@tencentcloud/tccc-sip-js 0.1.0

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/jssip.umd.js ADDED
@@ -0,0 +1 @@
1
+ ((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("trtc-js-sdk")):"function"==typeof define&&define.amd?define(["trtc-js-sdk"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).TCCCSIP=t(e.TRTC)})(this,function(j){var j=(j=j)&&"object"==typeof j&&"default"in j?j:{default:j},D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function M(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 V={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"},B=V,F={USER_AGENT:"".concat(B.title," ").concat(B.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 q(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 H(e,t,r){t=G(t);var n=e,t=Y()?Reflect.construct(t,r||[],G(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 c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(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,Q(n.key),n)}}function e(e,t,r){return t&&z(e.prototype,t),r&&z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function N(e,t){var r,n,o,i,s="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(s)return o=!(n=!0),{s:function(){s=s.call(e)},n:function(){var e=s.next();return n=e.done,e},e:function(e){o=!0,r=e},f:function(){try{n||null==s.return||s.return()}finally{if(o)throw r}}};if(Array.isArray(e)||(s=ee(e))||t&&e&&"number"==typeof e.length)return s&&(e=s),i=0,{s:t=function(){},n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},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 G(e){return(G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function K(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&&$(e,t)}function Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Y=function(){return!!e})()}function W(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 J(n){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?W(Object(o),!0).forEach(function(e){var t,r;t=n,r=o[e=e],(e=Q(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):W(Object(o)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))})}return n}function $(e,t){return($=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function X(e){return(e=>{if(Array.isArray(e))return q(e)})(e)||(()=>{if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)})()||ee(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 Q(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 Z(e){return(Z="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 ee(e,t){var r;if(e)return"string"==typeof e?q(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)?q(e,t):void 0}function te(e){var r="function"==typeof Map?new Map:void 0;return(te=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 Y()?Reflect.construct.apply(null,arguments):((n=[null]).push.apply(n,t),t=new(e.bind.apply(e,n)),r&&$(t,r.prototype),t)}(e,arguments,G(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),$(t,e)})(e)}K(me,te(Error));var re,ne,oe,ie,se,ae,ue,B=e(me),le=(K(fe,te(Error)),e(fe)),ce=(K(he,te(Error)),e(he));K(de,te(Error));var B={ConfigurationError:B,InvalidStateError:le,NotSupportedError:ce,NotReadyError:e(de)},pe={};function de(e){var t;return c(this,de),(t=H(this,de)).code=4,t.name="NOT_READY_ERROR",t.message=e,t}function he(e){var t;return c(this,he),(t=H(this,he)).code=3,t.name="NOT_SUPPORTED_ERROR",t.message=e,t}function fe(e){var t;return c(this,fe),(t=H(this,fe)).code=2,t.name="INVALID_STATE_ERROR",t.status=e,t.message="Invalid status: ".concat(e),t}function me(e,t){var r;return c(this,me),(r=H(this,me)).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}function Fr(){var o,t;return ne||(ne=1,o=qr(),t=ge(),re=e(i,[{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 i(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}}])),re;function i(e,t,r){if(c(this,i),!(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 ge(){return ie||(ie=1,(e={parse:function(g,u){var e={CRLF:M,DIGIT:l,ALPHA:s,HEXDIG:a,WSP:c,OCTET:r,DQUOTE:p,SP:d,HTAB:h,alphanum:o,reserved:V,unreserved:n,mark:B,escaped:f,LWS:m,SWS:v,HCOLON:F,TEXT_UTF8_TRIM:q,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:H,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=d())?h():e},word:E,STAR:z,SLASH:G,EQUAL:A,LPAREN:K,RPAREN:Y,RAQUOT:W,LAQUOT:J,COMMA:O,SEMI:x,COLON:$,LDQUOT:X,RDQUOT:Q,comment:function e(){var t,r,n,o=y;if(null!==(t=K())){for(r=[],null===(n=Z())&&null===(n=R())&&(n=e());null!==n;)r.push(n),null===(n=Z())&&null===(n=R())&&(n=e());null!==r&&null!==(n=Y())?t=[t,r,n]:(t=null,y=o)}else t=null,y=o;return t},ctext:Z,quoted_string:ee,quoted_string_clean:C,qdtext:te,quoted_pair:R,SIP_URI_noparams:re,SIP_URI:ne,uri_scheme:oe,uri_scheme_sips:ie,uri_scheme_sip:se,userinfo:ae,user:ue,user_unreserved:le,password:ce,hostport:pe,host:de,hostname:he,domainlabel:fe,toplabel:me,IPv6reference:ge,IPv6address:ye,h16:N,ls32:I,IPv4address:_e,dec_octet:ve,port:be,uri_parameters:Se,uri_parameter:Te,transport_param:we,user_param:Ee,method_param:Ae,ttl_param:Oe,maddr_param:xe,lr_param:Ce,other_param:Re,pname:Ne,pvalue:Ie,paramchar:Pe,param_unreserved:Ue,headers:ke,header:Le,hname:je,hvalue:De,hnv_unreserved:Me,Request_Response:function(){var e;return e=null===(e=ft())?Ve():e},Request_Line:Ve,Request_URI:Be,absoluteURI:Fe,hier_part:qe,net_path:He,abs_path:ze,opaque_part:Ge,uric:Ke,uric_no_slash:Ye,path_segments:We,segment:Je,param:$e,pchar:Xe,scheme:Qe,authority:Ze,srvr:et,reg_name:tt,query:rt,SIP_Version:nt,INVITEm:ot,ACKm:it,OPTIONSm:st,BYEm:at,CANCELm:ut,REGISTERm:lt,SUBSCRIBEm:ct,NOTIFYm:pt,REFERm:dt,Method:ht,Status_Line:ft,Status_Code:mt,extension_code:gt,Reason_Phrase:yt,Allow_Events:function(){var e,t,r,n,o,i=y;if(null!==(e=Mt())){for(t=[],o=y,null!==(r=O())&&null!==(n=Mt())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=Mt())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return e},Call_ID:function(){var e,t,r,n,o=y,i=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=i),null===(e=null!==e?void(D=g.substring(y,o)):e)&&(y=o),e},Contact:function(){var e,t,r,n,o,i,s=y;if(null===(e=z()))if(o=y,null!==(e=_t())){for(t=[],i=y,null!==(r=O())&&null!==(n=_t())?r=[r,n]:(r=null,y=i);null!==r;)t.push(r),i=y,null!==(r=O())&&null!==(n=_t())?r=[r,n]:(r=null,y=i);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=s),e},contact_param:_t,name_addr:P,display_name:vt,contact_params:bt,c_p_q:St,c_p_expires:Tt,delta_seconds:U,qvalue:wt,generic_param:k,gen_value:Et,Content_Disposition:function(){var e,t,r,n,o,i=y;if(null!==(e=At())){for(t=[],o=y,null!==(r=x())&&null!==(n=Ot())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Ot())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return e},disp_type:At,disp_param:Ot,handling_param:xt,Content_Encoding:function(){var e,t,r,n,o,i=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=i)}else e=null,y=i;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=Ct())?void(D=g.substring(y,t)):e)&&(y=t),e},media_type:Ct,m_type:Rt,discrete_type:Nt,composite_type:It,extension_token:Pt,x_token:Ut,m_subtype:kt,m_parameter:Lt,m_value:jt,CSeq:function(){var e,t,r,n=y;return null!==(e=Dt())&&null!==(t=m())&&null!==(r=ht())?e=[e,t,r]:(e=null,y=n),e},CSeq_value:Dt,Expires:function(){var e,t=y;return null===(e=null!==(e=U())?void(D=e):e)&&(y=t),e},Event:function(){var e,t,r,n,o,i=y,s=y;if(null!==(e=Mt())){for(t=[],o=y,null!==(r=x())&&null!==(n=k())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=k())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return null!==e&&(s=e[0],e=void(D.event=s.join("").toLowerCase())),null===e&&(y=i),e},event_type:Mt,From:function(){var e,t,r,n,o,i=y,s=y;if(null!==(e=null===(e=re())?P():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=Vt())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Vt())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;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=i),e},from_param:Vt,tag_param:Bt,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=U())?void(D=e):e)&&(y=t),e},Name_Addr_Header:function(){for(var e,t,r,n,o,i,s=y,a=y,u=[],l=vt();null!==l;)u.push(l),l=vt();if(null!==u)if(null!==(l=J()))if(null!==(e=ne()))if(null!==(t=W())){for(r=[],i=y,null!==(n=x())&&null!==(o=k())?n=[n,o]:(n=null,y=i);null!==n;)r.push(n),i=y,null!==(n=x())&&null!==(o=k())?n=[n,o]:(n=null,y=i);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=s),u},Proxy_Authenticate:Ft,challenge:Ft,other_challenge:qt,auth_param:Ht,digest_cln:zt,realm:Gt,realm_value:Kt,domain:Yt,URI:Wt,nonce:Jt,nonce_value:$t,opaque:Xt,stale:Qt,algorithm:Zt,qop_options:er,qop_value:tr,Proxy_Require:function(){var e,t,r,n,o,i=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=i)}else e=null,y=i;return e},Record_Route:function(){var e,t,r,n,o,i=y,s=y;if(null!==(e=rr())){for(t=[],o=y,null!==(r=O())&&null!==(n=rr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=rr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;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},rec_route:rr,Reason:function(){var e,t,r,n,o,i=y,s=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=nr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=nr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return null!==e&&(s=e[0],D.protocol=s.toLowerCase(),D.params||(D.params={}),e=void(D.params.text&&'"'===D.params.text[0]&&(s=D.params.text,D.text=s.substring(1,s.length-1),delete D.params.text))),null===e&&(y=i),e},reason_param:nr,reason_cause:or,Require:function(){var e,t,r,n,o,i=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=i)}else e=null,y=i;return e},Route:function(){var e,t,r,n,o,i=y;if(null!==(e=ir())){for(t=[],o=y,null!==(r=O())&&null!==(n=ir())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=ir())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return e},route_param:ir,Subscription_State:function(){var e,t,r,n,o,i=y;if(null!==(e=sr())){for(t=[],o=y,null!==(r=x())&&null!==(n=ar())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=ar())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return e},substate_value:sr,subexp_params:ar,event_reason_value:ur,Subject:function(){var e;return null!==(e=q())?e:""},Supported:function(){var e,t,r,n,o,i=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=i)}else e=null,y=i;return null!==e?e:""},To:function(){var e,t,r,n,o,i=y,s=y;if(null!==(e=null===(e=re())?P():e)){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 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=i),e},to_param:lr,Via:function(){var e,t,r,n,o,i=y;if(null!==(e=cr())){for(t=[],o=y,null!==(r=O())&&null!==(n=cr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=cr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return e},via_param:cr,via_params:pr,via_ttl:dr,via_maddr:hr,via_received:fr,via_branch:mr,response_port:gr,rport:yr,sent_protocol:_r,protocol_name:vr,transport:br,sent_by:Sr,via_host:Tr,via_port:wr,ttl:Er,WWW_Authenticate:Ft,Session_Expires:function(){var e,t,r,n,o,i=y;if(null!==(e=Ar())){for(t=[],o=y,null!==(r=x())&&null!==(n=Or())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&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 e},s_e_expires:Ar,s_e_params:Or,s_e_refresher:xr,extension_header:function(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=F())&&null!==(r=Cr())?e=[e,t,r]:(e=null,y=n),e},header_value:Cr,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=Rr())?e=[e,t]:(e=null,y=r),e},uuid:Rr,hex4:L,hex8:Nr,hex12:Ir,Refer_To:function(){var e,t,r,n,o,i=y,s=y;if(null!==(e=null===(e=re())?P():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=k())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=k())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return null===(e=null!==e?(()=>{try{D=new j(D.uri,D.display_name,D.params)}catch(e){D=-1}})():e)&&(y=i),e},Replaces:function(){var e,t,r,n,o,i=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=i)}else e=null,y=i;return e},call_id:Pr,replaces_param:Ur,to_tag:kr,from_tag:Lr,early_flag:jr};if(void 0!==u){if(void 0===e[u])throw new Error("Invalid rule name: "+Br(u)+".")}else u="CRLF";var y=0,i=0,t=[];function _(e){y<i||(i<y&&(i=y,t=[]),t.push(e))}function M(){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 s(){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=d())?h():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 d(){var e;return 32===g.charCodeAt(y)?(e=" ",y++):(e=null,_('" "')),e}function h(){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 V(){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())?B():e}function B(){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=[],i=c();null!==i;)o.push(i),i=c();if(null!==o&&null!==(i=M())?o=[o,i]:(o=null,y=n),null!==(o=null!==o?o:"")){if(null!==(e=c()))for(i=[];null!==e;)i.push(e),e=c();else i=null;null!==i?o=[o,i]:(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 F(){var e,t,r=y,n=y,o=[];for(null===(e=d())&&(e=h());null!==e;)o.push(e),null===(e=d())&&(e=h());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 q(){var e,t,r,n,o,i=y,s=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=s)}else e=null,y=s;return null===(e=null!==e?g.substring(y,i):e)&&(y=i),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 H(){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 G(){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 K(){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 Y(){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 W(){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 J(){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 $(){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 X(){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 Q(){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 Z(){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 ee(){var e,t,r,n,o=y,i=y;if(null!==(e=v()))if(null!==(t=p())){for(r=[],null===(n=te())&&(n=R());null!==n;)r.push(n),null===(n=te())&&(n=R());null!==r&&null!==(n=p())?e=[e,t,r,n]:(e=null,y=i)}else e=null,y=i;else e=null,y=i;return null===(e=null!==e?g.substring(y,o):e)&&(y=o),e}function C(){var e,t,r,n,o=y,i=y;if(null!==(e=v()))if(null!==(n=p())){for(t=[],null===(r=te())&&(r=R());null!==r;)t.push(r),null===(r=te())&&(r=R());null!==t&&null!==(r=p())?e=[e,n,t,r]:(e=null,y=i)}else e=null,y=i;else e=null,y=i;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 te(){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 re(){var e,t,r,n,o=y,i=y;return null!==(e=oe())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null!==(r=ae())?r:"")&&null!==(n=pe())?e=[e,t,r,n]:(e=null,y=i),null===(e=null!==e?(()=>{try{D.uri=new Vr(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 ne(){var e,t,r,n,o,i,s=y,a=y;return null!==(e=oe())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null!==(r=ae())?r:"")&&null!==(n=pe())&&null!==(o=Se())&&null!==(i=null!==(i=ke())?i:"")?e=[e,t,r,n,o,i]:(e=null,y=a),null===(e=null!==e?(()=>{try{D.uri=new Vr(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=s),e}function oe(){var e;return e=null===(e=ie())?se():e}function ie(){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 se(){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 ae(){var e,t,r,n,o=y,i=y;return null!==(e=ue())&&(n=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=ce())?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=i),null===(e=null!==e?void(D.user=decodeURIComponent(g.substring(y-1,o))):e)&&(y=o),e}function ue(){var e,t;if(null!==(t=null===(t=n())&&null===(t=f())?le():t))for(e=[];null!==t;)e.push(t),null===(t=n())&&null===(t=f())&&(t=le());else e=null;return e}function le(){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 ce(){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 pe(){var e,t,r,n,o=y;return null!==(e=de())&&(n=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=be())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function de(){var e,t=y;return null!==(e=null===(e=he())&&null===(e=_e())?ge():e)&&(D.host=g.substring(y,t).toLowerCase(),e=D.host),null===e&&(y=t),e}function he(){var e,t,r=y,n=y,o=[],i=y;for(null!==(e=fe())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t)?e=[e,t]:(e=null,y=i);null!==e;)o.push(e),i=y,null!==(e=fe())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t)?e=[e,t]:(e=null,y=i);return null!==o&&null!==(e=me())&&(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 fe(){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 me(){var e,t,r,n=y;if(null!==(e=s())){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 ge(){var e,t,r,n=y,o=y;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null!==e&&null!==(r=ye())&&(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 ye(){var e,t,r,n,o,i,s,a,u,l,c,p,d,h,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)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(s=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!==(h=I())?e=[e,t,r,n,o,i,s,a,u,l,c,p,h]:(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!==(i=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&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,i,s,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!==(i=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=I())?e=[e,t,r,n,o,i,s,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!==(i=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(a=I())?e=[e,t,r,n,o,i,s,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!==(i=I())?e=[e,t,r,n,o,i]:(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)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(s=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,i,s,a,u,l,c]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(d=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=d),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!==(i=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=I())?e=[e,t,r,n,o,i,s,a,u,l]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(d=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=d),null!==(t=null!==t?t:""))&&(d=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=d),null!==(r=null!==r?r:""))&&("::"===g.substr(y,2)?(n="::",y+=2):(n=null,_('"::"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(s=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=I())?e=[e,t,r,n,o,i,s,a,u]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(d=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=d),null!==(t=null!==t?t:""))&&(d=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=d),null!==(r=null!==r?r:""))&&(d=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=d),null!==(n=null!==n?n:""))&&("::"===g.substr(y,2)?(o="::",y+=2):(o=null,_('"::"')),null!==o)&&null!==(i=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(a=I())?e=[e,t,r,n,o,i,s,a]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(d=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=d),null!==(t=null!==t?t:""))&&(d=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=d),null!==(r=null!==r?r:""))&&(d=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=d),null!==(n=null!==n?n:""))&&(d=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(i=N())?o=[o,i]:(o=null,y=d),null!==(o=null!==o?o:""))&&("::"===g.substr(y,2)?(i="::",y+=2):(i=null,_('"::"')),null!==i)&&null!==(s=I())?e=[e,t,r,n,o,i,s]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(d=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=d),null!==(t=null!==t?t:""))&&(d=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=d),null!==(r=null!==r?r:""))&&(d=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=d),null!==(n=null!==n?n:""))&&(d=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(i=N())?o=[o,i]:(o=null,y=d),null!==(o=null!==o?o:""))&&(d=y,58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i&&null!==(s=N())?i=[i,s]:(i=null,y=d),null!==(i=null!==i?i:""))&&("::"===g.substr(y,2)?(s="::",y+=2):(s=null,_('"::"')),null!==s)&&null!==(a=N())?e=[e,t,r,n,o,i,s,a]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(d=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=d),null!==(t=null!==t?t:""))&&(d=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=d),null!==(r=null!==r?r:""))&&(d=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=d),null!==(n=null!==n?n:""))&&(d=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(i=N())?o=[o,i]:(o=null,y=d),null!==(o=null!==o?o:""))&&(d=y,58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i&&null!==(s=N())?i=[i,s]:(i=null,y=d),null!==(i=null!==i?i:""))&&(d=y,58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s&&null!==(a=N())?s=[s,a]:(s=null,y=d),null!==(s=null!==s?s:""))&&("::"===g.substr(y,2)?(a="::",y+=2):(a=null,_('"::"')),null!==a)?e=[e,t,r,n,o,i,s,a]:(e=null,y=m)),null!==e&&(h=f,D.host_type="IPv6",e=g.substring(y,h)),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?_e():e}function _e(){var e,t,r,n,o,i,s,a=y,u=y;return null!==(e=ve())&&(46===g.charCodeAt(y)?(s=".",y++):(s=null,_('"."')),null!==s)&&null!==(t=ve())&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r)&&null!==(n=ve())&&(46===g.charCodeAt(y)?(o=".",y++):(o=null,_('"."')),null!==o)&&null!==(i=ve())?e=[e,s,t,r,n,o,i]:(e=null,y=u),null!==e&&(s=a,D.host_type="IPv4",e=g.substring(y,s)),null===e&&(y=a),e}function ve(){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 be(){var e,t,r,n,o,i=y,s=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=s),null!==e&&(o=e,o=parseInt(o.join("")),e=D.port=o),null===e&&(y=i),e}function Se(){var e,t,r=[],n=y;for(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Te())?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=Te())?e=[e,t]:(e=null,y=n);return r}function Te(){var e;return e=null===(e=we())&&null===(e=Ee())&&null===(e=Ae())&&null===(e=Oe())&&null===(e=xe())&&null===(e=Ce())?Re():e}function we(){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 Ee(){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 Ae(){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=ht())?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 Oe(){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=Er())?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 xe(){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=de())?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 Ce(){var e,t,r,n,o=y,i=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=i),null!==e&&(D.uri_params||(D.uri_params={}),e=void(D.uri_params.lr=void 0)),null===e&&(y=o),e}function Re(){var e,t,r,n,o=y,i=y;return null!==(e=Ne())&&(n=y,61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t&&null!==(r=Ie())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=i),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 Ne(){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 Ie(){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 ke(){var e,t,r,n,o,i,s=y;if(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null!==e)if(null!==(t=Le())){for(r=[],i=y,38===g.charCodeAt(y)?(n="&",y++):(n=null,_('"&"')),null!==n&&null!==(o=Le())?n=[n,o]:(n=null,y=i);null!==n;)r.push(n),i=y,38===g.charCodeAt(y)?(n="&",y++):(n=null,_('"&"')),null!==n&&null!==(o=Le())?n=[n,o]:(n=null,y=i);null!==r?e=[e,t,r]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return e}function Le(){var e,t,r,n=y,o=y;return null!==(e=je())&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t)&&null!==(r=De())?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 je(){var e,t;if(null!==(t=null===(t=Me())&&null===(t=n())?f():t))for(e=[];null!==t;)e.push(t),null===(t=Me())&&null===(t=n())&&(t=f());else e=null;return e}function De(){var e,t=[];for(null===(e=Me())&&null===(e=n())&&(e=f());null!==e;)t.push(e),null===(e=Me())&&null===(e=n())&&(e=f());return t}function Me(){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 Ve(){var e,t,r,n,o,i=y;return null!==(e=ht())&&null!==(t=d())&&null!==(r=Be())&&null!==(n=d())&&null!==(o=nt())?e=[e,t,r,n,o]:(e=null,y=i),e}function Be(){var e;return e=null===(e=ne())?Fe():e}function Fe(){var e,t,r,n=y;return null!==(e=Qe())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null===(r=qe())?Ge():r)?e=[e,t,r]:(e=null,y=n),e}function qe(){var e,t,r,n,o=y;return null!==(e=null===(e=He())?ze():e)&&(n=y,63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null!==t&&null!==(r=rt())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function He(){var e,t,r,n=y;return"//"===g.substr(y,2)?(e="//",y+=2):(e=null,_('"//"')),null!==e&&null!==(t=Ze())&&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=We())?e=[e,t]:(e=null,y=r),e}function Ge(){var e,t,r,n=y;if(null!==(e=Ye())){for(t=[],r=Ke();null!==r;)t.push(r),r=Ke();null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function Ke(){var e;return e=null===(e=V())&&null===(e=n())?f():e}function Ye(){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 We(){var e,t,r,n,o,i=y;if(null!==(e=Je())){for(t=[],o=y,47===g.charCodeAt(y)?(r="/",y++):(r=null,_('"/"')),null!==r&&null!==(n=Je())?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=Je())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return e}function Je(){for(var e,t,r,n=y,o=[],i=Xe();null!==i;)o.push(i),i=Xe();if(null!==o){for(i=[],r=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=$e())?e=[e,t]:(e=null,y=r);null!==e;)i.push(e),r=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=$e())?e=[e,t]:(e=null,y=r);null!==i?o=[o,i]:(o=null,y=n)}else o=null,y=n;return o}function $e(){for(var e=[],t=Xe();null!==t;)e.push(t),t=Xe();return e}function Xe(){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 Qe(){var e,t,r,n=y,o=y;if(null!==(e=s())){for(t=[],null===(r=s())&&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=s())&&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 Ze(){var e;return e=null===(e=et())?tt():e}function et(){var e,t,r=y,n=y;return null!==(e=ae())&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t)?e=[e,t]:(e=null,y=n),null!==(e=null!==e?e:"")&&null!==(t=pe())?e=[e,t]:(e=null,y=r),null!==e?e:""}function tt(){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 rt(){for(var e=[],t=Ke();null!==t;)e.push(t),t=Ke();return e}function nt(){var e,t,r,n,o,i,s=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!==(i=l()))for(o=[];null!==i;)o.push(i),i=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,s)):e)&&(y=s),e}function ot(){var e;return"INVITE"===g.substr(y,6)?(e="INVITE",y+=6):(e=null,_('"INVITE"')),e}function it(){var e;return"ACK"===g.substr(y,3)?(e="ACK",y+=3):(e=null,_('"ACK"')),e}function st(){var e;return"OPTIONS"===g.substr(y,7)?(e="OPTIONS",y+=7):(e=null,_('"OPTIONS"')),e}function at(){var e;return"BYE"===g.substr(y,3)?(e="BYE",y+=3):(e=null,_('"BYE"')),e}function ut(){var e;return"CANCEL"===g.substr(y,6)?(e="CANCEL",y+=6):(e=null,_('"CANCEL"')),e}function lt(){var e;return"REGISTER"===g.substr(y,8)?(e="REGISTER",y+=8):(e=null,_('"REGISTER"')),e}function ct(){var e;return"SUBSCRIBE"===g.substr(y,9)?(e="SUBSCRIBE",y+=9):(e=null,_('"SUBSCRIBE"')),e}function pt(){var e;return"NOTIFY"===g.substr(y,6)?(e="NOTIFY",y+=6):(e=null,_('"NOTIFY"')),e}function dt(){var e;return"REFER"===g.substr(y,5)?(e="REFER",y+=5):(e=null,_('"REFER"')),e}function ht(){var e,t=y;return null!==(e=null===(e=ot())&&null===(e=it())&&null===(e=st())&&null===(e=at())&&null===(e=ut())&&null===(e=lt())&&null===(e=ct())&&null===(e=pt())&&null===(e=dt())?w():e)&&(D.method=g.substring(y,t),e=D.method),null===e&&(y=t),e}function ft(){var e,t,r,n,o,i=y;return null!==(e=nt())&&null!==(t=d())&&null!==(r=mt())&&null!==(n=d())&&null!==(o=yt())?e=[e,t,r,n,o]:(e=null,y=i),e}function mt(){var e,t,r=y;return null!==(e=gt())&&(t=e,e=void(D.status_code=parseInt(t.join("")))),null===e&&(y=r),e}function gt(){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 yt(){var e,t=y,r=[];for(null===(e=V())&&null===(e=n())&&null===(e=f())&&null===(e=S())&&null===(e=T())&&null===(e=d())&&(e=h());null!==e;)r.push(e),null===(e=V())&&null===(e=n())&&null===(e=f())&&null===(e=S())&&null===(e=T())&&null===(e=d())&&(e=h());return null===(r=null!==r?void(D.reason_phrase=g.substring(y,t)):r)&&(y=t),r}function _t(){var e,t,r,n,o,i=y,s=y;if(null!==(e=null===(e=re())?P():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=bt())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&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 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})})(i):e)&&(y=i),e}function P(){var e,t,r,n,o=y;return null!==(e=null!==(e=vt())?e:"")&&null!==(t=J())&&null!==(r=ne())&&null!==(n=W())?e=[e,t,r,n]:(e=null,y=o),e}function vt(){var e,t,r,n,o,i=y,s=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=s)}else e=null,y=s;return null!==(e=null===e?C():e)&&(s=e,e=void(D.display_name="string"==typeof s?s:s[1].reduce(function(e,t){return e+t[0]+t[1]},s[0]))),null===e&&(y=i),e}function bt(){var e;return e=null===(e=St())&&null===(e=Tt())?k():e}function St(){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=wt())?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 Tt(){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],D.params||(D.params={}),e=void(D.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 wt(){var e,t,r,n,o,i,s=y,a=y;return 48===g.charCodeAt(y)?(e="0",y++):(e=null,_('"0"')),null!==e&&(i=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=i),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=a),null===(e=null!==e?parseFloat(g.substring(y,s)):e)&&(y=s),e}function k(){var e,t,r,n,o=y,i=y;return null!==(e=w())&&(n=y,null!==(t=A())&&null!==(r=Et())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=i),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 Et(){var e;return e=null===(e=w())&&null===(e=de())?ee():e}function At(){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 Ot(){var e;return e=null===(e=xt())?k():e}function xt(){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 Ct(){var e,t,r,n,o,i,s,a=y;if(null!==(e=Rt()))if(null!==(t=G()))if(null!==(r=kt())){for(n=[],s=y,null!==(o=x())&&null!==(i=Lt())?o=[o,i]:(o=null,y=s);null!==o;)n.push(o),s=y,null!==(o=x())&&null!==(i=Lt())?o=[o,i]:(o=null,y=s);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 Rt(){var e;return e=null===(e=Nt())?It():e}function Nt(){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 It(){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 kt(){var e;return e=null===(e=Pt())?w():e}function Lt(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=A())&&null!==(r=jt())?e=[e,t,r]:(e=null,y=n),e}function jt(){var e;return e=null===(e=w())?ee():e}function Dt(){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 Mt(){var e,t,r,n,o,i=y;if(null!==(e=H())){for(t=[],o=y,46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r&&null!==(n=H())?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=H())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return e}function Vt(){var e;return e=null===(e=Bt())?k():e}function Bt(){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 Ft(){var e,t,r,n,o,i,s,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=[],s=y,null!==(o=O())&&null!==(i=zt())?o=[o,i]:(o=null,y=s);null!==o;)n.push(o),s=y,null!==(o=O())&&null!==(i=zt())?o=[o,i]:(o=null,y=s);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?qt():e}function qt(){var e,t,r,n,o,i,s,a=y;if(null!==(e=w()))if(null!==(t=m()))if(null!==(r=Ht())){for(n=[],s=y,null!==(o=O())&&null!==(i=Ht())?o=[o,i]:(o=null,y=s);null!==o;)n.push(o),s=y,null!==(o=O())&&null!==(i=Ht())?o=[o,i]:(o=null,y=s);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 Ht(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=A())&&null!==(r=null===(r=w())?ee():r)?e=[e,t,r]:(e=null,y=n),e}function zt(){var e;return e=null===(e=Gt())&&null===(e=Yt())&&null===(e=Jt())&&null===(e=Xt())&&null===(e=Qt())&&null===(e=Zt())&&null===(e=er())?Ht():e}function Gt(){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=Kt())?e=[e,t,r]:(e=null,y=n),e}function Kt(){var e,t,r=y;return null!==(e=C())&&(t=e,e=void(D.realm=t)),null===e&&(y=r),e}function Yt(){var e,t,r,n,o,i,s,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=X()))if(null!==(n=Wt())){if(o=[],a=y,null!==(s=d()))for(i=[];null!==s;)i.push(s),s=d();else i=null;for(null!==i&&null!==(s=Wt())?i=[i,s]:(i=null,y=a);null!==i;){if(o.push(i),a=y,null!==(s=d()))for(i=[];null!==s;)i.push(s),s=d();else i=null;null!==i&&null!==(s=Wt())?i=[i,s]:(i=null,y=a)}null!==o&&null!==(i=Q())?e=[e,t,r,n,o,i]:(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 Wt(){var e;return e=null===(e=Fe())?ze():e}function Jt(){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=$t())?e=[e,t,r]:(e=null,y=n),e}function $t(){var e,t,r=y;return null!==(e=C())&&(t=e,e=void(D.nonce=t)),null===e&&(y=r),e}function Xt(){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 Qt(){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 Zt(){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 er(){var e,t,r,n,o,i,s,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=X())){if(a=y,null!==(n=tr())){for(o=[],u=y,44===g.charCodeAt(y)?(i=",",y++):(i=null,_('","')),null!==i&&null!==(s=tr())?i=[i,s]:(i=null,y=u);null!==i;)o.push(i),u=y,44===g.charCodeAt(y)?(i=",",y++):(i=null,_('","')),null!==i&&null!==(s=tr())?i=[i,s]:(i=null,y=u);null!==o?n=[n,o]:(n=null,y=a)}else n=null,y=a;null!==n&&null!==(o=Q())?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 tr(){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 rr(){var e,t,r,n,o,i=y,s=y;if(null!==(e=P())){for(t=[],o=y,null!==(r=x())&&null!==(n=k())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=k())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;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})})(i):e)&&(y=i),e}function nr(){var e;return e=null===(e=or())?k():e}function or(){var e,t,r,n,o=y,i=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=i)}else e=null,y=i;else e=null,y=i;return null!==e&&(n=e[2],e=void(D.cause=parseInt(n.join("")))),null===e&&(y=o),e}function ir(){var e,t,r,n,o,i=y;if(null!==(e=P())){for(t=[],o=y,null!==(r=x())&&null!==(n=k())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=k())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return e}function sr(){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 ar(){var e,t,r,n,o=y,i=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=ur())?e=[e,t,r]:(e=null,y=i),null===(e=null!==e?void(void 0!==(n=e[2])&&(D.reason=n)):e)&&(y=o),e=null===e&&(i=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=i),null===(e=null!==e?void(void 0!==(n=e[2])&&(D.expires=n)):e)&&(y=o),null===e)&&(i=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=i),null===(e=null!==e?void(void 0!==(n=e[2])&&(D.retry_after=n)):e)&&(y=o),null===e)?k():e}function ur(){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 lr(){var e;return e=null===(e=Bt())?k():e}function cr(){var e,t,r,n,o,i,s,a=y;if(null!==(e=_r()))if(null!==(t=m()))if(null!==(r=Sr())){for(n=[],s=y,null!==(o=x())&&null!==(i=pr())?o=[o,i]:(o=null,y=s);null!==o;)n.push(o),s=y,null!==(o=x())&&null!==(i=pr())?o=[o,i]:(o=null,y=s);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 pr(){var e;return e=null===(e=dr())&&null===(e=hr())&&null===(e=fr())&&null===(e=mr())&&null===(e=gr())?k():e}function dr(){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=Er())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(D.ttl=r)),null===e&&(y=n),e}function hr(){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=de())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(D.maddr=r)),null===e&&(y=n),e}function fr(){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=_e())?ye():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 mr(){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 gr(){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=yr())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function yr(){var e,t,r,n,o,i=y,s=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=s),null!==e&&(o=e,e=void(D.rport=parseInt(o.join("")))),null===e&&(y=i),e}function _r(){var e,t,r,n,o,i=y;return null!==(e=vr())&&null!==(t=G())&&null!==(r=w())&&null!==(n=G())&&null!==(o=br())?e=[e,t,r,n,o]:(e=null,y=i),e}function vr(){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 br(){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 Sr(){var e,t,r,n,o=y;return null!==(e=Tr())&&(n=y,null!==(t=$())&&null!==(r=wr())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function Tr(){var e,t=y;return null===(e=null!==(e=null===(e=_e())&&null===(e=ge())?he():e)?void(D.host=g.substring(y,t)):e)&&(y=t),e}function wr(){var e,t,r,n,o,i=y,s=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=s),null!==e&&(o=e,e=void(D.port=parseInt(o.join("")))),null===e&&(y=i),e}function Er(){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 Ar(){var e,t,r=y;return null!==(e=U())&&(t=e,e=void(D.expires=t)),null===e&&(y=r),e}function Or(){var e;return e=null===(e=xr())?k():e}function xr(){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 Cr(){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 Rr(){var e,t,r,n,o,i,s,a,u,l=y,c=y;return null!==(e=Nr())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null!==t)&&null!==(r=L())&&(45===g.charCodeAt(y)?(n="-",y++):(n=null,_('"-"')),null!==n)&&null!==(o=L())&&(45===g.charCodeAt(y)?(i="-",y++):(i=null,_('"-"')),null!==i)&&null!==(s=L())&&(45===g.charCodeAt(y)?(a="-",y++):(a=null,_('"-"')),null!==a)&&null!==(u=Ir())?e=[e,t,r,n,o,i,s,a,u]:(e=null,y=c),null!==e&&(e[0],e=void(D=g.substring(y+5,l))),null===e&&(y=l),e}function L(){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 Nr(){var e,t,r=y;return null!==(e=L())&&null!==(t=L())?e=[e,t]:(e=null,y=r),e}function Ir(){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 Pr(){var e,t,r,n,o=y,i=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=i),null===(e=null!==e?void(D.call_id=g.substring(y,o)):e)&&(y=o),e}function Ur(){var e;return e=null===(e=kr())&&null===(e=Lr())&&null===(e=jr())?k():e}function kr(){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 Lr(){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 jr(){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 Dr,Mr,Vr=qr(),j=Fr(),D={};return null===e[u]()||y!==g.length?(Dr=(e=Math.max(y,i))<g.length?g.charAt(e):null,Mr=(()=>{for(var e=1,t=1,r=!1,n=0;n<Math.max(y,i);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),Dr,e,Mr.line,Mr.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?Br(t):"end of input")+" found."})(e,t),this.offset=r,this.line=n,this.column=o}}).SyntaxError.prototype=Error.prototype,oe=e),oe;function Br(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 qr(){var u,a,t;return ae||(ae=1,u=F,a=ye(),t=ge(),se=e(l,[{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 l(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,i=N(this._headers[t]);try{for(i.s();!(o=i.n()).done;){var s=o.value;r.push("".concat(t,"=").concat(s))}}catch(r){i.e(r)}finally{i.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}}])),se;function l(e,t,r,n){var o,i,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{},a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:{};if(c(this,l),!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,s)Object.prototype.hasOwnProperty.call(s,o)&&this.setParam(o,s[o]);for(i in a)Object.prototype.hasOwnProperty.call(a,i)&&this.setHeader(i,a[i])}}function ye(){var i,s,t,a,e,u;return ue||(ue=1,i=F,s=qr(),t=ge(),pe.str_utf8_length=function(e){return unescape(encodeURIComponent(e)).length},a=pe.isFunction=function(e){return void 0!==e&&"[object Function]"===Object.prototype.toString.call(e)},pe.isString=function(e){return void 0!==e&&"[object String]"===Object.prototype.toString.call(e)},pe.isDecimal=function(e){return!isNaN(e)&&parseFloat(e)===parseInt(e,10)},pe.isEmpty=function(e){return null===e||""===e||void 0===e||Array.isArray(e)&&0===e.length||"number"==typeof e&&isNaN(e)},pe.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,i=r;o<i.length;o++){var s=i[o];if(a(e[s]))return!1}return!0},e=pe.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},pe.newTag=function(){return e(10)},pe.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)})},pe.hostType=function(e){return e&&-1!==(e=t.parse(e,"host"))?e.host_type:void 0},u=pe.escapeUser=function(e){return encodeURIComponent(decodeURIComponent(e)).replace(/%3A/gi,":").replace(/%2B/gi,"+").replace(/%3F/gi,"?").replace(/%2F/gi,"/")},pe.normalizeTarget=function(e,t){if(e){if(e instanceof s)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(u(r),"@").concat(n),s.parse(e)||void 0}}},pe.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,i=0;i<o;i++)0!==i&&(n+="-"),n+=r[i].charAt(0).toUpperCase()+r[i].substring(1);return n=t[n]?t[n]:n},pe.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},pe.getRandomTestNetIP=function(){return"192.0.2.".concat(Math.floor(254*Math.random()+1))},pe.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,i=1073741824&t,e=(1073741823&e)+(1073741823&t);return o&i?2147483648^e^r^n:o|i?1073741824&e?3221225472^e^r^n:1073741824^e^r^n:e^r^n}function t(e,t,r,n,o,i,s){return e=u(e,u(u(t&r|~t&n,o),s)),u(a(e,i),t)}function r(e,t,r,n,o,i,s){return e=u(e,u(u(t&n|r&~n,o),s)),u(a(e,i),t)}function n(e,t,r,n,o,i,s){return e=u(e,u(u(t^r^n,o),s)),u(a(e,i),t)}function o(e,t,r,n,o,i,s){return e=u(e,u(u(r^(t|~n),o),s)),u(a(e,i),t)}function i(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 s,l,c,p,d=(e=>{for(var t,r=e.length,n=16*(((n=r+8)-n%64)/64+1),o=new Array(n-1),i=0,s=0;s<r;)i=s%4*8,o[t=(s-s%4)/4]=o[t]|e.charCodeAt(s)<<i,s++;return o[t=(s-s%4)/4]=o[t]|128<<(i=s%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)),h=1732584193,f=4023233417,m=2562383102,g=271733878,y=0;y<d.length;y+=16)h=t(s=h,l=f,c=m,p=g,d[y+0],7,3614090360),g=t(g,h,f,m,d[y+1],12,3905402710),m=t(m,g,h,f,d[y+2],17,606105819),f=t(f,m,g,h,d[y+3],22,3250441966),h=t(h,f,m,g,d[y+4],7,4118548399),g=t(g,h,f,m,d[y+5],12,1200080426),m=t(m,g,h,f,d[y+6],17,2821735955),f=t(f,m,g,h,d[y+7],22,4249261313),h=t(h,f,m,g,d[y+8],7,1770035416),g=t(g,h,f,m,d[y+9],12,2336552879),m=t(m,g,h,f,d[y+10],17,4294925233),f=t(f,m,g,h,d[y+11],22,2304563134),h=t(h,f,m,g,d[y+12],7,1804603682),g=t(g,h,f,m,d[y+13],12,4254626195),m=t(m,g,h,f,d[y+14],17,2792965006),h=r(h,f=t(f,m,g,h,d[y+15],22,1236535329),m,g,d[y+1],5,4129170786),g=r(g,h,f,m,d[y+6],9,3225465664),m=r(m,g,h,f,d[y+11],14,643717713),f=r(f,m,g,h,d[y+0],20,3921069994),h=r(h,f,m,g,d[y+5],5,3593408605),g=r(g,h,f,m,d[y+10],9,38016083),m=r(m,g,h,f,d[y+15],14,3634488961),f=r(f,m,g,h,d[y+4],20,3889429448),h=r(h,f,m,g,d[y+9],5,568446438),g=r(g,h,f,m,d[y+14],9,3275163606),m=r(m,g,h,f,d[y+3],14,4107603335),f=r(f,m,g,h,d[y+8],20,1163531501),h=r(h,f,m,g,d[y+13],5,2850285829),g=r(g,h,f,m,d[y+2],9,4243563512),m=r(m,g,h,f,d[y+7],14,1735328473),h=n(h,f=r(f,m,g,h,d[y+12],20,2368359562),m,g,d[y+5],4,4294588738),g=n(g,h,f,m,d[y+8],11,2272392833),m=n(m,g,h,f,d[y+11],16,1839030562),f=n(f,m,g,h,d[y+14],23,4259657740),h=n(h,f,m,g,d[y+1],4,2763975236),g=n(g,h,f,m,d[y+4],11,1272893353),m=n(m,g,h,f,d[y+7],16,4139469664),f=n(f,m,g,h,d[y+10],23,3200236656),h=n(h,f,m,g,d[y+13],4,681279174),g=n(g,h,f,m,d[y+0],11,3936430074),m=n(m,g,h,f,d[y+3],16,3572445317),f=n(f,m,g,h,d[y+6],23,76029189),h=n(h,f,m,g,d[y+9],4,3654602809),g=n(g,h,f,m,d[y+12],11,3873151461),m=n(m,g,h,f,d[y+15],16,530742520),h=o(h,f=n(f,m,g,h,d[y+2],23,3299628645),m,g,d[y+0],6,4096336452),g=o(g,h,f,m,d[y+7],10,1126891415),m=o(m,g,h,f,d[y+14],15,2878612391),f=o(f,m,g,h,d[y+5],21,4237533241),h=o(h,f,m,g,d[y+12],6,1700485571),g=o(g,h,f,m,d[y+3],10,2399980690),m=o(m,g,h,f,d[y+10],15,4293915773),f=o(f,m,g,h,d[y+1],21,2240044497),h=o(h,f,m,g,d[y+8],6,1873313359),g=o(g,h,f,m,d[y+15],10,4264355552),m=o(m,g,h,f,d[y+6],15,2734768916),f=o(f,m,g,h,d[y+13],21,1309151649),h=o(h,f,m,g,d[y+4],6,4149444226),g=o(g,h,f,m,d[y+11],10,3174756917),m=o(m,g,h,f,d[y+2],15,718787259),f=o(f,m,g,h,d[y+9],21,3951481745),h=u(h,s),f=u(f,l),m=u(m,c),g=u(g,p);return(i(h)+i(f)+i(m)+i(g)).toLowerCase()},pe.closeMediaStream=function(e){if(e)try{if(e.getTracks){var t,r=N(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=N(e.getAudioTracks());try{for(o.s();!(n=o.n()).done;)n.value.stop()}catch(e){o.e(e)}finally{o.f()}var i,s=N(e.getVideoTracks());try{for(s.s();!(i=s.n()).done;)i.value.stop()}catch(e){s.e(e)}finally{s.f()}}}catch(t){"function"!=typeof e.stop&&"object"!==Z(e.stop)||e.stop()}},pe.cloneArray=function(e){return e&&e.slice()||[]},pe.cloneObject=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return e&&Object.assign({},e)||t},pe.toPlainObject=function(r){var n;return"object"!==Z(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"===Z(t)||"object"===Z(t)&&t.constructor!==Object||(n[e]=t)}),n)},pe.isMiniProgram=function(){return"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfo&&"undefined"==typeof window}),pe}function _e(){}function t(){t.init.call(this)}function ve(e){return void 0===e._maxListeners?t.defaultMaxListeners:e._maxListeners}function be(e,t,r,n){var o,i;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),i=o[t]):(o=e._events=new _e,e._eventsCount=0),i?("function"==typeof i?i=o[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),!i.warned&&(n=ve(e))&&0<n&&i.length>n&&(i.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=i.length,n=n,"function"==typeof console.warn?console.warn(n):console.log(n))):(i=o[t]=r,++e._eventsCount),e}function Se(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 Te(e){var t=this._events;if(t){t=t[e];if("function"==typeof t)return 1;if(t)return t.length}return 0}function we(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}_e.prototype=Object.create(null),(t.EventEmitter=t).usingDomains=!1,t.prototype.domain=void 0,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.init=function(){this.domain=null,t.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new _e,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},t.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},t.prototype.getMaxListeners=function(){return ve(this)},t.prototype.emit=function(e){var t,r,n,o,i,s="error"===e;if(i=this._events)s=s&&null==i.error;else if(!s)return!1;if(a=this.domain,s){if(s=arguments[1],a)return(s=s||new Error('Uncaught, unspecified "error" event')).domainEmitter=this,s.domain=a,s.domainThrown=!1,a.emit("error",s),!1;if(s instanceof Error)throw s;var a=new Error('Uncaught, unspecified "error" event. ('+s+")");throw a.context=s,a}if(!(t=i[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,L=we(l,p),d=0;d<p;++d)L[d].call(c);break;case 2:var l=t,h=u,f=this,m=arguments[1];if(h)l.call(f,m);else for(var g=l.length,j=we(l,g),y=0;y<g;++y)j[y].call(f,m);break;case 3:var h=t,_=u,v=this,b=arguments[1],S=arguments[2];if(_)h.call(v,b,S);else for(var T=h.length,D=we(h,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=we(_,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,P=n;if(u)E.apply(I,P);else for(var U=E.length,V=we(E,U),k=0;k<U;++k)V[k].apply(I,P)}return!0},t.prototype.on=t.prototype.addListener=function(e,t){return be(this,e,t,!1)},t.prototype.prependListener=function(e,t){return be(this,e,t,!0)},t.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,Se(this,e,t)),this},t.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,Se(this,e,t)),this},t.prototype.removeListener=function(e,t){var r,n,o,i,s;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 _e:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length;0<i--;)if(r[i]===t||r[i].listener&&r[i].listener===t){s=r[i].listener,o=i;break}if(o<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new _e,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,s||t)}return this},t.prototype.off=function(e,t){return this.removeListener(e,t)},t.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),i=0;i<o.length;++i)"removeListener"!==(n=o[i])&&this.removeAllListeners(n);this.removeAllListeners("removeListener"),this._events=new _e,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 _e,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new _e:delete r[e]);return this},t.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[]}},t.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Te.call(e,t)},t.prototype.listenerCount=Te,t.prototype.eventNames=function(){return 0<this._eventsCount?Reflect.ownKeys(this._events):[]};var le=M(Object.freeze({__proto__:null,default:t,EventEmitter:t})),Ee="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function Ae(){throw new Error("setTimeout has not been defined")}function Oe(){throw new Error("clearTimeout has not been defined")}var xe=Ae,Ce=Oe;function Re(t){if(xe===setTimeout)return setTimeout(t,0);if((xe===Ae||!xe)&&setTimeout)return(xe=setTimeout)(t,0);try{return xe(t,0)}catch(e){try{return xe.call(null,t,0)}catch(e){return xe.call(this,t,0)}}}"function"==typeof Ee.setTimeout&&(xe=setTimeout),"function"==typeof Ee.clearTimeout&&(Ce=clearTimeout);var Ne,Ie=[],Pe=!1,Ue=-1;function ke(){Pe&&Ne&&(Pe=!1,Ne.length?Ie=Ne.concat(Ie):Ue=-1,Ie.length)&&Le()}function Le(){if(!Pe){var e=Re(ke);Pe=!0;for(var t=Ie.length;t;){for(Ne=Ie,Ie=[];++Ue<t;)Ne&&Ne[Ue].run();Ue=-1,t=Ie.length}Ne=null,Pe=!1,function(t){if(Ce===clearTimeout)return clearTimeout(t);if((Ce===Oe||!Ce)&&clearTimeout)return(Ce=clearTimeout)(t);try{Ce(t)}catch(e){try{return Ce.call(null,t)}catch(e){return Ce.call(this,t)}}}(e)}}function je(e,t){this.fun=e,this.array=t}function De(){}je.prototype.run=function(){this.fun.apply(null,this.array)};var Me,Ve,ce=De,Be=De,r=De,n=De,o=De,Fe=De,i=De,qe=Ee.performance||{},He=qe.now||qe.mozNow||qe.msNow||qe.oNow||qe.webkitNow||function(){return(new Date).getTime()},ze=new Date,Ge={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];Ie.push(new je(e,t)),1!==Ie.length||Pe||Re(Le)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ce,addListener:Be,once:r,off:n,removeListener:o,removeAllListeners:Fe,emit:i,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*He.call(qe),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-ze)/1e3}},ce={exports:{}};function Ke(){if(Ve)return Me;Ve=1;var o=1e3,i=60*o,s=60*i,a=24*s,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 Me=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"):s<=t?c(r,t,s,"hour"):i<=t?c(r,t,i,"minute"):o<=t?c(r,t,o,"second"):r+" ms"):(t=e,r=Math.abs(t),a<=r?Math.round(t/a)+"d":s<=r?Math.round(t/s)+"h":i<=r?Math.round(t/i)+"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*s;case"minutes":case"minute":case"mins":case"min":case"m":return n*i;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 Ye,We,Je;function a(e){let r,t,n,o=null;function s(...i){if(s.enabled){let n=s,e=Number(new Date),t=e-(r||e),o=(n.diff=t,n.prev=r,n.curr=e,r=e,i[0]=a.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O"),0);i[0]=i[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if("%%"===t)return"%";o++;r=a.formatters[r];if("function"==typeof r){let e=i[o];t=r.call(n,e),i.splice(o,1),o--}return t}),a.formatArgs.call(n,i),(n.log||a.log).apply(n,i)}}return s.namespace=e,s.useColors=a.useColors(),s.color=a.selectColor(e),s.extend=$e,s.destroy=a.destroy,Object.defineProperty(s,"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(s),s}function $e(e,t){t=a(this.namespace+(void 0===t?":":t)+e);return t.log=this.log,t}function Xe(e,t){let r=0,n=0,o=-1,i=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(o=n,i=r):r++,n++;else{if(-1===o)return;n=o+1,i++,r=i}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}(We=(Ye=ce).exports).formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Ye.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)}},We.save=function(e){try{e?We.storage.setItem("debug",e):We.storage.removeItem("debug")}catch(e){}},We.load=function(){let e;try{e=We.storage.getItem("debug")||We.storage.getItem("DEBUG")}catch(e){}return e=!e&&"env"in Ge?Ge.env.DEBUG:e},We.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+)/)},We.storage=(()=>{try{return localStorage}catch(e){}})(),We.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`."))}})(),We.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"],We.log=console.debug||console.log||(()=>{}),Ye.exports=(Je=We,((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(Xe(e,t))return!1;for(var r of a.names)if(Xe(e,r))return!0;return!1},a.humanize=Ke(),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(Je).forEach(e=>{a[e]=Je[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),Ye.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}};var Be={},Qe=[],Ze=[],et="undefined"!=typeof Uint8Array?Uint8Array:Array,tt=!1;function rt(){tt=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)Qe[t]=e[t],Ze[e.charCodeAt(t)]=t;Ze["-".charCodeAt(0)]=62,Ze["_".charCodeAt(0)]=63}function nt(e,t,r){for(var n,o=[],i=t;i<r;i+=3)n=(e[i]<<16)+(e[i+1]<<8)+e[i+2],o.push(Qe[n>>18&63]+Qe[n>>12&63]+Qe[n>>6&63]+Qe[63&n]);return o.join("")}function ot(e){var t;tt||rt();for(var r=e.length,n=r%3,o="",i=[],s=0,a=r-n;s<a;s+=16383)i.push(nt(e,s,a<s+16383?a:s+16383));return 1==n?(t=e[r-1],o=(o+=Qe[t>>2])+Qe[t<<4&63]+"=="):2==n&&(t=(e[r-2]<<8)+e[r-1],o=(o=(o+=Qe[t>>10])+Qe[t>>4&63])+Qe[t<<2&63]+"="),i.push(o),i.join("")}function it(e,t,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,l=u>>1,c=-7,p=r?o-1:0,d=r?-1:1,o=e[t+p];for(p+=d,i=o&(1<<-c)-1,o>>=-c,c+=a;0<c;i=256*i+e[t+p],p+=d,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;0<c;s=256*s+e[t+p],p+=d,c-=8);if(0===i)i=1-l;else{if(i===u)return s?NaN:1/0*(o?-1:1);s+=Math.pow(2,n),i-=l}return(o?-1:1)*s*Math.pow(2,i-n)}function st(e,t,r,n,o,i){var s,a,u=8*i-o-1,l=(1<<u)-1,c=l>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,h=n?1:-1,i=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?p/n:p*Math.pow(2,1-c))*n&&(s++,n/=2),l<=s+c?(a=0,s=l):1<=s+c?(a=(t*n-1)*Math.pow(2,o),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,o),s=0));8<=o;e[r+d]=255&a,d+=h,a/=256,o-=8);for(s=s<<o|a,u+=o;0<u;e[r+d]=255&s,d+=h,s/=256,u-=8);e[r+d-h]|=128*i}var at={}.toString,ut=Array.isArray||function(e){return"[object Array]"==at.call(e)};function lt(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ct(e,t){if(lt()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(e=null===e?new u(t):e).length=t,e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"!=typeof e)return pt(this,e,t,r);if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return ht(this,e)}function pt(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,i=t,s=r;if(i.byteLength,s<0||i.byteLength<s)throw new RangeError("'offset' is out of bounds");if(i.byteLength<s+(n||0))throw new RangeError("'length' is out of bounds");return i=void 0===s&&void 0===n?new Uint8Array(i):void 0===n?new Uint8Array(i,s):new Uint8Array(i,s,n),u.TYPED_ARRAY_SUPPORT?(o=i).__proto__=u.prototype:o=ft(o,i),o}if("string"==typeof t){s=e,n=t,i=r;if(u.isEncoding(i="string"==typeof i&&""!==i?i:"utf8"))return(n=(s=ct(s,o=0|yt(n,i))).write(n,i))!==o?s.slice(0,n):s;throw new TypeError('"encoding" must be a valid string encoding')}var a,r=e,n=t;if(gt(n))return 0!==(r=ct(r,a=0|mt(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?ct(r,0):ft(r,n);if("Buffer"===n.type&&ut(n.data))return ft(r,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function dt(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 ht(e,t){if(dt(t),e=ct(e,t<0?0:0|mt(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function ft(e,t){var r=t.length<0?0:0|mt(t.length);e=ct(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function mt(e){if(lt()<=e)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+lt().toString(16)+" bytes");return 0|e}function gt(e){return null!=e&&e._isBuffer}function yt(e,t){if(gt(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 kt(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Lt(e).length;default:if(n)return kt(e).length;t=(""+t).toLowerCase(),n=!0}}function _t(e,t,r){var n,o=!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":var i=this,s=t,a=r,u=i.length;(!a||a<0||u<a)&&(a=u);for(var l="",c=s=!s||s<0?0:s;c<a;++c)l+=(e=>e<16?"0"+e.toString(16):e.toString(16))(i[c]);return l;case"utf8":case"utf-8":return Et(this,t,r);case"ascii":var p=this,u=t,d=r,h="";d=Math.min(p.length,d);for(var f=u;f<d;++f)h+=String.fromCharCode(127&p[f]);return h;case"latin1":case"binary":var m=this,s=t,g=r,y="";g=Math.min(m.length,g);for(var _=s;_<g;++_)y+=String.fromCharCode(m[_]);return y;case"base64":return v=this,n=r,0===(b=t)&&n===v.length?ot(v):ot(v.slice(b,n));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":for(var v=t,b=r,S=this.slice(v,b),T="",w=0;w<S.length;w+=2)T+=String.fromCharCode(S[w]+256*S[w+1]);return T;default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function vt(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function bt(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(gt(t="string"==typeof t?u.from(t,n):t))return 0===t.length?-1:St(e,t,r,n,o);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(o?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):St(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function St(e,t,r,n,o){var i=1,s=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;s/=i=2,a/=2,r/=2}function u(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o)for(var l=-1,c=r;c<s;c++)if(u(e,c)===u(t,-1===l?0:c-l)){if(c-(l=-1===l?c:l)+1===a)return l*i}else-1!==l&&(c-=c-l),l=-1;else for(c=r=s<r+a?s-a:r;0<=c;c--){for(var p=!0,d=0;d<a;d++)if(u(e,c+d)!==u(t,d)){p=!1;break}if(p)return c}return-1}function Tt(e,t,r,n){return jt((e=>{for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t})(t),e,r,n)}function wt(e,t,r,n){return jt(((e,t)=>{for(var r,n,o=[],i=0;i<e.length&&!((t-=2)<0);++i)n=(r=e.charCodeAt(i))>>8,o.push(r%256),o.push(n);return o})(t,e.length-r),e,r,n)}function Et(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,s,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&(i=e[o+1]))&&127<(u=(31&l)<<6|63&i)&&(c=u);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&2047<(u=(15&l)<<12|(63&i)<<6|63&s)&&(u<55296||57343<u)&&(c=u);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&65535<(u=(15&l)<<18|(63&i)<<12|(63&s)<<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 d=n,h=d.length;if(h<=At)return String.fromCharCode.apply(String,d);for(var f="",m=0;m<h;)f+=String.fromCharCode.apply(String,d.slice(m,m+=At));return f}u.TYPED_ARRAY_SUPPORT=void 0===Ee.TYPED_ARRAY_SUPPORT||Ee.TYPED_ARRAY_SUPPORT,u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return pt(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array),u.alloc=function(e,t,r){return t=t,r=r,dt(e=e),!(e<=0)&&void 0!==t?"string"==typeof r?ct(null,e).fill(t,r):ct(null,e).fill(t):ct(null,e)},u.allocUnsafe=function(e){return ht(null,e)},u.allocUnsafeSlow=function(e){return ht(null,e)},u.isBuffer=function(e){return null!=e&&(!!e._isBuffer||Dt(e)||"function"==typeof(e=e).readFloatLE&&"function"==typeof e.slice&&Dt(e.slice(0,0)))},u.compare=function(e,t){if(!gt(e)||!gt(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},u.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}},u.concat=function(e,t){if(!ut(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);if(void 0===t)for(o=t=0;o<e.length;++o)t+=e[o].length;for(var r=u.allocUnsafe(t),n=0,o=0;o<e.length;++o){var i=e[o];if(!gt(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,n),n+=i.length}return r},u.byteLength=yt,u.prototype._isBuffer=!0,u.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)vt(this,t,t+1);return this},u.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)vt(this,t,t+3),vt(this,t+1,t+2);return this},u.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)vt(this,t,t+7),vt(this,t+1,t+6),vt(this,t+2,t+5),vt(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0==e?"":0===arguments.length?Et(this,0,e):_t.apply(this,arguments)},u.prototype.equals=function(e){if(gt(e))return this===e||0===u.compare(this,e);throw new TypeError("Argument must be a Buffer")},u.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+">"},u.prototype.compare=function(e,t,r,n,o){if(!gt(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 i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(i,s),u=this.slice(n,o),l=e.slice(t,r),c=0;c<a;++c)if(u[c]!==l[c]){i=u[c],s=l[c];break}return i<s?-1:s<i?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return bt(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return bt(this,e,t,r,!1)},u.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 i,s,a,u=!1;;)switch(n){case"hex":var l=this,c=e,p=t,d=r,h=(p=Number(p)||0,l.length-p);if((!d||(d=Number(d))>h)&&(d=h),(h=c.length)%2!=0)throw new TypeError("Invalid hex string");h/2<d&&(d=h/2);for(var f=0;f<d;++f){var m=parseInt(c.substr(2*f,2),16);if(isNaN(m))return f;l[p+f]=m}return f;case"utf8":case"utf-8":return h=t,a=r,jt(kt(e,(s=this).length-h),s,h,a);case"ascii":return Tt(this,e,t,r);case"latin1":case"binary":return Tt(this,e,t,r);case"base64":return s=this,a=t,i=r,jt(Lt(e),s,a,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wt(this,e,t,r);default:if(u)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),u=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var At=4096;function Ot(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 xt(e,t,r,n,o,i){if(!gt(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(o<t||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function Ct(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);o<i;++o)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function Rt(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);o<i;++o)e[r+o]=t>>>8*(n?o:3-o)&255}function Nt(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function It(e,t,r,n,o){return o||Nt(e,0,r,4),st(e,t,r,n,23,4),r+4}function Pt(e,t,r,n,o){return o||Nt(e,0,r,8),st(e,t,r,n,52,8),r+8}u.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),u.TYPED_ARRAY_SUPPORT)(o=this.subarray(e,t)).__proto__=u.prototype;else for(var n=t-e,o=new u(n,void 0),i=0;i<n;++i)o[i]=this[i+e];return o},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Ot(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Ot(e,t,this.length);for(var n=this[e+--t],o=1;0<t&&(o*=256);)n+=this[e+--t]*o;return n},u.prototype.readUInt8=function(e,t){return t||Ot(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||Ot(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||Ot(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||Ot(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||Ot(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Ot(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Ot(e,t,this.length);for(var n=t,o=1,i=this[e+--n];0<n&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return t||Ot(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||Ot(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},u.prototype.readInt16BE=function(e,t){t||Ot(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},u.prototype.readInt32LE=function(e,t){return t||Ot(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||Ot(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||Ot(e,4,this.length),it(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||Ot(e,4,this.length),it(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||Ot(e,8,this.length),it(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||Ot(e,8,this.length),it(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||xt(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||xt(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;0<=--o&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||xt(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||xt(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ct(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||xt(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ct(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||xt(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Rt(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||xt(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Rt(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){e=+e,t|=0,n||xt(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=0,i=1,s=0;for(this[t]=255&e;++o<r&&(i*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){e=+e,t|=0,n||xt(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=r-1,i=1,s=0;for(this[t+o]=255&e;0<=--o&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||xt(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&(e=e<0?255+e+1:e),t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||xt(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ct(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||xt(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ct(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||xt(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Rt(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||xt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Rt(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return It(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return It(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return Pt(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return Pt(this,e,t,!1,r)},u.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,i=(n=e.length-t<n-r?e.length-t+r:n)-r;if(this===e&&r<t&&t<n)for(o=i-1;0<=o;--o)e[o+t]=this[o+r];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+i),t);return i},u.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&&!u.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 i=gt(e)?e:kt(new u(e,n).toString()),s=i.length,a=0;a<r-t;++a)this[a+t]=i[a%s];return this};var Ut=/[^+\/0-9A-Za-z-_]/g;function kt(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],s=0;s<n;++s){if(55295<(r=e.charCodeAt(s))&&r<57344){if(!o){if(56319<r){-1<(t-=3)&&i.push(239,191,189);continue}if(s+1===n){-1<(t-=3)&&i.push(239,191,189);continue}o=r;continue}if(r<56320){-1<(t-=3)&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&-1<(t-=3)&&i.push(239,191,189);if(o=null,r<128){if(--t<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function Lt(e){var t=(e=>{if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(Ut,"")).length<2)return"";for(var t;e.length%4!=0;)e+="=";return e})(e);tt||rt();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 et(3*e/4-n),i=0<n?e-4:e,s=0,a=0;a<i;a+=4)r=Ze[t.charCodeAt(a)]<<18|Ze[t.charCodeAt(a+1)]<<12|Ze[t.charCodeAt(a+2)]<<6|Ze[t.charCodeAt(a+3)],o[s++]=r>>16&255,o[s++]=r>>8&255,o[s++]=255&r;return 2==n?(r=Ze[t.charCodeAt(a)]<<2|Ze[t.charCodeAt(a+1)]>>4,o[s++]=255&r):1==n&&(r=Ze[t.charCodeAt(a)]<<10|Ze[t.charCodeAt(a+1)]<<4|Ze[t.charCodeAt(a+2)]>>2,o[s++]=r>>8&255,o[s++]=255&r),o}function jt(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 Dt(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var r="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},Mt=/%[sdj%]/g;function Vt(e){if(!tr(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(zt(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,o=n.length,i=String(e).replace(Mt,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}}),s=n[r];r<o;s=n[++r])Qt(s)||!ir(s)?i+=" "+s:i+=" "+zt(s);return i}function Bt(e,t){var r;return nr(Ee.process)?function(){return Bt(e,t).apply(this,arguments)}:!0===Ge.noDeprecation?e:(r=!1,function(){if(!r){if(Ge.throwDeprecation)throw new Error(t);Ge.traceDeprecation?console.trace(t):console.error(t),r=!0}return e.apply(this,arguments)})}var Ft,qt={};function Ht(t){return nr(Ft)&&(Ft=Ge.env.NODE_DEBUG||""),t=t.toUpperCase(),qt[t]||(new RegExp("\\b"+t+"\\b","i").test(Ft)?qt[t]=function(){var e=Vt.apply(null,arguments);console.error("%s %d: %s",t,0,e)}:qt[t]=function(){}),qt[t]}function zt(e,t){var r={seen:[],stylize:Kt};return 3<=arguments.length&&(r.depth=arguments[2]),4<=arguments.length&&(r.colors=arguments[3]),Xt(t)?r.showHidden=t:t&&mr(r,t),nr(r.showHidden)&&(r.showHidden=!1),nr(r.depth)&&(r.depth=2),nr(r.colors)&&(r.colors=!1),nr(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Gt),Yt(r,e,r.depth)}function Gt(e,t){t=zt.styles[t];return t?"["+zt.colors[t][0]+"m"+e+"["+zt.colors[t][1]+"m":e}function Kt(e,t){return e}function Yt(t,r,n){if(t.customInspect&&r&&ur(r.inspect)&&r.inspect!==zt&&(!r.constructor||r.constructor.prototype!==r))return tr(e=r.inspect(n,t))?e:Yt(t,e,n);e=t;var e,o=nr(s=r)?e.stylize("undefined","undefined"):tr(s)?(o="'"+JSON.stringify(s).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'",e.stylize(o,"string")):er(s)?e.stylize(""+s,"number"):Xt(s)?e.stylize(""+s,"boolean"):Qt(s)?e.stylize("null","null"):void 0;if(o)return o;var i,s=Object.keys(r),a=(i={},s.forEach(function(e,t){i[e]=!0}),i);if(t.showHidden&&(s=Object.getOwnPropertyNames(r)),ar(r)&&(0<=s.indexOf("message")||0<=s.indexOf("description")))return Wt(r);if(0===s.length){if(ur(r))return c=r.name?": "+r.name:"",t.stylize("[Function"+c+"]","special");if(or(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(sr(r))return t.stylize(Date.prototype.toString.call(r),"date");if(ar(r))return Wt(r)}var u,l,c="",p=!1,d=["{","}"];return $t(r)&&(p=!0,d=["[","]"]),ur(r)&&(c=" [Function"+(r.name?": "+r.name:"")+"]"),or(r)&&(c=" "+RegExp.prototype.toString.call(r)),sr(r)&&(c=" "+Date.prototype.toUTCString.call(r)),ar(r)&&(c=" "+Wt(r)),0!==s.length||p&&0!=r.length?n<0?or(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),s=p?((t,r,n,o,e)=>{for(var i=[],s=0,a=r.length;s<a;++s)gr(r,String(s))?i.push(Jt(t,r,n,o,String(s),!0)):i.push("");return e.forEach(function(e){e.match(/^\d+$/)||i.push(Jt(t,r,n,o,e,!0))}),i})(t,r,n,a,s):s.map(function(e){return Jt(t,r,n,a,e,p)}),t.seen.pop(),u=c,l=d,60<(s=s).reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)?l[0]+(""===u?"":u+"\n ")+" "+s.join(",\n ")+" "+l[1]:l[0]+u+" "+s.join(", ")+" "+l[1]):d[0]+c+d[1]}function Wt(e){return"["+Error.prototype.toString.call(e)+"]"}function Jt(e,t,r,n,o,i){var s,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")),gr(n,o)||(s="["+o+"]"),a||(e.seen.indexOf(t.value)<0?-1<(a=Yt(e,t.value,Qt(r)?null:r-1)).indexOf("\n")&&(a=i?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")),nr(s)){if(i&&o.match(/^\d+$/))return a;s=(s=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),e.stylize(s,"string"))}return s+": "+a}function $t(e){return Array.isArray(e)}function Xt(e){return"boolean"==typeof e}function Qt(e){return null===e}function Zt(e){return null==e}function er(e){return"number"==typeof e}function tr(e){return"string"==typeof e}function rr(e){return"symbol"==typeof e}function nr(e){return void 0===e}function or(e){return ir(e)&&"[object RegExp]"===pr(e)}function ir(e){return"object"==typeof e&&null!==e}function sr(e){return ir(e)&&"[object Date]"===pr(e)}function ar(e){return ir(e)&&("[object Error]"===pr(e)||e instanceof Error)}function ur(e){return"function"==typeof e}function lr(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function cr(e){return u.isBuffer(e)}function pr(e){return Object.prototype.toString.call(e)}function dr(e){return e<10?"0"+e.toString(10):e.toString(10)}zt.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]},zt.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var hr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function fr(){var e,t;console.log("%s - %s",(t=[dr((e=new Date).getHours()),dr(e.getMinutes()),dr(e.getSeconds())].join(":"),[e.getDate(),hr[e.getMonth()],t].join(" ")),Vt.apply(null,arguments))}function mr(e,t){if(t&&ir(t))for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function gr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n=M(Object.freeze({__proto__:null,format:Vt,deprecate:Bt,debuglog:Ht,inspect:zt,isArray:$t,isBoolean:Xt,isNull:Qt,isNullOrUndefined:Zt,isNumber:er,isString:tr,isSymbol:rr,isUndefined:nr,isRegExp:or,isObject:ir,isDate:sr,isError:ar,isFunction:ur,isPrimitive:lr,isBuffer:cr,log:fr,inherits:r,_extend:mr,default:{inherits:r,_extend:mr,log:fr,isBuffer:cr,isPrimitive:lr,isFunction:ur,isError:ar,isDate:sr,isObject:ir,isRegExp:or,isUndefined:nr,isSymbol:rr,isString:tr,isNumber:er,isNullOrUndefined:Zt,isNull:Qt,isBoolean:Xt,isArray:$t,inspect:zt,deprecate:Bt,format:Vt,debuglog:Ht}}));class yr{_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 _r extends Error{code;name="OTLPExporterError";data;constructor(e,t,r){super(e),this.data=r,this.code=t}}function vr(e,t,r){return{timeoutMillis:(e=>{if(Number.isFinite(e)&&0<e)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)})(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}class br{_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)}}var Sr,Tr,wr,Er,Ar,Or,o="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof Ee?Ee:{},xr="1.9.0",Cr=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,Rr=(Sr=xr,Ar=new Set([Sr]),Or=new Set,(Fe=Sr.match(Cr))?(Tr=+Fe[1],wr=+Fe[2],Er=+Fe[3],null!=Fe[4]?function(e){return e===Sr}:function(e){var t,r,n;return!!Ar.has(e)||!Or.has(e)&&(!(t=e.match(Cr))||(r=+t[1],n=+t[2],null!=t[4])||Tr!=r?Pr:0==Tr?wr==n&&Er<=+t[3]?Ur:Pr:wr<=n?Ur:Pr)(e)}):function(){return!1}),i=xr.split(".")[0],Nr=Symbol.for("opentelemetry.js.api."+i),Ir=o;function Pr(e){return Or.add(e),!1}function Ur(e){return Ar.add(e),!0}function kr(e,t,r,n){void 0===n&&(n=!1);var o,i=Ir[Nr]=null!=(i=Ir[Nr])?i:{version:xr};return!n&&i[e]?(o=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e),r.error(o.stack||o.message),!1):i.version!==xr?(o=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+e+" does not match previously registered API v"+xr),r.error(o.stack||o.message),!1):(i[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+xr+"."),!0)}function Lr(e){var t=null==(t=Ir[Nr])?void 0:t.version;return!t||!Rr(t)||null==(t=Ir[Nr])?void 0:t[e]}function jr(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+xr+".");t=Ir[Nr];t&&delete t[e]}Mr.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Vr("debug",this._namespace,e)},Mr.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Vr("error",this._namespace,e)},Mr.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Vr("info",this._namespace,e)},Mr.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Vr("warn",this._namespace,e)},Mr.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Vr("verbose",this._namespace,e)};var l,Dr=Mr;function Mr(e){this._namespace=e.namespace||"DiagComponentLogger"}function Vr(e,t,r){var n=Lr("diag");if(n)return r.unshift(t),n[e].apply(n,function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;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))}([],((e,t)=>{var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s})(r),!1))}(r=l=l||{})[r.NONE=0]="NONE",r[r.ERROR=30]="ERROR",r[r.WARN=50]="WARN",r[r.INFO=60]="INFO",r[r.DEBUG=70]="DEBUG",r[r.VERBOSE=80]="VERBOSE",r[r.ALL=9999]="ALL";Yr.instance=function(){return this._instance||(this._instance=new Yr),this._instance};var Br=Yr,Hr=(Kr.prototype.getEntry=function(e){e=this._entries.get(e);if(e)return Object.assign({},e)},Kr.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){e=((e,t)=>{var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s})(e,2);return[e[0],e[1]]})},Kr.prototype.setEntry=function(e,t){var r=new Kr(this._entries);return r._entries.set(e,t),r},Kr.prototype.removeEntry=function(e){var t=new Kr(this._entries);return t._entries.delete(e),t},Kr.prototype.removeEntries=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=new Kr(this._entries);try{for(var i=(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.")})(r),s=i.next();!s.done;s=i.next()){var a=s.value;o._entries.delete(a)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return o},Kr.prototype.clear=function(){return new Kr},Kr),zr=Symbol("BaggageEntryMetadata"),Gr=Br.instance();function Kr(e){this._entries=e?new Map(e):new Map}function Yr(){function e(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Lr("diag");if(r)return r[n].apply(r,function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;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))}([],((e,t)=>{var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s})(e),!1))}}var a=this;a.setLogger=function(e,t){if(void 0===t&&(t={logLevel:l.INFO}),e===a)return i=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=i.stack)?o:i.message),!1;"number"==typeof t&&(t={logLevel:t});var r,n,o=Lr("diag"),i=(r=null!=(i=t.logLevel)?i:l.INFO,n=e,r<l.NONE?r=l.NONE:r>l.ALL&&(r=l.ALL),n=n||{},{error:s("error",l.ERROR),warn:s("warn",l.WARN),info:s("info",l.INFO),debug:s("debug",l.DEBUG),verbose:s("verbose",l.VERBOSE)});function s(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),i.warn("Current logger will overwrite one already registered from "+t)),kr("diag",i,a,!0)},a.disable=function(){jr("diag",a)},a.createComponentLogger=function(e){return new Dr(e)},a.verbose=e("verbose"),a.debug=e("debug"),a.info=e("info"),a.warn=e("warn"),a.error=e("error")}function Wr(e){return void 0===e&&(e={}),new Hr(new Map(Object.entries(e)))}function Jr(e){return"string"!=typeof e&&(Gr.error("Cannot create baggage metadata from unknown type: "+typeof e),e=""),{__TYPE__:zr,toString:function(){return e}}}function $r(e){return Symbol.for(e)}function Xr(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}Zr(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Qr(){}var Zr,en,tn,rn,nn,on,sn,an,un,ln=new 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}},cn=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],Fe=(Zr=function(e,t){return(Zr=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)},xn.prototype.createGauge=function(e,t){return hn},xn.prototype.createHistogram=function(e,t){return fn},xn.prototype.createCounter=function(e,t){return dn},xn.prototype.createUpDownCounter=function(e,t){return mn},xn.prototype.createObservableGauge=function(e,t){return yn},xn.prototype.createObservableCounter=function(e,t){return gn},xn.prototype.createObservableUpDownCounter=function(e,t){return _n},xn.prototype.addBatchObservableCallback=function(e,t){},xn.prototype.removeBatchObservableCallback=function(e){},xn),i=(Xr(On,un=Qr),On.prototype.add=function(e,t){},On),o=(Xr(An,an=Qr),An.prototype.add=function(e,t){},An),r=(Xr(En,sn=Qr),En.prototype.record=function(e,t){},En),s=(Xr(wn,on=Qr),wn.prototype.record=function(e,t){},wn),p=(Tn.prototype.addCallback=function(e){},Tn.prototype.removeCallback=function(e){},Tn),d=(Xr(Sn,nn=p),Sn),h=(Xr(bn,rn=p),bn),p=(Xr(vn,tn=p),vn),pn=new Fe,dn=new i,hn=new r,fn=new s,mn=new o,gn=new d,yn=new h,_n=new p;function vn(){return null!==tn&&tn.apply(this,arguments)||this}function bn(){return null!==rn&&rn.apply(this,arguments)||this}function Sn(){return null!==nn&&nn.apply(this,arguments)||this}function Tn(){}function wn(){return null!==on&&on.apply(this,arguments)||this}function En(){return null!==sn&&sn.apply(this,arguments)||this}function An(){return null!==an&&an.apply(this,arguments)||this}function On(){return null!==un&&un.apply(this,arguments)||this}function xn(){}function Cn(){return pn}(Fe=en=en||{})[Fe.INT=0]="INT",Fe[Fe.DOUBLE=1]="DOUBLE";var Rn,Nn={get:function(e,t){if(null!=e)return e[t]},keys:function(e){return null==e?[]:Object.keys(e)}},In={set:function(e,t,r){null!=e&&(e[t]=r)}};jn.prototype.active=function(){return ln},jn.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,function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;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))}([r],((e,t)=>{var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s})(n),!1))},jn.prototype.bind=function(e,t){return t},jn.prototype.enable=function(){return this},jn.prototype.disable=function(){return this};var Pn="context",Un=new jn,kn=(Ln.getInstance=function(){return this._instance||(this._instance=new Ln),this._instance},Ln.prototype.setGlobalContextManager=function(e){return kr(Pn,e,Br.instance())},Ln.prototype.active=function(){return this._getContextManager().active()},Ln.prototype.with=function(e,t,r){for(var n,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(n=this._getContextManager()).with.apply(n,function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;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))}([e,t,r],((e,t)=>{var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s})(o),!1))},Ln.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},Ln.prototype._getContextManager=function(){return Lr(Pn)||Un},Ln.prototype.disable=function(){this._getContextManager().disable(),jr(Pn,Br.instance())},Ln);function Ln(){}function jn(){}(i=Rn=Rn||{})[i.NONE=0]="NONE",i[i.SAMPLED=1]="SAMPLED";var Dn="0000000000000000",Mn="00000000000000000000000000000000",Vn={traceId:Mn,spanId:Dn,traceFlags:Rn.NONE},Bn=(qn.prototype.spanContext=function(){return this._spanContext},qn.prototype.setAttribute=function(e,t){return this},qn.prototype.setAttributes=function(e){return this},qn.prototype.addEvent=function(e,t){return this},qn.prototype.addLink=function(e){return this},qn.prototype.addLinks=function(e){return this},qn.prototype.setStatus=function(e){return this},qn.prototype.updateName=function(e){return this},qn.prototype.end=function(e){},qn.prototype.isRecording=function(){return!1},qn.prototype.recordException=function(e,t){},qn),Fn=$r("OpenTelemetry Context Key SPAN");function qn(e){this._spanContext=e=void 0===e?Vn:e}function Hn(e){return e.getValue(Fn)||void 0}function zn(){return Hn(kn.getInstance().active())}function Gn(e,t){return e.setValue(Fn,t)}function Kn(e){return e.deleteValue(Fn)}function Yn(e,t){return Gn(e,new Bn(t))}function Wn(e){return null==(e=Hn(e))?void 0:e.spanContext()}var Jn=/^([0-9a-f]{32})$/i,$n=/^[0-9a-f]{16}$/i;function Xn(e){return Jn.test(e)&&e!==Mn}function Qn(e){return $n.test(e)&&e!==Dn}function Zn(e){return Xn(e.traceId)&&Qn(e.spanId)}function eo(e){return new Bn(e)}var to=kn.getInstance(),ro=(no.prototype.startSpan=function(e,t,r){return void 0===r&&(r=to.active()),!Boolean(null==t?void 0:t.root)&&"object"==typeof(t=r&&Wn(r))&&"string"==typeof t.spanId&&"string"==typeof t.traceId&&"number"==typeof t.traceFlags&&Zn(t)?new Bn(t):new Bn},no.prototype.startActiveSpan=function(e,t,r,n){var o,i;if(!(arguments.length<2))return t=2===arguments.length?t:3===arguments.length?(o=t,r):(o=t,i=r,n),i=Gn(r=null!=i?i:to.active(),n=this.startSpan(e,o,r)),to.with(i,t,void 0,n)},no);function no(){}var oo,io,so,ao=new ro,uo=(fo.prototype.startSpan=function(e,t,r){return this._getTracer().startSpan(e,t,r)},fo.prototype.startActiveSpan=function(e,t,r,n){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},fo.prototype._getTracer=function(){var e;return this._delegate||((e=this._provider.getDelegateTracer(this.name,this.version,this.options))?(this._delegate=e,this._delegate):ao)},fo),lo=(ho.prototype.getTracer=function(e,t,r){return new ro},new ho),co=(po.prototype.getTracer=function(e,t,r){var n;return null!=(n=this.getDelegateTracer(e,t,r))?n:new uo(this,e,t,r)},po.prototype.getDelegate=function(){var e;return null!=(e=this._delegate)?e:lo},po.prototype.setDelegate=function(e){this._delegate=e},po.prototype.getDelegateTracer=function(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getTracer(e,t,r)},po);function po(){}function ho(){}function fo(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}(r=oo=oo||{})[r.NOT_RECORD=0]="NOT_RECORD",r[r.RECORD=1]="RECORD",r[r.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED",(s=io=io||{})[s.INTERNAL=0]="INTERNAL",s[s.SERVER=1]="SERVER",s[s.CLIENT=2]="CLIENT",s[s.PRODUCER=3]="PRODUCER",s[s.CONSUMER=4]="CONSUMER",(o=so=so||{})[o.UNSET=0]="UNSET",o[o.OK=1]="OK",o[o.ERROR=2]="ERROR";var d="[_0-9a-z-*/]",mo=new RegExp("^(?:[a-z]"+d+"{0,255}|[a-z0-9]"+d+"{0,240}@[a-z]"+d+"{0,13})$"),go=/^[ -~]{0,255}[!-~]$/,yo=/,|=/,_o=(vo.prototype.set=function(e,t){var r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,t),r},vo.prototype.unset=function(e){var t=this._clone();return t._internalState.delete(e),t},vo.prototype.get=function(e){return this._internalState.get(e)},vo.prototype.serialize=function(){var r=this;return this._keys().reduce(function(e,t){return e.push(t+"="+r.get(t)),e},[]).join(",")},vo.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),mo.test(r))&&(o=n,go.test(o))&&!yo.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))))},vo.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},vo.prototype._clone=function(){var e=new vo;return e._internalState=new Map(this._internalState),e},vo);function vo(e){this._internalState=new Map,e&&this._parse(e)}var bo=kn.getInstance(),f=Br.instance(),So=(Oo.prototype.getMeter=function(e,t,r){return pn},new Oo),To="metrics";Ao.getInstance=function(){return this._instance||(this._instance=new Ao),this._instance},Ao.prototype.setGlobalMeterProvider=function(e){return kr(To,e,Br.instance())},Ao.prototype.getMeterProvider=function(){return Lr(To)||So},Ao.prototype.getMeter=function(e,t,r){return this.getMeterProvider().getMeter(e,t,r)},Ao.prototype.disable=function(){jr(To,Br.instance())};var h=Ao.getInstance(),p=(Eo.prototype.inject=function(e,t){},Eo.prototype.extract=function(e,t){return e},Eo.prototype.fields=function(){return[]},Eo),wo=$r("OpenTelemetry Baggage Key");function Eo(){}function Ao(){}function Oo(){}function xo(e){return e.getValue(wo)||void 0}function Co(){return xo(kn.getInstance().active())}function Ro(e,t){return e.setValue(wo,t)}function No(e){return e.deleteValue(wo)}var Io="propagation",Po=new p;Mo.getInstance=function(){return this._instance||(this._instance=new Mo),this._instance},Mo.prototype.setGlobalPropagator=function(e){return kr(Io,e,Br.instance())},Mo.prototype.inject=function(e,t,r){return void 0===r&&(r=In),this._getGlobalPropagator().inject(e,t,r)},Mo.prototype.extract=function(e,t,r){return void 0===r&&(r=Nn),this._getGlobalPropagator().extract(e,t,r)},Mo.prototype.fields=function(){return this._getGlobalPropagator().fields()},Mo.prototype.disable=function(){jr(Io,Br.instance())},Mo.prototype._getGlobalPropagator=function(){return Lr(Io)||Po};var Uo=Mo.getInstance(),ko="trace";Do.getInstance=function(){return this._instance||(this._instance=new Do),this._instance},Do.prototype.setGlobalTracerProvider=function(e){var t=kr(ko,this._proxyTracerProvider,Br.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},Do.prototype.getTracerProvider=function(){return Lr(ko)||this._proxyTracerProvider},Do.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},Do.prototype.disable=function(){jr(ko,Br.instance()),this._proxyTracerProvider=new co};var Lo,jo=Do.getInstance(),Fe=Object.freeze({__proto__:null,context:bo,diag:f,metrics:h,propagation:Uo,trace:jo,default:{context:bo,diag:f,metrics:h,propagation:Uo,trace:jo},baggageEntryMetadataFromString:Jr,createContextKey:$r,ROOT_CONTEXT:ln,DiagConsoleLogger:function(){for(var e=0;e<cn.length;e++)this[cn[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)}})(cn[e].c)},get DiagLogLevel(){return l},createNoopMeter:Cn,get ValueType(){return en},defaultTextMapGetter:Nn,defaultTextMapSetter:In,ProxyTracer:uo,ProxyTracerProvider:co,get SamplingDecision(){return oo},get SpanKind(){return io},get SpanStatusCode(){return so},get TraceFlags(){return Rn},createTraceState:function(e){return new _o(e)},isSpanContextValid:Zn,isValidTraceId:Xn,isValidSpanId:Qn,INVALID_SPANID:Dn,INVALID_TRACEID:Mn,INVALID_SPAN_CONTEXT:Vn});function Do(){this._proxyTracerProvider=new co,this.wrapSpanContext=eo,this.isSpanContextValid=Zn,this.deleteSpan=Kn,this.getSpan=Hn,this.getActiveSpan=zn,this.getSpanContext=Wn,this.setSpan=Gn,this.setSpanContext=Yn}function Mo(){this.createBaggage=Wr,this.getBaggage=xo,this.getActiveBaggage=Co,this.setBaggage=Ro,this.deleteBaggage=No}let Vo=$r("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Bo(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)return;if(!Fo(e))return;t=e}}return 1})(e):Fo(typeof e))}function Fo(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}let qo=e=>{var t;f.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 Ho(e){try{qo(e)}catch{}}let zo=performance,Go="exception.message",Ko="exception.type",Yo="telemetry.sdk.language",Wo="telemetry.sdk.name",Jo="telemetry.sdk.version",$o={"telemetry.sdk.name":"opentelemetry","process.runtime.name":"browser","telemetry.sdk.language":"webjs","telemetry.sdk.version":"2.2.0"},Xo=Math.pow(10,6),Qo=Math.pow(10,9);function Zo(e){return[Math.trunc(e/1e3),Math.round(e%1e3*Xo)]}function ei(){let e=zo.timeOrigin;var t;return"number"!=typeof e&&(t=zo,e=t.timing&&t.timing.fetchStart),e}function ti(e){if(r=e,Array.isArray(r)&&2===r.length&&"number"==typeof r[0]&&"number"==typeof r[1])return e;if("number"==typeof e)return e<ei()?(r=e,t=Zo(ei()),r=Zo("number"==typeof r?r:zo.now()),(t=[t[0]+r[0],t[1]+r[1]])[1]>=Qo&&(t[1]-=Qo,t[0]+=1),t):Zo(e);var t,r;if(e instanceof Date)return Zo(e.getTime());throw TypeError("Invalid input type")}(i=Lo=Lo||{})[i.SUCCESS=0]="SUCCESS",i[i.FAILED=1]="FAILED";let ri="[object Null]",ni="[object Undefined]",oi=Function.prototype.toString,ii=oi.call(Object),si=Object.getPrototypeOf,ai=Object.prototype,ui=ai.hasOwnProperty,li=Symbol?Symbol.toStringTag:void 0,ci=ai.toString;function pi(e){if(null!=e&&"object"==typeof e&&"[object Object]"===(t=>{if(null==t)return void 0===t?ni:ri;if(li&&li in Object(t)){var r=t,n=ui.call(r,li),o=r[li];let e=!1;try{r[li]=void 0,e=!0}catch{}var i=ci.call(r);return e&&(n?r[li]=o:delete r[li]),i}return n=t,ci.call(n)})(e))return null===(e=si(e))||"function"==typeof(e=ui.call(e,"constructor")&&e.constructor)&&e instanceof e&&oi.call(e)===ii}function di(e){return fi(e)?e.slice():e}function hi(r,n,e){var o=e.get(r[n])||[];for(let e=0,t=o.length;e<t;e++){var i=o[e];if(i.key===n&&i.obj===r)return 1}}function fi(e){return Array.isArray(e)}function mi(e){return"function"==typeof e}function gi(e){return!yi(e)&&!fi(e)&&!mi(e)&&"object"==typeof e}function yi(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||e instanceof Date||e instanceof RegExp||null===e}class _i extends Error{constructor(e){super(e),Object.setPrototypeOf(this,_i.prototype)}}function vi(e,r){let n;var t=new Promise(function(e,t){n=setTimeout(function(){t(new _i("Operation timed out."))},r)});return Promise.race([e,t]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}class bi{_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 Si{_callback;_that;_isCalled=!1;_deferred=new bi;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}}l.ALL,l.VERBOSE,l.DEBUG,l.INFO,l.WARN,l.ERROR,l.NONE;let Ti={_export:function(e,r){return new Promise(t=>{bo.with(bo.active().setValue(Vo,!0),()=>{e.export(r,e=>{t(e)})})})}};class wi{_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=f.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,r){this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()?r({code:Lo.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:Lo.FAILED,error:t.error}):"retryable"===t.status?r({code:Lo.FAILED,error:new _r("Export failed with retryable status")}):r({code:Lo.FAILED,error:new _r("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:Lo.SUCCESS})}},e=>r({code:Lo.FAILED,error:e}))):r({code:Lo.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 Ei(e,t,r){return t={transport:r,serializer:t,promiseHandler:(r=e,new br(r.concurrencyLimit))},r={timeout:e.timeoutMillis},new wi(t.transport,t.serializer,{handleResponse(e){null!=e&&Object.prototype.hasOwnProperty.call(e,"partialSuccess")&&null!=e.partialSuccess&&0!==Object.keys(e.partialSuccess).length&&f.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}},t.promiseHandler,r.timeout)}var Ai,Oi,xi,Ci,Ri,Ni,Ii,Pi,Ui,r={},ki={},Li={};var ji,Di,Mi,Vi,Bi,Fi,qi,Hi={},zi={exports:{}};function Gi(){return qi||(qi=1,(l=ki).asPromise=(Oi||(Oi=1,Ai=function(e,t){for(var r=new Array(arguments.length-1),i=0,n=2,s=!0;n<arguments.length;)r[i++]=arguments[n++];return new Promise(function(n,o){r[i]=function(e){if(s)if(s=!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){s&&(s=!1,o(e))}})}),Ai),l.base64=(xi||(xi=1,(()=>{var e=Li;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,i=[],s=0,a=0;t<r;){var u=e[t++];switch(a){case 0:i[s++]=l[u>>2],n=(3&u)<<4,a=1;break;case 1:i[s++]=l[n|u>>4],n=(15&u)<<2,a=2;break;case 2:i[s++]=l[n|u>>6],i[s++]=l[63&u],a=0}8191<s&&((o=o||[]).push(String.fromCharCode.apply(String,i)),s=0)}return a&&(i[s++]=l[n],i[s++]=61,1===a)&&(i[s++]=61),o?(s&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))};var c="invalid encoding";e.decode=function(e,t,r){for(var n,o=r,i=0,s=0;s<e.length;){var a=e.charCodeAt(s++);if(61===a&&1<i)break;if(void 0===(a=u[a]))throw Error(c);switch(i){case 0:n=a,i=1;break;case 1:t[r++]=n<<2|(48&a)>>4,n=a,i=2;break;case 2:t[r++]=(15&n)<<4|(60&a)>>2,n=a,i=3;break;case 3:t[r++]=(3&n)<<6|a,i=0}}if(1===i)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)}})()),Li),l.EventEmitter=(Ri||(Ri=1,(Ci=r).prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},r.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},r.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}),Ci),l.float=Ii?Ni:(Ii=1,Ni=t(t)),l.inquire=Ui?Pi:(Ui=1,Pi=function(e){try{(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.')})(e);return null}catch(e){return null}}),l.utf8=(ji||(ji=1,Hi.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},0),Hi),l.pool=(Mi||(Mi=1,Di=function(t,r,e){var n=e||8192,o=n>>>1,i=null,s=n;return function(e){if(e<1||o<e)return t(e);n<s+e&&(i=t(n),s=0);e=r.call(i,s,s+=e);return 7&s&&(s=1+(7|s)),e}}),Di),l.LongBits=(Bi||(Bi=1,Vi=o,i=Gi(),(s=o.zero=new o(0,0)).toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1},o.zeroHash="\0\0\0\0\0\0\0\0",o.fromNumber=function(e){var t,r;return 0===e?s:(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):s},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)}},u=String.prototype.charCodeAt,o.fromHash=function(e){return"\0\0\0\0\0\0\0\0"===e?s:new o((u.call(e,0)|u.call(e,1)<<8|u.call(e,2)<<16|u.call(e,3)<<24)>>>0,(u.call(e,4)|u.call(e,5)<<8|u.call(e,6)<<16|u.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}),Vi),l.isUnsafeProperty=a,l.isNode=Boolean(D&&D.process&&D.process.versions&&D.process.versions.node),l.global=l.isNode&&D||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||D,l.emptyArray=Object.freeze?Object.freeze([]):[],l.emptyObject=Object.freeze?Object.freeze({}):{},l.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},l.isString=function(e){return"string"==typeof e||e instanceof String},l.isObject=function(e){return e&&"object"==typeof e},l.isset=l.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)},l.Buffer=(()=>{try{var e=l.global.Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}})(),l._Buffer_from=null,l._Buffer_allocUnsafe=null,l.newBuffer=function(e){return"number"==typeof e?l.Buffer?l._Buffer_allocUnsafe(e):new l.Array(e):l.Buffer?l._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},l.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,l.Long=l.global.dcodeIO&&l.global.dcodeIO.Long||l.global.Long||(()=>{try{var e=(()=>{if(!Fi){Fi=1;var e=zi,t=zi.exports,r=t,d=(Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,null);try{d=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 h(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=h;var i={},s={};function a(e,t){var r,n,o;return t?(o=0<=(e>>>=0)&&e<256)&&(n=s[e])?n:(r=m(e,0,!0),o&&(s[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=i[e])?n:(r=m(e,e<0?-1:0,!1),o&&(i[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)),i=v,s=0;s<e.length;s+=8){var a=Math.min(8,e.length-s),u=parseInt(e.substring(s,s+a),r);i=(a<8?(a=f(l(r,a)),i.mul(a)):i=i.mul(o)).add(f(u))}return i.unsigned=t,i}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,i="";;){var s=o.div(n),a=(o.sub(s.mul(n)).toInt()>>>0).toString(e);if((o=s).isZero())return a+i;for(;a.length<6;)a="0"+a;i=""+a+i}},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 h(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 h(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){h(e)||(e=g(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,i=e.high>>>16,s=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+s)>>>16)+(t+i)&65535)<<16|(l&=65535),this.unsigned)},x.subtract=function(e){return h(e)||(e=g(e)),this.add(e.neg())},x.sub=x.subtract,x.multiply=function(e){var t,r,n,o,i,s,a,u,l,c,p;return this.isZero()?this:(h(e)||(e=g(e)),d?m(d.mul(this.low,this.high,e.low,e.high),d.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,i=e.high>>>16,s=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*s)>>>16))+(t*e+r*a+n*s+o*i)&65535)<<16|(p&=65535),this.unsigned)))},x.mul=x.multiply,x.divide=function(e){if((e=h(e)?e:g(e)).isZero())throw Error("division by zero");var t,r;if(d)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?m((this.unsigned?d.div_u:d.div_s)(this.low,this.high,e.low,e.high),d.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),i=o<=48?1:l(2,o-48),s=f(n),a=s.mul(e);a.isNegative()||a.gt(t);)a=(s=f(n-=i,this.unsigned)).mul(e);s.isZero()&&(s=S),r=r.add(s),t=t.sub(a)}return r},x.div=x.divide,x.modulo=function(e){return h(e)||(e=g(e)),d?m((this.unsigned?d.rem_u:d.rem_s)(this.low,this.high,e.low,e.high),d.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 h(e)||(e=g(e)),m(this.low&e.low,this.high&e.high,this.unsigned)},x.or=function(e){return h(e)||(e=g(e)),m(this.low|e.low,this.high|e.high,this.unsigned)},x.xor=function(e){return h(e)||(e=g(e)),m(this.low^e.low,this.high^e.high,this.unsigned)},x.shiftLeft=function(e){return h(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 h(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 h(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 h(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 h(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 zi.exports})();return e&&e.isLong?e:null}catch(e){return null}})(),l.key2Re=/^true|false|0|1$/,l.key32Re=/^-?(?:0|[1-9][0-9]*)$/,l.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,l.longToHash=function(e){return e?l.LongBits.from(e).toHash():l.LongBits.zeroHash},l.longFromHash=function(e,t){e=l.LongBits.fromHash(e);return l.Long?l.Long.fromBits(e.lo,e.hi,t):e.toNumber(Boolean(t))},l.merge=n,l.nestingLimit=32,l.recursionLimit=100,l.makeProp=function(e,t){Object.defineProperty(e,t,{enumerable:!0,configurable:!0,writable:!0})},l.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},l.newError=e,l.ProtocolError=e("ProtocolError"),l.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]}},l.oneOfSetter=function(r){return function(e){for(var t=0;t<r.length;++t)r[t]!==e&&delete this[r[t]]}},l.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},l._configure=function(){var r=l.Buffer;r?(l._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,t){return new r(e,t)},l._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}):l._Buffer_from=l._Buffer_allocUnsafe=null}),ki;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 i=Object.keys(o),s=0;s<i.length;++s)a(i[s])||void 0!==e[i[s]]&&r||(e[i[s]]=o[i[s]])}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=d.bind(null,_),e.writeFloatBE=d.bind(null,v),e.readFloatLE=h.bind(null,b),e.readFloatBE=h.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?i:s,e.readDoubleBE=p?s:i):(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,i){var s,a,u=n<0?1:0;0===(n=u?-n:n)?(e(0,o,i+t),e(0<1/n?0:2147483648,o,i+r)):isNaN(n)?(e(0,o,i+t),e(2146959360,o,i+r)):17976931348623157e292<n?(e(0,o,i+t),e((u<<31|2146435072)>>>0,o,i+r)):n<22250738585072014e-324?(e((s=n/5e-324)>>>0,o,i+t),e((u<<31|s/4294967296)>>>0,o,i+r)):(1024===(a=Math.floor(Math.log(n)/Math.LN2))&&(a=1023),e(4503599627370496*(s=n*Math.pow(2,-a))>>>0,o,i+t),e((u<<31|a+1023<<20|1048576*s&1048575)>>>0,o,i+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 i(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 s(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 d(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 h(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 r(){this._listeners=Object.create(null)}var i,s,u,l}var Ki,s=m,Yi=Gi(),Wi=Yi.LongBits,Ji=Yi.base64,$i=Yi.utf8;function Xi(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function Qi(){}function Zi(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function m(){this.len=0,this.head=new Xi(Qi,0,0),this.tail=this.head,this.states=null}function es(){return Yi.Buffer?function(){return(m.create=function(){return new Ki})()}:function(){return new m}}function ts(e,t,r){t[r]=255&e}function rs(e,t){this.len=e,this.next=void 0,this.val=t}function ns(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 os(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}m.create=es(),m.alloc=function(e){return new Yi.Array(e)},Yi.Array!==Array&&(m.alloc=Yi.pool(m.alloc,Yi.Array.prototype.subarray)),m.prototype._push=function(e,t,r){return this.tail=this.tail.next=new Xi(e,t,r),this.len+=t,this},(rs.prototype=Object.create(Xi.prototype)).fn=function(e,t,r){for(;127<e;)t[r++]=127&e|128,e>>>=7;t[r]=e},m.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new rs((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},m.prototype.int32=function(e){return(e|=0)<0?this._push(ns,10,Wi.fromNumber(e)):this.uint32(e)},m.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},m.prototype.int64=m.prototype.uint64=function(e){e=Wi.from(e);return this._push(ns,e.length(),e)},m.prototype.sint64=function(e){e=Wi.from(e).zzEncode();return this._push(ns,e.length(),e)},m.prototype.bool=function(e){return this._push(ts,1,e?1:0)},m.prototype.sfixed32=m.prototype.fixed32=function(e){return this._push(os,4,e>>>0)},m.prototype.sfixed64=m.prototype.fixed64=function(e){e=Wi.from(e);return this._push(os,4,e.lo)._push(os,4,e.hi)},m.prototype.float=function(e){return this._push(Yi.float.writeFloatLE,4,e)},m.prototype.double=function(e){return this._push(Yi.float.writeDoubleLE,8,e)};var is=Yi.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]},o=(m.prototype.bytes=function(e){var t,r=e.length>>>0;return r?(Yi.isString(e)&&(t=m.alloc(r=Ji.length(e)),Ji.decode(e,t,0),e=t),this.uint32(r)._push(is,r,e)):this._push(ts,1,0)},m.prototype.string=function(e){var t=$i.length(e);return t?this.uint32(t)._push($i.write,t,e):this._push(ts,1,0)},m.prototype.fork=function(){return this.states=new Zi(this),this.head=this.tail=new Xi(Qi,0,0),this.len=0,this},m.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 Xi(Qi,0,0),this.len=0),this},m.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},m.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},m._configure=function(e){Ki=e,m.create=es(),Ki._configure()},us),ss=s,as=((us.prototype=Object.create(ss.prototype)).constructor=us,Gi());function us(){ss.call(this)}function ls(e,t,r){e.length<40?as.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}us._configure=function(){us.alloc=as._Buffer_allocUnsafe,us.writeBytesBuffer=as.Buffer&&as.Buffer.prototype instanceof Uint8Array&&"set"===as.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++]}},us.prototype.bytes=function(e){var t=(e=as.isString(e)?as._Buffer_from(e,"base64"):e).length>>>0;return this.uint32(t),t&&this._push(us.writeBytesBuffer,t,e),this},us.prototype.string=function(e){var t=as.Buffer.byteLength(e);return this.uint32(t),t&&this._push(ls,t,e),this},us._configure();var cs,d=g,ps=Gi(),ds=ps.LongBits,hs=ps.utf8;function fs(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function g(e){this.buf=e,this.pos=0,this.len=e.length}function ms(){return ps.Buffer?function(e){return(g.create=function(e){return ps.Buffer.isBuffer(e)?new cs(e):ys(e)})(e)}:ys}var gs,ys="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new g(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new g(e);throw Error("illegal buffer")};function _s(){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 vs(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function bs(){if(this.pos+8>this.len)throw fs(this,8);return new ds(vs(this.buf,this.pos+=4),vs(this.buf,this.pos+=4))}g.create=ms(),g.prototype._slice=ps.Array.prototype.subarray||ps.Array.prototype.slice,g.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)}),g.prototype.int32=function(){return 0|this.uint32()},g.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},g.prototype.bool=function(){return 0!==this.uint32()},g.prototype.fixed32=function(){if(this.pos+4>this.len)throw fs(this,4);return vs(this.buf,this.pos+=4)},g.prototype.sfixed32=function(){if(this.pos+4>this.len)throw fs(this,4);return 0|vs(this.buf,this.pos+=4)},g.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},g.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},g.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)},g.prototype.string=function(){var e=this.bytes();return hs.read(e,0,e.length)},g.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},g.recursionLimit=ps.recursionLimit,g.prototype.skipType=function(e,t){if(g.recursionLimit<(t=void 0===t?0:t))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},g._configure=function(e){cs=e,g.create=ms(),cs._configure();var t=ps.Long?"toLong":"toNumber";ps.merge(g.prototype,{int64:function(){return _s.call(this)[t](!1)},uint64:function(){return _s.call(this)[t](!0)},sint64:function(){return _s.call(this).zzDecode()[t](!1)},fixed64:function(){return bs.call(this)[t](!0)},sfixed64:function(){return bs.call(this)[t](!1)}})};var p=ws,Ss=d,Ts=((ws.prototype=Object.create(Ss.prototype)).constructor=ws,Gi());function ws(e){Ss.call(this,e)}ws._configure=function(){Ts.Buffer&&(ws.prototype._slice=Ts.Buffer.prototype.slice)},ws.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))},ws._configure();var h={},i=As,Es=Gi();function As(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");Es.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}((As.prototype=Object.create(Es.EventEmitter.prototype)).constructor=As).prototype.rpcCall=function e(r,t,n,o,i){if(!o)throw TypeError("request must be specified");var s=this;if(!i)return Es.asPromise(e,s,r,t,n,o);if(s.rpcImpl)try{return s.rpcImpl(r,t[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(e,t){if(e)return s.emit("error",e,r),i(e);if(null!==t){if(!(t instanceof n))try{t=n[s.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return s.emit("error",e,r),i(e)}return s.emit("data",t,r),i(null,t)}s.end(!0)})}catch(e){s.emit("error",e,r),setTimeout(function(){i(e)},0)}else setTimeout(function(){i(Error("already ended"))},0)},As.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},h.Service=i;var Os,i=Object.create(null);function xs(){Os.util._configure(),Os.Writer._configure(Os.BufferWriter),Os.Reader._configure(Os.BufferReader)}(Os=r).build="minimal",Os.Writer=s,Os.BufferWriter=o,Os.Reader=d,Os.BufferReader=p,Os.util=Gi(),Os.rpc=h,Os.roots=i,Os.configure=xs,xs();var y=r,_=y.Reader,v=y.Writer,b=y.util,S=y.roots.default||(y.roots.default={});function Cs(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 Rs(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 Ns(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 Is(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 Ps(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 Us(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 ks(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 T(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 Ls(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 w(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 js(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 Ds(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 Ms(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 Vs(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 Bs(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 Fs(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 qs(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 Hs(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 zs(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 Gs(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 Ks(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 Ys(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 Ws(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 Js(e,t,r){y.rpc.Service.call(this,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 Xs(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 Qs(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 Zs(e,t,r){y.rpc.Service.call(this,e,t,r)}function ea(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 ta(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 ra(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 na(e,t,r){y.rpc.Service.call(this,e,t,r)}function oa(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 E(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 ia(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 sa(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 aa(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 ua(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 la(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 ca(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]])}function pa(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 da(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 ha(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 fa(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 ma(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 ga(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]])}S.opentelemetry=((s={}).proto=((o={}).common=((d={}).v1=((p={}).AnyValue=(ga.prototype.stringValue=null,ga.prototype.boolValue=null,ga.prototype.intValue=null,ga.prototype.doubleValue=null,ga.prototype.arrayValue=null,ga.prototype.kvlistValue=null,ga.prototype.bytesValue=null,Object.defineProperty(ga.prototype,"value",{get:b.oneOfGetter(h=["stringValue","boolValue","intValue","doubleValue","arrayValue","kvlistValue","bytesValue"]),set:b.oneOfSetter(h)}),ga.create=function(e){return new ga(e)},ga.encode=function(e,t){return t=t||v.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")&&S.opentelemetry.proto.common.v1.ArrayValue.encode(e.arrayValue,t.uint32(42).fork()).ldelim(),null!=e.kvlistValue&&Object.hasOwnProperty.call(e,"kvlistValue")&&S.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},ga.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},ga.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.common.v1.AnyValue;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>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=S.opentelemetry.proto.common.v1.ArrayValue.decode(e,e.uint32());break;case 6:o.kvlistValue=S.opentelemetry.proto.common.v1.KeyValueList.decode(e,e.uint32());break;case 7:o.bytesValue=e.bytes();break;default:e.skipType(7&i)}}return o},ga.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},ga.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,!b.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,!(b.isInteger(e.intValue)||e.intValue&&b.isInteger(e.intValue.low)&&b.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=S.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=S.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||b.isString(e.bytesValue)))return"bytesValue: buffer expected"}return null},ga.fromObject=function(e){if(e instanceof S.opentelemetry.proto.common.v1.AnyValue)return e;var t=new S.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&&(b.Long?(t.intValue=b.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 b.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=S.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=S.opentelemetry.proto.common.v1.KeyValueList.fromObject(e.kvlistValue)}return null!=e.bytesValue&&("string"==typeof e.bytesValue?b.base64.decode(e.bytesValue,t.bytesValue=b.newBuffer(b.base64.length(e.bytesValue)),0):0<=e.bytesValue.length&&(t.bytesValue=e.bytesValue)),t},ga.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?b.Long.prototype.toString.call(e.intValue):t.longs===Number?new b.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=S.opentelemetry.proto.common.v1.ArrayValue.toObject(e.arrayValue,t),t.oneofs)&&(r.value="arrayValue"),null!=e.kvlistValue&&e.hasOwnProperty("kvlistValue")&&(r.kvlistValue=S.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?b.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},ga.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},ga.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.AnyValue"},ga),p.ArrayValue=(ma.prototype.values=b.emptyArray,ma.create=function(e){return new ma(e)},ma.encode=function(e,t){if(t=t||v.create(),null!=e.values&&e.values.length)for(var r=0;r<e.values.length;++r)S.opentelemetry.proto.common.v1.AnyValue.encode(e.values[r],t.uint32(10).fork()).ldelim();return t},ma.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},ma.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.common.v1.ArrayValue;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?(o.values&&o.values.length||(o.values=[]),o.values.push(S.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32()))):e.skipType(7&i)}return o},ma.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},ma.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=S.opentelemetry.proto.common.v1.AnyValue.verify(e.values[t]);if(r)return"values."+r}}return null},ma.fromObject=function(e){if(e instanceof S.opentelemetry.proto.common.v1.ArrayValue)return e;var t=new S.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]=S.opentelemetry.proto.common.v1.AnyValue.fromObject(e.values[r])}}return t},ma.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]=S.opentelemetry.proto.common.v1.AnyValue.toObject(e.values[n],t)}return r},ma.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},ma.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.ArrayValue"},ma),p.KeyValueList=(fa.prototype.values=b.emptyArray,fa.create=function(e){return new fa(e)},fa.encode=function(e,t){if(t=t||v.create(),null!=e.values&&e.values.length)for(var r=0;r<e.values.length;++r)S.opentelemetry.proto.common.v1.KeyValue.encode(e.values[r],t.uint32(10).fork()).ldelim();return t},fa.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},fa.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.common.v1.KeyValueList;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?(o.values&&o.values.length||(o.values=[]),o.values.push(S.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()))):e.skipType(7&i)}return o},fa.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},fa.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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.values[t]);if(r)return"values."+r}}return null},fa.fromObject=function(e){if(e instanceof S.opentelemetry.proto.common.v1.KeyValueList)return e;var t=new S.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]=S.opentelemetry.proto.common.v1.KeyValue.fromObject(e.values[r])}}return t},fa.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]=S.opentelemetry.proto.common.v1.KeyValue.toObject(e.values[n],t)}return r},fa.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},fa.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.KeyValueList"},fa),p.KeyValue=(ha.prototype.key=null,ha.prototype.value=null,ha.create=function(e){return new ha(e)},ha.encode=function(e,t){return t=t||v.create(),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(10).string(e.key),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&S.opentelemetry.proto.common.v1.AnyValue.encode(e.value,t.uint32(18).fork()).ldelim(),t},ha.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},ha.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.common.v1.KeyValue;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.key=e.string();break;case 2:o.value=S.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break;default:e.skipType(7&i)}}return o},ha.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},ha.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.key&&e.hasOwnProperty("key")&&!b.isString(e.key))return"key: string expected";if(null!=e.value&&e.hasOwnProperty("value")){e=S.opentelemetry.proto.common.v1.AnyValue.verify(e.value);if(e)return"value."+e}return null},ha.fromObject=function(e){if(e instanceof S.opentelemetry.proto.common.v1.KeyValue)return e;var t=new S.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=S.opentelemetry.proto.common.v1.AnyValue.fromObject(e.value)}return t},ha.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=S.opentelemetry.proto.common.v1.AnyValue.toObject(e.value,t)),r},ha.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},ha.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.KeyValue"},ha),p.InstrumentationScope=(da.prototype.name=null,da.prototype.version=null,da.prototype.attributes=b.emptyArray,da.prototype.droppedAttributesCount=null,da.create=function(e){return new da(e)},da.encode=function(e,t){if(t=t||v.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)S.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},da.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},da.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.common.v1.InstrumentationScope;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>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(S.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 4:o.droppedAttributesCount=e.uint32();break;default:e.skipType(7&i)}}return o},da.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},da.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!b.isString(e.name))return"name: string expected";if(null!=e.version&&e.hasOwnProperty("version")&&!b.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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!b.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},da.fromObject=function(e){if(e instanceof S.opentelemetry.proto.common.v1.InstrumentationScope)return e;var t=new S.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]=S.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),t},da.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]=S.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),r},da.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},da.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.InstrumentationScope"},da),p.EntityRef=(pa.prototype.schemaUrl=null,pa.prototype.type=null,pa.prototype.idKeys=b.emptyArray,pa.prototype.descriptionKeys=b.emptyArray,pa.create=function(e){return new pa(e)},pa.encode=function(e,t){if(t=t||v.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},pa.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},pa.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.common.v1.EntityRef;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>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&i)}}return o},pa.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},pa.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!b.isString(e.schemaUrl))return"schemaUrl: string expected";if(null!=e.type&&e.hasOwnProperty("type")&&!b.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(!b.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(!b.isString(e.descriptionKeys[t]))return"descriptionKeys: string[] expected"}return null},pa.fromObject=function(e){if(e instanceof S.opentelemetry.proto.common.v1.EntityRef)return e;var t=new S.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},pa.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},pa.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},pa.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.EntityRef"},pa),p),d),o.resource=((i={}).v1=((r={}).Resource=(ca.prototype.attributes=b.emptyArray,ca.prototype.droppedAttributesCount=null,ca.prototype.entityRefs=b.emptyArray,ca.create=function(e){return new ca(e)},ca.encode=function(e,t){if(t=t||v.create(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)S.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)S.opentelemetry.proto.common.v1.EntityRef.encode(e.entityRefs[r],t.uint32(26).fork()).ldelim();return t},ca.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},ca.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.resource.v1.Resource;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(S.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(S.opentelemetry.proto.common.v1.EntityRef.decode(e,e.uint32()));break;default:e.skipType(7&i)}}return o},ca.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},ca.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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!b.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=S.opentelemetry.proto.common.v1.EntityRef.verify(e.entityRefs[t]))return"entityRefs."+r}}return null},ca.fromObject=function(e){if(e instanceof S.opentelemetry.proto.resource.v1.Resource)return e;var t=new S.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]=S.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]=S.opentelemetry.proto.common.v1.EntityRef.fromObject(e.entityRefs[r])}}return t},ca.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]=S.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]=S.opentelemetry.proto.common.v1.EntityRef.toObject(e.entityRefs[n],t);return r},ca.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},ca.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.resource.v1.Resource"},ca),r),i),o.trace=((h={}).v1=((p={}).TracesData=(la.prototype.resourceSpans=b.emptyArray,la.create=function(e){return new la(e)},la.encode=function(e,t){if(t=t||v.create(),null!=e.resourceSpans&&e.resourceSpans.length)for(var r=0;r<e.resourceSpans.length;++r)S.opentelemetry.proto.trace.v1.ResourceSpans.encode(e.resourceSpans[r],t.uint32(10).fork()).ldelim();return t},la.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},la.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.trace.v1.TracesData;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?(o.resourceSpans&&o.resourceSpans.length||(o.resourceSpans=[]),o.resourceSpans.push(S.opentelemetry.proto.trace.v1.ResourceSpans.decode(e,e.uint32()))):e.skipType(7&i)}return o},la.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},la.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=S.opentelemetry.proto.trace.v1.ResourceSpans.verify(e.resourceSpans[t]);if(r)return"resourceSpans."+r}}return null},la.fromObject=function(e){if(e instanceof S.opentelemetry.proto.trace.v1.TracesData)return e;var t=new S.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]=S.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(e.resourceSpans[r])}}return t},la.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]=S.opentelemetry.proto.trace.v1.ResourceSpans.toObject(e.resourceSpans[n],t)}return r},la.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},la.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.TracesData"},la),p.ResourceSpans=(ua.prototype.resource=null,ua.prototype.scopeSpans=b.emptyArray,ua.prototype.schemaUrl=null,ua.create=function(e){return new ua(e)},ua.encode=function(e,t){if(t=t||v.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&S.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)S.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},ua.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},ua.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.trace.v1.ResourceSpans;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.resource=S.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeSpans&&o.scopeSpans.length||(o.scopeSpans=[]),o.scopeSpans.push(S.opentelemetry.proto.trace.v1.ScopeSpans.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&i)}}return o},ua.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},ua.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=S.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=S.opentelemetry.proto.trace.v1.ScopeSpans.verify(e.scopeSpans[r]))return"scopeSpans."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!b.isString(e.schemaUrl)?"schemaUrl: string expected":null},ua.fromObject=function(e){if(e instanceof S.opentelemetry.proto.trace.v1.ResourceSpans)return e;var t=new S.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=S.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]=S.opentelemetry.proto.trace.v1.ScopeSpans.fromObject(e.scopeSpans[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},ua.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=S.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]=S.opentelemetry.proto.trace.v1.ScopeSpans.toObject(e.scopeSpans[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},ua.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},ua.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.ResourceSpans"},ua),p.ScopeSpans=(aa.prototype.scope=null,aa.prototype.spans=b.emptyArray,aa.prototype.schemaUrl=null,aa.create=function(e){return new aa(e)},aa.encode=function(e,t){if(t=t||v.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&S.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)S.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},aa.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},aa.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.trace.v1.ScopeSpans;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.scope=S.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.spans&&o.spans.length||(o.spans=[]),o.spans.push(S.opentelemetry.proto.trace.v1.Span.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&i)}}return o},aa.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},aa.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=S.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=S.opentelemetry.proto.trace.v1.Span.verify(e.spans[r]))return"spans."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!b.isString(e.schemaUrl)?"schemaUrl: string expected":null},aa.fromObject=function(e){if(e instanceof S.opentelemetry.proto.trace.v1.ScopeSpans)return e;var t=new S.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=S.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]=S.opentelemetry.proto.trace.v1.Span.fromObject(e.spans[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},aa.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=S.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]=S.opentelemetry.proto.trace.v1.Span.toObject(e.spans[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},aa.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},aa.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.ScopeSpans"},aa),p.Span=(E.prototype.traceId=null,E.prototype.spanId=null,E.prototype.traceState=null,E.prototype.parentSpanId=null,E.prototype.flags=null,E.prototype.name=null,E.prototype.kind=null,E.prototype.startTimeUnixNano=null,E.prototype.endTimeUnixNano=null,E.prototype.attributes=b.emptyArray,E.prototype.droppedAttributesCount=null,E.prototype.events=b.emptyArray,E.prototype.droppedEventsCount=null,E.prototype.links=b.emptyArray,E.prototype.droppedLinksCount=null,E.prototype.status=null,E.create=function(e){return new E(e)},E.encode=function(e,t){if(t=t||v.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)S.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)S.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)S.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")&&S.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},E.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},E.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.trace.v1.Span;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>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(S.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(S.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(S.opentelemetry.proto.trace.v1.Span.Link.decode(e,e.uint32()));break;case 14:o.droppedLinksCount=e.uint32();break;case 15:o.status=S.opentelemetry.proto.trace.v1.Status.decode(e,e.uint32());break;default:e.skipType(7&i)}}return o},E.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},E.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||b.isString(e.traceId)))return"traceId: buffer expected";if(null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||b.isString(e.spanId)))return"spanId: buffer expected";if(null!=e.traceState&&e.hasOwnProperty("traceState")&&!b.isString(e.traceState))return"traceState: string expected";if(null!=e.parentSpanId&&e.hasOwnProperty("parentSpanId")&&!(e.parentSpanId&&"number"==typeof e.parentSpanId.length||b.isString(e.parentSpanId)))return"parentSpanId: buffer expected";if(null!=e.flags&&e.hasOwnProperty("flags")&&!b.isInteger(e.flags))return"flags: integer expected";if(null!=e.name&&e.hasOwnProperty("name")&&!b.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")&&!(b.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&b.isInteger(e.startTimeUnixNano.low)&&b.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.endTimeUnixNano&&e.hasOwnProperty("endTimeUnixNano")&&!(b.isInteger(e.endTimeUnixNano)||e.endTimeUnixNano&&b.isInteger(e.endTimeUnixNano.low)&&b.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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!b.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=S.opentelemetry.proto.trace.v1.Span.Event.verify(e.events[t]))return"events."+r}if(null!=e.droppedEventsCount&&e.hasOwnProperty("droppedEventsCount")&&!b.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=S.opentelemetry.proto.trace.v1.Span.Link.verify(e.links[t]))return"links."+r}return null!=e.droppedLinksCount&&e.hasOwnProperty("droppedLinksCount")&&!b.isInteger(e.droppedLinksCount)?"droppedLinksCount: integer expected":null!=e.status&&e.hasOwnProperty("status")&&(r=S.opentelemetry.proto.trace.v1.Status.verify(e.status))?"status."+r:null;var r},E.fromObject=function(e){if(e instanceof S.opentelemetry.proto.trace.v1.Span)return e;var t=new S.opentelemetry.proto.trace.v1.Span;switch(null!=e.traceId&&("string"==typeof e.traceId?b.base64.decode(e.traceId,t.traceId=b.newBuffer(b.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?b.base64.decode(e.spanId,t.spanId=b.newBuffer(b.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?b.base64.decode(e.parentSpanId,t.parentSpanId=b.newBuffer(b.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&&(b.Long?(t.startTimeUnixNano=b.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 b.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.endTimeUnixNano&&(b.Long?(t.endTimeUnixNano=b.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 b.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]=S.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]=S.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]=S.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=S.opentelemetry.proto.trace.v1.Status.fromObject(e.status)}return t},E.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=b.newBuffer(n.traceId))),t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=b.newBuffer(n.spanId))),n.traceState="",t.bytes===String?n.parentSpanId="":(n.parentSpanId=[],t.bytes!==Array&&(n.parentSpanId=b.newBuffer(n.parentSpanId))),n.name="",n.kind=t.enums===String?"SPAN_KIND_UNSPECIFIED":0,b.Long?(r=new b.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,b.Long?(r=new b.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?b.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?b.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?b.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===S.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]?e.kind:S.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?b.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new b.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?b.Long.prototype.toString.call(e.endTimeUnixNano):t.longs===Number?new b.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]=S.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]=S.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]=S.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=S.opentelemetry.proto.trace.v1.Status.toObject(e.status,t)),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},E.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},E.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span"},E.SpanKind=(d={},(r=Object.create(d))[d[0]="SPAN_KIND_UNSPECIFIED"]=0,r[d[1]="SPAN_KIND_INTERNAL"]=1,r[d[2]="SPAN_KIND_SERVER"]=2,r[d[3]="SPAN_KIND_CLIENT"]=3,r[d[4]="SPAN_KIND_PRODUCER"]=4,r[d[5]="SPAN_KIND_CONSUMER"]=5,r),E.Event=(sa.prototype.timeUnixNano=null,sa.prototype.name=null,sa.prototype.attributes=b.emptyArray,sa.prototype.droppedAttributesCount=null,sa.create=function(e){return new sa(e)},sa.encode=function(e,t){if(t=t||v.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)S.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},sa.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},sa.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.trace.v1.Span.Event;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>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(S.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 4:o.droppedAttributesCount=e.uint32();break;default:e.skipType(7&i)}}return o},sa.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},sa.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(b.isInteger(e.timeUnixNano)||e.timeUnixNano&&b.isInteger(e.timeUnixNano.low)&&b.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.name&&e.hasOwnProperty("name")&&!b.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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!b.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},sa.fromObject=function(e){if(e instanceof S.opentelemetry.proto.trace.v1.Span.Event)return e;var t=new S.opentelemetry.proto.trace.v1.Span.Event;if(null!=e.timeUnixNano&&(b.Long?(t.timeUnixNano=b.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 b.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]=S.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),t},sa.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[]),t.defaults&&(b.Long?(r=new b.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?b.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new b.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]=S.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),n},sa.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},sa.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span.Event"},sa),E.Link=(ia.prototype.traceId=null,ia.prototype.spanId=null,ia.prototype.traceState=null,ia.prototype.attributes=b.emptyArray,ia.prototype.droppedAttributesCount=null,ia.prototype.flags=null,ia.create=function(e){return new ia(e)},ia.encode=function(e,t){if(t=t||v.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)S.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},ia.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},ia.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.trace.v1.Span.Link;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>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(S.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&i)}}return o},ia.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},ia.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||b.isString(e.traceId)))return"traceId: buffer expected";if(null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||b.isString(e.spanId)))return"spanId: buffer expected";if(null!=e.traceState&&e.hasOwnProperty("traceState")&&!b.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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!b.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null!=e.flags&&e.hasOwnProperty("flags")&&!b.isInteger(e.flags)?"flags: integer expected":null},ia.fromObject=function(e){if(e instanceof S.opentelemetry.proto.trace.v1.Span.Link)return e;var t=new S.opentelemetry.proto.trace.v1.Span.Link;if(null!=e.traceId&&("string"==typeof e.traceId?b.base64.decode(e.traceId,t.traceId=b.newBuffer(b.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?b.base64.decode(e.spanId,t.spanId=b.newBuffer(b.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]=S.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},ia.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=b.newBuffer(r.traceId))),t.bytes===String?r.spanId="":(r.spanId=[],t.bytes!==Array&&(r.spanId=b.newBuffer(r.spanId))),r.traceState="",r.droppedAttributesCount=0,r.flags=0),null!=e.traceId&&e.hasOwnProperty("traceId")&&(r.traceId=t.bytes===String?b.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?b.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]=S.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},ia.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},ia.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span.Link"},ia),E),p.Status=(oa.prototype.message=null,oa.prototype.code=null,oa.create=function(e){return new oa(e)},oa.encode=function(e,t){return t=t||v.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},oa.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},oa.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.trace.v1.Status;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 2:o.message=e.string();break;case 3:o.code=e.int32();break;default:e.skipType(7&i)}}return o},oa.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},oa.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.message&&e.hasOwnProperty("message")&&!b.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},oa.fromObject=function(e){if(e instanceof S.opentelemetry.proto.trace.v1.Status)return e;var t=new S.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},oa.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===S.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]?e.code:S.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]),r},oa.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},oa.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Status"},oa.StatusCode=(d={},(r=Object.create(d))[d[0]="STATUS_CODE_UNSET"]=0,r[d[1]="STATUS_CODE_OK"]=1,r[d[2]="STATUS_CODE_ERROR"]=2,r),oa),p.SpanFlags=(d={},(r=Object.create(d))[d[0]="SPAN_FLAGS_DO_NOT_USE"]=0,r[d[255]="SPAN_FLAGS_TRACE_FLAGS_MASK"]=255,r[d[256]="SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK"]=256,r[d[512]="SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK"]=512,r),p),h),o.collector=((i={}).trace=((d={}).v1=((r={}).TraceService=(((na.prototype=Object.create(y.rpc.Service.prototype)).constructor=na).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(na.prototype.export=function e(t,r){return this.rpcCall(e,S.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest,S.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,t,r)},"name",{value:"Export"}),na),r.ExportTraceServiceRequest=(ra.prototype.resourceSpans=b.emptyArray,ra.create=function(e){return new ra(e)},ra.encode=function(e,t){if(t=t||v.create(),null!=e.resourceSpans&&e.resourceSpans.length)for(var r=0;r<e.resourceSpans.length;++r)S.opentelemetry.proto.trace.v1.ResourceSpans.encode(e.resourceSpans[r],t.uint32(10).fork()).ldelim();return t},ra.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},ra.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?(o.resourceSpans&&o.resourceSpans.length||(o.resourceSpans=[]),o.resourceSpans.push(S.opentelemetry.proto.trace.v1.ResourceSpans.decode(e,e.uint32()))):e.skipType(7&i)}return o},ra.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},ra.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=S.opentelemetry.proto.trace.v1.ResourceSpans.verify(e.resourceSpans[t]);if(r)return"resourceSpans."+r}}return null},ra.fromObject=function(e){if(e instanceof S.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest)return e;var t=new S.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]=S.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(e.resourceSpans[r])}}return t},ra.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]=S.opentelemetry.proto.trace.v1.ResourceSpans.toObject(e.resourceSpans[n],t)}return r},ra.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},ra.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"},ra),r.ExportTraceServiceResponse=(ta.prototype.partialSuccess=null,ta.create=function(e){return new ta(e)},ta.encode=function(e,t){return t=t||v.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&S.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},ta.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},ta.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?o.partialSuccess=S.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.decode(e,e.uint32()):e.skipType(7&i)}return o},ta.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},ta.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=S.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},ta.fromObject=function(e){if(e instanceof S.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse)return e;var t=new S.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=S.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.fromObject(e.partialSuccess)}return t},ta.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=S.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.toObject(e.partialSuccess,t)),r},ta.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},ta.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse"},ta),r.ExportTracePartialSuccess=(ea.prototype.rejectedSpans=null,ea.prototype.errorMessage=null,ea.create=function(e){return new ea(e)},ea.encode=function(e,t){return t=t||v.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},ea.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},ea.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.rejectedSpans=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&i)}}return o},ea.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},ea.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedSpans&&e.hasOwnProperty("rejectedSpans")&&!(b.isInteger(e.rejectedSpans)||e.rejectedSpans&&b.isInteger(e.rejectedSpans.low)&&b.isInteger(e.rejectedSpans.high))?"rejectedSpans: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!b.isString(e.errorMessage)?"errorMessage: string expected":null},ea.fromObject=function(e){var t;return e instanceof S.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess?e:(t=new S.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess,null!=e.rejectedSpans&&(b.Long?(t.rejectedSpans=b.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 b.LongBits(e.rejectedSpans.low>>>0,e.rejectedSpans.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},ea.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(b.Long?(r=new b.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?b.Long.prototype.toString.call(e.rejectedSpans):t.longs===Number?new b.LongBits(e.rejectedSpans.low>>>0,e.rejectedSpans.high>>>0).toNumber():e.rejectedSpans),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},ea.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},ea.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess"},ea),r),d),i.metrics=((p={}).v1=((h={}).MetricsService=(((Zs.prototype=Object.create(y.rpc.Service.prototype)).constructor=Zs).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(Zs.prototype.export=function e(t,r){return this.rpcCall(e,S.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,S.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,t,r)},"name",{value:"Export"}),Zs),h.ExportMetricsServiceRequest=(Qs.prototype.resourceMetrics=b.emptyArray,Qs.create=function(e){return new Qs(e)},Qs.encode=function(e,t){if(t=t||v.create(),null!=e.resourceMetrics&&e.resourceMetrics.length)for(var r=0;r<e.resourceMetrics.length;++r)S.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(e.resourceMetrics[r],t.uint32(10).fork()).ldelim();return t},Qs.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Qs.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?(o.resourceMetrics&&o.resourceMetrics.length||(o.resourceMetrics=[]),o.resourceMetrics.push(S.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(e,e.uint32()))):e.skipType(7&i)}return o},Qs.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Qs.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=S.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(e.resourceMetrics[t]);if(r)return"resourceMetrics."+r}}return null},Qs.fromObject=function(e){if(e instanceof S.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest)return e;var t=new S.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]=S.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(e.resourceMetrics[r])}}return t},Qs.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]=S.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(e.resourceMetrics[n],t)}return r},Qs.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Qs.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest"},Qs),h.ExportMetricsServiceResponse=(Xs.prototype.partialSuccess=null,Xs.create=function(e){return new Xs(e)},Xs.encode=function(e,t){return t=t||v.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&S.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},Xs.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Xs.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?o.partialSuccess=S.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.decode(e,e.uint32()):e.skipType(7&i)}return o},Xs.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Xs.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=S.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},Xs.fromObject=function(e){if(e instanceof S.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse)return e;var t=new S.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=S.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.fromObject(e.partialSuccess)}return t},Xs.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=S.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.toObject(e.partialSuccess,t)),r},Xs.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Xs.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse"},Xs),h.ExportMetricsPartialSuccess=($s.prototype.rejectedDataPoints=null,$s.prototype.errorMessage=null,$s.create=function(e){return new $s(e)},$s.encode=function(e,t){return t=t||v.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},$s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},$s.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.rejectedDataPoints=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&i)}}return o},$s.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},$s.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedDataPoints&&e.hasOwnProperty("rejectedDataPoints")&&!(b.isInteger(e.rejectedDataPoints)||e.rejectedDataPoints&&b.isInteger(e.rejectedDataPoints.low)&&b.isInteger(e.rejectedDataPoints.high))?"rejectedDataPoints: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!b.isString(e.errorMessage)?"errorMessage: string expected":null},$s.fromObject=function(e){var t;return e instanceof S.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess?e:(t=new S.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess,null!=e.rejectedDataPoints&&(b.Long?(t.rejectedDataPoints=b.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 b.LongBits(e.rejectedDataPoints.low>>>0,e.rejectedDataPoints.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},$s.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(b.Long?(r=new b.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?b.Long.prototype.toString.call(e.rejectedDataPoints):t.longs===Number?new b.LongBits(e.rejectedDataPoints.low>>>0,e.rejectedDataPoints.high>>>0).toNumber():e.rejectedDataPoints),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},$s.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},$s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess"},$s),h),p),i.logs=((r={}).v1=((d={}).LogsService=(((Js.prototype=Object.create(y.rpc.Service.prototype)).constructor=Js).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(Js.prototype.export=function e(t,r){return this.rpcCall(e,S.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,S.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,t,r)},"name",{value:"Export"}),Js),d.ExportLogsServiceRequest=(Ws.prototype.resourceLogs=b.emptyArray,Ws.create=function(e){return new Ws(e)},Ws.encode=function(e,t){if(t=t||v.create(),null!=e.resourceLogs&&e.resourceLogs.length)for(var r=0;r<e.resourceLogs.length;++r)S.opentelemetry.proto.logs.v1.ResourceLogs.encode(e.resourceLogs[r],t.uint32(10).fork()).ldelim();return t},Ws.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Ws.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?(o.resourceLogs&&o.resourceLogs.length||(o.resourceLogs=[]),o.resourceLogs.push(S.opentelemetry.proto.logs.v1.ResourceLogs.decode(e,e.uint32()))):e.skipType(7&i)}return o},Ws.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Ws.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=S.opentelemetry.proto.logs.v1.ResourceLogs.verify(e.resourceLogs[t]);if(r)return"resourceLogs."+r}}return null},Ws.fromObject=function(e){if(e instanceof S.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest)return e;var t=new S.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]=S.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(e.resourceLogs[r])}}return t},Ws.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]=S.opentelemetry.proto.logs.v1.ResourceLogs.toObject(e.resourceLogs[n],t)}return r},Ws.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Ws.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest"},Ws),d.ExportLogsServiceResponse=(Ys.prototype.partialSuccess=null,Ys.create=function(e){return new Ys(e)},Ys.encode=function(e,t){return t=t||v.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&S.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},Ys.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Ys.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?o.partialSuccess=S.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.decode(e,e.uint32()):e.skipType(7&i)}return o},Ys.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Ys.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=S.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},Ys.fromObject=function(e){if(e instanceof S.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse)return e;var t=new S.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=S.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.fromObject(e.partialSuccess)}return t},Ys.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=S.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.toObject(e.partialSuccess,t)),r},Ys.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Ys.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse"},Ys),d.ExportLogsPartialSuccess=(Ks.prototype.rejectedLogRecords=null,Ks.prototype.errorMessage=null,Ks.create=function(e){return new Ks(e)},Ks.encode=function(e,t){return t=t||v.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},Ks.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Ks.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.rejectedLogRecords=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&i)}}return o},Ks.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Ks.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedLogRecords&&e.hasOwnProperty("rejectedLogRecords")&&!(b.isInteger(e.rejectedLogRecords)||e.rejectedLogRecords&&b.isInteger(e.rejectedLogRecords.low)&&b.isInteger(e.rejectedLogRecords.high))?"rejectedLogRecords: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!b.isString(e.errorMessage)?"errorMessage: string expected":null},Ks.fromObject=function(e){var t;return e instanceof S.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess?e:(t=new S.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess,null!=e.rejectedLogRecords&&(b.Long?(t.rejectedLogRecords=b.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 b.LongBits(e.rejectedLogRecords.low>>>0,e.rejectedLogRecords.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},Ks.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(b.Long?(r=new b.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?b.Long.prototype.toString.call(e.rejectedLogRecords):t.longs===Number?new b.LongBits(e.rejectedLogRecords.low>>>0,e.rejectedLogRecords.high>>>0).toNumber():e.rejectedLogRecords),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},Ks.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Ks.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess"},Ks),d),r),i),o.metrics=((h={}).v1=((p={}).MetricsData=(Gs.prototype.resourceMetrics=b.emptyArray,Gs.create=function(e){return new Gs(e)},Gs.encode=function(e,t){if(t=t||v.create(),null!=e.resourceMetrics&&e.resourceMetrics.length)for(var r=0;r<e.resourceMetrics.length;++r)S.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(e.resourceMetrics[r],t.uint32(10).fork()).ldelim();return t},Gs.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Gs.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.MetricsData;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?(o.resourceMetrics&&o.resourceMetrics.length||(o.resourceMetrics=[]),o.resourceMetrics.push(S.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(e,e.uint32()))):e.skipType(7&i)}return o},Gs.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Gs.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=S.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(e.resourceMetrics[t]);if(r)return"resourceMetrics."+r}}return null},Gs.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.MetricsData)return e;var t=new S.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]=S.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(e.resourceMetrics[r])}}return t},Gs.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]=S.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(e.resourceMetrics[n],t)}return r},Gs.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Gs.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.MetricsData"},Gs),p.ResourceMetrics=(zs.prototype.resource=null,zs.prototype.scopeMetrics=b.emptyArray,zs.prototype.schemaUrl=null,zs.create=function(e){return new zs(e)},zs.encode=function(e,t){if(t=t||v.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&S.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)S.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},zs.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},zs.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.ResourceMetrics;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.resource=S.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeMetrics&&o.scopeMetrics.length||(o.scopeMetrics=[]),o.scopeMetrics.push(S.opentelemetry.proto.metrics.v1.ScopeMetrics.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&i)}}return o},zs.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},zs.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=S.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=S.opentelemetry.proto.metrics.v1.ScopeMetrics.verify(e.scopeMetrics[r]))return"scopeMetrics."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!b.isString(e.schemaUrl)?"schemaUrl: string expected":null},zs.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.ResourceMetrics)return e;var t=new S.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=S.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]=S.opentelemetry.proto.metrics.v1.ScopeMetrics.fromObject(e.scopeMetrics[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},zs.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=S.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]=S.opentelemetry.proto.metrics.v1.ScopeMetrics.toObject(e.scopeMetrics[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},zs.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},zs.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ResourceMetrics"},zs),p.ScopeMetrics=(Hs.prototype.scope=null,Hs.prototype.metrics=b.emptyArray,Hs.prototype.schemaUrl=null,Hs.create=function(e){return new Hs(e)},Hs.encode=function(e,t){if(t=t||v.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&S.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)S.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},Hs.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Hs.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.ScopeMetrics;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.scope=S.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.metrics&&o.metrics.length||(o.metrics=[]),o.metrics.push(S.opentelemetry.proto.metrics.v1.Metric.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&i)}}return o},Hs.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Hs.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=S.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=S.opentelemetry.proto.metrics.v1.Metric.verify(e.metrics[r]))return"metrics."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!b.isString(e.schemaUrl)?"schemaUrl: string expected":null},Hs.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.ScopeMetrics)return e;var t=new S.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=S.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]=S.opentelemetry.proto.metrics.v1.Metric.fromObject(e.metrics[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},Hs.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=S.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]=S.opentelemetry.proto.metrics.v1.Metric.toObject(e.metrics[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},Hs.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Hs.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ScopeMetrics"},Hs),p.Metric=(qs.prototype.name=null,qs.prototype.description=null,qs.prototype.unit=null,qs.prototype.gauge=null,qs.prototype.sum=null,qs.prototype.histogram=null,qs.prototype.exponentialHistogram=null,qs.prototype.summary=null,qs.prototype.metadata=b.emptyArray,Object.defineProperty(qs.prototype,"data",{get:b.oneOfGetter(d=["gauge","sum","histogram","exponentialHistogram","summary"]),set:b.oneOfSetter(d)}),qs.create=function(e){return new qs(e)},qs.encode=function(e,t){if(t=t||v.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")&&S.opentelemetry.proto.metrics.v1.Gauge.encode(e.gauge,t.uint32(42).fork()).ldelim(),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&S.opentelemetry.proto.metrics.v1.Sum.encode(e.sum,t.uint32(58).fork()).ldelim(),null!=e.histogram&&Object.hasOwnProperty.call(e,"histogram")&&S.opentelemetry.proto.metrics.v1.Histogram.encode(e.histogram,t.uint32(74).fork()).ldelim(),null!=e.exponentialHistogram&&Object.hasOwnProperty.call(e,"exponentialHistogram")&&S.opentelemetry.proto.metrics.v1.ExponentialHistogram.encode(e.exponentialHistogram,t.uint32(82).fork()).ldelim(),null!=e.summary&&Object.hasOwnProperty.call(e,"summary")&&S.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)S.opentelemetry.proto.common.v1.KeyValue.encode(e.metadata[r],t.uint32(98).fork()).ldelim();return t},qs.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},qs.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.Metric;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>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=S.opentelemetry.proto.metrics.v1.Gauge.decode(e,e.uint32());break;case 7:o.sum=S.opentelemetry.proto.metrics.v1.Sum.decode(e,e.uint32());break;case 9:o.histogram=S.opentelemetry.proto.metrics.v1.Histogram.decode(e,e.uint32());break;case 10:o.exponentialHistogram=S.opentelemetry.proto.metrics.v1.ExponentialHistogram.decode(e,e.uint32());break;case 11:o.summary=S.opentelemetry.proto.metrics.v1.Summary.decode(e,e.uint32());break;case 12:o.metadata&&o.metadata.length||(o.metadata=[]),o.metadata.push(S.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;default:e.skipType(7&i)}}return o},qs.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},qs.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.name&&e.hasOwnProperty("name")&&!b.isString(e.name))return"name: string expected";if(null!=e.description&&e.hasOwnProperty("description")&&!b.isString(e.description))return"description: string expected";if(null!=e.unit&&e.hasOwnProperty("unit")&&!b.isString(e.unit))return"unit: string expected";if(null!=e.gauge&&e.hasOwnProperty("gauge")&&(t.data=1,r=S.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=S.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=S.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=S.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=S.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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.metadata[n]))return"metadata."+r}return null},qs.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.Metric)return e;var t=new S.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=S.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=S.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=S.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=S.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=S.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]=S.opentelemetry.proto.common.v1.KeyValue.fromObject(e.metadata[r])}}return t},qs.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=S.opentelemetry.proto.metrics.v1.Gauge.toObject(e.gauge,t),t.oneofs)&&(r.data="gauge"),null!=e.sum&&e.hasOwnProperty("sum")&&(r.sum=S.opentelemetry.proto.metrics.v1.Sum.toObject(e.sum,t),t.oneofs)&&(r.data="sum"),null!=e.histogram&&e.hasOwnProperty("histogram")&&(r.histogram=S.opentelemetry.proto.metrics.v1.Histogram.toObject(e.histogram,t),t.oneofs)&&(r.data="histogram"),null!=e.exponentialHistogram&&e.hasOwnProperty("exponentialHistogram")&&(r.exponentialHistogram=S.opentelemetry.proto.metrics.v1.ExponentialHistogram.toObject(e.exponentialHistogram,t),t.oneofs)&&(r.data="exponentialHistogram"),null!=e.summary&&e.hasOwnProperty("summary")&&(r.summary=S.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]=S.opentelemetry.proto.common.v1.KeyValue.toObject(e.metadata[n],t)}return r},qs.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},qs.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Metric"},qs),p.Gauge=(Fs.prototype.dataPoints=b.emptyArray,Fs.create=function(e){return new Fs(e)},Fs.encode=function(e,t){if(t=t||v.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)S.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return t},Fs.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Fs.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.Gauge;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?(o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(S.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()))):e.skipType(7&i)}return o},Fs.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Fs.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=S.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}return null},Fs.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.Gauge)return e;var t=new S.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]=S.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[r])}}return t},Fs.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]=S.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[n],t)}return r},Fs.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Fs.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Gauge"},Fs),p.Sum=(Bs.prototype.dataPoints=b.emptyArray,Bs.prototype.aggregationTemporality=null,Bs.prototype.isMonotonic=null,Bs.create=function(e){return new Bs(e)},Bs.encode=function(e,t){if(t=t||v.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)S.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},Bs.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Bs.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.Sum;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(S.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&i)}}return o},Bs.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Bs.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=S.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},Bs.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.Sum)return e;var t=new S.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]=S.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},Bs.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]=S.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===S.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:S.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),null!=e.isMonotonic&&e.hasOwnProperty("isMonotonic")&&(r.isMonotonic=e.isMonotonic),r},Bs.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Bs.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Sum"},Bs),p.Histogram=(Vs.prototype.dataPoints=b.emptyArray,Vs.prototype.aggregationTemporality=null,Vs.create=function(e){return new Vs(e)},Vs.encode=function(e,t){if(t=t||v.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)S.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},Vs.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Vs.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.Histogram;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(S.opentelemetry.proto.metrics.v1.HistogramDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;default:e.skipType(7&i)}}return o},Vs.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Vs.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=S.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},Vs.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.Histogram)return e;var t=new S.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]=S.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},Vs.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]=S.opentelemetry.proto.metrics.v1.HistogramDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===S.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:S.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),r},Vs.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Vs.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Histogram"},Vs),p.ExponentialHistogram=(Ms.prototype.dataPoints=b.emptyArray,Ms.prototype.aggregationTemporality=null,Ms.create=function(e){return new Ms(e)},Ms.encode=function(e,t){if(t=t||v.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)S.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},Ms.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Ms.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.ExponentialHistogram;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(S.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;default:e.skipType(7&i)}}return o},Ms.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Ms.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=S.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},Ms.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.ExponentialHistogram)return e;var t=new S.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]=S.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},Ms.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]=S.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===S.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:S.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),r},Ms.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Ms.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogram"},Ms),p.Summary=(Ds.prototype.dataPoints=b.emptyArray,Ds.create=function(e){return new Ds(e)},Ds.encode=function(e,t){if(t=t||v.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)S.opentelemetry.proto.metrics.v1.SummaryDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return t},Ds.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Ds.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.Summary;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?(o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(S.opentelemetry.proto.metrics.v1.SummaryDataPoint.decode(e,e.uint32()))):e.skipType(7&i)}return o},Ds.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Ds.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=S.opentelemetry.proto.metrics.v1.SummaryDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}return null},Ds.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.Summary)return e;var t=new S.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]=S.opentelemetry.proto.metrics.v1.SummaryDataPoint.fromObject(e.dataPoints[r])}}return t},Ds.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]=S.opentelemetry.proto.metrics.v1.SummaryDataPoint.toObject(e.dataPoints[n],t)}return r},Ds.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Ds.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Summary"},Ds),p.AggregationTemporality=(d={},(r=Object.create(d))[d[0]="AGGREGATION_TEMPORALITY_UNSPECIFIED"]=0,r[d[1]="AGGREGATION_TEMPORALITY_DELTA"]=1,r[d[2]="AGGREGATION_TEMPORALITY_CUMULATIVE"]=2,r),p.DataPointFlags=(d={},(r=Object.create(d))[d[0]="DATA_POINT_FLAGS_DO_NOT_USE"]=0,r[d[1]="DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK"]=1,r),p.NumberDataPoint=(js.prototype.attributes=b.emptyArray,js.prototype.startTimeUnixNano=null,js.prototype.timeUnixNano=null,js.prototype.asDouble=null,js.prototype.asInt=null,js.prototype.exemplars=b.emptyArray,js.prototype.flags=null,Object.defineProperty(js.prototype,"value",{get:b.oneOfGetter(d=["asDouble","asInt"]),set:b.oneOfSetter(d)}),js.create=function(e){return new js(e)},js.encode=function(e,t){if(t=t||v.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)S.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)S.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},js.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},js.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.NumberDataPoint;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 7:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(S.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(S.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 8:o.flags=e.uint32();break;default:e.skipType(7&i)}}return o},js.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},js.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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[n]))return"attributes."+t}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(b.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&b.isInteger(e.startTimeUnixNano.low)&&b.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(b.isInteger(e.timeUnixNano)||e.timeUnixNano&&b.isInteger(e.timeUnixNano.low)&&b.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,!(b.isInteger(e.asInt)||e.asInt&&b.isInteger(e.asInt.low)&&b.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=S.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[n]))return"exemplars."+t}return null!=e.flags&&e.hasOwnProperty("flags")&&!b.isInteger(e.flags)?"flags: integer expected":null},js.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.NumberDataPoint)return e;var t=new S.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]=S.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(b.Long?(t.startTimeUnixNano=b.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 b.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(b.Long?(t.timeUnixNano=b.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 b.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.asDouble&&(t.asDouble=Number(e.asDouble)),null!=e.asInt&&(b.Long?(t.asInt=b.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 b.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]=S.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),t},js.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.exemplars=[],n.attributes=[]),t.defaults&&(b.Long?(r=new b.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,b.Long?(r=new b.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?b.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new b.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?b.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new b.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]=S.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?b.Long.prototype.toString.call(e.asInt):t.longs===Number?new b.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]=S.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},js.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},js.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.NumberDataPoint"},js),p.HistogramDataPoint=(w.prototype.attributes=b.emptyArray,w.prototype.startTimeUnixNano=null,w.prototype.timeUnixNano=null,w.prototype.count=null,w.prototype.sum=null,w.prototype.bucketCounts=b.emptyArray,w.prototype.explicitBounds=b.emptyArray,w.prototype.exemplars=b.emptyArray,w.prototype.flags=null,w.prototype.min=null,w.prototype.max=null,Object.defineProperty(w.prototype,"_sum",{get:b.oneOfGetter(r=["sum"]),set:b.oneOfSetter(r)}),Object.defineProperty(w.prototype,"_min",{get:b.oneOfGetter(r=["min"]),set:b.oneOfSetter(r)}),Object.defineProperty(w.prototype,"_max",{get:b.oneOfGetter(r=["max"]),set:b.oneOfSetter(r)}),w.create=function(e){return new w(e)},w.encode=function(e,t){if(t=t||v.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)S.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)S.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},w.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},w.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.HistogramDataPoint;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 9:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(S.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&i))for(var s=e.uint32()+e.pos;e.pos<s;)o.bucketCounts.push(e.fixed64());else o.bucketCounts.push(e.fixed64());break;case 7:if(o.explicitBounds&&o.explicitBounds.length||(o.explicitBounds=[]),2==(7&i))for(s=e.uint32()+e.pos;e.pos<s;)o.explicitBounds.push(e.double());else o.explicitBounds.push(e.double());break;case 8:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(S.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&i)}}return o},w.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},w.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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(b.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&b.isInteger(e.startTimeUnixNano.low)&&b.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(b.isInteger(e.timeUnixNano)||e.timeUnixNano&&b.isInteger(e.timeUnixNano.low)&&b.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(b.isInteger(e.count)||e.count&&b.isInteger(e.count.low)&&b.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(!(b.isInteger(e.bucketCounts[t])||e.bucketCounts[t]&&b.isInteger(e.bucketCounts[t].low)&&b.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=S.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[t]))return"exemplars."+r}}return null!=e.flags&&e.hasOwnProperty("flags")&&!b.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},w.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.HistogramDataPoint)return e;var t=new S.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]=S.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(b.Long?(t.startTimeUnixNano=b.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 b.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(b.Long?(t.timeUnixNano=b.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 b.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(b.Long?(t.count=b.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 b.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)b.Long?(t.bucketCounts[r]=b.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 b.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]=S.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},w.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.bucketCounts=[],n.explicitBounds=[],n.exemplars=[],n.attributes=[]),t.defaults&&(b.Long?(r=new b.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,b.Long?(r=new b.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,b.Long?(r=new b.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?b.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new b.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?b.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new b.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?b.Long.prototype.toString.call(e.count):t.longs===Number?new b.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?b.Long.prototype.toString.call(e.bucketCounts[o]):t.longs===Number?new b.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]=S.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]=S.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},w.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},w.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.HistogramDataPoint"},w),p.ExponentialHistogramDataPoint=(T.prototype.attributes=b.emptyArray,T.prototype.startTimeUnixNano=null,T.prototype.timeUnixNano=null,T.prototype.count=null,T.prototype.sum=null,T.prototype.scale=null,T.prototype.zeroCount=null,T.prototype.positive=null,T.prototype.negative=null,T.prototype.flags=null,T.prototype.exemplars=b.emptyArray,T.prototype.min=null,T.prototype.max=null,T.prototype.zeroThreshold=null,Object.defineProperty(T.prototype,"_sum",{get:b.oneOfGetter(d=["sum"]),set:b.oneOfSetter(d)}),Object.defineProperty(T.prototype,"_min",{get:b.oneOfGetter(d=["min"]),set:b.oneOfSetter(d)}),Object.defineProperty(T.prototype,"_max",{get:b.oneOfGetter(d=["max"]),set:b.oneOfSetter(d)}),T.create=function(e){return new T(e)},T.encode=function(e,t){if(t=t||v.create(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)S.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")&&S.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(e.positive,t.uint32(66).fork()).ldelim(),null!=e.negative&&Object.hasOwnProperty.call(e,"negative")&&S.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)S.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},T.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},T.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(S.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=S.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(e,e.uint32());break;case 9:o.negative=S.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(S.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&i)}}return o},T.decodeDelimited=function(e){return e instanceof _||(e=new _(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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(b.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&b.isInteger(e.startTimeUnixNano.low)&&b.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(b.isInteger(e.timeUnixNano)||e.timeUnixNano&&b.isInteger(e.timeUnixNano.low)&&b.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(b.isInteger(e.count)||e.count&&b.isInteger(e.count.low)&&b.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")&&!b.isInteger(e.scale))return"scale: integer expected";if(null!=e.zeroCount&&e.hasOwnProperty("zeroCount")&&!(b.isInteger(e.zeroCount)||e.zeroCount&&b.isInteger(e.zeroCount.low)&&b.isInteger(e.zeroCount.high)))return"zeroCount: integer|Long expected";if(null!=e.positive&&e.hasOwnProperty("positive")&&(r=S.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(e.positive)))return"positive."+r;if(null!=e.negative&&e.hasOwnProperty("negative")&&(r=S.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(e.negative)))return"negative."+r;if(null!=e.flags&&e.hasOwnProperty("flags")&&!b.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=S.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},T.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint)return e;var t=new S.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]=S.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(b.Long?(t.startTimeUnixNano=b.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 b.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(b.Long?(t.timeUnixNano=b.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 b.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(b.Long?(t.count=b.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 b.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&&(b.Long?(t.zeroCount=b.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 b.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=S.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=S.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]=S.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},T.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[],n.exemplars=[]),t.defaults&&(b.Long?(r=new b.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,b.Long?(r=new b.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,b.Long?(r=new b.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,b.Long?(r=new b.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]=S.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?b.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new b.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?b.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new b.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?b.Long.prototype.toString.call(e.count):t.longs===Number?new b.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?b.Long.prototype.toString.call(e.zeroCount):t.longs===Number?new b.LongBits(e.zeroCount.low>>>0,e.zeroCount.high>>>0).toNumber():e.zeroCount),null!=e.positive&&e.hasOwnProperty("positive")&&(n.positive=S.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(e.positive,t)),null!=e.negative&&e.hasOwnProperty("negative")&&(n.negative=S.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]=S.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},T.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},T.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint"},T.Buckets=(Ls.prototype.offset=null,Ls.prototype.bucketCounts=b.emptyArray,Ls.create=function(e){return new Ls(e)},Ls.encode=function(e,t){if(t=t||v.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},Ls.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Ls.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.offset=e.sint32();break;case 2:if(o.bucketCounts&&o.bucketCounts.length||(o.bucketCounts=[]),2==(7&i))for(var s=e.uint32()+e.pos;e.pos<s;)o.bucketCounts.push(e.uint64());else o.bucketCounts.push(e.uint64());break;default:e.skipType(7&i)}}return o},Ls.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Ls.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.offset&&e.hasOwnProperty("offset")&&!b.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(!(b.isInteger(e.bucketCounts[t])||e.bucketCounts[t]&&b.isInteger(e.bucketCounts[t].low)&&b.isInteger(e.bucketCounts[t].high)))return"bucketCounts: integer|Long[] expected"}return null},Ls.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets)return e;var t=new S.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)b.Long?(t.bucketCounts[r]=b.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 b.LongBits(e.bucketCounts[r].low>>>0,e.bucketCounts[r].high>>>0).toNumber(!0))}return t},Ls.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?b.Long.prototype.toString.call(e.bucketCounts[n]):t.longs===Number?new b.LongBits(e.bucketCounts[n].low>>>0,e.bucketCounts[n].high>>>0).toNumber(!0):e.bucketCounts[n]}return r},Ls.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Ls.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets"},Ls),T),p.SummaryDataPoint=(Us.prototype.attributes=b.emptyArray,Us.prototype.startTimeUnixNano=null,Us.prototype.timeUnixNano=null,Us.prototype.count=null,Us.prototype.sum=null,Us.prototype.quantileValues=b.emptyArray,Us.prototype.flags=null,Us.create=function(e){return new Us(e)},Us.encode=function(e,t){if(t=t||v.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)S.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)S.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},Us.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Us.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.SummaryDataPoint;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 7:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(S.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(S.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.decode(e,e.uint32()));break;case 8:o.flags=e.uint32();break;default:e.skipType(7&i)}}return o},Us.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Us.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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(b.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&b.isInteger(e.startTimeUnixNano.low)&&b.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(b.isInteger(e.timeUnixNano)||e.timeUnixNano&&b.isInteger(e.timeUnixNano.low)&&b.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(b.isInteger(e.count)||e.count&&b.isInteger(e.count.low)&&b.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=S.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify(e.quantileValues[t]))return"quantileValues."+r}}return null!=e.flags&&e.hasOwnProperty("flags")&&!b.isInteger(e.flags)?"flags: integer expected":null},Us.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.SummaryDataPoint)return e;var t=new S.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]=S.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(b.Long?(t.startTimeUnixNano=b.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 b.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(b.Long?(t.timeUnixNano=b.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 b.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(b.Long?(t.count=b.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 b.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]=S.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.fromObject(e.quantileValues[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),t},Us.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.quantileValues=[],n.attributes=[]),t.defaults&&(b.Long?(r=new b.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,b.Long?(r=new b.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,b.Long?(r=new b.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?b.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new b.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?b.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new b.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?b.Long.prototype.toString.call(e.count):t.longs===Number?new b.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]=S.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]=S.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},Us.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Us.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.SummaryDataPoint"},Us.ValueAtQuantile=(ks.prototype.quantile=null,ks.prototype.value=null,ks.create=function(e){return new ks(e)},ks.encode=function(e,t){return t=t||v.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},ks.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},ks.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.quantile=e.double();break;case 2:o.value=e.double();break;default:e.skipType(7&i)}}return o},ks.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},ks.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},ks.fromObject=function(e){var t;return e instanceof S.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile?e:(t=new S.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile,null!=e.quantile&&(t.quantile=Number(e.quantile)),null!=e.value&&(t.value=Number(e.value)),t)},ks.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},ks.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},ks.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile"},ks),Us),p.Exemplar=(Ps.prototype.filteredAttributes=b.emptyArray,Ps.prototype.timeUnixNano=null,Ps.prototype.asDouble=null,Ps.prototype.asInt=null,Ps.prototype.spanId=null,Ps.prototype.traceId=null,Object.defineProperty(Ps.prototype,"value",{get:b.oneOfGetter(r=["asDouble","asInt"]),set:b.oneOfSetter(r)}),Ps.create=function(e){return new Ps(e)},Ps.encode=function(e,t){if(t=t||v.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)S.opentelemetry.proto.common.v1.KeyValue.encode(e.filteredAttributes[r],t.uint32(58).fork()).ldelim();return t},Ps.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Ps.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.metrics.v1.Exemplar;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 7:o.filteredAttributes&&o.filteredAttributes.length||(o.filteredAttributes=[]),o.filteredAttributes.push(S.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&i)}}return o},Ps.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Ps.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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.filteredAttributes[r]);if(n)return"filteredAttributes."+n}}if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(b.isInteger(e.timeUnixNano)||e.timeUnixNano&&b.isInteger(e.timeUnixNano.low)&&b.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,!(b.isInteger(e.asInt)||e.asInt&&b.isInteger(e.asInt.low)&&b.isInteger(e.asInt.high)))return"asInt: integer|Long expected"}return null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||b.isString(e.spanId))?"spanId: buffer expected":null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||b.isString(e.traceId))?"traceId: buffer expected":null},Ps.fromObject=function(e){if(e instanceof S.opentelemetry.proto.metrics.v1.Exemplar)return e;var t=new S.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]=S.opentelemetry.proto.common.v1.KeyValue.fromObject(e.filteredAttributes[r])}}return null!=e.timeUnixNano&&(b.Long?(t.timeUnixNano=b.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 b.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.asDouble&&(t.asDouble=Number(e.asDouble)),null!=e.asInt&&(b.Long?(t.asInt=b.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 b.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber())),null!=e.spanId&&("string"==typeof e.spanId?b.base64.decode(e.spanId,t.spanId=b.newBuffer(b.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceId&&("string"==typeof e.traceId?b.base64.decode(e.traceId,t.traceId=b.newBuffer(b.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),t},Ps.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.filteredAttributes=[]),t.defaults&&(b.Long?(r=new b.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=b.newBuffer(n.spanId))),t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=b.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?b.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new b.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?b.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?b.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?b.Long.prototype.toString.call(e.asInt):t.longs===Number?new b.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]=S.opentelemetry.proto.common.v1.KeyValue.toObject(e.filteredAttributes[o],t)}return n},Ps.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Ps.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Exemplar"},Ps),p),h),o.logs=((i={}).v1=((d={}).LogsData=(Is.prototype.resourceLogs=b.emptyArray,Is.create=function(e){return new Is(e)},Is.encode=function(e,t){if(t=t||v.create(),null!=e.resourceLogs&&e.resourceLogs.length)for(var r=0;r<e.resourceLogs.length;++r)S.opentelemetry.proto.logs.v1.ResourceLogs.encode(e.resourceLogs[r],t.uint32(10).fork()).ldelim();return t},Is.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Is.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.logs.v1.LogsData;e.pos<n;){var i=e.uint32();if(i===r)break;i>>>3==1?(o.resourceLogs&&o.resourceLogs.length||(o.resourceLogs=[]),o.resourceLogs.push(S.opentelemetry.proto.logs.v1.ResourceLogs.decode(e,e.uint32()))):e.skipType(7&i)}return o},Is.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Is.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=S.opentelemetry.proto.logs.v1.ResourceLogs.verify(e.resourceLogs[t]);if(r)return"resourceLogs."+r}}return null},Is.fromObject=function(e){if(e instanceof S.opentelemetry.proto.logs.v1.LogsData)return e;var t=new S.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]=S.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(e.resourceLogs[r])}}return t},Is.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]=S.opentelemetry.proto.logs.v1.ResourceLogs.toObject(e.resourceLogs[n],t)}return r},Is.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Is.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.LogsData"},Is),d.ResourceLogs=(Ns.prototype.resource=null,Ns.prototype.scopeLogs=b.emptyArray,Ns.prototype.schemaUrl=null,Ns.create=function(e){return new Ns(e)},Ns.encode=function(e,t){if(t=t||v.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&S.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)S.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},Ns.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Ns.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.logs.v1.ResourceLogs;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.resource=S.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeLogs&&o.scopeLogs.length||(o.scopeLogs=[]),o.scopeLogs.push(S.opentelemetry.proto.logs.v1.ScopeLogs.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&i)}}return o},Ns.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Ns.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=S.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=S.opentelemetry.proto.logs.v1.ScopeLogs.verify(e.scopeLogs[r]))return"scopeLogs."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!b.isString(e.schemaUrl)?"schemaUrl: string expected":null},Ns.fromObject=function(e){if(e instanceof S.opentelemetry.proto.logs.v1.ResourceLogs)return e;var t=new S.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=S.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]=S.opentelemetry.proto.logs.v1.ScopeLogs.fromObject(e.scopeLogs[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},Ns.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=S.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]=S.opentelemetry.proto.logs.v1.ScopeLogs.toObject(e.scopeLogs[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},Ns.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Ns.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.ResourceLogs"},Ns),d.ScopeLogs=(Rs.prototype.scope=null,Rs.prototype.logRecords=b.emptyArray,Rs.prototype.schemaUrl=null,Rs.create=function(e){return new Rs(e)},Rs.encode=function(e,t){if(t=t||v.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&S.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)S.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},Rs.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Rs.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.logs.v1.ScopeLogs;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>3){case 1:o.scope=S.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.logRecords&&o.logRecords.length||(o.logRecords=[]),o.logRecords.push(S.opentelemetry.proto.logs.v1.LogRecord.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&i)}}return o},Rs.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Rs.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=S.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=S.opentelemetry.proto.logs.v1.LogRecord.verify(e.logRecords[r]))return"logRecords."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!b.isString(e.schemaUrl)?"schemaUrl: string expected":null},Rs.fromObject=function(e){if(e instanceof S.opentelemetry.proto.logs.v1.ScopeLogs)return e;var t=new S.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=S.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]=S.opentelemetry.proto.logs.v1.LogRecord.fromObject(e.logRecords[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},Rs.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=S.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]=S.opentelemetry.proto.logs.v1.LogRecord.toObject(e.logRecords[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},Rs.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Rs.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.ScopeLogs"},Rs),d.SeverityNumber=(r={},(p=Object.create(r))[r[0]="SEVERITY_NUMBER_UNSPECIFIED"]=0,p[r[1]="SEVERITY_NUMBER_TRACE"]=1,p[r[2]="SEVERITY_NUMBER_TRACE2"]=2,p[r[3]="SEVERITY_NUMBER_TRACE3"]=3,p[r[4]="SEVERITY_NUMBER_TRACE4"]=4,p[r[5]="SEVERITY_NUMBER_DEBUG"]=5,p[r[6]="SEVERITY_NUMBER_DEBUG2"]=6,p[r[7]="SEVERITY_NUMBER_DEBUG3"]=7,p[r[8]="SEVERITY_NUMBER_DEBUG4"]=8,p[r[9]="SEVERITY_NUMBER_INFO"]=9,p[r[10]="SEVERITY_NUMBER_INFO2"]=10,p[r[11]="SEVERITY_NUMBER_INFO3"]=11,p[r[12]="SEVERITY_NUMBER_INFO4"]=12,p[r[13]="SEVERITY_NUMBER_WARN"]=13,p[r[14]="SEVERITY_NUMBER_WARN2"]=14,p[r[15]="SEVERITY_NUMBER_WARN3"]=15,p[r[16]="SEVERITY_NUMBER_WARN4"]=16,p[r[17]="SEVERITY_NUMBER_ERROR"]=17,p[r[18]="SEVERITY_NUMBER_ERROR2"]=18,p[r[19]="SEVERITY_NUMBER_ERROR3"]=19,p[r[20]="SEVERITY_NUMBER_ERROR4"]=20,p[r[21]="SEVERITY_NUMBER_FATAL"]=21,p[r[22]="SEVERITY_NUMBER_FATAL2"]=22,p[r[23]="SEVERITY_NUMBER_FATAL3"]=23,p[r[24]="SEVERITY_NUMBER_FATAL4"]=24,p),d.LogRecordFlags=(r={},(p=Object.create(r))[r[0]="LOG_RECORD_FLAGS_DO_NOT_USE"]=0,p[r[255]="LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"]=255,p),d.LogRecord=(Cs.prototype.timeUnixNano=null,Cs.prototype.observedTimeUnixNano=null,Cs.prototype.severityNumber=null,Cs.prototype.severityText=null,Cs.prototype.body=null,Cs.prototype.attributes=b.emptyArray,Cs.prototype.droppedAttributesCount=null,Cs.prototype.flags=null,Cs.prototype.traceId=null,Cs.prototype.spanId=null,Cs.prototype.eventName=null,Cs.create=function(e){return new Cs(e)},Cs.encode=function(e,t){if(t=t||v.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")&&S.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)S.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},Cs.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Cs.decode=function(e,t,r){e instanceof _||(e=_.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new S.opentelemetry.proto.logs.v1.LogRecord;e.pos<n;){var i=e.uint32();if(i===r)break;switch(i>>>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=S.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break;case 6:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(S.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&i)}}return o},Cs.decodeDelimited=function(e){return e instanceof _||(e=new _(e)),this.decode(e,e.uint32())},Cs.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(b.isInteger(e.timeUnixNano)||e.timeUnixNano&&b.isInteger(e.timeUnixNano.low)&&b.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.observedTimeUnixNano&&e.hasOwnProperty("observedTimeUnixNano")&&!(b.isInteger(e.observedTimeUnixNano)||e.observedTimeUnixNano&&b.isInteger(e.observedTimeUnixNano.low)&&b.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")&&!b.isString(e.severityText))return"severityText: string expected";if(null!=e.body&&e.hasOwnProperty("body")&&(t=S.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=S.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[r]))return"attributes."+t}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!b.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null!=e.flags&&e.hasOwnProperty("flags")&&!b.isInteger(e.flags)?"flags: integer expected":null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||b.isString(e.traceId))?"traceId: buffer expected":null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||b.isString(e.spanId))?"spanId: buffer expected":null!=e.eventName&&e.hasOwnProperty("eventName")&&!b.isString(e.eventName)?"eventName: string expected":null},Cs.fromObject=function(e){if(e instanceof S.opentelemetry.proto.logs.v1.LogRecord)return e;var t=new S.opentelemetry.proto.logs.v1.LogRecord;switch(null!=e.timeUnixNano&&(b.Long?(t.timeUnixNano=b.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 b.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.observedTimeUnixNano&&(b.Long?(t.observedTimeUnixNano=b.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 b.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=S.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]=S.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?b.base64.decode(e.traceId,t.traceId=b.newBuffer(b.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?b.base64.decode(e.spanId,t.spanId=b.newBuffer(b.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.eventName&&(t.eventName=String(e.eventName)),t},Cs.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[]),t.defaults&&(b.Long?(r=new b.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=b.newBuffer(n.traceId))),t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=b.newBuffer(n.spanId))),b.Long?(r=new b.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?b.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new b.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===S.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]?e.severityNumber:S.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=S.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]=S.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?b.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?b.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?b.Long.prototype.toString.call(e.observedTimeUnixNano):t.longs===Number?new b.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber():e.observedTimeUnixNano),null!=e.eventName&&e.hasOwnProperty("eventName")&&(n.eventName=e.eventName),n},Cs.prototype.toJSON=function(){return this.constructor.toObject(this,y.util.toJSONOptions)},Cs.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.LogRecord"},Cs),d),i),o),s);h=S;function ya(e){return 48<=e&&e<=57?e-48:97<=e&&e<=102?e-87:e-55}function _a(t){var r=new Uint8Array(t.length/2);let n=0;for(let e=0;e<t.length;e+=2){var o=ya(t.charCodeAt(e)),i=ya(t.charCodeAt(e+1));r[n++]=o<<4|i}return r}function va(e){var t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function ba(e){return e=va(e),{low:Number(BigInt.asUintN(32,e)),high:Number(BigInt.asUintN(32,e>>BigInt(32)))}}let Sa="undefined"!=typeof BigInt?function(e){return va(e).toString()}:function(e){return e[0]*Qo+e[1]};function Ta(e){return e}function wa(e){if(void 0!==e)return _a(e)}let Ea={encodeHrTime:ba,encodeSpanContext:_a,encodeOptionalSpanContext:wa};function Aa(e){var t;return void 0===e?Ea:(t=e.useLongBits??!0,e=e.useHex??!1,{encodeHrTime:t?ba:Sa,encodeSpanContext:e?Ta:_a,encodeOptionalSpanContext:e?Ta:wa})}function Oa(e){var t={attributes:Ca(e.attributes),droppedAttributesCount:0},e=e.schemaUrl;return e&&""!==e&&(t.schemaUrl=e),t}function xa(e){return{name:e.name,version:e.version}}function Ca(t){return Object.keys(t).map(e=>Ra(e,t[e]))}function Ra(e,t){return{key:e,value:Na(t)}}function Na(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(Na)}}:"object"==t&&null!=e?{kvlistValue:{values:Object.entries(e).map(([e,t])=>Ra(e,t))}}:{}}function Ia(e,n){e=(e=>{var s,a=new Map;for(s of e){let{resource:e,instrumentationScope:{name:t,version:r="",schemaUrl:n=""}}=s,o=a.get(e);o||(o=new Map,a.set(e,o));var u=t+`@${r}:`+n;let i=o.get(u);i||(i=[],o.set(u,i)),i.push(s)}return a})(e);return Array.from(e,([e,t])=>{e=Oa(e);return{resource:e,scopeLogs:Array.from(t,([,e])=>({scope:xa(e[0].instrumentationScope),logRecords:e.map(e=>{return e=e,{timeUnixNano:(t=n).encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:Na(e.body),eventName:e.eventName,attributes:(r=e.attributes,Object.keys(r).map(e=>Ra(e,r[e]))),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)};var t,r}),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:e.schemaUrl}})}h.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,h.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;let Pa=Math.pow(2,-1022);function Ua(e){var t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((2146435072&t.getUint32(0))>>20)-1023}function ka(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 La(e,t){return 0===e||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}class ja extends Error{}class Da{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<Pa?this._minNormalLowerBoundaryIndex():Ua(e)+this._rightShift(ka(e)-1,52)>>this._shift}lowerBoundary(e){var t=this._minNormalLowerBoundaryIndex();if(e<t)throw new ja(`underflow: ${e} is < minimum lower boundary: `+t);t=this._maxNormalLowerBoundaryIndex();if(t<e)throw new ja(`overflow: ${e} is > maximum lower boundary: `+t);return La(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 1023>>this._shift}_rightShift(e,t){return Math.floor(e*Math.pow(2,-t))}}class Ma{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=La(Math.LOG2E,e),this._inverseFactor=La(Math.LN2,-e)}mapToIndex(e){var t;return e<=Pa?this._minNormalLowerBoundaryIndex()-1:0===ka(e)?(Ua(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 ja(`overflow: ${e} is > maximum lower boundary: `+t)}t=this._minNormalLowerBoundaryIndex();if(e<=t){if(e===t)return Pa;if(e===t-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new ja(`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?Ma:Da)(t-10));let Va=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class Ba{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){t=new Ba({},t);return t._rawAttributes=Fa(e),t._asyncAttributesPending=0<e.filter(([,e])=>Va(e)).length,t}constructor(e,t){var e=e.attributes??{};this._rawAttributes=Object.entries(e).map(([e,t])=>(Va(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Fa(this._rawAttributes),this._schemaUrl="string"==typeof(e=t?.schemaUrl)||void 0===e?e:void f.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,Va(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&f.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;var e,t,r={};for([e,t]of this._rawAttributes)Va(t)?f.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 f.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,Ba.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r))}}function Fa(e){return e.map(([t,e])=>Va(e)?[t,e.catch(e=>{f.debug("promise rejection for resource attribute: %s - %s",t,e)})]:[t,e])}function qa(e,t){let r=255&e|256;return t&&(r|=512),r}function Ha(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:Ca(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>{return t=r,{attributes:(e=e).attributes?Ca(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?Ca(e.attributes):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:qa(e.context.traceFlags,e.context.isRemote)};var t}),droppedLinksCount:e.droppedLinksCount,flags:qa(t.traceFlags,e.parentSpanContext?.isRemote)}}function za(e,i){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),s=[],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=>Ha(e,i));r.push({scope:xa(t[0].instrumentationScope),spans:e,schemaUrl:t[0].instrumentationScope.schemaUrl})}o=n.next()}var l=Oa(e),l={resource:l,scopeSpans:r,schemaUrl:l.schemaUrl};s.push(l),u=a.next()}return s}h.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,h.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,h.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,h.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;let Ga={serializeRequest:e=>{e={resourceLogs:Ia(e,Aa({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)))}},Ka={serializeRequest:e=>{e={resourceSpans:za(e,Aa({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)))}};class Ya{_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,i=1e3;for(;"retryable"===n.status&&0<o;){o--;let e=Math.max(Math.min(i,5e3)+(.4*Math.random()-.2),0);i*=1.5;var s=n.retryInMillis??e,a=r-Date.now();if(a<s)return n;n=await this.retry(t,a,s)}return n}shutdown(){return this._transport.shutdown()}}function Wa(e){return new Ya(e.transport)}function Ja(e){return[429,502,503,504].includes(e)}function $a(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 Xa{_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?(f.debug("XHR success"),t({status:"success"})):r.status&&Ja(r.status)?t({status:"retryable",retryInMillis:$a(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 Qa{_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}))?(f.debug("SendBeacon success"),e({status:"success"})):e({status:"failure",error:new Error("SendBeacon failed")})})}shutdown(){}}class Za{_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 f.debug("response success"),{status:"success"};if(Ja(r.status)){let e=r.headers.get("Retry-After");return{status:"retryable",retryInMillis:$a(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 eu(e,t){return Ei(e,t,Wa({transport:(t=e,new Xa(t))}))}function tu(e,t){return Ei(e,t,Wa({transport:(t=e,new Za(t))}))}function ru(e,t){return Ei(e,t,Wa({transport:(t={url:e.url,headers:e.headers},new Qa(t))}))}function nu(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):f.warn(`Header "${e}" has invalid value (${t}) and will be ignored`)}),r})(await r())),Object.assign(t,e)}}function ou(e,t,r){return i={url:e.url,timeoutMillis:e.timeoutMillis,headers:"function"==typeof(i=e).headers?i.headers:null!=(o=i.headers)?async()=>o:void 0,concurrencyLimit:e.concurrencyLimit},n=r,{...vr(i,e={},r={timeoutMillis:1e4,concurrencyLimit:30,compression:"none",headers:async()=>n,url:"http://localhost:4318/"+t}),headers:nu(i.headers,e.headers,r.headers),url:(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}'`)}})(i.url)??e.url??r.url};var n,o,i}function iu(e,t,r,n){return(e.headers||"function"!=typeof navigator.sendBeacon?void 0!==globalThis.fetch?tu:eu:ru)(ou(e,r,n),t)}var su,r=M(Object.freeze({__proto__:null,OTLPLogExporter:class extends yr{constructor(e={}){super(iu(e,Ga,"v1/logs",{"Content-Type":"application/json"}))}}}));(p=su=su||{})[p.UNSPECIFIED=0]="UNSPECIFIED",p[p.TRACE=1]="TRACE",p[p.TRACE2=2]="TRACE2",p[p.TRACE3=3]="TRACE3",p[p.TRACE4=4]="TRACE4",p[p.DEBUG=5]="DEBUG",p[p.DEBUG2=6]="DEBUG2",p[p.DEBUG3=7]="DEBUG3",p[p.DEBUG4=8]="DEBUG4",p[p.INFO=9]="INFO",p[p.INFO2=10]="INFO2",p[p.INFO3=11]="INFO3",p[p.INFO4=12]="INFO4",p[p.WARN=13]="WARN",p[p.WARN2=14]="WARN2",p[p.WARN3=15]="WARN3",p[p.WARN4=16]="WARN4",p[p.ERROR=17]="ERROR",p[p.ERROR2=18]="ERROR2",p[p.ERROR3=19]="ERROR3",p[p.ERROR4=20]="ERROR4",p[p.FATAL=21]="FATAL",p[p.FATAL2=22]="FATAL2",p[p.FATAL3=23]="FATAL3",p[p.FATAL4=24]="FATAL4";class au{emit(e){}}let uu=new au,lu=new class{getLogger(e,t,r){return new au}};class cu{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):uu)}}class pu{getLogger(e,t,r){var n;return null!=(n=this._getDelegateLogger(e,t,r))?n:new cu(this,e,t,r)}_getDelegate(){var e;return null!=(e=this._delegate)?e:lu}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getLogger(e,t,r)}}let du="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof Ee?Ee:{},hu=Symbol.for("io.opentelemetry.js.api.logs"),fu=du;var mu,d=class qh{constructor(){this._proxyLoggerProvider=new pu}static getInstance(){return this._instance||(this._instance=new qh),this._instance}setGlobalLoggerProvider(e){return fu[hu]?this.getLoggerProvider():(fu[hu]=(t=e,r=lu,e=>1===e?t:r),this._proxyLoggerProvider._setDelegate(e),e);var t,r}getLoggerProvider(){var e;return null!=(e=null==(e=fu[hu])?void 0:e.call(fu,1))?e:this._proxyLoggerProvider}getLogger(e,t,r){return this.getLoggerProvider().getLogger(e,t,r)}disable(){delete fu[hu],this._proxyLoggerProvider=new pu}}.getInstance(),i=M(Object.freeze({__proto__:null,logs:d,get SeverityNumber(){return su},NOOP_LOGGER:uu,NoopLogger:au,ProxyLoggerProvider:pu}));class gu{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:i,severityText:s,body:a,attributes:u={},context:l}=r,c=Date.now();if(this.hrTime=ti(r??c),this.hrTimeObserved=ti(n??c),l){let e=jo.getSpanContext(l);e&&Zn(e)&&(this.spanContext=e)}this.severityNumber=i,this.severityText=s,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?f.warn("Invalid attribute key: "+e):Bo(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&&f.warn("Dropping extra attributes."):Bo(t)?this.attributes[e]=this._truncateToSize(t):this.attributes[e]=t):f.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?(f.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&&f.warn("Can not execute the operation on emitted log record"),this._isReadonly}}class yu{instrumentationScope;_sharedState;constructor(e,t){this.instrumentationScope=e,this._sharedState=t}emit(e){var t=e.context||bo.active(),e=new gu(this._sharedState,this.instrumentationScope,{context:t,...e});this._sharedState.activeProcessor.onEmit(e,t),e._makeReadonly()}}class _u{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}}class vu{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let t=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(e=>vi(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 bu{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 vu(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new _u}}let Su=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=function r(n,o,i=0,s){let a;if(!(20<i)){if(i++,yi(n)||yi(o)||mi(o))a=di(o);else if(fi(n)){if(a=n.slice(),fi(o))for(let e=0,t=o.length;e<t;e++)a.push(di(o[e]));else if(gi(o)){let r=Object.keys(o);for(let t=0,e=r.length;t<e;t++){let e=r[t];a[e]=di(o[e])}}}else if(gi(n))if(gi(o)){if(e=o,!pi(n)||!pi(e))return o;a=Object.assign({},n);var u=Object.keys(o);for(let e=0,t=u.length;e<t;e++){var l=u[e],c=o[l];if(yi(c))void 0===c?delete a[l]:a[l]=c;else{var p=a[l],d=c;if(hi(n,l,s)||hi(o,l,s))delete a[l];else{if(gi(p)&&gi(d)){let e=s.get(p)||[],t=s.get(d)||[];e.push({obj:n,key:l}),t.push({obj:o,key:l}),s.set(p,e),s.set(d,t)}a[l]=r(a[l],c,i,s)}}}}else a=o;return a}var e}(t,e.shift(),0,r);return t})([{},{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},includeTraceContext:!0},e]),r=e.resource??(r={"service.name":"unknown_service","telemetry.sdk.language":$o[Yo],"telemetry.sdk.name":$o[Wo],"telemetry.sdk.version":$o[Jo]},Ba.FromAttributeList(Object.entries(r),void 0));this._sharedState=new bu(r,t.forceFlushTimeoutMillis,{attributeCountLimit:(t=t.logRecordLimits).attributeCountLimit??128,attributeValueLengthLimit:t.attributeValueLengthLimit??1/0},e?.processors??[]),this._shutdownOnce=new Si(this._shutdown,this)}getLogger(e,t,r){if(this._shutdownOnce.isCalled)return f.warn("A shutdown LoggerProvider cannot provide a Logger"),uu;e||f.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 yu({name:e,version:t,schemaUrl:r?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(n)}forceFlush(){return this._shutdownOnce.isCalled?(f.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(f.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:Lo.SUCCESS})}},SimpleLogRecordProcessor:class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new Si(this._shutdown,this),this._unresolvedExports=new Set}onEmit(r){if(!this._shutdownOnce.isCalled){let t=()=>Ti._export(this._exporter,[r]).then(e=>{e.code!==Lo.SUCCESS&&Ho(e.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${e})`))}).catch(Ho);if(r.resource.asyncAttributesPending){let e=r.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(e),t()),Ho);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:Lo.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),t({code:Lo.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}},BatchLogRecordProcessor:class extends class{_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 Si(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(f.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)=>{vi(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,Ho(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=()=>Ti._export(this._exporter,e).then(e=>{e.code!==Lo.SUCCESS&&Ho(e.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${e})`))}).catch(Ho),r=e.map(e=>e.resource).filter(e=>e.asyncAttributesPending);return 0===r.length?t():Promise.all(r.map(e=>e.waitForAsyncAttributes?.())).then(t,Ho)}}{_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))}}}),Tu=M(Su),wu=$r("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Eu(e){return e.setValue(wu,!0)}function Au(e){return!0===e.getValue(wu)}let Ou="baggage";class xu{inject(e,r,n){var o=Uo.getBaggage(e);if(o&&!Au(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,Ou,t)}}extract(e,t,r){r=r.get(t,Ou),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(";"),i=-1===o?n:n.substring(0,o),e=i.indexOf("=");if(!(e<=0)){var s=i.substring(0,e).trim(),i=i.substring(e+1).trim();if(s&&i){let e,t,r;try{e=decodeURIComponent(s),t=decodeURIComponent(i)}catch{return}return-1!==o&&o<n.length-1&&(r=Jr(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:Uo.setBaggage(e,Uo.createBaggage(n))}fields(){return[Ou]}}function Cu(t){var r,n={};if("object"==typeof t&&null!=t)for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&("string"!=typeof(r=e)||""===r?f.warn("Invalid attribute key: "+e):Ru(r=t[e])?Array.isArray(r)?n[e]=r.slice():n[e]=r:f.warn("Invalid attribute value set for key: "+e));return n}function Ru(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)return;if(!Nu(e))return;t=e}}return 1})(e):Nu(typeof e))}function Nu(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}let Iu=e=>{var t;f.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 Pu(e){try{Iu(e)}catch{}}let Uu={"telemetry.sdk.name":"opentelemetry","process.runtime.name":"browser","telemetry.sdk.language":"webjs","telemetry.sdk.version":"2.7.1"},ku=performance,Lu=Math.pow(10,6),ju=Math.pow(10,9);function Du(e){return[Math.trunc(e/1e3),Math.round(e%1e3*Lu)]}function Mu(e){return zu(Du(ku.timeOrigin),Du("number"==typeof e?e:ku.now()))}function Vu(e){if(qu(e))return e;if("number"==typeof e)return(e<ku.timeOrigin?Mu:Du)(e);if(e instanceof Date)return Du(e.getTime());throw TypeError("Invalid input type")}function Bu(e){return e[0]*ju+e[1]}function Fu(e){return 1e6*e[0]+e[1]/1e3}function qu(e){return Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Hu(e){return qu(e)||"number"==typeof e||e instanceof Date}function zu(e,t){e=[e[0]+t[0],e[1]+t[1]];return e[1]>=ju&&(e[1]-=ju,e[0]+=1),e}(o=mu=mu||{})[o.SUCCESS=0]="SUCCESS",o[o.FAILED=1]="FAILED";class Gu{_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){f.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){f.warn(`Failed to extract with ${t.constructor.name}. Err: `+e.message)}return e},e)}fields(){return this._fields.slice()}}let Ku="[_0-9a-z-*/]",Yu=new RegExp(`^(?:${`[a-z]${Ku}{0,255}`}|${`[a-z0-9]${Ku}{0,240}@[a-z]${Ku}{0,13}`})$`),Wu=/^[ -~]{0,255}[!-~]$/,Ju=/,|=/;function $u(e){return Yu.test(e)}function Xu(e){return Wu.test(e)&&!Ju.test(e)}class Qu{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState="string"==typeof e?e:"",this._length=this._rawTraceState.length}set(e,t){var r,n,o;return!$u(e)||!Xu(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),i=e.slice(t+1);if($u(o)&&Xu(i)){var s=n+e.length+(0<r.size?1:0);if(!(512<s)&&(r.set(o,i),n=s,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(Qu.prototype);return r._internalState=e,r._length=t,r}}let Zu="traceparent",el="tracestate",tl=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");class rl{inject(e,t,r){var n=jo.getSpanContext(e);n&&!Au(e)&&Zn(n)&&(e=`00-${n.traceId}-${n.spanId}-0`+Number(n.traceFlags||Rn.NONE).toString(16),r.set(t,Zu,e),n.traceState)&&r.set(t,el,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=tl.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,el);if(r){let e=Array.isArray(r)?r.join(","):r;n.traceState=new Qu("string"==typeof e?e:void 0)}return jo.setSpanContext(e,n)}fields(){return[Zu,el]}}let nl="[object Null]",ol="[object Undefined]",il=Function.prototype.toString,sl=il.call(Object),al=Object.getPrototypeOf,ul=Object.prototype,ll=ul.hasOwnProperty,cl=Symbol?Symbol.toStringTag:void 0,pl=ul.toString;function dl(e){if(null!=e&&"object"==typeof e&&"[object Object]"===(t=>{if(null==t)return void 0===t?ol:nl;if(cl&&cl in Object(t)){var r=t,n=ll.call(r,cl),o=r[cl];let e=!1;try{r[cl]=void 0,e=!0}catch{}var i=pl.call(r);return e&&(n?r[cl]=o:delete r[cl]),i}return n=t,pl.call(n)})(e))return null===(e=al(e))||"function"==typeof(e=ll.call(e,"constructor")&&e.constructor)&&e instanceof e&&il.call(e)===sl}function hl(e){return ml(e)?e.slice():e}function fl(r,n,e){var o=e.get(r[n])||[];for(let e=0,t=o.length;e<t;e++){var i=o[e];if(i.key===n&&i.obj===r)return 1}}function ml(e){return Array.isArray(e)}function gl(e){return"function"==typeof e}function yl(e){return!_l(e)&&!ml(e)&&!gl(e)&&"object"==typeof e}function _l(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||e instanceof Date||e instanceof RegExp||null===e}class vl{_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 bl{_isCalled=!1;_deferred=new vl;_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}}l.ALL,l.VERBOSE,l.DEBUG,l.INFO,l.WARN,l.ERROR,l.NONE;let Sl={_export:function(t,r){return new Promise(e=>{bo.with(Eu(bo.active()),()=>{t.export(r,e)})})}},Tl;function wl(){if(void 0===Tl)try{var e=globalThis.process.argv0;Tl=e?"unknown_service:"+e:"unknown_service"}catch{Tl="unknown_service"}return Tl}let El=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class Al{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){t=new Al({},t);return t._rawAttributes=Rl(e),t._asyncAttributesPending=0<e.filter(([,e])=>El(e)).length,t}constructor(e,t){var e=e.attributes??{};this._rawAttributes=Object.entries(e).map(([e,t])=>(El(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Rl(this._rawAttributes),this._schemaUrl="string"==typeof(e=t?.schemaUrl)||void 0===e?e:void f.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,El(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&f.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;var e,t,r={};for([e,t]of this._rawAttributes)El(t)?f.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 f.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,Al.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r))}}function Ol(e,t){return Al.FromAttributeList(Object.entries(e),t)}function xl(){return Ol({})}function Cl(){return Ol({"service.name":wl(),"telemetry.sdk.language":Uu[Yo],"telemetry.sdk.name":Uu[Wo],"telemetry.sdk.version":Uu[Jo]})}function Rl(e){return e.map(([t,e])=>El(e)?[t,e.catch(e=>{f.debug("promise rejection for resource attribute: %s - %s",t,e)})]:[t,e])}function Nl(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=J({url:e.url||Vl,headers:{"X-Tps-TenantID":e.tenantId||Ml},attributes:{}},e);return new Ul({resource:Ll.defaultResource().merge(Ll.resourceFromAttributes(J({"tps.tenant.id":e.tenantId||Ml,"service.name":"JsSIP","service.version":Dl.version},t))),processors:[new kl(new Pl(r))]}).getLogger("JsSIP",Dl.version)}var s=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[i,s]=e,i=i.trim(),s=s.trim();if(0===i.length)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${n}".`);let t,r;try{t=decodeURIComponent(i),r=decodeURIComponent(s)}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}},h=new class{detect(){return{attributes:{}}}},p=M(Object.freeze({__proto__:null,detectResources:(n={})=>(n.detectors||[]).map(t=>{try{r=t.detect(n);var e=new Al(r,void 0);return f.debug(t.constructor.name+" found resource.",e),e}catch(e){return f.debug(t.constructor.name+" failed: "+e.message),xl()}var r}).reduce((e,t)=>e.merge(t),xl()),envDetector:s,hostDetector:h,osDetector:h,processDetector:h,serviceInstanceIdDetector:h,resourceFromAttributes:Ol,defaultResource:Cl,emptyResource:xl,defaultServiceName:wl})),d={exports:{}},Il=(d.exports=j.default,n.inspect),Pl=r.OTLPLogExporter,o=i,Ul=Tu.LoggerProvider,kl=Tu.BatchLogRecordProcessor,Ll=p,s=d.exports,jl=ye(),Dl=V,Ml="tccc",Vl="https://otlp.tccc.qcloud.com/v1/logs",h=jl.newUUID(),Bl={provider:Nl({tenantId:Ml,url:Vl}),attributes:{uuid:h,"trtc.version":s.VERSION}},Fl=(Be.setConfig=function(e){Bl.provider=Nl(e)},Be.setAttributes=function(e){Bl.attributes=Object.assign(Bl.attributes,e)},{DEBUG:{severityNumber:o.SeverityNumber.DEBUG,severityText:"debug"},INFO:{severityNumber:o.SeverityNumber.INFO,severityText:"info"},WARN:{severityNumber:o.SeverityNumber.WARN,severityText:"warn"},ERROR:{severityNumber:o.SeverityNumber.ERROR,severityText:"error"}}),ql=(Be.log=function(e,t,r){for(var n=arguments.length,o=new Array(3<n?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];Bl.provider.emit(J(J({},Fl[(null==t?void 0:t.toUpperCase())||"DEBUG"]),{},{attributes:J(J({},jl.toPlainObject(r)),jl.toPlainObject(Bl.attributes)),body:"".concat(e||""," ").concat(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Il.apply(void 0,t.concat([{compact:!0,breakLength:1/0}])).slice(1,-1).replace(/((\\r|\\n)\\n(\\n)?)/g,"\n")}.apply(void 0,o))}))},ce.exports),Hl=F,zl=Be,Gl="TCCCSIP",j=e(Kl,[{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)),!(Kl._logLevel>Hl.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)),!(Kl._logLevel>Hl.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)),!(Kl._logLevel>Hl.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(Kl._log_report){var o={};try{0<r.length&&"object"===Z(r[r.length-1])&&(Object.assign(o,r[r.length-1]),r=r.slice(0,-1))}catch(e){}zl.log.apply(zl,[this.prefix,e,o].concat(X(r)))}}}],[{key:"setLogLevel",value:function(e){Kl._logLevel=e}},{key:"setLogReport",value:function(e){Kl._log_report=e}},{key:"setConfig",value:function(e){zl.setConfig(e)}},{key:"setAttributes",value:function(e){zl.setAttributes(e)}}]);function Kl(e){c(this,Kl),e?(this._debug=ql.default("".concat(Gl,":").concat(e)),this._warn=ql.default("".concat(Gl,":WARN:").concat(e)),this._error=ql.default("".concat(Gl,":ERROR:").concat(e)),this.prefix=e):(this._debug=ql.default(Gl),this._warn=ql.default("".concat(Gl,":WARN")),this._error=ql.default("".concat(Gl,":ERROR"))),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}j.setLogLevel(Hl.LOG_LEVEL.TRACE),j.setLogReport(!0);var n=j,r={},i={},h={exports:{}},Yl=h.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"]}]},s=(Object.keys(Yl).forEach(function(e){Yl[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})}),i);function Wl(e){return String(Number(e))===e?Number(e):e}function Jl(e,t){var r=t.split(/=(.+)/,2);return 2===r.length?e[r[0]]=Wl(r[1]):1===r.length&&1<t.length&&(e[r[0]]=void 0),e}function $l(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 i=t.names[o];n.push(t.name?r[t.name][i]:r[t.names[o]])}else n.push(r[t.name]);return tc.apply(null,n)}var Xl=h.exports,Ql=RegExp.prototype.test.bind(/^([a-z])=(.*)/),Zl=(s.parse=function(e){var t={},d=[],h=t;return e.split(/(\r\n|\r|\n)/).filter(Ql).forEach(function(e){var t=e[0],r=e.slice(2);"m"===t&&(d.push({rtp:[],fmtp:[]}),h=d[d.length-1]);for(var n=0;n<(Xl[t]||[]).length;n+=1){var o=Xl[t][n];if(o.reg.test(r)){var i=h;var s=r;var a=o.name&&o.names,a=(o.push&&!i[o.push]?i[o.push]=[]:a&&!i[o.name]&&(i[o.name]={}),o.push?{}:a?i[o.name]:i),u=s.match(o.reg),l=a,c=o.names;if((s=o.name)&&!c)l[s]=Wl(u[1]);else for(var p=0;p<c.length;p+=1)null!=u[p+1]&&(l[c[p]]=Wl(u[p+1]));o.push&&i[o.push].push(a);return}}}),t.media=d,t},s.parseParams=function(e){return e.split(/;\s?/).reduce(Jl,{})},s.parseFmtpConfig=s.parseParams,s.parsePayloads=function(e){return e.toString().split(" ").map(Number)},s.parseRemoteCandidates=function(e){for(var t=[],r=e.split(" ").map(Wl),n=0;n<r.length;n+=3)t.push({component:r[n],ip:r[n+1],port:r[n+2]});return t},s.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(Jl,{})})},s.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var t,r=!1;return"~"!==e[0]?t=Wl(e):(t=Wl(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})},h.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=["v","o","s","i","u","e","p","c","b","t","r","z","a"],nc=["i","c","b","a"],o=i,oc=(r.grammar=h.exports,r.write=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||rc,n=t.innerOrder||nc,o=[];return r.forEach(function(r){Zl[r].forEach(function(t){t.name in e&&null!=e[t.name]?o.push($l(r,t,e)):t.push in e&&null!=e[t.push]&&e[t.push].forEach(function(e){o.push($l(r,t,e))})})}),e.media.forEach(function(e){o.push($l("m",Zl.m[0],e)),n.forEach(function(r){Zl[r].forEach(function(t){t.name in e&&null!=e[t.name]?o.push($l(r,t,e)):t.push in e&&null!=e[t.push]&&e[t.push].forEach(function(e){o.push($l(r,t,e))})})})}),o.join("\r\n")+"\r\n"},r.parse=o.parse,r.parseParams=o.parseParams,r.parseFmtpConfig=o.parseFmtpConfig,r.parsePayloads=o.parsePayloads,r.parseRemoteCandidates=o.parseRemoteCandidates,r.parseImageAttributes=o.parseImageAttributes,r.parseSimulcastStreamList=o.parseSimulcastStreamList,r),Be=n,ic=F,sc=ye(),ac=Fr(),uc=ge(),lc=new Be("SIPMessage"),j=e(Nc,[{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[sc.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){var t=this.headers[sc.headerize(e)];if(t){if(t[0])return t[0]}else{var r,n=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),o=N(this.extraHeaders);try{for(o.s();!(r=o.n()).done;){var i=r.value;if(n.test(i))return i.substring(i.indexOf(":")+1).trim()}}catch(e){o.e(e)}finally{o.f()}}}},{key:"getHeaders",value:function(e){var t=this.headers[sc.headerize(e)],r=[];if(t){var n,o=N(t);try{for(o.s();!(n=o.n()).done;)r.push(n.value)}catch(e){o.e(e)}finally{o.f()}}else{var i,s=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),a=N(this.extraHeaders);try{for(a.s();!(i=a.n()).done;){var u=i.value;s.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[sc.headerize(e)])return!0;var t,r=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),n=N(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=oc.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=N(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 i,s=N(this.extraHeaders);try{for(s.s();!(i=s.n()).done;){var a=i.value;t+="".concat(a.trim(),"\r\n")}}catch(t){s.e(t)}finally{s.f()}var u=[];switch(this.method){case ic.REGISTER:u.push("path","gruu");break;case ic.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 ic.UPDATE:this.ua.configuration.session_timers&&u.push("timer"),u.push("ice")}u.push("outbound");var l=this.ua.configuration.user_agent||ic.USER_AGENT;return t=(t=(t+="Allow: ".concat(ic.ALLOWED_METHODS,"\r\n"))+"Supported: ".concat(u,"\r\n"))+"User-Agent: ".concat(l,"\r\n"),this.body?(l=sc.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 Nc(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=sc.cloneArray(this.extraHeaders),t.to=this.to,t.from=this.from,t.call_id=this.call_id,t.cseq=this.cseq,t}}]),s=(K(Rc,j),e(Rc,[{key:"cancel",value:function(e){this.transaction.cancel(e)}},{key:"clone",value:function(){var t=new Rc(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=sc.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}}])),i=e(function e(){c(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=sc.headerize(e),this.headers[e]?this.headers[e].push(t):this.headers[e]=[t]}},{key:"getHeader",value:function(e){e=this.headers[sc.headerize(e)];return e&&e[0]?e[0].raw:void 0}},{key:"getHeaders",value:function(e){var t=this.headers[sc.headerize(e)],r=[];if(!t)return[];var n,o=N(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[sc.headerize(e)]}},{key:"parseHeader",value:function(e){var t,r,n,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;if(e=sc.headerize(e),this.headers[e]){if(!(o>=this.headers[e].length))return r=(t=this.headers[e][o]).raw,t.parsed||(-1===(n=uc.parse(r,e.replace(/-/g,"_")))?(this.headers[e].splice(o,1),void lc.debug('error parsing "'.concat(e,'" header field with value "').concat(r,'"'))):t.parsed=n);lc.debug('not so many "'.concat(e,'" headers present'))}else lc.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[sc.headerize(e)]=[t]}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=oc.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){return this.data}}]),h=(K(Cc,i),e(Cc,[{key:"reply",value:function(e,t,r,n,o,i){var s=[],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||ic.REASON_PHRASE[e]||"",r=sc.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===ic.INVITE&&100<e&&e<=200){var l,c=N(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,d=N(this.getHeaders("via"));try{for(d.s();!(p=d.n()).done;)u+="Via: ".concat(p.value,"\r\n")}catch(e){d.e(e)}finally{d.f()}!this.to_tag&&100<e?a+=";tag=".concat(sc.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 h,f=N(r);try{for(f.s();!(h=f.n()).done;){var m=h.value;u+="".concat(m.trim(),"\r\n")}}catch(e){f.e(e)}finally{f.f()}switch(this.method){case ic.INVITE:this.ua.configuration.session_timers&&s.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&s.push("gruu"),s.push("ice","replaces");break;case ic.UPDATE:this.ua.configuration.session_timers&&s.push("timer"),n&&s.push("ice"),s.push("replaces")}s.push("outbound"),this.method===ic.OPTIONS?u=(u+="Allow: ".concat(ic.ALLOWED_METHODS,"\r\n"))+"Accept: ".concat(ic.ACCEPTED_BODY_TYPES,"\r\n"):405===e?u+="Allow: ".concat(ic.ALLOWED_METHODS,"\r\n"):415===e&&(u+="Accept: ".concat(ic.ACCEPTED_BODY_TYPES,"\r\n")),u+="Supported: ".concat(s,"\r\n"),n?(t=sc.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,i)}},{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||ic.REASON_PHRASE[e]||"",o="SIP/2.0 ".concat(e," ").concat(t,"\r\n"),i=N(r);try{for(i.s();!(n=i.n()).done;)o+="Via: ".concat(n.value,"\r\n")}catch(e){i.e(e)}finally{i.f()}t=this.getHeader("To");if(!this.to_tag&&100<e?t+=";tag=".concat(sc.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 s,a=N(this.ua.configuration.extra_headers);try{for(a.s();!(s=a.n()).done;){var u=s.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)}}])),o={OutgoingRequest:j,InitialOutgoingInviteRequest:s,IncomingRequest:h,IncomingResponse:(K(xc,i),e(xc))},Be=n,cc=ye(),pc=new Be("DigestAuthentication"),j=e(function e(t){c(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 pc.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 pc.warn('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this._algorithm="MD5";if(!this._nonce)return pc.warn("authenticate() | challenge without Digest nonce, authentication aborted"),!1;if(!this._realm)return pc.warn("authenticate() | challenge without Digest realm, authentication aborted"),!1;if(!this._credentials.password){if(!this._credentials.ha1)return pc.warn("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"),!1;if(this._credentials.realm!==this._realm)return pc.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 pc.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||cc.createRandomToken(12),this._nc+=1;var i,s,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=cc.calculateMD5("".concat(this._credentials.username,":").concat(this._realm,":").concat(this._credentials.password)):this._ha1=this._credentials.ha1,"auth"===this._qop?(i="".concat(this._method,":").concat(this._uri),s=cc.calculateMD5(i),pc.debug('authenticate() | using qop=auth [a2:"%s"]',i),this._response=cc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth:").concat(s))):"auth-int"===this._qop?(i="".concat(this._method,":").concat(this._uri,":").concat(cc.calculateMD5(e||"")),s=cc.calculateMD5(i),pc.debug('authenticate() | using qop=auth-int [a2:"%s"]',i),this._response=cc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth-int:").concat(s))):null===this._qop&&(i="".concat(this._method,":").concat(this._uri),s=cc.calculateMD5(i),pc.debug('authenticate() | using qop=null [a2:"%s"]',i),this._response=cc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(s))),pc.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")}}]),s={T1:500,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},h=le.EventEmitter,i=n,dc=F,hc=o,fc=s,mc=new i("NonInviteClientTransaction"),gc=new i("InviteClientTransaction"),yc=new i("AckClientTransaction"),_c=new i("NonInviteServerTransaction"),vc=new i("InviteServerTransaction"),A={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"},Be=(K(Oc,h),e(Oc,[{key:"C",get:function(){return A}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(A.STATUS_TRYING),this.F=setTimeout(function(){e.timer_F()},fc.TIMER_F),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){mc.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.F),clearTimeout(this.K),this.stateChanged(A.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onTransportError()}},{key:"timer_F",value:function(){mc.debug("Timer F expired for transaction ".concat(this.id)),this.stateChanged(A.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout()}},{key:"timer_K",value:function(){this.stateChanged(A.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 A.STATUS_TRYING:case A.STATUS_PROCEEDING:this.stateChanged(A.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e)}else switch(this.state){case A.STATUS_TRYING:case A.STATUS_PROCEEDING:this.stateChanged(A.STATUS_COMPLETED),clearTimeout(this.F),408===r?this.eventHandlers.onRequestTimeout():this.eventHandlers.onReceiveResponse(e),this.K=setTimeout(function(){t.timer_K()},fc.TIMER_K)}}}])),i=(K(Ac,h),e(Ac,[{key:"C",get:function(){return A}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(A.STATUS_CALLING),this.B=setTimeout(function(){e.timer_B()},fc.TIMER_B),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){clearTimeout(this.B),clearTimeout(this.D),clearTimeout(this.M),this.state!==A.STATUS_ACCEPTED&&(gc.debug("transport error occurred, deleting transaction ".concat(this.id)),this.eventHandlers.onTransportError()),this.stateChanged(A.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_M",value:function(){gc.debug("Timer M expired for transaction ".concat(this.id)),this.state===A.STATUS_ACCEPTED&&(clearTimeout(this.B),this.stateChanged(A.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"timer_B",value:function(){gc.debug("Timer B expired for transaction ".concat(this.id)),this.state===A.STATUS_CALLING&&(this.stateChanged(A.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout())}},{key:"timer_D",value:function(){gc.debug("Timer D expired for transaction ".concat(this.id)),clearTimeout(this.B),this.stateChanged(A.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"sendACK",value:function(e){var t=this,r=new hc.OutgoingRequest(dc.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()},fc.TIMER_D),this.transport.send(r)}},{key:"cancel",value:function(e){var t;this.state===A.STATUS_PROCEEDING&&((t=new hc.OutgoingRequest(dc.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 A.STATUS_CALLING:this.stateChanged(A.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e);break;case A.STATUS_PROCEEDING:this.eventHandlers.onReceiveResponse(e)}else if(200<=r&&r<=299)switch(this.state){case A.STATUS_CALLING:case A.STATUS_PROCEEDING:this.stateChanged(A.STATUS_ACCEPTED),this.M=setTimeout(function(){t.timer_M()},fc.TIMER_M),this.eventHandlers.onReceiveResponse(e);break;case A.STATUS_ACCEPTED:this.eventHandlers.onReceiveResponse(e)}else if(300<=r&&r<=699)switch(this.state){case A.STATUS_CALLING:case A.STATUS_PROCEEDING:this.stateChanged(A.STATUS_COMPLETED),this.sendACK(e),this.eventHandlers.onReceiveResponse(e);break;case A.STATUS_COMPLETED:this.sendACK(e)}}}])),bc=(K(Ec,h),e(Ec,[{key:"C",get:function(){return A}},{key:"send",value:function(){this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){yc.debug("transport error occurred for transaction ".concat(this.id)),this.eventHandlers.onTransportError()}}])),Sc=(K(wc,h),e(wc,[{key:"C",get:function(){return A}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_J",value:function(){_c.debug("Timer J expired for transaction ".concat(this.id)),this.stateChanged(A.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,_c.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.J),this.stateChanged(A.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"receiveResponse",value:function(e,t,r,n){var o=this;if(100===e)switch(this.state){case A.STATUS_TRYING:this.stateChanged(A.STATUS_PROCEEDING),this.transport.send(t)||this.onTransportError();break;case A.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 A.STATUS_TRYING:case A.STATUS_PROCEEDING:this.stateChanged(A.STATUS_COMPLETED),this.last_response=t,this.J=setTimeout(function(){o.timer_J()},fc.TIMER_J),this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}}}])),h=(K(Tc,h),e(Tc,[{key:"C",get:function(){return A}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_H",value:function(){vc.debug("Timer H expired for transaction ".concat(this.id)),this.state===A.STATUS_COMPLETED&&vc.debug("ACK not received, dialog will be terminated"),this.stateChanged(A.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_I",value:function(){this.stateChanged(A.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_L",value:function(){vc.debug("Timer L expired for transaction ".concat(this.id)),this.state===A.STATUS_ACCEPTED&&(this.stateChanged(A.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,vc.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(A.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===A.STATUS_PROCEEDING&&(this.transport.send(t)||this.onTransportError(),this.last_response=t),100<e&&e<=199&&this.state===A.STATUS_PROCEEDING)null===this.resendProvisionalTimer&&(this.resendProvisionalTimer=setInterval(function(){o.resend_provisional()},fc.PROVISIONAL_RESPONSE_INTERVAL));else if(200<=e&&e<=299)switch(this.state){case A.STATUS_PROCEEDING:this.stateChanged(A.STATUS_ACCEPTED),this.last_response=t,this.L=setTimeout(function(){o.timer_L()},fc.TIMER_L),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null);case A.STATUS_ACCEPTED:this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}else 300<=e&&e<=699&&this.state===A.STATUS_PROCEEDING&&(null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),this.transport.send(t)?(this.stateChanged(A.STATUS_COMPLETED),this.H=setTimeout(function(){o.timer_H()},fc.TIMER_H),r&&r()):(this.onTransportError(),n&&n()))}}]));function Tc(e,t,r){var n;return c(this,Tc),(n=H(this,Tc)).type=A.INVITE_SERVER,n.id=r.via_branch,n.ua=e,n.transport=t,n.request=r,n.last_response="",(r.server_transaction=n).state=A.STATUS_PROCEEDING,e.newTransaction(n),n.resendProvisionalTimer=null,r.reply(100),n}function wc(e,t,r){var n;return c(this,wc),(n=H(this,wc)).type=A.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=A.STATUS_TRYING,e.newTransaction(n),n}function Ec(e,t,r,n){c(this,Ec),(o=H(this,Ec)).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}function Ac(e,t,r,n){c(this,Ac),(o=H(this,Ac)).type=A.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}function Oc(e,t,r,n){c(this,Oc),(o=H(this,Oc)).type=A.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}function xc(){var e;return c(this,xc),(e=H(this,xc)).headers={},e.status_code=null,e.reason_phrase=null,e}function Cc(e){var t;return c(this,Cc),(t=H(this,Cc)).ua=e,t.headers={},t.ruri=null,t.transport=null,t.server_transaction=null,t}function Rc(e,t,r,n,o){return c(this,Rc),(e=H(this,Rc,[ic.INVITE,e,t,r,n,o])).transaction=null,e}function Nc(e,t,r,n,o,i){if(c(this,Nc),!e||!t||!r)return null;n=n||{},this.ua=r,this.headers={},this.method=e,this.ruri=t,this.body=i,this.extraHeaders=sc.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",ic.MAX_FORWARDS);i=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 ac(i,t,o),this.setHeader("to",this.to.toString());i=n.from_uri||r.configuration.uri,t={tag:n.from_tag||sc.newTag()},o=void 0!==n.from_display_name?n.from_display_name:r.configuration.display_name||null,this.from=new ac(i,o,t),this.setHeader("from",this.from.toString()),i=n.call_id||r.configuration.jssip_id+sc.createRandomToken(15),this.call_id=i,this.setHeader("call-id",i),o=n.cseq||Math.floor(1e4*Math.random());this.cseq=o,this.setHeader("cseq","".concat(o," ").concat(e))}var Be={C:A,NonInviteClientTransaction:Be,InviteClientTransaction:i,AckClientTransaction:bc,NonInviteServerTransaction:Sc,InviteServerTransaction:h,checkTransaction:function(e,t){var r,n=e._transactions;switch(t.method){case dc.INVITE:if(r=n.ist[t.via_branch])return r.state===A.STATUS_PROCEEDING&&r.transport.send(r.last_response),!0;break;case dc.ACK:if(!(r=n.ist[t.via_branch]))return!1;if(r.state===A.STATUS_ACCEPTED)return!1;if(r.state===A.STATUS_COMPLETED)return r.state=A.STATUS_CONFIRMED,r.I=setTimeout(function(){r.timer_I()},fc.TIMER_I),!0;break;case dc.CANCEL:return(r=n.ist[t.via_branch])?(t.reply_sl(200),r.state!==A.STATUS_PROCEEDING):(t.reply_sl(481),!0);default:if(r=n.nist[t.via_branch]){switch(r.state){case A.STATUS_TRYING:break;case A.STATUS_PROCEEDING:case A.STATUS_COMPLETED:r.transport.send(r.last_response)}return!0}}}},Ic=F,Pc=j,Uc=Be,kc=new n("RequestSender"),Lc={onRequestTimeout:function(){},onTransportError:function(){},onReceiveResponse:function(){},onAuthenticated:function(){}},i=e(function e(t,r,n){for(var o in c(this,e),this._ua=t,this._eventHandlers=n,this._method=r.method,this._request=r,this._auth=null,this._challenged=!1,this._staled=!1,Lc)!Object.prototype.hasOwnProperty.call(Lc,o)||this._eventHandlers[o]||(this._eventHandlers[o]=Lc[o]);t.status!==t.C.STATUS_USER_CLOSED||this._method===Ic.BYE&&this._method===Ic.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 Uc.InviteClientTransaction(this._ua,this._ua.transport,this._request,e);break;case"ACK":this.clientTransaction=new Uc.AckClientTransaction(this._ua,this._ua.transport,this._request,e);break;default:this.clientTransaction=new Uc.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 Pc({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)))}}]),bc=n,jc=ye(),Dc=F,Mc=o,Vc=i,Bc=new bc("Registrator"),Sc=e(function e(t,r){c(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?Bc.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 Mc.OutgoingRequest(Dc.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},e),e=new Vc(this._ua,e,{onRequestTimeout:function(){n._registrationFailure(null,Dc.causes.REQUEST_TIMEOUT)},onTransportError:function(){n._registrationFailure(null,Dc.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}))):Bc.debug("no Contact header pointing to us, response ignored"):Bc.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()):(Bc.debug("423 response received for REGISTER without Min-Expires"),n._registrationFailure(e,Dc.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 Mc.OutgoingRequest(Dc.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},e),new Vc(this._ua,t,{onRequestTimeout:function(){r._unregistered(null,Dc.causes.REQUEST_TIMEOUT)},onTransportError:function(){r._unregistered(null,Dc.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()):Bc.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})}}]),h=M(Fe),Fc=F,qc=Be,Hc=i,zc={onRequestTimeout:function(){},onTransportError:function(){},onSuccessResponse:function(){},onErrorResponse:function(){},onAuthenticated:function(){},onDialogError:function(){}},j=n,Gc=o,Kc=F,Yc=Be,Wc=e(function e(t,r,n){for(var o in c(this,e),this._dialog=t,this._ua=t._ua,this._request=r,this._eventHandlers=n,this._reattempt=!1,this._reattemptTimer=null,zc)!Object.prototype.hasOwnProperty.call(zc,o)||this._eventHandlers[o]||(this._eventHandlers[o]=zc[o])},[{key:"request",get:function(){return this._request}},{key:"send",value:function(){var e,t=this,r=new Hc(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===Fc.INVITE||this._request.method===Fc.UPDATE&&this._request.body)&&r.clientTransaction.state!==qc.C.STATUS_TERMINATED&&(this._dialog.uac_pending_reply=!0,e=function(){r.clientTransaction.state!==qc.C.STATUS_ACCEPTED&&r.clientTransaction.state!==qc.C.STATUS_COMPLETED&&r.clientTransaction.state!==qc.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!==Fc.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))}}]),Jc=ye(),$c=new j("Dialog"),Xc={STATUS_EARLY:1,STATUS_CONFIRMED:2,STATUS_TERMINATED:3},bc=e(function e(t,r,n){var o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:Xc.STATUS_CONFIRMED;if(c(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 Gc.IncomingResponse&&(o=r.status_code<200?Xc.STATUS_EARLY:Xc.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),$c.debug("new ".concat(n," dialog created with status ").concat(this._state===Xc.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===Xc.STATUS_TERMINATED}},{key:"update",value:function(e,t){this._state=Xc.STATUS_CONFIRMED,$c.debug("dialog ".concat(this._id.toString()," changed to CONFIRMED state")),"UAC"===t&&(this._route_set=e.getHeaders("record-route").reverse())}},{key:"terminate",value:function(){$c.debug("dialog ".concat(this._id.toString()," deleted")),this._ua.destroyDialog(this),this._state=Xc.STATUS_TERMINATED}},{key:"sendRequest",value:function(e){var t=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=Jc.cloneArray(r.extraHeaders),o=Jc.cloneObject(r.eventHandlers),r=r.body||null,e=this._createRequest(e,n,r);return o.onAuthenticated=function(){t._local_seqnum+=1},new Wc(this,e,o).send(),e}},{key:"receiveRequest",value:function(e){this._checkInDialogRequest(e)&&(e.method===Kc.ACK&&null!==this._ack_seqnum?this._ack_seqnum=null:e.method===Kc.INVITE&&(this._ack_seqnum=e.cseq),this._owner.receiveRequest(e))}},{key:"_createRequest",value:function(e,t,r){t=Jc.cloneArray(t),this._local_seqnum||(this._local_seqnum=Math.floor(1e4*Math.random()));var n=e===Kc.CANCEL||e===Kc.ACK?this._local_seqnum:this._local_seqnum+=1;return new Gc.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!==Kc.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===Kc.INVITE||e.method===Kc.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!==Yc.C.STATUS_ACCEPTED&&e.server_transaction.state!==Yc.C.STATUS_COMPLETED&&e.server_transaction.state!==Yc.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===Yc.C.STATUS_ACCEPTED&&(r._remote_target=e.parseHeader("contact").uri)})}else e.method===Kc.NOTIFY&&e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===Yc.C.STATUS_COMPLETED&&(r._remote_target=e.parseHeader("contact").uri)});return!0}}],[{key:"C",get:function(){return Xc}}]),Fe={exports:{}},j=le.EventEmitter,Qc=n,Zc=F,ep=B,tp=ye(),rp=new Qc("RTCSession:DTMF"),np={MIN_DURATION:70,MAX_DURATION:6e3,DEFAULT_DURATION:100,MIN_INTER_TONE_GAP:50,DEFAULT_INTER_TONE_GAP:500};function op(e){var t;return c(this,op),(t=H(this,op))._session=e,t._direction=null,t._tone=null,t._duration=null,t._request=null,t}Fe.exports=(K(op,j),e(op,[{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 ep.InvalidStateError(this._session.status);var n=tp.cloneArray(r.extraHeaders);if(this.eventHandlers=tp.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(Zc.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=np.DEFAULT_DURATION),this._tone?this._session.newDTMF({originator:"remote",dtmf:this,request:e}):rp.debug("invalid INFO DTMF received, discarded")}}])),Fe.exports.C=np;var Qc=le.EventEmitter,ip=F,sp=B,ap=ye(),j=(K(Ep,Qc),e(Ep,[{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 sp.InvalidStateError(this._session.status);this._contentType=e,this._body=t;n=ap.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})}}])),up=F,lp=new n("RTCSession:ReferNotifier"),Qc=e(function e(t,r,n){c(this,e),this._session=t,this._id=r,this._expires=n||300,this._active=!0,this.notify(100)},[{key:"notify",value:function(e,t){var r;lp.debug("notify()"),!1!==this._active&&(t=t||up.REASON_PHRASE[e]||"",r=200<=e?"terminated;reason=noresource":"active;expires=".concat(this._expires),this._session.sendRequest(up.NOTIFY,{extraHeaders:["Event: ".concat("refer",";id=").concat(this._id),"Subscription-State: ".concat(r),"Content-Type: ".concat("message/sipfrag;version=2.0")],body:"SIP/2.0 ".concat(e," ").concat(t),eventHandlers:{onErrorResponse:function(){this._active=!1}}}))}}]),cp=le.EventEmitter,pp=n,dp=F,hp=ge(),fp=ye(),mp=new pp("RTCSession:ReferSubscriber"),pp=(K(wp,cp),e(wp,[{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=(mp.debug("sendRefer()"),fp.cloneArray(n.extraHeaders)),i=fp.cloneObject(n.eventHandlers);for(t in i)Object.prototype.hasOwnProperty.call(i,t)&&this.on(t,i[t]);var s=null,n=(n.replaces&&(s=n.replaces._request.call_id,s=(s+=";to-tag=".concat(n.replaces._to_tag))+";from-tag=".concat(n.replaces._from_tag),s=encodeURIComponent(s)),"Refer-To: <".concat(e).concat(s?"?Replaces=".concat(s):"",">")),s=(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=s.cseq}},{key:"receiveNotify",value:function(e){if(mp.debug("receiveNotify()"),e.body){var t=hp.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 mp.debug('receiveNotify() | error parsing NOTIFY body: "'.concat(e.body,'"'))}}},{key:"_requestSucceeded",value:function(e){mp.debug("REFER succeeded"),mp.debug('emit "requestSucceeded"'),this.emit("requestSucceeded",{response:e})}},{key:"_requestFailed",value:function(e,t){mp.debug("REFER failed"),mp.debug('emit "requestFailed"'),this.emit("requestFailed",{response:e||null,cause:t})}}])),cp=(K(Tp,le.EventEmitter),e(Tp,[{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=cp,yp=ye(),gp=(K(Sp,gp),e(Sp,[{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&&yp.closeMediaStream(this._mediaStream)}}])),cp=(K(bp,cp),e(bp)),_p="object"===("undefined"==typeof globalThis?"undefined":Z(globalThis))?globalThis:"object"===("undefined"==typeof self?"undefined":Z(self))?self:"object"===("undefined"==typeof window?"undefined":Z(window))?window:"object"===Z(D)?D:{},vp={};function bp(e){var t;return c(this,bp),(t=H(this,bp,[e]))._mediaStream=e.mediaStream,t.type="remote",t}function Sp(e){return c(this,Sp),(e=H(this,Sp,[e])).type="local",e}function Tp(e){var t;return c(this,Tp),(t=H(this,Tp)).audio=e.audio,t.video=e.video,t._mediaStream=e.mediaStream,t._player=null,t}function wp(e){var t;return c(this,wp),(t=H(this,wp))._id=null,t._session=e,t}function Ep(e){var t;return c(this,Ep),(t=H(this,Ep))._session=e,t._direction=null,t._contentType=null,t._body=null,t}var Ap,Op,xp,Cp=M(Object.freeze({__proto__:null,OTLPTraceExporter:class extends yr{constructor(e={}){super(iu(e,Ka,"v1/traces",{"Content-Type":"application/json"}))}}}));class Rp{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:so.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=ku.now(),this._performanceOffset=e-(this._performanceStartTime+ku.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?f.warn("Invalid attribute key: "+e):Ru(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++)):f.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 i=this._spanLimits.eventCountLimit;if(0===i)f.warn("No events allowed."),this._droppedEventsCount++;else{void 0!==i&&this.events.length>=i&&(0===this._droppedEventsCount&&f.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),Hu(t)&&(Hu(o)||(o=t),t=void 0);var s=Cu(t),a=this._spanLimits.attributePerEventCountLimit,u={};let r=0,n=0;for(let t in s)if(Object.prototype.hasOwnProperty.call(s,t)){let e=s[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&&f.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);var o=this._spanLimits.attributePerLinkCountLimit,i=Cu(t.attributes),s={};let r=0,n=0;for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)){let e=i[t];void 0!==o&&n>=o?r++:(s[t]=this._truncateToSize(e),n++)}t={context:t.context};0<n&&(t.attributes=s),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!==so.UNSET&&this.status.code!==so.OK&&(t={code:e.code},e.code===so.ERROR&&("string"==typeof e.message?t.message=e.message:null!=e.message&&f.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()?f.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+=ju),[r,n]})(this.startTime,this.endTime),this._duration[0]<0&&(f.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&&f.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),0<this._droppedLinksCount&&f.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<=ku.now()?Mu(e+this._performanceOffset):"number"==typeof e?Du(e):e instanceof Date?Du(e.getTime()):qu(e)?e:this._startTimeProvided?Du(Date.now()):(e=ku.now()-this._performanceStartTime,zu(this.startTime,Du(e)))}isRecording(){return!1===this._ended}recordException(e,t){var r={};"string"==typeof e?r[Go]=e:e&&(e.code?r[Ko]=e.code.toString():e.name&&(r[Ko]=e.name),e.message&&(r[Go]=e.message),e.stack)&&(r["exception.stacktrace"]=e.stack),r[Ko]||r[Go]?this.addEvent("exception",r,t):f.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}}`),f.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?(f.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}}(x=Ap=Ap||{})[x.NOT_RECORD=0]="NOT_RECORD",x[x.RECORD=1]="RECORD",x[x.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED";class Np{shouldSample(){return{decision:Ap.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class Ip{shouldSample(){return{decision:Ap.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class Pp{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(Pu(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Ip),this._remoteParentSampled=e.remoteParentSampled??new Ip,this._remoteParentNotSampled=e.remoteParentNotSampled??new Np,this._localParentSampled=e.localParentSampled??new Ip,this._localParentNotSampled=e.localParentNotSampled??new Np}shouldSample(e,t,r,n,o,i){var s=jo.getSpanContext(e);return(s&&Zn(s)?s.isRemote?s.traceFlags&Rn.SAMPLED?this._remoteParentSampled:this._remoteParentNotSampled:s.traceFlags&Rn.SAMPLED?this._localParentSampled:this._localParentNotSampled:this._root).shouldSample(e,t,r,n,o,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class Up{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(4294967295*this._ratio)}shouldSample(e,t){return{decision:Xn(t)&&this._accumulate(t)<this._upperBound?Ap.RECORD_AND_SAMPLED:Ap.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 kp(){return{sampler:Lp(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Lp(){var e=Op.ParentBasedAlwaysOn;switch(e){case Op.AlwaysOn:return new Ip;case Op.AlwaysOff:return new Np;case Op.ParentBasedAlwaysOn:return new Pp({root:new Ip});case Op.ParentBasedAlwaysOff:return new Pp({root:new Np});case Op.TraceIdRatio:return new Up(jp());case Op.ParentBasedTraceIdRatio:return new Pp({root:new Up(jp())});default:return f.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Op.ParentBasedAlwaysOn}".`),new Pp({root:new Ip})}}function jp(){return f.error("OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1."),1}(x=Op=Op||{}).AlwaysOff="always_off",x.AlwaysOn="always_on",x.ParentBasedAlwaysOff="parentbased_always_off",x.ParentBasedAlwaysOn="parentbased_always_on",x.ParentBasedTraceIdRatio="parentbased_traceidratio",x.TraceIdRatio="traceidratio";class Dp extends class{_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 bl(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(f.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&Rn.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&&f.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++):(0<this._droppedSpansCount&&(f.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 i=setTimeout(()=>{o(new Error("Timeout"))},this._exportTimeoutMillis);bo.with(Eu(bo.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(i),e.code===mu.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=>{Pu(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,Pu(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)}}{_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=>{Pu(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{Pu(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 Mp=new Uint8Array(16),Vp=new Uint8Array(8),Bp=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Fp(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 qp(t){let r="";for(let e=0;e<t.length;e++)r+=Bp[t[e]];return r}class Hp{generateTraceId(){return Fp(Mp),qp(Mp)}generateSpanId(){return Fp(Vp),qp(Vp)}}class zp{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 Ap.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case Ap.RECORD:return"RECORD_ONLY";case Ap.NOT_RECORD:return"DROP"}})();if(this.startedSpans.add(1,{"otel.span.parent.origin":(e=e)?e.isRemote?"remote":"local":"none","otel.span.sampling_result":r}),t===Ap.NOT_RECORD)return()=>{};let n={"otel.span.sampling_result":r};return this.liveSpans.add(1,n),()=>{this.liveSpans.add(-1,n)}}}class Gp{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,r,n){s=t,o={sampler:Lp()},i=kp(),(o=Object.assign({},i,o,s)).generalLimits=Object.assign({},i.generalLimits,s.generalLimits||{}),o.spanLimits=Object.assign({},i.spanLimits,s.spanLimits||{});var o,i=o,s=(this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new Hp,this._resource=r,this._spanProcessor=n,this.instrumentationScope=e,i.meterProvider?i.meterProvider.getMeter("@opentelemetry/sdk-trace","2.7.1"):pn);this._tracerMetrics=new zp(s)}startSpan(e,t={},r=bo.active()){t.root&&(r=jo.deleteSpan(r));var n=jo.getSpan(r);if(Au(r))return f.debug("Instrumentation suppressed, returning Noop Span"),jo.wrapSpanContext(Vn);var n=n?.spanContext(),o=this._idGenerator.generateSpanId();let i,s,a;n&&jo.isSpanContextValid(n)?(s=n.traceId,a=n.traceState,i=n):s=this._idGenerator.generateTraceId();var u=t.kind??io.INTERNAL,l=(t.links??[]).map(e=>({context:e.context,attributes:Cu(e.attributes)})),c=Cu(t.attributes),p=this._sampler.shouldSample(r,s,e,u,c,l),n=this._tracerMetrics.startSpan(n,p.decision),o=(a=p.traceState??a,{traceId:s,spanId:o,traceFlags:p.decision===oo.RECORD_AND_SAMPLED?Rn.SAMPLED:Rn.NONE,traceState:a});return p.decision===oo.NOT_RECORD?(f.debug("Recording is off, propagating context in a non-recording span"),jo.wrapSpanContext(o)):(c=Cu(Object.assign(c,p.attributes)),new Rp({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:o,name:e,kind:u,links:l,parentSpanContext:i,attributes:c,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:n}))}startActiveSpan(e,t,r,n){let o,i,s;if(!(arguments.length<2))return s=2===arguments.length?t:3===arguments.length?(o=t,r):(o=t,i=r,n),t=i??bo.active(),r=this.startSpan(e,o,t),n=jo.setSpan(t,r),bo.with(n,s,void 0,r)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class Kp{_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=>{Pu(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)})}}(x=xp=xp||{})[x.resolved=0]="resolved",x[x.timeout=1]="timeout",x[x.error=2]="error",x[x.unresolved=3]="unresolved";class Yp{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){var t=(e=>{let t=e.shift();for(var r=new WeakMap;0<e.length;)t=function r(n,o,i=0,s){let a;if(!(20<i)){if(i++,_l(n)||_l(o)||gl(o))a=hl(o);else if(ml(n)){if(a=n.slice(),ml(o))for(let e=0,t=o.length;e<t;e++)a.push(hl(o[e]));else if(yl(o)){let r=Object.keys(o);for(let t=0,e=r.length;t<e;t++){let e=r[t];"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(a[e]=hl(o[e]))}}}else if(yl(n))if(yl(o)){if(e=o,!dl(n)||!dl(e))return o;a=Object.assign({},n);var u=Object.keys(o);for(let e=0,t=u.length;e<t;e++){var l=u[e];if("__proto__"!==l&&"constructor"!==l&&"prototype"!==l){var c=o[l];if(_l(c))void 0===c?delete a[l]:a[l]=c;else{var p=a[l],d=c;if(fl(n,l,s)||fl(o,l,s))delete a[l];else{if(yl(p)&&yl(d)){let e=s.get(p)||[],t=s.get(d)||[];e.push({obj:n,key:l}),t.push({obj:o,key:l}),s.set(p,e),s.set(d,t)}a[l]=r(a[l],c,i,s)}}}}}else a=o;return a}var e}(t,e.shift(),0,r);return t})([{},kp(),(t=e,(r=Object.assign({},t.spanLimits)).attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??128,r.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??1/0,Object.assign({},t,{spanLimits:r}))]),r=(this._resource=t.resource??Cl(),this._config=Object.assign({},t,{resource:this._resource}),[]);e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new Kp(r)}getTracer(e,t,r){var n=e+`@${t||""}:`+(r?.schemaUrl||"");return this._tracers.has(n)||this._tracers.set(n,new Gp({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=xp.timeout},o);e.forceFlush().then(()=>{clearTimeout(n),r!==xp.timeout&&(r=xp.resolved,t(r))}).catch(e=>{clearTimeout(n),r=xp.error,t(e)})}));return new Promise((t,r)=>{Promise.all(e).then(e=>{e=e.filter(e=>e!==xp.resolved);0<e.length?r(e):t()}).catch(e=>r([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class Wp{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:Fu(e.startTime),duration:Fu(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:mu.SUCCESS})}}class Jp{_finishedSpans=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:mu.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>t({code:mu.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}class $p{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new bl(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&Rn.SAMPLED)){let e=this._doExport(t).catch(e=>Pu(e));this._pendingExports.add(e),e.finally(()=>this._pendingExports.delete(e))}}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();e=await Sl._export(this._exporter,[e]);if(e.code!==mu.SUCCESS)throw e.error??new Error(`SimpleSpanProcessor: span export failed (status ${e})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}class Xp{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}var O,x=M(Object.freeze({__proto__:null,BasicTracerProvider:Yp,BatchSpanProcessor:Dp,RandomIdGenerator:Hp,ConsoleSpanExporter:Wp,InMemorySpanExporter:Jp,SimpleSpanProcessor:$p,NoopSpanProcessor:Xp,AlwaysOffSampler:Np,AlwaysOnSampler:Ip,ParentBasedSampler:Pp,TraceIdRatioBasedSampler:Up,get SamplingDecision(){return Ap}}));class Qp{_enabled=!1;_currentContext=ln;_bindFunction(t=ln,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=ln,this._enabled=!1,this}enable(){return this._enabled||(this._enabled=!0,this._currentContext=ln),this}with(e,t,r,...n){var o=this._currentContext;this._currentContext=e||ln;try{return t.call(r,...n)}finally{this._currentContext=o}}}(C=O=O||{}).CONNECT_END="connectEnd",C.CONNECT_START="connectStart",C.DECODED_BODY_SIZE="decodedBodySize",C.DOM_COMPLETE="domComplete",C.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",C.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",C.DOM_INTERACTIVE="domInteractive",C.DOMAIN_LOOKUP_END="domainLookupEnd",C.DOMAIN_LOOKUP_START="domainLookupStart",C.ENCODED_BODY_SIZE="encodedBodySize",C.FETCH_START="fetchStart",C.LOAD_EVENT_END="loadEventEnd",C.LOAD_EVENT_START="loadEventStart",C.NAVIGATION_START="navigationStart",C.REDIRECT_END="redirectEnd",C.REDIRECT_START="redirectStart",C.REQUEST_START="requestStart",C.RESPONSE_END="responseEnd",C.RESPONSE_START="responseStart",C.SECURE_CONNECTION_START="secureConnectionStart",C.START_TIME="startTime",C.UNLOAD_EVENT_END="unloadEventEnd",C.UNLOAD_EVENT_START="unloadEventStart";let Zp;function ed(e,t){return t in e}function td(e,t,r,n=!0){if(t in r&&"number"==typeof r[t]&&(!n||0!==r[t]))return e.addEvent(t,r[t])}function rd(e){return e.slice().sort((e,t)=>{e=e[O.FETCH_START],t=t[O.FETCH_START];return t<e?1:e<t?-1:0})}function nd(){return"undefined"!=typeof location?location.origin:void 0}function od(e){var t;return"function"==typeof URL?new URL(e,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0):((t=Zp=Zp||document.createElement("a")).href=e,t)}function id(e){var t=new sd({url:e.url||dd,headers:{"X-Tps-TenantID":e.id||pd}});return(t=new ud({spanProcessors:[new ad(t,{})],resource:ld.defaultResource().merge(ld.resourceFromAttributes({"tps.tenant.id":e.id||pd,"service.name":"JsSIP","service.version":cd.version}))})).register(),t.getTracer("JsSIP")}var C=M(Object.freeze({__proto__:null,WebTracerProvider:class extends Yp{constructor(e={}){super(e)}register(e={}){jo.setGlobalTracerProvider(this),null!==(t=e.propagator)&&(void 0!==t?Uo.setGlobalPropagator(t):Uo.setGlobalPropagator(new Gu({propagators:[new rl,new xu]})));var t,r=e.contextManager;if(null!==r){if(void 0===r){let e=new Qp;return void(e.enable(),bo.setGlobalContextManager(e))}r.enable(),bo.setGlobalContextManager(r)}}},StackContextManager:Qp,get PerformanceTimingNames(){return O},addSpanNetworkEvent:td,addSpanNetworkEvents:function(r,n,e=!1,t,o){if(void 0===t&&(t=0!==n[O.START_TIME]),e||(td(r,O.FETCH_START,n,t),td(r,O.DOMAIN_LOOKUP_START,n,t),td(r,O.DOMAIN_LOOKUP_END,n,t),td(r,O.CONNECT_START,n,t),td(r,O.SECURE_CONNECTION_START,n,t),td(r,O.CONNECT_END,n,t),td(r,O.REQUEST_START,n,t),td(r,O.RESPONSE_START,n,t),td(r,O.RESPONSE_END,n,t)),!o){let e=n[O.ENCODED_BODY_SIZE],t=(void 0!==e&&r.setAttribute("http.response_content_length",e),n[O.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 i=od(e),e=((n,e,t,r,o)=>{let i=Bu(u),s=Bu(e),a=t.filter(e=>{var t=Bu(Vu(e[O.FETCH_START])),r=Bu(Vu(e[O.RESPONSE_END]));return e.initiatorType.toLowerCase()===(o||"xmlhttprequest")&&e.name===n&&t>=i&&r<=s});return a=0<a.length?a.filter(e=>!r.has(e)):a})(e=i.toString(),n,t,o,r);if(0===e.length)return{mainRequest:void 0};if(1!==e.length){o=rd(e);if(i.origin!==nd()&&1<o.length){let e=o[0],t=((o,e,t)=>{var i=Bu(t),s=Bu(Vu(e));let a,u=o[1],r=o.length;for(let n=1;n<r;n++){let e=o[n],t=Bu(Vu(e[O.FETCH_START])),r=i-Bu(Vu(e[O.RESPONSE_END]));t>=s&&(!a||r<a)&&(a=r,u=e)}return u})(o,e[O.RESPONSE_END],n),r=e[O.RESPONSE_END];return t[O.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}}return{mainRequest:e[0]}},hasKey:ed,normalizeUrl:function(e){return od(e).href},parseUrl:od,shouldPropagateTraceHeaders:function(t,e){let r=e||[];return("string"==typeof r||r instanceof RegExp)&&(r=[r]),od(t).origin===nd()||r.some(e=>"string"==typeof e?t===e:!!t.match(e))},sortResources:rd,AlwaysOffSampler:Np,AlwaysOnSampler:Ip,BasicTracerProvider:Yp,BatchSpanProcessor:Dp,ConsoleSpanExporter:Wp,InMemorySpanExporter:Jp,NoopSpanProcessor:Xp,ParentBasedSampler:Pp,RandomIdGenerator:Hp,get SamplingDecision(){return Ap},SimpleSpanProcessor:$p,TraceIdRatioBasedSampler:Up})),sd=Cp.OTLPTraceExporter,ad=x.BatchSpanProcessor,ud=C.WebTracerProvider,ld=p,cd=V,pd="tccc",dd="https://otlp.tccc.qcloud.com/v1/traces",hd={provider:id({id:pd,url:dd}),attributes:{}},Cp=(vp.setConfig=function(e){hd.provider=id(e)},vp.setAttributes=function(e){Object.assign(hd.attributes,e)},vp.trace=id,le.EventEmitter),fd=d.exports,md=r,x=n,C=h,I=F,gd=B,yd=Be,P=ye(),_d=s,vd=o,bd=bc,Sd=i,Td=Fe.exports,wd=j,Ed=Qc,Ad=pp,Od=qr(),xd=gp,Cd=cp,Rd=_p,Nd=vp,Id=C.trace,Pd=C.context,U=new x("RTCSession"),k={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},Ud=["audio","video"],p=(K(Qd,Cp),e(Qd,[{key:"C",get:function(){return k}},{key:"causes",get:function(){return I.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 k.STATUS_NULL:case k.STATUS_INVITE_SENT:case k.STATUS_1XX_RECEIVED:case k.STATUS_INVITE_RECEIVED:case k.STATUS_WAITING_FOR_ANSWER:return!0;default:return!1}}},{key:"isEstablished",value:function(){switch(this._status){case k.STATUS_ANSWERED:case k.STATUS_WAITING_FOR_ACK:case k.STATUS_CONFIRMED:return!0;default:return!1}}},{key:"isEnded",value:function(){switch(this._status){case k.STATUS_CANCELED:case k.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=(U.debug("connect()"),e),i=P.cloneObject(r.eventHandlers),s=P.cloneArray(r.extraHeaders),a=P.cloneObject(r.mediaConstraints,{audio:!0,video:!0}),u=r.mediaStream||null,l=P.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!==k.STATUS_NULL)throw new gd.InvalidStateError(this._status);if(!Rd.RTCPeerConnection&&!P.isMiniProgram())throw new gd.NotSupportedError("WebRTC not supported");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(o));for(t in this._sessionTimers.enabled&&P.isDecimal(r.sessionTimersExpires)&&(r.sessionTimersExpires>=I.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=r.sessionTimersExpires:this._sessionTimers.defaultExpires=I.SESSION_EXPIRES),i)Object.prototype.hasOwnProperty.call(i,t)&&this.on(t,i[t]);this._from_tag=P.newTag();var o=r.anonymous||!1,d={from_tag:this._from_tag};this._contact=this._ua.contact.toString({anonymous:o,outbound:!0}),o?(d.from_display_name="Anonymous",d.from_uri=new Od("sip","anonymous","anonymous.invalid"),s.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString())),s.push("Privacy: id")):r.fromUserName&&(d.from_uri=new Od("sip",r.fromUserName,this._ua.configuration.uri.host),s.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),r.fromDisplayName&&(d.from_display_name=r.fromDisplayName),s.push("Contact: ".concat(this._contact)),s.push("Content-Type: application/sdp"),this._sessionTimers.enabled&&s.push("Session-Expires: ".concat(this._sessionTimers.defaultExpires).concat(this._ua.configuration.session_timers_force_refresher?";refresher=uac":"")),this._use_trtc&&s.push("X-TRTC: 1"),this._request=new vd.InitialOutgoingInviteRequest(e,this._ua,d,s),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=(U.debug("init_incoming()"),e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0);e.body&&"application/sdp"!==o?e.reply(415):(this._status=k.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=P.newTag(),this._createDialog(e,"UAS",!0)?(e.body?this._late_sdp=!1:this._late_sdp=!0,this._status=k.STATUS_WAITING_FOR_ANSWER,this._timers.userNoAnswerTimer=setTimeout(function(){e.reply(408),n._failed("local",null,I.causes.NO_ANSWER)},this._ua.configuration.no_answer_timeout),r&&(this._timers.expiresTimer=setTimeout(function(){n._status===k.STATUS_WAITING_FOR_ANSWER&&(e.reply(487),n._failed("system",null,I.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!==k.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 s=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(U.debug("answer()"),this._request),t=P.cloneArray(e.extraHeaders),r=P.cloneObject(e.mediaConstraints),n=e.mediaStream||null,o=P.cloneObject(e.pcConfig,{iceServers:[]}),i=e.rtcConstraints||null,u=e.rtcAnswerConstraints||null,l=P.cloneObject(e.rtcOfferConstraints),c=!1,p=!1,d=!1,h=!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 gd.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this._status!==k.STATUS_WAITING_FOR_ANSWER)throw new gd.InvalidStateError(this._status);if(this._sessionTimers.enabled&&P.isDecimal(e.sessionTimersExpires)&&(e.sessionTimersExpires>=I.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=e.sessionTimersExpires:this._sessionTimers.defaultExpires=I.SESSION_EXPIRES),this._status=k.STATUS_ANSWERED,this._createDialog(a,"UAS")){if(clearTimeout(this._timers.userNoAnswerTimer),t.unshift("Contact: ".concat(this._contact)),this._use_trtc){var f=a.getHeader("X-TRTC-SDKAPPID"),m=a.getHeader("X-TRTC-USERID"),g=parseInt(a.getHeader("X-TRTC-ROOMID"),10),y=a.getHeader("X-TRTC-STRROOMID"),_=a.getHeader("X-TRTC-USERSIG"),v=a.getHeader("X-TRTC-PRIVATEMAPKEY"),e=a.getHeader("X-TCCC-IVR"),b=a.getHeader("X-TRTC-PROXY");if(!this._is_mini_program&&f&&m&&(g||y)&&_)return void Promise.resolve().then(function(){return s._connecting(a),s._joinTRTCRoom({sdkAppId:f,userId:m,roomId:g,strRoomId:y,privateMapKey:v,userSig:_,proxy:b},function(e){s.terminate({status_code:480,cause:I.causes.WEBRTC_ERROR,reason_phrase:"TRTC Error"}),s._failed("system",e.toString(),I.causes.WEBRTC_ERROR)})}).then(function(e){if(s._status===k.STATUS_TERMINATED)throw new Error("terminated");U.debug("TRTC success"),s._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){s._status=k.STATUS_WAITING_FOR_ACK,s._setInvite2xxTimer(a,e),s._setACKTimer(),s._accepted("local")},function(){s._failed("system",null,I.causes.CONNECTION_ERROR)}),s._late_sdp=!1}).catch(function(e){var t,r,n,o,i;if(s._status!==k.STATUS_TERMINATED)throw r=t=I.causes.WEBRTC_ERROR,n=e.name,(o=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(n))&&(t=I.causes.USER_DENIED_MEDIA_ACCESS,U.warn('emit "getusermediafailed" [error:%o]',e),s.emit("getusermediafailed",e)),i=P.isFunction(e.getCode)?e.getCode():"0","RtcError"===e.name&&U.error("TRTC error",e.toString(),{code:i,name:n}),!o&&e.message&&(r=e.message),U.debug("TRTC error then terminate",{code:i,name:n}),a.reply(480,r),s._failed("local",e.toString(),t),e});if(e||this._is_mini_program)return(new Promise.resolve).then(function(e){if(s._status===k.STATUS_TERMINATED)throw new Error("terminated");U.debug("processing pure signal mode"),s._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){s._status=k.STATUS_WAITING_FOR_ACK,s._setInvite2xxTimer(a,e),s._setACKTimer(),s._accepted("local")},function(){s._failed("system",null,I.causes.CONNECTION_ERROR)}),s._late_sdp=!1}).catch(function(e){var t;if(s._status!==k.STATUS_TERMINATED)throw U.error("pure signal mode error then terminate",e.toString()),t=I.causes.WEBRTC_ERROR,a.reply(480,t),s._failed("local",e.toString(),t),e});throw U.error("missing TRTC config"),a.reply(500),this._failed("system",null,I.causes.INTERNAL_ERROR),new Error("missing config")}e=a.parseSDP();Array.isArray(e.media)||(e.media=[e.media]);var S,T=N(e.media);try{for(T.s();!(S=T.n()).done;){var w=S.value;"audio"===w.type&&(c=!0,w.direction&&"sendrecv"!==w.direction||(d=!0)),"video"===w.type&&(p=!0,w.direction&&"sendrecv"!==w.direction||(h=!0))}}catch(s){T.e(s)}finally{T.f()}if(n&&!1===r.audio){var E,A=N(n.getAudioTracks());try{for(A.s();!(E=A.n()).done;){var O=E.value;n.removeTrack(O)}}catch(s){A.e(s)}finally{A.f()}}if(n&&!1===r.video){var x,C=N(n.getVideoTracks());try{for(C.s();!(x=C.n()).done;){var R=x.value;n.removeTrack(R)}}catch(s){C.e(s)}finally{C.f()}}n||void 0!==r.audio||(r.audio=d),n||void 0!==r.video||(r.video=h),n||c||l.offerToReceiveAudio||(r.audio=!1),n||p||l.offerToReceiveVideo||(r.video=!1),this._createRTCConnection(o,i),Promise.resolve().then(function(){return n||(r.audio||r.video?new xd(r).initialize().catch(function(e){if(s._status===k.STATUS_TERMINATED)throw new Error("terminated");var t=I.causes.USER_DENIED_MEDIA_ACCESS;throw a.reply(480,t),s._failed("local",null,I.causes.USER_DENIED_MEDIA_ACCESS),U.warn('emit "getusermediafailed" [error:%o]',e),s.emit("getusermediafailed",e),new Error("getUserMedia() failed")}):void 0)}).then(function(t){if(s._status===k.STATUS_TERMINATED)throw new Error("terminated");(s._localStream=t).mediaStream&&t.mediaStream.getTracks().forEach(function(e){s._connection.addTrack(e,t.mediaStream)})}).then(function(){var e,t;if(!s._late_sdp)return e={originator:"remote",type:"offer",sdp:a.body},U.debug('emit "sdp"'),s.emit("sdp",e),t=new RTCSessionDescription({type:"offer",sdp:e.sdp}),s._connectionPromiseQueue=s._connectionPromiseQueue.then(function(){return s._connection.setRemoteDescription(t)}).catch(function(e){throw a.reply(488),s._failed("system",null,I.causes.WEBRTC_ERROR),U.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),s.emit("peerconnection:setremotedescriptionfailed",e),new Error("peerconnection.setRemoteDescription() failed")}),s._connectionPromiseQueue}).then(function(){if(s._status===k.STATUS_TERMINATED)throw new Error("terminated");return s._connecting(a),(s._late_sdp?s._createLocalDescription("offer",s._rtcOfferConstraints):s._createLocalDescription("answer",u)).catch(function(){throw a.reply(500),new Error("_createLocalDescription() failed")})}).then(function(e){if(s._status===k.STATUS_TERMINATED)throw new Error("terminated");s._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){s._status=k.STATUS_WAITING_FOR_ACK,s._setInvite2xxTimer(a,e),s._setACKTimer(),s._accepted("local")},function(){s._failed("system",null,I.causes.CONNECTION_ERROR)})}).catch(function(e){s._status!==k.STATUS_TERMINATED&&U.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]:{};U.debug("terminate()");var r,n,o=e.cause||I.causes.BYE,i=P.cloneArray(e.extraHeaders),s=e.body,a=e.status_code,u=e.reason_phrase;if(this._status===k.STATUS_TERMINATED)throw new gd.InvalidStateError(this._status);switch(this._status){case k.STATUS_NULL:case k.STATUS_INVITE_SENT:case k.STATUS_1XX_RECEIVED:if(U.debug("canceling session"),a&&(a<200||700<=a))throw new TypeError("Invalid status_code: ".concat(a));a&&(u=u||I.REASON_PHRASE[a]||"",r="SIP ;cause=".concat(a,' ;text="').concat(u,'"')),this._status===k.STATUS_NULL||this._status===k.STATUS_INVITE_SENT?(this._is_canceled=!0,this._cancel_reason=r):this._status===k.STATUS_1XX_RECEIVED&&this._request.cancel(r),this._status=k.STATUS_CANCELED,this._failed("local",null,I.causes.CANCELED);break;case k.STATUS_WAITING_FOR_ANSWER:case k.STATUS_ANSWERED:if(U.debug("rejecting session"),(a=a||480)<300||700<=a)throw new TypeError("Invalid status_code: ".concat(a));this._request.reply(a,u,i,s),this._failed("local",null,I.causes.REJECTED);break;case k.STATUS_WAITING_FOR_ACK:case k.STATUS_CONFIRMED:if(U.debug("terminating session"),u=e.reason_phrase||I.REASON_PHRASE[a]||"",a&&(a<200||700<=a))throw new TypeError("Invalid status_code: ".concat(a));a&&i.push("Reason: SIP ;cause=".concat(a,'; text="').concat(u,'"')),this._status===k.STATUS_WAITING_FOR_ACK&&"incoming"===this._direction&&this._request.server_transaction.state!==yd.C.STATUS_TERMINATED?(n=this._dialog,this.receiveRequest=function(e){e.method===I.ACK&&(t.sendRequest(I.BYE,{extraHeaders:i,body:s}),n.terminate())},this._request.server_transaction.on("stateChanged",function(){t._request.server_transaction.state===yd.C.STATUS_TERMINATED&&(t.sendRequest(I.BYE,{extraHeaders:i,body:s}),n.terminate())}),this._ended("local",null,o),this._dialog=n,this._ua.newDialog(n)):(this.sendRequest(I.BYE,{extraHeaders:i,body:s}),this._ended("local",null,o))}}},{key:"sendDTMF",value:function(e){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=(U.debug("sendDTMF() | tones: %s",e),0),s=o.duration||null,a=o.interToneGap||null,t=o.transportType||I.DTMF_TRANSPORT.INFO;if(void 0===e)throw new TypeError("Not enough arguments");if(this._status!==k.STATUS_CONFIRMED&&this._status!==k.STATUS_WAITING_FOR_ACK&&this._status!==k.STATUS_1XX_RECEIVED)throw new gd.InvalidStateError(this._status);if(t!==I.DTMF_TRANSPORT.INFO&&t!==I.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(s&&!P.isDecimal(s))throw new TypeError("Invalid tone duration: ".concat(s));if(s=s?s<Td.C.MIN_DURATION?(U.debug('"duration" value is lower than the minimum allowed, setting it to '.concat(Td.C.MIN_DURATION," milliseconds")),Td.C.MIN_DURATION):s>Td.C.MAX_DURATION?(U.debug('"duration" value is greater than the maximum allowed, setting it to '.concat(Td.C.MAX_DURATION," milliseconds")),Td.C.MAX_DURATION):Math.abs(s):Td.C.DEFAULT_DURATION,o.duration=s,a&&!P.isDecimal(a))throw new TypeError("Invalid interToneGap: ".concat(a));a=a?a<Td.C.MIN_INTER_TONE_GAP?(U.debug('"interToneGap" value is lower than the minimum allowed, setting it to '.concat(Td.C.MIN_INTER_TONE_GAP," milliseconds")),Td.C.MIN_INTER_TONE_GAP):Math.abs(a):Td.C.DEFAULT_INTER_TONE_GAP,t!==I.DTMF_TRANSPORT.RFC2833?this._tones?this._tones+=e:(this._tones=e,function e(){var t,r,n=this;this._status===k.STATUS_TERMINATED||!this._tones||i>=this._tones.length?this._tones=null:(t=this._tones[i],i+=1,r=","===t?2e3:(r=new Td(this),o.eventHandlers={onFailed:function(){n._tones=null}},r.send(t,o),s+a),setTimeout(e.bind(this),r))}.call(this)):(t=this._getDTMFRTPSender())&&(e=t.toneBuffer+e,t.insertDTMF(e,s,a))}},{key:"sendInfo",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(U.debug("sendInfo()"),this._status!==k.STATUS_CONFIRMED&&this._status!==k.STATUS_WAITING_FOR_ACK&&this._status!==k.STATUS_1XX_RECEIVED)throw new gd.InvalidStateError(this._status);new wd(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=(U.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=(U.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(U.debug("switchMicrophones(%s)",e),!this._is_confirmed||!this._trtcLocalStream)throw new gd.InvalidStateError(this._status);if(this._trtcLocalStream)return this._trtcLocalStream.switchDevice("audio",e);throw new gd.NotSupportedError("WebRTC mode not support switchMicrophones")}},{key:"switchSpeaker",value:function(t){var r=this;if(U.debug("switchSpeaker(%s)",t,this._trtcRemoteStream),!this._is_confirmed)throw new gd.InvalidStateError(this._status);if(this._trtcLocalStream){var e,n=[];for(e in this._trtcRemoteStream)(e=>{Object.prototype.hasOwnProperty.call(r._trtcRemoteStream,e)&&(U.error("stream",e),n.push(function(){return r._trtcRemoteStream[e].setAudioOutput(t)}))})(e);return Promise.all(n)}throw new gd.NotSupportedError("WebRTC mode not support switchSpeaker")}},{key:"setAudioVolume",value:function(e){if(U.debug("setAudioVolume(%d)",e),!this._is_confirmed)throw new gd.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 gd.NotSupportedError("WebRTC mode not support setAudioVolume")}},{key:"enableAudioVolumeEvaluation",value:function(e,t){if(U.debug("enableAudioVolumeEvaluation(%d)",e),this._localTRTCClient)return this._localTRTCClient.enableAudioVolumeEvaluation(e,t);throw new gd.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(U.debug("hold()"),this._status!==k.STATUS_WAITING_FOR_ACK&&this._status!==k.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:I.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(U.debug("unhold()"),this._status!==k.STATUS_WAITING_FOR_ACK&&this._status!==k.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:I.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=(U.debug("renegotiate()"),r.rtcOfferConstraints||null);return!(this._status!==k.STATUS_WAITING_FOR_ACK&&this._status!==k.STATUS_CONFIRMED||!this._isReadyToReOffer()||(e={succeeded:function(){n&&n()},failed:function(){t.terminate({cause:I.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,i=(U.debug("refer()"),e);if(this._status!==k.STATUS_WAITING_FOR_ACK&&this._status!==k.STATUS_CONFIRMED)return!1;if(e=this._ua.normalizeTarget(e))return(r=new Ad(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(i))}},{key:"sendRequest",value:function(e,t){return U.debug("sendRequest()"),this._dialog.sendRequest(e,t)}},{key:"receiveRequest",value:function(e){var t=this;if(U.debug("receiveRequest()"),e.method===I.CANCEL)this._status!==k.STATUS_WAITING_FOR_ANSWER&&this._status!==k.STATUS_ANSWERED||(this._status=k.STATUS_CANCELED,this._request.reply(487),this._failed("remote",e,I.causes.CANCELED));else switch(e.method){case I.ACK:if(this._status===k.STATUS_WAITING_FOR_ACK)if(this._status=k.STATUS_CONFIRMED,clearTimeout(this._timers.ackTimer),clearTimeout(this._timers.invite2xxTimer),this._late_sdp){if(!e.body){this.terminate({cause:I.causes.MISSING_SDP,status_code:400});break}var r={originator:"remote",type:"answer",sdp:e.body},n=(U.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:I.causes.BAD_MEDIA_DESCRIPTION,status_code:488}),U.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else this._is_confirmed||this._confirmed("remote",e);break;case I.BYE:this._status===k.STATUS_CONFIRMED||this._status===k.STATUS_WAITING_FOR_ACK?(e.reply(200),this._ended("remote",e,I.causes.BYE)):this._status===k.STATUS_INVITE_RECEIVED||this._status===k.STATUS_WAITING_FOR_ANSWER?(e.reply(200),this._request.reply(487,"BYE Received"),this._ended("remote",e,I.causes.BYE)):e.reply(403,"Wrong Status");break;case I.INVITE:this._status===k.STATUS_CONFIRMED?e.hasHeader("replaces")?this._receiveReplaces(e):this._receiveReinvite(e):e.reply(403,"Wrong Status");break;case I.INFO:this._status===k.STATUS_1XX_RECEIVED||this._status===k.STATUS_WAITING_FOR_ANSWER||this._status===k.STATUS_ANSWERED||this._status===k.STATUS_WAITING_FOR_ACK||this._status===k.STATUS_CONFIRMED?(r=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0)&&r.match(/^application\/dtmf-relay/i)?new Td(this).init_incoming(e):void 0!==r?new wd(this).init_incoming(e):e.reply(415):e.reply(403,"Wrong Status");break;case I.UPDATE:this._status===k.STATUS_CONFIRMED?this._receiveUpdate(e):e.reply(403,"Wrong Status");break;case I.REFER:this._status===k.STATUS_CONFIRMED?this._receiveRefer(e):e.reply(403,"Wrong Status");break;case I.NOTIFY:this._status===k.STATUS_CONFIRMED?this._receiveNotify(e):e.reply(403,"Wrong Status");break;default:e.reply(501)}}},{key:"onTransportError",value:function(){U.warn("onTransportError()"),this._status!==k.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:I.causes.CONNECTION_ERROR,cause:I.causes.CONNECTION_ERROR})}},{key:"onRequestTimeout",value:function(){U.warn("onRequestTimeout()"),this._status!==k.STATUS_TERMINATED&&this.terminate({status_code:408,reason_phrase:I.causes.REQUEST_TIMEOUT,cause:I.causes.REQUEST_TIMEOUT})}},{key:"onDialogError",value:function(){U.warn("onDialogError()"),this._status!==k.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:I.causes.DIALOG_ERROR,cause:I.causes.DIALOG_ERROR})}},{key:"newDTMF",value:function(e){U.debug("newDTMF()"),this.emit("newDTMF",e)}},{key:"newInfo",value:function(e){U.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||(U.debug("_isReadyToReOffer() | there is another INVITE/UPDATE transaction in progress"),!1):(U.debug("_isReadyToReOffer() | session not established yet"),!1):(U.debug("_isReadyToReOffer() | internal WebRTC status not ready"),!1)}},{key:"_close",value:function(){var e=this;if(U.debug("close()"),this._localStream&&this._localStream.close(),this._trtcLocalStream&&this._trtcLocalStreamLocallyGenerated&&(U.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){U.warn("TRTC leave room failed [error:%o]",e)}).then(function(){U.debug("TRTC destroy"),e._localTRTCClient&&e._localTRTCClient.destroy()})),this._status!==k.STATUS_TERMINATED){if(this._status=k.STATUS_TERMINATED,this._connection){for(var t in this._remoteStream)this.emit("removestream",t);try{this._connection.close()}catch(e){U.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=_d.T1;this._timers.invite2xxTimer=setTimeout(function e(){this._status===k.STATUS_WAITING_FOR_ACK&&(t.reply(200,null,["Contact: ".concat(this._contact)],r),n<_d.T2&&(n*=2)>_d.T2&&(n=_d.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===k.STATUS_WAITING_FOR_ACK&&(U.debug("no ACK received, terminating the session"),clearTimeout(e._timers.invite2xxTimer),e.sendRequest(I.BYE),e._ended("remote",null,I.causes.NO_ACK))},_d.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:I.causes.RTP_TIMEOUT,status_code:408,reason_phrase:I.causes.RTP_TIMEOUT})}),this._connection.addEventListener("track",function(e){var t,e=e.streams[0];r._remoteStream[e.id]||(t=new Cd({mediaStream:e}),r._remoteStream[e.id]=t,U.debug('emit "addstream" '.concat(e.id)),r.emit("addstream",{stream:t}))}),U.debug('emit "peerconnection"'),this.emit("peerconnection",{peerconnection:this._connection})}},{key:"_createLocalDescription",value:function(s,t){var a=this;if(U.debug("createLocalDescription(%s, %o)",s,t),"offer"!==s&&"answer"!==s)throw new Error('createLocalDescription() | invalid type "'.concat(s,'"'));var u=this._connection;return this._rtcReady=!1,Promise.resolve().then(function(){return"offer"===s?u.createOffer(t).catch(function(e){return U.warn('emit "peerconnection:createofferfailed" [error:%o]',e),a.emit("peerconnection:createofferfailed",e),Promise.reject(e)}):u.createAnswer(t).catch(function(e){return U.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,U.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:s,sdp:u.localDescription.sdp},U.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),i=!0,a._rtcReady=!0,a._iceReady=!0;var e={originator:"local",type:s,sdp:u.localDescription.sdp};U.debug('emit "sdp"'),a.emit("sdp",e),t(e.sdp)}var n,o,i=!1;a._iceReady=!1;u.addEventListener("icecandidate",n=function(e){e=e.candidate;e?a.emit("icecandidate",{candidate:e,ready:r}):i||r()}),u.addEventListener("icegatheringstatechange",o=function(){"complete"!==u.iceGatheringState||i||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 bd(this,e,t,bd.C.STATUS_EARLY)).error?(U.debug(o.error),this._failed("remote",e,I.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 bd(this,e,t)).error?(U.debug(r.error),this._failed("remote",e,I.causes.INTERNAL_ERROR),!1):(this._dialog=r,!0))}},{key:"_receiveReinvite",value:function(n){var t=this,e=(U.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=(i=!0,e.status_code||403),r=e.reason_phrase||"",e=P.cloneArray(e.extraHeaders);if(this._status!==k.STATUS_CONFIRMED)return!1;if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));n.reply(t,r,e)}.bind(this)},i=!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=k.STATUS_WAITING_FOR_ACK,t._setInvite2xxTimer(n,e),t._setACKTimer()}),"function"==typeof o.callback&&o.callback()}this.emit("reinvite",o),i||(this._late_sdp=!1,n.body?"application/sdp"!==e?(U.debug("invalid Content-Type"),n.reply(415)):this._processInDialogSdpOffer(n).then(function(e){t._status!==k.STATUS_TERMINATED&&r.call(t,e)}).catch(function(e){U.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=(U.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=P.cloneArray(e.extraHeaders);if(this._status!==k.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 i(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?(U.debug("invalid Content-Type"),n.reply(415)):this._processInDialogSdpOffer(n).then(function(e){t._status!==k.STATUS_TERMINATED&&i.call(t,e)}).catch(function(e){U.warn(e)}):i.call(this,null))}},{key:"_processInDialogSdpOffer",value:function(t){var r=this;U.debug("_processInDialogSdpOffer()");var e,n=t.parseSDP(),o=!1,i=N(n.media);try{for(i.s();!(e=i.n()).done;){var s=e.value;if(-1!==Ud.indexOf(s.type)){var a=s.direction||n.direction||"sendrecv";if("sendonly"!==a&&"inactive"!==a){o=!1;break}o=!0}}}catch(t){i.e(t)}finally{i.f()}var u={originator:"remote",type:"offer",sdp:t.body},l=(U.debug('emit "sdp"'),this.emit("sdp",u),new RTCSessionDescription({type:"offer",sdp:u.sdp}));return this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if(r._status===k.STATUS_TERMINATED)throw new Error("terminated");return r._connection.setRemoteDescription(l).catch(function(e){throw t.reply(488),U.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),r.emit("peerconnection:setremotedescriptionfailed",e),e})}).then(function(){if(r._status===k.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===k.STATUS_TERMINATED)throw new Error("terminated");return r._createLocalDescription("answer",r._rtcAnswerConstraints).catch(function(e){throw t.reply(500),U.warn('emit "peerconnection:createtelocaldescriptionfailed" [error:%o]',e),e})}).catch(function(e){U.warn("_processInDialogSdpOffer() failed [error: %o]",e)}),this._connectionPromiseQueue}},{key:"_receiveRefer",value:function(o){var i,r=this;U.debug("receiveRefer()"),o.refer_to?o.refer_to.uri.scheme!==I.SIP?(U.debug("Refer-To header field points to a non-SIP URI scheme"),o.reply(416)):(o.reply(202),i=new Ed(this,o.cseq),U.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!==k.STATUS_WAITING_FOR_ACK&&this._status!==k.STATUS_CONFIRMED)return!1;var r,n=new Qd(this._ua);n.on("progress",function(e){e=e.response;i.notify(e.status_code,e.reason_phrase)}),n.on("accepted",function(e){e=e.response;i.notify(e.status_code,e.reason_phrase)}),n.on("_failed",function(e){var t=e.message,e=e.cause;t?i.notify(t.status_code,t.reason_phrase):i.notify(487,e)}),o.refer_to.uri.hasHeader("replaces")&&(r=decodeURIComponent(o.refer_to.uri.getHeader("replaces")),t.extraHeaders=P.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(){i.notify(603)}.call(r)}})):(U.debug("no Refer-To header field present in REFER"),o.reply(400))}},{key:"_receiveNotify",value:function(e){if(U.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;U.debug("receiveReplaces()"),this.emit("replaces",{request:n,accept:function(e){!function(e){var t=this;if(this._status!==k.STATUS_WAITING_FOR_ACK&&this._status!==k.STATUS_CONFIRMED)return!1;var r=new Qd(this._ua);r.on("confirmed",function(){t.terminate()}),r.init_incoming(n,e)}.call(t,e)},reject:function(){!function(){U.debug("Replaced INVITE rejected by the user"),n.reply(486)}.call(t)}})}},{key:"_sendInitialRequest",value:function(e,r,t){var n=this,o=new Sd(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 xd(e).initialize().catch(function(e){if(n._status===k.STATUS_TERMINATED)throw new Error("terminated");throw n._failed("local",null,I.causes.USER_DENIED_MEDIA_ACCESS),U.warn('emit "getusermediafailed" [error:%o]',e),n.emit("getusermediafailed",e),e}):void 0)}).then(function(t){if(n._status===k.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,I.causes.WEBRTC_ERROR),e})}).then(function(e){if(n._is_canceled||n._status===k.STATUS_TERMINATED)throw new Error("terminated");n._request.body=e,n._status=k.STATUS_INVITE_SENT,U.debug('emit "sending" [request:%o]',n._request),n.emit("sending",{request:n._request}),o.send()}).catch(function(e){n._status!==k.STATUS_TERMINATED&&U.warn(e)})}},{key:"_sendTRTCInitialRequest",value:function(){var t=this,e=new Sd(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===k.STATUS_TERMINATED)throw new Error("terminated");U.debug("connecting"),t._connecting(t._request),t._status=k.STATUS_INVITE_SENT,U.debug('emit "sending" [request:%o]',t._request),t.emit("sending",{request:t._request}),e.send()}).catch(function(e){t._status!==k.STATUS_TERMINATED&&U.warn(e)})}},{key:"_inviteToTRTCRoom",value:function(o,e){var i=this;this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return i._joinTRTCRoom(e,function(e){i._acceptAndTerminate(o),i._failed("system",e.toString(),I.causes.WEBRTC_ERROR)})}).then(function(){i._rtcReady=!0,"incoming"===i._direction&&(i._handleSessionTimersInIncomingResponse(o),i._accepted("remote",o),i.sendRequest(I.ACK),i._confirmed("local",null))}).catch(function(e){var t,r,n;if(i._status!==k.STATUS_TERMINATED)throw r=t=I.causes.WEBRTC_ERROR,(n=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(e.name))&&(r=t=I.causes.USER_DENIED_MEDIA_ACCESS,U.warn('emit "getusermediafailed" [error:%o]',e),i.emit("getusermediafailed",e)),"RtcError"===e.name&&U.error("TRTC error",e.toString()),!n&&e.message&&(r=e.message),i._acceptAndTerminate(o,480,r),i._failed("local",o,t),e}).then(function(){U.debug("trtc done")})}},{key:"_joinTRTCRoom",value:function(e,r){var n,t,o,i,s,a,u,l,c,p,d=this;if(!this._trtc_already_join)return this._trtc_already_join=!0,n=this.tracer.startSpan("trtc",void 0),t=e.sdkAppId,s=e.userSig,a=e.privateMapKey,l=e.proxy,c={sdkAppId:t,userId:o=e.userId,roomId:i=e.roomId,strRoomId:u=e.strRoomId,direction:this._direction,uri:this._ua.configuration.uri.toString(),proxy:l},U.debug("TRTC start",c),n.setAttributes(c),p=fd.createClient({mode:"rtc",sdkAppId:Number(t),userId:o,userSig:s,useStringRoomId:!i}),l&&p.setProxyServer({websocketProxy:"wss://".concat(l)}),this._trtcLocalStream=fd.createStream(J({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){U.debug("TRTC stream-added, id:%s",e.stream.getId()),d.emit("stream-added",e),p.subscribe(e.stream,{audio:!0,video:Boolean(d._trtcLocalStream.video)}).catch(function(e){d._status!==k.STATUS_TERMINATED&&(U.error("TRTC subscribe stream errorCode: %d",e.getCode()),r)&&r(e)})}),p.on("stream-subscribed",function(e){var t=e.stream;U.debug("TRTC stream-subscribed, id:%o",t.getId()),d._trtcRemoteStream[t.getId()]=t,d.emit("addstream",e),d.emit("stream-subscribed",e),0<d.listenerCount("stream-subscribed")?U.debug("stream-subscribe listener count greater than 0"):t.play(d._getStreamPlayElement(o)).then(function(){U.debug("TRTC play stream success, id:%o",t.getId())}).catch(function(e){d._status!==k.STATUS_TERMINATED&&(U.error("TRTC play stream errorCode: %d",e.getCode()),r)&&r(e)})}),p.on("stream-removed",function(e){var t=e.stream;delete d._trtcRemoteStream[t.getId()],d.emit("stream-removed",e),d.emit("removestream",e)}),p.on("stream-updated",function(e){var t=e.stream;d._trtcRemoteStream[t.getId()]=t,d.emit("stream-updated",e)}),p.on("error",function(e){var t;d._status!==k.STATUS_TERMINATED&&(t=e.getCode(),U.error("TRTC errorCode: %o",t),d._failed("local",e.toString(),I.causes.WEBRTC_ERROR))}),p.on("audio-volume",function(e){e&&Array.isArray(e.result)&&(e=e.result.map(function(e){return J(J({},e),{},{originator:e.userId===d._localUserId?"local":"remote"})}),d.emit("audiovolume",{result:e}))}),p.on("network-quality",function(e){d.emit("networkquality",e)}),Promise.resolve().then(function(){var t=d.tracer.startSpan("trtc/join",{attributes:c},Id.setSpan(Pd.active(),n));return Promise.all([t,d._trtcLocalStream.initialize().then(function(){d._trtcLocalStreamLocallyGenerated=!0}),d._localTRTCClient.join({roomId:i||u,privateMapKey:a}).then(function(){U.debug("TRTC join success"),t.end()}).catch(function(e){return t.recordException(e),t.end(),Promise.reject(e)})])}).then(function(){var t;if(U.debug("TRTC join and initialize success"),d._status!==k.STATUS_TERMINATED)return 0<d.listenerCount("audiovolume")&&d._trtcLocalStream.play(d._getStreamPlayElement(o)),U.debug("TRTC join success then publish"),t=d.tracer.startSpan("trtc/publish",{attributes:c},Id.setSpan(Pd.active(),n)),d._localTRTCClient.publish(d._trtcLocalStream).then(function(){t.end()}).catch(function(e){return t.recordException(e),t.end(),Promise.reject(e)});U.debug("TRTC join success after terminate");try{d._trtcLocalStream.close(),d._localTRTCClient.leave().then(function(){d._localTRTCClient.destroy()}).catch(function(){d._localTRTCClient.destroy()})}catch(t){U.debug("trtc initial or join success then close error, message: ".concat(t.message))}}).then(function(){U.debug("TRTC publish success"),n.end()}).catch(function(e){U.warn("trtc join failed, status: ".concat(d._status,", error message: ").concat(e.toString()));var t=P.isFunction(e.getCode)?e.getCode():"0";n.recordException(e),n.setAttributes({errorName:e.name,errorCode:t,errorMessage:e.toString()}),n.end();try{d._trtcLocalStream.close(),d._localTRTCClient.leave().then(function(){d._localTRTCClient.destroy()})}catch(e){U.debug("trtc join failed then close or destroy error, error: ".concat(e.message))}if(d._status!==k.STATUS_TERMINATED)throw e});U.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 U.debug("get audio container",t),t||(U.debug("create audio container"),(t=document.createElement("div")).setAttribute("id",e),t.setAttribute("style","width:0;height:0;overflow:hidden"),document.body.appendChild(t),U.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;U.warn("sendDTMF() | no local audio track to send DTMF with")}},{key:"_receiveInviteResponse",value:function(t){var e,r,n,o,i,s,a,u,l,c,p,d,h,f,m,g,y,_=this;if(U.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(I.ACK):void 0!==(e=new bd(this,t,"UAC")).error?void U.debug(e.error):(this.sendRequest(I.ACK),void this.sendRequest(I.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===k.STATUS_INVITE_SENT||this._status===k.STATUS_1XX_RECEIVED)switch(!0){case/^100$/.test(t.status_code):this._status=k.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=k.STATUS_1XX_RECEIVED,!this._is_mini_program&&this._use_trtc?(this._progress("remote",t),s=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"),i=t.getHeader("X-TRTC-PROXY"),U.debug("".concat(t.status_code," with trtc params"),{sdkAppId:s,userId:f,roomId:g,strRoomId:v,userSig:r,privateMapKey:n,isIVRCall:o,proxy:i}),s&&f&&(g||v)&&r?this._inviteToTRTCRoom(t,{sdkAppId:s,userId:f,roomId:g,strRoomId:v,userSig:r,privateMapKey:n,proxy:i}):this._is_mini_program||o?U.debug("pure signal mode, no trtc params in 1xx response"):(this._acceptAndTerminate(t,400,I.causes.MISSING_SDP),this._failed("remote",t,I.causes.BAD_MEDIA_DESCRIPTION))):t.body?(s={originator:"remote",type:"answer",sdp:t.body},U.debug('emit "sdp"'),this.emit("sdp",s),a=new RTCSessionDescription({type:"answer",sdp:s.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return _._connection.setRemoteDescription(a)}).then(function(){return _._progress("remote",t)}).catch(function(e){U.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),_.emit("peerconnection:setremotedescriptionfailed",e)})):this._progress("remote",t)):U.debug("1xx response received without to tag");break;case/^2[0-9]{2}$/.test(t.status_code):(this._status=k.STATUS_CONFIRMED,t.body||this._use_trtc)?this._createDialog(t,"UAC")&&(this._use_trtc?(this._handleSessionTimersInIncomingResponse(t),this._accepted("remote",t),this.sendRequest(I.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"),d=t.getHeader("X-TRTC-USERSIG"),h=t.getHeader("X-TRTC-PRIVATEMAPKEY"),f=t.getHeader("X-TCCC-IVR"),m=t.getHeader("X-TRTC-PROXY"),U.debug("".concat(t.status_code," with trtc params"),{sdkAppId:u,userId:l,roomId:c,strRoomId:p,userSig:d,privateMapKey:h,isIVRCall:f,proxy:m}),u&&l&&(c||p)&&d?Promise.resolve().then(function(){return _._joinTRTCRoom({sdkAppId:u,userId:l,roomId:c,strRoomId:p,privateMapKey:h,userSig:d,proxy:m},function(e){_.terminate({status_code:480,cause:I.causes.WEBRTC_ERROR,reason_phrase:"TRTC Error"}),_._failed("system",e.toString(),I.causes.WEBRTC_ERROR)})}).catch(function(e){var t,r,n;_._status!==k.STATUS_TERMINATED&&(r=t=I.causes.WEBRTC_ERROR,(n=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(e.name))&&(r=t=I.causes.USER_DENIED_MEDIA_ACCESS,U.warn('emit "getusermediafailed" [error:%o]',e),_.emit("getusermediafailed",e)),"RtcError"===e.name&&U.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?U.debug("pure signal mode, no trtc params in 200OK"):U.debug("missing trtc params in 200OK")):(g={originator:"remote",type:"answer",sdp:t.body},U.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,I.causes.WEBRTC_ERROR)})}).then(function(){_._connection.setRemoteDescription(y).then(function(){_._handleSessionTimersInIncomingResponse(t),_._accepted("remote",t),_.sendRequest(I.ACK),_._confirmed("local",null)}).catch(function(e){_._acceptAndTerminate(t,488,"Not Acceptable Here"),_._failed("remote",t,I.causes.BAD_MEDIA_DESCRIPTION),U.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),_.emit("peerconnection:setremotedescriptionfailed",e)})}))):(this._acceptAndTerminate(t,400,I.causes.MISSING_SDP),this._failed("remote",t,I.causes.BAD_MEDIA_DESCRIPTION));break;default:var v=P.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=(U.debug("sendReinvite()"),P.cloneArray(e.extraHeaders)),o=P.cloneObject(e.eventHandlers),t=e.rtcOfferConstraints||this._rtcOfferConstraints||null,i=!1;function s(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)};U.debug('emit "sdp"'),r.emit("sdp",t),r.sendRequest(I.INVITE,{extraHeaders:n,body:e,eventHandlers:{onSuccessResponse:function(e){(function(e){var t,r,n=this;this._status===k.STATUS_TERMINATED||(this.sendRequest(I.ACK),i)||(this._handleSessionTimersInIncomingResponse(e),e.body&&e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()?(t={originator:"remote",type:"answer",sdp:e.body},U.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){s.call(n),U.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),n.emit("peerconnection:setremotedescriptionfailed",e)})):s.call(this))}).call(r,e),i=!0},onErrorResponse:function(e){s.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}).catch(function(){s()})}},{key:"_sendUpdate",value:function(){var r=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=(U.debug("sendUpdate()"),P.cloneArray(e.extraHeaders)),o=P.cloneObject(e.eventHandlers),t=e.rtcOfferConstraints||this._rtcOfferConstraints||null,i=e.sdpOffer||!1,s=!1;function a(e){var t,r,n=this;this._status===k.STATUS_TERMINATED||s||(this._handleSessionTimersInIncomingResponse(e),i?e.body&&e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()?(t={originator:"remote",type:"answer",sdp:e.body},U.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),U.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")),i?(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)};U.debug('emit "sdp"'),r.emit("sdp",t),r.sendRequest(I.UPDATE,{extraHeaders:n,body:e,eventHandlers:{onSuccessResponse:function(e){a.call(r,e),s=!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(I.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){U.debug("acceptAndTerminate()");var n=[];t&&(r=r||I.REASON_PHRASE[t]||"",n.push("Reason: SIP ;cause=".concat(t,'; text="').concat(r,'"'))),(this._dialog||this._createDialog(e,"UAC"))&&(this.sendRequest(I.ACK),this.sendRequest(I.BYE,{extraHeaders:n})),this._status=k.STATUS_TERMINATED}},{key:"_mangleOffer",value:function(e){if(!this._localHold&&!this._remoteHold)return e;if(e=md.parse(e),this._localHold&&!this._remoteHold){U.debug("mangleOffer() | me on hold, mangling offer");var t,r=N(e.media);try{for(r.s();!(t=r.n()).done;){var n=t.value;-1!==Ud.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){U.debug("mangleOffer() | both on hold, mangling offer");var o,i=N(e.media);try{for(i.s();!(o=i.n()).done;){var s=o.value;-1!==Ud.indexOf(s.type)&&(s.direction="inactive")}}catch(e){i.e(e)}finally{i.f()}}else if(this._remoteHold){U.debug("mangleOffer() | remote on hold, mangling offer");var a,u=N(e.media);try{for(u.s();!(a=u.n()).done;){var l=a.value;-1!==Ud.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 md.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>=I.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>=I.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!==k.STATUS_TERMINATED&&e._isReadyToReOffer()&&(U.debug("runSessionTimer() | sending session refresh request"),e._sessionTimers.refreshMethod===I.UPDATE?e._sendUpdate():e._sendReinvite())},500*t):this._sessionTimers.timer=setTimeout(function(){e._status!==k.STATUS_TERMINATED&&(U.warn("runSessionTimer() | timer expired, terminating the session"),e.terminate({cause:I.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 gd.InvalidStateError(this._status)}var t,r=N(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 gd.InvalidStateError(this._status)}var t,r=N(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){U.debug("newRTCSession()"),this._ua.newRTCSession(this,{originator:e,session:this,request:t})}},{key:"_connecting",value:function(e){U.debug("session connecting"),U.debug('emit "connecting"'),this.emit("connecting",{request:e})}},{key:"_progress",value:function(e,t){U.debug("session progress"),U.debug('emit "progress"'),this.emit("progress",{originator:e,response:t||null})}},{key:"_accepted",value:function(e,t){U.debug("session accepted"),this._start_time=new Date,U.debug('emit "accepted"'),this.emit("accepted",{originator:e,response:t||null})}},{key:"_confirmed",value:function(e,t){U.debug("session confirmed"),this._is_confirmed=!0,U.debug('emit "confirmed"'),this.emit("confirmed",{originator:e,ack:t||null})}},{key:"_ended",value:function(e,t,r){U.debug("session ended"),this._end_time=new Date,this._close(),U.debug('emit "ended"'),this.emit("ended",{originator:e,message:t||null,cause:r})}},{key:"_failed",value:function(e,t,r){U.debug("session failed"),U.debug('emit "_failed"'),this.emit("_failed",{originator:e,message:t||null,cause:r}),this._close(),U.debug('emit "failed"'),this.emit("failed",{originator:e,message:t||null,cause:r})}},{key:"_onhold",value:function(e){U.debug("session onhold"),this._setLocalMediaStatus(),U.debug('emit "hold"'),this.emit("hold",{originator:e})}},{key:"_onunhold",value:function(e){U.debug("session onunhold"),this._setLocalMediaStatus(),U.debug('emit "unhold"'),this.emit("unhold",{originator:e})}},{key:"_onmute",value:function(e){var t=e.audio,e=e.video;U.debug("session onmute"),this._setLocalMediaStatus(),U.debug('emit "muted"'),this.emit("muted",{audio:t,video:e})}},{key:"_onunmute",value:function(e){var t=e.audio,e=e.video;U.debug("session onunmute"),this._setLocalMediaStatus(),U.debug('emit "unmuted"'),this.emit("unmuted",{audio:t,video:e})}}],[{key:"C",get:function(){return k}}])),r=le.EventEmitter,h=n,kd=F,Ld=o,jd=ye(),Dd=i,Md=B,Vd=qr(),Bd=new h("Message"),s=(K(Xd,r),e(Xd,[{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 i,o=jd.cloneArray(n.extraHeaders),s=jd.cloneObject(n.eventHandlers),a=n.contentType||"text/plain",u={};for(i in n.fromUserName&&(u.from_uri=new Vd("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),s)Object.prototype.hasOwnProperty.call(s,i)&&this.on(i,s[i]);o.push("Content-Type: ".concat(a)),this._request=new Ld.OutgoingRequest(kd.MESSAGE,e,this._ua,u,o),t&&(this._request.body=t);n=new Dd(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=jd.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Md.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=jd.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Md.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=jd.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,kd.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,kd.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){Bd.debug("MESSAGE failed"),this._close(),Bd.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:r})}},{key:"_succeeded",value:function(e,t){Bd.debug("MESSAGE succeeded"),this._close(),Bd.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}}])),bc=le.EventEmitter,Fe=n,Fd=F,qd=o,Hd=ye(),zd=i,Gd=B,Kd=new Fe("Options"),j=(K($d,bc),e($d,[{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 i,o=Hd.cloneArray(n.extraHeaders),s=Hd.cloneObject(n.eventHandlers),n=n.contentType||"application/sdp";for(i in s)Object.prototype.hasOwnProperty.call(s,i)&&this.on(i,s[i]);o.push("Content-Type: ".concat(n)),this._request=new qd.OutgoingRequest(Fd.OPTIONS,e,this._ua,null,o),t&&(this._request.body=t);n=new zd(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=Hd.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Gd.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=Hd.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Gd.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=Hd.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,Fd.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,Fd.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){Kd.debug("OPTIONS failed"),this._close(),Kd.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:r})}},{key:"_succeeded",value:function(e,t){Kd.debug("OPTIONS succeeded"),this._close(),Kd.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}}])),Qc={},pp=n,Yd=ye(),Wd=ge(),Jd=new pp("Socket");function $d(e){var t;return c(this,$d),(t=H(this,$d))._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}function Xd(e){var t;return c(this,Xd),(t=H(this,Xd))._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}function Qd(e){c(this,Qd),U.debug("new"),(t=H(this,Qd))._id=null,t._ua=e,t._status=k.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=P.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:I.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=Nd.trace({id:r?"tcccsg":"tccc",url:r?"https://otlp.connect.tencentcloud.com/v1/traces":"https://otlp.tccc.qcloud.com/v1/traces"}),fd.Logger.setLogLevel(e),t._ua.configuration.log_report?fd.Logger.enableUploadLog():fd.Logger.disableUploadLog(),t}Qc.isSocket=function(t){if(Array.isArray(t))return!1;if(void 0===t)return Jd.warn("undefined JsSIP.Socket instance"),!1;try{if(!Yd.isString(t.url))throw Jd.warn("missing or invalid JsSIP.Socket url property"),new Error("Missing or invalid JsSIP.Socket url property");if(!Yd.isString(t.via_transport))throw Jd.warn("missing or invalid JsSIP.Socket via_transport property"),new Error("Missing or invalid JsSIP.Socket via_transport property");if(-1===Wd.parse(t.sip_uri,"SIP_URI"))throw Jd.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(!Yd.isFunction(t[e]))throw Jd.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};var Zd=Qc,gp=F,eh=new n("Transport"),th={STATUS_CONNECTED:0,STATUS_CONNECTING:1,STATUS_DISCONNECTED:2,SOCKET_STATUS_READY:0,SOCKET_STATUS_ERROR:1,recovery_options:{min_interval:gp.CONNECTION_RECOVERY_MIN_INTERVAL,max_interval:gp.CONNECTION_RECOVERY_MAX_INTERVAL}},cp=e(function e(t){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:th.recovery_options;c(this,e),eh.debug("new()"),this.status=th.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){eh.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(!Zd.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:th.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(){eh.debug("connect()"),this.isConnected()?eh.debug("Transport is already connected"):this.isConnecting()?eh.debug("Transport is connecting"):(this.close_requested=!1,this.status=th.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(){eh.debug("close()"),this.close_requested=!0,this.recover_attempts=0,this.status=th.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 eh.debug("send()"),this.isConnected()?(e=e.toString(),eh.debug("sending message:\n\n".concat(e,"\n")),this.socket.send(e)):(eh.warn("unable to send message, transport is not connected"),!1)}},{key:"isConnected",value:function(){return this.status===th.STATUS_CONNECTED}},{key:"isConnecting",value:function(){return this.status===th.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),eh.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!==th.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=th.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=th.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=th.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=th.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 eh.debug("received binary message failed to be converted into string, message discarded")}eh.debug("received binary message:\n\n".concat(e,"\n"))}else eh.debug("received text message:\n\n".concat(e,"\n"));this.ondata({transport:this,message:e})}else eh.debug("received message with CRLF Keep Alive response")}}]),_p={},vp=n,rh=ge(),nh=o,oh=new vp("Parser");_p.parseMessage=function(e,t){var r,n,o=e.indexOf("\r\n");if(-1!==o){var i=e.substring(0,o),s=rh.parse(i,"Request_Response");if(-1!==s){s.status_code?((r=new nh.IncomingResponse).status_code=s.status_code,r.reason_phrase=s.reason_phrase):((r=new nh.IncomingRequest(t)).method=s.method,r.ruri=s.uri),r.data=e;for(var a=o+2;;){if(-2===(o=((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})(e,a))){n=a+2;break}if(-1===o)return void oh.warn("parseMessage() | malformed message");if(!0!==(s=((e,t,r,n)=>{var o,i=t.indexOf(":",r),s=t.substring(r,i).trim(),a=t.substring(i+1,n).trim();switch(s.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=rh.parse(a,"Record_Route")))o=void 0;else{var u,l=N(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=rh.parse(a,"Contact")))o=void 0;else{var p,d=N(o);try{for(d.s();!(p=d.n()).done;){var h=p.value;e.addHeader("contact",a.substring(h.possition,h.offset)),e.headers.Contact[e.getHeaders("contact").length-1].parsed=h.parsed}}catch(e){d.e(e)}finally{d.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 nh.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(s,a),o=0}return void 0!==o||{error:'error parsing header "'.concat(s,'"')}})(r,e,a,o)))return void oh.warn("parseMessage() |",s.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}oh.warn('parseMessage() | error parsing first line of SIP message: "'.concat(i,'"'))}else oh.warn("parseMessage() | no CRLF found, not a SIP message")};var R,ih,sh,C=n,ah=F,uh=o,lh=ye(),ch=new C("sanityCheck"),ph=[function(){for(var e=0,t=["from","to","call_id","cseq","via"];e<t.length;e++){var r=t[e];if(!R.hasHeader(r))return ch.debug("missing mandatory header field : ".concat(r,", dropping the response")),!1}}],dh=[function(){if("sip"!==R.s("to").uri.scheme)return fh(416),!1},function(){if(!R.to_tag&&R.call_id.substr(0,5)===ih.configuration.jssip_id)return fh(482),!1},function(){if(lh.str_utf8_length(R.body)<R.getHeader("content-length"))return fh(400),!1},function(){var e,t=R.from_tag,r=R.call_id,n=R.cseq;if(!R.to_tag)if(R.method===ah.INVITE){if(ih._transactions.ist[R.via_branch])return!1;for(var o in ih._transactions.ist)if(Object.prototype.hasOwnProperty.call(ih._transactions.ist,o)&&(e=ih._transactions.ist[o]).request.from_tag===t&&e.request.call_id===r&&e.request.cseq===n)return fh(482),!1}else{if(ih._transactions.nist[R.via_branch])return!1;for(var i in ih._transactions.nist)if(Object.prototype.hasOwnProperty.call(ih._transactions.nist,i)&&(e=ih._transactions.nist[i]).request.from_tag===t&&e.request.call_id===r&&e.request.cseq===n)return fh(482),!1}}],hh=[function(){if(1<R.getHeaders("via").length)return ch.debug("more than one Via header field present in the response, dropping the response"),!1},function(){if(lh.str_utf8_length(R.body)<R.getHeader("content-length"))return ch.debug("message body length is lower than the value in Content-Length header field, dropping the response"),!1}];function fh(e){var t,r=R.getHeaders("via"),n="SIP/2.0 ".concat(e," ").concat(ah.REASON_PHRASE[e],"\r\n"),o=N(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=R.getHeader("To"),R.to_tag||(r+=";tag=".concat(lh.newTag())),n=(n=(n=(n+="To: ".concat(r,"\r\n"))+"From: ".concat(R.getHeader("From"),"\r\n"))+"Call-ID: ".concat(R.call_id,"\r\n"))+"CSeq: ".concat(R.cseq," ").concat(R.method,"\r\n"),sh.send(n+="\r\n")}var x={},mh=ye(),gh=F,yh=ge(),_h=qr(),vh=Qc,bh=B,Sh=n,Th=(x.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:gh.UPDATE,session_timers_force_refresher:!1,no_answer_timeout:60,register:!0,register_expires:600,registrar_server:null,sockets:null,connection_recovery_max_interval:gh.CONNECTION_RECOVERY_MAX_INTERVAL,connection_recovery_min_interval:gh.CONNECTION_RECOVERY_MIN_INTERVAL,extra_headers:null,via_host:"".concat(mh.createRandomToken(12),".invalid"),log_level:gh.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(vh.isSocket(e))t.push({socket:e});else{if(!Array.isArray(e)||!e.length)return;var r,n=N(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;Object.prototype.hasOwnProperty.call(o,"socket")&&vh.isSocket(o.socket)?t.push(o):vh.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(gh.SIP,":").concat(e));e=_h.parse(e);return e&&e.user?e:void 0}},optional:{authorization_user:function(e){return-1===yh.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(mh.isDecimal(e)){e=Number(e);if(0<e)return e}},connection_recovery_min_interval:function(e){if(mh.isDecimal(e)){e=Number(e);if(0<e)return e}},contact_uri:function(e){if("string"==typeof e){e=yh.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===yh.parse(e,"uuid")?void 0:e},no_answer_timeout:function(e){if(mh.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())===gh.INVITE||e===gh.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(mh.isDecimal(e)){e=Number(e);if(0<e)return e}},registrar_server:function(e){/^sip:/i.test(e)||(e="".concat(gh.SIP,":").concat(e));e=_h.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=N(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 mh.isDecimal(e)&&-1!==Object.values(gh.LOG_LEVEL).indexOf(Number(e))?(Sh.setLogLevel(Number(e)),e):(Sh.setLogLevel(gh.LOG_LEVEL.TRACE),gh.LOG_LEVEL.TRACE)},log_report:function(e){return"boolean"==typeof e?(Sh.setLogReport(e),e):(Sh.setLogReport(!0),!0)},log_proxy:function(e){return Sh.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}}}),Cp=(x.load=function(e,t){for(var r in Th.mandatory){if(!t.hasOwnProperty(r))throw new bh.ConfigurationError(r);var n=t[r],o=Th.mandatory[r](n);if(void 0===o)throw new bh.ConfigurationError(r,n);e[r]=o}for(var i in Th.optional)if(t.hasOwnProperty(i)){var s=t[i];if(mh.isEmpty(s))continue;var a=Th.optional[i](s);if(void 0===a)throw new bh.ConfigurationError(i,s);e[i]=a}},le.EventEmitter),wh=n,Eh=F,Ah=Sc,Oh=p,xh=s,Ch=j,Rh=Be,Nh=cp,Ih=ye(),Ph=B,Uh=qr(),kh=_p,Lh=o,jh=x,L=new wh("UA"),Dh={STATUS_INIT:0,STATUS_READY:1,STATUS_USER_CLOSED:2,STATUS_NOT_READY:3,CONFIGURATION_ERROR:1,NETWORK_ERROR:2},h=(K(Mh,Cp),e(Mh,[{key:"C",get:function(){return Dh}},{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(){L.debug("start()",{}),this._status===Dh.STATUS_INIT?this._transport.connect():this._status===Dh.STATUS_USER_CLOSED?(L.debug("restarting UA"),null!==this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null,this._transport.disconnect()),this._status=Dh.STATUS_INIT,this._transport.connect()):this._status===Dh.STATUS_READY?L.debug("UA is in READY status, not restarted"):L.debug("ERROR: connection is down, Auto-Recovery system is trying to reconnect"),this._dynConfiguration.register=this._configuration.register}},{key:"register",value:function(){L.debug("register()"),this._dynConfiguration.register=!0,this._registrator.register()}},{key:"unregister",value:function(e){L.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){L.debug("call()");var r=new Oh(this);return r.connect(e,t),r}},{key:"sendMessage",value:function(e,t,r){L.debug("sendMessage()");var n=new xh(this);return n.send(e,t,r),n}},{key:"sendOptions",value:function(e,t,r){L.debug("sendOptions()");var n=new Ch(this);return n.send(e,t,r),n}},{key:"terminateSessions",value:function(e){for(var t in L.debug("terminateSessions()"),this._sessions)this._sessions[t].isEnded()||this._sessions[t].terminate(e)}},{key:"stop",value:function(){var e=this;if(L.debug("stop()"),this._dynConfiguration={},this._status!==Dh.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)){L.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=Dh.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 L.debug("UA already closed")}},{key:"normalizeTarget",value:function(e){return Ih.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 L.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":Ih.isDecimal(t)&&-1!==Object.values(Eh.LOG_LEVEL).indexOf(Number(t))&&wh.setLogLevel(t);break;case"log_report":wh.setLogReport(Boolean(t));break;case"log_proxy":wh.setLogProxy(t);break;case"trtc_proxy_server":case"trtc_turn_server":this._configuration[e]=t;break;default:return L.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)L.debug("Request-URI does not point to us"),e.method!==Eh.ACK&&e.reply_sl(404);else if(e.ruri.scheme!==Eh.SIPS){if(!Rh.checkTransaction(this,e)){if(o===Eh.INVITE?new Rh.InviteServerTransaction(this,this._transport,e):o!==Eh.ACK&&o!==Eh.CANCEL&&new Rh.NonInviteServerTransaction(this,this._transport,e),o===Eh.OPTIONS){if(0===this.listeners("newOptions").length)return void e.reply(200);new Ch(this).init_incoming(e)}else if(o===Eh.MESSAGE){if(0===this.listeners("newMessage").length)return void e.reply(405);new xh(this).init_incoming(e)}else if(o===Eh.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===Eh.NOTIFY?(r=this._findSession(e))?r.receiveRequest(e):(L.debug("received NOTIFY request for a non existent subscription"),e.reply(481,"Subscription does not exist")):o!==Eh.ACK&&e.reply(481);else switch(o){case Eh.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 Oh(this)).init_incoming(e):(L.warn("INVITE received but WebRTC is not supported"),e.reply(488));break;case Eh.BYE:e.reply(481);break;case Eh.CANCEL:(r=this._findSession(e))?r.receiveRequest(e):L.debug("received CANCEL request for a non existent session");break;case Eh.ACK:break;case Eh.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{jh.load(this._configuration,e),wh.setAttributes({uri:this._configuration.uri.toString()})}catch(r){throw L.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=Ih.newUUID()),this._configuration.jssip_id=Ih.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 Nh(this._configuration.sockets,{max_interval:this._configuration.connection_recovery_max_interval,min_interval:this._configuration.connection_recovery_min_interval}),this._transport.onconnecting=function(e){this.emit("connecting",e)}.bind(this),this._transport.onconnect=function(e){this._status!==Dh.STATUS_USER_CLOSED&&(this._status=Dh.STATUS_READY,this._error=null,this.emit("connected",e),this._dynConfiguration.register)&&this._registrator.register()}.bind(this),this._transport.ondisconnect=function(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!==Dh.STATUS_USER_CLOSED&&(this._status=Dh.STATUS_NOT_READY,this._error=Dh.NETWORK_ERROR)}.bind(this),this._transport.ondata=function(e){var t,r=e.transport,n=e.message;if((n=kh.parseMessage(n,this))&&!(this._status===Dh.STATUS_USER_CLOSED&&n instanceof Lh.IncomingRequest)&&((e,t,r)=>{R=e,ih=t,sh=r;for(var n=0,o=ph;n<o.length;n++)if(!1===(0,o[n])())return!1;if(R instanceof uh.IncomingRequest){for(var i=0,s=dh;i<s.length;i++)if(!1===(0,s[i])())return!1}else if(R instanceof uh.IncomingResponse)for(var a=0,u=hh;a<u.length;a++)if(!1===(0,u[a])())return!1;return!0})(n,this,r))if(n instanceof Lh.IncomingRequest)n.transport=r,this.receiveRequest(n);else if(n instanceof Lh.IncomingResponse)switch(n.method){case Eh.INVITE:(t=this._transactions.ict[n.via_branch])&&t.receiveResponse(n);break;case Eh.ACK:break;default:(t=this._transactions.nict[n.via_branch])&&t.receiveResponse(n)}}.bind(this)}catch(e){throw L.warn(e),new Ph.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 Uh("sip",Ih.createRandomToken(8),this._configuration.via_host,null,{transport:"ws"});var n,o,i=this._configuration.use_trtc,s=(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"),i&&(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!==s.indexOf(n)?Object.defineProperty(this._configuration,n,{writable:!0,configurable:!1}):Object.defineProperty(this._configuration,n,{writable:!1,configurable:!1}));for(o in L.debug("configuration parameters after validation:"),this._configuration)if(Object.prototype.hasOwnProperty.call(jh.settings,o))switch(o){case"uri":case"registrar_server":L.debug("- ".concat(o,": ").concat(this._configuration[o]));break;case"password":case"ha1":case"authorization_jwt":L.debug("- ".concat(o,": NOT SHOWN"));break;default:L.debug("- ".concat(o,": ").concat(JSON.stringify(this._configuration[o])))}}}],[{key:"C",get:function(){return Dh}}]));function Mh(e){var t;if(c(this,Mh),L.debug("new() [configuration:%o]",e),(t=H(this,Mh))._cache={credentials:{}},t._configuration=Object.assign({},jh.settings),t._dynConfiguration={},t._dialogs={},t._applicants={},t._sessions={},t._transport=null,t._contact=null,t._status=Dh.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=Dh.STATUS_NOT_READY,t._error=Dh.CONFIGURATION_ERROR,e}return t._registrator=new Ah(t),t}var r=n,Vh=ge(),Bh=new r("WebSocketInterface"),i=e(function e(t){c(this,e),Bh.debug('new() [url:"%s"]',t),this._url=t,this._sip_uri=null,this._via_transport=null,this._ws=null;var r=Vh.parse(t,"absoluteURI");if(-1===r)throw Bh.warn("invalid WebSocket URI: ".concat(t)),new TypeError("Invalid argument: ".concat(t));if("wss"!==r.scheme&&"ws"!==r.scheme)throw Bh.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(Bh.debug("connect()"),this.isConnected())Bh.debug("WebSocket ".concat(this._url," is already connected"));else if(this.isConnecting())Bh.debug("WebSocket ".concat(this._url," is connecting"));else{this._ws&&this.disconnect(),Bh.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(){Bh.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 Bh.debug("send()"),this.isConnected()?(this._ws.send(e),!0):(Bh.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(){Bh.debug("WebSocket ".concat(this._url," connected")),this.onconnect()}},{key:"_onClose",value:function(e){var t=e.wasClean,r=e.code,e=e.reason;Bh.debug("WebSocket ".concat(this._url," closed")),!1===t&&Bh.debug("WebSocket abrupt disconnection"),this.ondisconnect(!t,r,e)}},{key:"_onMessage",value:function(e){e=e.data;Bh.debug("received WebSocket message"),this.ondata(e)}},{key:"_onError",value:function(e){Bh.warn("WebSocket ".concat(this._url," error: "),e)}}]),Fe=n,bc=(ge(),new Fe("WxWebsocketInterface"),{}),pp=d.exports,Fh=(bc.getMicrophones=pp.getMicrophones,bc.getSpeakers=pp.getSpeakers,bc.getDevices=pp.getDevices,V),gp=F,vp=B,C=ye(),Qc=h,le=qr(),Sc=Fr(),p=ge(),s=i,j=bc,Be=n;return ce.exports(Fh.title)("version %s",Fh.version),{C:gp,Exceptions:vp,Utils:C,UA:Qc,URI:le,NameAddrHeader:Sc,WebSocketInterface:s,Grammar:p,Devices:j,Logger:Be,debug:ce.exports,get name(){return Fh.title},get version(){return Fh.version}}});