o11y 236.0.1 → 236.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* licensed under the bsd-3-clause license
|
|
5
5
|
* see: https://github.com/dcodeio/protobuf.js for details
|
|
6
6
|
*/
|
|
7
|
-
var __protobufjs;!function(g){var r,e,t;r={1:[function(o,s){s.exports=function(o,s){for(var a=Array(arguments.length-1),l=0,u=2,p=!0;u<arguments.length;)a[l++]=arguments[u++];return new Promise((function(u,c){a[l]=function(o){if(p)if(p=!1,o)c(o);else{for(var s=Array(arguments.length-1),a=0;a<s.length;)s[a++]=arguments[a];u.apply(null,s)}};try{o.apply(s||null,a)}catch(o){p&&(p=!1,c(o))}}))}},{}],2:[function(o,s,a){var l=a;l.length=function(o){var s=o.length;if(!s)return 0;for(var a=0;1<--s%4&&"="==o[0|s];)++a;return Math.ceil(3*o.length)/4-a};for(var u=Array(64),p=Array(123),c=0;c<64;)p[u[c]=c<26?c+65:c<52?c+71:c<62?c-4:c-59|43]=c++;l.encode=function(o,s,a){for(var l,p=null,c=[],h=0,d=0;s<a;){var f=o[s++];switch(d){case 0:c[h++]=u[f>>2],l=(3&f)<<4,d=1;break;case 1:c[h++]=u[l|f>>4],l=(15&f)<<2,d=2;break;case 2:c[h++]=u[l|f>>6],c[h++]=u[63&f],d=0}8191<h&&((p=p||[]).push(String.fromCharCode.apply(String,c)),h=0)}return d&&(c[h++]=u[l],c[h++]=61,1===d&&(c[h++]=61)),p?(h&&p.push(String.fromCharCode.apply(String,c.slice(0,h))),p.join("")):String.fromCharCode.apply(String,c.slice(0,h))};var h="invalid encoding";l.decode=function(o,s,a){for(var l,u=a,c=0,d=0;d<o.length;){var f=o.charCodeAt(d++);if(61===f&&1<c)break;if((f=p[f])===g)throw Error(h);switch(c){case 0:l=f,c=1;break;case 1:s[a++]=l<<2|(48&f)>>4,l=f,c=2;break;case 2:s[a++]=(15&l)<<4|(60&f)>>2,l=f,c=3;break;case 3:s[a++]=(3&l)<<6|f,c=0}}if(1===c)throw Error(h);return a-u},l.test=function(o){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o)}},{}],3:[function(o,s){(s.exports=function o(s,a){"string"==typeof s&&(a=s,s=g);var l=[];function u(s){if("string"!=typeof s){var a=p();if(o.verbose&&console.log("codegen: "+a),a="return "+a,s){for(var c=Object.keys(s),h=Array(c.length+1),d=Array(c.length),f=0;f<c.length;)h[f]=c[f],d[f]=s[c[f++]];return h[f]=a,Function.apply(null,h).apply(null,d)}return Function(a)()}for(var m=Array(arguments.length-1),y=0;y<m.length;)m[y]=arguments[++y];if(y=0,s=s.replace(/%([%dfijs])/g,(function(o,s){var a=m[y++];switch(s){case"d":case"f":return+a+"";case"i":return Math.floor(a)+"";case"j":return JSON.stringify(a);case"s":return a+""}return"%"})),y!==m.length)throw Error("parameter count mismatch");return l.push(s),u}function p(o){return"function "+(o||a||"")+"("+(s&&s.join(",")||"")+"){\n "+l.join("\n ")+"\n}"}return u.toString=p,u}).verbose=!1},{}],4:[function(o,s){function a(){this.t={}}(s.exports=a).prototype.on=function(o,s,a){return(this.t[o]||(this.t[o]=[])).push({fn:s,ctx:a||this}),this},a.prototype.off=function(o,s){if(o===g)this.t={};else if(s===g)this.t[o]=[];else for(var a=this.t[o],l=0;l<a.length;)a[l].fn===s?a.splice(l,1):++l;return this},a.prototype.emit=function(o){var s=this.t[o];if(s){for(var a=[],l=1;l<arguments.length;)a.push(arguments[l++]);for(l=0;l<s.length;)s[l].fn.apply(s[l++].ctx,a)}return this}},{}],5:[function(o,s){s.exports=u;var a=o(1),l=o(7)("fs");function u(o,s,p){return s="function"==typeof s?(p=s,{}):s||{},p?!s.xhr&&l&&l.readFile?l.readFile(o,(function(a,l){return a&&"undefined"!=typeof XMLHttpRequest?u.xhr(o,s,p):a?p(a):p(null,s.binary?l:l.toString("utf8"))})):u.xhr(o,s,p):a(u,this,o,s)}u.xhr=function(o,s,a){var l=new XMLHttpRequest;l.onreadystatechange=function(){if(4!==l.readyState)return g;if(0!==l.status&&200!==l.status)return a(Error("status "+l.status));if(s.binary){var o=l.response;if(!o){o=[];for(var u=0;u<l.responseText.length;++u)o.push(255&l.responseText.charCodeAt(u))}return a(null,"undefined"!=typeof Uint8Array?new Uint8Array(o):o)}return a(null,l.responseText)},s.binary&&("overrideMimeType"in l&&l.overrideMimeType("text/plain; charset=x-user-defined"),l.responseType="arraybuffer"),l.open("GET",o),l.send()}},{1:1,7:7}],6:[function(o,s){function a(o){function s(o,s,a,l){var u=s<0?1:0;if(u&&(s=-s),0===s)o(0<1/s?0:2147483648,a,l);else if(isNaN(s))o(2143289344,a,l);else if(34028234663852886e22<s)o((u<<31|2139095040)>>>0,a,l);else if(s<11754943508222875e-54)o((u<<31|Math.round(s/1401298464324817e-60))>>>0,a,l);else{var p=Math.floor(Math.log(s)/Math.LN2);o((u<<31|127+p<<23|8388607&Math.round(s*Math.pow(2,-p)*8388608))>>>0,a,l)}}function a(o,s,a){var l=o(s,a),u=2*(l>>31)+1,p=l>>>23&255,c=8388607&l;return 255==p?c?NaN:1/0*u:0==p?1401298464324817e-60*u*c:u*Math.pow(2,p-150)*(8388608+c)}function h(o,s,a){y[0]=o,s[a]=v[0],s[a+1]=v[1],s[a+2]=v[2],s[a+3]=v[3]}function d(o,s,a){y[0]=o,s[a]=v[3],s[a+1]=v[2],s[a+2]=v[1],s[a+3]=v[0]}function f(o,s){return v[0]=o[s],v[1]=o[s+1],v[2]=o[s+2],v[3]=o[s+3],y[0]}function m(o,s){return v[3]=o[s],v[2]=o[s+1],v[1]=o[s+2],v[0]=o[s+3],y[0]}var y,v,b,_,w,A;function T(o,s,a,l,u,p){var c=l<0?1:0;if(c&&(l=-l),0===l)o(0,u,p+s),o(0<1/l?0:2147483648,u,p+a);else if(isNaN(l))o(0,u,p+s),o(2146959360,u,p+a);else if(17976931348623157e292<l)o(0,u,p+s),o((c<<31|2146435072)>>>0,u,p+a);else{var h;if(l<22250738585072014e-324)o((h=l/5e-324)>>>0,u,p+s),o((c<<31|h/4294967296)>>>0,u,p+a);else{var d=Math.floor(Math.log(l)/Math.LN2);1024===d&&(d=1023),o(4503599627370496*(h=l*Math.pow(2,-d))>>>0,u,p+s),o((c<<31|d+1023<<20|1048576*h&1048575)>>>0,u,p+a)}}}function O(o,s,a,l,u){var p=o(l,u+s),c=o(l,u+a),h=2*(c>>31)+1,d=c>>>20&2047,f=4294967296*(1048575&c)+p;return 2047==d?f?NaN:1/0*h:0==d?5e-324*h*f:h*Math.pow(2,d-1075)*(f+4503599627370496)}function k(o,s,a){_[0]=o,s[a]=w[0],s[a+1]=w[1],s[a+2]=w[2],s[a+3]=w[3],s[a+4]=w[4],s[a+5]=w[5],s[a+6]=w[6],s[a+7]=w[7]}function S(o,s,a){_[0]=o,s[a]=w[7],s[a+1]=w[6],s[a+2]=w[5],s[a+3]=w[4],s[a+4]=w[3],s[a+5]=w[2],s[a+6]=w[1],s[a+7]=w[0]}function E(o,s){return w[0]=o[s],w[1]=o[s+1],w[2]=o[s+2],w[3]=o[s+3],w[4]=o[s+4],w[5]=o[s+5],w[6]=o[s+6],w[7]=o[s+7],_[0]}function x(o,s){return w[7]=o[s],w[6]=o[s+1],w[5]=o[s+2],w[4]=o[s+3],w[3]=o[s+4],w[2]=o[s+5],w[1]=o[s+6],w[0]=o[s+7],_[0]}return"undefined"!=typeof Float32Array?(y=new Float32Array([-0]),b=128===(v=new Uint8Array(y.buffer))[3],o.writeFloatLE=b?h:d,o.writeFloatBE=b?d:h,o.readFloatLE=b?f:m,o.readFloatBE=b?m:f):(o.writeFloatLE=s.bind(null,l),o.writeFloatBE=s.bind(null,u),o.readFloatLE=a.bind(null,p),o.readFloatBE=a.bind(null,c)),"undefined"!=typeof Float64Array?(_=new Float64Array([-0]),A=128===(w=new Uint8Array(_.buffer))[7],o.writeDoubleLE=A?k:S,o.writeDoubleBE=A?S:k,o.readDoubleLE=A?E:x,o.readDoubleBE=A?x:E):(o.writeDoubleLE=T.bind(null,l,0,4),o.writeDoubleBE=T.bind(null,u,4,0),o.readDoubleLE=O.bind(null,p,0,4),o.readDoubleBE=O.bind(null,c,4,0)),o}function l(o,s,a){s[a]=255&o,s[a+1]=o>>>8&255,s[a+2]=o>>>16&255,s[a+3]=o>>>24}function u(o,s,a){s[a]=o>>>24,s[a+1]=o>>>16&255,s[a+2]=o>>>8&255,s[a+3]=255&o}function p(o,s){return(o[s]|o[s+1]<<8|o[s+2]<<16|o[s+3]<<24)>>>0}function c(o,s){return(o[s]<<24|o[s+1]<<16|o[s+2]<<8|o[s+3])>>>0}s.exports=a(a)},{}],7:[function(t,i,n){function r(t){try{var i=eval("require")(t);if(i&&(i.length||Object.keys(i).length))return i}catch(t){}return null}i.exports=r},{}],8:[function(o,s,a){var l=a,u=l.isAbsolute=function(o){return/^(?:\/|\w+:)/.test(o)},p=l.normalize=function(o){var s=(o=o.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),a=u(o),l="";a&&(l=s.shift()+"/");for(var p=0;p<s.length;)".."===s[p]?0<p&&".."!==s[p-1]?s.splice(--p,2):a?s.splice(p,1):++p:"."===s[p]?s.splice(p,1):++p;return l+s.join("/")};l.resolve=function(o,s,a){return a||(s=p(s)),u(s)?s:(a||(o=p(o)),(o=o.replace(/(?:\/|^)[^/]+$/,"")).length?p(o+"/"+s):s)}},{}],9:[function(o,s){s.exports=function(o,s,a){var l=a||8192,u=l>>>1,p=null,c=l;return function(a){if(a<1||u<a)return o(a);l<c+a&&(p=o(l),c=0);var h=s.call(p,c,c+=a);return 7&c&&(c=1+(7|c)),h}}},{}],10:[function(o,s,a){var l=a;l.length=function(o){for(var s=0,a=0,l=0;l<o.length;++l)(a=o.charCodeAt(l))<128?s+=1:a<2048?s+=2:55296==(64512&a)&&56320==(64512&o.charCodeAt(l+1))?(++l,s+=4):s+=3;return s},l.read=function(o,s,a){if(a-s<1)return"";for(var l,u=null,p=[],c=0;s<a;)(l=o[s++])<128?p[c++]=l:191<l&&l<224?p[c++]=(31&l)<<6|63&o[s++]:239<l&&l<365?(l=((7&l)<<18|(63&o[s++])<<12|(63&o[s++])<<6|63&o[s++])-65536,p[c++]=55296+(l>>10),p[c++]=56320+(1023&l)):p[c++]=(15&l)<<12|(63&o[s++])<<6|63&o[s++],8191<c&&((u=u||[]).push(String.fromCharCode.apply(String,p)),c=0);return u?(c&&u.push(String.fromCharCode.apply(String,p.slice(0,c))),u.join("")):String.fromCharCode.apply(String,p.slice(0,c))},l.write=function(o,s,a){for(var l,u,p=a,c=0;c<o.length;++c)(l=o.charCodeAt(c))<128?s[a++]=l:(l<2048?s[a++]=l>>6|192:(55296==(64512&l)&&56320==(64512&(u=o.charCodeAt(c+1)))?(l=65536+((1023&l)<<10)+(1023&u),++c,s[a++]=l>>18|240,s[a++]=l>>12&63|128):s[a++]=l>>12|224,s[a++]=l>>6&63|128),s[a++]=63&l|128);return a-p}},{}],11:[function(o,s,a){var l=a,u=o(14),p=o(33);function c(o,s,a,l){if(s.resolvedType)if(s.resolvedType instanceof u){o("switch(d%s){",l);for(var p=s.resolvedType.values,c=Object.keys(p),h=0;h<c.length;++h)s.repeated&&p[c[h]]===s.typeDefault&&o("default:"),o("case%j:",c[h])("case %i:",p[c[h]])("m%s=%j",l,p[c[h]])("break");o("}")}else o('if(typeof d%s!=="object")',l)("throw TypeError(%j)",s.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",l,a,l);else{var d=!1;switch(s.type){case"double":case"float":o("m%s=Number(d%s)",l,l);break;case"uint32":case"fixed32":o("m%s=d%s>>>0",l,l);break;case"int32":case"sint32":case"sfixed32":o("m%s=d%s|0",l,l);break;case"uint64":d=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",l,l,d)('else if(typeof d%s==="string")',l)("m%s=parseInt(d%s,10)",l,l)('else if(typeof d%s==="number")',l)("m%s=d%s",l,l)('else if(typeof d%s==="object")',l)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",l,l,l,d?"true":"");break;case"bytes":o('if(typeof d%s==="string")',l)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",l,l,l)("else if(d%s.length)",l)("m%s=d%s",l,l);break;case"string":o("m%s=String(d%s)",l,l);break;case"bool":o("m%s=Boolean(d%s)",l,l)}}return o}function h(o,s,a,l){if(s.resolvedType)s.resolvedType instanceof u?o("d%s=o.enums===String?types[%i].values[m%s]:m%s",l,a,l,l):o("d%s=types[%i].toObject(m%s,o)",l,a,l);else{var p=!1;switch(s.type){case"double":case"float":o("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",l,l,l,l);break;case"uint64":p=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o('if(typeof m%s==="number")',l)("d%s=o.longs===String?String(m%s):m%s",l,l,l)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",l,l,l,l,p?"true":"",l);break;case"bytes":o("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",l,l,l,l,l);break;default:o("d%s=m%s",l,l)}}return o}l.fromObject=function(o){var s=o.fieldsArray,a=p.codegen(["d"],o.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!s.length)return a("return new this.ctor");a("var m=new this.ctor");for(var l=0;l<s.length;++l){var h=s[l].resolve(),d=p.safeProp(h.name);h.map?(a("if(d%s){",d)('if(typeof d%s!=="object")',d)("throw TypeError(%j)",h.fullName+": object expected")("m%s={}",d)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",d),c(a,h,l,d+"[ks[i]]")("}")("}")):h.repeated?(a("if(d%s){",d)("if(!Array.isArray(d%s))",d)("throw TypeError(%j)",h.fullName+": array expected")("m%s=[]",d)("for(var i=0;i<d%s.length;++i){",d),c(a,h,l,d+"[i]")("}")("}")):(h.resolvedType instanceof u||a("if(d%s!=null){",d),c(a,h,l,d),h.resolvedType instanceof u||a("}"))}return a("return m")},l.toObject=function(o){var s=o.fieldsArray.slice().sort(p.compareFieldsById);if(!s.length)return p.codegen()("return {}");for(var a=p.codegen(["m","o"],o.name+"$toObject")("if(!o)")("o={}")("var d={}"),l=[],c=[],d=[],f=0;f<s.length;++f)s[f].partOf||(s[f].resolve().repeated?l:s[f].map?c:d).push(s[f]);if(l.length){for(a("if(o.arrays||o.defaults){"),f=0;f<l.length;++f)a("d%s=[]",p.safeProp(l[f].name));a("}")}if(c.length){for(a("if(o.objects||o.defaults){"),f=0;f<c.length;++f)a("d%s={}",p.safeProp(c[f].name));a("}")}if(d.length){for(a("if(o.defaults){"),f=0;f<d.length;++f){var m=d[f],y=p.safeProp(m.name);if(m.resolvedType instanceof u)a("d%s=o.enums===String?%j:%j",y,m.resolvedType.valuesById[m.typeDefault],m.typeDefault);else if(m.long)a("if(util.Long){")("var n=new util.Long(%i,%i,%j)",m.typeDefault.low,m.typeDefault.high,m.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",y)("}else")("d%s=o.longs===String?%j:%i",y,m.typeDefault.toString(),m.typeDefault.toNumber());else if(m.bytes){var v="["+Array.prototype.slice.call(m.typeDefault).join(",")+"]";a("if(o.bytes===String)d%s=%j",y,String.fromCharCode.apply(String,m.typeDefault))("else{")("d%s=%s",y,v)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",y,y)("}")}else a("d%s=%j",y,m.typeDefault)}a("}")}var b=!1;for(f=0;f<s.length;++f){m=s[f];var _=o.i.indexOf(m);y=p.safeProp(m.name),m.map?(b||(b=!0,a("var ks2")),a("if(m%s&&(ks2=Object.keys(m%s)).length){",y,y)("d%s={}",y)("for(var j=0;j<ks2.length;++j){"),h(a,m,_,y+"[ks2[j]]")("}")):m.repeated?(a("if(m%s&&m%s.length){",y,y)("d%s=[]",y)("for(var j=0;j<m%s.length;++j){",y),h(a,m,_,y+"[j]")("}")):(a("if(m%s!=null&&m.hasOwnProperty(%j)){",y,m.name),h(a,m,_,y),m.partOf&&a("if(o.oneofs)")("d%s=%j",p.safeProp(m.partOf.name),m.name)),a("}")}return a("return d")}},{14:14,33:33}],12:[function(o,s){s.exports=function(o){var s=u.codegen(["r","l"],o.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(o.fieldsArray.filter((function(o){return o.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");o.group&&s("if((t&7)===4)")("break"),s("switch(t>>>3){");for(var p=0;p<o.fieldsArray.length;++p){var c=o.i[p].resolve(),h=c.resolvedType instanceof a?"int32":c.type,d="m"+u.safeProp(c.name);s("case %i:",c.id),c.map?(s("if(%s===util.emptyObject)",d)("%s={}",d)("var c2 = r.uint32()+r.pos"),l.defaults[c.keyType]!==g?s("k=%j",l.defaults[c.keyType]):s("k=null"),l.defaults[h]!==g?s("value=%j",l.defaults[h]):s("value=null"),s("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",c.keyType)("case 2:"),l.basic[h]===g?s("value=types[%i].decode(r,r.uint32())",p):s("value=r.%s()",h),s("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),l.long[c.keyType]!==g?s('%s[typeof k==="object"?util.longToHash(k):k]=value',d):s("%s[k]=value",d)):c.repeated?(s("if(!(%s&&%s.length))",d,d)("%s=[]",d),l.packed[h]!==g&&s("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",d,h)("}else"),l.basic[h]===g?s(c.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",d,p):s("%s.push(r.%s())",d,h)):l.basic[h]===g?s(c.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",d,p):s("%s=r.%s()",d,h),s("break")}for(s("default:")("r.skipType(t&7)")("break")("}")("}"),p=0;p<o.i.length;++p){var f=o.i[p];f.required&&s("if(!m.hasOwnProperty(%j))",f.name)("throw util.ProtocolError(%j,{instance:m})","missing required '"+f.name+"'")}return s("return m")};var a=o(14),l=o(32),u=o(33)},{14:14,32:32,33:33}],13:[function(o,s){s.exports=function(o){for(var s,c=u.codegen(["m","w"],o.name+"$encode")("if(!w)")("w=Writer.create()"),h=o.fieldsArray.slice().sort(u.compareFieldsById),d=0;d<h.length;++d){var f=h[d].resolve(),m=o.i.indexOf(f),y=f.resolvedType instanceof a?"int32":f.type,v=l.basic[y];s="m"+u.safeProp(f.name),f.map?(c("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",s,f.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",s)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(f.id<<3|2)>>>0,8|l.mapKey[f.keyType],f.keyType),v===g?c("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",m,s):c(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|v,y,s),c("}")("}")):f.repeated?(c("if(%s!=null&&%s.length){",s,s),f.packed&&l.packed[y]!==g?c("w.uint32(%i).fork()",(f.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",s)("w.%s(%s[i])",y,s)("w.ldelim()"):(c("for(var i=0;i<%s.length;++i)",s),v===g?p(c,f,m,s+"[i]"):c("w.uint32(%i).%s(%s[i])",(f.id<<3|v)>>>0,y,s)),c("}")):(f.optional&&c("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",s,f.name),v===g?p(c,f,m,s):c("w.uint32(%i).%s(%s)",(f.id<<3|v)>>>0,y,s))}return c("return w")};var a=o(14),l=o(32),u=o(33);function p(o,s,a,l){return s.resolvedType.group?o("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",a,l,(s.id<<3|3)>>>0,(s.id<<3|4)>>>0):o("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",a,l,(s.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(o,s){s.exports=p;var a=o(22);((p.prototype=Object.create(a.prototype)).constructor=p).className="Enum";var l=o(21),u=o(33);function p(o,s,l,u,p){if(a.call(this,o,l),s&&"object"!=typeof s)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=u,this.comments=p||{},this.reserved=g,s)for(var c=Object.keys(s),h=0;h<c.length;++h)"number"==typeof s[c[h]]&&(this.valuesById[this.values[c[h]]=s[c[h]]]=c[h])}p.fromJSON=function(o,s){var a=new p(o,s.values,s.options,s.comment,s.comments);return a.reserved=s.reserved,a},p.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return u.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:g,"comment",s?this.comment:g,"comments",s?this.comments:g])},p.prototype.add=function(o,s,a){if(!u.isString(o))throw TypeError("name must be a string");if(!u.isInteger(s))throw TypeError("id must be an integer");if(this.values[o]!==g)throw Error("duplicate name '"+o+"' in "+this);if(this.isReservedId(s))throw Error("id "+s+" is reserved in "+this);if(this.isReservedName(o))throw Error("name '"+o+"' is reserved in "+this);if(this.valuesById[s]!==g){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+s+" in "+this);this.values[o]=s}else this.valuesById[this.values[o]=s]=o;return this.comments[o]=a||null,this},p.prototype.remove=function(o){if(!u.isString(o))throw TypeError("name must be a string");var s=this.values[o];if(null==s)throw Error("name '"+o+"' does not exist in "+this);return delete this.valuesById[s],delete this.values[o],delete this.comments[o],this},p.prototype.isReservedId=function(o){return l.isReservedId(this.reserved,o)},p.prototype.isReservedName=function(o){return l.isReservedName(this.reserved,o)}},{21:21,22:22,33:33}],15:[function(o,s){s.exports=d;var a=o(22);((d.prototype=Object.create(a.prototype)).constructor=d).className="Field";var l,u=o(14),p=o(32),c=o(33),h=/^required|optional|repeated$/;function d(o,s,l,u,d,f,m){if(c.isObject(u)?(m=d,f=u,u=d=g):c.isObject(d)&&(m=f,f=d,d=g),a.call(this,o,f),!c.isInteger(s)||s<0)throw TypeError("id must be a non-negative integer");if(!c.isString(l))throw TypeError("type must be a string");if(u!==g&&!h.test(u=u.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(d!==g&&!c.isString(d))throw TypeError("extend must be a string");this.rule=u&&"optional"!==u?u:g,this.type=l,this.id=s,this.extend=d||g,this.required="required"===u,this.optional=!this.required,this.repeated="repeated"===u,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!c.Long&&p.long[l]!==g,this.bytes="bytes"===l,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.n=null,this.comment=m}d.fromJSON=function(o,s){return new d(o,s.id,s.type,s.rule,s.extend,s.options,s.comment)},Object.defineProperty(d.prototype,"packed",{get:function(){return null===this.n&&(this.n=!1!==this.getOption("packed")),this.n}}),d.prototype.setOption=function(o,s,l){return"packed"===o&&(this.n=null),a.prototype.setOption.call(this,o,s,l)},d.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return c.toObject(["rule","optional"!==this.rule&&this.rule||g,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:g])},d.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=p.defaults[this.type])===g&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof l?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof u&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(this.options.packed===g||!this.resolvedType||this.resolvedType instanceof u)||delete this.options.packed,Object.keys(this.options).length||(this.options=g)),this.long)this.typeDefault=c.Long.fromNumber(this.typeDefault,"u"==this.type[0]),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var o;c.base64.test(this.typeDefault)?c.base64.decode(this.typeDefault,o=c.newBuffer(c.base64.length(this.typeDefault)),0):c.utf8.write(this.typeDefault,o=c.newBuffer(c.utf8.length(this.typeDefault)),0),this.typeDefault=o}return this.map?this.defaultValue=c.emptyObject:this.repeated?this.defaultValue=c.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof l&&(this.parent.ctor.prototype[this.name]=this.defaultValue),a.prototype.resolve.call(this)},d.d=function(o,s,a,l){return"function"==typeof s?s=c.decorateType(s).name:s&&"object"==typeof s&&(s=c.decorateEnum(s).name),function(u,p){c.decorateType(u.constructor).add(new d(p,o,s,a,{default:l}))}},d.r=function(o){l=o}},{14:14,22:22,32:32,33:33}],16:[function(o,s){var a=s.exports=o(17);a.build="light",a.load=function(o,s,l){return(s="function"==typeof s?(l=s,new a.Root):s||new a.Root).load(o,l)},a.loadSync=function(o,s){return(s=s||new a.Root).loadSync(o)},a.encoder=o(13),a.decoder=o(12),a.verifier=o(36),a.converter=o(11),a.ReflectionObject=o(22),a.Namespace=o(21),a.Root=o(26),a.Enum=o(14),a.Type=o(31),a.Field=o(15),a.OneOf=o(23),a.MapField=o(18),a.Service=o(30),a.Method=o(20),a.Message=o(19),a.wrappers=o(37),a.types=o(32),a.util=o(33),a.ReflectionObject.r(a.Root),a.Namespace.r(a.Type,a.Service,a.Enum),a.Root.r(a.Type),a.Field.r(a.Type)},{11:11,12:12,13:13,14:14,15:15,17:17,18:18,19:19,20:20,21:21,22:22,23:23,26:26,30:30,31:31,32:32,33:33,36:36,37:37}],17:[function(o,s,a){var l=a;l.build="minimal",l.Writer=o(38),l.BufferWriter=o(39),l.Reader=o(24),l.BufferReader=o(25),l.util=o(35),l.rpc=o(28),l.roots=o(27),(l.configure=function(){l.util.r(),l.Writer.r(l.BufferWriter),l.Reader.r(l.BufferReader)})()},{24:24,25:25,27:27,28:28,35:35,38:38,39:39}],18:[function(o,s){s.exports=p;var a=o(15);((p.prototype=Object.create(a.prototype)).constructor=p).className="MapField";var l=o(32),u=o(33);function p(o,s,l,p,c,h){if(a.call(this,o,s,p,g,g,c,h),!u.isString(l))throw TypeError("keyType must be a string");this.keyType=l,this.resolvedKeyType=null,this.map=!0}p.fromJSON=function(o,s){return new p(o,s.id,s.keyType,s.type,s.options,s.comment)},p.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return u.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:g])},p.prototype.resolve=function(){if(this.resolved)return this;if(l.mapKey[this.keyType]===g)throw Error("invalid key type: "+this.keyType);return a.prototype.resolve.call(this)},p.d=function(o,s,a){return"function"==typeof a?a=u.decorateType(a).name:a&&"object"==typeof a&&(a=u.decorateEnum(a).name),function(l,c){u.decorateType(l.constructor).add(new p(c,o,s,a))}}},{15:15,32:32,33:33}],19:[function(o,s){s.exports=l;var a=o(35);function l(o){if(o)for(var s=Object.keys(o),a=0;a<s.length;++a)this[s[a]]=o[s[a]]}l.create=function(o){return this.$type.create(o)},l.encode=function(o,s){return this.$type.encode(o,s)},l.encodeDelimited=function(o,s){return this.$type.encodeDelimited(o,s)},l.decode=function(o){return this.$type.decode(o)},l.decodeDelimited=function(o){return this.$type.decodeDelimited(o)},l.verify=function(o){return this.$type.verify(o)},l.fromObject=function(o){return this.$type.fromObject(o)},l.toObject=function(o,s){return this.$type.toObject(o,s)},l.prototype.toJSON=function(){return this.$type.toObject(this,a.toJSONOptions)}},{35:35}],20:[function(o,s){s.exports=u;var a=o(22);((u.prototype=Object.create(a.prototype)).constructor=u).className="Method";var l=o(33);function u(o,s,u,p,c,h,d,f,m){if(l.isObject(c)?(d=c,c=h=g):l.isObject(h)&&(d=h,h=g),s!==g&&!l.isString(s))throw TypeError("type must be a string");if(!l.isString(u))throw TypeError("requestType must be a string");if(!l.isString(p))throw TypeError("responseType must be a string");a.call(this,o,d),this.type=s||"rpc",this.requestType=u,this.requestStream=!!c||g,this.responseType=p,this.responseStream=!!h||g,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=f,this.parsedOptions=m}u.fromJSON=function(o,s){return new u(o,s.type,s.requestType,s.responseType,s.requestStream,s.responseStream,s.options,s.comment,s.parsedOptions)},u.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return l.toObject(["type","rpc"!==this.type&&this.type||g,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",s?this.comment:g,"parsedOptions",this.parsedOptions])},u.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),a.prototype.resolve.call(this))}},{22:22,33:33}],21:[function(o,s){s.exports=f;var a=o(22);((f.prototype=Object.create(a.prototype)).constructor=f).className="Namespace";var l,u,p,c=o(15),h=o(33);function d(o,s){if(!o||!o.length)return g;for(var a={},l=0;l<o.length;++l)a[o[l].name]=o[l].toJSON(s);return a}function f(o,s){a.call(this,o,s),this.nested=g,this.e=null}function m(o){return o.e=null,o}f.fromJSON=function(o,s){return new f(o,s.options).addJSON(s.nested)},f.arrayToJSON=d,f.isReservedId=function(o,s){if(o)for(var a=0;a<o.length;++a)if("string"!=typeof o[a]&&o[a][0]<=s&&o[a][1]>s)return!0;return!1},f.isReservedName=function(o,s){if(o)for(var a=0;a<o.length;++a)if(o[a]===s)return!0;return!1},Object.defineProperty(f.prototype,"nestedArray",{get:function(){return this.e||(this.e=h.toArray(this.nested))}}),f.prototype.toJSON=function(o){return h.toObject(["options",this.options,"nested",d(this.nestedArray,o)])},f.prototype.addJSON=function(o){if(o)for(var s,a=Object.keys(o),h=0;h<a.length;++h)s=o[a[h]],this.add((s.fields!==g?l.fromJSON:s.values!==g?p.fromJSON:s.methods!==g?u.fromJSON:s.id!==g?c.fromJSON:f.fromJSON)(a[h],s));return this},f.prototype.get=function(o){return this.nested&&this.nested[o]||null},f.prototype.getEnum=function(o){if(this.nested&&this.nested[o]instanceof p)return this.nested[o].values;throw Error("no such enum: "+o)},f.prototype.add=function(o){if(!(o instanceof c&&o.extend!==g||o instanceof l||o instanceof p||o instanceof u||o instanceof f))throw TypeError("object must be a valid nested object");if(this.nested){var s=this.get(o.name);if(s){if(!(s instanceof f&&o instanceof f)||s instanceof l||s instanceof u)throw Error("duplicate name '"+o.name+"' in "+this);for(var a=s.nestedArray,h=0;h<a.length;++h)o.add(a[h]);this.remove(s),this.nested||(this.nested={}),o.setOptions(s.options,!0)}}else this.nested={};return(this.nested[o.name]=o).onAdd(this),m(this)},f.prototype.remove=function(o){if(!(o instanceof a))throw TypeError("object must be a ReflectionObject");if(o.parent!==this)throw Error(o+" is not a member of "+this);return delete this.nested[o.name],Object.keys(this.nested).length||(this.nested=g),o.onRemove(this),m(this)},f.prototype.define=function(o,s){if(h.isString(o))o=o.split(".");else if(!Array.isArray(o))throw TypeError("illegal path");if(o&&o.length&&""===o[0])throw Error("path must be relative");for(var a=this;0<o.length;){var l=o.shift();if(a.nested&&a.nested[l]){if(!((a=a.nested[l])instanceof f))throw Error("path conflicts with non-namespace objects")}else a.add(a=new f(l))}return s&&a.addJSON(s),a},f.prototype.resolveAll=function(){for(var o=this.nestedArray,s=0;s<o.length;)o[s]instanceof f?o[s++].resolveAll():o[s++].resolve();return this.resolve()},f.prototype.lookup=function(o,s,a){if("boolean"==typeof s?(a=s,s=g):s&&!Array.isArray(s)&&(s=[s]),h.isString(o)&&o.length){if("."===o)return this.root;o=o.split(".")}else if(!o.length)return this;if(""===o[0])return this.root.lookup(o.slice(1),s);var l=this.get(o[0]);if(l){if(1===o.length){if(!s||~s.indexOf(l.constructor))return l}else if(l instanceof f&&(l=l.lookup(o.slice(1),s,!0)))return l}else for(var u=0;u<this.nestedArray.length;++u)if(this.e[u]instanceof f&&(l=this.e[u].lookup(o,s,!0)))return l;return null===this.parent||a?null:this.parent.lookup(o,s)},f.prototype.lookupType=function(o){var s=this.lookup(o,[l]);if(!s)throw Error("no such type: "+o);return s},f.prototype.lookupEnum=function(o){var s=this.lookup(o,[p]);if(!s)throw Error("no such Enum '"+o+"' in "+this);return s},f.prototype.lookupTypeOrEnum=function(o){var s=this.lookup(o,[l,p]);if(!s)throw Error("no such Type or Enum '"+o+"' in "+this);return s},f.prototype.lookupService=function(o){var s=this.lookup(o,[u]);if(!s)throw Error("no such Service '"+o+"' in "+this);return s},f.r=function(o,s,a){l=o,u=s,p=a}},{15:15,22:22,33:33}],22:[function(o,s){(s.exports=u).className="ReflectionObject";var a,l=o(33);function u(o,s){if(!l.isString(o))throw TypeError("name must be a string");if(s&&!l.isObject(s))throw TypeError("options must be an object");this.options=s,this.parsedOptions=null,this.name=o,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(u.prototype,{root:{get:function(){for(var o=this;null!==o.parent;)o=o.parent;return o}},fullName:{get:function(){for(var o=[this.name],s=this.parent;s;)o.unshift(s.name),s=s.parent;return o.join(".")}}}),u.prototype.toJSON=function(){throw Error()},u.prototype.onAdd=function(o){this.parent&&this.parent!==o&&this.parent.remove(this),this.parent=o,this.resolved=!1;var s=o.root;s instanceof a&&s.u(this)},u.prototype.onRemove=function(o){var s=o.root;s instanceof a&&s.o(this),this.parent=null,this.resolved=!1},u.prototype.resolve=function(){return this.resolved||this.root instanceof a&&(this.resolved=!0),this},u.prototype.getOption=function(o){return this.options?this.options[o]:g},u.prototype.setOption=function(o,s,a){return a&&this.options&&this.options[o]!==g||((this.options||(this.options={}))[o]=s),this},u.prototype.setParsedOption=function(o,s,a){this.parsedOptions||(this.parsedOptions=[]);var u=this.parsedOptions;if(a){var p=u.find((function(s){return Object.prototype.hasOwnProperty.call(s,o)}));if(p){var c=p[o];l.setProperty(c,a,s)}else(p={})[o]=l.setProperty({},a,s),u.push(p)}else{var h={};h[o]=s,u.push(h)}return this},u.prototype.setOptions=function(o,s){if(o)for(var a=Object.keys(o),l=0;l<a.length;++l)this.setOption(a[l],o[a[l]],s);return this},u.prototype.toString=function(){var o=this.constructor.className,s=this.fullName;return s.length?o+" "+s:o},u.r=function(o){a=o}},{33:33}],23:[function(o,s){s.exports=p;var a=o(22);((p.prototype=Object.create(a.prototype)).constructor=p).className="OneOf";var l=o(15),u=o(33);function p(o,s,l,u){if(Array.isArray(s)||(l=s,s=g),a.call(this,o,l),s!==g&&!Array.isArray(s))throw TypeError("fieldNames must be an Array");this.oneof=s||[],this.fieldsArray=[],this.comment=u}function c(o){if(o.parent)for(var s=0;s<o.fieldsArray.length;++s)o.fieldsArray[s].parent||o.parent.add(o.fieldsArray[s])}p.fromJSON=function(o,s){return new p(o,s.oneof,s.options,s.comment)},p.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return u.toObject(["options",this.options,"oneof",this.oneof,"comment",s?this.comment:g])},p.prototype.add=function(o){if(!(o instanceof l))throw TypeError("field must be a Field");return o.parent&&o.parent!==this.parent&&o.parent.remove(o),this.oneof.push(o.name),this.fieldsArray.push(o),c(o.partOf=this),this},p.prototype.remove=function(o){if(!(o instanceof l))throw TypeError("field must be a Field");var s=this.fieldsArray.indexOf(o);if(s<0)throw Error(o+" is not a member of "+this);return this.fieldsArray.splice(s,1),-1<(s=this.oneof.indexOf(o.name))&&this.oneof.splice(s,1),o.partOf=null,this},p.prototype.onAdd=function(o){a.prototype.onAdd.call(this,o);for(var s=0;s<this.oneof.length;++s){var l=o.get(this.oneof[s]);l&&!l.partOf&&(l.partOf=this).fieldsArray.push(l)}c(this)},p.prototype.onRemove=function(o){for(var s,l=0;l<this.fieldsArray.length;++l)(s=this.fieldsArray[l]).parent&&s.parent.remove(s);a.prototype.onRemove.call(this,o)},p.d=function(){for(var o=Array(arguments.length),s=0;s<arguments.length;)o[s]=arguments[s++];return function(s,a){u.decorateType(s.constructor).add(new p(a,o)),Object.defineProperty(s,a,{get:u.oneOfGetter(o),set:u.oneOfSetter(o)})}}},{15:15,22:22,33:33}],24:[function(o,s){s.exports=h;var a,l=o(35),u=l.LongBits,p=l.utf8;function c(o,s){return RangeError("index out of range: "+o.pos+" + "+(s||1)+" > "+o.len)}function h(o){this.buf=o,this.pos=0,this.len=o.length}function d(){return l.Buffer?function(o){return(h.create=function(o){return l.Buffer.isBuffer(o)?new a(o):m(o)})(o)}:m}var f,m="undefined"!=typeof Uint8Array?function(o){if(o instanceof Uint8Array||Array.isArray(o))return new h(o);throw Error("illegal buffer")}:function(o){if(Array.isArray(o))return new h(o);throw Error("illegal buffer")};function y(){var o=new u(0,0),s=0;if(!(4<this.len-this.pos)){for(;s<3;++s){if(this.pos>=this.len)throw c(this);if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*s)>>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(127&this.buf[this.pos++])<<7*s)>>>0,o}for(;s<4;++s)if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*s)>>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(127&this.buf[this.pos])<<28)>>>0,o.hi=(o.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return o;if(s=0,4<this.len-this.pos){for(;s<5;++s)if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*s+3)>>>0,this.buf[this.pos++]<128)return o}else for(;s<5;++s){if(this.pos>=this.len)throw c(this);if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*s+3)>>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}function v(o,s){return(o[s-4]|o[s-3]<<8|o[s-2]<<16|o[s-1]<<24)>>>0}function b(){if(this.pos+8>this.len)throw c(this,8);return new u(v(this.buf,this.pos+=4),v(this.buf,this.pos+=4))}h.create=d(),h.prototype.f=l.Array.prototype.subarray||l.Array.prototype.slice,h.prototype.uint32=(f=4294967295,function(){if(f=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return f;if(f=(f|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return f;if(f=(f|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return f;if(f=(f|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return f;if(f=(f|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return f;if((this.pos+=5)>this.len)throw this.pos=this.len,c(this,10);return f}),h.prototype.int32=function(){return 0|this.uint32()},h.prototype.sint32=function(){var o=this.uint32();return o>>>1^-(1&o)|0},h.prototype.bool=function(){return 0!==this.uint32()},h.prototype.fixed32=function(){if(this.pos+4>this.len)throw c(this,4);return v(this.buf,this.pos+=4)},h.prototype.sfixed32=function(){if(this.pos+4>this.len)throw c(this,4);return 0|v(this.buf,this.pos+=4)},h.prototype.float=function(){if(this.pos+4>this.len)throw c(this,4);var o=l.float.readFloatLE(this.buf,this.pos);return this.pos+=4,o},h.prototype.double=function(){if(this.pos+8>this.len)throw c(this,4);var o=l.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,o},h.prototype.bytes=function(){var o=this.uint32(),s=this.pos,a=this.pos+o;if(a>this.len)throw c(this,o);return this.pos+=o,Array.isArray(this.buf)?this.buf.slice(s,a):s===a?new this.buf.constructor(0):this.f.call(this.buf,s,a)},h.prototype.string=function(){var o=this.bytes();return p.read(o,0,o.length)},h.prototype.skip=function(o){if("number"==typeof o){if(this.pos+o>this.len)throw c(this,o);this.pos+=o}else do{if(this.pos>=this.len)throw c(this)}while(128&this.buf[this.pos++]);return this},h.prototype.skipType=function(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(o=7&this.uint32());)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+o+" at offset "+this.pos)}return this},h.r=function(o){a=o,h.create=d(),a.r();var s=l.Long?"toLong":"toNumber";l.merge(h.prototype,{int64:function(){return y.call(this)[s](!1)},uint64:function(){return y.call(this)[s](!0)},sint64:function(){return y.call(this).zzDecode()[s](!1)},fixed64:function(){return b.call(this)[s](!0)},sfixed64:function(){return b.call(this)[s](!1)}})}},{35:35}],25:[function(o,s){s.exports=u;var a=o(24);(u.prototype=Object.create(a.prototype)).constructor=u;var l=o(35);function u(o){a.call(this,o)}u.r=function(){l.Buffer&&(u.prototype.f=l.Buffer.prototype.slice)},u.prototype.string=function(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))},u.r()},{24:24,35:35}],26:[function(o,s){s.exports=m;var a=o(21);((m.prototype=Object.create(a.prototype)).constructor=m).className="Root";var l,u,p,c=o(15),h=o(14),d=o(23),f=o(33);function m(o){a.call(this,"",o),this.deferred=[],this.files=[]}function y(){}m.fromJSON=function(o,s){return s=s||new m,o.options&&s.setOptions(o.options),s.addJSON(o.nested)},m.prototype.resolvePath=f.path.resolve,m.prototype.fetch=f.fetch,m.prototype.load=function o(s,a,l){"function"==typeof a&&(l=a,a=g);var c=this;if(!l)return f.asPromise(o,c,s,a);var h=l===y;function d(o,s){if(l){var a=l;if(l=null,h)throw o;a(o,s)}}function m(o){var s=o.lastIndexOf("google/protobuf/");if(-1<s){var a=o.substring(s);if(a in p)return a}return null}function v(o,s){try{if(f.isString(s)&&"{"==s[0]&&(s=JSON.parse(s)),f.isString(s)){u.filename=o;var l,p=u(s,c,a),y=0;if(p.imports)for(;y<p.imports.length;++y)(l=m(p.imports[y])||c.resolvePath(o,p.imports[y]))&&b(l);if(p.weakImports)for(y=0;y<p.weakImports.length;++y)(l=m(p.weakImports[y])||c.resolvePath(o,p.weakImports[y]))&&b(l,!0)}else c.setOptions(s.options).addJSON(s.nested)}catch(o){d(o)}h||_||d(null,c)}function b(o,s){if(!~c.files.indexOf(o))if(c.files.push(o),o in p)h?v(o,p[o]):(++_,setTimeout((function(){--_,v(o,p[o])})));else if(h){var a;try{a=f.fs.readFileSync(o).toString("utf8")}catch(a){return void(s||d(a))}v(o,a)}else++_,c.fetch(o,(function(a,u){--_,l&&(a?s?_||d(null,c):d(a):v(o,u))}))}var _=0;f.isString(s)&&(s=[s]);for(var w,A=0;A<s.length;++A)(w=c.resolvePath("",s[A]))&&b(w);return h?c:(_||d(null,c),g)},m.prototype.loadSync=function(o,s){if(!f.isNode)throw Error("not supported");return this.load(o,s,y)},m.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(o){return"'extend "+o.extend+"' in "+o.parent.fullName})).join(", "));return a.prototype.resolveAll.call(this)};var v=/^[A-Z]/;function b(o,s){var a=s.parent.lookup(s.extend);if(a){var l=new c(s.fullName,s.id,s.type,s.rule,g,s.options);return(l.declaringField=s).extensionField=l,a.add(l),1}}m.prototype.u=function(o){if(o instanceof c)o.extend===g||o.extensionField||b(0,o)||this.deferred.push(o);else if(o instanceof h)v.test(o.name)&&(o.parent[o.name]=o.values);else if(!(o instanceof d)){if(o instanceof l)for(var s=0;s<this.deferred.length;)b(0,this.deferred[s])?this.deferred.splice(s,1):++s;for(var a=0;a<o.nestedArray.length;++a)this.u(o.e[a]);v.test(o.name)&&(o.parent[o.name]=o)}},m.prototype.o=function(o){if(o instanceof c){if(o.extend!==g)if(o.extensionField)o.extensionField.parent.remove(o.extensionField),o.extensionField=null;else{var s=this.deferred.indexOf(o);-1<s&&this.deferred.splice(s,1)}}else if(o instanceof h)v.test(o.name)&&delete o.parent[o.name];else if(o instanceof a){for(var l=0;l<o.nestedArray.length;++l)this.o(o.e[l]);v.test(o.name)&&delete o.parent[o.name]}},m.r=function(o,s,a){l=o,u=s,p=a}},{14:14,15:15,21:21,23:23,33:33}],27:[function(o,s){s.exports={}},{}],28:[function(o,s,a){a.Service=o(29)},{29:29}],29:[function(o,s){s.exports=l;var a=o(35);function l(o,s,l){if("function"!=typeof o)throw TypeError("rpcImpl must be a function");a.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!s,this.responseDelimited=!!l}((l.prototype=Object.create(a.EventEmitter.prototype)).constructor=l).prototype.rpcCall=function o(s,l,u,p,c){if(!p)throw TypeError("request must be specified");var h=this;if(!c)return a.asPromise(o,h,s,l,u,p);if(!h.rpcImpl)return setTimeout((function(){c(Error("already ended"))}),0),g;try{return h.rpcImpl(s,l[h.requestDelimited?"encodeDelimited":"encode"](p).finish(),(function(o,a){if(o)return h.emit("error",o,s),c(o);if(null===a)return h.end(!0),g;if(!(a instanceof u))try{a=u[h.responseDelimited?"decodeDelimited":"decode"](a)}catch(o){return h.emit("error",o,s),c(o)}return h.emit("data",a,s),c(null,a)}))}catch(o){return h.emit("error",o,s),setTimeout((function(){c(o)}),0),g}},l.prototype.end=function(o){return this.rpcImpl&&(o||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{35:35}],30:[function(o,s){s.exports=c;var a=o(21);((c.prototype=Object.create(a.prototype)).constructor=c).className="Service";var l=o(20),u=o(33),p=o(28);function c(o,s){a.call(this,o,s),this.methods={},this.h=null}function h(o){return o.h=null,o}c.fromJSON=function(o,s){var a=new c(o,s.options);if(s.methods)for(var u=Object.keys(s.methods),p=0;p<u.length;++p)a.add(l.fromJSON(u[p],s.methods[u[p]]));return s.nested&&a.addJSON(s.nested),a.comment=s.comment,a},c.prototype.toJSON=function(o){var s=a.prototype.toJSON.call(this,o),l=!!o&&!!o.keepComments;return u.toObject(["options",s&&s.options||g,"methods",a.arrayToJSON(this.methodsArray,o)||{},"nested",s&&s.nested||g,"comment",l?this.comment:g])},Object.defineProperty(c.prototype,"methodsArray",{get:function(){return this.h||(this.h=u.toArray(this.methods))}}),c.prototype.get=function(o){return this.methods[o]||a.prototype.get.call(this,o)},c.prototype.resolveAll=function(){for(var o=this.methodsArray,s=0;s<o.length;++s)o[s].resolve();return a.prototype.resolve.call(this)},c.prototype.add=function(o){if(this.get(o.name))throw Error("duplicate name '"+o.name+"' in "+this);return o instanceof l?h((this.methods[o.name]=o).parent=this):a.prototype.add.call(this,o)},c.prototype.remove=function(o){if(o instanceof l){if(this.methods[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.methods[o.name],o.parent=null,h(this)}return a.prototype.remove.call(this,o)},c.prototype.create=function(o,s,a){for(var l,c=new p.Service(o,s,a),h=0;h<this.methodsArray.length;++h){var d=u.lcFirst((l=this.h[h]).resolve().name).replace(/[^$\w_]/g,"");c[d]=u.codegen(["r","c"],u.isReserved(d)?d+"_":d)("return this.rpcCall(m,q,s,r,c)")({m:l,q:l.resolvedRequestType.ctor,s:l.resolvedResponseType.ctor})}return c}},{20:20,21:21,28:28,33:33}],31:[function(o,s){s.exports=T;var a=o(21);((T.prototype=Object.create(a.prototype)).constructor=T).className="Type";var l=o(14),u=o(23),p=o(15),c=o(18),h=o(30),d=o(19),f=o(24),m=o(38),y=o(33),v=o(13),b=o(12),_=o(36),w=o(11),A=o(37);function T(o,s){a.call(this,o,s),this.fields={},this.oneofs=g,this.extensions=g,this.reserved=g,this.group=g,this.c=null,this.i=null,this.a=null,this.l=null}function O(o){return o.c=o.i=o.a=null,delete o.encode,delete o.decode,delete o.verify,o}Object.defineProperties(T.prototype,{fieldsById:{get:function(){if(this.c)return this.c;this.c={};for(var o=Object.keys(this.fields),s=0;s<o.length;++s){var a=this.fields[o[s]],l=a.id;if(this.c[l])throw Error("duplicate id "+l+" in "+this);this.c[l]=a}return this.c}},fieldsArray:{get:function(){return this.i||(this.i=y.toArray(this.fields))}},oneofsArray:{get:function(){return this.a||(this.a=y.toArray(this.oneofs))}},ctor:{get:function(){return this.l||(this.ctor=T.generateConstructor(this)())},set:function(o){var s=o.prototype;s instanceof d||((o.prototype=new d).constructor=o,y.merge(o.prototype,s)),o.$type=o.prototype.$type=this,y.merge(o,d,!0),this.l=o;for(var a=0;a<this.fieldsArray.length;++a)this.i[a].resolve();var l={};for(a=0;a<this.oneofsArray.length;++a)l[this.a[a].resolve().name]={get:y.oneOfGetter(this.a[a].oneof),set:y.oneOfSetter(this.a[a].oneof)};a&&Object.defineProperties(o.prototype,l)}}}),T.generateConstructor=function(o){for(var s,a=y.codegen(["p"],o.name),l=0;l<o.fieldsArray.length;++l)(s=o.i[l]).map?a("this%s={}",y.safeProp(s.name)):s.repeated&&a("this%s=[]",y.safeProp(s.name));return a("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},T.fromJSON=function(o,s){var d=new T(o,s.options);d.extensions=s.extensions,d.reserved=s.reserved;for(var f=Object.keys(s.fields),m=0;m<f.length;++m)d.add((void 0!==s.fields[f[m]].keyType?c.fromJSON:p.fromJSON)(f[m],s.fields[f[m]]));if(s.oneofs)for(f=Object.keys(s.oneofs),m=0;m<f.length;++m)d.add(u.fromJSON(f[m],s.oneofs[f[m]]));if(s.nested)for(f=Object.keys(s.nested),m=0;m<f.length;++m){var y=s.nested[f[m]];d.add((y.id!==g?p.fromJSON:y.fields!==g?T.fromJSON:y.values!==g?l.fromJSON:y.methods!==g?h.fromJSON:a.fromJSON)(f[m],y))}return s.extensions&&s.extensions.length&&(d.extensions=s.extensions),s.reserved&&s.reserved.length&&(d.reserved=s.reserved),s.group&&(d.group=!0),s.comment&&(d.comment=s.comment),d},T.prototype.toJSON=function(o){var s=a.prototype.toJSON.call(this,o),l=!!o&&!!o.keepComments;return y.toObject(["options",s&&s.options||g,"oneofs",a.arrayToJSON(this.oneofsArray,o),"fields",a.arrayToJSON(this.fieldsArray.filter((function(o){return!o.declaringField})),o)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:g,"reserved",this.reserved&&this.reserved.length?this.reserved:g,"group",this.group||g,"nested",s&&s.nested||g,"comment",l?this.comment:g])},T.prototype.resolveAll=function(){for(var o=this.fieldsArray,s=0;s<o.length;)o[s++].resolve();var l=this.oneofsArray;for(s=0;s<l.length;)l[s++].resolve();return a.prototype.resolveAll.call(this)},T.prototype.get=function(o){return this.fields[o]||this.oneofs&&this.oneofs[o]||this.nested&&this.nested[o]||null},T.prototype.add=function(o){if(this.get(o.name))throw Error("duplicate name '"+o.name+"' in "+this);if(o instanceof p&&o.extend===g){if(this.c?this.c[o.id]:this.fieldsById[o.id])throw Error("duplicate id "+o.id+" in "+this);if(this.isReservedId(o.id))throw Error("id "+o.id+" is reserved in "+this);if(this.isReservedName(o.name))throw Error("name '"+o.name+"' is reserved in "+this);return o.parent&&o.parent.remove(o),(this.fields[o.name]=o).message=this,o.onAdd(this),O(this)}return o instanceof u?(this.oneofs||(this.oneofs={}),(this.oneofs[o.name]=o).onAdd(this),O(this)):a.prototype.add.call(this,o)},T.prototype.remove=function(o){if(o instanceof p&&o.extend===g){if(!this.fields||this.fields[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.fields[o.name],o.parent=null,o.onRemove(this),O(this)}if(o instanceof u){if(!this.oneofs||this.oneofs[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.oneofs[o.name],o.parent=null,o.onRemove(this),O(this)}return a.prototype.remove.call(this,o)},T.prototype.isReservedId=function(o){return a.isReservedId(this.reserved,o)},T.prototype.isReservedName=function(o){return a.isReservedName(this.reserved,o)},T.prototype.create=function(o){return new this.ctor(o)},T.prototype.setup=function(){for(var o=this.fullName,s=[],a=0;a<this.fieldsArray.length;++a)s.push(this.i[a].resolve().resolvedType);this.encode=v(this)({Writer:m,types:s,util:y}),this.decode=b(this)({Reader:f,types:s,util:y}),this.verify=_(this)({types:s,util:y}),this.fromObject=w.fromObject(this)({types:s,util:y}),this.toObject=w.toObject(this)({types:s,util:y});var l=A[o];if(l){var u=Object.create(this);u.fromObject=this.fromObject,this.fromObject=l.fromObject.bind(u),u.toObject=this.toObject,this.toObject=l.toObject.bind(u)}return this},T.prototype.encode=function(o,s){return this.setup().encode(o,s)},T.prototype.encodeDelimited=function(o,s){return this.encode(o,s&&s.len?s.fork():s).ldelim()},T.prototype.decode=function(o,s){return this.setup().decode(o,s)},T.prototype.decodeDelimited=function(o){return o instanceof f||(o=f.create(o)),this.decode(o,o.uint32())},T.prototype.verify=function(o){return this.setup().verify(o)},T.prototype.fromObject=function(o){return this.setup().fromObject(o)},T.prototype.toObject=function(o,s){return this.setup().toObject(o,s)},T.d=function(o){return function(s){y.decorateType(s,o)}}},{11:11,12:12,13:13,14:14,15:15,18:18,19:19,21:21,23:23,24:24,30:30,33:33,36:36,37:37,38:38}],32:[function(o,s,a){var l=a,u=o(33),p=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function c(o,s){var a=0,l={};for(s|=0;a<o.length;)l[p[a+s]]=o[a++];return l}l.basic=c([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),l.defaults=c([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",u.emptyArray,null]),l.long=c([0,0,0,1,1],7),l.mapKey=c([0,0,0,5,5,0,0,0,1,1,0,2],2),l.packed=c([1,5,0,0,0,5,5,0,0,0,1,1,0])},{33:33}],33:[function(o,s){var a,l,u=s.exports=o(35),p=o(27);u.codegen=o(3),u.fetch=o(5),u.path=o(8),u.fs=u.inquire("fs"),u.toArray=function(o){if(o){for(var s=Object.keys(o),a=Array(s.length),l=0;l<s.length;)a[l]=o[s[l++]];return a}return[]},u.toObject=function(o){for(var s={},a=0;a<o.length;){var l=o[a++],u=o[a++];u!==g&&(s[l]=u)}return s};var c=/\\/g,h=/"/g;u.isReserved=function(o){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(o)},u.safeProp=function(o){return!/^[$\w_]+$/.test(o)||u.isReserved(o)?'["'+o.replace(c,"\\\\").replace(h,'\\"')+'"]':"."+o},u.ucFirst=function(o){return o[0].toUpperCase()+o.substring(1)};var d=/_([a-z])/g;u.camelCase=function(o){return o.substring(0,1)+o.substring(1).replace(d,(function(o,s){return s.toUpperCase()}))},u.compareFieldsById=function(o,s){return o.id-s.id},u.decorateType=function(s,l){if(s.$type)return l&&s.$type.name!==l&&(u.decorateRoot.remove(s.$type),s.$type.name=l,u.decorateRoot.add(s.$type)),s.$type;var p=new(a=a||o(31))(l||s.name);return u.decorateRoot.add(p),p.ctor=s,Object.defineProperty(s,"$type",{value:p,enumerable:!1}),Object.defineProperty(s.prototype,"$type",{value:p,enumerable:!1}),p};var f=0;u.decorateEnum=function(s){if(s.$type)return s.$type;var a=new(l=l||o(14))("Enum"+f++,s);return u.decorateRoot.add(a),Object.defineProperty(s,"$type",{value:a,enumerable:!1}),a},u.setProperty=function(o,s,a){if("object"!=typeof o)throw TypeError("dst must be an object");if(!s)throw TypeError("path must be specified");return function o(s,a,l){var u=a.shift();if(0<a.length)s[u]=o(s[u]||{},a,l);else{var p=s[u];p&&(l=[].concat(p).concat(l)),s[u]=l}return s}(o,s=s.split("."),a)},Object.defineProperty(u,"decorateRoot",{get:function(){return p.decorated||(p.decorated=new(o(26)))}})},{14:14,26:26,27:27,3:3,31:31,35:35,5:5,8:8}],34:[function(o,s){s.exports=l;var a=o(35);function l(o,s){this.lo=o>>>0,this.hi=s>>>0}var u=l.zero=new l(0,0);u.toNumber=function(){return 0},u.zzEncode=u.zzDecode=function(){return this},u.length=function(){return 1};var p=l.zeroHash="\0\0\0\0\0\0\0\0";l.fromNumber=function(o){if(0===o)return u;var s=o<0;s&&(o=-o);var a=o>>>0,p=(o-a)/4294967296>>>0;return s&&(p=~p>>>0,a=~a>>>0,4294967295<++a&&(a=0,4294967295<++p&&(p=0))),new l(a,p)},l.from=function(o){if("number"==typeof o)return l.fromNumber(o);if(a.isString(o)){if(!a.Long)return l.fromNumber(parseInt(o,10));o=a.Long.fromString(o)}return o.low||o.high?new l(o.low>>>0,o.high>>>0):u},l.prototype.toNumber=function(o){if(!o&&this.hi>>>31){var s=1+~this.lo>>>0,a=~this.hi>>>0;return s||(a=a+1>>>0),-(s+4294967296*a)}return this.lo+4294967296*this.hi},l.prototype.toLong=function(o){return a.Long?new a.Long(0|this.lo,0|this.hi,!!o):{low:0|this.lo,high:0|this.hi,unsigned:!!o}};var c=String.prototype.charCodeAt;l.fromHash=function(o){return o===p?u:new l((c.call(o,0)|c.call(o,1)<<8|c.call(o,2)<<16|c.call(o,3)<<24)>>>0,(c.call(o,4)|c.call(o,5)<<8|c.call(o,6)<<16|c.call(o,7)<<24)>>>0)},l.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)},l.prototype.zzEncode=function(){var o=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^o)>>>0,this.lo=(this.lo<<1^o)>>>0,this},l.prototype.zzDecode=function(){var o=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^o)>>>0,this.hi=(this.hi>>>1^o)>>>0,this},l.prototype.length=function(){var o=this.lo,s=(this.lo>>>28|this.hi<<4)>>>0,a=this.hi>>>24;return 0==a?0==s?o<16384?o<128?1:2:o<2097152?3:4:s<16384?s<128?5:6:s<2097152?7:8:a<128?9:10}},{35:35}],35:[function(o,s,a){var l=a;function u(o,s,a){for(var l=Object.keys(s),u=0;u<l.length;++u)o[l[u]]!==g&&a||(o[l[u]]=s[l[u]]);return o}function p(o){function s(o,a){if(!(this instanceof s))return new s(o,a);Object.defineProperty(this,"message",{get:function(){return o}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:Error().stack||""}),a&&u(this,a)}return(s.prototype=Object.create(Error.prototype)).constructor=s,Object.defineProperty(s.prototype,"name",{get:function(){return o}}),s.prototype.toString=function(){return this.name+": "+this.message},s}l.asPromise=o(1),l.base64=o(2),l.EventEmitter=o(4),l.float=o(6),l.inquire=o(7),l.utf8=o(10),l.pool=o(9),l.LongBits=o(34),l.isNode=!!("undefined"!=typeof global&&global&&global.process&&global.process.versions&&global.process.versions.node),l.global=l.isNode&&global||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,l.emptyArray=Object.freeze?Object.freeze([]):[],l.emptyObject=Object.freeze?Object.freeze({}):{},l.isInteger=Number.isInteger||function(o){return"number"==typeof o&&isFinite(o)&&Math.floor(o)===o},l.isString=function(o){return"string"==typeof o||o instanceof String},l.isObject=function(o){return o&&"object"==typeof o},l.isset=l.isSet=function(o,s){var a=o[s];return null!=a&&o.hasOwnProperty(s)&&("object"!=typeof a||0<(Array.isArray(a)?a.length:Object.keys(a).length))},l.Buffer=null,l.v=null,l.b=null,l.newBuffer=function(o){return"number"==typeof o?l.Buffer?l.b(o):new l.Array(o):l.Buffer?l.v(o):"undefined"==typeof Uint8Array?o:new Uint8Array(o)},l.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,l.Long=l.global.dcodeIO&&l.global.dcodeIO.Long||l.global.Long||l.inquire("long"),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(o){return o?l.LongBits.from(o).toHash():l.LongBits.zeroHash},l.longFromHash=function(o,s){var a=l.LongBits.fromHash(o);return l.Long?l.Long.fromBits(a.lo,a.hi,s):a.toNumber(!!s)},l.merge=u,l.lcFirst=function(o){return o[0].toLowerCase()+o.substring(1)},l.newError=p,l.ProtocolError=p("ProtocolError"),l.oneOfGetter=function(o){for(var s={},a=0;a<o.length;++a)s[o[a]]=1;return function(){for(var o=Object.keys(this),a=o.length-1;-1<a;--a)if(1===s[o[a]]&&this[o[a]]!==g&&null!==this[o[a]])return o[a]}},l.oneOfSetter=function(o){return function(s){for(var a=0;a<o.length;++a)o[a]!==s&&delete this[o[a]]}},l.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},l.r=function(){var o=l.Buffer;o?(l.v=o.from!==Uint8Array.from&&o.from||function(s,a){return new o(s,a)},l.b=o.allocUnsafe||function(s){return new o(s)}):l.v=l.b=null}},{1:1,10:10,2:2,34:34,4:4,6:6,7:7,9:9}],36:[function(o,s){s.exports=function(o){var s=l.codegen(["m"],o.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),a={};o.oneofsArray.length&&s("var p={}");for(var h=0;h<o.fieldsArray.length;++h){var d=o.i[h].resolve(),f="m"+l.safeProp(d.name);if(d.optional&&s("if(%s!=null&&m.hasOwnProperty(%j)){",f,d.name),d.map)s("if(!util.isObject(%s))",f)("return%j",u(d,"object"))("var k=Object.keys(%s)",f)("for(var i=0;i<k.length;++i){"),c(s,d,"k[i]"),p(s,d,h,f+"[k[i]]")("}");else if(d.repeated)s("if(!Array.isArray(%s))",f)("return%j",u(d,"array"))("for(var i=0;i<%s.length;++i){",f),p(s,d,h,f+"[i]")("}");else{if(d.partOf){var m=l.safeProp(d.partOf.name);1===a[d.partOf.name]&&s("if(p%s===1)",m)("return%j",d.partOf.name+": multiple values"),a[d.partOf.name]=1,s("p%s=1",m)}p(s,d,h,f)}d.optional&&s("}")}return s("return null")};var a=o(14),l=o(33);function u(o,s){return o.name+": "+s+(o.repeated&&"array"!==s?"[]":o.map&&"object"!==s?"{k:"+o.keyType+"}":"")+" expected"}function p(o,s,l,p){if(s.resolvedType)if(s.resolvedType instanceof a){o("switch(%s){",p)("default:")("return%j",u(s,"enum value"));for(var c=Object.keys(s.resolvedType.values),h=0;h<c.length;++h)o("case %i:",s.resolvedType.values[c[h]]);o("break")("}")}else o("{")("var e=types[%i].verify(%s);",l,p)("if(e)")("return%j+e",s.name+".")("}");else switch(s.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":o("if(!util.isInteger(%s))",p)("return%j",u(s,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":o("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",p,p,p,p)("return%j",u(s,"integer|Long"));break;case"float":case"double":o('if(typeof %s!=="number")',p)("return%j",u(s,"number"));break;case"bool":o('if(typeof %s!=="boolean")',p)("return%j",u(s,"boolean"));break;case"string":o("if(!util.isString(%s))",p)("return%j",u(s,"string"));break;case"bytes":o('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',p,p,p)("return%j",u(s,"buffer"))}return o}function c(o,s,a){switch(s.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":o("if(!util.key32Re.test(%s))",a)("return%j",u(s,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":o("if(!util.key64Re.test(%s))",a)("return%j",u(s,"integer|Long key"));break;case"bool":o("if(!util.key2Re.test(%s))",a)("return%j",u(s,"boolean key"))}return o}},{14:14,33:33}],37:[function(o,s,a){var l=a,u=o(19);l[".google.protobuf.Any"]={fromObject:function(o){if(o&&o["@type"]){var s=o["@type"].substring(1+o["@type"].lastIndexOf("/")),a=this.lookup(s);if(a){var l="."==o["@type"][0]?o["@type"].substr(1):o["@type"];return~l.indexOf("/")||(l="/"+l),this.create({type_url:l,value:a.encode(a.fromObject(o)).finish()})}}return this.fromObject(o)},toObject:function(o,s){var a="",l="";if(s&&s.json&&o.type_url&&o.value){l=o.type_url.substring(1+o.type_url.lastIndexOf("/")),a=o.type_url.substring(0,1+o.type_url.lastIndexOf("/"));var p=this.lookup(l);p&&(o=p.decode(o.value))}if(o instanceof this.ctor||!(o instanceof u))return this.toObject(o,s);var c=o.$type.toObject(o,s);return""===a&&(a="type.googleapis.com/"),l=a+("."===o.$type.fullName[0]?o.$type.fullName.substr(1):o.$type.fullName),c["@type"]=l,c}}},{19:19}],38:[function(o,s){s.exports=m;var a,l=o(35),u=l.LongBits,p=l.base64,c=l.utf8;function h(o,s,a){this.fn=o,this.len=s,this.next=g,this.val=a}function d(){}function f(o){this.head=o.head,this.tail=o.tail,this.len=o.len,this.next=o.states}function m(){this.len=0,this.head=new h(d,0,0),this.tail=this.head,this.states=null}function y(){return l.Buffer?function(){return(m.create=function(){return new a})()}:function(){return new m}}function v(o,s,a){s[a]=255&o}function b(o,s){this.len=o,this.next=g,this.val=s}function _(o,s,a){for(;o.hi;)s[a++]=127&o.lo|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;127<o.lo;)s[a++]=127&o.lo|128,o.lo=o.lo>>>7;s[a++]=o.lo}function w(o,s,a){s[a]=255&o,s[a+1]=o>>>8&255,s[a+2]=o>>>16&255,s[a+3]=o>>>24}m.create=y(),m.alloc=function(o){return new l.Array(o)},l.Array!==Array&&(m.alloc=l.pool(m.alloc,l.Array.prototype.subarray)),m.prototype.p=function(o,s,a){return this.tail=this.tail.next=new h(o,s,a),this.len+=s,this},(b.prototype=Object.create(h.prototype)).fn=function(o,s,a){for(;127<o;)s[a++]=127&o|128,o>>>=7;s[a]=o},m.prototype.uint32=function(o){return this.len+=(this.tail=this.tail.next=new b((o>>>=0)<128?1:o<16384?2:o<2097152?3:o<268435456?4:5,o)).len,this},m.prototype.int32=function(o){return o<0?this.p(_,10,u.fromNumber(o)):this.uint32(o)},m.prototype.sint32=function(o){return this.uint32((o<<1^o>>31)>>>0)},m.prototype.int64=m.prototype.uint64=function(o){var s=u.from(o);return this.p(_,s.length(),s)},m.prototype.sint64=function(o){var s=u.from(o).zzEncode();return this.p(_,s.length(),s)},m.prototype.bool=function(o){return this.p(v,1,o?1:0)},m.prototype.sfixed32=m.prototype.fixed32=function(o){return this.p(w,4,o>>>0)},m.prototype.sfixed64=m.prototype.fixed64=function(o){var s=u.from(o);return this.p(w,4,s.lo).p(w,4,s.hi)},m.prototype.float=function(o){return this.p(l.float.writeFloatLE,4,o)},m.prototype.double=function(o){return this.p(l.float.writeDoubleLE,8,o)};var A=l.Array.prototype.set?function(o,s,a){s.set(o,a)}:function(o,s,a){for(var l=0;l<o.length;++l)s[a+l]=o[l]};m.prototype.bytes=function(o){var s=o.length>>>0;if(!s)return this.p(v,1,0);if(l.isString(o)){var a=m.alloc(s=p.length(o));p.decode(o,a,0),o=a}return this.uint32(s).p(A,s,o)},m.prototype.string=function(o){var s=c.length(o);return s?this.uint32(s).p(c.write,s,o):this.p(v,1,0)},m.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new h(d,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 h(d,0,0),this.len=0),this},m.prototype.ldelim=function(){var o=this.head,s=this.tail,a=this.len;return this.reset().uint32(a),a&&(this.tail.next=o.next,this.tail=s,this.len+=a),this},m.prototype.finish=function(){for(var o=this.head.next,s=this.constructor.alloc(this.len),a=0;o;)o.fn(o.val,s,a),a+=o.len,o=o.next;return s},m.r=function(o){a=o,m.create=y(),a.r()}},{35:35}],39:[function(o,s){s.exports=u;var a=o(38);(u.prototype=Object.create(a.prototype)).constructor=u;var l=o(35);function u(){a.call(this)}function p(o,s,a){o.length<40?l.utf8.write(o,s,a):s.utf8Write?s.utf8Write(o,a):s.write(o,a)}u.r=function(){u.alloc=l.b,u.writeBytesBuffer=l.Buffer&&l.Buffer.prototype instanceof Uint8Array&&"set"===l.Buffer.prototype.set.name?function(o,s,a){s.set(o,a)}:function(o,s,a){if(o.copy)o.copy(s,a,0,o.length);else for(var l=0;l<o.length;)s[a++]=o[l++]}},u.prototype.bytes=function(o){l.isString(o)&&(o=l.v(o,"base64"));var s=o.length>>>0;return this.uint32(s),s&&this.p(u.writeBytesBuffer,s,o),this},u.prototype.string=function(o){var s=l.Buffer.byteLength(o);return this.uint32(s),s&&this.p(p,s,o),this},u.r()},{35:35,38:38}]},e={},t=[16],__protobufjs=function o(s){var a=e[s];return a||r[s][0].call(a=e[s]={exports:{}},o,a,a.exports),a.exports}(t[0])}();import{utility,schemaUtil,LazyMapToList}from"o11y/shared";const activity={namespace:"sf.instrumentation",name:"Activity",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Activity:{reserved:[[5,5],[7,7]],fields:{duration:{options:{},id:3,type:"double"},stopReason:{options:{},id:6,type:"string"},isRoot:{options:{},id:8,type:"bool"},name:{options:{"(meta.max_length)":25},id:2,type:"string"},isSampled:{options:{},id:11,type:"bool"},preRootId:{options:{},id:9,type:"string"},id:{options:{},id:1,type:"string"},userPayload:{options:{},id:4,type:"Payload"},errorCount:{options:{},id:10,type:"uint32"}}},Payload:{fields:{payload:{options:{},id:2,type:"bytes"},schemaName:{options:{},id:1,type:"string"}}}}}}}}}},core_envelope={namespace:"sf.instrumentation",name:"CoreEnvelope",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MessageBundle:{fields:{messages:{options:{},rule:"repeated",id:2,type:"LogMessage"},schemaName:{options:{},id:1,type:"string"}}},Metrics:{fields:{valueRecorders:{options:{},rule:"repeated",id:2,type:"ValueRecorder"},upCounters:{options:{},rule:"repeated",id:1,type:"UpCounter"}}},CoreEnvelopeDiagnostics:{fields:{schemaVersion:{options:{},id:6,type:"string"},generatedTimestamp:{options:{},id:2,type:"double"},bundleCount:{options:{},id:3,type:"uint32"},upCounterCount:{options:{},id:4,type:"uint32"},valueRecorderCount:{options:{},id:5,type:"uint32"},key:{options:{},id:1,type:"string"}}},LogMessage:{fields:{appPayload:{options:{},id:10,type:"Payload"},data:{options:{},id:2,type:"bytes"},rootId:{options:{},id:4,type:"string"},pagePayload:{options:{},id:7,type:"Payload"},loggerAppName:{options:{},id:8,type:"string"},loggerName:{options:{},id:6,type:"string"},connectionType:{options:{},id:9,type:"string"},age:{options:{},id:3,type:"double"},seq:{options:{},id:5,type:"uint32"},timestamp:{options:{},id:1,type:"double"}}},CoreEnvelope:{options:{"(meta.msg.desc)":"This message is used to contain data that the Core ui-telemetry Connect API endpoint accepts."},fields:{diagnostics:{options:{},id:1,type:"CoreEnvelopeDiagnostics"},bundles:{options:{},rule:"repeated",id:2,type:"MessageBundle"},metrics:{options:{},id:3,type:"Metrics"},staticAttributes:{options:{},id:4,type:"StaticAttributes"}}},MetricTag:{fields:{name:{options:{},id:1,type:"string"},value:{options:{},id:2,type:"string"}}},ValueRecorder:{fields:{lastUpdatedTimestamp:{options:{},id:3,type:"double"},ownerName:{options:{},id:6,type:"string"},ownerAppName:{options:{},id:7,type:"string"},createdTimestamp:{options:{},id:2,type:"double"},values:{options:{},rule:"repeated",id:4,type:"double"},name:{options:{},id:1,type:"string"},tags:{options:{},rule:"repeated",id:5,type:"MetricTag"}}},StaticAttributes:{fields:{appVersion:{options:{},id:2,type:"string"},appName:{options:{},id:1,type:"string"},deviceModel:{options:{},id:5,type:"string"},sdkVersion:{options:{},id:6,type:"string"},deviceId:{options:{},id:4,type:"string"},appExperience:{options:{},id:3,type:"string"}}},Payload:{fields:{payload:{options:{},id:2,type:"bytes"},schemaName:{options:{},id:1,type:"string"}}},UpCounter:{fields:{lastUpdatedTimestamp:{options:{},id:3,type:"double"},ownerName:{options:{},id:6,type:"string"},ownerAppName:{options:{},id:7,type:"string"},createdTimestamp:{options:{},id:2,type:"double"},name:{options:{},id:1,type:"string"},value:{options:{},id:4,type:"uint32"},tags:{options:{},rule:"repeated",id:5,type:"MetricTag"}}}}}}}}}},error={namespace:"sf.instrumentation",name:"Error",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Error:{reserved:[[5,5],[7,7]],fields:{activityId:{options:{},id:6,type:"string"},stack:{options:{},id:3,type:"string"},name:{options:{},id:1,type:"string"},message:{options:{"(meta.max_length)":200},id:2,type:"string"},userPayload:{options:{},id:4,type:"Payload"}}},Payload:{fields:{payload:{options:{},id:2,type:"bytes"},schemaName:{options:{},id:1,type:"string"}}}}}}}}}},instrumented_event={namespace:"sf.instrumentation",name:"InstrumentedEvent",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MouseEvent:{fields:{cancelable:{options:{},id:5,type:"bool"},ctrlKey:{options:{},id:9,type:"bool"},type:{options:{},id:25,type:"string"},button:{options:{},id:3,type:"uint32"},offsetX:{options:{},id:17,type:"uint32"},eventPhase:{options:{},id:12,type:"uint32"},shiftKey:{options:{},id:23,type:"bool"},offsetY:{options:{},id:18,type:"uint32"},composed:{options:{},id:8,type:"bool"},altKey:{options:{},id:1,type:"bool"},isTrusted:{options:{},id:13,type:"bool"},buttons:{options:{},id:4,type:"uint32"},movementY:{options:{},id:16,type:"uint32"},clientY:{options:{},id:7,type:"uint32"},clientX:{options:{},id:6,type:"uint32"},movementX:{options:{},id:15,type:"uint32"},defaultPrevented:{options:{},id:10,type:"bool"},metaKey:{options:{},id:14,type:"bool"},timeStamp:{options:{},id:24,type:"double"},bubbles:{options:{},id:2,type:"bool"},detail:{options:{},id:11,type:"int64"},pageY:{options:{},id:20,type:"uint32"},pageX:{options:{},id:19,type:"uint32"},screenX:{options:{},id:21,type:"uint32"},screenY:{options:{},id:22,type:"uint32"}}},InstrumentedEvent:{oneofs:{event:{oneof:["mouseEvent"]}},reserved:[[4,4],"xpath",[6,6],[8,8]],fields:{mouseEvent:{options:{},id:7,type:"MouseEvent"},auto:{options:{},id:3,type:"bool"},parentComponent:{options:{},id:2,type:"string"},ownerComponent:{options:{},id:1,type:"string"},userPayload:{options:{},id:5,type:"Payload"},simplePath:{options:{},id:9,type:"string"}}},Payload:{fields:{payload:{options:{},id:2,type:"bytes"},schemaName:{options:{},id:1,type:"string"}}}}}}}}}},simple={namespace:"sf.instrumentation",name:"Simple",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Simple:{options:{"(meta.msg.desc)":"This message is used internally to allow convenient logging of simple text via the API without requiring a schema."},fields:{text:{options:{"(meta.max_length)":25},id:1,type:"string"}}}}}}}}}},version="2.10.0",coreEnvelopeKey="o11y";class CoreEnvelopeBuilder{constructor(){this._envelope={diagnostics:{key:coreEnvelopeKey,generatedTimestamp:void 0,bundleCount:0,upCounterCount:0,valueRecorderCount:0,schemaVersion:version},bundles:[],metrics:{upCounters:[],valueRecorders:[]},staticAttributes:{}}}withStaticAttributes(o){return this._envelope.staticAttributes=o,this}withLogs(o,s){let a=this._envelope.bundles.find((s=>s.schemaName===o));if(a)for(const o of s)a.messages.push(o);else a={schemaName:o,messages:s},this._envelope.bundles.push(a);return this._envelope.diagnostics.bundleCount=this._envelope.bundles.length,this}_getMetricTags(o){const s=o.getTags();if(s)return Object.entries(s).map((o=>({name:o[0],value:o[1].toString()})))}withUpCounters(o){for(const s of o){const o={name:s.getName(),createdTimestamp:s.getCreatedOn(),lastUpdatedTimestamp:s.getLastUpdatedOn(),value:s.getData(),ownerName:s.getOwnerName(),ownerAppName:s.getOwnerAppName(),tags:this._getMetricTags(s)};this._envelope.metrics.upCounters.push(o),s.reset()}return this._envelope.diagnostics.upCounterCount=this._envelope.metrics.upCounters.length,this}withValueRecorders(o){for(const s of o){const o={name:s.getName(),createdTimestamp:s.getCreatedOn(),lastUpdatedTimestamp:s.getLastUpdatedOn(),values:s.getData(),ownerName:s.getOwnerName(),ownerAppName:s.getOwnerAppName(),tags:this._getMetricTags(s)};this._envelope.metrics.valueRecorders.push(o),s.reset()}return this._envelope.diagnostics.valueRecorderCount=this._envelope.metrics.valueRecorders.length,this}build(){return this._envelope.diagnostics.generatedTimestamp=utility.time().tsNow,this._envelope}}class ProtobufUtil{constructor(){this._typeStore=new Map}getSchemaType(o){utility.requireArgument(o,"schema");const s=schemaUtil.getSchemaId(o);let a=this._typeStore.get(s);if(!a){a=__protobufjs.Root.fromJSON(o.pbjsSchema).lookupType(s),this._typeStore.set(s,a)}return a}validate(o,s){utility.requireArgument(o,"schema"),utility.requireArgument(s,"data");const a=this.getSchemaType(o),l=a.verify(s);if(l)throw new Error(`Data is invalid for ${a.fullName}: ${l}`);return a}encode(o,s){const a=this.validate(o,s),l=a.fromObject(s);return a.encode(l).finish()}encodePayload(o){if(o&&o.schema&&o.payload)return{schemaName:schemaUtil.getSchemaId(o.schema),payload:this.encode(o.schema,o.payload)}}getLogMessage(o,s,a){return{timestamp:a.timestamp,data:this.encode(o,s),age:utility.getAge(a.timestamp),rootId:a.rootId,seq:a.sequence,loggerName:a.loggerName,pagePayload:this.encodePayload(a.pagePayload),loggerAppName:a.loggerAppName,connectionType:a.connectionType,appPayload:this.encodePayload(a.appPayload)}}}const protobufUtil=new ProtobufUtil;class PublicSafety{constructor(o){this._errorCounter=o,this._safeCatchMode=!1}tryCatch(o){try{o()}catch(o){this._prodSafeCatch(o)}}tryCatchReturn(o,s){try{return utility.requireArgument(s,"noopValue"),o()}catch(o){return this._prodSafeCatch(o),s}}_prodSafeCatch(o){let s;try{if(s=!utility.isProduction,s)throw o;if(this._safeCatchMode)throw this._safeCatchMode=!1,new Error("Internal error in prodSafeCatch.");if(this._safeCatchMode=!0,this._errorCounter&&this._errorCounter.increment(),!(o instanceof Error)){const s=o&&o.message||("function"==typeof o.toString?o.toString():"");o=new Error(s)}this._safeCatchMode=!1}catch(o){if(s)throw o;if(o&&console&&"function"==typeof console.error)try{console.error(o)}catch(o){}this._safeCatchMode=!1}}}const defaultTraceIdLengthW3=32,defaultTraceIdLengthB3=16,defaultSpanIdLength=16,headerTraceParent="traceparent",headerB3="b3",headerTraceId="X-B3-TraceId",headerSpanId="X-B3-SpanId",headerSampled="X-B3-Sampled",headerParentSpanId="X-B3-ParentSpanId",defaultActivityNameForFetch="fetch",defaultActivityNameForXhrSend="xhr_send";class Tracing{constructor(o){this.instr=o,utility.requireArgument(o,"instr","object")}static _getB3CompactFormat(o,s,a,l){let u=`${o}-${s}`;return void 0===a&&void 0===l||(u+=a?"-1":"-0",void 0!==l&&(u+=`-${l}`)),u}static _getW3CompactFormat(o,s,a){return`00-${o}-${s}-${a?"01":"00"}`}static _conformTextAsId(o,s){const a=(o=o.toLowerCase()).length;for(let s=0;s<a;s+=1){const a=o[s];if(!(a>="a"&&a<="f"||a>="0"&&a<="9"))throw new Error(`The text '${o}' has an invalid character at index #${s}`)}return a>s?o.substr(a-s):a<s?o.padStart(s,"0"):o}static getHeaders(o,s,a,l){utility.requireArgument(o,"traceId","string"),utility.requireArgument(s,"spanId","string");const u=l&&l.useB3Headers;o=this._conformTextAsId(o,l&&void 0!==l.traceIdEffectiveLength?l.traceIdEffectiveLength:u?defaultTraceIdLengthB3:defaultTraceIdLengthW3),s=this._conformTextAsId(s,defaultSpanIdLength);const p=l&&void 0!==l.parentSpanId&&this._conformTextAsId(l.parentSpanId,defaultSpanIdLength)||void 0,c={};if(u){l&&l.useCompactHeader?c[headerB3]=this._getB3CompactFormat(o,s,a,p):(c[headerTraceId]=o,c[headerSpanId]=s,void 0!==p&&(c[headerParentSpanId]=p),void 0!==a&&(c[headerSampled]=a?"1":"0"))}else c[headerTraceParent]=this._getW3CompactFormat(o,s,a);return c}_disableNetworkInstrumentation(){Tracing._isNetworkInstrumentationEnabled&&(Tracing._originalFetch&&(Tracing._global.fetch=Tracing._originalFetch,Tracing._originalFetch=void 0),Tracing._originalXhr&&(Tracing._global.XMLHttpRequest=Tracing._originalXhr,Tracing._originalXhr=void 0),Tracing._originalXhrSend&&(Tracing._global.XMLHttpRequest.prototype.send=Tracing._originalXhrSend,Tracing._originalXhrSend=void 0),Tracing._isNetworkInstrumentationEnabled=!1)}_enableNetworkInstrumentation(o,s,a,l,u){"function"==typeof Tracing._global.fetch&&(this._overrideFetch(o,s,a,l,u),Tracing._isNetworkInstrumentationEnabled=!0),"function"==typeof Tracing._global.XMLHttpRequest&&(this._overrideXhr(o,s,a,l,u),Tracing._isNetworkInstrumentationEnabled=!0)}_overrideFetch(o,s,a,l,u){Tracing._originalFetch=Tracing._global.fetch;Tracing._global.fetch=async(p,c,...h)=>{let d;try{if(d=o.startActivity(a||defaultActivityNameForFetch),l){c=c||{};const o=d.getTraceHeaders(u);c.headers=Object.assign(c.headers||{},o)}return await Tracing._originalFetch.call(Tracing._global,p,c,...h)}catch(a){throw s&&(d?d.error(a):o.error(a)),a}finally{d&&d.stop()}}}_overrideXhr(o,s,a,l,u){Tracing._originalXhr=Tracing._global.XMLHttpRequest,Tracing._originalXhrSend=Tracing._originalXhr.prototype.send,Tracing._originalXhr.prototype.send=function(...p){let c;const h=this;try{if(h._o11yActivity=c=o.startActivity(a||defaultActivityNameForXhrSend),l){const o=c.getTraceHeaders(u);Object.entries(o).forEach((o=>{h.setRequestHeader(o[0],o[1])}))}Tracing._originalXhrSend.call(this,...p)}catch(a){throw s&&(c?c.error(a):o.error(a)),c&&c.stop(),a}};const p=new Proxy(Tracing._originalXhr,{construct(a){const l=new a;return l.addEventListener("load",(()=>{const o=l._o11yActivity;o&&o.stop()})),l.addEventListener("error",(a=>{const u=new Error("XHR Network-Level Error"),p=l._o11yActivity;p?(s&&p.error(u),p.stop()):s&&o.error(u)})),l.addEventListener("abort",(()=>{const o=l._o11yActivity;o&&o.discard()})),l}});Tracing._global.XMLHttpRequest=p}networkInstrumentation(o){if(utility.requireArgument(o,"options",["boolean","object"]),o){this._disableNetworkInstrumentation();const s="object"==typeof o?o:{};this._enableNetworkInstrumentation(utility.definedValueOrDefault(s.instrumentation,this.instr),utility.definedValueOrDefault(s.logErrors,!0),s.activityName,utility.definedValueOrDefault(s.useTracing,!0),s.tracingHeadersOptions)}else this._disableNetworkInstrumentation()}}Tracing._global=utility.getGlobal(),Tracing._isNetworkInstrumentationEnabled=!1;const timedout="timedout",terminated="terminated",discarded="discarded",stopReason={timedout,terminated,discarded};class ActivityImpl{constructor(o,s,a,l,u,p,c){this._name=o,this._rootId=s,this._onStopped=a,this._onError=l,this._isSampled=c,this._errorCount=0;const{tsNow:h,perfNow:d}=utility.time();if(ActivityImpl._count+=1,this._id=p||utility.generateUniqueId(),this._usePerf="undefined"!=typeof performance&&"function"==typeof performance.mark&&"function"==typeof performance.measure,this._usePerf){this._perfName=`${this._name}__${ActivityImpl._count}`,this._perfId=`${this._name}__${this.id}`;try{performance.mark(this._perfId)}catch(o){this._usePerf=!1}}this._startTimestamp=h,this._startPerfTime=d,u>0&&(this._timer=setTimeout((()=>{this._stopReason=this._stopReason||stopReason.timedout,this.stop()}),u)),this._safety=new PublicSafety}get id(){return this._id}getId(){return this.id}getRootId(){return this._rootId}get stopReason(){return this._stopReason}error(o,s,a){this._safety.tryCatch((()=>{this._errorCount+=1,"string"==typeof o&&(o=new Error(o)),this._onError(o,this._getDetail(s,a))}))}stop(o,s){this._safety.tryCatch((()=>this._stopInternal(o,s)))}_stopInternal(o,s){const a=utility.perfNow();if(this._usePerf)try{performance.measure(this._perfName,this._perfId),performance.clearMarks(this._perfId),performance.clearMeasures(this._perfName)}catch(o){}if(this._timer&&(clearTimeout(this._timer),this._timer=void 0),this.isStopped)return;this._stopPerfTime=a;const l=this._getDetail(o,s);this._onStopped(l)}get isStopped(){return void 0!==this._stopPerfTime}discard(){this._safety.tryCatch((()=>{this._stopReason=this._stopReason||stopReason.discarded,this.stop()}))}terminate(){this._safety.tryCatch((()=>{this._stopReason=this._stopReason||stopReason.terminated,this.stop()}))}getIsSampled(){return this._isSampled||!1}_getDetail(o,s){return{id:this._id,rootId:this._rootId,name:this._name,userSchemaOrText:o,userData:s,stopReason:this._stopReason,startTimestamp:this._startTimestamp,startPerfTime:this._startPerfTime,stopPerfTime:this._stopPerfTime,errorCount:this._errorCount,isSampled:this.getIsSampled()}}getTraceHeaders(o){const s=this.id,a=this._rootId||s;return Tracing.getHeaders(a,s,this.getIsSampled(),o)}getStartTimestamp(){return this._startTimestamp}getStartPerfTime(){return this._startPerfTime}getStopPerfTime(){return this._stopPerfTime}}ActivityImpl._count=0;const id=new Array(16).fill(0).join("");class ActivityNoOp{getId(){return id}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(o){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}}const activityNoOp=Object.freeze(new ActivityNoOp);class DomEventHelpers{getInstrumentedEventData(o,s,a){const l={ownerComponent:s.tagName,parentComponent:s.parentElement&&s.parentElement.tagName||void 0,event:o,simplePath:utility.getXpath(s)};return a&&(l.userPayload=schemaUtil.makePayload(a.schema,a.payload,!0)),l}getMouseEventData(o){return{altKey:o.altKey,bubbles:o.bubbles,button:o.button,buttons:o.buttons,cancelable:o.cancelable,clientX:o.clientX,clientY:o.clientY,composed:o.composed,defaultPrevented:o.defaultPrevented,detail:o.detail,eventPhase:o.eventPhase,isTrusted:o.isTrusted,timeStamp:o.timeStamp,type:o.type,ctrlKey:o.ctrlKey,metaKey:o.metaKey,movementX:o.movementX,movementY:o.movementY,offsetX:o.offsetX,offsetY:o.offsetY,pageX:o.pageX,pageY:o.pageY,screenX:o.screenX,screenY:o.screenY,shiftKey:o.shiftKey}}}const singleton=new DomEventHelpers,domEventHelpers=singleton,maxFieldLength=1e4,minFieldLength=0,maxFourBytesPos=2147483647,maxFourBytesNeg=-2147483648,maxFourBytesUnsigned=4294967295,maxEightBytesPos=0x8000000000000000,maxEightBytesNeg=-0x8000000000000000,maxEightBytesUnsigned=0x10000000000000000;class LogValidator{validate(o,s){const a=schemaUtil.checkSchema(o);utility.requireArgument(s,"data","object");const l=schemaUtil.getTypes(o),u=this.validateFields(s,l[a.message],l,schemaUtil.getSchemaId(o));if(u)throw new Error(u)}validateFields(o,s,a,l){const u=s.oneofs||{},p=s.fields||{};let c;for(const s in o){const h=o[s];if(this.isNullOrUndefinedOrEmpty(h)||(u[s]?c=this.matchFieldTypes(h,u[s].oneof[0],a,l,s):p[s]&&(c=this.matchFieldTypes(h,p[s].type,a,l,s,p[s].rule))),c)return c}}isNullOrUndefinedOrEmpty(o){return null==o||""===o}matchFieldTypes(o,s,a,l,u,p){let c,h;if("repeated"===p){let p;if(Array.isArray(o)){for(const c in o)if(p=this.matchFieldTypes(o[c],s,a,l,u),p)break}else p=`Schema ${l} on field: ${u}, repeated field should be an array`;return p}switch(s){case"string":c="string";break;case"bytes":c="object",o instanceof Uint8Array||(h=`Schema ${l} on field: ${u}, bytes array is malformed`);break;case"bool":c="boolean";break;case"uint32":c="number",h=this.checkNumberRange(o,maxFourBytesUnsigned,0,l,u);break;case"int32":case"sint32":case"fixed32":case"sfixed32":c="number",h=this.checkNumberRange(o,maxFourBytesPos,maxFourBytesNeg,l,u);break;case"uint64":c="number",h=this.checkNumberRange(o,maxEightBytesUnsigned,0,l,u);break;case"fixed64":case"sfixed64":case"int64":case"sint64":c="number",h=this.checkNumberRange(o,maxEightBytesPos,maxEightBytesNeg,l,u);break;case"double":case"float":c="number",Number.isFinite(o)||(h=`Schema ${l} on field: ${u}. Value must be finite`);break;default:const p={},d=Object.keys(a);for(const o in d)p[d[o].toLowerCase()]=d[o];p[s.toLowerCase()]&&(h=this.validateFields(o,a[p[s.toLowerCase()]],a,l),c="object")}const d=(o+"").length;return typeof o!==c?`Schema ${l} on field: ${u}. Expected type ${s} but received type ${typeof o}`:d<minFieldLength||d>maxFieldLength?`Schema ${l} on field: ${u}, exceeded maximum or minimum field length`:h||void 0}checkNumberRange(o,s,a,l,u){if(o>s||o<a)return`Schema ${l} on field: ${u}, number value is too large or small`}}const logValidator=new LogValidator;class UpCounterImpl{constructor(o,s,a,l){this._name=o,this._ownerName=s,this._ownerAppName=a,this._tags=l,this._value=0,this._createdOn=utility.time().tsNow}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this._value}increment(o=1){if("number"==typeof o&&o>0)return this._value+=Math.round(o),void(this._lastUpdatedOn=utility.time().tsNow);throw new Error("UpCounter can only increment positive numbers.")}reset(){this._lastUpdatedOn=void 0,this._value=0}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class ValueRecorderImpl{constructor(o,s,a,l){this._name=o,this._ownerName=s,this._ownerAppName=a,this._tags=l,this._values=new Array,this._createdOn=utility.time().tsNow}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this.values}get values(){return this._values.slice(0,this._values.length)}record(o){if("number"==typeof o)return this._values.push(o),void(this._lastUpdatedOn=utility.time().tsNow);throw new Error("ValueRecorder can only record numbers.")}reset(){this._lastUpdatedOn=void 0,this._values=[]}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class SizeLimitedMap{constructor(o){if(this._map=new Map,!("number"==typeof o&&o>0))throw new Error("maxSize must be a positive number");this._maxSize=Math.ceil(o)}get maxSize(){return this._maxSize}get(o){return this._map.get(o)}has(o){return this._map.has(o)}set(o,s){return!!(this.has(o)||this._map.size<this.maxSize)&&(this._map.set(o,s),!0)}getElements(){return Array.from(this._map.values())}clear(){this._map.clear()}}const maxCounters=1e3,maxValueRecorders=500;var MetricType;!function(o){o[o.Counter=0]="Counter",o[o.Percentile=1]="Percentile"}(MetricType||(MetricType={}));class MetricsImpl{constructor(o,s){this._ownerName=o,this._getOwnerAppName=s,this._upCounters=new SizeLimitedMap(maxCounters),this._valueRecorders=new SizeLimitedMap(maxValueRecorders)}incrementCounter(o,s,a=!1,l={}){this._tagError(l,a),this._upCounter(o,l).increment(s)}trackValue(o,s,a=!1,l={}){this._tagError(l,a),this._valueRecorder(o,l).record(s)}_upCounter(o,s){const{key:a,sortedTags:l}=this._getKeyAndSortedTags(o,s,MetricType.Counter);let u=this._upCounters.get(a);if(!u&&(u=new UpCounterImpl(o,this._ownerName,this._getOwnerAppName(),l),!this._upCounters.set(a,u)))throw new Error(`Max size of ${maxCounters} exceeeded for UpCounters`);return u}_valueRecorder(o,s){const{key:a,sortedTags:l}=this._getKeyAndSortedTags(o,s,MetricType.Percentile);let u=this._valueRecorders.get(a);if(!u&&(u=new ValueRecorderImpl(o,this._ownerName,this._getOwnerAppName(),l),!this._valueRecorders.set(a,u)))throw new Error(`Max size of ${maxValueRecorders} exceeeded for ValueRecorders`);return u}getUpCounters(){return this._upCounters.getElements()}getValueRecorders(){return this._valueRecorders.getElements()}_tagError(o,s){o.status=!0===s?"error":"success"}_getKeyAndSortedTags(o,s,a){const l=Object.keys(s).sort().reduce(((o,a)=>(o[a]=s[a],o)),{});return{key:`${MetricType[a]}:${o}${JSON.stringify(l)}`,sortedTags:l}}}class MockEvent{constructor(o,s,a){this.type=o,this.composed=s,this._composedPaths=a}composedPath(){return this._composedPaths}}const maxActivityDurationMsecs=void 0,reservedMetricCharacters=["`"],reservedMetricNames={internalError:"o11y-error"},denyListMetricNames=Object.freeze(Array.from(Object.values(reservedMetricNames)));class InstrumentationImpl{constructor(o,s){this._nextGen=o,this._name=s,this._onActivityStoppedCallback=this._handleActivityStop.bind(this),this._onActivityErrorCallback=this._handleActivityError.bind(this);for(const o of reservedMetricCharacters)if(this._name.indexOf(o)>=0)throw new Error(`Name cannot include the reserved character "${o}"`);this._safety=new PublicSafety({increment:o=>this._incrementError(o)}),this._metrics=this._initMetrics();const a=schemaUtil.getOptions(simple,"Simple","text");this._simpleTextMaxLength=a?a["(meta.max_length)"]:Number.MAX_VALUE}_initMetrics(){return new MetricsImpl(this.name,(()=>this._nextGen.appName||InstrumentationImpl.defaultAppName))}_incrementError(o=1){this._metrics.incrementCounter(reservedMetricNames.internalError,o,!1)}get name(){return this._name}_wrapUserPayload(o,s,a=!1){let l;return"string"==typeof o?(l=simple,s=o?{text:o.substr(0,this._simpleTextMaxLength)}:void 0):l=o,schemaUtil.makePayload(l,s,a)}log(o,s){this._safety.tryCatch((()=>{const a=utility.time().tsNow;utility.requireArgument(o,"userSchemaOrText",["object","string"]);const l=this._wrapUserPayload(o,s);l&&l.payload&&this._logInternal(this.name,l.schema,l.payload,a,this._nextGen.getRootActivityId())}))}_logInternal(o,s,a,l,u){this._checkInputs(s,a);const p=this._getPayloadFromProvider(this._nextGen.appPayloadProvider),c=this._getPayloadFromProvider(this._nextGen.pagePayloadProvider);return this._nextGen.addLog(o,s,a,l,u,c,p)}error(o,s,a){return this._safety.tryCatch((()=>this._errorInternal(o,s,a,void 0)))}_errorInternal(o,s,a,l){const u=utility.time().tsNow;utility.requireArgument(o,"error",[Error,"string"]),"string"==typeof o&&(o=new Error(o));const p=this._wrapUserPayload(s,a,!0),c={name:o.name,message:o.message,stack:o.stack,userPayload:p,activityId:l};return this._logInternal(this.name,error,c,u,this._nextGen.getRootActivityId())}startActivity(o){return this._safety.tryCatchReturn((()=>{utility.requireArgument(o,"name");return new ActivityImpl(o,this._nextGen.getRootActivityId(),this._onActivityStoppedCallback,this._onActivityErrorCallback,maxActivityDurationMsecs,void 0,this._nextGen.isRootActivitySampled())}),activityNoOp)}_getActivityData(o){const s=this._wrapUserPayload(o.userSchemaOrText,o.userData,!0);return{id:o.id,name:o.name,duration:o.stopPerfTime-o.startPerfTime,stopReason:o.stopReason,userPayload:s,errorCount:o.errorCount,isSampled:o.isSampled}}_handleActivityStop(o){if(o.stopReason===discarded)return;const s=this._getActivityData(o);this._logActivity(s,o.startTimestamp,o.rootId)}_logActivity(o,s,a){this._logInternal(this.name,activity,o,s,a)}_handleActivityError(o,s){this._errorInternal(o,s.userSchemaOrText,s.userData,s.id)}_getPayloadFromProvider(o){if(o){const s=o.getPayload();if(s)return this._checkInputs(s.schema,s.payload),s}}domEvent(o,s,a,l,u){this._safety.tryCatch((()=>{const p=utility.time().tsNow;let c;utility.requireArgument(o,"event",[Event,MockEvent]),utility.requireArgument(s,"handledBy",[HTMLElement,"object"]),s instanceof HTMLElement?c=s:(s=s).template&&s.template.host instanceof HTMLElement?c=s.template.host:utility.requireArgument(void 0,"handledBy");const h=this._wrapUserPayload(a,l,!0);switch(o.type){case"click":{const s=o,a=this._nextGen.getClickTracker();a&&a.markEventHandled(s);const l=domEventHelpers.getMouseEventData(s),d=domEventHelpers.getInstrumentedEventData(l,c,h);d.auto=u,this._logInternal(this.name,instrumented_event,d,p,this._nextGen.getRootActivityId());break}default:throw new Error(utility.notImplemented)}}))}incrementCounter(o,s=1,a=!1,l={}){this._safety.tryCatch((()=>{utility.requireArgument(o,"operation","string"),utility.checkForDenyListedValues(o,"operation",denyListMetricNames),utility.checkForReservedCharacters(o,"operation",reservedMetricCharacters),utility.requireArgument(s,"increment","number"),utility.requireArgument(a,"hasError","boolean"),utility.requireArgument(l,"tags","object"),Object.entries(l).forEach((o=>{utility.requireArgument(o[1],`Tag value for '${o[0]}'`,["string","number","boolean"])})),this._metrics.incrementCounter(o,s,a,l)}))}trackValue(o,s,a=!1,l={}){this._safety.tryCatch((()=>{utility.requireArgument(o,"operation","string"),utility.checkForDenyListedValues(o,"operation",denyListMetricNames),utility.checkForReservedCharacters(o,"operation",reservedMetricCharacters),utility.requireArgument(s,"value","number"),utility.requireArgument(a,"hasError","boolean"),utility.requireArgument(l,"tags","object"),Object.entries(l).forEach((o=>{utility.requireArgument(o[1],`Tag value for '${o[0]}'`,["string","number","boolean"])})),this._metrics.trackValue(o,s,a,l)}))}_checkInputs(o,s){let a;schemaUtil.checkSchema(o),utility.requireArgument(s,"data","object"),void 0!==s.userPayload&&schemaUtil.isInternal(o)&&(a=s.userPayload,logValidator.validate(a.schema,a.payload),s.userPayload=void 0),logValidator.validate(o,s),void 0!==a&&(s.userPayload=a)}getUpCounters(){return this._metrics.getUpCounters().filter((o=>o.getLastUpdatedOn()))}getValueRecorders(){return this._metrics.getValueRecorders().filter((o=>o.getLastUpdatedOn()))}}InstrumentationImpl.defaultAppName="APP_NOT_REGISTERED";class RootActivityImpl extends ActivityImpl{constructor(o,s,a,l,u){super(o,void 0,s,a,void 0,l||utility.generateUniqueId(32),u)}get preRootId(){return this._preRootId}set preRootId(o){this._preRootId=o}_getDetail(o,s){const a=super._getDetail(o,s);return a.isRoot=!0,a.preRootId=this.preRootId,a}}const rootId=new Array(32).fill(0).join("");class RootActivityNoOp{getId(){return rootId}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(o){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}}const rootActivityNoOp=Object.freeze(new RootActivityNoOp);class AppInstrumentationImpl extends InstrumentationImpl{constructor(){super(...arguments),this._onRootActivityStoppedCallback=this.handleRootActivityStop.bind(this)}startRootActivity(o,s,a){return this._safety.tryCatchReturn((()=>{utility.requireArgument(o,"name");const l=new RootActivityImpl(o,this._onRootActivityStoppedCallback,this._onActivityErrorCallback,s,a);if(this.rootActivity&&!this.rootActivity.isStopped){const o=this.rootActivity.getId();this.rootActivity.terminate(),l.preRootId=o}return this.rootActivity=l,this.rootActivity}),rootActivityNoOp)}handleRootActivityStop(o){if(o.stopReason===discarded)return;const s=this._getActivityData(o);this._logActivity(s,o.startTimestamp),this.rootActivity=void 0}_getActivityData(o){const s=super._getActivityData(o);return s.isRoot=o.isRoot,s.preRootId=o.preRootId,s}getRootActivityId(){return this.rootActivity&&this.rootActivity.getId()}isRootActivitySampled(){return this.rootActivity&&this.rootActivity.getIsSampled()}_initMetrics(){return new MetricsImpl(this.name,(()=>this.name))}}const pathLimit=5;class AutomaticClickTracker{constructor(o,s){this.isActive=!1,this._boundClickListener=this.clickListener.bind(this),utility.requireArgument(o,"instrumentation"),utility.requireArgument(s,"document"),this.instr=o,this.document=s}activate(){this.isActive||(this.document.addEventListener("click",this._boundClickListener,!0),this.isActive=!0)}deactivate(){this.isActive&&(this.document.removeEventListener("click",this._boundClickListener,!0),this.isActive=!1)}markEventHandled(o){this.ignoredEvent=o}clickListener(o){let s=o.composedPath&&o.composedPath();s&&s.length||(s=o.path);const a=this.getClickableElement(s);a&&setTimeout((()=>{o!==this.ignoredEvent&&this.instr.domEvent(o,a,void 0,void 0,!0)}))}getClickableElement(o){const s=o?Math.min(o.length,pathLimit):0;for(let a=0;a<s;a+=1){const s=o[a],l=s.tagName&&s.tagName.toLowerCase();if("a"===l||"button"===l)return s;if("input"===l){const o=s;if(o.type&&"button"===o.type.toLowerCase())return o}}}}const maxInstrumentationLength=80,truncatedText="_CUT",maxInstrumentationLengthBeforeTruncated=maxInstrumentationLength-truncatedText.length;class NextgenImpl{constructor(){this._logCollectors=new Set,this._instruments=new Map,this._sequence=0,this._forceDisabledLogCollectors=new Set,this._logCollectorFailures=new Map,this._isBufferingEnabled=!1,this._buffer=[]}get pagePayloadProvider(){return this._pagePayloadProvider}set pagePayloadProvider(o){this._pagePayloadProvider=o}get appPayloadProvider(){return this._appPayloadProvider}set appPayloadProvider(o){this._appPayloadProvider=o}registerApp(o,s){if(utility.requireArgument(o,"name","string"),this._appInstr)throw new Error("An app has already been registered with instrumentation.");if(this._instruments.get(o))throw new Error(`The instrumentation name ${o} is already taken`);this._appInstr=new AppInstrumentationImpl(this,o),this._instruments.set(o,this._appInstr),this._isBufferingEnabled=s;const a=new Tracing(this._appInstr);return{log:this._appInstr.log.bind(this._appInstr),error:this._appInstr.error.bind(this._appInstr),startActivity:this._appInstr.startActivity.bind(this._appInstr),domEvent:this._appInstr.domEvent.bind(this._appInstr),incrementCounter:this._appInstr.incrementCounter.bind(this._appInstr),trackValue:this._appInstr.trackValue.bind(this._appInstr),networkInstrumentation:a.networkInstrumentation.bind(a),startRootActivity:this._appInstr.startRootActivity.bind(this._appInstr),registerLogCollector:this.registerLogCollector.bind(this),registerMetricsCollector:this.registerMetricsCollector.bind(this),activateClickTracker:this.activateClickTracker.bind(this),deactivateClickTracker:this.deactivateClickTracker.bind(this),disableBuffering:this.disableBuffering.bind(this)}}getInstrumentation(o){utility.requireArgument(o,"name","string"),o.length>maxInstrumentationLength&&(o=o.substr(0,maxInstrumentationLengthBeforeTruncated)+truncatedText);let s=this._instruments.get(o);if(s){if(s===this._appInstr)throw new Error(`The instrumentation name ${o} is being used by the app.`)}else s=new InstrumentationImpl(this,o),this._instruments.set(o,s);return s}get appName(){return this._appInstr&&this._appInstr.name}addLog(o,s,a,l,u,p,c){this._sequence+=1;const h={timestamp:l,rootId:u,sequence:this._sequence,loggerName:o,pagePayload:p,appPayload:c,loggerAppName:this.appName,connectionType:utility.getConnectionType()};this._isBufferingEnabled&&this._buffer.push({schema:s,data:utility.clone(a),logMeta:h});for(const o of this._logCollectors){const l=utility.clone(a),u=this._logCollectorFailures.get(o);try{this._forceDisabledLogCollectors.has(o)||o.getIsCollectDisabled&&o.getIsCollectDisabled()||(o.collect(s,l,h),u>0&&this._logCollectorFailures.set(o,u-1))}catch(s){u>=NextgenImpl._collectorFailureLimit&&!this._forceDisabledLogCollectors.has(o)?this._forceDisabledLogCollectors.add(o):this._logCollectorFailures.set(o,u+1)}}return this._sequence}getBuffer(){return this._buffer}disableBuffering(){this._isBufferingEnabled=!1,this._buffer=[]}getClickTracker(){return this._autoClickTracker}getRootActivityId(){return this._appInstr&&this._appInstr.getRootActivityId()}isRootActivitySampled(){return this._appInstr&&this._appInstr.isRootActivitySampled()}activateClickTracker(){this._autoClickTracker||(this._autoClickTracker=new AutomaticClickTracker(this._appInstr,window.document)),this._autoClickTracker.activate()}deactivateClickTracker(){this._autoClickTracker&&(this._autoClickTracker.deactivate(),this._autoClickTracker=void 0)}registerLogCollector(o,s){if(utility.requireArgument(o,"collector"),this._logCollectors.add(o),this._logCollectorFailures.set(o,0),(!o.getIsCollectDisabled||!o.getIsCollectDisabled())&&s&&s.retroactive)for(const s of this._buffer)o.collect(s.schema,s.data,s.logMeta)}registerMetricsCollector(o){if(utility.requireArgument(o,"collector"),this._metricsCollector)throw new Error("A metrics Collector is already registered.");this._metricsCollector=o,this._metricsCollector.receiveMetricsExtractors({getAllUpCounters:this.getAllUpCounters.bind(this),getAllValueRecorders:this.getAllValueRecorders.bind(this)})}getAllUpCounters(){return Array.from(this._instruments.values()).map((o=>o.getUpCounters())).reduce(((o,s)=>o.concat(s)),[])}getAllValueRecorders(){return Array.from(this._instruments.values()).map((o=>o.getValueRecorders())).reduce(((o,s)=>o.concat(s)),[])}}NextgenImpl._collectorFailureLimit=5;class Index{get _lazyNextGen(){return this._nextgen||(this._nextgen=new NextgenImpl),this._nextgen}registerInstrumentedApp(o,s){s&&s.isProduction&&utility.markProduction();const a=this._lazyNextGen.registerApp(o,s&&s.enableBuffering);return s&&(this._nextgen.appPayloadProvider=s.appPayloadProvider,this._nextgen.pagePayloadProvider=s.pagePayloadProvider),a}getInstrumentation(o){return this._lazyNextGen.getInstrumentation(o)}}const index=new Index;index.registerInstrumentedApp.bind(index);const getInstrumentation=index.getInstrumentation.bind(index);utility.time.bind(utility);const maxUniqueSchemas=1e4,maxDelay_msecs=1e4,uploadThreshold_items=10,formDataKey="telemetry";var UploadMode;!function(o){o[o.fetchBinary=0]="fetchBinary",o[o.fetchFile=1]="fetchFile",o[o.noUpload=2]="noUpload"}(UploadMode||(UploadMode={}));class CoreCollector{constructor(o,s,a){if(this._apiEndpoint=o,this._uploadMode=s,this.environment=a,this._messageBuffers=new LazyMapToList(maxUniqueSchemas),this._instr=getInstrumentation("CoreCollector"),o){if(void 0===s)this._uploadMode=UploadMode.fetchBinary;else if(!(s in UploadMode))throw new Error(`Unsupported upload mode: ${s}`)}else this._uploadMode=UploadMode.noUpload;const l=__protobufjs.Root.fromJSON(core_envelope.pbjsSchema);this._coreEnvelopeType=l.lookupType("CoreEnvelope"),a&&(this._staticAttributes={appName:a.appName,appVersion:a.appVersion,appExperience:a.appExperience,deviceId:a.deviceId,deviceModel:a.deviceModel,sdkVersion:a.sdkVersion})}getIsCollectDisabled(){return this._isFull()}getProtoEncodedCoreEnvelope(){return this._getProtoEncodedCoreEnvelope()}getByteSize(){return this._messageBuffers.byteSizeOfValues}_isFull(){return this._messageBuffers.totalItemCount===this._messageBuffers.maxSize}_stopTimer(){void 0!==this._intervalHandle&&clearInterval(this._intervalHandle)}_restartTimer(){this._stopTimer(),this._intervalHandle=setInterval((()=>{this._upload()}),maxDelay_msecs)}collect(o,s,a){const l=0===this._messageBuffers.totalItemCount;schemaUtil.isInternal(o)&&s.userPayload&&(s.userPayload=protobufUtil.encodePayload(s.userPayload)),this._messageBuffers.push(o,protobufUtil.getLogMessage(o,s,a))?l&&this._restartTimer():(this._instr.error(new Error("Buffer is full"),schemaUtil.getSchemaId(o)),this._stopTimer(),this._upload()),!this.getIsCollectDisabled()&&this._shouldUpload()&&(this._stopTimer(),this._upload())}_shouldUpload(){return this._immediateUpload||this._messageBuffers.totalItemCount>=uploadThreshold_items}async _upload(){try{if(this._uploadMode===UploadMode.noUpload)return;const o=this._getProtoEncodedCoreEnvelope();if(!o)return;let s;switch(this._uploadMode){case UploadMode.fetchBinary:s={method:"POST",headers:{"Content-Type":"application/octet-stream"},body:o};break;case UploadMode.fetchFile:const a=new FormData;a.append(formDataKey,new Blob([o])),s={method:"POST",body:a}}s&&await fetch(this._apiEndpoint,s)}catch(o){this._instr.error(o)}}_getProtoEncodedCoreEnvelope(){if(!this._messageBuffers.totalItemCount)return;const o=(new CoreEnvelopeBuilder).withStaticAttributes(this._staticAttributes);this._messageBuffers.extractAllMessages().forEach(((s,a)=>{o.withLogs(schemaUtil.getSchemaId(a),s)})),this._metricsExtractors&&o.withUpCounters(this._metricsExtractors.getAllUpCounters()).withValueRecorders(this._metricsExtractors.getAllValueRecorders());const s=o.build(),a=this._coreEnvelopeType.verify(s);if(a)throw new Error(`Invalid CoreEnvelope: ${a}`);return this._coreEnvelopeType.encode(s).finish()}receiveMetricsExtractors(o){this._metricsExtractors=o}}const metricsCollectionMilliseconds=3e4;class HybridCollector{constructor(){if("undefined"==typeof __nimbus)throw new Error("Nimbus is unavailable");if(!__nimbus.plugins||!__nimbus.plugins.observability)throw new Error("Observability plugin not found in Nimbus plugins");this._observability=__nimbus.plugins.observability,setInterval((()=>{this._collectMetrics()}),metricsCollectionMilliseconds)}collect(o,s,a){schemaUtil.isInternal(o)&&s.userPayload&&(s.userPayload=protobufUtil.encodePayload(s.userPayload));const l=protobufUtil.getLogMessage(o,s,a),u={timestamp:a.timestamp,rootId:a.rootId,sequence:a.sequence,loggerName:a.loggerName,pagePayload:l.pagePayload,loggerAppName:a.loggerAppName,connectionType:a.connectionType,appPayload:l.appPayload};this._observability.log(schemaUtil.getSchemaId(o),l.data,u)}receiveMetricsExtractors(o){this._metricsExtractors=o}addRootActivityListeners(o,s){utility.requireArgument(o,"activityStarted","function"),utility.requireArgument(s,"activityEnded","function"),this._observability.addRootActivityListeners(o,s)}notifyIdleDetected(o){this._observability.idleDetected(o)}_collectMetrics(){if(this._metricsExtractors){const o=this._metricsExtractors.getAllUpCounters(),s=this._metricsExtractors.getAllValueRecorders(),a=[],l=[];for(const o of s){const s={name:o.getName(),createdTimestamp:o.getCreatedOn(),lastUpdatedTimestamp:o.getLastUpdatedOn(),values:o.getData(),ownerName:o.getOwnerName(),ownerAppName:o.getOwnerAppName(),tags:this._getMetricTags(o)};a.push(s),o.reset()}for(const s of o){const o={name:s.getName(),createdTimestamp:s.getCreatedOn(),lastUpdatedTimestamp:s.getLastUpdatedOn(),value:s.getData(),ownerName:s.getOwnerName(),ownerAppName:s.getOwnerAppName(),tags:this._getMetricTags(s)};l.push(o),s.reset()}if(a.length>0||l.length>0){const o={upCounters:l,valueRecorders:a};this._observability.logMetrics(o)}}}_getMetricTags(o){const s=o.getTags();return s?Object.entries(s).map((o=>({name:o[0],value:o[1].toString()}))):[]}}export{CoreCollector,HybridCollector};
|
|
7
|
+
var __protobufjs;!function(g){var r,e,t;r={1:[function(o,s){s.exports=function(o,s){for(var a=Array(arguments.length-1),l=0,u=2,p=!0;u<arguments.length;)a[l++]=arguments[u++];return new Promise((function(u,c){a[l]=function(o){if(p)if(p=!1,o)c(o);else{for(var s=Array(arguments.length-1),a=0;a<s.length;)s[a++]=arguments[a];u.apply(null,s)}};try{o.apply(s||null,a)}catch(o){p&&(p=!1,c(o))}}))}},{}],2:[function(o,s,a){var l=a;l.length=function(o){var s=o.length;if(!s)return 0;for(var a=0;1<--s%4&&"="==o[0|s];)++a;return Math.ceil(3*o.length)/4-a};for(var u=Array(64),p=Array(123),c=0;c<64;)p[u[c]=c<26?c+65:c<52?c+71:c<62?c-4:c-59|43]=c++;l.encode=function(o,s,a){for(var l,p=null,c=[],h=0,d=0;s<a;){var f=o[s++];switch(d){case 0:c[h++]=u[f>>2],l=(3&f)<<4,d=1;break;case 1:c[h++]=u[l|f>>4],l=(15&f)<<2,d=2;break;case 2:c[h++]=u[l|f>>6],c[h++]=u[63&f],d=0}8191<h&&((p=p||[]).push(String.fromCharCode.apply(String,c)),h=0)}return d&&(c[h++]=u[l],c[h++]=61,1===d&&(c[h++]=61)),p?(h&&p.push(String.fromCharCode.apply(String,c.slice(0,h))),p.join("")):String.fromCharCode.apply(String,c.slice(0,h))};var h="invalid encoding";l.decode=function(o,s,a){for(var l,u=a,c=0,d=0;d<o.length;){var f=o.charCodeAt(d++);if(61===f&&1<c)break;if((f=p[f])===g)throw Error(h);switch(c){case 0:l=f,c=1;break;case 1:s[a++]=l<<2|(48&f)>>4,l=f,c=2;break;case 2:s[a++]=(15&l)<<4|(60&f)>>2,l=f,c=3;break;case 3:s[a++]=(3&l)<<6|f,c=0}}if(1===c)throw Error(h);return a-u},l.test=function(o){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o)}},{}],3:[function(o,s){(s.exports=function o(s,a){"string"==typeof s&&(a=s,s=g);var l=[];function u(s){if("string"!=typeof s){var a=p();if(o.verbose&&console.log("codegen: "+a),a="return "+a,s){for(var c=Object.keys(s),h=Array(c.length+1),d=Array(c.length),f=0;f<c.length;)h[f]=c[f],d[f]=s[c[f++]];return h[f]=a,Function.apply(null,h).apply(null,d)}return Function(a)()}for(var m=Array(arguments.length-1),y=0;y<m.length;)m[y]=arguments[++y];if(y=0,s=s.replace(/%([%dfijs])/g,(function(o,s){var a=m[y++];switch(s){case"d":case"f":return+a+"";case"i":return Math.floor(a)+"";case"j":return JSON.stringify(a);case"s":return a+""}return"%"})),y!==m.length)throw Error("parameter count mismatch");return l.push(s),u}function p(o){return"function "+(o||a||"")+"("+(s&&s.join(",")||"")+"){\n "+l.join("\n ")+"\n}"}return u.toString=p,u}).verbose=!1},{}],4:[function(o,s){function a(){this.t={}}(s.exports=a).prototype.on=function(o,s,a){return(this.t[o]||(this.t[o]=[])).push({fn:s,ctx:a||this}),this},a.prototype.off=function(o,s){if(o===g)this.t={};else if(s===g)this.t[o]=[];else for(var a=this.t[o],l=0;l<a.length;)a[l].fn===s?a.splice(l,1):++l;return this},a.prototype.emit=function(o){var s=this.t[o];if(s){for(var a=[],l=1;l<arguments.length;)a.push(arguments[l++]);for(l=0;l<s.length;)s[l].fn.apply(s[l++].ctx,a)}return this}},{}],5:[function(o,s){s.exports=u;var a=o(1),l=o(7)("fs");function u(o,s,p){return s="function"==typeof s?(p=s,{}):s||{},p?!s.xhr&&l&&l.readFile?l.readFile(o,(function(a,l){return a&&"undefined"!=typeof XMLHttpRequest?u.xhr(o,s,p):a?p(a):p(null,s.binary?l:l.toString("utf8"))})):u.xhr(o,s,p):a(u,this,o,s)}u.xhr=function(o,s,a){var l=new XMLHttpRequest;l.onreadystatechange=function(){if(4!==l.readyState)return g;if(0!==l.status&&200!==l.status)return a(Error("status "+l.status));if(s.binary){var o=l.response;if(!o){o=[];for(var u=0;u<l.responseText.length;++u)o.push(255&l.responseText.charCodeAt(u))}return a(null,"undefined"!=typeof Uint8Array?new Uint8Array(o):o)}return a(null,l.responseText)},s.binary&&("overrideMimeType"in l&&l.overrideMimeType("text/plain; charset=x-user-defined"),l.responseType="arraybuffer"),l.open("GET",o),l.send()}},{1:1,7:7}],6:[function(o,s){function a(o){function s(o,s,a,l){var u=s<0?1:0;if(u&&(s=-s),0===s)o(0<1/s?0:2147483648,a,l);else if(isNaN(s))o(2143289344,a,l);else if(34028234663852886e22<s)o((u<<31|2139095040)>>>0,a,l);else if(s<11754943508222875e-54)o((u<<31|Math.round(s/1401298464324817e-60))>>>0,a,l);else{var p=Math.floor(Math.log(s)/Math.LN2);o((u<<31|127+p<<23|8388607&Math.round(s*Math.pow(2,-p)*8388608))>>>0,a,l)}}function a(o,s,a){var l=o(s,a),u=2*(l>>31)+1,p=l>>>23&255,c=8388607&l;return 255==p?c?NaN:1/0*u:0==p?1401298464324817e-60*u*c:u*Math.pow(2,p-150)*(8388608+c)}function h(o,s,a){y[0]=o,s[a]=v[0],s[a+1]=v[1],s[a+2]=v[2],s[a+3]=v[3]}function d(o,s,a){y[0]=o,s[a]=v[3],s[a+1]=v[2],s[a+2]=v[1],s[a+3]=v[0]}function f(o,s){return v[0]=o[s],v[1]=o[s+1],v[2]=o[s+2],v[3]=o[s+3],y[0]}function m(o,s){return v[3]=o[s],v[2]=o[s+1],v[1]=o[s+2],v[0]=o[s+3],y[0]}var y,v,b,_,w,A;function T(o,s,a,l,u,p){var c=l<0?1:0;if(c&&(l=-l),0===l)o(0,u,p+s),o(0<1/l?0:2147483648,u,p+a);else if(isNaN(l))o(0,u,p+s),o(2146959360,u,p+a);else if(17976931348623157e292<l)o(0,u,p+s),o((c<<31|2146435072)>>>0,u,p+a);else{var h;if(l<22250738585072014e-324)o((h=l/5e-324)>>>0,u,p+s),o((c<<31|h/4294967296)>>>0,u,p+a);else{var d=Math.floor(Math.log(l)/Math.LN2);1024===d&&(d=1023),o(4503599627370496*(h=l*Math.pow(2,-d))>>>0,u,p+s),o((c<<31|d+1023<<20|1048576*h&1048575)>>>0,u,p+a)}}}function O(o,s,a,l,u){var p=o(l,u+s),c=o(l,u+a),h=2*(c>>31)+1,d=c>>>20&2047,f=4294967296*(1048575&c)+p;return 2047==d?f?NaN:1/0*h:0==d?5e-324*h*f:h*Math.pow(2,d-1075)*(f+4503599627370496)}function k(o,s,a){_[0]=o,s[a]=w[0],s[a+1]=w[1],s[a+2]=w[2],s[a+3]=w[3],s[a+4]=w[4],s[a+5]=w[5],s[a+6]=w[6],s[a+7]=w[7]}function S(o,s,a){_[0]=o,s[a]=w[7],s[a+1]=w[6],s[a+2]=w[5],s[a+3]=w[4],s[a+4]=w[3],s[a+5]=w[2],s[a+6]=w[1],s[a+7]=w[0]}function E(o,s){return w[0]=o[s],w[1]=o[s+1],w[2]=o[s+2],w[3]=o[s+3],w[4]=o[s+4],w[5]=o[s+5],w[6]=o[s+6],w[7]=o[s+7],_[0]}function x(o,s){return w[7]=o[s],w[6]=o[s+1],w[5]=o[s+2],w[4]=o[s+3],w[3]=o[s+4],w[2]=o[s+5],w[1]=o[s+6],w[0]=o[s+7],_[0]}return"undefined"!=typeof Float32Array?(y=new Float32Array([-0]),b=128===(v=new Uint8Array(y.buffer))[3],o.writeFloatLE=b?h:d,o.writeFloatBE=b?d:h,o.readFloatLE=b?f:m,o.readFloatBE=b?m:f):(o.writeFloatLE=s.bind(null,l),o.writeFloatBE=s.bind(null,u),o.readFloatLE=a.bind(null,p),o.readFloatBE=a.bind(null,c)),"undefined"!=typeof Float64Array?(_=new Float64Array([-0]),A=128===(w=new Uint8Array(_.buffer))[7],o.writeDoubleLE=A?k:S,o.writeDoubleBE=A?S:k,o.readDoubleLE=A?E:x,o.readDoubleBE=A?x:E):(o.writeDoubleLE=T.bind(null,l,0,4),o.writeDoubleBE=T.bind(null,u,4,0),o.readDoubleLE=O.bind(null,p,0,4),o.readDoubleBE=O.bind(null,c,4,0)),o}function l(o,s,a){s[a]=255&o,s[a+1]=o>>>8&255,s[a+2]=o>>>16&255,s[a+3]=o>>>24}function u(o,s,a){s[a]=o>>>24,s[a+1]=o>>>16&255,s[a+2]=o>>>8&255,s[a+3]=255&o}function p(o,s){return(o[s]|o[s+1]<<8|o[s+2]<<16|o[s+3]<<24)>>>0}function c(o,s){return(o[s]<<24|o[s+1]<<16|o[s+2]<<8|o[s+3])>>>0}s.exports=a(a)},{}],7:[function(t,i,n){function r(t){try{var i=eval("require")(t);if(i&&(i.length||Object.keys(i).length))return i}catch(t){}return null}i.exports=r},{}],8:[function(o,s,a){var l=a,u=l.isAbsolute=function(o){return/^(?:\/|\w+:)/.test(o)},p=l.normalize=function(o){var s=(o=o.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),a=u(o),l="";a&&(l=s.shift()+"/");for(var p=0;p<s.length;)".."===s[p]?0<p&&".."!==s[p-1]?s.splice(--p,2):a?s.splice(p,1):++p:"."===s[p]?s.splice(p,1):++p;return l+s.join("/")};l.resolve=function(o,s,a){return a||(s=p(s)),u(s)?s:(a||(o=p(o)),(o=o.replace(/(?:\/|^)[^/]+$/,"")).length?p(o+"/"+s):s)}},{}],9:[function(o,s){s.exports=function(o,s,a){var l=a||8192,u=l>>>1,p=null,c=l;return function(a){if(a<1||u<a)return o(a);l<c+a&&(p=o(l),c=0);var h=s.call(p,c,c+=a);return 7&c&&(c=1+(7|c)),h}}},{}],10:[function(o,s,a){var l=a;l.length=function(o){for(var s=0,a=0,l=0;l<o.length;++l)(a=o.charCodeAt(l))<128?s+=1:a<2048?s+=2:55296==(64512&a)&&56320==(64512&o.charCodeAt(l+1))?(++l,s+=4):s+=3;return s},l.read=function(o,s,a){if(a-s<1)return"";for(var l,u=null,p=[],c=0;s<a;)(l=o[s++])<128?p[c++]=l:191<l&&l<224?p[c++]=(31&l)<<6|63&o[s++]:239<l&&l<365?(l=((7&l)<<18|(63&o[s++])<<12|(63&o[s++])<<6|63&o[s++])-65536,p[c++]=55296+(l>>10),p[c++]=56320+(1023&l)):p[c++]=(15&l)<<12|(63&o[s++])<<6|63&o[s++],8191<c&&((u=u||[]).push(String.fromCharCode.apply(String,p)),c=0);return u?(c&&u.push(String.fromCharCode.apply(String,p.slice(0,c))),u.join("")):String.fromCharCode.apply(String,p.slice(0,c))},l.write=function(o,s,a){for(var l,u,p=a,c=0;c<o.length;++c)(l=o.charCodeAt(c))<128?s[a++]=l:(l<2048?s[a++]=l>>6|192:(55296==(64512&l)&&56320==(64512&(u=o.charCodeAt(c+1)))?(l=65536+((1023&l)<<10)+(1023&u),++c,s[a++]=l>>18|240,s[a++]=l>>12&63|128):s[a++]=l>>12|224,s[a++]=l>>6&63|128),s[a++]=63&l|128);return a-p}},{}],11:[function(o,s,a){var l=a,u=o(14),p=o(33);function c(o,s,a,l){if(s.resolvedType)if(s.resolvedType instanceof u){o("switch(d%s){",l);for(var p=s.resolvedType.values,c=Object.keys(p),h=0;h<c.length;++h)s.repeated&&p[c[h]]===s.typeDefault&&o("default:"),o("case%j:",c[h])("case %i:",p[c[h]])("m%s=%j",l,p[c[h]])("break");o("}")}else o('if(typeof d%s!=="object")',l)("throw TypeError(%j)",s.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",l,a,l);else{var d=!1;switch(s.type){case"double":case"float":o("m%s=Number(d%s)",l,l);break;case"uint32":case"fixed32":o("m%s=d%s>>>0",l,l);break;case"int32":case"sint32":case"sfixed32":o("m%s=d%s|0",l,l);break;case"uint64":d=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",l,l,d)('else if(typeof d%s==="string")',l)("m%s=parseInt(d%s,10)",l,l)('else if(typeof d%s==="number")',l)("m%s=d%s",l,l)('else if(typeof d%s==="object")',l)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",l,l,l,d?"true":"");break;case"bytes":o('if(typeof d%s==="string")',l)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",l,l,l)("else if(d%s.length)",l)("m%s=d%s",l,l);break;case"string":o("m%s=String(d%s)",l,l);break;case"bool":o("m%s=Boolean(d%s)",l,l)}}return o}function h(o,s,a,l){if(s.resolvedType)s.resolvedType instanceof u?o("d%s=o.enums===String?types[%i].values[m%s]:m%s",l,a,l,l):o("d%s=types[%i].toObject(m%s,o)",l,a,l);else{var p=!1;switch(s.type){case"double":case"float":o("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",l,l,l,l);break;case"uint64":p=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o('if(typeof m%s==="number")',l)("d%s=o.longs===String?String(m%s):m%s",l,l,l)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",l,l,l,l,p?"true":"",l);break;case"bytes":o("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",l,l,l,l,l);break;default:o("d%s=m%s",l,l)}}return o}l.fromObject=function(o){var s=o.fieldsArray,a=p.codegen(["d"],o.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!s.length)return a("return new this.ctor");a("var m=new this.ctor");for(var l=0;l<s.length;++l){var h=s[l].resolve(),d=p.safeProp(h.name);h.map?(a("if(d%s){",d)('if(typeof d%s!=="object")',d)("throw TypeError(%j)",h.fullName+": object expected")("m%s={}",d)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",d),c(a,h,l,d+"[ks[i]]")("}")("}")):h.repeated?(a("if(d%s){",d)("if(!Array.isArray(d%s))",d)("throw TypeError(%j)",h.fullName+": array expected")("m%s=[]",d)("for(var i=0;i<d%s.length;++i){",d),c(a,h,l,d+"[i]")("}")("}")):(h.resolvedType instanceof u||a("if(d%s!=null){",d),c(a,h,l,d),h.resolvedType instanceof u||a("}"))}return a("return m")},l.toObject=function(o){var s=o.fieldsArray.slice().sort(p.compareFieldsById);if(!s.length)return p.codegen()("return {}");for(var a=p.codegen(["m","o"],o.name+"$toObject")("if(!o)")("o={}")("var d={}"),l=[],c=[],d=[],f=0;f<s.length;++f)s[f].partOf||(s[f].resolve().repeated?l:s[f].map?c:d).push(s[f]);if(l.length){for(a("if(o.arrays||o.defaults){"),f=0;f<l.length;++f)a("d%s=[]",p.safeProp(l[f].name));a("}")}if(c.length){for(a("if(o.objects||o.defaults){"),f=0;f<c.length;++f)a("d%s={}",p.safeProp(c[f].name));a("}")}if(d.length){for(a("if(o.defaults){"),f=0;f<d.length;++f){var m=d[f],y=p.safeProp(m.name);if(m.resolvedType instanceof u)a("d%s=o.enums===String?%j:%j",y,m.resolvedType.valuesById[m.typeDefault],m.typeDefault);else if(m.long)a("if(util.Long){")("var n=new util.Long(%i,%i,%j)",m.typeDefault.low,m.typeDefault.high,m.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",y)("}else")("d%s=o.longs===String?%j:%i",y,m.typeDefault.toString(),m.typeDefault.toNumber());else if(m.bytes){var v="["+Array.prototype.slice.call(m.typeDefault).join(",")+"]";a("if(o.bytes===String)d%s=%j",y,String.fromCharCode.apply(String,m.typeDefault))("else{")("d%s=%s",y,v)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",y,y)("}")}else a("d%s=%j",y,m.typeDefault)}a("}")}var b=!1;for(f=0;f<s.length;++f){m=s[f];var _=o.i.indexOf(m);y=p.safeProp(m.name),m.map?(b||(b=!0,a("var ks2")),a("if(m%s&&(ks2=Object.keys(m%s)).length){",y,y)("d%s={}",y)("for(var j=0;j<ks2.length;++j){"),h(a,m,_,y+"[ks2[j]]")("}")):m.repeated?(a("if(m%s&&m%s.length){",y,y)("d%s=[]",y)("for(var j=0;j<m%s.length;++j){",y),h(a,m,_,y+"[j]")("}")):(a("if(m%s!=null&&m.hasOwnProperty(%j)){",y,m.name),h(a,m,_,y),m.partOf&&a("if(o.oneofs)")("d%s=%j",p.safeProp(m.partOf.name),m.name)),a("}")}return a("return d")}},{14:14,33:33}],12:[function(o,s){s.exports=function(o){var s=u.codegen(["r","l"],o.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(o.fieldsArray.filter((function(o){return o.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");o.group&&s("if((t&7)===4)")("break"),s("switch(t>>>3){");for(var p=0;p<o.fieldsArray.length;++p){var c=o.i[p].resolve(),h=c.resolvedType instanceof a?"int32":c.type,d="m"+u.safeProp(c.name);s("case %i:",c.id),c.map?(s("if(%s===util.emptyObject)",d)("%s={}",d)("var c2 = r.uint32()+r.pos"),l.defaults[c.keyType]!==g?s("k=%j",l.defaults[c.keyType]):s("k=null"),l.defaults[h]!==g?s("value=%j",l.defaults[h]):s("value=null"),s("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",c.keyType)("case 2:"),l.basic[h]===g?s("value=types[%i].decode(r,r.uint32())",p):s("value=r.%s()",h),s("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),l.long[c.keyType]!==g?s('%s[typeof k==="object"?util.longToHash(k):k]=value',d):s("%s[k]=value",d)):c.repeated?(s("if(!(%s&&%s.length))",d,d)("%s=[]",d),l.packed[h]!==g&&s("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",d,h)("}else"),l.basic[h]===g?s(c.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",d,p):s("%s.push(r.%s())",d,h)):l.basic[h]===g?s(c.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",d,p):s("%s=r.%s()",d,h),s("break")}for(s("default:")("r.skipType(t&7)")("break")("}")("}"),p=0;p<o.i.length;++p){var f=o.i[p];f.required&&s("if(!m.hasOwnProperty(%j))",f.name)("throw util.ProtocolError(%j,{instance:m})","missing required '"+f.name+"'")}return s("return m")};var a=o(14),l=o(32),u=o(33)},{14:14,32:32,33:33}],13:[function(o,s){s.exports=function(o){for(var s,c=u.codegen(["m","w"],o.name+"$encode")("if(!w)")("w=Writer.create()"),h=o.fieldsArray.slice().sort(u.compareFieldsById),d=0;d<h.length;++d){var f=h[d].resolve(),m=o.i.indexOf(f),y=f.resolvedType instanceof a?"int32":f.type,v=l.basic[y];s="m"+u.safeProp(f.name),f.map?(c("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",s,f.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",s)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(f.id<<3|2)>>>0,8|l.mapKey[f.keyType],f.keyType),v===g?c("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",m,s):c(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|v,y,s),c("}")("}")):f.repeated?(c("if(%s!=null&&%s.length){",s,s),f.packed&&l.packed[y]!==g?c("w.uint32(%i).fork()",(f.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",s)("w.%s(%s[i])",y,s)("w.ldelim()"):(c("for(var i=0;i<%s.length;++i)",s),v===g?p(c,f,m,s+"[i]"):c("w.uint32(%i).%s(%s[i])",(f.id<<3|v)>>>0,y,s)),c("}")):(f.optional&&c("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",s,f.name),v===g?p(c,f,m,s):c("w.uint32(%i).%s(%s)",(f.id<<3|v)>>>0,y,s))}return c("return w")};var a=o(14),l=o(32),u=o(33);function p(o,s,a,l){return s.resolvedType.group?o("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",a,l,(s.id<<3|3)>>>0,(s.id<<3|4)>>>0):o("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",a,l,(s.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(o,s){s.exports=p;var a=o(22);((p.prototype=Object.create(a.prototype)).constructor=p).className="Enum";var l=o(21),u=o(33);function p(o,s,l,u,p){if(a.call(this,o,l),s&&"object"!=typeof s)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=u,this.comments=p||{},this.reserved=g,s)for(var c=Object.keys(s),h=0;h<c.length;++h)"number"==typeof s[c[h]]&&(this.valuesById[this.values[c[h]]=s[c[h]]]=c[h])}p.fromJSON=function(o,s){var a=new p(o,s.values,s.options,s.comment,s.comments);return a.reserved=s.reserved,a},p.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return u.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:g,"comment",s?this.comment:g,"comments",s?this.comments:g])},p.prototype.add=function(o,s,a){if(!u.isString(o))throw TypeError("name must be a string");if(!u.isInteger(s))throw TypeError("id must be an integer");if(this.values[o]!==g)throw Error("duplicate name '"+o+"' in "+this);if(this.isReservedId(s))throw Error("id "+s+" is reserved in "+this);if(this.isReservedName(o))throw Error("name '"+o+"' is reserved in "+this);if(this.valuesById[s]!==g){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+s+" in "+this);this.values[o]=s}else this.valuesById[this.values[o]=s]=o;return this.comments[o]=a||null,this},p.prototype.remove=function(o){if(!u.isString(o))throw TypeError("name must be a string");var s=this.values[o];if(null==s)throw Error("name '"+o+"' does not exist in "+this);return delete this.valuesById[s],delete this.values[o],delete this.comments[o],this},p.prototype.isReservedId=function(o){return l.isReservedId(this.reserved,o)},p.prototype.isReservedName=function(o){return l.isReservedName(this.reserved,o)}},{21:21,22:22,33:33}],15:[function(o,s){s.exports=d;var a=o(22);((d.prototype=Object.create(a.prototype)).constructor=d).className="Field";var l,u=o(14),p=o(32),c=o(33),h=/^required|optional|repeated$/;function d(o,s,l,u,d,f,m){if(c.isObject(u)?(m=d,f=u,u=d=g):c.isObject(d)&&(m=f,f=d,d=g),a.call(this,o,f),!c.isInteger(s)||s<0)throw TypeError("id must be a non-negative integer");if(!c.isString(l))throw TypeError("type must be a string");if(u!==g&&!h.test(u=u.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(d!==g&&!c.isString(d))throw TypeError("extend must be a string");this.rule=u&&"optional"!==u?u:g,this.type=l,this.id=s,this.extend=d||g,this.required="required"===u,this.optional=!this.required,this.repeated="repeated"===u,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!c.Long&&p.long[l]!==g,this.bytes="bytes"===l,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.n=null,this.comment=m}d.fromJSON=function(o,s){return new d(o,s.id,s.type,s.rule,s.extend,s.options,s.comment)},Object.defineProperty(d.prototype,"packed",{get:function(){return null===this.n&&(this.n=!1!==this.getOption("packed")),this.n}}),d.prototype.setOption=function(o,s,l){return"packed"===o&&(this.n=null),a.prototype.setOption.call(this,o,s,l)},d.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return c.toObject(["rule","optional"!==this.rule&&this.rule||g,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:g])},d.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=p.defaults[this.type])===g&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof l?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof u&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(this.options.packed===g||!this.resolvedType||this.resolvedType instanceof u)||delete this.options.packed,Object.keys(this.options).length||(this.options=g)),this.long)this.typeDefault=c.Long.fromNumber(this.typeDefault,"u"==this.type[0]),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var o;c.base64.test(this.typeDefault)?c.base64.decode(this.typeDefault,o=c.newBuffer(c.base64.length(this.typeDefault)),0):c.utf8.write(this.typeDefault,o=c.newBuffer(c.utf8.length(this.typeDefault)),0),this.typeDefault=o}return this.map?this.defaultValue=c.emptyObject:this.repeated?this.defaultValue=c.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof l&&(this.parent.ctor.prototype[this.name]=this.defaultValue),a.prototype.resolve.call(this)},d.d=function(o,s,a,l){return"function"==typeof s?s=c.decorateType(s).name:s&&"object"==typeof s&&(s=c.decorateEnum(s).name),function(u,p){c.decorateType(u.constructor).add(new d(p,o,s,a,{default:l}))}},d.r=function(o){l=o}},{14:14,22:22,32:32,33:33}],16:[function(o,s){var a=s.exports=o(17);a.build="light",a.load=function(o,s,l){return(s="function"==typeof s?(l=s,new a.Root):s||new a.Root).load(o,l)},a.loadSync=function(o,s){return(s=s||new a.Root).loadSync(o)},a.encoder=o(13),a.decoder=o(12),a.verifier=o(36),a.converter=o(11),a.ReflectionObject=o(22),a.Namespace=o(21),a.Root=o(26),a.Enum=o(14),a.Type=o(31),a.Field=o(15),a.OneOf=o(23),a.MapField=o(18),a.Service=o(30),a.Method=o(20),a.Message=o(19),a.wrappers=o(37),a.types=o(32),a.util=o(33),a.ReflectionObject.r(a.Root),a.Namespace.r(a.Type,a.Service,a.Enum),a.Root.r(a.Type),a.Field.r(a.Type)},{11:11,12:12,13:13,14:14,15:15,17:17,18:18,19:19,20:20,21:21,22:22,23:23,26:26,30:30,31:31,32:32,33:33,36:36,37:37}],17:[function(o,s,a){var l=a;l.build="minimal",l.Writer=o(38),l.BufferWriter=o(39),l.Reader=o(24),l.BufferReader=o(25),l.util=o(35),l.rpc=o(28),l.roots=o(27),(l.configure=function(){l.util.r(),l.Writer.r(l.BufferWriter),l.Reader.r(l.BufferReader)})()},{24:24,25:25,27:27,28:28,35:35,38:38,39:39}],18:[function(o,s){s.exports=p;var a=o(15);((p.prototype=Object.create(a.prototype)).constructor=p).className="MapField";var l=o(32),u=o(33);function p(o,s,l,p,c,h){if(a.call(this,o,s,p,g,g,c,h),!u.isString(l))throw TypeError("keyType must be a string");this.keyType=l,this.resolvedKeyType=null,this.map=!0}p.fromJSON=function(o,s){return new p(o,s.id,s.keyType,s.type,s.options,s.comment)},p.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return u.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:g])},p.prototype.resolve=function(){if(this.resolved)return this;if(l.mapKey[this.keyType]===g)throw Error("invalid key type: "+this.keyType);return a.prototype.resolve.call(this)},p.d=function(o,s,a){return"function"==typeof a?a=u.decorateType(a).name:a&&"object"==typeof a&&(a=u.decorateEnum(a).name),function(l,c){u.decorateType(l.constructor).add(new p(c,o,s,a))}}},{15:15,32:32,33:33}],19:[function(o,s){s.exports=l;var a=o(35);function l(o){if(o)for(var s=Object.keys(o),a=0;a<s.length;++a)this[s[a]]=o[s[a]]}l.create=function(o){return this.$type.create(o)},l.encode=function(o,s){return this.$type.encode(o,s)},l.encodeDelimited=function(o,s){return this.$type.encodeDelimited(o,s)},l.decode=function(o){return this.$type.decode(o)},l.decodeDelimited=function(o){return this.$type.decodeDelimited(o)},l.verify=function(o){return this.$type.verify(o)},l.fromObject=function(o){return this.$type.fromObject(o)},l.toObject=function(o,s){return this.$type.toObject(o,s)},l.prototype.toJSON=function(){return this.$type.toObject(this,a.toJSONOptions)}},{35:35}],20:[function(o,s){s.exports=u;var a=o(22);((u.prototype=Object.create(a.prototype)).constructor=u).className="Method";var l=o(33);function u(o,s,u,p,c,h,d,f,m){if(l.isObject(c)?(d=c,c=h=g):l.isObject(h)&&(d=h,h=g),s!==g&&!l.isString(s))throw TypeError("type must be a string");if(!l.isString(u))throw TypeError("requestType must be a string");if(!l.isString(p))throw TypeError("responseType must be a string");a.call(this,o,d),this.type=s||"rpc",this.requestType=u,this.requestStream=!!c||g,this.responseType=p,this.responseStream=!!h||g,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=f,this.parsedOptions=m}u.fromJSON=function(o,s){return new u(o,s.type,s.requestType,s.responseType,s.requestStream,s.responseStream,s.options,s.comment,s.parsedOptions)},u.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return l.toObject(["type","rpc"!==this.type&&this.type||g,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",s?this.comment:g,"parsedOptions",this.parsedOptions])},u.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),a.prototype.resolve.call(this))}},{22:22,33:33}],21:[function(o,s){s.exports=f;var a=o(22);((f.prototype=Object.create(a.prototype)).constructor=f).className="Namespace";var l,u,p,c=o(15),h=o(33);function d(o,s){if(!o||!o.length)return g;for(var a={},l=0;l<o.length;++l)a[o[l].name]=o[l].toJSON(s);return a}function f(o,s){a.call(this,o,s),this.nested=g,this.e=null}function m(o){return o.e=null,o}f.fromJSON=function(o,s){return new f(o,s.options).addJSON(s.nested)},f.arrayToJSON=d,f.isReservedId=function(o,s){if(o)for(var a=0;a<o.length;++a)if("string"!=typeof o[a]&&o[a][0]<=s&&o[a][1]>s)return!0;return!1},f.isReservedName=function(o,s){if(o)for(var a=0;a<o.length;++a)if(o[a]===s)return!0;return!1},Object.defineProperty(f.prototype,"nestedArray",{get:function(){return this.e||(this.e=h.toArray(this.nested))}}),f.prototype.toJSON=function(o){return h.toObject(["options",this.options,"nested",d(this.nestedArray,o)])},f.prototype.addJSON=function(o){if(o)for(var s,a=Object.keys(o),h=0;h<a.length;++h)s=o[a[h]],this.add((s.fields!==g?l.fromJSON:s.values!==g?p.fromJSON:s.methods!==g?u.fromJSON:s.id!==g?c.fromJSON:f.fromJSON)(a[h],s));return this},f.prototype.get=function(o){return this.nested&&this.nested[o]||null},f.prototype.getEnum=function(o){if(this.nested&&this.nested[o]instanceof p)return this.nested[o].values;throw Error("no such enum: "+o)},f.prototype.add=function(o){if(!(o instanceof c&&o.extend!==g||o instanceof l||o instanceof p||o instanceof u||o instanceof f))throw TypeError("object must be a valid nested object");if(this.nested){var s=this.get(o.name);if(s){if(!(s instanceof f&&o instanceof f)||s instanceof l||s instanceof u)throw Error("duplicate name '"+o.name+"' in "+this);for(var a=s.nestedArray,h=0;h<a.length;++h)o.add(a[h]);this.remove(s),this.nested||(this.nested={}),o.setOptions(s.options,!0)}}else this.nested={};return(this.nested[o.name]=o).onAdd(this),m(this)},f.prototype.remove=function(o){if(!(o instanceof a))throw TypeError("object must be a ReflectionObject");if(o.parent!==this)throw Error(o+" is not a member of "+this);return delete this.nested[o.name],Object.keys(this.nested).length||(this.nested=g),o.onRemove(this),m(this)},f.prototype.define=function(o,s){if(h.isString(o))o=o.split(".");else if(!Array.isArray(o))throw TypeError("illegal path");if(o&&o.length&&""===o[0])throw Error("path must be relative");for(var a=this;0<o.length;){var l=o.shift();if(a.nested&&a.nested[l]){if(!((a=a.nested[l])instanceof f))throw Error("path conflicts with non-namespace objects")}else a.add(a=new f(l))}return s&&a.addJSON(s),a},f.prototype.resolveAll=function(){for(var o=this.nestedArray,s=0;s<o.length;)o[s]instanceof f?o[s++].resolveAll():o[s++].resolve();return this.resolve()},f.prototype.lookup=function(o,s,a){if("boolean"==typeof s?(a=s,s=g):s&&!Array.isArray(s)&&(s=[s]),h.isString(o)&&o.length){if("."===o)return this.root;o=o.split(".")}else if(!o.length)return this;if(""===o[0])return this.root.lookup(o.slice(1),s);var l=this.get(o[0]);if(l){if(1===o.length){if(!s||~s.indexOf(l.constructor))return l}else if(l instanceof f&&(l=l.lookup(o.slice(1),s,!0)))return l}else for(var u=0;u<this.nestedArray.length;++u)if(this.e[u]instanceof f&&(l=this.e[u].lookup(o,s,!0)))return l;return null===this.parent||a?null:this.parent.lookup(o,s)},f.prototype.lookupType=function(o){var s=this.lookup(o,[l]);if(!s)throw Error("no such type: "+o);return s},f.prototype.lookupEnum=function(o){var s=this.lookup(o,[p]);if(!s)throw Error("no such Enum '"+o+"' in "+this);return s},f.prototype.lookupTypeOrEnum=function(o){var s=this.lookup(o,[l,p]);if(!s)throw Error("no such Type or Enum '"+o+"' in "+this);return s},f.prototype.lookupService=function(o){var s=this.lookup(o,[u]);if(!s)throw Error("no such Service '"+o+"' in "+this);return s},f.r=function(o,s,a){l=o,u=s,p=a}},{15:15,22:22,33:33}],22:[function(o,s){(s.exports=u).className="ReflectionObject";var a,l=o(33);function u(o,s){if(!l.isString(o))throw TypeError("name must be a string");if(s&&!l.isObject(s))throw TypeError("options must be an object");this.options=s,this.parsedOptions=null,this.name=o,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(u.prototype,{root:{get:function(){for(var o=this;null!==o.parent;)o=o.parent;return o}},fullName:{get:function(){for(var o=[this.name],s=this.parent;s;)o.unshift(s.name),s=s.parent;return o.join(".")}}}),u.prototype.toJSON=function(){throw Error()},u.prototype.onAdd=function(o){this.parent&&this.parent!==o&&this.parent.remove(this),this.parent=o,this.resolved=!1;var s=o.root;s instanceof a&&s.u(this)},u.prototype.onRemove=function(o){var s=o.root;s instanceof a&&s.o(this),this.parent=null,this.resolved=!1},u.prototype.resolve=function(){return this.resolved||this.root instanceof a&&(this.resolved=!0),this},u.prototype.getOption=function(o){return this.options?this.options[o]:g},u.prototype.setOption=function(o,s,a){return a&&this.options&&this.options[o]!==g||((this.options||(this.options={}))[o]=s),this},u.prototype.setParsedOption=function(o,s,a){this.parsedOptions||(this.parsedOptions=[]);var u=this.parsedOptions;if(a){var p=u.find((function(s){return Object.prototype.hasOwnProperty.call(s,o)}));if(p){var c=p[o];l.setProperty(c,a,s)}else(p={})[o]=l.setProperty({},a,s),u.push(p)}else{var h={};h[o]=s,u.push(h)}return this},u.prototype.setOptions=function(o,s){if(o)for(var a=Object.keys(o),l=0;l<a.length;++l)this.setOption(a[l],o[a[l]],s);return this},u.prototype.toString=function(){var o=this.constructor.className,s=this.fullName;return s.length?o+" "+s:o},u.r=function(o){a=o}},{33:33}],23:[function(o,s){s.exports=p;var a=o(22);((p.prototype=Object.create(a.prototype)).constructor=p).className="OneOf";var l=o(15),u=o(33);function p(o,s,l,u){if(Array.isArray(s)||(l=s,s=g),a.call(this,o,l),s!==g&&!Array.isArray(s))throw TypeError("fieldNames must be an Array");this.oneof=s||[],this.fieldsArray=[],this.comment=u}function c(o){if(o.parent)for(var s=0;s<o.fieldsArray.length;++s)o.fieldsArray[s].parent||o.parent.add(o.fieldsArray[s])}p.fromJSON=function(o,s){return new p(o,s.oneof,s.options,s.comment)},p.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return u.toObject(["options",this.options,"oneof",this.oneof,"comment",s?this.comment:g])},p.prototype.add=function(o){if(!(o instanceof l))throw TypeError("field must be a Field");return o.parent&&o.parent!==this.parent&&o.parent.remove(o),this.oneof.push(o.name),this.fieldsArray.push(o),c(o.partOf=this),this},p.prototype.remove=function(o){if(!(o instanceof l))throw TypeError("field must be a Field");var s=this.fieldsArray.indexOf(o);if(s<0)throw Error(o+" is not a member of "+this);return this.fieldsArray.splice(s,1),-1<(s=this.oneof.indexOf(o.name))&&this.oneof.splice(s,1),o.partOf=null,this},p.prototype.onAdd=function(o){a.prototype.onAdd.call(this,o);for(var s=0;s<this.oneof.length;++s){var l=o.get(this.oneof[s]);l&&!l.partOf&&(l.partOf=this).fieldsArray.push(l)}c(this)},p.prototype.onRemove=function(o){for(var s,l=0;l<this.fieldsArray.length;++l)(s=this.fieldsArray[l]).parent&&s.parent.remove(s);a.prototype.onRemove.call(this,o)},p.d=function(){for(var o=Array(arguments.length),s=0;s<arguments.length;)o[s]=arguments[s++];return function(s,a){u.decorateType(s.constructor).add(new p(a,o)),Object.defineProperty(s,a,{get:u.oneOfGetter(o),set:u.oneOfSetter(o)})}}},{15:15,22:22,33:33}],24:[function(o,s){s.exports=h;var a,l=o(35),u=l.LongBits,p=l.utf8;function c(o,s){return RangeError("index out of range: "+o.pos+" + "+(s||1)+" > "+o.len)}function h(o){this.buf=o,this.pos=0,this.len=o.length}function d(){return l.Buffer?function(o){return(h.create=function(o){return l.Buffer.isBuffer(o)?new a(o):m(o)})(o)}:m}var f,m="undefined"!=typeof Uint8Array?function(o){if(o instanceof Uint8Array||Array.isArray(o))return new h(o);throw Error("illegal buffer")}:function(o){if(Array.isArray(o))return new h(o);throw Error("illegal buffer")};function y(){var o=new u(0,0),s=0;if(!(4<this.len-this.pos)){for(;s<3;++s){if(this.pos>=this.len)throw c(this);if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*s)>>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(127&this.buf[this.pos++])<<7*s)>>>0,o}for(;s<4;++s)if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*s)>>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(127&this.buf[this.pos])<<28)>>>0,o.hi=(o.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return o;if(s=0,4<this.len-this.pos){for(;s<5;++s)if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*s+3)>>>0,this.buf[this.pos++]<128)return o}else for(;s<5;++s){if(this.pos>=this.len)throw c(this);if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*s+3)>>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}function v(o,s){return(o[s-4]|o[s-3]<<8|o[s-2]<<16|o[s-1]<<24)>>>0}function b(){if(this.pos+8>this.len)throw c(this,8);return new u(v(this.buf,this.pos+=4),v(this.buf,this.pos+=4))}h.create=d(),h.prototype.f=l.Array.prototype.subarray||l.Array.prototype.slice,h.prototype.uint32=(f=4294967295,function(){if(f=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return f;if(f=(f|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return f;if(f=(f|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return f;if(f=(f|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return f;if(f=(f|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return f;if((this.pos+=5)>this.len)throw this.pos=this.len,c(this,10);return f}),h.prototype.int32=function(){return 0|this.uint32()},h.prototype.sint32=function(){var o=this.uint32();return o>>>1^-(1&o)|0},h.prototype.bool=function(){return 0!==this.uint32()},h.prototype.fixed32=function(){if(this.pos+4>this.len)throw c(this,4);return v(this.buf,this.pos+=4)},h.prototype.sfixed32=function(){if(this.pos+4>this.len)throw c(this,4);return 0|v(this.buf,this.pos+=4)},h.prototype.float=function(){if(this.pos+4>this.len)throw c(this,4);var o=l.float.readFloatLE(this.buf,this.pos);return this.pos+=4,o},h.prototype.double=function(){if(this.pos+8>this.len)throw c(this,4);var o=l.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,o},h.prototype.bytes=function(){var o=this.uint32(),s=this.pos,a=this.pos+o;if(a>this.len)throw c(this,o);return this.pos+=o,Array.isArray(this.buf)?this.buf.slice(s,a):s===a?new this.buf.constructor(0):this.f.call(this.buf,s,a)},h.prototype.string=function(){var o=this.bytes();return p.read(o,0,o.length)},h.prototype.skip=function(o){if("number"==typeof o){if(this.pos+o>this.len)throw c(this,o);this.pos+=o}else do{if(this.pos>=this.len)throw c(this)}while(128&this.buf[this.pos++]);return this},h.prototype.skipType=function(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(o=7&this.uint32());)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+o+" at offset "+this.pos)}return this},h.r=function(o){a=o,h.create=d(),a.r();var s=l.Long?"toLong":"toNumber";l.merge(h.prototype,{int64:function(){return y.call(this)[s](!1)},uint64:function(){return y.call(this)[s](!0)},sint64:function(){return y.call(this).zzDecode()[s](!1)},fixed64:function(){return b.call(this)[s](!0)},sfixed64:function(){return b.call(this)[s](!1)}})}},{35:35}],25:[function(o,s){s.exports=u;var a=o(24);(u.prototype=Object.create(a.prototype)).constructor=u;var l=o(35);function u(o){a.call(this,o)}u.r=function(){l.Buffer&&(u.prototype.f=l.Buffer.prototype.slice)},u.prototype.string=function(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))},u.r()},{24:24,35:35}],26:[function(o,s){s.exports=m;var a=o(21);((m.prototype=Object.create(a.prototype)).constructor=m).className="Root";var l,u,p,c=o(15),h=o(14),d=o(23),f=o(33);function m(o){a.call(this,"",o),this.deferred=[],this.files=[]}function y(){}m.fromJSON=function(o,s){return s=s||new m,o.options&&s.setOptions(o.options),s.addJSON(o.nested)},m.prototype.resolvePath=f.path.resolve,m.prototype.fetch=f.fetch,m.prototype.load=function o(s,a,l){"function"==typeof a&&(l=a,a=g);var c=this;if(!l)return f.asPromise(o,c,s,a);var h=l===y;function d(o,s){if(l){var a=l;if(l=null,h)throw o;a(o,s)}}function m(o){var s=o.lastIndexOf("google/protobuf/");if(-1<s){var a=o.substring(s);if(a in p)return a}return null}function v(o,s){try{if(f.isString(s)&&"{"==s[0]&&(s=JSON.parse(s)),f.isString(s)){u.filename=o;var l,p=u(s,c,a),y=0;if(p.imports)for(;y<p.imports.length;++y)(l=m(p.imports[y])||c.resolvePath(o,p.imports[y]))&&b(l);if(p.weakImports)for(y=0;y<p.weakImports.length;++y)(l=m(p.weakImports[y])||c.resolvePath(o,p.weakImports[y]))&&b(l,!0)}else c.setOptions(s.options).addJSON(s.nested)}catch(o){d(o)}h||_||d(null,c)}function b(o,s){if(!~c.files.indexOf(o))if(c.files.push(o),o in p)h?v(o,p[o]):(++_,setTimeout((function(){--_,v(o,p[o])})));else if(h){var a;try{a=f.fs.readFileSync(o).toString("utf8")}catch(a){return void(s||d(a))}v(o,a)}else++_,c.fetch(o,(function(a,u){--_,l&&(a?s?_||d(null,c):d(a):v(o,u))}))}var _=0;f.isString(s)&&(s=[s]);for(var w,A=0;A<s.length;++A)(w=c.resolvePath("",s[A]))&&b(w);return h?c:(_||d(null,c),g)},m.prototype.loadSync=function(o,s){if(!f.isNode)throw Error("not supported");return this.load(o,s,y)},m.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(o){return"'extend "+o.extend+"' in "+o.parent.fullName})).join(", "));return a.prototype.resolveAll.call(this)};var v=/^[A-Z]/;function b(o,s){var a=s.parent.lookup(s.extend);if(a){var l=new c(s.fullName,s.id,s.type,s.rule,g,s.options);return(l.declaringField=s).extensionField=l,a.add(l),1}}m.prototype.u=function(o){if(o instanceof c)o.extend===g||o.extensionField||b(0,o)||this.deferred.push(o);else if(o instanceof h)v.test(o.name)&&(o.parent[o.name]=o.values);else if(!(o instanceof d)){if(o instanceof l)for(var s=0;s<this.deferred.length;)b(0,this.deferred[s])?this.deferred.splice(s,1):++s;for(var a=0;a<o.nestedArray.length;++a)this.u(o.e[a]);v.test(o.name)&&(o.parent[o.name]=o)}},m.prototype.o=function(o){if(o instanceof c){if(o.extend!==g)if(o.extensionField)o.extensionField.parent.remove(o.extensionField),o.extensionField=null;else{var s=this.deferred.indexOf(o);-1<s&&this.deferred.splice(s,1)}}else if(o instanceof h)v.test(o.name)&&delete o.parent[o.name];else if(o instanceof a){for(var l=0;l<o.nestedArray.length;++l)this.o(o.e[l]);v.test(o.name)&&delete o.parent[o.name]}},m.r=function(o,s,a){l=o,u=s,p=a}},{14:14,15:15,21:21,23:23,33:33}],27:[function(o,s){s.exports={}},{}],28:[function(o,s,a){a.Service=o(29)},{29:29}],29:[function(o,s){s.exports=l;var a=o(35);function l(o,s,l){if("function"!=typeof o)throw TypeError("rpcImpl must be a function");a.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!s,this.responseDelimited=!!l}((l.prototype=Object.create(a.EventEmitter.prototype)).constructor=l).prototype.rpcCall=function o(s,l,u,p,c){if(!p)throw TypeError("request must be specified");var h=this;if(!c)return a.asPromise(o,h,s,l,u,p);if(!h.rpcImpl)return setTimeout((function(){c(Error("already ended"))}),0),g;try{return h.rpcImpl(s,l[h.requestDelimited?"encodeDelimited":"encode"](p).finish(),(function(o,a){if(o)return h.emit("error",o,s),c(o);if(null===a)return h.end(!0),g;if(!(a instanceof u))try{a=u[h.responseDelimited?"decodeDelimited":"decode"](a)}catch(o){return h.emit("error",o,s),c(o)}return h.emit("data",a,s),c(null,a)}))}catch(o){return h.emit("error",o,s),setTimeout((function(){c(o)}),0),g}},l.prototype.end=function(o){return this.rpcImpl&&(o||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{35:35}],30:[function(o,s){s.exports=c;var a=o(21);((c.prototype=Object.create(a.prototype)).constructor=c).className="Service";var l=o(20),u=o(33),p=o(28);function c(o,s){a.call(this,o,s),this.methods={},this.h=null}function h(o){return o.h=null,o}c.fromJSON=function(o,s){var a=new c(o,s.options);if(s.methods)for(var u=Object.keys(s.methods),p=0;p<u.length;++p)a.add(l.fromJSON(u[p],s.methods[u[p]]));return s.nested&&a.addJSON(s.nested),a.comment=s.comment,a},c.prototype.toJSON=function(o){var s=a.prototype.toJSON.call(this,o),l=!!o&&!!o.keepComments;return u.toObject(["options",s&&s.options||g,"methods",a.arrayToJSON(this.methodsArray,o)||{},"nested",s&&s.nested||g,"comment",l?this.comment:g])},Object.defineProperty(c.prototype,"methodsArray",{get:function(){return this.h||(this.h=u.toArray(this.methods))}}),c.prototype.get=function(o){return this.methods[o]||a.prototype.get.call(this,o)},c.prototype.resolveAll=function(){for(var o=this.methodsArray,s=0;s<o.length;++s)o[s].resolve();return a.prototype.resolve.call(this)},c.prototype.add=function(o){if(this.get(o.name))throw Error("duplicate name '"+o.name+"' in "+this);return o instanceof l?h((this.methods[o.name]=o).parent=this):a.prototype.add.call(this,o)},c.prototype.remove=function(o){if(o instanceof l){if(this.methods[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.methods[o.name],o.parent=null,h(this)}return a.prototype.remove.call(this,o)},c.prototype.create=function(o,s,a){for(var l,c=new p.Service(o,s,a),h=0;h<this.methodsArray.length;++h){var d=u.lcFirst((l=this.h[h]).resolve().name).replace(/[^$\w_]/g,"");c[d]=u.codegen(["r","c"],u.isReserved(d)?d+"_":d)("return this.rpcCall(m,q,s,r,c)")({m:l,q:l.resolvedRequestType.ctor,s:l.resolvedResponseType.ctor})}return c}},{20:20,21:21,28:28,33:33}],31:[function(o,s){s.exports=T;var a=o(21);((T.prototype=Object.create(a.prototype)).constructor=T).className="Type";var l=o(14),u=o(23),p=o(15),c=o(18),h=o(30),d=o(19),f=o(24),m=o(38),y=o(33),v=o(13),b=o(12),_=o(36),w=o(11),A=o(37);function T(o,s){a.call(this,o,s),this.fields={},this.oneofs=g,this.extensions=g,this.reserved=g,this.group=g,this.c=null,this.i=null,this.a=null,this.l=null}function O(o){return o.c=o.i=o.a=null,delete o.encode,delete o.decode,delete o.verify,o}Object.defineProperties(T.prototype,{fieldsById:{get:function(){if(this.c)return this.c;this.c={};for(var o=Object.keys(this.fields),s=0;s<o.length;++s){var a=this.fields[o[s]],l=a.id;if(this.c[l])throw Error("duplicate id "+l+" in "+this);this.c[l]=a}return this.c}},fieldsArray:{get:function(){return this.i||(this.i=y.toArray(this.fields))}},oneofsArray:{get:function(){return this.a||(this.a=y.toArray(this.oneofs))}},ctor:{get:function(){return this.l||(this.ctor=T.generateConstructor(this)())},set:function(o){var s=o.prototype;s instanceof d||((o.prototype=new d).constructor=o,y.merge(o.prototype,s)),o.$type=o.prototype.$type=this,y.merge(o,d,!0),this.l=o;for(var a=0;a<this.fieldsArray.length;++a)this.i[a].resolve();var l={};for(a=0;a<this.oneofsArray.length;++a)l[this.a[a].resolve().name]={get:y.oneOfGetter(this.a[a].oneof),set:y.oneOfSetter(this.a[a].oneof)};a&&Object.defineProperties(o.prototype,l)}}}),T.generateConstructor=function(o){for(var s,a=y.codegen(["p"],o.name),l=0;l<o.fieldsArray.length;++l)(s=o.i[l]).map?a("this%s={}",y.safeProp(s.name)):s.repeated&&a("this%s=[]",y.safeProp(s.name));return a("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},T.fromJSON=function(o,s){var d=new T(o,s.options);d.extensions=s.extensions,d.reserved=s.reserved;for(var f=Object.keys(s.fields),m=0;m<f.length;++m)d.add((void 0!==s.fields[f[m]].keyType?c.fromJSON:p.fromJSON)(f[m],s.fields[f[m]]));if(s.oneofs)for(f=Object.keys(s.oneofs),m=0;m<f.length;++m)d.add(u.fromJSON(f[m],s.oneofs[f[m]]));if(s.nested)for(f=Object.keys(s.nested),m=0;m<f.length;++m){var y=s.nested[f[m]];d.add((y.id!==g?p.fromJSON:y.fields!==g?T.fromJSON:y.values!==g?l.fromJSON:y.methods!==g?h.fromJSON:a.fromJSON)(f[m],y))}return s.extensions&&s.extensions.length&&(d.extensions=s.extensions),s.reserved&&s.reserved.length&&(d.reserved=s.reserved),s.group&&(d.group=!0),s.comment&&(d.comment=s.comment),d},T.prototype.toJSON=function(o){var s=a.prototype.toJSON.call(this,o),l=!!o&&!!o.keepComments;return y.toObject(["options",s&&s.options||g,"oneofs",a.arrayToJSON(this.oneofsArray,o),"fields",a.arrayToJSON(this.fieldsArray.filter((function(o){return!o.declaringField})),o)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:g,"reserved",this.reserved&&this.reserved.length?this.reserved:g,"group",this.group||g,"nested",s&&s.nested||g,"comment",l?this.comment:g])},T.prototype.resolveAll=function(){for(var o=this.fieldsArray,s=0;s<o.length;)o[s++].resolve();var l=this.oneofsArray;for(s=0;s<l.length;)l[s++].resolve();return a.prototype.resolveAll.call(this)},T.prototype.get=function(o){return this.fields[o]||this.oneofs&&this.oneofs[o]||this.nested&&this.nested[o]||null},T.prototype.add=function(o){if(this.get(o.name))throw Error("duplicate name '"+o.name+"' in "+this);if(o instanceof p&&o.extend===g){if(this.c?this.c[o.id]:this.fieldsById[o.id])throw Error("duplicate id "+o.id+" in "+this);if(this.isReservedId(o.id))throw Error("id "+o.id+" is reserved in "+this);if(this.isReservedName(o.name))throw Error("name '"+o.name+"' is reserved in "+this);return o.parent&&o.parent.remove(o),(this.fields[o.name]=o).message=this,o.onAdd(this),O(this)}return o instanceof u?(this.oneofs||(this.oneofs={}),(this.oneofs[o.name]=o).onAdd(this),O(this)):a.prototype.add.call(this,o)},T.prototype.remove=function(o){if(o instanceof p&&o.extend===g){if(!this.fields||this.fields[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.fields[o.name],o.parent=null,o.onRemove(this),O(this)}if(o instanceof u){if(!this.oneofs||this.oneofs[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.oneofs[o.name],o.parent=null,o.onRemove(this),O(this)}return a.prototype.remove.call(this,o)},T.prototype.isReservedId=function(o){return a.isReservedId(this.reserved,o)},T.prototype.isReservedName=function(o){return a.isReservedName(this.reserved,o)},T.prototype.create=function(o){return new this.ctor(o)},T.prototype.setup=function(){for(var o=this.fullName,s=[],a=0;a<this.fieldsArray.length;++a)s.push(this.i[a].resolve().resolvedType);this.encode=v(this)({Writer:m,types:s,util:y}),this.decode=b(this)({Reader:f,types:s,util:y}),this.verify=_(this)({types:s,util:y}),this.fromObject=w.fromObject(this)({types:s,util:y}),this.toObject=w.toObject(this)({types:s,util:y});var l=A[o];if(l){var u=Object.create(this);u.fromObject=this.fromObject,this.fromObject=l.fromObject.bind(u),u.toObject=this.toObject,this.toObject=l.toObject.bind(u)}return this},T.prototype.encode=function(o,s){return this.setup().encode(o,s)},T.prototype.encodeDelimited=function(o,s){return this.encode(o,s&&s.len?s.fork():s).ldelim()},T.prototype.decode=function(o,s){return this.setup().decode(o,s)},T.prototype.decodeDelimited=function(o){return o instanceof f||(o=f.create(o)),this.decode(o,o.uint32())},T.prototype.verify=function(o){return this.setup().verify(o)},T.prototype.fromObject=function(o){return this.setup().fromObject(o)},T.prototype.toObject=function(o,s){return this.setup().toObject(o,s)},T.d=function(o){return function(s){y.decorateType(s,o)}}},{11:11,12:12,13:13,14:14,15:15,18:18,19:19,21:21,23:23,24:24,30:30,33:33,36:36,37:37,38:38}],32:[function(o,s,a){var l=a,u=o(33),p=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function c(o,s){var a=0,l={};for(s|=0;a<o.length;)l[p[a+s]]=o[a++];return l}l.basic=c([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),l.defaults=c([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",u.emptyArray,null]),l.long=c([0,0,0,1,1],7),l.mapKey=c([0,0,0,5,5,0,0,0,1,1,0,2],2),l.packed=c([1,5,0,0,0,5,5,0,0,0,1,1,0])},{33:33}],33:[function(o,s){var a,l,u=s.exports=o(35),p=o(27);u.codegen=o(3),u.fetch=o(5),u.path=o(8),u.fs=u.inquire("fs"),u.toArray=function(o){if(o){for(var s=Object.keys(o),a=Array(s.length),l=0;l<s.length;)a[l]=o[s[l++]];return a}return[]},u.toObject=function(o){for(var s={},a=0;a<o.length;){var l=o[a++],u=o[a++];u!==g&&(s[l]=u)}return s};var c=/\\/g,h=/"/g;u.isReserved=function(o){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(o)},u.safeProp=function(o){return!/^[$\w_]+$/.test(o)||u.isReserved(o)?'["'+o.replace(c,"\\\\").replace(h,'\\"')+'"]':"."+o},u.ucFirst=function(o){return o[0].toUpperCase()+o.substring(1)};var d=/_([a-z])/g;u.camelCase=function(o){return o.substring(0,1)+o.substring(1).replace(d,(function(o,s){return s.toUpperCase()}))},u.compareFieldsById=function(o,s){return o.id-s.id},u.decorateType=function(s,l){if(s.$type)return l&&s.$type.name!==l&&(u.decorateRoot.remove(s.$type),s.$type.name=l,u.decorateRoot.add(s.$type)),s.$type;var p=new(a=a||o(31))(l||s.name);return u.decorateRoot.add(p),p.ctor=s,Object.defineProperty(s,"$type",{value:p,enumerable:!1}),Object.defineProperty(s.prototype,"$type",{value:p,enumerable:!1}),p};var f=0;u.decorateEnum=function(s){if(s.$type)return s.$type;var a=new(l=l||o(14))("Enum"+f++,s);return u.decorateRoot.add(a),Object.defineProperty(s,"$type",{value:a,enumerable:!1}),a},u.setProperty=function(o,s,a){if("object"!=typeof o)throw TypeError("dst must be an object");if(!s)throw TypeError("path must be specified");return function o(s,a,l){var u=a.shift();if(0<a.length)s[u]=o(s[u]||{},a,l);else{var p=s[u];p&&(l=[].concat(p).concat(l)),s[u]=l}return s}(o,s=s.split("."),a)},Object.defineProperty(u,"decorateRoot",{get:function(){return p.decorated||(p.decorated=new(o(26)))}})},{14:14,26:26,27:27,3:3,31:31,35:35,5:5,8:8}],34:[function(o,s){s.exports=l;var a=o(35);function l(o,s){this.lo=o>>>0,this.hi=s>>>0}var u=l.zero=new l(0,0);u.toNumber=function(){return 0},u.zzEncode=u.zzDecode=function(){return this},u.length=function(){return 1};var p=l.zeroHash="\0\0\0\0\0\0\0\0";l.fromNumber=function(o){if(0===o)return u;var s=o<0;s&&(o=-o);var a=o>>>0,p=(o-a)/4294967296>>>0;return s&&(p=~p>>>0,a=~a>>>0,4294967295<++a&&(a=0,4294967295<++p&&(p=0))),new l(a,p)},l.from=function(o){if("number"==typeof o)return l.fromNumber(o);if(a.isString(o)){if(!a.Long)return l.fromNumber(parseInt(o,10));o=a.Long.fromString(o)}return o.low||o.high?new l(o.low>>>0,o.high>>>0):u},l.prototype.toNumber=function(o){if(!o&&this.hi>>>31){var s=1+~this.lo>>>0,a=~this.hi>>>0;return s||(a=a+1>>>0),-(s+4294967296*a)}return this.lo+4294967296*this.hi},l.prototype.toLong=function(o){return a.Long?new a.Long(0|this.lo,0|this.hi,!!o):{low:0|this.lo,high:0|this.hi,unsigned:!!o}};var c=String.prototype.charCodeAt;l.fromHash=function(o){return o===p?u:new l((c.call(o,0)|c.call(o,1)<<8|c.call(o,2)<<16|c.call(o,3)<<24)>>>0,(c.call(o,4)|c.call(o,5)<<8|c.call(o,6)<<16|c.call(o,7)<<24)>>>0)},l.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)},l.prototype.zzEncode=function(){var o=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^o)>>>0,this.lo=(this.lo<<1^o)>>>0,this},l.prototype.zzDecode=function(){var o=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^o)>>>0,this.hi=(this.hi>>>1^o)>>>0,this},l.prototype.length=function(){var o=this.lo,s=(this.lo>>>28|this.hi<<4)>>>0,a=this.hi>>>24;return 0==a?0==s?o<16384?o<128?1:2:o<2097152?3:4:s<16384?s<128?5:6:s<2097152?7:8:a<128?9:10}},{35:35}],35:[function(o,s,a){var l=a;function u(o,s,a){for(var l=Object.keys(s),u=0;u<l.length;++u)o[l[u]]!==g&&a||(o[l[u]]=s[l[u]]);return o}function p(o){function s(o,a){if(!(this instanceof s))return new s(o,a);Object.defineProperty(this,"message",{get:function(){return o}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:Error().stack||""}),a&&u(this,a)}return(s.prototype=Object.create(Error.prototype)).constructor=s,Object.defineProperty(s.prototype,"name",{get:function(){return o}}),s.prototype.toString=function(){return this.name+": "+this.message},s}l.asPromise=o(1),l.base64=o(2),l.EventEmitter=o(4),l.float=o(6),l.inquire=o(7),l.utf8=o(10),l.pool=o(9),l.LongBits=o(34),l.isNode=!!("undefined"!=typeof global&&global&&global.process&&global.process.versions&&global.process.versions.node),l.global=l.isNode&&global||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,l.emptyArray=Object.freeze?Object.freeze([]):[],l.emptyObject=Object.freeze?Object.freeze({}):{},l.isInteger=Number.isInteger||function(o){return"number"==typeof o&&isFinite(o)&&Math.floor(o)===o},l.isString=function(o){return"string"==typeof o||o instanceof String},l.isObject=function(o){return o&&"object"==typeof o},l.isset=l.isSet=function(o,s){var a=o[s];return null!=a&&o.hasOwnProperty(s)&&("object"!=typeof a||0<(Array.isArray(a)?a.length:Object.keys(a).length))},l.Buffer=null,l.v=null,l.b=null,l.newBuffer=function(o){return"number"==typeof o?l.Buffer?l.b(o):new l.Array(o):l.Buffer?l.v(o):"undefined"==typeof Uint8Array?o:new Uint8Array(o)},l.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,l.Long=l.global.dcodeIO&&l.global.dcodeIO.Long||l.global.Long||l.inquire("long"),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(o){return o?l.LongBits.from(o).toHash():l.LongBits.zeroHash},l.longFromHash=function(o,s){var a=l.LongBits.fromHash(o);return l.Long?l.Long.fromBits(a.lo,a.hi,s):a.toNumber(!!s)},l.merge=u,l.lcFirst=function(o){return o[0].toLowerCase()+o.substring(1)},l.newError=p,l.ProtocolError=p("ProtocolError"),l.oneOfGetter=function(o){for(var s={},a=0;a<o.length;++a)s[o[a]]=1;return function(){for(var o=Object.keys(this),a=o.length-1;-1<a;--a)if(1===s[o[a]]&&this[o[a]]!==g&&null!==this[o[a]])return o[a]}},l.oneOfSetter=function(o){return function(s){for(var a=0;a<o.length;++a)o[a]!==s&&delete this[o[a]]}},l.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},l.r=function(){var o=l.Buffer;o?(l.v=o.from!==Uint8Array.from&&o.from||function(s,a){return new o(s,a)},l.b=o.allocUnsafe||function(s){return new o(s)}):l.v=l.b=null}},{1:1,10:10,2:2,34:34,4:4,6:6,7:7,9:9}],36:[function(o,s){s.exports=function(o){var s=l.codegen(["m"],o.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),a={};o.oneofsArray.length&&s("var p={}");for(var h=0;h<o.fieldsArray.length;++h){var d=o.i[h].resolve(),f="m"+l.safeProp(d.name);if(d.optional&&s("if(%s!=null&&m.hasOwnProperty(%j)){",f,d.name),d.map)s("if(!util.isObject(%s))",f)("return%j",u(d,"object"))("var k=Object.keys(%s)",f)("for(var i=0;i<k.length;++i){"),c(s,d,"k[i]"),p(s,d,h,f+"[k[i]]")("}");else if(d.repeated)s("if(!Array.isArray(%s))",f)("return%j",u(d,"array"))("for(var i=0;i<%s.length;++i){",f),p(s,d,h,f+"[i]")("}");else{if(d.partOf){var m=l.safeProp(d.partOf.name);1===a[d.partOf.name]&&s("if(p%s===1)",m)("return%j",d.partOf.name+": multiple values"),a[d.partOf.name]=1,s("p%s=1",m)}p(s,d,h,f)}d.optional&&s("}")}return s("return null")};var a=o(14),l=o(33);function u(o,s){return o.name+": "+s+(o.repeated&&"array"!==s?"[]":o.map&&"object"!==s?"{k:"+o.keyType+"}":"")+" expected"}function p(o,s,l,p){if(s.resolvedType)if(s.resolvedType instanceof a){o("switch(%s){",p)("default:")("return%j",u(s,"enum value"));for(var c=Object.keys(s.resolvedType.values),h=0;h<c.length;++h)o("case %i:",s.resolvedType.values[c[h]]);o("break")("}")}else o("{")("var e=types[%i].verify(%s);",l,p)("if(e)")("return%j+e",s.name+".")("}");else switch(s.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":o("if(!util.isInteger(%s))",p)("return%j",u(s,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":o("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",p,p,p,p)("return%j",u(s,"integer|Long"));break;case"float":case"double":o('if(typeof %s!=="number")',p)("return%j",u(s,"number"));break;case"bool":o('if(typeof %s!=="boolean")',p)("return%j",u(s,"boolean"));break;case"string":o("if(!util.isString(%s))",p)("return%j",u(s,"string"));break;case"bytes":o('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',p,p,p)("return%j",u(s,"buffer"))}return o}function c(o,s,a){switch(s.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":o("if(!util.key32Re.test(%s))",a)("return%j",u(s,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":o("if(!util.key64Re.test(%s))",a)("return%j",u(s,"integer|Long key"));break;case"bool":o("if(!util.key2Re.test(%s))",a)("return%j",u(s,"boolean key"))}return o}},{14:14,33:33}],37:[function(o,s,a){var l=a,u=o(19);l[".google.protobuf.Any"]={fromObject:function(o){if(o&&o["@type"]){var s=o["@type"].substring(1+o["@type"].lastIndexOf("/")),a=this.lookup(s);if(a){var l="."==o["@type"][0]?o["@type"].substr(1):o["@type"];return~l.indexOf("/")||(l="/"+l),this.create({type_url:l,value:a.encode(a.fromObject(o)).finish()})}}return this.fromObject(o)},toObject:function(o,s){var a="",l="";if(s&&s.json&&o.type_url&&o.value){l=o.type_url.substring(1+o.type_url.lastIndexOf("/")),a=o.type_url.substring(0,1+o.type_url.lastIndexOf("/"));var p=this.lookup(l);p&&(o=p.decode(o.value))}if(o instanceof this.ctor||!(o instanceof u))return this.toObject(o,s);var c=o.$type.toObject(o,s);return""===a&&(a="type.googleapis.com/"),l=a+("."===o.$type.fullName[0]?o.$type.fullName.substr(1):o.$type.fullName),c["@type"]=l,c}}},{19:19}],38:[function(o,s){s.exports=m;var a,l=o(35),u=l.LongBits,p=l.base64,c=l.utf8;function h(o,s,a){this.fn=o,this.len=s,this.next=g,this.val=a}function d(){}function f(o){this.head=o.head,this.tail=o.tail,this.len=o.len,this.next=o.states}function m(){this.len=0,this.head=new h(d,0,0),this.tail=this.head,this.states=null}function y(){return l.Buffer?function(){return(m.create=function(){return new a})()}:function(){return new m}}function v(o,s,a){s[a]=255&o}function b(o,s){this.len=o,this.next=g,this.val=s}function _(o,s,a){for(;o.hi;)s[a++]=127&o.lo|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;127<o.lo;)s[a++]=127&o.lo|128,o.lo=o.lo>>>7;s[a++]=o.lo}function w(o,s,a){s[a]=255&o,s[a+1]=o>>>8&255,s[a+2]=o>>>16&255,s[a+3]=o>>>24}m.create=y(),m.alloc=function(o){return new l.Array(o)},l.Array!==Array&&(m.alloc=l.pool(m.alloc,l.Array.prototype.subarray)),m.prototype.p=function(o,s,a){return this.tail=this.tail.next=new h(o,s,a),this.len+=s,this},(b.prototype=Object.create(h.prototype)).fn=function(o,s,a){for(;127<o;)s[a++]=127&o|128,o>>>=7;s[a]=o},m.prototype.uint32=function(o){return this.len+=(this.tail=this.tail.next=new b((o>>>=0)<128?1:o<16384?2:o<2097152?3:o<268435456?4:5,o)).len,this},m.prototype.int32=function(o){return o<0?this.p(_,10,u.fromNumber(o)):this.uint32(o)},m.prototype.sint32=function(o){return this.uint32((o<<1^o>>31)>>>0)},m.prototype.int64=m.prototype.uint64=function(o){var s=u.from(o);return this.p(_,s.length(),s)},m.prototype.sint64=function(o){var s=u.from(o).zzEncode();return this.p(_,s.length(),s)},m.prototype.bool=function(o){return this.p(v,1,o?1:0)},m.prototype.sfixed32=m.prototype.fixed32=function(o){return this.p(w,4,o>>>0)},m.prototype.sfixed64=m.prototype.fixed64=function(o){var s=u.from(o);return this.p(w,4,s.lo).p(w,4,s.hi)},m.prototype.float=function(o){return this.p(l.float.writeFloatLE,4,o)},m.prototype.double=function(o){return this.p(l.float.writeDoubleLE,8,o)};var A=l.Array.prototype.set?function(o,s,a){s.set(o,a)}:function(o,s,a){for(var l=0;l<o.length;++l)s[a+l]=o[l]};m.prototype.bytes=function(o){var s=o.length>>>0;if(!s)return this.p(v,1,0);if(l.isString(o)){var a=m.alloc(s=p.length(o));p.decode(o,a,0),o=a}return this.uint32(s).p(A,s,o)},m.prototype.string=function(o){var s=c.length(o);return s?this.uint32(s).p(c.write,s,o):this.p(v,1,0)},m.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new h(d,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 h(d,0,0),this.len=0),this},m.prototype.ldelim=function(){var o=this.head,s=this.tail,a=this.len;return this.reset().uint32(a),a&&(this.tail.next=o.next,this.tail=s,this.len+=a),this},m.prototype.finish=function(){for(var o=this.head.next,s=this.constructor.alloc(this.len),a=0;o;)o.fn(o.val,s,a),a+=o.len,o=o.next;return s},m.r=function(o){a=o,m.create=y(),a.r()}},{35:35}],39:[function(o,s){s.exports=u;var a=o(38);(u.prototype=Object.create(a.prototype)).constructor=u;var l=o(35);function u(){a.call(this)}function p(o,s,a){o.length<40?l.utf8.write(o,s,a):s.utf8Write?s.utf8Write(o,a):s.write(o,a)}u.r=function(){u.alloc=l.b,u.writeBytesBuffer=l.Buffer&&l.Buffer.prototype instanceof Uint8Array&&"set"===l.Buffer.prototype.set.name?function(o,s,a){s.set(o,a)}:function(o,s,a){if(o.copy)o.copy(s,a,0,o.length);else for(var l=0;l<o.length;)s[a++]=o[l++]}},u.prototype.bytes=function(o){l.isString(o)&&(o=l.v(o,"base64"));var s=o.length>>>0;return this.uint32(s),s&&this.p(u.writeBytesBuffer,s,o),this},u.prototype.string=function(o){var s=l.Buffer.byteLength(o);return this.uint32(s),s&&this.p(p,s,o),this},u.r()},{35:35,38:38}]},e={},t=[16],__protobufjs=function o(s){var a=e[s];return a||r[s][0].call(a=e[s]={exports:{}},o,a,a.exports),a.exports}(t[0])}();import{utility,schemaUtil,LazyMapToList}from"o11y/shared";const activity={namespace:"sf.instrumentation",name:"Activity",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Activity:{reserved:[[5,5],[7,7]],fields:{duration:{options:{},id:3,type:"double"},stopReason:{options:{},id:6,type:"string"},isRoot:{options:{},id:8,type:"bool"},name:{options:{"(meta.max_length)":25},id:2,type:"string"},isSampled:{options:{},id:11,type:"bool"},preRootId:{options:{},id:9,type:"string"},id:{options:{},id:1,type:"string"},userPayload:{options:{},id:4,type:"Payload"},errorCount:{options:{},id:10,type:"uint32"}}},Payload:{fields:{payload:{options:{},id:2,type:"bytes"},schemaName:{options:{},id:1,type:"string"}}}}}}}}}},core_envelope={namespace:"sf.instrumentation",name:"CoreEnvelope",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MessageBundle:{fields:{messages:{options:{},rule:"repeated",id:2,type:"LogMessage"},schemaName:{options:{},id:1,type:"string"}}},Metrics:{fields:{valueRecorders:{options:{},rule:"repeated",id:2,type:"ValueRecorder"},upCounters:{options:{},rule:"repeated",id:1,type:"UpCounter"}}},CoreEnvelopeDiagnostics:{fields:{schemaVersion:{options:{},id:6,type:"string"},generatedTimestamp:{options:{},id:2,type:"double"},bundleCount:{options:{},id:3,type:"uint32"},upCounterCount:{options:{},id:4,type:"uint32"},valueRecorderCount:{options:{},id:5,type:"uint32"},key:{options:{},id:1,type:"string"}}},LogMessage:{fields:{appPayload:{options:{},id:10,type:"Payload"},data:{options:{},id:2,type:"bytes"},rootId:{options:{},id:4,type:"string"},pagePayload:{options:{},id:7,type:"Payload"},loggerAppName:{options:{},id:8,type:"string"},loggerName:{options:{},id:6,type:"string"},connectionType:{options:{},id:9,type:"string"},age:{options:{},id:3,type:"double"},seq:{options:{},id:5,type:"uint32"},timestamp:{options:{},id:1,type:"double"}}},CoreEnvelope:{options:{"(meta.msg.desc)":"This message is used to contain data that the Core ui-telemetry Connect API endpoint accepts."},fields:{diagnostics:{options:{},id:1,type:"CoreEnvelopeDiagnostics"},bundles:{options:{},rule:"repeated",id:2,type:"MessageBundle"},metrics:{options:{},id:3,type:"Metrics"},staticAttributes:{options:{},id:4,type:"StaticAttributes"}}},MetricTag:{fields:{name:{options:{},id:1,type:"string"},value:{options:{},id:2,type:"string"}}},ValueRecorder:{fields:{lastUpdatedTimestamp:{options:{},id:3,type:"double"},ownerName:{options:{},id:6,type:"string"},ownerAppName:{options:{},id:7,type:"string"},createdTimestamp:{options:{},id:2,type:"double"},values:{options:{},rule:"repeated",id:4,type:"double"},name:{options:{},id:1,type:"string"},tags:{options:{},rule:"repeated",id:5,type:"MetricTag"}}},StaticAttributes:{fields:{appVersion:{options:{},id:2,type:"string"},appName:{options:{},id:1,type:"string"},deviceModel:{options:{},id:5,type:"string"},sdkVersion:{options:{},id:6,type:"string"},deviceId:{options:{},id:4,type:"string"},appExperience:{options:{},id:3,type:"string"}}},Payload:{fields:{payload:{options:{},id:2,type:"bytes"},schemaName:{options:{},id:1,type:"string"}}},UpCounter:{fields:{lastUpdatedTimestamp:{options:{},id:3,type:"double"},ownerName:{options:{},id:6,type:"string"},ownerAppName:{options:{},id:7,type:"string"},createdTimestamp:{options:{},id:2,type:"double"},name:{options:{},id:1,type:"string"},value:{options:{},id:4,type:"uint32"},tags:{options:{},rule:"repeated",id:5,type:"MetricTag"}}}}}}}}}},error={namespace:"sf.instrumentation",name:"Error",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Error:{reserved:[[5,5],[7,7]],fields:{activityId:{options:{},id:6,type:"string"},stack:{options:{},id:3,type:"string"},name:{options:{},id:1,type:"string"},message:{options:{"(meta.max_length)":200},id:2,type:"string"},userPayload:{options:{},id:4,type:"Payload"}}},Payload:{fields:{payload:{options:{},id:2,type:"bytes"},schemaName:{options:{},id:1,type:"string"}}}}}}}}}},instrumented_event={namespace:"sf.instrumentation",name:"InstrumentedEvent",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MouseEvent:{fields:{cancelable:{options:{},id:5,type:"bool"},ctrlKey:{options:{},id:9,type:"bool"},type:{options:{},id:25,type:"string"},button:{options:{},id:3,type:"uint32"},offsetX:{options:{},id:17,type:"uint32"},eventPhase:{options:{},id:12,type:"uint32"},shiftKey:{options:{},id:23,type:"bool"},offsetY:{options:{},id:18,type:"uint32"},composed:{options:{},id:8,type:"bool"},altKey:{options:{},id:1,type:"bool"},isTrusted:{options:{},id:13,type:"bool"},buttons:{options:{},id:4,type:"uint32"},movementY:{options:{},id:16,type:"uint32"},clientY:{options:{},id:7,type:"uint32"},clientX:{options:{},id:6,type:"uint32"},movementX:{options:{},id:15,type:"uint32"},defaultPrevented:{options:{},id:10,type:"bool"},metaKey:{options:{},id:14,type:"bool"},timeStamp:{options:{},id:24,type:"double"},bubbles:{options:{},id:2,type:"bool"},detail:{options:{},id:11,type:"int64"},pageY:{options:{},id:20,type:"uint32"},pageX:{options:{},id:19,type:"uint32"},screenX:{options:{},id:21,type:"uint32"},screenY:{options:{},id:22,type:"uint32"}}},InstrumentedEvent:{oneofs:{event:{oneof:["mouseEvent"]}},reserved:[[4,4],"xpath",[6,6],[8,8]],fields:{mouseEvent:{options:{},id:7,type:"MouseEvent"},auto:{options:{},id:3,type:"bool"},parentComponent:{options:{},id:2,type:"string"},ownerComponent:{options:{},id:1,type:"string"},userPayload:{options:{},id:5,type:"Payload"},simplePath:{options:{},id:9,type:"string"}}},Payload:{fields:{payload:{options:{},id:2,type:"bytes"},schemaName:{options:{},id:1,type:"string"}}}}}}}}}},simple={namespace:"sf.instrumentation",name:"Simple",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Simple:{options:{"(meta.msg.desc)":"This message is used internally to allow convenient logging of simple text via the API without requiring a schema."},fields:{text:{options:{"(meta.max_length)":25},id:1,type:"string"}}}}}}}}}},version="236.0.0",coreEnvelopeKey="o11y";class CoreEnvelopeBuilder{constructor(){this._envelope={diagnostics:{key:coreEnvelopeKey,generatedTimestamp:void 0,bundleCount:0,upCounterCount:0,valueRecorderCount:0,schemaVersion:version},bundles:[],metrics:{upCounters:[],valueRecorders:[]},staticAttributes:{}}}withStaticAttributes(o){return this._envelope.staticAttributes=o,this}withLogs(o,s){let a=this._envelope.bundles.find((s=>s.schemaName===o));if(a)for(const o of s)a.messages.push(o);else a={schemaName:o,messages:s},this._envelope.bundles.push(a);return this._envelope.diagnostics.bundleCount=this._envelope.bundles.length,this}_getMetricTags(o){const s=o.getTags();if(s)return Object.entries(s).map((o=>({name:o[0],value:o[1].toString()})))}withUpCounters(o){for(const s of o){const o={name:s.getName(),createdTimestamp:s.getCreatedOn(),lastUpdatedTimestamp:s.getLastUpdatedOn(),value:s.getData(),ownerName:s.getOwnerName(),ownerAppName:s.getOwnerAppName(),tags:this._getMetricTags(s)};this._envelope.metrics.upCounters.push(o),s.reset()}return this._envelope.diagnostics.upCounterCount=this._envelope.metrics.upCounters.length,this}withValueRecorders(o){for(const s of o){const o={name:s.getName(),createdTimestamp:s.getCreatedOn(),lastUpdatedTimestamp:s.getLastUpdatedOn(),values:s.getData(),ownerName:s.getOwnerName(),ownerAppName:s.getOwnerAppName(),tags:this._getMetricTags(s)};this._envelope.metrics.valueRecorders.push(o),s.reset()}return this._envelope.diagnostics.valueRecorderCount=this._envelope.metrics.valueRecorders.length,this}build(){return this._envelope.diagnostics.generatedTimestamp=utility.time().tsNow,this._envelope}}class ProtobufUtil{constructor(){this._typeStore=new Map}getSchemaType(o){utility.requireArgument(o,"schema");const s=schemaUtil.getSchemaId(o);let a=this._typeStore.get(s);if(!a){a=__protobufjs.Root.fromJSON(o.pbjsSchema).lookupType(s),this._typeStore.set(s,a)}return a}validate(o,s){utility.requireArgument(o,"schema"),utility.requireArgument(s,"data");const a=this.getSchemaType(o),l=a.verify(s);if(l)throw new Error(`Data is invalid for ${a.fullName}: ${l}`);return a}encode(o,s){const a=this.validate(o,s),l=a.fromObject(s);return a.encode(l).finish()}encodePayload(o){if(o&&o.schema&&o.payload)return{schemaName:schemaUtil.getSchemaId(o.schema),payload:this.encode(o.schema,o.payload)}}getLogMessage(o,s,a){return{timestamp:a.timestamp,data:this.encode(o,s),age:utility.getAge(a.timestamp),rootId:a.rootId,seq:a.sequence,loggerName:a.loggerName,pagePayload:this.encodePayload(a.pagePayload),loggerAppName:a.loggerAppName,connectionType:a.connectionType,appPayload:this.encodePayload(a.appPayload)}}}const protobufUtil=new ProtobufUtil;class PublicSafety{constructor(o){this._errorCounter=o,this._safeCatchMode=!1}tryCatch(o){try{o()}catch(o){this._prodSafeCatch(o)}}tryCatchReturn(o,s){try{return utility.requireArgument(s,"noopValue"),o()}catch(o){return this._prodSafeCatch(o),s}}_prodSafeCatch(o){let s;try{if(s=!utility.isProduction,s)throw o;if(this._safeCatchMode)throw this._safeCatchMode=!1,new Error("Internal error in prodSafeCatch.");if(this._safeCatchMode=!0,this._errorCounter&&this._errorCounter.increment(),!(o instanceof Error)){const s=o&&o.message||("function"==typeof o.toString?o.toString():"");o=new Error(s)}this._safeCatchMode=!1}catch(o){if(s)throw o;if(o&&console&&"function"==typeof console.error)try{console.error(o)}catch(o){}this._safeCatchMode=!1}}}const defaultTraceIdLengthW3=32,defaultTraceIdLengthB3=16,defaultSpanIdLength=16,headerTraceParent="traceparent",headerB3="b3",headerTraceId="X-B3-TraceId",headerSpanId="X-B3-SpanId",headerSampled="X-B3-Sampled",headerParentSpanId="X-B3-ParentSpanId",defaultActivityNameForFetch="fetch",defaultActivityNameForXhrSend="xhr_send";class Tracing{constructor(o){this.instr=o,utility.requireArgument(o,"instr","object")}static _getB3CompactFormat(o,s,a,l){let u=`${o}-${s}`;return void 0===a&&void 0===l||(u+=a?"-1":"-0",void 0!==l&&(u+=`-${l}`)),u}static _getW3CompactFormat(o,s,a){return`00-${o}-${s}-${a?"01":"00"}`}static _conformTextAsId(o,s){const a=(o=o.toLowerCase()).length;for(let s=0;s<a;s+=1){const a=o[s];if(!(a>="a"&&a<="f"||a>="0"&&a<="9"))throw new Error(`The text '${o}' has an invalid character at index #${s}`)}return a>s?o.substr(a-s):a<s?o.padStart(s,"0"):o}static getHeaders(o,s,a,l){utility.requireArgument(o,"traceId","string"),utility.requireArgument(s,"spanId","string");const u=l&&l.useB3Headers;o=this._conformTextAsId(o,l&&void 0!==l.traceIdEffectiveLength?l.traceIdEffectiveLength:u?defaultTraceIdLengthB3:defaultTraceIdLengthW3),s=this._conformTextAsId(s,defaultSpanIdLength);const p=l&&void 0!==l.parentSpanId&&this._conformTextAsId(l.parentSpanId,defaultSpanIdLength)||void 0,c={};if(u){l&&l.useCompactHeader?c[headerB3]=this._getB3CompactFormat(o,s,a,p):(c[headerTraceId]=o,c[headerSpanId]=s,void 0!==p&&(c[headerParentSpanId]=p),void 0!==a&&(c[headerSampled]=a?"1":"0"))}else c[headerTraceParent]=this._getW3CompactFormat(o,s,a);return c}_disableNetworkInstrumentation(){Tracing._isNetworkInstrumentationEnabled&&(Tracing._originalFetch&&(Tracing._global.fetch=Tracing._originalFetch,Tracing._originalFetch=void 0),Tracing._originalXhr&&(Tracing._global.XMLHttpRequest=Tracing._originalXhr,Tracing._originalXhr=void 0),Tracing._originalXhrSend&&(Tracing._global.XMLHttpRequest.prototype.send=Tracing._originalXhrSend,Tracing._originalXhrSend=void 0),Tracing._isNetworkInstrumentationEnabled=!1)}_enableNetworkInstrumentation(o,s,a,l,u){"function"==typeof Tracing._global.fetch&&(this._overrideFetch(o,s,a,l,u),Tracing._isNetworkInstrumentationEnabled=!0),"function"==typeof Tracing._global.XMLHttpRequest&&(this._overrideXhr(o,s,a,l,u),Tracing._isNetworkInstrumentationEnabled=!0)}_overrideFetch(o,s,a,l,u){Tracing._originalFetch=Tracing._global.fetch;Tracing._global.fetch=async(p,c,...h)=>{let d;try{if(d=o.startActivity(a||defaultActivityNameForFetch),l){c=c||{};const o=d.getTraceHeaders(u);c.headers=Object.assign(c.headers||{},o)}return await Tracing._originalFetch.call(Tracing._global,p,c,...h)}catch(a){throw s&&(d?d.error(a):o.error(a)),a}finally{d&&d.stop()}}}_overrideXhr(o,s,a,l,u){Tracing._originalXhr=Tracing._global.XMLHttpRequest,Tracing._originalXhrSend=Tracing._originalXhr.prototype.send,Tracing._originalXhr.prototype.send=function(...p){let c;const h=this;try{if(h._o11yActivity=c=o.startActivity(a||defaultActivityNameForXhrSend),l){const o=c.getTraceHeaders(u);Object.entries(o).forEach((o=>{h.setRequestHeader(o[0],o[1])}))}Tracing._originalXhrSend.call(this,...p)}catch(a){throw s&&(c?c.error(a):o.error(a)),c&&c.stop(),a}};const p=new Proxy(Tracing._originalXhr,{construct(a){const l=new a;return l.addEventListener("load",(()=>{const o=l._o11yActivity;o&&o.stop()})),l.addEventListener("error",(a=>{const u=new Error("XHR Network-Level Error"),p=l._o11yActivity;p?(s&&p.error(u),p.stop()):s&&o.error(u)})),l.addEventListener("abort",(()=>{const o=l._o11yActivity;o&&o.discard()})),l}});Tracing._global.XMLHttpRequest=p}networkInstrumentation(o){if(utility.requireArgument(o,"options",["boolean","object"]),o){this._disableNetworkInstrumentation();const s="object"==typeof o?o:{};this._enableNetworkInstrumentation(utility.definedValueOrDefault(s.instrumentation,this.instr),utility.definedValueOrDefault(s.logErrors,!0),s.activityName,utility.definedValueOrDefault(s.useTracing,!0),s.tracingHeadersOptions)}else this._disableNetworkInstrumentation()}}Tracing._global=utility.getGlobal(),Tracing._isNetworkInstrumentationEnabled=!1;const timedout="timedout",terminated="terminated",discarded="discarded",stopReason={timedout,terminated,discarded};class ActivityImpl{constructor(o,s,a,l,u,p,c){this._name=o,this._rootId=s,this._onStopped=a,this._onError=l,this._isSampled=c,this._errorCount=0;const{tsNow:h,perfNow:d}=utility.time();if(ActivityImpl._count+=1,this._id=p||utility.generateUniqueId(),this._usePerf="undefined"!=typeof performance&&"function"==typeof performance.mark&&"function"==typeof performance.measure,this._usePerf){this._perfName=`${this._name}__${ActivityImpl._count}`,this._perfId=`${this._name}__${this.id}`;try{performance.mark(this._perfId)}catch(o){this._usePerf=!1}}this._startTimestamp=h,this._startPerfTime=d,u>0&&(this._timer=setTimeout((()=>{this._stopReason=this._stopReason||stopReason.timedout,this.stop()}),u)),this._safety=new PublicSafety}get id(){return this._id}getId(){return this.id}getRootId(){return this._rootId}get stopReason(){return this._stopReason}error(o,s,a){this._safety.tryCatch((()=>{this._errorCount+=1,"string"==typeof o&&(o=new Error(o)),this._onError(o,this._getDetail(s,a))}))}stop(o,s){this._safety.tryCatch((()=>this._stopInternal(o,s)))}_stopInternal(o,s){const a=utility.perfNow();if(this._usePerf)try{performance.measure(this._perfName,this._perfId),performance.clearMarks(this._perfId),performance.clearMeasures(this._perfName)}catch(o){}if(this._timer&&(clearTimeout(this._timer),this._timer=void 0),this.isStopped)return;this._stopPerfTime=a;const l=this._getDetail(o,s);this._onStopped(l)}get isStopped(){return void 0!==this._stopPerfTime}discard(){this._safety.tryCatch((()=>{this._stopReason=this._stopReason||stopReason.discarded,this.stop()}))}terminate(){this._safety.tryCatch((()=>{this._stopReason=this._stopReason||stopReason.terminated,this.stop()}))}getIsSampled(){return this._isSampled||!1}_getDetail(o,s){return{id:this._id,rootId:this._rootId,name:this._name,userSchemaOrText:o,userData:s,stopReason:this._stopReason,startTimestamp:this._startTimestamp,startPerfTime:this._startPerfTime,stopPerfTime:this._stopPerfTime,errorCount:this._errorCount,isSampled:this.getIsSampled()}}getTraceHeaders(o){const s=this.id,a=this._rootId||s;return Tracing.getHeaders(a,s,this.getIsSampled(),o)}getStartTimestamp(){return this._startTimestamp}getStartPerfTime(){return this._startPerfTime}getStopPerfTime(){return this._stopPerfTime}}ActivityImpl._count=0;const id=new Array(16).fill(0).join("");class ActivityNoOp{getId(){return id}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(o){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}}const activityNoOp=Object.freeze(new ActivityNoOp);class DomEventHelpers{getInstrumentedEventData(o,s,a){const l={ownerComponent:s.tagName,parentComponent:s.parentElement&&s.parentElement.tagName||void 0,event:o,simplePath:utility.getXpath(s)};return a&&(l.userPayload=schemaUtil.makePayload(a.schema,a.payload,!0)),l}getMouseEventData(o){return{altKey:o.altKey,bubbles:o.bubbles,button:o.button,buttons:o.buttons,cancelable:o.cancelable,clientX:o.clientX,clientY:o.clientY,composed:o.composed,defaultPrevented:o.defaultPrevented,detail:o.detail,eventPhase:o.eventPhase,isTrusted:o.isTrusted,timeStamp:o.timeStamp,type:o.type,ctrlKey:o.ctrlKey,metaKey:o.metaKey,movementX:o.movementX,movementY:o.movementY,offsetX:o.offsetX,offsetY:o.offsetY,pageX:o.pageX,pageY:o.pageY,screenX:o.screenX,screenY:o.screenY,shiftKey:o.shiftKey}}}const singleton=new DomEventHelpers,domEventHelpers=singleton,maxFieldLength=1e4,minFieldLength=0,maxFourBytesPos=2147483647,maxFourBytesNeg=-2147483648,maxFourBytesUnsigned=4294967295,maxEightBytesPos=0x8000000000000000,maxEightBytesNeg=-0x8000000000000000,maxEightBytesUnsigned=0x10000000000000000;class LogValidator{validate(o,s){const a=schemaUtil.checkSchema(o);utility.requireArgument(s,"data","object");const l=schemaUtil.getTypes(o),u=this.validateFields(s,l[a.message],l,schemaUtil.getSchemaId(o));if(u)throw new Error(u)}validateFields(o,s,a,l){const u=s.oneofs||{},p=s.fields||{};let c;for(const s in o){const h=o[s];if(this.isNullOrUndefinedOrEmpty(h)||(u[s]?c=this.matchFieldTypes(h,u[s].oneof[0],a,l,s):p[s]&&(c=this.matchFieldTypes(h,p[s].type,a,l,s,p[s].rule))),c)return c}}isNullOrUndefinedOrEmpty(o){return null==o||""===o}matchFieldTypes(o,s,a,l,u,p){let c,h;if("repeated"===p){let p;if(Array.isArray(o)){for(const c in o)if(p=this.matchFieldTypes(o[c],s,a,l,u),p)break}else p=`Schema ${l} on field: ${u}, repeated field should be an array`;return p}switch(s){case"string":c="string";break;case"bytes":c="object",o instanceof Uint8Array||(h=`Schema ${l} on field: ${u}, bytes array is malformed`);break;case"bool":c="boolean";break;case"uint32":c="number",h=this.checkNumberRange(o,maxFourBytesUnsigned,0,l,u);break;case"int32":case"sint32":case"fixed32":case"sfixed32":c="number",h=this.checkNumberRange(o,maxFourBytesPos,maxFourBytesNeg,l,u);break;case"uint64":c="number",h=this.checkNumberRange(o,maxEightBytesUnsigned,0,l,u);break;case"fixed64":case"sfixed64":case"int64":case"sint64":c="number",h=this.checkNumberRange(o,maxEightBytesPos,maxEightBytesNeg,l,u);break;case"double":case"float":c="number",Number.isFinite(o)||(h=`Schema ${l} on field: ${u}. Value must be finite`);break;default:const p={},d=Object.keys(a);for(const o in d)p[d[o].toLowerCase()]=d[o];p[s.toLowerCase()]&&(h=this.validateFields(o,a[p[s.toLowerCase()]],a,l),c="object")}const d=(o+"").length;return typeof o!==c?`Schema ${l} on field: ${u}. Expected type ${s} but received type ${typeof o}`:d<minFieldLength||d>maxFieldLength?`Schema ${l} on field: ${u}, exceeded maximum or minimum field length`:h||void 0}checkNumberRange(o,s,a,l,u){if(o>s||o<a)return`Schema ${l} on field: ${u}, number value is too large or small`}}const logValidator=new LogValidator;class UpCounterImpl{constructor(o,s,a,l){this._name=o,this._ownerName=s,this._ownerAppName=a,this._tags=l,this._value=0,this._createdOn=utility.time().tsNow}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this._value}increment(o=1){if("number"==typeof o&&o>0)return this._value+=Math.round(o),void(this._lastUpdatedOn=utility.time().tsNow);throw new Error("UpCounter can only increment positive numbers.")}reset(){this._lastUpdatedOn=void 0,this._value=0}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class ValueRecorderImpl{constructor(o,s,a,l){this._name=o,this._ownerName=s,this._ownerAppName=a,this._tags=l,this._values=new Array,this._createdOn=utility.time().tsNow}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this.values}get values(){return this._values.slice(0,this._values.length)}record(o){if("number"==typeof o)return this._values.push(o),void(this._lastUpdatedOn=utility.time().tsNow);throw new Error("ValueRecorder can only record numbers.")}reset(){this._lastUpdatedOn=void 0,this._values=[]}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class SizeLimitedMap{constructor(o){if(this._map=new Map,!("number"==typeof o&&o>0))throw new Error("maxSize must be a positive number");this._maxSize=Math.ceil(o)}get maxSize(){return this._maxSize}get(o){return this._map.get(o)}has(o){return this._map.has(o)}set(o,s){return!!(this.has(o)||this._map.size<this.maxSize)&&(this._map.set(o,s),!0)}getElements(){return Array.from(this._map.values())}clear(){this._map.clear()}}const maxCounters=1e3,maxValueRecorders=500;var MetricType;!function(o){o[o.Counter=0]="Counter",o[o.Percentile=1]="Percentile"}(MetricType||(MetricType={}));class MetricsImpl{constructor(o,s){this._ownerName=o,this._getOwnerAppName=s,this._upCounters=new SizeLimitedMap(maxCounters),this._valueRecorders=new SizeLimitedMap(maxValueRecorders)}incrementCounter(o,s,a=!1,l={}){this._tagError(l,a),this._upCounter(o,l).increment(s)}trackValue(o,s,a=!1,l={}){this._tagError(l,a),this._valueRecorder(o,l).record(s)}_upCounter(o,s){const{key:a,sortedTags:l}=this._getKeyAndSortedTags(o,s,MetricType.Counter);let u=this._upCounters.get(a);if(!u&&(u=new UpCounterImpl(o,this._ownerName,this._getOwnerAppName(),l),!this._upCounters.set(a,u)))throw new Error(`Max size of ${maxCounters} exceeeded for UpCounters`);return u}_valueRecorder(o,s){const{key:a,sortedTags:l}=this._getKeyAndSortedTags(o,s,MetricType.Percentile);let u=this._valueRecorders.get(a);if(!u&&(u=new ValueRecorderImpl(o,this._ownerName,this._getOwnerAppName(),l),!this._valueRecorders.set(a,u)))throw new Error(`Max size of ${maxValueRecorders} exceeeded for ValueRecorders`);return u}getUpCounters(){return this._upCounters.getElements()}getValueRecorders(){return this._valueRecorders.getElements()}_tagError(o,s){o.status=!0===s?"error":"success"}_getKeyAndSortedTags(o,s,a){const l=Object.keys(s).sort().reduce(((o,a)=>(o[a]=s[a],o)),{});return{key:`${MetricType[a]}:${o}${JSON.stringify(l)}`,sortedTags:l}}}class MockEvent{constructor(o,s,a){this.type=o,this.composed=s,this._composedPaths=a}composedPath(){return this._composedPaths}}const maxActivityDurationMsecs=void 0,reservedMetricCharacters=["`"],reservedMetricNames={internalError:"o11y-error"},denyListMetricNames=Object.freeze(Array.from(Object.values(reservedMetricNames)));class InstrumentationImpl{constructor(o,s){this._nextGen=o,this._name=s,this._onActivityStoppedCallback=this._handleActivityStop.bind(this),this._onActivityErrorCallback=this._handleActivityError.bind(this);for(const o of reservedMetricCharacters)if(this._name.indexOf(o)>=0)throw new Error(`Name cannot include the reserved character "${o}"`);this._safety=new PublicSafety({increment:o=>this._incrementError(o)}),this._metrics=this._initMetrics();const a=schemaUtil.getOptions(simple,"Simple","text");this._simpleTextMaxLength=a?a["(meta.max_length)"]:Number.MAX_VALUE}_initMetrics(){return new MetricsImpl(this.name,(()=>this._nextGen.appName||InstrumentationImpl.defaultAppName))}_incrementError(o=1){this._metrics.incrementCounter(reservedMetricNames.internalError,o,!1)}get name(){return this._name}_wrapUserPayload(o,s,a=!1){let l;return"string"==typeof o?(l=simple,s=o?{text:o.substr(0,this._simpleTextMaxLength)}:void 0):l=o,schemaUtil.makePayload(l,s,a)}log(o,s){this._safety.tryCatch((()=>{const a=utility.time().tsNow;utility.requireArgument(o,"userSchemaOrText",["object","string"]);const l=this._wrapUserPayload(o,s);l&&l.payload&&this._logInternal(this.name,l.schema,l.payload,a,this._nextGen.getRootActivityId())}))}_logInternal(o,s,a,l,u){this._checkInputs(s,a);const p=this._getPayloadFromProvider(this._nextGen.appPayloadProvider),c=this._getPayloadFromProvider(this._nextGen.pagePayloadProvider);return this._nextGen.addLog(o,s,a,l,u,c,p)}error(o,s,a){return this._safety.tryCatch((()=>this._errorInternal(o,s,a,void 0)))}_errorInternal(o,s,a,l){const u=utility.time().tsNow;utility.requireArgument(o,"error",[Error,"string"]),"string"==typeof o&&(o=new Error(o));const p=this._wrapUserPayload(s,a,!0),c={name:o.name,message:o.message,stack:o.stack,userPayload:p,activityId:l};return this._logInternal(this.name,error,c,u,this._nextGen.getRootActivityId())}startActivity(o){return this._safety.tryCatchReturn((()=>{utility.requireArgument(o,"name");return new ActivityImpl(o,this._nextGen.getRootActivityId(),this._onActivityStoppedCallback,this._onActivityErrorCallback,maxActivityDurationMsecs,void 0,this._nextGen.isRootActivitySampled())}),activityNoOp)}_getActivityData(o){const s=this._wrapUserPayload(o.userSchemaOrText,o.userData,!0);return{id:o.id,name:o.name,duration:o.stopPerfTime-o.startPerfTime,stopReason:o.stopReason,userPayload:s,errorCount:o.errorCount,isSampled:o.isSampled}}_handleActivityStop(o){if(o.stopReason===discarded)return;const s=this._getActivityData(o);this._logActivity(s,o.startTimestamp,o.rootId)}_logActivity(o,s,a){this._logInternal(this.name,activity,o,s,a)}_handleActivityError(o,s){this._errorInternal(o,s.userSchemaOrText,s.userData,s.id)}_getPayloadFromProvider(o){if(o){const s=o.getPayload();if(s)return this._checkInputs(s.schema,s.payload),s}}domEvent(o,s,a,l,u){this._safety.tryCatch((()=>{const p=utility.time().tsNow;let c;utility.requireArgument(o,"event",[Event,MockEvent]),utility.requireArgument(s,"handledBy",[HTMLElement,"object"]),s instanceof HTMLElement?c=s:(s=s).template&&s.template.host instanceof HTMLElement?c=s.template.host:utility.requireArgument(void 0,"handledBy");const h=this._wrapUserPayload(a,l,!0);switch(o.type){case"click":{const s=o,a=this._nextGen.getClickTracker();a&&a.markEventHandled(s);const l=domEventHelpers.getMouseEventData(s),d=domEventHelpers.getInstrumentedEventData(l,c,h);d.auto=u,this._logInternal(this.name,instrumented_event,d,p,this._nextGen.getRootActivityId());break}default:throw new Error(utility.notImplemented)}}))}incrementCounter(o,s=1,a=!1,l={}){this._safety.tryCatch((()=>{utility.requireArgument(o,"operation","string"),utility.checkForDenyListedValues(o,"operation",denyListMetricNames),utility.checkForReservedCharacters(o,"operation",reservedMetricCharacters),utility.requireArgument(s,"increment","number"),utility.requireArgument(a,"hasError","boolean"),utility.requireArgument(l,"tags","object"),Object.entries(l).forEach((o=>{utility.requireArgument(o[1],`Tag value for '${o[0]}'`,["string","number","boolean"])})),this._metrics.incrementCounter(o,s,a,l)}))}trackValue(o,s,a=!1,l={}){this._safety.tryCatch((()=>{utility.requireArgument(o,"operation","string"),utility.checkForDenyListedValues(o,"operation",denyListMetricNames),utility.checkForReservedCharacters(o,"operation",reservedMetricCharacters),utility.requireArgument(s,"value","number"),utility.requireArgument(a,"hasError","boolean"),utility.requireArgument(l,"tags","object"),Object.entries(l).forEach((o=>{utility.requireArgument(o[1],`Tag value for '${o[0]}'`,["string","number","boolean"])})),this._metrics.trackValue(o,s,a,l)}))}_checkInputs(o,s){let a;schemaUtil.checkSchema(o),utility.requireArgument(s,"data","object"),void 0!==s.userPayload&&schemaUtil.isInternal(o)&&(a=s.userPayload,logValidator.validate(a.schema,a.payload),s.userPayload=void 0),logValidator.validate(o,s),void 0!==a&&(s.userPayload=a)}getUpCounters(){return this._metrics.getUpCounters().filter((o=>o.getLastUpdatedOn()))}getValueRecorders(){return this._metrics.getValueRecorders().filter((o=>o.getLastUpdatedOn()))}}InstrumentationImpl.defaultAppName="APP_NOT_REGISTERED";class RootActivityImpl extends ActivityImpl{constructor(o,s,a,l,u){super(o,void 0,s,a,void 0,l||utility.generateUniqueId(32),u)}get preRootId(){return this._preRootId}set preRootId(o){this._preRootId=o}_getDetail(o,s){const a=super._getDetail(o,s);return a.isRoot=!0,a.preRootId=this.preRootId,a}}const rootId=new Array(32).fill(0).join("");class RootActivityNoOp{getId(){return rootId}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(o){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}}const rootActivityNoOp=Object.freeze(new RootActivityNoOp);class AppInstrumentationImpl extends InstrumentationImpl{constructor(){super(...arguments),this._onRootActivityStoppedCallback=this.handleRootActivityStop.bind(this)}startRootActivity(o,s,a){return this._safety.tryCatchReturn((()=>{utility.requireArgument(o,"name");const l=new RootActivityImpl(o,this._onRootActivityStoppedCallback,this._onActivityErrorCallback,s,a);if(this.rootActivity&&!this.rootActivity.isStopped){const o=this.rootActivity.getId();this.rootActivity.terminate(),l.preRootId=o}return this.rootActivity=l,this.rootActivity}),rootActivityNoOp)}handleRootActivityStop(o){if(o.stopReason===discarded)return;const s=this._getActivityData(o);this._logActivity(s,o.startTimestamp),this.rootActivity=void 0}_getActivityData(o){const s=super._getActivityData(o);return s.isRoot=o.isRoot,s.preRootId=o.preRootId,s}getRootActivityId(){return this.rootActivity&&this.rootActivity.getId()}isRootActivitySampled(){return this.rootActivity&&this.rootActivity.getIsSampled()}_initMetrics(){return new MetricsImpl(this.name,(()=>this.name))}}const pathLimit=5;class AutomaticClickTracker{constructor(o,s){this.isActive=!1,this._boundClickListener=this.clickListener.bind(this),utility.requireArgument(o,"instrumentation"),utility.requireArgument(s,"document"),this.instr=o,this.document=s}activate(){this.isActive||(this.document.addEventListener("click",this._boundClickListener,!0),this.isActive=!0)}deactivate(){this.isActive&&(this.document.removeEventListener("click",this._boundClickListener,!0),this.isActive=!1)}markEventHandled(o){this.ignoredEvent=o}clickListener(o){let s=o.composedPath&&o.composedPath();s&&s.length||(s=o.path);const a=this.getClickableElement(s);a&&setTimeout((()=>{o!==this.ignoredEvent&&this.instr.domEvent(o,a,void 0,void 0,!0)}))}getClickableElement(o){const s=o?Math.min(o.length,pathLimit):0;for(let a=0;a<s;a+=1){const s=o[a],l=s.tagName&&s.tagName.toLowerCase();if("a"===l||"button"===l)return s;if("input"===l){const o=s;if(o.type&&"button"===o.type.toLowerCase())return o}}}}const maxInstrumentationLength=80,truncatedText="_CUT",maxInstrumentationLengthBeforeTruncated=maxInstrumentationLength-truncatedText.length;class NextgenImpl{constructor(){this._logCollectors=new Set,this._instruments=new Map,this._sequence=0,this._forceDisabledLogCollectors=new Set,this._logCollectorFailures=new Map,this._isBufferingEnabled=!1,this._buffer=[]}get pagePayloadProvider(){return this._pagePayloadProvider}set pagePayloadProvider(o){this._pagePayloadProvider=o}get appPayloadProvider(){return this._appPayloadProvider}set appPayloadProvider(o){this._appPayloadProvider=o}registerApp(o,s){if(utility.requireArgument(o,"name","string"),this._appInstr)throw new Error("An app has already been registered with instrumentation.");if(this._instruments.get(o))throw new Error(`The instrumentation name ${o} is already taken`);this._appInstr=new AppInstrumentationImpl(this,o),this._instruments.set(o,this._appInstr),this._isBufferingEnabled=s;const a=new Tracing(this._appInstr);return{log:this._appInstr.log.bind(this._appInstr),error:this._appInstr.error.bind(this._appInstr),startActivity:this._appInstr.startActivity.bind(this._appInstr),domEvent:this._appInstr.domEvent.bind(this._appInstr),incrementCounter:this._appInstr.incrementCounter.bind(this._appInstr),trackValue:this._appInstr.trackValue.bind(this._appInstr),networkInstrumentation:a.networkInstrumentation.bind(a),startRootActivity:this._appInstr.startRootActivity.bind(this._appInstr),registerLogCollector:this.registerLogCollector.bind(this),registerMetricsCollector:this.registerMetricsCollector.bind(this),activateClickTracker:this.activateClickTracker.bind(this),deactivateClickTracker:this.deactivateClickTracker.bind(this),disableBuffering:this.disableBuffering.bind(this)}}getInstrumentation(o){utility.requireArgument(o,"name","string"),o.length>maxInstrumentationLength&&(o=o.substr(0,maxInstrumentationLengthBeforeTruncated)+truncatedText);let s=this._instruments.get(o);if(s){if(s===this._appInstr)throw new Error(`The instrumentation name ${o} is being used by the app.`)}else s=new InstrumentationImpl(this,o),this._instruments.set(o,s);return s}get appName(){return this._appInstr&&this._appInstr.name}addLog(o,s,a,l,u,p,c){this._sequence+=1;const h={timestamp:l,rootId:u,sequence:this._sequence,loggerName:o,pagePayload:p,appPayload:c,loggerAppName:this.appName,connectionType:utility.getConnectionType()};this._isBufferingEnabled&&this._buffer.push({schema:s,data:utility.clone(a),logMeta:h});for(const o of this._logCollectors){const l=utility.clone(a),u=this._logCollectorFailures.get(o);try{this._forceDisabledLogCollectors.has(o)||o.getIsCollectDisabled&&o.getIsCollectDisabled()||(o.collect(s,l,h),u>0&&this._logCollectorFailures.set(o,u-1))}catch(s){u>=NextgenImpl._collectorFailureLimit&&!this._forceDisabledLogCollectors.has(o)?this._forceDisabledLogCollectors.add(o):this._logCollectorFailures.set(o,u+1)}}return this._sequence}getBuffer(){return this._buffer}disableBuffering(){this._isBufferingEnabled=!1,this._buffer=[]}getClickTracker(){return this._autoClickTracker}getRootActivityId(){return this._appInstr&&this._appInstr.getRootActivityId()}isRootActivitySampled(){return this._appInstr&&this._appInstr.isRootActivitySampled()}activateClickTracker(){this._autoClickTracker||(this._autoClickTracker=new AutomaticClickTracker(this._appInstr,window.document)),this._autoClickTracker.activate()}deactivateClickTracker(){this._autoClickTracker&&(this._autoClickTracker.deactivate(),this._autoClickTracker=void 0)}registerLogCollector(o,s){if(utility.requireArgument(o,"collector"),this._logCollectors.add(o),this._logCollectorFailures.set(o,0),(!o.getIsCollectDisabled||!o.getIsCollectDisabled())&&s&&s.retroactive)for(const s of this._buffer)o.collect(s.schema,s.data,s.logMeta)}registerMetricsCollector(o){if(utility.requireArgument(o,"collector"),this._metricsCollector)throw new Error("A metrics Collector is already registered.");this._metricsCollector=o,this._metricsCollector.receiveMetricsExtractors({getAllUpCounters:this.getAllUpCounters.bind(this),getAllValueRecorders:this.getAllValueRecorders.bind(this)})}getAllUpCounters(){return Array.from(this._instruments.values()).map((o=>o.getUpCounters())).reduce(((o,s)=>o.concat(s)),[])}getAllValueRecorders(){return Array.from(this._instruments.values()).map((o=>o.getValueRecorders())).reduce(((o,s)=>o.concat(s)),[])}}NextgenImpl._collectorFailureLimit=5;class Index{get _lazyNextGen(){return this._nextgen||(this._nextgen=new NextgenImpl),this._nextgen}registerInstrumentedApp(o,s){s&&s.isProduction&&utility.markProduction();const a=this._lazyNextGen.registerApp(o,s&&s.enableBuffering);return s&&(this._nextgen.appPayloadProvider=s.appPayloadProvider,this._nextgen.pagePayloadProvider=s.pagePayloadProvider),a}getInstrumentation(o){return this._lazyNextGen.getInstrumentation(o)}}const index=new Index;index.registerInstrumentedApp.bind(index);const getInstrumentation=index.getInstrumentation.bind(index);utility.time.bind(utility);const maxUniqueSchemas=1e4,maxDelay_msecs=1e4,uploadThreshold_items=10,formDataKey="telemetry";var UploadMode;!function(o){o[o.fetchBinary=0]="fetchBinary",o[o.fetchFile=1]="fetchFile",o[o.noUpload=2]="noUpload"}(UploadMode||(UploadMode={}));class CoreCollector{constructor(o,s,a){if(this._apiEndpoint=o,this._uploadMode=s,this.environment=a,this._messageBuffers=new LazyMapToList(maxUniqueSchemas),this._instr=getInstrumentation("CoreCollector"),o){if(void 0===s)this._uploadMode=UploadMode.fetchBinary;else if(!(s in UploadMode))throw new Error(`Unsupported upload mode: ${s}`)}else this._uploadMode=UploadMode.noUpload;const l=__protobufjs.Root.fromJSON(core_envelope.pbjsSchema);this._coreEnvelopeType=l.lookupType("CoreEnvelope"),a&&(this._staticAttributes={appName:a.appName,appVersion:a.appVersion,appExperience:a.appExperience,deviceId:a.deviceId,deviceModel:a.deviceModel,sdkVersion:a.sdkVersion})}getIsCollectDisabled(){return this._isFull()}getProtoEncodedCoreEnvelope(){return this._getProtoEncodedCoreEnvelope()}getByteSize(){return this._messageBuffers.byteSizeOfValues}_isFull(){return this._messageBuffers.totalItemCount===this._messageBuffers.maxSize}_stopTimer(){void 0!==this._intervalHandle&&clearInterval(this._intervalHandle)}_restartTimer(){this._stopTimer(),this._intervalHandle=setInterval((()=>{this._upload()}),maxDelay_msecs)}collect(o,s,a){const l=0===this._messageBuffers.totalItemCount;schemaUtil.isInternal(o)&&s.userPayload&&(s.userPayload=protobufUtil.encodePayload(s.userPayload)),this._messageBuffers.push(o,protobufUtil.getLogMessage(o,s,a))?l&&this._restartTimer():(this._instr.error(new Error("Buffer is full"),schemaUtil.getSchemaId(o)),this._stopTimer(),this._upload()),!this.getIsCollectDisabled()&&this._shouldUpload()&&(this._stopTimer(),this._upload())}_shouldUpload(){return this._immediateUpload||this._messageBuffers.totalItemCount>=uploadThreshold_items}async _upload(){try{if(this._uploadMode===UploadMode.noUpload)return;const o=this._getProtoEncodedCoreEnvelope();if(!o)return;let s;switch(this._uploadMode){case UploadMode.fetchBinary:s={method:"POST",headers:{"Content-Type":"application/octet-stream"},body:o};break;case UploadMode.fetchFile:const a=new FormData;a.append(formDataKey,new Blob([o])),s={method:"POST",body:a}}s&&await fetch(this._apiEndpoint,s)}catch(o){this._instr.error(o)}}_getProtoEncodedCoreEnvelope(){if(!this._messageBuffers.totalItemCount)return;const o=(new CoreEnvelopeBuilder).withStaticAttributes(this._staticAttributes);this._messageBuffers.extractAllMessages().forEach(((s,a)=>{o.withLogs(schemaUtil.getSchemaId(a),s)})),this._metricsExtractors&&o.withUpCounters(this._metricsExtractors.getAllUpCounters()).withValueRecorders(this._metricsExtractors.getAllValueRecorders());const s=o.build(),a=this._coreEnvelopeType.verify(s);if(a)throw new Error(`Invalid CoreEnvelope: ${a}`);return this._coreEnvelopeType.encode(s).finish()}receiveMetricsExtractors(o){this._metricsExtractors=o}}const metricsCollectionMilliseconds=3e4;class HybridCollector{constructor(){if("undefined"==typeof __nimbus)throw new Error("Nimbus is unavailable");if(!__nimbus.plugins||!__nimbus.plugins.observability)throw new Error("Observability plugin not found in Nimbus plugins");this._observability=__nimbus.plugins.observability,setInterval((()=>{this._collectMetrics()}),metricsCollectionMilliseconds)}collect(o,s,a){schemaUtil.isInternal(o)&&s.userPayload&&(s.userPayload=protobufUtil.encodePayload(s.userPayload));const l=protobufUtil.getLogMessage(o,s,a),u={timestamp:a.timestamp,rootId:a.rootId,sequence:a.sequence,loggerName:a.loggerName,pagePayload:l.pagePayload,loggerAppName:a.loggerAppName,connectionType:a.connectionType,appPayload:l.appPayload};this._observability.log(schemaUtil.getSchemaId(o),l.data,u)}receiveMetricsExtractors(o){this._metricsExtractors=o}addRootActivityListeners(o,s){utility.requireArgument(o,"activityStarted","function"),utility.requireArgument(s,"activityEnded","function"),this._observability.addRootActivityListeners(o,s)}notifyIdleDetected(o){this._observability.idleDetected(o)}_collectMetrics(){if(this._metricsExtractors){const o=this._metricsExtractors.getAllUpCounters(),s=this._metricsExtractors.getAllValueRecorders(),a=[],l=[];for(const o of s){const s={name:o.getName(),createdTimestamp:o.getCreatedOn(),lastUpdatedTimestamp:o.getLastUpdatedOn(),values:o.getData(),ownerName:o.getOwnerName(),ownerAppName:o.getOwnerAppName(),tags:this._getMetricTags(o)};a.push(s),o.reset()}for(const s of o){const o={name:s.getName(),createdTimestamp:s.getCreatedOn(),lastUpdatedTimestamp:s.getLastUpdatedOn(),value:s.getData(),ownerName:s.getOwnerName(),ownerAppName:s.getOwnerAppName(),tags:this._getMetricTags(s)};l.push(o),s.reset()}if(a.length>0||l.length>0){const o={upCounters:l,valueRecorders:a};this._observability.logMetrics(o)}}}_getMetricTags(o){const s=o.getTags();return s?Object.entries(s).map((o=>({name:o[0],value:o[1].toString()}))):[]}}export{CoreCollector,HybridCollector};
|
|
8
8
|
//# sourceMappingURL=collectors.js.map
|