ATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(A,q,K){var Y=this.doc.implementation;if(Y&&Y.createDocumentType){var z=Y.createDocumentType(A,q,K);this.locator&&hV6(this.locator,z),DN1(this,z),this.doc.doctype=z}},warning:function(A){console.warn("[xmldom warning]\t"+A,wb8(this.locator))},error:function(A){console.error("[xmldom error]\t"+A,wb8(this.locator))},fatalError:function(A){throw new MkY(A,this.locator)}};function wb8(A){if(A)return` @`+(A.systemId||"")+"#[line:"+A.lineNumber+",col:"+A.columnNumber+"]"}function wI4(A,q,K){if(typeof A=="string")return A.substr(q,K);else{if(A.length>=q+K||q)return new java.lang.String(A,q,K)+"";return A}}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(A){Zi6.prototype[A]=function(){return null}});function DN1(A,q){if(!A.currentElement)A.doc.appendChild(q);else A.currentElement.appendChild(q)}PkY.__DOMHandler=Zi6;PkY.normalizeLineEndings=$I4;PkY.DOMParser=OI4});var JI4=C((fkY)=>{var jI4=Yb8();fkY.DOMImplementation=jI4.DOMImplementation;fkY.XMLSerializer=jI4.XMLSerializer;fkY.DOMParser=HI4().DOMParser});var DI4=C((LkY)=>{var{DOMParser:vkY}=JI4();LkY.parse=EkY;var XN1=3,MI4=4,kkY=8;function _b8(A){return A.nodeType===XN1||A.nodeType===kkY||A.nodeType===MI4}function Yn(A){if(!A.childNodes||A.childNodes.length===0)return!0;else return!1}function kw6(A,q){if(!A)throw Error(q)}function EkY(A){var q=new vkY().parseFromString(A);kw6(q.documentElement.nodeName==="plist","malformed document. First element should be ");var K=IV6(q.documentElement);if(K.length==1)K=K[0];return K}function IV6(A){var q,K,Y,z,w,_,$,O;if(!A)return null;if(A.nodeName==="plist"){if(w=[],Yn(A))return w;for(q=0;q."),Y=IV6(A.childNodes[q]);else kw6(A.childNodes[q].nodeName!=="key",'Unexpected key "'+IV6(A.childNodes[q])+'" while parsing .'),K[Y]=IV6(A.childNodes[q]);$+=1}if($%2===1)K[Y]="";return K}else if(A.nodeName==="array"){if(w=[],Yn(A))return w;for(q=0;q{(function(){var A,q,K,Y,z,w,_,$={}.hasOwnProperty;A=function(O,...H){var j,J,M,D;if(z(Object.assign))Object.assign.apply(null,arguments);else for(j=0,M=H.length;j{(function(){var A;WI4.exports=A=class{hasFeature(K,Y){return!0}createDocumentType(K,Y,z){throw Error("This DOM method is not implemented.")}createDocument(K,Y,z){throw Error("This DOM method is not implemented.")}createHTMLDocument(K){throw Error("This DOM method is not implemented.")}getFeature(K,Y){throw Error("This DOM method is not implemented.")}}}).call(PI4)});var fI4=C((ZI4,GI4)=>{(function(){var A;GI4.exports=A=class{constructor(){}handleError(K){throw Error(K)}}}).call(ZI4)});var NI4=C((TI4,VI4)=>{(function(){var A;VI4.exports=A=function(){class q{constructor(K){this.arr=K||[]}item(K){return this.arr[K]||null}contains(K){return this.arr.indexOf(K)!==-1}}return Object.defineProperty(q.prototype,"length",{get:function(){return this.arr.length}}),q}.call(this)}).call(TI4)});var EI4=C((vI4,kI4)=>{(function(){var A,q,K;q=fI4(),K=NI4(),kI4.exports=A=function(){class Y{constructor(){var z;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new q,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=z=Object.create(this.defaultParams)}getParameter(z){if(this.params.hasOwnProperty(z))return this.params[z];else return null}canSetParameter(z,w){return!0}setParameter(z,w){if(w!=null)return this.params[z]=w;else return delete this.params[z]}}return Object.defineProperty(Y.prototype,"parameterNames",{get:function(){return new K(Object.keys(this.defaultParams))}}),Y}.call(this)}).call(vI4)});var lJ=C((LI4,yI4)=>{(function(){yI4.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(LI4)});var Ob8=C((RI4,SI4)=>{(function(){var A,q,K;A=lJ(),K=XL(),SI4.exports=q=function(){class Y{constructor(z,w,_){if(this.parent=z,this.parent)this.options=this.parent.options,this.stringify=this.parent.stringify;if(w==null)throw Error("Missing attribute name. "+this.debugInfo(w));this.name=this.stringify.name(w),this.value=this.stringify.attValue(_),this.type=A.Attribute,this.isId=!1,this.schemaTypeInfo=null}clone(){return Object.create(this)}toString(z){return this.options.writer.attribute(this,this.options.writer.filterOptions(z))}debugInfo(z){if(z=z||this.name,z==null)return"parent: <"+this.parent.name+">";else return"attribute: {"+z+"}, parent: <"+this.parent.name+">"}isEqualNode(z){if(z.namespaceURI!==this.namespaceURI)return!1;if(z.prefix!==this.prefix)return!1;if(z.localName!==this.localName)return!1;if(z.value!==this.value)return!1;return!0}}return Object.defineProperty(Y.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(Y.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(Y.prototype,"textContent",{get:function(){return this.value},set:function(z){return this.value=z||""}}),Object.defineProperty(Y.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(Y.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(Y.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(Y.prototype,"specified",{get:function(){return!0}}),Y}.call(this)}).call(RI4)});var PN1=C((CI4,hI4)=>{(function(){var A;hI4.exports=A=function(){class q{constructor(K){this.nodes=K}clone(){return this.nodes=null}getNamedItem(K){return this.nodes[K]}setNamedItem(K){var Y=this.nodes[K.nodeName];return this.nodes[K.nodeName]=K,Y||null}removeNamedItem(K){var Y=this.nodes[K];return delete this.nodes[K],Y||null}item(K){return this.nodes[Object.keys(this.nodes)[K]]||null}getNamedItemNS(K,Y){throw Error("This DOM method is not implemented.")}setNamedItemNS(K){throw Error("This DOM method is not implemented.")}removeNamedItemNS(K,Y){throw Error("This DOM method is not implemented.")}}return Object.defineProperty(q.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),q}.call(this)}).call(CI4)});var WN1=C((II4,bI4)=>{(function(){var A,q,K,Y,z,w,_,$,O={}.hasOwnProperty;({isObject:$,isFunction:_,getValue:w}=ZQ()),z=XL(),A=lJ(),q=Ob8(),Y=PN1(),bI4.exports=K=function(){class H extends z{constructor(j,J,M){var D,X,P,W;super(j);if(J==null)throw Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(J),this.type=A.Element,this.attribs={},this.schemaTypeInfo=null,M!=null)this.attribute(M);if(j.type===A.Document){if(this.isRoot=!0,this.documentObject=j,j.rootObject=this,j.children){W=j.children;for(X=0,P=W.length;X=D;J=0<=D?++M:--M)if(!this.attribs[J].isEqualNode(j.attribs[J]))return!1;return!0}}return Object.defineProperty(H.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(H.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(H.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(H.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(H.prototype,"id",{get:function(){throw Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(H.prototype,"className",{get:function(){throw Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(H.prototype,"classList",{get:function(){throw Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(H.prototype,"attributes",{get:function(){if(!this.attributeMap||!this.attributeMap.nodes)this.attributeMap=new Y(this.attribs);return this.attributeMap}}),H}.call(this)}).call(II4)});var Gi6=C((xI4,uI4)=>{(function(){var A,q;q=XL(),uI4.exports=A=function(){class K extends q{constructor(Y){super(Y);this.value=""}clone(){return Object.create(this)}substringData(Y,z){throw Error("This DOM method is not implemented."+this.debugInfo())}appendData(Y){throw Error("This DOM method is not implemented."+this.debugInfo())}insertData(Y,z){throw Error("This DOM method is not implemented."+this.debugInfo())}deleteData(Y,z){throw Error("This DOM method is not implemented."+this.debugInfo())}replaceData(Y,z,w){throw Error("This DOM method is not implemented."+this.debugInfo())}isEqualNode(Y){if(!super.isEqualNode(Y))return!1;if(Y.data!==this.data)return!1;return!0}}return Object.defineProperty(K.prototype,"data",{get:function(){return this.value},set:function(Y){return this.value=Y||""}}),Object.defineProperty(K.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(K.prototype,"textContent",{get:function(){return this.value},set:function(Y){return this.value=Y||""}}),K}.call(this)}).call(xI4)});var ZN1=C((BI4,mI4)=>{(function(){var A,q,K;A=lJ(),K=Gi6(),mI4.exports=q=class extends K{constructor(z,w){super(z);if(w==null)throw Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=A.CData,this.value=this.stringify.cdata(w)}clone(){return Object.create(this)}toString(z){return this.options.writer.cdata(this,this.options.writer.filterOptions(z))}}}).call(BI4)});var GN1=C((gI4,FI4)=>{(function(){var A,q,K;A=lJ(),q=Gi6(),FI4.exports=K=class extends q{constructor(z,w){super(z);if(w==null)throw Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=A.Comment,this.value=this.stringify.comment(w)}clone(){return Object.create(this)}toString(z){return this.options.writer.comment(this,this.options.writer.filterOptions(z))}}}).call(gI4)});var fN1=C((QI4,UI4)=>{(function(){var A,q,K,Y;({isObject:Y}=ZQ()),K=XL(),A=lJ(),UI4.exports=q=class extends K{constructor(w,_,$,O){super(w);if(Y(_))({version:_,encoding:$,standalone:O}=_);if(!_)_="1.0";if(this.type=A.Declaration,this.version=this.stringify.xmlVersion(_),$!=null)this.encoding=this.stringify.xmlEncoding($);if(O!=null)this.standalone=this.stringify.xmlStandalone(O)}toString(w){return this.options.writer.declaration(this,this.options.writer.filterOptions(w))}}}).call(QI4)});var TN1=C((pI4,dI4)=>{(function(){var A,q,K;K=XL(),A=lJ(),dI4.exports=q=class extends K{constructor(z,w,_,$,O,H){super(z);if(w==null)throw Error("Missing DTD element name. "+this.debugInfo());if(_==null)throw Error("Missing DTD attribute name. "+this.debugInfo(w));if(!$)throw Error("Missing DTD attribute type. "+this.debugInfo(w));if(!O)throw Error("Missing DTD attribute default. "+this.debugInfo(w));if(O.indexOf("#")!==0)O="#"+O;if(!O.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(w));if(H&&!O.match(/^(#FIXED|#DEFAULT)$/))throw Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(w));if(this.elementName=this.stringify.name(w),this.type=A.AttributeDeclaration,this.attributeName=this.stringify.name(_),this.attributeType=this.stringify.dtdAttType($),H)this.defaultValue=this.stringify.dtdAttDefault(H);this.defaultValueType=O}toString(z){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(z))}}}).call(pI4)});var VN1=C((cI4,lI4)=>{(function(){var A,q,K,Y;({isObject:Y}=ZQ()),K=XL(),A=lJ(),lI4.exports=q=function(){class z extends K{constructor(w,_,$,O){super(w);if($==null)throw Error("Missing DTD entity name. "+this.debugInfo($));if(O==null)throw Error("Missing DTD entity value. "+this.debugInfo($));if(this.pe=!!_,this.name=this.stringify.name($),this.type=A.EntityDeclaration,!Y(O))this.value=this.stringify.dtdEntityValue(O),this.internal=!0;else{if(!O.pubID&&!O.sysID)throw Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo($));if(O.pubID&&!O.sysID)throw Error("System identifier is required for a public external entity. "+this.debugInfo($));if(this.internal=!1,O.pubID!=null)this.pubID=this.stringify.dtdPubID(O.pubID);if(O.sysID!=null)this.sysID=this.stringify.dtdSysID(O.sysID);if(O.nData!=null)this.nData=this.stringify.dtdNData(O.nData);if(this.pe&&this.nData)throw Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo($))}}toString(w){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(w))}}return Object.defineProperty(z.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(z.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(z.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(z.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(z.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(z.prototype,"xmlVersion",{get:function(){return null}}),z}.call(this)}).call(cI4)});var NN1=C((iI4,nI4)=>{(function(){var A,q,K;K=XL(),A=lJ(),nI4.exports=q=class extends K{constructor(z,w,_){super(z);if(w==null)throw Error("Missing DTD element name. "+this.debugInfo());if(!_)_="(#PCDATA)";if(Array.isArray(_))_="("+_.join(",")+")";this.name=this.stringify.name(w),this.type=A.ElementDeclaration,this.value=this.stringify.dtdElementValue(_)}toString(z){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(z))}}}).call(iI4)});var vN1=C((rI4,oI4)=>{(function(){var A,q,K;K=XL(),A=lJ(),oI4.exports=q=function(){class Y extends K{constructor(z,w,_){super(z);if(w==null)throw Error("Missing DTD notation name. "+this.debugInfo(w));if(!_.pubID&&!_.sysID)throw Error("Public or system identifiers are required for an external entity. "+this.debugInfo(w));if(this.name=this.stringify.name(w),this.type=A.NotationDeclaration,_.pubID!=null)this.pubID=this.stringify.dtdPubID(_.pubID);if(_.sysID!=null)this.sysID=this.stringify.dtdSysID(_.sysID)}toString(z){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(z))}}return Object.defineProperty(Y.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(Y.prototype,"systemId",{get:function(){return this.sysID}}),Y}.call(this)}).call(rI4)});var kN1=C((aI4,sI4)=>{(function(){var A,q,K,Y,z,w,_,$,O;({isObject:O}=ZQ()),$=XL(),A=lJ(),q=TN1(),Y=VN1(),K=NN1(),z=vN1(),_=PN1(),sI4.exports=w=function(){class H extends ${constructor(j,J,M){var D,X,P,W;super(j);if(this.type=A.DocType,j.children){W=j.children;for(X=0,P=W.length;X{(function(){var A,q,K;A=lJ(),q=XL(),eI4.exports=K=class extends q{constructor(z,w){super(z);if(w==null)throw Error("Missing raw text. "+this.debugInfo());this.type=A.Raw,this.value=this.stringify.raw(w)}clone(){return Object.create(this)}toString(z){return this.options.writer.raw(this,this.options.writer.filterOptions(z))}}}).call(tI4)});var LN1=C((Ab4,qb4)=>{(function(){var A,q,K;A=lJ(),q=Gi6(),qb4.exports=K=function(){class Y extends q{constructor(z,w){super(z);if(w==null)throw Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=A.Text,this.value=this.stringify.text(w)}clone(){return Object.create(this)}toString(z){return this.options.writer.text(this,this.options.writer.filterOptions(z))}splitText(z){throw Error("This DOM method is not implemented."+this.debugInfo())}replaceWholeText(z){throw Error("This DOM method is not implemented."+this.debugInfo())}}return Object.defineProperty(Y.prototype,"isElementContentWhitespace",{get:function(){throw Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(Y.prototype,"wholeText",{get:function(){var z,w,_;_="",w=this.previousSibling;while(w)_=w.data+_,w=w.previousSibling;_+=this.data,z=this.nextSibling;while(z)_=_+z.data,z=z.nextSibling;return _}}),Y}.call(this)}).call(Ab4)});var yN1=C((Kb4,Yb4)=>{(function(){var A,q,K;A=lJ(),q=Gi6(),Yb4.exports=K=class extends q{constructor(z,w,_){super(z);if(w==null)throw Error("Missing instruction target. "+this.debugInfo());if(this.type=A.ProcessingInstruction,this.target=this.stringify.insTarget(w),this.name=this.target,_)this.value=this.stringify.insValue(_)}clone(){return Object.create(this)}toString(z){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(z))}isEqualNode(z){if(!super.isEqualNode(z))return!1;if(z.target!==this.target)return!1;return!0}}}).call(Kb4)});var Hb8=C((zb4,wb4)=>{(function(){var A,q,K;K=XL(),A=lJ(),wb4.exports=q=class extends K{constructor(z){super(z);this.type=A.Dummy}clone(){return Object.create(this)}toString(z){return""}}}).call(zb4)});var Ob4=C((_b4,$b4)=>{(function(){var A;$b4.exports=A=function(){class q{constructor(K){this.nodes=K}clone(){return this.nodes=null}item(K){return this.nodes[K]||null}}return Object.defineProperty(q.prototype,"length",{get:function(){return this.nodes.length||0}}),q}.call(this)}).call(_b4)});var Jb4=C((Hb4,jb4)=>{(function(){jb4.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(Hb4)});var XL=C((Mb4,Db4)=>{(function(){var A,q,K,Y,z,w,_,$,O,H,j,J,M,D,X,P,W,Z,G={}.hasOwnProperty,f=[].splice;({isObject:Z,isFunction:W,isEmpty:P,getValue:X}=ZQ()),$=null,K=null,Y=null,z=null,w=null,M=null,D=null,J=null,_=null,q=null,j=null,O=null,A=null,Db4.exports=H=function(){class V{constructor(N){if(this.parent=N,this.parent)this.options=this.parent.options,this.stringify=this.parent.stringify;if(this.value=null,this.children=[],this.baseURI=null,!$)$=WN1(),K=ZN1(),Y=GN1(),z=fN1(),w=kN1(),M=EN1(),D=LN1(),J=yN1(),_=Hb8(),q=lJ(),j=Ob4(),O=PN1(),A=Jb4()}setParent(N){var v,y,R,h,B;if(this.parent=N,N)this.options=N.options,this.stringify=N.stringify;h=this.children,B=[];for(y=0,R=h.length;y";else if(!((y=this.parent)!=null?y.name:void 0))return"node: <"+N+">";else return"node: <"+N+">, parent: <"+this.parent.name+">"}ele(N,v,y){return this.element(N,v,y)}nod(N,v,y){return this.node(N,v,y)}txt(N){return this.text(N)}dat(N){return this.cdata(N)}com(N){return this.comment(N)}ins(N,v){return this.instruction(N,v)}doc(){return this.document()}dec(N,v,y){return this.declaration(N,v,y)}e(N,v,y){return this.element(N,v,y)}n(N,v,y){return this.node(N,v,y)}t(N){return this.text(N)}d(N){return this.cdata(N)}c(N){return this.comment(N)}r(N){return this.raw(N)}i(N,v){return this.instruction(N,v)}u(){return this.up()}importXMLBuilder(N){return this.importDocument(N)}attribute(N,v){throw Error("attribute() applies to element nodes only.")}att(N,v){return this.attribute(N,v)}a(N,v){return this.attribute(N,v)}removeAttribute(N){throw Error("attribute() applies to element nodes only.")}replaceChild(N,v){throw Error("This DOM method is not implemented."+this.debugInfo())}removeChild(N){throw Error("This DOM method is not implemented."+this.debugInfo())}appendChild(N){throw Error("This DOM method is not implemented."+this.debugInfo())}hasChildNodes(){return this.children.length!==0}cloneNode(N){throw Error("This DOM method is not implemented."+this.debugInfo())}normalize(){throw Error("This DOM method is not implemented."+this.debugInfo())}isSupported(N,v){return!0}hasAttributes(){return this.attribs.length!==0}compareDocumentPosition(N){var v,y;if(v=this,v===N)return 0;else if(this.document()!==N.document()){if(y=A.Disconnected|A.ImplementationSpecific,Math.random()<0.5)y|=A.Preceding;else y|=A.Following;return y}else if(v.isAncestor(N))return A.Contains|A.Preceding;else if(v.isDescendant(N))return A.Contains|A.Following;else if(v.isPreceding(N))return A.Preceding;else return A.Following}isSameNode(N){throw Error("This DOM method is not implemented."+this.debugInfo())}lookupPrefix(N){throw Error("This DOM method is not implemented."+this.debugInfo())}isDefaultNamespace(N){throw Error("This DOM method is not implemented."+this.debugInfo())}lookupNamespaceURI(N){throw Error("This DOM method is not implemented."+this.debugInfo())}isEqualNode(N){var v,y,R;if(N.nodeType!==this.nodeType)return!1;if(N.children.length!==this.children.length)return!1;for(v=y=0,R=this.children.length-1;0<=R?y<=R:y>=R;v=0<=R?++y:--y)if(!this.children[v].isEqualNode(N.children[v]))return!1;return!0}getFeature(N,v){throw Error("This DOM method is not implemented."+this.debugInfo())}setUserData(N,v,y){throw Error("This DOM method is not implemented."+this.debugInfo())}getUserData(N){throw Error("This DOM method is not implemented."+this.debugInfo())}contains(N){if(!N)return!1;return N===this||this.isDescendant(N)}isDescendant(N){var v,y,R,h,B;B=this.children;for(R=0,h=B.length;Ry}treePosition(N){var v,y;if(y=0,v=!1,this.foreachTreeNode(this.document(),function(R){if(y++,!v&&R===N)return v=!0}),v)return y;else return-1}foreachTreeNode(N,v){var y,R,h,B,x;N||(N=this.document()),B=N.children;for(R=0,h=B.length;R{(function(){var A,q={}.hasOwnProperty;Pb4.exports=A=function(){class K{constructor(Y){var z,w,_;if(this.assertLegalChar=this.assertLegalChar.bind(this),this.assertLegalName=this.assertLegalName.bind(this),Y||(Y={}),this.options=Y,!this.options.version)this.options.version="1.0";w=Y.stringify||{};for(z in w){if(!q.call(w,z))continue;_=w[z],this[z]=_}}name(Y){if(this.options.noValidation)return Y;return this.assertLegalName(""+Y||"")}text(Y){if(this.options.noValidation)return Y;return this.assertLegalChar(this.textEscape(""+Y||""))}cdata(Y){if(this.options.noValidation)return Y;return Y=""+Y||"",Y=Y.replace("]]>","]]]]>"),this.assertLegalChar(Y)}comment(Y){if(this.options.noValidation)return Y;if(Y=""+Y||"",Y.match(/--/))throw Error("Comment text cannot contain double-hypen: "+Y);return this.assertLegalChar(Y)}raw(Y){if(this.options.noValidation)return Y;return""+Y||""}attValue(Y){if(this.options.noValidation)return Y;return this.assertLegalChar(this.attEscape(Y=""+Y||""))}insTarget(Y){if(this.options.noValidation)return Y;return this.assertLegalChar(""+Y||"")}insValue(Y){if(this.options.noValidation)return Y;if(Y=""+Y||"",Y.match(/\?>/))throw Error("Invalid processing instruction value: "+Y);return this.assertLegalChar(Y)}xmlVersion(Y){if(this.options.noValidation)return Y;if(Y=""+Y||"",!Y.match(/1\.[0-9]+/))throw Error("Invalid version number: "+Y);return Y}xmlEncoding(Y){if(this.options.noValidation)return Y;if(Y=""+Y||"",!Y.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw Error("Invalid encoding: "+Y);return this.assertLegalChar(Y)}xmlStandalone(Y){if(this.options.noValidation)return Y;if(Y)return"yes";else return"no"}dtdPubID(Y){if(this.options.noValidation)return Y;return this.assertLegalChar(""+Y||"")}dtdSysID(Y){if(this.options.noValidation)return Y;return this.assertLegalChar(""+Y||"")}dtdElementValue(Y){if(this.options.noValidation)return Y;return this.assertLegalChar(""+Y||"")}dtdAttType(Y){if(this.options.noValidation)return Y;return this.assertLegalChar(""+Y||"")}dtdAttDefault(Y){if(this.options.noValidation)return Y;return this.assertLegalChar(""+Y||"")}dtdEntityValue(Y){if(this.options.noValidation)return Y;return this.assertLegalChar(""+Y||"")}dtdNData(Y){if(this.options.noValidation)return Y;return this.assertLegalChar(""+Y||"")}assertLegalChar(Y){var z,w;if(this.options.noValidation)return Y;if(this.options.version==="1.0"){if(z=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,this.options.invalidCharReplacement!==void 0)Y=Y.replace(z,this.options.invalidCharReplacement);else if(w=Y.match(z))throw Error(`Invalid character in string: ${Y} at index ${w.index}`)}else if(this.options.version==="1.1"){if(z=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,this.options.invalidCharReplacement!==void 0)Y=Y.replace(z,this.options.invalidCharReplacement);else if(w=Y.match(z))throw Error(`Invalid character in string: ${Y} at index ${w.index}`)}return Y}assertLegalName(Y){var z;if(this.options.noValidation)return Y;if(Y=this.assertLegalChar(Y),z=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!Y.match(z))throw Error(`Invalid character in name: ${Y}`);return Y}textEscape(Y){var z;if(this.options.noValidation)return Y;return z=this.options.noDoubleEncoding?/(?!&(lt|gt|amp|apos|quot);)&/g:/&/g,Y.replace(z,"&").replace(//g,">").replace(/\r/g," ")}attEscape(Y){var z;if(this.options.noValidation)return Y;return z=this.options.noDoubleEncoding?/(?!&(lt|gt|amp|apos|quot);)&/g:/&/g,Y.replace(z,"&").replace(/{(function(){Zb4.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(Wb4)});var Jb8=C((Gb4,fb4)=>{(function(){var A,q,K,Y,z,w,_,$,O,H,j,J,M,D,X,P,W,Z={}.hasOwnProperty;({assign:W}=ZQ()),A=lJ(),O=fN1(),H=kN1(),K=ZN1(),Y=GN1(),J=WN1(),D=EN1(),X=LN1(),M=yN1(),j=Hb8(),z=TN1(),w=NN1(),_=VN1(),$=vN1(),q=fi6(),fb4.exports=P=class{constructor(f){var V,N,v;f||(f={}),this.options=f,N=f.writer||{};for(V in N){if(!Z.call(N,V))continue;v=N[V],this["_"+V]=this[V],this[V]=v}}filterOptions(f){var V,N,v,y,R,h,B,x,F;if(f||(f={}),f=W({},this.options,f),V={writer:this},V.pretty=f.pretty||!1,V.allowEmpty=f.allowEmpty||!1,V.indent=(N=f.indent)!=null?N:" ",V.newline=(v=f.newline)!=null?v:` `,V.offset=(y=f.offset)!=null?y:0,V.width=(R=f.width)!=null?R:0,V.dontPrettyTextNodes=(h=(B=f.dontPrettyTextNodes)!=null?B:f.dontprettytextnodes)!=null?h:0,V.spaceBeforeSlash=(x=(F=f.spaceBeforeSlash)!=null?F:f.spacebeforeslash)!=null?x:"",V.spaceBeforeSlash===!0)V.spaceBeforeSlash=" ";return V.suppressPrettyCount=0,V.user={},V.state=q.None,V}indent(f,V,N){var v;if(!V.pretty||V.suppressPrettyCount)return"";else if(V.pretty){if(v=(N||0)+V.offset+1,v>0)return Array(v).join(V.indent)}return""}endline(f,V,N){if(!V.pretty||V.suppressPrettyCount)return"";else return V.newline}attribute(f,V,N){var v;if(this.openAttribute(f,V,N),V.pretty&&V.width>0)v=f.name+'="'+f.value+'"';else v=" "+f.name+'="'+f.value+'"';return this.closeAttribute(f,V,N),v}cdata(f,V,N){var v;return this.openNode(f,V,N),V.state=q.OpenTag,v=this.indent(f,V,N)+""+this.endline(f,V,N),V.state=q.None,this.closeNode(f,V,N),v}comment(f,V,N){var v;return this.openNode(f,V,N),V.state=q.OpenTag,v=this.indent(f,V,N)+""+this.endline(f,V,N),V.state=q.None,this.closeNode(f,V,N),v}declaration(f,V,N){var v;if(this.openNode(f,V,N),V.state=q.OpenTag,v=this.indent(f,V,N)+"",v+=this.endline(f,V,N),V.state=q.None,this.closeNode(f,V,N),v}docType(f,V,N){var v,y,R,h,B;if(N||(N=0),this.openNode(f,V,N),V.state=q.OpenTag,h=this.indent(f,V,N),h+="0){h+=" [",h+=this.endline(f,V,N),V.state=q.InsideTag,B=f.children;for(y=0,R=B.length;y",h+=this.endline(f,V,N),V.state=q.None,this.closeNode(f,V,N),h}element(f,V,N){var v,y,R,h,B,x,F,g,b,U,d,l,t,s,H6,Z6,G6,q6,w6;if(N||(N=0),l=!1,this.openNode(f,V,N),V.state=q.OpenTag,t=this.indent(f,V,N)+"<"+f.name,V.pretty&&V.width>0){g=t.length,H6=f.attribs;for(d in H6){if(!Z.call(H6,d))continue;if(v=H6[d],s=this.attribute(v,V,N),y=s.length,g+y>V.width)w6=this.indent(f,V,N+1)+s,t+=this.endline(f,V,N)+w6,g=w6.length;else w6=" "+s,t+=w6,g+=w6.length}}else{Z6=f.attribs;for(d in Z6){if(!Z.call(Z6,d))continue;v=Z6[d],t+=this.attribute(v,V,N)}}if(h=f.children.length,B=h===0?null:f.children[0],h===0||f.children.every(function(j6){return(j6.type===A.Text||j6.type===A.Raw||j6.type===A.CData)&&j6.value===""}))if(V.allowEmpty)t+=">",V.state=q.CloseTag,t+=""+this.endline(f,V,N);else V.state=q.CloseTag,t+=V.spaceBeforeSlash+"/>"+this.endline(f,V,N);else if(V.pretty&&h===1&&(B.type===A.Text||B.type===A.Raw||B.type===A.CData)&&B.value!=null)t+=">",V.state=q.InsideTag,V.suppressPrettyCount++,l=!0,t+=this.writeChildNode(B,V,N+1),V.suppressPrettyCount--,l=!1,V.state=q.CloseTag,t+=""+this.endline(f,V,N);else{if(V.dontPrettyTextNodes){G6=f.children;for(x=0,b=G6.length;x"+this.endline(f,V,N),V.state=q.InsideTag,q6=f.children;for(F=0,U=q6.length;F",l)V.suppressPrettyCount--;t+=this.endline(f,V,N),V.state=q.None}return this.closeNode(f,V,N),t}writeChildNode(f,V,N){switch(f.type){case A.CData:return this.cdata(f,V,N);case A.Comment:return this.comment(f,V,N);case A.Element:return this.element(f,V,N);case A.Raw:return this.raw(f,V,N);case A.Text:return this.text(f,V,N);case A.ProcessingInstruction:return this.processingInstruction(f,V,N);case A.Dummy:return"";case A.Declaration:return this.declaration(f,V,N);case A.DocType:return this.docType(f,V,N);case A.AttributeDeclaration:return this.dtdAttList(f,V,N);case A.ElementDeclaration:return this.dtdElement(f,V,N);case A.EntityDeclaration:return this.dtdEntity(f,V,N);case A.NotationDeclaration:return this.dtdNotation(f,V,N);default:throw Error("Unknown XML node type: "+f.constructor.name)}}processingInstruction(f,V,N){var v;if(this.openNode(f,V,N),V.state=q.OpenTag,v=this.indent(f,V,N)+"",v+=this.endline(f,V,N),V.state=q.None,this.closeNode(f,V,N),v}raw(f,V,N){var v;return this.openNode(f,V,N),V.state=q.OpenTag,v=this.indent(f,V,N),V.state=q.InsideTag,v+=f.value,V.state=q.CloseTag,v+=this.endline(f,V,N),V.state=q.None,this.closeNode(f,V,N),v}text(f,V,N){var v;return this.openNode(f,V,N),V.state=q.OpenTag,v=this.indent(f,V,N),V.state=q.InsideTag,v+=f.value,V.state=q.CloseTag,v+=this.endline(f,V,N),V.state=q.None,this.closeNode(f,V,N),v}dtdAttList(f,V,N){var v;if(this.openNode(f,V,N),V.state=q.OpenTag,v=this.indent(f,V,N)+""+this.endline(f,V,N),V.state=q.None,this.closeNode(f,V,N),v}dtdElement(f,V,N){var v;return this.openNode(f,V,N),V.state=q.OpenTag,v=this.indent(f,V,N)+""+this.endline(f,V,N),V.state=q.None,this.closeNode(f,V,N),v}dtdEntity(f,V,N){var v;if(this.openNode(f,V,N),V.state=q.OpenTag,v=this.indent(f,V,N)+""+this.endline(f,V,N),V.state=q.None,this.closeNode(f,V,N),v}dtdNotation(f,V,N){var v;if(this.openNode(f,V,N),V.state=q.OpenTag,v=this.indent(f,V,N)+""+this.endline(f,V,N),V.state=q.None,this.closeNode(f,V,N),v}openNode(f,V,N){}closeNode(f,V,N){}openAttribute(f,V,N){}closeAttribute(f,V,N){}}}).call(Gb4)});var RN1=C((Tb4,Vb4)=>{(function(){var A,q;q=Jb8(),Vb4.exports=A=class extends q{constructor(Y){super(Y)}document(Y,z){var w,_,$,O,H;z=this.filterOptions(z),O="",H=Y.children;for(_=0,$=H.length;_<$;_++)w=H[_],O+=this.writeChildNode(w,z,0);if(z.pretty&&O.slice(-z.newline.length)===z.newline)O=O.slice(0,-z.newline.length);return O}}}).call(Tb4)});var Mb8=C((Nb4,vb4)=>{(function(){var A,q,K,Y,z,w,_,$;({isPlainObject:$}=ZQ()),K=$b8(),q=EI4(),z=XL(),A=lJ(),_=jb8(),w=RN1(),vb4.exports=Y=function(){class O extends z{constructor(H){super(null);if(this.name="#document",this.type=A.Document,this.documentURI=null,this.domConfig=new q,H||(H={}),!H.writer)H.writer=new w;this.options=H,this.stringify=new _(H)}end(H){var j={};if(!H)H=this.options.writer;else if($(H))j=H,H=this.options.writer;return H.document(this,H.filterOptions(j))}toString(H){return this.options.writer.document(this,this.options.writer.filterOptions(H))}createElement(H){throw Error("This DOM method is not implemented."+this.debugInfo())}createDocumentFragment(){throw Error("This DOM method is not implemented."+this.debugInfo())}createTextNode(H){throw Error("This DOM method is not implemented."+this.debugInfo())}createComment(H){throw Error("This DOM method is not implemented."+this.debugInfo())}createCDATASection(H){throw Error("This DOM method is not implemented."+this.debugInfo())}createProcessingInstruction(H,j){throw Error("This DOM method is not implemented."+this.debugInfo())}createAttribute(H){throw Error("This DOM method is not implemented."+this.debugInfo())}createEntityReference(H){throw Error("This DOM method is not implemented."+this.debugInfo())}getElementsByTagName(H){throw Error("This DOM method is not implemented."+this.debugInfo())}importNode(H,j){throw Error("This DOM method is not implemented."+this.debugInfo())}createElementNS(H,j){throw Error("This DOM method is not implemented."+this.debugInfo())}createAttributeNS(H,j){throw Error("This DOM method is not implemented."+this.debugInfo())}getElementsByTagNameNS(H,j){throw Error("This DOM method is not implemented."+this.debugInfo())}getElementById(H){throw Error("This DOM method is not implemented."+this.debugInfo())}adoptNode(H){throw Error("This DOM method is not implemented."+this.debugInfo())}normalizeDocument(){throw Error("This DOM method is not implemented."+this.debugInfo())}renameNode(H,j,J){throw Error("This DOM method is not implemented."+this.debugInfo())}getElementsByClassName(H){throw Error("This DOM method is not implemented."+this.debugInfo())}createEvent(H){throw Error("This DOM method is not implemented."+this.debugInfo())}createRange(){throw Error("This DOM method is not implemented."+this.debugInfo())}createNodeIterator(H,j,J){throw Error("This DOM method is not implemented."+this.debugInfo())}createTreeWalker(H,j,J){throw Error("This DOM method is not implemented."+this.debugInfo())}}return Object.defineProperty(O.prototype,"implementation",{value:new K}),Object.defineProperty(O.prototype,"doctype",{get:function(){var H,j,J,M;M=this.children;for(j=0,J=M.length;j{(function(){var A,q,K,Y,z,w,_,$,O,H,j,J,M,D,X,P,W,Z,G,f,V,N,v,y={}.hasOwnProperty;({isObject:N,isFunction:V,isPlainObject:v,getValue:f}=ZQ()),A=lJ(),J=Mb8(),D=WN1(),Y=ZN1(),z=GN1(),P=EN1(),G=LN1(),X=yN1(),H=fN1(),j=kN1(),w=TN1(),$=VN1(),_=NN1(),O=vN1(),K=Ob8(),Z=jb8(),W=RN1(),q=fi6(),Eb4.exports=M=class{constructor(h,B,x){var F;if(this.name="?xml",this.type=A.Document,h||(h={}),F={},!h.writer)h.writer=new W;else if(v(h.writer))F=h.writer,h.writer=new W;this.options=h,this.writer=h.writer,this.writerOptions=this.writer.filterOptions(F),this.stringify=new Z(h),this.onDataCallback=B||function(){},this.onEndCallback=x||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}createChildNode(h){var B,x,F,g,b,U,d,l;switch(h.type){case A.CData:this.cdata(h.value);break;case A.Comment:this.comment(h.value);break;case A.Element:F={},d=h.attribs;for(x in d){if(!y.call(d,x))continue;B=d[x],F[x]=B.value}this.node(h.name,F);break;case A.Dummy:this.dummy();break;case A.Raw:this.raw(h.value);break;case A.Text:this.text(h.value);break;case A.ProcessingInstruction:this.instruction(h.target,h.value);break;default:throw Error("This XML node type is not supported in a JS object: "+h.constructor.name)}l=h.children;for(b=0,U=l.length;b=0)this.up();return this.onEnd()}openCurrent(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)}openNode(h){var B,x,F,g;if(!h.isOpen){if(!this.root&&this.currentLevel===0&&h.type===A.Element)this.root=h;if(x="",h.type===A.Element){this.writerOptions.state=q.OpenTag,x=this.writer.indent(h,this.writerOptions,this.currentLevel)+"<"+h.name,g=h.attribs;for(F in g){if(!y.call(g,F))continue;B=g[F],x+=this.writer.attribute(B,this.writerOptions,this.currentLevel)}x+=(h.children?">":"/>")+this.writer.endline(h,this.writerOptions,this.currentLevel),this.writerOptions.state=q.InsideTag}else{if(this.writerOptions.state=q.OpenTag,x=this.writer.indent(h,this.writerOptions,this.currentLevel)+"";x+=this.writer.endline(h,this.writerOptions,this.currentLevel)}return this.onData(x,this.currentLevel),h.isOpen=!0}}closeNode(h){var B;if(!h.isClosed){if(B="",this.writerOptions.state=q.CloseTag,h.type===A.Element)B=this.writer.indent(h,this.writerOptions,this.currentLevel)+""+this.writer.endline(h,this.writerOptions,this.currentLevel);else B=this.writer.indent(h,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(h,this.writerOptions,this.currentLevel);return this.writerOptions.state=q.None,this.onData(B,this.currentLevel),h.isClosed=!0}}onData(h,B){return this.documentStarted=!0,this.onDataCallback(h,B+1)}onEnd(){return this.documentCompleted=!0,this.onEndCallback()}debugInfo(h){if(h==null)return"";else return"node: <"+h+">"}ele(){return this.element(...arguments)}nod(h,B,x){return this.node(h,B,x)}txt(h){return this.text(h)}dat(h){return this.cdata(h)}com(h){return this.comment(h)}ins(h,B){return this.instruction(h,B)}dec(h,B,x){return this.declaration(h,B,x)}dtd(h,B,x){return this.doctype(h,B,x)}e(h,B,x){return this.element(h,B,x)}n(h,B,x){return this.node(h,B,x)}t(h){return this.text(h)}d(h){return this.cdata(h)}c(h){return this.comment(h)}r(h){return this.raw(h)}i(h,B){return this.instruction(h,B)}att(){if(this.currentNode&&this.currentNode.type===A.DocType)return this.attList(...arguments);else return this.attribute(...arguments)}a(){if(this.currentNode&&this.currentNode.type===A.DocType)return this.attList(...arguments);else return this.attribute(...arguments)}ent(h,B){return this.entity(h,B)}pent(h,B){return this.pEntity(h,B)}not(h,B){return this.notation(h,B)}}}).call(kb4)});var Sb4=C((yb4,Rb4)=>{(function(){var A,q,K,Y,z={}.hasOwnProperty;A=lJ(),Y=Jb8(),q=fi6(),Rb4.exports=K=class extends Y{constructor(_,$){super($);this.stream=_}endline(_,$,O){if(_.isLastRootNode&&$.state===q.CloseTag)return"";else return super.endline(_,$,O)}document(_,$){var O,H,j,J,M,D,X,P,W;X=_.children;for(H=j=0,M=X.length;j0){this.stream.write(" ["),this.stream.write(this.endline(_,$,O)),$.state=q.InsideTag,M=_.children;for(j=0,J=M.length;j"),this.stream.write(this.endline(_,$,O)),$.state=q.None,this.closeNode(_,$,O)}element(_,$,O){var H,j,J,M,D,X,P,W,Z,G,f,V,N,v,y,R;if(O||(O=0),this.openNode(_,$,O),$.state=q.OpenTag,f=this.indent(_,$,O)+"<"+_.name,$.pretty&&$.width>0){P=f.length,N=_.attribs;for(Z in N){if(!z.call(N,Z))continue;if(H=N[Z],V=this.attribute(H,$,O),j=V.length,P+j>$.width)R=this.indent(_,$,O+1)+V,f+=this.endline(_,$,O)+R,P=R.length;else R=" "+V,f+=R,P+=R.length}}else{v=_.attribs;for(Z in v){if(!z.call(v,Z))continue;H=v[Z],f+=this.attribute(H,$,O)}}if(this.stream.write(f),M=_.children.length,D=M===0?null:_.children[0],M===0||_.children.every(function(h){return(h.type===A.Text||h.type===A.Raw||h.type===A.CData)&&h.value===""}))if($.allowEmpty)this.stream.write(">"),$.state=q.CloseTag,this.stream.write("");else $.state=q.CloseTag,this.stream.write($.spaceBeforeSlash+"/>");else if($.pretty&&M===1&&(D.type===A.Text||D.type===A.Raw||D.type===A.CData)&&D.value!=null)this.stream.write(">"),$.state=q.InsideTag,$.suppressPrettyCount++,G=!0,this.writeChildNode(D,$,O+1),$.suppressPrettyCount--,G=!1,$.state=q.CloseTag,this.stream.write("");else{this.stream.write(">"+this.endline(_,$,O)),$.state=q.InsideTag,y=_.children;for(X=0,W=y.length;X")}return this.stream.write(this.endline(_,$,O)),$.state=q.None,this.closeNode(_,$,O)}processingInstruction(_,$,O){return this.stream.write(super.processingInstruction(_,$,O))}raw(_,$,O){return this.stream.write(super.raw(_,$,O))}text(_,$,O){return this.stream.write(super.text(_,$,O))}dtdAttList(_,$,O){return this.stream.write(super.dtdAttList(_,$,O))}dtdElement(_,$,O){return this.stream.write(super.dtdElement(_,$,O))}dtdEntity(_,$,O){return this.stream.write(super.dtdEntity(_,$,O))}dtdNotation(_,$,O){return this.stream.write(super.dtdNotation(_,$,O))}}}).call(yb4)});var hb4=C((Cb4,H86)=>{(function(){var A,q,K,Y,z,w,_,$,O;({assign:$,isFunction:O}=ZQ()),K=$b8(),Y=Mb8(),z=Lb4(),_=RN1(),w=Sb4(),A=lJ(),q=fi6(),Cb4.create=function(H,j,J,M){var D,X;if(H==null)throw Error("Root element needs a name.");if(M=$({},j,J,M),D=new Y(M),X=D.element(H),!M.headless){if(D.declaration(M),M.pubID!=null||M.sysID!=null)D.dtd(M)}return X},Cb4.begin=function(H,j,J){if(O(H))[j,J]=[H,j],H={};if(j)return new z(H,j,J);else return new Y(H)},Cb4.stringWriter=function(H){return new _(H)},Cb4.streamWriter=function(H,j){return new w(H,j)},Cb4.implementation=new K,Cb4.nodeType=A,Cb4.writerState=q}).call(Cb4)});var xb4=C((IkY)=>{var Ib4=vT8(),RkY=hb4();IkY.build=hkY;function SkY(A){function q(K){return K<10?"0"+K:K}return A.getUTCFullYear()+"-"+q(A.getUTCMonth()+1)+"-"+q(A.getUTCDate())+"T"+q(A.getUTCHours())+":"+q(A.getUTCMinutes())+":"+q(A.getUTCSeconds())+"Z"}var CkY=Object.prototype.toString;function bb4(A){var q=CkY.call(A).match(/\[object (.*)\]/);return q?q[1]:q}function hkY(A,q){var K={version:"1.0",encoding:"UTF-8"},Y={pubid:"-//Apple//DTD PLIST 1.0//EN",sysid:"http://www.apple.com/DTDs/PropertyList-1.0.dtd"},z=RkY.create("plist");if(z.dec(K.version,K.encoding,K.standalone),z.dtd(Y.pubid,Y.sysid),z.att("version","1.0"),Db8(A,z),!q)q={};return q.pretty=q.pretty!==!1,z.end(q)}function Db8(A,q){var K,Y,z,w=bb4(A);if(w=="Undefined")return;else if(Array.isArray(A)){q=q.ele("array");for(Y=0;Y{var ub4=DI4();Object.keys(ub4).forEach(function(A){Xb8[A]=ub4[A]});var Bb4=xb4();Object.keys(Bb4).forEach(function(A){Xb8[A]=Bb4[A]})});async function GQ(A,q){let Y=T1().preferredNotifChannel;await Xg(A);let z=await xkY(Y,A,q);c("tengu_notification_method_used",{configured_channel:Y,method_used:z,term:YA.terminal})}async function xkY(A,q,K){let Y=q.title||Fb4;try{switch(A){case"auto":return ukY(q,K);case"iterm2":return K.notifyITerm2(q),"iterm2";case"iterm2_with_bell":return K.notifyITerm2(q),K.notifyBell(),"iterm2_with_bell";case"kitty":return K.notifyKitty({...q,title:Y,id:Qb4()}),"kitty";case"terminal_bell":return K.notifyBell(),"terminal_bell";case"notifications_disabled":return"disabled";default:return"none"}}catch{return"error"}}async function ukY(A,q){let K=A.title||Fb4;switch(YA.terminal){case"Apple_Terminal":{if(await BkY())return q.notifyBell(),"terminal_bell";return"no_method_available"}case"iTerm.app":return q.notifyITerm2(A),"iterm2";case"kitty":return q.notifyKitty({...A,title:K,id:Qb4()}),"kitty";case"ghostty":return q.notifyGhostty({...A,title:K}),"ghostty";default:return"no_method_available"}}function Qb4(){return Math.floor(Math.random()*1e4)}async function BkY(){try{if(YA.terminal!=="Apple_Terminal")return!1;let q=(await W8("osascript",["-e",'tell application "Terminal" to name of current settings of front window'])).stdout.trim();if(!q)return!1;let K=await W8("defaults",["export","com.apple.Terminal","-"]);if(K.code!==0)return!1;let w=gb4.default.parse(K.stdout)?.["Window Settings"]?.[q];if(!w)return!1;return w.Bell===!1}catch(A){return $6(A),!1}}var gb4,Fb4="Claude Code";var Ti6=k(()=>{Q8();aq();B1();K9();x1();J$();gb4=e(mb4(),1)});function fQ(A){let q=Y6(29),{isFocused:K,isSelected:Y,children:z,description:w,showScrollDown:_,showScrollUp:$,styled:O,disabled:H}=A,j=Y===void 0?!1:Y,J=O===void 0?!0:O,M=H===void 0?!1:H,D;if(q[0]!==M||q[1]!==K||q[2]!==_||q[3]!==$)D=function(){if(M)return vC.default.createElement(T,null," ");if(K)return vC.default.createElement(T,{color:"suggestion"},q1.pointer);if(_)return vC.default.createElement(T,{dimColor:!0},q1.arrowDown);if($)return vC.default.createElement(T,{dimColor:!0},q1.arrowUp);return vC.default.createElement(T,null," ")},q[0]=M,q[1]=K,q[2]=_,q[3]=$,q[4]=D;else D=q[4];let X=D,P;if(q[5]!==M||q[6]!==K||q[7]!==j||q[8]!==J)P=function(){if(M)return"inactive";if(!J)return;if(j)return"success";if(K)return"suggestion"}(),q[5]=M,q[6]=K,q[7]=j,q[8]=J,q[9]=P;else P=q[9];let W=P,Z;if(q[10]!==X)Z=X(),q[10]=X,q[11]=Z;else Z=q[11];let G;if(q[12]!==z||q[13]!==M||q[14]!==J||q[15]!==W)G=J?vC.default.createElement(T,{color:W,dimColor:M},z):z,q[12]=z,q[13]=M,q[14]=J,q[15]=W,q[16]=G;else G=q[16];let f;if(q[17]!==M||q[18]!==j)f=j&&!M&&vC.default.createElement(T,{color:"success"},q1.tick),q[17]=M,q[18]=j,q[19]=f;else f=q[19];let V;if(q[20]!==Z||q[21]!==G||q[22]!==f)V=vC.default.createElement(m,{flexDirection:"row",gap:1},Z,G,f),q[20]=Z,q[21]=G,q[22]=f,q[23]=V;else V=q[23];let N;if(q[24]!==w)N=w&&vC.default.createElement(m,{paddingLeft:2},vC.default.createElement(T,{color:"inactive"},w)),q[24]=w,q[25]=N;else N=q[25];let v;if(q[26]!==N||q[27]!==V)v=vC.default.createElement(m,{flexDirection:"column"},V,N),q[26]=N,q[27]=V,q[28]=v;else v=q[28];return v}var vC;var Vi6=k(()=>{K1();n6();t7();vC=e(W6(),1)});function j86(A){let q=Y6(7),{isFocused:K,isSelected:Y,children:z,description:w,shouldShowDownArrow:_,shouldShowUpArrow:$}=A,O;if(q[0]!==z||q[1]!==w||q[2]!==K||q[3]!==Y||q[4]!==_||q[5]!==$)O=Ub4.default.createElement(fQ,{isFocused:K,isSelected:Y,description:w,showScrollDown:_,showScrollUp:$,styled:!1},z),q[0]=z,q[1]=w,q[2]=K,q[3]=Y,q[4]=_,q[5]=$,q[6]=O;else O=q[6];return O}var Ub4;var SN1=k(()=>{K1();Vi6();Ub4=e(W6(),1)});var CN1;var pb4=k(()=>{CN1=class CN1 extends Map{first;last;constructor(A){let q=[],K,Y,z,w=0;for(let _ of A){let $={label:_.label,value:_.value,description:_.description,previous:z,next:void 0,index:w};if(z)z.next=$;K||=$,Y=$,q.push([_.value,$]),w++,z=$}super(q);this.first=K,this.last=Y}}});import{isDeepStrictEqual as mkY}from"node:util";function hN1({visibleOptionCount:A=5,options:q,initialFocusValue:K,onFocus:Y,focusValue:z}){let[w,_]=wD.useReducer(gkY,{visibleOptionCount:A,options:q,initialFocusValue:z||K},db4),$=wD.useRef(Y);$.current=Y;let[O,H]=wD.useState(q);if(q!==O&&!mkY(q,O))_({type:"reset",state:db4({visibleOptionCount:A,options:q,initialFocusValue:z??w.focusedValue??K,currentViewport:{visibleFromIndex:w.visibleFromIndex,visibleToIndex:w.visibleToIndex}})}),H(q);let j=wD.useCallback(()=>{_({type:"focus-next-option"})},[]),J=wD.useCallback(()=>{_({type:"focus-previous-option"})},[]),M=wD.useCallback(()=>{_({type:"focus-next-page"})},[]),D=wD.useCallback(()=>{_({type:"focus-previous-page"})},[]),X=wD.useCallback((f)=>{if(f!==void 0)_({type:"set-focus",value:f})},[]),P=wD.useMemo(()=>{return q.map((f,V)=>({...f,index:V})).slice(w.visibleFromIndex,w.visibleToIndex)},[q,w.visibleFromIndex,w.visibleToIndex]),W=wD.useMemo(()=>{if(w.focusedValue===void 0)return;if(q.some((V)=>V.value===w.focusedValue))return w.focusedValue;return q[0]?.value},[w.focusedValue,q]),Z=wD.useMemo(()=>{return q.find((V)=>V.value===W)?.type==="input"},[W,q]);wD.useEffect(()=>{if(W!==void 0)$.current?.(W)},[W]),wD.useEffect(()=>{if(z!==void 0)_({type:"set-focus",value:z})},[z]);let G=wD.useMemo(()=>{if(W===void 0)return 0;let f=q.findIndex((V)=>V.value===W);return f>=0?f+1:0},[W,q]);return{focusedValue:W,focusedIndex:G,visibleFromIndex:w.visibleFromIndex,visibleToIndex:w.visibleToIndex,visibleOptions:P,isInInput:Z??!1,focusNextOption:j,focusPreviousOption:J,focusNextPage:M,focusPreviousPage:D,focusOption:X,options:q}}var wD,gkY=(A,q)=>{switch(q.type){case"focus-next-option":{if(A.focusedValue===void 0)return A;let K=A.optionMap.get(A.focusedValue);if(!K)return A;let Y=K.next||A.optionMap.first;if(!Y)return A;if(!K.next&&Y===A.optionMap.first)return{...A,focusedValue:Y.value,visibleFromIndex:0,visibleToIndex:A.visibleOptionCount};if(!(Y.index>=A.visibleToIndex))return{...A,focusedValue:Y.value};let w=Math.min(A.optionMap.size,A.visibleToIndex+1),_=w-A.visibleOptionCount;return{...A,focusedValue:Y.value,visibleFromIndex:_,visibleToIndex:w}}case"focus-previous-option":{if(A.focusedValue===void 0)return A;let K=A.optionMap.get(A.focusedValue);if(!K)return A;let Y=K.previous||A.optionMap.last;if(!Y)return A;if(!K.previous&&Y===A.optionMap.last){let $=A.optionMap.size,O=Math.max(0,$-A.visibleOptionCount);return{...A,focusedValue:Y.value,visibleFromIndex:O,visibleToIndex:$}}if(!(Y.index<=A.visibleFromIndex))return{...A,focusedValue:Y.value};let w=Math.max(0,A.visibleFromIndex-1),_=w+A.visibleOptionCount;return{...A,focusedValue:Y.value,visibleFromIndex:w,visibleToIndex:_}}case"focus-next-page":{if(A.focusedValue===void 0)return A;let K=A.optionMap.get(A.focusedValue);if(!K)return A;let Y=Math.min(A.optionMap.size-1,K.index+A.visibleOptionCount),z=A.optionMap.first;while(z&&z.index=A.visibleFromIndex&&K.index{let z=typeof A==="number"?Math.min(A,q.length):q.length,w=new CN1(q),_=K!==void 0&&w.get(K),$=_?K:w.first?.value,O=0,H=z;if(_){let j=_.index;if(Y)if(j>=Y.visibleFromIndex&&j=z)H=Math.min(w.size,j+1),O=Math.max(0,H-z);O=Math.max(0,Math.min(O,w.size-1)),H=Math.min(w.size,Math.max(z,H))}return{optionMap:w,visibleOptionCount:z,focusedValue:$,visibleFromIndex:O,visibleToIndex:H}};var Pb8=k(()=>{pb4();wD=e(W6(),1)});function cb4({visibleOptionCount:A=5,options:q,defaultValue:K,onChange:Y,onCancel:z,onFocus:w,focusValue:_}){let[$,O]=IN1.useState(K),H=hN1({visibleOptionCount:A,options:q,initialFocusValue:void 0,onFocus:w,focusValue:_}),j=IN1.useCallback(()=>{O(H.focusedValue)},[H.focusedValue]);return{...H,value:$,selectFocusedOption:j,onChange:Y,onCancel:z}}var IN1;var lb4=k(()=>{Pb8();IN1=e(W6(),1)});function wX(A,q){let K=Y6(5),Y=q===void 0?!0:q,w=bN1.useContext(Ni6)?.setState,_,$;if(K[0]!==Y||K[1]!==A||K[2]!==w)_=()=>{if(!Y||!w)return;return w((O)=>{if(O.activeOverlays.has(A))return O;let H=new Set(O.activeOverlays);return H.add(A),{...O,activeOverlays:H}}),()=>{w((O)=>{if(!O.activeOverlays.has(A))return O;let H=new Set(O.activeOverlays);return H.delete(A),{...O,activeOverlays:H}})}},$=[A,Y,w],K[0]=Y,K[1]=A,K[2]=w,K[3]=_,K[4]=$;else _=K[3],$=K[4];bN1.useEffect(_,$)}function ib4(){return V1(QkY)}function QkY(A){return A.activeOverlays.size>0}function bV6(){return V1(UkY)}function UkY(A){for(let q of A.activeOverlays)if(!FkY.has(q))return!0;return!1}var bN1,FkY;var PL=k(()=>{K1();pA();bN1=e(W6(),1),FkY=new Set(["autocomplete"])});var Wb8,nb4=({isDisabled:A=!1,disableSelection:q=!1,state:K,options:Y,isMultiSelect:z=!1,onUpFromFirstItem:w,onDownFromLastItem:_,onInputModeToggle:$,inputValues:O,imagesSelected:H=!1,onEnterImageSelection:j})=>{wX("select",!!K.onCancel);let J=Wb8.useMemo(()=>{return Y.find((X)=>X.value===K.focusedValue)?.type==="input"},[Y,K.focusedValue]),M=Wb8.useMemo(()=>{let D={};if(!J)D["select:next"]=()=>{if(_){let X=Y[Y.length-1];if(X&&K.focusedValue===X.value){_();return}}K.focusNextOption()},D["select:previous"]=()=>{if(w&&K.visibleFromIndex===0){let X=Y[0];if(X&&K.focusedValue===X.value){w();return}}K.focusPreviousOption()},D["select:accept"]=()=>{if(q===!0)return;if(K.focusedValue===void 0)return;if(Y.find((P)=>P.value===K.focusedValue)?.disabled===!0)return;K.selectFocusedOption?.(),K.onChange?.(K.focusedValue)};if(K.onCancel)D["select:cancel"]=()=>{K.onCancel()};return D},[Y,K,_,w,J,q]);f7(M,{context:"Select",isActive:!A}),kA((D,X,P)=>{let W=xI(D),Z=Y.find((f)=>f.value===K.focusedValue),G=Z?.type==="input";if(X.tab&&$&&K.focusedValue!==void 0){$(K.focusedValue);return}if(G){if(H)return;if(X.downArrow&&j?.()){P.stopImmediatePropagation();return}if(X.downArrow||X.ctrl&&D==="n"){if(_){let f=Y[Y.length-1];if(f&&K.focusedValue===f.value){_(),P.stopImmediatePropagation();return}}K.focusNextOption(),P.stopImmediatePropagation();return}if(X.upArrow||X.ctrl&&D==="p"){if(w&&K.visibleFromIndex===0){let f=Y[0];if(f&&K.focusedValue===f.value){w(),P.stopImmediatePropagation();return}}K.focusPreviousOption(),P.stopImmediatePropagation();return}if(/^[0-9]$/.test(W)&&Z?.type==="input"){if((O?.get(K.focusedValue)??"").trim())return}else return}if(X.pageDown)K.focusNextPage();if(X.pageUp)K.focusPreviousPage();if(q!==!0){if(z&&t31(D)===" "&&K.focusedValue!==void 0){if(Z?.disabled!==!0)K.selectFocusedOption?.(),K.onChange?.(K.focusedValue)}if(q!=="numeric"&&/^[0-9]+$/.test(W)){let f=parseInt(W)-1;if(f>=0&&f{n6();PL();H7();Wb8=e(W6(),1)});import{randomBytes as pkY}from"crypto";import{basename as dkY,extname as ckY,isAbsolute as lkY,join as Zb8}from"path";function ob4(){let A=process.platform,q=process.env.CLAUDE_CODE_TMPDIR||(A==="win32"?process.env.TEMP||"C:\\Temp":"/tmp"),K="claude_cli_latest_screenshot.png",Y={darwin:Zb8(q,"claude_cli_latest_screenshot.png"),linux:Zb8(q,"claude_cli_latest_screenshot.png"),win32:Zb8(q,"claude_cli_latest_screenshot.png")},z=Y[A]||Y.linux,w={darwin:{checkImage:"osascript -e 'the clipboard as «class PNGf»'",saveImage:`osascript -e 'set png_data to (the clipboard as «class PNGf»)' -e 'set fp to open for access POSIX file "${z}" with write permission' -e 'write png_data to fp' -e 'close access fp'`,getPath:"osascript -e 'get POSIX path of (the clipboard as «class furl»)'",deleteFile:`rm -f "${z}"`},linux:{checkImage:'xclip -selection clipboard -t TARGETS -o 2>/dev/null | grep -E "image/(png|jpeg|jpg|gif|webp|bmp)" || wl-paste -l 2>/dev/null | grep -E "image/(png|jpeg|jpg|gif|webp|bmp)"',saveImage:`xclip -selection clipboard -t image/png -o > "${z}" 2>/dev/null || wl-paste --type image/png > "${z}" 2>/dev/null || xclip -selection clipboard -t image/bmp -o > "${z}" 2>/dev/null || wl-paste --type image/bmp > "${z}"`,getPath:"xclip -selection clipboard -t text/plain -o 2>/dev/null || wl-paste 2>/dev/null",deleteFile:`rm -f "${z}"`},win32:{checkImage:'powershell -NoProfile -Command "(Get-Clipboard -Format Image) -ne $null"',saveImage:`powershell -NoProfile -Command "$img = Get-Clipboard -Format Image; if ($img) { $img.Save('${z.replace(/\\/g,"\\\\")}', [System.Drawing.Imaging.ImageFormat]::Png) }"`,getPath:'powershell -NoProfile -Command "Get-Clipboard"',deleteFile:`del /f "${z}"`}};return{commands:w[A]||w.linux,screenshotPath:z}}async function ab4(){if(process.platform!=="darwin")return!1;return(await z7("osascript",["-e","the clipboard as «class PNGf»"])).code===0}async function xV6(){let{commands:A,screenshotPath:q}=ob4();try{if((await GY(A.checkImage,{shell:!0,reject:!1})).exitCode!==0)return null;if((await GY(A.saveImage,{shell:!0,reject:!1})).exitCode!==0)return null;let z=P1().readFileBytesSync(q);if(z.length>=2&&z[0]===66&&z[1]===77)z=await(await IG6())(z).png().toBuffer();let w=await VF(z,z.length,"png"),_=w.buffer.toString("base64"),$=Uv8(_);return GY(A.deleteFile,{shell:!0,reject:!1}),{base64:_,mediaType:$,dimensions:w.dimensions}}catch{return null}}async function nkY(){let{commands:A}=ob4();try{let q=await GY(A.getPath,{shell:!0,reject:!1});if(q.exitCode!==0||!q.stdout)return null;return q.stdout.trim()}catch(q){return $6(q),null}}function tb4(A){if(A.startsWith('"')&&A.endsWith('"')||A.startsWith("'")&&A.endsWith("'"))return A.slice(1,-1);return A}function eb4(A){if(process.platform==="win32")return A;let Y=`__DOUBLE_BACKSLASH_${pkY(8).toString("hex")}__`;return A.replace(/\\\\/g,Y).replace(/\\(.)/g,"$1").replace(new RegExp(Y,"g"),"\\")}function uN1(A){let q=tb4(A.trim()),K=eb4(q);return sb4.test(K)}function rkY(A){let q=tb4(A.trim()),K=eb4(q);if(sb4.test(K))return K;return null}async function Ax4(A){let q=rkY(A);if(!q)return null;let K=q,Y;try{if(lkY(K))Y=P1().readFileBytesSync(K);else{let O=await nkY();if(O&&K===dkY(O))Y=P1().readFileBytesSync(O)}}catch(O){return $6(O),null}if(!Y)return null;if(Y.length>=2&&Y[0]===66&&Y[1]===77)Y=await(await IG6())(Y).png().toBuffer();let z=ckY(K).slice(1).toLowerCase()||"png",w=await VF(Y,Y.length,z),_=w.buffer.toString("base64"),$=Uv8(_);return{path:K,base64:_,mediaType:$,dimensions:w.dimensions}}var xN1=800,sb4;var vi6=k(()=>{aq();Ef();Y7();x1();xS();Qv8();Dv8();rA();sb4=/\.(png|jpe?g|gif|webp|bmp)$/i});import{join as BN1}from"path";import{open as okY,mkdir as akY}from"fs/promises";function Kx4(){return BN1(OA(),qx4,d1())}async function tkY(){let A=Kx4();await akY(A,{recursive:!0})}function Yx4(A,q){let K=q.split("/")[1]||"png";return BN1(Kx4(),`${A}.${K}`)}function uV6(A){if(A.type!=="image")return null;let q=Yx4(A.id,A.mediaType||"image/png");return _x4(),Ew6.set(A.id,q),q}async function Lw6(A){if(A.type!=="image")return null;try{await tkY();let q=Yx4(A.id,A.mediaType||"image/png"),K=await okY(q,"w",384);try{await K.writeFile(A.content,{encoding:"base64"}),await K.datasync()}finally{await K.close()}return _x4(),Ew6.set(A.id,q),L(`Stored image ${A.id} to ${q}`),q}catch(q){return L(`Failed to store image: ${q}`),null}}async function zx4(A){let q=new Map;for(let[K,Y]of Object.entries(A))if(Y.type==="image"){let z=await Lw6(Y);if(z)q.set(Number(K),z)}return q}function mN1(A){return Ew6.get(A)??null}function wx4(){Ew6.clear()}function _x4(){while(Ew6.size>=skY){let A=Ew6.keys().next().value;if(A!==void 0)Ew6.delete(A);else break}}async function $x4(){let A=P1(),q=BN1(OA(),qx4),K=d1();try{let Y;try{Y=await A.readdir(q)}catch{return}for(let z of Y){if(z.name===K)continue;let w=BN1(q,z.name);try{await A.rm(w,{recursive:!0,force:!0}),L(`Cleaned up old image cache: ${w}`)}catch{}}try{if((await A.readdir(q)).length===0)await A.rmdir(q)}catch{}}catch{}}var qx4="image-cache",skY=200,Ew6;var zn=k(()=>{Z8();Q1();Y7();G1();Ew6=new Map});import{pathToFileURL as ekY}from"url";function gN1(A){let q=Y6(13),{imageId:K,backgroundColor:Y,isSelected:z}=A,w=z===void 0?!1:z,_=mN1(K),$=`[Image #${K}]`;if(_&&ef()){let H=ekY(_).href,j,J;if(q[0]!==Y||q[1]!==$||q[2]!==w)j=wn.createElement(T,{backgroundColor:Y,inverse:w},$),J=wn.createElement(T,{backgroundColor:Y,inverse:w,bold:w},$),q[0]=Y,q[1]=$,q[2]=w,q[3]=j,q[4]=J;else j=q[3],J=q[4];let M;if(q[5]!==H||q[6]!==j||q[7]!==J)M=wn.createElement(d7,{url:H,fallback:j},J),q[5]=H,q[6]=j,q[7]=J,q[8]=M;else M=q[8];return M}let O;if(q[9]!==Y||q[10]!==$||q[11]!==w)O=wn.createElement(T,{backgroundColor:Y,inverse:w},$),q[9]=Y,q[10]=$,q[11]=w,q[12]=O;else O=q[12];return O}var wn;var Gb8=k(()=>{K1();n6();r56();zn();tc();wn=e(W6(),1)});function BV6(A){let q=Y6(100),{option:K,isFocused:Y,isSelected:z,shouldShowDownArrow:w,shouldShowUpArrow:_,maxIndexWidth:$,index:O,inputValue:H,onInputChange:j,onSubmit:J,onExit:M,layout:D,children:X,showLabel:P,onOpenEditor:W,resetCursorOnUpdate:Z,onImagePaste:G,pastedContents:f,onRemoveImage:V,imagesSelected:N,selectedImageIndex:v,onImagesSelectedChange:y,onSelectedImageIndexChange:R}=A,h=P===void 0?!1:P,B=Z===void 0?!1:Z,x=v===void 0?0:v,F;if(q[0]!==f)F=f?Object.values(f).filter(AEY):[],q[0]=f,q[1]=F;else F=q[1];let g=F,b=h||K.showLabelWithValue===!0,[U,d]=RY.useState(H.length),l=RY.useRef(!1),t;if(q[2]!==H.length||q[3]!==Y||q[4]!==B)t=()=>{if(B&&Y)if(l.current)l.current=!1;else d(H.length)},q[2]=H.length,q[3]=Y,q[4]=B,q[5]=t;else t=q[5];let s;if(q[6]!==H||q[7]!==Y||q[8]!==B)s=[B,Y,H],q[6]=H,q[7]=Y,q[8]=B,q[9]=s;else s=q[9];RY.useEffect(t,s);let H6;if(q[10]!==H||q[11]!==j||q[12]!==W)H6=()=>{W?.(H,j)},q[10]=H,q[11]=j,q[12]=W,q[13]=H6;else H6=q[13];let Z6=Y&&!!W,G6;if(q[14]!==Z6)G6={context:"Chat",isActive:Z6},q[14]=Z6,q[15]=G6;else G6=q[15];V8("chat:externalEditor",H6,G6);let q6;if(q[16]!==G)q6=()=>{if(!G)return;xV6().then((Z1)=>{if(Z1)G(Z1.base64,Z1.mediaType,void 0,Z1.dimensions)})},q[16]=G,q[17]=q6;else q6=q[17];let w6=Y&&!!G,j6;if(q[18]!==w6)j6={context:"Chat",isActive:w6},q[18]=w6,q[19]=j6;else j6=q[19];V8("chat:imagePaste",q6,j6);let _6;if(q[20]!==g||q[21]!==V)_6=()=>{if(g.length>0&&V)V(g[g.length-1].id)},q[20]=g,q[21]=V,q[22]=_6;else _6=q[22];let k6=Y&&!N&&H===""&&g.length>0&&!!V,P6;if(q[23]!==k6)P6={context:"Attachments",isActive:k6},q[23]=k6,q[24]=P6;else P6=q[24];V8("attachments:remove",_6,P6);let A6,K6;if(q[25]!==g.length||q[26]!==R||q[27]!==x)A6=()=>{if(g.length>1)R?.((x+1)%g.length)},K6=()=>{if(g.length>1)R?.((x-1+g.length)%g.length)},q[25]=g.length,q[26]=R,q[27]=x,q[28]=A6,q[29]=K6;else A6=q[28],K6=q[29];let z6;if(q[30]!==g||q[31]!==y||q[32]!==V||q[33]!==R||q[34]!==x)z6=()=>{let Z1=g[x];if(Z1&&V)if(V(Z1.id),g.length<=1)y?.(!1);else R?.(Math.min(x,g.length-2))},q[30]=g,q[31]=y,q[32]=V,q[33]=R,q[34]=x,q[35]=z6;else z6=q[35];let a;if(q[36]!==y)a=()=>{y?.(!1)},q[36]=y,q[37]=a;else a=q[37];let r;if(q[38]!==A6||q[39]!==K6||q[40]!==z6||q[41]!==a)r={"attachments:next":A6,"attachments:previous":K6,"attachments:remove":z6,"attachments:exit":a},q[38]=A6,q[39]=K6,q[40]=z6,q[41]=a,q[42]=r;else r=q[42];let X6=Y&&!!N,O6;if(q[43]!==X6)O6={context:"Attachments",isActive:X6},q[43]=X6,q[44]=O6;else O6=q[44];f7(r,O6);let D6;if(q[45]!==y)D6=(Z1,v1)=>{if(v1.upArrow)y?.(!1)},q[45]=y,q[46]=D6;else D6=q[46];let y6=Y&&!!N,C6;if(q[47]!==y6)C6={isActive:y6},q[47]=y6,q[48]=C6;else C6=q[48];kA(D6,C6);let h6,f6;if(q[49]!==N||q[50]!==Y||q[51]!==y)h6=()=>{if(!Y&&N)y?.(!1)},f6=[Y,N,y],q[49]=N,q[50]=Y,q[51]=y,q[52]=h6,q[53]=f6;else h6=q[52],f6=q[53];RY.useEffect(h6,f6);let M6=D==="expanded"?$+3:$+4,V6=D==="compact"?0:void 0,p6=`${O}.`,b6;if(q[54]!==$||q[55]!==p6)b6=p6.padEnd($+2),q[54]=$,q[55]=p6,q[56]=b6;else b6=q[56];let R6;if(q[57]!==b6)R6=RY.default.createElement(T,{dimColor:!0},b6),q[57]=b6,q[58]=R6;else R6=q[58];let x6;if(q[59]!==U||q[60]!==N||q[61]!==H||q[62]!==Y||q[63]!==M||q[64]!==G||q[65]!==j||q[66]!==J||q[67]!==K||q[68]!==b)x6=b?RY.default.createElement(RY.default.Fragment,null,RY.default.createElement(T,{color:Y?"suggestion":void 0},K.label),Y?RY.default.createElement(RY.default.Fragment,null,RY.default.createElement(T,{color:"suggestion"},K.labelValueSeparator??", "),RY.default.createElement(sK,{value:H,onChange:(Z1)=>{l.current=!0,j(Z1),K.onChange(Z1)},onSubmit:J,onExit:M,placeholder:K.placeholder,focus:!N,showCursor:!0,multiline:!0,cursorOffset:U,onChangeCursorOffset:d,columns:80,onImagePaste:G,onPaste:(Z1)=>{l.current=!0;let v1=H.slice(0,U),T6=H.slice(U),v6=v1+Z1+T6;j(v6),K.onChange(v6),d(v1.length+Z1.length)}})):H&&RY.default.createElement(T,null,K.labelValueSeparator??", ",H)):Y?RY.default.createElement(sK,{value:H,onChange:(Z1)=>{l.current=!0,j(Z1),K.onChange(Z1)},onSubmit:J,onExit:M,placeholder:K.placeholder||(typeof K.label==="string"?K.label:void 0),focus:!N,showCursor:!0,multiline:!0,cursorOffset:U,onChangeCursorOffset:d,columns:80,onImagePaste:G,onPaste:(Z1)=>{l.current=!0;let v1=H.slice(0,U),T6=H.slice(U),v6=v1+Z1+T6;j(v6),K.onChange(v6),d(v1.length+Z1.length)}}):RY.default.createElement(T,{color:H?void 0:"inactive"},H||K.placeholder||K.label),q[59]=U,q[60]=N,q[61]=H,q[62]=Y,q[63]=M,q[64]=G,q[65]=j,q[66]=J,q[67]=K,q[68]=b,q[69]=x6;else x6=q[69];let d6;if(q[70]!==X||q[71]!==V6||q[72]!==R6||q[73]!==x6)d6=RY.default.createElement(m,{flexDirection:"row",flexShrink:V6},R6,X,x6),q[70]=X,q[71]=V6,q[72]=R6,q[73]=x6,q[74]=d6;else d6=q[74];let t6;if(q[75]!==Y||q[76]!==z||q[77]!==w||q[78]!==_||q[79]!==d6)t6=RY.default.createElement(j86,{isFocused:Y,isSelected:z,shouldShowDownArrow:w,shouldShowUpArrow:_},d6),q[75]=Y,q[76]=z,q[77]=w,q[78]=_,q[79]=d6,q[80]=t6;else t6=q[80];let L6;if(q[81]!==M6||q[82]!==Y||q[83]!==z||q[84]!==K.description||q[85]!==K.dimDescription)L6=K.description&&RY.default.createElement(m,{paddingLeft:M6},RY.default.createElement(T,{dimColor:K.dimDescription!==!1,color:z?"success":Y?"suggestion":void 0},K.description)),q[81]=M6,q[82]=Y,q[83]=z,q[84]=K.description,q[85]=K.dimDescription,q[86]=L6;else L6=q[86];let u6;if(q[87]!==M6||q[88]!==g||q[89]!==N||q[90]!==Y||q[91]!==x)u6=g.length>0&&RY.default.createElement(m,{flexDirection:"row",gap:1,paddingLeft:M6},g.map((Z1,v1)=>RY.default.createElement(gN1,{key:Z1.id,imageId:Z1.id,isSelected:!!N&&v1===x})),RY.default.createElement(m,{flexGrow:1,justifyContent:"flex-start",flexDirection:"row"},RY.default.createElement(T,{dimColor:!0},N?RY.default.createElement(e8,null,g.length>1&&RY.default.createElement(RY.default.Fragment,null,RY.default.createElement(G8,{action:"attachments:next",context:"Attachments",fallback:"→",description:"next"}),RY.default.createElement(G8,{action:"attachments:previous",context:"Attachments",fallback:"←",description:"prev"})),RY.default.createElement(G8,{action:"attachments:remove",context:"Attachments",fallback:"backspace",description:"remove"}),RY.default.createElement(G8,{action:"attachments:exit",context:"Attachments",fallback:"esc",description:"cancel"})):Y?"(↓ to select)":null))),q[87]=M6,q[88]=g,q[89]=N,q[90]=Y,q[91]=x,q[92]=u6;else u6=q[92];let e6;if(q[93]!==D)e6=D==="expanded"&&RY.default.createElement(T,null," "),q[93]=D,q[94]=e6;else e6=q[94];let H1;if(q[95]!==t6||q[96]!==L6||q[97]!==u6||q[98]!==e6)H1=RY.default.createElement(m,{flexDirection:"column",flexShrink:0},t6,L6,u6,e6),q[95]=t6,q[96]=L6,q[97]=u6,q[98]=e6,q[99]=H1;else H1=q[99];return H1}function AEY(A){return A.type==="image"}var RY;var fb8=k(()=>{K1();n6();SN1();WO();H7();vi6();Gb8();hK();eq();RY=e(W6(),1)});function FN1(A){if(typeof A==="string")return A;if(typeof A==="number")return String(A);if(!A)return"";if(Array.isArray(A))return A.map(FN1).join("");if(a4.default.isValidElement(A))return FN1(A.props.children);return""}function E8(A){let q=Y6(72),{isDisabled:K,hideIndexes:Y,visibleOptionCount:z,highlightText:w,options:_,defaultValue:$,onCancel:O,onChange:H,onFocus:j,defaultFocusValue:J,layout:M,disableSelection:D,inlineDescriptions:X,onUpFromFirstItem:P,onDownFromLastItem:W,onInputModeToggle:Z,onOpenEditor:G,onImagePaste:f,pastedContents:V,onRemoveImage:N}=A,v=K===void 0?!1:K,y=Y===void 0?!1:Y,R=z===void 0?5:z,h=M===void 0?"compact":M,B=D===void 0?!1:D,x=X===void 0?!1:X,[F,g]=a4.useState(!1),[b,U]=a4.useState(0),d;if(q[0]!==_)d=()=>{let r=new Map;return _.forEach((X6)=>{if(X6.type==="input"&&X6.initialValue)r.set(X6.value,X6.initialValue)}),r},q[0]=_,q[1]=d;else d=q[1];let[l,t]=a4.useState(d),s;if(q[2]===Symbol.for("react.memo_cache_sentinel"))s=new Map,q[2]=s;else s=q[2];let H6=a4.useRef(s),Z6,G6;if(q[3]!==l||q[4]!==_)G6=()=>{for(let r of _)if(r.type==="input"&&r.initialValue!==void 0){let X6=H6.current.get(r.value)??"",O6=l.get(r.value)??"",D6=r.initialValue;if(D6!==X6&&O6===X6)t((y6)=>{let C6=new Map(y6);return C6.set(r.value,D6),C6});H6.current.set(r.value,D6)}},Z6=[_,l],q[3]=l,q[4]=_,q[5]=Z6,q[6]=G6;else Z6=q[5],G6=q[6];a4.useEffect(G6,Z6);let q6;if(q[7]!==J||q[8]!==$||q[9]!==O||q[10]!==H||q[11]!==j||q[12]!==_||q[13]!==R)q6={visibleOptionCount:R,options:_,defaultValue:$,onChange:H,onCancel:O,onFocus:j,focusValue:J},q[7]=J,q[8]=$,q[9]=O,q[10]=H,q[11]=j,q[12]=_,q[13]=R,q[14]=q6;else q6=q[14];let w6=cb4(q6),j6=B||(y?"numeric":!1),_6;if(q[15]!==V)_6=()=>{if(V&&Object.values(V).some(HEY)){let r=Object.values(V).filter(OEY).length;return g(!0),U(r-1),!0}return!1},q[15]=V,q[16]=_6;else _6=q[16];let k6;if(q[17]!==F||q[18]!==l||q[19]!==v||q[20]!==W||q[21]!==Z||q[22]!==P||q[23]!==_||q[24]!==w6||q[25]!==j6||q[26]!==_6)k6={isDisabled:v,disableSelection:j6,state:w6,options:_,isMultiSelect:!1,onUpFromFirstItem:P,onDownFromLastItem:W,onInputModeToggle:Z,inputValues:l,imagesSelected:F,onEnterImageSelection:_6},q[17]=F,q[18]=l,q[19]=v,q[20]=W,q[21]=Z,q[22]=P,q[23]=_,q[24]=w6,q[25]=j6,q[26]=_6,q[27]=k6;else k6=q[27];nb4(k6);let P6,A6,K6,z6;if(q[28]!==y||q[29]!==w||q[30]!==F||q[31]!==x||q[32]!==l||q[33]!==v||q[34]!==h||q[35]!==O||q[36]!==H||q[37]!==f||q[38]!==G||q[39]!==N||q[40]!==_.length||q[41]!==V||q[42]!==b||q[43]!==w6.focusedValue||q[44]!==w6.options||q[45]!==w6.value||q[46]!==w6.visibleFromIndex||q[47]!==w6.visibleOptions||q[48]!==w6.visibleToIndex){z6=Symbol.for("react.early_return_sentinel");A:{let r={container:$EY,highlightedText:_EY};if(h==="expanded"){let h6;if(q[53]!==w6.options.length)h6=w6.options.length.toString(),q[53]=w6.options.length,q[54]=h6;else h6=q[54];let f6=h6.length;z6=a4.default.createElement(m,{...r.container()},w6.visibleOptions.map((M6,V6)=>{let p6=M6.index===w6.visibleFromIndex,b6=M6.index===w6.visibleToIndex-1,R6=w6.visibleToIndex<_.length,x6=w6.visibleFromIndex>0,d6=w6.visibleFromIndex+V6+1,t6=!v&&w6.focusedValue===M6.value,L6=w6.value===M6.value;if(M6.type==="input"){let Z1=l.has(M6.value)?l.get(M6.value):M6.initialValue||"";return a4.default.createElement(BV6,{key:String(M6.value),option:M6,isFocused:t6,isSelected:L6,shouldShowDownArrow:R6&&b6,shouldShowUpArrow:x6&&p6,maxIndexWidth:f6,index:d6,inputValue:Z1,onInputChange:(v1)=>{t((T6)=>{let v6=new Map(T6);return v6.set(M6.value,v1),v6})},onSubmit:(v1)=>{let T6=V&&Object.values(V).some(wEY);if(v1.trim()||T6||M6.allowEmptySubmitToCancel)H?.(M6.value);else O?.()},onExit:O,layout:"expanded",showLabel:x,onOpenEditor:G,resetCursorOnUpdate:M6.resetCursorOnUpdate,onImagePaste:f,pastedContents:V,onRemoveImage:N,imagesSelected:F,selectedImageIndex:b,onImagesSelectedChange:g,onSelectedImageIndexChange:U})}let u6=M6.label;if(typeof M6.label==="string"&&w&&M6.label.includes(w)){let Z1=M6.label,v1=Z1.indexOf(w);u6=a4.default.createElement(a4.default.Fragment,null,Z1.slice(0,v1),a4.default.createElement(T,{...r.highlightedText()},w),Z1.slice(v1+w.length))}let e6=M6.disabled===!0,H1=e6?void 0:L6?"success":t6?"suggestion":void 0;return a4.default.createElement(m,{key:String(M6.value),flexDirection:"column",flexShrink:0},a4.default.createElement(j86,{isFocused:t6,isSelected:L6,shouldShowDownArrow:R6&&b6,shouldShowUpArrow:x6&&p6},a4.default.createElement(T,{dimColor:e6,color:H1},u6)),M6.description&&a4.default.createElement(m,{paddingLeft:2},a4.default.createElement(T,{dimColor:e6||M6.dimDescription!==!1,color:H1},a4.default.createElement(CK,null,M6.description))),a4.default.createElement(T,null," "))}));break A}if(h==="compact-vertical"){let h6;if(q[55]!==y||q[56]!==w6.options)h6=y?0:w6.options.length.toString().length,q[55]=y,q[56]=w6.options,q[57]=h6;else h6=q[57];let f6=h6;z6=a4.default.createElement(m,{...r.container()},w6.visibleOptions.map((M6,V6)=>{let p6=M6.index===w6.visibleFromIndex,b6=M6.index===w6.visibleToIndex-1,R6=w6.visibleToIndex<_.length,x6=w6.visibleFromIndex>0,d6=w6.visibleFromIndex+V6+1,t6=!v&&w6.focusedValue===M6.value,L6=w6.value===M6.value;if(M6.type==="input"){let H1=l.has(M6.value)?l.get(M6.value):M6.initialValue||"";return a4.default.createElement(BV6,{key:String(M6.value),option:M6,isFocused:t6,isSelected:L6,shouldShowDownArrow:R6&&b6,shouldShowUpArrow:x6&&p6,maxIndexWidth:f6,index:d6,inputValue:H1,onInputChange:(Z1)=>{t((v1)=>{let T6=new Map(v1);return T6.set(M6.value,Z1),T6})},onSubmit:(Z1)=>{let v1=V&&Object.values(V).some(zEY);if(Z1.trim()||v1||M6.allowEmptySubmitToCancel)H?.(M6.value);else O?.()},onExit:O,layout:"compact",showLabel:x,onOpenEditor:G,resetCursorOnUpdate:M6.resetCursorOnUpdate,onImagePaste:f,pastedContents:V,onRemoveImage:N,imagesSelected:F,selectedImageIndex:b,onImagesSelectedChange:g,onSelectedImageIndexChange:U})}let u6=M6.label;if(typeof M6.label==="string"&&w&&M6.label.includes(w)){let H1=M6.label,Z1=H1.indexOf(w);u6=a4.default.createElement(a4.default.Fragment,null,H1.slice(0,Z1),a4.default.createElement(T,{...r.highlightedText()},w),H1.slice(Z1+w.length))}let e6=M6.disabled===!0;return a4.default.createElement(m,{key:String(M6.value),flexDirection:"column",flexShrink:0},a4.default.createElement(j86,{isFocused:t6,isSelected:L6,shouldShowDownArrow:R6&&b6,shouldShowUpArrow:x6&&p6},a4.default.createElement(a4.default.Fragment,null,!y&&a4.default.createElement(T,{dimColor:!0},`${d6}.`.padEnd(f6+1)),a4.default.createElement(T,{dimColor:e6,color:e6?void 0:L6?"success":t6?"suggestion":void 0},u6))),M6.description&&a4.default.createElement(m,{paddingLeft:y?4:f6+4},a4.default.createElement(T,{dimColor:e6||M6.dimDescription!==!1,color:e6?void 0:L6?"success":t6?"suggestion":void 0},a4.default.createElement(CK,null,M6.description))))}));break A}let X6;if(q[58]!==y||q[59]!==w6.options)X6=y?0:w6.options.length.toString().length,q[58]=y,q[59]=w6.options,q[60]=X6;else X6=q[60];let O6=X6,D6=w6.visibleOptions.some(YEY),y6=!x&&!D6&&w6.visibleOptions.some(KEY),C6=w6.visibleOptions.map((h6,f6)=>{let M6=h6.index===w6.visibleFromIndex,V6=h6.index===w6.visibleToIndex-1,p6=w6.visibleToIndex<_.length,b6=w6.visibleFromIndex>0,R6=w6.visibleFromIndex+f6+1,x6=!v&&w6.focusedValue===h6.value,d6=w6.value===h6.value,t6=h6.disabled===!0,L6=h6.label;if(typeof h6.label==="string"&&w&&h6.label.includes(w)){let u6=h6.label,e6=u6.indexOf(w);L6=a4.default.createElement(a4.default.Fragment,null,u6.slice(0,e6),a4.default.createElement(T,{...r.highlightedText()},w),u6.slice(e6+w.length))}return{option:h6,index:R6,label:L6,isFocused:x6,isSelected:d6,isOptionDisabled:t6,shouldShowDownArrow:p6&&V6,shouldShowUpArrow:b6&&M6}});if(y6){let h6;if(q[61]!==y||q[62]!==O6)h6=(V6)=>{if(V6.option.type==="input")return 0;let p6=FN1(V6.option.label),b6=y?0:O6+2,R6=V6.isSelected?2:0;return 2+b6+B8(p6)+R6},q[61]=y,q[62]=O6,q[63]=h6;else h6=q[63];let f6=Math.max(...C6.map(h6)),M6;if(q[64]!==y||q[65]!==O6||q[66]!==f6)M6=(V6)=>{if(V6.option.type==="input")return null;let p6=FN1(V6.option.label),b6=y?0:O6+2,R6=V6.isSelected?2:0,x6=2+b6+B8(p6)+R6,d6=f6-x6;return a4.default.createElement(m,{key:String(V6.option.value),flexDirection:"row"},a4.default.createElement(m,{flexDirection:"row",flexShrink:0},V6.isFocused?a4.default.createElement(T,{color:"suggestion"},q1.pointer):V6.shouldShowDownArrow?a4.default.createElement(T,{dimColor:!0},q1.arrowDown):V6.shouldShowUpArrow?a4.default.createElement(T,{dimColor:!0},q1.arrowUp):a4.default.createElement(T,null," "),a4.default.createElement(T,null," "),a4.default.createElement(T,{dimColor:V6.isOptionDisabled,color:V6.isOptionDisabled?void 0:V6.isSelected?"success":V6.isFocused?"suggestion":void 0},!y&&a4.default.createElement(T,{dimColor:!0},`${V6.index}.`.padEnd(O6+2)),V6.label),V6.isSelected&&a4.default.createElement(T,{color:"success"}," ",q1.tick),d6>0&&a4.default.createElement(T,null," ".repeat(d6))),a4.default.createElement(m,{flexGrow:1,marginLeft:2},a4.default.createElement(T,{wrap:"wrap",dimColor:V6.isOptionDisabled||V6.option.dimDescription!==!1,color:V6.isOptionDisabled?void 0:V6.isSelected?"success":V6.isFocused?"suggestion":void 0},a4.default.createElement(CK,null,V6.option.description||" "))))},q[64]=y,q[65]=O6,q[66]=f6,q[67]=M6;else M6=q[67];z6=a4.default.createElement(m,{...r.container()},C6.map(M6));break A}P6=m,A6=r.container(),K6=w6.visibleOptions.map((h6,f6)=>{if(h6.type==="input"){let u6=l.has(h6.value)?l.get(h6.value):h6.initialValue||"",e6=h6.index===w6.visibleFromIndex,H1=h6.index===w6.visibleToIndex-1,Z1=w6.visibleToIndex<_.length,v1=w6.visibleFromIndex>0,T6=w6.visibleFromIndex+f6+1,v6=!v&&w6.focusedValue===h6.value,A1=w6.value===h6.value;return a4.default.createElement(BV6,{key:String(h6.value),option:h6,isFocused:v6,isSelected:A1,shouldShowDownArrow:Z1&&H1,shouldShowUpArrow:v1&&e6,maxIndexWidth:O6,index:T6,inputValue:u6,onInputChange:(F6)=>{t((m6)=>{let l6=new Map(m6);return l6.set(h6.value,F6),l6})},onSubmit:(F6)=>{let m6=V&&Object.values(V).some(qEY);if(F6.trim()||m6||h6.allowEmptySubmitToCancel)H?.(h6.value);else O?.()},onExit:O,layout:"compact",showLabel:x,onOpenEditor:G,resetCursorOnUpdate:h6.resetCursorOnUpdate,onImagePaste:f,pastedContents:V,onRemoveImage:N,imagesSelected:F,selectedImageIndex:b,onImagesSelectedChange:g,onSelectedImageIndexChange:U})}let M6=h6.label;if(typeof h6.label==="string"&&w&&h6.label.includes(w)){let u6=h6.label,e6=u6.indexOf(w);M6=a4.default.createElement(a4.default.Fragment,null,u6.slice(0,e6),a4.default.createElement(T,{...r.highlightedText()},w),u6.slice(e6+w.length))}let V6=h6.index===w6.visibleFromIndex,p6=h6.index===w6.visibleToIndex-1,b6=w6.visibleToIndex<_.length,R6=w6.visibleFromIndex>0,x6=w6.visibleFromIndex+f6+1,d6=!v&&w6.focusedValue===h6.value,t6=w6.value===h6.value,L6=h6.disabled===!0;return a4.default.createElement(j86,{key:String(h6.value),isFocused:d6,isSelected:t6,shouldShowDownArrow:b6&&p6,shouldShowUpArrow:R6&&V6},a4.default.createElement(m,{flexDirection:"row",flexShrink:0},!y&&a4.default.createElement(T,{dimColor:!0},`${x6}.`.padEnd(O6+2)),a4.default.createElement(T,{dimColor:L6,color:L6?void 0:t6?"success":d6?"suggestion":void 0},M6,x&&h6.description&&a4.default.createElement(T,{dimColor:L6||h6.dimDescription!==!1}," ",h6.description))),!x&&h6.description&&a4.default.createElement(m,{flexShrink:99,marginLeft:2},a4.default.createElement(T,{wrap:"wrap-trim",dimColor:L6||h6.dimDescription!==!1,color:L6?void 0:t6?"success":d6?"suggestion":void 0},a4.default.createElement(CK,null,h6.description))))})}q[28]=y,q[29]=w,q[30]=F,q[31]=x,q[32]=l,q[33]=v,q[34]=h,q[35]=O,q[36]=H,q[37]=f,q[38]=G,q[39]=N,q[40]=_.length,q[41]=V,q[42]=b,q[43]=w6.focusedValue,q[44]=w6.options,q[45]=w6.value,q[46]=w6.visibleFromIndex,q[47]=w6.visibleOptions,q[48]=w6.visibleToIndex,q[49]=P6,q[50]=A6,q[51]=K6,q[52]=z6}else P6=q[49],A6=q[50],K6=q[51],z6=q[52];if(z6!==Symbol.for("react.early_return_sentinel"))return z6;let a;if(q[68]!==P6||q[69]!==A6||q[70]!==K6)a=a4.default.createElement(P6,{...A6},K6),q[68]=P6,q[69]=A6,q[70]=K6,q[71]=a;else a=q[71];return a}function qEY(A){return A.type==="image"}function KEY(A){return A.description}function YEY(A){return A.type==="input"}function zEY(A){return A.type==="image"}function wEY(A){return A.type==="image"}function _EY(){return{bold:!0}}function $EY(){return{flexDirection:"column"}}function OEY(A){return A.type==="image"}function HEY(A){return A.type==="image"}var a4;var _5=k(()=>{K1();n6();SN1();lb4();rb4();t7();fb8();y5();a4=e(W6(),1)});function Ox4(A,q){return{name:`${A.name}-with-${q.name}-fallback`,read(){let K=A.read();if(K!==null&&K!==void 0)return K;return q.read()||{}},async readAsync(){let K=await A.readAsync();if(K!==null&&K!==void 0)return K;return await q.readAsync()||{}},update(K){let Y=A.read(),z=A.update(K);if(z.success){if(Y===null)q.delete();return z}let w=q.update(K);if(w.success){if(Y!==null)A.delete();return{success:!0,warning:w.warning}}return{success:!1}},delete(){let K=A.delete(),Y=q.delete();return K||Y}}}import{join as jEY}from"path";import{chmodSync as JEY}from"fs";function QN1(){let A=OA(),q=".credentials.json";return{storageDir:A,storagePath:jEY(A,".credentials.json")}}var Tb8;var Hx4=k(()=>{Y7();Z8();a1();a1();Tb8={name:"plaintext",read(){let{storagePath:A}=QN1();try{let q=P1().readFileSync(A,{encoding:"utf8"});return O8(q)}catch{return null}},async readAsync(){let{storagePath:A}=QN1();try{let q=await P1().readFile(A,{encoding:"utf8"});return O8(q)}catch{return null}},update(A){try{let{storageDir:q,storagePath:K}=QN1();try{P1().mkdirSync(q)}catch(Y){if(Y.code!=="EEXIST")throw Y}return pz(K,U6(A),{encoding:"utf8",flush:!1}),JEY(K,384),{success:!0,warning:"Warning: Storing credentials in plaintext."}}catch{return{success:!1}}},delete(){let{storagePath:A}=QN1();try{return P1().unlinkSync(A),!0}catch(q){if(q.code==="ENOENT")return!0;return!1}}}});function jH(){if(process.platform==="darwin")return Ox4(VC4,Tb8);return Tb8}var UN1=k(()=>{Zw6();Hx4()});import{createHash as MEY}from"crypto";function jx4(A){return A.replace(/[A-Z]/g,(q)=>`_${q.toLowerCase()}`)}async function Vb8(){if(ki6.length===0)return;let A=[...ki6];ki6=[];try{await I8.post(DEY,A,{headers:{"Content-Type":"application/json","DD-API-KEY":XEY},timeout:ZEY})}catch(q){$6(q)}}function TEY(){if(_n)return;_n=setTimeout(()=>{_n=null,Vb8()},kEY()).unref()}async function dN1(){if(_n)clearTimeout(_n),_n=null;await Vb8()}async function Nb8(A,q){if(D7()!=="firstParty")return;let K=pN1;if(K===null)K=await VEY();if(!K||!GEY.has(A))return;try{let Y=await mV6({model:q.model}),{envContext:z,...w}=Y,_={...w,...z,...q,userBucket:vEY()};if(typeof _.toolName==="string"&&_.toolName.startsWith("mcp__"))_.toolName="mcp";if(typeof _.model==="string"){let j=t$(_.model.replace(/\[1m]$/i,""));_.model=j in MO1?j:"other"}if(typeof _.version==="string")_.version=_.version.replace(/^(\d+\.\d+\.\d+-dev\.\d{8})\.t\d+\.sha[a-f0-9]+$/,"$1");if(_.status!==void 0&&_.status!==null){let j=String(_.status);_.http_status=j;let J=j.charAt(0);if(J>="1"&&J<="5")_.http_status_range=`${J}xx`;delete _.status}let $=_,H={ddsource:"nodejs",ddtags:[`event:${A}`,...fEY.filter((j)=>$[j]!==void 0&&$[j]!==null).map((j)=>`${jx4(j)}:${$[j]}`)].join(","),message:A,service:"claude-code",hostname:"claude-code",env:"external"};for(let[j,J]of Object.entries(_))if(J!==void 0&&J!==null)H[jx4(j)]=J;if(ki6.push(H),ki6.length>=WEY){if(_n)clearTimeout(_n),_n=null;Vb8()}else TEY()}catch(Y){$6(Y)}}function kEY(){return parseInt(process.env.CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS||"",10)||PEY}var DEY="https://http-intake.logs.us5.datadoghq.com/api/v2/logs",XEY="pubbbf48e6d78dae54bceaa4acf463299bf",PEY=15000,WEY=100,ZEY=5000,GEY,fEY,ki6,_n=null,pN1=null,VEY,NEY=30,vEY;var cN1=k(()=>{A3();Eq();x1();Q8();Xq();ct();yz();ij();aa();GEY=new Set(["chrome_bridge_connection_succeeded","chrome_bridge_connection_failed","chrome_bridge_disconnected","chrome_bridge_tool_call_completed","chrome_bridge_tool_call_error","chrome_bridge_tool_call_started","chrome_bridge_tool_call_timeout","tengu_api_error","tengu_api_success","tengu_cancel","tengu_compact_failed","tengu_exit","tengu_flicker","tengu_init","tengu_model_fallback_triggered","tengu_oauth_error","tengu_oauth_success","tengu_oauth_token_refresh_failure","tengu_oauth_token_refresh_success","tengu_oauth_token_refresh_lock_acquiring","tengu_oauth_token_refresh_lock_acquired","tengu_oauth_token_refresh_starting","tengu_oauth_token_refresh_completed","tengu_oauth_token_refresh_lock_releasing","tengu_oauth_token_refresh_lock_released","tengu_query_error","tengu_repo_text_file_size","tengu_session_file_read","tengu_started","tengu_tool_use_error","tengu_tool_use_granted_in_prompt_permanent","tengu_tool_use_granted_in_prompt_temporary","tengu_tool_use_rejected_in_prompt","tengu_tool_use_success","tengu_uncaught_exception","tengu_unhandled_rejection","tengu_voice_recording_started","tengu_voice_toggled","tengu_team_mem_sync_pull","tengu_team_mem_sync_push","tengu_team_mem_sync_started"]),fEY=["arch","clientType","errorType","http_status_range","http_status","kairosActive","model","platform","provider","subscriptionType","toolName","userBucket","userType","version","versionBase"];ki6=[];VEY=T8(async()=>{if(UV())return pN1=!1,!1;try{return pN1=!0,!0}catch(A){return $6(A),pN1=!1,!1}});vEY=T8(()=>{let A=ny(),q=MEY("sha256").update(A).digest("hex");return parseInt(q.slice(0,8),16)%NEY})});var Mx4=C((Jx4)=>{Object.defineProperty(Jx4,"__esModule",{value:!0})});var Xx4=C((Dx4)=>{Object.defineProperty(Dx4,"__esModule",{value:!0})});var vb8=C((Px4)=>{Object.defineProperty(Px4,"__esModule",{value:!0})});var kb8=C((LEY)=>{function EEY(A,q,K){q.split&&(q=q.split("."));var Y=0,z=q.length,w=A,_,$;while(Y{Object.defineProperty(Wx4,"__esModule",{value:!0});Wx4.pickBy=void 0;var REY=function(A,q){return Object.keys(A).filter(function(K){return q(K,A[K])}).reduce(function(K,Y){return K[Y]=A[Y],K},{})};Wx4.pickBy=REY});var Eb8=C((fx4)=>{Object.defineProperty(fx4,"__esModule",{value:!0});fx4.ValidationError=void 0;var SEY=d2(),CEY=function(A){SEY.__extends(q,A);function q(K,Y){var z=A.call(this,"".concat(K," ").concat(Y))||this;return z.field=K,z}return q}(Error);fx4.ValidationError=CEY});var Lb8=C((Vx4)=>{Object.defineProperty(Vx4,"__esModule",{value:!0});Vx4.isPlainObject=Vx4.exists=Vx4.isFunction=Vx4.isNumber=Vx4.isString=void 0;function hEY(A){return typeof A==="string"}Vx4.isString=hEY;function IEY(A){return typeof A==="number"}Vx4.isNumber=IEY;function bEY(A){return typeof A==="function"}Vx4.isFunction=bEY;function xEY(A){return A!==void 0&&A!==null}Vx4.exists=xEY;function uEY(A){return Object.prototype.toString.call(A).slice(8,-1).toLowerCase()==="object"}Vx4.isPlainObject=uEY});var Sb8=C((Cx4)=>{Object.defineProperty(Cx4,"__esModule",{value:!0});Cx4.validateEvent=Cx4.assertTraits=Cx4.assertTrackEventProperties=Cx4.assertTrackEventName=Cx4.assertEventType=Cx4.assertEventExists=Cx4.assertUserIdentity=void 0;var J86=Eb8(),yw6=Lb8(),yb8="is not a string",Rb8="is not an object",vx4="is nil";function kx4(A){var q=".userId/anonymousId/previousId/groupId",K=function(z){var w,_,$;return($=(_=(w=z.userId)!==null&&w!==void 0?w:z.anonymousId)!==null&&_!==void 0?_:z.groupId)!==null&&$!==void 0?$:z.previousId},Y=K(A);if(!(0,yw6.exists)(Y))throw new J86.ValidationError(q,vx4);else if(!(0,yw6.isString)(Y))throw new J86.ValidationError(q,yb8)}Cx4.assertUserIdentity=kx4;function Ex4(A){if(!(0,yw6.exists)(A))throw new J86.ValidationError("Event",vx4);if(typeof A!=="object")throw new J86.ValidationError("Event",Rb8)}Cx4.assertEventExists=Ex4;function Lx4(A){if(!(0,yw6.isString)(A.type))throw new J86.ValidationError(".type",yb8)}Cx4.assertEventType=Lx4;function yx4(A){if(!(0,yw6.isString)(A.event))throw new J86.ValidationError(".event",yb8)}Cx4.assertTrackEventName=yx4;function Rx4(A){if(!(0,yw6.isPlainObject)(A.properties))throw new J86.ValidationError(".properties",Rb8)}Cx4.assertTrackEventProperties=Rx4;function Sx4(A){if(!(0,yw6.isPlainObject)(A.traits))throw new J86.ValidationError(".traits",Rb8)}Cx4.assertTraits=Sx4;function QEY(A){if(Ex4(A),Lx4(A),A.type==="track")yx4(A),Rx4(A);if(["group","identify"].includes(A.type))Sx4(A);kx4(A)}Cx4.validateEvent=QEY});var xx4=C((Cb8)=>{Object.defineProperty(Cb8,"__esModule",{value:!0});Cb8.EventFactory=void 0;var g9=d2();g9.__exportStar(vb8(),Cb8);var Ix4=kb8(),nEY=Gx4(),rEY=Sb8(),oEY=function(){function A(q){this.user=q.user,this.createMessageId=q.createMessageId}return A.prototype.track=function(q,K,Y,z){return this.normalize(g9.__assign(g9.__assign({},this.baseEvent()),{event:q,type:"track",properties:K!==null&&K!==void 0?K:{},options:g9.__assign({},Y),integrations:g9.__assign({},z)}))},A.prototype.page=function(q,K,Y,z,w){var _,$={type:"page",properties:g9.__assign({},Y),options:g9.__assign({},z),integrations:g9.__assign({},w)};if(q!==null)$.category=q,$.properties=(_=$.properties)!==null&&_!==void 0?_:{},$.properties.category=q;if(K!==null)$.name=K;return this.normalize(g9.__assign(g9.__assign({},this.baseEvent()),$))},A.prototype.screen=function(q,K,Y,z,w){var _={type:"screen",properties:g9.__assign({},Y),options:g9.__assign({},z),integrations:g9.__assign({},w)};if(q!==null)_.category=q;if(K!==null)_.name=K;return this.normalize(g9.__assign(g9.__assign({},this.baseEvent()),_))},A.prototype.identify=function(q,K,Y,z){return this.normalize(g9.__assign(g9.__assign({},this.baseEvent()),{type:"identify",userId:q,traits:K!==null&&K!==void 0?K:{},options:g9.__assign({},Y),integrations:z}))},A.prototype.group=function(q,K,Y,z){return this.normalize(g9.__assign(g9.__assign({},this.baseEvent()),{type:"group",traits:K!==null&&K!==void 0?K:{},options:g9.__assign({},Y),integrations:g9.__assign({},z),groupId:q}))},A.prototype.alias=function(q,K,Y,z){var w={userId:q,type:"alias",options:g9.__assign({},Y),integrations:g9.__assign({},z)};if(K!==null)w.previousId=K;if(q===void 0)return this.normalize(g9.__assign(g9.__assign({},w),this.baseEvent()));return this.normalize(g9.__assign(g9.__assign({},this.baseEvent()),w))},A.prototype.baseEvent=function(){var q={integrations:{},options:{}};if(!this.user)return q;var K=this.user;if(K.id())q.userId=K.id();if(K.anonymousId())q.anonymousId=K.anonymousId();return q},A.prototype.context=function(q){var K,Y=["userId","anonymousId","timestamp"];delete q.integrations;var z=Object.keys(q),w=(K=q.context)!==null&&K!==void 0?K:{},_={};return z.forEach(function($){if($==="context")return;if(Y.includes($))(0,Ix4.dset)(_,$,q[$]);else(0,Ix4.dset)(w,$,q[$])}),[w,_]},A.prototype.normalize=function(q){var K,Y,z=Object.keys((K=q.integrations)!==null&&K!==void 0?K:{}).reduce(function(D,X){var P,W;return g9.__assign(g9.__assign({},D),(P={},P[X]=Boolean((W=q.integrations)===null||W===void 0?void 0:W[X]),P))},{});q.options=(0,nEY.pickBy)(q.options||{},function(D,X){return X!==void 0});var w=g9.__assign(g9.__assign({},z),(Y=q.options)===null||Y===void 0?void 0:Y.integrations),_=q.options?this.context(q.options):[],$=_[0],O=_[1],H=q.options,j=g9.__rest(q,["options"]),J=g9.__assign(g9.__assign(g9.__assign({timestamp:new Date},j),{integrations:w,context:$}),O),M=g9.__assign(g9.__assign({},J),{messageId:this.createMessageId()});return(0,rEY.validateEvent)(M),M},A}();Cb8.EventFactory=oEY});var hb8=C((mx4)=>{Object.defineProperty(mx4,"__esModule",{value:!0});mx4.invokeCallback=mx4.sleep=mx4.pTimeout=void 0;function ux4(A,q){return new Promise(function(K,Y){var z=setTimeout(function(){Y(Error("Promise timed out"))},q);A.then(function(w){return clearTimeout(z),K(w)}).catch(Y)})}mx4.pTimeout=ux4;function Bx4(A){return new Promise(function(q){return setTimeout(q,A)})}mx4.sleep=Bx4;function aEY(A,q,K){var Y=function(){try{return Promise.resolve(q(A))}catch(z){return Promise.reject(z)}};return Bx4(K).then(function(){return ux4(Y(),1000)}).catch(function(z){A===null||A===void 0||A.log("warn","Callback Error",{error:z}),A===null||A===void 0||A.stats.increment("callback_error")}).then(function(){return A})}mx4.invokeCallback=aEY});var Ux4=C((Fx4)=>{Object.defineProperty(Fx4,"__esModule",{value:!0});Fx4.createDeferred=void 0;var eEY=function(){var A,q,K=new Promise(function(Y,z){A=Y,q=z});return{resolve:A,reject:q,promise:K}};Fx4.createDeferred=eEY});var px4=C((Ib8)=>{Object.defineProperty(Ib8,"__esModule",{value:!0});var ALY=d2();ALY.__exportStar(Ux4(),Ib8)});var lx4=C((dx4)=>{Object.defineProperty(dx4,"__esModule",{value:!0});dx4.Emitter=void 0;var qLY=function(){function A(q){var K;this.callbacks={},this.warned=!1,this.maxListeners=(K=q===null||q===void 0?void 0:q.maxListeners)!==null&&K!==void 0?K:10}return A.prototype.warnIfPossibleMemoryLeak=function(q){if(this.warned)return;if(this.maxListeners&&this.callbacks[q].length>this.maxListeners)console.warn("Event Emitter: Possible memory leak detected; ".concat(String(q)," has exceeded ").concat(this.maxListeners," listeners.")),this.warned=!0},A.prototype.on=function(q,K){if(!this.callbacks[q])this.callbacks[q]=[K];else this.callbacks[q].push(K),this.warnIfPossibleMemoryLeak(q);return this},A.prototype.once=function(q,K){var Y=this,z=function(){var w=[];for(var _=0;_{Object.defineProperty(bb8,"__esModule",{value:!0});var KLY=d2();KLY.__exportStar(lx4(),bb8)});var gV6=C((lN1)=>{Object.defineProperty(lN1,"__esModule",{value:!0});var nx4=d2();nx4.__exportStar(px4(),lN1);nx4.__exportStar(ix4(),lN1)});var xb8=C((rx4)=>{Object.defineProperty(rx4,"__esModule",{value:!0});rx4.backoff=void 0;function YLY(A){var q=Math.random()+1,K=A.minTimeout,Y=K===void 0?500:K,z=A.factor,w=z===void 0?2:z,_=A.attempt,$=A.maxTimeout,O=$===void 0?1/0:$;return Math.min(q*Y*Math.pow(w,_),O)}rx4.backoff=YLY});var ub8=C((ax4)=>{Object.defineProperty(ax4,"__esModule",{value:!0});ax4.PriorityQueue=ax4.ON_REMOVE_FROM_FUTURE=void 0;var zLY=d2(),wLY=gV6(),_LY=xb8();ax4.ON_REMOVE_FROM_FUTURE="onRemoveFromFuture";var $LY=function(A){zLY.__extends(q,A);function q(K,Y,z){var w=A.call(this)||this;return w.future=[],w.maxAttempts=K,w.queue=Y,w.seen=z!==null&&z!==void 0?z:{},w}return q.prototype.push=function(){var K=this,Y=[];for(var z=0;zK.maxAttempts||K.includes(_))return!1;return K.queue.push(_),!0});return this.queue=this.queue.sort(function(_,$){return K.getAttempts(_)-K.getAttempts($)}),w},q.prototype.pushWithBackoff=function(K){var Y=this;if(this.getAttempts(K)===0)return this.push(K)[0];var z=this.updateAttempts(K);if(z>this.maxAttempts||this.includes(K))return!1;var w=(0,_LY.backoff)({attempt:z-1});return setTimeout(function(){Y.queue.push(K),Y.future=Y.future.filter(function(_){return _.id!==K.id}),Y.emit(ax4.ON_REMOVE_FROM_FUTURE)},w),this.future.push(K),!0},q.prototype.getAttempts=function(K){var Y;return(Y=this.seen[K.id])!==null&&Y!==void 0?Y:0},q.prototype.updateAttempts=function(K){return this.seen[K.id]=this.getAttempts(K)+1,this.getAttempts(K)},q.prototype.includes=function(K){return this.queue.includes(K)||this.future.includes(K)||Boolean(this.queue.find(function(Y){return Y.id===K.id}))||Boolean(this.future.find(function(Y){return Y.id===K.id}))},q.prototype.pop=function(){return this.queue.shift()},Object.defineProperty(q.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"todo",{get:function(){return this.queue.length+this.future.length},enumerable:!1,configurable:!0}),q}(wLY.Emitter);ax4.PriorityQueue=$LY});var Bb8=C((HLY)=>{var Rw6=256,nN1=[],iN1;while(Rw6--)nN1[Rw6]=(Rw6+256).toString(16).substring(1);function OLY(){var A=0,q,K="";if(!iN1||Rw6+16>256){iN1=Array(A=256);while(A--)iN1[A]=256*Math.random()|0;A=Rw6=0}for(;A<16;A++){if(q=iN1[Rw6+A],A==6)K+=nN1[q&15|64];else if(A==8)K+=nN1[q&63|128];else K+=nN1[q];if(A&1&&A>1&&A<11)K+="-"}return Rw6++,K}HLY.v4=OLY});var mb8=C((ex4)=>{Object.defineProperty(ex4,"__esModule",{value:!0});ex4.CoreLogger=void 0;var rN1=d2(),JLY=function(){function A(){this._logs=[]}return A.prototype.log=function(q,K,Y){var z=new Date;this._logs.push({level:q,message:K,time:z,extras:Y})},Object.defineProperty(A.prototype,"logs",{get:function(){return this._logs},enumerable:!1,configurable:!0}),A.prototype.flush=function(){if(this.logs.length>1){var q=this._logs.reduce(function(K,Y){var z,w,_,$=rN1.__assign(rN1.__assign({},Y),{json:JSON.stringify(Y.extras,null," "),extras:Y.extras});delete $.time;var O=(_=(w=Y.time)===null||w===void 0?void 0:w.toISOString())!==null&&_!==void 0?_:"";if(K[O])O="".concat(O,"-").concat(Math.random());return rN1.__assign(rN1.__assign({},K),(z={},z[O]=$,z))},{});if(console.table)console.table(q);else console.log(q)}else this.logs.forEach(function(K){var{level:Y,message:z,extras:w}=K;if(Y==="info"||Y==="debug")console.log(z,w!==null&&w!==void 0?w:"");else console[Y](z,w!==null&&w!==void 0?w:"")});this._logs=[]},A}();ex4.CoreLogger=JLY});var Fb8=C((Ku4)=>{Object.defineProperty(Ku4,"__esModule",{value:!0});Ku4.NullStats=Ku4.CoreStats=void 0;var gb8=d2(),MLY=function(A){var q={gauge:"g",counter:"c"};return q[A]},qu4=function(){function A(){this.metrics=[]}return A.prototype.increment=function(q,K,Y){if(K===void 0)K=1;this.metrics.push({metric:q,value:K,tags:Y!==null&&Y!==void 0?Y:[],type:"counter",timestamp:Date.now()})},A.prototype.gauge=function(q,K,Y){this.metrics.push({metric:q,value:K,tags:Y!==null&&Y!==void 0?Y:[],type:"gauge",timestamp:Date.now()})},A.prototype.flush=function(){var q=this.metrics.map(function(K){return gb8.__assign(gb8.__assign({},K),{tags:K.tags.join(",")})});if(console.table)console.table(q);else console.log(q);this.metrics=[]},A.prototype.serialize=function(){return this.metrics.map(function(q){return{m:q.metric,v:q.value,t:q.tags,k:MLY(q.type),e:q.timestamp}})},A}();Ku4.CoreStats=qu4;var DLY=function(A){gb8.__extends(q,A);function q(){return A!==null&&A.apply(this,arguments)||this}return q.prototype.gauge=function(){var K=[];for(var Y=0;Y{Object.defineProperty(wu4,"__esModule",{value:!0});wu4.CoreContext=wu4.ContextCancelation=void 0;var PLY=Bb8(),WLY=kb8(),ZLY=mb8(),GLY=Fb8(),zu4=function(){function A(q){var K,Y,z;this.retry=(K=q.retry)!==null&&K!==void 0?K:!0,this.type=(Y=q.type)!==null&&Y!==void 0?Y:"plugin Error",this.reason=(z=q.reason)!==null&&z!==void 0?z:""}return A}();wu4.ContextCancelation=zu4;var fLY=function(){function A(q,K,Y,z){if(K===void 0)K=(0,PLY.v4)();if(Y===void 0)Y=new GLY.NullStats;if(z===void 0)z=new ZLY.CoreLogger;this.attempts=0,this.event=q,this._id=K,this.logger=z,this.stats=Y}return A.system=function(){},A.prototype.isSame=function(q){return q.id===this.id},A.prototype.cancel=function(q){if(q)throw q;throw new zu4({reason:"Context Cancel"})},A.prototype.log=function(q,K,Y){this.logger.log(q,K,Y)},Object.defineProperty(A.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),A.prototype.updateEvent=function(q,K){var Y;if(q.split(".")[0]==="integrations"){var z=q.split(".")[1];if(((Y=this.event.integrations)===null||Y===void 0?void 0:Y[z])===!1)return this.event}return(0,WLY.dset)(this.event,q,K),this.event},A.prototype.failedDelivery=function(){return this._failedDelivery},A.prototype.setFailedDelivery=function(q){this._failedDelivery=q},A.prototype.logs=function(){return this.logger.logs},A.prototype.flush=function(){this.logger.flush(),this.stats.flush()},A.prototype.toJSON=function(){return{id:this._id,event:this.event,logs:this.logger.logs,metrics:this.stats.metrics}},A}();wu4.CoreContext=fLY});var ju4=C((Ou4)=>{Object.defineProperty(Ou4,"__esModule",{value:!0});Ou4.groupBy=void 0;var $u4=d2();function VLY(A,q){var K={};return A.forEach(function(Y){var z,w=void 0;if(typeof q==="string"){var _=Y[q];w=typeof _!=="string"?JSON.stringify(_):_}else if(q instanceof Function)w=q(Y);if(w===void 0)return;K[w]=$u4.__spreadArray($u4.__spreadArray([],(z=K[w])!==null&&z!==void 0?z:[],!0),[Y],!1)}),K}Ou4.groupBy=VLY});var Du4=C((Ju4)=>{Object.defineProperty(Ju4,"__esModule",{value:!0});Ju4.isThenable=void 0;var NLY=function(A){return typeof A==="object"&&A!==null&&"then"in A&&typeof A.then==="function"};Ju4.isThenable=NLY});var Wu4=C((Xu4)=>{Object.defineProperty(Xu4,"__esModule",{value:!0});Xu4.createTaskGroup=void 0;var vLY=Du4(),kLY=function(){var A,q,K=0;return{done:function(){return A},run:function(Y){var z=Y();if((0,vLY.isThenable)(z)){if(++K===1)A=new Promise(function(w){return q=w});z.finally(function(){return--K===0&&q()})}return z}}};Xu4.createTaskGroup=kLY});var Ub8=C((fu4)=>{Object.defineProperty(fu4,"__esModule",{value:!0});fu4.ensure=fu4.attempt=void 0;var Zu4=d2(),Qb8=oN1();function ELY(A){return Zu4.__awaiter(this,void 0,void 0,function(){var q;return Zu4.__generator(this,function(K){switch(K.label){case 0:return K.trys.push([0,2,,3]),[4,A()];case 1:return[2,K.sent()];case 2:return q=K.sent(),[2,Promise.reject(q)];case 3:return[2]}})})}function Gu4(A,q){A.log("debug","plugin",{plugin:q.name});var K=new Date().getTime(),Y=q[A.event.type];if(Y===void 0)return Promise.resolve(A);var z=ELY(function(){return Y.apply(q,[A])}).then(function(w){var _=new Date().getTime()-K;return w.stats.gauge("plugin_time",_,["plugin:".concat(q.name)]),w}).catch(function(w){if(w instanceof Qb8.ContextCancelation&&w.type==="middleware_cancellation")throw w;if(w instanceof Qb8.ContextCancelation)return A.log("warn",w.type,{plugin:q.name,error:w}),w;return A.log("error","plugin Error",{plugin:q.name,error:w}),A.stats.increment("plugin_error",1,["plugin:".concat(q.name)]),w});return z}fu4.attempt=Gu4;function LLY(A,q){return Gu4(A,q).then(function(K){if(K instanceof Qb8.CoreContext)return K;A.log("debug","Context canceled"),A.stats.increment("context_canceled"),A.cancel(K)})}fu4.ensure=LLY});var vu4=C((Vu4)=>{Object.defineProperty(Vu4,"__esModule",{value:!0});Vu4.CoreEventQueue=void 0;var SW=d2(),RLY=ju4(),SLY=ub8(),pb8=oN1(),CLY=gV6(),hLY=Wu4(),aN1=Ub8(),ILY=function(A){SW.__extends(q,A);function q(K){var Y=A.call(this)||this;return Y.criticalTasks=(0,hLY.createTaskGroup)(),Y.plugins=[],Y.failedInitializations=[],Y.flushing=!1,Y.queue=K,Y.queue.on(SLY.ON_REMOVE_FROM_FUTURE,function(){Y.scheduleFlush(0)}),Y}return q.prototype.register=function(K,Y,z){return SW.__awaiter(this,void 0,void 0,function(){var w=this;return SW.__generator(this,function(_){switch(_.label){case 0:return[4,Promise.resolve(Y.load(K,z)).then(function(){w.plugins.push(Y)}).catch(function($){if(Y.type==="destination"){w.failedInitializations.push(Y.name),console.warn(Y.name,$),K.log("warn","Failed to load destination",{plugin:Y.name,error:$});return}throw $})];case 1:return _.sent(),[2]}})})},q.prototype.deregister=function(K,Y,z){return SW.__awaiter(this,void 0,void 0,function(){var w;return SW.__generator(this,function(_){switch(_.label){case 0:if(_.trys.push([0,3,,4]),!Y.unload)return[3,2];return[4,Promise.resolve(Y.unload(K,z))];case 1:_.sent(),_.label=2;case 2:return this.plugins=this.plugins.filter(function($){return $.name!==Y.name}),[3,4];case 3:return w=_.sent(),K.log("warn","Failed to unload destination",{plugin:Y.name,error:w}),[3,4];case 4:return[2]}})})},q.prototype.dispatch=function(K){return SW.__awaiter(this,void 0,void 0,function(){var Y;return SW.__generator(this,function(z){return K.log("debug","Dispatching"),K.stats.increment("message_dispatched"),this.queue.push(K),Y=this.subscribeToDelivery(K),this.scheduleFlush(0),[2,Y]})})},q.prototype.subscribeToDelivery=function(K){return SW.__awaiter(this,void 0,void 0,function(){var Y=this;return SW.__generator(this,function(z){return[2,new Promise(function(w){var _=function($,O){if($.isSame(K))if(Y.off("flush",_),O)w($);else w($)};Y.on("flush",_)})]})})},q.prototype.dispatchSingle=function(K){return SW.__awaiter(this,void 0,void 0,function(){var Y=this;return SW.__generator(this,function(z){return K.log("debug","Dispatching"),K.stats.increment("message_dispatched"),this.queue.updateAttempts(K),K.attempts=1,[2,this.deliver(K).catch(function(w){var _=Y.enqueuRetry(w,K);if(!_)return K.setFailedDelivery({reason:w}),K;return Y.subscribeToDelivery(K)})]})})},q.prototype.isEmpty=function(){return this.queue.length===0},q.prototype.scheduleFlush=function(K){var Y=this;if(K===void 0)K=500;if(this.flushing)return;this.flushing=!0,setTimeout(function(){Y.flush().then(function(){setTimeout(function(){if(Y.flushing=!1,Y.queue.length)Y.scheduleFlush(0)},0)})},K)},q.prototype.deliver=function(K){return SW.__awaiter(this,void 0,void 0,function(){var Y,z,w,_;return SW.__generator(this,function($){switch($.label){case 0:return[4,this.criticalTasks.done()];case 1:$.sent(),Y=Date.now(),$.label=2;case 2:return $.trys.push([2,4,,5]),[4,this.flushOne(K)];case 3:return K=$.sent(),z=Date.now()-Y,this.emit("delivery_success",K),K.stats.gauge("delivered",z),K.log("debug","Delivered",K.event),[2,K];case 4:throw w=$.sent(),_=w,K.log("error","Failed to deliver",_),this.emit("delivery_failure",K,_),K.stats.increment("delivery_failed"),w;case 5:return[2]}})})},q.prototype.enqueuRetry=function(K,Y){var z=!(K instanceof pb8.ContextCancelation)||K.retry;if(!z)return!1;return this.queue.pushWithBackoff(Y)},q.prototype.flush=function(){return SW.__awaiter(this,void 0,void 0,function(){var K,Y,z;return SW.__generator(this,function(w){switch(w.label){case 0:if(this.queue.length===0)return[2,[]];if(K=this.queue.pop(),!K)return[2,[]];K.attempts=this.queue.getAttempts(K),w.label=1;case 1:return w.trys.push([1,3,,4]),[4,this.deliver(K)];case 2:return K=w.sent(),this.emit("flush",K,!0),[3,4];case 3:if(Y=w.sent(),z=this.enqueuRetry(Y,K),!z)K.setFailedDelivery({reason:Y}),this.emit("flush",K,!1);return[2,[]];case 4:return[2,[K]]}})})},q.prototype.isReady=function(){return!0},q.prototype.availableExtensions=function(K){var Y=this.plugins.filter(function(D){var X,P,W;if(D.type!=="destination"&&D.name!=="Segment.io")return!0;var Z=void 0;return(X=D.alternativeNames)===null||X===void 0||X.forEach(function(G){if(K[G]!==void 0)Z=K[G]}),(W=(P=K[D.name])!==null&&P!==void 0?P:Z)!==null&&W!==void 0?W:(D.name==="Segment.io"?!0:K.All)!==!1}),z=(0,RLY.groupBy)(Y,"type"),w=z.before,_=w===void 0?[]:w,$=z.enrichment,O=$===void 0?[]:$,H=z.destination,j=H===void 0?[]:H,J=z.after,M=J===void 0?[]:J;return{before:_,enrichment:O,destinations:j,after:M}},q.prototype.flushOne=function(K){var Y,z;return SW.__awaiter(this,void 0,void 0,function(){var w,_,$,O,H,j,X,J,M,D,X,P,W,Z,G;return SW.__generator(this,function(f){switch(f.label){case 0:if(!this.isReady())throw Error("Not ready");if(K.attempts>1)this.emit("delivery_retry",K);w=this.availableExtensions((Y=K.event.integrations)!==null&&Y!==void 0?Y:{}),_=w.before,$=w.enrichment,O=0,H=_,f.label=1;case 1:if(!(O{Object.defineProperty(ku4,"__esModule",{value:!0})});var Cu4=C((yu4)=>{Object.defineProperty(yu4,"__esModule",{value:!0});yu4.dispatch=yu4.getDelay=void 0;var Lu4=d2(),bLY=hb8(),xLY=function(A,q){var K=Date.now()-A;return Math.max((q!==null&&q!==void 0?q:300)-K,0)};yu4.getDelay=xLY;function uLY(A,q,K,Y){return Lu4.__awaiter(this,void 0,void 0,function(){var z,w;return Lu4.__generator(this,function(_){switch(_.label){case 0:if(K.emit("dispatch_start",A),z=Date.now(),!q.isEmpty())return[3,2];return[4,q.dispatchSingle(A)];case 1:return w=_.sent(),[3,4];case 2:return[4,q.dispatch(A)];case 3:w=_.sent(),_.label=4;case 4:if(!(Y===null||Y===void 0?void 0:Y.callback))return[3,6];return[4,(0,bLY.invokeCallback)(w,Y.callback,yu4.getDelay(z,Y.timeout))];case 5:w=_.sent(),_.label=6;case 6:if(Y===null||Y===void 0?void 0:Y.debug)w.flush();return[2,w]}})})}yu4.dispatch=uLY});var bu4=C((hu4)=>{Object.defineProperty(hu4,"__esModule",{value:!0});hu4.bindAll=void 0;function BLY(A){var q=A.constructor.prototype;for(var K=0,Y=Object.getOwnPropertyNames(q);K{Object.defineProperty(_D,"__esModule",{value:!0});_D.CoreLogger=_D.backoff=void 0;var SG=d2();SG.__exportStar(Mx4(),_D);SG.__exportStar(Xx4(),_D);SG.__exportStar(vb8(),_D);SG.__exportStar(xx4(),_D);SG.__exportStar(hb8(),_D);SG.__exportStar(ub8(),_D);var mLY=xb8();Object.defineProperty(_D,"backoff",{enumerable:!0,get:function(){return mLY.backoff}});SG.__exportStar(oN1(),_D);SG.__exportStar(vu4(),_D);SG.__exportStar(Eu4(),_D);SG.__exportStar(Cu4(),_D);SG.__exportStar(Lb8(),_D);SG.__exportStar(Eb8(),_D);SG.__exportStar(Sb8(),_D);SG.__exportStar(bu4(),_D);SG.__exportStar(Fb8(),_D);var gLY=mb8();Object.defineProperty(_D,"CoreLogger",{enumerable:!0,get:function(){return gLY.CoreLogger}});SG.__exportStar(Ub8(),_D)});var Bu4=C((xu4)=>{Object.defineProperty(xu4,"__esModule",{value:!0});xu4.validateSettings=void 0;var QLY=M86(),ULY=(A)=>{if(!A.writeKey)throw new QLY.ValidationError("writeKey","writeKey is missing.")};xu4.validateSettings=ULY});var db8=C((mu4)=>{Object.defineProperty(mu4,"__esModule",{value:!0});mu4.version=void 0;mu4.version="1.3.0"});var Uu4=C((Fu4)=>{Object.defineProperty(Fu4,"__esModule",{value:!0});Fu4.tryCreateFormattedUrl=void 0;var pLY=(A)=>A.replace(/\/$/,""),dLY=(A,q)=>{return pLY(new URL(q||"",A).href)};Fu4.tryCreateFormattedUrl=dLY});var lb8=C((cb8)=>{Object.defineProperty(cb8,"__esModule",{value:!0});cb8.uuid=void 0;var cLY=Bb8();Object.defineProperty(cb8,"uuid",{enumerable:!0,get:function(){return cLY.v4}})});var nu4=C((lu4)=>{Object.defineProperty(lu4,"__esModule",{value:!0});lu4.ContextBatch=void 0;var iLY=lb8(),pu4=32,du4=480;class cu4{constructor(A){this.id=(0,iLY.uuid)(),this.items=[],this.sizeInBytes=0,this.maxEventCount=Math.max(1,A)}tryAdd(A){if(this.length===this.maxEventCount)return{success:!1,message:`Event limit of ${this.maxEventCount} has been exceeded.`};let q=this.calculateSize(A.context);if(q>pu4*1024)return{success:!1,message:`Event exceeds maximum event size of ${pu4} KB`};if(this.sizeInBytes+q>du4*1024)return{success:!1,message:`Event has caused batch size to exceed ${du4} KB`};return this.items.push(A),this.sizeInBytes+=q,{success:!0}}get length(){return this.items.length}calculateSize(A){return encodeURI(JSON.stringify(A.event)).split(/%..|i/).length}getEvents(){return this.items.map(({context:q})=>q.event)}getContexts(){return this.items.map((A)=>A.context)}resolveEvents(){this.items.forEach(({resolver:A,context:q})=>A(q))}}lu4.ContextBatch=cu4});var au4=C((ru4)=>{Object.defineProperty(ru4,"__esModule",{value:!0});ru4.b64encode=void 0;var nLY=g6("buffer"),rLY=(A)=>{return nLY.Buffer.from(A).toString("base64")};ru4.b64encode=rLY});var qB4=C((eu4)=>{Object.defineProperty(eu4,"__esModule",{value:!0});eu4.Publisher=void 0;var oLY=M86(),aLY=Uu4(),sLY=gV6(),tLY=nu4(),eLY=au4();function AyY(A){return new Promise((q)=>setTimeout(q,A))}function Ei6(){}class tu4{constructor({host:A,path:q,maxRetries:K,flushAt:Y,flushInterval:z,writeKey:w,httpRequestTimeout:_,httpClient:$,disable:O},H){this._emitter=H,this._maxRetries=K,this._flushAt=Math.max(Y,1),this._flushInterval=z,this._auth=(0,eLY.b64encode)(`${w}:`),this._url=(0,aLY.tryCreateFormattedUrl)(A??"https://api.segment.io",q??"/v1/batch"),this._httpRequestTimeout=_??1e4,this._disable=Boolean(O),this._httpClient=$}createBatch(){this.pendingFlushTimeout&&clearTimeout(this.pendingFlushTimeout);let A=new tLY.ContextBatch(this._flushAt);return this._batch=A,this.pendingFlushTimeout=setTimeout(()=>{if(A===this._batch)this._batch=void 0;if(this.pendingFlushTimeout=void 0,A.length)this.send(A).catch(Ei6)},this._flushInterval),A}clearBatch(){this.pendingFlushTimeout&&clearTimeout(this.pendingFlushTimeout),this._batch=void 0}flush(A){if(!A)return;if(this._flushPendingItemsCount=A,!this._batch)return;if(this._batch.length===A)this.send(this._batch).catch(Ei6),this.clearBatch()}enqueue(A){let q=this._batch??this.createBatch(),{promise:K,resolve:Y}=(0,sLY.createDeferred)(),z={context:A,resolver:Y};if(q.tryAdd(z).success){let O=q.length===this._flushPendingItemsCount;if(q.length===this._flushAt||O)this.send(q).catch(Ei6),this.clearBatch();return K}if(q.length)this.send(q).catch(Ei6),this.clearBatch();let _=this.createBatch(),$=_.tryAdd(z);if($.success){if(_.length===this._flushPendingItemsCount)this.send(_).catch(Ei6),this.clearBatch();return K}else return A.setFailedDelivery({reason:Error($.message)}),Promise.resolve(A)}async send(A){if(this._flushPendingItemsCount)this._flushPendingItemsCount-=A.length;let q=A.getEvents(),K=this._maxRetries+1,Y=0;while(Y=200&&_.status<300){A.resolveEvents();return}else if(_.status===400){su4(A,Error(`[${_.status}] ${_.statusText}`));return}else z=Error(`[${_.status}] ${_.statusText}`)}catch(w){z=w}if(Y===K){su4(A,z);return}await AyY((0,oLY.backoff)({attempt:Y,minTimeout:25,maxTimeout:1000}))}}}eu4.Publisher=tu4;function su4(A,q){A.getContexts().forEach((K)=>K.setFailedDelivery({reason:q})),A.resolveEvents()}});var ib8=C((KB4)=>{Object.defineProperty(KB4,"__esModule",{value:!0});KB4.detectRuntime=void 0;var qyY=()=>{if(typeof process==="object"&&process&&typeof process.env==="object"&&process.env&&typeof process.version==="string")return"node";if(typeof window==="object")return"browser";if(typeof WebSocketPair<"u")return"cloudflare-worker";if(typeof EdgeRuntime==="string")return"vercel-edge";if(typeof WorkerGlobalScope<"u"&&typeof importScripts==="function")return"web-worker";return"unknown"};KB4.detectRuntime=qyY});var $B4=C((wB4)=>{Object.defineProperty(wB4,"__esModule",{value:!0});wB4.createConfiguredNodePlugin=wB4.createNodePlugin=void 0;var KyY=qB4(),YyY=db8(),zyY=ib8();function wyY(A){A.updateEvent("context.library.name","@segment/analytics-node"),A.updateEvent("context.library.version",YyY.version);let q=(0,zyY.detectRuntime)();if(q==="node")A.updateEvent("_metadata.nodeVersion",process.version);A.updateEvent("_metadata.jsRuntime",q)}function zB4(A){function q(K){return wyY(K),A.enqueue(K)}return{name:"Segment.io",type:"destination",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),alias:q,group:q,identify:q,page:q,screen:q,track:q}}wB4.createNodePlugin=zB4;var _yY=(A,q)=>{let K=new KyY.Publisher(A,q);return{publisher:K,plugin:zB4(K)}};wB4.createConfiguredNodePlugin=_yY});var jB4=C((OB4)=>{Object.defineProperty(OB4,"__esModule",{value:!0});OB4.createMessageId=void 0;var OyY=lb8(),HyY=()=>{return`node-next-${Date.now()}-${(0,OyY.uuid)()}`};OB4.createMessageId=HyY});var XB4=C((MB4)=>{Object.defineProperty(MB4,"__esModule",{value:!0});MB4.NodeEventFactory=void 0;var jyY=M86(),JyY=jB4();class JB4 extends jyY.EventFactory{constructor(){super({createMessageId:JyY.createMessageId})}}MB4.NodeEventFactory=JB4});var sN1=C((WB4)=>{Object.defineProperty(WB4,"__esModule",{value:!0});WB4.Context=void 0;var MyY=M86();class PB4 extends MyY.CoreContext{static system(){return new this({type:"track",event:"system"})}}WB4.Context=PB4});var TB4=C((GB4)=>{Object.defineProperty(GB4,"__esModule",{value:!0});GB4.dispatchAndEmit=void 0;var DyY=M86(),XyY=sN1(),PyY=(A)=>(q)=>{let K=q.failedDelivery();return K?A(K.reason,q):A(void 0,q)},WyY=async(A,q,K,Y)=>{try{let z=new XyY.Context(A),w=await(0,DyY.dispatch)(z,q,K,{...Y?{callback:PyY(Y)}:{}}),_=w.failedDelivery();if(_)K.emit("error",{code:"delivery_failure",reason:_.reason,ctx:w});else K.emit(A.type,w)}catch(z){K.emit("error",{code:"unknown",reason:z})}};GB4.dispatchAndEmit=WyY});var kB4=C((NB4)=>{Object.defineProperty(NB4,"__esModule",{value:!0});NB4.NodeEmitter=void 0;var ZyY=gV6();class VB4 extends ZyY.Emitter{}NB4.NodeEmitter=VB4});var CB4=C((RB4)=>{Object.defineProperty(RB4,"__esModule",{value:!0});RB4.NodeEventQueue=void 0;var EB4=M86();class LB4 extends EB4.PriorityQueue{constructor(){super(1,[])}getAttempts(A){return A.attempts??0}updateAttempts(A){return A.attempts=this.getAttempts(A)+1,this.getAttempts(A)}}class yB4 extends EB4.CoreEventQueue{constructor(){super(new LB4)}}RB4.NodeEventQueue=yB4});var xB4=C((IB4)=>{Object.defineProperty(IB4,"__esModule",{value:!0});IB4.abortSignalAfterTimeout=IB4.AbortSignal=void 0;var GyY=gV6(),fyY=ib8();class nb8{constructor(){this.onabort=null,this.aborted=!1,this.eventEmitter=new GyY.Emitter}toString(){return"[object AbortSignal]"}get[Symbol.toStringTag](){return"AbortSignal"}removeEventListener(...A){this.eventEmitter.off(...A)}addEventListener(...A){this.eventEmitter.on(...A)}dispatchEvent(A){let q={type:A,target:this},K=`on${A}`;if(typeof this[K]==="function")this[K](q);this.eventEmitter.emit(A,q)}}IB4.AbortSignal=nb8;class hB4{constructor(){this.signal=new nb8}abort(){if(this.signal.aborted)return;this.signal.aborted=!0,this.signal.dispatchEvent("abort")}toString(){return"[object AbortController]"}get[Symbol.toStringTag](){return"AbortController"}}var TyY=(A)=>{if((0,fyY.detectRuntime)()==="cloudflare-worker")return[];let q=new(globalThis.AbortController||hB4),K=setTimeout(()=>{q.abort()},A);return K?.unref?.(),[q.signal,K]};IB4.abortSignalAfterTimeout=TyY});var uB4=C((TQ)=>{var NyY=TQ&&TQ.__createBinding||(Object.create?function(A,q,K,Y){if(Y===void 0)Y=K;var z=Object.getOwnPropertyDescriptor(q,K);if(!z||("get"in z?!q.__esModule:z.writable||z.configurable))z={enumerable:!0,get:function(){return q[K]}};Object.defineProperty(A,Y,z)}:function(A,q,K,Y){if(Y===void 0)Y=K;A[Y]=q[K]}),vyY=TQ&&TQ.__setModuleDefault||(Object.create?function(A,q){Object.defineProperty(A,"default",{enumerable:!0,value:q})}:function(A,q){A.default=q}),kyY=TQ&&TQ.__importStar||function(A){if(A&&A.__esModule)return A;var q={};if(A!=null){for(var K in A)if(K!=="default"&&Object.prototype.hasOwnProperty.call(A,K))NyY(q,A,K)}return vyY(q,A),q};Object.defineProperty(TQ,"__esModule",{value:!0});TQ.fetch=void 0;var EyY=async(...A)=>{if(globalThis.fetch)return globalThis.fetch(...A);else if(typeof EdgeRuntime!=="string")return(await Promise.resolve().then(()=>kyY(qT8()))).default(...A);else throw Error("Invariant: an edge runtime that does not support fetch should not exist")};TQ.fetch=EyY});var rb8=C((mB4)=>{Object.defineProperty(mB4,"__esModule",{value:!0});mB4.FetchHTTPClient=void 0;var LyY=xB4(),yyY=uB4();class BB4{constructor(A){this._fetch=A??yyY.fetch}async makeRequest(A){let[q,K]=(0,LyY.abortSignalAfterTimeout)(A.httpRequestTimeout),Y={url:A.url,method:A.method,headers:A.headers,body:JSON.stringify(A.data),signal:q};return this._fetch(A.url,Y).finally(()=>clearTimeout(K))}}mB4.FetchHTTPClient=BB4});var ob8=C((dB4)=>{Object.defineProperty(dB4,"__esModule",{value:!0});dB4.Analytics=void 0;var FB4=M86(),RyY=Bu4(),SyY=db8(),CyY=$B4(),hyY=XB4(),IyY=TB4(),byY=kB4(),QB4=sN1(),xyY=CB4(),UB4=rb8();class pB4 extends byY.NodeEmitter{constructor(A){super();this._isClosed=!1,this._pendingEvents=0,this._isFlushing=!1,(0,RyY.validateSettings)(A),this._eventFactory=new hyY.NodeEventFactory,this._queue=new xyY.NodeEventQueue;let q=A.flushInterval??1e4;this._closeAndFlushDefaultTimeout=q*1.25;let{plugin:K,publisher:Y}=(0,CyY.createConfiguredNodePlugin)({writeKey:A.writeKey,host:A.host,path:A.path,maxRetries:A.maxRetries??3,flushAt:A.flushAt??A.maxEventsInBatch??15,httpRequestTimeout:A.httpRequestTimeout,disable:A.disable,flushInterval:q,httpClient:typeof A.httpClient==="function"?new UB4.FetchHTTPClient(A.httpClient):A.httpClient??new UB4.FetchHTTPClient},this);this._publisher=Y,this.ready=this.register(K).then(()=>{return}),this.emit("initialize",A),(0,FB4.bindAll)(this)}get VERSION(){return SyY.version}closeAndFlush({timeout:A=this._closeAndFlushDefaultTimeout}={}){return this.flush({timeout:A,close:!0})}async flush({timeout:A,close:q=!1}={}){if(this._isFlushing){console.warn("Overlapping flush calls detected. Please wait for the previous flush to finish before calling .flush again");return}else this._isFlushing=!0;if(q)this._isClosed=!0;this._publisher.flush(this._pendingEvents);let K=new Promise((Y)=>{if(!this._pendingEvents)Y();else this.once("drained",()=>{Y()})}).finally(()=>{this._isFlushing=!1});return A?(0,FB4.pTimeout)(K,A).catch(()=>{return}):K}_dispatch(A,q){if(this._isClosed){this.emit("call_after_close",A);return}this._pendingEvents++,(0,IyY.dispatchAndEmit)(A,this._queue,this,q).catch((K)=>K).finally(()=>{if(this._pendingEvents--,!this._pendingEvents)this.emit("drained")})}alias({userId:A,previousId:q,context:K,timestamp:Y,integrations:z},w){let _=this._eventFactory.alias(A,q,{context:K,integrations:z,timestamp:Y});this._dispatch(_,w)}group({timestamp:A,groupId:q,userId:K,anonymousId:Y,traits:z={},context:w,integrations:_},$){let O=this._eventFactory.group(q,z,{context:w,anonymousId:Y,userId:K,timestamp:A,integrations:_});this._dispatch(O,$)}identify({userId:A,anonymousId:q,traits:K={},context:Y,timestamp:z,integrations:w},_){let $=this._eventFactory.identify(A,K,{context:Y,anonymousId:q,userId:A,timestamp:z,integrations:w});this._dispatch($,_)}page({userId:A,anonymousId:q,category:K,name:Y,properties:z,context:w,timestamp:_,integrations:$},O){let H=this._eventFactory.page(K??null,Y??null,z,{context:w,anonymousId:q,userId:A,timestamp:_,integrations:$});this._dispatch(H,O)}screen({userId:A,anonymousId:q,category:K,name:Y,properties:z,context:w,timestamp:_,integrations:$},O){let H=this._eventFactory.screen(K??null,Y??null,z,{context:w,anonymousId:q,userId:A,timestamp:_,integrations:$});this._dispatch(H,O)}track({userId:A,anonymousId:q,event:K,properties:Y,context:z,timestamp:w,integrations:_},$){let O=this._eventFactory.track(K,Y,{context:z,userId:A,anonymousId:q,timestamp:w,integrations:_});this._dispatch(O,$)}register(...A){return this._queue.criticalTasks.run(async()=>{let q=QB4.Context.system(),K=A.map((Y)=>this._queue.register(q,Y,this));await Promise.all(K),this.emit("register",A.map((Y)=>Y.name))})}async deregister(...A){let q=QB4.Context.system(),K=A.map((Y)=>{let z=this._queue.plugins.find((w)=>w.name===Y);if(z)return this._queue.deregister(q,z,this);else q.log("warn",`plugin ${Y} not found`)});await Promise.all(K),this.emit("deregister",A)}}dB4.Analytics=pB4});var lB4=C((Li6)=>{Object.defineProperty(Li6,"__esModule",{value:!0});Li6.FetchHTTPClient=Li6.Context=Li6.Analytics=void 0;var uyY=ob8();Object.defineProperty(Li6,"Analytics",{enumerable:!0,get:function(){return uyY.Analytics}});var ByY=sN1();Object.defineProperty(Li6,"Context",{enumerable:!0,get:function(){return ByY.Context}});var myY=rb8();Object.defineProperty(Li6,"FetchHTTPClient",{enumerable:!0,get:function(){return myY.FetchHTTPClient}});var gyY=ob8();Li6.default=gyY.Analytics});function pyY(){return UyY.production}async function dyY(){if(UV())return!1;return!0}async function rB4(){await ab8?.closeAndFlush()}async function sb8(A,q){let K=await nB4();if(!K)return;try{let Y=eN1(),z=Y9(),w=await mV6({model:q.model}),_=aB4(w,q),$={anonymousId:Y,event:A,properties:_};if(z){let O=ik(!0);$.userId=O.deviceId,$.properties.accountUuid=z.accountUuid,$.properties.organizationUuid=z.organizationUuid}K.track($)}catch(Y){$6(Y)}}async function oB4(A){let q=await nB4();if(!q)return;try{let K=eN1(),Y=Y9(),z={anonymousId:K,traits:A};if(Y){let w=ik(!0);z.userId=w.deviceId}q.identify(z)}catch(K){$6(K)}}var iB4,UyY,ab8=null,nB4;var tN1=k(()=>{Eq();cq6();Q8();x1();bA();ij();aa();iB4=e(lB4(),1),UyY={production:"LKJN8LsLERHEOXkw487o7qCTFOrGPimI",development:"b64sf1kxwDGe1PiSAlv5ixuH0f509RKK"};nB4=T8(async()=>{if(!await dyY())return null;try{return ab8=new iB4.Analytics({writeKey:pyY(),flushAt:50,flushInterval:1e4}),ab8}catch(q){return $6(q),null}})});import{writeSync as $n}from"fs";function sB4(){if(!process.stdout.isTTY)return;try{if(wP.get(process.stdout)?.isAltScreenActive)$n(1,je),$n(1,kg6);if($n(1,S06),$n(1,l56),$n(1,a06),$n(1,Vb),$n(1,zj1),process.platform==="win32")process.title="";else $n(1,PS7)}catch{}}function tB4(){if(process.stdout.isTTY&&Ek()&&!Cy())try{let A=d1();if(!Ri6(A))return;let q=kC(A),K;if(q)K=`"${q.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;else K=A;$n(1,M1.dim(` Resume this session with: claude --resume ${K} `))}catch{}}function tb8(A){if(yi6!==void 0)clearTimeout(yi6),yi6=void 0;try{process.exit(A)}catch(q){process.kill(process.pid,"SIGKILL")}throw Error("unreachable")}function O3(A=0,q="other",K){process.exitCode=A,cyY=$K(A,q,K).catch((Y)=>{L(`Graceful shutdown failed: ${Y}`,{level:"error"}),sB4(),tB4(),tb8(A)}).catch(()=>{})}function Av1(){return eb8}async function $K(A=0,q="other",K){if(eb8)return;eb8=!0,yi6=setTimeout(()=>{tb8(A)},5000),yi6.unref(),process.exitCode=A;let Y;try{let z=(async()=>{try{await cKA()}catch{}})();await Promise.race([z,new Promise((w,_)=>{Y=setTimeout(()=>_(Error("Cleanup timeout")),2000)})]),clearTimeout(Y)}catch{clearTimeout(Y)}try{let{executeSessionEndHooks:z}=await Promise.resolve().then(() => (J$(),Ax8));await z(q,K)}catch{}try{LR6()}catch{}try{await Promise.all([Si6(),dN1(),rB4()])}catch{}sB4(),tB4(),tb8(A)}var eB4,eb8=!1,yi6,cyY;var B_=k(()=>{iK();Eq();G1();AI();sY();FV6();cN1();tN1();Je();Zb();Tg();D2();B1();Q1();uq();Vg();eB4=T8(()=>{if(process.on("SIGINT",()=>{z8("info","shutdown_signal",{signal:"SIGINT"}),$K(0)}),process.on("SIGTERM",()=>{z8("info","shutdown_signal",{signal:"SIGTERM"}),$K(143)}),process.platform!=="win32"){if(process.on("SIGHUP",()=>{z8("info","shutdown_signal",{signal:"SIGHUP"}),$K(129)}),process.stdin.isTTY){let A=setInterval(()=>{if(!process.stdout.writable||!process.stdin.readable)clearInterval(A),z8("info","shutdown_signal",{signal:"orphan_detected"}),$K(129)},30000);A.unref()}}process.on("uncaughtException",(A)=>{z8("error","uncaught_exception",{error_name:A.name,error_message:A.message.slice(0,2000)}),c("tengu_uncaught_exception",{error_name:A.name})}),process.on("unhandledRejection",(A)=>{let q=A instanceof Error?A.name:typeof A==="string"?"string":"unknown",K=A instanceof Error?{error_name:A.name,error_message:A.message.slice(0,2000),error_stack:A.stack?.slice(0,4000)}:{error_message:String(A).slice(0,2000)};z8("error","unhandled_rejection",K),c("tengu_unhandled_rejection",{error_name:q})})})});async function qv1(A){try{return await A()}catch(q){if(I8.isAxiosError(q)&&q.response?.status===401){c("tengu_grove_oauth_401_received",{});let K=g7()?.accessToken;if(K)return await Sf(K),await A()}throw q}}async function qx8(){try{await qv1(()=>{let A=gO();if(A.error)throw Error(`Failed to get auth headers: ${A.error}`);return I8.post(`${U7().BASE_API_URL}/api/oauth/account/grove_notice_viewed`,{},{headers:{...A.headers,"User-Agent":mO()}})}),ax.cache.clear?.()}catch(A){$6(A)}}async function Kv1(A){try{await qv1(()=>{let q=gO();if(q.error)throw Error(`Failed to get auth headers: ${q.error}`);return I8.patch(`${U7().BASE_API_URL}/api/oauth/account/settings`,{grove_enabled:A},{headers:{...q.headers,"User-Agent":mO()}})}),ax.cache.clear?.()}catch(q){$6(q)}}async function QV6(){if(!Ci6())return!1;let A=Y9()?.accountUuid;if(!A)return!1;let K=T1().groveConfigCache?.[A],Y=Date.now();if(!K)return L("Grove: No cache, fetching config in background (dialog skipped this session)"),Am4(A),!1;if(Y-K.timestamp>lyY)return L("Grove: Cache stale, returning cached data and refreshing in background"),Am4(A),K.grove_enabled;return L("Grove: Using fresh cached config"),K.grove_enabled}async function Am4(A){try{let q=await D86();if(!q.success)return;let K=q.data.grove_enabled;_8((Y)=>({...Y,groveConfigCache:{...Y.groveConfigCache,[A]:{grove_enabled:K,timestamp:Date.now()}}}))}catch(q){L(`Grove: Failed to fetch and store config: ${q}`)}}function Kx8(A,q,K){if(!A.success||!q.success)return!1;let Y=A.data,z=q.data;if(Y.grove_enabled!==null)return!1;if(K)return!0;if(!z.notice_is_grace_period)return!0;let _=z.notice_reminder_frequency;if(_!==null&&Y.grove_notice_viewed_at)return Math.floor((Date.now()-new Date(Y.grove_notice_viewed_at).getTime())/86400000)>=_;else{let $=Y.grove_notice_viewed_at;return $===null||$===void 0}}async function qm4(){let[A,q]=await Promise.all([ax(),D86()]);if(Kx8(A,q,!1)){let Y=q.success?q.data:null;if(c("tengu_grove_print_viewed",{dismissable:Y?.notice_is_grace_period}),Y===null||Y.notice_is_grace_period)Io(` An update to our Consumer Terms and Privacy Policy will take effect on October 8, 2025. Run \`claude\` to review the updated terms. `),await qx8();else Io(` [ACTION REQUIRED] An update to our Consumer Terms and Privacy Policy has taken effect on October 8, 2025. You must run \`claude\` to review the updated terms. `),await $K(1)}}var lyY=86400000,ax,D86;var UV6=k(()=>{A3();uD();x1();L5();G1();B1();bA();Q8();Eq();B_();ax=T8(async()=>{if(process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC)return{success:!1};try{return{success:!0,data:(await qv1(()=>{let q=gO();if(q.error)throw Error(`Failed to get auth headers: ${q.error}`);return I8.get(`${U7().BASE_API_URL}/api/oauth/account/settings`,{headers:{...q.headers,"User-Agent":mO()}})})).data}}catch(A){return $6(A),ax.cache.clear?.(),{success:!1}}});D86=T8(async()=>{if(process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC)return{success:!1};try{let A=await qv1(()=>{let w=gO();if(w.error)throw Error(`Failed to get auth headers: ${w.error}`);return I8.get(`${U7().BASE_API_URL}/api/claude_code_grove`,{headers:{...w.headers,"User-Agent":ey()},timeout:3000})}),{grove_enabled:q,domain_excluded:K,notice_is_grace_period:Y,notice_reminder_frequency:z}=A.data;return{success:!0,data:{grove_enabled:q,domain_excluded:K??!1,notice_is_grace_period:Y??!0,notice_reminder_frequency:z}}}catch(A){return L(`Failed to fetch Grove notice config: ${A}`),{success:!1}}})});var Km4;var Ym4=k(()=>{B7();Km4=i6(()=>I.object({uuid:I.string(),checksum:I.string(),settings:I.record(I.string(),I.unknown())}))});function zm4({isDisabled:A=!1,visibleOptionCount:q=5,options:K,defaultValue:Y=[],onChange:z,onCancel:w,onFocus:_,focusValue:$,submitButtonText:O,onSubmit:H,onDownFromLastItem:j,onUpFromFirstItem:J,initialFocusLast:M}){let[D,X]=Sw6.useState(Y),[P,W]=Sw6.useState(!1),[Z,G]=Sw6.useState(()=>{let v=new Map;return K.forEach((y)=>{if(y.type==="input"&&y.initialValue)v.set(y.value,y.initialValue)}),v}),f=Sw6.useCallback((v)=>{let y=typeof v==="function"?v(D):v;X(y),z?.(y)},[D,z]),V=hN1({visibleOptionCount:q,options:K,initialFocusValue:M?K[K.length-1]?.value:void 0,onFocus:_,focusValue:$});wX("multi-select");let N=Sw6.useCallback((v,y)=>{G((h)=>{let B=new Map(h);return B.set(v,y),B});let R=K.find((h)=>h.value===v);if(R&&R.type==="input")R.onChange(y);f((h)=>{if(y){if(!h.includes(v))return[...h,v];return h}else return h.filter((B)=>B!==v)})},[K,f]);return kA((v,y,R)=>{let h=xI(v),x=K.find((g)=>g.value===V.focusedValue)?.type==="input";if(x){if(!(y.upArrow||y.downArrow||y.escape||y.tab||y.return||y.ctrl&&(v==="n"||v==="p"||y.return)))return}let F=K[K.length-1]?.value;if(y.tab&&!y.shift){if(O&&H&&V.focusedValue===F&&!P)W(!0);else if(!P)V.focusNextOption();return}if(y.tab&&y.shift){if(O&&H&&P)W(!1),V.focusOption(F);else V.focusPreviousOption();return}if(y.downArrow||y.ctrl&&v==="n"||!y.ctrl&&!y.shift&&v==="j"){if(P&&j)j();else if(O&&H&&V.focusedValue===F&&!P)W(!0);else if(!O&&j&&V.focusedValue===F)j();else if(!P)V.focusNextOption();return}if(y.upArrow||y.ctrl&&v==="p"||!y.ctrl&&!y.shift&&v==="k"){if(O&&H&&P)W(!1),V.focusOption(F);else if(J&&V.focusedValue===K[0]?.value)J();else V.focusPreviousOption();return}if(y.pageDown){V.focusNextPage();return}if(y.pageUp){V.focusPreviousPage();return}if(y.return||t31(v)===" "){if(y.ctrl&&y.return&&x&&H){H();return}if(P&&H){H();return}if(V.focusedValue!==void 0){let g=D.includes(V.focusedValue)?D.filter((b)=>b!==V.focusedValue):[...D,V.focusedValue];f(g)}return}if(/^[0-9]+$/.test(h)){let g=parseInt(h)-1;if(g>=0&&gd!==b):[...D,b];f(U)}return}if(y.escape)w(),R.stopImmediatePropagation()},{isActive:!A}),{...V,selectedValues:D,inputValues:Z,isSubmitFocused:P,updateInputValue:N,onCancel:w}}var Sw6;var wm4=k(()=>{n6();PL();Pb8();Sw6=e(W6(),1)});function _m4(A){let q=Y6(43),{isDisabled:K,visibleOptionCount:Y,options:z,defaultValue:w,onCancel:_,onChange:$,onFocus:O,focusValue:H,submitButtonText:j,onSubmit:J,onDownFromLastItem:M,onUpFromFirstItem:D,initialFocusLast:X,onOpenEditor:P,hideIndexes:W,onImagePaste:Z,pastedContents:G,onRemoveImage:f}=A,V=K===void 0?!1:K,N=Y===void 0?5:Y,v;if(q[0]!==w)v=w===void 0?[]:w,q[0]=w,q[1]=v;else v=q[1];let y=v,R=W===void 0?!1:W,h;if(q[2]!==y||q[3]!==H||q[4]!==X||q[5]!==V||q[6]!==_||q[7]!==$||q[8]!==M||q[9]!==O||q[10]!==J||q[11]!==D||q[12]!==z||q[13]!==j||q[14]!==N)h={isDisabled:V,visibleOptionCount:N,options:z,defaultValue:y,onChange:$,onCancel:_,onFocus:O,focusValue:H,submitButtonText:j,onSubmit:J,onDownFromLastItem:M,onUpFromFirstItem:D,initialFocusLast:X},q[2]=y,q[3]=H,q[4]=X,q[5]=V,q[6]=_,q[7]=$,q[8]=M,q[9]=O,q[10]=J,q[11]=D,q[12]=z,q[13]=j,q[14]=N,q[15]=h;else h=q[15];let B=zm4(h),x,F,g,b,U;if(q[16]!==R||q[17]!==V||q[18]!==_||q[19]!==Z||q[20]!==P||q[21]!==f||q[22]!==z.length||q[23]!==G||q[24]!==B){let s=z.length.toString().length;F=m,U="column",x=m,g="column",b=B.visibleOptions.map((H6,Z6)=>{let G6=!V&&B.focusedValue===H6.value&&!B.isSubmitFocused,q6=B.selectedValues.includes(H6.value),w6=H6.index===B.visibleFromIndex,j6=H6.index===B.visibleToIndex-1,_6=B.visibleToIndex0,P6=B.visibleFromIndex+Z6+1;if(H6.type==="input"){let A6=B.inputValues.get(H6.value)||"";return CG.default.createElement(m,{key:String(H6.value),gap:1},CG.default.createElement(BV6,{option:H6,isFocused:G6,isSelected:!1,shouldShowDownArrow:_6&&j6,shouldShowUpArrow:k6&&w6,maxIndexWidth:s,index:P6,inputValue:A6,onInputChange:(K6)=>{B.updateInputValue(H6.value,K6)},onSubmit:iyY,onExit:()=>{_()},layout:"compact",onOpenEditor:P,onImagePaste:Z,pastedContents:G,onRemoveImage:f},CG.default.createElement(T,{color:q6?"success":void 0},"[",q6?q1.tick:" ","]"," ")))}return CG.default.createElement(m,{key:String(H6.value),gap:1},CG.default.createElement(j86,{isFocused:G6,isSelected:!1,shouldShowDownArrow:_6&&j6,shouldShowUpArrow:k6&&w6,description:H6.description},!R&&CG.default.createElement(T,{dimColor:!0},`${P6}.`.padEnd(s)),CG.default.createElement(T,{color:!R&&q6?"success":void 0},"[",q6?q1.tick:" ","]"),CG.default.createElement(T,{color:G6?"suggestion":void 0},H6.label)))}),q[16]=R,q[17]=V,q[18]=_,q[19]=Z,q[20]=P,q[21]=f,q[22]=z.length,q[23]=G,q[24]=B,q[25]=x,q[26]=F,q[27]=g,q[28]=b,q[29]=U}else x=q[25],F=q[26],g=q[27],b=q[28],U=q[29];let d;if(q[30]!==x||q[31]!==g||q[32]!==b)d=CG.default.createElement(x,{flexDirection:g},b),q[30]=x,q[31]=g,q[32]=b,q[33]=d;else d=q[33];let l;if(q[34]!==J||q[35]!==B.isSubmitFocused||q[36]!==j)l=j&&J&&CG.default.createElement(m,{marginTop:0,gap:1},B.isSubmitFocused?CG.default.createElement(T,{color:"suggestion"},q1.pointer):CG.default.createElement(T,null," "),CG.default.createElement(m,{marginLeft:3},CG.default.createElement(T,{color:B.isSubmitFocused?"suggestion":void 0,bold:!0},j))),q[34]=J,q[35]=B.isSubmitFocused,q[36]=j,q[37]=l;else l=q[37];let t;if(q[38]!==F||q[39]!==d||q[40]!==l||q[41]!==U)t=CG.default.createElement(F,{flexDirection:U},d,l),q[38]=F,q[39]=d,q[40]=l,q[41]=U,q[42]=t;else t=q[42];return t}function iyY(){}var CG;var $m4=k(()=>{K1();t7();n6();fb8();SN1();wm4();CG=e(W6(),1)});var HY=k(()=>{_5();$m4()});function X86(A){let q=Y6(13),{title:K,subtitle:Y,color:z,workerBadge:w}=A,_=z===void 0?"permission":z,$;if(q[0]!==_||q[1]!==K)$=sx.createElement(T,{bold:!0,color:_},K),q[0]=_,q[1]=K,q[2]=$;else $=q[2];let O;if(q[3]!==w)O=w&&sx.createElement(T,{dimColor:!0},"· ","@",w.name),q[3]=w,q[4]=O;else O=q[4];let H;if(q[5]!==$||q[6]!==O)H=sx.createElement(m,{flexDirection:"row",gap:1},$,O),q[5]=$,q[6]=O,q[7]=H;else H=q[7];let j;if(q[8]!==Y)j=Y!=null&&(typeof Y==="string"?sx.createElement(T,{dimColor:!0,wrap:"truncate-start"},Y):Y),q[8]=Y,q[9]=j;else j=q[9];let J;if(q[10]!==H||q[11]!==j)J=sx.createElement(m,{flexDirection:"column"},H,j),q[10]=H,q[11]=j,q[12]=J;else J=q[12];return J}var sx;var hi6=k(()=>{K1();n6();sx=e(W6(),1)});function Vw(A){let q=Y6(15),{title:K,subtitle:Y,color:z,titleColor:w,innerPaddingX:_,workerBadge:$,titleRight:O,children:H}=A,j=z===void 0?"permission":z,J=_===void 0?1:_,M;if(q[0]!==Y||q[1]!==K||q[2]!==w||q[3]!==$)M=tx.createElement(X86,{title:K,subtitle:Y,color:w,workerBadge:$}),q[0]=Y,q[1]=K,q[2]=w,q[3]=$,q[4]=M;else M=q[4];let D;if(q[5]!==M||q[6]!==O)D=tx.createElement(m,{paddingX:1,flexDirection:"column"},tx.createElement(m,{justifyContent:"space-between"},M,O)),q[5]=M,q[6]=O,q[7]=D;else D=q[7];let X;if(q[8]!==H||q[9]!==J)X=tx.createElement(m,{flexDirection:"column",paddingX:J},H),q[8]=H,q[9]=J,q[10]=X;else X=q[10];let P;if(q[11]!==j||q[12]!==D||q[13]!==X)P=tx.createElement(m,{flexDirection:"column",borderStyle:"round",borderColor:j,borderLeft:!1,borderRight:!1,borderBottom:!1,marginTop:1},D,X),q[11]=j,q[12]=D,q[13]=X,q[14]=P;else P=q[14];return P}var tx;var hG=k(()=>{K1();n6();hi6();tx=e(W6(),1)});var Om4,pV6;var Yv1=k(()=>{Om4=["apiKeyHelper","awsAuthRefresh","awsCredentialExport","otelHeadersHelper","statusLine"],pV6=new Set(["ANTHROPIC_CUSTOM_HEADERS","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_FOUNDRY_API_KEY","ANTHROPIC_MODEL","ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION","ANTHROPIC_SMALL_FAST_MODEL","AWS_DEFAULT_REGION","AWS_PROFILE","AWS_REGION","BASH_DEFAULT_TIMEOUT_MS","BASH_MAX_OUTPUT_LENGTH","BASH_MAX_TIMEOUT_MS","CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR","CLAUDE_CODE_API_KEY_HELPER_TTL_MS","CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS","CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC","CLAUDE_CODE_DISABLE_TERMINAL_TITLE","CLAUDE_CODE_ENABLE_TELEMETRY","CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS","CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL","CLAUDE_CODE_MAX_OUTPUT_TOKENS","CLAUDE_CODE_SKIP_BEDROCK_AUTH","CLAUDE_CODE_SKIP_FOUNDRY_AUTH","CLAUDE_CODE_SKIP_VERTEX_AUTH","CLAUDE_CODE_SUBAGENT_MODEL","CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_FOUNDRY","CLAUDE_CODE_USE_VERTEX","DISABLE_AUTOUPDATER","DISABLE_BUG_COMMAND","DISABLE_COST_WARNINGS","DISABLE_ERROR_REPORTING","DISABLE_FEEDBACK_COMMAND","DISABLE_TELEMETRY","ENABLE_TOOL_SEARCH","MAX_MCP_OUTPUT_TOKENS","MAX_THINKING_TOKENS","MCP_TIMEOUT","MCP_TOOL_TIMEOUT","OTEL_EXPORTER_OTLP_HEADERS","OTEL_EXPORTER_OTLP_LOGS_HEADERS","OTEL_EXPORTER_OTLP_LOGS_PROTOCOL","OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE","OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY","OTEL_EXPORTER_OTLP_METRICS_HEADERS","OTEL_EXPORTER_OTLP_METRICS_PROTOCOL","OTEL_EXPORTER_OTLP_PROTOCOL","OTEL_EXPORTER_OTLP_TRACES_HEADERS","OTEL_LOG_USER_PROMPTS","OTEL_LOGS_EXPORT_INTERVAL","OTEL_LOGS_EXPORTER","OTEL_METRIC_EXPORT_INTERVAL","OTEL_METRICS_EXPORTER","OTEL_METRICS_INCLUDE_ACCOUNT_UUID","OTEL_METRICS_INCLUDE_SESSION_ID","OTEL_METRICS_INCLUDE_VERSION","OTEL_RESOURCE_ATTRIBUTES","USE_BUILTIN_RIPGREP","VERTEX_REGION_CLAUDE_3_5_HAIKU","VERTEX_REGION_CLAUDE_3_5_SONNET","VERTEX_REGION_CLAUDE_3_7_SONNET","VERTEX_REGION_CLAUDE_4_0_OPUS","VERTEX_REGION_CLAUDE_4_0_SONNET","VERTEX_REGION_CLAUDE_4_1_OPUS","VERTEX_REGION_CLAUDE_HAIKU_4_5"])});function dV6(A){if(!A)return{shellSettings:{},envVars:{},hasHooks:!1};let q={};for(let z of Om4){let w=A[z];if(typeof w==="string"&&w.length>0)q[z]=w}let K={};if(A.env&&typeof A.env==="object"){for(let[z,w]of Object.entries(A.env))if(typeof w==="string"&&w.length>0){if(!pV6.has(z.toUpperCase()))K[z]=w}}let Y=A.hooks!==void 0&&A.hooks!==null&&typeof A.hooks==="object"&&Object.keys(A.hooks).length>0;return{shellSettings:q,envVars:K,hasHooks:Y,hooks:Y?A.hooks:void 0}}function zv1(A){return Object.keys(A.shellSettings).length>0||Object.keys(A.envVars).length>0||A.hasHooks}function Hm4(A,q){let K=dV6(A),Y=dV6(q);if(!zv1(Y))return!1;if(!zv1(K))return!0;let z=U6({shellSettings:K.shellSettings,envVars:K.envVars,hooks:K.hooks}),w=U6({shellSettings:Y.shellSettings,envVars:Y.envVars,hooks:Y.hooks});return z!==w}function jm4(A){let q=[];for(let K of Object.keys(A.shellSettings))q.push(K);for(let K of Object.keys(A.envVars))q.push(K);if(A.hasHooks)q.push("hooks");return q}var Yx8=k(()=>{Yv1();a1()});function Jm4(A){let q=Y6(26),{settings:K,onAccept:Y,onReject:z}=A,w=dV6(K),_=jm4(w),$=z3(),O;if(q[0]===Symbol.for("react.memo_cache_sentinel"))O={context:"Confirmation"},q[0]=O;else O=q[0];V8("confirm:no",z,O);let H;if(q[1]!==Y||q[2]!==z)H=function(d){if(d==="exit"){z();return}Y()},q[1]=Y,q[2]=z,q[3]=H;else H=q[3];let j=H,J=Vw,M="warning",D="warning",X="Managed settings require approval",P=m,W="column",Z=1,G=1,f;if(q[4]===Symbol.for("react.memo_cache_sentinel"))f=CW.default.createElement(T,null,"Your organization has configured managed settings that could allow execution of arbitrary code or interception of your prompts and responses."),q[4]=f;else f=q[4];let V=m,N="column",v;if(q[5]===Symbol.for("react.memo_cache_sentinel"))v=CW.default.createElement(T,{dimColor:!0},"Settings requiring approval:"),q[5]=v;else v=q[5];let y=_.map(nyY),R;if(q[6]!==V||q[7]!==v||q[8]!==y)R=CW.default.createElement(V,{flexDirection:N},v,y),q[6]=V,q[7]=v,q[8]=y,q[9]=R;else R=q[9];let h;if(q[10]===Symbol.for("react.memo_cache_sentinel"))h=CW.default.createElement(T,null,"Only accept if you trust your organization's IT administration and expect these settings to be configured."),q[10]=h;else h=q[10];let B;if(q[11]===Symbol.for("react.memo_cache_sentinel"))B=[{label:"Yes, I trust these settings",value:"accept"},{label:"No, exit Claude Code",value:"exit"}],q[11]=B;else B=q[11];let x;if(q[12]!==j)x=CW.default.createElement(E8,{options:B,onChange:(U)=>j(U),onCancel:()=>j("exit")}),q[12]=j,q[13]=x;else x=q[13];let F;if(q[14]!==$.keyName||q[15]!==$.pending)F=CW.default.createElement(T,{dimColor:!0},$.pending?CW.default.createElement(CW.default.Fragment,null,"Press ",$.keyName," again to exit"):CW.default.createElement(CW.default.Fragment,null,"Enter to confirm · Esc to exit")),q[14]=$.keyName,q[15]=$.pending,q[16]=F;else F=q[16];let g;if(q[17]!==P||q[18]!==R||q[19]!==x||q[20]!==F||q[21]!==f)g=CW.default.createElement(P,{flexDirection:W,gap:Z,paddingTop:G},f,R,h,x,F),q[17]=P,q[18]=R,q[19]=x,q[20]=F,q[21]=f,q[22]=g;else g=q[22];let b;if(q[23]!==J||q[24]!==g)b=CW.default.createElement(J,{color:M,titleColor:D,title:X},g),q[23]=J,q[24]=g,q[25]=b;else b=q[25];return b}function nyY(A,q){return CW.default.createElement(m,{key:q,paddingLeft:2},CW.default.createElement(T,null,CW.default.createElement(T,{dimColor:!0},"· "),CW.default.createElement(T,null,A)))}var CW;var Mm4=k(()=>{K1();n6();HY();hG();KO();H7();Yx8();CW=e(W6(),1)});import{openSync as ryY}from"fs";import{ReadStream as oyY}from"tty";function ayY(){if(On!==null)return On;if(process.stdin.isTTY){On=void 0;return}if($1(!1)){On=void 0;return}if(process.argv.includes("mcp")){On=void 0;return}if(process.platform==="win32"){On=void 0;return}try{let A=ryY("/dev/tty","r"),q=new oyY(A);return q.isTTY=!0,On=q,On}catch(A){$6(A),On=void 0;return}}function P86(A=!1){let q=ayY(),K={exitOnCtrlC:A};if(q)K.stdin=q;return K}var On=null;var wv1=k(()=>{Z8();x1()});function tyY(A,q){let K=Y6(9),{addNotification:Y,removeNotification:z}=Vq(),w;if(K[0]!==Y||K[1]!==z||K[2]!==A)w=()=>{if(A.length===0){z("keybinding-config-warning");return}let $=A.filter(ARY).length,O=A.filter(eyY).length,H;if($>0&&O>0)H=`Found ${$} keybinding error${$>1?"s":""} and ${O} warning${O>1?"s":""}`;else if($>0)H=`Found ${$} keybinding error${$>1?"s":""}`;else H=`Found ${O} keybinding warning${O>1?"s":""}`;H=H+" · /doctor for details",Y({key:"keybinding-config-warning",text:H,color:$>0?"error":"warning",priority:$>0?"immediate":"high",timeoutMs:60000})},K[0]=Y,K[1]=z,K[2]=A,K[3]=w;else w=K[3];let _;if(K[4]!==Y||K[5]!==q||K[6]!==z||K[7]!==A)_=[A,q,Y,z],K[4]=Y,K[5]=q,K[6]=z,K[7]=A,K[8]=_;else _=K[8];$D.useEffect(w,_)}function eyY(A){return A.severity==="warning"}function ARY(A){return A.severity==="error"}function OD({children:A}){let[{bindings:q,warnings:K},Y]=$D.useState(()=>{let W=sp6();return L(`[keybindings] KeybindingSetup initialized with ${W.bindings.length} bindings, ${W.warnings.length} warnings`),W}),[z,w]=$D.useState(!1);tyY(K,z);let _=$D.useRef(null),[$,O]=$D.useState(null),H=$D.useRef(null),j=$D.useRef(new Map),J=$D.useRef(new Set),M=$D.useCallback((W)=>{J.current.add(W)},[]),D=$D.useCallback((W)=>{J.current.delete(W)},[]),X=$D.useCallback(()=>{if(H.current)clearTimeout(H.current),H.current=null},[]),P=$D.useCallback((W)=>{if(X(),W!==null)H.current=setTimeout(()=>{L("[keybindings] Chord timeout - cancelling"),_.current=null,O(null)},syY);_.current=W,O(W)},[X]);return $D.useEffect(()=>{Cw4();let W=hw4((Z)=>{w(!0),Y(Z),L(`[keybindings] Reloaded: ${Z.bindings.length} bindings, ${Z.warnings.length} warnings`)});return()=>{W(),X()}},[X]),$D.default.createElement(xj1,{bindings:q,pendingChordRef:_,pendingChord:$,setPendingChord:P,activeContexts:J.current,registerActiveContext:M,unregisterActiveContext:D,handlerRegistryRef:j},$D.default.createElement(qRY,{bindings:q,pendingChordRef:_,setPendingChord:P,activeContexts:J.current,handlerRegistryRef:j}),A)}function qRY(A){let q=Y6(6),{bindings:K,pendingChordRef:Y,setPendingChord:z,activeContexts:w,handlerRegistryRef:_}=A,$;if(q[0]!==w||q[1]!==K||q[2]!==_||q[3]!==Y||q[4]!==z)$=(H,j,J)=>{let M=_.current,D=new Set;if(M)for(let Z of M.values())for(let G of Z)D.add(G.context);let X=[...D,...w,"Global"],P=Y.current!==null,W=bj1(H,j,X,K,Y.current);A:switch(W.type){case"chord_started":{z(W.pending),J.stopImmediatePropagation();break A}case"match":{if(z(null),P){let Z=new Set(X);if(M){let G=M.get(W.action);if(G&&G.size>0){for(let f of G)if(Z.has(f.context)){f.handler(),J.stopImmediatePropagation();break}}}}break A}case"chord_cancelled":{z(null);break A}case"unbound":{z(null);break A}case"none":}},q[0]=w,q[1]=K,q[2]=_,q[3]=Y,q[4]=z,q[5]=$;else $=q[5];return kA($),null}var $D,syY=1000;var Hn=k(()=>{K1();n6();Lg();wi();G1();qw();Bg6();$D=e(W6(),1)});async function Dm4(A,q){if(!q||!zv1(dV6(q)))return"no_check_needed";if(!Hm4(A,q))return"no_check_needed";if(!Ek())return"no_check_needed";return c("tengu_managed_settings_security_dialog_shown",{}),new Promise((K)=>{(async()=>{let{unmount:Y}=await kb(_v1.default.createElement(AJ,null,_v1.default.createElement(OD,null,_v1.default.createElement(Jm4,{settings:q,onAccept:()=>{c("tengu_managed_settings_security_dialog_accepted",{}),Y(),K("approved")},onReject:()=>{c("tengu_managed_settings_security_dialog_rejected",{}),Y(),K("rejected")}}))),P86(!1))})()})}function Xm4(A){if(A==="rejected")return O3(1),!1;return!0}var _v1;var Pm4=k(()=>{n6();Mm4();pA();Q1();B1();B_();Yx8();wv1();Hn();_v1=e(W6(),1)});import{join as KRY}from"path";function zx8(){return cV6}function lV6(A){cV6=A}function Ii6(){return KRY(OA(),YRY)}function VQ(){if(D7()!=="firstParty")return!1;if(!Om())return!1;let A=g7();if(A?.accessToken&&A.scopes?.includes(Bk)&&(A.subscriptionType==="enterprise"||A.subscriptionType==="team"))return!0;try{let{key:q}=f$({skipRetrievingKeyFromApiKeyHelper:!0});if(q)return!0}catch{}return!1}function wx8(){try{let A=Ii6(),q=bj(A),K=q3(q,!1);if(!K||typeof K!=="object"||Array.isArray(K))return null;return K}catch{return null}}function $v1(){if(!VQ())return null;if(cV6)return cV6;let A=wx8();if(A)return cV6=A,A;return null}function Wm4(){cV6=null}var YRY="remote-settings.json",cV6=null;var _x8=k(()=>{Z8();yz();bA();L5();p7();J2()});import{createHash as zRY}from"crypto";import{open as wRY,unlink as Zm4}from"fs/promises";function Gm4(){if(Cw6)return;if(VQ())Cw6=new Promise((A)=>{jn=A,setTimeout(()=>{if(jn)L("Remote settings: Loading promise timed out, resolving anyway"),jn(),jn=null},ORY)})}function HRY(){return`${U7().BASE_API_URL}/api/claude_code/settings`}function Ox8(A){if(Array.isArray(A))return A.map(Ox8);if(A!==null&&typeof A==="object"){let q={};for(let K of Object.keys(A).sort())q[K]=Ox8(A[K]);return q}return A}function jRY(A){let q=Ox8(A),K=U6(q);return`sha256:${zRY("sha256").update(K).digest("hex")}`}function Hx8(){return VQ()}async function Ov1(){if(Cw6)await Cw6}function JRY(){try{let{key:q}=f$({skipRetrievingKeyFromApiKeyHelper:!0});if(q)return{headers:{"x-api-key":q}}}catch{}let A=g7();if(A?.accessToken)return{headers:{Authorization:`Bearer ${A.accessToken}`,"anthropic-beta":G0}};return{headers:{},error:"No authentication available"}}async function MRY(A){let q=null;for(let K=1;K<=$x8+1;K++){if(q=await DRY(A),q.success)return q;if(q.skipRetry)return q;if(K>$x8)return q;let Y=jx(K);L(`Remote settings: Retry ${K}/${$x8} after ${Y}ms`),await oE(Y)}return q}async function DRY(A){try{await L_();let q=JRY();if(q.error)return{success:!1,error:"Authentication required for remote settings",skipRetry:!0};let K=HRY(),Y={...q.headers,"User-Agent":mO()};if(A)Y["If-None-Match"]=`"${A}"`;let z=await I8.get(K,{headers:Y,timeout:_RY,validateStatus:($)=>$===200||$===204||$===304||$===404});if(z.status===304)return L("Remote settings: Using cached settings (304)"),{success:!0,settings:null,checksum:A};if(z.status===204||z.status===404)return L(`Remote settings: No settings found (${z.status})`),{success:!0,settings:{},checksum:void 0};let w=Km4().safeParse(z.data);if(!w.success)return L(`Remote settings: Invalid response format - ${w.error.message}`),{success:!1,error:"Invalid remote settings format"};let _=dX().safeParse(w.data.settings);if(!_.success)return L(`Remote settings: Settings validation failed - ${_.error.message}`),{success:!1,error:"Invalid settings structure"};return L("Remote settings: Fetched successfully"),{success:!0,settings:_.data,checksum:w.data.checksum}}catch(q){if(I8.isAxiosError(q)){let K=q;if(K.response?.status===404)return{success:!0,settings:{},checksum:""};if(K.response?.status===401||K.response?.status===403)return{success:!1,error:"Not authorized for remote settings",skipRetry:!0};if(K.code==="ECONNABORTED")return{success:!1,error:"Remote settings request timeout"};if(K.code==="ECONNREFUSED"||K.code==="ENOTFOUND")return{success:!1,error:"Cannot connect to server"}}return{success:!1,error:q instanceof Error?q.message:"Unknown error"}}}async function XRY(A){try{let q=Ii6(),K=await wRY(q,"w",384);try{await K.writeFile(U6(A,null,2),{encoding:"utf-8"}),await K.datasync()}finally{await K.close()}L(`Remote settings: Saved to ${q}`)}catch(q){L(`Remote settings: Failed to save - ${q instanceof Error?q.message:"unknown error"}`)}}async function jx8(){Tm4(),Wm4(),Cw6=null,jn=null;try{let A=Ii6();await Zm4(A)}catch{}}async function Jx8(){if(!VQ())return null;let A=wx8(),q=A?jRY(A):void 0;try{let K=await MRY(q);if(!K.success){if(A)return L("Remote settings: Using stale cache after fetch failure"),lV6(A),A;return null}if(K.settings===null&&A)return L("Remote settings: Cache still valid (304 Not Modified)"),lV6(A),A;let Y=K.settings||{};if(Object.keys(Y).length>0){let w=await Dm4(A,Y);if(!Xm4(w))return L("Remote settings: User rejected new settings, using cached settings"),A;return lV6(Y),await XRY(Y),L("Remote settings: Applied new settings successfully"),Y}lV6(Y);try{let w=Ii6();await Zm4(w),L("Remote settings: Deleted cached file (404 response)")}catch(w){if(w.code!=="ENOENT")L(`Remote settings: Failed to delete cached file - ${w instanceof Error?w.message:"unknown error"}`)}return Y}catch{if(A)return L("Remote settings: Using stale cache after error"),lV6(A),A;return null}}async function fm4(){if(VQ()&&!Cw6)Cw6=new Promise((A)=>{jn=A});try{let A=await Jx8();if(VQ())WRY();if(A!==null)o$.notifyChange("policySettings")}finally{if(jn)jn(),jn=null}}async function Hv1(){if(await jx8(),!VQ()){o$.notifyChange("policySettings");return}await Jx8(),L("Remote settings: Refreshed after auth change"),o$.notifyChange("policySettings")}async function PRY(){if(!VQ())return;let A=zx8(),q=A?U6(A):null;try{await Jx8();let K=zx8();if((K?U6(K):null)!==q)L("Remote settings: Changed during background poll"),o$.notifyChange("policySettings")}catch{}}function WRY(){if(iV6!==null)return;if(!VQ())return;iV6=setInterval(()=>{PRY()},$RY),iV6.unref(),Kq(async()=>Tm4())}function Tm4(){if(iV6!==null)clearInterval(iV6),iV6=null}var _RY=1e4,$x8=5,$RY=3600000,iV6=null,Cw6=null,jn=null,ORY=30000;var nV6=k(()=>{A3();uD();G1();L5();bA();hI();Ym4();Yi();DF();Vm();sY();Pm4();a1();_x8()});var Mx8;var Vm4=k(()=>{B7();Mx8=i6(()=>I.object({restrictions:I.record(I.string(),I.object({allowed:I.boolean()}))}))});var fx8={};m1(fx8,{waitForPolicyLimitsToLoad:()=>bi6,stopBackgroundPolling:()=>Gx8,startBackgroundPolling:()=>Em4,refreshPolicyLimits:()=>xi6,loadPolicyLimits:()=>Zx8,isPolicyLimitsEligible:()=>ex,isPolicyAllowed:()=>_X,initializePolicyLimitsLoadingPromise:()=>Px8,clearPolicyLimitsCache:()=>Jv1});import{join as ZRY}from"path";import{createHash as GRY}from"crypto";import{readFileSync as fRY}from"fs";import{writeFile as TRY,unlink as vm4}from"fs/promises";function VRY(A){return A instanceof Error}function Px8(){if(hw6)return;if(ex())hw6=new Promise((A)=>{Jn=A,setTimeout(()=>{if(Jn)L("Policy limits: Loading promise timed out, resolving anyway"),Jn(),Jn=null},ERY)})}function jv1(){return ZRY(OA(),NRY)}function LRY(){return`${U7().BASE_API_URL}/api/claude_code/policy_limits`}function Xx8(A){if(Array.isArray(A))return A.map(Xx8);if(A!==null&&typeof A==="object"){let q={};for(let[K,Y]of Object.entries(A).sort(([z],[w])=>z.localeCompare(w)))q[K]=Xx8(Y);return q}return A}function yRY(A){let q=Xx8(A),K=U6(q);return`sha256:${GRY("sha256").update(K).digest("hex")}`}function ex(){if(D7()!=="firstParty")return!1;if(!Om())return!1;try{let{key:q}=f$({skipRetrievingKeyFromApiKeyHelper:!0});if(q)return!0}catch{}let A=g7();if(!A?.accessToken)return!1;if(!A.scopes?.includes(Bk))return!1;if(A.subscriptionType!=="enterprise"&&A.subscriptionType!=="team")return!1;return!0}async function bi6(){if(hw6)await hw6}function RRY(){try{let{key:q}=f$({skipRetrievingKeyFromApiKeyHelper:!0});if(q)return{headers:{"x-api-key":q}}}catch{}let A=g7();if(A?.accessToken)return{headers:{Authorization:`Bearer ${A.accessToken}`,"anthropic-beta":G0}};return{headers:{},error:"No authentication available"}}async function SRY(A){let q=null;for(let K=1;K<=Dx8+1;K++){if(q=await CRY(A),q.success)return q;if(q.skipRetry)return q;if(K>Dx8)return q;let Y=jx(K);L(`Policy limits: Retry ${K}/${Dx8} after ${Y}ms`),await oE(Y)}return q}async function CRY(A){try{await L_();let q=RRY();if(q.error)return{success:!1,error:"Authentication required for policy limits",skipRetry:!0};let K=LRY(),Y={...q.headers,"User-Agent":mO()};if(A)Y["If-None-Match"]=`"${A}"`;let z=await I8.get(K,{headers:Y,timeout:vRY,validateStatus:(_)=>_===200||_===304||_===404});if(z.status===304)return L("Policy limits: Using cached restrictions (304)"),{success:!0,restrictions:null,etag:A};if(z.status===404)return L("Policy limits: No restrictions found (404)"),{success:!0,restrictions:{},etag:void 0};let w=Mx8().safeParse(z.data);if(!w.success)return L(`Policy limits: Invalid response format - ${w.error.message}`),{success:!1,error:"Invalid policy limits format"};return L("Policy limits: Fetched successfully"),{success:!0,restrictions:w.data.restrictions}}catch(q){if(I8.isAxiosError(q)){if(q.response?.status===401||q.response?.status===403)return{success:!1,error:"Not authorized for policy limits",skipRetry:!0};if(q.code==="ECONNABORTED")return{success:!1,error:"Policy limits request timeout"};if(q.code==="ECONNREFUSED"||q.code==="ENOTFOUND")return{success:!1,error:"Cannot connect to server"}}return{success:!1,error:q instanceof Error?q.message:"Unknown error"}}}function km4(){try{let A=fRY(jv1(),"utf-8"),q=q3(A,!1),K=Mx8().safeParse(q);if(!K.success)return null;return K.data.restrictions}catch{return null}}async function hRY(A){try{let q=jv1();await TRY(q,U6({restrictions:A},null,2),{encoding:"utf-8",mode:384}),L(`Policy limits: Saved to ${q}`)}catch(q){L(`Policy limits: Failed to save - ${q instanceof Error?q.message:"unknown error"}`)}}async function Wx8(){if(!ex())return null;let A=km4(),q=A?yRY(A):void 0;try{let K=await SRY(q);if(!K.success){if(A)return L("Policy limits: Using stale cache after fetch failure"),WL=A,A;return null}if(K.restrictions===null&&A)return L("Policy limits: Cache still valid (304 Not Modified)"),WL=A,A;let Y=K.restrictions||{};if(Object.keys(Y).length>0)return WL=Y,await hRY(Y),L("Policy limits: Applied new restrictions successfully"),Y;WL=Y;try{await vm4(jv1()),L("Policy limits: Deleted cached file (404 response)")}catch(w){if(VRY(w)&&w.code!=="ENOENT")L(`Policy limits: Failed to delete cached file - ${w.message}`)}return Y}catch{if(A)return L("Policy limits: Using stale cache after error"),WL=A,A;return null}}function _X(A){let q=IRY();if(!q)return!0;let K=q[A];if(!K)return!0;return K.allowed}function IRY(){if(!ex())return null;if(WL)return WL;let A=km4();if(A)return WL=A,A;return null}async function Zx8(){if(ex()&&!hw6)hw6=new Promise((A)=>{Jn=A});try{if(await Wx8(),ex())Em4()}finally{if(Jn)Jn(),Jn=null}}async function xi6(){if(await Jv1(),!ex())return;await Wx8(),L("Policy limits: Refreshed after auth change")}async function Jv1(){Gx8(),WL=null,hw6=null,Jn=null;try{await vm4(jv1())}catch{}}async function bRY(){if(!ex())return;let A=WL?U6(WL):null;try{if(await Wx8(),(WL?U6(WL):null)!==A)L("Policy limits: Changed during background poll")}catch{}}function Em4(){if(rV6!==null)return;if(!ex())return;if(rV6=setInterval(()=>{bRY()},kRY),rV6.unref(),!Nm4)Nm4=!0,Kq(async()=>Gx8())}function Gx8(){if(rV6!==null)clearInterval(rV6),rV6=null}var NRY="policy-limits.json",vRY=1e4,Dx8=5,kRY=3600000,rV6=null,Nm4=!1,hw6=null,Jn=null,ERY=30000,WL=null;var Xv=k(()=>{A3();uD();G1();L5();bA();Vm4();Z8();yz();J2();Yi();DF();sY();a1()});var Mv1=C((Lm4)=>{Object.defineProperty(Lm4,"__esModule",{value:!0});Lm4.AggregationTemporality=void 0;var xRY;(function(A){A[A.DELTA=0]="DELTA",A[A.CUMULATIVE=1]="CUMULATIVE"})(xRY=Lm4.AggregationTemporality||(Lm4.AggregationTemporality={}))});var W86=C((Rm4)=>{Object.defineProperty(Rm4,"__esModule",{value:!0});Rm4.DataPointType=Rm4.InstrumentType=void 0;var uRY;(function(A){A.COUNTER="COUNTER",A.GAUGE="GAUGE",A.HISTOGRAM="HISTOGRAM",A.UP_DOWN_COUNTER="UP_DOWN_COUNTER",A.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",A.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",A.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(uRY=Rm4.InstrumentType||(Rm4.InstrumentType={}));var BRY;(function(A){A[A.HISTOGRAM=0]="HISTOGRAM",A[A.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",A[A.GAUGE=2]="GAUGE",A[A.SUM=3]="SUM"})(BRY=Rm4.DataPointType||(Rm4.DataPointType={}))});var Au=C((Sm4)=>{Object.defineProperty(Sm4,"__esModule",{value:!0});Sm4.equalsCaseInsensitive=Sm4.binarySearchUB=Sm4.setEquals=Sm4.FlatMap=Sm4.isPromiseAllSettledRejectionResult=Sm4.PromiseAllSettled=Sm4.callWithTimeout=Sm4.TimeoutError=Sm4.instrumentationScopeId=Sm4.hashAttributes=Sm4.isNotNullish=void 0;function mRY(A){return A!==void 0&&A!==null}Sm4.isNotNullish=mRY;function gRY(A){let q=Object.keys(A);if(q.length===0)return"";return q=q.sort(),JSON.stringify(q.map((K)=>[K,A[K]]))}Sm4.hashAttributes=gRY;function FRY(A){return`${A.name}:${A.version??""}:${A.schemaUrl??""}`}Sm4.instrumentationScopeId=FRY;class Dv1 extends Error{constructor(A){super(A);Object.setPrototypeOf(this,Dv1.prototype)}}Sm4.TimeoutError=Dv1;function QRY(A,q){let K,Y=new Promise(function(w,_){K=setTimeout(function(){_(new Dv1("Operation timed out."))},q)});return Promise.race([A,Y]).then((z)=>{return clearTimeout(K),z},(z)=>{throw clearTimeout(K),z})}Sm4.callWithTimeout=QRY;async function URY(A){return Promise.all(A.map(async(q)=>{try{return{status:"fulfilled",value:await q}}catch(K){return{status:"rejected",reason:K}}}))}Sm4.PromiseAllSettled=URY;function pRY(A){return A.status==="rejected"}Sm4.isPromiseAllSettledRejectionResult=pRY;function dRY(A,q){let K=[];return A.forEach((Y)=>{K.push(...q(Y))}),K}Sm4.FlatMap=dRY;function cRY(A,q){if(A.size!==q.size)return!1;for(let K of A)if(!q.has(K))return!1;return!0}Sm4.setEquals=cRY;function lRY(A,q){let K=0,Y=A.length-1,z=A.length;while(Y>=K){let w=K+Math.trunc((Y-K)/2);if(A[w]{Object.defineProperty(hm4,"__esModule",{value:!0});hm4.AggregatorKind=void 0;var YSY;(function(A){A[A.DROP=0]="DROP",A[A.SUM=1]="SUM",A[A.LAST_VALUE=2]="LAST_VALUE",A[A.HISTOGRAM=3]="HISTOGRAM",A[A.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(YSY=hm4.AggregatorKind||(hm4.AggregatorKind={}))});var um4=C((bm4)=>{Object.defineProperty(bm4,"__esModule",{value:!0});bm4.DropAggregator=void 0;var zSY=oV6();class Im4{kind=zSY.AggregatorKind.DROP;createAccumulation(){return}merge(A,q){return}diff(A,q){return}toMetricData(A,q,K,Y){return}}bm4.DropAggregator=Im4});var Fm4=C((mm4)=>{Object.defineProperty(mm4,"__esModule",{value:!0});mm4.HistogramAggregator=mm4.HistogramAccumulation=void 0;var wSY=oV6(),ui6=W86(),_SY=Au();function $SY(A){let q=A.map(()=>0);return q.push(0),{buckets:{boundaries:A,counts:q},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}class Bi6{startTime;_boundaries;_recordMinMax;_current;constructor(A,q,K=!0,Y=$SY(q)){this.startTime=A,this._boundaries=q,this._recordMinMax=K,this._current=Y}record(A){if(Number.isNaN(A))return;if(this._current.count+=1,this._current.sum+=A,this._recordMinMax)this._current.min=Math.min(A,this._current.min),this._current.max=Math.max(A,this._current.max),this._current.hasMinMax=!0;let q=(0,_SY.binarySearchUB)(this._boundaries,A);this._current.buckets.counts[q]+=1}setStartTime(A){this.startTime=A}toPointValue(){return this._current}}mm4.HistogramAccumulation=Bi6;class Bm4{_boundaries;_recordMinMax;kind=wSY.AggregatorKind.HISTOGRAM;constructor(A,q){this._boundaries=A,this._recordMinMax=q}createAccumulation(A){return new Bi6(A,this._boundaries,this._recordMinMax)}merge(A,q){let K=A.toPointValue(),Y=q.toPointValue(),z=K.buckets.counts,w=Y.buckets.counts,_=Array(z.length);for(let H=0;H{let _=w.toPointValue(),$=A.type===ui6.InstrumentType.GAUGE||A.type===ui6.InstrumentType.UP_DOWN_COUNTER||A.type===ui6.InstrumentType.OBSERVABLE_GAUGE||A.type===ui6.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:z,startTime:w.startTime,endTime:Y,value:{min:_.hasMinMax?_.min:void 0,max:_.hasMinMax?_.max:void 0,sum:!$?_.sum:void 0,buckets:_.buckets,count:_.count}}})}}}mm4.HistogramAggregator=Bm4});var pm4=C((Qm4)=>{Object.defineProperty(Qm4,"__esModule",{value:!0});Qm4.Buckets=void 0;class vx8{backing;indexBase;indexStart;indexEnd;constructor(A=new kx8,q=0,K=0,Y=0){this.backing=A,this.indexBase=q,this.indexStart=K,this.indexEnd=Y}get offset(){return this.indexStart}get length(){if(this.backing.length===0)return 0;if(this.indexEnd===this.indexStart&&this.at(0)===0)return 0;return this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(A,q)=>this.at(q))}at(A){let q=this.indexBase-this.indexStart;if(A=0;A--)if(this.at(A)!==0){this.indexEnd-=this.length-A-1;break}this._rotate()}downscale(A){this._rotate();let q=1+this.indexEnd-this.indexStart,K=1<>=A,this.indexEnd>>=A,this.indexBase=this.indexStart}clone(){return new vx8(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let A=this.indexBase-this.indexStart;if(A===0)return;else if(A>0)this.backing.reverse(0,this.backing.length),this.backing.reverse(0,A),this.backing.reverse(A,this.backing.length);else this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+A);this.indexBase=this.indexStart}_relocateBucket(A,q){if(A===q)return;this.incrementBucket(A,this.backing.emptyBucket(q))}}Qm4.Buckets=vx8;class kx8{_counts;constructor(A=[0]){this._counts=A}get length(){return this._counts.length}countAt(A){return this._counts[A]}growTo(A,q,K){let Y=Array(A).fill(0);Y.splice(K,this._counts.length-q,...this._counts.slice(q)),Y.splice(0,q,...this._counts.slice(0,q)),this._counts=Y}reverse(A,q){let K=Math.floor((A+q)/2)-A;for(let Y=0;Y=q)this._counts[A]-=q;else this._counts[A]=0}clone(){return new kx8([...this._counts])}}});var Lx8=C((dm4)=>{Object.defineProperty(dm4,"__esModule",{value:!0});dm4.getSignificand=dm4.getNormalBase2=dm4.MIN_VALUE=dm4.MAX_NORMAL_EXPONENT=dm4.MIN_NORMAL_EXPONENT=dm4.SIGNIFICAND_WIDTH=void 0;dm4.SIGNIFICAND_WIDTH=52;var HSY=2146435072,jSY=1048575,Ex8=1023;dm4.MIN_NORMAL_EXPONENT=-Ex8+1;dm4.MAX_NORMAL_EXPONENT=Ex8;dm4.MIN_VALUE=Math.pow(2,-1022);function JSY(A){let q=new DataView(new ArrayBuffer(8));return q.setFloat64(0,A),((q.getUint32(0)&HSY)>>20)-Ex8}dm4.getNormalBase2=JSY;function MSY(A){let q=new DataView(new ArrayBuffer(8));q.setFloat64(0,A);let K=q.getUint32(0),Y=q.getUint32(4);return(K&jSY)*Math.pow(2,32)+Y}dm4.getSignificand=MSY});var Xv1=C((lm4)=>{Object.defineProperty(lm4,"__esModule",{value:!0});lm4.nextGreaterSquare=lm4.ldexp=void 0;function GSY(A,q){if(A===0||A===Number.POSITIVE_INFINITY||A===Number.NEGATIVE_INFINITY||Number.isNaN(A))return A;return A*Math.pow(2,q)}lm4.ldexp=GSY;function fSY(A){return A--,A|=A>>1,A|=A>>2,A|=A>>4,A|=A>>8,A|=A>>16,A++,A}lm4.nextGreaterSquare=fSY});var Pv1=C((rm4)=>{Object.defineProperty(rm4,"__esModule",{value:!0});rm4.MappingError=void 0;class nm4 extends Error{}rm4.MappingError=nm4});var Ag4=C((tm4)=>{Object.defineProperty(tm4,"__esModule",{value:!0});tm4.ExponentMapping=void 0;var aV6=Lx8(),VSY=Xv1(),am4=Pv1();class sm4{_shift;constructor(A){this._shift=-A}mapToIndex(A){if(A>this._shift}lowerBoundary(A){let q=this._minNormalLowerBoundaryIndex();if(AK)throw new am4.MappingError(`overflow: ${A} is > maximum lower boundary: ${K}`);return VSY.ldexp(1,A<>this._shift;if(this._shift<2)A--;return A}_maxNormalLowerBoundaryIndex(){return aV6.MAX_NORMAL_EXPONENT>>this._shift}_rightShift(A,q){return Math.floor(A*Math.pow(2,-q))}}tm4.ExponentMapping=sm4});var _g4=C((zg4)=>{Object.defineProperty(zg4,"__esModule",{value:!0});zg4.LogarithmMapping=void 0;var sV6=Lx8(),qg4=Xv1(),Kg4=Pv1();class Yg4{_scale;_scaleFactor;_inverseFactor;constructor(A){this._scale=A,this._scaleFactor=qg4.ldexp(Math.LOG2E,A),this._inverseFactor=qg4.ldexp(Math.LN2,-A)}mapToIndex(A){if(A<=sV6.MIN_VALUE)return this._minNormalLowerBoundaryIndex()-1;if(sV6.getSignificand(A)===0)return(sV6.getNormalBase2(A)<=K)return K;return q}lowerBoundary(A){let q=this._maxNormalLowerBoundaryIndex();if(A>=q){if(A===q)return 2*Math.exp((A-(1< maximum lower boundary: ${q}`)}let K=this._minNormalLowerBoundaryIndex();if(A<=K){if(A===K)return sV6.MIN_VALUE;else if(A===K-1)return Math.exp((A+(1<{Object.defineProperty(Hg4,"__esModule",{value:!0});Hg4.getMapping=void 0;var NSY=Ag4(),vSY=_g4(),kSY=Pv1(),$g4=-10,Og4=20,ESY=Array.from({length:31},(A,q)=>{if(q>10)return new vSY.LogarithmMapping(q-10);return new NSY.ExponentMapping(q-10)});function LSY(A){if(A>Og4||A<$g4)throw new kSY.MappingError(`expected scale >= ${$g4} && <= ${Og4}, got: ${A}`);return ESY[A+10]}Hg4.getMapping=LSY});var Zg4=C((Pg4)=>{Object.defineProperty(Pg4,"__esModule",{value:!0});Pg4.ExponentialHistogramAggregator=Pg4.ExponentialHistogramAccumulation=void 0;var ySY=oV6(),mi6=W86(),RSY=nq(),Mg4=pm4(),Dg4=Jg4(),SSY=Xv1();class tV6{low;high;static combine(A,q){return new tV6(Math.min(A.low,q.low),Math.max(A.high,q.high))}constructor(A,q){this.low=A,this.high=q}}var CSY=20,hSY=160,yx8=2;class Wv1{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(A,q=hSY,K=!0,Y=0,z=0,w=0,_=Number.POSITIVE_INFINITY,$=Number.NEGATIVE_INFINITY,O=new Mg4.Buckets,H=new Mg4.Buckets,j=(0,Dg4.getMapping)(CSY)){if(this.startTime=A,this._maxSize=q,this._recordMinMax=K,this._sum=Y,this._count=z,this._zeroCount=w,this._min=_,this._max=$,this._positive=O,this._negative=H,this._mapping=j,this._maxSizethis._max)this._max=A;if(A0)this._updateBuckets(this._positive,A,q);else this._updateBuckets(this._negative,-A,q)}merge(A){if(this._count===0)this._min=A.min,this._max=A.max;else if(A.count!==0){if(A.minthis.max)this._max=A.max}this.startTime=A.startTime,this._sum+=A.sum,this._count+=A.count,this._zeroCount+=A.zeroCount;let q=this._minScale(A);this._downscale(this.scale-q),this._mergeBuckets(this.positive,A,A.positive,q),this._mergeBuckets(this.negative,A,A.negative,q)}diff(A){this._min=1/0,this._max=-1/0,this._sum-=A.sum,this._count-=A.count,this._zeroCount-=A.zeroCount;let q=this._minScale(A);this._downscale(this.scale-q),this._diffBuckets(this.positive,A,A.positive,q),this._diffBuckets(this.negative,A,A.negative,q)}clone(){return new Wv1(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(A,q,K){let Y=this._mapping.mapToIndex(q),z=!1,w=0,_=0;if(A.length===0)A.indexStart=Y,A.indexEnd=A.indexStart,A.indexBase=A.indexStart;else if(Y=this._maxSize)z=!0,_=Y,w=A.indexEnd;else if(Y>A.indexEnd&&Y-A.indexStart>=this._maxSize)z=!0,_=A.indexStart,w=Y;if(z){let $=this._changeScale(w,_);this._downscale($),Y=this._mapping.mapToIndex(q)}this._incrementIndexBy(A,Y,K)}_incrementIndexBy(A,q,K){if(K===0)return;if(A.length===0)A.indexStart=A.indexEnd=A.indexBase=q;if(q=A.backing.length)this._grow(A,z+1);A.indexStart=q}else if(q>A.indexEnd){let z=q-A.indexStart;if(z>=A.backing.length)this._grow(A,z+1);A.indexEnd=q}let Y=q-A.indexBase;if(Y<0)Y+=A.backing.length;A.incrementBucket(Y,K)}_grow(A,q){let K=A.backing.length,Y=A.indexBase-A.indexStart,z=K-Y,w=(0,SSY.nextGreaterSquare)(q);if(w>this._maxSize)w=this._maxSize;let _=w-Y;A.backing.growTo(w,z,_)}_changeScale(A,q){let K=0;while(A-q>=this._maxSize)A>>=1,q>>=1,K++;return K}_downscale(A){if(A===0)return;if(A<0)throw Error(`impossible change of scale: ${this.scale}`);let q=this._mapping.scale-A;this._positive.downscale(A),this._negative.downscale(A),this._mapping=(0,Dg4.getMapping)(q)}_minScale(A){let q=Math.min(this.scale,A.scale),K=tV6.combine(this._highLowAtScale(this.positive,this.scale,q),this._highLowAtScale(A.positive,A.scale,q)),Y=tV6.combine(this._highLowAtScale(this.negative,this.scale,q),this._highLowAtScale(A.negative,A.scale,q));return Math.min(q-this._changeScale(K.high,K.low),q-this._changeScale(Y.high,Y.low))}_highLowAtScale(A,q,K){if(A.length===0)return new tV6(0,-1);let Y=q-K;return new tV6(A.indexStart>>Y,A.indexEnd>>Y)}_mergeBuckets(A,q,K,Y){let z=K.offset,w=q.scale-Y;for(let _=0;_>w,K.at(_))}_diffBuckets(A,q,K,Y){let z=K.offset,w=q.scale-Y;for(let _=0;_>w)-A.indexBase;if(O<0)O+=A.backing.length;A.decrementBucket(O,K.at(_))}A.trim()}}Pg4.ExponentialHistogramAccumulation=Wv1;class Xg4{_maxSize;_recordMinMax;kind=ySY.AggregatorKind.EXPONENTIAL_HISTOGRAM;constructor(A,q){this._maxSize=A,this._recordMinMax=q}createAccumulation(A){return new Wv1(A,this._maxSize,this._recordMinMax)}merge(A,q){let K=q.clone();return K.merge(A),K}diff(A,q){let K=q.clone();return K.diff(A),K}toMetricData(A,q,K,Y){return{descriptor:A,aggregationTemporality:q,dataPointType:mi6.DataPointType.EXPONENTIAL_HISTOGRAM,dataPoints:K.map(([z,w])=>{let _=w.toPointValue(),$=A.type===mi6.InstrumentType.GAUGE||A.type===mi6.InstrumentType.UP_DOWN_COUNTER||A.type===mi6.InstrumentType.OBSERVABLE_GAUGE||A.type===mi6.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:z,startTime:w.startTime,endTime:Y,value:{min:_.hasMinMax?_.min:void 0,max:_.hasMinMax?_.max:void 0,sum:!$?_.sum:void 0,positive:{offset:_.positive.offset,bucketCounts:_.positive.bucketCounts},negative:{offset:_.negative.offset,bucketCounts:_.negative.bucketCounts},count:_.count,scale:_.scale,zeroCount:_.zeroCount}}})}}}Pg4.ExponentialHistogramAggregator=Xg4});var Vg4=C((fg4)=>{Object.defineProperty(fg4,"__esModule",{value:!0});fg4.LastValueAggregator=fg4.LastValueAccumulation=void 0;var bSY=oV6(),gi6=b9(),xSY=W86();class Fi6{startTime;_current;sampleTime;constructor(A,q=0,K=[0,0]){this.startTime=A,this._current=q,this.sampleTime=K}record(A){this._current=A,this.sampleTime=(0,gi6.millisToHrTime)(Date.now())}setStartTime(A){this.startTime=A}toPointValue(){return this._current}}fg4.LastValueAccumulation=Fi6;class Gg4{kind=bSY.AggregatorKind.LAST_VALUE;createAccumulation(A){return new Fi6(A)}merge(A,q){let K=(0,gi6.hrTimeToMicroseconds)(q.sampleTime)>=(0,gi6.hrTimeToMicroseconds)(A.sampleTime)?q:A;return new Fi6(A.startTime,K.toPointValue(),K.sampleTime)}diff(A,q){let K=(0,gi6.hrTimeToMicroseconds)(q.sampleTime)>=(0,gi6.hrTimeToMicroseconds)(A.sampleTime)?q:A;return new Fi6(q.startTime,K.toPointValue(),K.sampleTime)}toMetricData(A,q,K,Y){return{descriptor:A,aggregationTemporality:q,dataPointType:xSY.DataPointType.GAUGE,dataPoints:K.map(([z,w])=>{return{attributes:z,startTime:w.startTime,endTime:Y,value:w.toPointValue()}})}}}fg4.LastValueAggregator=Gg4});var Eg4=C((vg4)=>{Object.defineProperty(vg4,"__esModule",{value:!0});vg4.SumAggregator=vg4.SumAccumulation=void 0;var BSY=oV6(),mSY=W86();class Iw6{startTime;monotonic;_current;reset;constructor(A,q,K=0,Y=!1){this.startTime=A,this.monotonic=q,this._current=K,this.reset=Y}record(A){if(this.monotonic&&A<0)return;this._current+=A}setStartTime(A){this.startTime=A}toPointValue(){return this._current}}vg4.SumAccumulation=Iw6;class Ng4{monotonic;kind=BSY.AggregatorKind.SUM;constructor(A){this.monotonic=A}createAccumulation(A){return new Iw6(A,this.monotonic)}merge(A,q){let K=A.toPointValue(),Y=q.toPointValue();if(q.reset)return new Iw6(q.startTime,this.monotonic,Y,q.reset);return new Iw6(A.startTime,this.monotonic,K+Y)}diff(A,q){let K=A.toPointValue(),Y=q.toPointValue();if(this.monotonic&&K>Y)return new Iw6(q.startTime,this.monotonic,Y,!0);return new Iw6(q.startTime,this.monotonic,Y-K)}toMetricData(A,q,K,Y){return{descriptor:A,aggregationTemporality:q,dataPointType:mSY.DataPointType.SUM,dataPoints:K.map(([z,w])=>{return{attributes:z,startTime:w.startTime,endTime:Y,value:w.toPointValue()}}),isMonotonic:this.monotonic}}}vg4.SumAggregator=Ng4});var Cg4=C((qu)=>{Object.defineProperty(qu,"__esModule",{value:!0});qu.SumAggregator=qu.SumAccumulation=qu.LastValueAggregator=qu.LastValueAccumulation=qu.ExponentialHistogramAggregator=qu.ExponentialHistogramAccumulation=qu.HistogramAggregator=qu.HistogramAccumulation=qu.DropAggregator=void 0;var FSY=um4();Object.defineProperty(qu,"DropAggregator",{enumerable:!0,get:function(){return FSY.DropAggregator}});var Lg4=Fm4();Object.defineProperty(qu,"HistogramAccumulation",{enumerable:!0,get:function(){return Lg4.HistogramAccumulation}});Object.defineProperty(qu,"HistogramAggregator",{enumerable:!0,get:function(){return Lg4.HistogramAggregator}});var yg4=Zg4();Object.defineProperty(qu,"ExponentialHistogramAccumulation",{enumerable:!0,get:function(){return yg4.ExponentialHistogramAccumulation}});Object.defineProperty(qu,"ExponentialHistogramAggregator",{enumerable:!0,get:function(){return yg4.ExponentialHistogramAggregator}});var Rg4=Vg4();Object.defineProperty(qu,"LastValueAccumulation",{enumerable:!0,get:function(){return Rg4.LastValueAccumulation}});Object.defineProperty(qu,"LastValueAggregator",{enumerable:!0,get:function(){return Rg4.LastValueAggregator}});var Sg4=Eg4();Object.defineProperty(qu,"SumAccumulation",{enumerable:!0,get:function(){return Sg4.SumAccumulation}});Object.defineProperty(qu,"SumAggregator",{enumerable:!0,get:function(){return Sg4.SumAggregator}})});var mg4=C((hg4)=>{Object.defineProperty(hg4,"__esModule",{value:!0});hg4.DEFAULT_AGGREGATION=hg4.EXPONENTIAL_HISTOGRAM_AGGREGATION=hg4.HISTOGRAM_AGGREGATION=hg4.LAST_VALUE_AGGREGATION=hg4.SUM_AGGREGATION=hg4.DROP_AGGREGATION=hg4.DefaultAggregation=hg4.ExponentialHistogramAggregation=hg4.ExplicitBucketHistogramAggregation=hg4.HistogramAggregation=hg4.LastValueAggregation=hg4.SumAggregation=hg4.DropAggregation=void 0;var USY=nq(),bw6=Cg4(),NQ=W86();class Zv1{static DEFAULT_INSTANCE=new bw6.DropAggregator;createAggregator(A){return Zv1.DEFAULT_INSTANCE}}hg4.DropAggregation=Zv1;class Qi6{static MONOTONIC_INSTANCE=new bw6.SumAggregator(!0);static NON_MONOTONIC_INSTANCE=new bw6.SumAggregator(!1);createAggregator(A){switch(A.type){case NQ.InstrumentType.COUNTER:case NQ.InstrumentType.OBSERVABLE_COUNTER:case NQ.InstrumentType.HISTOGRAM:return Qi6.MONOTONIC_INSTANCE;default:return Qi6.NON_MONOTONIC_INSTANCE}}}hg4.SumAggregation=Qi6;class Gv1{static DEFAULT_INSTANCE=new bw6.LastValueAggregator;createAggregator(A){return Gv1.DEFAULT_INSTANCE}}hg4.LastValueAggregation=Gv1;class fv1{static DEFAULT_INSTANCE=new bw6.HistogramAggregator([0,5,10,25,50,75,100,250,500,750,1000,2500,5000,7500,1e4],!0);createAggregator(A){return fv1.DEFAULT_INSTANCE}}hg4.HistogramAggregation=fv1;class Rx8{_recordMinMax;_boundaries;constructor(A,q=!0){if(this._recordMinMax=q,A==null)throw Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");A=A.concat(),A=A.sort((z,w)=>z-w);let K=A.lastIndexOf(-1/0),Y=A.indexOf(1/0);if(Y===-1)Y=void 0;this._boundaries=A.slice(K+1,Y)}createAggregator(A){return new bw6.HistogramAggregator(this._boundaries,this._recordMinMax)}}hg4.ExplicitBucketHistogramAggregation=Rx8;class Sx8{_maxSize;_recordMinMax;constructor(A=160,q=!0){this._maxSize=A,this._recordMinMax=q}createAggregator(A){return new bw6.ExponentialHistogramAggregator(this._maxSize,this._recordMinMax)}}hg4.ExponentialHistogramAggregation=Sx8;class Cx8{_resolve(A){switch(A.type){case NQ.InstrumentType.COUNTER:case NQ.InstrumentType.UP_DOWN_COUNTER:case NQ.InstrumentType.OBSERVABLE_COUNTER:case NQ.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:return hg4.SUM_AGGREGATION;case NQ.InstrumentType.GAUGE:case NQ.InstrumentType.OBSERVABLE_GAUGE:return hg4.LAST_VALUE_AGGREGATION;case NQ.InstrumentType.HISTOGRAM:{if(A.advice.explicitBucketBoundaries)return new Rx8(A.advice.explicitBucketBoundaries);return hg4.HISTOGRAM_AGGREGATION}}return USY.diag.warn(`Unable to recognize instrument type: ${A.type}`),hg4.DROP_AGGREGATION}createAggregator(A){return this._resolve(A).createAggregator(A)}}hg4.DefaultAggregation=Cx8;hg4.DROP_AGGREGATION=new Zv1;hg4.SUM_AGGREGATION=new Qi6;hg4.LAST_VALUE_AGGREGATION=new Gv1;hg4.HISTOGRAM_AGGREGATION=new fv1;hg4.EXPONENTIAL_HISTOGRAM_AGGREGATION=new Sx8;hg4.DEFAULT_AGGREGATION=new Cx8});var Ui6=C((Fg4)=>{Object.defineProperty(Fg4,"__esModule",{value:!0});Fg4.toAggregation=Fg4.AggregationType=void 0;var xw6=mg4(),uw6;(function(A){A[A.DEFAULT=0]="DEFAULT",A[A.DROP=1]="DROP",A[A.SUM=2]="SUM",A[A.LAST_VALUE=3]="LAST_VALUE",A[A.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",A[A.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(uw6=Fg4.AggregationType||(Fg4.AggregationType={}));function aSY(A){switch(A.type){case uw6.DEFAULT:return xw6.DEFAULT_AGGREGATION;case uw6.DROP:return xw6.DROP_AGGREGATION;case uw6.SUM:return xw6.SUM_AGGREGATION;case uw6.LAST_VALUE:return xw6.LAST_VALUE_AGGREGATION;case uw6.EXPONENTIAL_HISTOGRAM:{let q=A;return new xw6.ExponentialHistogramAggregation(q.options?.maxSize,q.options?.recordMinMax)}case uw6.EXPLICIT_BUCKET_HISTOGRAM:{let q=A;if(q.options==null)return xw6.HISTOGRAM_AGGREGATION;else return new xw6.ExplicitBucketHistogramAggregation(q.options?.boundaries,q.options?.recordMinMax)}default:throw Error("Unsupported Aggregation")}}Fg4.toAggregation=aSY});var hx8=C((Ug4)=>{Object.defineProperty(Ug4,"__esModule",{value:!0});Ug4.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR=Ug4.DEFAULT_AGGREGATION_SELECTOR=void 0;var sSY=Mv1(),tSY=Ui6(),eSY=(A)=>{return{type:tSY.AggregationType.DEFAULT}};Ug4.DEFAULT_AGGREGATION_SELECTOR=eSY;var ACY=(A)=>sSY.AggregationTemporality.CUMULATIVE;Ug4.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR=ACY});var Ix8=C((ig4)=>{Object.defineProperty(ig4,"__esModule",{value:!0});ig4.MetricReader=void 0;var dg4=nq(),Tv1=Au(),cg4=hx8();class lg4{_shutdown=!1;_metricProducers;_sdkMetricProducer;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;constructor(A){this._aggregationSelector=A?.aggregationSelector??cg4.DEFAULT_AGGREGATION_SELECTOR,this._aggregationTemporalitySelector=A?.aggregationTemporalitySelector??cg4.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR,this._metricProducers=A?.metricProducers??[],this._cardinalitySelector=A?.cardinalitySelector}setMetricProducer(A){if(this._sdkMetricProducer)throw Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=A,this.onInitialized()}selectAggregation(A){return this._aggregationSelector(A)}selectAggregationTemporality(A){return this._aggregationTemporalitySelector(A)}selectCardinalityLimit(A){return this._cardinalitySelector?this._cardinalitySelector(A):2000}onInitialized(){}async collect(A){if(this._sdkMetricProducer===void 0)throw Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw Error("MetricReader is shutdown");let[q,...K]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:A?.timeoutMillis}),...this._metricProducers.map((_)=>_.collect({timeoutMillis:A?.timeoutMillis}))]),Y=q.errors.concat((0,Tv1.FlatMap)(K,(_)=>_.errors)),z=q.resourceMetrics.resource,w=q.resourceMetrics.scopeMetrics.concat((0,Tv1.FlatMap)(K,(_)=>_.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:z,scopeMetrics:w},errors:Y}}async shutdown(A){if(this._shutdown){dg4.diag.error("Cannot call shutdown twice.");return}if(A?.timeoutMillis==null)await this.onShutdown();else await(0,Tv1.callWithTimeout)(this.onShutdown(),A.timeoutMillis);this._shutdown=!0}async forceFlush(A){if(this._shutdown){dg4.diag.warn("Cannot forceFlush on already shutdown MetricReader.");return}if(A?.timeoutMillis==null){await this.onForceFlush();return}await(0,Tv1.callWithTimeout)(this.onForceFlush(),A.timeoutMillis)}}ig4.MetricReader=lg4});var tg4=C((ag4)=>{Object.defineProperty(ag4,"__esModule",{value:!0});ag4.PeriodicExportingMetricReader=void 0;var bx8=nq(),Vv1=b9(),KCY=Ix8(),rg4=Au();class og4 extends KCY.MetricReader{_interval;_exporter;_exportInterval;_exportTimeout;constructor(A){super({aggregationSelector:A.exporter.selectAggregation?.bind(A.exporter),aggregationTemporalitySelector:A.exporter.selectAggregationTemporality?.bind(A.exporter),metricProducers:A.metricProducers});if(A.exportIntervalMillis!==void 0&&A.exportIntervalMillis<=0)throw Error("exportIntervalMillis must be greater than 0");if(A.exportTimeoutMillis!==void 0&&A.exportTimeoutMillis<=0)throw Error("exportTimeoutMillis must be greater than 0");if(A.exportTimeoutMillis!==void 0&&A.exportIntervalMillis!==void 0&&A.exportIntervalMillis0)bx8.diag.error("PeriodicExportingMetricReader: metrics collection errors",...q);if(A.resource.asyncAttributesPending)try{await A.resource.waitForAsyncAttributes?.()}catch(Y){bx8.diag.debug("Error while resolving async portion of resource: ",Y),(0,Vv1.globalErrorHandler)(Y)}if(A.scopeMetrics.length===0)return;let K=await Vv1.internal._export(this._exporter,A);if(K.code!==Vv1.ExportResultCode.SUCCESS)throw Error(`PeriodicExportingMetricReader: metrics export failed (error ${K.error})`)}onInitialized(){if(this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=="number")this._interval.unref()}async onForceFlush(){await this._runOnce(),await this._exporter.forceFlush()}async onShutdown(){if(this._interval)clearInterval(this._interval);await this.onForceFlush(),await this._exporter.shutdown()}}ag4.PeriodicExportingMetricReader=og4});var YF4=C((qF4)=>{Object.defineProperty(qF4,"__esModule",{value:!0});qF4.InMemoryMetricExporter=void 0;var eg4=b9();class AF4{_shutdown=!1;_aggregationTemporality;_metrics=[];constructor(A){this._aggregationTemporality=A}export(A,q){if(this._shutdown){setTimeout(()=>q({code:eg4.ExportResultCode.FAILED}),0);return}this._metrics.push(A),setTimeout(()=>q({code:eg4.ExportResultCode.SUCCESS}),0)}getMetrics(){return this._metrics}forceFlush(){return Promise.resolve()}reset(){this._metrics=[]}selectAggregationTemporality(A){return this._aggregationTemporality}shutdown(){return this._shutdown=!0,Promise.resolve()}}qF4.InMemoryMetricExporter=AF4});var $F4=C((wF4)=>{Object.defineProperty(wF4,"__esModule",{value:!0});wF4.ConsoleMetricExporter=void 0;var zF4=b9(),YCY=hx8();class xx8{_shutdown=!1;_temporalitySelector;constructor(A){this._temporalitySelector=A?.temporalitySelector??YCY.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR}export(A,q){if(this._shutdown){setImmediate(q,{code:zF4.ExportResultCode.FAILED});return}return xx8._sendMetrics(A,q)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(A){return this._temporalitySelector(A)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(A,q){for(let K of A.scopeMetrics)for(let Y of K.metrics)console.dir({descriptor:Y.descriptor,dataPointType:Y.dataPointType,dataPoints:Y.dataPoints},{depth:null});q({code:zF4.ExportResultCode.SUCCESS})}}wF4.ConsoleMetricExporter=xx8});var JF4=C((HF4)=>{Object.defineProperty(HF4,"__esModule",{value:!0});HF4.ViewRegistry=void 0;class OF4{_registeredViews=[];addView(A){this._registeredViews.push(A)}findViews(A,q){return this._registeredViews.filter((Y)=>{return this._matchInstrument(Y.instrumentSelector,A)&&this._matchMeter(Y.meterSelector,q)})}_matchInstrument(A,q){return(A.getType()===void 0||q.type===A.getType())&&A.getNameFilter().match(q.name)&&A.getUnitFilter().match(q.unit)}_matchMeter(A,q){return A.getNameFilter().match(q.name)&&(q.version===void 0||A.getVersionFilter().match(q.version))&&(q.schemaUrl===void 0||A.getSchemaUrlFilter().match(q.schemaUrl))}}HF4.ViewRegistry=OF4});var pi6=C((XF4)=>{Object.defineProperty(XF4,"__esModule",{value:!0});XF4.isValidName=XF4.isDescriptorCompatibleWith=XF4.createInstrumentDescriptorWithView=XF4.createInstrumentDescriptor=void 0;var MF4=nq(),zCY=Au();function wCY(A,q,K){if(!DF4(A))MF4.diag.warn(`Invalid metric name: "${A}". The metric name should be a ASCII string with a length no greater than 255 characters.`);return{name:A,type:q,description:K?.description??"",unit:K?.unit??"",valueType:K?.valueType??MF4.ValueType.DOUBLE,advice:K?.advice??{}}}XF4.createInstrumentDescriptor=wCY;function _CY(A,q){return{name:A.name??q.name,description:A.description??q.description,type:q.type,unit:q.unit,valueType:q.valueType,advice:q.advice}}XF4.createInstrumentDescriptorWithView=_CY;function $CY(A,q){return(0,zCY.equalsCaseInsensitive)(A.name,q.name)&&A.unit===q.unit&&A.type===q.type&&A.valueType===q.valueType}XF4.isDescriptorCompatibleWith=$CY;var OCY=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function DF4(A){return A.match(OCY)!=null}XF4.isValidName=DF4});var Nv1=C((vF4)=>{Object.defineProperty(vF4,"__esModule",{value:!0});vF4.isObservableInstrument=vF4.ObservableUpDownCounterInstrument=vF4.ObservableGaugeInstrument=vF4.ObservableCounterInstrument=vF4.ObservableInstrument=vF4.HistogramInstrument=vF4.GaugeInstrument=vF4.CounterInstrument=vF4.UpDownCounterInstrument=vF4.SyncInstrument=void 0;var eV6=nq(),MCY=b9();class AN6{_writableMetricStorage;_descriptor;constructor(A,q){this._writableMetricStorage=A,this._descriptor=q}_record(A,q={},K=eV6.context.active()){if(typeof A!=="number"){eV6.diag.warn(`non-number value provided to metric ${this._descriptor.name}: ${A}`);return}if(this._descriptor.valueType===eV6.ValueType.INT&&!Number.isInteger(A)){if(eV6.diag.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),A=Math.trunc(A),!Number.isInteger(A))return}this._writableMetricStorage.record(A,q,K,(0,MCY.millisToHrTime)(Date.now()))}}vF4.SyncInstrument=AN6;class WF4 extends AN6{add(A,q,K){this._record(A,q,K)}}vF4.UpDownCounterInstrument=WF4;class ZF4 extends AN6{add(A,q,K){if(A<0){eV6.diag.warn(`negative value provided to counter ${this._descriptor.name}: ${A}`);return}this._record(A,q,K)}}vF4.CounterInstrument=ZF4;class GF4 extends AN6{record(A,q,K){this._record(A,q,K)}}vF4.GaugeInstrument=GF4;class fF4 extends AN6{record(A,q,K){if(A<0){eV6.diag.warn(`negative value provided to histogram ${this._descriptor.name}: ${A}`);return}this._record(A,q,K)}}vF4.HistogramInstrument=fF4;class qN6{_observableRegistry;_metricStorages;_descriptor;constructor(A,q,K){this._observableRegistry=K,this._descriptor=A,this._metricStorages=q}addCallback(A){this._observableRegistry.addCallback(A,this)}removeCallback(A){this._observableRegistry.removeCallback(A,this)}}vF4.ObservableInstrument=qN6;class TF4 extends qN6{}vF4.ObservableCounterInstrument=TF4;class VF4 extends qN6{}vF4.ObservableGaugeInstrument=VF4;class NF4 extends qN6{}vF4.ObservableUpDownCounterInstrument=NF4;function DCY(A){return A instanceof qN6}vF4.isObservableInstrument=DCY});var RF4=C((LF4)=>{Object.defineProperty(LF4,"__esModule",{value:!0});LF4.Meter=void 0;var Bw6=pi6(),mw6=Nv1(),gw6=W86();class EF4{_meterSharedState;constructor(A){this._meterSharedState=A}createGauge(A,q){let K=(0,Bw6.createInstrumentDescriptor)(A,gw6.InstrumentType.GAUGE,q),Y=this._meterSharedState.registerMetricStorage(K);return new mw6.GaugeInstrument(Y,K)}createHistogram(A,q){let K=(0,Bw6.createInstrumentDescriptor)(A,gw6.InstrumentType.HISTOGRAM,q),Y=this._meterSharedState.registerMetricStorage(K);return new mw6.HistogramInstrument(Y,K)}createCounter(A,q){let K=(0,Bw6.createInstrumentDescriptor)(A,gw6.InstrumentType.COUNTER,q),Y=this._meterSharedState.registerMetricStorage(K);return new mw6.CounterInstrument(Y,K)}createUpDownCounter(A,q){let K=(0,Bw6.createInstrumentDescriptor)(A,gw6.InstrumentType.UP_DOWN_COUNTER,q),Y=this._meterSharedState.registerMetricStorage(K);return new mw6.UpDownCounterInstrument(Y,K)}createObservableGauge(A,q){let K=(0,Bw6.createInstrumentDescriptor)(A,gw6.InstrumentType.OBSERVABLE_GAUGE,q),Y=this._meterSharedState.registerAsyncMetricStorage(K);return new mw6.ObservableGaugeInstrument(K,Y,this._meterSharedState.observableRegistry)}createObservableCounter(A,q){let K=(0,Bw6.createInstrumentDescriptor)(A,gw6.InstrumentType.OBSERVABLE_COUNTER,q),Y=this._meterSharedState.registerAsyncMetricStorage(K);return new mw6.ObservableCounterInstrument(K,Y,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(A,q){let K=(0,Bw6.createInstrumentDescriptor)(A,gw6.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER,q),Y=this._meterSharedState.registerAsyncMetricStorage(K);return new mw6.ObservableUpDownCounterInstrument(K,Y,this._meterSharedState.observableRegistry)}addBatchObservableCallback(A,q){this._meterSharedState.observableRegistry.addBatchCallback(A,q)}removeBatchObservableCallback(A,q){this._meterSharedState.observableRegistry.removeBatchCallback(A,q)}}LF4.Meter=EF4});var ux8=C((CF4)=>{Object.defineProperty(CF4,"__esModule",{value:!0});CF4.MetricStorage=void 0;var vCY=pi6();class SF4{_instrumentDescriptor;constructor(A){this._instrumentDescriptor=A}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(A){this._instrumentDescriptor=(0,vCY.createInstrumentDescriptor)(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:A,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}CF4.MetricStorage=SF4});var di6=C((bF4)=>{Object.defineProperty(bF4,"__esModule",{value:!0});bF4.AttributeHashMap=bF4.HashMap=void 0;var kCY=Au();class Bx8{_hash;_valueMap=new Map;_keyMap=new Map;constructor(A){this._hash=A}get(A,q){return q??=this._hash(A),this._valueMap.get(q)}getOrDefault(A,q){let K=this._hash(A);if(this._valueMap.has(K))return this._valueMap.get(K);let Y=q();if(!this._keyMap.has(K))this._keyMap.set(K,A);return this._valueMap.set(K,Y),Y}set(A,q,K){if(K??=this._hash(A),!this._keyMap.has(K))this._keyMap.set(K,A);this._valueMap.set(K,q)}has(A,q){return q??=this._hash(A),this._valueMap.has(q)}*keys(){let A=this._keyMap.entries(),q=A.next();while(q.done!==!0)yield[q.value[1],q.value[0]],q=A.next()}*entries(){let A=this._valueMap.entries(),q=A.next();while(q.done!==!0)yield[this._keyMap.get(q.value[0]),q.value[1],q.value[0]],q=A.next()}get size(){return this._valueMap.size}}bF4.HashMap=Bx8;class IF4 extends Bx8{constructor(){super(kCY.hashAttributes)}}bF4.AttributeHashMap=IF4});var gx8=C((BF4)=>{Object.defineProperty(BF4,"__esModule",{value:!0});BF4.DeltaMetricProcessor=void 0;var LCY=Au(),mx8=di6();class uF4{_aggregator;_activeCollectionStorage=new mx8.AttributeHashMap;_cumulativeMemoStorage=new mx8.AttributeHashMap;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;constructor(A,q){this._aggregator=A,this._cardinalityLimit=(q??2000)-1,this._overflowHashCode=(0,LCY.hashAttributes)(this._overflowAttributes)}record(A,q,K,Y){let z=this._activeCollectionStorage.get(q);if(!z){if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(Y))?.record(A);return}z=this._aggregator.createAccumulation(Y),this._activeCollectionStorage.set(q,z)}z?.record(A)}batchCumulate(A,q){Array.from(A.entries()).forEach(([K,Y,z])=>{let w=this._aggregator.createAccumulation(q);w?.record(Y);let _=w;if(this._cumulativeMemoStorage.has(K,z)){let $=this._cumulativeMemoStorage.get(K,z);_=this._aggregator.diff($,w)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit){if(K=this._overflowAttributes,z=this._overflowHashCode,this._cumulativeMemoStorage.has(K,z)){let $=this._cumulativeMemoStorage.get(K,z);_=this._aggregator.diff($,w)}}if(this._activeCollectionStorage.has(K,z)){let $=this._activeCollectionStorage.get(K,z);_=this._aggregator.merge($,_)}this._cumulativeMemoStorage.set(K,w,z),this._activeCollectionStorage.set(K,_,z)})}collect(){let A=this._activeCollectionStorage;return this._activeCollectionStorage=new mx8.AttributeHashMap,A}}BF4.DeltaMetricProcessor=uF4});var Fx8=C((gF4)=>{Object.defineProperty(gF4,"__esModule",{value:!0});gF4.TemporalMetricProcessor=void 0;var yCY=Mv1(),RCY=di6();class ci6{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(A,q){this._aggregator=A,q.forEach((K)=>{this._unreportedAccumulations.set(K,[])})}buildMetrics(A,q,K,Y){this._stashAccumulations(K);let z=this._getMergedUnreportedAccumulations(A),w=z,_;if(this._reportHistory.has(A)){let O=this._reportHistory.get(A),H=O.collectionTime;if(_=O.aggregationTemporality,_===yCY.AggregationTemporality.CUMULATIVE)w=ci6.merge(O.accumulations,z,this._aggregator);else w=ci6.calibrateStartTime(O.accumulations,z,H)}else _=A.selectAggregationTemporality(q.type);this._reportHistory.set(A,{accumulations:w,collectionTime:Y,aggregationTemporality:_});let $=SCY(w);if($.length===0)return;return this._aggregator.toMetricData(q,_,$,Y)}_stashAccumulations(A){let q=this._unreportedAccumulations.keys();for(let K of q){let Y=this._unreportedAccumulations.get(K);if(Y===void 0)Y=[],this._unreportedAccumulations.set(K,Y);Y.push(A)}}_getMergedUnreportedAccumulations(A){let q=new RCY.AttributeHashMap,K=this._unreportedAccumulations.get(A);if(this._unreportedAccumulations.set(A,[]),K===void 0)return q;for(let Y of K)q=ci6.merge(q,Y,this._aggregator);return q}static merge(A,q,K){let Y=A,z=q.entries(),w=z.next();while(w.done!==!0){let[_,$,O]=w.value;if(A.has(_,O)){let H=A.get(_,O),j=K.merge(H,$);Y.set(_,j,O)}else Y.set(_,$,O);w=z.next()}return Y}static calibrateStartTime(A,q,K){for(let[Y,z]of A.keys())q.get(Y,z)?.setStartTime(K);return q}}gF4.TemporalMetricProcessor=ci6;function SCY(A){return Array.from(A.entries())}});var dF4=C((UF4)=>{Object.defineProperty(UF4,"__esModule",{value:!0});UF4.AsyncMetricStorage=void 0;var CCY=ux8(),hCY=gx8(),ICY=Fx8(),bCY=di6();class QF4 extends CCY.MetricStorage{_attributesProcessor;_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;constructor(A,q,K,Y,z){super(A);this._attributesProcessor=K,this._aggregationCardinalityLimit=z,this._deltaMetricStorage=new hCY.DeltaMetricProcessor(q,this._aggregationCardinalityLimit),this._temporalMetricStorage=new ICY.TemporalMetricProcessor(q,Y)}record(A,q){let K=new bCY.AttributeHashMap;Array.from(A.entries()).forEach(([Y,z])=>{K.set(this._attributesProcessor.process(Y),z)}),this._deltaMetricStorage.batchCumulate(K,q)}collect(A,q){let K=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(A,this._instrumentDescriptor,K,q)}}UF4.AsyncMetricStorage=QF4});var aF4=C((rF4)=>{Object.defineProperty(rF4,"__esModule",{value:!0});rF4.getConflictResolutionRecipe=rF4.getDescriptionResolutionRecipe=rF4.getTypeConflictResolutionRecipe=rF4.getUnitConflictResolutionRecipe=rF4.getValueTypeConflictResolutionRecipe=rF4.getIncompatibilityDetails=void 0;function xCY(A,q){let K="";if(A.unit!==q.unit)K+=` - Unit '${A.unit}' does not match '${q.unit}' `;if(A.type!==q.type)K+=` - Type '${A.type}' does not match '${q.type}' `;if(A.valueType!==q.valueType)K+=` - Value Type '${A.valueType}' does not match '${q.valueType}' `;if(A.description!==q.description)K+=` - Description '${A.description}' does not match '${q.description}' `;return K}rF4.getIncompatibilityDetails=xCY;function cF4(A,q){return` - use valueType '${A.valueType}' on instrument creation or use an instrument name other than '${q.name}'`}rF4.getValueTypeConflictResolutionRecipe=cF4;function lF4(A,q){return` - use unit '${A.unit}' on instrument creation or use an instrument name other than '${q.name}'`}rF4.getUnitConflictResolutionRecipe=lF4;function iF4(A,q){let K={name:q.name,type:q.type,unit:q.unit},Y=JSON.stringify(K);return` - create a new view with a name other than '${A.name}' and InstrumentSelector '${Y}'`}rF4.getTypeConflictResolutionRecipe=iF4;function nF4(A,q){let K={name:q.name,type:q.type,unit:q.unit},Y=JSON.stringify(K);return` - create a new view with a name other than '${A.name}' and InstrumentSelector '${Y}' - OR - create a new view with the name ${A.name} and description '${A.description}' and InstrumentSelector ${Y} - OR - create a new view with the name ${q.name} and description '${A.description}' and InstrumentSelector ${Y}`}rF4.getDescriptionResolutionRecipe=nF4;function uCY(A,q){if(A.valueType!==q.valueType)return cF4(A,q);if(A.unit!==q.unit)return lF4(A,q);if(A.type!==q.type)return iF4(A,q);if(A.description!==q.description)return nF4(A,q);return""}rF4.getConflictResolutionRecipe=uCY});var AQ4=C((tF4)=>{Object.defineProperty(tF4,"__esModule",{value:!0});tF4.MetricStorageRegistry=void 0;var UCY=pi6(),sF4=nq(),vv1=aF4();class Qx8{_sharedRegistry=new Map;_perCollectorRegistry=new Map;static create(){return new Qx8}getStorages(A){let q=[];for(let Y of this._sharedRegistry.values())q=q.concat(Y);let K=this._perCollectorRegistry.get(A);if(K!=null)for(let Y of K.values())q=q.concat(Y);return q}register(A){this._registerStorage(A,this._sharedRegistry)}registerForCollector(A,q){let K=this._perCollectorRegistry.get(A);if(K==null)K=new Map,this._perCollectorRegistry.set(A,K);this._registerStorage(q,K)}findOrUpdateCompatibleStorage(A){let q=this._sharedRegistry.get(A.name);if(q===void 0)return null;return this._findOrUpdateCompatibleStorage(A,q)}findOrUpdateCompatibleCollectorStorage(A,q){let K=this._perCollectorRegistry.get(A);if(K===void 0)return null;let Y=K.get(q.name);if(Y===void 0)return null;return this._findOrUpdateCompatibleStorage(q,Y)}_registerStorage(A,q){let K=A.getInstrumentDescriptor(),Y=q.get(K.name);if(Y===void 0){q.set(K.name,[A]);return}Y.push(A)}_findOrUpdateCompatibleStorage(A,q){let K=null;for(let Y of q){let z=Y.getInstrumentDescriptor();if((0,UCY.isDescriptorCompatibleWith)(z,A)){if(z.description!==A.description){if(A.description.length>z.description.length)Y.updateDescription(A.description);sF4.diag.warn("A view or instrument with the name ",A.name,` has already been registered, but has a different description and is incompatible with another registered view. `,`Details: `,(0,vv1.getIncompatibilityDetails)(z,A),`The longer description will be used. To resolve the conflict:`,(0,vv1.getConflictResolutionRecipe)(z,A))}K=Y}else sF4.diag.warn("A view or instrument with the name ",A.name,` has already been registered and is incompatible with another registered view. `,`Details: `,(0,vv1.getIncompatibilityDetails)(z,A),`To resolve the conflict: `,(0,vv1.getConflictResolutionRecipe)(z,A))}return K}}tF4.MetricStorageRegistry=Qx8});var zQ4=C((KQ4)=>{Object.defineProperty(KQ4,"__esModule",{value:!0});KQ4.MultiMetricStorage=void 0;class qQ4{_backingStorages;constructor(A){this._backingStorages=A}record(A,q,K,Y){this._backingStorages.forEach((z)=>{z.record(A,q,K,Y)})}}KQ4.MultiMetricStorage=qQ4});var jQ4=C((OQ4)=>{Object.defineProperty(OQ4,"__esModule",{value:!0});OQ4.BatchObservableResultImpl=OQ4.ObservableResultImpl=void 0;var KN6=nq(),wQ4=di6(),pCY=Nv1();class _Q4{_instrumentName;_valueType;_buffer=new wQ4.AttributeHashMap;constructor(A,q){this._instrumentName=A,this._valueType=q}observe(A,q={}){if(typeof A!=="number"){KN6.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${A}`);return}if(this._valueType===KN6.ValueType.INT&&!Number.isInteger(A)){if(KN6.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),A=Math.trunc(A),!Number.isInteger(A))return}this._buffer.set(q,A)}}OQ4.ObservableResultImpl=_Q4;class $Q4{_buffer=new Map;observe(A,q,K={}){if(!(0,pCY.isObservableInstrument)(A))return;let Y=this._buffer.get(A);if(Y==null)Y=new wQ4.AttributeHashMap,this._buffer.set(A,Y);if(typeof q!=="number"){KN6.diag.warn(`non-number value provided to metric ${A._descriptor.name}: ${q}`);return}if(A._descriptor.valueType===KN6.ValueType.INT&&!Number.isInteger(q)){if(KN6.diag.warn(`INT value type cannot accept a floating-point value for ${A._descriptor.name}, ignoring the fractional digits.`),q=Math.trunc(q),!Number.isInteger(q))return}Y.set(K,q)}}OQ4.BatchObservableResultImpl=$Q4});var WQ4=C((XQ4)=>{Object.defineProperty(XQ4,"__esModule",{value:!0});XQ4.ObservableRegistry=void 0;var cCY=nq(),JQ4=Nv1(),MQ4=jQ4(),li6=Au();class DQ4{_callbacks=[];_batchCallbacks=[];addCallback(A,q){if(this._findCallback(A,q)>=0)return;this._callbacks.push({callback:A,instrument:q})}removeCallback(A,q){let K=this._findCallback(A,q);if(K<0)return;this._callbacks.splice(K,1)}addBatchCallback(A,q){let K=new Set(q.filter(JQ4.isObservableInstrument));if(K.size===0){cCY.diag.error("BatchObservableCallback is not associated with valid instruments",q);return}if(this._findBatchCallback(A,K)>=0)return;this._batchCallbacks.push({callback:A,instruments:K})}removeBatchCallback(A,q){let K=new Set(q.filter(JQ4.isObservableInstrument)),Y=this._findBatchCallback(A,K);if(Y<0)return;this._batchCallbacks.splice(Y,1)}async observe(A,q){let K=this._observeCallbacks(A,q),Y=this._observeBatchCallbacks(A,q);return(await(0,li6.PromiseAllSettled)([...K,...Y])).filter(li6.isPromiseAllSettledRejectionResult).map((_)=>_.reason)}_observeCallbacks(A,q){return this._callbacks.map(async({callback:K,instrument:Y})=>{let z=new MQ4.ObservableResultImpl(Y._descriptor.name,Y._descriptor.valueType),w=Promise.resolve(K(z));if(q!=null)w=(0,li6.callWithTimeout)(w,q);await w,Y._metricStorages.forEach((_)=>{_.record(z._buffer,A)})})}_observeBatchCallbacks(A,q){return this._batchCallbacks.map(async({callback:K,instruments:Y})=>{let z=new MQ4.BatchObservableResultImpl,w=Promise.resolve(K(z));if(q!=null)w=(0,li6.callWithTimeout)(w,q);await w,Y.forEach((_)=>{let $=z._buffer.get(_);if($==null)return;_._metricStorages.forEach((O)=>{O.record($,A)})})})}_findCallback(A,q){return this._callbacks.findIndex((K)=>{return K.callback===A&&K.instrument===q})}_findBatchCallback(A,q){return this._batchCallbacks.findIndex((K)=>{return K.callback===A&&(0,li6.setEquals)(K.instruments,q)})}}XQ4.ObservableRegistry=DQ4});var TQ4=C((GQ4)=>{Object.defineProperty(GQ4,"__esModule",{value:!0});GQ4.SyncMetricStorage=void 0;var lCY=ux8(),iCY=gx8(),nCY=Fx8();class ZQ4 extends lCY.MetricStorage{_attributesProcessor;_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;constructor(A,q,K,Y,z){super(A);this._attributesProcessor=K,this._aggregationCardinalityLimit=z,this._deltaMetricStorage=new iCY.DeltaMetricProcessor(q,this._aggregationCardinalityLimit),this._temporalMetricStorage=new nCY.TemporalMetricProcessor(q,Y)}record(A,q,K,Y){q=this._attributesProcessor.process(q,K),this._deltaMetricStorage.record(A,q,K,Y)}collect(A,q){let K=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(A,this._instrumentDescriptor,K,q)}}GQ4.SyncMetricStorage=ZQ4});var kv1=C((EQ4)=>{Object.defineProperty(EQ4,"__esModule",{value:!0});EQ4.createDenyListAttributesProcessor=EQ4.createAllowListAttributesProcessor=EQ4.createMultiAttributesProcessor=EQ4.createNoopAttributesProcessor=void 0;class VQ4{process(A,q){return A}}class NQ4{_processors;constructor(A){this._processors=A}process(A,q){let K=A;for(let Y of this._processors)K=Y.process(K,q);return K}}class vQ4{_allowedAttributeNames;constructor(A){this._allowedAttributeNames=A}process(A,q){let K={};return Object.keys(A).filter((Y)=>this._allowedAttributeNames.includes(Y)).forEach((Y)=>K[Y]=A[Y]),K}}class kQ4{_deniedAttributeNames;constructor(A){this._deniedAttributeNames=A}process(A,q){let K={};return Object.keys(A).filter((Y)=>!this._deniedAttributeNames.includes(Y)).forEach((Y)=>K[Y]=A[Y]),K}}function rCY(){return tCY}EQ4.createNoopAttributesProcessor=rCY;function oCY(A){return new NQ4(A)}EQ4.createMultiAttributesProcessor=oCY;function aCY(A){return new vQ4(A)}EQ4.createAllowListAttributesProcessor=aCY;function sCY(A){return new kQ4(A)}EQ4.createDenyListAttributesProcessor=sCY;var tCY=new VQ4});var CQ4=C((RQ4)=>{Object.defineProperty(RQ4,"__esModule",{value:!0});RQ4.MeterSharedState=void 0;var KhY=pi6(),YhY=RF4(),zhY=Au(),whY=dF4(),_hY=AQ4(),$hY=zQ4(),OhY=WQ4(),HhY=TQ4(),jhY=kv1();class yQ4{_meterProviderSharedState;_instrumentationScope;metricStorageRegistry=new _hY.MetricStorageRegistry;observableRegistry=new OhY.ObservableRegistry;meter;constructor(A,q){this._meterProviderSharedState=A,this._instrumentationScope=q,this.meter=new YhY.Meter(this)}registerMetricStorage(A){let q=this._registerMetricStorage(A,HhY.SyncMetricStorage);if(q.length===1)return q[0];return new $hY.MultiMetricStorage(q)}registerAsyncMetricStorage(A){return this._registerMetricStorage(A,whY.AsyncMetricStorage)}async collect(A,q,K){let Y=await this.observableRegistry.observe(q,K?.timeoutMillis),z=this.metricStorageRegistry.getStorages(A);if(z.length===0)return null;let w=z.map((_)=>{return _.collect(A,q)}).filter(zhY.isNotNullish);if(w.length===0)return{errors:Y};return{scopeMetrics:{scope:this._instrumentationScope,metrics:w},errors:Y}}_registerMetricStorage(A,q){let Y=this._meterProviderSharedState.viewRegistry.findViews(A,this._instrumentationScope).map((z)=>{let w=(0,KhY.createInstrumentDescriptorWithView)(z,A),_=this.metricStorageRegistry.findOrUpdateCompatibleStorage(w);if(_!=null)return _;let $=z.aggregation.createAggregator(w),O=new q(w,$,z.attributesProcessor,this._meterProviderSharedState.metricCollectors,z.aggregationCardinalityLimit);return this.metricStorageRegistry.register(O),O});if(Y.length===0){let w=this._meterProviderSharedState.selectAggregations(A.type).map(([_,$])=>{let O=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(_,A);if(O!=null)return O;let H=$.createAggregator(A),j=_.selectCardinalityLimit(A.type),J=new q(A,H,(0,jhY.createNoopAttributesProcessor)(),[_],j);return this.metricStorageRegistry.registerForCollector(_,J),J});Y=Y.concat(w)}return Y}}RQ4.MeterSharedState=yQ4});var xQ4=C((IQ4)=>{Object.defineProperty(IQ4,"__esModule",{value:!0});IQ4.MeterProviderSharedState=void 0;var JhY=Au(),MhY=JF4(),DhY=CQ4(),XhY=Ui6();class hQ4{resource;viewRegistry=new MhY.ViewRegistry;metricCollectors=[];meterSharedStates=new Map;constructor(A){this.resource=A}getMeterSharedState(A){let q=(0,JhY.instrumentationScopeId)(A),K=this.meterSharedStates.get(q);if(K==null)K=new DhY.MeterSharedState(this,A),this.meterSharedStates.set(q,K);return K}selectAggregations(A){let q=[];for(let K of this.metricCollectors)q.push([K,(0,XhY.toAggregation)(K.selectAggregation(A))]);return q}}IQ4.MeterProviderSharedState=hQ4});var gQ4=C((BQ4)=>{Object.defineProperty(BQ4,"__esModule",{value:!0});BQ4.MetricCollector=void 0;var PhY=b9();class uQ4{_sharedState;_metricReader;constructor(A,q){this._sharedState=A,this._metricReader=q}async collect(A){let q=(0,PhY.millisToHrTime)(Date.now()),K=[],Y=[],z=Array.from(this._sharedState.meterSharedStates.values()).map(async(w)=>{let _=await w.collect(this,q,A);if(_?.scopeMetrics!=null)K.push(_.scopeMetrics);if(_?.errors!=null)Y.push(..._.errors)});return await Promise.all(z),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:K},errors:Y}}async forceFlush(A){await this._metricReader.forceFlush(A)}async shutdown(A){await this._metricReader.shutdown(A)}selectAggregationTemporality(A){return this._metricReader.selectAggregationTemporality(A)}selectAggregation(A){return this._metricReader.selectAggregation(A)}selectCardinalityLimit(A){return this._metricReader.selectCardinalityLimit?.(A)??2000}}BQ4.MetricCollector=uQ4});var Ev1=C((QQ4)=>{Object.defineProperty(QQ4,"__esModule",{value:!0});QQ4.ExactPredicate=QQ4.PatternPredicate=void 0;var WhY=/[\^$\\.+?()[\]{}|]/g;class Ux8{_matchAll;_regexp;constructor(A){if(A==="*")this._matchAll=!0,this._regexp=/.*/;else this._matchAll=!1,this._regexp=new RegExp(Ux8.escapePattern(A))}match(A){if(this._matchAll)return!0;return this._regexp.test(A)}static escapePattern(A){return`^${A.replace(WhY,"\\$&").replace("*",".*")}$`}static hasWildcard(A){return A.includes("*")}}QQ4.PatternPredicate=Ux8;class FQ4{_matchAll;_pattern;constructor(A){this._matchAll=A===void 0,this._pattern=A}match(A){if(this._matchAll)return!0;if(A===this._pattern)return!0;return!1}}QQ4.ExactPredicate=FQ4});var iQ4=C((cQ4)=>{Object.defineProperty(cQ4,"__esModule",{value:!0});cQ4.InstrumentSelector=void 0;var pQ4=Ev1();class dQ4{_nameFilter;_type;_unitFilter;constructor(A){this._nameFilter=new pQ4.PatternPredicate(A?.name??"*"),this._type=A?.type,this._unitFilter=new pQ4.ExactPredicate(A?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}cQ4.InstrumentSelector=dQ4});var aQ4=C((rQ4)=>{Object.defineProperty(rQ4,"__esModule",{value:!0});rQ4.MeterSelector=void 0;var px8=Ev1();class nQ4{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(A){this._nameFilter=new px8.ExactPredicate(A?.name),this._versionFilter=new px8.ExactPredicate(A?.version),this._schemaUrlFilter=new px8.ExactPredicate(A?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}rQ4.MeterSelector=nQ4});var KU4=C((AU4)=>{Object.defineProperty(AU4,"__esModule",{value:!0});AU4.View=void 0;var GhY=Ev1(),sQ4=kv1(),fhY=iQ4(),ThY=aQ4(),tQ4=Ui6();function VhY(A){return A.instrumentName==null&&A.instrumentType==null&&A.instrumentUnit==null&&A.meterName==null&&A.meterVersion==null&&A.meterSchemaUrl==null}function NhY(A){if(VhY(A))throw Error("Cannot create view with no selector arguments supplied");if(A.name!=null&&(A?.instrumentName==null||GhY.PatternPredicate.hasWildcard(A.instrumentName)))throw Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.")}class eQ4{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(A){if(NhY(A),A.attributesProcessors!=null)this.attributesProcessor=(0,sQ4.createMultiAttributesProcessor)(A.attributesProcessors);else this.attributesProcessor=(0,sQ4.createNoopAttributesProcessor)();this.name=A.name,this.description=A.description,this.aggregation=(0,tQ4.toAggregation)(A.aggregation??{type:tQ4.AggregationType.DEFAULT}),this.instrumentSelector=new fhY.InstrumentSelector({name:A.instrumentName,type:A.instrumentType,unit:A.instrumentUnit}),this.meterSelector=new ThY.MeterSelector({name:A.meterName,version:A.meterVersion,schemaUrl:A.meterSchemaUrl}),this.aggregationCardinalityLimit=A.aggregationCardinalityLimit}}AU4.View=eQ4});var _U4=C((zU4)=>{Object.defineProperty(zU4,"__esModule",{value:!0});zU4.MeterProvider=void 0;var Lv1=nq(),vhY=TM6(),khY=xQ4(),EhY=gQ4(),LhY=KU4();class YU4{_sharedState;_shutdown=!1;constructor(A){if(this._sharedState=new khY.MeterProviderSharedState(A?.resource??(0,vhY.defaultResource)()),A?.views!=null&&A.views.length>0)for(let q of A.views)this._sharedState.viewRegistry.addView(new LhY.View(q));if(A?.readers!=null&&A.readers.length>0)for(let q of A.readers){let K=new EhY.MetricCollector(this._sharedState,q);q.setMetricProducer(K),this._sharedState.metricCollectors.push(K)}}getMeter(A,q="",K={}){if(this._shutdown)return Lv1.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,Lv1.createNoopMeter)();return this._sharedState.getMeterSharedState({name:A,version:q,schemaUrl:K.schemaUrl}).meter}async shutdown(A){if(this._shutdown){Lv1.diag.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map((q)=>{return q.shutdown(A)}))}async forceFlush(A){if(this._shutdown){Lv1.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map((q)=>{return q.forceFlush(A)}))}}zU4.MeterProvider=YU4});var Z86=C((Pv)=>{Object.defineProperty(Pv,"__esModule",{value:!0});Pv.TimeoutError=Pv.createDenyListAttributesProcessor=Pv.createAllowListAttributesProcessor=Pv.AggregationType=Pv.MeterProvider=Pv.ConsoleMetricExporter=Pv.InMemoryMetricExporter=Pv.PeriodicExportingMetricReader=Pv.MetricReader=Pv.InstrumentType=Pv.DataPointType=Pv.AggregationTemporality=void 0;var yhY=Mv1();Object.defineProperty(Pv,"AggregationTemporality",{enumerable:!0,get:function(){return yhY.AggregationTemporality}});var $U4=W86();Object.defineProperty(Pv,"DataPointType",{enumerable:!0,get:function(){return $U4.DataPointType}});Object.defineProperty(Pv,"InstrumentType",{enumerable:!0,get:function(){return $U4.InstrumentType}});var RhY=Ix8();Object.defineProperty(Pv,"MetricReader",{enumerable:!0,get:function(){return RhY.MetricReader}});var ShY=tg4();Object.defineProperty(Pv,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return ShY.PeriodicExportingMetricReader}});var ChY=YF4();Object.defineProperty(Pv,"InMemoryMetricExporter",{enumerable:!0,get:function(){return ChY.InMemoryMetricExporter}});var hhY=$F4();Object.defineProperty(Pv,"ConsoleMetricExporter",{enumerable:!0,get:function(){return hhY.ConsoleMetricExporter}});var IhY=_U4();Object.defineProperty(Pv,"MeterProvider",{enumerable:!0,get:function(){return IhY.MeterProvider}});var bhY=Ui6();Object.defineProperty(Pv,"AggregationType",{enumerable:!0,get:function(){return bhY.AggregationType}});var OU4=kv1();Object.defineProperty(Pv,"createAllowListAttributesProcessor",{enumerable:!0,get:function(){return OU4.createAllowListAttributesProcessor}});Object.defineProperty(Pv,"createDenyListAttributesProcessor",{enumerable:!0,get:function(){return OU4.createDenyListAttributesProcessor}});var xhY=Au();Object.defineProperty(Pv,"TimeoutError",{enumerable:!0,get:function(){return xhY.TimeoutError}})});var cx8=C((HU4)=>{Object.defineProperty(HU4,"__esModule",{value:!0});HU4.AggregationTemporalityPreference=void 0;var BhY;(function(A){A[A.DELTA=0]="DELTA",A[A.CUMULATIVE=1]="CUMULATIVE",A[A.LOWMEMORY=2]="LOWMEMORY"})(BhY=HU4.AggregationTemporalityPreference||(HU4.AggregationTemporalityPreference={}))});var DU4=C((JU4)=>{Object.defineProperty(JU4,"__esModule",{value:!0});JU4.OTLPExporterBase=void 0;class jU4{_delegate;constructor(A){this._delegate=A}export(A,q){this._delegate.export(A,q)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}JU4.OTLPExporterBase=jU4});var yv1=C((PU4)=>{Object.defineProperty(PU4,"__esModule",{value:!0});PU4.OTLPExporterError=void 0;class XU4 extends Error{code;name="OTLPExporterError";data;constructor(A,q,K){super(A);this.data=K,this.code=q}}PU4.OTLPExporterError=XU4});var ii6=C((GU4)=>{Object.defineProperty(GU4,"__esModule",{value:!0});GU4.getSharedConfigurationDefaults=GU4.mergeOtlpSharedConfigurationWithDefaults=GU4.wrapStaticHeadersInFunction=GU4.validateTimeoutMillis=void 0;function ZU4(A){if(Number.isFinite(A)&&A>0)return A;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${A}')`)}GU4.validateTimeoutMillis=ZU4;function mhY(A){if(A==null)return;return async()=>A}GU4.wrapStaticHeadersInFunction=mhY;function ghY(A,q,K){return{timeoutMillis:ZU4(A.timeoutMillis??q.timeoutMillis??K.timeoutMillis),concurrencyLimit:A.concurrencyLimit??q.concurrencyLimit??K.concurrencyLimit,compression:A.compression??q.compression??K.compression}}GU4.mergeOtlpSharedConfigurationWithDefaults=ghY;function FhY(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}GU4.getSharedConfigurationDefaults=FhY});var VU4=C((TU4)=>{Object.defineProperty(TU4,"__esModule",{value:!0});TU4.CompressionAlgorithm=void 0;var dhY;(function(A){A.NONE="none",A.GZIP="gzip"})(dhY=TU4.CompressionAlgorithm||(TU4.CompressionAlgorithm={}))});var ix8=C((vU4)=>{Object.defineProperty(vU4,"__esModule",{value:!0});vU4.createBoundedQueueExportPromiseHandler=void 0;class NU4{_concurrencyLimit;_sendingPromises=[];constructor(A){this._concurrencyLimit=A}pushPromise(A){if(this.hasReachedLimit())throw Error("Concurrency Limit reached");this._sendingPromises.push(A);let q=()=>{let K=this._sendingPromises.indexOf(A);this._sendingPromises.splice(K,1)};A.then(q,q)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function chY(A){return new NU4(A.concurrencyLimit)}vU4.createBoundedQueueExportPromiseHandler=chY});var yU4=C((EU4)=>{Object.defineProperty(EU4,"__esModule",{value:!0});EU4.createLoggingPartialSuccessResponseHandler=void 0;var lhY=nq();function ihY(A){return Object.prototype.hasOwnProperty.call(A,"partialSuccess")}function nhY(){return{handleResponse(A){if(A==null||!ihY(A)||A.partialSuccess==null||Object.keys(A.partialSuccess).length===0)return;lhY.diag.warn("Received Partial Success response:",JSON.stringify(A.partialSuccess))}}}EU4.createLoggingPartialSuccessResponseHandler=nhY});var nx8=C((CU4)=>{Object.defineProperty(CU4,"__esModule",{value:!0});CU4.createOtlpExportDelegate=void 0;var Fw6=b9(),RU4=yv1(),rhY=yU4(),ohY=nq();class SU4{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(A,q,K,Y,z){this._transport=A,this._serializer=q,this._responseHandler=K,this._promiseQueue=Y,this._timeout=z,this._diagLogger=ohY.diag.createComponentLogger({namespace:"OTLPExportDelegate"})}export(A,q){if(this._diagLogger.debug("items to be sent",A),this._promiseQueue.hasReachedLimit()){q({code:Fw6.ExportResultCode.FAILED,error:Error("Concurrent export limit reached")});return}let K=this._serializer.serializeRequest(A);if(K==null){q({code:Fw6.ExportResultCode.FAILED,error:Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(K,this._timeout).then((Y)=>{if(Y.status==="success"){if(Y.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(Y.data))}catch(z){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",z,Y.data)}q({code:Fw6.ExportResultCode.SUCCESS});return}else if(Y.status==="failure"&&Y.error){q({code:Fw6.ExportResultCode.FAILED,error:Y.error});return}else if(Y.status==="retryable")q({code:Fw6.ExportResultCode.FAILED,error:new RU4.OTLPExporterError("Export failed with retryable status")});else q({code:Fw6.ExportResultCode.FAILED,error:new RU4.OTLPExporterError("Export failed with unknown error")})},(Y)=>q({code:Fw6.ExportResultCode.FAILED,error:Y})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function ahY(A,q){return new SU4(A.transport,A.serializer,(0,rhY.createLoggingPartialSuccessResponseHandler)(),A.promiseHandler,q.timeout)}CU4.createOtlpExportDelegate=ahY});var xU4=C((IU4)=>{Object.defineProperty(IU4,"__esModule",{value:!0});IU4.createOtlpNetworkExportDelegate=void 0;var shY=ix8(),thY=nx8();function ehY(A,q,K){return(0,thY.createOtlpExportDelegate)({transport:K,serializer:q,promiseHandler:(0,shY.createBoundedQueueExportPromiseHandler)(A)},{timeout:A.timeoutMillis})}IU4.createOtlpNetworkExportDelegate=ehY});var vQ=C((G86)=>{Object.defineProperty(G86,"__esModule",{value:!0});G86.createOtlpNetworkExportDelegate=G86.CompressionAlgorithm=G86.getSharedConfigurationDefaults=G86.mergeOtlpSharedConfigurationWithDefaults=G86.OTLPExporterError=G86.OTLPExporterBase=void 0;var AIY=DU4();Object.defineProperty(G86,"OTLPExporterBase",{enumerable:!0,get:function(){return AIY.OTLPExporterBase}});var qIY=yv1();Object.defineProperty(G86,"OTLPExporterError",{enumerable:!0,get:function(){return qIY.OTLPExporterError}});var uU4=ii6();Object.defineProperty(G86,"mergeOtlpSharedConfigurationWithDefaults",{enumerable:!0,get:function(){return uU4.mergeOtlpSharedConfigurationWithDefaults}});Object.defineProperty(G86,"getSharedConfigurationDefaults",{enumerable:!0,get:function(){return uU4.getSharedConfigurationDefaults}});var KIY=VU4();Object.defineProperty(G86,"CompressionAlgorithm",{enumerable:!0,get:function(){return KIY.CompressionAlgorithm}});var YIY=xU4();Object.defineProperty(G86,"createOtlpNetworkExportDelegate",{enumerable:!0,get:function(){return YIY.createOtlpNetworkExportDelegate}})});var ax8=C((gU4)=>{Object.defineProperty(gU4,"__esModule",{value:!0});gU4.OTLPMetricExporterBase=gU4.LowMemoryTemporalitySelector=gU4.DeltaTemporalitySelector=gU4.CumulativeTemporalitySelector=void 0;var wIY=b9(),HD=Z86(),BU4=cx8(),_IY=vQ(),$IY=nq(),OIY=()=>HD.AggregationTemporality.CUMULATIVE;gU4.CumulativeTemporalitySelector=OIY;var HIY=(A)=>{switch(A){case HD.InstrumentType.COUNTER:case HD.InstrumentType.OBSERVABLE_COUNTER:case HD.InstrumentType.GAUGE:case HD.InstrumentType.HISTOGRAM:case HD.InstrumentType.OBSERVABLE_GAUGE:return HD.AggregationTemporality.DELTA;case HD.InstrumentType.UP_DOWN_COUNTER:case HD.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:return HD.AggregationTemporality.CUMULATIVE}};gU4.DeltaTemporalitySelector=HIY;var jIY=(A)=>{switch(A){case HD.InstrumentType.COUNTER:case HD.InstrumentType.HISTOGRAM:return HD.AggregationTemporality.DELTA;case HD.InstrumentType.GAUGE:case HD.InstrumentType.UP_DOWN_COUNTER:case HD.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:case HD.InstrumentType.OBSERVABLE_COUNTER:case HD.InstrumentType.OBSERVABLE_GAUGE:return HD.AggregationTemporality.CUMULATIVE}};gU4.LowMemoryTemporalitySelector=jIY;function JIY(){let A=((0,wIY.getStringFromEnv)("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE")??"cumulative").toLowerCase();if(A==="cumulative")return gU4.CumulativeTemporalitySelector;if(A==="delta")return gU4.DeltaTemporalitySelector;if(A==="lowmemory")return gU4.LowMemoryTemporalitySelector;return $IY.diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${A}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),gU4.CumulativeTemporalitySelector}function MIY(A){if(A!=null){if(A===BU4.AggregationTemporalityPreference.DELTA)return gU4.DeltaTemporalitySelector;else if(A===BU4.AggregationTemporalityPreference.LOWMEMORY)return gU4.LowMemoryTemporalitySelector;return gU4.CumulativeTemporalitySelector}return JIY()}var DIY=Object.freeze({type:HD.AggregationType.DEFAULT});function XIY(A){return A?.aggregationPreference??(()=>DIY)}class mU4 extends _IY.OTLPExporterBase{_aggregationTemporalitySelector;_aggregationSelector;constructor(A,q){super(A);this._aggregationSelector=XIY(q),this._aggregationTemporalitySelector=MIY(q?.temporalityPreference)}selectAggregation(A){return this._aggregationSelector(A)}selectAggregationTemporality(A){return this._aggregationTemporalitySelector(A)}}gU4.OTLPMetricExporterBase=mU4});var sx8=C((qo_,QU4)=>{QU4.exports=PIY;function PIY(A,q){var K=Array(arguments.length-1),Y=0,z=2,w=!0;while(z{var Sv1=dU4;Sv1.length=function(q){var K=q.length;if(!K)return 0;var Y=0;while(--K%4>1&&q.charAt(K)==="=")++Y;return Math.ceil(q.length*3)/4-Y};var YN6=Array(64),pU4=Array(123);for(EC=0;EC<64;)pU4[YN6[EC]=EC<26?EC+65:EC<52?EC+71:EC<62?EC-4:EC-59|43]=EC++;var EC;Sv1.encode=function(q,K,Y){var z=null,w=[],_=0,$=0,O;while(K>2],O=(H&3)<<4,$=1;break;case 1:w[_++]=YN6[O|H>>4],O=(H&15)<<2,$=2;break;case 2:w[_++]=YN6[O|H>>6],w[_++]=YN6[H&63],$=0;break}if(_>8191)(z||(z=[])).push(String.fromCharCode.apply(String,w)),_=0}if($){if(w[_++]=YN6[O],w[_++]=61,$===1)w[_++]=61}if(z){if(_)z.push(String.fromCharCode.apply(String,w.slice(0,_)));return z.join("")}return String.fromCharCode.apply(String,w.slice(0,_))};var UU4="invalid encoding";Sv1.decode=function(q,K,Y){var z=Y,w=0,_;for(var $=0;$1)break;if((O=pU4[O])===void 0)throw Error(UU4);switch(w){case 0:_=O,w=1;break;case 1:K[Y++]=_<<2|(O&48)>>4,_=O,w=2;break;case 2:K[Y++]=(_&15)<<4|(O&60)>>2,_=O,w=3;break;case 3:K[Y++]=(_&3)<<6|O,w=0;break}}if(w===1)throw Error(UU4);return Y-z};Sv1.test=function(q){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(q)}});var iU4=C((Yo_,lU4)=>{lU4.exports=Cv1;function Cv1(){this._listeners={}}Cv1.prototype.on=function(q,K,Y){return(this._listeners[q]||(this._listeners[q]=[])).push({fn:K,ctx:Y||this}),this};Cv1.prototype.off=function(q,K){if(q===void 0)this._listeners={};else if(K===void 0)this._listeners[q]=[];else{var Y=this._listeners[q];for(var z=0;z{tU4.exports=nU4(nU4);function nU4(A){if(typeof Float32Array<"u")(function(){var q=new Float32Array([-0]),K=new Uint8Array(q.buffer),Y=K[3]===128;function z(O,H,j){q[0]=O,H[j]=K[0],H[j+1]=K[1],H[j+2]=K[2],H[j+3]=K[3]}function w(O,H,j){q[0]=O,H[j]=K[3],H[j+1]=K[2],H[j+2]=K[1],H[j+3]=K[0]}A.writeFloatLE=Y?z:w,A.writeFloatBE=Y?w:z;function _(O,H){return K[0]=O[H],K[1]=O[H+1],K[2]=O[H+2],K[3]=O[H+3],q[0]}function $(O,H){return K[3]=O[H],K[2]=O[H+1],K[1]=O[H+2],K[0]=O[H+3],q[0]}A.readFloatLE=Y?_:$,A.readFloatBE=Y?$:_})();else(function(){function q(Y,z,w,_){var $=z<0?1:0;if($)z=-z;if(z===0)Y(1/z>0?0:2147483648,w,_);else if(isNaN(z))Y(2143289344,w,_);else if(z>340282346638528860000000000000000000000)Y(($<<31|2139095040)>>>0,w,_);else if(z<0.000000000000000000000000000000000000011754943508222875)Y(($<<31|Math.round(z/0.000000000000000000000000000000000000000000001401298464324817))>>>0,w,_);else{var O=Math.floor(Math.log(z)/Math.LN2),H=Math.round(z*Math.pow(2,-O)*8388608)&8388607;Y(($<<31|O+127<<23|H)>>>0,w,_)}}A.writeFloatLE=q.bind(null,rU4),A.writeFloatBE=q.bind(null,oU4);function K(Y,z,w){var _=Y(z,w),$=(_>>31)*2+1,O=_>>>23&255,H=_&8388607;return O===255?H?NaN:$*(1/0):O===0?$*0.000000000000000000000000000000000000000000001401298464324817*H:$*Math.pow(2,O-150)*(H+8388608)}A.readFloatLE=K.bind(null,aU4),A.readFloatBE=K.bind(null,sU4)})();if(typeof Float64Array<"u")(function(){var q=new Float64Array([-0]),K=new Uint8Array(q.buffer),Y=K[7]===128;function z(O,H,j){q[0]=O,H[j]=K[0],H[j+1]=K[1],H[j+2]=K[2],H[j+3]=K[3],H[j+4]=K[4],H[j+5]=K[5],H[j+6]=K[6],H[j+7]=K[7]}function w(O,H,j){q[0]=O,H[j]=K[7],H[j+1]=K[6],H[j+2]=K[5],H[j+3]=K[4],H[j+4]=K[3],H[j+5]=K[2],H[j+6]=K[1],H[j+7]=K[0]}A.writeDoubleLE=Y?z:w,A.writeDoubleBE=Y?w:z;function _(O,H){return K[0]=O[H],K[1]=O[H+1],K[2]=O[H+2],K[3]=O[H+3],K[4]=O[H+4],K[5]=O[H+5],K[6]=O[H+6],K[7]=O[H+7],q[0]}function $(O,H){return K[7]=O[H],K[6]=O[H+1],K[5]=O[H+2],K[4]=O[H+3],K[3]=O[H+4],K[2]=O[H+5],K[1]=O[H+6],K[0]=O[H+7],q[0]}A.readDoubleLE=Y?_:$,A.readDoubleBE=Y?$:_})();else(function(){function q(Y,z,w,_,$,O){var H=_<0?1:0;if(H)_=-_;if(_===0)Y(0,$,O+z),Y(1/_>0?0:2147483648,$,O+w);else if(isNaN(_))Y(0,$,O+z),Y(2146959360,$,O+w);else if(_>179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)Y(0,$,O+z),Y((H<<31|2146435072)>>>0,$,O+w);else{var j;if(_<0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072014)j=_/0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005,Y(j>>>0,$,O+z),Y((H<<31|j/4294967296)>>>0,$,O+w);else{var J=Math.floor(Math.log(_)/Math.LN2);if(J===1024)J=1023;j=_*Math.pow(2,-J),Y(j*4503599627370496>>>0,$,O+z),Y((H<<31|J+1023<<20|j*1048576&1048575)>>>0,$,O+w)}}}A.writeDoubleLE=q.bind(null,rU4,0,4),A.writeDoubleBE=q.bind(null,oU4,4,0);function K(Y,z,w,_,$){var O=Y(_,$+z),H=Y(_,$+w),j=(H>>31)*2+1,J=H>>>20&2047,M=4294967296*(H&1048575)+O;return J===2047?M?NaN:j*(1/0):J===0?j*0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005*M:j*Math.pow(2,J-1075)*(M+4503599627370496)}A.readDoubleLE=K.bind(null,aU4,0,4),A.readDoubleBE=K.bind(null,sU4,4,0)})();return A}function rU4(A,q,K){q[K]=A&255,q[K+1]=A>>>8&255,q[K+2]=A>>>16&255,q[K+3]=A>>>24}function oU4(A,q,K){q[K]=A>>>24,q[K+1]=A>>>16&255,q[K+2]=A>>>8&255,q[K+3]=A&255}function aU4(A,q){return(A[q]|A[q+1]<<8|A[q+2]<<16|A[q+3]<<24)>>>0}function sU4(A,q){return(A[q]<<24|A[q+1]<<16|A[q+2]<<8|A[q+3])>>>0}});var Ap4=C((ni6,tx8)=>{(function(A,q){function K(Y){return Y.default||Y}if(typeof define==="function"&&define.amd)define([],function(){var Y={};return q(Y),K(Y)});else if(typeof ni6==="object"){if(q(ni6),typeof tx8==="object")tx8.exports=K(ni6)}else(function(){var Y={};q(Y),A.Long=K(Y)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:ni6,function(A){Object.defineProperty(A,"__esModule",{value:!0}),A.default=void 0;var q=null;try{q=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function K(g,b,U){this.low=g|0,this.high=b|0,this.unsigned=!!U}K.prototype.__isLong__,Object.defineProperty(K.prototype,"__isLong__",{value:!0});function Y(g){return(g&&g.__isLong__)===!0}function z(g){var b=Math.clz32(g&-g);return g?31-b:b}K.isLong=Y;var w={},_={};function $(g,b){var U,d,l;if(b){if(g>>>=0,l=0<=g&&g<256){if(d=_[g],d)return d}if(U=H(g,0,!0),l)_[g]=U;return U}else{if(g|=0,l=-128<=g&&g<128){if(d=w[g],d)return d}if(U=H(g,g<0?-1:0,!1),l)w[g]=U;return U}}K.fromInt=$;function O(g,b){if(isNaN(g))return b?V:f;if(b){if(g<0)return V;if(g>=W)return h}else{if(g<=-Z)return B;if(g+1>=Z)return R}if(g<0)return O(-g,b).neg();return H(g%P|0,g/P|0,b)}K.fromNumber=O;function H(g,b,U){return new K(g,b,U)}K.fromBits=H;var j=Math.pow;function J(g,b,U){if(g.length===0)throw Error("empty string");if(typeof b==="number")U=b,b=!1;else b=!!b;if(g==="NaN"||g==="Infinity"||g==="+Infinity"||g==="-Infinity")return b?V:f;if(U=U||10,U<2||360)throw Error("interior hyphen");else if(d===0)return J(g.substring(1),b,U).neg();var l=O(j(U,8)),t=f;for(var s=0;s>>0:this.low},x.toNumber=function(){if(this.unsigned)return(this.high>>>0)*P+(this.low>>>0);return this.high*P+(this.low>>>0)},x.toString=function(b){if(b=b||10,b<2||36>>0,q6=G6.toString(b);if(s=Z6,s.isZero())return q6+H6;else{while(q6.length<6)q6="0"+q6;H6=""+q6+H6}}},x.getHighBits=function(){return this.high},x.getHighBitsUnsigned=function(){return this.high>>>0},x.getLowBits=function(){return this.low},x.getLowBitsUnsigned=function(){return this.low>>>0},x.getNumBitsAbs=function(){if(this.isNegative())return this.eq(B)?64:this.neg().getNumBitsAbs();var b=this.high!=0?this.high:this.low;for(var U=31;U>0;U--)if((b&1<>21;if(!b)return!0;if(this.unsigned)return!1;return b===-1&&!(this.low===0&&this.high===-2097152)},x.isZero=function(){return this.high===0&&this.low===0},x.eqz=x.isZero,x.isNegative=function(){return!this.unsigned&&this.high<0},x.isPositive=function(){return this.unsigned||this.high>=0},x.isOdd=function(){return(this.low&1)===1},x.isEven=function(){return(this.low&1)===0},x.equals=function(b){if(!Y(b))b=M(b);if(this.unsigned!==b.unsigned&&this.high>>>31===1&&b.high>>>31===1)return!1;return this.high===b.high&&this.low===b.low},x.eq=x.equals,x.notEquals=function(b){return!this.eq(b)},x.neq=x.notEquals,x.ne=x.notEquals,x.lessThan=function(b){return this.comp(b)<0},x.lt=x.lessThan,x.lessThanOrEqual=function(b){return this.comp(b)<=0},x.lte=x.lessThanOrEqual,x.le=x.lessThanOrEqual,x.greaterThan=function(b){return this.comp(b)>0},x.gt=x.greaterThan,x.greaterThanOrEqual=function(b){return this.comp(b)>=0},x.gte=x.greaterThanOrEqual,x.ge=x.greaterThanOrEqual,x.compare=function(b){if(!Y(b))b=M(b);if(this.eq(b))return 0;var U=this.isNegative(),d=b.isNegative();if(U&&!d)return-1;if(!U&&d)return 1;if(!this.unsigned)return this.sub(b).isNegative()?-1:1;return b.high>>>0>this.high>>>0||b.high===this.high&&b.low>>>0>this.low>>>0?-1:1},x.comp=x.compare,x.negate=function(){if(!this.unsigned&&this.eq(B))return B;return this.not().add(N)},x.neg=x.negate,x.add=function(b){if(!Y(b))b=M(b);var U=this.high>>>16,d=this.high&65535,l=this.low>>>16,t=this.low&65535,s=b.high>>>16,H6=b.high&65535,Z6=b.low>>>16,G6=b.low&65535,q6=0,w6=0,j6=0,_6=0;return _6+=t+G6,j6+=_6>>>16,_6&=65535,j6+=l+Z6,w6+=j6>>>16,j6&=65535,w6+=d+H6,q6+=w6>>>16,w6&=65535,q6+=U+s,q6&=65535,H(j6<<16|_6,q6<<16|w6,this.unsigned)},x.subtract=function(b){if(!Y(b))b=M(b);return this.add(b.neg())},x.sub=x.subtract,x.multiply=function(b){if(this.isZero())return this;if(!Y(b))b=M(b);if(q){var U=q.mul(this.low,this.high,b.low,b.high);return H(U,q.get_high(),this.unsigned)}if(b.isZero())return this.unsigned?V:f;if(this.eq(B))return b.isOdd()?B:f;if(b.eq(B))return this.isOdd()?B:f;if(this.isNegative())if(b.isNegative())return this.neg().mul(b.neg());else return this.neg().mul(b).neg();else if(b.isNegative())return this.mul(b.neg()).neg();if(this.lt(G)&&b.lt(G))return O(this.toNumber()*b.toNumber(),this.unsigned);var d=this.high>>>16,l=this.high&65535,t=this.low>>>16,s=this.low&65535,H6=b.high>>>16,Z6=b.high&65535,G6=b.low>>>16,q6=b.low&65535,w6=0,j6=0,_6=0,k6=0;return k6+=s*q6,_6+=k6>>>16,k6&=65535,_6+=t*q6,j6+=_6>>>16,_6&=65535,_6+=s*G6,j6+=_6>>>16,_6&=65535,j6+=l*q6,w6+=j6>>>16,j6&=65535,j6+=t*G6,w6+=j6>>>16,j6&=65535,j6+=s*Z6,w6+=j6>>>16,j6&=65535,w6+=d*q6+l*G6+t*Z6+s*H6,w6&=65535,H(_6<<16|k6,w6<<16|j6,this.unsigned)},x.mul=x.multiply,x.divide=function(b){if(!Y(b))b=M(b);if(b.isZero())throw Error("division by zero");if(q){if(!this.unsigned&&this.high===-2147483648&&b.low===-1&&b.high===-1)return this;var U=(this.unsigned?q.div_u:q.div_s)(this.low,this.high,b.low,b.high);return H(U,q.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?V:f;var d,l,t;if(!this.unsigned){if(this.eq(B))if(b.eq(N)||b.eq(y))return B;else if(b.eq(B))return N;else{var s=this.shr(1);if(d=s.div(b).shl(1),d.eq(f))return b.isNegative()?N:y;else return l=this.sub(b.mul(d)),t=d.add(l.div(b)),t}else if(b.eq(B))return this.unsigned?V:f;if(this.isNegative()){if(b.isNegative())return this.neg().div(b.neg());return this.neg().div(b).neg()}else if(b.isNegative())return this.div(b.neg()).neg();t=f}else{if(!b.unsigned)b=b.toUnsigned();if(b.gt(this))return V;if(b.gt(this.shru(1)))return v;t=V}l=this;while(l.gte(b)){d=Math.max(1,Math.floor(l.toNumber()/b.toNumber()));var H6=Math.ceil(Math.log(d)/Math.LN2),Z6=H6<=48?1:j(2,H6-48),G6=O(d),q6=G6.mul(b);while(q6.isNegative()||q6.gt(l))d-=Z6,G6=O(d,this.unsigned),q6=G6.mul(b);if(G6.isZero())G6=N;t=t.add(G6),l=l.sub(q6)}return t},x.div=x.divide,x.modulo=function(b){if(!Y(b))b=M(b);if(q){var U=(this.unsigned?q.rem_u:q.rem_s)(this.low,this.high,b.low,b.high);return H(U,q.get_high(),this.unsigned)}return this.sub(this.div(b).mul(b))},x.mod=x.modulo,x.rem=x.modulo,x.not=function(){return H(~this.low,~this.high,this.unsigned)},x.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},x.clz=x.countLeadingZeros,x.countTrailingZeros=function(){return this.low?z(this.low):z(this.high)+32},x.ctz=x.countTrailingZeros,x.and=function(b){if(!Y(b))b=M(b);return H(this.low&b.low,this.high&b.high,this.unsigned)},x.or=function(b){if(!Y(b))b=M(b);return H(this.low|b.low,this.high|b.high,this.unsigned)},x.xor=function(b){if(!Y(b))b=M(b);return H(this.low^b.low,this.high^b.high,this.unsigned)},x.shiftLeft=function(b){if(Y(b))b=b.toInt();if((b&=63)===0)return this;else if(b<32)return H(this.low<>>32-b,this.unsigned);else return H(0,this.low<>>b|this.high<<32-b,this.high>>b,this.unsigned);else return H(this.high>>b-32,this.high>=0?0:-1,this.unsigned)},x.shr=x.shiftRight,x.shiftRightUnsigned=function(b){if(Y(b))b=b.toInt();if((b&=63)===0)return this;if(b<32)return H(this.low>>>b|this.high<<32-b,this.high>>>b,this.unsigned);if(b===32)return H(this.high,0,this.unsigned);return H(this.high>>>b-32,0,this.unsigned)},x.shru=x.shiftRightUnsigned,x.shr_u=x.shiftRightUnsigned,x.rotateLeft=function(b){var U;if(Y(b))b=b.toInt();if((b&=63)===0)return this;if(b===32)return H(this.high,this.low,this.unsigned);if(b<32)return U=32-b,H(this.low<>>U,this.high<>>U,this.unsigned);return b-=32,U=32-b,H(this.high<>>U,this.low<>>U,this.unsigned)},x.rotl=x.rotateLeft,x.rotateRight=function(b){var U;if(Y(b))b=b.toInt();if((b&=63)===0)return this;if(b===32)return H(this.high,this.low,this.unsigned);if(b<32)return U=32-b,H(this.high<>>b,this.low<>>b,this.unsigned);return b-=32,U=32-b,H(this.low<>>b,this.high<>>b,this.unsigned)},x.rotr=x.rotateRight,x.toSigned=function(){if(!this.unsigned)return this;return H(this.low,this.high,!1)},x.toUnsigned=function(){if(this.unsigned)return this;return H(this.low,this.high,!0)},x.toBytes=function(b){return b?this.toBytesLE():this.toBytesBE()},x.toBytesLE=function(){var b=this.high,U=this.low;return[U&255,U>>>8&255,U>>>16&255,U>>>24,b&255,b>>>8&255,b>>>16&255,b>>>24]},x.toBytesBE=function(){var b=this.high,U=this.low;return[b>>>24,b>>>16&255,b>>>8&255,b&255,U>>>24,U>>>16&255,U>>>8&255,U&255]},K.fromBytes=function(b,U,d){return d?K.fromBytesLE(b,U):K.fromBytesBE(b,U)},K.fromBytesLE=function(b,U){return new K(b[0]|b[1]<<8|b[2]<<16|b[3]<<24,b[4]|b[5]<<8|b[6]<<16|b[7]<<24,U)},K.fromBytesBE=function(b,U){return new K(b[4]<<24|b[5]<<16|b[6]<<8|b[7],b[0]<<24|b[1]<<16|b[2]<<8|b[3],U)},typeof BigInt==="function")K.fromBigInt=function(b,U){var d=Number(BigInt.asIntN(32,b)),l=Number(BigInt.asIntN(32,b>>BigInt(32)));return H(d,l,U)},K.fromValue=function(b,U){if(typeof b==="bigint")return K.fromBigInt(b,U);return M(b,U)},x.toBigInt=function(){var b=BigInt(this.low>>>0),U=BigInt(this.unsigned?this.high>>>0:this.high);return U<{ex8.exports=WIY;function WIY(moduleName){try{var mod=moduleName==="long"?Ap4():moduleName==="buffer"?g6("buffer"):moduleName==="fs"?g6("fs"):eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(A){}return null}});var Yp4=C((Kp4)=>{var qu8=Kp4;qu8.length=function(q){var K=0,Y=0;for(var z=0;z191&&O<224)_[$++]=(O&31)<<6|q[K++]&63;else if(O>239&&O<365)O=((O&7)<<18|(q[K++]&63)<<12|(q[K++]&63)<<6|q[K++]&63)-65536,_[$++]=55296+(O>>10),_[$++]=56320+(O&1023);else _[$++]=(O&15)<<12|(q[K++]&63)<<6|q[K++]&63;if($>8191)(w||(w=[])).push(String.fromCharCode.apply(String,_)),$=0}if(w){if($)w.push(String.fromCharCode.apply(String,_.slice(0,$)));return w.join("")}return String.fromCharCode.apply(String,_.slice(0,$))};qu8.write=function(q,K,Y){var z=Y,w,_;for(var $=0;$>6|192,K[Y++]=w&63|128;else if((w&64512)===55296&&((_=q.charCodeAt($+1))&64512)===56320)w=65536+((w&1023)<<10)+(_&1023),++$,K[Y++]=w>>18|240,K[Y++]=w>>12&63|128,K[Y++]=w>>6&63|128,K[Y++]=w&63|128;else K[Y++]=w>>12|224,K[Y++]=w>>6&63|128,K[Y++]=w&63|128;return Y-z}});var wp4=C((_o_,zp4)=>{zp4.exports=ZIY;function ZIY(A,q,K){var Y=K||8192,z=Y>>>1,w=null,_=Y;return function(O){if(O<1||O>z)return A(O);if(_+O>Y)w=A(Y),_=0;var H=q.call(w,_,_+=O);if(_&7)_=(_|7)+1;return H}}});var $p4=C(($o_,_p4)=>{_p4.exports=CP;var ri6=kQ();function CP(A,q){this.lo=A>>>0,this.hi=q>>>0}var Qw6=CP.zero=new CP(0,0);Qw6.toNumber=function(){return 0};Qw6.zzEncode=Qw6.zzDecode=function(){return this};Qw6.length=function(){return 1};var GIY=CP.zeroHash="\x00\x00\x00\x00\x00\x00\x00\x00";CP.fromNumber=function(q){if(q===0)return Qw6;var K=q<0;if(K)q=-q;var Y=q>>>0,z=(q-Y)/4294967296>>>0;if(K){if(z=~z>>>0,Y=~Y>>>0,++Y>4294967295){if(Y=0,++z>4294967295)z=0}}return new CP(Y,z)};CP.from=function(q){if(typeof q==="number")return CP.fromNumber(q);if(ri6.isString(q))if(ri6.Long)q=ri6.Long.fromString(q);else return CP.fromNumber(parseInt(q,10));return q.low||q.high?new CP(q.low>>>0,q.high>>>0):Qw6};CP.prototype.toNumber=function(q){if(!q&&this.hi>>>31){var K=~this.lo+1>>>0,Y=~this.hi>>>0;if(!K)Y=Y+1>>>0;return-(K+Y*4294967296)}return this.lo+this.hi*4294967296};CP.prototype.toLong=function(q){return ri6.Long?new ri6.Long(this.lo|0,this.hi|0,Boolean(q)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(q)}};var f86=String.prototype.charCodeAt;CP.fromHash=function(q){if(q===GIY)return Qw6;return new CP((f86.call(q,0)|f86.call(q,1)<<8|f86.call(q,2)<<16|f86.call(q,3)<<24)>>>0,(f86.call(q,4)|f86.call(q,5)<<8|f86.call(q,6)<<16|f86.call(q,7)<<24)>>>0)};CP.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};CP.prototype.zzEncode=function(){var q=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^q)>>>0,this.lo=(this.lo<<1^q)>>>0,this};CP.prototype.zzDecode=function(){var q=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^q)>>>0,this.hi=(this.hi>>>1^q)>>>0,this};CP.prototype.length=function(){var q=this.lo,K=(this.lo>>>28|this.hi<<4)>>>0,Y=this.hi>>>24;return Y===0?K===0?q<16384?q<128?1:2:q<2097152?3:4:K<16384?K<128?5:6:K<2097152?7:8:Y<128?9:10}});var kQ=C((Ku8)=>{var rq=Ku8;rq.asPromise=sx8();rq.base64=cU4();rq.EventEmitter=iU4();rq.float=eU4();rq.inquire=Au8();rq.utf8=Yp4();rq.pool=wp4();rq.LongBits=$p4();rq.isNode=Boolean(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);rq.global=rq.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Ku8;rq.emptyArray=Object.freeze?Object.freeze([]):[];rq.emptyObject=Object.freeze?Object.freeze({}):{};rq.isInteger=Number.isInteger||function(q){return typeof q==="number"&&isFinite(q)&&Math.floor(q)===q};rq.isString=function(q){return typeof q==="string"||q instanceof String};rq.isObject=function(q){return q&&typeof q==="object"};rq.isset=rq.isSet=function(q,K){var Y=q[K];if(Y!=null&&q.hasOwnProperty(K))return typeof Y!=="object"||(Array.isArray(Y)?Y.length:Object.keys(Y).length)>0;return!1};rq.Buffer=function(){try{var A=rq.inquire("buffer").Buffer;return A.prototype.utf8Write?A:null}catch(q){return null}}();rq._Buffer_from=null;rq._Buffer_allocUnsafe=null;rq.newBuffer=function(q){return typeof q==="number"?rq.Buffer?rq._Buffer_allocUnsafe(q):new rq.Array(q):rq.Buffer?rq._Buffer_from(q):typeof Uint8Array>"u"?q:new Uint8Array(q)};rq.Array=typeof Uint8Array<"u"?Uint8Array:Array;rq.Long=rq.global.dcodeIO&&rq.global.dcodeIO.Long||rq.global.Long||rq.inquire("long");rq.key2Re=/^true|false|0|1$/;rq.key32Re=/^-?(?:0|[1-9][0-9]*)$/;rq.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;rq.longToHash=function(q){return q?rq.LongBits.from(q).toHash():rq.LongBits.zeroHash};rq.longFromHash=function(q,K){var Y=rq.LongBits.fromHash(q);if(rq.Long)return rq.Long.fromBits(Y.lo,Y.hi,K);return Y.toNumber(Boolean(K))};function Op4(A,q,K){for(var Y=Object.keys(q),z=0;z-1;--w)if(K[z[w]]===1&&this[z[w]]!==void 0&&this[z[w]]!==null)return z[w]}};rq.oneOfSetter=function(q){return function(K){for(var Y=0;Y{Dp4.exports=Bz;var LC=kQ(),Yu8,hv1=LC.LongBits,jp4=LC.base64,Jp4=LC.utf8;function oi6(A,q,K){this.fn=A,this.len=q,this.next=void 0,this.val=K}function wu8(){}function fIY(A){this.head=A.head,this.tail=A.tail,this.len=A.len,this.next=A.states}function Bz(){this.len=0,this.head=new oi6(wu8,0,0),this.tail=this.head,this.states=null}var Mp4=function(){return LC.Buffer?function(){return(Bz.create=function(){return new Yu8})()}:function(){return new Bz}};Bz.create=Mp4();Bz.alloc=function(q){return new LC.Array(q)};if(LC.Array!==Array)Bz.alloc=LC.pool(Bz.alloc,LC.Array.prototype.subarray);Bz.prototype._push=function(q,K,Y){return this.tail=this.tail.next=new oi6(q,K,Y),this.len+=K,this};function _u8(A,q,K){q[K]=A&255}function TIY(A,q,K){while(A>127)q[K++]=A&127|128,A>>>=7;q[K]=A}function $u8(A,q){this.len=A,this.next=void 0,this.val=q}$u8.prototype=Object.create(oi6.prototype);$u8.prototype.fn=TIY;Bz.prototype.uint32=function(q){return this.len+=(this.tail=this.tail.next=new $u8((q=q>>>0)<128?1:q<16384?2:q<2097152?3:q<268435456?4:5,q)).len,this};Bz.prototype.int32=function(q){return q<0?this._push(Ou8,10,hv1.fromNumber(q)):this.uint32(q)};Bz.prototype.sint32=function(q){return this.uint32((q<<1^q>>31)>>>0)};function Ou8(A,q,K){while(A.hi)q[K++]=A.lo&127|128,A.lo=(A.lo>>>7|A.hi<<25)>>>0,A.hi>>>=7;while(A.lo>127)q[K++]=A.lo&127|128,A.lo=A.lo>>>7;q[K++]=A.lo}Bz.prototype.uint64=function(q){var K=hv1.from(q);return this._push(Ou8,K.length(),K)};Bz.prototype.int64=Bz.prototype.uint64;Bz.prototype.sint64=function(q){var K=hv1.from(q).zzEncode();return this._push(Ou8,K.length(),K)};Bz.prototype.bool=function(q){return this._push(_u8,1,q?1:0)};function zu8(A,q,K){q[K]=A&255,q[K+1]=A>>>8&255,q[K+2]=A>>>16&255,q[K+3]=A>>>24}Bz.prototype.fixed32=function(q){return this._push(zu8,4,q>>>0)};Bz.prototype.sfixed32=Bz.prototype.fixed32;Bz.prototype.fixed64=function(q){var K=hv1.from(q);return this._push(zu8,4,K.lo)._push(zu8,4,K.hi)};Bz.prototype.sfixed64=Bz.prototype.fixed64;Bz.prototype.float=function(q){return this._push(LC.float.writeFloatLE,4,q)};Bz.prototype.double=function(q){return this._push(LC.float.writeDoubleLE,8,q)};var VIY=LC.Array.prototype.set?function(q,K,Y){K.set(q,Y)}:function(q,K,Y){for(var z=0;z>>0;if(!K)return this._push(_u8,1,0);if(LC.isString(q)){var Y=Bz.alloc(K=jp4.length(q));jp4.decode(q,Y,0),q=Y}return this.uint32(K)._push(VIY,K,q)};Bz.prototype.string=function(q){var K=Jp4.length(q);return K?this.uint32(K)._push(Jp4.write,K,q):this._push(_u8,1,0)};Bz.prototype.fork=function(){return this.states=new fIY(this),this.head=this.tail=new oi6(wu8,0,0),this.len=0,this};Bz.prototype.reset=function(){if(this.states)this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next;else this.head=this.tail=new oi6(wu8,0,0),this.len=0;return this};Bz.prototype.ldelim=function(){var q=this.head,K=this.tail,Y=this.len;if(this.reset().uint32(Y),Y)this.tail.next=q.next,this.tail=K,this.len+=Y;return this};Bz.prototype.finish=function(){var q=this.head.next,K=this.constructor.alloc(this.len),Y=0;while(q)q.fn(q.val,K,Y),Y+=q.len,q=q.next;return K};Bz._configure=function(A){Yu8=A,Bz.create=Mp4(),Yu8._configure()}});var Wp4=C((jo_,Pp4)=>{Pp4.exports=EQ;var Xp4=Iv1();(EQ.prototype=Object.create(Xp4.prototype)).constructor=EQ;var T86=kQ();function EQ(){Xp4.call(this)}EQ._configure=function(){EQ.alloc=T86._Buffer_allocUnsafe,EQ.writeBytesBuffer=T86.Buffer&&T86.Buffer.prototype instanceof Uint8Array&&T86.Buffer.prototype.set.name==="set"?function(q,K,Y){K.set(q,Y)}:function(q,K,Y){if(q.copy)q.copy(K,Y,0,q.length);else for(var z=0;z>>0;if(this.uint32(K),K)this._push(EQ.writeBytesBuffer,K,q);return this};function NIY(A,q,K){if(A.length<40)T86.utf8.write(A,q,K);else if(q.utf8Write)q.utf8Write(A,K);else q.write(A,K)}EQ.prototype.string=function(q){var K=T86.Buffer.byteLength(q);if(this.uint32(K),K)this._push(NIY,K,q);return this};EQ._configure()});var xv1=C((Jo_,Vp4)=>{Vp4.exports=iJ;var Ku=kQ(),ju8,fp4=Ku.LongBits,vIY=Ku.utf8;function Yu(A,q){return RangeError("index out of range: "+A.pos+" + "+(q||1)+" > "+A.len)}function iJ(A){this.buf=A,this.pos=0,this.len=A.length}var Zp4=typeof Uint8Array<"u"?function(q){if(q instanceof Uint8Array||Array.isArray(q))return new iJ(q);throw Error("illegal buffer")}:function(q){if(Array.isArray(q))return new iJ(q);throw Error("illegal buffer")},Tp4=function(){return Ku.Buffer?function(K){return(iJ.create=function(z){return Ku.Buffer.isBuffer(z)?new ju8(z):Zp4(z)})(K)}:Zp4};iJ.create=Tp4();iJ.prototype._slice=Ku.Array.prototype.subarray||Ku.Array.prototype.slice;iJ.prototype.uint32=function(){var q=4294967295;return function(){if(q=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128)return q;if(q=(q|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)return q;if(q=(q|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)return q;if(q=(q|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)return q;if(q=(q|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128)return q;if((this.pos+=5)>this.len)throw this.pos=this.len,Yu(this,10);return q}}();iJ.prototype.int32=function(){return this.uint32()|0};iJ.prototype.sint32=function(){var q=this.uint32();return q>>>1^-(q&1)|0};function Hu8(){var A=new fp4(0,0),q=0;if(this.len-this.pos>4){for(;q<4;++q)if(A.lo=(A.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return A;if(A.lo=(A.lo|(this.buf[this.pos]&127)<<28)>>>0,A.hi=(A.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return A;q=0}else{for(;q<3;++q){if(this.pos>=this.len)throw Yu(this);if(A.lo=(A.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return A}return A.lo=(A.lo|(this.buf[this.pos++]&127)<>>0,A}if(this.len-this.pos>4){for(;q<5;++q)if(A.hi=(A.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return A}else for(;q<5;++q){if(this.pos>=this.len)throw Yu(this);if(A.hi=(A.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return A}throw Error("invalid varint encoding")}iJ.prototype.bool=function(){return this.uint32()!==0};function bv1(A,q){return(A[q-4]|A[q-3]<<8|A[q-2]<<16|A[q-1]<<24)>>>0}iJ.prototype.fixed32=function(){if(this.pos+4>this.len)throw Yu(this,4);return bv1(this.buf,this.pos+=4)};iJ.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Yu(this,4);return bv1(this.buf,this.pos+=4)|0};function Gp4(){if(this.pos+8>this.len)throw Yu(this,8);return new fp4(bv1(this.buf,this.pos+=4),bv1(this.buf,this.pos+=4))}iJ.prototype.float=function(){if(this.pos+4>this.len)throw Yu(this,4);var q=Ku.float.readFloatLE(this.buf,this.pos);return this.pos+=4,q};iJ.prototype.double=function(){if(this.pos+8>this.len)throw Yu(this,4);var q=Ku.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,q};iJ.prototype.bytes=function(){var q=this.uint32(),K=this.pos,Y=this.pos+q;if(Y>this.len)throw Yu(this,q);if(this.pos+=q,Array.isArray(this.buf))return this.buf.slice(K,Y);if(K===Y){var z=Ku.Buffer;return z?z.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,K,Y)};iJ.prototype.string=function(){var q=this.bytes();return vIY.read(q,0,q.length)};iJ.prototype.skip=function(q){if(typeof q==="number"){if(this.pos+q>this.len)throw Yu(this,q);this.pos+=q}else do if(this.pos>=this.len)throw Yu(this);while(this.buf[this.pos++]&128);return this};iJ.prototype.skipType=function(A){switch(A){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:while((A=this.uint32()&7)!==4)this.skipType(A);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+A+" at offset "+this.pos)}return this};iJ._configure=function(A){ju8=A,iJ.create=Tp4(),ju8._configure();var q=Ku.Long?"toLong":"toNumber";Ku.merge(iJ.prototype,{int64:function(){return Hu8.call(this)[q](!1)},uint64:function(){return Hu8.call(this)[q](!0)},sint64:function(){return Hu8.call(this).zzDecode()[q](!1)},fixed64:function(){return Gp4.call(this)[q](!0)},sfixed64:function(){return Gp4.call(this)[q](!1)}})}});var Ep4=C((Mo_,kp4)=>{kp4.exports=Uw6;var vp4=xv1();(Uw6.prototype=Object.create(vp4.prototype)).constructor=Uw6;var Np4=kQ();function Uw6(A){vp4.call(this,A)}Uw6._configure=function(){if(Np4.Buffer)Uw6.prototype._slice=Np4.Buffer.prototype.slice};Uw6.prototype.string=function(){var q=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+q,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+q,this.len))};Uw6._configure()});var yp4=C((Do_,Lp4)=>{Lp4.exports=ai6;var Ju8=kQ();(ai6.prototype=Object.create(Ju8.EventEmitter.prototype)).constructor=ai6;function ai6(A,q,K){if(typeof A!=="function")throw TypeError("rpcImpl must be a function");Ju8.EventEmitter.call(this),this.rpcImpl=A,this.requestDelimited=Boolean(q),this.responseDelimited=Boolean(K)}ai6.prototype.rpcCall=function A(q,K,Y,z,w){if(!z)throw TypeError("request must be specified");var _=this;if(!w)return Ju8.asPromise(A,_,q,K,Y,z);if(!_.rpcImpl){setTimeout(function(){w(Error("already ended"))},0);return}try{return _.rpcImpl(q,K[_.requestDelimited?"encodeDelimited":"encode"](z).finish(),function(O,H){if(O)return _.emit("error",O,q),w(O);if(H===null){_.end(!0);return}if(!(H instanceof Y))try{H=Y[_.responseDelimited?"decodeDelimited":"decode"](H)}catch(j){return _.emit("error",j,q),w(j)}return _.emit("data",H,q),w(null,H)})}catch($){_.emit("error",$,q),setTimeout(function(){w($)},0);return}};ai6.prototype.end=function(q){if(this.rpcImpl){if(!q)this.rpcImpl(null,null,null);this.rpcImpl=null,this.emit("end").off()}return this}});var Mu8=C((Rp4)=>{var kIY=Rp4;kIY.Service=yp4()});var Du8=C((Po_,Sp4)=>{Sp4.exports={}});var Xu8=C((hp4)=>{var Wv=hp4;Wv.build="minimal";Wv.Writer=Iv1();Wv.BufferWriter=Wp4();Wv.Reader=xv1();Wv.BufferReader=Ep4();Wv.util=kQ();Wv.rpc=Mu8();Wv.roots=Du8();Wv.configure=Cp4;function Cp4(){Wv.util._configure(),Wv.Writer._configure(Wv.BufferWriter),Wv.Reader._configure(Wv.BufferReader)}Cp4()});var uv1=C((Ip4,bp4)=>{Object.defineProperty(Ip4,"__esModule",{value:!0});var GK=Xu8(),f8=GK.Reader,f5=GK.Writer,o6=GK.util,c6=GK.roots.default||(GK.roots.default={});c6.opentelemetry=function(){var A={};return A.proto=function(){var q={};return q.common=function(){var K={};return K.v1=function(){var Y={};return Y.AnyValue=function(){function z(_){if(_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}z.prototype.stringValue=null,z.prototype.boolValue=null,z.prototype.intValue=null,z.prototype.doubleValue=null,z.prototype.arrayValue=null,z.prototype.kvlistValue=null,z.prototype.bytesValue=null;var w;return Object.defineProperty(z.prototype,"value",{get:o6.oneOfGetter(w=["stringValue","boolValue","intValue","doubleValue","arrayValue","kvlistValue","bytesValue"]),set:o6.oneOfSetter(w)}),z.create=function($){return new z($)},z.encode=function($,O){if(!O)O=f5.create();if($.stringValue!=null&&Object.hasOwnProperty.call($,"stringValue"))O.uint32(10).string($.stringValue);if($.boolValue!=null&&Object.hasOwnProperty.call($,"boolValue"))O.uint32(16).bool($.boolValue);if($.intValue!=null&&Object.hasOwnProperty.call($,"intValue"))O.uint32(24).int64($.intValue);if($.doubleValue!=null&&Object.hasOwnProperty.call($,"doubleValue"))O.uint32(33).double($.doubleValue);if($.arrayValue!=null&&Object.hasOwnProperty.call($,"arrayValue"))c6.opentelemetry.proto.common.v1.ArrayValue.encode($.arrayValue,O.uint32(42).fork()).ldelim();if($.kvlistValue!=null&&Object.hasOwnProperty.call($,"kvlistValue"))c6.opentelemetry.proto.common.v1.KeyValueList.encode($.kvlistValue,O.uint32(50).fork()).ldelim();if($.bytesValue!=null&&Object.hasOwnProperty.call($,"bytesValue"))O.uint32(58).bytes($.bytesValue);return O},z.encodeDelimited=function($,O){return this.encode($,O).ldelim()},z.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.common.v1.AnyValue;while($.pos>>3){case 1:{J.stringValue=$.string();break}case 2:{J.boolValue=$.bool();break}case 3:{J.intValue=$.int64();break}case 4:{J.doubleValue=$.double();break}case 5:{J.arrayValue=c6.opentelemetry.proto.common.v1.ArrayValue.decode($,$.uint32());break}case 6:{J.kvlistValue=c6.opentelemetry.proto.common.v1.KeyValueList.decode($,$.uint32());break}case 7:{J.bytesValue=$.bytes();break}default:$.skipType(M&7);break}}return J},z.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},z.verify=function($){if(typeof $!=="object"||$===null)return"object expected";var O={};if($.stringValue!=null&&$.hasOwnProperty("stringValue")){if(O.value=1,!o6.isString($.stringValue))return"stringValue: string expected"}if($.boolValue!=null&&$.hasOwnProperty("boolValue")){if(O.value===1)return"value: multiple values";if(O.value=1,typeof $.boolValue!=="boolean")return"boolValue: boolean expected"}if($.intValue!=null&&$.hasOwnProperty("intValue")){if(O.value===1)return"value: multiple values";if(O.value=1,!o6.isInteger($.intValue)&&!($.intValue&&o6.isInteger($.intValue.low)&&o6.isInteger($.intValue.high)))return"intValue: integer|Long expected"}if($.doubleValue!=null&&$.hasOwnProperty("doubleValue")){if(O.value===1)return"value: multiple values";if(O.value=1,typeof $.doubleValue!=="number")return"doubleValue: number expected"}if($.arrayValue!=null&&$.hasOwnProperty("arrayValue")){if(O.value===1)return"value: multiple values";O.value=1;{var H=c6.opentelemetry.proto.common.v1.ArrayValue.verify($.arrayValue);if(H)return"arrayValue."+H}}if($.kvlistValue!=null&&$.hasOwnProperty("kvlistValue")){if(O.value===1)return"value: multiple values";O.value=1;{var H=c6.opentelemetry.proto.common.v1.KeyValueList.verify($.kvlistValue);if(H)return"kvlistValue."+H}}if($.bytesValue!=null&&$.hasOwnProperty("bytesValue")){if(O.value===1)return"value: multiple values";if(O.value=1,!($.bytesValue&&typeof $.bytesValue.length==="number"||o6.isString($.bytesValue)))return"bytesValue: buffer expected"}return null},z.fromObject=function($){if($ instanceof c6.opentelemetry.proto.common.v1.AnyValue)return $;var O=new c6.opentelemetry.proto.common.v1.AnyValue;if($.stringValue!=null)O.stringValue=String($.stringValue);if($.boolValue!=null)O.boolValue=Boolean($.boolValue);if($.intValue!=null){if(o6.Long)(O.intValue=o6.Long.fromValue($.intValue)).unsigned=!1;else if(typeof $.intValue==="string")O.intValue=parseInt($.intValue,10);else if(typeof $.intValue==="number")O.intValue=$.intValue;else if(typeof $.intValue==="object")O.intValue=new o6.LongBits($.intValue.low>>>0,$.intValue.high>>>0).toNumber()}if($.doubleValue!=null)O.doubleValue=Number($.doubleValue);if($.arrayValue!=null){if(typeof $.arrayValue!=="object")throw TypeError(".opentelemetry.proto.common.v1.AnyValue.arrayValue: object expected");O.arrayValue=c6.opentelemetry.proto.common.v1.ArrayValue.fromObject($.arrayValue)}if($.kvlistValue!=null){if(typeof $.kvlistValue!=="object")throw TypeError(".opentelemetry.proto.common.v1.AnyValue.kvlistValue: object expected");O.kvlistValue=c6.opentelemetry.proto.common.v1.KeyValueList.fromObject($.kvlistValue)}if($.bytesValue!=null){if(typeof $.bytesValue==="string")o6.base64.decode($.bytesValue,O.bytesValue=o6.newBuffer(o6.base64.length($.bytesValue)),0);else if($.bytesValue.length>=0)O.bytesValue=$.bytesValue}return O},z.toObject=function($,O){if(!O)O={};var H={};if($.stringValue!=null&&$.hasOwnProperty("stringValue")){if(H.stringValue=$.stringValue,O.oneofs)H.value="stringValue"}if($.boolValue!=null&&$.hasOwnProperty("boolValue")){if(H.boolValue=$.boolValue,O.oneofs)H.value="boolValue"}if($.intValue!=null&&$.hasOwnProperty("intValue")){if(typeof $.intValue==="number")H.intValue=O.longs===String?String($.intValue):$.intValue;else H.intValue=O.longs===String?o6.Long.prototype.toString.call($.intValue):O.longs===Number?new o6.LongBits($.intValue.low>>>0,$.intValue.high>>>0).toNumber():$.intValue;if(O.oneofs)H.value="intValue"}if($.doubleValue!=null&&$.hasOwnProperty("doubleValue")){if(H.doubleValue=O.json&&!isFinite($.doubleValue)?String($.doubleValue):$.doubleValue,O.oneofs)H.value="doubleValue"}if($.arrayValue!=null&&$.hasOwnProperty("arrayValue")){if(H.arrayValue=c6.opentelemetry.proto.common.v1.ArrayValue.toObject($.arrayValue,O),O.oneofs)H.value="arrayValue"}if($.kvlistValue!=null&&$.hasOwnProperty("kvlistValue")){if(H.kvlistValue=c6.opentelemetry.proto.common.v1.KeyValueList.toObject($.kvlistValue,O),O.oneofs)H.value="kvlistValue"}if($.bytesValue!=null&&$.hasOwnProperty("bytesValue")){if(H.bytesValue=O.bytes===String?o6.base64.encode($.bytesValue,0,$.bytesValue.length):O.bytes===Array?Array.prototype.slice.call($.bytesValue):$.bytesValue,O.oneofs)H.value="bytesValue"}return H},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.common.v1.AnyValue"},z}(),Y.ArrayValue=function(){function z(w){if(this.values=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.values=o6.emptyArray,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.values!=null&&_.values.length)for(var O=0;O<_.values.length;++O)c6.opentelemetry.proto.common.v1.AnyValue.encode(_.values[O],$.uint32(10).fork()).ldelim();return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.common.v1.ArrayValue;while(_.pos>>3){case 1:{if(!(j.values&&j.values.length))j.values=[];j.values.push(c6.opentelemetry.proto.common.v1.AnyValue.decode(_,_.uint32()));break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.values!=null&&_.hasOwnProperty("values")){if(!Array.isArray(_.values))return"values: array expected";for(var $=0;$<_.values.length;++$){var O=c6.opentelemetry.proto.common.v1.AnyValue.verify(_.values[$]);if(O)return"values."+O}}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.common.v1.ArrayValue)return _;var $=new c6.opentelemetry.proto.common.v1.ArrayValue;if(_.values){if(!Array.isArray(_.values))throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: array expected");$.values=[];for(var O=0;O<_.values.length;++O){if(typeof _.values[O]!=="object")throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: object expected");$.values[O]=c6.opentelemetry.proto.common.v1.AnyValue.fromObject(_.values[O])}}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.values=[];if(_.values&&_.values.length){O.values=[];for(var H=0;H<_.values.length;++H)O.values[H]=c6.opentelemetry.proto.common.v1.AnyValue.toObject(_.values[H],$)}return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.common.v1.ArrayValue"},z}(),Y.KeyValueList=function(){function z(w){if(this.values=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.values=o6.emptyArray,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.values!=null&&_.values.length)for(var O=0;O<_.values.length;++O)c6.opentelemetry.proto.common.v1.KeyValue.encode(_.values[O],$.uint32(10).fork()).ldelim();return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.common.v1.KeyValueList;while(_.pos>>3){case 1:{if(!(j.values&&j.values.length))j.values=[];j.values.push(c6.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.values!=null&&_.hasOwnProperty("values")){if(!Array.isArray(_.values))return"values: array expected";for(var $=0;$<_.values.length;++$){var O=c6.opentelemetry.proto.common.v1.KeyValue.verify(_.values[$]);if(O)return"values."+O}}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.common.v1.KeyValueList)return _;var $=new c6.opentelemetry.proto.common.v1.KeyValueList;if(_.values){if(!Array.isArray(_.values))throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: array expected");$.values=[];for(var O=0;O<_.values.length;++O){if(typeof _.values[O]!=="object")throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: object expected");$.values[O]=c6.opentelemetry.proto.common.v1.KeyValue.fromObject(_.values[O])}}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.values=[];if(_.values&&_.values.length){O.values=[];for(var H=0;H<_.values.length;++H)O.values[H]=c6.opentelemetry.proto.common.v1.KeyValue.toObject(_.values[H],$)}return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.common.v1.KeyValueList"},z}(),Y.KeyValue=function(){function z(w){if(w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.key=null,z.prototype.value=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.key!=null&&Object.hasOwnProperty.call(_,"key"))$.uint32(10).string(_.key);if(_.value!=null&&Object.hasOwnProperty.call(_,"value"))c6.opentelemetry.proto.common.v1.AnyValue.encode(_.value,$.uint32(18).fork()).ldelim();return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.common.v1.KeyValue;while(_.pos>>3){case 1:{j.key=_.string();break}case 2:{j.value=c6.opentelemetry.proto.common.v1.AnyValue.decode(_,_.uint32());break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.key!=null&&_.hasOwnProperty("key")){if(!o6.isString(_.key))return"key: string expected"}if(_.value!=null&&_.hasOwnProperty("value")){var $=c6.opentelemetry.proto.common.v1.AnyValue.verify(_.value);if($)return"value."+$}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.common.v1.KeyValue)return _;var $=new c6.opentelemetry.proto.common.v1.KeyValue;if(_.key!=null)$.key=String(_.key);if(_.value!=null){if(typeof _.value!=="object")throw TypeError(".opentelemetry.proto.common.v1.KeyValue.value: object expected");$.value=c6.opentelemetry.proto.common.v1.AnyValue.fromObject(_.value)}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.defaults)O.key="",O.value=null;if(_.key!=null&&_.hasOwnProperty("key"))O.key=_.key;if(_.value!=null&&_.hasOwnProperty("value"))O.value=c6.opentelemetry.proto.common.v1.AnyValue.toObject(_.value,$);return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.common.v1.KeyValue"},z}(),Y.InstrumentationScope=function(){function z(w){if(this.attributes=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.name=null,z.prototype.version=null,z.prototype.attributes=o6.emptyArray,z.prototype.droppedAttributesCount=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.name!=null&&Object.hasOwnProperty.call(_,"name"))$.uint32(10).string(_.name);if(_.version!=null&&Object.hasOwnProperty.call(_,"version"))$.uint32(18).string(_.version);if(_.attributes!=null&&_.attributes.length)for(var O=0;O<_.attributes.length;++O)c6.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[O],$.uint32(26).fork()).ldelim();if(_.droppedAttributesCount!=null&&Object.hasOwnProperty.call(_,"droppedAttributesCount"))$.uint32(32).uint32(_.droppedAttributesCount);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.common.v1.InstrumentationScope;while(_.pos>>3){case 1:{j.name=_.string();break}case 2:{j.version=_.string();break}case 3:{if(!(j.attributes&&j.attributes.length))j.attributes=[];j.attributes.push(c6.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 4:{j.droppedAttributesCount=_.uint32();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.name!=null&&_.hasOwnProperty("name")){if(!o6.isString(_.name))return"name: string expected"}if(_.version!=null&&_.hasOwnProperty("version")){if(!o6.isString(_.version))return"version: string expected"}if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var $=0;$<_.attributes.length;++$){var O=c6.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[$]);if(O)return"attributes."+O}}if(_.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount")){if(!o6.isInteger(_.droppedAttributesCount))return"droppedAttributesCount: integer expected"}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.common.v1.InstrumentationScope)return _;var $=new c6.opentelemetry.proto.common.v1.InstrumentationScope;if(_.name!=null)$.name=String(_.name);if(_.version!=null)$.version=String(_.version);if(_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: array expected");$.attributes=[];for(var O=0;O<_.attributes.length;++O){if(typeof _.attributes[O]!=="object")throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: object expected");$.attributes[O]=c6.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[O])}}if(_.droppedAttributesCount!=null)$.droppedAttributesCount=_.droppedAttributesCount>>>0;return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.attributes=[];if($.defaults)O.name="",O.version="",O.droppedAttributesCount=0;if(_.name!=null&&_.hasOwnProperty("name"))O.name=_.name;if(_.version!=null&&_.hasOwnProperty("version"))O.version=_.version;if(_.attributes&&_.attributes.length){O.attributes=[];for(var H=0;H<_.attributes.length;++H)O.attributes[H]=c6.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[H],$)}if(_.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount"))O.droppedAttributesCount=_.droppedAttributesCount;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.common.v1.InstrumentationScope"},z}(),Y.EntityRef=function(){function z(w){if(this.idKeys=[],this.descriptionKeys=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.schemaUrl=null,z.prototype.type=null,z.prototype.idKeys=o6.emptyArray,z.prototype.descriptionKeys=o6.emptyArray,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.schemaUrl!=null&&Object.hasOwnProperty.call(_,"schemaUrl"))$.uint32(10).string(_.schemaUrl);if(_.type!=null&&Object.hasOwnProperty.call(_,"type"))$.uint32(18).string(_.type);if(_.idKeys!=null&&_.idKeys.length)for(var O=0;O<_.idKeys.length;++O)$.uint32(26).string(_.idKeys[O]);if(_.descriptionKeys!=null&&_.descriptionKeys.length)for(var O=0;O<_.descriptionKeys.length;++O)$.uint32(34).string(_.descriptionKeys[O]);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.common.v1.EntityRef;while(_.pos>>3){case 1:{j.schemaUrl=_.string();break}case 2:{j.type=_.string();break}case 3:{if(!(j.idKeys&&j.idKeys.length))j.idKeys=[];j.idKeys.push(_.string());break}case 4:{if(!(j.descriptionKeys&&j.descriptionKeys.length))j.descriptionKeys=[];j.descriptionKeys.push(_.string());break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl")){if(!o6.isString(_.schemaUrl))return"schemaUrl: string expected"}if(_.type!=null&&_.hasOwnProperty("type")){if(!o6.isString(_.type))return"type: string expected"}if(_.idKeys!=null&&_.hasOwnProperty("idKeys")){if(!Array.isArray(_.idKeys))return"idKeys: array expected";for(var $=0;$<_.idKeys.length;++$)if(!o6.isString(_.idKeys[$]))return"idKeys: string[] expected"}if(_.descriptionKeys!=null&&_.hasOwnProperty("descriptionKeys")){if(!Array.isArray(_.descriptionKeys))return"descriptionKeys: array expected";for(var $=0;$<_.descriptionKeys.length;++$)if(!o6.isString(_.descriptionKeys[$]))return"descriptionKeys: string[] expected"}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.common.v1.EntityRef)return _;var $=new c6.opentelemetry.proto.common.v1.EntityRef;if(_.schemaUrl!=null)$.schemaUrl=String(_.schemaUrl);if(_.type!=null)$.type=String(_.type);if(_.idKeys){if(!Array.isArray(_.idKeys))throw TypeError(".opentelemetry.proto.common.v1.EntityRef.idKeys: array expected");$.idKeys=[];for(var O=0;O<_.idKeys.length;++O)$.idKeys[O]=String(_.idKeys[O])}if(_.descriptionKeys){if(!Array.isArray(_.descriptionKeys))throw TypeError(".opentelemetry.proto.common.v1.EntityRef.descriptionKeys: array expected");$.descriptionKeys=[];for(var O=0;O<_.descriptionKeys.length;++O)$.descriptionKeys[O]=String(_.descriptionKeys[O])}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.idKeys=[],O.descriptionKeys=[];if($.defaults)O.schemaUrl="",O.type="";if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl"))O.schemaUrl=_.schemaUrl;if(_.type!=null&&_.hasOwnProperty("type"))O.type=_.type;if(_.idKeys&&_.idKeys.length){O.idKeys=[];for(var H=0;H<_.idKeys.length;++H)O.idKeys[H]=_.idKeys[H]}if(_.descriptionKeys&&_.descriptionKeys.length){O.descriptionKeys=[];for(var H=0;H<_.descriptionKeys.length;++H)O.descriptionKeys[H]=_.descriptionKeys[H]}return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.common.v1.EntityRef"},z}(),Y}(),K}(),q.resource=function(){var K={};return K.v1=function(){var Y={};return Y.Resource=function(){function z(w){if(this.attributes=[],this.entityRefs=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.attributes=o6.emptyArray,z.prototype.droppedAttributesCount=null,z.prototype.entityRefs=o6.emptyArray,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.attributes!=null&&_.attributes.length)for(var O=0;O<_.attributes.length;++O)c6.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[O],$.uint32(10).fork()).ldelim();if(_.droppedAttributesCount!=null&&Object.hasOwnProperty.call(_,"droppedAttributesCount"))$.uint32(16).uint32(_.droppedAttributesCount);if(_.entityRefs!=null&&_.entityRefs.length)for(var O=0;O<_.entityRefs.length;++O)c6.opentelemetry.proto.common.v1.EntityRef.encode(_.entityRefs[O],$.uint32(26).fork()).ldelim();return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.resource.v1.Resource;while(_.pos>>3){case 1:{if(!(j.attributes&&j.attributes.length))j.attributes=[];j.attributes.push(c6.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 2:{j.droppedAttributesCount=_.uint32();break}case 3:{if(!(j.entityRefs&&j.entityRefs.length))j.entityRefs=[];j.entityRefs.push(c6.opentelemetry.proto.common.v1.EntityRef.decode(_,_.uint32()));break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var $=0;$<_.attributes.length;++$){var O=c6.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[$]);if(O)return"attributes."+O}}if(_.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount")){if(!o6.isInteger(_.droppedAttributesCount))return"droppedAttributesCount: integer expected"}if(_.entityRefs!=null&&_.hasOwnProperty("entityRefs")){if(!Array.isArray(_.entityRefs))return"entityRefs: array expected";for(var $=0;$<_.entityRefs.length;++$){var O=c6.opentelemetry.proto.common.v1.EntityRef.verify(_.entityRefs[$]);if(O)return"entityRefs."+O}}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.resource.v1.Resource)return _;var $=new c6.opentelemetry.proto.resource.v1.Resource;if(_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: array expected");$.attributes=[];for(var O=0;O<_.attributes.length;++O){if(typeof _.attributes[O]!=="object")throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: object expected");$.attributes[O]=c6.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[O])}}if(_.droppedAttributesCount!=null)$.droppedAttributesCount=_.droppedAttributesCount>>>0;if(_.entityRefs){if(!Array.isArray(_.entityRefs))throw TypeError(".opentelemetry.proto.resource.v1.Resource.entityRefs: array expected");$.entityRefs=[];for(var O=0;O<_.entityRefs.length;++O){if(typeof _.entityRefs[O]!=="object")throw TypeError(".opentelemetry.proto.resource.v1.Resource.entityRefs: object expected");$.entityRefs[O]=c6.opentelemetry.proto.common.v1.EntityRef.fromObject(_.entityRefs[O])}}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.attributes=[],O.entityRefs=[];if($.defaults)O.droppedAttributesCount=0;if(_.attributes&&_.attributes.length){O.attributes=[];for(var H=0;H<_.attributes.length;++H)O.attributes[H]=c6.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[H],$)}if(_.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount"))O.droppedAttributesCount=_.droppedAttributesCount;if(_.entityRefs&&_.entityRefs.length){O.entityRefs=[];for(var H=0;H<_.entityRefs.length;++H)O.entityRefs[H]=c6.opentelemetry.proto.common.v1.EntityRef.toObject(_.entityRefs[H],$)}return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.resource.v1.Resource"},z}(),Y}(),K}(),q.trace=function(){var K={};return K.v1=function(){var Y={};return Y.TracesData=function(){function z(w){if(this.resourceSpans=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.resourceSpans=o6.emptyArray,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.resourceSpans!=null&&_.resourceSpans.length)for(var O=0;O<_.resourceSpans.length;++O)c6.opentelemetry.proto.trace.v1.ResourceSpans.encode(_.resourceSpans[O],$.uint32(10).fork()).ldelim();return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.trace.v1.TracesData;while(_.pos>>3){case 1:{if(!(j.resourceSpans&&j.resourceSpans.length))j.resourceSpans=[];j.resourceSpans.push(c6.opentelemetry.proto.trace.v1.ResourceSpans.decode(_,_.uint32()));break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.resourceSpans!=null&&_.hasOwnProperty("resourceSpans")){if(!Array.isArray(_.resourceSpans))return"resourceSpans: array expected";for(var $=0;$<_.resourceSpans.length;++$){var O=c6.opentelemetry.proto.trace.v1.ResourceSpans.verify(_.resourceSpans[$]);if(O)return"resourceSpans."+O}}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.trace.v1.TracesData)return _;var $=new c6.opentelemetry.proto.trace.v1.TracesData;if(_.resourceSpans){if(!Array.isArray(_.resourceSpans))throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: array expected");$.resourceSpans=[];for(var O=0;O<_.resourceSpans.length;++O){if(typeof _.resourceSpans[O]!=="object")throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: object expected");$.resourceSpans[O]=c6.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(_.resourceSpans[O])}}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.resourceSpans=[];if(_.resourceSpans&&_.resourceSpans.length){O.resourceSpans=[];for(var H=0;H<_.resourceSpans.length;++H)O.resourceSpans[H]=c6.opentelemetry.proto.trace.v1.ResourceSpans.toObject(_.resourceSpans[H],$)}return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.trace.v1.TracesData"},z}(),Y.ResourceSpans=function(){function z(w){if(this.scopeSpans=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.resource=null,z.prototype.scopeSpans=o6.emptyArray,z.prototype.schemaUrl=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.resource!=null&&Object.hasOwnProperty.call(_,"resource"))c6.opentelemetry.proto.resource.v1.Resource.encode(_.resource,$.uint32(10).fork()).ldelim();if(_.scopeSpans!=null&&_.scopeSpans.length)for(var O=0;O<_.scopeSpans.length;++O)c6.opentelemetry.proto.trace.v1.ScopeSpans.encode(_.scopeSpans[O],$.uint32(18).fork()).ldelim();if(_.schemaUrl!=null&&Object.hasOwnProperty.call(_,"schemaUrl"))$.uint32(26).string(_.schemaUrl);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.trace.v1.ResourceSpans;while(_.pos>>3){case 1:{j.resource=c6.opentelemetry.proto.resource.v1.Resource.decode(_,_.uint32());break}case 2:{if(!(j.scopeSpans&&j.scopeSpans.length))j.scopeSpans=[];j.scopeSpans.push(c6.opentelemetry.proto.trace.v1.ScopeSpans.decode(_,_.uint32()));break}case 3:{j.schemaUrl=_.string();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.resource!=null&&_.hasOwnProperty("resource")){var $=c6.opentelemetry.proto.resource.v1.Resource.verify(_.resource);if($)return"resource."+$}if(_.scopeSpans!=null&&_.hasOwnProperty("scopeSpans")){if(!Array.isArray(_.scopeSpans))return"scopeSpans: array expected";for(var O=0;O<_.scopeSpans.length;++O){var $=c6.opentelemetry.proto.trace.v1.ScopeSpans.verify(_.scopeSpans[O]);if($)return"scopeSpans."+$}}if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl")){if(!o6.isString(_.schemaUrl))return"schemaUrl: string expected"}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.trace.v1.ResourceSpans)return _;var $=new c6.opentelemetry.proto.trace.v1.ResourceSpans;if(_.resource!=null){if(typeof _.resource!=="object")throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.resource: object expected");$.resource=c6.opentelemetry.proto.resource.v1.Resource.fromObject(_.resource)}if(_.scopeSpans){if(!Array.isArray(_.scopeSpans))throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: array expected");$.scopeSpans=[];for(var O=0;O<_.scopeSpans.length;++O){if(typeof _.scopeSpans[O]!=="object")throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: object expected");$.scopeSpans[O]=c6.opentelemetry.proto.trace.v1.ScopeSpans.fromObject(_.scopeSpans[O])}}if(_.schemaUrl!=null)$.schemaUrl=String(_.schemaUrl);return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.scopeSpans=[];if($.defaults)O.resource=null,O.schemaUrl="";if(_.resource!=null&&_.hasOwnProperty("resource"))O.resource=c6.opentelemetry.proto.resource.v1.Resource.toObject(_.resource,$);if(_.scopeSpans&&_.scopeSpans.length){O.scopeSpans=[];for(var H=0;H<_.scopeSpans.length;++H)O.scopeSpans[H]=c6.opentelemetry.proto.trace.v1.ScopeSpans.toObject(_.scopeSpans[H],$)}if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl"))O.schemaUrl=_.schemaUrl;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.trace.v1.ResourceSpans"},z}(),Y.ScopeSpans=function(){function z(w){if(this.spans=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.scope=null,z.prototype.spans=o6.emptyArray,z.prototype.schemaUrl=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.scope!=null&&Object.hasOwnProperty.call(_,"scope"))c6.opentelemetry.proto.common.v1.InstrumentationScope.encode(_.scope,$.uint32(10).fork()).ldelim();if(_.spans!=null&&_.spans.length)for(var O=0;O<_.spans.length;++O)c6.opentelemetry.proto.trace.v1.Span.encode(_.spans[O],$.uint32(18).fork()).ldelim();if(_.schemaUrl!=null&&Object.hasOwnProperty.call(_,"schemaUrl"))$.uint32(26).string(_.schemaUrl);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.trace.v1.ScopeSpans;while(_.pos>>3){case 1:{j.scope=c6.opentelemetry.proto.common.v1.InstrumentationScope.decode(_,_.uint32());break}case 2:{if(!(j.spans&&j.spans.length))j.spans=[];j.spans.push(c6.opentelemetry.proto.trace.v1.Span.decode(_,_.uint32()));break}case 3:{j.schemaUrl=_.string();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.scope!=null&&_.hasOwnProperty("scope")){var $=c6.opentelemetry.proto.common.v1.InstrumentationScope.verify(_.scope);if($)return"scope."+$}if(_.spans!=null&&_.hasOwnProperty("spans")){if(!Array.isArray(_.spans))return"spans: array expected";for(var O=0;O<_.spans.length;++O){var $=c6.opentelemetry.proto.trace.v1.Span.verify(_.spans[O]);if($)return"spans."+$}}if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl")){if(!o6.isString(_.schemaUrl))return"schemaUrl: string expected"}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.trace.v1.ScopeSpans)return _;var $=new c6.opentelemetry.proto.trace.v1.ScopeSpans;if(_.scope!=null){if(typeof _.scope!=="object")throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.scope: object expected");$.scope=c6.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(_.scope)}if(_.spans){if(!Array.isArray(_.spans))throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: array expected");$.spans=[];for(var O=0;O<_.spans.length;++O){if(typeof _.spans[O]!=="object")throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: object expected");$.spans[O]=c6.opentelemetry.proto.trace.v1.Span.fromObject(_.spans[O])}}if(_.schemaUrl!=null)$.schemaUrl=String(_.schemaUrl);return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.spans=[];if($.defaults)O.scope=null,O.schemaUrl="";if(_.scope!=null&&_.hasOwnProperty("scope"))O.scope=c6.opentelemetry.proto.common.v1.InstrumentationScope.toObject(_.scope,$);if(_.spans&&_.spans.length){O.spans=[];for(var H=0;H<_.spans.length;++H)O.spans[H]=c6.opentelemetry.proto.trace.v1.Span.toObject(_.spans[H],$)}if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl"))O.schemaUrl=_.schemaUrl;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.trace.v1.ScopeSpans"},z}(),Y.Span=function(){function z(w){if(this.attributes=[],this.events=[],this.links=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.traceId=null,z.prototype.spanId=null,z.prototype.traceState=null,z.prototype.parentSpanId=null,z.prototype.flags=null,z.prototype.name=null,z.prototype.kind=null,z.prototype.startTimeUnixNano=null,z.prototype.endTimeUnixNano=null,z.prototype.attributes=o6.emptyArray,z.prototype.droppedAttributesCount=null,z.prototype.events=o6.emptyArray,z.prototype.droppedEventsCount=null,z.prototype.links=o6.emptyArray,z.prototype.droppedLinksCount=null,z.prototype.status=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.traceId!=null&&Object.hasOwnProperty.call(_,"traceId"))$.uint32(10).bytes(_.traceId);if(_.spanId!=null&&Object.hasOwnProperty.call(_,"spanId"))$.uint32(18).bytes(_.spanId);if(_.traceState!=null&&Object.hasOwnProperty.call(_,"traceState"))$.uint32(26).string(_.traceState);if(_.parentSpanId!=null&&Object.hasOwnProperty.call(_,"parentSpanId"))$.uint32(34).bytes(_.parentSpanId);if(_.name!=null&&Object.hasOwnProperty.call(_,"name"))$.uint32(42).string(_.name);if(_.kind!=null&&Object.hasOwnProperty.call(_,"kind"))$.uint32(48).int32(_.kind);if(_.startTimeUnixNano!=null&&Object.hasOwnProperty.call(_,"startTimeUnixNano"))$.uint32(57).fixed64(_.startTimeUnixNano);if(_.endTimeUnixNano!=null&&Object.hasOwnProperty.call(_,"endTimeUnixNano"))$.uint32(65).fixed64(_.endTimeUnixNano);if(_.attributes!=null&&_.attributes.length)for(var O=0;O<_.attributes.length;++O)c6.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[O],$.uint32(74).fork()).ldelim();if(_.droppedAttributesCount!=null&&Object.hasOwnProperty.call(_,"droppedAttributesCount"))$.uint32(80).uint32(_.droppedAttributesCount);if(_.events!=null&&_.events.length)for(var O=0;O<_.events.length;++O)c6.opentelemetry.proto.trace.v1.Span.Event.encode(_.events[O],$.uint32(90).fork()).ldelim();if(_.droppedEventsCount!=null&&Object.hasOwnProperty.call(_,"droppedEventsCount"))$.uint32(96).uint32(_.droppedEventsCount);if(_.links!=null&&_.links.length)for(var O=0;O<_.links.length;++O)c6.opentelemetry.proto.trace.v1.Span.Link.encode(_.links[O],$.uint32(106).fork()).ldelim();if(_.droppedLinksCount!=null&&Object.hasOwnProperty.call(_,"droppedLinksCount"))$.uint32(112).uint32(_.droppedLinksCount);if(_.status!=null&&Object.hasOwnProperty.call(_,"status"))c6.opentelemetry.proto.trace.v1.Status.encode(_.status,$.uint32(122).fork()).ldelim();if(_.flags!=null&&Object.hasOwnProperty.call(_,"flags"))$.uint32(133).fixed32(_.flags);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.trace.v1.Span;while(_.pos>>3){case 1:{j.traceId=_.bytes();break}case 2:{j.spanId=_.bytes();break}case 3:{j.traceState=_.string();break}case 4:{j.parentSpanId=_.bytes();break}case 16:{j.flags=_.fixed32();break}case 5:{j.name=_.string();break}case 6:{j.kind=_.int32();break}case 7:{j.startTimeUnixNano=_.fixed64();break}case 8:{j.endTimeUnixNano=_.fixed64();break}case 9:{if(!(j.attributes&&j.attributes.length))j.attributes=[];j.attributes.push(c6.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 10:{j.droppedAttributesCount=_.uint32();break}case 11:{if(!(j.events&&j.events.length))j.events=[];j.events.push(c6.opentelemetry.proto.trace.v1.Span.Event.decode(_,_.uint32()));break}case 12:{j.droppedEventsCount=_.uint32();break}case 13:{if(!(j.links&&j.links.length))j.links=[];j.links.push(c6.opentelemetry.proto.trace.v1.Span.Link.decode(_,_.uint32()));break}case 14:{j.droppedLinksCount=_.uint32();break}case 15:{j.status=c6.opentelemetry.proto.trace.v1.Status.decode(_,_.uint32());break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.traceId!=null&&_.hasOwnProperty("traceId")){if(!(_.traceId&&typeof _.traceId.length==="number"||o6.isString(_.traceId)))return"traceId: buffer expected"}if(_.spanId!=null&&_.hasOwnProperty("spanId")){if(!(_.spanId&&typeof _.spanId.length==="number"||o6.isString(_.spanId)))return"spanId: buffer expected"}if(_.traceState!=null&&_.hasOwnProperty("traceState")){if(!o6.isString(_.traceState))return"traceState: string expected"}if(_.parentSpanId!=null&&_.hasOwnProperty("parentSpanId")){if(!(_.parentSpanId&&typeof _.parentSpanId.length==="number"||o6.isString(_.parentSpanId)))return"parentSpanId: buffer expected"}if(_.flags!=null&&_.hasOwnProperty("flags")){if(!o6.isInteger(_.flags))return"flags: integer expected"}if(_.name!=null&&_.hasOwnProperty("name")){if(!o6.isString(_.name))return"name: string expected"}if(_.kind!=null&&_.hasOwnProperty("kind"))switch(_.kind){default:return"kind: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:break}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")){if(!o6.isInteger(_.startTimeUnixNano)&&!(_.startTimeUnixNano&&o6.isInteger(_.startTimeUnixNano.low)&&o6.isInteger(_.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected"}if(_.endTimeUnixNano!=null&&_.hasOwnProperty("endTimeUnixNano")){if(!o6.isInteger(_.endTimeUnixNano)&&!(_.endTimeUnixNano&&o6.isInteger(_.endTimeUnixNano.low)&&o6.isInteger(_.endTimeUnixNano.high)))return"endTimeUnixNano: integer|Long expected"}if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var $=0;$<_.attributes.length;++$){var O=c6.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[$]);if(O)return"attributes."+O}}if(_.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount")){if(!o6.isInteger(_.droppedAttributesCount))return"droppedAttributesCount: integer expected"}if(_.events!=null&&_.hasOwnProperty("events")){if(!Array.isArray(_.events))return"events: array expected";for(var $=0;$<_.events.length;++$){var O=c6.opentelemetry.proto.trace.v1.Span.Event.verify(_.events[$]);if(O)return"events."+O}}if(_.droppedEventsCount!=null&&_.hasOwnProperty("droppedEventsCount")){if(!o6.isInteger(_.droppedEventsCount))return"droppedEventsCount: integer expected"}if(_.links!=null&&_.hasOwnProperty("links")){if(!Array.isArray(_.links))return"links: array expected";for(var $=0;$<_.links.length;++$){var O=c6.opentelemetry.proto.trace.v1.Span.Link.verify(_.links[$]);if(O)return"links."+O}}if(_.droppedLinksCount!=null&&_.hasOwnProperty("droppedLinksCount")){if(!o6.isInteger(_.droppedLinksCount))return"droppedLinksCount: integer expected"}if(_.status!=null&&_.hasOwnProperty("status")){var O=c6.opentelemetry.proto.trace.v1.Status.verify(_.status);if(O)return"status."+O}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.trace.v1.Span)return _;var $=new c6.opentelemetry.proto.trace.v1.Span;if(_.traceId!=null){if(typeof _.traceId==="string")o6.base64.decode(_.traceId,$.traceId=o6.newBuffer(o6.base64.length(_.traceId)),0);else if(_.traceId.length>=0)$.traceId=_.traceId}if(_.spanId!=null){if(typeof _.spanId==="string")o6.base64.decode(_.spanId,$.spanId=o6.newBuffer(o6.base64.length(_.spanId)),0);else if(_.spanId.length>=0)$.spanId=_.spanId}if(_.traceState!=null)$.traceState=String(_.traceState);if(_.parentSpanId!=null){if(typeof _.parentSpanId==="string")o6.base64.decode(_.parentSpanId,$.parentSpanId=o6.newBuffer(o6.base64.length(_.parentSpanId)),0);else if(_.parentSpanId.length>=0)$.parentSpanId=_.parentSpanId}if(_.flags!=null)$.flags=_.flags>>>0;if(_.name!=null)$.name=String(_.name);switch(_.kind){default:if(typeof _.kind==="number"){$.kind=_.kind;break}break;case"SPAN_KIND_UNSPECIFIED":case 0:$.kind=0;break;case"SPAN_KIND_INTERNAL":case 1:$.kind=1;break;case"SPAN_KIND_SERVER":case 2:$.kind=2;break;case"SPAN_KIND_CLIENT":case 3:$.kind=3;break;case"SPAN_KIND_PRODUCER":case 4:$.kind=4;break;case"SPAN_KIND_CONSUMER":case 5:$.kind=5;break}if(_.startTimeUnixNano!=null){if(o6.Long)($.startTimeUnixNano=o6.Long.fromValue(_.startTimeUnixNano)).unsigned=!1;else if(typeof _.startTimeUnixNano==="string")$.startTimeUnixNano=parseInt(_.startTimeUnixNano,10);else if(typeof _.startTimeUnixNano==="number")$.startTimeUnixNano=_.startTimeUnixNano;else if(typeof _.startTimeUnixNano==="object")$.startTimeUnixNano=new o6.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber()}if(_.endTimeUnixNano!=null){if(o6.Long)($.endTimeUnixNano=o6.Long.fromValue(_.endTimeUnixNano)).unsigned=!1;else if(typeof _.endTimeUnixNano==="string")$.endTimeUnixNano=parseInt(_.endTimeUnixNano,10);else if(typeof _.endTimeUnixNano==="number")$.endTimeUnixNano=_.endTimeUnixNano;else if(typeof _.endTimeUnixNano==="object")$.endTimeUnixNano=new o6.LongBits(_.endTimeUnixNano.low>>>0,_.endTimeUnixNano.high>>>0).toNumber()}if(_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: array expected");$.attributes=[];for(var O=0;O<_.attributes.length;++O){if(typeof _.attributes[O]!=="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: object expected");$.attributes[O]=c6.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[O])}}if(_.droppedAttributesCount!=null)$.droppedAttributesCount=_.droppedAttributesCount>>>0;if(_.events){if(!Array.isArray(_.events))throw TypeError(".opentelemetry.proto.trace.v1.Span.events: array expected");$.events=[];for(var O=0;O<_.events.length;++O){if(typeof _.events[O]!=="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.events: object expected");$.events[O]=c6.opentelemetry.proto.trace.v1.Span.Event.fromObject(_.events[O])}}if(_.droppedEventsCount!=null)$.droppedEventsCount=_.droppedEventsCount>>>0;if(_.links){if(!Array.isArray(_.links))throw TypeError(".opentelemetry.proto.trace.v1.Span.links: array expected");$.links=[];for(var O=0;O<_.links.length;++O){if(typeof _.links[O]!=="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.links: object expected");$.links[O]=c6.opentelemetry.proto.trace.v1.Span.Link.fromObject(_.links[O])}}if(_.droppedLinksCount!=null)$.droppedLinksCount=_.droppedLinksCount>>>0;if(_.status!=null){if(typeof _.status!=="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.status: object expected");$.status=c6.opentelemetry.proto.trace.v1.Status.fromObject(_.status)}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.attributes=[],O.events=[],O.links=[];if($.defaults){if($.bytes===String)O.traceId="";else if(O.traceId=[],$.bytes!==Array)O.traceId=o6.newBuffer(O.traceId);if($.bytes===String)O.spanId="";else if(O.spanId=[],$.bytes!==Array)O.spanId=o6.newBuffer(O.spanId);if(O.traceState="",$.bytes===String)O.parentSpanId="";else if(O.parentSpanId=[],$.bytes!==Array)O.parentSpanId=o6.newBuffer(O.parentSpanId);if(O.name="",O.kind=$.enums===String?"SPAN_KIND_UNSPECIFIED":0,o6.Long){var H=new o6.Long(0,0,!1);O.startTimeUnixNano=$.longs===String?H.toString():$.longs===Number?H.toNumber():H}else O.startTimeUnixNano=$.longs===String?"0":0;if(o6.Long){var H=new o6.Long(0,0,!1);O.endTimeUnixNano=$.longs===String?H.toString():$.longs===Number?H.toNumber():H}else O.endTimeUnixNano=$.longs===String?"0":0;O.droppedAttributesCount=0,O.droppedEventsCount=0,O.droppedLinksCount=0,O.status=null,O.flags=0}if(_.traceId!=null&&_.hasOwnProperty("traceId"))O.traceId=$.bytes===String?o6.base64.encode(_.traceId,0,_.traceId.length):$.bytes===Array?Array.prototype.slice.call(_.traceId):_.traceId;if(_.spanId!=null&&_.hasOwnProperty("spanId"))O.spanId=$.bytes===String?o6.base64.encode(_.spanId,0,_.spanId.length):$.bytes===Array?Array.prototype.slice.call(_.spanId):_.spanId;if(_.traceState!=null&&_.hasOwnProperty("traceState"))O.traceState=_.traceState;if(_.parentSpanId!=null&&_.hasOwnProperty("parentSpanId"))O.parentSpanId=$.bytes===String?o6.base64.encode(_.parentSpanId,0,_.parentSpanId.length):$.bytes===Array?Array.prototype.slice.call(_.parentSpanId):_.parentSpanId;if(_.name!=null&&_.hasOwnProperty("name"))O.name=_.name;if(_.kind!=null&&_.hasOwnProperty("kind"))O.kind=$.enums===String?c6.opentelemetry.proto.trace.v1.Span.SpanKind[_.kind]===void 0?_.kind:c6.opentelemetry.proto.trace.v1.Span.SpanKind[_.kind]:_.kind;if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano"))if(typeof _.startTimeUnixNano==="number")O.startTimeUnixNano=$.longs===String?String(_.startTimeUnixNano):_.startTimeUnixNano;else O.startTimeUnixNano=$.longs===String?o6.Long.prototype.toString.call(_.startTimeUnixNano):$.longs===Number?new o6.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber():_.startTimeUnixNano;if(_.endTimeUnixNano!=null&&_.hasOwnProperty("endTimeUnixNano"))if(typeof _.endTimeUnixNano==="number")O.endTimeUnixNano=$.longs===String?String(_.endTimeUnixNano):_.endTimeUnixNano;else O.endTimeUnixNano=$.longs===String?o6.Long.prototype.toString.call(_.endTimeUnixNano):$.longs===Number?new o6.LongBits(_.endTimeUnixNano.low>>>0,_.endTimeUnixNano.high>>>0).toNumber():_.endTimeUnixNano;if(_.attributes&&_.attributes.length){O.attributes=[];for(var j=0;j<_.attributes.length;++j)O.attributes[j]=c6.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[j],$)}if(_.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount"))O.droppedAttributesCount=_.droppedAttributesCount;if(_.events&&_.events.length){O.events=[];for(var j=0;j<_.events.length;++j)O.events[j]=c6.opentelemetry.proto.trace.v1.Span.Event.toObject(_.events[j],$)}if(_.droppedEventsCount!=null&&_.hasOwnProperty("droppedEventsCount"))O.droppedEventsCount=_.droppedEventsCount;if(_.links&&_.links.length){O.links=[];for(var j=0;j<_.links.length;++j)O.links[j]=c6.opentelemetry.proto.trace.v1.Span.Link.toObject(_.links[j],$)}if(_.droppedLinksCount!=null&&_.hasOwnProperty("droppedLinksCount"))O.droppedLinksCount=_.droppedLinksCount;if(_.status!=null&&_.hasOwnProperty("status"))O.status=c6.opentelemetry.proto.trace.v1.Status.toObject(_.status,$);if(_.flags!=null&&_.hasOwnProperty("flags"))O.flags=_.flags;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.trace.v1.Span"},z.SpanKind=function(){var w={},_=Object.create(w);return _[w[0]="SPAN_KIND_UNSPECIFIED"]=0,_[w[1]="SPAN_KIND_INTERNAL"]=1,_[w[2]="SPAN_KIND_SERVER"]=2,_[w[3]="SPAN_KIND_CLIENT"]=3,_[w[4]="SPAN_KIND_PRODUCER"]=4,_[w[5]="SPAN_KIND_CONSUMER"]=5,_}(),z.Event=function(){function w(_){if(this.attributes=[],_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}return w.prototype.timeUnixNano=null,w.prototype.name=null,w.prototype.attributes=o6.emptyArray,w.prototype.droppedAttributesCount=null,w.create=function($){return new w($)},w.encode=function($,O){if(!O)O=f5.create();if($.timeUnixNano!=null&&Object.hasOwnProperty.call($,"timeUnixNano"))O.uint32(9).fixed64($.timeUnixNano);if($.name!=null&&Object.hasOwnProperty.call($,"name"))O.uint32(18).string($.name);if($.attributes!=null&&$.attributes.length)for(var H=0;H<$.attributes.length;++H)c6.opentelemetry.proto.common.v1.KeyValue.encode($.attributes[H],O.uint32(26).fork()).ldelim();if($.droppedAttributesCount!=null&&Object.hasOwnProperty.call($,"droppedAttributesCount"))O.uint32(32).uint32($.droppedAttributesCount);return O},w.encodeDelimited=function($,O){return this.encode($,O).ldelim()},w.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.trace.v1.Span.Event;while($.pos>>3){case 1:{J.timeUnixNano=$.fixed64();break}case 2:{J.name=$.string();break}case 3:{if(!(J.attributes&&J.attributes.length))J.attributes=[];J.attributes.push(c6.opentelemetry.proto.common.v1.KeyValue.decode($,$.uint32()));break}case 4:{J.droppedAttributesCount=$.uint32();break}default:$.skipType(M&7);break}}return J},w.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},w.verify=function($){if(typeof $!=="object"||$===null)return"object expected";if($.timeUnixNano!=null&&$.hasOwnProperty("timeUnixNano")){if(!o6.isInteger($.timeUnixNano)&&!($.timeUnixNano&&o6.isInteger($.timeUnixNano.low)&&o6.isInteger($.timeUnixNano.high)))return"timeUnixNano: integer|Long expected"}if($.name!=null&&$.hasOwnProperty("name")){if(!o6.isString($.name))return"name: string expected"}if($.attributes!=null&&$.hasOwnProperty("attributes")){if(!Array.isArray($.attributes))return"attributes: array expected";for(var O=0;O<$.attributes.length;++O){var H=c6.opentelemetry.proto.common.v1.KeyValue.verify($.attributes[O]);if(H)return"attributes."+H}}if($.droppedAttributesCount!=null&&$.hasOwnProperty("droppedAttributesCount")){if(!o6.isInteger($.droppedAttributesCount))return"droppedAttributesCount: integer expected"}return null},w.fromObject=function($){if($ instanceof c6.opentelemetry.proto.trace.v1.Span.Event)return $;var O=new c6.opentelemetry.proto.trace.v1.Span.Event;if($.timeUnixNano!=null){if(o6.Long)(O.timeUnixNano=o6.Long.fromValue($.timeUnixNano)).unsigned=!1;else if(typeof $.timeUnixNano==="string")O.timeUnixNano=parseInt($.timeUnixNano,10);else if(typeof $.timeUnixNano==="number")O.timeUnixNano=$.timeUnixNano;else if(typeof $.timeUnixNano==="object")O.timeUnixNano=new o6.LongBits($.timeUnixNano.low>>>0,$.timeUnixNano.high>>>0).toNumber()}if($.name!=null)O.name=String($.name);if($.attributes){if(!Array.isArray($.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: array expected");O.attributes=[];for(var H=0;H<$.attributes.length;++H){if(typeof $.attributes[H]!=="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: object expected");O.attributes[H]=c6.opentelemetry.proto.common.v1.KeyValue.fromObject($.attributes[H])}}if($.droppedAttributesCount!=null)O.droppedAttributesCount=$.droppedAttributesCount>>>0;return O},w.toObject=function($,O){if(!O)O={};var H={};if(O.arrays||O.defaults)H.attributes=[];if(O.defaults){if(o6.Long){var j=new o6.Long(0,0,!1);H.timeUnixNano=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.timeUnixNano=O.longs===String?"0":0;H.name="",H.droppedAttributesCount=0}if($.timeUnixNano!=null&&$.hasOwnProperty("timeUnixNano"))if(typeof $.timeUnixNano==="number")H.timeUnixNano=O.longs===String?String($.timeUnixNano):$.timeUnixNano;else H.timeUnixNano=O.longs===String?o6.Long.prototype.toString.call($.timeUnixNano):O.longs===Number?new o6.LongBits($.timeUnixNano.low>>>0,$.timeUnixNano.high>>>0).toNumber():$.timeUnixNano;if($.name!=null&&$.hasOwnProperty("name"))H.name=$.name;if($.attributes&&$.attributes.length){H.attributes=[];for(var J=0;J<$.attributes.length;++J)H.attributes[J]=c6.opentelemetry.proto.common.v1.KeyValue.toObject($.attributes[J],O)}if($.droppedAttributesCount!=null&&$.hasOwnProperty("droppedAttributesCount"))H.droppedAttributesCount=$.droppedAttributesCount;return H},w.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},w.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.trace.v1.Span.Event"},w}(),z.Link=function(){function w(_){if(this.attributes=[],_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}return w.prototype.traceId=null,w.prototype.spanId=null,w.prototype.traceState=null,w.prototype.attributes=o6.emptyArray,w.prototype.droppedAttributesCount=null,w.prototype.flags=null,w.create=function($){return new w($)},w.encode=function($,O){if(!O)O=f5.create();if($.traceId!=null&&Object.hasOwnProperty.call($,"traceId"))O.uint32(10).bytes($.traceId);if($.spanId!=null&&Object.hasOwnProperty.call($,"spanId"))O.uint32(18).bytes($.spanId);if($.traceState!=null&&Object.hasOwnProperty.call($,"traceState"))O.uint32(26).string($.traceState);if($.attributes!=null&&$.attributes.length)for(var H=0;H<$.attributes.length;++H)c6.opentelemetry.proto.common.v1.KeyValue.encode($.attributes[H],O.uint32(34).fork()).ldelim();if($.droppedAttributesCount!=null&&Object.hasOwnProperty.call($,"droppedAttributesCount"))O.uint32(40).uint32($.droppedAttributesCount);if($.flags!=null&&Object.hasOwnProperty.call($,"flags"))O.uint32(53).fixed32($.flags);return O},w.encodeDelimited=function($,O){return this.encode($,O).ldelim()},w.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.trace.v1.Span.Link;while($.pos>>3){case 1:{J.traceId=$.bytes();break}case 2:{J.spanId=$.bytes();break}case 3:{J.traceState=$.string();break}case 4:{if(!(J.attributes&&J.attributes.length))J.attributes=[];J.attributes.push(c6.opentelemetry.proto.common.v1.KeyValue.decode($,$.uint32()));break}case 5:{J.droppedAttributesCount=$.uint32();break}case 6:{J.flags=$.fixed32();break}default:$.skipType(M&7);break}}return J},w.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},w.verify=function($){if(typeof $!=="object"||$===null)return"object expected";if($.traceId!=null&&$.hasOwnProperty("traceId")){if(!($.traceId&&typeof $.traceId.length==="number"||o6.isString($.traceId)))return"traceId: buffer expected"}if($.spanId!=null&&$.hasOwnProperty("spanId")){if(!($.spanId&&typeof $.spanId.length==="number"||o6.isString($.spanId)))return"spanId: buffer expected"}if($.traceState!=null&&$.hasOwnProperty("traceState")){if(!o6.isString($.traceState))return"traceState: string expected"}if($.attributes!=null&&$.hasOwnProperty("attributes")){if(!Array.isArray($.attributes))return"attributes: array expected";for(var O=0;O<$.attributes.length;++O){var H=c6.opentelemetry.proto.common.v1.KeyValue.verify($.attributes[O]);if(H)return"attributes."+H}}if($.droppedAttributesCount!=null&&$.hasOwnProperty("droppedAttributesCount")){if(!o6.isInteger($.droppedAttributesCount))return"droppedAttributesCount: integer expected"}if($.flags!=null&&$.hasOwnProperty("flags")){if(!o6.isInteger($.flags))return"flags: integer expected"}return null},w.fromObject=function($){if($ instanceof c6.opentelemetry.proto.trace.v1.Span.Link)return $;var O=new c6.opentelemetry.proto.trace.v1.Span.Link;if($.traceId!=null){if(typeof $.traceId==="string")o6.base64.decode($.traceId,O.traceId=o6.newBuffer(o6.base64.length($.traceId)),0);else if($.traceId.length>=0)O.traceId=$.traceId}if($.spanId!=null){if(typeof $.spanId==="string")o6.base64.decode($.spanId,O.spanId=o6.newBuffer(o6.base64.length($.spanId)),0);else if($.spanId.length>=0)O.spanId=$.spanId}if($.traceState!=null)O.traceState=String($.traceState);if($.attributes){if(!Array.isArray($.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: array expected");O.attributes=[];for(var H=0;H<$.attributes.length;++H){if(typeof $.attributes[H]!=="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: object expected");O.attributes[H]=c6.opentelemetry.proto.common.v1.KeyValue.fromObject($.attributes[H])}}if($.droppedAttributesCount!=null)O.droppedAttributesCount=$.droppedAttributesCount>>>0;if($.flags!=null)O.flags=$.flags>>>0;return O},w.toObject=function($,O){if(!O)O={};var H={};if(O.arrays||O.defaults)H.attributes=[];if(O.defaults){if(O.bytes===String)H.traceId="";else if(H.traceId=[],O.bytes!==Array)H.traceId=o6.newBuffer(H.traceId);if(O.bytes===String)H.spanId="";else if(H.spanId=[],O.bytes!==Array)H.spanId=o6.newBuffer(H.spanId);H.traceState="",H.droppedAttributesCount=0,H.flags=0}if($.traceId!=null&&$.hasOwnProperty("traceId"))H.traceId=O.bytes===String?o6.base64.encode($.traceId,0,$.traceId.length):O.bytes===Array?Array.prototype.slice.call($.traceId):$.traceId;if($.spanId!=null&&$.hasOwnProperty("spanId"))H.spanId=O.bytes===String?o6.base64.encode($.spanId,0,$.spanId.length):O.bytes===Array?Array.prototype.slice.call($.spanId):$.spanId;if($.traceState!=null&&$.hasOwnProperty("traceState"))H.traceState=$.traceState;if($.attributes&&$.attributes.length){H.attributes=[];for(var j=0;j<$.attributes.length;++j)H.attributes[j]=c6.opentelemetry.proto.common.v1.KeyValue.toObject($.attributes[j],O)}if($.droppedAttributesCount!=null&&$.hasOwnProperty("droppedAttributesCount"))H.droppedAttributesCount=$.droppedAttributesCount;if($.flags!=null&&$.hasOwnProperty("flags"))H.flags=$.flags;return H},w.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},w.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.trace.v1.Span.Link"},w}(),z}(),Y.Status=function(){function z(w){if(w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.message=null,z.prototype.code=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.message!=null&&Object.hasOwnProperty.call(_,"message"))$.uint32(18).string(_.message);if(_.code!=null&&Object.hasOwnProperty.call(_,"code"))$.uint32(24).int32(_.code);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.trace.v1.Status;while(_.pos>>3){case 2:{j.message=_.string();break}case 3:{j.code=_.int32();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.message!=null&&_.hasOwnProperty("message")){if(!o6.isString(_.message))return"message: string expected"}if(_.code!=null&&_.hasOwnProperty("code"))switch(_.code){default:return"code: enum value expected";case 0:case 1:case 2:break}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.trace.v1.Status)return _;var $=new c6.opentelemetry.proto.trace.v1.Status;if(_.message!=null)$.message=String(_.message);switch(_.code){default:if(typeof _.code==="number"){$.code=_.code;break}break;case"STATUS_CODE_UNSET":case 0:$.code=0;break;case"STATUS_CODE_OK":case 1:$.code=1;break;case"STATUS_CODE_ERROR":case 2:$.code=2;break}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.defaults)O.message="",O.code=$.enums===String?"STATUS_CODE_UNSET":0;if(_.message!=null&&_.hasOwnProperty("message"))O.message=_.message;if(_.code!=null&&_.hasOwnProperty("code"))O.code=$.enums===String?c6.opentelemetry.proto.trace.v1.Status.StatusCode[_.code]===void 0?_.code:c6.opentelemetry.proto.trace.v1.Status.StatusCode[_.code]:_.code;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.trace.v1.Status"},z.StatusCode=function(){var w={},_=Object.create(w);return _[w[0]="STATUS_CODE_UNSET"]=0,_[w[1]="STATUS_CODE_OK"]=1,_[w[2]="STATUS_CODE_ERROR"]=2,_}(),z}(),Y.SpanFlags=function(){var z={},w=Object.create(z);return w[z[0]="SPAN_FLAGS_DO_NOT_USE"]=0,w[z[255]="SPAN_FLAGS_TRACE_FLAGS_MASK"]=255,w[z[256]="SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK"]=256,w[z[512]="SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK"]=512,w}(),Y}(),K}(),q.collector=function(){var K={};return K.trace=function(){var Y={};return Y.v1=function(){var z={};return z.TraceService=function(){function w(_,$,O){GK.rpc.Service.call(this,_,$,O)}return(w.prototype=Object.create(GK.rpc.Service.prototype)).constructor=w,w.create=function($,O,H){return new this($,O,H)},Object.defineProperty(w.prototype.export=function _($,O){return this.rpcCall(_,c6.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest,c6.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,$,O)},"name",{value:"Export"}),w}(),z.ExportTraceServiceRequest=function(){function w(_){if(this.resourceSpans=[],_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}return w.prototype.resourceSpans=o6.emptyArray,w.create=function($){return new w($)},w.encode=function($,O){if(!O)O=f5.create();if($.resourceSpans!=null&&$.resourceSpans.length)for(var H=0;H<$.resourceSpans.length;++H)c6.opentelemetry.proto.trace.v1.ResourceSpans.encode($.resourceSpans[H],O.uint32(10).fork()).ldelim();return O},w.encodeDelimited=function($,O){return this.encode($,O).ldelim()},w.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;while($.pos>>3){case 1:{if(!(J.resourceSpans&&J.resourceSpans.length))J.resourceSpans=[];J.resourceSpans.push(c6.opentelemetry.proto.trace.v1.ResourceSpans.decode($,$.uint32()));break}default:$.skipType(M&7);break}}return J},w.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},w.verify=function($){if(typeof $!=="object"||$===null)return"object expected";if($.resourceSpans!=null&&$.hasOwnProperty("resourceSpans")){if(!Array.isArray($.resourceSpans))return"resourceSpans: array expected";for(var O=0;O<$.resourceSpans.length;++O){var H=c6.opentelemetry.proto.trace.v1.ResourceSpans.verify($.resourceSpans[O]);if(H)return"resourceSpans."+H}}return null},w.fromObject=function($){if($ instanceof c6.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest)return $;var O=new c6.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;if($.resourceSpans){if(!Array.isArray($.resourceSpans))throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: array expected");O.resourceSpans=[];for(var H=0;H<$.resourceSpans.length;++H){if(typeof $.resourceSpans[H]!=="object")throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: object expected");O.resourceSpans[H]=c6.opentelemetry.proto.trace.v1.ResourceSpans.fromObject($.resourceSpans[H])}}return O},w.toObject=function($,O){if(!O)O={};var H={};if(O.arrays||O.defaults)H.resourceSpans=[];if($.resourceSpans&&$.resourceSpans.length){H.resourceSpans=[];for(var j=0;j<$.resourceSpans.length;++j)H.resourceSpans[j]=c6.opentelemetry.proto.trace.v1.ResourceSpans.toObject($.resourceSpans[j],O)}return H},w.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},w.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"},w}(),z.ExportTraceServiceResponse=function(){function w(_){if(_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}return w.prototype.partialSuccess=null,w.create=function($){return new w($)},w.encode=function($,O){if(!O)O=f5.create();if($.partialSuccess!=null&&Object.hasOwnProperty.call($,"partialSuccess"))c6.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.encode($.partialSuccess,O.uint32(10).fork()).ldelim();return O},w.encodeDelimited=function($,O){return this.encode($,O).ldelim()},w.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;while($.pos>>3){case 1:{J.partialSuccess=c6.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.decode($,$.uint32());break}default:$.skipType(M&7);break}}return J},w.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},w.verify=function($){if(typeof $!=="object"||$===null)return"object expected";if($.partialSuccess!=null&&$.hasOwnProperty("partialSuccess")){var O=c6.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify($.partialSuccess);if(O)return"partialSuccess."+O}return null},w.fromObject=function($){if($ instanceof c6.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse)return $;var O=new c6.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;if($.partialSuccess!=null){if(typeof $.partialSuccess!=="object")throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.partialSuccess: object expected");O.partialSuccess=c6.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.fromObject($.partialSuccess)}return O},w.toObject=function($,O){if(!O)O={};var H={};if(O.defaults)H.partialSuccess=null;if($.partialSuccess!=null&&$.hasOwnProperty("partialSuccess"))H.partialSuccess=c6.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.toObject($.partialSuccess,O);return H},w.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},w.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse"},w}(),z.ExportTracePartialSuccess=function(){function w(_){if(_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}return w.prototype.rejectedSpans=null,w.prototype.errorMessage=null,w.create=function($){return new w($)},w.encode=function($,O){if(!O)O=f5.create();if($.rejectedSpans!=null&&Object.hasOwnProperty.call($,"rejectedSpans"))O.uint32(8).int64($.rejectedSpans);if($.errorMessage!=null&&Object.hasOwnProperty.call($,"errorMessage"))O.uint32(18).string($.errorMessage);return O},w.encodeDelimited=function($,O){return this.encode($,O).ldelim()},w.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;while($.pos>>3){case 1:{J.rejectedSpans=$.int64();break}case 2:{J.errorMessage=$.string();break}default:$.skipType(M&7);break}}return J},w.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},w.verify=function($){if(typeof $!=="object"||$===null)return"object expected";if($.rejectedSpans!=null&&$.hasOwnProperty("rejectedSpans")){if(!o6.isInteger($.rejectedSpans)&&!($.rejectedSpans&&o6.isInteger($.rejectedSpans.low)&&o6.isInteger($.rejectedSpans.high)))return"rejectedSpans: integer|Long expected"}if($.errorMessage!=null&&$.hasOwnProperty("errorMessage")){if(!o6.isString($.errorMessage))return"errorMessage: string expected"}return null},w.fromObject=function($){if($ instanceof c6.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess)return $;var O=new c6.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;if($.rejectedSpans!=null){if(o6.Long)(O.rejectedSpans=o6.Long.fromValue($.rejectedSpans)).unsigned=!1;else if(typeof $.rejectedSpans==="string")O.rejectedSpans=parseInt($.rejectedSpans,10);else if(typeof $.rejectedSpans==="number")O.rejectedSpans=$.rejectedSpans;else if(typeof $.rejectedSpans==="object")O.rejectedSpans=new o6.LongBits($.rejectedSpans.low>>>0,$.rejectedSpans.high>>>0).toNumber()}if($.errorMessage!=null)O.errorMessage=String($.errorMessage);return O},w.toObject=function($,O){if(!O)O={};var H={};if(O.defaults){if(o6.Long){var j=new o6.Long(0,0,!1);H.rejectedSpans=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.rejectedSpans=O.longs===String?"0":0;H.errorMessage=""}if($.rejectedSpans!=null&&$.hasOwnProperty("rejectedSpans"))if(typeof $.rejectedSpans==="number")H.rejectedSpans=O.longs===String?String($.rejectedSpans):$.rejectedSpans;else H.rejectedSpans=O.longs===String?o6.Long.prototype.toString.call($.rejectedSpans):O.longs===Number?new o6.LongBits($.rejectedSpans.low>>>0,$.rejectedSpans.high>>>0).toNumber():$.rejectedSpans;if($.errorMessage!=null&&$.hasOwnProperty("errorMessage"))H.errorMessage=$.errorMessage;return H},w.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},w.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess"},w}(),z}(),Y}(),K.metrics=function(){var Y={};return Y.v1=function(){var z={};return z.MetricsService=function(){function w(_,$,O){GK.rpc.Service.call(this,_,$,O)}return(w.prototype=Object.create(GK.rpc.Service.prototype)).constructor=w,w.create=function($,O,H){return new this($,O,H)},Object.defineProperty(w.prototype.export=function _($,O){return this.rpcCall(_,c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,$,O)},"name",{value:"Export"}),w}(),z.ExportMetricsServiceRequest=function(){function w(_){if(this.resourceMetrics=[],_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}return w.prototype.resourceMetrics=o6.emptyArray,w.create=function($){return new w($)},w.encode=function($,O){if(!O)O=f5.create();if($.resourceMetrics!=null&&$.resourceMetrics.length)for(var H=0;H<$.resourceMetrics.length;++H)c6.opentelemetry.proto.metrics.v1.ResourceMetrics.encode($.resourceMetrics[H],O.uint32(10).fork()).ldelim();return O},w.encodeDelimited=function($,O){return this.encode($,O).ldelim()},w.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;while($.pos>>3){case 1:{if(!(J.resourceMetrics&&J.resourceMetrics.length))J.resourceMetrics=[];J.resourceMetrics.push(c6.opentelemetry.proto.metrics.v1.ResourceMetrics.decode($,$.uint32()));break}default:$.skipType(M&7);break}}return J},w.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},w.verify=function($){if(typeof $!=="object"||$===null)return"object expected";if($.resourceMetrics!=null&&$.hasOwnProperty("resourceMetrics")){if(!Array.isArray($.resourceMetrics))return"resourceMetrics: array expected";for(var O=0;O<$.resourceMetrics.length;++O){var H=c6.opentelemetry.proto.metrics.v1.ResourceMetrics.verify($.resourceMetrics[O]);if(H)return"resourceMetrics."+H}}return null},w.fromObject=function($){if($ instanceof c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest)return $;var O=new c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;if($.resourceMetrics){if(!Array.isArray($.resourceMetrics))throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: array expected");O.resourceMetrics=[];for(var H=0;H<$.resourceMetrics.length;++H){if(typeof $.resourceMetrics[H]!=="object")throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: object expected");O.resourceMetrics[H]=c6.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject($.resourceMetrics[H])}}return O},w.toObject=function($,O){if(!O)O={};var H={};if(O.arrays||O.defaults)H.resourceMetrics=[];if($.resourceMetrics&&$.resourceMetrics.length){H.resourceMetrics=[];for(var j=0;j<$.resourceMetrics.length;++j)H.resourceMetrics[j]=c6.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject($.resourceMetrics[j],O)}return H},w.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},w.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest"},w}(),z.ExportMetricsServiceResponse=function(){function w(_){if(_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}return w.prototype.partialSuccess=null,w.create=function($){return new w($)},w.encode=function($,O){if(!O)O=f5.create();if($.partialSuccess!=null&&Object.hasOwnProperty.call($,"partialSuccess"))c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.encode($.partialSuccess,O.uint32(10).fork()).ldelim();return O},w.encodeDelimited=function($,O){return this.encode($,O).ldelim()},w.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;while($.pos>>3){case 1:{J.partialSuccess=c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.decode($,$.uint32());break}default:$.skipType(M&7);break}}return J},w.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},w.verify=function($){if(typeof $!=="object"||$===null)return"object expected";if($.partialSuccess!=null&&$.hasOwnProperty("partialSuccess")){var O=c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify($.partialSuccess);if(O)return"partialSuccess."+O}return null},w.fromObject=function($){if($ instanceof c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse)return $;var O=new c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;if($.partialSuccess!=null){if(typeof $.partialSuccess!=="object")throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.partialSuccess: object expected");O.partialSuccess=c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.fromObject($.partialSuccess)}return O},w.toObject=function($,O){if(!O)O={};var H={};if(O.defaults)H.partialSuccess=null;if($.partialSuccess!=null&&$.hasOwnProperty("partialSuccess"))H.partialSuccess=c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.toObject($.partialSuccess,O);return H},w.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},w.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse"},w}(),z.ExportMetricsPartialSuccess=function(){function w(_){if(_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}return w.prototype.rejectedDataPoints=null,w.prototype.errorMessage=null,w.create=function($){return new w($)},w.encode=function($,O){if(!O)O=f5.create();if($.rejectedDataPoints!=null&&Object.hasOwnProperty.call($,"rejectedDataPoints"))O.uint32(8).int64($.rejectedDataPoints);if($.errorMessage!=null&&Object.hasOwnProperty.call($,"errorMessage"))O.uint32(18).string($.errorMessage);return O},w.encodeDelimited=function($,O){return this.encode($,O).ldelim()},w.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;while($.pos>>3){case 1:{J.rejectedDataPoints=$.int64();break}case 2:{J.errorMessage=$.string();break}default:$.skipType(M&7);break}}return J},w.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},w.verify=function($){if(typeof $!=="object"||$===null)return"object expected";if($.rejectedDataPoints!=null&&$.hasOwnProperty("rejectedDataPoints")){if(!o6.isInteger($.rejectedDataPoints)&&!($.rejectedDataPoints&&o6.isInteger($.rejectedDataPoints.low)&&o6.isInteger($.rejectedDataPoints.high)))return"rejectedDataPoints: integer|Long expected"}if($.errorMessage!=null&&$.hasOwnProperty("errorMessage")){if(!o6.isString($.errorMessage))return"errorMessage: string expected"}return null},w.fromObject=function($){if($ instanceof c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess)return $;var O=new c6.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;if($.rejectedDataPoints!=null){if(o6.Long)(O.rejectedDataPoints=o6.Long.fromValue($.rejectedDataPoints)).unsigned=!1;else if(typeof $.rejectedDataPoints==="string")O.rejectedDataPoints=parseInt($.rejectedDataPoints,10);else if(typeof $.rejectedDataPoints==="number")O.rejectedDataPoints=$.rejectedDataPoints;else if(typeof $.rejectedDataPoints==="object")O.rejectedDataPoints=new o6.LongBits($.rejectedDataPoints.low>>>0,$.rejectedDataPoints.high>>>0).toNumber()}if($.errorMessage!=null)O.errorMessage=String($.errorMessage);return O},w.toObject=function($,O){if(!O)O={};var H={};if(O.defaults){if(o6.Long){var j=new o6.Long(0,0,!1);H.rejectedDataPoints=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.rejectedDataPoints=O.longs===String?"0":0;H.errorMessage=""}if($.rejectedDataPoints!=null&&$.hasOwnProperty("rejectedDataPoints"))if(typeof $.rejectedDataPoints==="number")H.rejectedDataPoints=O.longs===String?String($.rejectedDataPoints):$.rejectedDataPoints;else H.rejectedDataPoints=O.longs===String?o6.Long.prototype.toString.call($.rejectedDataPoints):O.longs===Number?new o6.LongBits($.rejectedDataPoints.low>>>0,$.rejectedDataPoints.high>>>0).toNumber():$.rejectedDataPoints;if($.errorMessage!=null&&$.hasOwnProperty("errorMessage"))H.errorMessage=$.errorMessage;return H},w.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},w.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess"},w}(),z}(),Y}(),K.logs=function(){var Y={};return Y.v1=function(){var z={};return z.LogsService=function(){function w(_,$,O){GK.rpc.Service.call(this,_,$,O)}return(w.prototype=Object.create(GK.rpc.Service.prototype)).constructor=w,w.create=function($,O,H){return new this($,O,H)},Object.defineProperty(w.prototype.export=function _($,O){return this.rpcCall(_,c6.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,c6.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,$,O)},"name",{value:"Export"}),w}(),z.ExportLogsServiceRequest=function(){function w(_){if(this.resourceLogs=[],_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}return w.prototype.resourceLogs=o6.emptyArray,w.create=function($){return new w($)},w.encode=function($,O){if(!O)O=f5.create();if($.resourceLogs!=null&&$.resourceLogs.length)for(var H=0;H<$.resourceLogs.length;++H)c6.opentelemetry.proto.logs.v1.ResourceLogs.encode($.resourceLogs[H],O.uint32(10).fork()).ldelim();return O},w.encodeDelimited=function($,O){return this.encode($,O).ldelim()},w.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;while($.pos>>3){case 1:{if(!(J.resourceLogs&&J.resourceLogs.length))J.resourceLogs=[];J.resourceLogs.push(c6.opentelemetry.proto.logs.v1.ResourceLogs.decode($,$.uint32()));break}default:$.skipType(M&7);break}}return J},w.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},w.verify=function($){if(typeof $!=="object"||$===null)return"object expected";if($.resourceLogs!=null&&$.hasOwnProperty("resourceLogs")){if(!Array.isArray($.resourceLogs))return"resourceLogs: array expected";for(var O=0;O<$.resourceLogs.length;++O){var H=c6.opentelemetry.proto.logs.v1.ResourceLogs.verify($.resourceLogs[O]);if(H)return"resourceLogs."+H}}return null},w.fromObject=function($){if($ instanceof c6.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest)return $;var O=new c6.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;if($.resourceLogs){if(!Array.isArray($.resourceLogs))throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: array expected");O.resourceLogs=[];for(var H=0;H<$.resourceLogs.length;++H){if(typeof $.resourceLogs[H]!=="object")throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: object expected");O.resourceLogs[H]=c6.opentelemetry.proto.logs.v1.ResourceLogs.fromObject($.resourceLogs[H])}}return O},w.toObject=function($,O){if(!O)O={};var H={};if(O.arrays||O.defaults)H.resourceLogs=[];if($.resourceLogs&&$.resourceLogs.length){H.resourceLogs=[];for(var j=0;j<$.resourceLogs.length;++j)H.resourceLogs[j]=c6.opentelemetry.proto.logs.v1.ResourceLogs.toObject($.resourceLogs[j],O)}return H},w.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},w.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest"},w}(),z.ExportLogsServiceResponse=function(){function w(_){if(_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}return w.prototype.partialSuccess=null,w.create=function($){return new w($)},w.encode=function($,O){if(!O)O=f5.create();if($.partialSuccess!=null&&Object.hasOwnProperty.call($,"partialSuccess"))c6.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.encode($.partialSuccess,O.uint32(10).fork()).ldelim();return O},w.encodeDelimited=function($,O){return this.encode($,O).ldelim()},w.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;while($.pos>>3){case 1:{J.partialSuccess=c6.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.decode($,$.uint32());break}default:$.skipType(M&7);break}}return J},w.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},w.verify=function($){if(typeof $!=="object"||$===null)return"object expected";if($.partialSuccess!=null&&$.hasOwnProperty("partialSuccess")){var O=c6.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify($.partialSuccess);if(O)return"partialSuccess."+O}return null},w.fromObject=function($){if($ instanceof c6.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse)return $;var O=new c6.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;if($.partialSuccess!=null){if(typeof $.partialSuccess!=="object")throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.partialSuccess: object expected");O.partialSuccess=c6.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.fromObject($.partialSuccess)}return O},w.toObject=function($,O){if(!O)O={};var H={};if(O.defaults)H.partialSuccess=null;if($.partialSuccess!=null&&$.hasOwnProperty("partialSuccess"))H.partialSuccess=c6.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.toObject($.partialSuccess,O);return H},w.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},w.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse"},w}(),z.ExportLogsPartialSuccess=function(){function w(_){if(_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}return w.prototype.rejectedLogRecords=null,w.prototype.errorMessage=null,w.create=function($){return new w($)},w.encode=function($,O){if(!O)O=f5.create();if($.rejectedLogRecords!=null&&Object.hasOwnProperty.call($,"rejectedLogRecords"))O.uint32(8).int64($.rejectedLogRecords);if($.errorMessage!=null&&Object.hasOwnProperty.call($,"errorMessage"))O.uint32(18).string($.errorMessage);return O},w.encodeDelimited=function($,O){return this.encode($,O).ldelim()},w.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;while($.pos>>3){case 1:{J.rejectedLogRecords=$.int64();break}case 2:{J.errorMessage=$.string();break}default:$.skipType(M&7);break}}return J},w.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},w.verify=function($){if(typeof $!=="object"||$===null)return"object expected";if($.rejectedLogRecords!=null&&$.hasOwnProperty("rejectedLogRecords")){if(!o6.isInteger($.rejectedLogRecords)&&!($.rejectedLogRecords&&o6.isInteger($.rejectedLogRecords.low)&&o6.isInteger($.rejectedLogRecords.high)))return"rejectedLogRecords: integer|Long expected"}if($.errorMessage!=null&&$.hasOwnProperty("errorMessage")){if(!o6.isString($.errorMessage))return"errorMessage: string expected"}return null},w.fromObject=function($){if($ instanceof c6.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess)return $;var O=new c6.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;if($.rejectedLogRecords!=null){if(o6.Long)(O.rejectedLogRecords=o6.Long.fromValue($.rejectedLogRecords)).unsigned=!1;else if(typeof $.rejectedLogRecords==="string")O.rejectedLogRecords=parseInt($.rejectedLogRecords,10);else if(typeof $.rejectedLogRecords==="number")O.rejectedLogRecords=$.rejectedLogRecords;else if(typeof $.rejectedLogRecords==="object")O.rejectedLogRecords=new o6.LongBits($.rejectedLogRecords.low>>>0,$.rejectedLogRecords.high>>>0).toNumber()}if($.errorMessage!=null)O.errorMessage=String($.errorMessage);return O},w.toObject=function($,O){if(!O)O={};var H={};if(O.defaults){if(o6.Long){var j=new o6.Long(0,0,!1);H.rejectedLogRecords=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.rejectedLogRecords=O.longs===String?"0":0;H.errorMessage=""}if($.rejectedLogRecords!=null&&$.hasOwnProperty("rejectedLogRecords"))if(typeof $.rejectedLogRecords==="number")H.rejectedLogRecords=O.longs===String?String($.rejectedLogRecords):$.rejectedLogRecords;else H.rejectedLogRecords=O.longs===String?o6.Long.prototype.toString.call($.rejectedLogRecords):O.longs===Number?new o6.LongBits($.rejectedLogRecords.low>>>0,$.rejectedLogRecords.high>>>0).toNumber():$.rejectedLogRecords;if($.errorMessage!=null&&$.hasOwnProperty("errorMessage"))H.errorMessage=$.errorMessage;return H},w.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},w.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess"},w}(),z}(),Y}(),K}(),q.metrics=function(){var K={};return K.v1=function(){var Y={};return Y.MetricsData=function(){function z(w){if(this.resourceMetrics=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.resourceMetrics=o6.emptyArray,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.resourceMetrics!=null&&_.resourceMetrics.length)for(var O=0;O<_.resourceMetrics.length;++O)c6.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(_.resourceMetrics[O],$.uint32(10).fork()).ldelim();return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.metrics.v1.MetricsData;while(_.pos>>3){case 1:{if(!(j.resourceMetrics&&j.resourceMetrics.length))j.resourceMetrics=[];j.resourceMetrics.push(c6.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(_,_.uint32()));break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.resourceMetrics!=null&&_.hasOwnProperty("resourceMetrics")){if(!Array.isArray(_.resourceMetrics))return"resourceMetrics: array expected";for(var $=0;$<_.resourceMetrics.length;++$){var O=c6.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(_.resourceMetrics[$]);if(O)return"resourceMetrics."+O}}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.metrics.v1.MetricsData)return _;var $=new c6.opentelemetry.proto.metrics.v1.MetricsData;if(_.resourceMetrics){if(!Array.isArray(_.resourceMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: array expected");$.resourceMetrics=[];for(var O=0;O<_.resourceMetrics.length;++O){if(typeof _.resourceMetrics[O]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: object expected");$.resourceMetrics[O]=c6.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(_.resourceMetrics[O])}}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.resourceMetrics=[];if(_.resourceMetrics&&_.resourceMetrics.length){O.resourceMetrics=[];for(var H=0;H<_.resourceMetrics.length;++H)O.resourceMetrics[H]=c6.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(_.resourceMetrics[H],$)}return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.metrics.v1.MetricsData"},z}(),Y.ResourceMetrics=function(){function z(w){if(this.scopeMetrics=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.resource=null,z.prototype.scopeMetrics=o6.emptyArray,z.prototype.schemaUrl=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.resource!=null&&Object.hasOwnProperty.call(_,"resource"))c6.opentelemetry.proto.resource.v1.Resource.encode(_.resource,$.uint32(10).fork()).ldelim();if(_.scopeMetrics!=null&&_.scopeMetrics.length)for(var O=0;O<_.scopeMetrics.length;++O)c6.opentelemetry.proto.metrics.v1.ScopeMetrics.encode(_.scopeMetrics[O],$.uint32(18).fork()).ldelim();if(_.schemaUrl!=null&&Object.hasOwnProperty.call(_,"schemaUrl"))$.uint32(26).string(_.schemaUrl);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.metrics.v1.ResourceMetrics;while(_.pos>>3){case 1:{j.resource=c6.opentelemetry.proto.resource.v1.Resource.decode(_,_.uint32());break}case 2:{if(!(j.scopeMetrics&&j.scopeMetrics.length))j.scopeMetrics=[];j.scopeMetrics.push(c6.opentelemetry.proto.metrics.v1.ScopeMetrics.decode(_,_.uint32()));break}case 3:{j.schemaUrl=_.string();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.resource!=null&&_.hasOwnProperty("resource")){var $=c6.opentelemetry.proto.resource.v1.Resource.verify(_.resource);if($)return"resource."+$}if(_.scopeMetrics!=null&&_.hasOwnProperty("scopeMetrics")){if(!Array.isArray(_.scopeMetrics))return"scopeMetrics: array expected";for(var O=0;O<_.scopeMetrics.length;++O){var $=c6.opentelemetry.proto.metrics.v1.ScopeMetrics.verify(_.scopeMetrics[O]);if($)return"scopeMetrics."+$}}if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl")){if(!o6.isString(_.schemaUrl))return"schemaUrl: string expected"}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.metrics.v1.ResourceMetrics)return _;var $=new c6.opentelemetry.proto.metrics.v1.ResourceMetrics;if(_.resource!=null){if(typeof _.resource!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.resource: object expected");$.resource=c6.opentelemetry.proto.resource.v1.Resource.fromObject(_.resource)}if(_.scopeMetrics){if(!Array.isArray(_.scopeMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: array expected");$.scopeMetrics=[];for(var O=0;O<_.scopeMetrics.length;++O){if(typeof _.scopeMetrics[O]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: object expected");$.scopeMetrics[O]=c6.opentelemetry.proto.metrics.v1.ScopeMetrics.fromObject(_.scopeMetrics[O])}}if(_.schemaUrl!=null)$.schemaUrl=String(_.schemaUrl);return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.scopeMetrics=[];if($.defaults)O.resource=null,O.schemaUrl="";if(_.resource!=null&&_.hasOwnProperty("resource"))O.resource=c6.opentelemetry.proto.resource.v1.Resource.toObject(_.resource,$);if(_.scopeMetrics&&_.scopeMetrics.length){O.scopeMetrics=[];for(var H=0;H<_.scopeMetrics.length;++H)O.scopeMetrics[H]=c6.opentelemetry.proto.metrics.v1.ScopeMetrics.toObject(_.scopeMetrics[H],$)}if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl"))O.schemaUrl=_.schemaUrl;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.metrics.v1.ResourceMetrics"},z}(),Y.ScopeMetrics=function(){function z(w){if(this.metrics=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.scope=null,z.prototype.metrics=o6.emptyArray,z.prototype.schemaUrl=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.scope!=null&&Object.hasOwnProperty.call(_,"scope"))c6.opentelemetry.proto.common.v1.InstrumentationScope.encode(_.scope,$.uint32(10).fork()).ldelim();if(_.metrics!=null&&_.metrics.length)for(var O=0;O<_.metrics.length;++O)c6.opentelemetry.proto.metrics.v1.Metric.encode(_.metrics[O],$.uint32(18).fork()).ldelim();if(_.schemaUrl!=null&&Object.hasOwnProperty.call(_,"schemaUrl"))$.uint32(26).string(_.schemaUrl);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.metrics.v1.ScopeMetrics;while(_.pos>>3){case 1:{j.scope=c6.opentelemetry.proto.common.v1.InstrumentationScope.decode(_,_.uint32());break}case 2:{if(!(j.metrics&&j.metrics.length))j.metrics=[];j.metrics.push(c6.opentelemetry.proto.metrics.v1.Metric.decode(_,_.uint32()));break}case 3:{j.schemaUrl=_.string();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.scope!=null&&_.hasOwnProperty("scope")){var $=c6.opentelemetry.proto.common.v1.InstrumentationScope.verify(_.scope);if($)return"scope."+$}if(_.metrics!=null&&_.hasOwnProperty("metrics")){if(!Array.isArray(_.metrics))return"metrics: array expected";for(var O=0;O<_.metrics.length;++O){var $=c6.opentelemetry.proto.metrics.v1.Metric.verify(_.metrics[O]);if($)return"metrics."+$}}if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl")){if(!o6.isString(_.schemaUrl))return"schemaUrl: string expected"}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.metrics.v1.ScopeMetrics)return _;var $=new c6.opentelemetry.proto.metrics.v1.ScopeMetrics;if(_.scope!=null){if(typeof _.scope!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.scope: object expected");$.scope=c6.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(_.scope)}if(_.metrics){if(!Array.isArray(_.metrics))throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: array expected");$.metrics=[];for(var O=0;O<_.metrics.length;++O){if(typeof _.metrics[O]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: object expected");$.metrics[O]=c6.opentelemetry.proto.metrics.v1.Metric.fromObject(_.metrics[O])}}if(_.schemaUrl!=null)$.schemaUrl=String(_.schemaUrl);return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.metrics=[];if($.defaults)O.scope=null,O.schemaUrl="";if(_.scope!=null&&_.hasOwnProperty("scope"))O.scope=c6.opentelemetry.proto.common.v1.InstrumentationScope.toObject(_.scope,$);if(_.metrics&&_.metrics.length){O.metrics=[];for(var H=0;H<_.metrics.length;++H)O.metrics[H]=c6.opentelemetry.proto.metrics.v1.Metric.toObject(_.metrics[H],$)}if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl"))O.schemaUrl=_.schemaUrl;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.metrics.v1.ScopeMetrics"},z}(),Y.Metric=function(){function z(_){if(this.metadata=[],_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}z.prototype.name=null,z.prototype.description=null,z.prototype.unit=null,z.prototype.gauge=null,z.prototype.sum=null,z.prototype.histogram=null,z.prototype.exponentialHistogram=null,z.prototype.summary=null,z.prototype.metadata=o6.emptyArray;var w;return Object.defineProperty(z.prototype,"data",{get:o6.oneOfGetter(w=["gauge","sum","histogram","exponentialHistogram","summary"]),set:o6.oneOfSetter(w)}),z.create=function($){return new z($)},z.encode=function($,O){if(!O)O=f5.create();if($.name!=null&&Object.hasOwnProperty.call($,"name"))O.uint32(10).string($.name);if($.description!=null&&Object.hasOwnProperty.call($,"description"))O.uint32(18).string($.description);if($.unit!=null&&Object.hasOwnProperty.call($,"unit"))O.uint32(26).string($.unit);if($.gauge!=null&&Object.hasOwnProperty.call($,"gauge"))c6.opentelemetry.proto.metrics.v1.Gauge.encode($.gauge,O.uint32(42).fork()).ldelim();if($.sum!=null&&Object.hasOwnProperty.call($,"sum"))c6.opentelemetry.proto.metrics.v1.Sum.encode($.sum,O.uint32(58).fork()).ldelim();if($.histogram!=null&&Object.hasOwnProperty.call($,"histogram"))c6.opentelemetry.proto.metrics.v1.Histogram.encode($.histogram,O.uint32(74).fork()).ldelim();if($.exponentialHistogram!=null&&Object.hasOwnProperty.call($,"exponentialHistogram"))c6.opentelemetry.proto.metrics.v1.ExponentialHistogram.encode($.exponentialHistogram,O.uint32(82).fork()).ldelim();if($.summary!=null&&Object.hasOwnProperty.call($,"summary"))c6.opentelemetry.proto.metrics.v1.Summary.encode($.summary,O.uint32(90).fork()).ldelim();if($.metadata!=null&&$.metadata.length)for(var H=0;H<$.metadata.length;++H)c6.opentelemetry.proto.common.v1.KeyValue.encode($.metadata[H],O.uint32(98).fork()).ldelim();return O},z.encodeDelimited=function($,O){return this.encode($,O).ldelim()},z.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.metrics.v1.Metric;while($.pos>>3){case 1:{J.name=$.string();break}case 2:{J.description=$.string();break}case 3:{J.unit=$.string();break}case 5:{J.gauge=c6.opentelemetry.proto.metrics.v1.Gauge.decode($,$.uint32());break}case 7:{J.sum=c6.opentelemetry.proto.metrics.v1.Sum.decode($,$.uint32());break}case 9:{J.histogram=c6.opentelemetry.proto.metrics.v1.Histogram.decode($,$.uint32());break}case 10:{J.exponentialHistogram=c6.opentelemetry.proto.metrics.v1.ExponentialHistogram.decode($,$.uint32());break}case 11:{J.summary=c6.opentelemetry.proto.metrics.v1.Summary.decode($,$.uint32());break}case 12:{if(!(J.metadata&&J.metadata.length))J.metadata=[];J.metadata.push(c6.opentelemetry.proto.common.v1.KeyValue.decode($,$.uint32()));break}default:$.skipType(M&7);break}}return J},z.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},z.verify=function($){if(typeof $!=="object"||$===null)return"object expected";var O={};if($.name!=null&&$.hasOwnProperty("name")){if(!o6.isString($.name))return"name: string expected"}if($.description!=null&&$.hasOwnProperty("description")){if(!o6.isString($.description))return"description: string expected"}if($.unit!=null&&$.hasOwnProperty("unit")){if(!o6.isString($.unit))return"unit: string expected"}if($.gauge!=null&&$.hasOwnProperty("gauge")){O.data=1;{var H=c6.opentelemetry.proto.metrics.v1.Gauge.verify($.gauge);if(H)return"gauge."+H}}if($.sum!=null&&$.hasOwnProperty("sum")){if(O.data===1)return"data: multiple values";O.data=1;{var H=c6.opentelemetry.proto.metrics.v1.Sum.verify($.sum);if(H)return"sum."+H}}if($.histogram!=null&&$.hasOwnProperty("histogram")){if(O.data===1)return"data: multiple values";O.data=1;{var H=c6.opentelemetry.proto.metrics.v1.Histogram.verify($.histogram);if(H)return"histogram."+H}}if($.exponentialHistogram!=null&&$.hasOwnProperty("exponentialHistogram")){if(O.data===1)return"data: multiple values";O.data=1;{var H=c6.opentelemetry.proto.metrics.v1.ExponentialHistogram.verify($.exponentialHistogram);if(H)return"exponentialHistogram."+H}}if($.summary!=null&&$.hasOwnProperty("summary")){if(O.data===1)return"data: multiple values";O.data=1;{var H=c6.opentelemetry.proto.metrics.v1.Summary.verify($.summary);if(H)return"summary."+H}}if($.metadata!=null&&$.hasOwnProperty("metadata")){if(!Array.isArray($.metadata))return"metadata: array expected";for(var j=0;j<$.metadata.length;++j){var H=c6.opentelemetry.proto.common.v1.KeyValue.verify($.metadata[j]);if(H)return"metadata."+H}}return null},z.fromObject=function($){if($ instanceof c6.opentelemetry.proto.metrics.v1.Metric)return $;var O=new c6.opentelemetry.proto.metrics.v1.Metric;if($.name!=null)O.name=String($.name);if($.description!=null)O.description=String($.description);if($.unit!=null)O.unit=String($.unit);if($.gauge!=null){if(typeof $.gauge!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.gauge: object expected");O.gauge=c6.opentelemetry.proto.metrics.v1.Gauge.fromObject($.gauge)}if($.sum!=null){if(typeof $.sum!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.sum: object expected");O.sum=c6.opentelemetry.proto.metrics.v1.Sum.fromObject($.sum)}if($.histogram!=null){if(typeof $.histogram!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.histogram: object expected");O.histogram=c6.opentelemetry.proto.metrics.v1.Histogram.fromObject($.histogram)}if($.exponentialHistogram!=null){if(typeof $.exponentialHistogram!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.exponentialHistogram: object expected");O.exponentialHistogram=c6.opentelemetry.proto.metrics.v1.ExponentialHistogram.fromObject($.exponentialHistogram)}if($.summary!=null){if(typeof $.summary!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.summary: object expected");O.summary=c6.opentelemetry.proto.metrics.v1.Summary.fromObject($.summary)}if($.metadata){if(!Array.isArray($.metadata))throw TypeError(".opentelemetry.proto.metrics.v1.Metric.metadata: array expected");O.metadata=[];for(var H=0;H<$.metadata.length;++H){if(typeof $.metadata[H]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.metadata: object expected");O.metadata[H]=c6.opentelemetry.proto.common.v1.KeyValue.fromObject($.metadata[H])}}return O},z.toObject=function($,O){if(!O)O={};var H={};if(O.arrays||O.defaults)H.metadata=[];if(O.defaults)H.name="",H.description="",H.unit="";if($.name!=null&&$.hasOwnProperty("name"))H.name=$.name;if($.description!=null&&$.hasOwnProperty("description"))H.description=$.description;if($.unit!=null&&$.hasOwnProperty("unit"))H.unit=$.unit;if($.gauge!=null&&$.hasOwnProperty("gauge")){if(H.gauge=c6.opentelemetry.proto.metrics.v1.Gauge.toObject($.gauge,O),O.oneofs)H.data="gauge"}if($.sum!=null&&$.hasOwnProperty("sum")){if(H.sum=c6.opentelemetry.proto.metrics.v1.Sum.toObject($.sum,O),O.oneofs)H.data="sum"}if($.histogram!=null&&$.hasOwnProperty("histogram")){if(H.histogram=c6.opentelemetry.proto.metrics.v1.Histogram.toObject($.histogram,O),O.oneofs)H.data="histogram"}if($.exponentialHistogram!=null&&$.hasOwnProperty("exponentialHistogram")){if(H.exponentialHistogram=c6.opentelemetry.proto.metrics.v1.ExponentialHistogram.toObject($.exponentialHistogram,O),O.oneofs)H.data="exponentialHistogram"}if($.summary!=null&&$.hasOwnProperty("summary")){if(H.summary=c6.opentelemetry.proto.metrics.v1.Summary.toObject($.summary,O),O.oneofs)H.data="summary"}if($.metadata&&$.metadata.length){H.metadata=[];for(var j=0;j<$.metadata.length;++j)H.metadata[j]=c6.opentelemetry.proto.common.v1.KeyValue.toObject($.metadata[j],O)}return H},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.metrics.v1.Metric"},z}(),Y.Gauge=function(){function z(w){if(this.dataPoints=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.dataPoints=o6.emptyArray,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.dataPoints!=null&&_.dataPoints.length)for(var O=0;O<_.dataPoints.length;++O)c6.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(_.dataPoints[O],$.uint32(10).fork()).ldelim();return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.metrics.v1.Gauge;while(_.pos>>3){case 1:{if(!(j.dataPoints&&j.dataPoints.length))j.dataPoints=[];j.dataPoints.push(c6.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(_,_.uint32()));break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.dataPoints!=null&&_.hasOwnProperty("dataPoints")){if(!Array.isArray(_.dataPoints))return"dataPoints: array expected";for(var $=0;$<_.dataPoints.length;++$){var O=c6.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(_.dataPoints[$]);if(O)return"dataPoints."+O}}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.metrics.v1.Gauge)return _;var $=new c6.opentelemetry.proto.metrics.v1.Gauge;if(_.dataPoints){if(!Array.isArray(_.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: array expected");$.dataPoints=[];for(var O=0;O<_.dataPoints.length;++O){if(typeof _.dataPoints[O]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: object expected");$.dataPoints[O]=c6.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(_.dataPoints[O])}}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.dataPoints=[];if(_.dataPoints&&_.dataPoints.length){O.dataPoints=[];for(var H=0;H<_.dataPoints.length;++H)O.dataPoints[H]=c6.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(_.dataPoints[H],$)}return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.metrics.v1.Gauge"},z}(),Y.Sum=function(){function z(w){if(this.dataPoints=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.dataPoints=o6.emptyArray,z.prototype.aggregationTemporality=null,z.prototype.isMonotonic=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.dataPoints!=null&&_.dataPoints.length)for(var O=0;O<_.dataPoints.length;++O)c6.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(_.dataPoints[O],$.uint32(10).fork()).ldelim();if(_.aggregationTemporality!=null&&Object.hasOwnProperty.call(_,"aggregationTemporality"))$.uint32(16).int32(_.aggregationTemporality);if(_.isMonotonic!=null&&Object.hasOwnProperty.call(_,"isMonotonic"))$.uint32(24).bool(_.isMonotonic);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.metrics.v1.Sum;while(_.pos>>3){case 1:{if(!(j.dataPoints&&j.dataPoints.length))j.dataPoints=[];j.dataPoints.push(c6.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(_,_.uint32()));break}case 2:{j.aggregationTemporality=_.int32();break}case 3:{j.isMonotonic=_.bool();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.dataPoints!=null&&_.hasOwnProperty("dataPoints")){if(!Array.isArray(_.dataPoints))return"dataPoints: array expected";for(var $=0;$<_.dataPoints.length;++$){var O=c6.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(_.dataPoints[$]);if(O)return"dataPoints."+O}}if(_.aggregationTemporality!=null&&_.hasOwnProperty("aggregationTemporality"))switch(_.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}if(_.isMonotonic!=null&&_.hasOwnProperty("isMonotonic")){if(typeof _.isMonotonic!=="boolean")return"isMonotonic: boolean expected"}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.metrics.v1.Sum)return _;var $=new c6.opentelemetry.proto.metrics.v1.Sum;if(_.dataPoints){if(!Array.isArray(_.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: array expected");$.dataPoints=[];for(var O=0;O<_.dataPoints.length;++O){if(typeof _.dataPoints[O]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: object expected");$.dataPoints[O]=c6.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(_.dataPoints[O])}}switch(_.aggregationTemporality){default:if(typeof _.aggregationTemporality==="number"){$.aggregationTemporality=_.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:$.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:$.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:$.aggregationTemporality=2;break}if(_.isMonotonic!=null)$.isMonotonic=Boolean(_.isMonotonic);return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.dataPoints=[];if($.defaults)O.aggregationTemporality=$.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0,O.isMonotonic=!1;if(_.dataPoints&&_.dataPoints.length){O.dataPoints=[];for(var H=0;H<_.dataPoints.length;++H)O.dataPoints[H]=c6.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(_.dataPoints[H],$)}if(_.aggregationTemporality!=null&&_.hasOwnProperty("aggregationTemporality"))O.aggregationTemporality=$.enums===String?c6.opentelemetry.proto.metrics.v1.AggregationTemporality[_.aggregationTemporality]===void 0?_.aggregationTemporality:c6.opentelemetry.proto.metrics.v1.AggregationTemporality[_.aggregationTemporality]:_.aggregationTemporality;if(_.isMonotonic!=null&&_.hasOwnProperty("isMonotonic"))O.isMonotonic=_.isMonotonic;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.metrics.v1.Sum"},z}(),Y.Histogram=function(){function z(w){if(this.dataPoints=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.dataPoints=o6.emptyArray,z.prototype.aggregationTemporality=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.dataPoints!=null&&_.dataPoints.length)for(var O=0;O<_.dataPoints.length;++O)c6.opentelemetry.proto.metrics.v1.HistogramDataPoint.encode(_.dataPoints[O],$.uint32(10).fork()).ldelim();if(_.aggregationTemporality!=null&&Object.hasOwnProperty.call(_,"aggregationTemporality"))$.uint32(16).int32(_.aggregationTemporality);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.metrics.v1.Histogram;while(_.pos>>3){case 1:{if(!(j.dataPoints&&j.dataPoints.length))j.dataPoints=[];j.dataPoints.push(c6.opentelemetry.proto.metrics.v1.HistogramDataPoint.decode(_,_.uint32()));break}case 2:{j.aggregationTemporality=_.int32();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.dataPoints!=null&&_.hasOwnProperty("dataPoints")){if(!Array.isArray(_.dataPoints))return"dataPoints: array expected";for(var $=0;$<_.dataPoints.length;++$){var O=c6.opentelemetry.proto.metrics.v1.HistogramDataPoint.verify(_.dataPoints[$]);if(O)return"dataPoints."+O}}if(_.aggregationTemporality!=null&&_.hasOwnProperty("aggregationTemporality"))switch(_.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.metrics.v1.Histogram)return _;var $=new c6.opentelemetry.proto.metrics.v1.Histogram;if(_.dataPoints){if(!Array.isArray(_.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: array expected");$.dataPoints=[];for(var O=0;O<_.dataPoints.length;++O){if(typeof _.dataPoints[O]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: object expected");$.dataPoints[O]=c6.opentelemetry.proto.metrics.v1.HistogramDataPoint.fromObject(_.dataPoints[O])}}switch(_.aggregationTemporality){default:if(typeof _.aggregationTemporality==="number"){$.aggregationTemporality=_.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:$.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:$.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:$.aggregationTemporality=2;break}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.dataPoints=[];if($.defaults)O.aggregationTemporality=$.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0;if(_.dataPoints&&_.dataPoints.length){O.dataPoints=[];for(var H=0;H<_.dataPoints.length;++H)O.dataPoints[H]=c6.opentelemetry.proto.metrics.v1.HistogramDataPoint.toObject(_.dataPoints[H],$)}if(_.aggregationTemporality!=null&&_.hasOwnProperty("aggregationTemporality"))O.aggregationTemporality=$.enums===String?c6.opentelemetry.proto.metrics.v1.AggregationTemporality[_.aggregationTemporality]===void 0?_.aggregationTemporality:c6.opentelemetry.proto.metrics.v1.AggregationTemporality[_.aggregationTemporality]:_.aggregationTemporality;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.metrics.v1.Histogram"},z}(),Y.ExponentialHistogram=function(){function z(w){if(this.dataPoints=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.dataPoints=o6.emptyArray,z.prototype.aggregationTemporality=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.dataPoints!=null&&_.dataPoints.length)for(var O=0;O<_.dataPoints.length;++O)c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.encode(_.dataPoints[O],$.uint32(10).fork()).ldelim();if(_.aggregationTemporality!=null&&Object.hasOwnProperty.call(_,"aggregationTemporality"))$.uint32(16).int32(_.aggregationTemporality);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.metrics.v1.ExponentialHistogram;while(_.pos>>3){case 1:{if(!(j.dataPoints&&j.dataPoints.length))j.dataPoints=[];j.dataPoints.push(c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.decode(_,_.uint32()));break}case 2:{j.aggregationTemporality=_.int32();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.dataPoints!=null&&_.hasOwnProperty("dataPoints")){if(!Array.isArray(_.dataPoints))return"dataPoints: array expected";for(var $=0;$<_.dataPoints.length;++$){var O=c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify(_.dataPoints[$]);if(O)return"dataPoints."+O}}if(_.aggregationTemporality!=null&&_.hasOwnProperty("aggregationTemporality"))switch(_.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.metrics.v1.ExponentialHistogram)return _;var $=new c6.opentelemetry.proto.metrics.v1.ExponentialHistogram;if(_.dataPoints){if(!Array.isArray(_.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: array expected");$.dataPoints=[];for(var O=0;O<_.dataPoints.length;++O){if(typeof _.dataPoints[O]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: object expected");$.dataPoints[O]=c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.fromObject(_.dataPoints[O])}}switch(_.aggregationTemporality){default:if(typeof _.aggregationTemporality==="number"){$.aggregationTemporality=_.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:$.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:$.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:$.aggregationTemporality=2;break}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.dataPoints=[];if($.defaults)O.aggregationTemporality=$.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0;if(_.dataPoints&&_.dataPoints.length){O.dataPoints=[];for(var H=0;H<_.dataPoints.length;++H)O.dataPoints[H]=c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.toObject(_.dataPoints[H],$)}if(_.aggregationTemporality!=null&&_.hasOwnProperty("aggregationTemporality"))O.aggregationTemporality=$.enums===String?c6.opentelemetry.proto.metrics.v1.AggregationTemporality[_.aggregationTemporality]===void 0?_.aggregationTemporality:c6.opentelemetry.proto.metrics.v1.AggregationTemporality[_.aggregationTemporality]:_.aggregationTemporality;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.metrics.v1.ExponentialHistogram"},z}(),Y.Summary=function(){function z(w){if(this.dataPoints=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.dataPoints=o6.emptyArray,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.dataPoints!=null&&_.dataPoints.length)for(var O=0;O<_.dataPoints.length;++O)c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.encode(_.dataPoints[O],$.uint32(10).fork()).ldelim();return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.metrics.v1.Summary;while(_.pos>>3){case 1:{if(!(j.dataPoints&&j.dataPoints.length))j.dataPoints=[];j.dataPoints.push(c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.decode(_,_.uint32()));break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.dataPoints!=null&&_.hasOwnProperty("dataPoints")){if(!Array.isArray(_.dataPoints))return"dataPoints: array expected";for(var $=0;$<_.dataPoints.length;++$){var O=c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.verify(_.dataPoints[$]);if(O)return"dataPoints."+O}}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.metrics.v1.Summary)return _;var $=new c6.opentelemetry.proto.metrics.v1.Summary;if(_.dataPoints){if(!Array.isArray(_.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: array expected");$.dataPoints=[];for(var O=0;O<_.dataPoints.length;++O){if(typeof _.dataPoints[O]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: object expected");$.dataPoints[O]=c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.fromObject(_.dataPoints[O])}}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.dataPoints=[];if(_.dataPoints&&_.dataPoints.length){O.dataPoints=[];for(var H=0;H<_.dataPoints.length;++H)O.dataPoints[H]=c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.toObject(_.dataPoints[H],$)}return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.metrics.v1.Summary"},z}(),Y.AggregationTemporality=function(){var z={},w=Object.create(z);return w[z[0]="AGGREGATION_TEMPORALITY_UNSPECIFIED"]=0,w[z[1]="AGGREGATION_TEMPORALITY_DELTA"]=1,w[z[2]="AGGREGATION_TEMPORALITY_CUMULATIVE"]=2,w}(),Y.DataPointFlags=function(){var z={},w=Object.create(z);return w[z[0]="DATA_POINT_FLAGS_DO_NOT_USE"]=0,w[z[1]="DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK"]=1,w}(),Y.NumberDataPoint=function(){function z(_){if(this.attributes=[],this.exemplars=[],_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}z.prototype.attributes=o6.emptyArray,z.prototype.startTimeUnixNano=null,z.prototype.timeUnixNano=null,z.prototype.asDouble=null,z.prototype.asInt=null,z.prototype.exemplars=o6.emptyArray,z.prototype.flags=null;var w;return Object.defineProperty(z.prototype,"value",{get:o6.oneOfGetter(w=["asDouble","asInt"]),set:o6.oneOfSetter(w)}),z.create=function($){return new z($)},z.encode=function($,O){if(!O)O=f5.create();if($.startTimeUnixNano!=null&&Object.hasOwnProperty.call($,"startTimeUnixNano"))O.uint32(17).fixed64($.startTimeUnixNano);if($.timeUnixNano!=null&&Object.hasOwnProperty.call($,"timeUnixNano"))O.uint32(25).fixed64($.timeUnixNano);if($.asDouble!=null&&Object.hasOwnProperty.call($,"asDouble"))O.uint32(33).double($.asDouble);if($.exemplars!=null&&$.exemplars.length)for(var H=0;H<$.exemplars.length;++H)c6.opentelemetry.proto.metrics.v1.Exemplar.encode($.exemplars[H],O.uint32(42).fork()).ldelim();if($.asInt!=null&&Object.hasOwnProperty.call($,"asInt"))O.uint32(49).sfixed64($.asInt);if($.attributes!=null&&$.attributes.length)for(var H=0;H<$.attributes.length;++H)c6.opentelemetry.proto.common.v1.KeyValue.encode($.attributes[H],O.uint32(58).fork()).ldelim();if($.flags!=null&&Object.hasOwnProperty.call($,"flags"))O.uint32(64).uint32($.flags);return O},z.encodeDelimited=function($,O){return this.encode($,O).ldelim()},z.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.metrics.v1.NumberDataPoint;while($.pos>>3){case 7:{if(!(J.attributes&&J.attributes.length))J.attributes=[];J.attributes.push(c6.opentelemetry.proto.common.v1.KeyValue.decode($,$.uint32()));break}case 2:{J.startTimeUnixNano=$.fixed64();break}case 3:{J.timeUnixNano=$.fixed64();break}case 4:{J.asDouble=$.double();break}case 6:{J.asInt=$.sfixed64();break}case 5:{if(!(J.exemplars&&J.exemplars.length))J.exemplars=[];J.exemplars.push(c6.opentelemetry.proto.metrics.v1.Exemplar.decode($,$.uint32()));break}case 8:{J.flags=$.uint32();break}default:$.skipType(M&7);break}}return J},z.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},z.verify=function($){if(typeof $!=="object"||$===null)return"object expected";var O={};if($.attributes!=null&&$.hasOwnProperty("attributes")){if(!Array.isArray($.attributes))return"attributes: array expected";for(var H=0;H<$.attributes.length;++H){var j=c6.opentelemetry.proto.common.v1.KeyValue.verify($.attributes[H]);if(j)return"attributes."+j}}if($.startTimeUnixNano!=null&&$.hasOwnProperty("startTimeUnixNano")){if(!o6.isInteger($.startTimeUnixNano)&&!($.startTimeUnixNano&&o6.isInteger($.startTimeUnixNano.low)&&o6.isInteger($.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected"}if($.timeUnixNano!=null&&$.hasOwnProperty("timeUnixNano")){if(!o6.isInteger($.timeUnixNano)&&!($.timeUnixNano&&o6.isInteger($.timeUnixNano.low)&&o6.isInteger($.timeUnixNano.high)))return"timeUnixNano: integer|Long expected"}if($.asDouble!=null&&$.hasOwnProperty("asDouble")){if(O.value=1,typeof $.asDouble!=="number")return"asDouble: number expected"}if($.asInt!=null&&$.hasOwnProperty("asInt")){if(O.value===1)return"value: multiple values";if(O.value=1,!o6.isInteger($.asInt)&&!($.asInt&&o6.isInteger($.asInt.low)&&o6.isInteger($.asInt.high)))return"asInt: integer|Long expected"}if($.exemplars!=null&&$.hasOwnProperty("exemplars")){if(!Array.isArray($.exemplars))return"exemplars: array expected";for(var H=0;H<$.exemplars.length;++H){var j=c6.opentelemetry.proto.metrics.v1.Exemplar.verify($.exemplars[H]);if(j)return"exemplars."+j}}if($.flags!=null&&$.hasOwnProperty("flags")){if(!o6.isInteger($.flags))return"flags: integer expected"}return null},z.fromObject=function($){if($ instanceof c6.opentelemetry.proto.metrics.v1.NumberDataPoint)return $;var O=new c6.opentelemetry.proto.metrics.v1.NumberDataPoint;if($.attributes){if(!Array.isArray($.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: array expected");O.attributes=[];for(var H=0;H<$.attributes.length;++H){if(typeof $.attributes[H]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: object expected");O.attributes[H]=c6.opentelemetry.proto.common.v1.KeyValue.fromObject($.attributes[H])}}if($.startTimeUnixNano!=null){if(o6.Long)(O.startTimeUnixNano=o6.Long.fromValue($.startTimeUnixNano)).unsigned=!1;else if(typeof $.startTimeUnixNano==="string")O.startTimeUnixNano=parseInt($.startTimeUnixNano,10);else if(typeof $.startTimeUnixNano==="number")O.startTimeUnixNano=$.startTimeUnixNano;else if(typeof $.startTimeUnixNano==="object")O.startTimeUnixNano=new o6.LongBits($.startTimeUnixNano.low>>>0,$.startTimeUnixNano.high>>>0).toNumber()}if($.timeUnixNano!=null){if(o6.Long)(O.timeUnixNano=o6.Long.fromValue($.timeUnixNano)).unsigned=!1;else if(typeof $.timeUnixNano==="string")O.timeUnixNano=parseInt($.timeUnixNano,10);else if(typeof $.timeUnixNano==="number")O.timeUnixNano=$.timeUnixNano;else if(typeof $.timeUnixNano==="object")O.timeUnixNano=new o6.LongBits($.timeUnixNano.low>>>0,$.timeUnixNano.high>>>0).toNumber()}if($.asDouble!=null)O.asDouble=Number($.asDouble);if($.asInt!=null){if(o6.Long)(O.asInt=o6.Long.fromValue($.asInt)).unsigned=!1;else if(typeof $.asInt==="string")O.asInt=parseInt($.asInt,10);else if(typeof $.asInt==="number")O.asInt=$.asInt;else if(typeof $.asInt==="object")O.asInt=new o6.LongBits($.asInt.low>>>0,$.asInt.high>>>0).toNumber()}if($.exemplars){if(!Array.isArray($.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: array expected");O.exemplars=[];for(var H=0;H<$.exemplars.length;++H){if(typeof $.exemplars[H]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: object expected");O.exemplars[H]=c6.opentelemetry.proto.metrics.v1.Exemplar.fromObject($.exemplars[H])}}if($.flags!=null)O.flags=$.flags>>>0;return O},z.toObject=function($,O){if(!O)O={};var H={};if(O.arrays||O.defaults)H.exemplars=[],H.attributes=[];if(O.defaults){if(o6.Long){var j=new o6.Long(0,0,!1);H.startTimeUnixNano=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.startTimeUnixNano=O.longs===String?"0":0;if(o6.Long){var j=new o6.Long(0,0,!1);H.timeUnixNano=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.timeUnixNano=O.longs===String?"0":0;H.flags=0}if($.startTimeUnixNano!=null&&$.hasOwnProperty("startTimeUnixNano"))if(typeof $.startTimeUnixNano==="number")H.startTimeUnixNano=O.longs===String?String($.startTimeUnixNano):$.startTimeUnixNano;else H.startTimeUnixNano=O.longs===String?o6.Long.prototype.toString.call($.startTimeUnixNano):O.longs===Number?new o6.LongBits($.startTimeUnixNano.low>>>0,$.startTimeUnixNano.high>>>0).toNumber():$.startTimeUnixNano;if($.timeUnixNano!=null&&$.hasOwnProperty("timeUnixNano"))if(typeof $.timeUnixNano==="number")H.timeUnixNano=O.longs===String?String($.timeUnixNano):$.timeUnixNano;else H.timeUnixNano=O.longs===String?o6.Long.prototype.toString.call($.timeUnixNano):O.longs===Number?new o6.LongBits($.timeUnixNano.low>>>0,$.timeUnixNano.high>>>0).toNumber():$.timeUnixNano;if($.asDouble!=null&&$.hasOwnProperty("asDouble")){if(H.asDouble=O.json&&!isFinite($.asDouble)?String($.asDouble):$.asDouble,O.oneofs)H.value="asDouble"}if($.exemplars&&$.exemplars.length){H.exemplars=[];for(var J=0;J<$.exemplars.length;++J)H.exemplars[J]=c6.opentelemetry.proto.metrics.v1.Exemplar.toObject($.exemplars[J],O)}if($.asInt!=null&&$.hasOwnProperty("asInt")){if(typeof $.asInt==="number")H.asInt=O.longs===String?String($.asInt):$.asInt;else H.asInt=O.longs===String?o6.Long.prototype.toString.call($.asInt):O.longs===Number?new o6.LongBits($.asInt.low>>>0,$.asInt.high>>>0).toNumber():$.asInt;if(O.oneofs)H.value="asInt"}if($.attributes&&$.attributes.length){H.attributes=[];for(var J=0;J<$.attributes.length;++J)H.attributes[J]=c6.opentelemetry.proto.common.v1.KeyValue.toObject($.attributes[J],O)}if($.flags!=null&&$.hasOwnProperty("flags"))H.flags=$.flags;return H},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.metrics.v1.NumberDataPoint"},z}(),Y.HistogramDataPoint=function(){function z(_){if(this.attributes=[],this.bucketCounts=[],this.explicitBounds=[],this.exemplars=[],_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}z.prototype.attributes=o6.emptyArray,z.prototype.startTimeUnixNano=null,z.prototype.timeUnixNano=null,z.prototype.count=null,z.prototype.sum=null,z.prototype.bucketCounts=o6.emptyArray,z.prototype.explicitBounds=o6.emptyArray,z.prototype.exemplars=o6.emptyArray,z.prototype.flags=null,z.prototype.min=null,z.prototype.max=null;var w;return Object.defineProperty(z.prototype,"_sum",{get:o6.oneOfGetter(w=["sum"]),set:o6.oneOfSetter(w)}),Object.defineProperty(z.prototype,"_min",{get:o6.oneOfGetter(w=["min"]),set:o6.oneOfSetter(w)}),Object.defineProperty(z.prototype,"_max",{get:o6.oneOfGetter(w=["max"]),set:o6.oneOfSetter(w)}),z.create=function($){return new z($)},z.encode=function($,O){if(!O)O=f5.create();if($.startTimeUnixNano!=null&&Object.hasOwnProperty.call($,"startTimeUnixNano"))O.uint32(17).fixed64($.startTimeUnixNano);if($.timeUnixNano!=null&&Object.hasOwnProperty.call($,"timeUnixNano"))O.uint32(25).fixed64($.timeUnixNano);if($.count!=null&&Object.hasOwnProperty.call($,"count"))O.uint32(33).fixed64($.count);if($.sum!=null&&Object.hasOwnProperty.call($,"sum"))O.uint32(41).double($.sum);if($.bucketCounts!=null&&$.bucketCounts.length){O.uint32(50).fork();for(var H=0;H<$.bucketCounts.length;++H)O.fixed64($.bucketCounts[H]);O.ldelim()}if($.explicitBounds!=null&&$.explicitBounds.length){O.uint32(58).fork();for(var H=0;H<$.explicitBounds.length;++H)O.double($.explicitBounds[H]);O.ldelim()}if($.exemplars!=null&&$.exemplars.length)for(var H=0;H<$.exemplars.length;++H)c6.opentelemetry.proto.metrics.v1.Exemplar.encode($.exemplars[H],O.uint32(66).fork()).ldelim();if($.attributes!=null&&$.attributes.length)for(var H=0;H<$.attributes.length;++H)c6.opentelemetry.proto.common.v1.KeyValue.encode($.attributes[H],O.uint32(74).fork()).ldelim();if($.flags!=null&&Object.hasOwnProperty.call($,"flags"))O.uint32(80).uint32($.flags);if($.min!=null&&Object.hasOwnProperty.call($,"min"))O.uint32(89).double($.min);if($.max!=null&&Object.hasOwnProperty.call($,"max"))O.uint32(97).double($.max);return O},z.encodeDelimited=function($,O){return this.encode($,O).ldelim()},z.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.metrics.v1.HistogramDataPoint;while($.pos>>3){case 9:{if(!(J.attributes&&J.attributes.length))J.attributes=[];J.attributes.push(c6.opentelemetry.proto.common.v1.KeyValue.decode($,$.uint32()));break}case 2:{J.startTimeUnixNano=$.fixed64();break}case 3:{J.timeUnixNano=$.fixed64();break}case 4:{J.count=$.fixed64();break}case 5:{J.sum=$.double();break}case 6:{if(!(J.bucketCounts&&J.bucketCounts.length))J.bucketCounts=[];if((M&7)===2){var D=$.uint32()+$.pos;while($.pos>>0,$.startTimeUnixNano.high>>>0).toNumber()}if($.timeUnixNano!=null){if(o6.Long)(O.timeUnixNano=o6.Long.fromValue($.timeUnixNano)).unsigned=!1;else if(typeof $.timeUnixNano==="string")O.timeUnixNano=parseInt($.timeUnixNano,10);else if(typeof $.timeUnixNano==="number")O.timeUnixNano=$.timeUnixNano;else if(typeof $.timeUnixNano==="object")O.timeUnixNano=new o6.LongBits($.timeUnixNano.low>>>0,$.timeUnixNano.high>>>0).toNumber()}if($.count!=null){if(o6.Long)(O.count=o6.Long.fromValue($.count)).unsigned=!1;else if(typeof $.count==="string")O.count=parseInt($.count,10);else if(typeof $.count==="number")O.count=$.count;else if(typeof $.count==="object")O.count=new o6.LongBits($.count.low>>>0,$.count.high>>>0).toNumber()}if($.sum!=null)O.sum=Number($.sum);if($.bucketCounts){if(!Array.isArray($.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.bucketCounts: array expected");O.bucketCounts=[];for(var H=0;H<$.bucketCounts.length;++H)if(o6.Long)(O.bucketCounts[H]=o6.Long.fromValue($.bucketCounts[H])).unsigned=!1;else if(typeof $.bucketCounts[H]==="string")O.bucketCounts[H]=parseInt($.bucketCounts[H],10);else if(typeof $.bucketCounts[H]==="number")O.bucketCounts[H]=$.bucketCounts[H];else if(typeof $.bucketCounts[H]==="object")O.bucketCounts[H]=new o6.LongBits($.bucketCounts[H].low>>>0,$.bucketCounts[H].high>>>0).toNumber()}if($.explicitBounds){if(!Array.isArray($.explicitBounds))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.explicitBounds: array expected");O.explicitBounds=[];for(var H=0;H<$.explicitBounds.length;++H)O.explicitBounds[H]=Number($.explicitBounds[H])}if($.exemplars){if(!Array.isArray($.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: array expected");O.exemplars=[];for(var H=0;H<$.exemplars.length;++H){if(typeof $.exemplars[H]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: object expected");O.exemplars[H]=c6.opentelemetry.proto.metrics.v1.Exemplar.fromObject($.exemplars[H])}}if($.flags!=null)O.flags=$.flags>>>0;if($.min!=null)O.min=Number($.min);if($.max!=null)O.max=Number($.max);return O},z.toObject=function($,O){if(!O)O={};var H={};if(O.arrays||O.defaults)H.bucketCounts=[],H.explicitBounds=[],H.exemplars=[],H.attributes=[];if(O.defaults){if(o6.Long){var j=new o6.Long(0,0,!1);H.startTimeUnixNano=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.startTimeUnixNano=O.longs===String?"0":0;if(o6.Long){var j=new o6.Long(0,0,!1);H.timeUnixNano=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.timeUnixNano=O.longs===String?"0":0;if(o6.Long){var j=new o6.Long(0,0,!1);H.count=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.count=O.longs===String?"0":0;H.flags=0}if($.startTimeUnixNano!=null&&$.hasOwnProperty("startTimeUnixNano"))if(typeof $.startTimeUnixNano==="number")H.startTimeUnixNano=O.longs===String?String($.startTimeUnixNano):$.startTimeUnixNano;else H.startTimeUnixNano=O.longs===String?o6.Long.prototype.toString.call($.startTimeUnixNano):O.longs===Number?new o6.LongBits($.startTimeUnixNano.low>>>0,$.startTimeUnixNano.high>>>0).toNumber():$.startTimeUnixNano;if($.timeUnixNano!=null&&$.hasOwnProperty("timeUnixNano"))if(typeof $.timeUnixNano==="number")H.timeUnixNano=O.longs===String?String($.timeUnixNano):$.timeUnixNano;else H.timeUnixNano=O.longs===String?o6.Long.prototype.toString.call($.timeUnixNano):O.longs===Number?new o6.LongBits($.timeUnixNano.low>>>0,$.timeUnixNano.high>>>0).toNumber():$.timeUnixNano;if($.count!=null&&$.hasOwnProperty("count"))if(typeof $.count==="number")H.count=O.longs===String?String($.count):$.count;else H.count=O.longs===String?o6.Long.prototype.toString.call($.count):O.longs===Number?new o6.LongBits($.count.low>>>0,$.count.high>>>0).toNumber():$.count;if($.sum!=null&&$.hasOwnProperty("sum")){if(H.sum=O.json&&!isFinite($.sum)?String($.sum):$.sum,O.oneofs)H._sum="sum"}if($.bucketCounts&&$.bucketCounts.length){H.bucketCounts=[];for(var J=0;J<$.bucketCounts.length;++J)if(typeof $.bucketCounts[J]==="number")H.bucketCounts[J]=O.longs===String?String($.bucketCounts[J]):$.bucketCounts[J];else H.bucketCounts[J]=O.longs===String?o6.Long.prototype.toString.call($.bucketCounts[J]):O.longs===Number?new o6.LongBits($.bucketCounts[J].low>>>0,$.bucketCounts[J].high>>>0).toNumber():$.bucketCounts[J]}if($.explicitBounds&&$.explicitBounds.length){H.explicitBounds=[];for(var J=0;J<$.explicitBounds.length;++J)H.explicitBounds[J]=O.json&&!isFinite($.explicitBounds[J])?String($.explicitBounds[J]):$.explicitBounds[J]}if($.exemplars&&$.exemplars.length){H.exemplars=[];for(var J=0;J<$.exemplars.length;++J)H.exemplars[J]=c6.opentelemetry.proto.metrics.v1.Exemplar.toObject($.exemplars[J],O)}if($.attributes&&$.attributes.length){H.attributes=[];for(var J=0;J<$.attributes.length;++J)H.attributes[J]=c6.opentelemetry.proto.common.v1.KeyValue.toObject($.attributes[J],O)}if($.flags!=null&&$.hasOwnProperty("flags"))H.flags=$.flags;if($.min!=null&&$.hasOwnProperty("min")){if(H.min=O.json&&!isFinite($.min)?String($.min):$.min,O.oneofs)H._min="min"}if($.max!=null&&$.hasOwnProperty("max")){if(H.max=O.json&&!isFinite($.max)?String($.max):$.max,O.oneofs)H._max="max"}return H},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.metrics.v1.HistogramDataPoint"},z}(),Y.ExponentialHistogramDataPoint=function(){function z(_){if(this.attributes=[],this.exemplars=[],_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}z.prototype.attributes=o6.emptyArray,z.prototype.startTimeUnixNano=null,z.prototype.timeUnixNano=null,z.prototype.count=null,z.prototype.sum=null,z.prototype.scale=null,z.prototype.zeroCount=null,z.prototype.positive=null,z.prototype.negative=null,z.prototype.flags=null,z.prototype.exemplars=o6.emptyArray,z.prototype.min=null,z.prototype.max=null,z.prototype.zeroThreshold=null;var w;return Object.defineProperty(z.prototype,"_sum",{get:o6.oneOfGetter(w=["sum"]),set:o6.oneOfSetter(w)}),Object.defineProperty(z.prototype,"_min",{get:o6.oneOfGetter(w=["min"]),set:o6.oneOfSetter(w)}),Object.defineProperty(z.prototype,"_max",{get:o6.oneOfGetter(w=["max"]),set:o6.oneOfSetter(w)}),z.create=function($){return new z($)},z.encode=function($,O){if(!O)O=f5.create();if($.attributes!=null&&$.attributes.length)for(var H=0;H<$.attributes.length;++H)c6.opentelemetry.proto.common.v1.KeyValue.encode($.attributes[H],O.uint32(10).fork()).ldelim();if($.startTimeUnixNano!=null&&Object.hasOwnProperty.call($,"startTimeUnixNano"))O.uint32(17).fixed64($.startTimeUnixNano);if($.timeUnixNano!=null&&Object.hasOwnProperty.call($,"timeUnixNano"))O.uint32(25).fixed64($.timeUnixNano);if($.count!=null&&Object.hasOwnProperty.call($,"count"))O.uint32(33).fixed64($.count);if($.sum!=null&&Object.hasOwnProperty.call($,"sum"))O.uint32(41).double($.sum);if($.scale!=null&&Object.hasOwnProperty.call($,"scale"))O.uint32(48).sint32($.scale);if($.zeroCount!=null&&Object.hasOwnProperty.call($,"zeroCount"))O.uint32(57).fixed64($.zeroCount);if($.positive!=null&&Object.hasOwnProperty.call($,"positive"))c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode($.positive,O.uint32(66).fork()).ldelim();if($.negative!=null&&Object.hasOwnProperty.call($,"negative"))c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode($.negative,O.uint32(74).fork()).ldelim();if($.flags!=null&&Object.hasOwnProperty.call($,"flags"))O.uint32(80).uint32($.flags);if($.exemplars!=null&&$.exemplars.length)for(var H=0;H<$.exemplars.length;++H)c6.opentelemetry.proto.metrics.v1.Exemplar.encode($.exemplars[H],O.uint32(90).fork()).ldelim();if($.min!=null&&Object.hasOwnProperty.call($,"min"))O.uint32(97).double($.min);if($.max!=null&&Object.hasOwnProperty.call($,"max"))O.uint32(105).double($.max);if($.zeroThreshold!=null&&Object.hasOwnProperty.call($,"zeroThreshold"))O.uint32(113).double($.zeroThreshold);return O},z.encodeDelimited=function($,O){return this.encode($,O).ldelim()},z.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;while($.pos>>3){case 1:{if(!(J.attributes&&J.attributes.length))J.attributes=[];J.attributes.push(c6.opentelemetry.proto.common.v1.KeyValue.decode($,$.uint32()));break}case 2:{J.startTimeUnixNano=$.fixed64();break}case 3:{J.timeUnixNano=$.fixed64();break}case 4:{J.count=$.fixed64();break}case 5:{J.sum=$.double();break}case 6:{J.scale=$.sint32();break}case 7:{J.zeroCount=$.fixed64();break}case 8:{J.positive=c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode($,$.uint32());break}case 9:{J.negative=c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode($,$.uint32());break}case 10:{J.flags=$.uint32();break}case 11:{if(!(J.exemplars&&J.exemplars.length))J.exemplars=[];J.exemplars.push(c6.opentelemetry.proto.metrics.v1.Exemplar.decode($,$.uint32()));break}case 12:{J.min=$.double();break}case 13:{J.max=$.double();break}case 14:{J.zeroThreshold=$.double();break}default:$.skipType(M&7);break}}return J},z.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},z.verify=function($){if(typeof $!=="object"||$===null)return"object expected";var O={};if($.attributes!=null&&$.hasOwnProperty("attributes")){if(!Array.isArray($.attributes))return"attributes: array expected";for(var H=0;H<$.attributes.length;++H){var j=c6.opentelemetry.proto.common.v1.KeyValue.verify($.attributes[H]);if(j)return"attributes."+j}}if($.startTimeUnixNano!=null&&$.hasOwnProperty("startTimeUnixNano")){if(!o6.isInteger($.startTimeUnixNano)&&!($.startTimeUnixNano&&o6.isInteger($.startTimeUnixNano.low)&&o6.isInteger($.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected"}if($.timeUnixNano!=null&&$.hasOwnProperty("timeUnixNano")){if(!o6.isInteger($.timeUnixNano)&&!($.timeUnixNano&&o6.isInteger($.timeUnixNano.low)&&o6.isInteger($.timeUnixNano.high)))return"timeUnixNano: integer|Long expected"}if($.count!=null&&$.hasOwnProperty("count")){if(!o6.isInteger($.count)&&!($.count&&o6.isInteger($.count.low)&&o6.isInteger($.count.high)))return"count: integer|Long expected"}if($.sum!=null&&$.hasOwnProperty("sum")){if(O._sum=1,typeof $.sum!=="number")return"sum: number expected"}if($.scale!=null&&$.hasOwnProperty("scale")){if(!o6.isInteger($.scale))return"scale: integer expected"}if($.zeroCount!=null&&$.hasOwnProperty("zeroCount")){if(!o6.isInteger($.zeroCount)&&!($.zeroCount&&o6.isInteger($.zeroCount.low)&&o6.isInteger($.zeroCount.high)))return"zeroCount: integer|Long expected"}if($.positive!=null&&$.hasOwnProperty("positive")){var j=c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify($.positive);if(j)return"positive."+j}if($.negative!=null&&$.hasOwnProperty("negative")){var j=c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify($.negative);if(j)return"negative."+j}if($.flags!=null&&$.hasOwnProperty("flags")){if(!o6.isInteger($.flags))return"flags: integer expected"}if($.exemplars!=null&&$.hasOwnProperty("exemplars")){if(!Array.isArray($.exemplars))return"exemplars: array expected";for(var H=0;H<$.exemplars.length;++H){var j=c6.opentelemetry.proto.metrics.v1.Exemplar.verify($.exemplars[H]);if(j)return"exemplars."+j}}if($.min!=null&&$.hasOwnProperty("min")){if(O._min=1,typeof $.min!=="number")return"min: number expected"}if($.max!=null&&$.hasOwnProperty("max")){if(O._max=1,typeof $.max!=="number")return"max: number expected"}if($.zeroThreshold!=null&&$.hasOwnProperty("zeroThreshold")){if(typeof $.zeroThreshold!=="number")return"zeroThreshold: number expected"}return null},z.fromObject=function($){if($ instanceof c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint)return $;var O=new c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;if($.attributes){if(!Array.isArray($.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: array expected");O.attributes=[];for(var H=0;H<$.attributes.length;++H){if(typeof $.attributes[H]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: object expected");O.attributes[H]=c6.opentelemetry.proto.common.v1.KeyValue.fromObject($.attributes[H])}}if($.startTimeUnixNano!=null){if(o6.Long)(O.startTimeUnixNano=o6.Long.fromValue($.startTimeUnixNano)).unsigned=!1;else if(typeof $.startTimeUnixNano==="string")O.startTimeUnixNano=parseInt($.startTimeUnixNano,10);else if(typeof $.startTimeUnixNano==="number")O.startTimeUnixNano=$.startTimeUnixNano;else if(typeof $.startTimeUnixNano==="object")O.startTimeUnixNano=new o6.LongBits($.startTimeUnixNano.low>>>0,$.startTimeUnixNano.high>>>0).toNumber()}if($.timeUnixNano!=null){if(o6.Long)(O.timeUnixNano=o6.Long.fromValue($.timeUnixNano)).unsigned=!1;else if(typeof $.timeUnixNano==="string")O.timeUnixNano=parseInt($.timeUnixNano,10);else if(typeof $.timeUnixNano==="number")O.timeUnixNano=$.timeUnixNano;else if(typeof $.timeUnixNano==="object")O.timeUnixNano=new o6.LongBits($.timeUnixNano.low>>>0,$.timeUnixNano.high>>>0).toNumber()}if($.count!=null){if(o6.Long)(O.count=o6.Long.fromValue($.count)).unsigned=!1;else if(typeof $.count==="string")O.count=parseInt($.count,10);else if(typeof $.count==="number")O.count=$.count;else if(typeof $.count==="object")O.count=new o6.LongBits($.count.low>>>0,$.count.high>>>0).toNumber()}if($.sum!=null)O.sum=Number($.sum);if($.scale!=null)O.scale=$.scale|0;if($.zeroCount!=null){if(o6.Long)(O.zeroCount=o6.Long.fromValue($.zeroCount)).unsigned=!1;else if(typeof $.zeroCount==="string")O.zeroCount=parseInt($.zeroCount,10);else if(typeof $.zeroCount==="number")O.zeroCount=$.zeroCount;else if(typeof $.zeroCount==="object")O.zeroCount=new o6.LongBits($.zeroCount.low>>>0,$.zeroCount.high>>>0).toNumber()}if($.positive!=null){if(typeof $.positive!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.positive: object expected");O.positive=c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject($.positive)}if($.negative!=null){if(typeof $.negative!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.negative: object expected");O.negative=c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject($.negative)}if($.flags!=null)O.flags=$.flags>>>0;if($.exemplars){if(!Array.isArray($.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: array expected");O.exemplars=[];for(var H=0;H<$.exemplars.length;++H){if(typeof $.exemplars[H]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: object expected");O.exemplars[H]=c6.opentelemetry.proto.metrics.v1.Exemplar.fromObject($.exemplars[H])}}if($.min!=null)O.min=Number($.min);if($.max!=null)O.max=Number($.max);if($.zeroThreshold!=null)O.zeroThreshold=Number($.zeroThreshold);return O},z.toObject=function($,O){if(!O)O={};var H={};if(O.arrays||O.defaults)H.attributes=[],H.exemplars=[];if(O.defaults){if(o6.Long){var j=new o6.Long(0,0,!1);H.startTimeUnixNano=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.startTimeUnixNano=O.longs===String?"0":0;if(o6.Long){var j=new o6.Long(0,0,!1);H.timeUnixNano=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.timeUnixNano=O.longs===String?"0":0;if(o6.Long){var j=new o6.Long(0,0,!1);H.count=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.count=O.longs===String?"0":0;if(H.scale=0,o6.Long){var j=new o6.Long(0,0,!1);H.zeroCount=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.zeroCount=O.longs===String?"0":0;H.positive=null,H.negative=null,H.flags=0,H.zeroThreshold=0}if($.attributes&&$.attributes.length){H.attributes=[];for(var J=0;J<$.attributes.length;++J)H.attributes[J]=c6.opentelemetry.proto.common.v1.KeyValue.toObject($.attributes[J],O)}if($.startTimeUnixNano!=null&&$.hasOwnProperty("startTimeUnixNano"))if(typeof $.startTimeUnixNano==="number")H.startTimeUnixNano=O.longs===String?String($.startTimeUnixNano):$.startTimeUnixNano;else H.startTimeUnixNano=O.longs===String?o6.Long.prototype.toString.call($.startTimeUnixNano):O.longs===Number?new o6.LongBits($.startTimeUnixNano.low>>>0,$.startTimeUnixNano.high>>>0).toNumber():$.startTimeUnixNano;if($.timeUnixNano!=null&&$.hasOwnProperty("timeUnixNano"))if(typeof $.timeUnixNano==="number")H.timeUnixNano=O.longs===String?String($.timeUnixNano):$.timeUnixNano;else H.timeUnixNano=O.longs===String?o6.Long.prototype.toString.call($.timeUnixNano):O.longs===Number?new o6.LongBits($.timeUnixNano.low>>>0,$.timeUnixNano.high>>>0).toNumber():$.timeUnixNano;if($.count!=null&&$.hasOwnProperty("count"))if(typeof $.count==="number")H.count=O.longs===String?String($.count):$.count;else H.count=O.longs===String?o6.Long.prototype.toString.call($.count):O.longs===Number?new o6.LongBits($.count.low>>>0,$.count.high>>>0).toNumber():$.count;if($.sum!=null&&$.hasOwnProperty("sum")){if(H.sum=O.json&&!isFinite($.sum)?String($.sum):$.sum,O.oneofs)H._sum="sum"}if($.scale!=null&&$.hasOwnProperty("scale"))H.scale=$.scale;if($.zeroCount!=null&&$.hasOwnProperty("zeroCount"))if(typeof $.zeroCount==="number")H.zeroCount=O.longs===String?String($.zeroCount):$.zeroCount;else H.zeroCount=O.longs===String?o6.Long.prototype.toString.call($.zeroCount):O.longs===Number?new o6.LongBits($.zeroCount.low>>>0,$.zeroCount.high>>>0).toNumber():$.zeroCount;if($.positive!=null&&$.hasOwnProperty("positive"))H.positive=c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject($.positive,O);if($.negative!=null&&$.hasOwnProperty("negative"))H.negative=c6.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject($.negative,O);if($.flags!=null&&$.hasOwnProperty("flags"))H.flags=$.flags;if($.exemplars&&$.exemplars.length){H.exemplars=[];for(var J=0;J<$.exemplars.length;++J)H.exemplars[J]=c6.opentelemetry.proto.metrics.v1.Exemplar.toObject($.exemplars[J],O)}if($.min!=null&&$.hasOwnProperty("min")){if(H.min=O.json&&!isFinite($.min)?String($.min):$.min,O.oneofs)H._min="min"}if($.max!=null&&$.hasOwnProperty("max")){if(H.max=O.json&&!isFinite($.max)?String($.max):$.max,O.oneofs)H._max="max"}if($.zeroThreshold!=null&&$.hasOwnProperty("zeroThreshold"))H.zeroThreshold=O.json&&!isFinite($.zeroThreshold)?String($.zeroThreshold):$.zeroThreshold;return H},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint"},z.Buckets=function(){function _($){if(this.bucketCounts=[],$){for(var O=Object.keys($),H=0;H>>3){case 1:{M.offset=O.sint32();break}case 2:{if(!(M.bucketCounts&&M.bucketCounts.length))M.bucketCounts=[];if((D&7)===2){var X=O.uint32()+O.pos;while(O.pos>>0,O.bucketCounts[j].high>>>0).toNumber(!0)}return H},_.toObject=function(O,H){if(!H)H={};var j={};if(H.arrays||H.defaults)j.bucketCounts=[];if(H.defaults)j.offset=0;if(O.offset!=null&&O.hasOwnProperty("offset"))j.offset=O.offset;if(O.bucketCounts&&O.bucketCounts.length){j.bucketCounts=[];for(var J=0;J>>0,O.bucketCounts[J].high>>>0).toNumber(!0):O.bucketCounts[J]}return j},_.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},_.getTypeUrl=function(O){if(O===void 0)O="type.googleapis.com";return O+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets"},_}(),z}(),Y.SummaryDataPoint=function(){function z(w){if(this.attributes=[],this.quantileValues=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.attributes=o6.emptyArray,z.prototype.startTimeUnixNano=null,z.prototype.timeUnixNano=null,z.prototype.count=null,z.prototype.sum=null,z.prototype.quantileValues=o6.emptyArray,z.prototype.flags=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.startTimeUnixNano!=null&&Object.hasOwnProperty.call(_,"startTimeUnixNano"))$.uint32(17).fixed64(_.startTimeUnixNano);if(_.timeUnixNano!=null&&Object.hasOwnProperty.call(_,"timeUnixNano"))$.uint32(25).fixed64(_.timeUnixNano);if(_.count!=null&&Object.hasOwnProperty.call(_,"count"))$.uint32(33).fixed64(_.count);if(_.sum!=null&&Object.hasOwnProperty.call(_,"sum"))$.uint32(41).double(_.sum);if(_.quantileValues!=null&&_.quantileValues.length)for(var O=0;O<_.quantileValues.length;++O)c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.encode(_.quantileValues[O],$.uint32(50).fork()).ldelim();if(_.attributes!=null&&_.attributes.length)for(var O=0;O<_.attributes.length;++O)c6.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[O],$.uint32(58).fork()).ldelim();if(_.flags!=null&&Object.hasOwnProperty.call(_,"flags"))$.uint32(64).uint32(_.flags);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.metrics.v1.SummaryDataPoint;while(_.pos>>3){case 7:{if(!(j.attributes&&j.attributes.length))j.attributes=[];j.attributes.push(c6.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 2:{j.startTimeUnixNano=_.fixed64();break}case 3:{j.timeUnixNano=_.fixed64();break}case 4:{j.count=_.fixed64();break}case 5:{j.sum=_.double();break}case 6:{if(!(j.quantileValues&&j.quantileValues.length))j.quantileValues=[];j.quantileValues.push(c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.decode(_,_.uint32()));break}case 8:{j.flags=_.uint32();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var $=0;$<_.attributes.length;++$){var O=c6.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[$]);if(O)return"attributes."+O}}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")){if(!o6.isInteger(_.startTimeUnixNano)&&!(_.startTimeUnixNano&&o6.isInteger(_.startTimeUnixNano.low)&&o6.isInteger(_.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected"}if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")){if(!o6.isInteger(_.timeUnixNano)&&!(_.timeUnixNano&&o6.isInteger(_.timeUnixNano.low)&&o6.isInteger(_.timeUnixNano.high)))return"timeUnixNano: integer|Long expected"}if(_.count!=null&&_.hasOwnProperty("count")){if(!o6.isInteger(_.count)&&!(_.count&&o6.isInteger(_.count.low)&&o6.isInteger(_.count.high)))return"count: integer|Long expected"}if(_.sum!=null&&_.hasOwnProperty("sum")){if(typeof _.sum!=="number")return"sum: number expected"}if(_.quantileValues!=null&&_.hasOwnProperty("quantileValues")){if(!Array.isArray(_.quantileValues))return"quantileValues: array expected";for(var $=0;$<_.quantileValues.length;++$){var O=c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify(_.quantileValues[$]);if(O)return"quantileValues."+O}}if(_.flags!=null&&_.hasOwnProperty("flags")){if(!o6.isInteger(_.flags))return"flags: integer expected"}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.metrics.v1.SummaryDataPoint)return _;var $=new c6.opentelemetry.proto.metrics.v1.SummaryDataPoint;if(_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: array expected");$.attributes=[];for(var O=0;O<_.attributes.length;++O){if(typeof _.attributes[O]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: object expected");$.attributes[O]=c6.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[O])}}if(_.startTimeUnixNano!=null){if(o6.Long)($.startTimeUnixNano=o6.Long.fromValue(_.startTimeUnixNano)).unsigned=!1;else if(typeof _.startTimeUnixNano==="string")$.startTimeUnixNano=parseInt(_.startTimeUnixNano,10);else if(typeof _.startTimeUnixNano==="number")$.startTimeUnixNano=_.startTimeUnixNano;else if(typeof _.startTimeUnixNano==="object")$.startTimeUnixNano=new o6.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber()}if(_.timeUnixNano!=null){if(o6.Long)($.timeUnixNano=o6.Long.fromValue(_.timeUnixNano)).unsigned=!1;else if(typeof _.timeUnixNano==="string")$.timeUnixNano=parseInt(_.timeUnixNano,10);else if(typeof _.timeUnixNano==="number")$.timeUnixNano=_.timeUnixNano;else if(typeof _.timeUnixNano==="object")$.timeUnixNano=new o6.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber()}if(_.count!=null){if(o6.Long)($.count=o6.Long.fromValue(_.count)).unsigned=!1;else if(typeof _.count==="string")$.count=parseInt(_.count,10);else if(typeof _.count==="number")$.count=_.count;else if(typeof _.count==="object")$.count=new o6.LongBits(_.count.low>>>0,_.count.high>>>0).toNumber()}if(_.sum!=null)$.sum=Number(_.sum);if(_.quantileValues){if(!Array.isArray(_.quantileValues))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: array expected");$.quantileValues=[];for(var O=0;O<_.quantileValues.length;++O){if(typeof _.quantileValues[O]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: object expected");$.quantileValues[O]=c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.fromObject(_.quantileValues[O])}}if(_.flags!=null)$.flags=_.flags>>>0;return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.quantileValues=[],O.attributes=[];if($.defaults){if(o6.Long){var H=new o6.Long(0,0,!1);O.startTimeUnixNano=$.longs===String?H.toString():$.longs===Number?H.toNumber():H}else O.startTimeUnixNano=$.longs===String?"0":0;if(o6.Long){var H=new o6.Long(0,0,!1);O.timeUnixNano=$.longs===String?H.toString():$.longs===Number?H.toNumber():H}else O.timeUnixNano=$.longs===String?"0":0;if(o6.Long){var H=new o6.Long(0,0,!1);O.count=$.longs===String?H.toString():$.longs===Number?H.toNumber():H}else O.count=$.longs===String?"0":0;O.sum=0,O.flags=0}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano"))if(typeof _.startTimeUnixNano==="number")O.startTimeUnixNano=$.longs===String?String(_.startTimeUnixNano):_.startTimeUnixNano;else O.startTimeUnixNano=$.longs===String?o6.Long.prototype.toString.call(_.startTimeUnixNano):$.longs===Number?new o6.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber():_.startTimeUnixNano;if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano"))if(typeof _.timeUnixNano==="number")O.timeUnixNano=$.longs===String?String(_.timeUnixNano):_.timeUnixNano;else O.timeUnixNano=$.longs===String?o6.Long.prototype.toString.call(_.timeUnixNano):$.longs===Number?new o6.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber():_.timeUnixNano;if(_.count!=null&&_.hasOwnProperty("count"))if(typeof _.count==="number")O.count=$.longs===String?String(_.count):_.count;else O.count=$.longs===String?o6.Long.prototype.toString.call(_.count):$.longs===Number?new o6.LongBits(_.count.low>>>0,_.count.high>>>0).toNumber():_.count;if(_.sum!=null&&_.hasOwnProperty("sum"))O.sum=$.json&&!isFinite(_.sum)?String(_.sum):_.sum;if(_.quantileValues&&_.quantileValues.length){O.quantileValues=[];for(var j=0;j<_.quantileValues.length;++j)O.quantileValues[j]=c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.toObject(_.quantileValues[j],$)}if(_.attributes&&_.attributes.length){O.attributes=[];for(var j=0;j<_.attributes.length;++j)O.attributes[j]=c6.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[j],$)}if(_.flags!=null&&_.hasOwnProperty("flags"))O.flags=_.flags;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.metrics.v1.SummaryDataPoint"},z.ValueAtQuantile=function(){function w(_){if(_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}return w.prototype.quantile=null,w.prototype.value=null,w.create=function($){return new w($)},w.encode=function($,O){if(!O)O=f5.create();if($.quantile!=null&&Object.hasOwnProperty.call($,"quantile"))O.uint32(9).double($.quantile);if($.value!=null&&Object.hasOwnProperty.call($,"value"))O.uint32(17).double($.value);return O},w.encodeDelimited=function($,O){return this.encode($,O).ldelim()},w.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;while($.pos>>3){case 1:{J.quantile=$.double();break}case 2:{J.value=$.double();break}default:$.skipType(M&7);break}}return J},w.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},w.verify=function($){if(typeof $!=="object"||$===null)return"object expected";if($.quantile!=null&&$.hasOwnProperty("quantile")){if(typeof $.quantile!=="number")return"quantile: number expected"}if($.value!=null&&$.hasOwnProperty("value")){if(typeof $.value!=="number")return"value: number expected"}return null},w.fromObject=function($){if($ instanceof c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile)return $;var O=new c6.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;if($.quantile!=null)O.quantile=Number($.quantile);if($.value!=null)O.value=Number($.value);return O},w.toObject=function($,O){if(!O)O={};var H={};if(O.defaults)H.quantile=0,H.value=0;if($.quantile!=null&&$.hasOwnProperty("quantile"))H.quantile=O.json&&!isFinite($.quantile)?String($.quantile):$.quantile;if($.value!=null&&$.hasOwnProperty("value"))H.value=O.json&&!isFinite($.value)?String($.value):$.value;return H},w.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},w.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile"},w}(),z}(),Y.Exemplar=function(){function z(_){if(this.filteredAttributes=[],_){for(var $=Object.keys(_),O=0;O<$.length;++O)if(_[$[O]]!=null)this[$[O]]=_[$[O]]}}z.prototype.filteredAttributes=o6.emptyArray,z.prototype.timeUnixNano=null,z.prototype.asDouble=null,z.prototype.asInt=null,z.prototype.spanId=null,z.prototype.traceId=null;var w;return Object.defineProperty(z.prototype,"value",{get:o6.oneOfGetter(w=["asDouble","asInt"]),set:o6.oneOfSetter(w)}),z.create=function($){return new z($)},z.encode=function($,O){if(!O)O=f5.create();if($.timeUnixNano!=null&&Object.hasOwnProperty.call($,"timeUnixNano"))O.uint32(17).fixed64($.timeUnixNano);if($.asDouble!=null&&Object.hasOwnProperty.call($,"asDouble"))O.uint32(25).double($.asDouble);if($.spanId!=null&&Object.hasOwnProperty.call($,"spanId"))O.uint32(34).bytes($.spanId);if($.traceId!=null&&Object.hasOwnProperty.call($,"traceId"))O.uint32(42).bytes($.traceId);if($.asInt!=null&&Object.hasOwnProperty.call($,"asInt"))O.uint32(49).sfixed64($.asInt);if($.filteredAttributes!=null&&$.filteredAttributes.length)for(var H=0;H<$.filteredAttributes.length;++H)c6.opentelemetry.proto.common.v1.KeyValue.encode($.filteredAttributes[H],O.uint32(58).fork()).ldelim();return O},z.encodeDelimited=function($,O){return this.encode($,O).ldelim()},z.decode=function($,O,H){if(!($ instanceof f8))$=f8.create($);var j=O===void 0?$.len:$.pos+O,J=new c6.opentelemetry.proto.metrics.v1.Exemplar;while($.pos>>3){case 7:{if(!(J.filteredAttributes&&J.filteredAttributes.length))J.filteredAttributes=[];J.filteredAttributes.push(c6.opentelemetry.proto.common.v1.KeyValue.decode($,$.uint32()));break}case 2:{J.timeUnixNano=$.fixed64();break}case 3:{J.asDouble=$.double();break}case 6:{J.asInt=$.sfixed64();break}case 4:{J.spanId=$.bytes();break}case 5:{J.traceId=$.bytes();break}default:$.skipType(M&7);break}}return J},z.decodeDelimited=function($){if(!($ instanceof f8))$=new f8($);return this.decode($,$.uint32())},z.verify=function($){if(typeof $!=="object"||$===null)return"object expected";var O={};if($.filteredAttributes!=null&&$.hasOwnProperty("filteredAttributes")){if(!Array.isArray($.filteredAttributes))return"filteredAttributes: array expected";for(var H=0;H<$.filteredAttributes.length;++H){var j=c6.opentelemetry.proto.common.v1.KeyValue.verify($.filteredAttributes[H]);if(j)return"filteredAttributes."+j}}if($.timeUnixNano!=null&&$.hasOwnProperty("timeUnixNano")){if(!o6.isInteger($.timeUnixNano)&&!($.timeUnixNano&&o6.isInteger($.timeUnixNano.low)&&o6.isInteger($.timeUnixNano.high)))return"timeUnixNano: integer|Long expected"}if($.asDouble!=null&&$.hasOwnProperty("asDouble")){if(O.value=1,typeof $.asDouble!=="number")return"asDouble: number expected"}if($.asInt!=null&&$.hasOwnProperty("asInt")){if(O.value===1)return"value: multiple values";if(O.value=1,!o6.isInteger($.asInt)&&!($.asInt&&o6.isInteger($.asInt.low)&&o6.isInteger($.asInt.high)))return"asInt: integer|Long expected"}if($.spanId!=null&&$.hasOwnProperty("spanId")){if(!($.spanId&&typeof $.spanId.length==="number"||o6.isString($.spanId)))return"spanId: buffer expected"}if($.traceId!=null&&$.hasOwnProperty("traceId")){if(!($.traceId&&typeof $.traceId.length==="number"||o6.isString($.traceId)))return"traceId: buffer expected"}return null},z.fromObject=function($){if($ instanceof c6.opentelemetry.proto.metrics.v1.Exemplar)return $;var O=new c6.opentelemetry.proto.metrics.v1.Exemplar;if($.filteredAttributes){if(!Array.isArray($.filteredAttributes))throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: array expected");O.filteredAttributes=[];for(var H=0;H<$.filteredAttributes.length;++H){if(typeof $.filteredAttributes[H]!=="object")throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: object expected");O.filteredAttributes[H]=c6.opentelemetry.proto.common.v1.KeyValue.fromObject($.filteredAttributes[H])}}if($.timeUnixNano!=null){if(o6.Long)(O.timeUnixNano=o6.Long.fromValue($.timeUnixNano)).unsigned=!1;else if(typeof $.timeUnixNano==="string")O.timeUnixNano=parseInt($.timeUnixNano,10);else if(typeof $.timeUnixNano==="number")O.timeUnixNano=$.timeUnixNano;else if(typeof $.timeUnixNano==="object")O.timeUnixNano=new o6.LongBits($.timeUnixNano.low>>>0,$.timeUnixNano.high>>>0).toNumber()}if($.asDouble!=null)O.asDouble=Number($.asDouble);if($.asInt!=null){if(o6.Long)(O.asInt=o6.Long.fromValue($.asInt)).unsigned=!1;else if(typeof $.asInt==="string")O.asInt=parseInt($.asInt,10);else if(typeof $.asInt==="number")O.asInt=$.asInt;else if(typeof $.asInt==="object")O.asInt=new o6.LongBits($.asInt.low>>>0,$.asInt.high>>>0).toNumber()}if($.spanId!=null){if(typeof $.spanId==="string")o6.base64.decode($.spanId,O.spanId=o6.newBuffer(o6.base64.length($.spanId)),0);else if($.spanId.length>=0)O.spanId=$.spanId}if($.traceId!=null){if(typeof $.traceId==="string")o6.base64.decode($.traceId,O.traceId=o6.newBuffer(o6.base64.length($.traceId)),0);else if($.traceId.length>=0)O.traceId=$.traceId}return O},z.toObject=function($,O){if(!O)O={};var H={};if(O.arrays||O.defaults)H.filteredAttributes=[];if(O.defaults){if(o6.Long){var j=new o6.Long(0,0,!1);H.timeUnixNano=O.longs===String?j.toString():O.longs===Number?j.toNumber():j}else H.timeUnixNano=O.longs===String?"0":0;if(O.bytes===String)H.spanId="";else if(H.spanId=[],O.bytes!==Array)H.spanId=o6.newBuffer(H.spanId);if(O.bytes===String)H.traceId="";else if(H.traceId=[],O.bytes!==Array)H.traceId=o6.newBuffer(H.traceId)}if($.timeUnixNano!=null&&$.hasOwnProperty("timeUnixNano"))if(typeof $.timeUnixNano==="number")H.timeUnixNano=O.longs===String?String($.timeUnixNano):$.timeUnixNano;else H.timeUnixNano=O.longs===String?o6.Long.prototype.toString.call($.timeUnixNano):O.longs===Number?new o6.LongBits($.timeUnixNano.low>>>0,$.timeUnixNano.high>>>0).toNumber():$.timeUnixNano;if($.asDouble!=null&&$.hasOwnProperty("asDouble")){if(H.asDouble=O.json&&!isFinite($.asDouble)?String($.asDouble):$.asDouble,O.oneofs)H.value="asDouble"}if($.spanId!=null&&$.hasOwnProperty("spanId"))H.spanId=O.bytes===String?o6.base64.encode($.spanId,0,$.spanId.length):O.bytes===Array?Array.prototype.slice.call($.spanId):$.spanId;if($.traceId!=null&&$.hasOwnProperty("traceId"))H.traceId=O.bytes===String?o6.base64.encode($.traceId,0,$.traceId.length):O.bytes===Array?Array.prototype.slice.call($.traceId):$.traceId;if($.asInt!=null&&$.hasOwnProperty("asInt")){if(typeof $.asInt==="number")H.asInt=O.longs===String?String($.asInt):$.asInt;else H.asInt=O.longs===String?o6.Long.prototype.toString.call($.asInt):O.longs===Number?new o6.LongBits($.asInt.low>>>0,$.asInt.high>>>0).toNumber():$.asInt;if(O.oneofs)H.value="asInt"}if($.filteredAttributes&&$.filteredAttributes.length){H.filteredAttributes=[];for(var J=0;J<$.filteredAttributes.length;++J)H.filteredAttributes[J]=c6.opentelemetry.proto.common.v1.KeyValue.toObject($.filteredAttributes[J],O)}return H},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function($){if($===void 0)$="type.googleapis.com";return $+"/opentelemetry.proto.metrics.v1.Exemplar"},z}(),Y}(),K}(),q.logs=function(){var K={};return K.v1=function(){var Y={};return Y.LogsData=function(){function z(w){if(this.resourceLogs=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.resourceLogs=o6.emptyArray,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.resourceLogs!=null&&_.resourceLogs.length)for(var O=0;O<_.resourceLogs.length;++O)c6.opentelemetry.proto.logs.v1.ResourceLogs.encode(_.resourceLogs[O],$.uint32(10).fork()).ldelim();return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.logs.v1.LogsData;while(_.pos>>3){case 1:{if(!(j.resourceLogs&&j.resourceLogs.length))j.resourceLogs=[];j.resourceLogs.push(c6.opentelemetry.proto.logs.v1.ResourceLogs.decode(_,_.uint32()));break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.resourceLogs!=null&&_.hasOwnProperty("resourceLogs")){if(!Array.isArray(_.resourceLogs))return"resourceLogs: array expected";for(var $=0;$<_.resourceLogs.length;++$){var O=c6.opentelemetry.proto.logs.v1.ResourceLogs.verify(_.resourceLogs[$]);if(O)return"resourceLogs."+O}}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.logs.v1.LogsData)return _;var $=new c6.opentelemetry.proto.logs.v1.LogsData;if(_.resourceLogs){if(!Array.isArray(_.resourceLogs))throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: array expected");$.resourceLogs=[];for(var O=0;O<_.resourceLogs.length;++O){if(typeof _.resourceLogs[O]!=="object")throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: object expected");$.resourceLogs[O]=c6.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(_.resourceLogs[O])}}return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.resourceLogs=[];if(_.resourceLogs&&_.resourceLogs.length){O.resourceLogs=[];for(var H=0;H<_.resourceLogs.length;++H)O.resourceLogs[H]=c6.opentelemetry.proto.logs.v1.ResourceLogs.toObject(_.resourceLogs[H],$)}return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.logs.v1.LogsData"},z}(),Y.ResourceLogs=function(){function z(w){if(this.scopeLogs=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.resource=null,z.prototype.scopeLogs=o6.emptyArray,z.prototype.schemaUrl=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.resource!=null&&Object.hasOwnProperty.call(_,"resource"))c6.opentelemetry.proto.resource.v1.Resource.encode(_.resource,$.uint32(10).fork()).ldelim();if(_.scopeLogs!=null&&_.scopeLogs.length)for(var O=0;O<_.scopeLogs.length;++O)c6.opentelemetry.proto.logs.v1.ScopeLogs.encode(_.scopeLogs[O],$.uint32(18).fork()).ldelim();if(_.schemaUrl!=null&&Object.hasOwnProperty.call(_,"schemaUrl"))$.uint32(26).string(_.schemaUrl);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.logs.v1.ResourceLogs;while(_.pos>>3){case 1:{j.resource=c6.opentelemetry.proto.resource.v1.Resource.decode(_,_.uint32());break}case 2:{if(!(j.scopeLogs&&j.scopeLogs.length))j.scopeLogs=[];j.scopeLogs.push(c6.opentelemetry.proto.logs.v1.ScopeLogs.decode(_,_.uint32()));break}case 3:{j.schemaUrl=_.string();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.resource!=null&&_.hasOwnProperty("resource")){var $=c6.opentelemetry.proto.resource.v1.Resource.verify(_.resource);if($)return"resource."+$}if(_.scopeLogs!=null&&_.hasOwnProperty("scopeLogs")){if(!Array.isArray(_.scopeLogs))return"scopeLogs: array expected";for(var O=0;O<_.scopeLogs.length;++O){var $=c6.opentelemetry.proto.logs.v1.ScopeLogs.verify(_.scopeLogs[O]);if($)return"scopeLogs."+$}}if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl")){if(!o6.isString(_.schemaUrl))return"schemaUrl: string expected"}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.logs.v1.ResourceLogs)return _;var $=new c6.opentelemetry.proto.logs.v1.ResourceLogs;if(_.resource!=null){if(typeof _.resource!=="object")throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.resource: object expected");$.resource=c6.opentelemetry.proto.resource.v1.Resource.fromObject(_.resource)}if(_.scopeLogs){if(!Array.isArray(_.scopeLogs))throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: array expected");$.scopeLogs=[];for(var O=0;O<_.scopeLogs.length;++O){if(typeof _.scopeLogs[O]!=="object")throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: object expected");$.scopeLogs[O]=c6.opentelemetry.proto.logs.v1.ScopeLogs.fromObject(_.scopeLogs[O])}}if(_.schemaUrl!=null)$.schemaUrl=String(_.schemaUrl);return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.scopeLogs=[];if($.defaults)O.resource=null,O.schemaUrl="";if(_.resource!=null&&_.hasOwnProperty("resource"))O.resource=c6.opentelemetry.proto.resource.v1.Resource.toObject(_.resource,$);if(_.scopeLogs&&_.scopeLogs.length){O.scopeLogs=[];for(var H=0;H<_.scopeLogs.length;++H)O.scopeLogs[H]=c6.opentelemetry.proto.logs.v1.ScopeLogs.toObject(_.scopeLogs[H],$)}if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl"))O.schemaUrl=_.schemaUrl;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.logs.v1.ResourceLogs"},z}(),Y.ScopeLogs=function(){function z(w){if(this.logRecords=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.scope=null,z.prototype.logRecords=o6.emptyArray,z.prototype.schemaUrl=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.scope!=null&&Object.hasOwnProperty.call(_,"scope"))c6.opentelemetry.proto.common.v1.InstrumentationScope.encode(_.scope,$.uint32(10).fork()).ldelim();if(_.logRecords!=null&&_.logRecords.length)for(var O=0;O<_.logRecords.length;++O)c6.opentelemetry.proto.logs.v1.LogRecord.encode(_.logRecords[O],$.uint32(18).fork()).ldelim();if(_.schemaUrl!=null&&Object.hasOwnProperty.call(_,"schemaUrl"))$.uint32(26).string(_.schemaUrl);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.logs.v1.ScopeLogs;while(_.pos>>3){case 1:{j.scope=c6.opentelemetry.proto.common.v1.InstrumentationScope.decode(_,_.uint32());break}case 2:{if(!(j.logRecords&&j.logRecords.length))j.logRecords=[];j.logRecords.push(c6.opentelemetry.proto.logs.v1.LogRecord.decode(_,_.uint32()));break}case 3:{j.schemaUrl=_.string();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.scope!=null&&_.hasOwnProperty("scope")){var $=c6.opentelemetry.proto.common.v1.InstrumentationScope.verify(_.scope);if($)return"scope."+$}if(_.logRecords!=null&&_.hasOwnProperty("logRecords")){if(!Array.isArray(_.logRecords))return"logRecords: array expected";for(var O=0;O<_.logRecords.length;++O){var $=c6.opentelemetry.proto.logs.v1.LogRecord.verify(_.logRecords[O]);if($)return"logRecords."+$}}if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl")){if(!o6.isString(_.schemaUrl))return"schemaUrl: string expected"}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.logs.v1.ScopeLogs)return _;var $=new c6.opentelemetry.proto.logs.v1.ScopeLogs;if(_.scope!=null){if(typeof _.scope!=="object")throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.scope: object expected");$.scope=c6.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(_.scope)}if(_.logRecords){if(!Array.isArray(_.logRecords))throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: array expected");$.logRecords=[];for(var O=0;O<_.logRecords.length;++O){if(typeof _.logRecords[O]!=="object")throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: object expected");$.logRecords[O]=c6.opentelemetry.proto.logs.v1.LogRecord.fromObject(_.logRecords[O])}}if(_.schemaUrl!=null)$.schemaUrl=String(_.schemaUrl);return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.logRecords=[];if($.defaults)O.scope=null,O.schemaUrl="";if(_.scope!=null&&_.hasOwnProperty("scope"))O.scope=c6.opentelemetry.proto.common.v1.InstrumentationScope.toObject(_.scope,$);if(_.logRecords&&_.logRecords.length){O.logRecords=[];for(var H=0;H<_.logRecords.length;++H)O.logRecords[H]=c6.opentelemetry.proto.logs.v1.LogRecord.toObject(_.logRecords[H],$)}if(_.schemaUrl!=null&&_.hasOwnProperty("schemaUrl"))O.schemaUrl=_.schemaUrl;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.logs.v1.ScopeLogs"},z}(),Y.SeverityNumber=function(){var z={},w=Object.create(z);return w[z[0]="SEVERITY_NUMBER_UNSPECIFIED"]=0,w[z[1]="SEVERITY_NUMBER_TRACE"]=1,w[z[2]="SEVERITY_NUMBER_TRACE2"]=2,w[z[3]="SEVERITY_NUMBER_TRACE3"]=3,w[z[4]="SEVERITY_NUMBER_TRACE4"]=4,w[z[5]="SEVERITY_NUMBER_DEBUG"]=5,w[z[6]="SEVERITY_NUMBER_DEBUG2"]=6,w[z[7]="SEVERITY_NUMBER_DEBUG3"]=7,w[z[8]="SEVERITY_NUMBER_DEBUG4"]=8,w[z[9]="SEVERITY_NUMBER_INFO"]=9,w[z[10]="SEVERITY_NUMBER_INFO2"]=10,w[z[11]="SEVERITY_NUMBER_INFO3"]=11,w[z[12]="SEVERITY_NUMBER_INFO4"]=12,w[z[13]="SEVERITY_NUMBER_WARN"]=13,w[z[14]="SEVERITY_NUMBER_WARN2"]=14,w[z[15]="SEVERITY_NUMBER_WARN3"]=15,w[z[16]="SEVERITY_NUMBER_WARN4"]=16,w[z[17]="SEVERITY_NUMBER_ERROR"]=17,w[z[18]="SEVERITY_NUMBER_ERROR2"]=18,w[z[19]="SEVERITY_NUMBER_ERROR3"]=19,w[z[20]="SEVERITY_NUMBER_ERROR4"]=20,w[z[21]="SEVERITY_NUMBER_FATAL"]=21,w[z[22]="SEVERITY_NUMBER_FATAL2"]=22,w[z[23]="SEVERITY_NUMBER_FATAL3"]=23,w[z[24]="SEVERITY_NUMBER_FATAL4"]=24,w}(),Y.LogRecordFlags=function(){var z={},w=Object.create(z);return w[z[0]="LOG_RECORD_FLAGS_DO_NOT_USE"]=0,w[z[255]="LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"]=255,w}(),Y.LogRecord=function(){function z(w){if(this.attributes=[],w){for(var _=Object.keys(w),$=0;$<_.length;++$)if(w[_[$]]!=null)this[_[$]]=w[_[$]]}}return z.prototype.timeUnixNano=null,z.prototype.observedTimeUnixNano=null,z.prototype.severityNumber=null,z.prototype.severityText=null,z.prototype.body=null,z.prototype.attributes=o6.emptyArray,z.prototype.droppedAttributesCount=null,z.prototype.flags=null,z.prototype.traceId=null,z.prototype.spanId=null,z.prototype.eventName=null,z.create=function(_){return new z(_)},z.encode=function(_,$){if(!$)$=f5.create();if(_.timeUnixNano!=null&&Object.hasOwnProperty.call(_,"timeUnixNano"))$.uint32(9).fixed64(_.timeUnixNano);if(_.severityNumber!=null&&Object.hasOwnProperty.call(_,"severityNumber"))$.uint32(16).int32(_.severityNumber);if(_.severityText!=null&&Object.hasOwnProperty.call(_,"severityText"))$.uint32(26).string(_.severityText);if(_.body!=null&&Object.hasOwnProperty.call(_,"body"))c6.opentelemetry.proto.common.v1.AnyValue.encode(_.body,$.uint32(42).fork()).ldelim();if(_.attributes!=null&&_.attributes.length)for(var O=0;O<_.attributes.length;++O)c6.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[O],$.uint32(50).fork()).ldelim();if(_.droppedAttributesCount!=null&&Object.hasOwnProperty.call(_,"droppedAttributesCount"))$.uint32(56).uint32(_.droppedAttributesCount);if(_.flags!=null&&Object.hasOwnProperty.call(_,"flags"))$.uint32(69).fixed32(_.flags);if(_.traceId!=null&&Object.hasOwnProperty.call(_,"traceId"))$.uint32(74).bytes(_.traceId);if(_.spanId!=null&&Object.hasOwnProperty.call(_,"spanId"))$.uint32(82).bytes(_.spanId);if(_.observedTimeUnixNano!=null&&Object.hasOwnProperty.call(_,"observedTimeUnixNano"))$.uint32(89).fixed64(_.observedTimeUnixNano);if(_.eventName!=null&&Object.hasOwnProperty.call(_,"eventName"))$.uint32(98).string(_.eventName);return $},z.encodeDelimited=function(_,$){return this.encode(_,$).ldelim()},z.decode=function(_,$,O){if(!(_ instanceof f8))_=f8.create(_);var H=$===void 0?_.len:_.pos+$,j=new c6.opentelemetry.proto.logs.v1.LogRecord;while(_.pos>>3){case 1:{j.timeUnixNano=_.fixed64();break}case 11:{j.observedTimeUnixNano=_.fixed64();break}case 2:{j.severityNumber=_.int32();break}case 3:{j.severityText=_.string();break}case 5:{j.body=c6.opentelemetry.proto.common.v1.AnyValue.decode(_,_.uint32());break}case 6:{if(!(j.attributes&&j.attributes.length))j.attributes=[];j.attributes.push(c6.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 7:{j.droppedAttributesCount=_.uint32();break}case 8:{j.flags=_.fixed32();break}case 9:{j.traceId=_.bytes();break}case 10:{j.spanId=_.bytes();break}case 12:{j.eventName=_.string();break}default:_.skipType(J&7);break}}return j},z.decodeDelimited=function(_){if(!(_ instanceof f8))_=new f8(_);return this.decode(_,_.uint32())},z.verify=function(_){if(typeof _!=="object"||_===null)return"object expected";if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")){if(!o6.isInteger(_.timeUnixNano)&&!(_.timeUnixNano&&o6.isInteger(_.timeUnixNano.low)&&o6.isInteger(_.timeUnixNano.high)))return"timeUnixNano: integer|Long expected"}if(_.observedTimeUnixNano!=null&&_.hasOwnProperty("observedTimeUnixNano")){if(!o6.isInteger(_.observedTimeUnixNano)&&!(_.observedTimeUnixNano&&o6.isInteger(_.observedTimeUnixNano.low)&&o6.isInteger(_.observedTimeUnixNano.high)))return"observedTimeUnixNano: integer|Long expected"}if(_.severityNumber!=null&&_.hasOwnProperty("severityNumber"))switch(_.severityNumber){default:return"severityNumber: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:break}if(_.severityText!=null&&_.hasOwnProperty("severityText")){if(!o6.isString(_.severityText))return"severityText: string expected"}if(_.body!=null&&_.hasOwnProperty("body")){var $=c6.opentelemetry.proto.common.v1.AnyValue.verify(_.body);if($)return"body."+$}if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var O=0;O<_.attributes.length;++O){var $=c6.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[O]);if($)return"attributes."+$}}if(_.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount")){if(!o6.isInteger(_.droppedAttributesCount))return"droppedAttributesCount: integer expected"}if(_.flags!=null&&_.hasOwnProperty("flags")){if(!o6.isInteger(_.flags))return"flags: integer expected"}if(_.traceId!=null&&_.hasOwnProperty("traceId")){if(!(_.traceId&&typeof _.traceId.length==="number"||o6.isString(_.traceId)))return"traceId: buffer expected"}if(_.spanId!=null&&_.hasOwnProperty("spanId")){if(!(_.spanId&&typeof _.spanId.length==="number"||o6.isString(_.spanId)))return"spanId: buffer expected"}if(_.eventName!=null&&_.hasOwnProperty("eventName")){if(!o6.isString(_.eventName))return"eventName: string expected"}return null},z.fromObject=function(_){if(_ instanceof c6.opentelemetry.proto.logs.v1.LogRecord)return _;var $=new c6.opentelemetry.proto.logs.v1.LogRecord;if(_.timeUnixNano!=null){if(o6.Long)($.timeUnixNano=o6.Long.fromValue(_.timeUnixNano)).unsigned=!1;else if(typeof _.timeUnixNano==="string")$.timeUnixNano=parseInt(_.timeUnixNano,10);else if(typeof _.timeUnixNano==="number")$.timeUnixNano=_.timeUnixNano;else if(typeof _.timeUnixNano==="object")$.timeUnixNano=new o6.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber()}if(_.observedTimeUnixNano!=null){if(o6.Long)($.observedTimeUnixNano=o6.Long.fromValue(_.observedTimeUnixNano)).unsigned=!1;else if(typeof _.observedTimeUnixNano==="string")$.observedTimeUnixNano=parseInt(_.observedTimeUnixNano,10);else if(typeof _.observedTimeUnixNano==="number")$.observedTimeUnixNano=_.observedTimeUnixNano;else if(typeof _.observedTimeUnixNano==="object")$.observedTimeUnixNano=new o6.LongBits(_.observedTimeUnixNano.low>>>0,_.observedTimeUnixNano.high>>>0).toNumber()}switch(_.severityNumber){default:if(typeof _.severityNumber==="number"){$.severityNumber=_.severityNumber;break}break;case"SEVERITY_NUMBER_UNSPECIFIED":case 0:$.severityNumber=0;break;case"SEVERITY_NUMBER_TRACE":case 1:$.severityNumber=1;break;case"SEVERITY_NUMBER_TRACE2":case 2:$.severityNumber=2;break;case"SEVERITY_NUMBER_TRACE3":case 3:$.severityNumber=3;break;case"SEVERITY_NUMBER_TRACE4":case 4:$.severityNumber=4;break;case"SEVERITY_NUMBER_DEBUG":case 5:$.severityNumber=5;break;case"SEVERITY_NUMBER_DEBUG2":case 6:$.severityNumber=6;break;case"SEVERITY_NUMBER_DEBUG3":case 7:$.severityNumber=7;break;case"SEVERITY_NUMBER_DEBUG4":case 8:$.severityNumber=8;break;case"SEVERITY_NUMBER_INFO":case 9:$.severityNumber=9;break;case"SEVERITY_NUMBER_INFO2":case 10:$.severityNumber=10;break;case"SEVERITY_NUMBER_INFO3":case 11:$.severityNumber=11;break;case"SEVERITY_NUMBER_INFO4":case 12:$.severityNumber=12;break;case"SEVERITY_NUMBER_WARN":case 13:$.severityNumber=13;break;case"SEVERITY_NUMBER_WARN2":case 14:$.severityNumber=14;break;case"SEVERITY_NUMBER_WARN3":case 15:$.severityNumber=15;break;case"SEVERITY_NUMBER_WARN4":case 16:$.severityNumber=16;break;case"SEVERITY_NUMBER_ERROR":case 17:$.severityNumber=17;break;case"SEVERITY_NUMBER_ERROR2":case 18:$.severityNumber=18;break;case"SEVERITY_NUMBER_ERROR3":case 19:$.severityNumber=19;break;case"SEVERITY_NUMBER_ERROR4":case 20:$.severityNumber=20;break;case"SEVERITY_NUMBER_FATAL":case 21:$.severityNumber=21;break;case"SEVERITY_NUMBER_FATAL2":case 22:$.severityNumber=22;break;case"SEVERITY_NUMBER_FATAL3":case 23:$.severityNumber=23;break;case"SEVERITY_NUMBER_FATAL4":case 24:$.severityNumber=24;break}if(_.severityText!=null)$.severityText=String(_.severityText);if(_.body!=null){if(typeof _.body!=="object")throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.body: object expected");$.body=c6.opentelemetry.proto.common.v1.AnyValue.fromObject(_.body)}if(_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: array expected");$.attributes=[];for(var O=0;O<_.attributes.length;++O){if(typeof _.attributes[O]!=="object")throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: object expected");$.attributes[O]=c6.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[O])}}if(_.droppedAttributesCount!=null)$.droppedAttributesCount=_.droppedAttributesCount>>>0;if(_.flags!=null)$.flags=_.flags>>>0;if(_.traceId!=null){if(typeof _.traceId==="string")o6.base64.decode(_.traceId,$.traceId=o6.newBuffer(o6.base64.length(_.traceId)),0);else if(_.traceId.length>=0)$.traceId=_.traceId}if(_.spanId!=null){if(typeof _.spanId==="string")o6.base64.decode(_.spanId,$.spanId=o6.newBuffer(o6.base64.length(_.spanId)),0);else if(_.spanId.length>=0)$.spanId=_.spanId}if(_.eventName!=null)$.eventName=String(_.eventName);return $},z.toObject=function(_,$){if(!$)$={};var O={};if($.arrays||$.defaults)O.attributes=[];if($.defaults){if(o6.Long){var H=new o6.Long(0,0,!1);O.timeUnixNano=$.longs===String?H.toString():$.longs===Number?H.toNumber():H}else O.timeUnixNano=$.longs===String?"0":0;if(O.severityNumber=$.enums===String?"SEVERITY_NUMBER_UNSPECIFIED":0,O.severityText="",O.body=null,O.droppedAttributesCount=0,O.flags=0,$.bytes===String)O.traceId="";else if(O.traceId=[],$.bytes!==Array)O.traceId=o6.newBuffer(O.traceId);if($.bytes===String)O.spanId="";else if(O.spanId=[],$.bytes!==Array)O.spanId=o6.newBuffer(O.spanId);if(o6.Long){var H=new o6.Long(0,0,!1);O.observedTimeUnixNano=$.longs===String?H.toString():$.longs===Number?H.toNumber():H}else O.observedTimeUnixNano=$.longs===String?"0":0;O.eventName=""}if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano"))if(typeof _.timeUnixNano==="number")O.timeUnixNano=$.longs===String?String(_.timeUnixNano):_.timeUnixNano;else O.timeUnixNano=$.longs===String?o6.Long.prototype.toString.call(_.timeUnixNano):$.longs===Number?new o6.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber():_.timeUnixNano;if(_.severityNumber!=null&&_.hasOwnProperty("severityNumber"))O.severityNumber=$.enums===String?c6.opentelemetry.proto.logs.v1.SeverityNumber[_.severityNumber]===void 0?_.severityNumber:c6.opentelemetry.proto.logs.v1.SeverityNumber[_.severityNumber]:_.severityNumber;if(_.severityText!=null&&_.hasOwnProperty("severityText"))O.severityText=_.severityText;if(_.body!=null&&_.hasOwnProperty("body"))O.body=c6.opentelemetry.proto.common.v1.AnyValue.toObject(_.body,$);if(_.attributes&&_.attributes.length){O.attributes=[];for(var j=0;j<_.attributes.length;++j)O.attributes[j]=c6.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[j],$)}if(_.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount"))O.droppedAttributesCount=_.droppedAttributesCount;if(_.flags!=null&&_.hasOwnProperty("flags"))O.flags=_.flags;if(_.traceId!=null&&_.hasOwnProperty("traceId"))O.traceId=$.bytes===String?o6.base64.encode(_.traceId,0,_.traceId.length):$.bytes===Array?Array.prototype.slice.call(_.traceId):_.traceId;if(_.spanId!=null&&_.hasOwnProperty("spanId"))O.spanId=$.bytes===String?o6.base64.encode(_.spanId,0,_.spanId.length):$.bytes===Array?Array.prototype.slice.call(_.spanId):_.spanId;if(_.observedTimeUnixNano!=null&&_.hasOwnProperty("observedTimeUnixNano"))if(typeof _.observedTimeUnixNano==="number")O.observedTimeUnixNano=$.longs===String?String(_.observedTimeUnixNano):_.observedTimeUnixNano;else O.observedTimeUnixNano=$.longs===String?o6.Long.prototype.toString.call(_.observedTimeUnixNano):$.longs===Number?new o6.LongBits(_.observedTimeUnixNano.low>>>0,_.observedTimeUnixNano.high>>>0).toNumber():_.observedTimeUnixNano;if(_.eventName!=null&&_.hasOwnProperty("eventName"))O.eventName=_.eventName;return O},z.prototype.toJSON=function(){return this.constructor.toObject(this,GK.util.toJSONOptions)},z.getTypeUrl=function(_){if(_===void 0)_="type.googleapis.com";return _+"/opentelemetry.proto.logs.v1.LogRecord"},z}(),Y}(),K}(),q}(),A}();bp4.exports=c6});var mp4=C((up4)=>{Object.defineProperty(up4,"__esModule",{value:!0});up4.hexToBinary=void 0;function xp4(A){if(A>=48&&A<=57)return A-48;if(A>=97&&A<=102)return A-87;return A-55}function EIY(A){let q=new Uint8Array(A.length/2),K=0;for(let Y=0;Y{Object.defineProperty(pp4,"__esModule",{value:!0});pp4.getOtlpEncoder=pp4.encodeAsString=pp4.encodeAsLongBits=pp4.toLongBits=pp4.hrTimeToNanos=void 0;var LIY=b9(),Pu8=mp4();function Wu8(A){let q=BigInt(1e9);return BigInt(Math.trunc(A[0]))*q+BigInt(Math.trunc(A[1]))}pp4.hrTimeToNanos=Wu8;function Fp4(A){let q=Number(BigInt.asUintN(32,A)),K=Number(BigInt.asUintN(32,A>>BigInt(32)));return{low:q,high:K}}pp4.toLongBits=Fp4;function Zu8(A){let q=Wu8(A);return Fp4(q)}pp4.encodeAsLongBits=Zu8;function Qp4(A){return Wu8(A).toString()}pp4.encodeAsString=Qp4;var yIY=typeof BigInt<"u"?Qp4:LIY.hrTimeToNanoseconds;function gp4(A){return A}function Up4(A){if(A===void 0)return;return(0,Pu8.hexToBinary)(A)}var RIY={encodeHrTime:Zu8,encodeSpanContext:Pu8.hexToBinary,encodeOptionalSpanContext:Up4};function SIY(A){if(A===void 0)return RIY;let q=A.useLongBits??!0,K=A.useHex??!1;return{encodeHrTime:q?Zu8:yIY,encodeSpanContext:K?gp4:Pu8.hexToBinary,encodeOptionalSpanContext:K?gp4:Up4}}pp4.getOtlpEncoder=SIY});var mv1=C((lp4)=>{Object.defineProperty(lp4,"__esModule",{value:!0});lp4.toAnyValue=lp4.toKeyValue=lp4.toAttributes=lp4.createInstrumentationScope=lp4.createResource=void 0;function xIY(A){let q={attributes:cp4(A.attributes),droppedAttributesCount:0},K=A.schemaUrl;if(K&&K!=="")q.schemaUrl=K;return q}lp4.createResource=xIY;function uIY(A){return{name:A.name,version:A.version}}lp4.createInstrumentationScope=uIY;function cp4(A){return Object.keys(A).map((q)=>Gu8(q,A[q]))}lp4.toAttributes=cp4;function Gu8(A,q){return{key:A,value:fu8(q)}}lp4.toKeyValue=Gu8;function fu8(A){let q=typeof A;if(q==="string")return{stringValue:A};if(q==="number"){if(!Number.isInteger(A))return{doubleValue:A};return{intValue:A}}if(q==="boolean")return{boolValue:A};if(A instanceof Uint8Array)return{bytesValue:A};if(Array.isArray(A))return{arrayValue:{values:A.map(fu8)}};if(q==="object"&&A!=null)return{kvlistValue:{values:Object.entries(A).map(([K,Y])=>Gu8(K,Y))}};return{}}lp4.toAnyValue=fu8});var Tu8=C((rp4)=>{Object.defineProperty(rp4,"__esModule",{value:!0});rp4.toLogAttributes=rp4.createExportLogsServiceRequest=void 0;var QIY=Bv1(),gv1=mv1();function UIY(A,q){let K=(0,QIY.getOtlpEncoder)(q);return{resourceLogs:dIY(A,K)}}rp4.createExportLogsServiceRequest=UIY;function pIY(A){let q=new Map;for(let K of A){let{resource:Y,instrumentationScope:{name:z,version:w="",schemaUrl:_=""}}=K,$=q.get(Y);if(!$)$=new Map,q.set(Y,$);let O=`${z}@${w}:${_}`,H=$.get(O);if(!H)H=[],$.set(O,H);H.push(K)}return q}function dIY(A,q){let K=pIY(A);return Array.from(K,([Y,z])=>{let w=(0,gv1.createResource)(Y);return{resource:w,scopeLogs:Array.from(z,([,_])=>{return{scope:(0,gv1.createInstrumentationScope)(_[0].instrumentationScope),logRecords:_.map(($)=>cIY($,q)),schemaUrl:_[0].instrumentationScope.schemaUrl}}),schemaUrl:w.schemaUrl}})}function cIY(A,q){return{timeUnixNano:q.encodeHrTime(A.hrTime),observedTimeUnixNano:q.encodeHrTime(A.hrTimeObserved),severityNumber:lIY(A.severityNumber),severityText:A.severityText,body:(0,gv1.toAnyValue)(A.body),eventName:A.eventName,attributes:np4(A.attributes),droppedAttributesCount:A.droppedAttributesCount,flags:A.spanContext?.traceFlags,traceId:q.encodeOptionalSpanContext(A.spanContext?.traceId),spanId:q.encodeOptionalSpanContext(A.spanContext?.spanId)}}function lIY(A){return A}function np4(A){return Object.keys(A).map((q)=>(0,gv1.toKeyValue)(q,A[q]))}rp4.toLogAttributes=np4});var ep4=C((sp4)=>{Object.defineProperty(sp4,"__esModule",{value:!0});sp4.ProtobufLogsSerializer=void 0;var ap4=uv1(),nIY=Tu8(),rIY=ap4.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,oIY=ap4.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;sp4.ProtobufLogsSerializer={serializeRequest:(A)=>{let q=(0,nIY.createExportLogsServiceRequest)(A);return oIY.encode(q).finish()},deserializeResponse:(A)=>{return rIY.decode(A)}}});var Ad4=C((Vu8)=>{Object.defineProperty(Vu8,"__esModule",{value:!0});Vu8.ProtobufLogsSerializer=void 0;var aIY=ep4();Object.defineProperty(Vu8,"ProtobufLogsSerializer",{enumerable:!0,get:function(){return aIY.ProtobufLogsSerializer}})});var Kd4=C((qd4)=>{Object.defineProperty(qd4,"__esModule",{value:!0});qd4.EAggregationTemporality=void 0;var tIY;(function(A){A[A.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",A[A.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",A[A.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(tIY=qd4.EAggregationTemporality||(qd4.EAggregationTemporality={}))});var vu8=C((Hd4)=>{Object.defineProperty(Hd4,"__esModule",{value:!0});Hd4.createExportMetricsServiceRequest=Hd4.toMetric=Hd4.toScopeMetrics=Hd4.toResourceMetrics=void 0;var Yd4=nq(),zN6=Z86(),zd4=Kd4(),eIY=Bv1(),si6=mv1();function _d4(A,q){let K=(0,eIY.getOtlpEncoder)(q),Y=(0,si6.createResource)(A.resource);return{resource:Y,schemaUrl:Y.schemaUrl,scopeMetrics:$d4(A.scopeMetrics,K)}}Hd4.toResourceMetrics=_d4;function $d4(A,q){return Array.from(A.map((K)=>({scope:(0,si6.createInstrumentationScope)(K.scope),metrics:K.metrics.map((Y)=>Od4(Y,q)),schemaUrl:K.scope.schemaUrl})))}Hd4.toScopeMetrics=$d4;function Od4(A,q){let K={name:A.descriptor.name,description:A.descriptor.description,unit:A.descriptor.unit},Y=YbY(A.aggregationTemporality);switch(A.dataPointType){case zN6.DataPointType.SUM:K.sum={aggregationTemporality:Y,isMonotonic:A.isMonotonic,dataPoints:wd4(A,q)};break;case zN6.DataPointType.GAUGE:K.gauge={dataPoints:wd4(A,q)};break;case zN6.DataPointType.HISTOGRAM:K.histogram={aggregationTemporality:Y,dataPoints:qbY(A,q)};break;case zN6.DataPointType.EXPONENTIAL_HISTOGRAM:K.exponentialHistogram={aggregationTemporality:Y,dataPoints:KbY(A,q)};break}return K}Hd4.toMetric=Od4;function AbY(A,q,K){let Y={attributes:(0,si6.toAttributes)(A.attributes),startTimeUnixNano:K.encodeHrTime(A.startTime),timeUnixNano:K.encodeHrTime(A.endTime)};switch(q){case Yd4.ValueType.INT:Y.asInt=A.value;break;case Yd4.ValueType.DOUBLE:Y.asDouble=A.value;break}return Y}function wd4(A,q){return A.dataPoints.map((K)=>{return AbY(K,A.descriptor.valueType,q)})}function qbY(A,q){return A.dataPoints.map((K)=>{let Y=K.value;return{attributes:(0,si6.toAttributes)(K.attributes),bucketCounts:Y.buckets.counts,explicitBounds:Y.buckets.boundaries,count:Y.count,sum:Y.sum,min:Y.min,max:Y.max,startTimeUnixNano:q.encodeHrTime(K.startTime),timeUnixNano:q.encodeHrTime(K.endTime)}})}function KbY(A,q){return A.dataPoints.map((K)=>{let Y=K.value;return{attributes:(0,si6.toAttributes)(K.attributes),count:Y.count,min:Y.min,max:Y.max,sum:Y.sum,positive:{offset:Y.positive.offset,bucketCounts:Y.positive.bucketCounts},negative:{offset:Y.negative.offset,bucketCounts:Y.negative.bucketCounts},scale:Y.scale,zeroCount:Y.zeroCount,startTimeUnixNano:q.encodeHrTime(K.startTime),timeUnixNano:q.encodeHrTime(K.endTime)}})}function YbY(A){switch(A){case zN6.AggregationTemporality.DELTA:return zd4.EAggregationTemporality.AGGREGATION_TEMPORALITY_DELTA;case zN6.AggregationTemporality.CUMULATIVE:return zd4.EAggregationTemporality.AGGREGATION_TEMPORALITY_CUMULATIVE}}function zbY(A,q){return{resourceMetrics:A.map((K)=>_d4(K,q))}}Hd4.createExportMetricsServiceRequest=zbY});var Xd4=C((Md4)=>{Object.defineProperty(Md4,"__esModule",{value:!0});Md4.ProtobufMetricsSerializer=void 0;var Jd4=uv1(),ObY=vu8(),HbY=Jd4.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,jbY=Jd4.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;Md4.ProtobufMetricsSerializer={serializeRequest:(A)=>{let q=(0,ObY.createExportMetricsServiceRequest)([A]);return jbY.encode(q).finish()},deserializeResponse:(A)=>{return HbY.decode(A)}}});var Pd4=C((ku8)=>{Object.defineProperty(ku8,"__esModule",{value:!0});ku8.ProtobufMetricsSerializer=void 0;var JbY=Xd4();Object.defineProperty(ku8,"ProtobufMetricsSerializer",{enumerable:!0,get:function(){return JbY.ProtobufMetricsSerializer}})});var Eu8=C((Td4)=>{Object.defineProperty(Td4,"__esModule",{value:!0});Td4.createExportTraceServiceRequest=Td4.toOtlpSpanEvent=Td4.toOtlpLink=Td4.sdkSpanToOtlpSpan=void 0;var ti6=mv1(),DbY=Bv1(),XbY=256,PbY=512;function Wd4(A,q){let K=A&255|XbY;if(q)K|=PbY;return K}function Zd4(A,q){let K=A.spanContext(),Y=A.status,z=A.parentSpanContext?.spanId?q.encodeSpanContext(A.parentSpanContext?.spanId):void 0;return{traceId:q.encodeSpanContext(K.traceId),spanId:q.encodeSpanContext(K.spanId),parentSpanId:z,traceState:K.traceState?.serialize(),name:A.name,kind:A.kind==null?0:A.kind+1,startTimeUnixNano:q.encodeHrTime(A.startTime),endTimeUnixNano:q.encodeHrTime(A.endTime),attributes:(0,ti6.toAttributes)(A.attributes),droppedAttributesCount:A.droppedAttributesCount,events:A.events.map((w)=>fd4(w,q)),droppedEventsCount:A.droppedEventsCount,status:{code:Y.code,message:Y.message},links:A.links.map((w)=>Gd4(w,q)),droppedLinksCount:A.droppedLinksCount,flags:Wd4(K.traceFlags,A.parentSpanContext?.isRemote)}}Td4.sdkSpanToOtlpSpan=Zd4;function Gd4(A,q){return{attributes:A.attributes?(0,ti6.toAttributes)(A.attributes):[],spanId:q.encodeSpanContext(A.context.spanId),traceId:q.encodeSpanContext(A.context.traceId),traceState:A.context.traceState?.serialize(),droppedAttributesCount:A.droppedAttributesCount||0,flags:Wd4(A.context.traceFlags,A.context.isRemote)}}Td4.toOtlpLink=Gd4;function fd4(A,q){return{attributes:A.attributes?(0,ti6.toAttributes)(A.attributes):[],name:A.name,timeUnixNano:q.encodeHrTime(A.time),droppedAttributesCount:A.droppedAttributesCount||0}}Td4.toOtlpSpanEvent=fd4;function WbY(A,q){let K=(0,DbY.getOtlpEncoder)(q);return{resourceSpans:GbY(A,K)}}Td4.createExportTraceServiceRequest=WbY;function ZbY(A){let q=new Map;for(let K of A){let Y=q.get(K.resource);if(!Y)Y=new Map,q.set(K.resource,Y);let z=`${K.instrumentationScope.name}@${K.instrumentationScope.version||""}:${K.instrumentationScope.schemaUrl||""}`,w=Y.get(z);if(!w)w=[],Y.set(z,w);w.push(K)}return q}function GbY(A,q){let K=ZbY(A),Y=[],z=K.entries(),w=z.next();while(!w.done){let[_,$]=w.value,O=[],H=$.values(),j=H.next();while(!j.done){let D=j.value;if(D.length>0){let X=D.map((P)=>Zd4(P,q));O.push({scope:(0,ti6.createInstrumentationScope)(D[0].instrumentationScope),spans:X,schemaUrl:D[0].instrumentationScope.schemaUrl})}j=H.next()}let J=(0,ti6.createResource)(_),M={resource:J,scopeSpans:O,schemaUrl:J.schemaUrl};Y.push(M),w=z.next()}return Y}});var Ed4=C((vd4)=>{Object.defineProperty(vd4,"__esModule",{value:!0});vd4.ProtobufTraceSerializer=void 0;var Nd4=uv1(),NbY=Eu8(),vbY=Nd4.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,kbY=Nd4.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;vd4.ProtobufTraceSerializer={serializeRequest:(A)=>{let q=(0,NbY.createExportTraceServiceRequest)(A);return kbY.encode(q).finish()},deserializeResponse:(A)=>{return vbY.decode(A)}}});var Ld4=C((Lu8)=>{Object.defineProperty(Lu8,"__esModule",{value:!0});Lu8.ProtobufTraceSerializer=void 0;var EbY=Ed4();Object.defineProperty(Lu8,"ProtobufTraceSerializer",{enumerable:!0,get:function(){return EbY.ProtobufTraceSerializer}})});var Sd4=C((yd4)=>{Object.defineProperty(yd4,"__esModule",{value:!0});yd4.JsonLogsSerializer=void 0;var ybY=Tu8();yd4.JsonLogsSerializer={serializeRequest:(A)=>{let q=(0,ybY.createExportLogsServiceRequest)(A,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(q))},deserializeResponse:(A)=>{if(A.length===0)return{};return JSON.parse(new TextDecoder().decode(A))}}});var Cd4=C((yu8)=>{Object.defineProperty(yu8,"__esModule",{value:!0});yu8.JsonLogsSerializer=void 0;var RbY=Sd4();Object.defineProperty(yu8,"JsonLogsSerializer",{enumerable:!0,get:function(){return RbY.JsonLogsSerializer}})});var bd4=C((hd4)=>{Object.defineProperty(hd4,"__esModule",{value:!0});hd4.JsonMetricsSerializer=void 0;var CbY=vu8();hd4.JsonMetricsSerializer={serializeRequest:(A)=>{let q=(0,CbY.createExportMetricsServiceRequest)([A],{useLongBits:!1});return new TextEncoder().encode(JSON.stringify(q))},deserializeResponse:(A)=>{if(A.length===0)return{};return JSON.parse(new TextDecoder().decode(A))}}});var xd4=C((Ru8)=>{Object.defineProperty(Ru8,"__esModule",{value:!0});Ru8.JsonMetricsSerializer=void 0;var hbY=bd4();Object.defineProperty(Ru8,"JsonMetricsSerializer",{enumerable:!0,get:function(){return hbY.JsonMetricsSerializer}})});var md4=C((ud4)=>{Object.defineProperty(ud4,"__esModule",{value:!0});ud4.JsonTraceSerializer=void 0;var bbY=Eu8();ud4.JsonTraceSerializer={serializeRequest:(A)=>{let q=(0,bbY.createExportTraceServiceRequest)(A,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(q))},deserializeResponse:(A)=>{if(A.length===0)return{};return JSON.parse(new TextDecoder().decode(A))}}});var gd4=C((Su8)=>{Object.defineProperty(Su8,"__esModule",{value:!0});Su8.JsonTraceSerializer=void 0;var xbY=md4();Object.defineProperty(Su8,"JsonTraceSerializer",{enumerable:!0,get:function(){return xbY.JsonTraceSerializer}})});var LQ=C((V86)=>{Object.defineProperty(V86,"__esModule",{value:!0});V86.JsonTraceSerializer=V86.JsonMetricsSerializer=V86.JsonLogsSerializer=V86.ProtobufTraceSerializer=V86.ProtobufMetricsSerializer=V86.ProtobufLogsSerializer=void 0;var BbY=Ad4();Object.defineProperty(V86,"ProtobufLogsSerializer",{enumerable:!0,get:function(){return BbY.ProtobufLogsSerializer}});var mbY=Pd4();Object.defineProperty(V86,"ProtobufMetricsSerializer",{enumerable:!0,get:function(){return mbY.ProtobufMetricsSerializer}});var gbY=Ld4();Object.defineProperty(V86,"ProtobufTraceSerializer",{enumerable:!0,get:function(){return gbY.ProtobufTraceSerializer}});var FbY=Cd4();Object.defineProperty(V86,"JsonLogsSerializer",{enumerable:!0,get:function(){return FbY.JsonLogsSerializer}});var QbY=xd4();Object.defineProperty(V86,"JsonMetricsSerializer",{enumerable:!0,get:function(){return QbY.JsonMetricsSerializer}});var UbY=gd4();Object.defineProperty(V86,"JsonTraceSerializer",{enumerable:!0,get:function(){return UbY.JsonTraceSerializer}})});var Ud4=C((Fd4)=>{Object.defineProperty(Fd4,"__esModule",{value:!0});Fd4.validateAndNormalizeHeaders=void 0;var dbY=nq();function cbY(A){let q={};return Object.entries(A??{}).forEach(([K,Y])=>{if(typeof Y<"u")q[K]=String(Y);else dbY.diag.warn(`Header "${K}" has invalid value (${Y}) and will be ignored`)}),q}Fd4.validateAndNormalizeHeaders=cbY});var ld4=C((dd4)=>{Object.defineProperty(dd4,"__esModule",{value:!0});dd4.getHttpConfigurationDefaults=dd4.mergeOtlpHttpConfigurationWithDefaults=void 0;var pd4=ii6(),lbY=Ud4();function ibY(A,q,K){return async()=>{let Y={...await K()},z={};if(q!=null)Object.assign(z,await q());if(A!=null)Object.assign(z,(0,lbY.validateAndNormalizeHeaders)(await A()));return Object.assign(z,Y)}}function nbY(A){if(A==null)return;try{let q=globalThis.location?.href;return new URL(A,q).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${A}'`)}}function rbY(A,q,K){return{...(0,pd4.mergeOtlpSharedConfigurationWithDefaults)(A,q,K),headers:ibY(A.headers,q.headers,K.headers),url:nbY(A.url)??q.url??K.url}}dd4.mergeOtlpHttpConfigurationWithDefaults=rbY;function obY(A,q){return{...(0,pd4.getSharedConfigurationDefaults)(),headers:async()=>A,url:"http://localhost:4318/"+q}}dd4.getHttpConfigurationDefaults=obY});var Fv1=C((rd4)=>{Object.defineProperty(rd4,"__esModule",{value:!0});rd4.getNodeHttpConfigurationDefaults=rd4.mergeOtlpNodeHttpConfigurationWithDefaults=rd4.httpAgentFactoryFromOptions=void 0;var id4=ld4();function nd4(A){return async(q)=>{let K=q==="http:",Y=K?import("http"):import("https"),{Agent:z}=await Y;if(K){let{ca:w,cert:_,key:$,...O}=A;return new z(O)}return new z(A)}}rd4.httpAgentFactoryFromOptions=nd4;function sbY(A,q,K){return{...(0,id4.mergeOtlpHttpConfigurationWithDefaults)(A,q,K),agentFactory:A.agentFactory??q.agentFactory??K.agentFactory,userAgent:A.userAgent}}rd4.mergeOtlpNodeHttpConfigurationWithDefaults=sbY;function tbY(A,q){return{...(0,id4.getHttpConfigurationDefaults)(A,q),agentFactory:nd4({keepAlive:!0})}}rd4.getNodeHttpConfigurationDefaults=tbY});var td4=C((ad4)=>{Object.defineProperty(ad4,"__esModule",{value:!0});ad4.parseRetryAfterToMills=ad4.isExportRetryable=void 0;function qxY(A){return[429,502,503,504].includes(A)}ad4.isExportRetryable=qxY;function KxY(A){if(A==null)return;let q=Number.parseInt(A,10);if(Number.isInteger(q))return q>0?q*1000:-1;let K=new Date(A).getTime()-Date.now();if(K>=0)return K;return 0}ad4.parseRetryAfterToMills=KxY});var qc4=C((ed4)=>{Object.defineProperty(ed4,"__esModule",{value:!0});ed4.VERSION=void 0;ed4.VERSION="0.208.0"});var $c4=C((wc4)=>{Object.defineProperty(wc4,"__esModule",{value:!0});wc4.compressAndSend=wc4.sendWithHttp=void 0;var zxY=g6("zlib"),wxY=g6("stream"),Kc4=td4(),_xY=yv1(),$xY=qc4(),Yc4=`OTel-OTLP-Exporter-JavaScript/${$xY.VERSION}`;function OxY(A,q,K,Y,z,w,_,$,O){let H=new URL(q);if(z)K["User-Agent"]=`${z} ${Yc4}`;else K["User-Agent"]=Yc4;let j={hostname:H.hostname,port:H.port,path:H.pathname,method:"POST",headers:K,agent:w},J=A(j,(M)=>{let D=[];M.on("data",(X)=>D.push(X)),M.on("end",()=>{if(M.statusCode&&M.statusCode<299)$({status:"success",data:Buffer.concat(D)});else if(M.statusCode&&(0,Kc4.isExportRetryable)(M.statusCode))$({status:"retryable",retryInMillis:(0,Kc4.parseRetryAfterToMills)(M.headers["retry-after"])});else{let X=new _xY.OTLPExporterError(M.statusMessage,M.statusCode,Buffer.concat(D).toString());$({status:"failure",error:X})}})});J.setTimeout(O,()=>{J.destroy(),$({status:"failure",error:Error("Request Timeout")})}),J.on("error",(M)=>{$({status:"failure",error:M})}),zc4(J,Y,_,(M)=>{$({status:"failure",error:M})})}wc4.sendWithHttp=OxY;function zc4(A,q,K,Y){let z=HxY(K);if(q==="gzip")A.setHeader("Content-Encoding","gzip"),z=z.on("error",Y).pipe(zxY.createGzip()).on("error",Y);z.pipe(A).on("error",Y)}wc4.compressAndSend=zc4;function HxY(A){let q=new wxY.Readable;return q.push(A),q.push(null),q}});var Jc4=C((Hc4)=>{Object.defineProperty(Hc4,"__esModule",{value:!0});Hc4.createHttpExporterTransport=void 0;var JxY=$c4();class Oc4{_parameters;_utils=null;constructor(A){this._parameters=A}async send(A,q){let{agent:K,request:Y}=await this._loadUtils(),z=await this._parameters.headers();return new Promise((w)=>{(0,JxY.sendWithHttp)(Y,this._parameters.url,z,this._parameters.compression,this._parameters.userAgent,K,A,(_)=>{w(_)},q)})}shutdown(){}async _loadUtils(){let A=this._utils;if(A===null){let q=new URL(this._parameters.url).protocol,[K,Y]=await Promise.all([this._parameters.agentFactory(q),MxY(q)]);A=this._utils={agent:K,request:Y}}return A}}async function MxY(A){let q=A==="http:"?import("http"):import("https"),{request:K}=await q;return K}function DxY(A){return new Oc4(A)}Hc4.createHttpExporterTransport=DxY});var Wc4=C((Xc4)=>{Object.defineProperty(Xc4,"__esModule",{value:!0});Xc4.createRetryingTransport=void 0;var XxY=5,PxY=1000,WxY=5000,ZxY=1.5,Mc4=0.2;function GxY(){return Math.random()*(2*Mc4)-Mc4}class Dc4{_transport;constructor(A){this._transport=A}retry(A,q,K){return new Promise((Y,z)=>{setTimeout(()=>{this._transport.send(A,q).then(Y,z)},K)})}async send(A,q){let K=Date.now()+q,Y=await this._transport.send(A,q),z=XxY,w=PxY;while(Y.status==="retryable"&&z>0){z--;let _=Math.max(Math.min(w,WxY)+GxY(),0);w=w*ZxY;let $=Y.retryInMillis??_,O=K-Date.now();if($>O)return Y;Y=await this.retry(A,O,$)}return Y}shutdown(){return this._transport.shutdown()}}function fxY(A){return new Dc4(A.transport)}Xc4.createRetryingTransport=fxY});var fc4=C((Zc4)=>{Object.defineProperty(Zc4,"__esModule",{value:!0});Zc4.createOtlpHttpExportDelegate=void 0;var TxY=nx8(),VxY=Jc4(),NxY=ix8(),vxY=Wc4();function kxY(A,q){return(0,TxY.createOtlpExportDelegate)({transport:(0,vxY.createRetryingTransport)({transport:(0,VxY.createHttpExporterTransport)(A)}),serializer:q,promiseHandler:(0,NxY.createBoundedQueueExportPromiseHandler)(A)},{timeout:A.timeoutMillis})}Zc4.createOtlpHttpExportDelegate=kxY});var Cu8=C((kc4)=>{Object.defineProperty(kc4,"__esModule",{value:!0});kc4.getSharedConfigurationFromEnvironment=void 0;var Nc4=b9(),vc4=nq();function Tc4(A){let q=(0,Nc4.getNumberFromEnv)(A);if(q!=null){if(Number.isFinite(q)&&q>0)return q;vc4.diag.warn(`Configuration: ${A} is invalid, expected number greater than 0 (actual: ${q})`)}return}function ExY(A){let q=Tc4(`OTEL_EXPORTER_OTLP_${A}_TIMEOUT`),K=Tc4("OTEL_EXPORTER_OTLP_TIMEOUT");return q??K}function Vc4(A){let q=(0,Nc4.getStringFromEnv)(A)?.trim();if(q==null||q==="none"||q==="gzip")return q;vc4.diag.warn(`Configuration: ${A} is invalid, expected 'none' or 'gzip' (actual: '${q}')`);return}function LxY(A){let q=Vc4(`OTEL_EXPORTER_OTLP_${A}_COMPRESSION`),K=Vc4("OTEL_EXPORTER_OTLP_COMPRESSION");return q??K}function yxY(A){return{timeoutMillis:ExY(A),compression:LxY(A)}}kc4.getSharedConfigurationFromEnvironment=yxY});var Rc4=C((Lc4)=>{Object.defineProperty(Lc4,"__esModule",{value:!0});Lc4.getNodeHttpConfigurationFromEnvironment=void 0;var RxY=g6("fs"),SxY=g6("path"),yQ=b9(),Qv1=nq(),CxY=Cu8(),hxY=ii6(),IxY=Fv1();function bxY(A){let q=(0,yQ.getStringFromEnv)(`OTEL_EXPORTER_OTLP_${A}_HEADERS`),K=(0,yQ.getStringFromEnv)("OTEL_EXPORTER_OTLP_HEADERS"),Y=(0,yQ.parseKeyPairsIntoRecord)(q),z=(0,yQ.parseKeyPairsIntoRecord)(K);if(Object.keys(Y).length===0&&Object.keys(z).length===0)return;return Object.assign({},(0,yQ.parseKeyPairsIntoRecord)(K),(0,yQ.parseKeyPairsIntoRecord)(q))}function xxY(A){try{return new URL(A).toString()}catch{Qv1.diag.warn(`Configuration: Could not parse environment-provided export URL: '${A}', falling back to undefined`);return}}function uxY(A,q){try{new URL(A)}catch{Qv1.diag.warn(`Configuration: Could not parse environment-provided export URL: '${A}', falling back to undefined`);return}if(!A.endsWith("/"))A=A+"/";A+=q;try{new URL(A)}catch{Qv1.diag.warn(`Configuration: Provided URL appended with '${q}' is not a valid URL, using 'undefined' instead of '${A}'`);return}return A}function BxY(A){let q=(0,yQ.getStringFromEnv)("OTEL_EXPORTER_OTLP_ENDPOINT");if(q===void 0)return;return uxY(q,A)}function mxY(A){let q=(0,yQ.getStringFromEnv)(`OTEL_EXPORTER_OTLP_${A}_ENDPOINT`);if(q===void 0)return;return xxY(q)}function hu8(A,q,K){let Y=(0,yQ.getStringFromEnv)(A),z=(0,yQ.getStringFromEnv)(q),w=Y??z;if(w!=null)try{return RxY.readFileSync(SxY.resolve(process.cwd(),w))}catch{Qv1.diag.warn(K);return}else return}function gxY(A){return hu8(`OTEL_EXPORTER_OTLP_${A}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function FxY(A){return hu8(`OTEL_EXPORTER_OTLP_${A}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function QxY(A){return hu8(`OTEL_EXPORTER_OTLP_${A}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function UxY(A,q){return{...(0,CxY.getSharedConfigurationFromEnvironment)(A),url:mxY(A)??BxY(q),headers:(0,hxY.wrapStaticHeadersInFunction)(bxY(A)),agentFactory:(0,IxY.httpAgentFactoryFromOptions)({keepAlive:!0,ca:QxY(A),cert:gxY(A),key:FxY(A)})}}Lc4.getNodeHttpConfigurationFromEnvironment=UxY});var hc4=C((Sc4)=>{Object.defineProperty(Sc4,"__esModule",{value:!0});Sc4.convertLegacyHeaders=void 0;var pxY=ii6();function dxY(A){if(typeof A.headers==="function")return A.headers;return(0,pxY.wrapStaticHeadersInFunction)(A.headers)}Sc4.convertLegacyHeaders=dxY});var uc4=C((bc4)=>{Object.defineProperty(bc4,"__esModule",{value:!0});bc4.convertLegacyHttpOptions=void 0;var cxY=nq(),Ic4=Fv1(),lxY=Mn(),ixY=Rc4(),nxY=hc4();function rxY(A){if(typeof A.httpAgentOptions==="function")return A.httpAgentOptions;let q=A.httpAgentOptions;if(A.keepAlive!=null)q={keepAlive:A.keepAlive,...q};if(q!=null)return(0,lxY.httpAgentFactoryFromOptions)(q);else return}function oxY(A,q,K,Y){if(A.metadata)cxY.diag.warn("Metadata cannot be set when using http");return(0,Ic4.mergeOtlpNodeHttpConfigurationWithDefaults)({url:A.url,headers:(0,nxY.convertLegacyHeaders)(A),concurrencyLimit:A.concurrencyLimit,timeoutMillis:A.timeoutMillis,compression:A.compression,agentFactory:rxY(A),userAgent:A.userAgent},(0,ixY.getNodeHttpConfigurationFromEnvironment)(q,K),(0,Ic4.getNodeHttpConfigurationDefaults)(Y,K))}bc4.convertLegacyHttpOptions=oxY});var Mn=C((wN6)=>{Object.defineProperty(wN6,"__esModule",{value:!0});wN6.convertLegacyHttpOptions=wN6.getSharedConfigurationFromEnvironment=wN6.createOtlpHttpExportDelegate=wN6.httpAgentFactoryFromOptions=void 0;var axY=Fv1();Object.defineProperty(wN6,"httpAgentFactoryFromOptions",{enumerable:!0,get:function(){return axY.httpAgentFactoryFromOptions}});var sxY=fc4();Object.defineProperty(wN6,"createOtlpHttpExportDelegate",{enumerable:!0,get:function(){return sxY.createOtlpHttpExportDelegate}});var txY=Cu8();Object.defineProperty(wN6,"getSharedConfigurationFromEnvironment",{enumerable:!0,get:function(){return txY.getSharedConfigurationFromEnvironment}});var exY=uc4();Object.defineProperty(wN6,"convertLegacyHttpOptions",{enumerable:!0,get:function(){return exY.convertLegacyHttpOptions}})});var Qc4=C((gc4)=>{Object.defineProperty(gc4,"__esModule",{value:!0});gc4.OTLPMetricExporter=void 0;var quY=ax8(),KuY=LQ(),Bc4=Mn();class mc4 extends quY.OTLPMetricExporterBase{constructor(A){super((0,Bc4.createOtlpHttpExportDelegate)((0,Bc4.convertLegacyHttpOptions)(A??{},"METRICS","v1/metrics",{"Content-Type":"application/json"}),KuY.JsonMetricsSerializer),A)}}gc4.OTLPMetricExporter=mc4});var Uc4=C((Iu8)=>{Object.defineProperty(Iu8,"__esModule",{value:!0});Iu8.OTLPMetricExporter=void 0;var YuY=Qc4();Object.defineProperty(Iu8,"OTLPMetricExporter",{enumerable:!0,get:function(){return YuY.OTLPMetricExporter}})});var pc4=C((bu8)=>{Object.defineProperty(bu8,"__esModule",{value:!0});bu8.OTLPMetricExporter=void 0;var wuY=Uc4();Object.defineProperty(bu8,"OTLPMetricExporter",{enumerable:!0,get:function(){return wuY.OTLPMetricExporter}})});var pv1=C((N86)=>{Object.defineProperty(N86,"__esModule",{value:!0});N86.OTLPMetricExporterBase=N86.LowMemoryTemporalitySelector=N86.DeltaTemporalitySelector=N86.CumulativeTemporalitySelector=N86.AggregationTemporalityPreference=N86.OTLPMetricExporter=void 0;var $uY=pc4();Object.defineProperty(N86,"OTLPMetricExporter",{enumerable:!0,get:function(){return $uY.OTLPMetricExporter}});var OuY=cx8();Object.defineProperty(N86,"AggregationTemporalityPreference",{enumerable:!0,get:function(){return OuY.AggregationTemporalityPreference}});var Uv1=ax8();Object.defineProperty(N86,"CumulativeTemporalitySelector",{enumerable:!0,get:function(){return Uv1.CumulativeTemporalitySelector}});Object.defineProperty(N86,"DeltaTemporalitySelector",{enumerable:!0,get:function(){return Uv1.DeltaTemporalitySelector}});Object.defineProperty(N86,"LowMemoryTemporalitySelector",{enumerable:!0,get:function(){return Uv1.LowMemoryTemporalitySelector}});Object.defineProperty(N86,"OTLPMetricExporterBase",{enumerable:!0,get:function(){return Uv1.OTLPMetricExporterBase}})});var nc4=C((lc4)=>{Object.defineProperty(lc4,"__esModule",{value:!0});lc4.OTLPMetricExporter=void 0;var juY=pv1(),JuY=LQ(),dc4=Mn();class cc4 extends juY.OTLPMetricExporterBase{constructor(A){super((0,dc4.createOtlpHttpExportDelegate)((0,dc4.convertLegacyHttpOptions)(A??{},"METRICS","v1/metrics",{"Content-Type":"application/x-protobuf"}),JuY.ProtobufMetricsSerializer),A)}}lc4.OTLPMetricExporter=cc4});var rc4=C((xu8)=>{Object.defineProperty(xu8,"__esModule",{value:!0});xu8.OTLPMetricExporter=void 0;var MuY=nc4();Object.defineProperty(xu8,"OTLPMetricExporter",{enumerable:!0,get:function(){return MuY.OTLPMetricExporter}})});var oc4=C((uu8)=>{Object.defineProperty(uu8,"__esModule",{value:!0});uu8.OTLPMetricExporter=void 0;var XuY=rc4();Object.defineProperty(uu8,"OTLPMetricExporter",{enumerable:!0,get:function(){return XuY.OTLPMetricExporter}})});var ac4=C((Bu8)=>{Object.defineProperty(Bu8,"__esModule",{value:!0});Bu8.OTLPMetricExporter=void 0;var WuY=oc4();Object.defineProperty(Bu8,"OTLPMetricExporter",{enumerable:!0,get:function(){return WuY.OTLPMetricExporter}})});var ec4=C((sc4)=>{Object.defineProperty(sc4,"__esModule",{value:!0});sc4.VERSION=void 0;sc4.VERSION="0.208.0"});var E9=C((Yl4)=>{Object.defineProperty(Yl4,"__esModule",{value:!0});Yl4.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=Yl4.DEFAULT_MAX_SEND_MESSAGE_LENGTH=Yl4.Propagate=Yl4.LogVerbosity=Yl4.Status=void 0;var Al4;(function(A){A[A.OK=0]="OK",A[A.CANCELLED=1]="CANCELLED",A[A.UNKNOWN=2]="UNKNOWN",A[A.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",A[A.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",A[A.NOT_FOUND=5]="NOT_FOUND",A[A.ALREADY_EXISTS=6]="ALREADY_EXISTS",A[A.PERMISSION_DENIED=7]="PERMISSION_DENIED",A[A.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",A[A.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",A[A.ABORTED=10]="ABORTED",A[A.OUT_OF_RANGE=11]="OUT_OF_RANGE",A[A.UNIMPLEMENTED=12]="UNIMPLEMENTED",A[A.INTERNAL=13]="INTERNAL",A[A.UNAVAILABLE=14]="UNAVAILABLE",A[A.DATA_LOSS=15]="DATA_LOSS",A[A.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(Al4||(Yl4.Status=Al4={}));var ql4;(function(A){A[A.DEBUG=0]="DEBUG",A[A.INFO=1]="INFO",A[A.ERROR=2]="ERROR",A[A.NONE=3]="NONE"})(ql4||(Yl4.LogVerbosity=ql4={}));var Kl4;(function(A){A[A.DEADLINE=1]="DEADLINE",A[A.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",A[A.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",A[A.CANCELLATION=8]="CANCELLATION",A[A.DEFAULTS=65535]="DEFAULTS"})(Kl4||(Yl4.Propagate=Kl4={}));Yl4.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1;Yl4.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4194304});var mu8=C((Ta_,NuY)=>{NuY.exports={name:"@grpc/grpc-js",version:"1.14.0",description:"gRPC Library for Node - pure JS implementation",homepage:"https://grpc.io/",repository:"https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",main:"build/src/index.js",engines:{node:">=12.10.0"},keywords:[],author:{name:"Google Inc."},types:"build/src/index.d.ts",license:"Apache-2.0",devDependencies:{"@grpc/proto-loader":"file:../proto-loader","@types/gulp":"^4.0.17","@types/gulp-mocha":"0.0.37","@types/lodash":"^4.14.202","@types/mocha":"^10.0.6","@types/ncp":"^2.0.8","@types/node":">=20.11.20","@types/pify":"^5.0.4","@types/semver":"^7.5.8","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0","@typescript-eslint/typescript-estree":"^7.1.0","clang-format":"^1.8.0",eslint:"^8.42.0","eslint-config-prettier":"^8.8.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^4.2.1",execa:"^2.0.3",gulp:"^4.0.2","gulp-mocha":"^6.0.0",lodash:"^4.17.21",madge:"^5.0.1","mocha-jenkins-reporter":"^0.4.1",ncp:"^2.0.0",pify:"^4.0.1",prettier:"^2.8.8",rimraf:"^3.0.2",semver:"^7.6.0","ts-node":"^10.9.2",typescript:"^5.3.3"},contributors:[{name:"Google Inc."}],scripts:{build:"npm run compile",clean:"rimraf ./build",compile:"tsc -p .",format:'clang-format -i -style="{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}" src/*.ts test/*.ts',lint:"eslint src/*.ts test/*.ts",prepare:"npm run copy-protos && npm run generate-types && npm run generate-test-types && npm run compile",test:"gulp test",check:"npm run lint",fix:"eslint --fix src/*.ts test/*.ts",pretest:"npm run generate-types && npm run generate-test-types && npm run compile",posttest:"npm run check && madge -c ./build/src","generate-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ --include-dirs proto/ proto/xds/ proto/protoc-gen-validate/ -O src/generated/ --grpcLib ../index channelz.proto xds/service/orca/v3/orca.proto","generate-test-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --include-dirs test/fixtures/ -O test/generated/ --grpcLib ../../src/index test_service.proto echo_service.proto","copy-protos":"node ./copy-protos"},dependencies:{"@grpc/proto-loader":"^0.8.0","@js-sdsl/ordered-map":"^4.4.2"},files:["src/**/*.ts","build/src/**/*.{js,d.ts,js.map}","proto/**/*.proto","proto/**/LICENSE","LICENSE","deps/envoy-api/envoy/api/v2/**/*.proto","deps/envoy-api/envoy/config/**/*.proto","deps/envoy-api/envoy/service/**/*.proto","deps/envoy-api/envoy/type/**/*.proto","deps/udpa/udpa/**/*.proto","deps/googleapis/google/api/*.proto","deps/googleapis/google/rpc/*.proto","deps/protoc-gen-validate/validate/**/*.proto"]}});var m_=C(($l4)=>{var gu8,Fu8,Qu8,Uu8;Object.defineProperty($l4,"__esModule",{value:!0});$l4.log=$l4.setLoggerVerbosity=$l4.setLogger=$l4.getLogger=void 0;$l4.trace=buY;$l4.isTracerEnabled=_l4;var v86=E9(),vuY=g6("process"),kuY=mu8().version,EuY={error:(A,...q)=>{console.error("E "+A,...q)},info:(A,...q)=>{console.error("I "+A,...q)},debug:(A,...q)=>{console.error("D "+A,...q)}},pw6=EuY,_N6=v86.LogVerbosity.ERROR,LuY=(Fu8=(gu8=process.env.GRPC_NODE_VERBOSITY)!==null&&gu8!==void 0?gu8:process.env.GRPC_VERBOSITY)!==null&&Fu8!==void 0?Fu8:"";switch(LuY.toUpperCase()){case"DEBUG":_N6=v86.LogVerbosity.DEBUG;break;case"INFO":_N6=v86.LogVerbosity.INFO;break;case"ERROR":_N6=v86.LogVerbosity.ERROR;break;case"NONE":_N6=v86.LogVerbosity.NONE;break;default:}var yuY=()=>{return pw6};$l4.getLogger=yuY;var RuY=(A)=>{pw6=A};$l4.setLogger=RuY;var SuY=(A)=>{_N6=A};$l4.setLoggerVerbosity=SuY;var CuY=(A,...q)=>{let K;if(A>=_N6){switch(A){case v86.LogVerbosity.DEBUG:K=pw6.debug;break;case v86.LogVerbosity.INFO:K=pw6.info;break;case v86.LogVerbosity.ERROR:K=pw6.error;break}if(!K)K=pw6.error;if(K)K.bind(pw6)(...q)}};$l4.log=CuY;var huY=(Uu8=(Qu8=process.env.GRPC_NODE_TRACE)!==null&&Qu8!==void 0?Qu8:process.env.GRPC_TRACE)!==null&&Uu8!==void 0?Uu8:"",pu8=new Set,wl4=new Set;for(let A of huY.split(","))if(A.startsWith("-"))wl4.add(A.substring(1));else pu8.add(A);var IuY=pu8.has("all");function buY(A,q,K){if(_l4(q))$l4.log(A,new Date().toISOString()+" | v"+kuY+" "+vuY.pid+" | "+q+" | "+K)}function _l4(A){return!wl4.has(A)&&(IuY||pu8.has(A))}});var dv1=C((Ol4)=>{Object.defineProperty(Ol4,"__esModule",{value:!0});Ol4.getErrorMessage=FuY;Ol4.getErrorCode=QuY;function FuY(A){if(A instanceof Error)return A.message;else return String(A)}function QuY(A){if(typeof A==="object"&&A!==null&&"code"in A&&typeof A.code==="number")return A.code;else return null}});var hP=C((Jl4)=>{Object.defineProperty(Jl4,"__esModule",{value:!0});Jl4.Metadata=void 0;var duY=m_(),cuY=E9(),luY=dv1(),iuY=/^[:0-9a-z_.-]+$/,nuY=/^[ -~]*$/;function ruY(A){return iuY.test(A)}function ouY(A){return nuY.test(A)}function jl4(A){return A.endsWith("-bin")}function auY(A){return!A.startsWith("grpc-")}function cv1(A){return A.toLowerCase()}function Hl4(A,q){if(!ruY(A))throw Error('Metadata key "'+A+'" contains illegal characters');if(q!==null&&q!==void 0)if(jl4(A)){if(!Buffer.isBuffer(q))throw Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(q))throw Error("keys that don't end with '-bin' must have String values");if(!ouY(q))throw Error('Metadata string value "'+q+'" contains illegal characters')}}class lv1{constructor(A={}){this.internalRepr=new Map,this.opaqueData=new Map,this.options=A}set(A,q){A=cv1(A),Hl4(A,q),this.internalRepr.set(A,[q])}add(A,q){A=cv1(A),Hl4(A,q);let K=this.internalRepr.get(A);if(K===void 0)this.internalRepr.set(A,[q]);else K.push(q)}remove(A){A=cv1(A),this.internalRepr.delete(A)}get(A){return A=cv1(A),this.internalRepr.get(A)||[]}getMap(){let A={};for(let[q,K]of this.internalRepr)if(K.length>0){let Y=K[0];A[q]=Buffer.isBuffer(Y)?Buffer.from(Y):Y}return A}clone(){let A=new lv1(this.options),q=A.internalRepr;for(let[K,Y]of this.internalRepr){let z=Y.map((w)=>{if(Buffer.isBuffer(w))return Buffer.from(w);else return w});q.set(K,z)}return A}merge(A){for(let[q,K]of A.internalRepr){let Y=(this.internalRepr.get(q)||[]).concat(K);this.internalRepr.set(q,Y)}}setOptions(A){this.options=A}getOptions(){return this.options}toHttp2Headers(){let A={};for(let[q,K]of this.internalRepr){if(q.startsWith(":"))continue;A[q]=K.map(suY)}return A}toJSON(){let A={};for(let[q,K]of this.internalRepr)A[q]=K;return A}setOpaque(A,q){this.opaqueData.set(A,q)}getOpaque(A){return this.opaqueData.get(A)}static fromHttp2Headers(A){let q=new lv1;for(let K of Object.keys(A)){if(K.charAt(0)===":")continue;let Y=A[K];try{if(jl4(K)){if(Array.isArray(Y))Y.forEach((z)=>{q.add(K,Buffer.from(z,"base64"))});else if(Y!==void 0)if(auY(K))Y.split(",").forEach((z)=>{q.add(K,Buffer.from(z.trim(),"base64"))});else q.add(K,Buffer.from(Y,"base64"))}else if(Array.isArray(Y))Y.forEach((z)=>{q.add(K,z)});else if(Y!==void 0)q.add(K,Y)}catch(z){let w=`Failed to add metadata entry ${K}: ${Y}. ${(0,luY.getErrorMessage)(z)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,duY.log)(cuY.LogVerbosity.ERROR,w)}}return q}}Jl4.Metadata=lv1;var suY=(A)=>{return Buffer.isBuffer(A)?A.toString("base64"):A}});var nv1=C((Dl4)=>{Object.defineProperty(Dl4,"__esModule",{value:!0});Dl4.CallCredentials=void 0;var cu8=hP();function tuY(A){return"getRequestHeaders"in A&&typeof A.getRequestHeaders==="function"}class $N6{static createFromMetadataGenerator(A){return new lu8(A)}static createFromGoogleCredential(A){return $N6.createFromMetadataGenerator((q,K)=>{let Y;if(tuY(A))Y=A.getRequestHeaders(q.service_url);else Y=new Promise((z,w)=>{A.getRequestMetadata(q.service_url,(_,$)=>{if(_){w(_);return}if(!$){w(Error("Headers not set by metadata plugin"));return}z($)})});Y.then((z)=>{let w=new cu8.Metadata;for(let _ of Object.keys(z))w.add(_,z[_]);K(null,w)},(z)=>{K(z)})})}static createEmpty(){return new iu8}}Dl4.CallCredentials=$N6;class iv1 extends $N6{constructor(A){super();this.creds=A}async generateMetadata(A){let q=new cu8.Metadata,K=await Promise.all(this.creds.map((Y)=>Y.generateMetadata(A)));for(let Y of K)q.merge(Y);return q}compose(A){return new iv1(this.creds.concat([A]))}_equals(A){if(this===A)return!0;if(A instanceof iv1)return this.creds.every((q,K)=>q._equals(A.creds[K]));else return!1}}class lu8 extends $N6{constructor(A){super();this.metadataGenerator=A}generateMetadata(A){return new Promise((q,K)=>{this.metadataGenerator(A,(Y,z)=>{if(z!==void 0)q(z);else K(Y)})})}compose(A){return new iv1([this,A])}_equals(A){if(this===A)return!0;if(A instanceof lu8)return this.metadataGenerator===A.metadataGenerator;else return!1}}class iu8 extends $N6{generateMetadata(A){return Promise.resolve(new cu8.Metadata)}compose(A){return A}_equals(A){return A instanceof iu8}}});var ru8=C((Wl4)=>{Object.defineProperty(Wl4,"__esModule",{value:!0});Wl4.CIPHER_SUITES=void 0;Wl4.getDefaultRootsData=ABY;var euY=g6("fs");Wl4.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;var Pl4=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH,nu8=null;function ABY(){if(Pl4){if(nu8===null)nu8=euY.readFileSync(Pl4);return nu8}return null}});var pT=C((fl4)=>{Object.defineProperty(fl4,"__esModule",{value:!0});fl4.parseUri=YBY;fl4.splitHostPort=zBY;fl4.combineHostPort=wBY;fl4.uriToString=_BY;var KBY=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;function YBY(A){let q=KBY.exec(A);if(q===null)return null;return{scheme:q[1],authority:q[2],path:q[3]}}var Gl4=/^\d+$/;function zBY(A){if(A.startsWith("[")){let q=A.indexOf("]");if(q===-1)return null;let K=A.substring(1,q);if(K.indexOf(":")===-1)return null;if(A.length>q+1)if(A[q+1]===":"){let Y=A.substring(q+2);if(Gl4.test(Y))return{host:K,port:+Y};else return null}else return null;else return{host:K}}else{let q=A.split(":");if(q.length===2)if(Gl4.test(q[1]))return{host:q[0],port:+q[1]};else return null;else return{host:A}}}function wBY(A){if(A.port===void 0)return A.host;else if(A.host.includes(":"))return`[${A.host}]:${A.port}`;else return`${A.host}:${A.port}`}function _BY(A){let q="";if(A.scheme!==void 0)q+=A.scheme+":";if(A.authority!==void 0)q+="//"+A.authority+"/";return q+=A.path,q}});var zu=C((Tl4)=>{Object.defineProperty(Tl4,"__esModule",{value:!0});Tl4.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0;Tl4.registerResolver=JBY;Tl4.registerDefaultScheme=MBY;Tl4.createResolver=DBY;Tl4.getDefaultAuthority=XBY;Tl4.mapUriDefaultScheme=PBY;var au8=pT();Tl4.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";var ON6={},ou8=null;function JBY(A,q){ON6[A]=q}function MBY(A){ou8=A}function DBY(A,q,K){if(A.scheme!==void 0&&A.scheme in ON6)return new ON6[A.scheme](A,q,K);else throw Error(`No resolver could be created for target ${(0,au8.uriToString)(A)}`)}function XBY(A){if(A.scheme!==void 0&&A.scheme in ON6)return ON6[A.scheme].getDefaultAuthority(A);else throw Error(`Invalid target ${(0,au8.uriToString)(A)}`)}function PBY(A){if(A.scheme===void 0||!(A.scheme in ON6))if(ou8!==null)return{scheme:ou8,authority:void 0,path:(0,au8.uriToString)(A)};else return null;return A}});var jN6=C((El4)=>{Object.defineProperty(El4,"__esModule",{value:!0});El4.ChannelCredentials=void 0;El4.createCertificateProviderChannelCredentials=kBY;var An6=g6("tls"),av1=nv1(),tu8=ru8(),Nl4=pT(),VBY=zu(),NBY=m_(),vBY=E9();function su8(A,q){if(A&&!(A instanceof Buffer))throw TypeError(`${q}, if provided, must be a Buffer.`)}class HN6{compose(A){return new ov1(this,A)}static createSsl(A,q,K,Y){var z;if(su8(A,"Root certificate"),su8(q,"Private key"),su8(K,"Certificate chain"),q&&!K)throw Error("Private key must be given with accompanying certificate chain");if(!q&&K)throw Error("Certificate chain must be given with accompanying private key");let w=(0,An6.createSecureContext)({ca:(z=A!==null&&A!==void 0?A:(0,tu8.getDefaultRootsData)())!==null&&z!==void 0?z:void 0,key:q!==null&&q!==void 0?q:void 0,cert:K!==null&&K!==void 0?K:void 0,ciphers:tu8.CIPHER_SUITES});return new rv1(w,Y!==null&&Y!==void 0?Y:{})}static createFromSecureContext(A,q){return new rv1(A,q!==null&&q!==void 0?q:{})}static createInsecure(){return new eu8}}El4.ChannelCredentials=HN6;class eu8 extends HN6{constructor(){super()}compose(A){throw Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(A){return A instanceof eu8}_createSecureConnector(A,q,K){return{connect(Y){return Promise.resolve({socket:Y,secure:!1})},waitForReady:()=>{return Promise.resolve()},getCallCredentials:()=>{return K!==null&&K!==void 0?K:av1.CallCredentials.createEmpty()},destroy(){}}}}function vl4(A,q,K,Y){var z,w;let _={secureContext:A},$=K;if("grpc.http_connect_target"in Y){let J=(0,Nl4.parseUri)(Y["grpc.http_connect_target"]);if(J)$=J}let O=(0,VBY.getDefaultAuthority)($),H=(0,Nl4.splitHostPort)(O),j=(z=H===null||H===void 0?void 0:H.host)!==null&&z!==void 0?z:O;if(_.host=j,q.checkServerIdentity)_.checkServerIdentity=q.checkServerIdentity;if(q.rejectUnauthorized!==void 0)_.rejectUnauthorized=q.rejectUnauthorized;if(_.ALPNProtocols=["h2"],Y["grpc.ssl_target_name_override"]){let J=Y["grpc.ssl_target_name_override"],M=(w=_.checkServerIdentity)!==null&&w!==void 0?w:An6.checkServerIdentity;_.checkServerIdentity=(D,X)=>{return M(J,X)},_.servername=J}else _.servername=j;if(Y["grpc-node.tls_enable_trace"])_.enableTrace=!0;return _}class kl4{constructor(A,q){this.connectionOptions=A,this.callCredentials=q}connect(A){let q=Object.assign({socket:A},this.connectionOptions);return new Promise((K,Y)=>{let z=(0,An6.connect)(q,()=>{var w;if(((w=this.connectionOptions.rejectUnauthorized)!==null&&w!==void 0?w:!0)&&!z.authorized){Y(z.authorizationError);return}K({socket:z,secure:!0})});z.on("error",(w)=>{Y(w)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}}class rv1 extends HN6{constructor(A,q){super();this.secureContext=A,this.verifyOptions=q}_isSecure(){return!0}_equals(A){if(this===A)return!0;if(A instanceof rv1)return this.secureContext===A.secureContext&&this.verifyOptions.checkServerIdentity===A.verifyOptions.checkServerIdentity;else return!1}_createSecureConnector(A,q,K){let Y=vl4(this.secureContext,this.verifyOptions,A,q);return new kl4(Y,K!==null&&K!==void 0?K:av1.CallCredentials.createEmpty())}}class ei6 extends HN6{constructor(A,q,K){super();this.caCertificateProvider=A,this.identityCertificateProvider=q,this.verifyOptions=K,this.refcount=0,this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this),this.secureContextWatchers=[]}_isSecure(){return!0}_equals(A){var q,K;if(this===A)return!0;if(A instanceof ei6)return this.caCertificateProvider===A.caCertificateProvider&&this.identityCertificateProvider===A.identityCertificateProvider&&((q=this.verifyOptions)===null||q===void 0?void 0:q.checkServerIdentity)===((K=A.verifyOptions)===null||K===void 0?void 0:K.checkServerIdentity);else return!1}ref(){var A;if(this.refcount===0)this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),(A=this.identityCertificateProvider)===null||A===void 0||A.addIdentityCertificateListener(this.identityCertificateUpdateListener);this.refcount+=1}unref(){var A;if(this.refcount-=1,this.refcount===0)this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),(A=this.identityCertificateProvider)===null||A===void 0||A.removeIdentityCertificateListener(this.identityCertificateUpdateListener)}_createSecureConnector(A,q,K){return this.ref(),new ei6.SecureConnectorImpl(this,A,q,K!==null&&K!==void 0?K:av1.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(let A of this.secureContextWatchers)A(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate(A){this.latestCaUpdate=A,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate(A){this.latestIdentityUpdate=A,this.maybeUpdateWatchers()}hasReceivedUpdates(){if(this.latestCaUpdate===void 0)return!1;if(this.identityCertificateProvider&&this.latestIdentityUpdate===void 0)return!1;return!0}getSecureContext(){if(this.hasReceivedUpdates())return Promise.resolve(this.getLatestSecureContext());else return new Promise((A)=>{this.secureContextWatchers.push(A)})}getLatestSecureContext(){var A,q;if(!this.latestCaUpdate)return null;if(this.identityCertificateProvider!==null&&!this.latestIdentityUpdate)return null;try{return(0,An6.createSecureContext)({ca:this.latestCaUpdate.caCertificate,key:(A=this.latestIdentityUpdate)===null||A===void 0?void 0:A.privateKey,cert:(q=this.latestIdentityUpdate)===null||q===void 0?void 0:q.certificate,ciphers:tu8.CIPHER_SUITES})}catch(K){return(0,NBY.log)(vBY.LogVerbosity.ERROR,"Failed to createSecureContext with error "+K.message),null}}}ei6.SecureConnectorImpl=class{constructor(A,q,K,Y){this.parent=A,this.channelTarget=q,this.options=K,this.callCredentials=Y}connect(A){return new Promise((q,K)=>{let Y=this.parent.getLatestSecureContext();if(!Y){K(Error("Failed to load credentials"));return}if(A.closed)K(Error("Socket closed while loading credentials"));let z=vl4(Y,this.parent.verifyOptions,this.channelTarget,this.options),w=Object.assign({socket:A},z),_=()=>{K(Error("Socket closed"))},$=(H)=>{K(H)},O=(0,An6.connect)(w,()=>{var H;if(O.removeListener("close",_),O.removeListener("error",$),((H=this.parent.verifyOptions.rejectUnauthorized)!==null&&H!==void 0?H:!0)&&!O.authorized){K(O.authorizationError);return}q({socket:O,secure:!0})});O.once("close",_),O.once("error",$)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};function kBY(A,q,K){return new ei6(A,q,K!==null&&K!==void 0?K:{})}class ov1 extends HN6{constructor(A,q){super();if(this.channelCredentials=A,this.callCredentials=q,!A._isSecure())throw Error("Cannot compose insecure credentials")}compose(A){let q=this.callCredentials.compose(A);return new ov1(this.channelCredentials,q)}_isSecure(){return!0}_equals(A){if(this===A)return!0;if(A instanceof ov1)return this.channelCredentials._equals(A.channelCredentials)&&this.callCredentials._equals(A.callCredentials);else return!1}_createSecureConnector(A,q,K){let Y=this.callCredentials.compose(K!==null&&K!==void 0?K:av1.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(A,q,Y)}}});var E86=C((Rl4)=>{Object.defineProperty(Rl4,"__esModule",{value:!0});Rl4.createChildChannelControlHelper=RBY;Rl4.registerLoadBalancerType=SBY;Rl4.registerDefaultLoadBalancerType=CBY;Rl4.createLoadBalancer=hBY;Rl4.isLoadBalancerNameRegistered=IBY;Rl4.parseLoadBalancingConfig=yl4;Rl4.getDefaultConfig=bBY;Rl4.selectLbConfigFromList=xBY;var LBY=m_(),yBY=E9();function RBY(A,q){var K,Y,z,w,_,$,O,H,j,J;return{createSubchannel:(Y=(K=q.createSubchannel)===null||K===void 0?void 0:K.bind(q))!==null&&Y!==void 0?Y:A.createSubchannel.bind(A),updateState:(w=(z=q.updateState)===null||z===void 0?void 0:z.bind(q))!==null&&w!==void 0?w:A.updateState.bind(A),requestReresolution:($=(_=q.requestReresolution)===null||_===void 0?void 0:_.bind(q))!==null&&$!==void 0?$:A.requestReresolution.bind(A),addChannelzChild:(H=(O=q.addChannelzChild)===null||O===void 0?void 0:O.bind(q))!==null&&H!==void 0?H:A.addChannelzChild.bind(A),removeChannelzChild:(J=(j=q.removeChannelzChild)===null||j===void 0?void 0:j.bind(q))!==null&&J!==void 0?J:A.removeChannelzChild.bind(A)}}var k86={},qn6=null;function SBY(A,q,K){k86[A]={LoadBalancer:q,LoadBalancingConfig:K}}function CBY(A){qn6=A}function hBY(A,q){let K=A.getLoadBalancerName();if(K in k86)return new k86[K].LoadBalancer(q);else return null}function IBY(A){return A in k86}function yl4(A){let q=Object.keys(A);if(q.length!==1)throw Error("Provided load balancing config has multiple conflicting entries");let K=q[0];if(K in k86)try{return k86[K].LoadBalancingConfig.createFromJson(A[K])}catch(Y){throw Error(`${K}: ${Y.message}`)}else throw Error(`Unrecognized load balancing config name ${K}`)}function bBY(){if(!qn6)throw Error("No default load balancer type registered");return new k86[qn6].LoadBalancingConfig}function xBY(A,q=!1){for(let K of A)try{return yl4(K)}catch(Y){(0,LBY.log)(yBY.LogVerbosity.DEBUG,"Config parsing failed with error",Y.message);continue}if(q)if(qn6)return new k86[qn6].LoadBalancingConfig;else return null;else return null}});var AB8=C((hl4)=>{Object.defineProperty(hl4,"__esModule",{value:!0});hl4.validateRetryThrottling=Sl4;hl4.validateServiceConfig=Cl4;hl4.extractAndSelectServiceConfig=tBY;var dBY=g6("os"),sv1=E9(),tv1=/^\d+(\.\d{1,9})?s$/,cBY="node";function lBY(A){if("service"in A&&A.service!==""){if(typeof A.service!=="string")throw Error(`Invalid method config name: invalid service: expected type string, got ${typeof A.service}`);if("method"in A&&A.method!==""){if(typeof A.method!=="string")throw Error(`Invalid method config name: invalid method: expected type string, got ${typeof A.service}`);return{service:A.service,method:A.method}}else return{service:A.service}}else{if("method"in A&&A.method!==void 0)throw Error("Invalid method config name: method set with empty or unset service");return{}}}function iBY(A){if(!("maxAttempts"in A)||!Number.isInteger(A.maxAttempts)||A.maxAttempts<2)throw Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in A)||typeof A.initialBackoff!=="string"||!tv1.test(A.initialBackoff))throw Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("maxBackoff"in A)||typeof A.maxBackoff!=="string"||!tv1.test(A.maxBackoff))throw Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("backoffMultiplier"in A)||typeof A.backoffMultiplier!=="number"||A.backoffMultiplier<=0)throw Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!(("retryableStatusCodes"in A)&&Array.isArray(A.retryableStatusCodes)))throw Error("Invalid method config retry policy: retryableStatusCodes is required");if(A.retryableStatusCodes.length===0)throw Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(let q of A.retryableStatusCodes)if(typeof q==="number"){if(!Object.values(sv1.Status).includes(q))throw Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else if(typeof q==="string"){if(!Object.values(sv1.Status).includes(q.toUpperCase()))throw Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}else throw Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");return{maxAttempts:A.maxAttempts,initialBackoff:A.initialBackoff,maxBackoff:A.maxBackoff,backoffMultiplier:A.backoffMultiplier,retryableStatusCodes:A.retryableStatusCodes}}function nBY(A){if(!("maxAttempts"in A)||!Number.isInteger(A.maxAttempts)||A.maxAttempts<2)throw Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in A&&(typeof A.hedgingDelay!=="string"||!tv1.test(A.hedgingDelay)))throw Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in A&&Array.isArray(A.nonFatalStatusCodes))for(let K of A.nonFatalStatusCodes)if(typeof K==="number"){if(!Object.values(sv1.Status).includes(K))throw Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else if(typeof K==="string"){if(!Object.values(sv1.Status).includes(K.toUpperCase()))throw Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name")}else throw Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");let q={maxAttempts:A.maxAttempts};if(A.hedgingDelay)q.hedgingDelay=A.hedgingDelay;if(A.nonFatalStatusCodes)q.nonFatalStatusCodes=A.nonFatalStatusCodes;return q}function rBY(A){var q;let K={name:[]};if(!("name"in A)||!Array.isArray(A.name))throw Error("Invalid method config: invalid name array");for(let Y of A.name)K.name.push(lBY(Y));if("waitForReady"in A){if(typeof A.waitForReady!=="boolean")throw Error("Invalid method config: invalid waitForReady");K.waitForReady=A.waitForReady}if("timeout"in A)if(typeof A.timeout==="object"){if(!("seconds"in A.timeout)||typeof A.timeout.seconds!=="number")throw Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in A.timeout)||typeof A.timeout.nanos!=="number")throw Error("Invalid method config: invalid timeout.nanos");K.timeout=A.timeout}else if(typeof A.timeout==="string"&&tv1.test(A.timeout)){let Y=A.timeout.substring(0,A.timeout.length-1).split(".");K.timeout={seconds:Y[0]|0,nanos:((q=Y[1])!==null&&q!==void 0?q:0)|0}}else throw Error("Invalid method config: invalid timeout");if("maxRequestBytes"in A){if(typeof A.maxRequestBytes!=="number")throw Error("Invalid method config: invalid maxRequestBytes");K.maxRequestBytes=A.maxRequestBytes}if("maxResponseBytes"in A){if(typeof A.maxResponseBytes!=="number")throw Error("Invalid method config: invalid maxRequestBytes");K.maxResponseBytes=A.maxResponseBytes}if("retryPolicy"in A)if("hedgingPolicy"in A)throw Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");else K.retryPolicy=iBY(A.retryPolicy);else if("hedgingPolicy"in A)K.hedgingPolicy=nBY(A.hedgingPolicy);return K}function Sl4(A){if(!("maxTokens"in A)||typeof A.maxTokens!=="number"||A.maxTokens<=0||A.maxTokens>1000)throw Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in A)||typeof A.tokenRatio!=="number"||A.tokenRatio<=0)throw Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+A.maxTokens.toFixed(3),tokenRatio:+A.tokenRatio.toFixed(3)}}function oBY(A){if(!(typeof A==="object"&&A!==null))throw Error(`Invalid loadBalancingConfig: unexpected type ${typeof A}`);let q=Object.keys(A);if(q.length>1)throw Error(`Invalid loadBalancingConfig: unexpected multiple keys ${q}`);if(q.length===0)throw Error("Invalid loadBalancingConfig: load balancing policy name required");return{[q[0]]:A[q[0]]}}function Cl4(A){let q={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in A)if(typeof A.loadBalancingPolicy==="string")q.loadBalancingPolicy=A.loadBalancingPolicy;else throw Error("Invalid service config: invalid loadBalancingPolicy");if("loadBalancingConfig"in A)if(Array.isArray(A.loadBalancingConfig))for(let Y of A.loadBalancingConfig)q.loadBalancingConfig.push(oBY(Y));else throw Error("Invalid service config: invalid loadBalancingConfig");if("methodConfig"in A){if(Array.isArray(A.methodConfig))for(let Y of A.methodConfig)q.methodConfig.push(rBY(Y))}if("retryThrottling"in A)q.retryThrottling=Sl4(A.retryThrottling);let K=[];for(let Y of q.methodConfig)for(let z of Y.name){for(let w of K)if(z.service===w.service&&z.method===w.method)throw Error(`Invalid service config: duplicate name ${z.service}/${z.method}`);K.push(z)}return q}function aBY(A){if(!("serviceConfig"in A))throw Error("Invalid service config choice: missing service config");let q={serviceConfig:Cl4(A.serviceConfig)};if("clientLanguage"in A)if(Array.isArray(A.clientLanguage)){q.clientLanguage=[];for(let Y of A.clientLanguage)if(typeof Y==="string")q.clientLanguage.push(Y);else throw Error("Invalid service config choice: invalid clientLanguage")}else throw Error("Invalid service config choice: invalid clientLanguage");if("clientHostname"in A)if(Array.isArray(A.clientHostname)){q.clientHostname=[];for(let Y of A.clientHostname)if(typeof Y==="string")q.clientHostname.push(Y);else throw Error("Invalid service config choice: invalid clientHostname")}else throw Error("Invalid service config choice: invalid clientHostname");if("percentage"in A)if(typeof A.percentage==="number"&&0<=A.percentage&&A.percentage<=100)q.percentage=A.percentage;else throw Error("Invalid service config choice: invalid percentage");let K=["clientLanguage","percentage","clientHostname","serviceConfig"];for(let Y in A)if(!K.includes(Y))throw Error(`Invalid service config choice: unexpected field ${Y}`);return q}function sBY(A,q){if(!Array.isArray(A))throw Error("Invalid service config list");for(let K of A){let Y=aBY(K);if(typeof Y.percentage==="number"&&q>Y.percentage)continue;if(Array.isArray(Y.clientHostname)){let z=!1;for(let w of Y.clientHostname)if(w===dBY.hostname())z=!0;if(!z)continue}if(Array.isArray(Y.clientLanguage)){let z=!1;for(let w of Y.clientLanguage)if(w===cBY)z=!0;if(!z)continue}return Y.serviceConfig}throw Error("No matching service config found")}function tBY(A,q){for(let K of A)if(K.length>0&&K[0].startsWith("grpc_config=")){let Y=K.join("").substring(12),z=JSON.parse(Y);return sBY(z,q)}return null}});var dT=C((bl4)=>{Object.defineProperty(bl4,"__esModule",{value:!0});bl4.ConnectivityState=void 0;var Il4;(function(A){A[A.IDLE=0]="IDLE",A[A.CONNECTING=1]="CONNECTING",A[A.READY=2]="READY",A[A.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",A[A.SHUTDOWN=4]="SHUTDOWN"})(Il4||(bl4.ConnectivityState=Il4={}))});var Dn=C((ml4)=>{Object.defineProperty(ml4,"__esModule",{value:!0});ml4.QueuePicker=ml4.UnavailablePicker=ml4.PickResultType=void 0;var KmY=hP(),YmY=E9(),ev1;(function(A){A[A.COMPLETE=0]="COMPLETE",A[A.QUEUE=1]="QUEUE",A[A.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",A[A.DROP=3]="DROP"})(ev1||(ml4.PickResultType=ev1={}));class ul4{constructor(A){this.status=Object.assign({code:YmY.Status.UNAVAILABLE,details:"No connection established",metadata:new KmY.Metadata},A)}pick(A){return{pickResultType:ev1.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}}ml4.UnavailablePicker=ul4;class Bl4{constructor(A,q){this.loadBalancer=A,this.childPicker=q,this.calledExitIdle=!1}pick(A){if(!this.calledExitIdle)process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0;if(this.childPicker)return this.childPicker.pick(A);else return{pickResultType:ev1.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}}ml4.QueuePicker=Bl4});var JN6=C((Fl4)=>{Object.defineProperty(Fl4,"__esModule",{value:!0});Fl4.BackoffTimeout=void 0;var _mY=E9(),$mY=m_(),OmY="backoff",HmY=1000,jmY=1.6,JmY=120000,MmY=0.2;function DmY(A,q){return Math.random()*(q-A)+A}class Ak1{constructor(A,q){if(this.callback=A,this.initialDelay=HmY,this.multiplier=jmY,this.maxDelay=JmY,this.jitter=MmY,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=Ak1.getNextId(),q){if(q.initialDelay)this.initialDelay=q.initialDelay;if(q.multiplier)this.multiplier=q.multiplier;if(q.jitter)this.jitter=q.jitter;if(q.maxDelay)this.maxDelay=q.maxDelay}this.trace("constructed initialDelay="+this.initialDelay+" multiplier="+this.multiplier+" jitter="+this.jitter+" maxDelay="+this.maxDelay),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}static getNextId(){return this.nextId++}trace(A){$mY.trace(_mY.LogVerbosity.DEBUG,OmY,"{"+this.id+"} "+A)}runTimer(A){var q,K;if(this.trace("runTimer(delay="+A+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+A),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},A),!this.hasRef)(K=(q=this.timerId).unref)===null||K===void 0||K.call(q)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);let A=Math.min(this.nextDelay*this.multiplier,this.maxDelay),q=A*this.jitter;this.nextDelay=A+DmY(-q,q)}stop(){this.trace("stop()"),clearTimeout(this.timerId),this.running=!1}reset(){if(this.trace("reset() running="+this.running),this.nextDelay=this.initialDelay,this.running){let A=new Date,q=this.startTime;if(q.setMilliseconds(q.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),A{Object.defineProperty(pl4,"__esModule",{value:!0});pl4.ChildLoadBalancerHandler=void 0;var XmY=E86(),PmY=dT(),WmY="child_load_balancer_helper";class Ul4{constructor(A){this.channelControlHelper=A,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(q){this.parent=q,this.child=null}createSubchannel(q,K){return this.parent.channelControlHelper.createSubchannel(q,K)}updateState(q,K,Y){var z;if(this.calledByPendingChild()){if(q===PmY.ConnectivityState.CONNECTING)return;(z=this.parent.currentChild)===null||z===void 0||z.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(q,K,Y)}requestReresolution(){var q;let K=(q=this.parent.pendingChild)!==null&&q!==void 0?q:this.parent.currentChild;if(this.child===K)this.parent.channelControlHelper.requestReresolution()}setChild(q){this.child=q}addChannelzChild(q){this.parent.channelControlHelper.addChannelzChild(q)}removeChannelzChild(q){this.parent.channelControlHelper.removeChannelzChild(q)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance(A,q){return A.getLoadBalancerName()!==q.getLoadBalancerName()}updateAddressList(A,q,K,Y){let z;if(this.currentChild===null||this.latestConfig===null||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,q)){let w=new this.ChildPolicyHelper(this),_=(0,XmY.createLoadBalancer)(q,w);if(w.setChild(_),this.currentChild===null)this.currentChild=_,z=this.currentChild;else{if(this.pendingChild)this.pendingChild.destroy();this.pendingChild=_,z=this.pendingChild}}else if(this.pendingChild===null)z=this.currentChild;else z=this.pendingChild;return this.latestConfig=q,z.updateAddressList(A,q,K,Y)}exitIdle(){if(this.currentChild){if(this.currentChild.exitIdle(),this.pendingChild)this.pendingChild.exitIdle()}}resetBackoff(){if(this.currentChild){if(this.currentChild.resetBackoff(),this.pendingChild)this.pendingChild.resetBackoff()}}destroy(){if(this.currentChild)this.currentChild.destroy(),this.currentChild=null;if(this.pendingChild)this.pendingChild.destroy(),this.pendingChild=null}getTypeName(){return WmY}}pl4.ChildLoadBalancerHandler=Ul4});var ol4=C((nl4)=>{Object.defineProperty(nl4,"__esModule",{value:!0});nl4.ResolvingLoadBalancer=void 0;var ZmY=E86(),GmY=AB8(),Zv=dT(),cl4=zu(),Kn6=Dn(),fmY=JN6(),qB8=E9(),TmY=hP(),VmY=m_(),NmY=E9(),vmY=pT(),kmY=qk1(),EmY="resolving_load_balancer";function ll4(A){VmY.trace(NmY.LogVerbosity.DEBUG,EmY,A)}var LmY=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function ymY(A,q,K,Y){for(let z of K.name)switch(Y){case"EMPTY":if(!z.service&&!z.method)return!0;break;case"SERVICE":if(z.service===A&&!z.method)return!0;break;case"SERVICE_AND_METHOD":if(z.service===A&&z.method===q)return!0}return!1}function RmY(A,q,K,Y){for(let z of K)if(ymY(A,q,z,Y))return z;return null}function SmY(A){return{invoke(q,K){var Y,z;let w=q.split("/").filter((O)=>O.length>0),_=(Y=w[0])!==null&&Y!==void 0?Y:"",$=(z=w[1])!==null&&z!==void 0?z:"";if(A&&A.methodConfig)for(let O of LmY){let H=RmY(_,$,A.methodConfig,O);if(H)return{methodConfig:H,pickInformation:{},status:qB8.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:qB8.Status.OK,dynamicFilterFactories:[]}},unref(){}}}class il4{constructor(A,q,K,Y,z){if(this.target=A,this.channelControlHelper=q,this.channelOptions=K,this.onSuccessfulResolution=Y,this.onFailedResolution=z,this.latestChildState=Zv.ConnectivityState.IDLE,this.latestChildPicker=new Kn6.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=Zv.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,K["grpc.service_config"])this.defaultServiceConfig=(0,GmY.validateServiceConfig)(JSON.parse(K["grpc.service_config"]));else this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]};this.updateState(Zv.ConnectivityState.IDLE,new Kn6.QueuePicker(this),null),this.childLoadBalancer=new kmY.ChildLoadBalancerHandler({createSubchannel:q.createSubchannel.bind(q),requestReresolution:()=>{if(this.backoffTimeout.isRunning())ll4("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0;else this.updateResolution()},updateState:(_,$,O)=>{this.latestChildState=_,this.latestChildPicker=$,this.latestChildErrorMessage=O,this.updateState(_,$,O)},addChannelzChild:q.addChannelzChild.bind(q),removeChannelzChild:q.removeChannelzChild.bind(q)}),this.innerResolver=(0,cl4.createResolver)(A,this.handleResolverResult.bind(this),K);let w={initialDelay:K["grpc.initial_reconnect_backoff_ms"],maxDelay:K["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new fmY.BackoffTimeout(()=>{if(this.continueResolving)this.updateResolution(),this.continueResolving=!1;else this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},w),this.backoffTimeout.unref()}handleResolverResult(A,q,K,Y){var z,w;this.backoffTimeout.stop(),this.backoffTimeout.reset();let _=!0,$=null;if(K===null)$=this.defaultServiceConfig;else if(K.ok)$=K.value;else if(this.previousServiceConfig!==null)$=this.previousServiceConfig;else _=!1,this.handleResolutionFailure(K.error);if($!==null){let O=(z=$===null||$===void 0?void 0:$.loadBalancingConfig)!==null&&z!==void 0?z:[],H=(0,ZmY.selectLbConfigFromList)(O,!0);if(H===null)_=!1,this.handleResolutionFailure({code:qB8.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new TmY.Metadata});else _=this.childLoadBalancer.updateAddressList(A,H,Object.assign(Object.assign({},this.channelOptions),q),Y)}if(_)this.onSuccessfulResolution($,(w=q[cl4.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])!==null&&w!==void 0?w:SmY($));return _}updateResolution(){if(this.innerResolver.updateResolution(),this.currentState===Zv.ConnectivityState.IDLE)this.updateState(Zv.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage);this.backoffTimeout.runOnce()}updateState(A,q,K){if(ll4((0,vmY.uriToString)(this.target)+" "+Zv.ConnectivityState[this.currentState]+" -> "+Zv.ConnectivityState[A]),A===Zv.ConnectivityState.IDLE)q=new Kn6.QueuePicker(this,q);this.currentState=A,this.channelControlHelper.updateState(A,q,K)}handleResolutionFailure(A){if(this.latestChildState===Zv.ConnectivityState.IDLE)this.updateState(Zv.ConnectivityState.TRANSIENT_FAILURE,new Kn6.UnavailablePicker(A),A.details),this.onFailedResolution(A)}exitIdle(){if(this.currentState===Zv.ConnectivityState.IDLE||this.currentState===Zv.ConnectivityState.TRANSIENT_FAILURE)if(this.backoffTimeout.isRunning())this.continueResolving=!0;else this.updateResolution();this.childLoadBalancer.exitIdle()}updateAddressList(A,q){throw Error("updateAddressList not supported on ResolvingLoadBalancer")}resetBackoff(){this.backoffTimeout.reset(),this.childLoadBalancer.resetBackoff()}destroy(){this.childLoadBalancer.destroy(),this.innerResolver.destroy(),this.backoffTimeout.reset(),this.backoffTimeout.stop(),this.latestChildState=Zv.ConnectivityState.IDLE,this.latestChildPicker=new Kn6.QueuePicker(this),this.currentState=Zv.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}}nl4.ResolvingLoadBalancer=il4});var tl4=C((al4)=>{Object.defineProperty(al4,"__esModule",{value:!0});al4.recognizedOptions=void 0;al4.channelOptionsEqual=CmY;al4.recognizedOptions={"grpc.ssl_target_name_override":!0,"grpc.primary_user_agent":!0,"grpc.secondary_user_agent":!0,"grpc.default_authority":!0,"grpc.keepalive_time_ms":!0,"grpc.keepalive_timeout_ms":!0,"grpc.keepalive_permit_without_calls":!0,"grpc.service_config":!0,"grpc.max_concurrent_streams":!0,"grpc.initial_reconnect_backoff_ms":!0,"grpc.max_reconnect_backoff_ms":!0,"grpc.use_local_subchannel_pool":!0,"grpc.max_send_message_length":!0,"grpc.max_receive_message_length":!0,"grpc.enable_http_proxy":!0,"grpc.enable_channelz":!0,"grpc.dns_min_time_between_resolutions_ms":!0,"grpc.enable_retries":!0,"grpc.per_rpc_retry_buffer_size":!0,"grpc.retry_buffer_size":!0,"grpc.max_connection_age_ms":!0,"grpc.max_connection_age_grace_ms":!0,"grpc-node.max_session_memory":!0,"grpc.service_config_disable_resolution":!0,"grpc.client_idle_timeout_ms":!0,"grpc-node.tls_enable_trace":!0,"grpc.lb.ring_hash.ring_size_cap":!0,"grpc-node.retry_max_attempts_limit":!0,"grpc-node.flow_control_window":!0,"grpc.server_call_metric_recording":!0};function CmY(A,q){let K=Object.keys(A).sort(),Y=Object.keys(q).sort();if(K.length!==Y.length)return!1;for(let z=0;z{Object.defineProperty(Yi4,"__esModule",{value:!0});Yi4.EndpointMap=void 0;Yi4.isTcpSubchannelAddress=zn6;Yi4.subchannelAddressEqual=Kk1;Yi4.subchannelAddressToString=Ai4;Yi4.stringToSubchannelAddress=bmY;Yi4.endpointEqual=xmY;Yi4.endpointToString=umY;Yi4.endpointHasAddress=qi4;var el4=g6("net");function zn6(A){return"port"in A}function Kk1(A,q){if(!A&&!q)return!0;if(!A||!q)return!1;if(zn6(A))return zn6(q)&&A.host===q.host&&A.port===q.port;else return!zn6(q)&&A.path===q.path}function Ai4(A){if(zn6(A))if((0,el4.isIPv6)(A.host))return"["+A.host+"]:"+A.port;else return A.host+":"+A.port;else return A.path}var ImY=443;function bmY(A,q){if((0,el4.isIP)(A))return{host:A,port:q!==null&&q!==void 0?q:ImY};else return{path:A}}function xmY(A,q){if(A.addresses.length!==q.addresses.length)return!1;for(let K=0;K{Object.defineProperty(Mi4,"t",{value:!0});class KB8{constructor(A,q,K=1){this.i=void 0,this.h=void 0,this.o=void 0,this.u=A,this.l=q,this.p=K}I(){let A=this,q=A.o.o===A;if(q&&A.p===1)A=A.h;else if(A.i){A=A.i;while(A.h)A=A.h}else{if(q)return A.o;let K=A.o;while(K.i===A)A=K,K=A.o;A=K}return A}B(){let A=this;if(A.h){A=A.h;while(A.i)A=A.i;return A}else{let q=A.o;while(q.h===A)A=q,q=A.o;if(A.h!==q)return q;else return A}}_(){let A=this.o,q=this.h,K=q.i;if(A.o===this)A.o=q;else if(A.i===this)A.i=q;else A.h=q;if(q.o=A,q.i=this,this.o=q,this.h=K,K)K.o=this;return q}g(){let A=this.o,q=this.i,K=q.h;if(A.o===this)A.o=q;else if(A.i===this)A.i=q;else A.h=q;if(q.o=A,q.h=this,this.o=q,this.i=K,K)K.o=this;return q}}class wi4 extends KB8{constructor(){super(...arguments);this.M=1}_(){let A=super._();return this.O(),A.O(),A}g(){let A=super.g();return this.O(),A.O(),A}O(){if(this.M=1,this.i)this.M+=this.i.M;if(this.h)this.M+=this.h.M}}class _i4{constructor(A=0){this.iteratorType=A}equals(A){return this.T===A.T}}class $i4{constructor(){this.m=0}get length(){return this.m}size(){return this.m}empty(){return this.m===0}}class Oi4 extends $i4{}function dw6(){throw RangeError("Iterator access denied!")}class Hi4 extends Oi4{constructor(A=function(K,Y){if(KY)return 1;return 0},q=!1){super();this.v=void 0,this.A=A,this.enableIndex=q,this.N=q?wi4:KB8,this.C=new this.N}R(A,q){let K=this.C;while(A){let Y=this.A(A.u,q);if(Y<0)A=A.h;else if(Y>0)K=A,A=A.i;else return A}return K}K(A,q){let K=this.C;while(A)if(this.A(A.u,q)<=0)A=A.h;else K=A,A=A.i;return K}L(A,q){let K=this.C;while(A){let Y=this.A(A.u,q);if(Y<0)K=A,A=A.h;else if(Y>0)A=A.i;else return A}return K}k(A,q){let K=this.C;while(A)if(this.A(A.u,q)<0)K=A,A=A.h;else A=A.i;return K}P(A){while(!0){let q=A.o;if(q===this.C)return;if(A.p===1){A.p=0;return}if(A===q.i){let K=q.h;if(K.p===1)if(K.p=0,q.p=1,q===this.v)this.v=q._();else q._();else if(K.h&&K.h.p===1){if(K.p=q.p,q.p=0,K.h.p=0,q===this.v)this.v=q._();else q._();return}else if(K.i&&K.i.p===1)K.p=1,K.i.p=0,K.g();else K.p=1,A=q}else{let K=q.i;if(K.p===1)if(K.p=0,q.p=1,q===this.v)this.v=q.g();else q.g();else if(K.i&&K.i.p===1){if(K.p=q.p,q.p=0,K.i.p=0,q===this.v)this.v=q.g();else q.g();return}else if(K.h&&K.h.p===1)K.p=1,K.h.p=0,K._();else K.p=1,A=q}}}S(A){if(this.m===1){this.clear();return}let q=A;while(q.i||q.h){if(q.h){q=q.h;while(q.i)q=q.i}else q=q.i;let Y=A.u;A.u=q.u,q.u=Y;let z=A.l;A.l=q.l,q.l=z,A=q}if(this.C.i===q)this.C.i=q.o;else if(this.C.h===q)this.C.h=q.o;this.P(q);let K=q.o;if(q===K.i)K.i=void 0;else K.h=void 0;if(this.m-=1,this.v.p=0,this.enableIndex)while(K!==this.C)K.M-=1,K=K.o}U(A){let q=typeof A==="number"?A:void 0,K=typeof A==="function"?A:void 0,Y=typeof A>"u"?[]:void 0,z=0,w=this.v,_=[];while(_.length||w)if(w)_.push(w),w=w.i;else{if(w=_.pop(),z===q)return w;Y&&Y.push(w),K&&K(w,z,this),z+=1,w=w.h}return Y}j(A){while(!0){let q=A.o;if(q.p===0)return;let K=q.o;if(q===K.i){let Y=K.h;if(Y&&Y.p===1){if(Y.p=q.p=0,K===this.v)return;K.p=1,A=K;continue}else if(A===q.h){if(A.p=0,A.i)A.i.o=q;if(A.h)A.h.o=K;if(q.h=A.i,K.i=A.h,A.i=q,A.h=K,K===this.v)this.v=A,this.C.o=A;else{let z=K.o;if(z.i===K)z.i=A;else z.h=A}A.o=K.o,q.o=A,K.o=A,K.p=1}else{if(q.p=0,K===this.v)this.v=K.g();else K.g();K.p=1;return}}else{let Y=K.i;if(Y&&Y.p===1){if(Y.p=q.p=0,K===this.v)return;K.p=1,A=K;continue}else if(A===q.i){if(A.p=0,A.i)A.i.o=K;if(A.h)A.h.o=q;if(K.h=A.i,q.i=A.h,A.i=K,A.h=q,K===this.v)this.v=A,this.C.o=A;else{let z=K.o;if(z.i===K)z.i=A;else z.h=A}A.o=K.o,q.o=A,K.o=A,K.p=1}else{if(q.p=0,K===this.v)this.v=K._();else K._();K.p=1;return}}if(this.enableIndex)q.O(),K.O(),A.O();return}}q(A,q,K){if(this.v===void 0)return this.m+=1,this.v=new this.N(A,q,0),this.v.o=this.C,this.C.o=this.C.i=this.C.h=this.v,this.m;let Y,z=this.C.i,w=this.A(z.u,A);if(w===0)return z.l=q,this.m;else if(w>0)z.i=new this.N(A,q),z.i.o=z,Y=z.i,this.C.i=Y;else{let _=this.C.h,$=this.A(_.u,A);if($===0)return _.l=q,this.m;else if($<0)_.h=new this.N(A,q),_.h.o=_,Y=_.h,this.C.h=Y;else{if(K!==void 0){let O=K.T;if(O!==this.C){let H=this.A(O.u,A);if(H===0)return O.l=q,this.m;else if(H>0){let j=O.I(),J=this.A(j.u,A);if(J===0)return j.l=q,this.m;else if(J<0)if(Y=new this.N(A,q),j.h===void 0)j.h=Y,Y.o=j;else O.i=Y,Y.o=O}}}if(Y===void 0){Y=this.v;while(!0){let O=this.A(Y.u,A);if(O>0){if(Y.i===void 0){Y.i=new this.N(A,q),Y.i.o=Y,Y=Y.i;break}Y=Y.i}else if(O<0){if(Y.h===void 0){Y.h=new this.N(A,q),Y.h.o=Y,Y=Y.h;break}Y=Y.h}else return Y.l=q,this.m}}}}if(this.enableIndex){let _=Y.o;while(_!==this.C)_.M+=1,_=_.o}return this.j(Y),this.m+=1,this.m}H(A,q){while(A){let K=this.A(A.u,q);if(K<0)A=A.h;else if(K>0)A=A.i;else return A}return A||this.C}clear(){this.m=0,this.v=void 0,this.C.o=void 0,this.C.i=this.C.h=void 0}updateKeyByIterator(A,q){let K=A.T;if(K===this.C)dw6();if(this.m===1)return K.u=q,!0;let Y=K.B().u;if(K===this.C.i){if(this.A(Y,q)>0)return K.u=q,!0;return!1}let z=K.I().u;if(K===this.C.h){if(this.A(z,q)<0)return K.u=q,!0;return!1}if(this.A(z,q)>=0||this.A(Y,q)<=0)return!1;return K.u=q,!0}eraseElementByPos(A){if(A<0||A>this.m-1)throw RangeError();let q=this.U(A);return this.S(q),this.m}eraseElementByKey(A){if(this.m===0)return!1;let q=this.H(this.v,A);if(q===this.C)return!1;return this.S(q),!0}eraseElementByIterator(A){let q=A.T;if(q===this.C)dw6();let K=q.h===void 0;if(A.iteratorType===0){if(K)A.next()}else if(!K||q.i===void 0)A.next();return this.S(q),A}getHeight(){if(this.m===0)return 0;function A(q){if(!q)return 0;return Math.max(A(q.i),A(q.h))+1}return A(this.v)}}class ji4 extends _i4{constructor(A,q,K){super(K);if(this.T=A,this.C=q,this.iteratorType===0)this.pre=function(){if(this.T===this.C.i)dw6();return this.T=this.T.I(),this},this.next=function(){if(this.T===this.C)dw6();return this.T=this.T.B(),this};else this.pre=function(){if(this.T===this.C.h)dw6();return this.T=this.T.B(),this},this.next=function(){if(this.T===this.C)dw6();return this.T=this.T.I(),this}}get index(){let A=this.T,q=this.C.o;if(A===this.C){if(q)return q.M-1;return 0}let K=0;if(A.i)K+=A.i.M;while(A!==q){let Y=A.o;if(A===Y.h){if(K+=1,Y.i)K+=Y.i.M}A=Y}return K}isAccessible(){return this.T!==this.C}}class wu extends ji4{constructor(A,q,K,Y){super(A,q,Y);this.container=K}get pointer(){if(this.T===this.C)dw6();let A=this;return new Proxy([],{get(q,K){if(K==="0")return A.T.u;else if(K==="1")return A.T.l;return q[0]=A.T.u,q[1]=A.T.l,q[K]},set(q,K,Y){if(K!=="1")throw TypeError("prop must be 1");return A.T.l=Y,!0}})}copy(){return new wu(this.T,this.C,this.container,this.iteratorType)}}class Ji4 extends Hi4{constructor(A=[],q,K){super(q,K);let Y=this;A.forEach(function(z){Y.setElement(z[0],z[1])})}begin(){return new wu(this.C.i||this.C,this.C,this)}end(){return new wu(this.C,this.C,this)}rBegin(){return new wu(this.C.h||this.C,this.C,this,1)}rEnd(){return new wu(this.C,this.C,this,1)}front(){if(this.m===0)return;let A=this.C.i;return[A.u,A.l]}back(){if(this.m===0)return;let A=this.C.h;return[A.u,A.l]}lowerBound(A){let q=this.R(this.v,A);return new wu(q,this.C,this)}upperBound(A){let q=this.K(this.v,A);return new wu(q,this.C,this)}reverseLowerBound(A){let q=this.L(this.v,A);return new wu(q,this.C,this)}reverseUpperBound(A){let q=this.k(this.v,A);return new wu(q,this.C,this)}forEach(A){this.U(function(q,K,Y){A([q.u,q.l],K,Y)})}setElement(A,q,K){return this.q(A,q,K)}getElementByPos(A){if(A<0||A>this.m-1)throw RangeError();let q=this.U(A);return[q.u,q.l]}find(A){let q=this.H(this.v,A);return new wu(q,this.C,this)}getElementByKey(A){return this.H(this.v,A).l}union(A){let q=this;return A.forEach(function(K){q.setElement(K[0],K[1])}),this.m}*[Symbol.iterator](){let A=this.m,q=this.U();for(let K=0;K{Object.defineProperty(Pi4,"__esModule",{value:!0});Pi4.registerAdminService=cmY;Pi4.addAdminServicesToServer=lmY;var Xi4=[];function cmY(A,q){Xi4.push({getServiceDefinition:A,getHandlers:q})}function lmY(A){for(let{getServiceDefinition:q,getHandlers:K}of Xi4)A.addService(q(),K())}});var Ni4=C((Ti4)=>{Object.defineProperty(Ti4,"__esModule",{value:!0});Ti4.ClientDuplexStreamImpl=Ti4.ClientWritableStreamImpl=Ti4.ClientReadableStreamImpl=Ti4.ClientUnaryCallImpl=void 0;Ti4.callErrorFromStatus=omY;var rmY=g6("events"),YB8=g6("stream"),wn6=E9();function omY(A,q){let K=`${A.code} ${wn6.Status[A.code]}: ${A.details}`,z=`${Error(K).stack} for call at ${q}`;return Object.assign(Error(K),A,{stack:z})}class Wi4 extends rmY.EventEmitter{constructor(){super()}cancel(){var A;(A=this.call)===null||A===void 0||A.cancelWithStatus(wn6.Status.CANCELLED,"Cancelled on client")}getPeer(){var A,q;return(q=(A=this.call)===null||A===void 0?void 0:A.getPeer())!==null&&q!==void 0?q:"unknown"}getAuthContext(){var A,q;return(q=(A=this.call)===null||A===void 0?void 0:A.getAuthContext())!==null&&q!==void 0?q:null}}Ti4.ClientUnaryCallImpl=Wi4;class Zi4 extends YB8.Readable{constructor(A){super({objectMode:!0});this.deserialize=A}cancel(){var A;(A=this.call)===null||A===void 0||A.cancelWithStatus(wn6.Status.CANCELLED,"Cancelled on client")}getPeer(){var A,q;return(q=(A=this.call)===null||A===void 0?void 0:A.getPeer())!==null&&q!==void 0?q:"unknown"}getAuthContext(){var A,q;return(q=(A=this.call)===null||A===void 0?void 0:A.getAuthContext())!==null&&q!==void 0?q:null}_read(A){var q;(q=this.call)===null||q===void 0||q.startRead()}}Ti4.ClientReadableStreamImpl=Zi4;class Gi4 extends YB8.Writable{constructor(A){super({objectMode:!0});this.serialize=A}cancel(){var A;(A=this.call)===null||A===void 0||A.cancelWithStatus(wn6.Status.CANCELLED,"Cancelled on client")}getPeer(){var A,q;return(q=(A=this.call)===null||A===void 0?void 0:A.getPeer())!==null&&q!==void 0?q:"unknown"}getAuthContext(){var A,q;return(q=(A=this.call)===null||A===void 0?void 0:A.getAuthContext())!==null&&q!==void 0?q:null}_write(A,q,K){var Y;let z={callback:K},w=Number(q);if(!Number.isNaN(w))z.flags=w;(Y=this.call)===null||Y===void 0||Y.sendMessageWithContext(z,A)}_final(A){var q;(q=this.call)===null||q===void 0||q.halfClose(),A()}}Ti4.ClientWritableStreamImpl=Gi4;class fi4 extends YB8.Duplex{constructor(A,q){super({objectMode:!0});this.serialize=A,this.deserialize=q}cancel(){var A;(A=this.call)===null||A===void 0||A.cancelWithStatus(wn6.Status.CANCELLED,"Cancelled on client")}getPeer(){var A,q;return(q=(A=this.call)===null||A===void 0?void 0:A.getPeer())!==null&&q!==void 0?q:"unknown"}getAuthContext(){var A,q;return(q=(A=this.call)===null||A===void 0?void 0:A.getAuthContext())!==null&&q!==void 0?q:null}_read(A){var q;(q=this.call)===null||q===void 0||q.startRead()}_write(A,q,K){var Y;let z={callback:K},w=Number(q);if(!Number.isNaN(w))z.flags=w;(Y=this.call)===null||Y===void 0||Y.sendMessageWithContext(z,A)}_final(A){var q;(q=this.call)===null||q===void 0||q.halfClose(),A()}}Ti4.ClientDuplexStreamImpl=fi4});var cw6=C((ki4)=>{Object.defineProperty(ki4,"__esModule",{value:!0});ki4.InterceptingListenerImpl=void 0;ki4.statusOrFromValue=qgY;ki4.statusOrFromError=KgY;ki4.isInterceptingListener=YgY;var AgY=hP();function qgY(A){return{ok:!0,value:A}}function KgY(A){var q;return{ok:!1,error:Object.assign(Object.assign({},A),{metadata:(q=A.metadata)!==null&&q!==void 0?q:new AgY.Metadata})}}function YgY(A){return A.onReceiveMetadata!==void 0&&A.onReceiveMetadata.length===1}class vi4{constructor(A,q){this.listener=A,this.nextListener=q,this.processingMetadata=!1,this.hasPendingMessage=!1,this.processingMessage=!1,this.pendingStatus=null}processPendingMessage(){if(this.hasPendingMessage)this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1}processPendingStatus(){if(this.pendingStatus)this.nextListener.onReceiveStatus(this.pendingStatus)}onReceiveMetadata(A){this.processingMetadata=!0,this.listener.onReceiveMetadata(A,(q)=>{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(q),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(A){this.processingMessage=!0,this.listener.onReceiveMessage(A,(q)=>{if(this.processingMessage=!1,this.processingMetadata)this.pendingMessage=q,this.hasPendingMessage=!0;else this.nextListener.onReceiveMessage(q),this.processPendingStatus()})}onReceiveStatus(A){this.listener.onReceiveStatus(A,(q)=>{if(this.processingMetadata||this.processingMessage)this.pendingStatus=q;else this.nextListener.onReceiveStatus(q)})}}ki4.InterceptingListenerImpl=vi4});var _B8=C((xi4)=>{Object.defineProperty(xi4,"__esModule",{value:!0});xi4.InterceptingCall=xi4.RequesterBuilder=xi4.ListenerBuilder=xi4.InterceptorConfigurationError=void 0;xi4.getInterceptingCall=jgY;var $gY=hP(),Li4=cw6(),yi4=E9(),Ri4=dv1();class $n6 extends Error{constructor(A){super(A);this.name="InterceptorConfigurationError",Error.captureStackTrace(this,$n6)}}xi4.InterceptorConfigurationError=$n6;class Si4{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(A){return this.metadata=A,this}withOnReceiveMessage(A){return this.message=A,this}withOnReceiveStatus(A){return this.status=A,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}}xi4.ListenerBuilder=Si4;class Ci4{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(A){return this.start=A,this}withSendMessage(A){return this.message=A,this}withHalfClose(A){return this.halfClose=A,this}withCancel(A){return this.cancel=A,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}}xi4.RequesterBuilder=Ci4;var zB8={onReceiveMetadata:(A,q)=>{q(A)},onReceiveMessage:(A,q)=>{q(A)},onReceiveStatus:(A,q)=>{q(A)}},_n6={start:(A,q,K)=>{K(A,q)},sendMessage:(A,q)=>{q(A)},halfClose:(A)=>{A()},cancel:(A)=>{A()}};class hi4{constructor(A,q){var K,Y,z,w;if(this.nextCall=A,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,q)this.requester={start:(K=q.start)!==null&&K!==void 0?K:_n6.start,sendMessage:(Y=q.sendMessage)!==null&&Y!==void 0?Y:_n6.sendMessage,halfClose:(z=q.halfClose)!==null&&z!==void 0?z:_n6.halfClose,cancel:(w=q.cancel)!==null&&w!==void 0?w:_n6.cancel};else this.requester=_n6}cancelWithStatus(A,q){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(A,q)})}getPeer(){return this.nextCall.getPeer()}processPendingMessage(){if(this.pendingMessageContext)this.nextCall.sendMessageWithContext(this.pendingMessageContext,this.pendingMessage),this.pendingMessageContext=null,this.pendingMessage=null}processPendingHalfClose(){if(this.pendingHalfClose)this.nextCall.halfClose()}start(A,q){var K,Y,z,w,_,$;let O={onReceiveMetadata:(Y=(K=q===null||q===void 0?void 0:q.onReceiveMetadata)===null||K===void 0?void 0:K.bind(q))!==null&&Y!==void 0?Y:(H)=>{},onReceiveMessage:(w=(z=q===null||q===void 0?void 0:q.onReceiveMessage)===null||z===void 0?void 0:z.bind(q))!==null&&w!==void 0?w:(H)=>{},onReceiveStatus:($=(_=q===null||q===void 0?void 0:q.onReceiveStatus)===null||_===void 0?void 0:_.bind(q))!==null&&$!==void 0?$:(H)=>{}};this.processingMetadata=!0,this.requester.start(A,O,(H,j)=>{var J,M,D;this.processingMetadata=!1;let X;if((0,Li4.isInterceptingListener)(j))X=j;else{let P={onReceiveMetadata:(J=j.onReceiveMetadata)!==null&&J!==void 0?J:zB8.onReceiveMetadata,onReceiveMessage:(M=j.onReceiveMessage)!==null&&M!==void 0?M:zB8.onReceiveMessage,onReceiveStatus:(D=j.onReceiveStatus)!==null&&D!==void 0?D:zB8.onReceiveStatus};X=new Li4.InterceptingListenerImpl(P,O)}this.nextCall.start(H,X),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(A,q){this.processingMessage=!0,this.requester.sendMessage(q,(K)=>{if(this.processingMessage=!1,this.processingMetadata)this.pendingMessageContext=A,this.pendingMessage=q;else this.nextCall.sendMessageWithContext(A,K),this.processPendingHalfClose()})}sendMessage(A){this.sendMessageWithContext({},A)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{if(this.processingMetadata||this.processingMessage)this.pendingHalfClose=!0;else this.nextCall.halfClose()})}getAuthContext(){return this.nextCall.getAuthContext()}}xi4.InterceptingCall=hi4;function OgY(A,q,K){var Y,z;let w=(Y=K.deadline)!==null&&Y!==void 0?Y:1/0,_=K.host,$=(z=K.parent)!==null&&z!==void 0?z:null,O=K.propagate_flags,H=K.credentials,j=A.createCall(q,w,_,$,O);if(H)j.setCredentials(H);return j}class wB8{constructor(A,q){this.call=A,this.methodDefinition=q}cancelWithStatus(A,q){this.call.cancelWithStatus(A,q)}getPeer(){return this.call.getPeer()}sendMessageWithContext(A,q){let K;try{K=this.methodDefinition.requestSerialize(q)}catch(Y){this.call.cancelWithStatus(yi4.Status.INTERNAL,`Request message serialization failure: ${(0,Ri4.getErrorMessage)(Y)}`);return}this.call.sendMessageWithContext(A,K)}sendMessage(A){this.sendMessageWithContext({},A)}start(A,q){let K=null;this.call.start(A,{onReceiveMetadata:(Y)=>{var z;(z=q===null||q===void 0?void 0:q.onReceiveMetadata)===null||z===void 0||z.call(q,Y)},onReceiveMessage:(Y)=>{var z;let w;try{w=this.methodDefinition.responseDeserialize(Y)}catch(_){K={code:yi4.Status.INTERNAL,details:`Response message parsing error: ${(0,Ri4.getErrorMessage)(_)}`,metadata:new $gY.Metadata},this.call.cancelWithStatus(K.code,K.details);return}(z=q===null||q===void 0?void 0:q.onReceiveMessage)===null||z===void 0||z.call(q,w)},onReceiveStatus:(Y)=>{var z,w;if(K)(z=q===null||q===void 0?void 0:q.onReceiveStatus)===null||z===void 0||z.call(q,K);else(w=q===null||q===void 0?void 0:q.onReceiveStatus)===null||w===void 0||w.call(q,Y)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}getAuthContext(){return this.call.getAuthContext()}}class Ii4 extends wB8{constructor(A,q){super(A,q)}start(A,q){var K,Y;let z=!1,w={onReceiveMetadata:(Y=(K=q===null||q===void 0?void 0:q.onReceiveMetadata)===null||K===void 0?void 0:K.bind(q))!==null&&Y!==void 0?Y:(_)=>{},onReceiveMessage:(_)=>{var $;z=!0,($=q===null||q===void 0?void 0:q.onReceiveMessage)===null||$===void 0||$.call(q,_)},onReceiveStatus:(_)=>{var $,O;if(!z)($=q===null||q===void 0?void 0:q.onReceiveMessage)===null||$===void 0||$.call(q,null);(O=q===null||q===void 0?void 0:q.onReceiveStatus)===null||O===void 0||O.call(q,_)}};super.start(A,w),this.call.startRead()}}class bi4 extends wB8{}function HgY(A,q,K){let Y=OgY(A,K.path,q);if(K.responseStream)return new bi4(Y,K);else return new Ii4(Y,K)}function jgY(A,q,K,Y){if(A.clientInterceptors.length>0&&A.clientInterceptorProviders.length>0)throw new $n6("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(A.callInterceptors.length>0&&A.callInterceptorProviders.length>0)throw new $n6("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let z=[];if(A.callInterceptors.length>0||A.callInterceptorProviders.length>0)z=[].concat(A.callInterceptors,A.callInterceptorProviders.map(($)=>$(q))).filter(($)=>$);else z=[].concat(A.clientInterceptors,A.clientInterceptorProviders.map(($)=>$(q))).filter(($)=>$);let w=Object.assign({},K,{method_definition:q});return z.reduceRight(($,O)=>{return(H)=>O(H,$)},($)=>HgY(Y,$,q))(w)}});var OB8=C((mi4)=>{Object.defineProperty(mi4,"__esModule",{value:!0});mi4.Client=void 0;var RQ=Ni4(),PgY=HB8(),WgY=dT(),L86=E9(),MN6=hP(),zk1=_B8(),_u=Symbol(),DN6=Symbol(),XN6=Symbol(),Xn=Symbol();function $B8(A){return typeof A==="function"}function PN6(A){var q;return((q=A.stack)===null||q===void 0?void 0:q.split(` `).slice(1).join(` `))||"no stack trace available"}class Bi4{constructor(A,q,K={}){var Y,z;if(K=Object.assign({},K),this[DN6]=(Y=K.interceptors)!==null&&Y!==void 0?Y:[],delete K.interceptors,this[XN6]=(z=K.interceptor_providers)!==null&&z!==void 0?z:[],delete K.interceptor_providers,this[DN6].length>0&&this[XN6].length>0)throw Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[Xn]=K.callInvocationTransformer,delete K.callInvocationTransformer,K.channelOverride)this[_u]=K.channelOverride;else if(K.channelFactoryOverride){let w=K.channelFactoryOverride;delete K.channelFactoryOverride,this[_u]=w(A,q,K)}else this[_u]=new PgY.ChannelImplementation(A,q,K)}close(){this[_u].close()}getChannel(){return this[_u]}waitForReady(A,q){let K=(Y)=>{if(Y){q(Error("Failed to connect before the deadline"));return}let z;try{z=this[_u].getConnectivityState(!0)}catch(w){q(Error("The channel has been closed"));return}if(z===WgY.ConnectivityState.READY)q();else try{this[_u].watchConnectivityState(z,A,K)}catch(w){q(Error("The channel has been closed"))}};setImmediate(K)}checkOptionalUnaryResponseArguments(A,q,K){if($B8(A))return{metadata:new MN6.Metadata,options:{},callback:A};else if($B8(q))if(A instanceof MN6.Metadata)return{metadata:A,options:{},callback:q};else return{metadata:new MN6.Metadata,options:A,callback:q};else{if(!(A instanceof MN6.Metadata&&q instanceof Object&&$B8(K)))throw Error("Incorrect arguments passed");return{metadata:A,options:q,callback:K}}}makeUnaryRequest(A,q,K,Y,z,w,_){var $,O;let H=this.checkOptionalUnaryResponseArguments(z,w,_),j={path:A,requestStream:!1,responseStream:!1,requestSerialize:q,responseDeserialize:K},J={argument:Y,metadata:H.metadata,call:new RQ.ClientUnaryCallImpl,channel:this[_u],methodDefinition:j,callOptions:H.options,callback:H.callback};if(this[Xn])J=this[Xn](J);let M=J.call,D={clientInterceptors:this[DN6],clientInterceptorProviders:this[XN6],callInterceptors:($=J.callOptions.interceptors)!==null&&$!==void 0?$:[],callInterceptorProviders:(O=J.callOptions.interceptor_providers)!==null&&O!==void 0?O:[]},X=(0,zk1.getInterceptingCall)(D,J.methodDefinition,J.callOptions,J.channel);M.call=X;let P=null,W=!1,Z=Error();return X.start(J.metadata,{onReceiveMetadata:(G)=>{M.emit("metadata",G)},onReceiveMessage(G){if(P!==null)X.cancelWithStatus(L86.Status.UNIMPLEMENTED,"Too many responses received");P=G},onReceiveStatus(G){if(W)return;if(W=!0,G.code===L86.Status.OK)if(P===null){let f=PN6(Z);J.callback((0,RQ.callErrorFromStatus)({code:L86.Status.UNIMPLEMENTED,details:"No message received",metadata:G.metadata},f))}else J.callback(null,P);else{let f=PN6(Z);J.callback((0,RQ.callErrorFromStatus)(G,f))}Z=null,M.emit("status",G)}}),X.sendMessage(Y),X.halfClose(),M}makeClientStreamRequest(A,q,K,Y,z,w){var _,$;let O=this.checkOptionalUnaryResponseArguments(Y,z,w),H={path:A,requestStream:!0,responseStream:!1,requestSerialize:q,responseDeserialize:K},j={metadata:O.metadata,call:new RQ.ClientWritableStreamImpl(q),channel:this[_u],methodDefinition:H,callOptions:O.options,callback:O.callback};if(this[Xn])j=this[Xn](j);let J=j.call,M={clientInterceptors:this[DN6],clientInterceptorProviders:this[XN6],callInterceptors:(_=j.callOptions.interceptors)!==null&&_!==void 0?_:[],callInterceptorProviders:($=j.callOptions.interceptor_providers)!==null&&$!==void 0?$:[]},D=(0,zk1.getInterceptingCall)(M,j.methodDefinition,j.callOptions,j.channel);J.call=D;let X=null,P=!1,W=Error();return D.start(j.metadata,{onReceiveMetadata:(Z)=>{J.emit("metadata",Z)},onReceiveMessage(Z){if(X!==null)D.cancelWithStatus(L86.Status.UNIMPLEMENTED,"Too many responses received");X=Z,D.startRead()},onReceiveStatus(Z){if(P)return;if(P=!0,Z.code===L86.Status.OK)if(X===null){let G=PN6(W);j.callback((0,RQ.callErrorFromStatus)({code:L86.Status.UNIMPLEMENTED,details:"No message received",metadata:Z.metadata},G))}else j.callback(null,X);else{let G=PN6(W);j.callback((0,RQ.callErrorFromStatus)(Z,G))}W=null,J.emit("status",Z)}}),J}checkMetadataAndOptions(A,q){let K,Y;if(A instanceof MN6.Metadata)if(K=A,q)Y=q;else Y={};else{if(A)Y=A;else Y={};K=new MN6.Metadata}return{metadata:K,options:Y}}makeServerStreamRequest(A,q,K,Y,z,w){var _,$;let O=this.checkMetadataAndOptions(z,w),H={path:A,requestStream:!1,responseStream:!0,requestSerialize:q,responseDeserialize:K},j={argument:Y,metadata:O.metadata,call:new RQ.ClientReadableStreamImpl(K),channel:this[_u],methodDefinition:H,callOptions:O.options};if(this[Xn])j=this[Xn](j);let J=j.call,M={clientInterceptors:this[DN6],clientInterceptorProviders:this[XN6],callInterceptors:(_=j.callOptions.interceptors)!==null&&_!==void 0?_:[],callInterceptorProviders:($=j.callOptions.interceptor_providers)!==null&&$!==void 0?$:[]},D=(0,zk1.getInterceptingCall)(M,j.methodDefinition,j.callOptions,j.channel);J.call=D;let X=!1,P=Error();return D.start(j.metadata,{onReceiveMetadata(W){J.emit("metadata",W)},onReceiveMessage(W){J.push(W)},onReceiveStatus(W){if(X)return;if(X=!0,J.push(null),W.code!==L86.Status.OK){let Z=PN6(P);J.emit("error",(0,RQ.callErrorFromStatus)(W,Z))}P=null,J.emit("status",W)}}),D.sendMessage(Y),D.halfClose(),J}makeBidiStreamRequest(A,q,K,Y,z){var w,_;let $=this.checkMetadataAndOptions(Y,z),O={path:A,requestStream:!0,responseStream:!0,requestSerialize:q,responseDeserialize:K},H={metadata:$.metadata,call:new RQ.ClientDuplexStreamImpl(q,K),channel:this[_u],methodDefinition:O,callOptions:$.options};if(this[Xn])H=this[Xn](H);let j=H.call,J={clientInterceptors:this[DN6],clientInterceptorProviders:this[XN6],callInterceptors:(w=H.callOptions.interceptors)!==null&&w!==void 0?w:[],callInterceptorProviders:(_=H.callOptions.interceptor_providers)!==null&&_!==void 0?_:[]},M=(0,zk1.getInterceptingCall)(J,H.methodDefinition,H.callOptions,H.channel);j.call=M;let D=!1,X=Error();return M.start(H.metadata,{onReceiveMetadata(P){j.emit("metadata",P)},onReceiveMessage(P){j.push(P)},onReceiveStatus(P){if(D)return;if(D=!0,j.push(null),P.code!==L86.Status.OK){let W=PN6(X);j.emit("error",(0,RQ.callErrorFromStatus)(P,W))}X=null,j.emit("status",P)}}),j}}mi4.Client=Bi4});var wk1=C((Qi4)=>{Object.defineProperty(Qi4,"__esModule",{value:!0});Qi4.makeClientConstructor=Fi4;Qi4.loadPackageDefinition=TgY;var On6=OB8(),ZgY={unary:On6.Client.prototype.makeUnaryRequest,server_stream:On6.Client.prototype.makeServerStreamRequest,client_stream:On6.Client.prototype.makeClientStreamRequest,bidi:On6.Client.prototype.makeBidiStreamRequest};function jB8(A){return["__proto__","prototype","constructor"].includes(A)}function Fi4(A,q,K){if(!K)K={};class Y extends On6.Client{}return Object.keys(A).forEach((z)=>{if(jB8(z))return;let w=A[z],_;if(typeof z==="string"&&z.charAt(0)==="$")throw Error("Method names cannot start with $");if(w.requestStream)if(w.responseStream)_="bidi";else _="client_stream";else if(w.responseStream)_="server_stream";else _="unary";let{requestSerialize:$,responseDeserialize:O}=w,H=GgY(ZgY[_],w.path,$,O);if(Y.prototype[z]=H,Object.assign(Y.prototype[z],w),w.originalName&&!jB8(w.originalName))Y.prototype[w.originalName]=Y.prototype[z]}),Y.service=A,Y.serviceName=q,Y}function GgY(A,q,K,Y){return function(...z){return A.call(this,q,K,Y,...z)}}function fgY(A){return"format"in A}function TgY(A){let q={};for(let K in A)if(Object.prototype.hasOwnProperty.call(A,K)){let Y=A[K],z=K.split(".");if(z.some(($)=>jB8($)))continue;let w=z[z.length-1],_=q;for(let $ of z.slice(0,-1)){if(!_[$])_[$]={};_=_[$]}if(fgY(Y))_[w]=Y;else _[w]=Fi4(Y,w,{})}return q}});var Jn4=C((na_,jn4)=>{var vgY=1/0,kgY="[object Symbol]",EgY=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,LgY=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,$k1="\\ud800-\\udfff",ri4="\\u0300-\\u036f\\ufe20-\\ufe23",oi4="\\u20d0-\\u20f0",ai4="\\u2700-\\u27bf",si4="a-z\\xdf-\\xf6\\xf8-\\xff",ygY="\\xac\\xb1\\xd7\\xf7",RgY="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",SgY="\\u2000-\\u206f",CgY=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ti4="A-Z\\xc0-\\xd6\\xd8-\\xde",ei4="\\ufe0e\\ufe0f",An4=ygY+RgY+SgY+CgY,MB8="['’]",hgY="["+$k1+"]",Ui4="["+An4+"]",_k1="["+ri4+oi4+"]",qn4="\\d+",IgY="["+ai4+"]",Kn4="["+si4+"]",Yn4="[^"+$k1+An4+qn4+ai4+si4+ti4+"]",JB8="\\ud83c[\\udffb-\\udfff]",bgY="(?:"+_k1+"|"+JB8+")",zn4="[^"+$k1+"]",DB8="(?:\\ud83c[\\udde6-\\uddff]){2}",XB8="[\\ud800-\\udbff][\\udc00-\\udfff]",WN6="["+ti4+"]",wn4="\\u200d",pi4="(?:"+Kn4+"|"+Yn4+")",xgY="(?:"+WN6+"|"+Yn4+")",di4="(?:"+MB8+"(?:d|ll|m|re|s|t|ve))?",ci4="(?:"+MB8+"(?:D|LL|M|RE|S|T|VE))?",_n4=bgY+"?",$n4="["+ei4+"]?",ugY="(?:"+wn4+"(?:"+[zn4,DB8,XB8].join("|")+")"+$n4+_n4+")*",On4=$n4+_n4+ugY,BgY="(?:"+[IgY,DB8,XB8].join("|")+")"+On4,mgY="(?:"+[zn4+_k1+"?",_k1,DB8,XB8,hgY].join("|")+")",ggY=RegExp(MB8,"g"),FgY=RegExp(_k1,"g"),QgY=RegExp(JB8+"(?="+JB8+")|"+mgY+On4,"g"),UgY=RegExp([WN6+"?"+Kn4+"+"+di4+"(?="+[Ui4,WN6,"$"].join("|")+")",xgY+"+"+ci4+"(?="+[Ui4,WN6+pi4,"$"].join("|")+")",WN6+"?"+pi4+"+"+di4,WN6+"+"+ci4,qn4,BgY].join("|"),"g"),pgY=RegExp("["+wn4+$k1+ri4+oi4+ei4+"]"),dgY=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,cgY={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"ss"},lgY=typeof global=="object"&&global&&global.Object===Object&&global,igY=typeof self=="object"&&self&&self.Object===Object&&self,ngY=lgY||igY||Function("return this")();function rgY(A,q,K,Y){var z=-1,w=A?A.length:0;if(Y&&w)K=A[++z];while(++zz?0:z+q;if(K=K>z?z:K,K<0)K+=z;z=q>K?0:K-q>>>0,q>>>=0;var w=Array(z);while(++Y=Y?A:wFY(A,q,K)}function OFY(A){return function(q){q=Ok1(q);var K=Hn4(q)?AFY(q):void 0,Y=K?K[0]:q.charAt(0),z=K?$FY(K,1).join(""):q.slice(1);return Y[A]()+z}}function HFY(A){return function(q){return rgY(WFY(XFY(q).replace(ggY,"")),A,"")}}function jFY(A){return!!A&&typeof A=="object"}function JFY(A){return typeof A=="symbol"||jFY(A)&&zFY.call(A)==kgY}function Ok1(A){return A==null?"":_FY(A)}var MFY=HFY(function(A,q,K){return q=q.toLowerCase(),A+(K?DFY(q):q)});function DFY(A){return PFY(Ok1(A).toLowerCase())}function XFY(A){return A=Ok1(A),A&&A.replace(LgY,tgY).replace(FgY,"")}var PFY=OFY("toUpperCase");function WFY(A,q,K){if(A=Ok1(A),q=K?void 0:q,q===void 0)return egY(A)?KFY(A):agY(A);return A.match(q)||[]}jn4.exports=MFY});var Dn4=C((ra_,Mn4)=>{Mn4.exports=PB8;function PB8(A,q){if(typeof A==="string")q=A,A=void 0;var K=[];function Y(w){if(typeof w!=="string"){var _=z();if(PB8.verbose)console.log("codegen: "+_);if(_="return "+_,w){var $=Object.keys(w),O=Array($.length+1),H=Array($.length),j=0;while(j<$.length)O[j]=$[j],H[j]=w[$[j++]];return O[j]=_,Function.apply(null,O).apply(null,H)}return Function(_)()}var J=Array(arguments.length-1),M=0;while(M{Xn4.exports=Hn6;var ZFY=sx8(),GFY=Au8(),WB8=GFY("fs");function Hn6(A,q,K){if(typeof q==="function")K=q,q={};else if(!q)q={};if(!K)return ZFY(Hn6,this,A,q);if(!q.xhr&&WB8&&WB8.readFile)return WB8.readFile(A,function(z,w){return z&&typeof XMLHttpRequest<"u"?Hn6.xhr(A,q,K):z?K(z):K(null,q.binary?w:w.toString("utf8"))});return Hn6.xhr(A,q,K)}Hn6.xhr=function(q,K,Y){var z=new XMLHttpRequest;if(z.onreadystatechange=function(){if(z.readyState!==4)return;if(z.status!==0&&z.status!==200)return Y(Error("status "+z.status));if(K.binary){var _=z.response;if(!_){_=[];for(var $=0;${var GB8=Zn4,Wn4=GB8.isAbsolute=function(q){return/^(?:\/|\w+:)/.test(q)},ZB8=GB8.normalize=function(q){q=q.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var K=q.split("/"),Y=Wn4(q),z="";if(Y)z=K.shift()+"/";for(var w=0;w0&&K[w-1]!=="..")K.splice(--w,2);else if(Y)K.splice(w,1);else++w;else if(K[w]===".")K.splice(w,1);else++w;return z+K.join("/")};GB8.resolve=function(q,K,Y){if(!Y)K=ZB8(K);if(Wn4(K))return K;if(!Y)q=ZB8(q);return(q=q.replace(/(?:\/|^)[^/]+$/,"")).length?ZB8(q+"/"+K):K}});var GN6=C((sa_,Vn4)=>{Vn4.exports=Mz;var Hk1=R86();((Mz.prototype=Object.create(Hk1.prototype)).constructor=Mz).className="Namespace";var fB8=y86(),jk1=IP(),fFY=nw6(),lw6,ZN6,iw6;Mz.fromJSON=function(q,K){return new Mz(q,K.options).addJSON(K.nested)};function fn4(A,q){if(!(A&&A.length))return;var K={};for(var Y=0;YK)return!0}return!1};Mz.isReservedName=function(q,K){if(q){for(var Y=0;Y0){var z=q.shift();if(Y.nested&&Y.nested[z]){if(Y=Y.nested[z],!(Y instanceof Mz))throw Error("path conflicts with non-namespace objects")}else Y.add(Y=new Mz(z))}if(K)Y.addJSON(K);return Y};Mz.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var q=this.nestedArray,K=0;this.resolve();while(K{K._resolveFeaturesRecursive(q)}),this};Mz.prototype.lookup=function(q,K,Y){if(typeof K==="boolean")Y=K,K=void 0;else if(K&&!Array.isArray(K))K=[K];if(jk1.isString(q)&&q.length){if(q===".")return this.root;q=q.split(".")}else if(!q.length)return this;var z=q.join(".");if(q[0]==="")return this.root.lookup(q.slice(1),K);var w=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+z];if(w&&(!K||K.indexOf(w.constructor)>-1))return w;if(w=this._lookupImpl(q,z),w&&(!K||K.indexOf(w.constructor)>-1))return w;if(Y)return null;var _=this;while(_.parent){if(w=_.parent._lookupImpl(q,z),w&&(!K||K.indexOf(w.constructor)>-1))return w;_=_.parent}return null};Mz.prototype._lookupImpl=function(q,K){if(Object.prototype.hasOwnProperty.call(this._lookupCache,K))return this._lookupCache[K];var Y=this.get(q[0]),z=null;if(Y){if(q.length===1)z=Y;else if(Y instanceof Mz)q=q.slice(1),z=Y._lookupImpl(q,q.join("."))}else for(var w=0;w{Nn4.exports=Pn;var TB8=y86();((Pn.prototype=Object.create(TB8.prototype)).constructor=Pn).className="MapField";var TFY=rw6(),jn6=IP();function Pn(A,q,K,Y,z,w){if(TB8.call(this,A,q,Y,void 0,void 0,z,w),!jn6.isString(K))throw TypeError("keyType must be a string");this.keyType=K,this.resolvedKeyType=null,this.map=!0}Pn.fromJSON=function(q,K){return new Pn(q,K.id,K.keyType,K.type,K.options,K.comment)};Pn.prototype.toJSON=function(q){var K=q?Boolean(q.keepComments):!1;return jn6.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",K?this.comment:void 0])};Pn.prototype.resolve=function(){if(this.resolved)return this;if(TFY.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return TB8.prototype.resolve.call(this)};Pn.d=function(q,K,Y){if(typeof Y==="function")Y=jn6.decorateType(Y).name;else if(Y&&typeof Y==="object")Y=jn6.decorateEnum(Y).name;return function(w,_){jn6.decorateType(w.constructor).add(new Pn(_,q,K,Y))}}});var Mk1=C((ea_,vn4)=>{vn4.exports=ow6;var VB8=R86();((ow6.prototype=Object.create(VB8.prototype)).constructor=ow6).className="Method";var fN6=IP();function ow6(A,q,K,Y,z,w,_,$,O){if(fN6.isObject(z))_=z,z=w=void 0;else if(fN6.isObject(w))_=w,w=void 0;if(!(q===void 0||fN6.isString(q)))throw TypeError("type must be a string");if(!fN6.isString(K))throw TypeError("requestType must be a string");if(!fN6.isString(Y))throw TypeError("responseType must be a string");VB8.call(this,A,_),this.type=q||"rpc",this.requestType=K,this.requestStream=z?!0:void 0,this.responseType=Y,this.responseStream=w?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=$,this.parsedOptions=O}ow6.fromJSON=function(q,K){return new ow6(q,K.type,K.requestType,K.responseType,K.requestStream,K.responseStream,K.options,K.comment,K.parsedOptions)};ow6.prototype.toJSON=function(q){var K=q?Boolean(q.keepComments):!1;return fN6.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",K?this.comment:void 0,"parsedOptions",this.parsedOptions])};ow6.prototype.resolve=function(){if(this.resolved)return this;return this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),VB8.prototype.resolve.call(this)}});var Dk1=C((As_,En4)=>{En4.exports=ZL;var Wn=GN6();((ZL.prototype=Object.create(Wn.prototype)).constructor=ZL).className="Service";var NB8=Mk1(),Jn6=IP(),VFY=Mu8();function ZL(A,q){Wn.call(this,A,q),this.methods={},this._methodsArray=null}ZL.fromJSON=function(q,K){var Y=new ZL(q,K.options);if(K.methods)for(var z=Object.keys(K.methods),w=0;w{K._resolveFeaturesRecursive(q)}),this};ZL.prototype.add=function(q){if(this.get(q.name))throw Error("duplicate name '"+q.name+"' in "+this);if(q instanceof NB8)return this.methods[q.name]=q,q.parent=this,kn4(this);return Wn.prototype.add.call(this,q)};ZL.prototype.remove=function(q){if(q instanceof NB8){if(this.methods[q.name]!==q)throw Error(q+" is not a member of "+this);return delete this.methods[q.name],q.parent=null,kn4(this)}return Wn.prototype.remove.call(this,q)};ZL.prototype.create=function(q,K,Y){var z=new VFY.Service(q,K,Y);for(var w=0,_;w{Ln4.exports=SQ;var NFY=kQ();function SQ(A){if(A)for(var q=Object.keys(A),K=0;K{Rn4.exports=EFY;var vFY=$u(),Zn=rw6(),yn4=IP();function kFY(A){return"missing required '"+A.name+"'"}function EFY(A){var q=yn4.codegen(["r","l","e"],A.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(A.fieldsArray.filter(function($){return $.map}).length?",k,value":""))("while(r.pos>>3){"),K=0;for(;K>>3){")("case 1: k=r.%s(); break",Y.keyType)("case 2:"),Zn.basic[z]===void 0)q("value=types[%i].decode(r,r.uint32())",K);else q("value=r.%s()",z);if(q("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),Zn.long[Y.keyType]!==void 0)q('%s[typeof k==="object"?util.longToHash(k):k]=value',w);else q("%s[k]=value",w)}else if(Y.repeated){if(q("if(!(%s&&%s.length))",w,w)("%s=[]",w),Zn.packed[z]!==void 0)q("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos{Sn4.exports=RFY;var LFY=$u(),kB8=IP();function yC(A,q){return A.name+": "+q+(A.repeated&&q!=="array"?"[]":A.map&&q!=="object"?"{k:"+A.keyType+"}":"")+" expected"}function EB8(A,q,K,Y){if(q.resolvedType)if(q.resolvedType instanceof LFY){A("switch(%s){",Y)("default:")("return%j",yC(q,"enum value"));for(var z=Object.keys(q.resolvedType.values),w=0;w{var Cn4=hn4,Mn6=$u(),CQ=IP();function yB8(A,q,K,Y){var z=!1;if(q.resolvedType)if(q.resolvedType instanceof Mn6){A("switch(d%s){",Y);for(var w=q.resolvedType.values,_=Object.keys(w),$=0;$<_.length;++$){if(w[_[$]]===q.typeDefault&&!z){if(A("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',Y,Y,Y),!q.repeated)A("break");z=!0}A("case%j:",_[$])("case %i:",w[_[$]])("m%s=%j",Y,w[_[$]])("break")}A("}")}else A('if(typeof d%s!=="object")',Y)("throw TypeError(%j)",q.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",Y,K,Y);else{var O=!1;switch(q.type){case"double":case"float":A("m%s=Number(d%s)",Y,Y);break;case"uint32":case"fixed32":A("m%s=d%s>>>0",Y,Y);break;case"int32":case"sint32":case"sfixed32":A("m%s=d%s|0",Y,Y);break;case"uint64":O=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":A("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",Y,Y,O)('else if(typeof d%s==="string")',Y)("m%s=parseInt(d%s,10)",Y,Y)('else if(typeof d%s==="number")',Y)("m%s=d%s",Y,Y)('else if(typeof d%s==="object")',Y)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",Y,Y,Y,O?"true":"");break;case"bytes":A('if(typeof d%s==="string")',Y)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",Y,Y,Y)("else if(d%s.length >= 0)",Y)("m%s=d%s",Y,Y);break;case"string":A("m%s=String(d%s)",Y,Y);break;case"bool":A("m%s=Boolean(d%s)",Y,Y);break}}return A}Cn4.fromObject=function(q){var K=q.fieldsArray,Y=CQ.codegen(["d"],q.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!K.length)return Y("return new this.ctor");Y("var m=new this.ctor");for(var z=0;z>>0,m%s.high>>>0).toNumber(%s):m%s",Y,Y,Y,Y,z?"true":"",Y);break;case"bytes":A("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",Y,Y,Y,Y,Y);break;default:A("d%s=m%s",Y,Y);break}}return A}Cn4.toObject=function(q){var K=q.fieldsArray.slice().sort(CQ.compareFieldsById);if(!K.length)return CQ.codegen()("return {}");var Y=CQ.codegen(["m","o"],q.name+"$toObject")("if(!o)")("o={}")("var d={}"),z=[],w=[],_=[],$=0;for(;${var SFY=In4,CFY=Xk1();SFY[".google.protobuf.Any"]={fromObject:function(A){if(A&&A["@type"]){var q=A["@type"].substring(A["@type"].lastIndexOf("/")+1),K=this.lookup(q);if(K){var Y=A["@type"].charAt(0)==="."?A["@type"].slice(1):A["@type"];if(Y.indexOf("/")===-1)Y="/"+Y;return this.create({type_url:Y,value:K.encode(K.fromObject(A)).finish()})}}return this.fromObject(A)},toObject:function(A,q){var K="type.googleapis.com/",Y="",z="";if(q&&q.json&&A.type_url&&A.value){z=A.type_url.substring(A.type_url.lastIndexOf("/")+1),Y=A.type_url.substring(0,A.type_url.lastIndexOf("/")+1);var w=this.lookup(z);if(w)A=w.decode(A.value)}if(!(A instanceof this.ctor)&&A instanceof CFY){var _=A.$type.toObject(A,q),$=A.$type.fullName[0]==="."?A.$type.fullName.slice(1):A.$type.fullName;if(Y==="")Y=K;return z=Y+$,_["@type"]=z,_}return this.toObject(A,q)}}});var Zk1=C((_s_,xn4)=>{xn4.exports=g_;var RC=GN6();((g_.prototype=Object.create(RC.prototype)).constructor=g_).className="Type";var hFY=$u(),bB8=nw6(),Pk1=y86(),IFY=Jk1(),bFY=Dk1(),hB8=Xk1(),IB8=xv1(),xFY=Iv1(),IG=IP(),uFY=xB8(),BFY=vB8(),mFY=LB8(),bn4=SB8(),gFY=CB8();function g_(A,q){RC.call(this,A,q),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(g_.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var A=Object.keys(this.fields),q=0;q{K._resolveFeatures(q)}),this.fieldsArray.forEach((K)=>{K._resolveFeatures(q)}),this};g_.prototype.get=function(q){return this.fields[q]||this.oneofs&&this.oneofs[q]||this.nested&&this.nested[q]||null};g_.prototype.add=function(q){if(this.get(q.name))throw Error("duplicate name '"+q.name+"' in "+this);if(q instanceof Pk1&&q.extend===void 0){if(this._fieldsById?this._fieldsById[q.id]:this.fieldsById[q.id])throw Error("duplicate id "+q.id+" in "+this);if(this.isReservedId(q.id))throw Error("id "+q.id+" is reserved in "+this);if(this.isReservedName(q.name))throw Error("name '"+q.name+"' is reserved in "+this);if(q.parent)q.parent.remove(q);return this.fields[q.name]=q,q.message=this,q.onAdd(this),Wk1(this)}if(q instanceof bB8){if(!this.oneofs)this.oneofs={};return this.oneofs[q.name]=q,q.onAdd(this),Wk1(this)}return RC.prototype.add.call(this,q)};g_.prototype.remove=function(q){if(q instanceof Pk1&&q.extend===void 0){if(!this.fields||this.fields[q.name]!==q)throw Error(q+" is not a member of "+this);return delete this.fields[q.name],q.parent=null,q.onRemove(this),Wk1(this)}if(q instanceof bB8){if(!this.oneofs||this.oneofs[q.name]!==q)throw Error(q+" is not a member of "+this);return delete this.oneofs[q.name],q.parent=null,q.onRemove(this),Wk1(this)}return RC.prototype.remove.call(this,q)};g_.prototype.isReservedId=function(q){return RC.isReservedId(this.reserved,q)};g_.prototype.isReservedName=function(q){return RC.isReservedName(this.reserved,q)};g_.prototype.create=function(q){return new this.ctor(q)};g_.prototype.setup=function(){var q=this.fullName,K=[];for(var Y=0;Y{mn4.exports=GL;var Tk1=GN6();((GL.prototype=Object.create(Tk1.prototype)).constructor=GL).className="Root";var Gk1=y86(),uB8=$u(),FFY=nw6(),S86=IP(),BB8,mB8,Dn6;function GL(A){Tk1.call(this,"",A),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}GL.fromJSON=function(q,K){if(!K)K=new GL;if(q.options)K.setOptions(q.options);return K.addJSON(q.nested).resolveAll()};GL.prototype.resolvePath=S86.path.resolve;GL.prototype.fetch=S86.fetch;function Bn4(){}GL.prototype.load=function A(q,K,Y){if(typeof K==="function")Y=K,K=void 0;var z=this;if(!Y)return S86.asPromise(A,z,q,K);var w=Y===Bn4;function _(D,X){if(!Y)return;if(w)throw D;if(X)X.resolveAll();var P=Y;Y=null,P(D,X)}function $(D){var X=D.lastIndexOf("google/protobuf/");if(X>-1){var P=D.substring(X);if(P in Dn6)return P}return null}function O(D,X){try{if(S86.isString(X)&&X.charAt(0)==="{")X=JSON.parse(X);if(!S86.isString(X))z.setOptions(X.options).addJSON(X.nested);else{mB8.filename=D;var P=mB8(X,z,K),W,Z=0;if(P.imports){for(;Z-1)return;if(z.files.push(D),D in Dn6){if(w)O(D,Dn6[D]);else++j,setTimeout(function(){--j,O(D,Dn6[D])});return}if(w){var P;try{P=S86.fs.readFileSync(D).toString("utf8")}catch(W){if(!X)_(W);return}O(D,P)}else++j,z.fetch(D,function(W,Z){if(--j,!Y)return;if(W){if(!X)_(W);else if(!j)_(null,z);return}O(D,Z)})}var j=0;if(S86.isString(q))q=[q];for(var J=0,M;J-1)this.deferred.splice(K,1)}}else if(q instanceof uB8){if(fk1.test(q.name))delete q.parent[q.name]}else if(q instanceof Tk1){for(var Y=0;Y{var nJ=Fn4.exports=kQ(),gn4=Du8(),gB8,FB8;nJ.codegen=Dn4();nJ.fetch=Pn4();nJ.path=Gn4();nJ.fs=nJ.inquire("fs");nJ.toArray=function(q){if(q){var K=Object.keys(q),Y=Array(K.length),z=0;while(z0)_[H]=w(_[H]||{},$,O);else{var j=_[H];if(j&&z)return _;if(j)O=[].concat(j).concat(O);_[H]=O}return _}if(typeof q!=="object")throw TypeError("dst must be an object");if(!K)throw TypeError("path must be specified");return K=K.split("."),w(q,K,Y)};Object.defineProperty(nJ,"decorateRoot",{get:function(){return gn4.decorated||(gn4.decorated=new(Vk1()))}})});var rw6=C((Qn4)=>{var Xn6=Qn4,cFY=IP(),lFY=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function Pn6(A,q){var K=0,Y={};q|=0;while(K{pn4.exports=bP;var Zn6=R86();((bP.prototype=Object.create(Zn6.prototype)).constructor=bP).className="Field";var Un4=$u(),QB8=rw6(),jD=IP(),Wn6,iFY=/^required|optional|repeated$/;bP.fromJSON=function(q,K){var Y=new bP(q,K.id,K.type,K.rule,K.extend,K.options,K.comment);if(K.edition)Y._edition=K.edition;return Y._defaultEdition="proto3",Y};function bP(A,q,K,Y,z,w,_){if(jD.isObject(Y))_=z,w=Y,Y=z=void 0;else if(jD.isObject(z))_=w,w=z,z=void 0;if(Zn6.call(this,A,w),!jD.isInteger(q)||q<0)throw TypeError("id must be a non-negative integer");if(!jD.isString(K))throw TypeError("type must be a string");if(Y!==void 0&&!iFY.test(Y=Y.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(z!==void 0&&!jD.isString(z))throw TypeError("extend must be a string");if(Y==="proto3_optional")Y="optional";this.rule=Y&&Y!=="optional"?Y:void 0,this.type=K,this.id=q,this.extend=z||void 0,this.repeated=Y==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=jD.Long?QB8.long[K]!==void 0:!1,this.bytes=K==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=_}Object.defineProperty(bP.prototype,"required",{get:function(){return this._features.field_presence==="LEGACY_REQUIRED"}});Object.defineProperty(bP.prototype,"optional",{get:function(){return!this.required}});Object.defineProperty(bP.prototype,"delimited",{get:function(){return this.resolvedType instanceof Wn6&&this._features.message_encoding==="DELIMITED"}});Object.defineProperty(bP.prototype,"packed",{get:function(){return this._features.repeated_field_encoding==="PACKED"}});Object.defineProperty(bP.prototype,"hasPresence",{get:function(){if(this.repeated||this.map)return!1;return this.partOf||this.declaringField||this.extensionField||this._features.field_presence!=="IMPLICIT"}});bP.prototype.setOption=function(q,K,Y){return Zn6.prototype.setOption.call(this,q,K,Y)};bP.prototype.toJSON=function(q){var K=q?Boolean(q.keepComments):!1;return jD.toObject(["edition",this._editionToJSON(),"rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",K?this.comment:void 0])};bP.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=QB8.defaults[this.type])===void 0)if(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof Wn6)this.typeDefault=null;else this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]];else if(this.options&&this.options.proto3_optional)this.typeDefault=null;if(this.options&&this.options.default!=null){if(this.typeDefault=this.options.default,this.resolvedType instanceof Un4&&typeof this.typeDefault==="string")this.typeDefault=this.resolvedType.values[this.typeDefault]}if(this.options){if(this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof Un4))delete this.options.packed;if(!Object.keys(this.options).length)this.options=void 0}if(this.long){if(this.typeDefault=jD.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze)Object.freeze(this.typeDefault)}else if(this.bytes&&typeof this.typeDefault==="string"){var q;if(jD.base64.test(this.typeDefault))jD.base64.decode(this.typeDefault,q=jD.newBuffer(jD.base64.length(this.typeDefault)),0);else jD.utf8.write(this.typeDefault,q=jD.newBuffer(jD.utf8.length(this.typeDefault)),0);this.typeDefault=q}if(this.map)this.defaultValue=jD.emptyObject;else if(this.repeated)this.defaultValue=jD.emptyArray;else this.defaultValue=this.typeDefault;if(this.parent instanceof Wn6)this.parent.ctor.prototype[this.name]=this.defaultValue;return Zn6.prototype.resolve.call(this)};bP.prototype._inferLegacyProtoFeatures=function(q){if(q!=="proto2"&&q!=="proto3")return{};var K={};if(this.rule==="required")K.field_presence="LEGACY_REQUIRED";if(this.parent&&QB8.defaults[this.type]===void 0){var Y=this.parent.get(this.type.split(".").pop());if(Y&&Y instanceof Wn6&&Y.group)K.message_encoding="DELIMITED"}if(this.getOption("packed")===!0)K.repeated_field_encoding="PACKED";else if(this.getOption("packed")===!1)K.repeated_field_encoding="EXPANDED";return K};bP.prototype._resolveFeatures=function(q){return Zn6.prototype._resolveFeatures.call(this,this._edition||q)};bP.d=function(q,K,Y,z){if(typeof K==="function")K=jD.decorateType(K).name;else if(K&&typeof K==="object")K=jD.decorateEnum(K).name;return function(_,$){jD.decorateType(_.constructor).add(new bP($,q,K,Y,{default:z}))}};bP._configure=function(q){Wn6=q}});var nw6=C((Js_,ln4)=>{ln4.exports=fL;var vk1=R86();((fL.prototype=Object.create(vk1.prototype)).constructor=fL).className="OneOf";var dn4=y86(),Nk1=IP();function fL(A,q,K,Y){if(!Array.isArray(q))K=q,q=void 0;if(vk1.call(this,A,K),!(q===void 0||Array.isArray(q)))throw TypeError("fieldNames must be an Array");this.oneof=q||[],this.fieldsArray=[],this.comment=Y}fL.fromJSON=function(q,K){return new fL(q,K.oneof,K.options,K.comment)};fL.prototype.toJSON=function(q){var K=q?Boolean(q.keepComments):!1;return Nk1.toObject(["options",this.options,"oneof",this.oneof,"comment",K?this.comment:void 0])};function cn4(A){if(A.parent){for(var q=0;q-1)this.oneof.splice(K,1);return q.partOf=null,this};fL.prototype.onAdd=function(q){vk1.prototype.onAdd.call(this,q);var K=this;for(var Y=0;Y{in4.exports=hW;hW.className="ReflectionObject";var nFY=nw6(),Gn6=IP(),kk1,rFY={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},oFY={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},aFY={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function hW(A,q){if(!Gn6.isString(A))throw TypeError("name must be a string");if(q&&!Gn6.isObject(q))throw TypeError("options must be an object");this.options=q,this.parsedOptions=null,this.name=A,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(hW.prototype,{root:{get:function(){var A=this;while(A.parent!==null)A=A.parent;return A}},fullName:{get:function(){var A=[this.name],q=this.parent;while(q)A.unshift(q.name),q=q.parent;return A.join(".")}}});hW.prototype.toJSON=function(){throw Error()};hW.prototype.onAdd=function(q){if(this.parent&&this.parent!==q)this.parent.remove(this);this.parent=q,this.resolved=!1;var K=q.root;if(K instanceof kk1)K._handleAdd(this)};hW.prototype.onRemove=function(q){var K=q.root;if(K instanceof kk1)K._handleRemove(this);this.parent=null,this.resolved=!1};hW.prototype.resolve=function(){if(this.resolved)return this;if(this.root instanceof kk1)this.resolved=!0;return this};hW.prototype._resolveFeaturesRecursive=function(q){return this._resolveFeatures(this._edition||q)};hW.prototype._resolveFeatures=function(q){if(this._featuresResolved)return;var K={};if(!q)throw Error("Unknown edition for "+this.fullName);var Y=Object.assign(this.options?Object.assign({},this.options.features):{},this._inferLegacyProtoFeatures(q));if(this._edition){if(q==="proto2")K=Object.assign({},oFY);else if(q==="proto3")K=Object.assign({},aFY);else if(q==="2023")K=Object.assign({},rFY);else throw Error("Unknown edition: "+q);this._features=Object.assign(K,Y||{}),this._featuresResolved=!0;return}if(this.partOf instanceof nFY){var z=Object.assign({},this.partOf._features);this._features=Object.assign(z,Y||{})}else if(this.declaringField);else if(this.parent){var w=Object.assign({},this.parent._features);this._features=Object.assign(w,Y||{})}else throw Error("Unable to find a parent for "+this.fullName);if(this.extensionField)this.extensionField._features=this._features;this._featuresResolved=!0};hW.prototype._inferLegacyProtoFeatures=function(){return{}};hW.prototype.getOption=function(q){if(this.options)return this.options[q];return};hW.prototype.setOption=function(q,K,Y){if(!this.options)this.options={};if(/^features\./.test(q))Gn6.setProperty(this.options,q,K,Y);else if(!Y||this.options[q]===void 0){if(this.getOption(q)!==K)this.resolved=!1;this.options[q]=K}return this};hW.prototype.setParsedOption=function(q,K,Y){if(!this.parsedOptions)this.parsedOptions=[];var z=this.parsedOptions;if(Y){var w=z.find(function(O){return Object.prototype.hasOwnProperty.call(O,q)});if(w){var _=w[q];Gn6.setProperty(_,Y,K)}else w={},w[q]=Gn6.setProperty({},Y,K),z.push(w)}else{var $={};$[q]=K,z.push($)}return this};hW.prototype.setOptions=function(q,K){if(q)for(var Y=Object.keys(q),z=0;z{rn4.exports=Ou;var UB8=R86();((Ou.prototype=Object.create(UB8.prototype)).constructor=Ou).className="Enum";var nn4=GN6(),Ek1=IP();function Ou(A,q,K,Y,z,w){if(UB8.call(this,A,K),q&&typeof q!=="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=Y,this.comments=z||{},this.valuesOptions=w,this._valuesFeatures={},this.reserved=void 0,q){for(var _=Object.keys(q),$=0;$<_.length;++$)if(typeof q[_[$]]==="number")this.valuesById[this.values[_[$]]=q[_[$]]]=_[$]}}Ou.prototype._resolveFeatures=function(q){return q=this._edition||q,UB8.prototype._resolveFeatures.call(this,q),Object.keys(this.values).forEach((K)=>{var Y=Object.assign({},this._features);this._valuesFeatures[K]=Object.assign(Y,this.valuesOptions&&this.valuesOptions[K]&&this.valuesOptions[K].features)}),this};Ou.fromJSON=function(q,K){var Y=new Ou(q,K.values,K.options,K.comment,K.comments);if(Y.reserved=K.reserved,K.edition)Y._edition=K.edition;return Y._defaultEdition="proto3",Y};Ou.prototype.toJSON=function(q){var K=q?Boolean(q.keepComments):!1;return Ek1.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",K?this.comment:void 0,"comments",K?this.comments:void 0])};Ou.prototype.add=function(q,K,Y,z){if(!Ek1.isString(q))throw TypeError("name must be a string");if(!Ek1.isInteger(K))throw TypeError("id must be an integer");if(this.values[q]!==void 0)throw Error("duplicate name '"+q+"' in "+this);if(this.isReservedId(K))throw Error("id "+K+" is reserved in "+this);if(this.isReservedName(q))throw Error("name '"+q+"' is reserved in "+this);if(this.valuesById[K]!==void 0){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+K+" in "+this);this.values[q]=K}else this.valuesById[this.values[q]=K]=q;if(z){if(this.valuesOptions===void 0)this.valuesOptions={};this.valuesOptions[q]=z||null}return this.comments[q]=Y||null,this};Ou.prototype.remove=function(q){if(!Ek1.isString(q))throw TypeError("name must be a string");var K=this.values[q];if(K==null)throw Error("name '"+q+"' does not exist in "+this);if(delete this.valuesById[K],delete this.values[q],delete this.comments[q],this.valuesOptions)delete this.valuesOptions[q];return this};Ou.prototype.isReservedId=function(q){return nn4.isReservedId(this.reserved,q)};Ou.prototype.isReservedName=function(q){return nn4.isReservedName(this.reserved,q)}});var xB8=C((Xs_,an4)=>{an4.exports=tFY;var sFY=$u(),pB8=rw6(),dB8=IP();function on4(A,q,K,Y){return q.delimited?A("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",K,Y,(q.id<<3|3)>>>0,(q.id<<3|4)>>>0):A("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",K,Y,(q.id<<3|2)>>>0)}function tFY(A){var q=dB8.codegen(["m","w"],A.name+"$encode")("if(!w)")("w=Writer.create()"),K,Y,z=A.fieldsArray.slice().sort(dB8.compareFieldsById);for(var K=0;K>>0,8|pB8.mapKey[w.keyType],w.keyType),O===void 0)q("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",_,Y);else q(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|O,$,Y);q("}")("}")}else if(w.repeated){if(q("if(%s!=null&&%s.length){",Y,Y),w.packed&&pB8.packed[$]!==void 0)q("w.uint32(%i).fork()",(w.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",Y)("w.%s(%s[i])",$,Y)("w.ldelim()");else if(q("for(var i=0;i<%s.length;++i)",Y),O===void 0)on4(q,w,_,Y+"[i]");else q("w.uint32(%i).%s(%s[i])",(w.id<<3|O)>>>0,$,Y);q("}")}else{if(w.optional)q("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",Y,w.name);if(O===void 0)on4(q,w,_,Y);else q("w.uint32(%i).%s(%s)",(w.id<<3|O)>>>0,$,Y)}}return q("return w")}});var tn4=C((Ps_,sn4)=>{var Dz=sn4.exports=Xu8();Dz.build="light";function eFY(A,q,K){if(typeof q==="function")K=q,q=new Dz.Root;else if(!q)q=new Dz.Root;return q.load(A,K)}Dz.load=eFY;function AQY(A,q){if(!q)q=new Dz.Root;return q.loadSync(A)}Dz.loadSync=AQY;Dz.encoder=xB8();Dz.decoder=vB8();Dz.verifier=LB8();Dz.converter=SB8();Dz.ReflectionObject=R86();Dz.Namespace=GN6();Dz.Root=Vk1();Dz.Enum=$u();Dz.Type=Zk1();Dz.Field=y86();Dz.OneOf=nw6();Dz.MapField=Jk1();Dz.Service=Dk1();Dz.Method=Mk1();Dz.Message=Xk1();Dz.wrappers=CB8();Dz.types=rw6();Dz.util=IP();Dz.ReflectionObject._configure(Dz.Root);Dz.Namespace._configure(Dz.Type,Dz.Service,Dz.Enum);Dz.Root._configure(Dz.Type);Dz.Field._configure(Dz.Type)});var lB8=C((Ws_,qr4)=>{qr4.exports=Ar4;var cB8=/[\s{}=;:[\],'"()<>]/g,qQY=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,KQY=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,YQY=/^ *[*/]+ */,zQY=/^\s*\*?\/*/,wQY=/\n/g,_QY=/\s/,$QY=/\\(.?)/g,OQY={"0":"\x00",r:"\r",n:` `,t:"\t"};function en4(A){return A.replace($QY,function(q,K){switch(K){case"\\":case"":return K;default:return OQY[K]||""}})}Ar4.unescape=en4;function Ar4(A,q){A=A.toString();var K=0,Y=A.length,z=1,w=0,_={},$=[],O=null;function H(V){return Error("illegal "+V+" (line "+z+")")}function j(){var V=O==="'"?KQY:qQY;V.lastIndex=K-1;var N=V.exec(A);if(!N)throw H("string");return K=V.lastIndex,W(O),O=null,en4(N[1])}function J(V){return A.charAt(V)}function M(V,N,v){var y={type:A.charAt(V++),lineEmpty:!1,leading:v},R;if(q)R=2;else R=3;var h=V-R,B;do if(--h<0||(B=A.charAt(h))===` `){y.lineEmpty=!0;break}while(B===" "||B==="\t");var x=A.substring(V,N).split(wQY);for(var F=0;F0)return $.shift();if(O)return j();var V,N,v,y,R,h=K===0;do{if(K===Y)return null;V=!1;while(_QY.test(v=J(K))){if(v===` `)h=!0,++z;if(++K===Y)return null}if(J(K)==="/"){if(++K===Y)throw H("comment");if(J(K)==="/")if(!q){R=J(y=K+1)==="/";while(J(++K)!==` `)if(K===Y)return null;if(++K,R)M(y,K-1,h),h=!0;++z,V=!0}else{if(y=K,R=!1,D(K-1)){R=!0;do{if(K=X(K),K===Y)break;if(K++,!h)break}while(D(K))}else K=Math.min(Y,X(K)+1);if(R)M(y,K,h),h=!0;z++,V=!0}else if((v=J(K))==="*"){y=K+1,R=q||J(y)==="*";do{if(v===` `)++z;if(++K===Y)throw H("comment");N=v,v=J(K)}while(N!=="*"||v!=="/");if(++K,R)M(y,K-2,h),h=!0;V=!0}else return"/"}}while(V);var B=K;cB8.lastIndex=0;var x=cB8.test(J(B++));if(!x)while(B{_r4.exports=Gn;Gn.filename=null;Gn.defaults={keepCase:!1};var HQY=lB8(),Kr4=Vk1(),Yr4=Zk1(),zr4=y86(),jQY=Jk1(),wr4=nw6(),JQY=$u(),MQY=Dk1(),DQY=Mk1(),XQY=R86(),PQY=rw6(),iB8=IP(),WQY=/^[1-9][0-9]*$/,ZQY=/^-?[1-9][0-9]*$/,GQY=/^0[x][0-9a-fA-F]+$/,fQY=/^-?0[x][0-9a-fA-F]+$/,TQY=/^0[0-7]+$/,VQY=/^-?0[0-7]+$/,NQY=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,hQ=/^[a-zA-Z_][a-zA-Z_0-9]*$/,IQ=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;function Gn(A,q,K){if(!(q instanceof Kr4))K=q,q=new Kr4;if(!K)K=Gn.defaults;var Y=K.preferTrailingComment||!1,z=HQY(A,K.alternateCommentMode||!1),w=z.next,_=z.push,$=z.peek,O=z.skip,H=z.cmnt,j=!0,J,M,D,X="proto2",P=q,W=[],Z={},G=K.keepCase?function(a){return a}:iB8.camelCase;function f(){W.forEach((a)=>{a._edition=X,Object.keys(Z).forEach((r)=>{if(a.getOption(r)!==void 0)return;a.setOption(r,Z[r],!0)})})}function V(a,r,X6){var O6=Gn.filename;if(!X6)Gn.filename=null;return Error("illegal "+(r||"token")+" '"+a+"' ("+(O6?O6+", ":"")+"line "+z.line+")")}function N(){var a=[],r;do{if((r=w())!=='"'&&r!=="'")throw V(r);a.push(w()),O(r),r=$()}while(r==='"'||r==="'");return a.join("")}function v(a){var r=w();switch(r){case"'":case'"':return _(r),N();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return R(r,!0)}catch(X6){if(a&&IQ.test(r))return r;throw V(r,"value")}}function y(a,r){var X6,O6;do if(r&&((X6=$())==='"'||X6==="'")){var D6=N();if(a.push(D6),X>=2023)throw V(D6,"id")}else try{a.push([O6=h(w()),O("to",!0)?h(w()):O6])}catch(C6){if(r&&IQ.test(X6)&&X>=2023)a.push(X6);else throw C6}while(O(",",!0));var y6={options:void 0};y6.setOption=function(C6,h6){if(this.options===void 0)this.options={};this.options[C6]=h6},U(y6,function(h6){if(h6==="option")q6(y6,h6),O(";");else throw V(h6)},function(){k6(y6)})}function R(a,r){var X6=1;if(a.charAt(0)==="-")X6=-1,a=a.substring(1);switch(a){case"inf":case"INF":case"Inf":return X6*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(WQY.test(a))return X6*parseInt(a,10);if(GQY.test(a))return X6*parseInt(a,16);if(TQY.test(a))return X6*parseInt(a,8);if(NQY.test(a))return X6*parseFloat(a);throw V(a,"number",r)}function h(a,r){switch(a){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!r&&a.charAt(0)==="-")throw V(a,"id");if(ZQY.test(a))return parseInt(a,10);if(fQY.test(a))return parseInt(a,16);if(VQY.test(a))return parseInt(a,8);throw V(a,"id")}function B(){if(J!==void 0)throw V("package");if(J=w(),!IQ.test(J))throw V(J,"name");P=P.define(J),O(";")}function x(){var a=$(),r;switch(a){case"weak":r=D||(D=[]),w();break;case"public":w();default:r=M||(M=[]);break}a=N(),O(";"),r.push(a)}function F(){if(O("="),X=N(),X<2023)throw V(X,"syntax");O(";")}function g(){if(O("="),X=N(),!["2023"].includes(X))throw V(X,"edition");O(";")}function b(a,r){switch(r){case"option":return q6(a,r),O(";"),!0;case"message":return d(a,r),!0;case"enum":return Z6(a,r),!0;case"service":return P6(a,r),!0;case"extend":return K6(a,r),!0}return!1}function U(a,r,X6){var O6=z.line;if(a){if(typeof a.comment!=="string")a.comment=H();a.filename=Gn.filename}if(O("{",!0)){var D6;while((D6=w())!=="}")r(D6);O(";",!0)}else{if(X6)X6();if(O(";"),a&&(typeof a.comment!=="string"||Y))a.comment=H(O6)||a.comment}}function d(a,r){if(!hQ.test(r=w()))throw V(r,"type name");var X6=new Yr4(r);if(U(X6,function(D6){if(b(X6,D6))return;switch(D6){case"map":s(X6,D6);break;case"required":if(X!=="proto2")throw V(D6);case"repeated":l(X6,D6);break;case"optional":if(X==="proto3")l(X6,"proto3_optional");else if(X!=="proto2")throw V(D6);else l(X6,"optional");break;case"oneof":H6(X6,D6);break;case"extensions":y(X6.extensions||(X6.extensions=[]));break;case"reserved":y(X6.reserved||(X6.reserved=[]),!0);break;default:if(X==="proto2"||!IQ.test(D6))throw V(D6);_(D6),l(X6,"optional");break}}),a.add(X6),a===P)W.push(X6)}function l(a,r,X6){var O6=w();if(O6==="group"){t(a,r);return}while(O6.endsWith(".")||$().startsWith("."))O6+=w();if(!IQ.test(O6))throw V(O6,"type");var D6=w();if(!hQ.test(D6))throw V(D6,"name");D6=G(D6),O("=");var y6=new zr4(D6,h(w()),O6,r,X6);if(U(y6,function(f6){if(f6==="option")q6(y6,f6),O(";");else throw V(f6)},function(){k6(y6)}),r==="proto3_optional"){var C6=new wr4("_"+D6);y6.setOption("proto3_optional",!0),C6.add(y6),a.add(C6)}else a.add(y6);if(a===P)W.push(y6)}function t(a,r){if(X>=2023)throw V("group");var X6=w();if(!hQ.test(X6))throw V(X6,"name");var O6=iB8.lcFirst(X6);if(X6===O6)X6=iB8.ucFirst(X6);O("=");var D6=h(w()),y6=new Yr4(X6);y6.group=!0;var C6=new zr4(O6,D6,X6,r);C6.filename=Gn.filename,U(y6,function(f6){switch(f6){case"option":q6(y6,f6),O(";");break;case"required":case"repeated":l(y6,f6);break;case"optional":if(X==="proto3")l(y6,"proto3_optional");else l(y6,"optional");break;case"message":d(y6,f6);break;case"enum":Z6(y6,f6);break;case"reserved":y(y6.reserved||(y6.reserved=[]),!0);break;default:throw V(f6)}}),a.add(y6).add(C6)}function s(a){O("<");var r=w();if(PQY.mapKey[r]===void 0)throw V(r,"type");O(",");var X6=w();if(!IQ.test(X6))throw V(X6,"type");O(">");var O6=w();if(!hQ.test(O6))throw V(O6,"name");O("=");var D6=new jQY(G(O6),h(w()),r,X6);U(D6,function(C6){if(C6==="option")q6(D6,C6),O(";");else throw V(C6)},function(){k6(D6)}),a.add(D6)}function H6(a,r){if(!hQ.test(r=w()))throw V(r,"name");var X6=new wr4(G(r));U(X6,function(D6){if(D6==="option")q6(X6,D6),O(";");else _(D6),l(X6,"optional")}),a.add(X6)}function Z6(a,r){if(!hQ.test(r=w()))throw V(r,"name");var X6=new JQY(r);if(U(X6,function(D6){switch(D6){case"option":q6(X6,D6),O(";");break;case"reserved":if(y(X6.reserved||(X6.reserved=[]),!0),X6.reserved===void 0)X6.reserved=[];break;default:G6(X6,D6)}}),a.add(X6),a===P)W.push(X6)}function G6(a,r){if(!hQ.test(r))throw V(r,"name");O("=");var X6=h(w(),!0),O6={options:void 0};O6.getOption=function(D6){return this.options[D6]},O6.setOption=function(D6,y6){XQY.prototype.setOption.call(O6,D6,y6)},O6.setParsedOption=function(){return},U(O6,function(y6){if(y6==="option")q6(O6,y6),O(";");else throw V(y6)},function(){k6(O6)}),a.add(r,X6,O6.comment,O6.parsedOptions||O6.options)}function q6(a,r){var X6,O6,D6=!0;if(r==="option")r=w();while(r!=="="){if(r==="("){var y6=w();O(")"),r="("+y6+")"}if(D6){if(D6=!1,r.includes(".")&&!r.includes("(")){var C6=r.split(".");X6=C6[0]+".",r=C6[1];continue}X6=r}else O6=O6?O6+=r:r;r=w()}var h6=O6?X6.concat(O6):X6,f6=w6(a,h6);O6=O6&&O6[0]==="."?O6.slice(1):O6,X6=X6&&X6[X6.length-1]==="."?X6.slice(0,-1):X6,_6(a,X6,f6,O6)}function w6(a,r){if(O("{",!0)){var X6={};while(!O("}",!0)){if(!hQ.test(z6=w()))throw V(z6,"name");if(z6===null)throw V(z6,"end of input");var O6,D6=z6;if(O(":",!0),$()==="{")O6=w6(a,r+"."+z6);else if($()==="["){O6=[];var y6;if(O("[",!0)){do y6=v(!0),O6.push(y6);while(O(",",!0));if(O("]"),typeof y6<"u")j6(a,r+"."+z6,y6)}}else O6=v(!0),j6(a,r+"."+z6,O6);var C6=X6[D6];if(C6)O6=[].concat(C6).concat(O6);X6[D6]=O6,O(",",!0),O(";",!0)}return X6}var h6=v(!0);return j6(a,r,h6),h6}function j6(a,r,X6){if(P===a&&/^features\./.test(r)){Z[r]=X6;return}if(a.setOption)a.setOption(r,X6)}function _6(a,r,X6,O6){if(a.setParsedOption)a.setParsedOption(r,X6,O6)}function k6(a){if(O("[",!0)){do q6(a,"option");while(O(",",!0));O("]")}return a}function P6(a,r){if(!hQ.test(r=w()))throw V(r,"service name");var X6=new MQY(r);if(U(X6,function(D6){if(b(X6,D6))return;if(D6==="rpc")A6(X6,D6);else throw V(D6)}),a.add(X6),a===P)W.push(X6)}function A6(a,r){var X6=H(),O6=r;if(!hQ.test(r=w()))throw V(r,"name");var D6=r,y6,C6,h6,f6;if(O("("),O("stream",!0))C6=!0;if(!IQ.test(r=w()))throw V(r);if(y6=r,O(")"),O("returns"),O("("),O("stream",!0))f6=!0;if(!IQ.test(r=w()))throw V(r);h6=r,O(")");var M6=new DQY(D6,O6,y6,h6,C6,f6);M6.comment=X6,U(M6,function(p6){if(p6==="option")q6(M6,p6),O(";");else throw V(p6)}),a.add(M6)}function K6(a,r){if(!IQ.test(r=w()))throw V(r,"reference");var X6=r;U(null,function(D6){switch(D6){case"required":case"repeated":l(a,D6,X6);break;case"optional":if(X==="proto3")l(a,"proto3_optional",X6);else l(a,"optional",X6);break;default:if(X==="proto2"||!IQ.test(D6))throw V(D6);_(D6),l(a,"optional",X6);break}})}var z6;while((z6=w())!==null)switch(z6){case"package":if(!j)throw V(z6);B();break;case"import":if(!j)throw V(z6);x();break;case"syntax":if(!j)throw V(z6);F();break;case"edition":if(!j)throw V(z6);g();break;case"option":q6(P,z6),O(";",!0);break;default:if(b(P,z6)){j=!1;continue}throw V(z6)}return f(),Gn.filename=null,{package:J,imports:M,weakImports:D,root:q}}});var jr4=C((Gs_,Hr4)=>{Hr4.exports=Hu;var vQY=/\/|\./;function Hu(A,q){if(!vQY.test(A))A="google/protobuf/"+A+".proto",q={nested:{google:{nested:{protobuf:{nested:q}}}}};Hu[A]=q}Hu("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var Or4;Hu("duration",{Duration:Or4={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});Hu("timestamp",{Timestamp:Or4});Hu("empty",{Empty:{fields:{}}});Hu("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});Hu("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});Hu("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});Hu.get=function(q){return Hu[q]||null}});var Lk1=C((fs_,Jr4)=>{var C86=Jr4.exports=tn4();C86.build="full";C86.tokenize=lB8();C86.parse=$r4();C86.common=jr4();C86.Root._configure(C86.Type,C86.parse,C86.common)});var nB8=C((Ts_,kQY)=>{kQY.exports={nested:{google:{nested:{protobuf:{options:{go_package:"google.golang.org/protobuf/types/descriptorpb",java_package:"com.google.protobuf",java_outer_classname:"DescriptorProtos",csharp_namespace:"Google.Protobuf.Reflection",objc_class_prefix:"GPB",cc_enable_arenas:!0,optimize_for:"SPEED"},nested:{FileDescriptorSet:{edition:"proto2",fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}},extensions:[[536000000,536000000]]},Edition:{edition:"proto2",values:{EDITION_UNKNOWN:0,EDITION_LEGACY:900,EDITION_PROTO2:998,EDITION_PROTO3:999,EDITION_2023:1000,EDITION_2024:1001,EDITION_1_TEST_ONLY:1,EDITION_2_TEST_ONLY:2,EDITION_99997_TEST_ONLY:99997,EDITION_99998_TEST_ONLY:99998,EDITION_99999_TEST_ONLY:99999,EDITION_MAX:2147483647}},FileDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},package:{type:"string",id:2},dependency:{rule:"repeated",type:"string",id:3},publicDependency:{rule:"repeated",type:"int32",id:10},weakDependency:{rule:"repeated",type:"int32",id:11},optionDependency:{rule:"repeated",type:"string",id:15},messageType:{rule:"repeated",type:"DescriptorProto",id:4},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:5},service:{rule:"repeated",type:"ServiceDescriptorProto",id:6},extension:{rule:"repeated",type:"FieldDescriptorProto",id:7},options:{type:"FileOptions",id:8},sourceCodeInfo:{type:"SourceCodeInfo",id:9},syntax:{type:"string",id:12},edition:{type:"Edition",id:14}}},DescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},field:{rule:"repeated",type:"FieldDescriptorProto",id:2},extension:{rule:"repeated",type:"FieldDescriptorProto",id:6},nestedType:{rule:"repeated",type:"DescriptorProto",id:3},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:4},extensionRange:{rule:"repeated",type:"ExtensionRange",id:5},oneofDecl:{rule:"repeated",type:"OneofDescriptorProto",id:8},options:{type:"MessageOptions",id:7},reservedRange:{rule:"repeated",type:"ReservedRange",id:9},reservedName:{rule:"repeated",type:"string",id:10},visibility:{type:"SymbolVisibility",id:11}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2},options:{type:"ExtensionRangeOptions",id:3}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},ExtensionRangeOptions:{edition:"proto2",fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999},declaration:{rule:"repeated",type:"Declaration",id:2,options:{retention:"RETENTION_SOURCE"}},features:{type:"FeatureSet",id:50},verification:{type:"VerificationState",id:3,options:{default:"UNVERIFIED",retention:"RETENTION_SOURCE"}}},extensions:[[1000,536870911]],nested:{Declaration:{fields:{number:{type:"int32",id:1},fullName:{type:"string",id:2},type:{type:"string",id:3},reserved:{type:"bool",id:5},repeated:{type:"bool",id:6}},reserved:[[4,4]]},VerificationState:{values:{DECLARATION:0,UNVERIFIED:1}}}},FieldDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:3},label:{type:"Label",id:4},type:{type:"Type",id:5},typeName:{type:"string",id:6},extendee:{type:"string",id:2},defaultValue:{type:"string",id:7},oneofIndex:{type:"int32",id:9},jsonName:{type:"string",id:10},options:{type:"FieldOptions",id:8},proto3Optional:{type:"bool",id:17}},nested:{Type:{values:{TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Label:{values:{LABEL_OPTIONAL:1,LABEL_REPEATED:3,LABEL_REQUIRED:2}}}},OneofDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3},reservedRange:{rule:"repeated",type:"EnumReservedRange",id:4},reservedName:{rule:"repeated",type:"string",id:5},visibility:{type:"SymbolVisibility",id:6}},nested:{EnumReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},EnumValueDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},inputType:{type:"string",id:2},outputType:{type:"string",id:3},options:{type:"MethodOptions",id:4},clientStreaming:{type:"bool",id:5},serverStreaming:{type:"bool",id:6}}},FileOptions:{edition:"proto2",fields:{javaPackage:{type:"string",id:1},javaOuterClassname:{type:"string",id:8},javaMultipleFiles:{type:"bool",id:10},javaGenerateEqualsAndHash:{type:"bool",id:20,options:{deprecated:!0}},javaStringCheckUtf8:{type:"bool",id:27},optimizeFor:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},goPackage:{type:"string",id:11},ccGenericServices:{type:"bool",id:16},javaGenericServices:{type:"bool",id:17},pyGenericServices:{type:"bool",id:18},deprecated:{type:"bool",id:23},ccEnableArenas:{type:"bool",id:31,options:{default:!0}},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},swiftPrefix:{type:"string",id:39},phpClassPrefix:{type:"string",id:40},phpNamespace:{type:"string",id:41},phpMetadataNamespace:{type:"string",id:44},rubyPackage:{type:"string",id:45},features:{type:"FeatureSet",id:50},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],reserved:[[42,42],[38,38],"php_generic_services"],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{edition:"proto2",fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:11,options:{deprecated:!0}},features:{type:"FeatureSet",id:12},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],reserved:[[4,4],[5,5],[6,6],[8,8],[9,9]]},FieldOptions:{edition:"proto2",fields:{ctype:{type:"CType",id:1,options:{default:"STRING"}},packed:{type:"bool",id:2},jstype:{type:"JSType",id:6,options:{default:"JS_NORMAL"}},lazy:{type:"bool",id:5},unverifiedLazy:{type:"bool",id:15},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10,options:{deprecated:!0}},debugRedact:{type:"bool",id:16},retention:{type:"OptionRetention",id:17},targets:{rule:"repeated",type:"OptionTargetType",id:19},editionDefaults:{rule:"repeated",type:"EditionDefault",id:20},features:{type:"FeatureSet",id:21},featureSupport:{type:"FeatureSupport",id:22},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],reserved:[[4,4],[18,18]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}},OptionRetention:{values:{RETENTION_UNKNOWN:0,RETENTION_RUNTIME:1,RETENTION_SOURCE:2}},OptionTargetType:{values:{TARGET_TYPE_UNKNOWN:0,TARGET_TYPE_FILE:1,TARGET_TYPE_EXTENSION_RANGE:2,TARGET_TYPE_MESSAGE:3,TARGET_TYPE_FIELD:4,TARGET_TYPE_ONEOF:5,TARGET_TYPE_ENUM:6,TARGET_TYPE_ENUM_ENTRY:7,TARGET_TYPE_SERVICE:8,TARGET_TYPE_METHOD:9}},EditionDefault:{fields:{edition:{type:"Edition",id:3},value:{type:"string",id:2}}},FeatureSupport:{fields:{editionIntroduced:{type:"Edition",id:1},editionDeprecated:{type:"Edition",id:2},deprecationWarning:{type:"string",id:3},editionRemoved:{type:"Edition",id:4}}}}},OneofOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]]},EnumOptions:{edition:"proto2",fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:6,options:{deprecated:!0}},features:{type:"FeatureSet",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],reserved:[[5,5]]},EnumValueOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:1},features:{type:"FeatureSet",id:2},debugRedact:{type:"bool",id:3},featureSupport:{type:"FieldOptions.FeatureSupport",id:4},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]]},ServiceOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:34},deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]]},MethodOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:33},idempotencyLevel:{type:"IdempotencyLevel",id:34,options:{default:"IDEMPOTENCY_UNKNOWN"}},features:{type:"FeatureSet",id:35},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],nested:{IdempotencyLevel:{values:{IDEMPOTENCY_UNKNOWN:0,NO_SIDE_EFFECTS:1,IDEMPOTENT:2}}}},UninterpretedOption:{edition:"proto2",fields:{name:{rule:"repeated",type:"NamePart",id:2},identifierValue:{type:"string",id:3},positiveIntValue:{type:"uint64",id:4},negativeIntValue:{type:"int64",id:5},doubleValue:{type:"double",id:6},stringValue:{type:"bytes",id:7},aggregateValue:{type:"string",id:8}},nested:{NamePart:{fields:{namePart:{rule:"required",type:"string",id:1},isExtension:{rule:"required",type:"bool",id:2}}}}},FeatureSet:{edition:"proto2",fields:{fieldPresence:{type:"FieldPresence",id:1,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},enumType:{type:"EnumType",id:2,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},repeatedFieldEncoding:{type:"RepeatedFieldEncoding",id:3,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},utf8Validation:{type:"Utf8Validation",id:4,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},messageEncoding:{type:"MessageEncoding",id:5,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},jsonFormat:{type:"JsonFormat",id:6,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},enforceNamingStyle:{type:"EnforceNamingStyle",id:7,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},defaultSymbolVisibility:{type:"VisibilityFeature.DefaultSymbolVisibility",id:8,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},extensions:[[1000,9994],[9995,9999],[1e4,1e4]],reserved:[[999,999]],nested:{FieldPresence:{values:{FIELD_PRESENCE_UNKNOWN:0,EXPLICIT:1,IMPLICIT:2,LEGACY_REQUIRED:3}},EnumType:{values:{ENUM_TYPE_UNKNOWN:0,OPEN:1,CLOSED:2}},RepeatedFieldEncoding:{values:{REPEATED_FIELD_ENCODING_UNKNOWN:0,PACKED:1,EXPANDED:2}},Utf8Validation:{values:{UTF8_VALIDATION_UNKNOWN:0,VERIFY:2,NONE:3}},MessageEncoding:{values:{MESSAGE_ENCODING_UNKNOWN:0,LENGTH_PREFIXED:1,DELIMITED:2}},JsonFormat:{values:{JSON_FORMAT_UNKNOWN:0,ALLOW:1,LEGACY_BEST_EFFORT:2}},EnforceNamingStyle:{values:{ENFORCE_NAMING_STYLE_UNKNOWN:0,STYLE2024:1,STYLE_LEGACY:2}},VisibilityFeature:{fields:{},reserved:[[1,536870911]],nested:{DefaultSymbolVisibility:{values:{DEFAULT_SYMBOL_VISIBILITY_UNKNOWN:0,EXPORT_ALL:1,EXPORT_TOP_LEVEL:2,LOCAL_ALL:3,STRICT:4}}}}}},FeatureSetDefaults:{edition:"proto2",fields:{defaults:{rule:"repeated",type:"FeatureSetEditionDefault",id:1},minimumEdition:{type:"Edition",id:4},maximumEdition:{type:"Edition",id:5}},nested:{FeatureSetEditionDefault:{fields:{edition:{type:"Edition",id:3},overridableFeatures:{type:"FeatureSet",id:4},fixedFeatures:{type:"FeatureSet",id:5}},reserved:[[1,1],[2,2],"features"]}}},SourceCodeInfo:{edition:"proto2",fields:{location:{rule:"repeated",type:"Location",id:1}},extensions:[[536000000,536000000]],nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},span:{rule:"repeated",type:"int32",id:2,options:{packed:!0}},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{edition:"proto2",fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4},semantic:{type:"Semantic",id:5}},nested:{Semantic:{values:{NONE:0,SET:1,ALIAS:2}}}}}},SymbolVisibility:{edition:"proto2",values:{VISIBILITY_UNSET:0,VISIBILITY_LOCAL:1,VISIBILITY_EXPORT:2}}}}}}}}});var Gr4=C((_9,Zr4)=>{var TL=Lk1();Zr4.exports=_9=TL.descriptor=TL.Root.fromJSON(nB8()).lookup(".google.protobuf");var{Namespace:Mr4,Root:fn6,Enum:fn,Type:bQ,Field:h86,MapField:EQY,OneOf:yk1,Service:Tn6,Method:Rk1}=TL;fn6.fromDescriptor=function(q){if(typeof q.length==="number")q=_9.FileDescriptorSet.decode(q);var K=new fn6;if(q.file){var Y,z;for(var w=0,_;w{mQY.exports={nested:{google:{nested:{protobuf:{nested:{Api:{fields:{name:{type:"string",id:1},methods:{rule:"repeated",type:"Method",id:2},options:{rule:"repeated",type:"Option",id:3},version:{type:"string",id:4},sourceContext:{type:"SourceContext",id:5},mixins:{rule:"repeated",type:"Mixin",id:6},syntax:{type:"Syntax",id:7}}},Method:{fields:{name:{type:"string",id:1},requestTypeUrl:{type:"string",id:2},requestStreaming:{type:"bool",id:3},responseTypeUrl:{type:"string",id:4},responseStreaming:{type:"bool",id:5},options:{rule:"repeated",type:"Option",id:6},syntax:{type:"Syntax",id:7}}},Mixin:{fields:{name:{type:"string",id:1},root:{type:"string",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}}}}}}}}});var Tr4=C((Ns_,gQY)=>{gQY.exports={nested:{google:{nested:{protobuf:{nested:{SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var Vr4=C((vs_,FQY)=>{FQY.exports={nested:{google:{nested:{protobuf:{nested:{Type:{fields:{name:{type:"string",id:1},fields:{rule:"repeated",type:"Field",id:2},oneofs:{rule:"repeated",type:"string",id:3},options:{rule:"repeated",type:"Option",id:4},sourceContext:{type:"SourceContext",id:5},syntax:{type:"Syntax",id:6}}},Field:{fields:{kind:{type:"Kind",id:1},cardinality:{type:"Cardinality",id:2},number:{type:"int32",id:3},name:{type:"string",id:4},typeUrl:{type:"string",id:6},oneofIndex:{type:"int32",id:7},packed:{type:"bool",id:8},options:{rule:"repeated",type:"Option",id:9},jsonName:{type:"string",id:10},defaultValue:{type:"string",id:11}},nested:{Kind:{values:{TYPE_UNKNOWN:0,TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Cardinality:{values:{CARDINALITY_UNKNOWN:0,CARDINALITY_OPTIONAL:1,CARDINALITY_REQUIRED:2,CARDINALITY_REPEATED:3}}}},Enum:{fields:{name:{type:"string",id:1},enumvalue:{rule:"repeated",type:"EnumValue",id:2},options:{rule:"repeated",type:"Option",id:3},sourceContext:{type:"SourceContext",id:4},syntax:{type:"Syntax",id:5}}},EnumValue:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{rule:"repeated",type:"Option",id:3}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var yr4=C((Er4)=>{Object.defineProperty(Er4,"__esModule",{value:!0});Er4.addCommonProtos=Er4.loadProtosWithOptionsSync=Er4.loadProtosWithOptions=void 0;var Nr4=g6("fs"),vr4=g6("path"),NN6=Lk1();function kr4(A,q){let K=A.resolvePath;A.resolvePath=(Y,z)=>{if(vr4.isAbsolute(z))return z;for(let w of q){let _=vr4.join(w,z);try{return Nr4.accessSync(_,Nr4.constants.R_OK),_}catch($){continue}}return process.emitWarning(`${z} not found in any of the include paths ${q}`),K(Y,z)}}async function QQY(A,q){let K=new NN6.Root;if(q=q||{},q.includeDirs){if(!Array.isArray(q.includeDirs))return Promise.reject(Error("The includeDirs option must be an array"));kr4(K,q.includeDirs)}let Y=await K.load(A,q);return Y.resolveAll(),Y}Er4.loadProtosWithOptions=QQY;function UQY(A,q){let K=new NN6.Root;if(q=q||{},q.includeDirs){if(!Array.isArray(q.includeDirs))throw Error("The includeDirs option must be an array");kr4(K,q.includeDirs)}let Y=K.loadSync(A,q);return Y.resolveAll(),Y}Er4.loadProtosWithOptionsSync=UQY;function pQY(){let A=fr4(),q=nB8(),K=Tr4(),Y=Vr4();NN6.common("api",A.nested.google.nested.protobuf.nested),NN6.common("descriptor",q.nested.google.nested.protobuf.nested),NN6.common("source_context",K.nested.google.nested.protobuf.nested),NN6.common("type",Y.nested.google.nested.protobuf.nested)}Er4.addCommonProtos=pQY});var Rr4=C((Vn6,oB8)=>{(function(A,q){function K(Y){return"default"in Y?Y.default:Y}if(typeof define==="function"&&define.amd)define([],function(){var Y={};return q(Y),K(Y)});else if(typeof Vn6==="object"){if(q(Vn6),typeof oB8==="object")oB8.exports=K(Vn6)}else(function(){var Y={};q(Y),A.Long=K(Y)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:Vn6,function(A){Object.defineProperty(A,"__esModule",{value:!0}),A.default=void 0;var q=null;try{q=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function K(g,b,U){this.low=g|0,this.high=b|0,this.unsigned=!!U}K.prototype.__isLong__,Object.defineProperty(K.prototype,"__isLong__",{value:!0});function Y(g){return(g&&g.__isLong__)===!0}function z(g){var b=Math.clz32(g&-g);return g?31-b:b}K.isLong=Y;var w={},_={};function $(g,b){var U,d,l;if(b){if(g>>>=0,l=0<=g&&g<256){if(d=_[g],d)return d}if(U=H(g,0,!0),l)_[g]=U;return U}else{if(g|=0,l=-128<=g&&g<128){if(d=w[g],d)return d}if(U=H(g,g<0?-1:0,!1),l)w[g]=U;return U}}K.fromInt=$;function O(g,b){if(isNaN(g))return b?V:f;if(b){if(g<0)return V;if(g>=W)return h}else{if(g<=-Z)return B;if(g+1>=Z)return R}if(g<0)return O(-g,b).neg();return H(g%P|0,g/P|0,b)}K.fromNumber=O;function H(g,b,U){return new K(g,b,U)}K.fromBits=H;var j=Math.pow;function J(g,b,U){if(g.length===0)throw Error("empty string");if(typeof b==="number")U=b,b=!1;else b=!!b;if(g==="NaN"||g==="Infinity"||g==="+Infinity"||g==="-Infinity")return b?V:f;if(U=U||10,U<2||360)throw Error("interior hyphen");else if(d===0)return J(g.substring(1),b,U).neg();var l=O(j(U,8)),t=f;for(var s=0;s>>0:this.low},x.toNumber=function(){if(this.unsigned)return(this.high>>>0)*P+(this.low>>>0);return this.high*P+(this.low>>>0)},x.toString=function(b){if(b=b||10,b<2||36>>0,q6=G6.toString(b);if(s=Z6,s.isZero())return q6+H6;else{while(q6.length<6)q6="0"+q6;H6=""+q6+H6}}},x.getHighBits=function(){return this.high},x.getHighBitsUnsigned=function(){return this.high>>>0},x.getLowBits=function(){return this.low},x.getLowBitsUnsigned=function(){return this.low>>>0},x.getNumBitsAbs=function(){if(this.isNegative())return this.eq(B)?64:this.neg().getNumBitsAbs();var b=this.high!=0?this.high:this.low;for(var U=31;U>0;U--)if((b&1<>21;if(!b)return!0;if(this.unsigned)return!1;return b===-1&&!(this.low===0&&this.high===-2097152)},x.isZero=function(){return this.high===0&&this.low===0},x.eqz=x.isZero,x.isNegative=function(){return!this.unsigned&&this.high<0},x.isPositive=function(){return this.unsigned||this.high>=0},x.isOdd=function(){return(this.low&1)===1},x.isEven=function(){return(this.low&1)===0},x.equals=function(b){if(!Y(b))b=M(b);if(this.unsigned!==b.unsigned&&this.high>>>31===1&&b.high>>>31===1)return!1;return this.high===b.high&&this.low===b.low},x.eq=x.equals,x.notEquals=function(b){return!this.eq(b)},x.neq=x.notEquals,x.ne=x.notEquals,x.lessThan=function(b){return this.comp(b)<0},x.lt=x.lessThan,x.lessThanOrEqual=function(b){return this.comp(b)<=0},x.lte=x.lessThanOrEqual,x.le=x.lessThanOrEqual,x.greaterThan=function(b){return this.comp(b)>0},x.gt=x.greaterThan,x.greaterThanOrEqual=function(b){return this.comp(b)>=0},x.gte=x.greaterThanOrEqual,x.ge=x.greaterThanOrEqual,x.compare=function(b){if(!Y(b))b=M(b);if(this.eq(b))return 0;var U=this.isNegative(),d=b.isNegative();if(U&&!d)return-1;if(!U&&d)return 1;if(!this.unsigned)return this.sub(b).isNegative()?-1:1;return b.high>>>0>this.high>>>0||b.high===this.high&&b.low>>>0>this.low>>>0?-1:1},x.comp=x.compare,x.negate=function(){if(!this.unsigned&&this.eq(B))return B;return this.not().add(N)},x.neg=x.negate,x.add=function(b){if(!Y(b))b=M(b);var U=this.high>>>16,d=this.high&65535,l=this.low>>>16,t=this.low&65535,s=b.high>>>16,H6=b.high&65535,Z6=b.low>>>16,G6=b.low&65535,q6=0,w6=0,j6=0,_6=0;return _6+=t+G6,j6+=_6>>>16,_6&=65535,j6+=l+Z6,w6+=j6>>>16,j6&=65535,w6+=d+H6,q6+=w6>>>16,w6&=65535,q6+=U+s,q6&=65535,H(j6<<16|_6,q6<<16|w6,this.unsigned)},x.subtract=function(b){if(!Y(b))b=M(b);return this.add(b.neg())},x.sub=x.subtract,x.multiply=function(b){if(this.isZero())return this;if(!Y(b))b=M(b);if(q){var U=q.mul(this.low,this.high,b.low,b.high);return H(U,q.get_high(),this.unsigned)}if(b.isZero())return this.unsigned?V:f;if(this.eq(B))return b.isOdd()?B:f;if(b.eq(B))return this.isOdd()?B:f;if(this.isNegative())if(b.isNegative())return this.neg().mul(b.neg());else return this.neg().mul(b).neg();else if(b.isNegative())return this.mul(b.neg()).neg();if(this.lt(G)&&b.lt(G))return O(this.toNumber()*b.toNumber(),this.unsigned);var d=this.high>>>16,l=this.high&65535,t=this.low>>>16,s=this.low&65535,H6=b.high>>>16,Z6=b.high&65535,G6=b.low>>>16,q6=b.low&65535,w6=0,j6=0,_6=0,k6=0;return k6+=s*q6,_6+=k6>>>16,k6&=65535,_6+=t*q6,j6+=_6>>>16,_6&=65535,_6+=s*G6,j6+=_6>>>16,_6&=65535,j6+=l*q6,w6+=j6>>>16,j6&=65535,j6+=t*G6,w6+=j6>>>16,j6&=65535,j6+=s*Z6,w6+=j6>>>16,j6&=65535,w6+=d*q6+l*G6+t*Z6+s*H6,w6&=65535,H(_6<<16|k6,w6<<16|j6,this.unsigned)},x.mul=x.multiply,x.divide=function(b){if(!Y(b))b=M(b);if(b.isZero())throw Error("division by zero");if(q){if(!this.unsigned&&this.high===-2147483648&&b.low===-1&&b.high===-1)return this;var U=(this.unsigned?q.div_u:q.div_s)(this.low,this.high,b.low,b.high);return H(U,q.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?V:f;var d,l,t;if(!this.unsigned){if(this.eq(B))if(b.eq(N)||b.eq(y))return B;else if(b.eq(B))return N;else{var s=this.shr(1);if(d=s.div(b).shl(1),d.eq(f))return b.isNegative()?N:y;else return l=this.sub(b.mul(d)),t=d.add(l.div(b)),t}else if(b.eq(B))return this.unsigned?V:f;if(this.isNegative()){if(b.isNegative())return this.neg().div(b.neg());return this.neg().div(b).neg()}else if(b.isNegative())return this.div(b.neg()).neg();t=f}else{if(!b.unsigned)b=b.toUnsigned();if(b.gt(this))return V;if(b.gt(this.shru(1)))return v;t=V}l=this;while(l.gte(b)){d=Math.max(1,Math.floor(l.toNumber()/b.toNumber()));var H6=Math.ceil(Math.log(d)/Math.LN2),Z6=H6<=48?1:j(2,H6-48),G6=O(d),q6=G6.mul(b);while(q6.isNegative()||q6.gt(l))d-=Z6,G6=O(d,this.unsigned),q6=G6.mul(b);if(G6.isZero())G6=N;t=t.add(G6),l=l.sub(q6)}return t},x.div=x.divide,x.modulo=function(b){if(!Y(b))b=M(b);if(q){var U=(this.unsigned?q.rem_u:q.rem_s)(this.low,this.high,b.low,b.high);return H(U,q.get_high(),this.unsigned)}return this.sub(this.div(b).mul(b))},x.mod=x.modulo,x.rem=x.modulo,x.not=function(){return H(~this.low,~this.high,this.unsigned)},x.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},x.clz=x.countLeadingZeros,x.countTrailingZeros=function(){return this.low?z(this.low):z(this.high)+32},x.ctz=x.countTrailingZeros,x.and=function(b){if(!Y(b))b=M(b);return H(this.low&b.low,this.high&b.high,this.unsigned)},x.or=function(b){if(!Y(b))b=M(b);return H(this.low|b.low,this.high|b.high,this.unsigned)},x.xor=function(b){if(!Y(b))b=M(b);return H(this.low^b.low,this.high^b.high,this.unsigned)},x.shiftLeft=function(b){if(Y(b))b=b.toInt();if((b&=63)===0)return this;else if(b<32)return H(this.low<>>32-b,this.unsigned);else return H(0,this.low<>>b|this.high<<32-b,this.high>>b,this.unsigned);else return H(this.high>>b-32,this.high>=0?0:-1,this.unsigned)},x.shr=x.shiftRight,x.shiftRightUnsigned=function(b){if(Y(b))b=b.toInt();if((b&=63)===0)return this;if(b<32)return H(this.low>>>b|this.high<<32-b,this.high>>>b,this.unsigned);if(b===32)return H(this.high,0,this.unsigned);return H(this.high>>>b-32,0,this.unsigned)},x.shru=x.shiftRightUnsigned,x.shr_u=x.shiftRightUnsigned,x.rotateLeft=function(b){var U;if(Y(b))b=b.toInt();if((b&=63)===0)return this;if(b===32)return H(this.high,this.low,this.unsigned);if(b<32)return U=32-b,H(this.low<>>U,this.high<>>U,this.unsigned);return b-=32,U=32-b,H(this.high<>>U,this.low<>>U,this.unsigned)},x.rotl=x.rotateLeft,x.rotateRight=function(b){var U;if(Y(b))b=b.toInt();if((b&=63)===0)return this;if(b===32)return H(this.high,this.low,this.unsigned);if(b<32)return U=32-b,H(this.high<>>b,this.low<>>b,this.unsigned);return b-=32,U=32-b,H(this.low<>>b,this.high<>>b,this.unsigned)},x.rotr=x.rotateRight,x.toSigned=function(){if(!this.unsigned)return this;return H(this.low,this.high,!1)},x.toUnsigned=function(){if(this.unsigned)return this;return H(this.low,this.high,!0)},x.toBytes=function(b){return b?this.toBytesLE():this.toBytesBE()},x.toBytesLE=function(){var b=this.high,U=this.low;return[U&255,U>>>8&255,U>>>16&255,U>>>24,b&255,b>>>8&255,b>>>16&255,b>>>24]},x.toBytesBE=function(){var b=this.high,U=this.low;return[b>>>24,b>>>16&255,b>>>8&255,b&255,U>>>24,U>>>16&255,U>>>8&255,U&255]},K.fromBytes=function(b,U,d){return d?K.fromBytesLE(b,U):K.fromBytesBE(b,U)},K.fromBytesLE=function(b,U){return new K(b[0]|b[1]<<8|b[2]<<16|b[3]<<24,b[4]|b[5]<<8|b[6]<<16|b[7]<<24,U)},K.fromBytesBE=function(b,U){return new K(b[4]<<24|b[5]<<16|b[6]<<8|b[7],b[0]<<24|b[1]<<16|b[2]<<8|b[3],U)},typeof BigInt==="function")K.fromBigInt=function(b,U){var d=Number(BigInt.asIntN(32,b)),l=Number(BigInt.asIntN(32,b>>BigInt(32)));return H(d,l,U)},K.fromValue=function(b,U){if(typeof b==="bigint")return fromBigInt(b,U);return M(b,U)},x.toBigInt=function(){var b=BigInt(this.low>>>0),U=BigInt(this.unsigned?this.high>>>0:this.high);return U<{Object.defineProperty(xr4,"__esModule",{value:!0});xr4.loadFileDescriptorSetFromObject=xr4.loadFileDescriptorSetFromBuffer=xr4.fromJSON=xr4.loadSync=xr4.load=xr4.IdempotencyLevel=xr4.isAnyExtension=xr4.Long=void 0;var lQY=Jn4(),xQ=Lk1(),eB8=Gr4(),Am8=yr4(),iQY=Rr4();xr4.Long=iQY;function nQY(A){return"@type"in A&&typeof A["@type"]==="string"}xr4.isAnyExtension=nQY;var Cr4;(function(A){A.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",A.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",A.IDEMPOTENT="IDEMPOTENT"})(Cr4=xr4.IdempotencyLevel||(xr4.IdempotencyLevel={}));var hr4={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function rQY(A,q){if(A==="")return q;else return A+"."+q}function oQY(A){return A instanceof xQ.Service||A instanceof xQ.Type||A instanceof xQ.Enum}function aQY(A){return A instanceof xQ.Namespace||A instanceof xQ.Root}function Ir4(A,q){let K=rQY(q,A.name);if(oQY(A))return[[K,A]];else if(aQY(A)&&typeof A.nested<"u")return Object.keys(A.nested).map((Y)=>{return Ir4(A.nested[Y],K)}).reduce((Y,z)=>Y.concat(z),[]);return[]}function aB8(A,q){return function(Y){return A.toObject(A.decode(Y),q)}}function sB8(A){return function(K){if(Array.isArray(K))throw Error(`Failed to serialize message: expected object with ${A.name} structure, got array instead`);let Y=A.fromObject(K);return A.encode(Y).finish()}}function sQY(A){return(A||[]).reduce((q,K)=>{for(let[Y,z]of Object.entries(K))switch(Y){case"uninterpreted_option":q.uninterpreted_option.push(K.uninterpreted_option);break;default:q[Y]=z}return q},{deprecated:!1,idempotency_level:Cr4.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function tQY(A,q,K,Y){let{resolvedRequestType:z,resolvedResponseType:w}=A;return{path:"/"+q+"/"+A.name,requestStream:!!A.requestStream,responseStream:!!A.responseStream,requestSerialize:sB8(z),requestDeserialize:aB8(z,K),responseSerialize:sB8(w),responseDeserialize:aB8(w,K),originalName:lQY(A.name),requestType:tB8(z,K,Y),responseType:tB8(w,K,Y),options:sQY(A.parsedOptions)}}function eQY(A,q,K,Y){let z={};for(let w of A.methodsArray)z[w.name]=tQY(w,q,K,Y);return z}function tB8(A,q,K){let Y=A.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:Y.$type.toObject(Y,hr4),fileDescriptorProtos:K,serialize:sB8(A),deserialize:aB8(A,q)}}function AUY(A,q){let K=A.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:K.$type.toObject(K,hr4),fileDescriptorProtos:q}}function qUY(A,q,K,Y){if(A instanceof xQ.Service)return eQY(A,q,K,Y);else if(A instanceof xQ.Type)return tB8(A,K,Y);else if(A instanceof xQ.Enum)return AUY(A,Y);else throw Error("Type mismatch in reflection object handling")}function Sk1(A,q){let K={};A.resolveAll();let z=A.toDescriptor("proto3").file.map((w)=>Buffer.from(eB8.FileDescriptorProto.encode(w).finish()));for(let[w,_]of Ir4(A,""))K[w]=qUY(_,w,q,z);return K}function br4(A,q){q=q||{};let K=xQ.Root.fromDescriptor(A);return K.resolveAll(),Sk1(K,q)}function KUY(A,q){return(0,Am8.loadProtosWithOptions)(A,q).then((K)=>{return Sk1(K,q)})}xr4.load=KUY;function YUY(A,q){let K=(0,Am8.loadProtosWithOptionsSync)(A,q);return Sk1(K,q)}xr4.loadSync=YUY;function zUY(A,q){q=q||{};let K=xQ.Root.fromJSON(A);return K.resolveAll(),Sk1(K,q)}xr4.fromJSON=zUY;function wUY(A,q){let K=eB8.FileDescriptorSet.decode(A);return br4(K,q)}xr4.loadFileDescriptorSetFromBuffer=wUY;function _UY(A,q){let K=eB8.FileDescriptorSet.fromObject(A);return br4(K,q)}xr4.loadFileDescriptorSetFromObject=_UY;(0,Am8.addCommonProtos)()});var I86=C((or4)=>{var __dirname="/home/runner/code/tmp/claude-cli-external-build-2207/node_modules/@grpc/grpc-js/build/src";Object.defineProperty(or4,"__esModule",{value:!0});or4.registerChannelzSocket=or4.registerChannelzServer=or4.registerChannelzSubchannel=or4.registerChannelzChannel=or4.ChannelzCallTrackerStub=or4.ChannelzCallTracker=or4.ChannelzChildrenTrackerStub=or4.ChannelzChildrenTracker=or4.ChannelzTrace=or4.ChannelzTraceStub=void 0;or4.unregisterChannelzRef=ZUY;or4.getChannelzHandlers=nr4;or4.getChannelzServiceDefinition=rr4;or4.setup=RUY;var hk1=g6("net"),aw6=Di4(),Nn6=dT(),vn6=E9(),DUY=Gv(),XUY=Yk1(),PUY=wk1();function Km8(A){return{channel_id:A.id,name:A.name}}function Ym8(A){return{subchannel_id:A.id,name:A.name}}function WUY(A){return{server_id:A.id}}function Ik1(A){return{socket_id:A.id,name:A.name}}var Br4=32,zm8=100;class Qr4{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:uQ(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}}or4.ChannelzTraceStub=Qr4;class Ur4{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(A,q,K){let Y=new Date;if(this.events.push({description:q,severity:A,timestamp:Y,childChannel:(K===null||K===void 0?void 0:K.kind)==="channel"?K:void 0,childSubchannel:(K===null||K===void 0?void 0:K.kind)==="subchannel"?K:void 0}),this.events.length>=Br4*2)this.events=this.events.slice(Br4);this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:uQ(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map((A)=>{return{description:A.description,severity:A.severity,timestamp:uQ(A.timestamp),channel_ref:A.childChannel?Km8(A.childChannel):null,subchannel_ref:A.childSubchannel?Ym8(A.childSubchannel):null}})}}}or4.ChannelzTrace=Ur4;class wm8{constructor(){this.channelChildren=new aw6.OrderedMap,this.subchannelChildren=new aw6.OrderedMap,this.socketChildren=new aw6.OrderedMap,this.trackerMap={["channel"]:this.channelChildren,["subchannel"]:this.subchannelChildren,["socket"]:this.socketChildren}}refChild(A){let q=this.trackerMap[A.kind],K=q.find(A.id);if(K.equals(q.end()))q.setElement(A.id,{ref:A,count:1},K);else K.pointer[1].count+=1}unrefChild(A){let q=this.trackerMap[A.kind],K=q.getElementByKey(A.id);if(K!==void 0){if(K.count-=1,K.count===0)q.eraseElementByKey(A.id)}}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}}or4.ChannelzChildrenTracker=wm8;class pr4 extends wm8{refChild(){}unrefChild(){}}or4.ChannelzChildrenTrackerStub=pr4;class _m8{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}}or4.ChannelzCallTracker=_m8;class dr4 extends _m8{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}}or4.ChannelzCallTrackerStub=dr4;var Tn={["channel"]:new aw6.OrderedMap,["subchannel"]:new aw6.OrderedMap,["server"]:new aw6.OrderedMap,["socket"]:new aw6.OrderedMap},bk1=(A)=>{let q=1;function K(){return q++}let Y=Tn[A];return(z,w,_)=>{let $=K(),O={id:$,name:z,kind:A};if(_)Y.setElement($,{ref:O,getInfo:w});return O}};or4.registerChannelzChannel=bk1("channel");or4.registerChannelzSubchannel=bk1("subchannel");or4.registerChannelzServer=bk1("server");or4.registerChannelzSocket=bk1("socket");function ZUY(A){Tn[A.kind].eraseElementByKey(A.id)}function GUY(A){let q=Number.parseInt(A,16);return[q/256|0,q%256]}function mr4(A){if(A==="")return[];let q=A.split(":").map((Y)=>GUY(Y));return[].concat(...q)}function fUY(A){return(0,hk1.isIPv6)(A)&&A.toLowerCase().startsWith("::ffff:")&&(0,hk1.isIPv4)(A.substring(7))}function gr4(A){return Buffer.from(Uint8Array.from(A.split(".").map((q)=>Number.parseInt(q))))}function TUY(A){if((0,hk1.isIPv4)(A))return gr4(A);else if(fUY(A))return gr4(A.substring(7));else if((0,hk1.isIPv6)(A)){let q,K,Y=A.indexOf("::");if(Y===-1)q=A,K="";else q=A.substring(0,Y),K=A.substring(Y+2);let z=Buffer.from(mr4(q)),w=Buffer.from(mr4(K)),_=Buffer.alloc(16-z.length-w.length,0);return Buffer.concat([z,_,w])}else return null}function cr4(A){switch(A){case Nn6.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case Nn6.ConnectivityState.IDLE:return{state:"IDLE"};case Nn6.ConnectivityState.READY:return{state:"READY"};case Nn6.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case Nn6.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function uQ(A){if(!A)return null;let q=A.getTime();return{seconds:q/1000|0,nanos:q%1000*1e6}}function lr4(A){let q=A.getInfo(),K=[],Y=[];return q.children.channels.forEach((z)=>{K.push(Km8(z[1].ref))}),q.children.subchannels.forEach((z)=>{Y.push(Ym8(z[1].ref))}),{ref:Km8(A.ref),data:{target:q.target,state:cr4(q.state),calls_started:q.callTracker.callsStarted,calls_succeeded:q.callTracker.callsSucceeded,calls_failed:q.callTracker.callsFailed,last_call_started_timestamp:uQ(q.callTracker.lastCallStartedTimestamp),trace:q.trace.getTraceMessage()},channel_ref:K,subchannel_ref:Y}}function VUY(A,q){let K=parseInt(A.request.channel_id,10),Y=Tn.channel.getElementByKey(K);if(Y===void 0){q({code:vn6.Status.NOT_FOUND,details:"No channel data found for id "+K});return}q(null,{channel:lr4(Y)})}function NUY(A,q){let K=parseInt(A.request.max_results,10)||zm8,Y=[],z=parseInt(A.request.start_channel_id,10),w=Tn.channel,_;for(_=w.lowerBound(z);!_.equals(w.end())&&Y.length{K.push(Ik1(Y[1].ref))}),{ref:WUY(A.ref),data:{calls_started:q.callTracker.callsStarted,calls_succeeded:q.callTracker.callsSucceeded,calls_failed:q.callTracker.callsFailed,last_call_started_timestamp:uQ(q.callTracker.lastCallStartedTimestamp),trace:q.trace.getTraceMessage()},listen_socket:K}}function vUY(A,q){let K=parseInt(A.request.server_id,10),z=Tn.server.getElementByKey(K);if(z===void 0){q({code:vn6.Status.NOT_FOUND,details:"No server data found for id "+K});return}q(null,{server:ir4(z)})}function kUY(A,q){let K=parseInt(A.request.max_results,10)||zm8,Y=parseInt(A.request.start_server_id,10),z=Tn.server,w=[],_;for(_=z.lowerBound(Y);!_.equals(z.end())&&w.length{w.push(Ik1($[1].ref))});let _={ref:Ym8(Y.ref),data:{target:z.target,state:cr4(z.state),calls_started:z.callTracker.callsStarted,calls_succeeded:z.callTracker.callsSucceeded,calls_failed:z.callTracker.callsFailed,last_call_started_timestamp:uQ(z.callTracker.lastCallStartedTimestamp),trace:z.trace.getTraceMessage()},socket_ref:w};q(null,{subchannel:_})}function Fr4(A){var q;if((0,DUY.isTcpSubchannelAddress)(A))return{address:"tcpip_address",tcpip_address:{ip_address:(q=TUY(A.host))!==null&&q!==void 0?q:void 0,port:A.port}};else return{address:"uds_address",uds_address:{filename:A.path}}}function LUY(A,q){var K,Y,z,w,_;let $=parseInt(A.request.socket_id,10),O=Tn.socket.getElementByKey($);if(O===void 0){q({code:vn6.Status.NOT_FOUND,details:"No socket data found for id "+$});return}let H=O.getInfo(),j=H.security?{model:"tls",tls:{cipher_suite:H.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:(K=H.security.cipherSuiteStandardName)!==null&&K!==void 0?K:void 0,other_name:(Y=H.security.cipherSuiteOtherName)!==null&&Y!==void 0?Y:void 0,local_certificate:(z=H.security.localCertificate)!==null&&z!==void 0?z:void 0,remote_certificate:(w=H.security.remoteCertificate)!==null&&w!==void 0?w:void 0}}:null,J={ref:Ik1(O.ref),local:H.localAddress?Fr4(H.localAddress):null,remote:H.remoteAddress?Fr4(H.remoteAddress):null,remote_name:(_=H.remoteName)!==null&&_!==void 0?_:void 0,security:j,data:{keep_alives_sent:H.keepAlivesSent,streams_started:H.streamsStarted,streams_succeeded:H.streamsSucceeded,streams_failed:H.streamsFailed,last_local_stream_created_timestamp:uQ(H.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:uQ(H.lastRemoteStreamCreatedTimestamp),messages_received:H.messagesReceived,messages_sent:H.messagesSent,last_message_received_timestamp:uQ(H.lastMessageReceivedTimestamp),last_message_sent_timestamp:uQ(H.lastMessageSentTimestamp),local_flow_control_window:H.localFlowControlWindow?{value:H.localFlowControlWindow}:null,remote_flow_control_window:H.remoteFlowControlWindow?{value:H.remoteFlowControlWindow}:null}};q(null,{socket:J})}function yUY(A,q){let K=parseInt(A.request.server_id,10),Y=Tn.server.getElementByKey(K);if(Y===void 0){q({code:vn6.Status.NOT_FOUND,details:"No server data found for id "+K});return}let z=parseInt(A.request.start_socket_id,10),w=parseInt(A.request.max_results,10)||zm8,$=Y.getInfo().sessionChildren.sockets,O=[],H;for(H=$.lowerBound(z);!H.equals($.end())&&O.length{Object.defineProperty(sr4,"__esModule",{value:!0});sr4.getNextCallNumber=dUY;var pUY=0;function dUY(){return pUY++}});var $m8=C((er4)=>{Object.defineProperty(er4,"__esModule",{value:!0});er4.CompressionAlgorithms=void 0;var tr4;(function(A){A[A.identity=0]="identity",A[A.deflate=1]="deflate",A[A.gzip=2]="gzip"})(tr4||(er4.CompressionAlgorithms=tr4={}))});var Om8=C((Ko4)=>{Object.defineProperty(Ko4,"__esModule",{value:!0});Ko4.BaseFilter=void 0;class qo4{async sendMetadata(A){return A}receiveMetadata(A){return A}async sendMessage(A){return A}async receiveMessage(A){return A}receiveTrailers(A){return A}}Ko4.BaseFilter=qo4});var jm8=C((jo4)=>{Object.defineProperty(jo4,"__esModule",{value:!0});jo4.CompressionFilterFactory=jo4.CompressionFilter=void 0;var uk1=g6("zlib"),wo4=$m8(),vN6=E9(),lUY=Om8(),iUY=m_(),nUY=(A)=>{return typeof A==="number"&&typeof wo4.CompressionAlgorithms[A]==="string"};class kn6{async writeMessage(A,q){let K=A;if(q)K=await this.compressMessage(K);let Y=Buffer.allocUnsafe(K.length+5);return Y.writeUInt8(q?1:0,0),Y.writeUInt32BE(K.length,1),K.copy(Y,5),Y}async readMessage(A){let q=A.readUInt8(0)===1,K=A.slice(5);if(q)K=await this.decompressMessage(K);return K}}class kN6 extends kn6{async compressMessage(A){return A}async writeMessage(A,q){let K=Buffer.allocUnsafe(A.length+5);return K.writeUInt8(0,0),K.writeUInt32BE(A.length,1),A.copy(K,5),K}decompressMessage(A){return Promise.reject(Error('Received compressed message but "grpc-encoding" header was identity'))}}class _o4 extends kn6{constructor(A){super();this.maxRecvMessageLength=A}compressMessage(A){return new Promise((q,K)=>{uk1.deflate(A,(Y,z)=>{if(Y)K(Y);else q(z)})})}decompressMessage(A){return new Promise((q,K)=>{let Y=0,z=[],w=uk1.createInflate();w.on("data",(_)=>{if(z.push(_),Y+=_.byteLength,this.maxRecvMessageLength!==-1&&Y>this.maxRecvMessageLength)w.destroy(),K({code:vN6.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`})}),w.on("end",()=>{q(Buffer.concat(z))}),w.write(A),w.end()})}}class $o4 extends kn6{constructor(A){super();this.maxRecvMessageLength=A}compressMessage(A){return new Promise((q,K)=>{uk1.gzip(A,(Y,z)=>{if(Y)K(Y);else q(z)})})}decompressMessage(A){return new Promise((q,K)=>{let Y=0,z=[],w=uk1.createGunzip();w.on("data",(_)=>{if(z.push(_),Y+=_.byteLength,this.maxRecvMessageLength!==-1&&Y>this.maxRecvMessageLength)w.destroy(),K({code:vN6.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`})}),w.on("end",()=>{q(Buffer.concat(z))}),w.write(A),w.end()})}}class Oo4 extends kn6{constructor(A){super();this.compressionName=A}compressMessage(A){return Promise.reject(Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(A){return Promise.reject(Error(`Compression method not supported: ${this.compressionName}`))}}function zo4(A,q){switch(A){case"identity":return new kN6;case"deflate":return new _o4(q);case"gzip":return new $o4(q);default:return new Oo4(A)}}class Hm8 extends lUY.BaseFilter{constructor(A,q){var K,Y,z;super();this.sharedFilterConfig=q,this.sendCompression=new kN6,this.receiveCompression=new kN6,this.currentCompressionAlgorithm="identity";let w=A["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=(K=A["grpc.max_receive_message_length"])!==null&&K!==void 0?K:vN6.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=(Y=A["grpc.max_send_message_length"])!==null&&Y!==void 0?Y:vN6.DEFAULT_MAX_SEND_MESSAGE_LENGTH,w!==void 0)if(nUY(w)){let _=wo4.CompressionAlgorithms[w],$=(z=q.serverSupportedEncodingHeader)===null||z===void 0?void 0:z.split(",");if(!$||$.includes(_))this.currentCompressionAlgorithm=_,this.sendCompression=zo4(this.currentCompressionAlgorithm,-1)}else iUY.log(vN6.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${w}`)}async sendMetadata(A){let q=await A;if(q.set("grpc-accept-encoding","identity,deflate,gzip"),q.set("accept-encoding","identity"),this.currentCompressionAlgorithm==="identity")q.remove("grpc-encoding");else q.set("grpc-encoding",this.currentCompressionAlgorithm);return q}receiveMetadata(A){let q=A.get("grpc-encoding");if(q.length>0){let Y=q[0];if(typeof Y==="string")this.receiveCompression=zo4(Y,this.maxReceiveMessageLength)}A.remove("grpc-encoding");let K=A.get("grpc-accept-encoding")[0];if(K){if(this.sharedFilterConfig.serverSupportedEncodingHeader=K,!K.split(",").includes(this.currentCompressionAlgorithm))this.sendCompression=new kN6,this.currentCompressionAlgorithm="identity"}return A.remove("grpc-accept-encoding"),A}async sendMessage(A){var q;let K=await A;if(this.maxSendMessageLength!==-1&&K.message.length>this.maxSendMessageLength)throw{code:vN6.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let Y;if(this.sendCompression instanceof kN6)Y=!1;else Y=(((q=K.flags)!==null&&q!==void 0?q:0)&2)===0;return{message:await this.sendCompression.writeMessage(K.message,Y),flags:K.flags}}async receiveMessage(A){return this.receiveCompression.readMessage(await A)}}jo4.CompressionFilter=Hm8;class Ho4{constructor(A,q){this.options=q,this.sharedFilterConfig={}}createFilter(){return new Hm8(this.options,this.sharedFilterConfig)}}jo4.CompressionFilterFactory=Ho4});var En6=C((Mo4)=>{Object.defineProperty(Mo4,"__esModule",{value:!0});Mo4.restrictControlPlaneStatusCode=aUY;var BQ=E9(),oUY=[BQ.Status.OK,BQ.Status.INVALID_ARGUMENT,BQ.Status.NOT_FOUND,BQ.Status.ALREADY_EXISTS,BQ.Status.FAILED_PRECONDITION,BQ.Status.ABORTED,BQ.Status.OUT_OF_RANGE,BQ.Status.DATA_LOSS];function aUY(A,q){if(oUY.includes(A))return{code:BQ.Status.INTERNAL,details:`Invalid status from control plane: ${A} ${BQ.Status[A]} ${q}`};else return{code:A,details:q}}});var EN6=C((Do4)=>{Object.defineProperty(Do4,"__esModule",{value:!0});Do4.minDeadline=tUY;Do4.getDeadlineTimeoutString=ApY;Do4.getRelativeTimeout=KpY;Do4.deadlineToString=YpY;Do4.formatDateDifference=zpY;function tUY(...A){let q=1/0;for(let K of A){let Y=K instanceof Date?K.getTime():K;if(YqpY)return 1/0;else return Y}function YpY(A){if(A instanceof Date)return A.toISOString();else{let q=new Date(A);if(Number.isNaN(q.getTime()))return""+A;else return q.toISOString()}}function zpY(A,q){return((q.getTime()-A.getTime())/1000).toFixed(3)+"s"}});var Bk1=C((Xo4)=>{Object.defineProperty(Xo4,"__esModule",{value:!0});Xo4.FilterStackFactory=Xo4.FilterStack=void 0;class Jm8{constructor(A){this.filters=A}sendMetadata(A){let q=A;for(let K=0;K=0;K--)q=this.filters[K].receiveMetadata(q);return q}sendMessage(A){let q=A;for(let K=0;K=0;K--)q=this.filters[K].receiveMessage(q);return q}receiveTrailers(A){let q=A;for(let K=this.filters.length-1;K>=0;K--)q=this.filters[K].receiveTrailers(q);return q}push(A){this.filters.unshift(...A)}getFilters(){return this.filters}}Xo4.FilterStack=Jm8;class Mm8{constructor(A){this.factories=A}push(A){this.factories.unshift(...A)}clone(){return new Mm8([...this.factories])}createFilter(){return new Jm8(this.factories.map((A)=>A.createFilter()))}}Xo4.FilterStackFactory=Mm8});var To4=C((Go4)=>{Object.defineProperty(Go4,"__esModule",{value:!0});Go4.SingleSubchannelChannel=void 0;var JpY=xk1(),Ln6=I86(),MpY=jm8(),DpY=dT(),yn6=E9(),XpY=En6(),PpY=EN6(),WpY=Bk1(),Dm8=hP(),ZpY=zu(),mk1=pT();class Wo4{constructor(A,q,K,Y,z){var w,_;this.subchannel=A,this.method=q,this.options=Y,this.callNumber=z,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;let $=this.method.split("/"),O="";if($.length>=2)O=$[1];let H=(_=(w=(0,mk1.splitHostPort)(this.options.host))===null||w===void 0?void 0:w.host)!==null&&_!==void 0?_:"localhost";this.serviceUrl=`https://${H}/${O}`;let j=(0,PpY.getRelativeTimeout)(Y.deadline);if(j!==1/0)if(j<=0)this.cancelWithStatus(yn6.Status.DEADLINE_EXCEEDED,"Deadline exceeded");else setTimeout(()=>{this.cancelWithStatus(yn6.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},j);this.filterStack=K.createFilter()}cancelWithStatus(A,q){if(this.childCall)this.childCall.cancelWithStatus(A,q);else this.pendingStatus={code:A,details:q,metadata:new Dm8.Metadata}}getPeer(){var A,q;return(q=(A=this.childCall)===null||A===void 0?void 0:A.getPeer())!==null&&q!==void 0?q:this.subchannel.getAddress()}async start(A,q){if(this.pendingStatus){q.onReceiveStatus(this.pendingStatus);return}if(this.subchannel.getConnectivityState()!==DpY.ConnectivityState.READY){q.onReceiveStatus({code:yn6.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new Dm8.Metadata});return}let K=await this.filterStack.sendMetadata(Promise.resolve(A)),Y;try{Y=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(w){let _=w,{code:$,details:O}=(0,XpY.restrictControlPlaneStatusCode)(typeof _.code==="number"?_.code:yn6.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${_.message}`);q.onReceiveStatus({code:$,details:O,metadata:new Dm8.Metadata});return}Y.merge(K);let z={onReceiveMetadata:async(w)=>{q.onReceiveMetadata(await this.filterStack.receiveMetadata(w))},onReceiveMessage:async(w)=>{this.readFilterPending=!0;let _=await this.filterStack.receiveMessage(w);if(this.readFilterPending=!1,q.onReceiveMessage(_),this.pendingStatus)q.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async(w)=>{let _=await this.filterStack.receiveTrailers(w);if(this.readFilterPending)this.pendingStatus=_;else q.onReceiveStatus(_)}};if(this.childCall=this.subchannel.createCall(Y,this.options.host,this.method,z),this.readPending)this.childCall.startRead();if(this.pendingMessage)this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message);if(this.halfClosePending&&!this.writeFilterPending)this.childCall.halfClose()}async sendMessageWithContext(A,q){this.writeFilterPending=!0;let K=await this.filterStack.sendMessage(Promise.resolve({message:q,flags:A.flags}));if(this.writeFilterPending=!1,this.childCall){if(this.childCall.sendMessageWithContext(A,K.message),this.halfClosePending)this.childCall.halfClose()}else this.pendingMessage={context:A,message:K.message}}startRead(){if(this.childCall)this.childCall.startRead();else this.readPending=!0}halfClose(){if(this.childCall&&!this.writeFilterPending)this.childCall.halfClose();else this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(A){throw Error("Method not implemented.")}getAuthContext(){if(this.childCall)return this.childCall.getAuthContext();else return null}}class Zo4{constructor(A,q,K){if(this.subchannel=A,this.target=q,this.channelzEnabled=!1,this.channelzTrace=new Ln6.ChannelzTrace,this.callTracker=new Ln6.ChannelzCallTracker,this.childrenTracker=new Ln6.ChannelzChildrenTracker,this.channelzEnabled=K["grpc.enable_channelz"]!==0,this.channelzRef=(0,Ln6.registerChannelzChannel)((0,mk1.uriToString)(q),()=>({target:`${(0,mk1.uriToString)(q)} (${A.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled)this.childrenTracker.refChild(A.getChannelzRef());this.filterStackFactory=new WpY.FilterStackFactory([new MpY.CompressionFilterFactory(this,K)])}close(){if(this.channelzEnabled)this.childrenTracker.unrefChild(this.subchannel.getChannelzRef());(0,Ln6.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,mk1.uriToString)(this.target)}getConnectivityState(A){throw Error("Method not implemented.")}watchConnectivityState(A,q,K){throw Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(A,q){let K={deadline:q,host:(0,ZpY.getDefaultAuthority)(this.target),flags:yn6.Propagate.DEFAULTS,parentCall:null};return new Wo4(this.subchannel,A,this.filterStackFactory,K,(0,JpY.getNextCallNumber)())}}Go4.SingleSubchannelChannel=Zo4});var ko4=C((No4)=>{Object.defineProperty(No4,"__esModule",{value:!0});No4.Subchannel=void 0;var Y_=dT(),GpY=JN6(),Xm8=m_(),gk1=E9(),fpY=pT(),TpY=Gv(),mQ=I86(),VpY=To4(),NpY="subchannel",vpY=2147483647;class Vo4{constructor(A,q,K,Y,z){var w;this.channelTarget=A,this.subchannelAddress=q,this.options=K,this.connector=z,this.connectivityState=Y_.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;let _={initialDelay:K["grpc.initial_reconnect_backoff_ms"],maxDelay:K["grpc.max_reconnect_backoff_ms"]};if(this.backoffTimeout=new GpY.BackoffTimeout(()=>{this.handleBackoffTimer()},_),this.backoffTimeout.unref(),this.subchannelAddressString=(0,TpY.subchannelAddressToString)(q),this.keepaliveTime=(w=K["grpc.keepalive_time_ms"])!==null&&w!==void 0?w:-1,K["grpc.enable_channelz"]===0)this.channelzEnabled=!1,this.channelzTrace=new mQ.ChannelzTraceStub,this.callTracker=new mQ.ChannelzCallTrackerStub,this.childrenTracker=new mQ.ChannelzChildrenTrackerStub,this.streamTracker=new mQ.ChannelzCallTrackerStub;else this.channelzTrace=new mQ.ChannelzTrace,this.callTracker=new mQ.ChannelzCallTracker,this.childrenTracker=new mQ.ChannelzChildrenTracker,this.streamTracker=new mQ.ChannelzCallTracker;this.channelzRef=(0,mQ.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(K,void 0,2)),this.secureConnector=Y._createSecureConnector(A,K)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(A){Xm8.trace(gk1.LogVerbosity.DEBUG,NpY,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+A)}refTrace(A){Xm8.trace(gk1.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+A)}handleBackoffTimer(){if(this.continueConnecting)this.transitionToState([Y_.ConnectivityState.TRANSIENT_FAILURE],Y_.ConnectivityState.CONNECTING);else this.transitionToState([Y_.ConnectivityState.TRANSIENT_FAILURE],Y_.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let A=this.options;if(A["grpc.keepalive_time_ms"]){let q=Math.min(this.keepaliveTime,vpY);A=Object.assign(Object.assign({},A),{"grpc.keepalive_time_ms":q})}this.connector.connect(this.subchannelAddress,this.secureConnector,A).then((q)=>{if(this.transitionToState([Y_.ConnectivityState.CONNECTING],Y_.ConnectivityState.READY)){if(this.transport=q,this.channelzEnabled)this.childrenTracker.refChild(q.getChannelzRef());q.addDisconnectListener((K)=>{if(this.transitionToState([Y_.ConnectivityState.READY],Y_.ConnectivityState.IDLE),K&&this.keepaliveTime>0)this.keepaliveTime*=2,Xm8.log(gk1.LogVerbosity.ERROR,`Connection to ${(0,fpY.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`)})}else q.shutdown()},(q)=>{this.transitionToState([Y_.ConnectivityState.CONNECTING],Y_.ConnectivityState.TRANSIENT_FAILURE,`${q}`)})}transitionToState(A,q,K){var Y,z;if(A.indexOf(this.connectivityState)===-1)return!1;if(K)this.trace(Y_.ConnectivityState[this.connectivityState]+" -> "+Y_.ConnectivityState[q]+' with error "'+K+'"');else this.trace(Y_.ConnectivityState[this.connectivityState]+" -> "+Y_.ConnectivityState[q]);if(this.channelzEnabled)this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+Y_.ConnectivityState[q]);let w=this.connectivityState;switch(this.connectivityState=q,q){case Y_.ConnectivityState.READY:this.stopBackoff();break;case Y_.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case Y_.ConnectivityState.TRANSIENT_FAILURE:if(this.channelzEnabled&&this.transport)this.childrenTracker.unrefChild(this.transport.getChannelzRef());if((Y=this.transport)===null||Y===void 0||Y.shutdown(),this.transport=null,!this.backoffTimeout.isRunning())process.nextTick(()=>{this.handleBackoffTimer()});break;case Y_.ConnectivityState.IDLE:if(this.channelzEnabled&&this.transport)this.childrenTracker.unrefChild(this.transport.getChannelzRef());(z=this.transport)===null||z===void 0||z.shutdown(),this.transport=null;break;default:throw Error(`Invalid state: unknown ConnectivityState ${q}`)}for(let _ of this.stateListeners)_(this,w,q,this.keepaliveTime,K);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){if(this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,this.refcount===0)this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,mQ.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([Y_.ConnectivityState.CONNECTING,Y_.ConnectivityState.READY],Y_.ConnectivityState.IDLE)})}unrefIfOneRef(){if(this.refcount===1)return this.unref(),!0;return!1}createCall(A,q,K,Y){if(!this.transport)throw Error("Cannot create call, subchannel not READY");let z;if(this.channelzEnabled)this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),z={onCallEnd:(w)=>{if(w.code===gk1.Status.OK)this.callTracker.addCallSucceeded();else this.callTracker.addCallFailed()}};else z={};return this.transport.createCall(A,q,K,Y,z)}startConnecting(){process.nextTick(()=>{if(!this.transitionToState([Y_.ConnectivityState.IDLE],Y_.ConnectivityState.CONNECTING)){if(this.connectivityState===Y_.ConnectivityState.TRANSIENT_FAILURE)this.continueConnecting=!0}})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(A){this.stateListeners.add(A)}removeConnectivityStateListener(A){this.stateListeners.delete(A)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([Y_.ConnectivityState.TRANSIENT_FAILURE],Y_.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(A){}removeHealthStateWatcher(A){}getRealSubchannel(){return this}realSubchannelEquals(A){return A.getRealSubchannel()===this}throttleKeepalive(A){if(A>this.keepaliveTime)this.keepaliveTime=A}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){if(!this.subchannelChannel)this.subchannelChannel=new VpY.SingleSubchannelChannel(this,this.channelTarget,this.options);return this.subchannelChannel}addDataWatcher(A){throw Error("Not implemented")}getOrCreateDataProducer(A,q){let K=this.dataProducers.get(A);if(K)return K;let Y=q(this);return this.dataProducers.set(A,Y),Y}removeDataProducer(A){this.dataProducers.delete(A)}}No4.Subchannel=Vo4});var yo4=C((Eo4)=>{var Pm8;Object.defineProperty(Eo4,"__esModule",{value:!0});Eo4.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0;Eo4.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=((Pm8=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)!==null&&Pm8!==void 0?Pm8:"false")==="true"});var Gm8=C((Io4)=>{Object.defineProperty(Io4,"__esModule",{value:!0});Io4.DEFAULT_PORT=void 0;Io4.setup=hpY;var Ro4=zu(),Wm8=g6("dns"),kpY=AB8(),Zm8=E9(),LN6=cw6(),EpY=hP(),LpY=m_(),ypY=E9(),b86=pT(),So4=g6("net"),RpY=JN6(),Co4=yo4(),SpY="dns_resolver";function gQ(A){LpY.trace(ypY.LogVerbosity.DEBUG,SpY,A)}Io4.DEFAULT_PORT=443;var CpY=30000;class ho4{constructor(A,q,K){var Y,z,w;if(this.target=A,this.listener=q,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new Wm8.promises.Resolver,gQ("Resolver constructed for target "+(0,b86.uriToString)(A)),A.authority)this.alternativeResolver.setServers([A.authority]);let _=(0,b86.splitHostPort)(A.path);if(_===null)this.ipResult=null,this.dnsHostname=null,this.port=null;else if((0,So4.isIPv4)(_.host)||(0,So4.isIPv6)(_.host))this.ipResult=[{addresses:[{host:_.host,port:(Y=_.port)!==null&&Y!==void 0?Y:Io4.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null;else this.ipResult=null,this.dnsHostname=_.host,this.port=(z=_.port)!==null&&z!==void 0?z:Io4.DEFAULT_PORT;if(this.percentage=Math.random()*100,K["grpc.service_config_disable_resolution"]===1)this.isServiceConfigEnabled=!1;this.defaultResolutionError={code:Zm8.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,b86.uriToString)(this.target)}`,metadata:new EpY.Metadata};let $={initialDelay:K["grpc.initial_reconnect_backoff_ms"],maxDelay:K["grpc.max_reconnect_backoff_ms"]};this.backoff=new RpY.BackoffTimeout(()=>{if(this.continueResolving)this.startResolutionWithBackoff()},$),this.backoff.unref(),this.minTimeBetweenResolutionsMs=(w=K["grpc.dns_min_time_between_resolutions_ms"])!==null&&w!==void 0?w:CpY,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){if(!this.returnedIpResult)gQ("Returning IP address for target "+(0,b86.uriToString)(this.target)),setImmediate(()=>{this.listener((0,LN6.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0;this.backoff.stop(),this.backoff.reset(),this.stopNextResolutionTimer();return}if(this.dnsHostname===null)gQ("Failed to parse DNS address "+(0,b86.uriToString)(this.target)),setImmediate(()=>{this.listener((0,LN6.statusOrFromError)({code:Zm8.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,b86.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(this.pendingLookupPromise!==null)return;gQ("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;let A=this.dnsHostname;if(this.pendingLookupPromise=this.lookup(A),this.pendingLookupPromise.then((q)=>{if(this.pendingLookupPromise===null)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,LN6.statusOrFromValue)(q.map((z)=>({addresses:[z]})));let K="["+q.map((z)=>z.host+":"+z.port).join(",")+"]";gQ("Resolved addresses for target "+(0,b86.uriToString)(this.target)+": "+K);let Y=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(Y)},(q)=>{if(this.pendingLookupPromise===null)return;gQ("Resolution error for target "+(0,b86.uriToString)(this.target)+": "+q.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,LN6.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,"")}),this.isServiceConfigEnabled&&this.pendingTxtPromise===null)this.pendingTxtPromise=this.resolveTxt(A),this.pendingTxtPromise.then((q)=>{if(this.pendingTxtPromise===null)return;this.pendingTxtPromise=null;let K;try{if(K=(0,kpY.extractAndSelectServiceConfig)(q,this.percentage),K)this.latestServiceConfigResult=(0,LN6.statusOrFromValue)(K);else this.latestServiceConfigResult=null}catch(Y){this.latestServiceConfigResult=(0,LN6.statusOrFromError)({code:Zm8.Status.UNAVAILABLE,details:`Parsing service config failed with error ${Y.message}`})}if(this.latestLookupResult!==null)this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},(q)=>{})}}handleHealthStatus(A){if(A)this.backoff.stop(),this.backoff.reset();else this.continueResolving=!0}async lookup(A){if(Co4.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){gQ("Using alternative DNS resolver.");let K=await Promise.allSettled([this.alternativeResolver.resolve4(A),this.alternativeResolver.resolve6(A)]);if(K.every((Y)=>Y.status==="rejected"))throw Error(K[0].reason);return K.reduce((Y,z)=>{return z.status==="fulfilled"?[...Y,...z.value]:Y},[]).map((Y)=>({host:Y,port:+this.port}))}return(await Wm8.promises.lookup(A,{all:!0})).map((K)=>({host:K.address,port:+this.port}))}async resolveTxt(A){if(Co4.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)return gQ("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(A);return Wm8.promises.resolveTxt(A)}startNextResolutionTimer(){var A,q;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{if(this.stopNextResolutionTimer(),this.continueResolving)this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),(q=(A=this.nextResolutionTimer).unref)===null||q===void 0||q.call(A),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){if(this.pendingLookupPromise===null)this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution()}updateResolution(){if(this.pendingLookupPromise===null)if(this.isNextResolutionTimerRunning||this.backoff.isRunning()){if(this.isNextResolutionTimerRunning)gQ('resolution update delayed by "min time between resolutions" rate limit');else gQ("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString());this.continueResolving=!0}else this.startResolutionWithBackoff()}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(A){return A.path}}function hpY(){(0,Ro4.registerResolver)("dns",ho4),(0,Ro4.registerDefaultScheme)("dns")}});var fm8=C((mo4)=>{Object.defineProperty(mo4,"__esModule",{value:!0});mo4.parseCIDR=uo4;mo4.mapProxyName=ppY;mo4.getProxiedConnection=dpY;var Rn6=m_(),yN6=E9(),xo4=g6("net"),bpY=g6("http"),xpY=m_(),bo4=Gv(),Sn6=pT(),upY=g6("url"),BpY=Gm8(),mpY="proxy";function RN6(A){xpY.trace(yN6.LogVerbosity.DEBUG,mpY,A)}function gpY(){let A="",q="";if(process.env.grpc_proxy)q="grpc_proxy",A=process.env.grpc_proxy;else if(process.env.https_proxy)q="https_proxy",A=process.env.https_proxy;else if(process.env.http_proxy)q="http_proxy",A=process.env.http_proxy;else return{};let K;try{K=new upY.URL(A)}catch($){return(0,Rn6.log)(yN6.LogVerbosity.ERROR,`cannot parse value of "${q}" env var`),{}}if(K.protocol!=="http:")return(0,Rn6.log)(yN6.LogVerbosity.ERROR,`"${K.protocol}" scheme not supported in proxy URI`),{};let Y=null;if(K.username)if(K.password)(0,Rn6.log)(yN6.LogVerbosity.INFO,"userinfo found in proxy URI"),Y=decodeURIComponent(`${K.username}:${K.password}`);else Y=K.username;let{hostname:z,port:w}=K;if(w==="")w="80";let _={address:`${z}:${w}`};if(Y)_.creds=Y;return RN6("Proxy server "+_.address+" set by environment variable "+q),_}function FpY(){let A=process.env.no_grpc_proxy,q="no_grpc_proxy";if(!A)A=process.env.no_proxy,q="no_proxy";if(A)return RN6("No proxy server list set by environment variable "+q),A.split(",");else return[]}function uo4(A){let q=A.split("/");if(q.length!==2)return null;let K=parseInt(q[1],10);if(!(0,xo4.isIPv4)(q[0])||Number.isNaN(K)||K<0||K>32)return null;return{ip:Bo4(q[0]),prefixLength:K}}function Bo4(A){return A.split(".").reduce((q,K)=>(q<<8)+parseInt(K,10),0)}function QpY(A,q){let K=A.ip,Y=-1<<32-A.prefixLength;return(Bo4(q)&Y)===(K&Y)}function UpY(A){for(let q of FpY()){let K=uo4(q);if((0,xo4.isIPv4)(A)&&K&&QpY(K,A))return!0;else if(A.endsWith(q))return!0}return!1}function ppY(A,q){var K;let Y={target:A,extraOptions:{}};if(((K=q["grpc.enable_http_proxy"])!==null&&K!==void 0?K:1)===0)return Y;if(A.scheme==="unix")return Y;let z=gpY();if(!z.address)return Y;let w=(0,Sn6.splitHostPort)(A.path);if(!w)return Y;let _=w.host;if(UpY(_))return RN6("Not using proxy for target in no_proxy list: "+(0,Sn6.uriToString)(A)),Y;let $={"grpc.http_connect_target":(0,Sn6.uriToString)(A)};if(z.creds)$["grpc.http_connect_creds"]=z.creds;return{target:{scheme:"dns",path:z.address},extraOptions:$}}function dpY(A,q){var K;if(!("grpc.http_connect_target"in q))return Promise.resolve(null);let Y=q["grpc.http_connect_target"],z=(0,Sn6.parseUri)(Y);if(z===null)return Promise.resolve(null);let w=(0,Sn6.splitHostPort)(z.path);if(w===null)return Promise.resolve(null);let _=`${w.host}:${(K=w.port)!==null&&K!==void 0?K:BpY.DEFAULT_PORT}`,$={method:"CONNECT",path:_},O={Host:_};if((0,bo4.isTcpSubchannelAddress)(A))$.host=A.host,$.port=A.port;else $.socketPath=A.path;if("grpc.http_connect_creds"in q)O["Proxy-Authorization"]="Basic "+Buffer.from(q["grpc.http_connect_creds"]).toString("base64");$.headers=O;let H=(0,bo4.subchannelAddressToString)(A);return RN6("Using proxy "+H+" to connect to "+$.path),new Promise((j,J)=>{let M=bpY.request($);M.once("connect",(D,X,P)=>{if(M.removeAllListeners(),X.removeAllListeners(),D.statusCode===200){if(RN6("Successfully connected to "+$.path+" through proxy "+H),P.length>0)X.unshift(P);RN6("Successfully established a plaintext connection to "+$.path+" through proxy "+H),j(X)}else(0,Rn6.log)(yN6.LogVerbosity.ERROR,"Failed to connect to "+$.path+" through proxy "+H+" with status "+D.statusCode),J()}),M.once("error",(D)=>{M.removeAllListeners(),(0,Rn6.log)(yN6.LogVerbosity.ERROR,"Failed to connect to proxy "+H+" with error "+D.message),J()}),M.end()})}});var Tm8=C((Fo4)=>{Object.defineProperty(Fo4,"__esModule",{value:!0});Fo4.StreamDecoder=void 0;var FQ;(function(A){A[A.NO_DATA=0]="NO_DATA",A[A.READING_SIZE=1]="READING_SIZE",A[A.READING_MESSAGE=2]="READING_MESSAGE"})(FQ||(FQ={}));class go4{constructor(A){this.maxReadMessageLength=A,this.readState=FQ.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(A){let q=0,K,Y=[];while(qthis.maxReadMessageLength)throw Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=FQ.READING_MESSAGE;else{let z=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=FQ.NO_DATA,Y.push(z)}}break;case FQ.READING_MESSAGE:if(K=Math.min(A.length-q,this.readMessageRemaining),this.readPartialMessage.push(A.slice(q,q+K)),this.readMessageRemaining-=K,q+=K,this.readMessageRemaining===0){let z=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),w=Buffer.concat(z,this.readMessageSize+5);this.readState=FQ.NO_DATA,Y.push(w)}break;default:throw Error("Unexpected read state")}return Y}}Fo4.StreamDecoder=go4});var co4=C((po4)=>{Object.defineProperty(po4,"__esModule",{value:!0});po4.Http2SubchannelCall=void 0;var Vn=g6("http2"),npY=g6("os"),z_=E9(),Nn=hP(),rpY=Tm8(),opY=m_(),apY=E9(),spY="subchannel_call";function tpY(A){for(let[q,K]of Object.entries(npY.constants.errno))if(K===A)return q;return"Unknown system error "+A}function Vm8(A){let q=`Received HTTP status code ${A}`,K;switch(A){case 400:K=z_.Status.INTERNAL;break;case 401:K=z_.Status.UNAUTHENTICATED;break;case 403:K=z_.Status.PERMISSION_DENIED;break;case 404:K=z_.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:K=z_.Status.UNAVAILABLE;break;default:K=z_.Status.UNKNOWN}return{code:K,details:q,metadata:new Nn.Metadata}}class Uo4{constructor(A,q,K,Y,z){var w;this.http2Stream=A,this.callEventTracker=q,this.listener=K,this.transport=Y,this.callId=z,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;let _=(w=Y.getOptions()["grpc.max_receive_message_length"])!==null&&w!==void 0?w:z_.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new rpY.StreamDecoder(_),A.on("response",($,O)=>{let H="";for(let j of Object.keys($))H+="\t\t"+j+": "+$[j]+` `;if(this.trace(`Received server headers: `+H),this.httpStatusCode=$[":status"],O&Vn.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers($);else{let j;try{j=Nn.Metadata.fromHttp2Headers($)}catch(J){this.endCall({code:z_.Status.UNKNOWN,details:J.message,metadata:new Nn.Metadata});return}this.listener.onReceiveMetadata(j)}}),A.on("trailers",($)=>{this.handleTrailers($)}),A.on("data",($)=>{if(this.statusOutput)return;this.trace("receive HTTP/2 data frame of length "+$.length);let O;try{O=this.decoder.write($)}catch(H){if(this.httpStatusCode!==void 0&&this.httpStatusCode!==200){let j=Vm8(this.httpStatusCode);this.cancelWithStatus(j.code,j.details)}else this.cancelWithStatus(z_.Status.RESOURCE_EXHAUSTED,H.message);return}for(let H of O)this.trace("parsed message of length "+H.length),this.callEventTracker.addMessageReceived(),this.tryPush(H)}),A.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),A.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var $;if(this.trace("HTTP/2 stream closed with code "+A.rstCode),(($=this.finalStatus)===null||$===void 0?void 0:$.code)===z_.Status.OK)return;let O,H="";switch(A.rstCode){case Vn.constants.NGHTTP2_NO_ERROR:if(this.finalStatus!==null)return;if(this.httpStatusCode&&this.httpStatusCode!==200){let j=Vm8(this.httpStatusCode);O=j.code,H=j.details}else O=z_.Status.INTERNAL,H=`Received RST_STREAM with code ${A.rstCode} (Call ended without gRPC status)`;break;case Vn.constants.NGHTTP2_REFUSED_STREAM:O=z_.Status.UNAVAILABLE,H="Stream refused by server";break;case Vn.constants.NGHTTP2_CANCEL:if(this.connectionDropped)O=z_.Status.UNAVAILABLE,H="Connection dropped";else O=z_.Status.CANCELLED,H="Call cancelled";break;case Vn.constants.NGHTTP2_ENHANCE_YOUR_CALM:O=z_.Status.RESOURCE_EXHAUSTED,H="Bandwidth exhausted or memory limit exceeded";break;case Vn.constants.NGHTTP2_INADEQUATE_SECURITY:O=z_.Status.PERMISSION_DENIED,H="Protocol not secure enough";break;case Vn.constants.NGHTTP2_INTERNAL_ERROR:if(O=z_.Status.INTERNAL,this.internalError===null)H=`Received RST_STREAM with code ${A.rstCode} (Internal server error)`;else if(this.internalError.code==="ECONNRESET"||this.internalError.code==="ETIMEDOUT")O=z_.Status.UNAVAILABLE,H=this.internalError.message;else H=`Received RST_STREAM with code ${A.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:O=z_.Status.INTERNAL,H=`Received RST_STREAM with code ${A.rstCode}`}this.endCall({code:O,details:H,metadata:new Nn.Metadata,rstCode:A.rstCode})})}),A.on("error",($)=>{if($.code!=="ERR_HTTP2_STREAM_ERROR")this.trace("Node error event: message="+$.message+" code="+$.code+" errno="+tpY($.errno)+" syscall="+$.syscall),this.internalError=$;this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.connectionDropped=!0,setImmediate(()=>{this.endCall({code:z_.Status.UNAVAILABLE,details:"Connection dropped",metadata:new Nn.Metadata})})}outputStatus(){if(!this.statusOutput)this.statusOutput=!0,this.trace("ended with status: code="+this.finalStatus.code+' details="'+this.finalStatus.details+'"'),this.callEventTracker.onCallEnd(this.finalStatus),process.nextTick(()=>{this.listener.onReceiveStatus(this.finalStatus)}),this.http2Stream.resume()}trace(A){opY.trace(apY.LogVerbosity.DEBUG,spY,"["+this.callId+"] "+A)}endCall(A){if(this.finalStatus===null||this.finalStatus.code===z_.Status.OK)this.finalStatus=A,this.maybeOutputStatus();this.destroyHttp2Stream()}maybeOutputStatus(){if(this.finalStatus!==null){if(this.finalStatus.code!==z_.Status.OK||this.readsClosed&&this.unpushedReadMessages.length===0&&!this.isReadFilterPending&&!this.isPushPending)this.outputStatus()}}push(A){this.trace("pushing to reader message of length "+(A instanceof Buffer?A.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{if(this.isPushPending=!1,this.statusOutput)return;this.listener.onReceiveMessage(A),this.maybeOutputStatus()})}tryPush(A){if(this.canPush)this.http2Stream.pause(),this.push(A);else this.trace("unpushedReadMessages.push message of length "+A.length),this.unpushedReadMessages.push(A)}handleTrailers(A){this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0);let q="";for(let w of Object.keys(A))q+="\t\t"+w+": "+A[w]+` `;this.trace(`Received server trailers: `+q);let K;try{K=Nn.Metadata.fromHttp2Headers(A)}catch(w){K=new Nn.Metadata}let Y=K.getMap(),z;if(typeof Y["grpc-status"]==="string"){let w=Number(Y["grpc-status"]);this.trace("received status code "+w+" from server"),K.remove("grpc-status");let _="";if(typeof Y["grpc-message"]==="string"){try{_=decodeURI(Y["grpc-message"])}catch($){_=Y["grpc-message"]}K.remove("grpc-message"),this.trace('received status details string "'+_+'" from server')}z={code:w,details:_,metadata:K}}else if(this.httpStatusCode)z=Vm8(this.httpStatusCode),z.metadata=K;else z={code:z_.Status.UNKNOWN,details:"No status information received",metadata:K};this.endCall(z)}destroyHttp2Stream(){var A;if(this.http2Stream.destroyed)return;if(this.serverEndedCall)this.http2Stream.end();else{let q;if(((A=this.finalStatus)===null||A===void 0?void 0:A.code)===z_.Status.OK)q=Vn.constants.NGHTTP2_NO_ERROR;else q=Vn.constants.NGHTTP2_CANCEL;this.trace("close http2 stream with code "+q),this.http2Stream.close(q)}}cancelWithStatus(A,q){this.trace("cancelWithStatus code: "+A+' details: "'+q+'"'),this.endCall({code:A,details:q,metadata:new Nn.Metadata})}getStatus(){return this.finalStatus}getPeer(){return this.transport.getPeerName()}getCallNumber(){return this.callId}getAuthContext(){return this.transport.getAuthContext()}startRead(){if(this.finalStatus!==null&&this.finalStatus.code!==z_.Status.OK){this.readsClosed=!0,this.maybeOutputStatus();return}if(this.canPush=!0,this.unpushedReadMessages.length>0){let A=this.unpushedReadMessages.shift();this.push(A);return}this.http2Stream.resume()}sendMessageWithContext(A,q){this.trace("write() called with message of length "+q.length);let K=(Y)=>{process.nextTick(()=>{var z;let w=z_.Status.UNAVAILABLE;if((Y===null||Y===void 0?void 0:Y.code)==="ERR_STREAM_WRITE_AFTER_END")w=z_.Status.INTERNAL;if(Y)this.cancelWithStatus(w,`Write error: ${Y.message}`);(z=A.callback)===null||z===void 0||z.call(A)})};this.trace("sending data chunk of length "+q.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(q,K)}catch(Y){this.endCall({code:z_.Status.UNAVAILABLE,details:`Write failed with error ${Y.message}`,metadata:new Nn.Metadata})}}halfClose(){this.trace("end() called"),this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end()}}po4.Http2SubchannelCall=Uo4});var oo4=C((no4)=>{Object.defineProperty(no4,"__esModule",{value:!0});no4.Http2SubchannelConnector=void 0;var sw6=g6("http2"),epY=g6("tls"),Qk1=I86(),Cn6=E9(),AdY=fm8(),SN6=m_(),qdY=zu(),Uk1=Gv(),Nm8=pT(),KdY=g6("net"),YdY=co4(),zdY=xk1(),vm8="transport",wdY="transport_flowctrl",_dY=mu8().version,{HTTP2_HEADER_AUTHORITY:$dY,HTTP2_HEADER_CONTENT_TYPE:OdY,HTTP2_HEADER_METHOD:HdY,HTTP2_HEADER_PATH:jdY,HTTP2_HEADER_TE:JdY,HTTP2_HEADER_USER_AGENT:MdY}=sw6.constants,DdY=20000,XdY=Buffer.from("too_many_pings","ascii");class lo4{constructor(A,q,K,Y){if(this.session=A,this.options=K,this.remoteName=Y,this.keepaliveTimer=null,this.pendingSendKeepalivePing=!1,this.activeCalls=new Set,this.disconnectListeners=[],this.disconnectHandled=!1,this.channelzEnabled=!0,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null,this.subchannelAddressString=(0,Uk1.subchannelAddressToString)(q),K["grpc.enable_channelz"]===0)this.channelzEnabled=!1,this.streamTracker=new Qk1.ChannelzCallTrackerStub;else this.streamTracker=new Qk1.ChannelzCallTracker;if(this.channelzRef=(0,Qk1.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[K["grpc.primary_user_agent"],`grpc-node-js/${_dY}`,K["grpc.secondary_user_agent"]].filter((z)=>z).join(" "),"grpc.keepalive_time_ms"in K)this.keepaliveTimeMs=K["grpc.keepalive_time_ms"];else this.keepaliveTimeMs=-1;if("grpc.keepalive_timeout_ms"in K)this.keepaliveTimeoutMs=K["grpc.keepalive_timeout_ms"];else this.keepaliveTimeoutMs=DdY;if("grpc.keepalive_permit_without_calls"in K)this.keepaliveWithoutCalls=K["grpc.keepalive_permit_without_calls"]===1;else this.keepaliveWithoutCalls=!1;if(A.once("close",()=>{this.trace("session closed"),this.handleDisconnect()}),A.once("goaway",(z,w,_)=>{let $=!1;if(z===sw6.constants.NGHTTP2_ENHANCE_YOUR_CALM&&_&&_.equals(XdY))$=!0;this.trace("connection closed by GOAWAY with code "+z+" and data "+(_===null||_===void 0?void 0:_.toString())),this.reportDisconnectToOwner($)}),A.once("error",(z)=>{this.trace("connection closed with error "+z.message),this.handleDisconnect()}),A.socket.once("close",(z)=>{this.trace("connection closed. hadError="+z),this.handleDisconnect()}),SN6.isTracerEnabled(vm8))A.on("remoteSettings",(z)=>{this.trace("new settings received"+(this.session!==A?" on the old connection":"")+": "+JSON.stringify(z))}),A.on("localSettings",(z)=>{this.trace("local settings acknowledged by remote"+(this.session!==A?" on the old connection":"")+": "+JSON.stringify(z))});if(this.keepaliveWithoutCalls)this.maybeStartKeepalivePingTimer();if(A.socket instanceof epY.TLSSocket)this.authContext={transportSecurityType:"ssl",sslPeerCertificate:A.socket.getPeerCertificate()};else this.authContext={}}getChannelzInfo(){var A,q,K;let Y=this.session.socket,z=Y.remoteAddress?(0,Uk1.stringToSubchannelAddress)(Y.remoteAddress,Y.remotePort):null,w=Y.localAddress?(0,Uk1.stringToSubchannelAddress)(Y.localAddress,Y.localPort):null,_;if(this.session.encrypted){let O=Y,H=O.getCipher(),j=O.getCertificate(),J=O.getPeerCertificate();_={cipherSuiteStandardName:(A=H.standardName)!==null&&A!==void 0?A:null,cipherSuiteOtherName:H.standardName?null:H.name,localCertificate:j&&"raw"in j?j.raw:null,remoteCertificate:J&&"raw"in J?J.raw:null}}else _=null;return{remoteAddress:z,localAddress:w,security:_,remoteName:this.remoteName,streamsStarted:this.streamTracker.callsStarted,streamsSucceeded:this.streamTracker.callsSucceeded,streamsFailed:this.streamTracker.callsFailed,messagesSent:this.messagesSent,messagesReceived:this.messagesReceived,keepAlivesSent:this.keepalivesSent,lastLocalStreamCreatedTimestamp:this.streamTracker.lastCallStartedTimestamp,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:this.lastMessageSentTimestamp,lastMessageReceivedTimestamp:this.lastMessageReceivedTimestamp,localFlowControlWindow:(q=this.session.state.localWindowSize)!==null&&q!==void 0?q:null,remoteFlowControlWindow:(K=this.session.state.remoteWindowSize)!==null&&K!==void 0?K:null}}trace(A){SN6.trace(Cn6.LogVerbosity.DEBUG,vm8,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+A)}keepaliveTrace(A){SN6.trace(Cn6.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+A)}flowControlTrace(A){SN6.trace(Cn6.LogVerbosity.DEBUG,wdY,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+A)}internalsTrace(A){SN6.trace(Cn6.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+A)}reportDisconnectToOwner(A){if(this.disconnectHandled)return;this.disconnectHandled=!0,this.disconnectListeners.forEach((q)=>q(A))}handleDisconnect(){this.clearKeepaliveTimeout(),this.reportDisconnectToOwner(!1);for(let A of this.activeCalls)A.onDisconnect();setImmediate(()=>{this.session.destroy()})}addDisconnectListener(A){this.disconnectListeners.push(A)}canSendPing(){return!this.session.destroyed&&this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var A,q;if(!this.canSendPing()){this.pendingSendKeepalivePing=!0;return}if(this.keepaliveTimer){console.error("keepaliveTimeout is not null");return}if(this.channelzEnabled)this.keepalivesSent+=1;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),(q=(A=this.keepaliveTimer).unref)===null||q===void 0||q.call(A);let K="";try{if(!this.session.ping((z,w,_)=>{if(this.clearKeepaliveTimeout(),z)this.keepaliveTrace("Ping failed with error "+z.message),this.handleDisconnect();else this.keepaliveTrace("Received ping response"),this.maybeStartKeepalivePingTimer()}))K="Ping returned false"}catch(Y){K=(Y instanceof Error?Y.message:"")||"Unknown error"}if(K)this.keepaliveTrace("Ping send failed: "+K),this.handleDisconnect()}maybeStartKeepalivePingTimer(){var A,q;if(!this.canSendPing())return;if(this.pendingSendKeepalivePing)this.pendingSendKeepalivePing=!1,this.maybeSendPing();else if(!this.keepaliveTimer)this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.maybeSendPing()},this.keepaliveTimeMs),(q=(A=this.keepaliveTimer).unref)===null||q===void 0||q.call(A)}clearKeepaliveTimeout(){if(this.keepaliveTimer)clearTimeout(this.keepaliveTimer),this.keepaliveTimer=null}removeActiveCall(A){if(this.activeCalls.delete(A),this.activeCalls.size===0)this.session.unref()}addActiveCall(A){if(this.activeCalls.add(A),this.activeCalls.size===1){if(this.session.ref(),!this.keepaliveWithoutCalls)this.maybeStartKeepalivePingTimer()}}createCall(A,q,K,Y,z){let w=A.toHttp2Headers();w[$dY]=q,w[MdY]=this.userAgent,w[OdY]="application/grpc",w[HdY]="POST",w[jdY]=K,w[JdY]="trailers";let _;try{_=this.session.request(w)}catch(H){throw this.handleDisconnect(),H}this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize),this.internalsTrace("session.closed="+this.session.closed+" session.destroyed="+this.session.destroyed+" session.socket.destroyed="+this.session.socket.destroyed);let $,O;if(this.channelzEnabled)this.streamTracker.addCallStarted(),$={addMessageSent:()=>{var H;this.messagesSent+=1,this.lastMessageSentTimestamp=new Date,(H=z.addMessageSent)===null||H===void 0||H.call(z)},addMessageReceived:()=>{var H;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,(H=z.addMessageReceived)===null||H===void 0||H.call(z)},onCallEnd:(H)=>{var j;(j=z.onCallEnd)===null||j===void 0||j.call(z,H),this.removeActiveCall(O)},onStreamEnd:(H)=>{var j;if(H)this.streamTracker.addCallSucceeded();else this.streamTracker.addCallFailed();(j=z.onStreamEnd)===null||j===void 0||j.call(z,H)}};else $={addMessageSent:()=>{var H;(H=z.addMessageSent)===null||H===void 0||H.call(z)},addMessageReceived:()=>{var H;(H=z.addMessageReceived)===null||H===void 0||H.call(z)},onCallEnd:(H)=>{var j;(j=z.onCallEnd)===null||j===void 0||j.call(z,H),this.removeActiveCall(O)},onStreamEnd:(H)=>{var j;(j=z.onStreamEnd)===null||j===void 0||j.call(z,H)}};return O=new YdY.Http2SubchannelCall(_,$,Y,this,(0,zdY.getNextCallNumber)()),this.addActiveCall(O),O}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}getAuthContext(){return this.authContext}shutdown(){this.session.close(),(0,Qk1.unregisterChannelzRef)(this.channelzRef)}}class io4{constructor(A){this.channelTarget=A,this.session=null,this.isShutdown=!1}trace(A){SN6.trace(Cn6.LogVerbosity.DEBUG,vm8,(0,Nm8.uriToString)(this.channelTarget)+" "+A)}createSession(A,q,K){if(this.isShutdown)return Promise.reject();if(A.socket.closed)return Promise.reject("Connection closed before starting HTTP/2 handshake");return new Promise((Y,z)=>{var w,_,$,O,H,j,J;let M=null,D=this.channelTarget;if("grpc.http_connect_target"in K){let R=(0,Nm8.parseUri)(K["grpc.http_connect_target"]);if(R)D=R,M=(0,Nm8.uriToString)(R)}let X=A.secure?"https":"http",P=(0,qdY.getDefaultAuthority)(D),W=()=>{var R;(R=this.session)===null||R===void 0||R.destroy(),this.session=null,setImmediate(()=>{if(!y)y=!0,z(`${v.trim()} (${new Date().toISOString()})`)})},Z=(R)=>{var h;if((h=this.session)===null||h===void 0||h.destroy(),v=R.message,this.trace("connection failed with error "+v),!y)y=!0,z(`${v} (${new Date().toISOString()})`)},G={createConnection:(R,h)=>{return A.socket},settings:{initialWindowSize:(O=(w=K["grpc-node.flow_control_window"])!==null&&w!==void 0?w:($=(_=sw6.getDefaultSettings)===null||_===void 0?void 0:_.call(sw6))===null||$===void 0?void 0:$.initialWindowSize)!==null&&O!==void 0?O:65535}},f=sw6.connect(`${X}://${P}`,G),V=(J=(j=(H=sw6.getDefaultSettings)===null||H===void 0?void 0:H.call(sw6))===null||j===void 0?void 0:j.initialWindowSize)!==null&&J!==void 0?J:65535,N=K["grpc-node.flow_control_window"];this.session=f;let v="Failed to connect",y=!1;f.unref(),f.once("remoteSettings",()=>{var R;if(N&&N>V)try{f.setLocalWindowSize(N)}catch(h){let B=N-((R=f.state.localWindowSize)!==null&&R!==void 0?R:V);if(B>0)f.incrementWindowSize(B)}f.removeAllListeners(),A.socket.removeListener("close",W),A.socket.removeListener("error",Z),Y(new lo4(f,q,K,M)),this.session=null}),f.once("close",W),f.once("error",Z),A.socket.once("close",W),A.socket.once("error",Z)})}tcpConnect(A,q){return(0,AdY.getProxiedConnection)(A,q).then((K)=>{if(K)return K;else return new Promise((Y,z)=>{let w=()=>{z(Error("Socket closed"))},_=(O)=>{z(O)},$=KdY.connect(A,()=>{$.removeListener("close",w),$.removeListener("error",_),Y($)});$.once("close",w),$.once("error",_)})})}async connect(A,q,K){if(this.isShutdown)return Promise.reject();let Y=null,z=null,w=(0,Uk1.subchannelAddressToString)(A);try{return this.trace(w+" Waiting for secureConnector to be ready"),await q.waitForReady(),this.trace(w+" secureConnector is ready"),Y=await this.tcpConnect(A,K),Y.setNoDelay(),this.trace(w+" Established TCP connection"),z=await q.connect(Y),this.trace(w+" Established secure connection"),this.createSession(z,A,K)}catch(_){throw Y===null||Y===void 0||Y.destroy(),z===null||z===void 0||z.socket.destroy(),_}}shutdown(){var A;this.isShutdown=!0,(A=this.session)===null||A===void 0||A.close(),this.session=null}}no4.Http2SubchannelConnector=io4});var to4=C((ao4)=>{Object.defineProperty(ao4,"__esModule",{value:!0});ao4.SubchannelPool=void 0;ao4.getSubchannelPool=NdY;var PdY=tl4(),WdY=ko4(),ZdY=Gv(),GdY=pT(),fdY=oo4(),TdY=1e4;class pk1{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let A=!0;for(let q in this.pool){let Y=this.pool[q].filter((z)=>!z.subchannel.unrefIfOneRef());if(Y.length>0)A=!1;this.pool[q]=Y}if(A&&this.cleanupTimer!==null)clearInterval(this.cleanupTimer),this.cleanupTimer=null}ensureCleanupTask(){var A,q;if(this.cleanupTimer===null)this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},TdY),(q=(A=this.cleanupTimer).unref)===null||q===void 0||q.call(A)}getOrCreateSubchannel(A,q,K,Y){this.ensureCleanupTask();let z=(0,GdY.uriToString)(A);if(z in this.pool){let _=this.pool[z];for(let $ of _)if((0,ZdY.subchannelAddressEqual)(q,$.subchannelAddress)&&(0,PdY.channelOptionsEqual)(K,$.channelArguments)&&Y._equals($.channelCredentials))return $.subchannel}let w=new WdY.Subchannel(A,q,K,Y,new fdY.Http2SubchannelConnector(A));if(!(z in this.pool))this.pool[z]=[];return this.pool[z].push({subchannelAddress:q,channelArguments:K,channelCredentials:Y,subchannel:w}),w.ref(),w}}ao4.SubchannelPool=pk1;var VdY=new pk1;function NdY(A){if(A)return VdY;else return new pk1}});var za4=C((Ka4)=>{Object.defineProperty(Ka4,"__esModule",{value:!0});Ka4.LoadBalancingCall=void 0;var eo4=dT(),dk1=E9(),Aa4=EN6(),ck1=hP(),hn6=Dn(),kdY=pT(),EdY=m_(),km8=En6(),LdY=g6("http2"),ydY="load_balancing_call";class qa4{constructor(A,q,K,Y,z,w,_){var $,O;this.channel=A,this.callConfig=q,this.methodName=K,this.host=Y,this.credentials=z,this.deadline=w,this.callNumber=_,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.metadata=null,this.listener=null,this.onCallEnded=null,this.childStartTime=null;let H=this.methodName.split("/"),j="";if(H.length>=2)j=H[1];let J=(O=($=(0,kdY.splitHostPort)(this.host))===null||$===void 0?void 0:$.host)!==null&&O!==void 0?O:"localhost";this.serviceUrl=`https://${J}/${j}`,this.startTime=new Date}getDeadlineInfo(){var A,q;let K=[];if(this.childStartTime){if(this.childStartTime>this.startTime){if((A=this.metadata)===null||A===void 0?void 0:A.getOptions().waitForReady)K.push("wait_for_ready");K.push(`LB pick: ${(0,Aa4.formatDateDifference)(this.startTime,this.childStartTime)}`)}return K.push(...this.child.getDeadlineInfo()),K}else{if((q=this.metadata)===null||q===void 0?void 0:q.getOptions().waitForReady)K.push("wait_for_ready");K.push("Waiting for LB pick")}return K}trace(A){EdY.trace(dk1.LogVerbosity.DEBUG,ydY,"["+this.callNumber+"] "+A)}outputStatus(A,q){var K,Y;if(!this.ended){this.ended=!0,this.trace("ended with status: code="+A.code+' details="'+A.details+'" start time='+this.startTime.toISOString());let z=Object.assign(Object.assign({},A),{progress:q});(K=this.listener)===null||K===void 0||K.onReceiveStatus(z),(Y=this.onCallEnded)===null||Y===void 0||Y.call(this,z.code,z.details,z.metadata)}}doPick(){var A,q;if(this.ended)return;if(!this.metadata)throw Error("doPick called before start");this.trace("Pick called");let K=this.metadata.clone(),Y=this.channel.doPick(K,this.callConfig.pickInformation),z=Y.subchannel?"("+Y.subchannel.getChannelzRef().id+") "+Y.subchannel.getAddress():""+Y.subchannel;switch(this.trace("Pick result: "+hn6.PickResultType[Y.pickResultType]+" subchannel: "+z+" status: "+((A=Y.status)===null||A===void 0?void 0:A.code)+" "+((q=Y.status)===null||q===void 0?void 0:q.details)),Y.pickResultType){case hn6.PickResultType.COMPLETE:this.credentials.compose(Y.subchannel.getCallCredentials()).generateMetadata({method_name:this.methodName,service_url:this.serviceUrl}).then((O)=>{var H;if(this.ended){this.trace("Credentials metadata generation finished after call ended");return}if(K.merge(O),K.get("authorization").length>1)this.outputStatus({code:dk1.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new ck1.Metadata},"PROCESSED");if(Y.subchannel.getConnectivityState()!==eo4.ConnectivityState.READY){this.trace("Picked subchannel "+z+" has state "+eo4.ConnectivityState[Y.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),this.doPick();return}if(this.deadline!==1/0)K.set("grpc-timeout",(0,Aa4.getDeadlineTimeoutString)(this.deadline));try{this.child=Y.subchannel.getRealSubchannel().createCall(K,this.host,this.methodName,{onReceiveMetadata:(j)=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(j)},onReceiveMessage:(j)=>{this.trace("Received message"),this.listener.onReceiveMessage(j)},onReceiveStatus:(j)=>{if(this.trace("Received status"),j.rstCode===LdY.constants.NGHTTP2_REFUSED_STREAM)this.outputStatus(j,"REFUSED");else this.outputStatus(j,"PROCESSED")}}),this.childStartTime=new Date}catch(j){this.trace("Failed to start call on picked subchannel "+z+" with error "+j.message),this.outputStatus({code:dk1.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+j.message,metadata:new ck1.Metadata},"NOT_STARTED");return}if((H=Y.onCallStarted)===null||H===void 0||H.call(Y),this.onCallEnded=Y.onCallEnded,this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending)this.child.startRead();if(this.pendingMessage)this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message);if(this.pendingHalfClose)this.child.halfClose()},(O)=>{let{code:H,details:j}=(0,km8.restrictControlPlaneStatusCode)(typeof O.code==="number"?O.code:dk1.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${O.message}`);this.outputStatus({code:H,details:j,metadata:new ck1.Metadata},"PROCESSED")});break;case hn6.PickResultType.DROP:let{code:_,details:$}=(0,km8.restrictControlPlaneStatusCode)(Y.status.code,Y.status.details);setImmediate(()=>{this.outputStatus({code:_,details:$,metadata:Y.status.metadata},"DROP")});break;case hn6.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{let{code:O,details:H}=(0,km8.restrictControlPlaneStatusCode)(Y.status.code,Y.status.details);setImmediate(()=>{this.outputStatus({code:O,details:H,metadata:Y.status.metadata},"PROCESSED")})}break;case hn6.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(A,q){var K;this.trace("cancelWithStatus code: "+A+' details: "'+q+'"'),(K=this.child)===null||K===void 0||K.cancelWithStatus(A,q),this.outputStatus({code:A,details:q,metadata:new ck1.Metadata},"PROCESSED")}getPeer(){var A,q;return(q=(A=this.child)===null||A===void 0?void 0:A.getPeer())!==null&&q!==void 0?q:this.channel.getTarget()}start(A,q){this.trace("start called"),this.listener=q,this.metadata=A,this.doPick()}sendMessageWithContext(A,q){if(this.trace("write() called with message of length "+q.length),this.child)this.child.sendMessageWithContext(A,q);else this.pendingMessage={context:A,message:q}}startRead(){if(this.trace("startRead called"),this.child)this.child.startRead();else this.readPending=!0}halfClose(){if(this.trace("halfClose called"),this.child)this.child.halfClose();else this.pendingHalfClose=!0}setCredentials(A){throw Error("Method not implemented.")}getCallNumber(){return this.callNumber}getAuthContext(){if(this.child)return this.child.getAuthContext();else return null}}Ka4.LoadBalancingCall=qa4});var Ha4=C(($a4)=>{Object.defineProperty($a4,"__esModule",{value:!0});$a4.ResolvingCall=void 0;var RdY=nv1(),tw6=E9(),ew6=EN6(),wa4=hP(),SdY=m_(),CdY=En6(),hdY="resolving_call";class _a4{constructor(A,q,K,Y,z){if(this.channel=A,this.method=q,this.filterStackFactory=Y,this.callNumber=z,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.readFilterPending=!1,this.writeFilterPending=!1,this.pendingChildStatus=null,this.metadata=null,this.listener=null,this.statusWatchers=[],this.deadlineTimer=setTimeout(()=>{},0),this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=RdY.CallCredentials.createEmpty(),this.deadline=K.deadline,this.host=K.host,K.parentCall){if(K.flags&tw6.Propagate.CANCELLATION)K.parentCall.on("cancelled",()=>{this.cancelWithStatus(tw6.Status.CANCELLED,"Cancelled by parent call")});if(K.flags&tw6.Propagate.DEADLINE)this.trace("Propagating deadline from parent: "+K.parentCall.getDeadline()),this.deadline=(0,ew6.minDeadline)(this.deadline,K.parentCall.getDeadline())}this.trace("Created"),this.runDeadlineTimer()}trace(A){SdY.trace(tw6.LogVerbosity.DEBUG,hdY,"["+this.callNumber+"] "+A)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.trace("Deadline: "+(0,ew6.deadlineToString)(this.deadline));let A=(0,ew6.getRelativeTimeout)(this.deadline);if(A!==1/0){this.trace("Deadline will be reached in "+A+"ms");let q=()=>{if(!this.deadlineStartTime){this.cancelWithStatus(tw6.Status.DEADLINE_EXCEEDED,"Deadline exceeded");return}let K=[],Y=new Date;if(K.push(`Deadline exceeded after ${(0,ew6.formatDateDifference)(this.deadlineStartTime,Y)}`),this.configReceivedTime){if(this.configReceivedTime>this.deadlineStartTime)K.push(`name resolution: ${(0,ew6.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`);if(this.childStartTime){if(this.childStartTime>this.configReceivedTime)K.push(`metadata filters: ${(0,ew6.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`)}else K.push("waiting for metadata filters")}else K.push("waiting for name resolution");if(this.child)K.push(...this.child.getDeadlineInfo());this.cancelWithStatus(tw6.Status.DEADLINE_EXCEEDED,K.join(","))};if(A<=0)process.nextTick(q);else this.deadlineTimer=setTimeout(q,A)}}outputStatus(A){if(!this.ended){if(this.ended=!0,!this.filterStack)this.filterStack=this.filterStackFactory.createFilter();clearTimeout(this.deadlineTimer);let q=this.filterStack.receiveTrailers(A);this.trace("ended with status: code="+q.code+' details="'+q.details+'"'),this.statusWatchers.forEach((K)=>K(q)),process.nextTick(()=>{var K;(K=this.listener)===null||K===void 0||K.onReceiveStatus(q)})}}sendMessageOnChild(A,q){if(!this.child)throw Error("sendMessageonChild called with child not populated");let K=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message:q,flags:A.flags})).then((Y)=>{if(this.writeFilterPending=!1,K.sendMessageWithContext(A,Y.message),this.pendingHalfClose)K.halfClose()},(Y)=>{this.cancelWithStatus(Y.code,Y.details)})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw Error("getConfig called before start");let A=this.channel.getConfig(this.method,this.metadata);if(A.type==="NONE"){this.channel.queueCallForConfig(this);return}else if(A.type==="ERROR"){if(this.metadata.getOptions().waitForReady)this.channel.queueCallForConfig(this);else this.outputStatus(A.error);return}this.configReceivedTime=new Date;let q=A.config;if(q.status!==tw6.Status.OK){let{code:K,details:Y}=(0,CdY.restrictControlPlaneStatusCode)(q.status,"Failed to route call to method "+this.method);this.outputStatus({code:K,details:Y,metadata:new wa4.Metadata});return}if(q.methodConfig.timeout){let K=new Date;K.setSeconds(K.getSeconds()+q.methodConfig.timeout.seconds),K.setMilliseconds(K.getMilliseconds()+q.methodConfig.timeout.nanos/1e6),this.deadline=(0,ew6.minDeadline)(this.deadline,K),this.runDeadlineTimer()}this.filterStackFactory.push(q.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then((K)=>{if(this.child=this.channel.createRetryingCall(q,this.method,this.host,this.credentials,this.deadline),this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=new Date,this.child.start(K,{onReceiveMetadata:(Y)=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(Y))},onReceiveMessage:(Y)=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(Y).then((z)=>{if(this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(z),this.pendingChildStatus)this.outputStatus(this.pendingChildStatus)},(z)=>{this.cancelWithStatus(z.code,z.details)})},onReceiveStatus:(Y)=>{if(this.trace("Received status"),this.readFilterPending)this.pendingChildStatus=Y;else this.outputStatus(Y)}}),this.readPending)this.child.startRead();if(this.pendingMessage)this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message);else if(this.pendingHalfClose)this.child.halfClose()},(K)=>{this.outputStatus(K)})}reportResolverError(A){var q;if((q=this.metadata)===null||q===void 0?void 0:q.getOptions().waitForReady)this.channel.queueCallForConfig(this);else this.outputStatus(A)}cancelWithStatus(A,q){var K;this.trace("cancelWithStatus code: "+A+' details: "'+q+'"'),(K=this.child)===null||K===void 0||K.cancelWithStatus(A,q),this.outputStatus({code:A,details:q,metadata:new wa4.Metadata})}getPeer(){var A,q;return(q=(A=this.child)===null||A===void 0?void 0:A.getPeer())!==null&&q!==void 0?q:this.channel.getTarget()}start(A,q){this.trace("start called"),this.metadata=A.clone(),this.listener=q,this.getConfig()}sendMessageWithContext(A,q){if(this.trace("write() called with message of length "+q.length),this.child)this.sendMessageOnChild(A,q);else this.pendingMessage={context:A,message:q}}startRead(){if(this.trace("startRead called"),this.child)this.child.startRead();else this.readPending=!0}halfClose(){if(this.trace("halfClose called"),this.child&&!this.writeFilterPending)this.child.halfClose();else this.pendingHalfClose=!0}setCredentials(A){this.credentials=A}addStatusWatcher(A){this.statusWatchers.push(A)}getCallNumber(){return this.callNumber}getAuthContext(){if(this.child)return this.child.getAuthContext();else return null}}$a4.ResolvingCall=_a4});var Pa4=C((Da4)=>{Object.defineProperty(Da4,"__esModule",{value:!0});Da4.RetryingCall=Da4.MessageBufferTracker=Da4.RetryThrottler=void 0;var lk1=E9(),IdY=EN6(),bdY=hP(),xdY=m_(),udY="retrying_call";class ja4{constructor(A,q,K){if(this.maxTokens=A,this.tokenRatio=q,K)this.tokens=K.tokens*(A/K.maxTokens);else this.tokens=A}addCallSucceeded(){this.tokens=Math.min(this.tokens+this.tokenRatio,this.maxTokens)}addCallFailed(){this.tokens=Math.max(this.tokens-1,0)}canRetryCall(){return this.tokens>this.maxTokens/2}}Da4.RetryThrottler=ja4;class Ja4{constructor(A,q){this.totalLimit=A,this.limitPerCall=q,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(A,q){var K;let Y=(K=this.allocatedPerCall.get(q))!==null&&K!==void 0?K:0;if(this.limitPerCall-Y total allocated ${this.totalAllocated}`);this.totalAllocated-=A;let Y=(K=this.allocatedPerCall.get(q))!==null&&K!==void 0?K:0;if(Y allocated for call ${Y}`);this.allocatedPerCall.set(q,Y-A)}freeAll(A){var q;let K=(q=this.allocatedPerCall.get(A))!==null&&q!==void 0?q:0;if(this.totalAllocated total allocated ${this.totalAllocated}`);this.totalAllocated-=K,this.allocatedPerCall.delete(A)}}Da4.MessageBufferTracker=Ja4;var Em8="grpc-previous-rpc-attempts",BdY=5;class Ma4{constructor(A,q,K,Y,z,w,_,$,O){var H;this.channel=A,this.callConfig=q,this.methodName=K,this.host=Y,this.credentials=z,this.deadline=w,this.callNumber=_,this.bufferTracker=$,this.retryThrottler=O,this.listener=null,this.initialMetadata=null,this.underlyingCalls=[],this.writeBuffer=[],this.writeBufferOffset=0,this.readStarted=!1,this.transparentRetryUsed=!1,this.attempts=0,this.hedgingTimer=null,this.committedCallIndex=null,this.initialRetryBackoffSec=0,this.nextRetryBackoffSec=0;let j=(H=A.getOptions()["grpc-node.retry_max_attempts_limit"])!==null&&H!==void 0?H:BdY;if(A.getOptions()["grpc.enable_retries"]===0)this.state="NO_RETRY",this.maxAttempts=1;else if(q.methodConfig.retryPolicy){this.state="RETRY";let J=q.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(J.initialBackoff.substring(0,J.initialBackoff.length-1)),this.maxAttempts=Math.min(J.maxAttempts,j)}else if(q.methodConfig.hedgingPolicy)this.state="HEDGING",this.maxAttempts=Math.min(q.methodConfig.hedgingPolicy.maxAttempts,j);else this.state="TRANSPARENT_ONLY",this.maxAttempts=1;this.startTime=new Date}getDeadlineInfo(){if(this.underlyingCalls.length===0)return[];let A=[],q=this.underlyingCalls[this.underlyingCalls.length-1];if(this.underlyingCalls.length>1)A.push(`previous attempts: ${this.underlyingCalls.length-1}`);if(q.startTime>this.startTime)A.push(`time to current attempt start: ${(0,IdY.formatDateDifference)(this.startTime,q.startTime)}`);return A.push(...q.call.getDeadlineInfo()),A}getCallNumber(){return this.callNumber}trace(A){xdY.trace(lk1.LogVerbosity.DEBUG,udY,"["+this.callNumber+"] "+A)}reportStatus(A){this.trace("ended with status: code="+A.code+' details="'+A.details+'" start time='+this.startTime.toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var q;(q=this.listener)===null||q===void 0||q.onReceiveStatus({code:A.code,details:A.details,metadata:A.metadata})})}cancelWithStatus(A,q){this.trace("cancelWithStatus code: "+A+' details: "'+q+'"'),this.reportStatus({code:A,details:q,metadata:new bdY.Metadata});for(let{call:K}of this.underlyingCalls)K.cancelWithStatus(A,q)}getPeer(){if(this.committedCallIndex!==null)return this.underlyingCalls[this.committedCallIndex].call.getPeer();else return"unknown"}getBufferEntry(A){var q;return(q=this.writeBuffer[A-this.writeBufferOffset])!==null&&q!==void 0?q:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if(this.state!=="COMMITTED")return;let A;if(this.underlyingCalls[this.committedCallIndex].state==="COMPLETED")A=this.getNextBufferIndex();else A=this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let q=this.writeBufferOffset;qA)A=Y.nextMessageToSend,q=K;if(q===-1)this.state="TRANSPARENT_ONLY";else this.commitCall(q)}isStatusCodeInList(A,q){return A.some((K)=>{var Y;return K===q||K.toString().toLowerCase()===((Y=lk1.Status[q])===null||Y===void 0?void 0:Y.toLowerCase())})}getNextRetryJitter(){return Math.random()*0.3999999999999999+0.8}getNextRetryBackoffMs(){var A;let q=(A=this.callConfig)===null||A===void 0?void 0:A.methodConfig.retryPolicy;if(!q)return 0;let Y=this.getNextRetryJitter()*this.nextRetryBackoffSec*1000,z=Number(q.maxBackoff.substring(0,q.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*q.backoffMultiplier,z),Y}maybeRetryCall(A,q){if(this.state!=="RETRY"){q(!1);return}if(this.attempts>=this.maxAttempts){q(!1);return}let K;if(A===null)K=this.getNextRetryBackoffMs();else if(A<0){this.state="TRANSPARENT_ONLY",q(!1);return}else K=A,this.nextRetryBackoffSec=this.initialRetryBackoffSec;setTimeout(()=>{var Y,z;if(this.state!=="RETRY"){q(!1);return}if((z=(Y=this.retryThrottler)===null||Y===void 0?void 0:Y.canRetryCall())!==null&&z!==void 0?z:!0)q(!0),this.attempts+=1,this.startNewAttempt();else this.trace("Retry attempt denied by throttling policy"),q(!1)},K)}countActiveCalls(){let A=0;for(let q of this.underlyingCalls)if((q===null||q===void 0?void 0:q.state)==="ACTIVE")A+=1;return A}handleProcessedStatus(A,q,K){var Y,z,w;switch(this.state){case"COMMITTED":case"NO_RETRY":case"TRANSPARENT_ONLY":this.commitCall(q),this.reportStatus(A);break;case"HEDGING":if(this.isStatusCodeInList((Y=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)!==null&&Y!==void 0?Y:[],A.code)){(z=this.retryThrottler)===null||z===void 0||z.addCallFailed();let _;if(K===null)_=0;else if(K<0){this.state="TRANSPARENT_ONLY",this.commitCall(q),this.reportStatus(A);return}else _=K;setTimeout(()=>{if(this.maybeStartHedgingAttempt(),this.countActiveCalls()===0)this.commitCall(q),this.reportStatus(A)},_)}else this.commitCall(q),this.reportStatus(A);break;case"RETRY":if(this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,A.code))(w=this.retryThrottler)===null||w===void 0||w.addCallFailed(),this.maybeRetryCall(K,(_)=>{if(!_)this.commitCall(q),this.reportStatus(A)});else this.commitCall(q),this.reportStatus(A);break}}getPushback(A){let q=A.get("grpc-retry-pushback-ms");if(q.length===0)return null;try{return parseInt(q[0])}catch(K){return-1}}handleChildStatus(A,q){var K;if(this.underlyingCalls[q].state==="COMPLETED")return;if(this.trace("state="+this.state+" handling status with progress "+A.progress+" from child ["+this.underlyingCalls[q].call.getCallNumber()+"] in state "+this.underlyingCalls[q].state),this.underlyingCalls[q].state="COMPLETED",A.code===lk1.Status.OK){(K=this.retryThrottler)===null||K===void 0||K.addCallSucceeded(),this.commitCall(q),this.reportStatus(A);return}if(this.state==="NO_RETRY"){this.commitCall(q),this.reportStatus(A);return}if(this.state==="COMMITTED"){this.reportStatus(A);return}let Y=this.getPushback(A.metadata);switch(A.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":if(this.transparentRetryUsed)this.handleProcessedStatus(A,q,Y);else this.transparentRetryUsed=!0,this.startNewAttempt();break;case"DROP":this.commitCall(q),this.reportStatus(A);break;case"PROCESSED":this.handleProcessedStatus(A,q,Y);break}}maybeStartHedgingAttempt(){if(this.state!=="HEDGING")return;if(!this.callConfig.methodConfig.hedgingPolicy)return;if(this.attempts>=this.maxAttempts)return;this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}maybeStartHedgingTimer(){var A,q,K;if(this.hedgingTimer)clearTimeout(this.hedgingTimer);if(this.state!=="HEDGING")return;if(!this.callConfig.methodConfig.hedgingPolicy)return;let Y=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=this.maxAttempts)return;let z=(A=Y.hedgingDelay)!==null&&A!==void 0?A:"0s",w=Number(z.substring(0,z.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},w*1000),(K=(q=this.hedgingTimer).unref)===null||K===void 0||K.call(q)}startNewAttempt(){let A=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline);this.trace("Created child call ["+A.getCallNumber()+"] for attempt "+this.attempts);let q=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:A,nextMessageToSend:0,startTime:new Date});let K=this.attempts-1,Y=this.initialMetadata.clone();if(K>0)Y.set(Em8,`${K}`);let z=!1;if(A.start(Y,{onReceiveMetadata:(w)=>{if(this.trace("Received metadata from child ["+A.getCallNumber()+"]"),this.commitCall(q),z=!0,K>0)w.set(Em8,`${K}`);if(this.underlyingCalls[q].state==="ACTIVE")this.listener.onReceiveMetadata(w)},onReceiveMessage:(w)=>{if(this.trace("Received message from child ["+A.getCallNumber()+"]"),this.commitCall(q),this.underlyingCalls[q].state==="ACTIVE")this.listener.onReceiveMessage(w)},onReceiveStatus:(w)=>{if(this.trace("Received status from child ["+A.getCallNumber()+"]"),!z&&K>0)w.metadata.set(Em8,`${K}`);this.handleChildStatus(w,q)}}),this.sendNextChildMessage(q),this.readStarted)A.startRead()}start(A,q){this.trace("start called"),this.listener=q,this.initialMetadata=A,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(A){var q,K;let Y=this.underlyingCalls[A],z=Y.nextMessageToSend;(K=(q=this.getBufferEntry(z)).callback)===null||K===void 0||K.call(q),this.clearSentMessages(),Y.nextMessageToSend+=1,this.sendNextChildMessage(A)}sendNextChildMessage(A){let q=this.underlyingCalls[A];if(q.state==="COMPLETED")return;if(this.getBufferEntry(q.nextMessageToSend)){let K=this.getBufferEntry(q.nextMessageToSend);switch(K.entryType){case"MESSAGE":q.call.sendMessageWithContext({callback:(Y)=>{this.handleChildWriteCompleted(A)}},K.message.message);break;case"HALF_CLOSE":q.nextMessageToSend+=1,q.call.halfClose();break;case"FREED":break}}}sendMessageWithContext(A,q){var K;this.trace("write() called with message of length "+q.length);let Y={message:q,flags:A.flags},z=this.getNextBufferIndex(),w={entryType:"MESSAGE",message:Y,allocated:this.bufferTracker.allocate(q.length,this.callNumber)};if(this.writeBuffer.push(w),w.allocated){(K=A.callback)===null||K===void 0||K.call(A);for(let[_,$]of this.underlyingCalls.entries())if($.state==="ACTIVE"&&$.nextMessageToSend===z)$.call.sendMessageWithContext({callback:(O)=>{this.handleChildWriteCompleted(_)}},q)}else{if(this.commitCallWithMostMessages(),this.committedCallIndex===null)return;let _=this.underlyingCalls[this.committedCallIndex];if(w.callback=A.callback,_.state==="ACTIVE"&&_.nextMessageToSend===z)_.call.sendMessageWithContext({callback:($)=>{this.handleChildWriteCompleted(this.committedCallIndex)}},q)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(let A of this.underlyingCalls)if((A===null||A===void 0?void 0:A.state)==="ACTIVE")A.call.startRead()}halfClose(){this.trace("halfClose called");let A=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(let q of this.underlyingCalls)if((q===null||q===void 0?void 0:q.state)==="ACTIVE"&&q.nextMessageToSend===A)q.nextMessageToSend+=1,q.call.halfClose()}setCredentials(A){throw Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}getAuthContext(){if(this.committedCallIndex!==null)return this.underlyingCalls[this.committedCallIndex].call.getAuthContext();else return null}}Da4.RetryingCall=Ma4});var In6=C((Za4)=>{Object.defineProperty(Za4,"__esModule",{value:!0});Za4.BaseSubchannelWrapper=void 0;class Wa4{constructor(A){this.child=A,this.healthy=!0,this.healthListeners=new Set,this.refcount=0,this.dataWatchers=new Set,A.addHealthStateWatcher((q)=>{if(this.healthy)this.updateHealthListeners()})}updateHealthListeners(){for(let A of this.healthListeners)A(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(A){this.child.addConnectivityStateListener(A)}removeConnectivityStateListener(A){this.child.removeConnectivityStateListener(A)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(A){this.child.throttleKeepalive(A)}ref(){this.child.ref(),this.refcount+=1}unref(){if(this.child.unref(),this.refcount-=1,this.refcount===0)this.destroy()}destroy(){for(let A of this.dataWatchers)A.destroy()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(A){this.healthListeners.add(A)}removeHealthStateWatcher(A){this.healthListeners.delete(A)}addDataWatcher(A){A.setSubchannel(this.getRealSubchannel()),this.dataWatchers.add(A)}setHealthy(A){if(A!==this.healthy){if(this.healthy=A,this.child.isHealthy())this.updateHealthListeners()}}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(A){return this.getRealSubchannel()===A.getRealSubchannel()}getCallCredentials(){return this.child.getCallCredentials()}getChannel(){return this.child.getChannel()}}Za4.BaseSubchannelWrapper=Wa4});var Sm8=C((ka4)=>{Object.defineProperty(ka4,"__esModule",{value:!0});ka4.InternalChannel=ka4.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;var FdY=jN6(),QdY=ol4(),UdY=to4(),Rm8=Dn(),pdY=hP(),x86=E9(),ddY=Bk1(),cdY=jm8(),fa4=zu(),ik1=m_(),ldY=fm8(),nk1=pT(),SC=dT(),bn6=I86(),idY=za4(),ndY=EN6(),rdY=Ha4(),Lm8=xk1(),odY=En6(),ym8=Pa4(),adY=In6(),sdY=2147483647,tdY=1000,edY=1800000,rk1=new Map,AcY=16777216,qcY=1048576;class Ta4 extends adY.BaseSubchannelWrapper{constructor(A,q){super(A);this.channel=q,this.refCount=0,this.subchannelStateListener=(K,Y,z,w)=>{q.throttleKeepalive(w)}}ref(){if(this.refCount===0)this.child.addConnectivityStateListener(this.subchannelStateListener),this.channel.addWrappedSubchannel(this);this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0)this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this)}}class Va4{pick(A){return{pickResultType:Rm8.PickResultType.DROP,status:{code:x86.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new pdY.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}}ka4.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";class Na4{constructor(A){this.target=A,this.trace=new bn6.ChannelzTrace,this.callTracker=new bn6.ChannelzCallTracker,this.childrenTracker=new bn6.ChannelzChildrenTracker,this.state=SC.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>{return{target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}}}}class va4{constructor(A,q,K){var Y,z,w,_,$,O;if(this.credentials=q,this.options=K,this.connectivityState=SC.ConnectivityState.IDLE,this.currentPicker=new Rm8.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.callRefTimer=null,this.configSelector=null,this.currentResolutionError=null,this.wrappedSubchannels=new Set,this.callCount=0,this.idleTimer=null,this.channelzEnabled=!0,this.randomChannelId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),typeof A!=="string")throw TypeError("Channel target must be a string");if(!(q instanceof FdY.ChannelCredentials))throw TypeError("Channel credentials must be a ChannelCredentials object");if(K){if(typeof K!=="object")throw TypeError("Channel options must be an object")}this.channelzInfoTracker=new Na4(A);let H=(0,nk1.parseUri)(A);if(H===null)throw Error(`Could not parse target name "${A}"`);let j=(0,fa4.mapUriDefaultScheme)(H);if(j===null)throw Error(`Could not find a default scheme for target name "${A}"`);if(this.options["grpc.enable_channelz"]===0)this.channelzEnabled=!1;if(this.channelzRef=(0,bn6.registerChannelzChannel)(A,this.channelzInfoTracker.getChannelzInfoCallback(),this.channelzEnabled),this.channelzEnabled)this.channelzInfoTracker.trace.addTrace("CT_INFO","Channel created");if(this.options["grpc.default_authority"])this.defaultAuthority=this.options["grpc.default_authority"];else this.defaultAuthority=(0,fa4.getDefaultAuthority)(j);let J=(0,ldY.mapProxyName)(j,K);this.target=J.target,this.options=Object.assign({},this.options,J.extraOptions),this.subchannelPool=(0,UdY.getSubchannelPool)(((Y=this.options["grpc.use_local_subchannel_pool"])!==null&&Y!==void 0?Y:0)===0),this.retryBufferTracker=new ym8.MessageBufferTracker((z=this.options["grpc.retry_buffer_size"])!==null&&z!==void 0?z:AcY,(w=this.options["grpc.per_rpc_retry_buffer_size"])!==null&&w!==void 0?w:qcY),this.keepaliveTime=(_=this.options["grpc.keepalive_time_ms"])!==null&&_!==void 0?_:-1,this.idleTimeoutMs=Math.max(($=this.options["grpc.client_idle_timeout_ms"])!==null&&$!==void 0?$:edY,tdY);let M={createSubchannel:(X,P)=>{let W={};for(let[f,V]of Object.entries(P))if(!f.startsWith(ka4.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX))W[f]=V;let Z=this.subchannelPool.getOrCreateSubchannel(this.target,X,W,this.credentials);if(Z.throttleKeepalive(this.keepaliveTime),this.channelzEnabled)this.channelzInfoTracker.trace.addTrace("CT_INFO","Created subchannel or used existing subchannel",Z.getChannelzRef());return new Ta4(Z,this)},updateState:(X,P)=>{this.currentPicker=P;let W=this.pickQueue.slice();if(this.pickQueue=[],W.length>0)this.callRefTimerUnref();for(let Z of W)Z.doPick();this.updateState(X)},requestReresolution:()=>{throw Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:(X)=>{if(this.channelzEnabled)this.channelzInfoTracker.childrenTracker.refChild(X)},removeChannelzChild:(X)=>{if(this.channelzEnabled)this.channelzInfoTracker.childrenTracker.unrefChild(X)}};this.resolvingLoadBalancer=new QdY.ResolvingLoadBalancer(this.target,M,this.options,(X,P)=>{var W;if(X.retryThrottling)rk1.set(this.getTarget(),new ym8.RetryThrottler(X.retryThrottling.maxTokens,X.retryThrottling.tokenRatio,rk1.get(this.getTarget())));else rk1.delete(this.getTarget());if(this.channelzEnabled)this.channelzInfoTracker.trace.addTrace("CT_INFO","Address resolution succeeded");(W=this.configSelector)===null||W===void 0||W.unref(),this.configSelector=P,this.currentResolutionError=null,process.nextTick(()=>{let Z=this.configSelectionQueue;if(this.configSelectionQueue=[],Z.length>0)this.callRefTimerUnref();for(let G of Z)G.getConfig()})},(X)=>{if(this.channelzEnabled)this.channelzInfoTracker.trace.addTrace("CT_WARNING","Address resolution failed with code "+X.code+' and details "'+X.details+'"');if(this.configSelectionQueue.length>0)this.trace("Name resolution failed with calls queued for config selection");if(this.configSelector===null)this.currentResolutionError=Object.assign(Object.assign({},(0,odY.restrictControlPlaneStatusCode)(X.code,X.details)),{metadata:X.metadata});let P=this.configSelectionQueue;if(this.configSelectionQueue=[],P.length>0)this.callRefTimerUnref();for(let W of P)W.reportResolverError(X)}),this.filterStackFactory=new ddY.FilterStackFactory([new cdY.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(K,void 0,2));let D=Error();if((0,ik1.isTracerEnabled)("channel_stacktrace"))(0,ik1.trace)(x86.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+`) Channel constructed `+((O=D.stack)===null||O===void 0?void 0:O.substring(D.stack.indexOf(` `)+1)));this.lastActivityTimestamp=new Date}trace(A,q){(0,ik1.trace)(q!==null&&q!==void 0?q:x86.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,nk1.uriToString)(this.target)+" "+A)}callRefTimerRef(){var A,q,K,Y;if(!this.callRefTimer)this.callRefTimer=setInterval(()=>{},sdY);if(!((q=(A=this.callRefTimer).hasRef)===null||q===void 0?void 0:q.call(A)))this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(Y=(K=this.callRefTimer).ref)===null||Y===void 0||Y.call(K)}callRefTimerUnref(){var A,q,K;if(!((A=this.callRefTimer)===null||A===void 0?void 0:A.hasRef)||this.callRefTimer.hasRef())this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(K=(q=this.callRefTimer)===null||q===void 0?void 0:q.unref)===null||K===void 0||K.call(q)}removeConnectivityStateWatcher(A){let q=this.connectivityStateWatchers.findIndex((K)=>K===A);if(q>=0)this.connectivityStateWatchers.splice(q,1)}updateState(A){if((0,ik1.trace)(x86.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,nk1.uriToString)(this.target)+" "+SC.ConnectivityState[this.connectivityState]+" -> "+SC.ConnectivityState[A]),this.channelzEnabled)this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+SC.ConnectivityState[A]);this.connectivityState=A,this.channelzInfoTracker.state=A;let q=this.connectivityStateWatchers.slice();for(let K of q)if(A!==K.currentState){if(K.timer)clearTimeout(K.timer);this.removeConnectivityStateWatcher(K),K.callback()}if(A!==SC.ConnectivityState.TRANSIENT_FAILURE)this.currentResolutionError=null}throttleKeepalive(A){if(A>this.keepaliveTime){this.keepaliveTime=A;for(let q of this.wrappedSubchannels)q.throttleKeepalive(A)}}addWrappedSubchannel(A){this.wrappedSubchannels.add(A)}removeWrappedSubchannel(A){this.wrappedSubchannels.delete(A)}doPick(A,q){return this.currentPicker.pick({metadata:A,extraPickInfo:q})}queueCallForPick(A){this.pickQueue.push(A),this.callRefTimerRef()}getConfig(A,q){if(this.connectivityState!==SC.ConnectivityState.SHUTDOWN)this.resolvingLoadBalancer.exitIdle();if(this.configSelector)return{type:"SUCCESS",config:this.configSelector.invoke(A,q,this.randomChannelId)};else if(this.currentResolutionError)return{type:"ERROR",error:this.currentResolutionError};else return{type:"NONE"}}queueCallForConfig(A){this.configSelectionQueue.push(A),this.callRefTimerRef()}enterIdle(){if(this.resolvingLoadBalancer.destroy(),this.updateState(SC.ConnectivityState.IDLE),this.currentPicker=new Rm8.QueuePicker(this.resolvingLoadBalancer),this.idleTimer)clearTimeout(this.idleTimer),this.idleTimer=null;if(this.callRefTimer)clearInterval(this.callRefTimer),this.callRefTimer=null}startIdleTimeout(A){var q,K;this.idleTimer=setTimeout(()=>{if(this.callCount>0){this.startIdleTimeout(this.idleTimeoutMs);return}let z=new Date().valueOf()-this.lastActivityTimestamp.valueOf();if(z>=this.idleTimeoutMs)this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle();else this.startIdleTimeout(this.idleTimeoutMs-z)},A),(K=(q=this.idleTimer).unref)===null||K===void 0||K.call(q)}maybeStartIdleTimer(){if(this.connectivityState!==SC.ConnectivityState.SHUTDOWN&&!this.idleTimer)this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){if(this.channelzEnabled)this.channelzInfoTracker.callTracker.addCallStarted();this.callCount+=1}onCallEnd(A){if(this.channelzEnabled)if(A.code===x86.Status.OK)this.channelzInfoTracker.callTracker.addCallSucceeded();else this.channelzInfoTracker.callTracker.addCallFailed();this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(A,q,K,Y,z){let w=(0,Lm8.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+w+'] method="'+q+'"'),new idY.LoadBalancingCall(this,A,q,K,Y,z,w)}createRetryingCall(A,q,K,Y,z){let w=(0,Lm8.getNextCallNumber)();return this.trace("createRetryingCall ["+w+'] method="'+q+'"'),new ym8.RetryingCall(this,A,q,K,Y,z,w,this.retryBufferTracker,rk1.get(this.getTarget()))}createResolvingCall(A,q,K,Y,z){let w=(0,Lm8.getNextCallNumber)();this.trace("createResolvingCall ["+w+'] method="'+A+'", deadline='+(0,ndY.deadlineToString)(q));let _={deadline:q,flags:z!==null&&z!==void 0?z:x86.Propagate.DEFAULTS,host:K!==null&&K!==void 0?K:this.defaultAuthority,parentCall:Y},$=new rdY.ResolvingCall(this,A,_,this.filterStackFactory.clone(),w);return this.onCallStart(),$.addStatusWatcher((O)=>{this.onCallEnd(O)}),$}close(){var A;this.resolvingLoadBalancer.destroy(),this.updateState(SC.ConnectivityState.SHUTDOWN),this.currentPicker=new Va4;for(let q of this.configSelectionQueue)q.cancelWithStatus(x86.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(let q of this.pickQueue)q.cancelWithStatus(x86.Status.UNAVAILABLE,"Channel closed before call started");if(this.pickQueue=[],this.callRefTimer)clearInterval(this.callRefTimer);if(this.idleTimer)clearTimeout(this.idleTimer);if(this.channelzEnabled)(0,bn6.unregisterChannelzRef)(this.channelzRef);this.subchannelPool.unrefUnusedSubchannels(),(A=this.configSelector)===null||A===void 0||A.unref(),this.configSelector=null}getTarget(){return(0,nk1.uriToString)(this.target)}getConnectivityState(A){let q=this.connectivityState;if(A)this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer();return q}watchConnectivityState(A,q,K){if(this.connectivityState===SC.ConnectivityState.SHUTDOWN)throw Error("Channel has been shut down");let Y=null;if(q!==1/0){let w=q instanceof Date?q:new Date(q),_=new Date;if(q===-1/0||w<=_){process.nextTick(K,Error("Deadline passed without connectivity state change"));return}Y=setTimeout(()=>{this.removeConnectivityStateWatcher(z),K(Error("Deadline passed without connectivity state change"))},w.getTime()-_.getTime())}let z={currentState:A,callback:K,timer:Y};this.connectivityStateWatchers.push(z)}getChannelzRef(){return this.channelzRef}createCall(A,q,K,Y,z){if(typeof A!=="string")throw TypeError("Channel#createCall: method must be a string");if(!(typeof q==="number"||q instanceof Date))throw TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===SC.ConnectivityState.SHUTDOWN)throw Error("Channel has been shut down");return this.createResolvingCall(A,q,K,Y,z)}getOptions(){return this.options}}ka4.InternalChannel=va4});var HB8=C((Ra4)=>{Object.defineProperty(Ra4,"__esModule",{value:!0});Ra4.ChannelImplementation=void 0;var KcY=jN6(),YcY=Sm8();class ya4{constructor(A,q,K){if(typeof A!=="string")throw TypeError("Channel target must be a string");if(!(q instanceof KcY.ChannelCredentials))throw TypeError("Channel credentials must be a ChannelCredentials object");if(K){if(typeof K!=="object")throw TypeError("Channel options must be an object")}this.internalChannel=new YcY.InternalChannel(A,q,K)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(A){return this.internalChannel.getConnectivityState(A)}watchConnectivityState(A,q,K){this.internalChannel.watchConnectivityState(A,q,K)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(A,q,K,Y,z){if(typeof A!=="string")throw TypeError("Channel#createCall: method must be a string");if(!(typeof q==="number"||q instanceof Date))throw TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(A,q,K,Y,z)}}Ra4.ChannelImplementation=ya4});var ma4=C((ua4)=>{Object.defineProperty(ua4,"__esModule",{value:!0});ua4.ServerDuplexStreamImpl=ua4.ServerWritableStreamImpl=ua4.ServerReadableStreamImpl=ua4.ServerUnaryCallImpl=void 0;ua4.serverErrorToStatus=Im8;var zcY=g6("events"),Cm8=g6("stream"),hm8=E9(),Ca4=hP();function Im8(A,q){var K;let Y={code:hm8.Status.UNKNOWN,details:"message"in A?A.message:"Unknown Error",metadata:(K=q!==null&&q!==void 0?q:A.metadata)!==null&&K!==void 0?K:null};if("code"in A&&typeof A.code==="number"&&Number.isInteger(A.code)){if(Y.code=A.code,"details"in A&&typeof A.details==="string")Y.details=A.details}return Y}class ha4 extends zcY.EventEmitter{constructor(A,q,K,Y){super();this.path=A,this.call=q,this.metadata=K,this.request=Y,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(A){this.call.sendMetadata(A)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}ua4.ServerUnaryCallImpl=ha4;class Ia4 extends Cm8.Readable{constructor(A,q,K){super({objectMode:!0});this.path=A,this.call=q,this.metadata=K,this.cancelled=!1}_read(A){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(A){this.call.sendMetadata(A)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}ua4.ServerReadableStreamImpl=Ia4;class ba4 extends Cm8.Writable{constructor(A,q,K,Y){super({objectMode:!0});this.path=A,this.call=q,this.metadata=K,this.request=Y,this.pendingStatus={code:hm8.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new Ca4.Metadata,this.on("error",(z)=>{this.pendingStatus=Im8(z),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(A){this.call.sendMetadata(A)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(A,q,K){this.call.sendMessage(A,K)}_final(A){var q;A(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(q=this.pendingStatus.metadata)!==null&&q!==void 0?q:this.trailingMetadata}))}end(A){if(A)this.trailingMetadata=A;return super.end()}}ua4.ServerWritableStreamImpl=ba4;class xa4 extends Cm8.Duplex{constructor(A,q,K){super({objectMode:!0});this.path=A,this.call=q,this.metadata=K,this.pendingStatus={code:hm8.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new Ca4.Metadata,this.on("error",(Y)=>{this.pendingStatus=Im8(Y),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(A){this.call.sendMetadata(A)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(A){this.call.startRead()}_write(A,q,K){this.call.sendMessage(A,K)}_final(A){var q;A(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(q=this.pendingStatus.metadata)!==null&&q!==void 0?q:this.trailingMetadata}))}end(A){if(A)this.trailingMetadata=A;return super.end()}}ua4.ServerDuplexStreamImpl=xa4});var ok1=C((ga4)=>{Object.defineProperty(ga4,"__esModule",{value:!0});ga4.ServerCredentials=void 0;ga4.createCertificateProviderServerCredentials=HcY;ga4.createServerCredentialsWithInterceptors=jcY;var bm8=ru8();class CN6{constructor(A,q){this.serverConstructorOptions=A,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=q!==null&&q!==void 0?q:null}_addWatcher(A){this.watchers.add(A)}_removeWatcher(A){this.watchers.delete(A)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(A){this.latestContextOptions=A;for(let q of this.watchers)q(this.latestContextOptions)}_isSecure(){return this.serverConstructorOptions!==null}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new xm8}static createSsl(A,q,K=!1){var Y;if(A!==null&&!Buffer.isBuffer(A))throw TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(q))throw TypeError("keyCertPairs must be an array");if(typeof K!=="boolean")throw TypeError("checkClientCertificate must be a boolean");let z=[],w=[];for(let _=0;_{Object.defineProperty(Qa4,"__esModule",{value:!0});Qa4.durationMessageToDuration=DcY;Qa4.msToDuration=XcY;Qa4.durationToMs=PcY;Qa4.isDuration=WcY;Qa4.isDurationMessage=ZcY;Qa4.parseDuration=fcY;Qa4.durationToString=TcY;function DcY(A){return{seconds:Number.parseInt(A.seconds),nanos:A.nanos}}function XcY(A){return{seconds:A/1000|0,nanos:A%1000*1e6|0}}function PcY(A){return A.seconds*1000+A.nanos/1e6|0}function WcY(A){return typeof A.seconds==="number"&&typeof A.nanos==="number"}function ZcY(A){return typeof A.seconds==="string"&&typeof A.nanos==="number"}var GcY=/^(\d+)(?:\.(\d+))?s$/;function fcY(A){let q=A.match(GcY);if(!q)return null;return{seconds:Number.parseInt(q[1],10),nanos:q[2]?Number.parseInt(q[2].padEnd(9,"0"),10):0}}function TcY(A){if(A.nanos===0)return`${A.seconds}s`;let q;if(A.nanos%1e6===0)q=1e6;else if(A.nanos%1000===0)q=1000;else q=1;return`${A.seconds}.${A.nanos/q}s`}});var sk1=C((sa4)=>{var __dirname="/home/runner/code/tmp/claude-cli-external-build-2207/node_modules/@grpc/grpc-js/build/src";Object.defineProperty(sa4,"__esModule",{value:!0});sa4.OrcaOobMetricsSubchannelWrapper=sa4.GRPC_METRICS_HEADER=sa4.ServerMetricRecorder=sa4.PerRequestMetricRecorder=void 0;sa4.createOrcaClient=ia4;sa4.createMetricsReader=xcY;var RcY=wk1(),gm8=xn6(),ScY=jN6(),CcY=In6(),Ua4=E9(),hcY=JN6(),IcY=dT(),pa4=null;function ak1(){if(pa4)return pa4;let A=qm8().loadSync,q=A("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,RcY.loadPackageDefinition)(q)}class ca4{constructor(){this.message={}}recordRequestCostMetric(A,q){if(!this.message.request_cost)this.message.request_cost={};this.message.request_cost[A]=q}recordUtilizationMetric(A,q){if(!this.message.utilization)this.message.utilization={};this.message.utilization[A]=q}recordNamedMetric(A,q){if(!this.message.named_metrics)this.message.named_metrics={};this.message.named_metrics[A]=q}recordCPUUtilizationMetric(A){this.message.cpu_utilization=A}recordMemoryUtilizationMetric(A){this.message.mem_utilization=A}recordApplicationUtilizationMetric(A){this.message.application_utilization=A}recordQpsMetric(A){this.message.rps_fractional=A}recordEpsMetric(A){this.message.eps=A}serialize(){return ak1().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}}sa4.PerRequestMetricRecorder=ca4;var bcY=30000;class la4{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:(A)=>{let q=A.request.report_interval?(0,gm8.durationToMs)((0,gm8.durationMessageToDuration)(A.request.report_interval)):bcY,K=setInterval(()=>{A.write(this.message)},q);A.on("cancelled",()=>{clearInterval(K)})}}}putUtilizationMetric(A,q){if(!this.message.utilization)this.message.utilization={};this.message.utilization[A]=q}setAllUtilizationMetrics(A){this.message.utilization=Object.assign({},A)}deleteUtilizationMetric(A){var q;(q=this.message.utilization)===null||q===void 0||delete q[A]}setCpuUtilizationMetric(A){this.message.cpu_utilization=A}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(A){this.message.application_utilization=A}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(A){this.message.rps_fractional=A}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(A){this.message.eps=A}deleteEpsMetric(){delete this.message.eps}addToServer(A){let q=ak1().xds.service.orca.v3.OpenRcaService.service;A.addService(q,this.serviceImplementation)}}sa4.ServerMetricRecorder=la4;function ia4(A){return new(ak1()).xds.service.orca.v3.OpenRcaService("unused",ScY.ChannelCredentials.createInsecure(),{channelOverride:A})}sa4.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";var da4="grpc_orca_load_report";function xcY(A,q){return(K,Y,z)=>{let w=z.getOpaque(da4);if(w)A(w);else{let _=z.get(sa4.GRPC_METRICS_HEADER);if(_.length>0)w=ak1().xds.data.orca.v3.OrcaLoadReport.deserialize(_[0]),A(w),z.setOpaque(da4,w)}if(q)q(K,Y,z)}}var na4="orca_oob_metrics";class ra4{constructor(A,q){this.metricsListener=A,this.intervalMs=q,this.dataProducer=null}setSubchannel(A){let q=A.getOrCreateDataProducer(na4,ucY);this.dataProducer=q,q.addDataWatcher(this)}destroy(){var A;(A=this.dataProducer)===null||A===void 0||A.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(A){this.metricsListener(A)}}class oa4{constructor(A){this.subchannel=A,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new hcY.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();let q=A.getChannel();this.client=ia4(q),A.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(A){this.dataWatchers.add(A),this.updateMetricsSubscription()}removeDataWatcher(A){var q;if(this.dataWatchers.delete(A),this.dataWatchers.size===0)this.subchannel.removeDataProducer(na4),(q=this.metricsCall)===null||q===void 0||q.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener);else this.updateMetricsSubscription()}updateMetricsSubscription(){var A;if(this.dataWatchers.size===0||!this.orcaSupported||this.subchannel.getConnectivityState()!==IcY.ConnectivityState.READY)return;let q=Math.min(...Array.from(this.dataWatchers).map((K)=>K.getInterval()));if(!this.metricsCall||q!==this.currentInterval){(A=this.metricsCall)===null||A===void 0||A.cancel(),this.currentInterval=q;let K=this.client.streamCoreMetrics({report_interval:(0,gm8.msToDuration)(q)});this.metricsCall=K,K.on("data",(Y)=>{this.dataWatchers.forEach((z)=>{z.onMetricsUpdate(Y)})}),K.on("error",(Y)=>{if(this.metricsCall=null,Y.code===Ua4.Status.UNIMPLEMENTED){this.orcaSupported=!1;return}if(Y.code===Ua4.Status.CANCELLED)return;this.backoffTimer.runOnce()})}}}class aa4 extends CcY.BaseSubchannelWrapper{constructor(A,q,K){super(A);this.addDataWatcher(new ra4(q,K))}getWrappedSubchannel(){return this.child}}sa4.OrcaOobMetricsSubchannelWrapper=aa4;function ucY(A){return new oa4(A)}});var pm8=C((Ds4)=>{Object.defineProperty(Ds4,"__esModule",{value:!0});Ds4.BaseServerInterceptingCall=Ds4.ServerInterceptingCall=Ds4.ResponderBuilder=Ds4.ServerListenerBuilder=void 0;Ds4.isInterceptingServerListener=pcY;Ds4.getServerInterceptingCall=ncY;var AE1=hP(),fv=E9(),hN6=g6("http2"),As4=dv1(),qs4=g6("zlib"),QcY=Tm8(),_s4=m_(),UcY=g6("tls"),Ks4=sk1(),$s4="server_call";function A26(A){_s4.trace(fv.LogVerbosity.DEBUG,$s4,A)}class Os4{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(A){return this.metadata=A,this}withOnReceiveMessage(A){return this.message=A,this}withOnReceiveHalfClose(A){return this.halfClose=A,this}withOnCancel(A){return this.cancel=A,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}}Ds4.ServerListenerBuilder=Os4;function pcY(A){return A.onReceiveMetadata!==void 0&&A.onReceiveMetadata.length===1}class Hs4{constructor(A,q){this.listener=A,this.nextListener=q,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){if(this.hasPendingMessage)this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1}processPendingHalfClose(){if(this.hasPendingHalfClose)this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1}onReceiveMetadata(A){if(this.cancelled)return;this.processingMetadata=!0,this.listener.onReceiveMetadata(A,(q)=>{if(this.processingMetadata=!1,this.cancelled)return;this.nextListener.onReceiveMetadata(q),this.processPendingMessage(),this.processPendingHalfClose()})}onReceiveMessage(A){if(this.cancelled)return;this.processingMessage=!0,this.listener.onReceiveMessage(A,(q)=>{if(this.processingMessage=!1,this.cancelled)return;if(this.processingMetadata)this.pendingMessage=q,this.hasPendingMessage=!0;else this.nextListener.onReceiveMessage(q),this.processPendingHalfClose()})}onReceiveHalfClose(){if(this.cancelled)return;this.listener.onReceiveHalfClose(()=>{if(this.cancelled)return;if(this.processingMetadata||this.processingMessage)this.hasPendingHalfClose=!0;else this.nextListener.onReceiveHalfClose()})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}}class js4{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(A){return this.start=A,this}withSendMetadata(A){return this.metadata=A,this}withSendMessage(A){return this.message=A,this}withSendStatus(A){return this.status=A,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}}Ds4.ResponderBuilder=js4;var tk1={onReceiveMetadata:(A,q)=>{q(A)},onReceiveMessage:(A,q)=>{q(A)},onReceiveHalfClose:(A)=>{A()},onCancel:()=>{}},ek1={start:(A)=>{A()},sendMetadata:(A,q)=>{q(A)},sendMessage:(A,q)=>{q(A)},sendStatus:(A,q)=>{q(A)}};class Js4{constructor(A,q){var K,Y,z,w;this.nextCall=A,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:(K=q===null||q===void 0?void 0:q.start)!==null&&K!==void 0?K:ek1.start,sendMetadata:(Y=q===null||q===void 0?void 0:q.sendMetadata)!==null&&Y!==void 0?Y:ek1.sendMetadata,sendMessage:(z=q===null||q===void 0?void 0:q.sendMessage)!==null&&z!==void 0?z:ek1.sendMessage,sendStatus:(w=q===null||q===void 0?void 0:q.sendStatus)!==null&&w!==void 0?w:ek1.sendStatus}}processPendingMessage(){if(this.pendingMessageCallback)this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null}processPendingStatus(){if(this.pendingStatus)this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null}start(A){this.responder.start((q)=>{var K,Y,z,w;let _={onReceiveMetadata:(K=q===null||q===void 0?void 0:q.onReceiveMetadata)!==null&&K!==void 0?K:tk1.onReceiveMetadata,onReceiveMessage:(Y=q===null||q===void 0?void 0:q.onReceiveMessage)!==null&&Y!==void 0?Y:tk1.onReceiveMessage,onReceiveHalfClose:(z=q===null||q===void 0?void 0:q.onReceiveHalfClose)!==null&&z!==void 0?z:tk1.onReceiveHalfClose,onCancel:(w=q===null||q===void 0?void 0:q.onCancel)!==null&&w!==void 0?w:tk1.onCancel},$=new Hs4(_,A);this.nextCall.start($)})}sendMetadata(A){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(A,(q)=>{this.processingMetadata=!1,this.nextCall.sendMetadata(q),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(A,q){if(this.processingMessage=!0,!this.sentMetadata)this.sendMetadata(new AE1.Metadata);this.responder.sendMessage(A,(K)=>{if(this.processingMessage=!1,this.processingMetadata)this.pendingMessage=K,this.pendingMessageCallback=q;else this.nextCall.sendMessage(K,q)})}sendStatus(A){this.responder.sendStatus(A,(q)=>{if(this.processingMetadata||this.processingMessage)this.pendingStatus=q;else this.nextCall.sendStatus(q)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}}Ds4.ServerInterceptingCall=Js4;var Ms4="grpc-accept-encoding",Qm8="grpc-encoding",Ys4="grpc-message",zs4="grpc-status",Fm8="grpc-timeout",dcY=/(\d{1,8})\s*([HMSmun])/,ccY={H:3600000,M:60000,S:1000,m:1,u:0.001,n:0.000001},lcY={[Ms4]:"identity,deflate,gzip",[Qm8]:"identity"},ws4={[hN6.constants.HTTP2_HEADER_STATUS]:hN6.constants.HTTP_STATUS_OK,[hN6.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},icY={waitForTrailers:!0};class Um8{constructor(A,q,K,Y,z){var w,_;if(this.stream=A,this.callEventTracker=K,this.handler=Y,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=fv.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=fv.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new Ks4.PerRequestMetricRecorder,this.stream.once("error",(J)=>{}),this.stream.once("close",()=>{var J;if(A26("Request to method "+((J=this.handler)===null||J===void 0?void 0:J.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded)this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:fv.Status.CANCELLED,details:"Stream closed before sending status",metadata:null});this.notifyOnCancel()}),this.stream.on("data",(J)=>{this.handleDataFrame(J)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in z)this.maxSendMessageSize=z["grpc.max_send_message_length"];if("grpc.max_receive_message_length"in z)this.maxReceiveMessageSize=z["grpc.max_receive_message_length"];this.host=(w=q[":authority"])!==null&&w!==void 0?w:q.host,this.decoder=new QcY.StreamDecoder(this.maxReceiveMessageSize);let $=AE1.Metadata.fromHttp2Headers(q);if(_s4.isTracerEnabled($s4))A26("Request to "+this.handler.path+" received headers "+JSON.stringify($.toJSON()));let O=$.get(Fm8);if(O.length>0)this.handleTimeoutHeader(O[0]);let H=$.get(Qm8);if(H.length>0)this.incomingEncoding=H[0];$.remove(Fm8),$.remove(Qm8),$.remove(Ms4),$.remove(hN6.constants.HTTP2_HEADER_ACCEPT_ENCODING),$.remove(hN6.constants.HTTP2_HEADER_TE),$.remove(hN6.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=$;let j=(_=A.session)===null||_===void 0?void 0:_.socket;this.connectionInfo={localAddress:j===null||j===void 0?void 0:j.localAddress,localPort:j===null||j===void 0?void 0:j.localPort,remoteAddress:j===null||j===void 0?void 0:j.remoteAddress,remotePort:j===null||j===void 0?void 0:j.remotePort},this.shouldSendMetrics=!!z["grpc.server_call_metric_recording"]}handleTimeoutHeader(A){let q=A.toString().match(dcY);if(q===null){let z={code:fv.Status.INTERNAL,details:`Invalid ${Fm8} value "${A}"`,metadata:null};process.nextTick(()=>{this.sendStatus(z)});return}let K=+q[1]*ccY[q[2]]|0,Y=new Date;this.deadline=Y.setMilliseconds(Y.getMilliseconds()+K),this.deadlineTimer=setTimeout(()=>{let z={code:fv.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(z)},K)}checkCancelled(){if(!this.cancelled&&(this.stream.destroyed||this.stream.closed))this.notifyOnCancel(),this.cancelled=!0;return this.cancelled}notifyOnCancel(){if(this.cancelNotified)return;if(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var A;(A=this.listener)===null||A===void 0||A.onCancel()}),this.deadlineTimer)clearTimeout(this.deadlineTimer);this.stream.resume()}maybeSendMetadata(){if(!this.metadataSent)this.sendMetadata(new AE1.Metadata)}serializeMessage(A){let q=this.handler.serialize(A),K=q.byteLength,Y=Buffer.allocUnsafe(K+5);return Y.writeUInt8(0,0),Y.writeUInt32BE(K,1),q.copy(Y,5),Y}decompressMessage(A,q){let K=A.subarray(5);if(q==="identity")return K;else if(q==="deflate"||q==="gzip"){let Y;if(q==="deflate")Y=qs4.createInflate();else Y=qs4.createGunzip();return new Promise((z,w)=>{let _=0,$=[];Y.on("data",(O)=>{if($.push(O),_+=O.byteLength,this.maxReceiveMessageSize!==-1&&_>this.maxReceiveMessageSize)Y.destroy(),w({code:fv.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`})}),Y.on("end",()=>{z(Buffer.concat($))}),Y.write(K),Y.end()})}else return Promise.reject({code:fv.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${q}"`})}async decompressAndMaybePush(A){if(A.type!=="COMPRESSED")throw Error(`Invalid queue entry type: ${A.type}`);let K=A.compressedMessage.readUInt8(0)===1?this.incomingEncoding:"identity",Y;try{Y=await this.decompressMessage(A.compressedMessage,K)}catch(z){this.sendStatus(z);return}try{A.parsedMessage=this.handler.deserialize(Y)}catch(z){this.sendStatus({code:fv.Status.INTERNAL,details:`Error deserializing request: ${z.message}`});return}A.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&this.readQueue[0].type!=="COMPRESSED"){this.isReadPending=!1;let A=this.readQueue.shift();if(A.type==="READABLE")this.listener.onReceiveMessage(A.parsedMessage);else this.listener.onReceiveHalfClose()}}handleDataFrame(A){var q;if(this.checkCancelled())return;A26("Request to "+this.handler.path+" received data frame of size "+A.length);let K;try{K=this.decoder.write(A)}catch(Y){this.sendStatus({code:fv.Status.RESOURCE_EXHAUSTED,details:Y.message});return}for(let Y of K){this.stream.pause();let z={type:"COMPRESSED",compressedMessage:Y,parsedMessage:null};this.readQueue.push(z),this.decompressAndMaybePush(z),(q=this.callEventTracker)===null||q===void 0||q.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(A){if(A26("Request to "+this.handler.path+" start called"),this.checkCancelled())return;this.listener=A,A.onReceiveMetadata(this.metadata)}sendMetadata(A){if(this.checkCancelled())return;if(this.metadataSent)return;this.metadataSent=!0;let q=A?A.toHttp2Headers():null,K=Object.assign(Object.assign(Object.assign({},ws4),lcY),q);this.stream.respond(K,icY)}sendMessage(A,q){if(this.checkCancelled())return;let K;try{K=this.serializeMessage(A)}catch(Y){this.sendStatus({code:fv.Status.INTERNAL,details:`Error serializing response: ${(0,As4.getErrorMessage)(Y)}`,metadata:null});return}if(this.maxSendMessageSize!==-1&&K.length-5>this.maxSendMessageSize){this.sendStatus({code:fv.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${K.length} vs. ${this.maxSendMessageSize})`,metadata:null});return}this.maybeSendMetadata(),A26("Request to "+this.handler.path+" sent data frame of size "+K.length),this.stream.write(K,(Y)=>{var z;if(Y){this.sendStatus({code:fv.Status.INTERNAL,details:`Error writing message: ${(0,As4.getErrorMessage)(Y)}`,metadata:null});return}(z=this.callEventTracker)===null||z===void 0||z.addMessageSent(),q()})}sendStatus(A){var q,K,Y;if(this.checkCancelled())return;A26("Request to method "+((q=this.handler)===null||q===void 0?void 0:q.path)+" ended with status code: "+fv.Status[A.code]+" details: "+A.details);let z=(Y=(K=A.metadata)===null||K===void 0?void 0:K.clone())!==null&&Y!==void 0?Y:new AE1.Metadata;if(this.shouldSendMetrics)z.set(Ks4.GRPC_METRICS_HEADER,this.metricsRecorder.serialize());if(this.metadataSent)if(!this.wantTrailers)this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{if(this.callEventTracker&&!this.streamEnded)this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(A);let w=Object.assign({[zs4]:A.code,[Ys4]:encodeURI(A.details)},z.toHttp2Headers());this.stream.sendTrailers(w),this.notifyOnCancel()}),this.stream.end();else this.notifyOnCancel();else{if(this.callEventTracker&&!this.streamEnded)this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(A);let w=Object.assign(Object.assign({[zs4]:A.code,[Ys4]:encodeURI(A.details)},ws4),z.toHttp2Headers());this.stream.respond(w,{endStream:!0}),this.notifyOnCancel()}}startRead(){if(A26("Request to "+this.handler.path+" startRead called"),this.checkCancelled())return;if(this.isReadPending=!0,this.readQueue.length===0){if(!this.receivedHalfClose)this.stream.resume()}else this.maybePushNextMessage()}getPeer(){var A;let q=(A=this.stream.session)===null||A===void 0?void 0:A.socket;if(q===null||q===void 0?void 0:q.remoteAddress)if(q.remotePort)return`${q.remoteAddress}:${q.remotePort}`;else return q.remoteAddress;else return"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var A;if(((A=this.stream.session)===null||A===void 0?void 0:A.socket)instanceof UcY.TLSSocket){let q=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:q.raw?q:void 0}}else return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}}Ds4.BaseServerInterceptingCall=Um8;function ncY(A,q,K,Y,z,w){let _={path:z.path,requestStream:z.type==="clientStream"||z.type==="bidi",responseStream:z.type==="serverStream"||z.type==="bidi",requestDeserialize:z.deserialize,responseSerialize:z.serialize},$=new Um8(q,K,Y,z,w);return A.reduce((O,H)=>{return H(_,O)},$)}});var Vs4=C((B86)=>{var ecY=B86&&B86.__runInitializers||function(A,q,K){var Y=arguments.length>2;for(var z=0;z=0;D--){var X={};for(var P in Y)X[P]=P==="access"?{}:Y[P];for(var P in Y.access)X.access[P]=Y.access[P];X.addInitializer=function(Z){if(M)throw TypeError("Cannot add initializers after decoration has completed");w.push(_(Z||null))};var W=(0,K[D])($==="accessor"?{get:j.get,set:j.set}:j[O],X);if($==="accessor"){if(W===void 0)continue;if(W===null||typeof W!=="object")throw TypeError("Object expected");if(J=_(W.get))j.get=J;if(J=_(W.set))j.set=J;if(J=_(W.init))z.unshift(J)}else if(J=_(W))if($==="field")z.unshift(J);else j[O]=J}if(H)Object.defineProperty(H,Y.name,j);M=!0};Object.defineProperty(B86,"__esModule",{value:!0});B86.Server=void 0;var Tv=g6("http2"),qlY=g6("util"),rJ=E9(),xN6=ma4(),dm8=ok1(),Ps4=zu(),bN6=m_(),u86=Gv(),ju=pT(),$X=I86(),Ws4=pm8(),IN6=2147483647,cm8=2147483647,KlY=20000,Zs4=2147483647,{HTTP2_HEADER_PATH:Gs4}=Tv.constants,YlY="server",fs4=Buffer.from("max_age");function Ts4(A){bN6.trace(rJ.LogVerbosity.DEBUG,"server_call",A)}function zlY(){}function wlY(A){return function(q,K){return qlY.deprecate(q,A)}}function lm8(A){return{code:rJ.Status.UNIMPLEMENTED,details:`The server does not implement the method ${A}`}}function _lY(A,q){let K=lm8(q);switch(A){case"unary":return(Y,z)=>{z(K,null)};case"clientStream":return(Y,z)=>{z(K,null)};case"serverStream":return(Y)=>{Y.emit("error",K)};case"bidi":return(Y)=>{Y.emit("error",K)};default:throw Error(`Invalid handlerType ${A}`)}}var $lY=(()=>{var A;let q=[],K;return A=class{constructor(z){var w,_,$,O,H,j;if(this.boundPorts=(ecY(this,q),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=z!==null&&z!==void 0?z:{},this.options["grpc.enable_channelz"]===0)this.channelzEnabled=!1,this.channelzTrace=new $X.ChannelzTraceStub,this.callTracker=new $X.ChannelzCallTrackerStub,this.listenerChildrenTracker=new $X.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new $X.ChannelzChildrenTrackerStub;else this.channelzTrace=new $X.ChannelzTrace,this.callTracker=new $X.ChannelzCallTracker,this.listenerChildrenTracker=new $X.ChannelzChildrenTracker,this.sessionChildrenTracker=new $X.ChannelzChildrenTracker;if(this.channelzRef=(0,$X.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=(w=this.options["grpc.max_connection_age_ms"])!==null&&w!==void 0?w:IN6,this.maxConnectionAgeGraceMs=(_=this.options["grpc.max_connection_age_grace_ms"])!==null&&_!==void 0?_:IN6,this.keepaliveTimeMs=($=this.options["grpc.keepalive_time_ms"])!==null&&$!==void 0?$:cm8,this.keepaliveTimeoutMs=(O=this.options["grpc.keepalive_timeout_ms"])!==null&&O!==void 0?O:KlY,this.sessionIdleTimeout=(H=this.options["grpc.max_connection_idle_ms"])!==null&&H!==void 0?H:Zs4,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options)this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"];else this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER;if("grpc.max_concurrent_streams"in this.options)this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]};this.interceptors=(j=this.options.interceptors)!==null&&j!==void 0?j:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(z){var w,_,$;let O=this.sessions.get(z),H=z.socket,j=H.remoteAddress?(0,u86.stringToSubchannelAddress)(H.remoteAddress,H.remotePort):null,J=H.localAddress?(0,u86.stringToSubchannelAddress)(H.localAddress,H.localPort):null,M;if(z.encrypted){let X=H,P=X.getCipher(),W=X.getCertificate(),Z=X.getPeerCertificate();M={cipherSuiteStandardName:(w=P.standardName)!==null&&w!==void 0?w:null,cipherSuiteOtherName:P.standardName?null:P.name,localCertificate:W&&"raw"in W?W.raw:null,remoteCertificate:Z&&"raw"in Z?Z.raw:null}}else M=null;return{remoteAddress:j,localAddress:J,security:M,remoteName:null,streamsStarted:O.streamTracker.callsStarted,streamsSucceeded:O.streamTracker.callsSucceeded,streamsFailed:O.streamTracker.callsFailed,messagesSent:O.messagesSent,messagesReceived:O.messagesReceived,keepAlivesSent:O.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:O.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:O.lastMessageSentTimestamp,lastMessageReceivedTimestamp:O.lastMessageReceivedTimestamp,localFlowControlWindow:(_=z.state.localWindowSize)!==null&&_!==void 0?_:null,remoteFlowControlWindow:($=z.state.remoteWindowSize)!==null&&$!==void 0?$:null}}trace(z){bN6.trace(rJ.LogVerbosity.DEBUG,YlY,"("+this.channelzRef.id+") "+z)}keepaliveTrace(z){bN6.trace(rJ.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+z)}addProtoService(){throw Error("Not implemented. Use addService() instead")}addService(z,w){if(z===null||typeof z!=="object"||w===null||typeof w!=="object")throw Error("addService() requires two objects as arguments");let _=Object.keys(z);if(_.length===0)throw Error("Cannot add an empty service to a server");_.forEach(($)=>{let O=z[$],H;if(O.requestStream)if(O.responseStream)H="bidi";else H="clientStream";else if(O.responseStream)H="serverStream";else H="unary";let j=w[$],J;if(j===void 0&&typeof O.originalName==="string")j=w[O.originalName];if(j!==void 0)J=j.bind(w);else J=_lY(H,$);if(this.register(O.path,J,O.responseSerialize,O.requestDeserialize,H)===!1)throw Error(`Method handler for ${O.path} already provided.`)})}removeService(z){if(z===null||typeof z!=="object")throw Error("removeService() requires object as argument");Object.keys(z).forEach((_)=>{let $=z[_];this.unregister($.path)})}bind(z,w){throw Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(z){return(0,$X.registerChannelzSocket)((0,u86.subchannelAddressToString)(z),()=>{return{localAddress:z,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}},this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(z){(0,$X.unregisterChannelzRef)(z)}createHttp2Server(z){let w;if(z._isSecure()){let _=z._getConstructorOptions(),$=z._getSecureContextOptions(),O=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),_),$),{enableTrace:this.options["grpc-node.tls_enable_trace"]===1}),H=$!==null;this.trace("Initial credentials valid: "+H),w=Tv.createSecureServer(O),w.prependListener("connection",(J)=>{if(!H)this.trace("Dropped connection from "+JSON.stringify(J.address())+" due to unloaded credentials"),J.destroy()}),w.on("secureConnection",(J)=>{J.on("error",(M)=>{this.trace("An incoming TLS connection closed with error: "+M.message)})});let j=(J)=>{if(J){let M=w;try{M.setSecureContext(J)}catch(D){bN6.log(rJ.LogVerbosity.ERROR,"Failed to set secure context with error "+D.message),J=null}}H=J!==null,this.trace("Post-update credentials valid: "+H)};z._addWatcher(j),w.on("close",()=>{z._removeWatcher(j)})}else w=Tv.createServer(this.commonServerOptions);return w.setTimeout(0,zlY),this._setupHandlers(w,z._getInterceptors()),w}bindOneAddress(z,w){this.trace("Attempting to bind "+(0,u86.subchannelAddressToString)(z));let _=this.createHttp2Server(w.credentials);return new Promise(($,O)=>{let H=(j)=>{this.trace("Failed to bind "+(0,u86.subchannelAddressToString)(z)+" with error "+j.message),$({port:"port"in z?z.port:1,error:j.message})};_.once("error",H),_.listen(z,()=>{let j=_.address(),J;if(typeof j==="string")J={path:j};else J={host:j.address,port:j.port};let M=this.experimentalRegisterListenerToChannelz(J);this.listenerChildrenTracker.refChild(M),this.http2Servers.set(_,{channelzRef:M,sessions:new Set,ownsChannelzRef:!0}),w.listeningServers.add(_),this.trace("Successfully bound "+(0,u86.subchannelAddressToString)(J)),$({port:"port"in J?J.port:1}),_.removeListener("error",H)})})}async bindManyPorts(z,w){if(z.length===0)return{count:0,port:0,errors:[]};if((0,u86.isTcpSubchannelAddress)(z[0])&&z[0].port===0){let _=await this.bindOneAddress(z[0],w);if(_.error){let $=await this.bindManyPorts(z.slice(1),w);return Object.assign(Object.assign({},$),{errors:[_.error,...$.errors]})}else{let $=z.slice(1).map((j)=>(0,u86.isTcpSubchannelAddress)(j)?{host:j.host,port:_.port}:j),O=await Promise.all($.map((j)=>this.bindOneAddress(j,w))),H=[_,...O];return{count:H.filter((j)=>j.error===void 0).length,port:_.port,errors:H.filter((j)=>j.error).map((j)=>j.error)}}}else{let _=await Promise.all(z.map(($)=>this.bindOneAddress($,w)));return{count:_.filter(($)=>$.error===void 0).length,port:_[0].port,errors:_.filter(($)=>$.error).map(($)=>$.error)}}}async bindAddressList(z,w){let _=await this.bindManyPorts(z,w);if(_.count>0){if(_.count{let $=!1,O=(j,J,M,D)=>{if($)return!0;if($=!0,!j.ok)return _(Error(j.error.details)),!0;let X=[].concat(...j.value.map((P)=>P.addresses));if(X.length===0)return _(Error(`No addresses resolved for port ${z}`)),!0;return w(X),!0};(0,Ps4.createResolver)(z,O,this.options).updateResolution()})}async bindPort(z,w){let _=await this.resolvePort(z);if(w.cancelled)throw this.completeUnbind(w),Error("bindAsync operation cancelled by unbind call");let $=await this.bindAddressList(_,w);if(w.cancelled)throw this.completeUnbind(w),Error("bindAsync operation cancelled by unbind call");return $}normalizePort(z){let w=(0,ju.parseUri)(z);if(w===null)throw Error(`Could not parse port "${z}"`);let _=(0,Ps4.mapUriDefaultScheme)(w);if(_===null)throw Error(`Could not get a default scheme for port "${z}"`);return _}bindAsync(z,w,_){if(this.shutdown)throw Error("bindAsync called after shutdown");if(typeof z!=="string")throw TypeError("port must be a string");if(w===null||!(w instanceof dm8.ServerCredentials))throw TypeError("creds must be a ServerCredentials object");if(typeof _!=="function")throw TypeError("callback must be a function");this.trace("bindAsync port="+z);let $=this.normalizePort(z),O=(M,D)=>{process.nextTick(()=>_(M,D))},H=this.boundPorts.get((0,ju.uriToString)($));if(H){if(!w._equals(H.credentials)){O(Error(`${z} already bound with incompatible credentials`),0);return}if(H.cancelled=!1,H.completionPromise)H.completionPromise.then((M)=>_(null,M),(M)=>_(M,0));else O(null,H.portNumber);return}H={mapKey:(0,ju.uriToString)($),originalUri:$,completionPromise:null,cancelled:!1,portNumber:0,credentials:w,listeningServers:new Set};let j=(0,ju.splitHostPort)($.path),J=this.bindPort($,H);if(H.completionPromise=J,(j===null||j===void 0?void 0:j.port)===0)J.then((M)=>{let D={scheme:$.scheme,authority:$.authority,path:(0,ju.combineHostPort)({host:j.host,port:M})};H.mapKey=(0,ju.uriToString)(D),H.completionPromise=null,H.portNumber=M,this.boundPorts.set(H.mapKey,H),_(null,M)},(M)=>{_(M,0)});else this.boundPorts.set(H.mapKey,H),J.then((M)=>{H.completionPromise=null,H.portNumber=M,_(null,M)},(M)=>{_(M,0)})}registerInjectorToChannelz(){return(0,$X.registerChannelzSocket)("injector",()=>{return{localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}},this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(z,w,_=!1){if(z===null||!(z instanceof dm8.ServerCredentials))throw TypeError("creds must be a ServerCredentials object");if(this.channelzEnabled)this.listenerChildrenTracker.refChild(w);let $=this.createHttp2Server(z),O=new Set;return this.http2Servers.set($,{channelzRef:w,sessions:O,ownsChannelzRef:_}),{injectConnection:(H)=>{$.emit("connection",H)},drain:(H)=>{var j,J;for(let M of O)this.closeSession(M);(J=(j=setTimeout(()=>{for(let M of O)M.destroy(Tv.constants.NGHTTP2_CANCEL)},H)).unref)===null||J===void 0||J.call(j)},destroy:()=>{this.closeServer($);for(let H of O)this.closeSession(H)}}}createConnectionInjector(z){if(z===null||!(z instanceof dm8.ServerCredentials))throw TypeError("creds must be a ServerCredentials object");let w=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(z,w,!0)}closeServer(z,w){this.trace("Closing server with address "+JSON.stringify(z.address()));let _=this.http2Servers.get(z);z.close(()=>{if(_&&_.ownsChannelzRef)this.listenerChildrenTracker.unrefChild(_.channelzRef),(0,$X.unregisterChannelzRef)(_.channelzRef);this.http2Servers.delete(z),w===null||w===void 0||w()})}closeSession(z,w){var _;this.trace("Closing session initiated by "+((_=z.socket)===null||_===void 0?void 0:_.remoteAddress));let $=this.sessions.get(z),O=()=>{if($)this.sessionChildrenTracker.unrefChild($.ref),(0,$X.unregisterChannelzRef)($.ref);w===null||w===void 0||w()};if(z.closed)queueMicrotask(O);else z.close(O)}completeUnbind(z){for(let w of z.listeningServers){let _=this.http2Servers.get(w);if(this.closeServer(w,()=>{z.listeningServers.delete(w)}),_)for(let $ of _.sessions)this.closeSession($)}this.boundPorts.delete(z.mapKey)}unbind(z){this.trace("unbind port="+z);let w=this.normalizePort(z),_=(0,ju.splitHostPort)(w.path);if((_===null||_===void 0?void 0:_.port)===0)throw Error("Cannot unbind port 0");let $=this.boundPorts.get((0,ju.uriToString)(w));if($)if(this.trace("unbinding "+$.mapKey+" originally bound as "+(0,ju.uriToString)($.originalUri)),$.completionPromise)$.cancelled=!0;else this.completeUnbind($)}drain(z,w){var _,$;this.trace("drain port="+z+" graceTimeMs="+w);let O=this.normalizePort(z),H=(0,ju.splitHostPort)(O.path);if((H===null||H===void 0?void 0:H.port)===0)throw Error("Cannot drain port 0");let j=this.boundPorts.get((0,ju.uriToString)(O));if(!j)return;let J=new Set;for(let M of j.listeningServers){let D=this.http2Servers.get(M);if(D)for(let X of D.sessions)J.add(X),this.closeSession(X,()=>{J.delete(X)})}($=(_=setTimeout(()=>{for(let M of J)M.destroy(Tv.constants.NGHTTP2_CANCEL)},w)).unref)===null||$===void 0||$.call(_)}forceShutdown(){for(let z of this.boundPorts.values())z.cancelled=!0;this.boundPorts.clear();for(let z of this.http2Servers.keys())this.closeServer(z);this.sessions.forEach((z,w)=>{this.closeSession(w),w.destroy(Tv.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,$X.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(z,w,_,$,O){if(this.handlers.has(z))return!1;return this.handlers.set(z,{func:w,serialize:_,deserialize:$,type:O,path:z}),!0}unregister(z){return this.handlers.delete(z)}start(){if(this.http2Servers.size===0||[...this.http2Servers.keys()].every((z)=>!z.listening))throw Error("server must be bound in order to start");if(this.started===!0)throw Error("server is already started");this.started=!0}tryShutdown(z){var w;let _=(H)=>{(0,$X.unregisterChannelzRef)(this.channelzRef),z(H)},$=0;function O(){if($--,$===0)_()}this.shutdown=!0;for(let[H,j]of this.http2Servers.entries()){$++;let J=j.channelzRef.name;this.trace("Waiting for server "+J+" to close"),this.closeServer(H,()=>{this.trace("Server "+J+" finished closing"),O()});for(let M of j.sessions.keys()){$++;let D=(w=M.socket)===null||w===void 0?void 0:w.remoteAddress;this.trace("Waiting for session "+D+" to close"),this.closeSession(M,()=>{this.trace("Session "+D+" finished closing"),O()})}}if($===0)_()}addHttp2Port(){throw Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(z,w){let _=w[Tv.constants.HTTP2_HEADER_CONTENT_TYPE];if(typeof _!=="string"||!_.startsWith("application/grpc"))return z.respond({[Tv.constants.HTTP2_HEADER_STATUS]:Tv.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1;return!0}_retrieveHandler(z){Ts4("Received call to method "+z+" at address "+this.serverAddressString);let w=this.handlers.get(z);if(w===void 0)return Ts4("No handler registered for method "+z+". Sending UNIMPLEMENTED status."),null;return w}_respondWithError(z,w,_=null){var $,O;let H=Object.assign({"grpc-status":($=z.code)!==null&&$!==void 0?$:rJ.Status.INTERNAL,"grpc-message":z.details,[Tv.constants.HTTP2_HEADER_STATUS]:Tv.constants.HTTP_STATUS_OK,[Tv.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},(O=z.metadata)===null||O===void 0?void 0:O.toHttp2Headers());w.respond(H,{endStream:!0}),this.callTracker.addCallFailed(),_===null||_===void 0||_.streamTracker.addCallFailed()}_channelzHandler(z,w,_){this.onStreamOpened(w);let $=this.sessions.get(w.session);if(this.callTracker.addCallStarted(),$===null||$===void 0||$.streamTracker.addCallStarted(),!this._verifyContentType(w,_)){this.callTracker.addCallFailed(),$===null||$===void 0||$.streamTracker.addCallFailed();return}let O=_[Gs4],H=this._retrieveHandler(O);if(!H){this._respondWithError(lm8(O),w,$);return}let j={addMessageSent:()=>{if($)$.messagesSent+=1,$.lastMessageSentTimestamp=new Date},addMessageReceived:()=>{if($)$.messagesReceived+=1,$.lastMessageReceivedTimestamp=new Date},onCallEnd:(M)=>{if(M.code===rJ.Status.OK)this.callTracker.addCallSucceeded();else this.callTracker.addCallFailed()},onStreamEnd:(M)=>{if($)if(M)$.streamTracker.addCallSucceeded();else $.streamTracker.addCallFailed()}},J=(0,Ws4.getServerInterceptingCall)([...z,...this.interceptors],w,_,j,H,this.options);if(!this._runHandlerForCall(J,H))this.callTracker.addCallFailed(),$===null||$===void 0||$.streamTracker.addCallFailed(),J.sendStatus({code:rJ.Status.INTERNAL,details:`Unknown handler type: ${H.type}`})}_streamHandler(z,w,_){if(this.onStreamOpened(w),this._verifyContentType(w,_)!==!0)return;let $=_[Gs4],O=this._retrieveHandler($);if(!O){this._respondWithError(lm8($),w,null);return}let H=(0,Ws4.getServerInterceptingCall)([...z,...this.interceptors],w,_,null,O,this.options);if(!this._runHandlerForCall(H,O))H.sendStatus({code:rJ.Status.INTERNAL,details:`Unknown handler type: ${O.type}`})}_runHandlerForCall(z,w){let{type:_}=w;if(_==="unary")OlY(z,w);else if(_==="clientStream")HlY(z,w);else if(_==="serverStream")jlY(z,w);else if(_==="bidi")JlY(z,w);else return!1;return!0}_setupHandlers(z,w){if(z===null)return;let _=z.address(),$="null";if(_)if(typeof _==="string")$=_;else $=_.address+":"+_.port;this.serverAddressString=$;let O=this.channelzEnabled?this._channelzHandler:this._streamHandler,H=this.channelzEnabled?this._channelzSessionHandler(z):this._sessionHandler(z);z.on("stream",O.bind(this,w)),z.on("session",H)}_sessionHandler(z){return(w)=>{var _,$;(_=this.http2Servers.get(z))===null||_===void 0||_.sessions.add(w);let O=null,H=null,j=null,J=!1,M=this.enableIdleTimeout(w);if(this.maxConnectionAgeMs!==IN6){let Z=this.maxConnectionAgeMs/10,G=Math.random()*Z*2-Z;O=setTimeout(()=>{var f,V;J=!0,this.trace("Connection dropped by max connection age: "+((f=w.socket)===null||f===void 0?void 0:f.remoteAddress));try{w.goaway(Tv.constants.NGHTTP2_NO_ERROR,2147483647,fs4)}catch(N){w.destroy();return}if(w.close(),this.maxConnectionAgeGraceMs!==IN6)H=setTimeout(()=>{w.destroy()},this.maxConnectionAgeGraceMs),(V=H.unref)===null||V===void 0||V.call(H)},this.maxConnectionAgeMs+G),($=O.unref)===null||$===void 0||$.call(O)}let D=()=>{if(j)clearTimeout(j),j=null},X=()=>{return!w.destroyed&&this.keepaliveTimeMs0},P,W=()=>{var Z;if(!X())return;this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),j=setTimeout(()=>{D(),P()},this.keepaliveTimeMs),(Z=j.unref)===null||Z===void 0||Z.call(j)};P=()=>{var Z;if(!X())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let G="";try{if(!w.ping((V,N,v)=>{if(D(),V)this.keepaliveTrace("Ping failed with error: "+V.message),J=!0,w.close();else this.keepaliveTrace("Received ping response"),W()}))G="Ping returned false"}catch(f){G=(f instanceof Error?f.message:"")||"Unknown error"}if(G){this.keepaliveTrace("Ping send failed: "+G),this.trace("Connection dropped due to ping send error: "+G),J=!0,w.close();return}j=setTimeout(()=>{D(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),J=!0,w.close()},this.keepaliveTimeoutMs),(Z=j.unref)===null||Z===void 0||Z.call(j)},W(),w.on("close",()=>{var Z,G;if(!J)this.trace(`Connection dropped by client ${(Z=w.socket)===null||Z===void 0?void 0:Z.remoteAddress}`);if(O)clearTimeout(O);if(H)clearTimeout(H);if(D(),M!==null)clearTimeout(M.timeout),this.sessionIdleTimeouts.delete(w);(G=this.http2Servers.get(z))===null||G===void 0||G.sessions.delete(w)})}}_channelzSessionHandler(z){return(w)=>{var _,$,O,H;let j=(0,$X.registerChannelzSocket)(($=(_=w.socket)===null||_===void 0?void 0:_.remoteAddress)!==null&&$!==void 0?$:"unknown",this.getChannelzSessionInfo.bind(this,w),this.channelzEnabled),J={ref:j,streamTracker:new $X.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};(O=this.http2Servers.get(z))===null||O===void 0||O.sessions.add(w),this.sessions.set(w,J);let M=`${w.socket.remoteAddress}:${w.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+M),this.trace("Connection established by client "+M),this.sessionChildrenTracker.refChild(j);let D=null,X=null,P=null,W=!1,Z=this.enableIdleTimeout(w);if(this.maxConnectionAgeMs!==IN6){let v=this.maxConnectionAgeMs/10,y=Math.random()*v*2-v;D=setTimeout(()=>{var R;W=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+M);try{w.goaway(Tv.constants.NGHTTP2_NO_ERROR,2147483647,fs4)}catch(h){w.destroy();return}if(w.close(),this.maxConnectionAgeGraceMs!==IN6)X=setTimeout(()=>{w.destroy()},this.maxConnectionAgeGraceMs),(R=X.unref)===null||R===void 0||R.call(X)},this.maxConnectionAgeMs+y),(H=D.unref)===null||H===void 0||H.call(D)}let G=()=>{if(P)clearTimeout(P),P=null},f=()=>{return!w.destroyed&&this.keepaliveTimeMs0},V,N=()=>{var v;if(!f())return;this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),P=setTimeout(()=>{G(),V()},this.keepaliveTimeMs),(v=P.unref)===null||v===void 0||v.call(P)};V=()=>{var v;if(!f())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let y="";try{if(!w.ping((h,B,x)=>{if(G(),h)this.keepaliveTrace("Ping failed with error: "+h.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+h.message+" return in "+B),W=!0,w.close();else this.keepaliveTrace("Received ping response"),N()}))y="Ping returned false"}catch(R){y=(R instanceof Error?R.message:"")||"Unknown error"}if(y){this.keepaliveTrace("Ping send failed: "+y),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+y),W=!0,w.close();return}J.keepAlivesSent+=1,P=setTimeout(()=>{G(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+M),W=!0,w.close()},this.keepaliveTimeoutMs),(v=P.unref)===null||v===void 0||v.call(P)},N(),w.on("close",()=>{var v;if(!W)this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+M);if(this.sessionChildrenTracker.unrefChild(j),(0,$X.unregisterChannelzRef)(j),D)clearTimeout(D);if(X)clearTimeout(X);if(G(),Z!==null)clearTimeout(Z.timeout),this.sessionIdleTimeouts.delete(w);(v=this.http2Servers.get(z))===null||v===void 0||v.sessions.delete(w),this.sessions.delete(w)})}}enableIdleTimeout(z){var w,_;if(this.sessionIdleTimeout>=Zs4)return null;let $={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,z),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,z)};(_=(w=$.timeout).unref)===null||_===void 0||_.call(w),this.sessionIdleTimeouts.set(z,$);let{socket:O}=z;return this.trace("Enable idle timeout for "+O.remoteAddress+":"+O.remotePort),$}onIdleTimeout(z,w){let{socket:_}=w,$=z.sessionIdleTimeouts.get(w);if($!==void 0&&$.activeStreams===0)if(Date.now()-$.lastIdle>=z.sessionIdleTimeout)z.trace("Session idle timeout triggered for "+(_===null||_===void 0?void 0:_.remoteAddress)+":"+(_===null||_===void 0?void 0:_.remotePort)+" last idle at "+$.lastIdle),z.closeSession(w);else $.timeout.refresh()}onStreamOpened(z){let w=z.session,_=this.sessionIdleTimeouts.get(w);if(_)_.activeStreams+=1,z.once("close",_.onClose)}onStreamClose(z){var w,_;let $=this.sessionIdleTimeouts.get(z);if($){if($.activeStreams-=1,$.activeStreams===0)$.lastIdle=Date.now(),$.timeout.refresh(),this.trace("Session onStreamClose"+((w=z.socket)===null||w===void 0?void 0:w.remoteAddress)+":"+((_=z.socket)===null||_===void 0?void 0:_.remotePort)+" at "+$.lastIdle)}}},(()=>{let Y=typeof Symbol==="function"&&Symbol.metadata?Object.create(null):void 0;if(K=[wlY("Calling start() is no longer necessary. It can be safely omitted.")],AlY(A,null,K,{kind:"method",name:"start",static:!1,private:!1,access:{has:(z)=>("start"in z),get:(z)=>z.start},metadata:Y},null,q),Y)Object.defineProperty(A,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:Y})})(),A})();B86.Server=$lY;async function OlY(A,q){let K;function Y(_,$,O,H){if(_){A.sendStatus((0,xN6.serverErrorToStatus)(_,O));return}A.sendMessage($,()=>{A.sendStatus({code:rJ.Status.OK,details:"OK",metadata:O!==null&&O!==void 0?O:null})})}let z,w=null;A.start({onReceiveMetadata(_){z=_,A.startRead()},onReceiveMessage(_){if(w){A.sendStatus({code:rJ.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${q.path}`,metadata:null});return}w=_,A.startRead()},onReceiveHalfClose(){if(!w){A.sendStatus({code:rJ.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${q.path}`,metadata:null});return}K=new xN6.ServerWritableStreamImpl(q.path,A,z,w);try{q.func(K,Y)}catch(_){A.sendStatus({code:rJ.Status.UNKNOWN,details:`Server method handler threw error ${_.message}`,metadata:null})}},onCancel(){if(K)K.cancelled=!0,K.emit("cancelled","cancelled")}})}function HlY(A,q){let K;function Y(z,w,_,$){if(z){A.sendStatus((0,xN6.serverErrorToStatus)(z,_));return}A.sendMessage(w,()=>{A.sendStatus({code:rJ.Status.OK,details:"OK",metadata:_!==null&&_!==void 0?_:null})})}A.start({onReceiveMetadata(z){K=new xN6.ServerDuplexStreamImpl(q.path,A,z);try{q.func(K,Y)}catch(w){A.sendStatus({code:rJ.Status.UNKNOWN,details:`Server method handler threw error ${w.message}`,metadata:null})}},onReceiveMessage(z){K.push(z)},onReceiveHalfClose(){K.push(null)},onCancel(){if(K)K.cancelled=!0,K.emit("cancelled","cancelled"),K.destroy()}})}function jlY(A,q){let K,Y,z=null;A.start({onReceiveMetadata(w){Y=w,A.startRead()},onReceiveMessage(w){if(z){A.sendStatus({code:rJ.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${q.path}`,metadata:null});return}z=w,A.startRead()},onReceiveHalfClose(){if(!z){A.sendStatus({code:rJ.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${q.path}`,metadata:null});return}K=new xN6.ServerWritableStreamImpl(q.path,A,Y,z);try{q.func(K)}catch(w){A.sendStatus({code:rJ.Status.UNKNOWN,details:`Server method handler threw error ${w.message}`,metadata:null})}},onCancel(){if(K)K.cancelled=!0,K.emit("cancelled","cancelled"),K.destroy()}})}function JlY(A,q){let K;A.start({onReceiveMetadata(Y){K=new xN6.ServerDuplexStreamImpl(q.path,A,Y);try{q.func(K)}catch(z){A.sendStatus({code:rJ.Status.UNKNOWN,details:`Server method handler threw error ${z.message}`,metadata:null})}},onReceiveMessage(Y){K.push(Y)},onReceiveHalfClose(){K.push(null)},onCancel(){if(K)K.cancelled=!0,K.emit("cancelled","cancelled"),K.destroy()}})}});var Es4=C((vs4)=>{Object.defineProperty(vs4,"__esModule",{value:!0});vs4.StatusBuilder=void 0;class Ns4{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(A){return this.code=A,this}withDetails(A){return this.details=A,this}withMetadata(A){return this.metadata=A,this}build(){let A={};if(this.code!==null)A.code=this.code;if(this.details!==null)A.details=this.details;if(this.metadata!==null)A.metadata=this.metadata;return A}}vs4.StatusBuilder=Ns4});var mn6=C((bs4)=>{Object.defineProperty(bs4,"__esModule",{value:!0});bs4.LeafLoadBalancer=bs4.PickFirstLoadBalancer=bs4.PickFirstLoadBalancingConfig=void 0;bs4.shuffled=Cs4;bs4.setup=flY;var im8=E86(),oJ=dT(),m86=Dn(),Ls4=Gv(),MlY=m_(),DlY=E9(),ys4=Gv(),Rs4=g6("net"),XlY=cw6(),PlY="pick_first";function un6(A){MlY.trace(DlY.LogVerbosity.DEBUG,PlY,A)}var Bn6="pick_first",WlY=250;class uN6{constructor(A){this.shuffleAddressList=A}getLoadBalancerName(){return Bn6}toJsonObject(){return{[Bn6]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(A){if("shuffleAddressList"in A&&typeof A.shuffleAddressList!=="boolean")throw Error("pick_first config field shuffleAddressList must be a boolean if provided");return new uN6(A.shuffleAddressList===!0)}}bs4.PickFirstLoadBalancingConfig=uN6;class Ss4{constructor(A){this.subchannel=A}pick(A){return{pickResultType:m86.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}}function Cs4(A){let q=A.slice();for(let K=q.length-1;K>1;K--){let Y=Math.floor(Math.random()*(K+1)),z=q[K];q[K]=q[Y],q[Y]=z}return q}function ZlY(A){if(A.length===0)return[];let q=[],K=[],Y=[],z=(0,ys4.isTcpSubchannelAddress)(A[0])&&(0,Rs4.isIPv6)(A[0].host);for(let $ of A)if((0,ys4.isTcpSubchannelAddress)($)&&(0,Rs4.isIPv6)($.host))K.push($);else Y.push($);let w=z?K:Y,_=z?Y:K;for(let $=0;${this.onSubchannelStateUpdate(q,K,Y,w)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every((A)=>A.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every((A)=>A.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var A;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){let q=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(oJ.ConnectivityState.TRANSIENT_FAILURE,new m86.UnavailablePicker({details:q}),q)}else this.updateState(oJ.ConnectivityState.READY,new Ss4(this.currentPick),null);else if(((A=this.latestAddressList)===null||A===void 0?void 0:A.length)===0){let q=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(oJ.ConnectivityState.TRANSIENT_FAILURE,new m86.UnavailablePicker({details:q}),q)}else if(this.children.length===0)this.updateState(oJ.ConnectivityState.IDLE,new m86.QueuePicker(this),null);else if(this.stickyTransientFailureMode){let q=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(oJ.ConnectivityState.TRANSIENT_FAILURE,new m86.UnavailablePicker({details:q}),q)}else this.updateState(oJ.ConnectivityState.CONNECTING,new m86.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(!this.allChildrenHaveReportedTF())return;if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode){this.calculateAndReportNewState();return}this.stickyTransientFailureMode=!0;for(let{subchannel:A}of this.children)A.startConnecting();this.calculateAndReportNewState()}removeCurrentPick(){if(this.currentPick!==null)this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null}onSubchannelStateUpdate(A,q,K,Y){var z;if((z=this.currentPick)===null||z===void 0?void 0:z.realSubchannelEquals(A)){if(K!==oJ.ConnectivityState.READY)this.removeCurrentPick(),this.calculateAndReportNewState();return}for(let[w,_]of this.children.entries())if(A.realSubchannelEquals(_.subchannel)){if(K===oJ.ConnectivityState.READY)this.pickSubchannel(_.subchannel);if(K===oJ.ConnectivityState.TRANSIENT_FAILURE){if(_.hasReportedTransientFailure=!0,Y)this.lastError=Y;if(this.maybeEnterStickyTransientFailureMode(),w===this.currentSubchannelIndex)this.startNextSubchannelConnecting(w+1)}_.subchannel.startConnecting();return}}startNextSubchannelConnecting(A){clearTimeout(this.connectionDelayTimeout);for(let[q,K]of this.children.entries())if(q>=A){let Y=K.subchannel.getConnectivityState();if(Y===oJ.ConnectivityState.IDLE||Y===oJ.ConnectivityState.CONNECTING){this.startConnecting(q);return}}this.maybeEnterStickyTransientFailureMode()}startConnecting(A){var q,K;if(clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=A,this.children[A].subchannel.getConnectivityState()===oJ.ConnectivityState.IDLE)un6("Start connecting to subchannel with address "+this.children[A].subchannel.getAddress()),process.nextTick(()=>{var Y;(Y=this.children[A])===null||Y===void 0||Y.subchannel.startConnecting()});this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(A+1)},WlY),(K=(q=this.connectionDelayTimeout).unref)===null||K===void 0||K.call(q)}pickSubchannel(A){un6("Pick subchannel with address "+A.getAddress()),this.stickyTransientFailureMode=!1,A.ref(),this.channelControlHelper.addChannelzChild(A.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),A.addConnectivityStateListener(this.subchannelStateListener),A.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=A,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(A,q,K){un6(oJ.ConnectivityState[this.currentState]+" -> "+oJ.ConnectivityState[A]),this.currentState=A,this.channelControlHelper.updateState(A,q,K)}resetSubchannelList(){for(let A of this.children)A.subchannel.removeConnectivityStateListener(this.subchannelStateListener),A.subchannel.unref(),this.channelControlHelper.removeChannelzChild(A.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(A,q){un6("connectToAddressList(["+A.map((Y)=>(0,Ls4.subchannelAddressToString)(Y))+"])");let K=A.map((Y)=>({subchannel:this.channelControlHelper.createSubchannel(Y,q),hasReportedTransientFailure:!1}));for(let{subchannel:Y}of K)if(Y.getConnectivityState()===oJ.ConnectivityState.READY){this.pickSubchannel(Y);return}for(let{subchannel:Y}of K)Y.ref(),this.channelControlHelper.addChannelzChild(Y.getChannelzRef());this.resetSubchannelList(),this.children=K;for(let{subchannel:Y}of this.children)Y.addConnectivityStateListener(this.subchannelStateListener);for(let Y of this.children)if(Y.subchannel.getConnectivityState()===oJ.ConnectivityState.TRANSIENT_FAILURE)Y.hasReportedTransientFailure=!0;this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(A,q,K,Y){if(!(q instanceof uN6))return!1;if(!A.ok){if(this.children.length===0&&this.currentPick===null)this.channelControlHelper.updateState(oJ.ConnectivityState.TRANSIENT_FAILURE,new m86.UnavailablePicker(A.error),A.error.details);return!0}let z=A.value;if(this.reportHealthStatus=K[hs4],q.getShuffleAddressList())z=Cs4(z);let w=[].concat(...z.map(($)=>$.addresses));un6("updateAddressList(["+w.map(($)=>(0,Ls4.subchannelAddressToString)($))+"])");let _=ZlY(w);if(this.latestAddressList=_,this.latestOptions=K,this.connectToAddressList(_,K),this.latestResolutionNote=Y,w.length>0)return!0;else return this.lastError="No addresses resolved",!1}exitIdle(){if(this.currentState===oJ.ConnectivityState.IDLE&&this.latestAddressList)this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return Bn6}}bs4.PickFirstLoadBalancer=qE1;var GlY=new uN6(!1);class Is4{constructor(A,q,K,Y){this.endpoint=A,this.options=K,this.resolutionNote=Y,this.latestState=oJ.ConnectivityState.IDLE;let z=(0,im8.createChildChannelControlHelper)(q,{updateState:(w,_,$)=>{this.latestState=w,this.latestPicker=_,q.updateState(w,_,$)}});this.pickFirstBalancer=new qE1(z),this.latestPicker=new m86.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,XlY.statusOrFromValue)([this.endpoint]),GlY,Object.assign(Object.assign({},this.options),{[hs4]:!0}),this.resolutionNote)}updateEndpoint(A,q){if(this.options=q,this.endpoint=A,this.latestState!==oJ.ConnectivityState.IDLE)this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}}bs4.LeafLoadBalancer=Is4;function flY(){(0,im8.registerLoadBalancerType)(Bn6,qE1,uN6),(0,im8.registerDefaultLoadBalancerType)(Bn6)}});var gs4=C((Bs4)=>{Object.defineProperty(Bs4,"__esModule",{value:!0});Bs4.FileWatcherCertificateProvider=void 0;var klY=g6("fs"),ElY=m_(),LlY=E9(),ylY=g6("util"),RlY="certificate_provider";function KE1(A){ElY.trace(LlY.LogVerbosity.DEBUG,RlY,A)}var nm8=(0,ylY.promisify)(klY.readFile);class us4{constructor(A){if(this.config=A,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,A.certificateFile===void 0!==(A.privateKeyFile===void 0))throw Error("certificateFile and privateKeyFile must be set or unset together");if(A.certificateFile===void 0&&A.caCertificateFile===void 0)throw Error("At least one of certificateFile and caCertificateFile must be set");KE1("File watcher constructed with config "+JSON.stringify(A))}updateCertificates(){if(this.fileResultPromise)return;this.fileResultPromise=Promise.allSettled([this.config.certificateFile?nm8(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?nm8(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?nm8(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([A,q,K])=>{if(!this.refreshTimer)return;if(KE1("File watcher read certificates certificate "+A.status+", privateKey "+q.status+", CA certificate "+K.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,A.status==="fulfilled"&&q.status==="fulfilled")this.latestIdentityUpdate={certificate:A.value,privateKey:q.value};else this.latestIdentityUpdate=null;if(K.status==="fulfilled")this.latestCaUpdate={caCertificate:K.value};else this.latestCaUpdate=null;for(let Y of this.identityListeners)Y(this.latestIdentityUpdate);for(let Y of this.caListeners)Y(this.latestCaUpdate)}),KE1("File watcher initiated certificate update")}maybeStartWatchingFiles(){if(!this.refreshTimer){let A=this.lastUpdateTime?new Date().getTime()-this.lastUpdateTime.getTime():1/0;if(A>this.config.refreshIntervalMs)this.updateCertificates();if(A>this.config.refreshIntervalMs*2)this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0;this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),KE1("File watcher started watching")}}maybeStopWatchingFiles(){if(this.caListeners.size===0&&this.identityListeners.size===0){if(this.fileResultPromise=null,this.refreshTimer)clearInterval(this.refreshTimer),this.refreshTimer=null}}addCaCertificateListener(A){if(this.caListeners.add(A),this.maybeStartWatchingFiles(),this.latestCaUpdate!==void 0)process.nextTick(A,this.latestCaUpdate)}removeCaCertificateListener(A){this.caListeners.delete(A),this.maybeStopWatchingFiles()}addIdentityCertificateListener(A){if(this.identityListeners.add(A),this.maybeStartWatchingFiles(),this.latestIdentityUpdate!==void 0)process.nextTick(A,this.latestIdentityUpdate)}removeIdentityCertificateListener(A){this.identityListeners.delete(A),this.maybeStopWatchingFiles()}}Bs4.FileWatcherCertificateProvider=us4});var am8=C((jY)=>{Object.defineProperty(jY,"__esModule",{value:!0});jY.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=jY.createCertificateProviderChannelCredentials=jY.FileWatcherCertificateProvider=jY.createCertificateProviderServerCredentials=jY.createServerCredentialsWithInterceptors=jY.BaseSubchannelWrapper=jY.registerAdminService=jY.FilterStackFactory=jY.BaseFilter=jY.statusOrFromError=jY.statusOrFromValue=jY.PickResultType=jY.QueuePicker=jY.UnavailablePicker=jY.ChildLoadBalancerHandler=jY.EndpointMap=jY.endpointHasAddress=jY.endpointToString=jY.subchannelAddressToString=jY.LeafLoadBalancer=jY.isLoadBalancerNameRegistered=jY.parseLoadBalancingConfig=jY.selectLbConfigFromList=jY.registerLoadBalancerType=jY.createChildChannelControlHelper=jY.BackoffTimeout=jY.parseDuration=jY.durationToMs=jY.splitHostPort=jY.uriToString=jY.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=jY.createResolver=jY.registerResolver=jY.log=jY.trace=void 0;var Fs4=m_();Object.defineProperty(jY,"trace",{enumerable:!0,get:function(){return Fs4.trace}});Object.defineProperty(jY,"log",{enumerable:!0,get:function(){return Fs4.log}});var rm8=zu();Object.defineProperty(jY,"registerResolver",{enumerable:!0,get:function(){return rm8.registerResolver}});Object.defineProperty(jY,"createResolver",{enumerable:!0,get:function(){return rm8.createResolver}});Object.defineProperty(jY,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return rm8.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var Qs4=pT();Object.defineProperty(jY,"uriToString",{enumerable:!0,get:function(){return Qs4.uriToString}});Object.defineProperty(jY,"splitHostPort",{enumerable:!0,get:function(){return Qs4.splitHostPort}});var Us4=xn6();Object.defineProperty(jY,"durationToMs",{enumerable:!0,get:function(){return Us4.durationToMs}});Object.defineProperty(jY,"parseDuration",{enumerable:!0,get:function(){return Us4.parseDuration}});var SlY=JN6();Object.defineProperty(jY,"BackoffTimeout",{enumerable:!0,get:function(){return SlY.BackoffTimeout}});var gn6=E86();Object.defineProperty(jY,"createChildChannelControlHelper",{enumerable:!0,get:function(){return gn6.createChildChannelControlHelper}});Object.defineProperty(jY,"registerLoadBalancerType",{enumerable:!0,get:function(){return gn6.registerLoadBalancerType}});Object.defineProperty(jY,"selectLbConfigFromList",{enumerable:!0,get:function(){return gn6.selectLbConfigFromList}});Object.defineProperty(jY,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return gn6.parseLoadBalancingConfig}});Object.defineProperty(jY,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return gn6.isLoadBalancerNameRegistered}});var ClY=mn6();Object.defineProperty(jY,"LeafLoadBalancer",{enumerable:!0,get:function(){return ClY.LeafLoadBalancer}});var YE1=Gv();Object.defineProperty(jY,"subchannelAddressToString",{enumerable:!0,get:function(){return YE1.subchannelAddressToString}});Object.defineProperty(jY,"endpointToString",{enumerable:!0,get:function(){return YE1.endpointToString}});Object.defineProperty(jY,"endpointHasAddress",{enumerable:!0,get:function(){return YE1.endpointHasAddress}});Object.defineProperty(jY,"EndpointMap",{enumerable:!0,get:function(){return YE1.EndpointMap}});var hlY=qk1();Object.defineProperty(jY,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return hlY.ChildLoadBalancerHandler}});var om8=Dn();Object.defineProperty(jY,"UnavailablePicker",{enumerable:!0,get:function(){return om8.UnavailablePicker}});Object.defineProperty(jY,"QueuePicker",{enumerable:!0,get:function(){return om8.QueuePicker}});Object.defineProperty(jY,"PickResultType",{enumerable:!0,get:function(){return om8.PickResultType}});var ps4=cw6();Object.defineProperty(jY,"statusOrFromValue",{enumerable:!0,get:function(){return ps4.statusOrFromValue}});Object.defineProperty(jY,"statusOrFromError",{enumerable:!0,get:function(){return ps4.statusOrFromError}});var IlY=Om8();Object.defineProperty(jY,"BaseFilter",{enumerable:!0,get:function(){return IlY.BaseFilter}});var blY=Bk1();Object.defineProperty(jY,"FilterStackFactory",{enumerable:!0,get:function(){return blY.FilterStackFactory}});var xlY=Yk1();Object.defineProperty(jY,"registerAdminService",{enumerable:!0,get:function(){return xlY.registerAdminService}});var ulY=In6();Object.defineProperty(jY,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return ulY.BaseSubchannelWrapper}});var ds4=ok1();Object.defineProperty(jY,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return ds4.createServerCredentialsWithInterceptors}});Object.defineProperty(jY,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return ds4.createCertificateProviderServerCredentials}});var BlY=gs4();Object.defineProperty(jY,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return BlY.FileWatcherCertificateProvider}});var mlY=jN6();Object.defineProperty(jY,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return mlY.createCertificateProviderChannelCredentials}});var glY=Sm8();Object.defineProperty(jY,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return glY.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})});var is4=C((ls4)=>{Object.defineProperty(ls4,"__esModule",{value:!0});ls4.setup=plY;var QlY=zu(),UlY=cw6();class cs4{constructor(A,q,K){this.listener=q,this.hasReturnedResult=!1,this.endpoints=[];let Y;if(A.authority==="")Y="/"+A.path;else Y=A.path;this.endpoints=[{addresses:[{path:Y}]}]}updateResolution(){if(!this.hasReturnedResult)this.hasReturnedResult=!0,process.nextTick(this.listener,(0,UlY.statusOrFromValue)(this.endpoints),{},null,"")}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(A){return"localhost"}}function plY(){(0,QlY.registerResolver)("unix",cs4)}});var es4=C((ts4)=>{Object.defineProperty(ts4,"__esModule",{value:!0});ts4.setup=rlY;var ns4=g6("net"),rs4=cw6(),zE1=E9(),sm8=hP(),os4=zu(),clY=Gv(),as4=pT(),llY=m_(),ilY="ip_resolver";function ss4(A){llY.trace(zE1.LogVerbosity.DEBUG,ilY,A)}var tm8="ipv4",em8="ipv6",nlY=443;class Ag8{constructor(A,q,K){var Y;this.listener=q,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,ss4("Resolver constructed for target "+(0,as4.uriToString)(A));let z=[];if(!(A.scheme===tm8||A.scheme===em8)){this.error={code:zE1.Status.UNAVAILABLE,details:`Unrecognized scheme ${A.scheme} in IP resolver`,metadata:new sm8.Metadata};return}let w=A.path.split(",");for(let _ of w){let $=(0,as4.splitHostPort)(_);if($===null){this.error={code:zE1.Status.UNAVAILABLE,details:`Failed to parse ${A.scheme} address ${_}`,metadata:new sm8.Metadata};return}if(A.scheme===tm8&&!(0,ns4.isIPv4)($.host)||A.scheme===em8&&!(0,ns4.isIPv6)($.host)){this.error={code:zE1.Status.UNAVAILABLE,details:`Failed to parse ${A.scheme} address ${_}`,metadata:new sm8.Metadata};return}z.push({host:$.host,port:(Y=$.port)!==null&&Y!==void 0?Y:nlY})}this.endpoints=z.map((_)=>({addresses:[_]})),ss4("Parsed "+A.scheme+" address list "+z.map(clY.subchannelAddressToString))}updateResolution(){if(!this.hasReturnedResult)this.hasReturnedResult=!0,process.nextTick(()=>{if(this.error)this.listener((0,rs4.statusOrFromError)(this.error),{},null,"");else this.listener((0,rs4.statusOrFromValue)(this.endpoints),{},null,"")})}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(A){return A.path.split(",")[0]}}function rlY(){(0,os4.registerResolver)(tm8,Ag8),(0,os4.registerResolver)(em8,Ag8)}});var _t4=C((zt4)=>{Object.defineProperty(zt4,"__esModule",{value:!0});zt4.RoundRobinLoadBalancer=void 0;zt4.setup=qiY;var Kt4=E86(),IW=dT(),Fn6=Dn(),alY=m_(),slY=E9(),At4=Gv(),tlY=mn6(),elY="round_robin";function qt4(A){alY.trace(slY.LogVerbosity.DEBUG,elY,A)}var wE1="round_robin";class _E1{getLoadBalancerName(){return wE1}constructor(){}toJsonObject(){return{[wE1]:{}}}static createFromJson(A){return new _E1}}class Yt4{constructor(A,q=0){this.children=A,this.nextIndex=q}pick(A){let q=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,q.pick(A)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}}function AiY(A,q){return[...A.slice(q),...A.slice(0,q)]}class qg8{constructor(A){this.channelControlHelper=A,this.children=[],this.currentState=IW.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,Kt4.createChildChannelControlHelper)(A,{updateState:(q,K,Y)=>{if(this.currentState===IW.ConnectivityState.READY&&q!==IW.ConnectivityState.READY)this.channelControlHelper.requestReresolution();if(Y)this.lastError=Y;this.calculateAndUpdateState()}})}countChildrenWithState(A){return this.children.filter((q)=>q.getConnectivityState()===A).length}calculateAndUpdateState(){if(this.updatesPaused)return;if(this.countChildrenWithState(IW.ConnectivityState.READY)>0){let A=this.children.filter((K)=>K.getConnectivityState()===IW.ConnectivityState.READY),q=0;if(this.currentReadyPicker!==null){let K=this.currentReadyPicker.peekNextEndpoint();if(q=A.findIndex((Y)=>(0,At4.endpointEqual)(Y.getEndpoint(),K)),q<0)q=0}this.updateState(IW.ConnectivityState.READY,new Yt4(A.map((K)=>({endpoint:K.getEndpoint(),picker:K.getPicker()})),q),null)}else if(this.countChildrenWithState(IW.ConnectivityState.CONNECTING)>0)this.updateState(IW.ConnectivityState.CONNECTING,new Fn6.QueuePicker(this),null);else if(this.countChildrenWithState(IW.ConnectivityState.TRANSIENT_FAILURE)>0){let A=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(IW.ConnectivityState.TRANSIENT_FAILURE,new Fn6.UnavailablePicker({details:A}),A)}else this.updateState(IW.ConnectivityState.IDLE,new Fn6.QueuePicker(this),null);for(let A of this.children)if(A.getConnectivityState()===IW.ConnectivityState.IDLE)A.exitIdle()}updateState(A,q,K){if(qt4(IW.ConnectivityState[this.currentState]+" -> "+IW.ConnectivityState[A]),A===IW.ConnectivityState.READY)this.currentReadyPicker=q;else this.currentReadyPicker=null;this.currentState=A,this.channelControlHelper.updateState(A,q,K)}resetSubchannelList(){for(let A of this.children)A.destroy();this.children=[]}updateAddressList(A,q,K,Y){if(!(q instanceof _E1))return!1;if(!A.ok){if(this.children.length===0)this.updateState(IW.ConnectivityState.TRANSIENT_FAILURE,new Fn6.UnavailablePicker(A.error),A.error.details);return!0}let z=Math.random()*A.value.length|0,w=AiY(A.value,z);if(this.resetSubchannelList(),w.length===0){let _=`No addresses resolved. Resolution note: ${Y}`;this.updateState(IW.ConnectivityState.TRANSIENT_FAILURE,new Fn6.UnavailablePicker({details:_}),_)}qt4("Connect to endpoint list "+w.map(At4.endpointToString)),this.updatesPaused=!0,this.children=w.map((_)=>new tlY.LeafLoadBalancer(_,this.childChannelControlHelper,K,Y));for(let _ of this.children)_.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return wE1}}zt4.RoundRobinLoadBalancer=qg8;function qiY(){(0,Kt4.registerLoadBalancerType)(wE1,qg8,_E1)}});var Xt4=C((Mt4)=>{var Kg8;Object.defineProperty(Mt4,"__esModule",{value:!0});Mt4.OutlierDetectionLoadBalancer=Mt4.OutlierDetectionLoadBalancingConfig=void 0;Mt4.setup=DiY;var YiY=dT(),$t4=E9(),q26=xn6(),Ot4=am8(),ziY=E86(),wiY=qk1(),_iY=Dn(),Yg8=Gv(),$iY=In6(),OiY=m_(),HiY="outlier_detection";function xP(A){OiY.trace($t4.LogVerbosity.DEBUG,HiY,A)}var _g8="outlier_detection",jiY=((Kg8=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)!==null&&Kg8!==void 0?Kg8:"true")==="true",JiY={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},MiY={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function BN6(A,q,K,Y){if(q in A&&A[q]!==void 0&&typeof A[q]!==K){let z=Y?`${Y}.${q}`:q;throw Error(`outlier detection config ${z} parse error: expected ${K}, got ${typeof A[q]}`)}}function zg8(A,q,K){let Y=K?`${K}.${q}`:q;if(q in A&&A[q]!==void 0){if(!(0,q26.isDuration)(A[q]))throw Error(`outlier detection config ${Y} parse error: expected Duration, got ${typeof A[q]}`);if(!(A[q].seconds>=0&&A[q].seconds<=315576000000&&A[q].nanos>=0&&A[q].nanos<=999999999))throw Error(`outlier detection config ${Y} parse error: values out of range for non-negative Duaration`)}}function $E1(A,q,K){let Y=K?`${K}.${q}`:q;if(BN6(A,q,"number",K),q in A&&A[q]!==void 0&&!(A[q]>=0&&A[q]<=100))throw Error(`outlier detection config ${Y} parse error: value out of range for percentage (0-100)`)}class Qn6{constructor(A,q,K,Y,z,w,_){if(this.childPolicy=_,_.getLoadBalancerName()==="pick_first")throw Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=A!==null&&A!==void 0?A:1e4,this.baseEjectionTimeMs=q!==null&&q!==void 0?q:30000,this.maxEjectionTimeMs=K!==null&&K!==void 0?K:300000,this.maxEjectionPercent=Y!==null&&Y!==void 0?Y:10,this.successRateEjection=z?Object.assign(Object.assign({},JiY),z):null,this.failurePercentageEjection=w?Object.assign(Object.assign({},MiY),w):null}getLoadBalancerName(){return _g8}toJsonObject(){var A,q;return{outlier_detection:{interval:(0,q26.msToDuration)(this.intervalMs),base_ejection_time:(0,q26.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,q26.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:(A=this.successRateEjection)!==null&&A!==void 0?A:void 0,failure_percentage_ejection:(q=this.failurePercentageEjection)!==null&&q!==void 0?q:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(A){var q;if(zg8(A,"interval"),zg8(A,"base_ejection_time"),zg8(A,"max_ejection_time"),$E1(A,"max_ejection_percent"),"success_rate_ejection"in A&&A.success_rate_ejection!==void 0){if(typeof A.success_rate_ejection!=="object")throw Error("outlier detection config success_rate_ejection must be an object");BN6(A.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),$E1(A.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),BN6(A.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),BN6(A.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in A&&A.failure_percentage_ejection!==void 0){if(typeof A.failure_percentage_ejection!=="object")throw Error("outlier detection config failure_percentage_ejection must be an object");$E1(A.failure_percentage_ejection,"threshold","failure_percentage_ejection"),$E1(A.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),BN6(A.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),BN6(A.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in A)||!Array.isArray(A.child_policy))throw Error("outlier detection config child_policy must be an array");let K=(0,ziY.selectLbConfigFromList)(A.child_policy);if(!K)throw Error("outlier detection config child_policy: no valid recognized policy found");return new Qn6(A.interval?(0,q26.durationToMs)(A.interval):null,A.base_ejection_time?(0,q26.durationToMs)(A.base_ejection_time):null,A.max_ejection_time?(0,q26.durationToMs)(A.max_ejection_time):null,(q=A.max_ejection_percent)!==null&&q!==void 0?q:null,A.success_rate_ejection,A.failure_percentage_ejection,K)}}Mt4.OutlierDetectionLoadBalancingConfig=Qn6;class Ht4 extends $iY.BaseSubchannelWrapper{constructor(A,q){super(A);this.mapEntry=q,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0){if(this.mapEntry){let A=this.mapEntry.subchannelWrappers.indexOf(this);if(A>=0)this.mapEntry.subchannelWrappers.splice(A,1)}}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}}function wg8(){return{success:0,failure:0}}class jt4{constructor(){this.activeBucket=wg8(),this.inactiveBucket=wg8()}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket=wg8()}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}}class Jt4{constructor(A,q){this.wrappedPicker=A,this.countCalls=q}pick(A){let q=this.wrappedPicker.pick(A);if(q.pickResultType===_iY.PickResultType.COMPLETE){let K=q.subchannel,Y=K.getMapEntry();if(Y){let z=q.onCallEnded;if(this.countCalls)z=(w,_,$)=>{var O;if(w===$t4.Status.OK)Y.counter.addSuccess();else Y.counter.addFailure();(O=q.onCallEnded)===null||O===void 0||O.call(q,w,_,$)};return Object.assign(Object.assign({},q),{subchannel:K.getWrappedSubchannel(),onCallEnded:z})}else return Object.assign(Object.assign({},q),{subchannel:K.getWrappedSubchannel()})}else return q}}class $g8{constructor(A){this.entryMap=new Yg8.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new wiY.ChildLoadBalancerHandler((0,Ot4.createChildChannelControlHelper)(A,{createSubchannel:(q,K)=>{let Y=A.createSubchannel(q,K),z=this.entryMap.getForSubchannelAddress(q),w=new Ht4(Y,z);if((z===null||z===void 0?void 0:z.currentEjectionTimestamp)!==null)w.eject();return z===null||z===void 0||z.subchannelWrappers.push(w),w},updateState:(q,K,Y)=>{if(q===YiY.ConnectivityState.READY)A.updateState(q,new Jt4(K,this.isCountingEnabled()),Y);else A.updateState(q,K,Y)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return this.latestConfig!==null&&(this.latestConfig.getSuccessRateEjectionConfig()!==null||this.latestConfig.getFailurePercentageEjectionConfig()!==null)}getCurrentEjectionPercent(){let A=0;for(let q of this.entryMap.values())if(q.currentEjectionTimestamp!==null)A+=1;return A*100/this.entryMap.size}runSuccessRateCheck(A){if(!this.latestConfig)return;let q=this.latestConfig.getSuccessRateEjectionConfig();if(!q)return;xP("Running success rate check");let K=q.request_volume,Y=0,z=[];for(let[j,J]of this.entryMap.entries()){let M=J.counter.getLastSuccesses(),D=J.counter.getLastFailures();if(xP("Stats for "+(0,Yg8.endpointToString)(j)+": successes="+M+" failures="+D+" targetRequestVolume="+K),M+D>=K)Y+=1,z.push(M/(M+D))}if(xP("Found "+Y+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+z+"]"),Yj+J)/z.length,_=0;for(let j of z){let J=j-w;_+=J*J}let $=_/z.length,O=Math.sqrt($),H=w-O*(q.stdev_factor/1000);xP("stdev="+O+" ejectionThreshold="+H);for(let[j,J]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let M=J.counter.getLastSuccesses(),D=J.counter.getLastFailures();if(M+Dthis.runChecks(),A),(K=(q=this.ejectionTimer).unref)===null||K===void 0||K.call(q)}runChecks(){let A=new Date;if(xP("Ejection timer running"),this.switchAllBuckets(),!this.latestConfig)return;this.timerStartTime=A,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(A),this.runFailurePercentageCheck(A);for(let[q,K]of this.entryMap.entries())if(K.currentEjectionTimestamp===null){if(K.ejectionTimeMultiplier>0)K.ejectionTimeMultiplier-=1}else{let Y=this.latestConfig.getBaseEjectionTimeMs(),z=this.latestConfig.getMaxEjectionTimeMs(),w=new Date(K.currentEjectionTimestamp.getTime());if(w.setMilliseconds(w.getMilliseconds()+Math.min(Y*K.ejectionTimeMultiplier,Math.max(Y,z))),w{Object.defineProperty(Wt4,"__esModule",{value:!0});Wt4.PriorityQueue=void 0;var mN6=0,Og8=(A)=>Math.floor(A/2),OE1=(A)=>A*2+1,Un6=(A)=>A*2+2;class Pt4{constructor(A=(q,K)=>q>K){this.comparator=A,this.heap=[]}size(){return this.heap.length}isEmpty(){return this.size()==0}peek(){return this.heap[mN6]}push(...A){return A.forEach((q)=>{this.heap.push(q),this.siftUp()}),this.size()}pop(){let A=this.peek(),q=this.size()-1;if(q>mN6)this.swap(mN6,q);return this.heap.pop(),this.siftDown(),A}replace(A){let q=this.peek();return this.heap[mN6]=A,this.siftDown(),q}greater(A,q){return this.comparator(this.heap[A],this.heap[q])}swap(A,q){[this.heap[A],this.heap[q]]=[this.heap[q],this.heap[A]]}siftUp(){let A=this.size()-1;while(A>mN6&&this.greater(A,Og8(A)))this.swap(A,Og8(A)),A=Og8(A)}siftDown(){let A=mN6;while(OE1(A){Object.defineProperty(Et4,"__esModule",{value:!0});Et4.WeightedRoundRobinLoadBalancingConfig=void 0;Et4.setup=LiY;var uP=dT(),WiY=E9(),VL=xn6(),Vt4=E86(),ZiY=mn6(),GiY=m_(),Nt4=sk1(),gN6=Dn(),fiY=Gt4(),ft4=Gv(),TiY="weighted_round_robin";function Hg8(A){GiY.trace(WiY.LogVerbosity.DEBUG,TiY,A)}var jg8="weighted_round_robin",ViY=1e4,NiY=1e4,viY=180000,kiY=1000,EiY=1;function Tt4(A,q,K){if(q in A&&A[q]!==void 0&&typeof A[q]!==K)throw Error(`weighted round robin config ${q} parse error: expected ${K}, got ${typeof A[q]}`)}function HE1(A,q){if(q in A&&A[q]!==void 0&&A[q]!==null){let K;if((0,VL.isDuration)(A[q]))K=A[q];else if((0,VL.isDurationMessage)(A[q]))K=(0,VL.durationMessageToDuration)(A[q]);else if(typeof A[q]==="string"){let Y=(0,VL.parseDuration)(A[q]);if(!Y)throw Error(`weighted round robin config ${q}: failed to parse duration string ${A[q]}`);K=Y}else throw Error(`weighted round robin config ${q}: expected duration, got ${typeof A[q]}`);return(0,VL.durationToMs)(K)}return null}class pn6{constructor(A,q,K,Y,z,w){this.enableOobLoadReport=A!==null&&A!==void 0?A:!1,this.oobLoadReportingPeriodMs=q!==null&&q!==void 0?q:ViY,this.blackoutPeriodMs=K!==null&&K!==void 0?K:NiY,this.weightExpirationPeriodMs=Y!==null&&Y!==void 0?Y:viY,this.weightUpdatePeriodMs=Math.max(z!==null&&z!==void 0?z:kiY,100),this.errorUtilizationPenalty=w!==null&&w!==void 0?w:EiY}getLoadBalancerName(){return jg8}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,VL.durationToString)((0,VL.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,VL.durationToString)((0,VL.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,VL.durationToString)((0,VL.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,VL.durationToString)((0,VL.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(A){if(Tt4(A,"enable_oob_load_report","boolean"),Tt4(A,"error_utilization_penalty","number"),A.error_utilization_penalty<0)throw Error("weighted round robin config error_utilization_penalty < 0");return new pn6(A.enable_oob_load_report,HE1(A,"oob_load_reporting_period"),HE1(A,"blackout_period"),HE1(A,"weight_expiration_period"),HE1(A,"weight_update_period"),A.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}}Et4.WeightedRoundRobinLoadBalancingConfig=pn6;class vt4{constructor(A,q){this.metricsHandler=q,this.queue=new fiY.PriorityQueue((z,w)=>z.deadlinez.weight>0),Y;if(K.length<2)Y=1;else{let z=0;for(let{weight:w}of K)z+=w;Y=z/K.length}for(let z of A){let w=z.weight>0?1/z.weight:Y;this.queue.push({endpointName:z.endpointName,picker:z.picker,period:w,deadline:Math.random()*w})}}pick(A){let q=this.queue.pop();this.queue.push(Object.assign(Object.assign({},q),{deadline:q.deadline+q.period}));let K=q.picker.pick(A);if(K.pickResultType===gN6.PickResultType.COMPLETE)if(this.metricsHandler)return Object.assign(Object.assign({},K),{onCallEnded:(0,Nt4.createMetricsReader)((Y)=>this.metricsHandler(Y,q.endpointName),K.onCallEnded)});else{let Y=K.subchannel;return Object.assign(Object.assign({},K),{subchannel:Y.getWrappedSubchannel()})}else return K}}class kt4{constructor(A){this.channelControlHelper=A,this.latestConfig=null,this.children=new Map,this.currentState=uP.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(A){let q=0;for(let K of this.children.values())if(K.child.getConnectivityState()===A)q+=1;return q}updateWeight(A,q){var K,Y;let{rps_fractional:z,application_utilization:w}=q;if(w>0&&z>0)w+=q.eps/z*((Y=(K=this.latestConfig)===null||K===void 0?void 0:K.getErrorUtilizationPenalty())!==null&&Y!==void 0?Y:0);let _=w===0?0:z/w;if(_===0)return;let $=new Date;if(A.nonEmptySince===null)A.nonEmptySince=$;A.lastUpdated=$,A.weight=_}getWeight(A){if(!this.latestConfig)return 0;let q=new Date().getTime();if(q-A.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return A.nonEmptySince=null,0;let K=this.latestConfig.getBlackoutPeriodMs();if(K>0&&(A.nonEmptySince===null||q-A.nonEmptySince.getTime()0){let A=[];for(let[K,Y]of this.children){if(Y.child.getConnectivityState()!==uP.ConnectivityState.READY)continue;A.push({endpointName:K,picker:Y.child.getPicker(),weight:this.getWeight(Y)})}Hg8("Created picker with weights: "+A.map((K)=>K.endpointName+":"+K.weight).join(","));let q;if(!this.latestConfig.getEnableOobLoadReport())q=(K,Y)=>{let z=this.children.get(Y);if(z)this.updateWeight(z,K)};else q=null;this.updateState(uP.ConnectivityState.READY,new vt4(A,q),null)}else if(this.countChildrenWithState(uP.ConnectivityState.CONNECTING)>0)this.updateState(uP.ConnectivityState.CONNECTING,new gN6.QueuePicker(this),null);else if(this.countChildrenWithState(uP.ConnectivityState.TRANSIENT_FAILURE)>0){let A=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(uP.ConnectivityState.TRANSIENT_FAILURE,new gN6.UnavailablePicker({details:A}),A)}else this.updateState(uP.ConnectivityState.IDLE,new gN6.QueuePicker(this),null);for(let{child:A}of this.children.values())if(A.getConnectivityState()===uP.ConnectivityState.IDLE)A.exitIdle()}updateState(A,q,K){Hg8(uP.ConnectivityState[this.currentState]+" -> "+uP.ConnectivityState[A]),this.currentState=A,this.channelControlHelper.updateState(A,q,K)}updateAddressList(A,q,K,Y){var z,w;if(!(q instanceof pn6))return!1;if(!A.ok){if(this.children.size===0)this.updateState(uP.ConnectivityState.TRANSIENT_FAILURE,new gN6.UnavailablePicker(A.error),A.error.details);return!0}if(A.value.length===0){let O=`No addresses resolved. Resolution note: ${Y}`;return this.updateState(uP.ConnectivityState.TRANSIENT_FAILURE,new gN6.UnavailablePicker({details:O}),O),!1}Hg8("Connect to endpoint list "+A.value.map(ft4.endpointToString));let _=new Date,$=new Set;this.updatesPaused=!0,this.latestConfig=q;for(let O of A.value){let H=(0,ft4.endpointToString)(O);$.add(H);let j=this.children.get(H);if(!j)j={child:new ZiY.LeafLoadBalancer(O,(0,Vt4.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(J,M,D)=>{if(this.currentState===uP.ConnectivityState.READY&&J!==uP.ConnectivityState.READY)this.channelControlHelper.requestReresolution();if(J===uP.ConnectivityState.READY)j.nonEmptySince=null;if(D)this.lastError=D;this.calculateAndUpdateState()},createSubchannel:(J,M)=>{let D=this.channelControlHelper.createSubchannel(J,M);if(j===null||j===void 0?void 0:j.oobMetricsListener)return new Nt4.OrcaOobMetricsSubchannelWrapper(D,j.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs());else return D}}),K,Y),lastUpdated:_,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(H,j);if(q.getEnableOobLoadReport())j.oobMetricsListener=(J)=>{this.updateWeight(j,J)};else j.oobMetricsListener=null}for(let[O,H]of this.children)if($.has(O))H.child.startConnecting();else H.child.destroy(),this.children.delete(O);if(this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer)clearInterval(this.weightUpdateTimer);return this.weightUpdateTimer=(w=(z=setInterval(()=>{if(this.currentState===uP.ConnectivityState.READY)this.calculateAndUpdateState()},q.getWeightUpdatePeriodMs())).unref)===null||w===void 0?void 0:w.call(z),!0}exitIdle(){}resetBackoff(){}destroy(){for(let A of this.children.values())A.child.destroy();if(this.children.clear(),this.weightUpdateTimer)clearInterval(this.weightUpdateTimer)}getTypeName(){return jg8}}function LiY(){(0,Vt4.registerLoadBalancerType)(jg8,kt4,pn6)}});var dn6=C((y2)=>{Object.defineProperty(y2,"__esModule",{value:!0});y2.experimental=y2.ServerMetricRecorder=y2.ServerInterceptingCall=y2.ResponderBuilder=y2.ServerListenerBuilder=y2.addAdminServicesToServer=y2.getChannelzHandlers=y2.getChannelzServiceDefinition=y2.InterceptorConfigurationError=y2.InterceptingCall=y2.RequesterBuilder=y2.ListenerBuilder=y2.StatusBuilder=y2.getClientChannel=y2.ServerCredentials=y2.Server=y2.setLogVerbosity=y2.setLogger=y2.load=y2.loadObject=y2.CallCredentials=y2.ChannelCredentials=y2.waitForClientReady=y2.closeClient=y2.Channel=y2.makeGenericClientConstructor=y2.makeClientConstructor=y2.loadPackageDefinition=y2.Client=y2.compressionAlgorithms=y2.propagate=y2.connectivityState=y2.status=y2.logVerbosity=y2.Metadata=y2.credentials=void 0;var jE1=nv1();Object.defineProperty(y2,"CallCredentials",{enumerable:!0,get:function(){return jE1.CallCredentials}});var RiY=HB8();Object.defineProperty(y2,"Channel",{enumerable:!0,get:function(){return RiY.ChannelImplementation}});var SiY=$m8();Object.defineProperty(y2,"compressionAlgorithms",{enumerable:!0,get:function(){return SiY.CompressionAlgorithms}});var CiY=dT();Object.defineProperty(y2,"connectivityState",{enumerable:!0,get:function(){return CiY.ConnectivityState}});var JE1=jN6();Object.defineProperty(y2,"ChannelCredentials",{enumerable:!0,get:function(){return JE1.ChannelCredentials}});var Rt4=OB8();Object.defineProperty(y2,"Client",{enumerable:!0,get:function(){return Rt4.Client}});var Jg8=E9();Object.defineProperty(y2,"logVerbosity",{enumerable:!0,get:function(){return Jg8.LogVerbosity}});Object.defineProperty(y2,"status",{enumerable:!0,get:function(){return Jg8.Status}});Object.defineProperty(y2,"propagate",{enumerable:!0,get:function(){return Jg8.Propagate}});var St4=m_(),Mg8=wk1();Object.defineProperty(y2,"loadPackageDefinition",{enumerable:!0,get:function(){return Mg8.loadPackageDefinition}});Object.defineProperty(y2,"makeClientConstructor",{enumerable:!0,get:function(){return Mg8.makeClientConstructor}});Object.defineProperty(y2,"makeGenericClientConstructor",{enumerable:!0,get:function(){return Mg8.makeClientConstructor}});var hiY=hP();Object.defineProperty(y2,"Metadata",{enumerable:!0,get:function(){return hiY.Metadata}});var IiY=Vs4();Object.defineProperty(y2,"Server",{enumerable:!0,get:function(){return IiY.Server}});var biY=ok1();Object.defineProperty(y2,"ServerCredentials",{enumerable:!0,get:function(){return biY.ServerCredentials}});var xiY=Es4();Object.defineProperty(y2,"StatusBuilder",{enumerable:!0,get:function(){return xiY.StatusBuilder}});y2.credentials={combineChannelCredentials:(A,...q)=>{return q.reduce((K,Y)=>K.compose(Y),A)},combineCallCredentials:(A,...q)=>{return q.reduce((K,Y)=>K.compose(Y),A)},createInsecure:JE1.ChannelCredentials.createInsecure,createSsl:JE1.ChannelCredentials.createSsl,createFromSecureContext:JE1.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:jE1.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:jE1.CallCredentials.createFromGoogleCredential,createEmpty:jE1.CallCredentials.createEmpty};var uiY=(A)=>A.close();y2.closeClient=uiY;var BiY=(A,q,K)=>A.waitForReady(q,K);y2.waitForClientReady=BiY;var miY=(A,q)=>{throw Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};y2.loadObject=miY;var giY=(A,q,K)=>{throw Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};y2.load=giY;var FiY=(A)=>{St4.setLogger(A)};y2.setLogger=FiY;var QiY=(A)=>{St4.setLoggerVerbosity(A)};y2.setLogVerbosity=QiY;var UiY=(A)=>{return Rt4.Client.prototype.getChannel.call(A)};y2.getClientChannel=UiY;var ME1=_B8();Object.defineProperty(y2,"ListenerBuilder",{enumerable:!0,get:function(){return ME1.ListenerBuilder}});Object.defineProperty(y2,"RequesterBuilder",{enumerable:!0,get:function(){return ME1.RequesterBuilder}});Object.defineProperty(y2,"InterceptingCall",{enumerable:!0,get:function(){return ME1.InterceptingCall}});Object.defineProperty(y2,"InterceptorConfigurationError",{enumerable:!0,get:function(){return ME1.InterceptorConfigurationError}});var Ct4=I86();Object.defineProperty(y2,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return Ct4.getChannelzServiceDefinition}});Object.defineProperty(y2,"getChannelzHandlers",{enumerable:!0,get:function(){return Ct4.getChannelzHandlers}});var piY=Yk1();Object.defineProperty(y2,"addAdminServicesToServer",{enumerable:!0,get:function(){return piY.addAdminServicesToServer}});var Dg8=pm8();Object.defineProperty(y2,"ServerListenerBuilder",{enumerable:!0,get:function(){return Dg8.ServerListenerBuilder}});Object.defineProperty(y2,"ResponderBuilder",{enumerable:!0,get:function(){return Dg8.ResponderBuilder}});Object.defineProperty(y2,"ServerInterceptingCall",{enumerable:!0,get:function(){return Dg8.ServerInterceptingCall}});var diY=sk1();Object.defineProperty(y2,"ServerMetricRecorder",{enumerable:!0,get:function(){return diY.ServerMetricRecorder}});var ciY=am8();y2.experimental=ciY;var liY=Gm8(),iiY=is4(),niY=es4(),riY=mn6(),oiY=_t4(),aiY=Xt4(),siY=yt4(),tiY=I86();(()=>{liY.setup(),iiY.setup(),niY.setup(),riY.setup(),oiY.setup(),aiY.setup(),siY.setup(),tiY.setup()})()});var xt4=C((It4)=>{Object.defineProperty(It4,"__esModule",{value:!0});It4.createServiceClientConstructor=void 0;var $nY=dn6();function OnY(A,q){let K={export:{path:A,requestStream:!1,responseStream:!1,requestSerialize:(Y)=>{return Y},requestDeserialize:(Y)=>{return Y},responseSerialize:(Y)=>{return Y},responseDeserialize:(Y)=>{return Y}}};return $nY.makeGenericClientConstructor(K,q)}It4.createServiceClientConstructor=OnY});var cn6=C((Bt4)=>{Object.defineProperty(Bt4,"__esModule",{value:!0});Bt4.createOtlpGrpcExporterTransport=Bt4.GrpcExporterTransport=Bt4.createEmptyMetadata=Bt4.createSslCredentials=Bt4.createInsecureCredentials=void 0;var HnY=ec4(),ut4=`OTel-OTLP-Exporter-JavaScript/${HnY.VERSION}`;function jnY(A){if(A)return`${A} ${ut4}`;return ut4}var JnY=0,MnY=2;function DnY(A){return A==="gzip"?MnY:JnY}function XnY(){let{credentials:A}=dn6();return A.createInsecure()}Bt4.createInsecureCredentials=XnY;function PnY(A,q,K){let{credentials:Y}=dn6();return Y.createSsl(A,q,K)}Bt4.createSslCredentials=PnY;function WnY(){let{Metadata:A}=dn6();return new A}Bt4.createEmptyMetadata=WnY;class Xg8{_parameters;_client;_metadata;constructor(A){this._parameters=A}shutdown(){this._client?.close()}send(A,q){let K=Buffer.from(A);if(this._client==null){let{createServiceClientConstructor:Y}=xt4();try{this._metadata=this._parameters.metadata()}catch(w){return Promise.resolve({status:"failure",error:w})}let z=Y(this._parameters.grpcPath,this._parameters.grpcName);try{this._client=new z(this._parameters.address,this._parameters.credentials(),{"grpc.default_compression_algorithm":DnY(this._parameters.compression),"grpc.primary_user_agent":jnY(this._parameters.userAgent)})}catch(w){return Promise.resolve({status:"failure",error:w})}}return new Promise((Y)=>{let z=Date.now()+q;if(this._metadata==null)return Y({error:Error("metadata was null"),status:"failure"});this._client.export(K,this._metadata,{deadline:z},(w,_)=>{if(w)Y({status:"failure",error:w});else Y({data:_,status:"success"})})})}}Bt4.GrpcExporterTransport=Xg8;function ZnY(A){return new Xg8(A)}Bt4.createOtlpGrpcExporterTransport=ZnY});var ct4=C((pt4)=>{Object.defineProperty(pt4,"__esModule",{value:!0});pt4.getOtlpGrpcDefaultConfiguration=pt4.mergeOtlpGrpcConfigurationWithDefaults=pt4.validateAndNormalizeUrl=void 0;var Qt4=vQ(),ln6=cn6(),NnY=g6("url"),gt4=nq();function Ut4(A){if(A=A.trim(),!A.match(/^([\w]{1,8}):\/\//))A=`https://${A}`;let K=new NnY.URL(A);if(K.protocol==="unix:")return A;if(K.pathname&&K.pathname!=="/")gt4.diag.warn("URL path should not be set when using grpc, the path part of the URL will be ignored.");if(K.protocol!==""&&!K.protocol?.match(/^(http)s?:$/))gt4.diag.warn("URL protocol should be http(s)://. Using http://.");return K.host}pt4.validateAndNormalizeUrl=Ut4;function Ft4(A,q){for(let[K,Y]of Object.entries(q.getMap()))if(A.get(K).length<1)A.set(K,Y)}function vnY(A,q,K){let Y=A.url??q.url??K.url;return{...(0,Qt4.mergeOtlpSharedConfigurationWithDefaults)(A,q,K),metadata:()=>{let z=K.metadata();return Ft4(z,A.metadata?.().clone()??(0,ln6.createEmptyMetadata)()),Ft4(z,q.metadata?.()??(0,ln6.createEmptyMetadata)()),z},url:Ut4(Y),credentials:A.credentials??q.credentials?.(Y)??K.credentials(Y),userAgent:A.userAgent}}pt4.mergeOtlpGrpcConfigurationWithDefaults=vnY;function knY(){return{...(0,Qt4.getSharedConfigurationDefaults)(),metadata:()=>(0,ln6.createEmptyMetadata)(),url:"http://localhost:4317",credentials:(A)=>{if(A.startsWith("http://"))return()=>(0,ln6.createInsecureCredentials)();else return()=>(0,ln6.createSslCredentials)()}}}pt4.getOtlpGrpcDefaultConfiguration=knY});var st4=C((ot4)=>{Object.defineProperty(ot4,"__esModule",{value:!0});ot4.getOtlpGrpcConfigurationFromEnv=void 0;var lt4=b9(),in6=cn6(),ynY=Mn(),RnY=g6("fs"),SnY=g6("path"),nt4=nq();function Pg8(A,q){if(A!=null&&A!=="")return A;if(q!=null&&q!=="")return q;return}function CnY(A){let q=process.env[`OTEL_EXPORTER_OTLP_${A}_HEADERS`]?.trim(),K=process.env.OTEL_EXPORTER_OTLP_HEADERS?.trim(),Y=(0,lt4.parseKeyPairsIntoRecord)(q),z=(0,lt4.parseKeyPairsIntoRecord)(K);if(Object.keys(Y).length===0&&Object.keys(z).length===0)return;let w=Object.assign({},z,Y),_=(0,in6.createEmptyMetadata)();for(let[$,O]of Object.entries(w))_.set($,O);return _}function hnY(A){let q=CnY(A);if(q==null)return;return()=>q}function InY(A){let q=process.env[`OTEL_EXPORTER_OTLP_${A}_ENDPOINT`]?.trim(),K=process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();return Pg8(q,K)}function bnY(A){let q=process.env[`OTEL_EXPORTER_OTLP_${A}_INSECURE`]?.toLowerCase().trim(),K=process.env.OTEL_EXPORTER_OTLP_INSECURE?.toLowerCase().trim();return Pg8(q,K)==="true"}function Wg8(A,q,K){let Y=process.env[A]?.trim(),z=process.env[q]?.trim(),w=Pg8(Y,z);if(w!=null)try{return RnY.readFileSync(SnY.resolve(process.cwd(),w))}catch{nt4.diag.warn(K);return}else return}function xnY(A){return Wg8(`OTEL_EXPORTER_OTLP_${A}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function unY(A){return Wg8(`OTEL_EXPORTER_OTLP_${A}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function it4(A){return Wg8(`OTEL_EXPORTER_OTLP_${A}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function rt4(A){let q=unY(A),K=xnY(A),Y=it4(A),z=q!=null&&K!=null;if(Y!=null&&!z)return nt4.diag.warn("Client key and certificate must both be provided, but one was missing - attempting to create credentials from just the root certificate"),(0,in6.createSslCredentials)(it4(A));return(0,in6.createSslCredentials)(Y,q,K)}function BnY(A){if(bnY(A))return(0,in6.createInsecureCredentials)();return rt4(A)}function mnY(A){return{...(0,ynY.getSharedConfigurationFromEnvironment)(A),metadata:hnY(A),url:InY(A),credentials:(q)=>{if(q.startsWith("http://"))return()=>{return(0,in6.createInsecureCredentials)()};else if(q.startsWith("https://"))return()=>{return rt4(A)};return()=>{return BnY(A)}}}}ot4.getOtlpGrpcConfigurationFromEnv=mnY});var qe4=C((et4)=>{Object.defineProperty(et4,"__esModule",{value:!0});et4.convertLegacyOtlpGrpcOptions=void 0;var gnY=nq(),tt4=ct4(),FnY=cn6(),QnY=st4();function UnY(A,q){if(A.headers)gnY.diag.warn("Headers cannot be set when using grpc");let K=A.credentials;return(0,tt4.mergeOtlpGrpcConfigurationWithDefaults)({url:A.url,metadata:()=>{return A.metadata??(0,FnY.createEmptyMetadata)()},compression:A.compression,timeoutMillis:A.timeoutMillis,concurrencyLimit:A.concurrencyLimit,credentials:K!=null?()=>K:void 0,userAgent:A.userAgent},(0,QnY.getOtlpGrpcConfigurationFromEnv)(q),(0,tt4.getOtlpGrpcDefaultConfiguration)())}et4.convertLegacyOtlpGrpcOptions=UnY});var ze4=C((Ke4)=>{Object.defineProperty(Ke4,"__esModule",{value:!0});Ke4.createOtlpGrpcExportDelegate=void 0;var pnY=vQ(),dnY=cn6();function cnY(A,q,K,Y){return(0,pnY.createOtlpNetworkExportDelegate)(A,q,(0,dnY.createOtlpGrpcExporterTransport)({address:A.url,compression:A.compression,credentials:A.credentials,metadata:A.metadata,userAgent:A.userAgent,grpcName:K,grpcPath:Y}))}Ke4.createOtlpGrpcExportDelegate=cnY});var XE1=C((DE1)=>{Object.defineProperty(DE1,"__esModule",{value:!0});DE1.createOtlpGrpcExportDelegate=DE1.convertLegacyOtlpGrpcOptions=void 0;var lnY=qe4();Object.defineProperty(DE1,"convertLegacyOtlpGrpcOptions",{enumerable:!0,get:function(){return lnY.convertLegacyOtlpGrpcOptions}});var inY=ze4();Object.defineProperty(DE1,"createOtlpGrpcExportDelegate",{enumerable:!0,get:function(){return inY.createOtlpGrpcExportDelegate}})});var He4=C(($e4)=>{Object.defineProperty($e4,"__esModule",{value:!0});$e4.OTLPMetricExporter=void 0;var rnY=pv1(),we4=XE1(),onY=LQ();class _e4 extends rnY.OTLPMetricExporterBase{constructor(A){super((0,we4.createOtlpGrpcExportDelegate)((0,we4.convertLegacyOtlpGrpcOptions)(A??{},"METRICS"),onY.ProtobufMetricsSerializer,"MetricsExportService","/opentelemetry.proto.collector.metrics.v1.MetricsService/Export"),A)}}$e4.OTLPMetricExporter=_e4});var je4=C((Zg8)=>{Object.defineProperty(Zg8,"__esModule",{value:!0});Zg8.OTLPMetricExporter=void 0;var anY=He4();Object.defineProperty(Zg8,"OTLPMetricExporter",{enumerable:!0,get:function(){return anY.OTLPMetricExporter}})});var Tg8=C((Xe4)=>{Object.defineProperty(Xe4,"__esModule",{value:!0});Xe4.PrometheusSerializer=void 0;var tnY=nq(),K26=Z86(),Je4=b9();function WE1(A){return A.replace(/\\/g,"\\\\").replace(/\n/g,"\\n")}function Me4(A=""){if(typeof A!=="string")A=JSON.stringify(A);return WE1(A).replace(/"/g,"\\\"")}var enY=/[^a-z0-9_]/gi,ArY=/_{2,}/g;function fg8(A){return A.replace(enY,"_").replace(ArY,"_")}function Gg8(A,q){if(!A.endsWith("_total")&&q.dataPointType===K26.DataPointType.SUM&&q.isMonotonic)A=A+"_total";return A}function qrY(A){if(A===1/0)return"+Inf";else if(A===-1/0)return"-Inf";else return`${A}`}function KrY(A){switch(A.dataPointType){case K26.DataPointType.SUM:if(A.isMonotonic)return"counter";return"gauge";case K26.DataPointType.GAUGE:return"gauge";case K26.DataPointType.HISTOGRAM:return"histogram";default:return"untyped"}}function PE1(A,q,K,Y,z){let w=!1,_="";for(let[$,O]of Object.entries(q)){let H=fg8($);w=!0,_+=`${_.length>0?",":""}${H}="${Me4(O)}"`}if(z)for(let[$,O]of Object.entries(z)){let H=fg8($);w=!0,_+=`${_.length>0?",":""}${H}="${Me4(O)}"`}if(w)A+=`{${_}}`;return`${A} ${qrY(K)}${Y!==void 0?" "+String(Y):""} `}var YrY="# no registered metrics";class De4{_prefix;_appendTimestamp;_additionalAttributes;_withResourceConstantLabels;_withoutTargetInfo;constructor(A,q=!1,K,Y){if(A)this._prefix=A+"_";this._appendTimestamp=q,this._withResourceConstantLabels=K,this._withoutTargetInfo=!!Y}serialize(A){let q="";this._additionalAttributes=this._filterResourceConstantLabels(A.resource.attributes,this._withResourceConstantLabels);for(let K of A.scopeMetrics)q+=this._serializeScopeMetrics(K);if(q==="")q+=YrY;return this._serializeResource(A.resource)+q}_filterResourceConstantLabels(A,q){if(q){let K={};for(let[Y,z]of Object.entries(A))if(Y.match(q))K[Y]=z;return K}return}_serializeScopeMetrics(A){let q="";for(let K of A.metrics)q+=this._serializeMetricData(K)+` `;return q}_serializeMetricData(A){let q=fg8(WE1(A.descriptor.name));if(this._prefix)q=`${this._prefix}${q}`;let K=A.dataPointType;q=Gg8(q,A);let Y=`# HELP ${q} ${WE1(A.descriptor.description||"description missing")}`,z=A.descriptor.unit?` # UNIT ${q} ${WE1(A.descriptor.unit)}`:"",w=`# TYPE ${q} ${KrY(A)}`,_="";switch(K){case K26.DataPointType.SUM:case K26.DataPointType.GAUGE:{_=A.dataPoints.map(($)=>this._serializeSingularDataPoint(q,A,$)).join("");break}case K26.DataPointType.HISTOGRAM:{_=A.dataPoints.map(($)=>this._serializeHistogramDataPoint(q,A,$)).join("");break}default:tnY.diag.error(`Unrecognizable DataPointType: ${K} for metric "${q}"`)}return`${Y}${z} ${w} ${_}`.trim()}_serializeSingularDataPoint(A,q,K){let Y="";A=Gg8(A,q);let{value:z,attributes:w}=K,_=(0,Je4.hrTimeToMilliseconds)(K.endTime);return Y+=PE1(A,w,z,this._appendTimestamp?_:void 0,this._additionalAttributes),Y}_serializeHistogramDataPoint(A,q,K){let Y="";A=Gg8(A,q);let{attributes:z,value:w}=K,_=(0,Je4.hrTimeToMilliseconds)(K.endTime);for(let j of["count","sum"]){let J=w[j];if(J!=null)Y+=PE1(A+"_"+j,z,J,this._appendTimestamp?_:void 0,this._additionalAttributes)}let $=0,O=w.buckets.counts.entries(),H=!1;for(let[j,J]of O){$+=J;let M=w.buckets.boundaries[j];if(M===void 0&&H)break;if(M===1/0)H=!0;Y+=PE1(A+"_bucket",z,$,this._appendTimestamp?_:void 0,Object.assign({},this._additionalAttributes??{},{le:M===void 0||M===1/0?"+Inf":String(M)}))}return Y}_serializeResource(A){if(this._withoutTargetInfo===!0)return"";let q="target_info",K=`# HELP ${q} Target metadata`,Y=`# TYPE ${q} gauge`,z=PE1(q,A.attributes,1).trim();return`${K} ${Y} ${z} `}}Xe4.PrometheusSerializer=De4});var Ge4=C((We4)=>{Object.defineProperty(We4,"__esModule",{value:!0});We4.PrometheusExporter=void 0;var nn6=nq(),zrY=b9(),Vg8=Z86(),wrY=g6("http"),_rY=Tg8(),$rY=g6("url");class vn extends Vg8.MetricReader{static DEFAULT_OPTIONS={host:void 0,port:9464,endpoint:"/metrics",prefix:"",appendTimestamp:!1,withResourceConstantLabels:void 0,withoutTargetInfo:!1};_host;_port;_baseUrl;_endpoint;_server;_prefix;_appendTimestamp;_serializer;_startServerPromise;constructor(A={},q=()=>{}){super({aggregationSelector:(z)=>{return{type:Vg8.AggregationType.DEFAULT}},aggregationTemporalitySelector:(z)=>Vg8.AggregationTemporality.CUMULATIVE,metricProducers:A.metricProducers});this._host=A.host||process.env.OTEL_EXPORTER_PROMETHEUS_HOST||vn.DEFAULT_OPTIONS.host,this._port=A.port||Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT)||vn.DEFAULT_OPTIONS.port,this._prefix=A.prefix||vn.DEFAULT_OPTIONS.prefix,this._appendTimestamp=typeof A.appendTimestamp==="boolean"?A.appendTimestamp:vn.DEFAULT_OPTIONS.appendTimestamp;let K=A.withResourceConstantLabels||vn.DEFAULT_OPTIONS.withResourceConstantLabels,Y=A.withoutTargetInfo||vn.DEFAULT_OPTIONS.withoutTargetInfo;if(this._server=(0,wrY.createServer)(this._requestHandler).unref(),this._serializer=new _rY.PrometheusSerializer(this._prefix,this._appendTimestamp,K,Y),this._baseUrl=`http://${this._host}:${this._port}/`,this._endpoint=(A.endpoint||vn.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/,"/$1"),A.preventServerStart!==!0)this.startServer().then(q,(z)=>{nn6.diag.error(z),q(z)});else if(q)queueMicrotask(q)}async onForceFlush(){}onShutdown(){return this.stopServer()}stopServer(){if(!this._server)return nn6.diag.debug("Prometheus stopServer() was called but server was never started."),Promise.resolve();else return new Promise((A)=>{this._server.close((q)=>{if(!q)nn6.diag.debug("Prometheus exporter was stopped");else if(q.code!=="ERR_SERVER_NOT_RUNNING")(0,zrY.globalErrorHandler)(q);A()})})}startServer(){return this._startServerPromise??=new Promise((A,q)=>{this._server.once("error",q),this._server.listen({port:this._port,host:this._host},()=>{nn6.diag.debug(`Prometheus exporter server started: ${this._host}:${this._port}/${this._endpoint}`),A()})}),this._startServerPromise}getMetricsRequestHandler(A,q){this._exportMetrics(q)}_requestHandler=(A,q)=>{if(A.url!=null&&new $rY.URL(A.url,this._baseUrl).pathname===this._endpoint)this._exportMetrics(q);else this._notFound(q)};_exportMetrics=(A)=>{A.statusCode=200,A.setHeader("content-type","text/plain"),this.collect().then((q)=>{let{resourceMetrics:K,errors:Y}=q;if(Y.length)nn6.diag.error("PrometheusExporter: metrics collection errors",...Y);A.end(this._serializer.serialize(K))},(q)=>{A.end(`# failed to export metrics: ${q}`)})};_notFound=(A)=>{A.statusCode=404,A.end()}}We4.PrometheusExporter=vn});var fe4=C((ZE1)=>{Object.defineProperty(ZE1,"__esModule",{value:!0});ZE1.PrometheusSerializer=ZE1.PrometheusExporter=void 0;var OrY=Ge4();Object.defineProperty(ZE1,"PrometheusExporter",{enumerable:!0,get:function(){return OrY.PrometheusExporter}});var HrY=Tg8();Object.defineProperty(ZE1,"PrometheusSerializer",{enumerable:!0,get:function(){return HrY.PrometheusSerializer}})});var ke4=C((Ne4)=>{Object.defineProperty(Ne4,"__esModule",{value:!0});Ne4.OTLPLogExporter=void 0;var JrY=vQ(),MrY=LQ(),Te4=Mn();class Ve4 extends JrY.OTLPExporterBase{constructor(A={}){super((0,Te4.createOtlpHttpExportDelegate)((0,Te4.convertLegacyHttpOptions)(A,"LOGS","v1/logs",{"Content-Type":"application/x-protobuf"}),MrY.ProtobufLogsSerializer))}}Ne4.OTLPLogExporter=Ve4});var Ee4=C((Ng8)=>{Object.defineProperty(Ng8,"__esModule",{value:!0});Ng8.OTLPLogExporter=void 0;var DrY=ke4();Object.defineProperty(Ng8,"OTLPLogExporter",{enumerable:!0,get:function(){return DrY.OTLPLogExporter}})});var Le4=C((vg8)=>{Object.defineProperty(vg8,"__esModule",{value:!0});vg8.OTLPLogExporter=void 0;var PrY=Ee4();Object.defineProperty(vg8,"OTLPLogExporter",{enumerable:!0,get:function(){return PrY.OTLPLogExporter}})});var ye4=C((kg8)=>{Object.defineProperty(kg8,"__esModule",{value:!0});kg8.OTLPLogExporter=void 0;var ZrY=Le4();Object.defineProperty(kg8,"OTLPLogExporter",{enumerable:!0,get:function(){return ZrY.OTLPLogExporter}})});var Ie4=C((Ce4)=>{Object.defineProperty(Ce4,"__esModule",{value:!0});Ce4.OTLPLogExporter=void 0;var Re4=XE1(),frY=LQ(),TrY=vQ();class Se4 extends TrY.OTLPExporterBase{constructor(A={}){super((0,Re4.createOtlpGrpcExportDelegate)((0,Re4.convertLegacyOtlpGrpcOptions)(A,"LOGS"),frY.ProtobufLogsSerializer,"LogsExportService","/opentelemetry.proto.collector.logs.v1.LogsService/Export"))}}Ce4.OTLPLogExporter=Se4});var be4=C((Eg8)=>{Object.defineProperty(Eg8,"__esModule",{value:!0});Eg8.OTLPLogExporter=void 0;var VrY=Ie4();Object.defineProperty(Eg8,"OTLPLogExporter",{enumerable:!0,get:function(){return VrY.OTLPLogExporter}})});var ge4=C((Be4)=>{Object.defineProperty(Be4,"__esModule",{value:!0});Be4.OTLPLogExporter=void 0;var vrY=vQ(),krY=LQ(),xe4=Mn();class ue4 extends vrY.OTLPExporterBase{constructor(A={}){super((0,xe4.createOtlpHttpExportDelegate)((0,xe4.convertLegacyHttpOptions)(A,"LOGS","v1/logs",{"Content-Type":"application/json"}),krY.JsonLogsSerializer))}}Be4.OTLPLogExporter=ue4});var Fe4=C((Lg8)=>{Object.defineProperty(Lg8,"__esModule",{value:!0});Lg8.OTLPLogExporter=void 0;var ErY=ge4();Object.defineProperty(Lg8,"OTLPLogExporter",{enumerable:!0,get:function(){return ErY.OTLPLogExporter}})});var Qe4=C((yg8)=>{Object.defineProperty(yg8,"__esModule",{value:!0});yg8.OTLPLogExporter=void 0;var yrY=Fe4();Object.defineProperty(yg8,"OTLPLogExporter",{enumerable:!0,get:function(){return yrY.OTLPLogExporter}})});var Ue4=C((Rg8)=>{Object.defineProperty(Rg8,"__esModule",{value:!0});Rg8.OTLPLogExporter=void 0;var SrY=Qe4();Object.defineProperty(Rg8,"OTLPLogExporter",{enumerable:!0,get:function(){return SrY.OTLPLogExporter}})});var ce4=C((pe4)=>{Object.defineProperty(pe4,"__esModule",{value:!0});pe4.ExceptionEventName=void 0;pe4.ExceptionEventName="exception"});var re4=C((ie4)=>{Object.defineProperty(ie4,"__esModule",{value:!0});ie4.SpanImpl=void 0;var CC=nq(),bG=b9(),Y26=AK6(),hrY=ce4();class le4{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;name;status={code:CC.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(A){let q=Date.now();if(this._spanContext=A.spanContext,this._performanceStartTime=bG.otperformance.now(),this._performanceOffset=q-(this._performanceStartTime+(0,bG.getTimeOrigin)()),this._startTimeProvided=A.startTime!=null,this._spanLimits=A.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,this._spanProcessor=A.spanProcessor,this.name=A.name,this.parentSpanContext=A.parentSpanContext,this.kind=A.kind,this.links=A.links||[],this.startTime=this._getTime(A.startTime??q),this.resource=A.resource,this.instrumentationScope=A.scope,A.attributes!=null)this.setAttributes(A.attributes);this._spanProcessor.onStart(this,A.context)}spanContext(){return this._spanContext}setAttribute(A,q){if(q==null||this._isSpanEnded())return this;if(A.length===0)return CC.diag.warn(`Invalid attribute key: ${A}`),this;if(!(0,bG.isAttributeValue)(q))return CC.diag.warn(`Invalid attribute value set for key: ${A}`),this;let{attributeCountLimit:K}=this._spanLimits;if(K!==void 0&&Object.keys(this.attributes).length>=K&&!Object.prototype.hasOwnProperty.call(this.attributes,A))return this._droppedAttributesCount++,this;return this.attributes[A]=this._truncateToSize(q),this}setAttributes(A){for(let[q,K]of Object.entries(A))this.setAttribute(q,K);return this}addEvent(A,q,K){if(this._isSpanEnded())return this;let{eventCountLimit:Y}=this._spanLimits;if(Y===0)return CC.diag.warn("No events allowed."),this._droppedEventsCount++,this;if(Y!==void 0&&this.events.length>=Y){if(this._droppedEventsCount===0)CC.diag.debug("Dropping extra events.");this.events.shift(),this._droppedEventsCount++}if((0,bG.isTimeInput)(q)){if(!(0,bG.isTimeInput)(K))K=q;q=void 0}let z=(0,bG.sanitizeAttributes)(q);return this.events.push({name:A,attributes:z,time:this._getTime(K),droppedAttributesCount:0}),this}addLink(A){return this.links.push(A),this}addLinks(A){return this.links.push(...A),this}setStatus(A){if(this._isSpanEnded())return this;if(this.status={...A},this.status.message!=null&&typeof A.message!=="string")CC.diag.warn(`Dropping invalid status.message of type '${typeof A.message}', expected 'string'`),delete this.status.message;return this}updateName(A){if(this._isSpanEnded())return this;return this.name=A,this}end(A){if(this._isSpanEnded()){CC.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}if(this._ended=!0,this.endTime=this._getTime(A),this._duration=(0,bG.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0)CC.diag.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0];if(this._droppedEventsCount>0)CC.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`);this._spanProcessor.onEnd(this)}_getTime(A){if(typeof A==="number"&&A<=bG.otperformance.now())return(0,bG.hrTime)(A+this._performanceOffset);if(typeof A==="number")return(0,bG.millisToHrTime)(A);if(A instanceof Date)return(0,bG.millisToHrTime)(A.getTime());if((0,bG.isTimeInputHrTime)(A))return A;if(this._startTimeProvided)return(0,bG.millisToHrTime)(Date.now());let q=bG.otperformance.now()-this._performanceStartTime;return(0,bG.addHrTimes)(this.startTime,(0,bG.millisToHrTime)(q))}isRecording(){return this._ended===!1}recordException(A,q){let K={};if(typeof A==="string")K[Y26.ATTR_EXCEPTION_MESSAGE]=A;else if(A){if(A.code)K[Y26.ATTR_EXCEPTION_TYPE]=A.code.toString();else if(A.name)K[Y26.ATTR_EXCEPTION_TYPE]=A.name;if(A.message)K[Y26.ATTR_EXCEPTION_MESSAGE]=A.message;if(A.stack)K[Y26.ATTR_EXCEPTION_STACKTRACE]=A.stack}if(K[Y26.ATTR_EXCEPTION_TYPE]||K[Y26.ATTR_EXCEPTION_MESSAGE])this.addEvent(hrY.ExceptionEventName,K,q);else CC.diag.warn(`Failed to record an exception ${A}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let A=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);CC.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,A)}return this._ended}_truncateToLimitUtil(A,q){if(A.length<=q)return A;return A.substring(0,q)}_truncateToSize(A){let q=this._attributeValueLengthLimit;if(q<=0)return CC.diag.warn(`Attribute value limit must be positive, got ${q}`),A;if(typeof A==="string")return this._truncateToLimitUtil(A,q);if(Array.isArray(A))return A.map((K)=>typeof K==="string"?this._truncateToLimitUtil(K,q):K);return A}}ie4.SpanImpl=le4});var rn6=C((oe4)=>{Object.defineProperty(oe4,"__esModule",{value:!0});oe4.SamplingDecision=void 0;var IrY;(function(A){A[A.NOT_RECORD=0]="NOT_RECORD",A[A.RECORD=1]="RECORD",A[A.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(IrY=oe4.SamplingDecision||(oe4.SamplingDecision={}))});var GE1=C((se4)=>{Object.defineProperty(se4,"__esModule",{value:!0});se4.AlwaysOffSampler=void 0;var brY=rn6();class ae4{shouldSample(){return{decision:brY.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}se4.AlwaysOffSampler=ae4});var fE1=C((A6q)=>{Object.defineProperty(A6q,"__esModule",{value:!0});A6q.AlwaysOnSampler=void 0;var xrY=rn6();class ee4{shouldSample(){return{decision:xrY.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}A6q.AlwaysOnSampler=ee4});var hg8=C((z6q)=>{Object.defineProperty(z6q,"__esModule",{value:!0});z6q.ParentBasedSampler=void 0;var TE1=nq(),urY=b9(),K6q=GE1(),Cg8=fE1();class Y6q{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(A){if(this._root=A.root,!this._root)(0,urY.globalErrorHandler)(Error("ParentBasedSampler must have a root sampler configured")),this._root=new Cg8.AlwaysOnSampler;this._remoteParentSampled=A.remoteParentSampled??new Cg8.AlwaysOnSampler,this._remoteParentNotSampled=A.remoteParentNotSampled??new K6q.AlwaysOffSampler,this._localParentSampled=A.localParentSampled??new Cg8.AlwaysOnSampler,this._localParentNotSampled=A.localParentNotSampled??new K6q.AlwaysOffSampler}shouldSample(A,q,K,Y,z,w){let _=TE1.trace.getSpanContext(A);if(!_||!(0,TE1.isSpanContextValid)(_))return this._root.shouldSample(A,q,K,Y,z,w);if(_.isRemote){if(_.traceFlags&TE1.TraceFlags.SAMPLED)return this._remoteParentSampled.shouldSample(A,q,K,Y,z,w);return this._remoteParentNotSampled.shouldSample(A,q,K,Y,z,w)}if(_.traceFlags&TE1.TraceFlags.SAMPLED)return this._localParentSampled.shouldSample(A,q,K,Y,z,w);return this._localParentNotSampled.shouldSample(A,q,K,Y,z,w)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}z6q.ParentBasedSampler=Y6q});var Ig8=C((O6q)=>{Object.defineProperty(O6q,"__esModule",{value:!0});O6q.TraceIdRatioBasedSampler=void 0;var BrY=nq(),_6q=rn6();class $6q{_ratio;_upperBound;constructor(A=0){this._ratio=A,this._ratio=this._normalize(A),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(A,q){return{decision:(0,BrY.isValidTraceId)(q)&&this._accumulate(q)=1?1:A<=0?0:A}_accumulate(A){let q=0;for(let K=0;K>>0}return q}}O6q.TraceIdRatioBasedSampler=$6q});var ug8=C((X6q)=>{Object.defineProperty(X6q,"__esModule",{value:!0});X6q.buildSamplerFromEnv=X6q.loadDefaultConfig=void 0;var xg8=nq(),QQ=b9(),j6q=GE1(),bg8=fE1(),VE1=hg8(),J6q=Ig8(),UQ;(function(A){A.AlwaysOff="always_off",A.AlwaysOn="always_on",A.ParentBasedAlwaysOff="parentbased_always_off",A.ParentBasedAlwaysOn="parentbased_always_on",A.ParentBasedTraceIdRatio="parentbased_traceidratio",A.TraceIdRatio="traceidratio"})(UQ||(UQ={}));var NE1=1;function mrY(){return{sampler:D6q(),forceFlushTimeoutMillis:30000,generalLimits:{attributeValueLengthLimit:(0,QQ.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,QQ.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:(0,QQ.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,QQ.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:(0,QQ.getNumberFromEnv)("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:(0,QQ.getNumberFromEnv)("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:(0,QQ.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:(0,QQ.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}X6q.loadDefaultConfig=mrY;function D6q(){let A=(0,QQ.getStringFromEnv)("OTEL_TRACES_SAMPLER")??UQ.ParentBasedAlwaysOn;switch(A){case UQ.AlwaysOn:return new bg8.AlwaysOnSampler;case UQ.AlwaysOff:return new j6q.AlwaysOffSampler;case UQ.ParentBasedAlwaysOn:return new VE1.ParentBasedSampler({root:new bg8.AlwaysOnSampler});case UQ.ParentBasedAlwaysOff:return new VE1.ParentBasedSampler({root:new j6q.AlwaysOffSampler});case UQ.TraceIdRatio:return new J6q.TraceIdRatioBasedSampler(M6q());case UQ.ParentBasedTraceIdRatio:return new VE1.ParentBasedSampler({root:new J6q.TraceIdRatioBasedSampler(M6q())});default:return xg8.diag.error(`OTEL_TRACES_SAMPLER value "${A}" invalid, defaulting to "${UQ.ParentBasedAlwaysOn}".`),new VE1.ParentBasedSampler({root:new bg8.AlwaysOnSampler})}}X6q.buildSamplerFromEnv=D6q;function M6q(){let A=(0,QQ.getNumberFromEnv)("OTEL_TRACES_SAMPLER_ARG");if(A==null)return xg8.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${NE1}.`),NE1;if(A<0||A>1)return xg8.diag.error(`OTEL_TRACES_SAMPLER_ARG=${A} was given, but it is out of range ([0..1]), defaulting to ${NE1}.`),NE1;return A}});var Bg8=C((Z6q)=>{Object.defineProperty(Z6q,"__esModule",{value:!0});Z6q.reconfigureLimits=Z6q.mergeConfig=Z6q.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=Z6q.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;var W6q=ug8(),vE1=b9();Z6q.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128;Z6q.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function FrY(A){let q={sampler:(0,W6q.buildSamplerFromEnv)()},K=(0,W6q.loadDefaultConfig)(),Y=Object.assign({},K,q,A);return Y.generalLimits=Object.assign({},K.generalLimits,A.generalLimits||{}),Y.spanLimits=Object.assign({},K.spanLimits,A.spanLimits||{}),Y}Z6q.mergeConfig=FrY;function QrY(A){let q=Object.assign({},A.spanLimits);return q.attributeCountLimit=A.spanLimits?.attributeCountLimit??A.generalLimits?.attributeCountLimit??(0,vE1.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??(0,vE1.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??Z6q.DEFAULT_ATTRIBUTE_COUNT_LIMIT,q.attributeValueLengthLimit=A.spanLimits?.attributeValueLengthLimit??A.generalLimits?.attributeValueLengthLimit??(0,vE1.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,vE1.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??Z6q.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},A,{spanLimits:q})}Z6q.reconfigureLimits=QrY});var k6q=C((N6q)=>{Object.defineProperty(N6q,"__esModule",{value:!0});N6q.BatchSpanProcessorBase=void 0;var FN6=nq(),kn=b9();class V6q{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(A,q){if(this._exporter=A,this._maxExportBatchSize=typeof q?.maxExportBatchSize==="number"?q.maxExportBatchSize:(0,kn.getNumberFromEnv)("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=typeof q?.maxQueueSize==="number"?q.maxQueueSize:(0,kn.getNumberFromEnv)("OTEL_BSP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=typeof q?.scheduledDelayMillis==="number"?q.scheduledDelayMillis:(0,kn.getNumberFromEnv)("OTEL_BSP_SCHEDULE_DELAY")??5000,this._exportTimeoutMillis=typeof q?.exportTimeoutMillis==="number"?q.exportTimeoutMillis:(0,kn.getNumberFromEnv)("OTEL_BSP_EXPORT_TIMEOUT")??30000,this._shutdownOnce=new kn.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize)FN6.diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize}forceFlush(){if(this._shutdownOnce.isCalled)return this._shutdownOnce.promise;return this._flushAll()}onStart(A,q){}onEnd(A){if(this._shutdownOnce.isCalled)return;if((A.spanContext().traceFlags&FN6.TraceFlags.SAMPLED)===0)return;this._addToBuffer(A)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>{return this.onShutdown()}).then(()=>{return this._flushAll()}).then(()=>{return this._exporter.shutdown()})}_addToBuffer(A){if(this._finishedSpans.length>=this._maxQueueSize){if(this._droppedSpansCount===0)FN6.diag.debug("maxQueueSize reached, dropping spans");this._droppedSpansCount++;return}if(this._droppedSpansCount>0)FN6.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0;this._finishedSpans.push(A),this._maybeStartTimer()}_flushAll(){return new Promise((A,q)=>{let K=[],Y=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let z=0,w=Y;z{A()}).catch(q)})}_flushOneBatch(){if(this._clearTimer(),this._finishedSpans.length===0)return Promise.resolve();return new Promise((A,q)=>{let K=setTimeout(()=>{q(Error("Timeout"))},this._exportTimeoutMillis);FN6.context.with((0,kn.suppressTracing)(FN6.context.active()),()=>{let Y;if(this._finishedSpans.length<=this._maxExportBatchSize)Y=this._finishedSpans,this._finishedSpans=[];else Y=this._finishedSpans.splice(0,this._maxExportBatchSize);let z=()=>this._exporter.export(Y,(_)=>{if(clearTimeout(K),_.code===kn.ExportResultCode.SUCCESS)A();else q(_.error??Error("BatchSpanProcessor: span export failed"))}),w=null;for(let _=0,$=Y.length;_<$;_++){let O=Y[_];if(O.resource.asyncAttributesPending&&O.resource.waitForAsyncAttributes)w??=[],w.push(O.resource.waitForAsyncAttributes())}if(w===null)z();else Promise.all(w).then(z,(_)=>{(0,kn.globalErrorHandler)(_),q(_)})})})}_maybeStartTimer(){if(this._isExporting)return;let A=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{if(this._isExporting=!1,this._finishedSpans.length>0)this._clearTimer(),this._maybeStartTimer()}).catch((q)=>{this._isExporting=!1,(0,kn.globalErrorHandler)(q)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return A();if(this._timer!==void 0)return;if(this._timer=setTimeout(()=>A(),this._scheduledDelayMillis),typeof this._timer!=="number")this._timer.unref()}_clearTimer(){if(this._timer!==void 0)clearTimeout(this._timer),this._timer=void 0}}N6q.BatchSpanProcessorBase=V6q});var R6q=C((L6q)=>{Object.defineProperty(L6q,"__esModule",{value:!0});L6q.BatchSpanProcessor=void 0;var prY=k6q();class E6q extends prY.BatchSpanProcessorBase{onShutdown(){}}L6q.BatchSpanProcessor=E6q});var x6q=C((I6q)=>{Object.defineProperty(I6q,"__esModule",{value:!0});I6q.RandomIdGenerator=void 0;var drY=8,C6q=16;class h6q{generateTraceId=S6q(C6q);generateSpanId=S6q(drY)}I6q.RandomIdGenerator=h6q;var kE1=Buffer.allocUnsafe(C6q);function S6q(A){return function(){for(let K=0;K>>0,K*4);for(let K=0;K0)break;else if(K===A-1)kE1[A-1]=1;return kE1.toString("hex",0,A)}}});var u6q=C((EE1)=>{Object.defineProperty(EE1,"__esModule",{value:!0});EE1.RandomIdGenerator=EE1.BatchSpanProcessor=void 0;var crY=R6q();Object.defineProperty(EE1,"BatchSpanProcessor",{enumerable:!0,get:function(){return crY.BatchSpanProcessor}});var lrY=x6q();Object.defineProperty(EE1,"RandomIdGenerator",{enumerable:!0,get:function(){return lrY.RandomIdGenerator}})});var mg8=C((LE1)=>{Object.defineProperty(LE1,"__esModule",{value:!0});LE1.RandomIdGenerator=LE1.BatchSpanProcessor=void 0;var B6q=u6q();Object.defineProperty(LE1,"BatchSpanProcessor",{enumerable:!0,get:function(){return B6q.BatchSpanProcessor}});Object.defineProperty(LE1,"RandomIdGenerator",{enumerable:!0,get:function(){return B6q.RandomIdGenerator}})});var Q6q=C((g6q)=>{Object.defineProperty(g6q,"__esModule",{value:!0});g6q.Tracer=void 0;var bW=nq(),yE1=b9(),rrY=re4(),orY=Bg8(),arY=mg8();class m6q{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;constructor(A,q,K,Y){let z=(0,orY.mergeConfig)(q);this._sampler=z.sampler,this._generalLimits=z.generalLimits,this._spanLimits=z.spanLimits,this._idGenerator=q.idGenerator||new arY.RandomIdGenerator,this._resource=K,this._spanProcessor=Y,this.instrumentationScope=A}startSpan(A,q={},K=bW.context.active()){if(q.root)K=bW.trace.deleteSpan(K);let Y=bW.trace.getSpan(K);if((0,yE1.isTracingSuppressed)(K))return bW.diag.debug("Instrumentation suppressed, returning Noop Span"),bW.trace.wrapSpanContext(bW.INVALID_SPAN_CONTEXT);let z=Y?.spanContext(),w=this._idGenerator.generateSpanId(),_,$,O;if(!z||!bW.trace.isSpanContextValid(z))$=this._idGenerator.generateTraceId();else $=z.traceId,O=z.traceState,_=z;let H=q.kind??bW.SpanKind.INTERNAL,j=(q.links??[]).map((Z)=>{return{context:Z.context,attributes:(0,yE1.sanitizeAttributes)(Z.attributes)}}),J=(0,yE1.sanitizeAttributes)(q.attributes),M=this._sampler.shouldSample(K,$,A,H,J,j);O=M.traceState??O;let D=M.decision===bW.SamplingDecision.RECORD_AND_SAMPLED?bW.TraceFlags.SAMPLED:bW.TraceFlags.NONE,X={traceId:$,spanId:w,traceFlags:D,traceState:O};if(M.decision===bW.SamplingDecision.NOT_RECORD)return bW.diag.debug("Recording is off, propagating context in a non-recording span"),bW.trace.wrapSpanContext(X);let P=(0,yE1.sanitizeAttributes)(Object.assign(J,M.attributes));return new rrY.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:K,spanContext:X,name:A,kind:H,links:j,parentSpanContext:_,attributes:P,startTime:q.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits})}startActiveSpan(A,q,K,Y){let z,w,_;if(arguments.length<2)return;else if(arguments.length===2)_=q;else if(arguments.length===3)z=q,_=K;else z=q,w=K,_=Y;let $=w??bW.context.active(),O=this.startSpan(A,z,$),H=bW.trace.setSpan($,O);return bW.context.with(H,_,void 0,O)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}g6q.Tracer=m6q});var c6q=C((p6q)=>{Object.defineProperty(p6q,"__esModule",{value:!0});p6q.MultiSpanProcessor=void 0;var srY=b9();class U6q{_spanProcessors;constructor(A){this._spanProcessors=A}forceFlush(){let A=[];for(let q of this._spanProcessors)A.push(q.forceFlush());return new Promise((q)=>{Promise.all(A).then(()=>{q()}).catch((K)=>{(0,srY.globalErrorHandler)(K||Error("MultiSpanProcessor: forceFlush failed")),q()})})}onStart(A,q){for(let K of this._spanProcessors)K.onStart(A,q)}onEnd(A){for(let q of this._spanProcessors)q.onEnd(A)}shutdown(){let A=[];for(let q of this._spanProcessors)A.push(q.shutdown());return new Promise((q,K)=>{Promise.all(A).then(()=>{q()},K)})}}p6q.MultiSpanProcessor=U6q});var o6q=C((n6q)=>{Object.defineProperty(n6q,"__esModule",{value:!0});n6q.BasicTracerProvider=n6q.ForceFlushState=void 0;var trY=b9(),erY=TM6(),AoY=Q6q(),qoY=ug8(),KoY=c6q(),YoY=Bg8(),QN6;(function(A){A[A.resolved=0]="resolved",A[A.timeout=1]="timeout",A[A.error=2]="error",A[A.unresolved=3]="unresolved"})(QN6=n6q.ForceFlushState||(n6q.ForceFlushState={}));class i6q{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(A={}){let q=(0,trY.merge)({},(0,qoY.loadDefaultConfig)(),(0,YoY.reconfigureLimits)(A));this._resource=q.resource??(0,erY.defaultResource)(),this._config=Object.assign({},q,{resource:this._resource});let K=[];if(A.spanProcessors?.length)K.push(...A.spanProcessors);this._activeSpanProcessor=new KoY.MultiSpanProcessor(K)}getTracer(A,q,K){let Y=`${A}@${q||""}:${K?.schemaUrl||""}`;if(!this._tracers.has(Y))this._tracers.set(Y,new AoY.Tracer({name:A,version:q,schemaUrl:K?.schemaUrl},this._config,this._resource,this._activeSpanProcessor));return this._tracers.get(Y)}forceFlush(){let A=this._config.forceFlushTimeoutMillis,q=this._activeSpanProcessor._spanProcessors.map((K)=>{return new Promise((Y)=>{let z,w=setTimeout(()=>{Y(Error(`Span processor did not completed within timeout period of ${A} ms`)),z=QN6.timeout},A);K.forceFlush().then(()=>{if(clearTimeout(w),z!==QN6.timeout)z=QN6.resolved,Y(z)}).catch((_)=>{clearTimeout(w),z=QN6.error,Y(_)})})});return new Promise((K,Y)=>{Promise.all(q).then((z)=>{let w=z.filter((_)=>_!==QN6.resolved);if(w.length>0)Y(w);else K()}).catch((z)=>Y([z]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}n6q.BasicTracerProvider=i6q});var e6q=C((s6q)=>{Object.defineProperty(s6q,"__esModule",{value:!0});s6q.ConsoleSpanExporter=void 0;var gg8=b9();class a6q{export(A,q){return this._sendSpans(A,q)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(A){return{resource:{attributes:A.resource.attributes},instrumentationScope:A.instrumentationScope,traceId:A.spanContext().traceId,parentSpanContext:A.parentSpanContext,traceState:A.spanContext().traceState?.serialize(),name:A.name,id:A.spanContext().spanId,kind:A.kind,timestamp:(0,gg8.hrTimeToMicroseconds)(A.startTime),duration:(0,gg8.hrTimeToMicroseconds)(A.duration),attributes:A.attributes,status:A.status,events:A.events,links:A.links}}_sendSpans(A,q){for(let K of A)console.dir(this._exportInfo(K),{depth:3});if(q)return q({code:gg8.ExportResultCode.SUCCESS})}}s6q.ConsoleSpanExporter=a6q});var z1q=C((K1q)=>{Object.defineProperty(K1q,"__esModule",{value:!0});K1q.InMemorySpanExporter=void 0;var A1q=b9();class q1q{_finishedSpans=[];_stopped=!1;export(A,q){if(this._stopped)return q({code:A1q.ExportResultCode.FAILED,error:Error("Exporter has been stopped")});this._finishedSpans.push(...A),setTimeout(()=>q({code:A1q.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}K1q.InMemorySpanExporter=q1q});var O1q=C((_1q)=>{Object.defineProperty(_1q,"__esModule",{value:!0});_1q.SimpleSpanProcessor=void 0;var zoY=nq(),RE1=b9();class w1q{_exporter;_shutdownOnce;_pendingExports;constructor(A){this._exporter=A,this._shutdownOnce=new RE1.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){if(await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush)await this._exporter.forceFlush()}onStart(A,q){}onEnd(A){if(this._shutdownOnce.isCalled)return;if((A.spanContext().traceFlags&zoY.TraceFlags.SAMPLED)===0)return;let q=this._doExport(A).catch((K)=>(0,RE1.globalErrorHandler)(K));this._pendingExports.add(q),q.finally(()=>this._pendingExports.delete(q))}async _doExport(A){if(A.resource.asyncAttributesPending)await A.resource.waitForAsyncAttributes?.();let q=await RE1.internal._export(this._exporter,[A]);if(q.code!==RE1.ExportResultCode.SUCCESS)throw q.error??Error(`SimpleSpanProcessor: span export failed (status ${q})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}_1q.SimpleSpanProcessor=w1q});var M1q=C((j1q)=>{Object.defineProperty(j1q,"__esModule",{value:!0});j1q.NoopSpanProcessor=void 0;class H1q{onStart(A,q){}onEnd(A){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}j1q.NoopSpanProcessor=H1q});var X1q=C((Vv)=>{Object.defineProperty(Vv,"__esModule",{value:!0});Vv.SamplingDecision=Vv.TraceIdRatioBasedSampler=Vv.ParentBasedSampler=Vv.AlwaysOnSampler=Vv.AlwaysOffSampler=Vv.NoopSpanProcessor=Vv.SimpleSpanProcessor=Vv.InMemorySpanExporter=Vv.ConsoleSpanExporter=Vv.RandomIdGenerator=Vv.BatchSpanProcessor=Vv.BasicTracerProvider=void 0;var woY=o6q();Object.defineProperty(Vv,"BasicTracerProvider",{enumerable:!0,get:function(){return woY.BasicTracerProvider}});var D1q=mg8();Object.defineProperty(Vv,"BatchSpanProcessor",{enumerable:!0,get:function(){return D1q.BatchSpanProcessor}});Object.defineProperty(Vv,"RandomIdGenerator",{enumerable:!0,get:function(){return D1q.RandomIdGenerator}});var _oY=e6q();Object.defineProperty(Vv,"ConsoleSpanExporter",{enumerable:!0,get:function(){return _oY.ConsoleSpanExporter}});var $oY=z1q();Object.defineProperty(Vv,"InMemorySpanExporter",{enumerable:!0,get:function(){return $oY.InMemorySpanExporter}});var OoY=O1q();Object.defineProperty(Vv,"SimpleSpanProcessor",{enumerable:!0,get:function(){return OoY.SimpleSpanProcessor}});var HoY=M1q();Object.defineProperty(Vv,"NoopSpanProcessor",{enumerable:!0,get:function(){return HoY.NoopSpanProcessor}});var joY=GE1();Object.defineProperty(Vv,"AlwaysOffSampler",{enumerable:!0,get:function(){return joY.AlwaysOffSampler}});var JoY=fE1();Object.defineProperty(Vv,"AlwaysOnSampler",{enumerable:!0,get:function(){return JoY.AlwaysOnSampler}});var MoY=hg8();Object.defineProperty(Vv,"ParentBasedSampler",{enumerable:!0,get:function(){return MoY.ParentBasedSampler}});var DoY=Ig8();Object.defineProperty(Vv,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return DoY.TraceIdRatioBasedSampler}});var XoY=rn6();Object.defineProperty(Vv,"SamplingDecision",{enumerable:!0,get:function(){return XoY.SamplingDecision}})});var f1q=C((Z1q)=>{Object.defineProperty(Z1q,"__esModule",{value:!0});Z1q.OTLPTraceExporter=void 0;var WoY=vQ(),ZoY=LQ(),P1q=Mn();class W1q extends WoY.OTLPExporterBase{constructor(A={}){super((0,P1q.createOtlpHttpExportDelegate)((0,P1q.convertLegacyHttpOptions)(A,"TRACES","v1/traces",{"Content-Type":"application/x-protobuf"}),ZoY.ProtobufTraceSerializer))}}Z1q.OTLPTraceExporter=W1q});var T1q=C((Fg8)=>{Object.defineProperty(Fg8,"__esModule",{value:!0});Fg8.OTLPTraceExporter=void 0;var GoY=f1q();Object.defineProperty(Fg8,"OTLPTraceExporter",{enumerable:!0,get:function(){return GoY.OTLPTraceExporter}})});var V1q=C((Qg8)=>{Object.defineProperty(Qg8,"__esModule",{value:!0});Qg8.OTLPTraceExporter=void 0;var ToY=T1q();Object.defineProperty(Qg8,"OTLPTraceExporter",{enumerable:!0,get:function(){return ToY.OTLPTraceExporter}})});var N1q=C((Ug8)=>{Object.defineProperty(Ug8,"__esModule",{value:!0});Ug8.OTLPTraceExporter=void 0;var NoY=V1q();Object.defineProperty(Ug8,"OTLPTraceExporter",{enumerable:!0,get:function(){return NoY.OTLPTraceExporter}})});var y1q=C((E1q)=>{Object.defineProperty(E1q,"__esModule",{value:!0});E1q.OTLPTraceExporter=void 0;var v1q=XE1(),koY=LQ(),EoY=vQ();class k1q extends EoY.OTLPExporterBase{constructor(A={}){super((0,v1q.createOtlpGrpcExportDelegate)((0,v1q.convertLegacyOtlpGrpcOptions)(A,"TRACES"),koY.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}}E1q.OTLPTraceExporter=k1q});var R1q=C((pg8)=>{Object.defineProperty(pg8,"__esModule",{value:!0});pg8.OTLPTraceExporter=void 0;var LoY=y1q();Object.defineProperty(pg8,"OTLPTraceExporter",{enumerable:!0,get:function(){return LoY.OTLPTraceExporter}})});var b1q=C((h1q)=>{Object.defineProperty(h1q,"__esModule",{value:!0});h1q.OTLPTraceExporter=void 0;var RoY=vQ(),SoY=LQ(),S1q=Mn();class C1q extends RoY.OTLPExporterBase{constructor(A={}){super((0,S1q.createOtlpHttpExportDelegate)((0,S1q.convertLegacyHttpOptions)(A,"TRACES","v1/traces",{"Content-Type":"application/json"}),SoY.JsonTraceSerializer))}}h1q.OTLPTraceExporter=C1q});var x1q=C((dg8)=>{Object.defineProperty(dg8,"__esModule",{value:!0});dg8.OTLPTraceExporter=void 0;var CoY=b1q();Object.defineProperty(dg8,"OTLPTraceExporter",{enumerable:!0,get:function(){return CoY.OTLPTraceExporter}})});var u1q=C((cg8)=>{Object.defineProperty(cg8,"__esModule",{value:!0});cg8.OTLPTraceExporter=void 0;var IoY=x1q();Object.defineProperty(cg8,"OTLPTraceExporter",{enumerable:!0,get:function(){return IoY.OTLPTraceExporter}})});var B1q=C((lg8)=>{Object.defineProperty(lg8,"__esModule",{value:!0});lg8.OTLPTraceExporter=void 0;var xoY=u1q();Object.defineProperty(lg8,"OTLPTraceExporter",{enumerable:!0,get:function(){return xoY.OTLPTraceExporter}})});class ig8{error(A,...q){$6(Error(A)),L(`[3P telemetry] OTEL diag error: ${A}`,{level:"error"})}warn(A,...q){$6(Error(A)),L(`[3P telemetry] OTEL diag warn: ${A}`,{level:"warn"})}info(A,...q){return}debug(A,...q){return}verbose(A,...q){return}}var m1q=k(()=>{x1();G1()});async function g1q(){let A=gO();if(A.error)throw Error(`Auth error: ${A.error}`);let q={"Content-Type":"application/json","User-Agent":mO(),...A.headers},K="https://api.anthropic.com/api/claude_code/organizations/metrics_enabled";return(await I8.get(K,{headers:q,timeout:5000})).data}async function moY(){if(process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC)return{enabled:!1,vcsAccountLinkingEnabled:!1,hasError:!1};try{let A;try{A=await g1q()}catch(q){if(I8.isAxiosError(q)&&(q.response?.status===401||q.response?.status===403&&typeof q.response?.data==="string"&&q.response.data.includes("OAuth token has been revoked"))){let Y=g7()?.accessToken;if(Y)await Sf(Y),A=await g1q();else throw q}else throw q}return L(`Metrics opt-out API response: enabled=${A.metrics_logging_enabled}, vcsLinking=${A.vcs_account_linking_enabled}`),{enabled:A.metrics_logging_enabled,vcsAccountLinkingEnabled:A.vcs_account_linking_enabled,hasError:!1}}catch(A){return L(`Failed to check metrics opt-out status: ${D1(A)}`),$6(A),{enabled:!1,vcsAccountLinkingEnabled:!1,hasError:!0}}}async function F1q(){let A=await goY();if(A.hasError)return A;let q=T1().metricsStatusCache;if(q!==void 0&&q.enabled===A.enabled&&q.vcsAccountLinkingEnabled===A.vcsAccountLinkingEnabled&&Date.now()-q.timestamp({...Y,metricsStatusCache:{enabled:A.enabled,vcsAccountLinkingEnabled:A.vcsAccountLinkingEnabled,timestamp:Date.now()}})),A}async function U1q(){if(A7()&&!Cf())return{enabled:!1,vcsAccountLinkingEnabled:!1,hasError:!1};let A=T1().metricsStatusCache;if(A){if(Date.now()-A.timestamp>Q1q)F1q().catch($6);return{enabled:A.enabled,vcsAccountLinkingEnabled:A.vcsAccountLinkingEnabled,hasError:!1}}return F1q()}var BoY=3600000,Q1q=86400000,goY;var p1q=k(()=>{A3();Hd();uD();G1();x1();bA();MA();Q8();goY=_vA(moY,BoY)});class rg8{endpoint;timeout;pendingExports=[];isShutdown=!1;constructor(A={}){this.endpoint="https://api.anthropic.com/api/claude_code/metrics",this.timeout=A.timeout||5000}async export(A,q){if(this.isShutdown){q({code:z26.ExportResultCode.FAILED,error:Error("Exporter has been shutdown")});return}let K=this.doExport(A,q);this.pendingExports.push(K),K.finally(()=>{let Y=this.pendingExports.indexOf(K);if(Y>-1)this.pendingExports.splice(Y,1)})}async doExport(A,q){try{if(!(L$()||u7())){L("BigQuery metrics export: trust not established, skipping"),q({code:z26.ExportResultCode.SUCCESS});return}if(!(await U1q()).enabled){L("Metrics export disabled by organization setting"),q({code:z26.ExportResultCode.SUCCESS});return}let z=this.transformMetricsForInternal(A),w=gO();if(w.error){L(`Metrics export failed: ${w.error}`),q({code:z26.ExportResultCode.FAILED,error:Error(w.error)});return}let _={"Content-Type":"application/json","User-Agent":mO(),...w.headers},$=await I8.post(this.endpoint,z,{timeout:this.timeout,headers:_});L("BigQuery metrics exported successfully"),L(`BigQuery API Response: ${U6($.data,null,2)}`),q({code:z26.ExportResultCode.SUCCESS})}catch(K){L(`BigQuery metrics export failed: ${D1(K)}`),$6(K),q({code:z26.ExportResultCode.FAILED,error:K instanceof Error?K:Error("Unknown export error")})}}transformMetricsForInternal(A){let q=A.resource.attributes,K={"service.name":q["service.name"]||"claude-code","service.version":q["service.version"]||"unknown","os.type":q["os.type"]||"unknown","os.version":q["os.version"]||"unknown","host.arch":q["host.arch"]||"unknown","aggregation.temporality":this.selectAggregationTemporality()===ng8.AggregationTemporality.DELTA?"delta":"cumulative"};if(q["wsl.version"])K["wsl.version"]=q["wsl.version"];if(A7()){K["user.customer_type"]="claude_ai";let z=K3();if(z)K["user.subscription_type"]=z}else K["user.customer_type"]="api";return{resource_attributes:K,metrics:A.scopeMetrics.flatMap((z)=>z.metrics.map((w)=>({name:w.descriptor.name,description:w.descriptor.description,unit:w.descriptor.unit,data_points:this.extractDataPoints(w)})))}}extractDataPoints(A){return(A.dataPoints||[]).filter((K)=>typeof K.value==="number").map((K)=>({attributes:this.convertAttributes(K.attributes),value:K.value,timestamp:this.hrTimeToISOString(K.endTime||K.startTime||[Date.now()/1000,0])}))}async shutdown(){this.isShutdown=!0,await this.forceFlush(),L("BigQuery metrics exporter shutdown complete")}async forceFlush(){await Promise.all(this.pendingExports),L("BigQuery metrics exporter flush complete")}convertAttributes(A){let q={};if(A){for(let[K,Y]of Object.entries(A))if(Y!==void 0&&Y!==null)q[K]=String(Y)}return q}hrTimeToISOString(A){let[q,K]=A;return new Date(q*1000+K/1e6).toISOString()}selectAggregationTemporality(){return ng8.AggregationTemporality.DELTA}}var ng8,z26;var d1q=k(()=>{A3();G1();x1();uD();p1q();bA();Q8();Q1();a1();MA();ng8=e(Z86(),1),z26=e(b9(),1)});var AF8={};m1(AF8,{isTelemetryEnabled:()=>q8q,initializeTelemetry:()=>ioY,flushTelemetry:()=>noY,bootstrapTelemetry:()=>A8q});function A8q(){if(!process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE)process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE="delta"}function QoY(){let A=(process.env.OTEL_METRICS_EXPORTER||"").trim().split(",").filter(Boolean),q=parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL||FoY.toString()),K=[];for(let Y of A)if(Y==="console"){let z=new an6.ConsoleMetricExporter,w=z.export.bind(z);z.export=(_,$)=>{if(_.resource&&_.resource.attributes)L(` === Resource Attributes ===`),L(U6(_.resource.attributes)),L(`=========================== `);return w(_,$)},K.push(z)}else if(Y==="otlp"){let z=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),w=eg8();switch(z){case"grpc":K.push(new l1q.OTLPMetricExporter);break;case"http/json":K.push(new i1q.OTLPMetricExporter(w));break;case"http/protobuf":K.push(new c1q.OTLPMetricExporter(w));break;default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${z}`)}}else if(Y==="prometheus")K.push(new n1q.PrometheusExporter);else throw Error(`Unknown exporter type set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${Y}`);return K.map((Y)=>{if("export"in Y)return new ag8.PeriodicExportingMetricReader({exporter:Y,exportIntervalMillis:q});return Y})}function UoY(){let A=(process.env.OTEL_LOGS_EXPORTER||"").trim().split(",").filter(Boolean),q=process.env.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),K=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;L(`[3P telemetry] getOtlpLogExporters: types=${U6(A)}, protocol=${q}, endpoint=${K}`);let Y=[];for(let z of A)if(z==="console")Y.push(new F86.ConsoleLogRecordExporter);else if(z==="otlp"){let w=eg8();switch(q){case"grpc":Y.push(new o1q.OTLPLogExporter);break;case"http/json":Y.push(new sg8.OTLPLogExporter(w));break;case"http/protobuf":Y.push(new r1q.OTLPLogExporter(w));break;default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_LOGS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${q}`)}}else throw Error(`Unknown exporter type set in OTEL_LOGS_EXPORTER env var: ${z}`);return Y}function poY(){let A=(process.env.OTEL_TRACES_EXPORTER||"").trim().split(",").filter(Boolean),q=[];for(let K of A)if(K==="console")q.push(new Q86.ConsoleSpanExporter);else if(K==="otlp"){let Y=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),z=eg8();switch(Y){case"grpc":q.push(new s1q.OTLPTraceExporter);break;case"http/json":q.push(new tg8.OTLPTraceExporter(z));break;case"http/protobuf":q.push(new a1q.OTLPTraceExporter(z));break;default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_TRACES_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${Y}`)}}else throw Error(`Unknown exporter type set in OTEL_TRACES_EXPORTER env var: ${K}`);return q}function q8q(){return $1(process.env.CLAUDE_CODE_ENABLE_TELEMETRY)}function doY(){let A=new rg8;return new ag8.PeriodicExportingMetricReader({exporter:A,exportIntervalMillis:300000})}function coY(){let A=K3(),q=A7()&&(A==="enterprise"||A==="team");return KF8()||q}function loY(A){let q=process.env.BETA_TRACING_ENDPOINT;if(!q)return;let K={url:`${q}/v1/traces`},Y={url:`${q}/v1/logs`},z=new tg8.OTLPTraceExporter(K),w=new Q86.BatchSpanProcessor(z,{scheduledDelayMillis:e1q}),_=new Q86.BasicTracerProvider({resource:A,spanProcessors:[w]});w26.trace.setGlobalTracerProvider(_),z81(_);let $=new sg8.OTLPLogExporter(Y),O=new F86.LoggerProvider({resource:A,processors:[new F86.BatchLogRecordProcessor($,{scheduledDelayMillis:t1q})]});on6.logs.setGlobalLoggerProvider(O),q81(O);let H=on6.logs.getLogger("com.anthropic.claude_code.events",{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.VERSION);K81(H),process.on("beforeExit",async()=>{await O?.forceFlush(),await _?.forceFlush()}),process.on("exit",()=>{O?.forceFlush(),_?.forceFlush()})}function ioY(){Uq("telemetry_init_start"),A8q(),w26.diag.setLogger(new ig8,w26.DiagLogLevel.ERROR),QG4();let A=[],q=q8q();if(L(`[3P telemetry] isTelemetryEnabled=${q} (CLAUDE_CODE_ENABLE_TELEMETRY=${process.env.CLAUDE_CODE_ENABLE_TELEMETRY})`),q)A.push(...QoY());if(coY())A.push(doY());let K=c8(),Y={[g86.ATTR_SERVICE_NAME]:"claude-code",[g86.ATTR_SERVICE_VERSION]:{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.VERSION};if(K==="wsl"){let D=uq6();if(D)Y["wsl.version"]=D}let z=Ju.resourceFromAttributes(Y),w=Ju.resourceFromAttributes(Ju.osDetector.detect().attributes||{}),_=Ju.hostDetector.detect(),$=_.attributes?.[g86.SEMRESATTRS_HOST_ARCH]?{[g86.SEMRESATTRS_HOST_ARCH]:_.attributes[g86.SEMRESATTRS_HOST_ARCH]}:{},O=Ju.resourceFromAttributes($),H=Ju.resourceFromAttributes(Ju.envDetector.detect().attributes||{}),j=z.merge(w).merge(O).merge(H);if(qD()){loY(j);let D=new an6.MeterProvider({resource:j,views:[],readers:A});return Y81(D),Kq(async()=>{let P=parseInt(process.env.CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS||"2000");try{Ml6();let W=jR6(),Z=S46(),G=[];if(W)G.push(W.forceFlush());if(Z)G.push(Z.forceFlush());await Promise.all(G);let f=[D.shutdown()];if(W)f.push(W.shutdown());if(Z)f.push(Z.shutdown());await Promise.race([Promise.all(f),new Promise((V,N)=>setTimeout(()=>N(Error("OpenTelemetry shutdown timeout")),P))])}catch{}}),D.getMeter("com.anthropic.claude_code",{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.VERSION)}let J=new an6.MeterProvider({resource:j,views:[],readers:A});if(Y81(J),q){let D=UoY();if(L(`[3P telemetry] Created ${D.length} log exporter(s)`),D.length>0){let X=new F86.LoggerProvider({resource:j,processors:D.map((W)=>new F86.BatchLogRecordProcessor(W,{scheduledDelayMillis:parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||t1q.toString())}))});on6.logs.setGlobalLoggerProvider(X),q81(X);let P=on6.logs.getLogger("com.anthropic.claude_code.events",{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.VERSION);K81(P),L("[3P telemetry] Event logger set successfully"),process.on("beforeExit",async()=>{await X?.forceFlush(),await S46()?.forceFlush()}),process.on("exit",()=>{X?.forceFlush(),S46()?.forceFlush()})}}if(q&&iC8()){let D=poY();if(D.length>0){let X=D.map((W)=>new Q86.BatchSpanProcessor(W,{scheduledDelayMillis:parseInt(process.env.OTEL_TRACES_EXPORT_INTERVAL||e1q.toString())})),P=new Q86.BasicTracerProvider({resource:j,spanProcessors:X});w26.trace.setGlobalTracerProvider(P),z81(P)}}return Kq(async()=>{let D=parseInt(process.env.CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS||"2000");try{Ml6();let X=[J.shutdown()],P=jR6();if(P)X.push(P.shutdown());let W=S46();if(W)X.push(W.shutdown());await Promise.race([Promise.all(X),new Promise((Z,G)=>setTimeout(()=>G(Error("OpenTelemetry shutdown timeout")),D))])}catch(X){if(X instanceof Error&&X.message.includes("timeout"))L(` OpenTelemetry telemetry flush timed out after ${D}ms To resolve this issue, you can: 1. Increase the timeout by setting CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS env var (e.g., 5000 for 5 seconds) 2. Check if your OpenTelemetry backend is experiencing scalability issues 3. Disable OpenTelemetry by unsetting CLAUDE_CODE_ENABLE_TELEMETRY env var Current timeout: ${D}ms `,{level:"error"});throw X}}),J.getMeter("com.anthropic.claude_code",{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.VERSION)}async function noY(){let A=cg1();if(!A)return;let q=parseInt(process.env.CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS||"5000");try{let K=[A.forceFlush()],Y=jR6();if(Y)K.push(Y.forceFlush());let z=S46();if(z)K.push(z.forceFlush());await Promise.race([Promise.all(K),new Promise((w,_)=>setTimeout(()=>_(Error("OpenTelemetry flush timeout")),q))]),L("Telemetry flushed successfully")}catch(K){if(K instanceof Error&&K.message.includes("timeout"))L(`Telemetry flush timed out after ${q}ms. Some metrics may not be exported.`,{level:"warn"});else L(`Telemetry flush failed: ${D1(K)}`,{level:"error"})}}function roY(){let A={},q=process.env.OTEL_EXPORTER_OTLP_HEADERS;if(q)for(let K of q.split(",")){let[Y,...z]=K.split("=");if(Y&&z.length>0)A[Y.trim()]=z.join("=").trim()}return A}function eg8(){let A=mR(),q=ER(),K=BA(),Y={},z=roY();if(K?.otelHeadersHelper)Y.headers=async()=>{let O=YF8();return{...z,...O}};else if(Object.keys(z).length>0)Y.headers=async()=>z;let w=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;if(!A||w&&Rt(w)){let O=tI();if(q||O)Y.httpAgentOptions={...q,...O&&{ca:O}};return Y}let _=tI(),$=(O)=>{return q||_?new og8.HttpsProxyAgent(A,{...q&&{cert:q.cert,key:q.key,passphrase:q.passphrase},..._&&{ca:_}}):new og8.HttpsProxyAgent(A)};return Y.httpAgentOptions=$,Y}var w26,on6,an6,c1q,l1q,i1q,n1q,ag8,F86,r1q,o1q,sg8,Q86,a1q,s1q,tg8,Ju,g86,og8,FoY=60000,t1q=5000,e1q=5000;var qF8=k(()=>{m1q();d1q();sY();VE();bA();Q1();U16();wl6();uK();bA();GA();G1();AI();mm();lX6();Z8();a1();FT6();MA();w26=e(nq(),1),on6=e(Oe1(),1),an6=e(Z86(),1),c1q=e(ac4(),1),l1q=e(je4(),1),i1q=e(pv1(),1),n1q=e(fe4(),1),ag8=e(Z86(),1),F86=e(Qe1(),1),r1q=e(ye4(),1),o1q=e(be4(),1),sg8=e(Ue4(),1),Q86=e(X1q(),1),a1q=e(N1q(),1),s1q=e(R1q(),1),tg8=e(B1q(),1),Ju=e(TM6(),1),g86=e(AK6(),1),og8=e(Gx6(),1)});var K8q={};m1(K8q,{performLogout:()=>sn6,clearAuthRelatedCaches:()=>SE1,call:()=>ooY});async function sn6({clearOnboarding:A=!1}){let{flushTelemetry:q}=await Promise.resolve().then(() => (qF8(),AF8));await q(),await _F8(),jH().delete(),await SE1(),_8((Y)=>{let z={...Y};if(A){if(z.hasCompletedOnboarding=!1,z.subscriptionNoticeCount=0,z.hasAvailableSubscription=!1,z.customApiKeyResponses?.approved)z.customApiKeyResponses={...z.customApiKeyResponses,approved:[]}}return z.oauthAccount=void 0,z})}async function SE1(){g7.cache?.clear?.(),CE1(),ik.cache?.clear?.(),UN6(),D86.cache?.clear?.(),ax.cache?.clear?.(),await jx8(),await Jv1()}async function ooY(){await sn6({clearOnboarding:!0});let A=zF8.createElement(T,null,"Successfully logged out from your Anthropic account.");return setTimeout(()=>{O3(0,"logout")},200),A}var zF8;var wF8=k(()=>{Q8();n6();bA();UN1();rE();cq6();B_();UV6();nV6();Xv();rA();zF8=e(W6(),1)});import{homedir as aoY}from"os";import{join as hE1}from"path";function IE1(A){return{env:A?.env??process.env,home:A?.homedir??process.env.HOME??aoY()}}function bE1(A){let{env:q,home:K}=IE1(A);return q.XDG_STATE_HOME??hE1(K,".local","state")}function Y8q(A){let{env:q,home:K}=IE1(A);return q.XDG_CACHE_HOME??hE1(K,".cache")}function z8q(A){let{env:q,home:K}=IE1(A);return q.XDG_DATA_HOME??hE1(K,".local","share")}function w8q(A){let{home:q}=IE1(A);return hE1(q,".local","bin")}var $F8=()=>{};import{join as tn6}from"path";function O8q(){return(process.argv[1]||"").includes("/.claude/local/node_modules/")}async function soY(){try{if(!P1().existsSync(U86))P1().mkdirSync(U86);if(!P1().existsSync(_8q))pz(_8q,U6({name:"claude-local",version:"0.0.1",private:!0},null,2),{encoding:"utf8",flush:!1});let A=tn6(U86,"claude");if(!P1().existsSync(A)){let q=`#!/bin/sh exec "${U86}/node_modules/.bin/claude" "$@"`;pz(A,q,{encoding:"utf8",flush:!1}),await W8("chmod",["+x",A])}return!0}catch(A){return $6(A),!1}}async function en6(A,q){try{if(!await soY())return"install_failed";let K=q?q:A==="stable"?"stable":"latest",Y=await z7("npm",["install",`${{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.PACKAGE_URL}@${K}`],{cwd:U86,maxBuffer:1e6});if(Y.code!==0){let z=Error(`Failed to install Claude CLI package: ${Y.stderr}`);return $6(z),Y.code===190?"in_progress":"install_failed"}return _8((z)=>({...z,installMethod:"local"})),"success"}catch(K){return $6(K),"install_failed"}}function p86(){return P1().existsSync(tn6(U86,"node_modules",".bin","claude"))}function pN6(){let A=process.env.SHELL||"";if(A.includes("zsh"))return"zsh";if(A.includes("bash"))return"bash";if(A.includes("fish"))return"fish";return"unknown"}var U86,_8q,$8q;var _26=k(()=>{aq();x1();Q8();Y7();Z8();a1();a1();U86=tn6(OA(),"local"),_8q=tn6(U86,"package.json"),$8q=tn6(U86,"claude")});import{homedir as H8q}from"os";import{join as OF8}from"path";import{readFile as toY,open as eoY,stat as AaY}from"fs/promises";function d86(A){let q=A?.homedir??H8q(),Y=(A?.env??process.env).ZDOTDIR||q;return{zsh:OF8(Y,".zshrc"),bash:OF8(q,".bashrc"),fish:OF8(q,".config/fish/config.fish")}}function xE1(A){let q=!1;return{filtered:A.filter((Y)=>{if(j8q.test(Y)){let z=Y.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(!z)z=Y.match(/alias\s+claude\s*=\s*([^#\n]+)/);if(z&&z[1]){if(z[1].trim()===$8q)return q=!0,!1}}return!0}),hadAlias:q}}async function Ar6(A){try{return(await toY(A,{encoding:"utf8"})).split(` `)}catch(q){let K=q.code;if(K==="ENOENT"||K==="EACCES"||K==="EPERM")return null;throw q}}async function uE1(A,q){let K=await eoY(A,"w");try{await K.writeFile(q.join(` `),{encoding:"utf8"}),await K.datasync()}finally{await K.close()}}async function HF8(A){let q=d86(A);for(let K of Object.values(q)){let Y=await Ar6(K);if(!Y)continue;for(let z of Y)if(j8q.test(z)){let w=z.match(/alias\s+claude=["']?([^"'\s]+)/);if(w&&w[1])return w[1]}}return null}async function J8q(A){let q=await HF8(A);if(!q)return null;let K=A?.homedir??H8q(),Y=q.startsWith("~")?q.replace("~",K):q;try{let z=await AaY(Y);if(z.isFile()||z.isSymbolicLink())return q}catch{}return null}var j8q;var BE1=k(()=>{_26();j8q=/^\s*alias\s+claude\s*=/});import{constants as qaY}from"fs";import{join as KaY}from"path";import{homedir as qr6}from"os";import{accessSync as YaY}from"fs";async function M8q(){try{let A=await mx("tengu_version_config",{minVersion:"0.0.0"});if(A.minVersion&&V06({ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.VERSION,A.minVersion))console.error(` It looks like your version of Claude Code (${{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.VERSION}) needs an update. A newer version (${A.minVersion} or higher) is required to continue. To update, please run: claude update This will ensure you have access to the latest features and improvements. `),O3(1)}catch(A){$6(A)}}async function c86(){return(await X8q()).external||void 0}async function D8q(){return(await X8q()).external_message||void 0}async function X8q(){try{return await mx("tengu_max_version_config",{})}catch(A){return $6(A),{}}}function cN6(A){let K=h7()?.minimumVersion;if(!K)return!1;let Y=!dD(A,K);if(Y)L(`Skipping update to ${A} - below minimumVersion ${K}`);return Y}function dN6(){return KaY(OA(),".update.lock")}function _aY(){try{if(!P1().existsSync(OA()))P1().mkdirSync(OA());if(P1().existsSync(dN6())){let A=P1().statSync(dN6());if(Date.now()-A.mtimeMs({...w,installMethod:"global"})),"success"}finally{$aY()}}async function HaY(){let A=d86();for(let[,q]of Object.entries(A))try{let K=await Ar6(q);if(!K)continue;let{filtered:Y,hadAlias:z}=xE1(K);if(z)await uE1(q,Y),L(`Removed claude alias from ${q}`)}catch(K){L(`Failed to remove alias from ${q}: ${K}`,{level:"error"})}}var zaY="https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases",mE1,waY=300000;var En=k(()=>{B1();rA();Q8();G1();K9();Z8();MA();aq();a1();Y7();B_();x1();GA();BE1();a1();A3();mE1=class mE1 extends Sh6{}});import{join as jaY}from"node:path";import{createHash as JaY}from"node:crypto";import{chmodSync as MaY}from"fs";async function DaY(A="latest",q,K){let Y=Date.now();try{let z=await I8.get(`${q}/${A}`,{timeout:30000,responseType:"text",...K}),w=Date.now()-Y;return c("tengu_version_check_success",{latency_ms:w}),z.data.trim()}catch(z){let w=Date.now()-Y,_=z instanceof Error?z.message:String(z),$;if(I8.isAxiosError(z)&&z.response)$=z.response.status;c("tengu_version_check_failure",{latency_ms:w,http_status:$,is_timeout:_.includes("timeout")});let O=Error(`Failed to fetch version from ${q}/${A}: ${_}`);throw $6(O),O}}async function MF8(A){if(/^v?\d+\.\d+\.\d+(-\S+)?$/.test(A))return A.startsWith("v")?A.slice(1):A;let q=A;if(q!=="stable"&&q!=="latest")throw Error(`Invalid channel: ${A}. Use 'stable' or 'latest'`);return DaY(q,Z8q)}function PaY(){return Number(process.env.CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING)||XaY}async function WaY(A,q,K,Y={}){let z;for(let w=1;w<=JF8;w++){let _=new AbortController,$,O=()=>{if($)clearTimeout($),$=void 0},H=()=>{O(),$=setTimeout(()=>{_.abort()},PaY())};try{H();let j=await I8.get(A,{timeout:300000,responseType:"arraybuffer",signal:_.signal,onDownloadProgress:()=>{H()},...Y});O();let J=JaY("sha256");J.update(j.data);let M=J.digest("hex");if(M!==q)throw Error(`Checksum mismatch: expected ${q}, got ${M}`);(await import("fs")).writeFileSync(K,Buffer.from(j.data)),MaY(K,493);return}catch(j){O();let J=I8.isCancel(j);if(J)z=new G8q;else z=j instanceof Error?j:Error(String(j));if(J&&wsetTimeout(M,1000));continue}throw z}}throw z??Error("Download failed after all retries")}async function ZaY(A,q,K,Y){let z=P1();if(z.existsSync(q))z.rmSync(q,{recursive:!0,force:!0});let w=Ln(),_=Date.now();c("tengu_binary_download_attempt",{});let $;try{$=(await I8.get(`${K}/${A}/manifest.json`,{timeout:1e4,responseType:"json",...Y})).data}catch(D){let X=Date.now()-_,P=D instanceof Error?D.message:String(D),W;if(I8.isAxiosError(D)&&D.response)W=D.response.status;throw c("tengu_binary_manifest_fetch_failure",{latency_ms:X,http_status:W,is_timeout:P.includes("timeout")}),$6(Error(`Failed to fetch manifest from ${K}/${A}/manifest.json: ${P}`)),D}let O=$.platforms[w];if(!O)throw c("tengu_binary_platform_not_found",{}),Error(`Platform ${w} not found in manifest for version ${A}`);let H=O.checksum,j=FE1(w),J=`${K}/${A}/${w}/${j}`;z.mkdirSync(q);let M=jaY(q,j);try{await WaY(J,H,M,Y||{});let D=Date.now()-_;c("tengu_binary_download_success",{latency_ms:D})}catch(D){let X=Date.now()-_,P=D instanceof Error?D.message:String(D),W;if(I8.isAxiosError(D)&&D.response)W=D.response.status;throw c("tengu_binary_download_failure",{latency_ms:X,http_status:W,is_timeout:P.includes("timeout"),is_checksum_mismatch:P.includes("Checksum mismatch")}),$6(Error(`Failed to download binary from ${J}: ${P}`)),D}}async function f8q(A,q){return await ZaY(A,q,Z8q),"binary"}var Z8q="https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases",XaY=60000,JF8=3,G8q;var T8q=k(()=>{A3();Y7();aq();G1();B1();DF8();x1();a1();a1();G8q=class G8q extends Error{constructor(){super("Download stalled: no data received for 60 seconds");this.name="StallTimeoutError"}}});import{readFile as GaY}from"fs/promises";function UE1(A,q){return q.includes(A.id)||A.idLike.some((K)=>q.includes(K))}function XF8(){let A=process.execPath||process.argv[0]||"";if(/[/\\]mise[/\\]installs[/\\]/i.test(A))return L(`Detected mise installation: ${A}`),!0;return!1}function PF8(){let A=process.execPath||process.argv[0]||"";if(/[/\\]\.?asdf[/\\]installs[/\\]/i.test(A))return L(`Detected asdf installation: ${A}`),!0;return!1}function pE1(){let A=c8();if(A!=="macos"&&A!=="linux"&&A!=="wsl")return!1;let q=process.execPath||process.argv[0]||"";if(q.includes("/Caskroom/"))return L(`Detected Homebrew cask installation: ${q}`),!0;return!1}function WF8(){if(c8()!=="windows")return!1;let q=process.execPath||process.argv[0]||"",K=[/Microsoft[/\\]WinGet[/\\]Packages/i,/Microsoft[/\\]WinGet[/\\]Links/i];for(let Y of K)if(Y.test(q))return L(`Detected winget installation: ${q}`),!0;return!1}var QE1,ZF8,GF8,fF8,TF8,lN6;var dE1=k(()=>{uK();G1();aq();Eq();QE1=T8(async()=>{try{let A=await GaY("/etc/os-release","utf8"),q=A.match(/^ID=["']?(\S+?)["']?\s*$/m),K=A.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);return{id:q?.[1]??"",idLike:K?.[1]?.split(" ")??[]}}catch{return null}});ZF8=T8(async()=>{if(c8()!=="linux")return!1;let q=await QE1();if(q&&!UE1(q,["arch"]))return!1;let K=process.execPath||process.argv[0]||"",Y=await W8("pacman",["-Qo",K],{timeout:5000,useCwd:!1});if(Y.code===0&&Y.stdout)return L(`Detected pacman installation: ${Y.stdout.trim()}`),!0;return!1}),GF8=T8(async()=>{if(c8()!=="linux")return!1;let q=await QE1();if(q&&!UE1(q,["debian"]))return!1;let K=process.execPath||process.argv[0]||"",Y=await W8("dpkg",["-S",K],{timeout:5000,useCwd:!1});if(Y.code===0&&Y.stdout)return L(`Detected deb installation: ${Y.stdout.trim()}`),!0;return!1}),fF8=T8(async()=>{if(c8()!=="linux")return!1;let q=await QE1();if(q&&!UE1(q,["fedora","rhel","suse"]))return!1;let K=process.execPath||process.argv[0]||"",Y=await W8("rpm",["-qf",K],{timeout:5000,useCwd:!1});if(Y.code===0&&Y.stdout)return L(`Detected rpm installation: ${Y.stdout.trim()}`),!0;return!1}),TF8=T8(async()=>{if(c8()!=="linux")return!1;let q=await QE1();if(q&&!UE1(q,["alpine"]))return!1;let K=process.execPath||process.argv[0]||"",Y=await W8("apk",["info","--who-owns",K],{timeout:5000,useCwd:!1});if(Y.code===0&&Y.stdout)return L(`Detected apk installation: ${Y.stdout.trim()}`),!0;return!1}),lN6=T8(async()=>{if(pE1())return"homebrew";if(WF8())return"winget";if(XF8())return"mise";if(PF8())return"asdf";if(await ZF8())return"pacman";if(await TF8())return"apk";if(await GF8())return"deb";if(await fF8())return"rpm";return"unknown"})});import{realpath as V8q}from"fs/promises";import{homedir as O26}from"os";import{join as pQ,posix as Yr6,win32 as zr6,delimiter as faY}from"path";function TaY(){let A=process.argv[1]||"",q=process.execPath||process.argv[0]||"";if(c8()==="windows")A=A.split(zr6.sep).join(Yr6.sep),q=q.split(zr6.sep).join(Yr6.sep);return[A,q]}async function dQ(){let[A]=TaY();if(ZY()){if(pE1()||WF8()||XF8()||PF8()||await ZF8()||await GF8()||await fF8()||await TF8())return"package-manager";return"native"}if(O8q())return"npm-local";if(["/usr/local/lib/node_modules","/usr/lib/node_modules","/opt/homebrew/lib/node_modules","/opt/homebrew/bin","/usr/local/bin","/.nvm/versions/node/"].some((z)=>A.includes(z)))return"npm-global";if(A.includes("/npm/")||A.includes("/nvm/"))return"npm-global";let K=await GY("npm config get prefix",{shell:!0,reject:!1}),Y=K.exitCode===0?K.stdout.trim():null;if(Y&&A.startsWith(Y))return"npm-global";return"unknown"}async function VaY(){if(ZY()){try{return await V8q(process.execPath)}catch{}try{let A=await f0("claude");if(A)return A}catch{}try{return await P1().stat(pQ(O26(),".local/bin/claude")),pQ(O26(),".local/bin/claude")}catch{}return"native"}try{return process.argv[0]||"unknown"}catch{return"unknown"}}function wr6(){try{if(ZY())return process.execPath||"unknown";return process.argv[1]||"unknown"}catch{return"unknown"}}async function NaY(){let A=P1(),q=[],K=pQ(O26(),".claude","local");if(p86())q.push({type:"npm-local",path:K});let Y=["@anthropic-ai/claude-code"];if({ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.PACKAGE_URL&&{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.PACKAGE_URL!=="@anthropic-ai/claude-code")Y.push({ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.PACKAGE_URL);let z=await W8("npm",["-g","config","get","prefix"]);if(z.code===0&&z.stdout){let $=z.stdout.trim(),O=c8()==="windows",H=O?pQ($,"claude"):pQ($,"bin","claude"),j=!1;try{await A.stat(H),j=!0}catch{}if(j){let J=!1;try{if((await V8q(H)).includes("/Caskroom/"))J=pE1()}catch{}if(!J)q.push({type:"npm-global",path:H})}else for(let J of Y){let M=O?pQ($,"node_modules",J):pQ($,"lib","node_modules",J);try{await A.stat(M),q.push({type:"npm-global-orphan",path:M})}catch{}}}let w=pQ(O26(),".local","bin","claude");try{await A.stat(w),q.push({type:"native",path:w})}catch{}if(T1().installMethod==="native"){let $=pQ(O26(),".local","share","claude");try{if(await A.stat($),!q.some((O)=>O.type==="native"))q.push({type:"native",path:$})}catch{}}return q}async function vaY(A){let q=[],K=T1();if(A==="development")return q;if(A==="native"){let _=(process.env.PATH||"").split(faY),$=O26(),O=pQ($,".local","bin"),H=O;if(c8()==="windows")H=O.split(zr6.sep).join(Yr6.sep);if(!_.some((J)=>{let M=J;if(c8()==="windows")M=J.split(zr6.sep).join(Yr6.sep);let D=M.replace(/\/+$/,""),X=J.replace(/[/\\]+$/,"");return D===H||X==="~/.local/bin"||X==="$HOME/.local/bin"}))if(c8()==="windows"){let M=O.split(Yr6.sep).join(zr6.sep);q.push({issue:`Native installation exists but ${M} is not in your PATH`,fix:"Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal."})}else{let M=pN6(),X=d86()[M],P=X?X.replace(O26(),"~"):"your shell config file";q.push({issue:"Native installation exists but ~/.local/bin is not in your PATH",fix:`Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${P} then open a new terminal or run: source ${P}`})}}if(!$1(process.env.DISABLE_INSTALLATION_CHECKS)){if(A==="npm-local"&&K.installMethod!=="local")q.push({issue:`Running from local installation but config install method is '${K.installMethod}'`,fix:"Consider using native installation: claude install"});if(A==="native"&&K.installMethod!=="native")q.push({issue:`Running native installation but config install method is '${K.installMethod}'`,fix:"Run claude install to update configuration"})}if(A==="npm-global"&&p86())q.push({issue:"Local installation exists but not being used",fix:"Consider using native installation: claude install"});let Y=await HF8(),z=await J8q();if(A==="npm-local"){if(!await f0("claude")&&!z)if(Y)q.push({issue:"Local installation not accessible",fix:`Alias exists but points to invalid target: ${Y}. Update alias: alias claude="~/.claude/local/claude"`});else q.push({issue:"Local installation not accessible",fix:'Create alias: alias claude="~/.claude/local/claude"'})}return q}function kaY(){if(c8()!=="linux")return[];let A=[],q=mA.getLinuxGlobPatternWarnings();if(q.length>0){let K=q.slice(0,3).join(", "),Y=q.length-3,z=Y>0?`${K} (${Y} more)`:K;A.push({issue:"Glob patterns in sandbox permission rules are not fully supported on Linux",fix:`Found ${q.length} pattern(s): ${z}. On Linux, glob patterns in Edit/Read rules will be ignored.`})}return A}async function j26(){let A=await dQ(),q={ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.VERSION?{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.VERSION:"unknown",K=await VaY(),Y=wr6(),z=await NaY(),w=await vaY(A);if(w.push(...kaY()),A==="native"){let D=z.filter((P)=>P.type==="npm-global"||P.type==="npm-global-orphan"||P.type==="npm-local"),X=c8()==="windows";for(let P of D)if(P.type==="npm-global"){let W="npm -g uninstall @anthropic-ai/claude-code";if({ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.PACKAGE_URL&&{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.PACKAGE_URL!=="@anthropic-ai/claude-code")W+=` && npm -g uninstall ${{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.PACKAGE_URL}`;w.push({issue:`Leftover npm global installation at ${P.path}`,fix:`Run: ${W}`})}else if(P.type==="npm-global-orphan")w.push({issue:`Orphaned npm global package at ${P.path}`,fix:X?`Run: rmdir /s /q "${P.path}"`:`Run: rm -rf ${P.path}`});else if(P.type==="npm-local")w.push({issue:`Leftover npm local installation at ${P.path}`,fix:X?`Run: rmdir /s /q "${P.path}"`:`Run: rm -rf ${P.path}`})}let $=T1().installMethod||"not set",O=null;if(A==="npm-global"){if(O=(await jF8()).hasPermissions,!O&&!H26())w.push({issue:"Insufficient permissions for auto-updates",fix:"Do one of: (1) Re-install node without sudo, or (2) Use `claude install` for native installation"})}let H=KkA(),j={working:H.working??!0,mode:H.mode,systemPath:H.mode==="system"?H.path:null},J=A==="package-manager"?await lN6():void 0;return{installationType:A,version:q,installationPath:K,invokedBinary:Y,configInstallMethod:$,autoUpdates:(()=>{let D=H26();return D?`disabled (${D})`:"enabled"})(),hasUpdatePermissions:O,multipleInstallations:z,warnings:w,packageManager:J,ripgrepStatus:j}}var cQ=k(()=>{Y7();W7();_26();Q8();En();BE1();uK();aq();Ef();EI();Pw();Z8();dE1();tB()});import{join as N8q,basename as EaY}from"path";function l86(){if($1(void 0))return!0;if(dz(void 0))return!1;return p8("tengu_pid_based_version_locking",!1)}function cE1(A){if(A<=1)return!1;try{return process.kill(A,0),!0}catch{return!1}}function yaY(A,q){if(!cE1(A))return!1;if(A===process.pid)return!0;try{let K=sQA(A);if(!K)return!0;let Y=K.toLowerCase(),z=q.toLowerCase();return Y.includes("claude")||Y.includes(z)}catch{return!0}}function J26(A){let q=P1();try{if(!q.existsSync(A))return null;let K=q.readFileSync(A,{encoding:"utf8"});if(!K||K.trim()==="")return null;let Y=O8(K);if(typeof Y.pid!=="number"||!Y.version||!Y.execPath)return null;return Y}catch{return null}}function _r6(A){let q=J26(A);if(!q)return!1;let{pid:K,execPath:Y}=q;if(!cE1(K))return!1;if(!yaY(K,Y))return L(`Lock PID ${K} is running but does not appear to be Claude - treating as stale`),!1;let z=P1();try{let w=z.statSync(A);if(Date.now()-w.mtimeMs>LaY){if(!cE1(K))return!1}}catch{}return!0}function RaY(A,q){let K=P1(),Y=`${A}.tmp.${process.pid}.${Date.now()}`;try{pz(Y,U6(q,null,2),{encoding:"utf8",flush:!0}),K.renameSync(Y,A)}catch(z){try{if(K.existsSync(Y))K.unlinkSync(Y)}catch{}throw z}}async function v8q(A,q){let K=P1(),Y=EaY(A);if(_r6(q)){let w=J26(q);return L(`Cannot acquire lock for ${Y} - held by PID ${w?.pid}`),null}let z={pid:process.pid,version:Y,execPath:process.execPath,acquiredAt:Date.now()};try{if(RaY(q,z),J26(q)?.pid!==process.pid)return null;return L(`Acquired PID lock for ${Y} (PID ${process.pid})`),()=>{try{if(J26(q)?.pid===process.pid)K.unlinkSync(q),L(`Released PID lock for ${Y}`)}catch(_){L(`Failed to release lock for ${Y}: ${_}`)}}}catch(w){return L(`Failed to acquire lock for ${Y}: ${w}`),null}}async function k8q(A,q){let K=await v8q(A,q);if(!K)return!1;let Y=()=>{try{K()}catch{}};return process.on("exit",Y),process.on("SIGINT",Y),process.on("SIGTERM",Y),!0}async function E8q(A,q,K){let Y=await v8q(A,q);if(!Y)return!1;try{return await K(),!0}finally{Y()}}function L8q(A){let q=P1(),K=[];if(!q.existsSync(A))return K;try{let Y=q.readdirStringSync(A).filter((z)=>z.endsWith(".lock"));for(let z of Y){let w=N8q(A,z),_=J26(w);if(_)K.push({version:_.version,pid:_.pid,isProcessRunning:cE1(_.pid),execPath:_.execPath,acquiredAt:new Date(_.acquiredAt),lockFilePath:w})}}catch(Y){$6(Y instanceof Error?Y:Error(`Failed to get lock info: ${Y}`))}return K}function lE1(A){let q=P1(),K=0;if(!q.existsSync(A))return 0;try{let Y=q.readdirStringSync(A).filter((z)=>z.endsWith(".lock"));for(let z of Y){let w=N8q(A,z);try{if(q.lstatSync(w).isDirectory())q.rmSync(w,{recursive:!0,force:!0}),K++,L(`Cleaned up legacy directory lock: ${z}`);else if(!_r6(w))q.unlinkSync(w),K++,L(`Cleaned up stale lock: ${z}`)}catch{}}}catch(Y){$6(Y instanceof Error?Y:Error(`Failed to cleanup stale locks: ${Y}`))}return K}var LaY=7200000;var VF8=k(()=>{Y7();G1();x1();wI6();rA();Z8();a1();a1()});import{join as aJ,dirname as yn,resolve as lQ,delimiter as SaY,basename as CaY}from"node:path";import{homedir as S8q}from"node:os";import{constants as haY,existsSync as NL}from"fs";import{access as IaY,copyFile as vF8,chmod as baY,rename as iE1,unlink as iQ,mkdir as M26,symlink as xaY,stat as xG,lstat as uaY,realpath as BaY,readlink as kF8,readdir as iN6,rmdir as maY,rm as oE1,writeFile as gaY}from"fs/promises";function Ln(){let A=YA.platform,q=process.arch==="x64"?"x64":process.arch==="arm64"?"arm64":null;if(!q){let K=Error(`Unsupported architecture: ${process.arch}`);throw L(`Native installer does not support architecture: ${process.arch}`,{level:"error"}),K}if(A==="linux"&&pV.isMuslEnvironment())return`linux-${q}-musl`;return`${A}-${q}`}function FE1(A){return A.startsWith("win32")?"claude.exe":"claude"}function nQ(){let A=Ln(),q=FE1(A);return{versions:aJ(z8q(),"claude","versions"),staging:aJ(Y8q(),"claude","staging"),locks:aJ(bE1(),"claude","locks"),executable:aJ(w8q(),q)}}async function i86(A){try{let q=await xG(A);if(!q.isFile()||q.size===0)return!1;return await IaY(A,haY.X_OK),!0}catch{return!1}}async function LF8(A){let q=nQ(),K=[q.versions,q.staging,q.locks];await Promise.all(K.map((w)=>M26(w,{recursive:!0})));let Y=yn(q.executable);await M26(Y,{recursive:!0});let z=aJ(q.versions,A);try{await xG(z)}catch{await gaY(z,"",{encoding:"utf8"})}return{stagingPath:aJ(q.staging,A),installPath:z}}async function C8q(A,q,K=0){let Y=nQ(),z=$r6(Y,A);if(await M26(Y.locks,{recursive:!0}),l86()){let _=0,$=K+1,O=K>0?1000:100,H=K>0?5000:500;while(_<$){if(await E8q(A,z,async()=>{try{await q()}catch(J){throw $6(J),J}}))return c("tengu_version_lock_acquired",{is_pid_based:!0,is_lifetime_lock:!1,attempts:_+1}),!0;if(_++,_<$){let J=Math.min(O*Math.pow(2,_-1),H);await new Promise((M)=>setTimeout(M,J))}}return c("tengu_version_lock_failed",{is_pid_based:!0,is_lifetime_lock:!1,attempts:$}),nE1(A,Error("Lock held by another process")),!1}let w=null;try{try{w=await rE1.default.lock(A,{stale:EF8,retries:{retries:K,minTimeout:K>0?1000:100,maxTimeout:K>0?5000:500},lockfilePath:z,onCompromised:(_)=>{L(`NON-FATAL: Version lock was compromised during operation: ${_.message}`,{level:"info"})}})}catch(_){return c("tengu_version_lock_failed",{is_pid_based:!1,is_lifetime_lock:!1}),nE1(A,_),!1}try{return await q(),c("tengu_version_lock_acquired",{is_pid_based:!1,is_lifetime_lock:!1}),!0}catch(_){throw $6(_),_}}finally{if(w)await w()}}async function h8q(A,q){await M26(yn(q),{recursive:!0});let K=`${q}.tmp.${process.pid}.${Date.now()}`;try{await vF8(A,K),await baY(K,493),await iE1(K,q),L(`Atomically installed binary to ${q}`)}catch(Y){try{await iQ(K)}catch{}throw Y}}async function FaY(A,q){try{let K=aJ(A,"node_modules","@anthropic-ai"),z=(await iN6(K)).find((_)=>_.startsWith("claude-cli-native-"));if(!z)throw c("tengu_native_install_package_failure",{stage_find_package:!0,error_package_not_found:!0}),Error("Could not find platform-specific native package");let w=aJ(K,z,"cli");try{await xG(w)}catch{throw c("tengu_native_install_package_failure",{stage_binary_exists:!0,error_binary_not_found:!0}),Error("Native binary not found in staged package")}await h8q(w,q),await oE1(A,{recursive:!0,force:!0}),c("tengu_native_install_package_success",{})}catch(K){let Y=K instanceof Error?K.message:String(K);if(!Y.includes("Could not find platform-specific")&&!Y.includes("Native binary not found"))c("tengu_native_install_package_failure",{stage_atomic_move:!0,error_move_failed:!0});throw $6(K instanceof Error?K:Error(Y)),K}}async function QaY(A,q){try{let K=Ln(),Y=FE1(K),z=aJ(A,Y);try{await xG(z)}catch{throw c("tengu_native_install_binary_failure",{stage_binary_exists:!0,error_binary_not_found:!0}),Error("Staged binary not found")}await h8q(z,q),await oE1(A,{recursive:!0,force:!0}),c("tengu_native_install_binary_success",{})}catch(K){let Y=K instanceof Error?K.message:String(K);if(!Y.includes("Staged binary not found"))c("tengu_native_install_binary_failure",{stage_atomic_move:!0,error_move_failed:!0});throw $6(K instanceof Error?K:Error(Y)),K}}async function UaY(A,q,K){if(K==="npm")await FaY(A,q);else await QaY(A,q)}async function y8q(A,q){let{stagingPath:K,installPath:Y}=await LF8(A),{executable:z}=nQ(),w=$1("true")?`${K}.${process.pid}.${Date.now()}`:K,_=!await I8q(A)||q;if(_){L(q?`Force reinstalling native installer version ${A}`:`Downloading native installer version ${A}`);let $=await f8q(A,w);await UaY(w,Y,$)}else L(`Version ${A} already installed, updating symlink`);if(await daY(z),await caY(z,Y),!await i86(z)){let $=!1;try{await xG(Y),$=!0}catch{}throw Error(`Failed to create executable at ${z}. Source file exists: ${$}. Check write permissions to ${z}.`)}return _}async function I8q(A){let{installPath:q}=await LF8(A);return i86(q)}async function paY(A,q=!1){let K=Date.now(),Y=await MF8(A),{executable:z}=nQ();if(L(`Checking for native installer update to version ${Y}`),!q){let $=await c86();if($&&sf(Y,$)){if(L(`Native installer: maxVersion ${$} is set, capping update from ${Y} to ${$}`),dD({ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.VERSION,$))return L(`Native installer: current version ${{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.VERSION} is already at or above maxVersion ${$}, skipping update`),c("tengu_native_update_skipped_max_version",{latency_ms:Date.now()-K,max_version:$,available_version:Y}),{success:!0};Y=$}}if(!q&&Y==={ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.VERSION&&await I8q(Y)&&await i86(z))return L(`Found ${Y} at ${z}, skipping install`),c("tengu_native_update_complete",{latency_ms:Date.now()-K,was_new_install:!1,was_force_reinstall:!1,was_already_running:!0}),{success:!0};if(!q&&cN6(Y))return c("tengu_native_update_skipped_minimum_version",{latency_ms:Date.now()-K,target_version:Y}),{success:!0};let w=!1,_;if($1("true"))w=await y8q(Y,q),_=Date.now()-K;else{let{installPath:$}=await LF8(Y);if(q)await iaY($);let O=await C8q($,async()=>{w=await y8q(Y,q)},3);if(_=Date.now()-K,!O){let H=nQ(),j;if(l86()){let J=$r6(H,$);if(_r6(J))j=J26(J)?.pid}return c("tengu_native_update_lock_failed",{latency_ms:_,lock_holder_pid:j}),{success:!1,lockFailed:!0,lockHolderPid:j}}}return c("tengu_native_update_complete",{latency_ms:_,was_new_install:w,was_force_reinstall:q}),L(`Successfully updated to version ${Y}`),{success:!0}}async function daY(A){try{if((await xG(A)).isDirectory()){if((await iN6(A)).length===0)await maY(A),L(`Removed empty directory at ${A}`)}}catch(q){L(`Could not remove empty directory at ${A}: ${q}`)}}async function caY(A,q){if(Ln().startsWith("win32"))try{let _=yn(A);await M26(_,{recursive:!0});let $=!1;try{await xG(A),$=!0}catch{}if($){try{let H=await xG(A),j=await xG(q);if(H.size===j.size)return!1}catch{}let O=`${A}.old.${Date.now()}`;await iE1(A,O);try{await vF8(q,A);try{await iQ(O)}catch{}}catch(H){try{await iE1(O,A)}catch(j){let J=Error(`Failed to restore old executable: ${j}`,{cause:H});throw $6(J),J}throw H}}else{try{await xG(q)}catch{throw Error(`Source file does not exist: ${q}`)}await vF8(q,A)}return!0}catch(_){return $6(Error(`Failed to copy executable from ${q} to ${A}: ${_}`)),!1}let z=yn(A);try{await M26(z,{recursive:!0}),L(`Created directory ${z} for symlink`)}catch(_){return $6(Error(`Failed to create directory ${z}: ${_}`)),!1}try{let _=!1;try{await xG(A),_=!0}catch{}if(_){try{let $=await kF8(A),O=lQ(yn(A),$),H=lQ(q);if(O===H)return!1}catch{}await iQ(A)}}catch(_){$6(Error(`Failed to check/remove existing symlink: ${_}`))}let w=`${A}.tmp.${process.pid}.${Date.now()}`;try{return await xaY(q,w),await iE1(w,A),L(`Atomically updated symlink ${A} -> ${q}`),!0}catch(_){try{await iQ(w)}catch{}return $6(Error(`Failed to create symlink from ${A} to ${q}: ${_}`)),!1}}async function rQ(A=!1){if($1(process.env.DISABLE_INSTALLATION_CHECKS))return[];let q=await dQ();if(q==="development")return[];let K=T1();if(!(A||q==="native"||K.installMethod==="native"))return[];let z=nQ(),w=[],_=yn(z.executable),$=lQ(_),H=Ln().startsWith("win32");if(!NL(_))w.push({message:`installMethod is native, but directory ${_} does not exist`,userActionRequired:!0,type:"error"});if(!NL(z.executable))w.push({message:`installMethod is native, but claude command not found at ${z.executable}`,userActionRequired:!0,type:"error"});else if(!H)try{let J=await kF8(z.executable),M=lQ(yn(z.executable),J);if(!NL(M))w.push({message:`Claude symlink points to non-existent file: ${J}`,userActionRequired:!0,type:"error"});else if(!await i86(M))w.push({message:`Claude symlink points to invalid binary: ${J}`,userActionRequired:!0,type:"error"})}catch{if(!await i86(z.executable))w.push({message:`${z.executable} exists but is not a valid Claude binary`,userActionRequired:!0,type:"error"})}else if(!await i86(z.executable))w.push({message:`${z.executable} exists but is not a valid Claude binary`,userActionRequired:!0,type:"error"});if(!(process.env.PATH||"").split(SaY).some((J)=>{try{let M=lQ(J);if(H)return M.toLowerCase()===$.toLowerCase();return M===$}catch{return!1}}))if(H){let J=_.replace(/\//g,"\\");w.push({message:`Native installation exists but ${J} is not in your PATH. Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`,userActionRequired:!0,type:"path"})}else{let J=pN6(),D=d86()[J],X=D?D.replace(S8q(),"~"):"your shell config file";w.push({message:`Native installation exists but ~/.local/bin is not in your PATH. Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${X} && source ${X}`,userActionRequired:!0,type:"path"})}return w}async function Rn(A,q=!1){let K=await MF8(A),Y=await paY(A,q);if(!Y.success)return{latestVersion:null,wasUpdated:!1,lockFailed:Y.lockFailed,lockHolderPid:Y.lockHolderPid};if(K||Y.success){if(T1().installMethod!=="native")_8((w)=>({...w,installMethod:"native",autoUpdates:!1,autoUpdatesProtectedForNative:!0})),L('Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection')}return Or6(),{latestVersion:K,wasUpdated:Y.success,lockFailed:!1}}async function laY(A){try{if(NL(A)){let q=await kF8(A),K=lQ(yn(A),q);if(NL(K)&&await i86(K))return K}}catch{}return null}function $r6(A,q){let K=CaY(q);return aJ(A.locks,`${K}.lock`)}async function yF8(){let A=nQ();if(!process.execPath.includes(A.versions))return;try{let q=lQ(process.execPath),K=$r6(A,q);if(await M26(A.locks,{recursive:!0}),!NL(q)){L(`Cannot lock current version - file does not exist: ${q}`,{level:"info"});return}if(l86()){if(!await k8q(q,K)){c("tengu_version_lock_failed",{is_pid_based:!0,is_lifetime_lock:!0}),nE1(q,Error("Lock already held by another process"));return}c("tengu_version_lock_acquired",{is_pid_based:!0,is_lifetime_lock:!0}),L(`Acquired PID lock on running version: ${q}`)}else{let Y;try{Y=await rE1.default.lock(q,{stale:EF8,retries:0,lockfilePath:K,onCompromised:(z)=>{L(`NON-FATAL: Lock on running version was compromised: ${z.message}`,{level:"info"})}}),c("tengu_version_lock_acquired",{is_pid_based:!1,is_lifetime_lock:!0}),L(`Acquired mtime-based lock on running version: ${q}`),Kq(async()=>{try{await Y?.()}catch{}})}catch(z){c("tengu_version_lock_failed",{is_pid_based:!1,is_lifetime_lock:!0}),nE1(q,z);return}}}catch(q){L(`NON-FATAL: Failed to lock current version during execution ${D1(q)}`,{level:"info"})}}function nE1(A,q){let K=`NON-FATAL: Lock acquisition failed for ${A} (expected in multi-process scenarios)`,Y=q instanceof Error?Error(K,{cause:q}):Error(`${K}: ${q}`);$6(Y)}async function iaY(A){let q=nQ(),K=$r6(q,A);try{await iQ(K),L(`Force-removed lock file at ${K}`)}catch(Y){L(`Failed to force-remove lock file: ${D1(Y)}`)}}async function Or6(){await Promise.resolve();let A=nQ();if(Ln().startsWith("win32"))try{let K=yn(A.executable);if(NL(K)){let z=(await iN6(K)).filter((_)=>_.startsWith("claude.exe.old.")&&_.match(/claude\.exe\.old\.\d+$/)),w=0;for(let _ of z)try{let $=aJ(K,_);await iQ($),w++}catch{}if(w>0)L(`Cleaned up ${w} old Windows executables on startup`)}}catch(K){L(`Failed to clean up old Windows executables: ${K}`)}if(NL(A.staging))try{let K=await iN6(A.staging),Y=Date.now()-3600000,z=0;for(let w of K){let _=aJ(A.staging,w);try{if((await xG(_)).mtime.getTime()0)L(`Cleaned up ${z} orphaned staging directories`),c("tengu_native_staging_cleanup",{cleaned_count:z})}catch(K){L(`Failed to clean up staging directories: ${K}`)}if(NL(A.versions))try{let K=await iN6(A.versions),Y=Date.now()-3600000,z=0;for(let w of K)if(w.match(/\.tmp\.\d+\.\d+$/)){let _=aJ(A.versions,w);try{if((await xG(_)).mtime.getTime()0)L(`Cleaned up ${z} orphaned temp install files`),c("tengu_native_temp_files_cleanup",{cleaned_count:z})}catch(K){L(`Failed to clean up temp install files: ${K}`)}if(l86()&&NL(A.locks)){let K=lE1(A.locks);if(K>0)L(`Cleaned up ${K} stale version locks`),c("tengu_native_stale_locks_cleanup",{cleaned_count:K})}if(!NL(A.versions))return;try{let K=await iN6(A.versions),Y=[];for(let D of K){let X=aJ(A.versions,D);try{let P=await xG(X);if(P.isFile()&&(P.size===0||await i86(X)))Y.push(D)}catch{}}let z=process.execPath,w=z&&z.includes(A.versions)?lQ(z):null,_=new Set([...w?[w]:[]]),$=await laY(A.executable);if($)_.add($);for(let D of Y){let X=lQ(A.versions,D);if(_.has(X))continue;let P=$r6(A,X),W=!1;if(l86())W=_r6(P);else try{W=await rE1.default.check(X,{stale:EF8,lockfilePath:P})}catch{W=!1}if(W)_.add(X),L(`Protecting locked version from cleanup: ${D}`)}let O=[];for(let D of Y){let X=lQ(A.versions,D);if(_.has(X))continue;try{let P=await xG(X);O.push({name:D,path:X,mtime:P.mtime})}catch{}}O.sort((D,X)=>X.mtime.getTime()-D.mtime.getTime());let H=O.slice(NF8);if(H.length===0){c("tengu_native_version_cleanup",{total_count:Y.length,deleted_count:0,protected_count:_.size,retained_count:NF8,lock_failed_count:0,error_count:0});return}let j=0,J=0,M=0;await Promise.all(H.map(async(D)=>{try{if(await C8q(D.path,async()=>{await iQ(D.path)}))j++;else J++,L(`Skipping deletion of ${D.name} - locked by another process`)}catch(X){M++,$6(Error(`Failed to delete version ${D.name}: ${X}`))}})),c("tengu_native_version_cleanup",{total_count:Y.length,deleted_count:j,protected_count:_.size,retained_count:NF8,lock_failed_count:J,error_count:M})}catch(K){if(K.code!=="ENOENT")$6(Error(`Version cleanup failed: ${K}`))}}async function naY(A){let q=A;if((await uaY(A)).isSymbolicLink())q=await BaY(A);return q.endsWith(".js")||q.includes("node_modules")}async function Hr6(){let A=nQ();try{if(!NL(A.executable))return;if(await naY(A.executable)){L(`Skipping removal of ${A.executable} - appears to be npm-managed`);return}await iQ(A.executable),L(`Removed claude symlink at ${A.executable}`)}catch(q){if(q.code==="ENOENT")return;$6(Error(`Failed to remove claude symlink: ${q}`))}}async function jr6(){let A=[],q=d86();for(let[K,Y]of Object.entries(q))try{let z=await Ar6(Y);if(!z)continue;let{filtered:w,hadAlias:_}=xE1(z);if(_)await uE1(Y,w),A.push({message:`Removed claude alias from ${Y}. Run: unalias claude`,userActionRequired:!0,type:"alias"}),L(`Cleaned up claude alias from ${K} config`)}catch(z){$6(z),A.push({message:`Failed to clean up ${Y}: ${z}`,userActionRequired:!1,type:"error"})}return A}async function raY(A){try{let q=await z7("npm",["config","get","prefix"]);if(q.code!==0||!q.stdout)return{success:!1,error:"Failed to get npm global prefix"};let K=q.stdout.trim(),Y=!1;async function z(w,_){try{return await xG(w),await iQ(w),L(`Manually removed ${_}: ${w}`),!0}catch{return!1}}if(Ln()==="windows"){let w=aJ(K,"claude.cmd"),_=aJ(K,"claude.ps1"),$=aJ(K,"claude");if(await z(w,"bin script"))Y=!0;if(await z(_,"PowerShell script"))Y=!0;if(await z($,"bin executable"))Y=!0}else{let w=aJ(K,"bin","claude");if(await z(w,"bin symlink"))Y=!0}if(Y){L(`Successfully removed ${A} manually`);let w=Ln()==="windows"?aJ(K,"node_modules",A):aJ(K,"lib","node_modules",A);return{success:!0,warning:`${A} executables removed, but node_modules directory was left intact for safety. You may manually delete it later at: ${w}`}}else return{success:!1}}catch(q){return L(`Manual removal failed: ${q}`,{level:"error"}),{success:!1,error:`Manual removal failed: ${q}`}}}async function R8q(A){let{code:q,stderr:K}=await z7("npm",["uninstall","-g",A],{cwd:process.cwd()});if(q===0)return L(`Removed global npm installation of ${A}`),{success:!0};else if(K&&!K.includes("npm ERR! code E404")){if(K.includes("npm error code ENOTEMPTY")){L(`Failed to uninstall global npm package ${A}: ${K}`,{level:"error"}),L("Attempting manual removal due to ENOTEMPTY error");let Y=await raY(A);if(Y.success)return{success:!0,warning:Y.warning};else if(Y.error)return{success:!1,error:`Failed to remove global npm installation of ${A}: ${K}. Manual removal also failed: ${Y.error}`}}return L(`Failed to uninstall global npm package ${A}: ${K}`,{level:"error"}),{success:!1,error:`Failed to remove global npm installation of ${A}: ${K}`}}return{success:!1}}async function Jr6(){let A=[],q=[],K=0,Y=await R8q("@anthropic-ai/claude-code");if(Y.success){if(K++,Y.warning)q.push(Y.warning)}else if(Y.error)A.push(Y.error);if({ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.PACKAGE_URL&&{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.PACKAGE_URL!=="@anthropic-ai/claude-code"){let w=await R8q({ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.71",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-06T22:45:36Z"}.PACKAGE_URL);if(w.success){if(K++,w.warning)q.push(w.warning)}else if(w.error)A.push(w.error)}let z=aJ(S8q(),".claude","local");if(NL(z))try{await oE1(z,{recursive:!0,force:!0}),K++,L(`Removed local installation at ${z}`)}catch(w){A.push(`Failed to remove ${z}: ${w}`),L(`Failed to remove local installation: ${w}`,{level:"error"})}return{removed:K,errors:A,warnings:q}}var rE1,NF8=2,EF8=604800000;var DF8=k(()=>{K9();ta();aq();x1();sY();B1();G1();$F8();Q8();BE1();_26();En();T8q();cQ();Z8();VF8();MA();rE1=e(zm(),1)});var Mu=k(()=>{DF8()});function Sn(){let A=D26(),K=["user","project","local"].flatMap((Y)=>UJ(Y).errors);return{settings:A.settings,errors:[...A.errors,...K]}}var Mr6=k(()=>{GA();LG()});function b8q(){return[]}function x8q(A,q=null,K){let Y=A?.find((z)=>z.name==="ide");if(q){let z=sO(q.ideType),w=Lb(q.ideType)?"plugin":"extension";if(q.error)return[{label:"IDE",value:X26.createElement(T,null,uA("error",K)(q1.cross)," Error installing ",z," ",w,": ",q.error,` `,"Please restart your IDE and try again.")}];if(q.installed)if(Y&&Y.type==="connected")if(q.installedVersion!==Y.serverInfo?.version)return[{label:"IDE",value:`Connected to ${z} ${w} version ${q.installedVersion} (server version: ${Y.serverInfo?.version})`}];else return[{label:"IDE",value:`Connected to ${z} ${w} version ${q.installedVersion}`}];else return[{label:"IDE",value:`Installed ${z} ${w}`}]}else if(Y){let z=VD8(Y)??"IDE";if(Y.type==="connected")return[{label:"IDE",value:`Connected to ${z} extension`}];else return[{label:"IDE",value:`${uA("error",K)(q1.cross)} Not connected to ${z}`}]}return[]}function u8q(A=[],q){let K=A.filter((Y)=>Y.name!=="ide");if(!K.length)return[];return[{label:"MCP servers",value:X26.createElement(m,{flexDirection:"row",flexWrap:"wrap",columnGap:1,flexShrink:99},K.map((Y,z)=>{let w="";if(Y.type==="connected")w=uA("success",q)(q1.tick);else if(Y.type==="pending")w=uA("inactive",q)(q1.radioOff);else if(Y.type==="needs-auth")w=uA("warning",q)(q1.triangleUpOutline);else if(Y.type==="failed")w=uA("error",q)(q1.cross);else w=uA("error",q)(q1.cross);let _=z{let z=T3(Y.path);K.push(`Large ${z} will impact performance (${f3(Y.content.length)} chars > ${f3(OF)})`)}),q&&q.content.length>NY6)K.push(`CLAUDE.md entries marked as IMPORTANT exceed ${f3(NY6)} characters (${f3(q.content.length)} chars)`);return K}function m8q(){return[{label:"Setting sources",value:Td().filter((Y)=>{let z=HA(Y);return z!==null&&Object.keys(z).length>0}).map((Y)=>{if(Y==="policySettings"){let z=U8q();if(z===null)return null;switch(z){case"remote":return"Enterprise managed settings (remote)";case"plist":return"Enterprise managed settings (plist)";case"hklm":return"Enterprise managed settings (HKLM)";case"file":return"Enterprise managed settings (file)";case"hkcu":return"Enterprise managed settings (HKCU)"}}return FUA(Y)}).filter((Y)=>Y!==null)}]}async function g8q(){return(await rQ()).map((q)=>q.message)}async function F8q(){let A=await j26(),q=[],{errors:K}=Sn();if(K.length>0){let z=Array.from(new Set(K.map((w)=>w.file))).join(", ");q.push(`Found invalid settings files: ${z}. They will be ignored.`)}if(A.warnings.forEach((Y)=>{q.push(Y.issue)}),A.hasUpdatePermissions===!1)q.push("No write permissions for auto-updates (requires sudo)");return q}function aE1(){let A=Dr6();if(!A)return[];let q=[];if(A.subscription)q.push({label:"Login method",value:`${A.subscription} Account`});if(A.tokenSource)q.push({label:"Auth token",value:A.tokenSource});if(A.apiKeySource)q.push({label:"API key",value:A.apiKeySource});if(A.organization&&!process.env.IS_DEMO)q.push({label:"Organization",value:A.organization});if(A.email&&!process.env.IS_DEMO)q.push({label:"Email",value:A.email});return q}function sE1(){let A=D7(),q=[];if(A!=="firstParty"){let z={bedrock:"AWS Bedrock",vertex:"Google Vertex AI",foundry:"Microsoft Foundry"}[A];q.push({label:"API provider",value:z})}if(A==="firstParty"){let z=process.env.ANTHROPIC_BASE_URL;if(z)q.push({label:"Anthropic base URL",value:z})}else if(A==="bedrock"){let z=process.env.BEDROCK_BASE_URL;if(z)q.push({label:"Bedrock base URL",value:z});if(q.push({label:"AWS region",value:Q46()}),$1(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH))q.push({value:"AWS auth skipped"})}else if(A==="vertex"){let z=process.env.VERTEX_BASE_URL;if(z)q.push({label:"Vertex base URL",value:z});let w=process.env.ANTHROPIC_VERTEX_PROJECT_ID;if(w)q.push({label:"GCP project",value:w});if(q.push({label:"Default region",value:E81()}),$1(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH))q.push({value:"GCP auth skipped"})}else if(A==="foundry"){let z=process.env.ANTHROPIC_FOUNDRY_BASE_URL;if(z)q.push({label:"Microsoft Foundry base URL",value:z});let w=process.env.ANTHROPIC_FOUNDRY_RESOURCE;if(w)q.push({label:"Microsoft Foundry resource",value:w});if($1(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))q.push({value:"Microsoft Foundry auth skipped"})}let K=mR();if(K)q.push({label:"Proxy",value:K});let Y=ER();if(process.env.NODE_EXTRA_CA_CERTS)q.push({label:"Additional CA cert(s)",value:process.env.NODE_EXTRA_CA_CERTS});if(Y){if(Y.cert&&process.env.CLAUDE_CODE_CLIENT_CERT)q.push({label:"mTLS client cert",value:process.env.CLAUDE_CODE_CLIENT_CERT});if(Y.key&&process.env.CLAUDE_CODE_CLIENT_KEY)q.push({label:"mTLS client key",value:process.env.CLAUDE_CODE_CLIENT_KEY})}return q}function Q8q(A){let q=YP(A);if(A===null&&A7()){let K=K06();q=`${M1.bold("Default")} ${K}`}return q}var X26;var RF8=k(()=>{n6();Mu();bA();M$();sD();Oq();p7();yz();Xq();iK();cQ();Z8();VE();mm();GA();Mr6();Pw();t7();bA();F2();X26=e(W6(),1)});async function p8q(){try{if(T1().claudeCodeFirstTokenDate!==void 0)return;let q=gO();if(q.error){$6(Error(`Failed to get auth headers: ${q.error}`));return}let Y=`${U7().BASE_API_URL}/api/organization/claude_code_first_token_date`,w=(await I8.get(Y,{headers:{...q.headers,"User-Agent":mO()},timeout:1e4})).data?.first_token_date??null;if(w!==null){let _=new Date(w).getTime();if(isNaN(_)){$6(Error(`Received invalid first_token_date from API: ${w}`));return}}_8((_)=>({..._,claudeCodeFirstTokenDate:w}))}catch(A){$6(A)}}var d8q=k(()=>{Q8();uD();x1();L5();A3()});var tE1={};m1(tE1,{installOAuthTokens:()=>Xr6,authStatus:()=>aaY,authLogout:()=>saY,authLogin:()=>oaY});async function Xr6(A){await sn6({clearOnboarding:!1});let q=A.profile??await Y86(A.accessToken);if(q)XV6({accountUuid:q.account.uuid,emailAddress:q.account.email,organizationUuid:q.organization.uuid,displayName:q.account.display_name||void 0,hasExtraUsageEnabled:q.organization.has_extra_usage_enabled??void 0,billingType:q.organization.billing_type??void 0,subscriptionCreatedAt:q.organization.subscription_created_at??void 0,accountCreatedAt:q.account.created_at});else if(A.tokenAccount)XV6({accountUuid:A.tokenAccount.uuid,emailAddress:A.tokenAccount.emailAddress,organizationUuid:A.tokenAccount.organizationUuid});let K=nN6(A);if(eE1(),K.warning)c("tengu_oauth_storage_warning",{warning:K.warning});if(await fI8(A.accessToken).catch((Y)=>L(String(Y),{level:"error"})),jQ(A.scopes))await p8q().catch((Y)=>L(String(Y),{level:"error"}));else if(!await TI8(A.accessToken))throw Error("Unable to create API key. The server accepted the request but did not return a key.");await SE1()}async function oaY({email:A,sso:q}){let K=process.env.CLAUDE_CODE_OAUTH_REFRESH_TOKEN;if(K){let w=process.env.CLAUDE_CODE_OAUTH_SCOPES;if(!w)process.stderr.write(`CLAUDE_CODE_OAUTH_SCOPES is required when using CLAUDE_CODE_OAUTH_REFRESH_TOKEN. Set it to the space-separated scopes the refresh token was issued with (e.g. "user:inference" or "user:profile user:inference user:sessions:claude_code user:mcp_servers"). `),process.exit(1);let _=w.split(/\s+/).filter(Boolean);try{c("tengu_login_from_refresh_token",{});let $=await ll6(K,{scopes:_});await Xr6($),_8((O)=>{if(O.hasCompletedOnboarding)return O;return{...O,hasCompletedOnboarding:!0}}),c("tengu_oauth_success",{loginWithClaudeAi:!0}),process.stdout.write(`Login successful. `),process.exit(0)}catch($){$6($),process.stderr.write(`Login failed: ${D1($)} `),process.exit(1)}}let Y=q?"sso":void 0,z=new fw6;try{c("tengu_oauth_flow_start",{loginWithClaudeAi:!0});let w=await z.startOAuthFlow(async(_)=>{process.stdout.write(`Opening browser to sign in… `),process.stdout.write(`If the browser didn't open, visit: ${_} `)},{loginWithClaudeAi:!0,loginHint:A,loginMethod:Y});await Xr6(w),c("tengu_oauth_success",{loginWithClaudeAi:!0}),process.stdout.write(`Login successful. `),process.exit(0)}catch(w){$6(w),process.stderr.write(`Login failed: ${D1(w)} `),process.exit(1)}finally{z.cleanup()}}async function aaY(A){let{source:q,hasToken:K}=Du(),{source:Y}=f$(),z=!!process.env.ANTHROPIC_API_KEY&&!Gf(),w=Y9(),_=K3(),$=hx(),O=K||Y!=="none"||z||$,H="none";if($)H="third_party";else if(q==="claude.ai")H="claude.ai";else if(q==="apiKeyHelper")H="api_key_helper";else if(q!=="none")H="oauth_token";else if(Y==="ANTHROPIC_API_KEY"||z)H="api_key";else if(Y==="/login managed key")H="claude.ai";if(A.text){let j=[...aE1(),...sE1()],J=!1;for(let M of j){let D=typeof M.value==="string"?M.value:Array.isArray(M.value)?M.value.join(", "):null;if(D===null||D==="none")continue;if(J=!0,M.label)process.stdout.write(`${M.label}: ${D} `);else process.stdout.write(`${D} `)}if(!J&&z)process.stdout.write(`API key: ANTHROPIC_API_KEY `);if(!O)process.stdout.write(`Not logged in. Run claude auth login to authenticate. `)}else{let j=D7(),J=Y!=="none"?Y:z?"ANTHROPIC_API_KEY":null,M={loggedIn:O,authMethod:H,apiProvider:j};if(J)M.apiKeySource=J;if(H==="claude.ai")M.email=w?.emailAddress??null,M.orgId=w?.organizationUuid??null,M.orgName=w?.organizationName??null,M.subscriptionType=_??null;process.stdout.write(U6(M,null,2)+` `)}process.exit(O?0:1)}async function saY(){try{await sn6({clearOnboarding:!1})}catch{process.stderr.write(`Failed to log out. `),process.exit(1)}process.stdout.write(`Successfully logged out from your Anthropic account. `),process.exit(0)}var Pr6=k(()=>{bA();yz();wF8();RF8();a1();FV1();EW();dl6();d8q();B1();x1();G1();Z8();Q8();MA()});var l8q={};m1(l8q,{ConsoleOAuthFlow:()=>P26});function P26({onDone:A,startingMessage:q,mode:K="login",forceLoginMethod:Y}){let z=BA()||{},w=Y??z.forceLoginMethod,_=z.forceLoginOrgUUID,$=w==="claudeai"?"Login method pre-selected: Subscription Plan (Claude Pro/Max)":w==="console"?"Login method pre-selected: API Usage Billing (Anthropic Console)":null,O=vg(),[H,j]=k7.useState(()=>{if(K==="setup-token")return{state:"ready_to_start"};if(w==="claudeai"||w==="console")return{state:"ready_to_start"};return{state:"idle"}}),[J,M]=k7.useState(""),[D,X]=k7.useState(0),[P]=k7.useState(()=>new fw6),[W,Z]=k7.useState(()=>{return K==="setup-token"||w==="claudeai"}),[G,f]=k7.useState(!1),[V,N]=k7.useState(!1),v=PA().columns-c8q.length-1;k7.useEffect(()=>{if(w==="claudeai")c("tengu_oauth_claudeai_forced",{});else if(w==="console")c("tengu_oauth_console_forced",{})},[w]),k7.useEffect(()=>{if(H.state==="about_to_retry")setTimeout(()=>{j(H.nextState)},1000)},[H]),V8("confirm:yes",()=>{c("tengu_oauth_success",{loginWithClaudeAi:W}),A()},{context:"Confirmation",isActive:H.state==="success"&&K!=="setup-token"}),V8("confirm:yes",()=>{j({state:"idle"})},{context:"Confirmation",isActive:H.state==="platform_setup"}),V8("confirm:yes",()=>{if(H.state==="error"&&H.toRetry)M(""),j({state:"about_to_retry",nextState:H.toRetry})},{context:"Confirmation",isActive:H.state==="error"&&!!H.toRetry}),k7.useEffect(()=>{if(J==="c"&&H.state==="waiting_for_login"&&G&&!V)yG(H.url).then((x)=>{if(x)N(!0),setTimeout(()=>N(!1),2000)}),M("")},[J,H,G,V]);async function y(x,F){try{let[g,b]=x.split("#");if(!g||!b){j({state:"error",message:"Invalid code. Please make sure the full code was copied",toRetry:{state:"waiting_for_login",url:F}});return}c("tengu_oauth_manual_entry",{}),P.handleManualAuthCodeInput({authorizationCode:g,state:b})}catch(g){$6(g),j({state:"error",message:g.message,toRetry:{state:"waiting_for_login",url:F}})}}let R=k7.useCallback(async()=>{try{c("tengu_oauth_flow_start",{loginWithClaudeAi:W});let x=await P.startOAuthFlow(async(F)=>{j({state:"waiting_for_login",url:F}),setTimeout(()=>f(!0),3000)},{loginWithClaudeAi:W,inferenceOnly:K==="setup-token",expiresIn:K==="setup-token"?31536000:void 0,orgUUID:_}).catch((F)=>{let g=F.message.includes("Token exchange failed");throw j({state:"error",message:g?"Failed to exchange authorization code for access token. Please try again.":F.message,toRetry:K==="setup-token"?{state:"ready_to_start"}:{state:"idle"}}),c("tengu_oauth_token_exchange_error",{error:F.message}),F});if(K==="setup-token")j({state:"success",token:x.accessToken});else await Xr6(x),j({state:"success"}),GQ({message:"Claude Code login successful",notificationType:"auth_success"},O)}catch(x){let F=x.message;j({state:"error",message:F,toRetry:{state:K==="setup-token"?"ready_to_start":"idle"}}),c("tengu_oauth_error",{error:F})}},[P,f,W,K,_]),h=k7.useRef(!1);k7.useEffect(()=>{if(H.state==="ready_to_start"&&!h.current)h.current=!0,process.nextTick(()=>{R(),h.current=!1})},[H.state,R]),k7.useEffect(()=>{if(K==="setup-token"&&H.state==="success"){let x=setTimeout(async()=>{c("tengu_oauth_success",{loginWithClaudeAi:W}),A()},500);return()=>clearTimeout(x)}},[K,H,W,A]),k7.useEffect(()=>{return()=>{P.cleanup()}},[P]);function B(){switch(H.state){case"idle":return k7.default.createElement(m,{flexDirection:"column",gap:1,marginTop:1},k7.default.createElement(T,{bold:!0},q?q:"Claude Code can be used with your Claude subscription or billed based on API usage through your Console account."),k7.default.createElement(T,null,"Select login method:"),k7.default.createElement(m,null,k7.default.createElement(E8,{options:[{label:k7.default.createElement(T,null,"Claude account with subscription ·"," ",k7.default.createElement(T,{dimColor:!0},"Pro, Max, Team, or Enterprise"),` `),value:"claudeai"},{label:k7.default.createElement(T,null,"Anthropic Console account ·"," ",k7.default.createElement(T,{dimColor:!0},"API usage billing"),` `),value:"console"},{label:k7.default.createElement(T,null,"3rd-party platform ·"," ",k7.default.createElement(T,{dimColor:!0},"Amazon Bedrock, Microsoft Foundry, or Vertex AI"),` `),value:"platform"}],onCancel:()=>{},onChange:(x)=>{if(x==="platform")c("tengu_oauth_platform_selected",{}),j({state:"platform_setup"});else if(j({state:"ready_to_start"}),x==="claudeai")c("tengu_oauth_claudeai_selected",{}),Z(!0);else c("tengu_oauth_console_selected",{}),Z(!1)}})));case"platform_setup":return k7.default.createElement(m,{flexDirection:"column",gap:1,marginTop:1},k7.default.createElement(T,{bold:!0},"Using 3rd-party platforms"),k7.default.createElement(m,{flexDirection:"column",gap:1},k7.default.createElement(T,null,"Claude Code supports Amazon Bedrock, Microsoft Foundry, and Vertex AI. Set the required environment variables, then restart Claude Code."),k7.default.createElement(T,null,"If you are part of an enterprise organization, contact your administrator for setup instructions."),k7.default.createElement(m,{flexDirection:"column",marginTop:1},k7.default.createElement(T,{bold:!0},"Documentation:"),k7.default.createElement(T,null,"· Amazon Bedrock:"," ",k7.default.createElement(d7,{url:"https://code.claude.com/docs/en/amazon-bedrock"},"https://code.claude.com/docs/en/amazon-bedrock")),k7.default.createElement(T,null,"· Microsoft Foundry:"," ",k7.default.createElement(d7,{url:"https://code.claude.com/docs/en/microsoft-foundry"},"https://code.claude.com/docs/en/microsoft-foundry")),k7.default.createElement(T,null,"· Vertex AI:"," ",k7.default.createElement(d7,{url:"https://code.claude.com/docs/en/google-vertex-ai"},"https://code.claude.com/docs/en/google-vertex-ai"))),k7.default.createElement(m,{marginTop:1},k7.default.createElement(T,{dimColor:!0},"Press ",k7.default.createElement(T,{bold:!0},"Enter")," to go back to login options."))));case"waiting_for_login":return k7.default.createElement(m,{flexDirection:"column",gap:1},$&&k7.default.createElement(m,null,k7.default.createElement(T,{dimColor:!0},$)),!G&&k7.default.createElement(m,null,k7.default.createElement(Sq,null),k7.default.createElement(T,null,"Opening browser to sign in…")),G&&k7.default.createElement(m,null,k7.default.createElement(T,null,c8q),k7.default.createElement(sK,{value:J,onChange:M,onSubmit:(x)=>y(x,H.url),cursorOffset:D,onChangeCursorOffset:X,columns:v,mask:"*"})));case"creating_api_key":return k7.default.createElement(m,{flexDirection:"column",gap:1},k7.default.createElement(m,null,k7.default.createElement(Sq,null),k7.default.createElement(T,null,"Creating API key for Claude Code…")));case"about_to_retry":return k7.default.createElement(m,{flexDirection:"column",gap:1},k7.default.createElement(T,{color:"permission"},"Retrying…"));case"success":return k7.default.createElement(m,{flexDirection:"column"},K==="setup-token"&&H.token?null:k7.default.createElement(k7.default.Fragment,null,Y9()?.emailAddress?k7.default.createElement(T,{dimColor:!0},"Logged in as"," ",k7.default.createElement(T,null,Y9()?.emailAddress)):null,k7.default.createElement(T,{color:"success"},"Login successful. Press ",k7.default.createElement(T,{bold:!0},"Enter")," to continue…")));case"error":return k7.default.createElement(m,{flexDirection:"column",gap:1},k7.default.createElement(T,{color:"error"},"OAuth error: ",H.message),H.toRetry&&k7.default.createElement(m,{marginTop:1},k7.default.createElement(T,{color:"permission"},"Press ",k7.default.createElement(T,{bold:!0},"Enter")," to retry.")));default:return null}}return k7.default.createElement(m,{flexDirection:"column",gap:1},H.state==="waiting_for_login"&&G&&k7.default.createElement(m,{flexDirection:"column",key:"urlToCopy",gap:1,paddingBottom:1},k7.default.createElement(m,{paddingX:1},k7.default.createElement(T,{dimColor:!0},"Browser didn't open? Use the url below to sign in"," "),V?k7.default.createElement(T,{color:"success"},"(Copied!)"):k7.default.createElement(T,{dimColor:!0},k7.default.createElement(J8,{shortcut:"c",action:"copy",parens:!0}))),k7.default.createElement(d7,{url:H.url},k7.default.createElement(T,{dimColor:!0},H.url))),K==="setup-token"&&H.state==="success"&&H.token&&k7.default.createElement(m,{key:"tokenOutput",flexDirection:"column",gap:1,paddingTop:1},k7.default.createElement(T,{color:"success"},"✓ Long-lived authentication token created successfully!"),k7.default.createElement(m,{flexDirection:"column",gap:1},k7.default.createElement(T,null,"Your OAuth token (valid for 1 year):"),k7.default.createElement(T,{color:"warning"},H.token),k7.default.createElement(T,{dimColor:!0},"Store this token securely. You won't be able to see it again."),k7.default.createElement(T,{dimColor:!0},"Use this token by setting: export CLAUDE_CODE_OAUTH_TOKEN="))),k7.default.createElement(m,{paddingLeft:1,flexDirection:"column",gap:1},B()))}var k7,c8q="Paste code here if prompted > ";var Wr6=k(()=>{n6();H7();ai();JK();WO();FV1();bA();B1();xq();x1();E$();Ti6();ac();_5();Pr6();GA();k7=e(W6(),1)});function n86(){let A=V1((z)=>z.mainLoopModel),q=V1((z)=>z.mainLoopModelForSession),K=null;return J5(q??A??Hg())}var Zr6=k(()=>{Xq();pA()});async function Gr6(A,q){if(SF8)return;if(SF8=!0,!A.isBypassPermissionsModeAvailable)return;if(!await AL1())return;q((Y)=>{return{...Y,toolPermissionContext:CY6(Y.toolPermissionContext)}})}function i8q(){SF8=!1}function n8q(){let A=V1((K)=>K.toolPermissionContext),q=q7();hF8.useEffect(()=>{if(Lq())return;Gr6(A,q)},[])}async function IF8(A,q){{if(CF8)return;CF8=!0;let{updatedContext:K,notification:Y}=await xF8(A);if(!K&&!Y)return;q((z)=>{let w=K?{...z,toolPermissionContext:K}:z;if(!Y)return w;return{...w,notifications:{...w.notifications,queue:[...w.notifications.queue,{key:"auto-mode-gate-notification",text:Y,color:"warning",priority:"high"}]}}})}}function r8q(){CF8=!1}function o8q(){let A=V1((K)=>K.toolPermissionContext),q=q7();hF8.useEffect(()=>{if(Lq())return;IF8(A,q)},[])}var hF8,SF8=!1,CF8=!1;var bF8=k(()=>{pA();XP();Q1();hF8=e(W6(),1)});var a8q={};m1(a8q,{call:()=>eaY,Login:()=>rN6});function taY(){let A=Y9();if(!A)return{};return{email:A.emailAddress,account_uuid:A.accountUuid,organization_uuid:A.organizationUuid}}async function eaY(A,q){return Xu.createElement(rN6,{onDone:async(K)=>{if(q.onChangeAPIKey(),q.setMessages(s8q),K){TH6(),oB4(taY()),Hv1(),xi6(),ik.cache?.clear?.(),UN6(),i8q();let Y=q.getAppState();Gr6(Y.toolPermissionContext,q.setAppState),r8q(),IF8(Y.toolPermissionContext,q.setAppState),q.setAppState((z)=>({...z,authVersion:z.authVersion+1}))}A(K?"Login successful":"Login interrupted")}})}function rN6(A){let q=Y6(12),K=n86(),Y;if(q[0]!==K||q[1]!==A)Y=()=>A.onDone(!1,K),q[0]=K,q[1]=A,q[2]=Y;else Y=q[2];let z;if(q[3]!==K||q[4]!==A)z=()=>A.onDone(!0,K),q[3]=K,q[4]=A,q[5]=z;else z=q[5];let w;if(q[6]!==A.startingMessage||q[7]!==z)w=Xu.createElement(P26,{onDone:z,startingMessage:A.startingMessage}),q[6]=A.startingMessage,q[7]=z,q[8]=w;else w=q[8];let _;if(q[9]!==Y||q[10]!==w)_=Xu.createElement(l8,{title:"Login",onCancel:Y,color:"permission",inputGuide:AsY},w),q[9]=Y,q[10]=w,q[11]=_;else _=q[11];return _}function AsY(A){return A.pending?Xu.createElement(T,null,"Press ",A.keyName," again to exit"):Xu.createElement(G8,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancel"})}var Xu;var qL1=k(()=>{K1();n6();Wr6();zq();hK();Zr6();Q1();SA();tN1();bA();nV6();Xv();rA();cq6();bF8();Xu=e(W6(),1)});var fr6={};m1(fr6,{updateSessionTitle:()=>gF8,sendEventToRemoteSession:()=>mF8,prepareApiRequest:()=>uG,getOAuthHeaders:()=>JD,getBranchFromSession:()=>KL1,fetchSession:()=>oN6,fetchCodeSessionsFromSessionsAPI:()=>BF8,axiosGetWithRetry:()=>e8q,CodeSessionSchema:()=>YsY});import{randomUUID as qsY}from"crypto";function KsY(A){if(!I8.isAxiosError(A))return!1;if(!A.response)return!0;if(A.response.status>=500)return!0;return!1}async function e8q(A,q){let K;for(let Y=0;Y<=uF8;Y++)try{return await I8.get(A,q)}catch(z){if(K=z,!KsY(z))throw z;if(Y>=uF8)throw L(`Teleport request failed after ${Y+1} attempts: ${D1(z)}`),z;let w=t8q[Y]??2000;L(`Teleport request failed (attempt ${Y+1}/${uF8+1}), retrying in ${w}ms: ${D1(z)}`),await new Promise((_)=>setTimeout(_,w))}throw K}async function uG(){let A=g7()?.accessToken;if(A===void 0)throw Error("Claude Code web sessions require authentication with a Claude.ai account. API key authentication is not sufficient. Please run /login to authenticate, or check your authentication status with /status.");let q=await TC();if(!q)throw Error("Unable to get organization UUID");return{accessToken:A,orgUUID:q}}async function BF8(){let{accessToken:A,orgUUID:q}=await uG(),K=`${U7().BASE_API_URL}/v1/sessions`;try{let Y={...JD(A),"anthropic-beta":"ccr-byoc-2025-07-29","x-organization-uuid":q},z=await e8q(K,{headers:Y});if(z.status!==200)throw Error(`Failed to fetch code sessions: ${z.statusText}`);return z.data.data.map((_)=>{let $=_.session_context.sources.find((H)=>H.type==="git_repository"),O=null;if($?.url){let H=GK6($.url);if(H){let[j,J]=H.split("/");if(j&&J)O={name:J,owner:{login:j},default_branch:$.revision||void 0}}}return{id:_.id,title:_.title||"Untitled",description:"",status:_.session_status,repo:O,turns:[],created_at:_.created_at,updated_at:_.updated_at}})}catch(Y){let z=Y instanceof Error?Y:Error(String(Y));throw $6(z),Y}}function JD(A){return{Authorization:`Bearer ${A}`,"Content-Type":"application/json","anthropic-version":"2023-06-01"}}async function oN6(A){let{accessToken:q,orgUUID:K}=await uG(),Y=`${U7().BASE_API_URL}/v1/sessions/${A}`,z={...JD(q),"anthropic-beta":"ccr-byoc-2025-07-29","x-organization-uuid":K},w=await I8.get(Y,{headers:z,timeout:15000,validateStatus:(_)=>_<500});if(w.status!==200){let $=w.data?.error?.message;if(w.status===404)throw Error(`Session not found: ${A}`);if(w.status===401)throw Error("Session expired. Please run /login to sign in again.");throw Error($||`Failed to fetch session: ${w.status} ${w.statusText}`)}return w.data}function KL1(A){return A.session_context.outcomes?.find((K)=>K.type==="git_repository")?.git_info?.branches[0]}async function mF8(A,q){try{let{accessToken:K,orgUUID:Y}=await uG(),z=`${U7().BASE_API_URL}/v1/sessions/${A}/events`,w={...JD(K),"anthropic-beta":"ccr-byoc-2025-07-29","x-organization-uuid":Y},$={events:[{uuid:qsY(),session_id:A,type:"user",parent_tool_use_id:null,message:{role:"user",content:q}}]};L(`[sendEventToRemoteSession] Sending event to session ${A}`);let O=await I8.post(z,$,{headers:w,validateStatus:(H)=>H<500,timeout:30000});if(O.status===200||O.status===201)return L(`[sendEventToRemoteSession] Successfully sent event to session ${A}`),!0;return L(`[sendEventToRemoteSession] Failed with status ${O.status}: ${U6(O.data)}`),!1}catch(K){return L(`[sendEventToRemoteSession] Error: ${D1(K)}`),!1}}async function gF8(A,q){try{let{accessToken:K,orgUUID:Y}=await uG(),z=`${U7().BASE_API_URL}/v1/sessions/${A}`,w={...JD(K),"anthropic-beta":"ccr-byoc-2025-07-29","x-organization-uuid":Y};L(`[updateSessionTitle] Updating title for session ${A}: "${q}"`);let _=await I8.patch(z,{title:q},{headers:w,validateStatus:($)=>$<500});if(_.status===200)return L(`[updateSessionTitle] Successfully updated title for session ${A}`),!0;return L(`[updateSessionTitle] Failed with status ${_.status}: ${U6(_.data)}`),!1}catch(K){return L(`[updateSessionTitle] Error: ${D1(K)}`),!1}}var t8q,uF8,YsY;var BG=k(()=>{L5();bA();A3();EW();x1();G1();xf();B7();a1();MA();t8q=[2000,4000,8000,16000],uF8=t8q.length;YsY=i6(()=>Q4.object({id:Q4.string(),title:Q4.string(),description:Q4.string(),status:Q4.enum(["idle","working","waiting","completed","archived","cancelled","rejected"]),repo:Q4.object({name:Q4.string(),owner:Q4.object({login:Q4.string()}),default_branch:Q4.string().optional()}).nullable(),turns:Q4.array(Q4.string()),created_at:Q4.string(),updated_at:Q4.string()}))});async function AAq(A){let{accessToken:q,orgUUID:K}=await uG(),Y={...JD(q),"x-organization-uuid":K},z=`${U7().BASE_API_URL}/api/oauth/organizations/${K}/admin_requests`;return(await I8.post(z,A,{headers:Y})).data}async function qAq(A,q){let{accessToken:K,orgUUID:Y}=await uG(),z={...JD(K),"x-organization-uuid":Y},w=`${U7().BASE_API_URL}/api/oauth/organizations/${Y}/admin_requests/me?request_type=${A}`;for(let $ of q)w+=`&statuses=${$}`;return(await I8.get(w,{headers:z})).data}async function KAq(A){let{accessToken:q,orgUUID:K}=await uG(),Y={...JD(q),"x-organization-uuid":K},z=`${U7().BASE_API_URL}/api/oauth/organizations/${K}/admin_requests/eligibility?request_type=${A}`;return(await I8.get(z,{headers:Y})).data}var YAq=k(()=>{A3();L5();BG()});async function YL1(){let A=K3(),q=A==="team"||A==="enterprise",K=wx(),Y=Y9()?.hasExtraUsageEnabled===!0;if(!K&&q){try{if((await KAq("limit_increase"))?.is_allowed===!1)return{type:"message",value:"Please contact your admin to manage extra usage settings."}}catch(w){$6(w)}try{let w=await qAq("limit_increase",["pending","dismissed"]);if(w&&w.length>0)return{type:"message",value:"You have already submitted a request for extra usage to your admin."}}catch(w){$6(w)}try{return await AAq({request_type:"limit_increase",details:null}),{type:"message",value:Y?"Request sent to your admin to increase extra usage.":"Request sent to your admin to enable extra usage."}}catch(w){$6(w)}return{type:"message",value:"Please contact your admin to manage extra usage settings."}}let z=q?"https://claude.ai/admin-settings/usage":"https://claude.ai/settings/usage";try{let w=await $Y(z);return{type:"browser-opened",url:z,opened:w}}catch(w){return $6(w),{type:"message",value:`Failed to open browser. Please visit ${z} to manage extra usage.`}}}var FF8=k(()=>{x1();bA();RP();Q8();YAq()});var wAq={};m1(wAq,{call:()=>QF8});async function QF8(A,q){let K=await YL1();if(K.type==="message")return A(K.value),null;return zAq.default.createElement(rN6,{startingMessage:"Starting new login following /extra-usage. Exit with Ctrl-C to use existing account.",onDone:(Y)=>{q.onChangeAPIKey(),A(Y?"Login successful":"Login interrupted")}})}var zAq;var UF8=k(()=>{qL1();FF8();zAq=e(W6(),1)});var _Aq={};m1(_Aq,{call:()=>zsY});async function zsY(){let A=await YL1();if(A.type==="message")return{type:"text",value:A.value};return{type:"text",value:A.opened?`Browser opened to manage extra usage. If it didn't open, visit: ${A.url}`:`Please visit ${A.url} to manage extra usage.`}}var $Aq=k(()=>{FF8()});function OAq(){if(process.env.DISABLE_EXTRA_USAGE_COMMAND)return!1;return WG6()}var r86,HAq;var Tr6=k(()=>{bA();Q1();r86={type:"local-jsx",name:"extra-usage",description:"Configure extra usage to keep working when limits are hit",isEnabled:()=>OAq()&&!u7(),isHidden:!1,load:()=>Promise.resolve().then(() => (UF8(),wAq)),userFacingName(){return"extra-usage"}},HAq={type:"local",name:"extra-usage",supportsNonInteractive:!0,description:"Configure extra usage to keep working when limits are hit",isEnabled:()=>OAq()&&u7(),get isHidden(){return!u7()},load:()=>Promise.resolve().then(() => ($Aq(),_Aq)),userFacingName(){return"extra-usage"}}});function o86(){let[A,q]=zL1.useState({...TT});return zL1.useEffect(()=>{let K=(Y)=>{q({...Y})};return E66.add(K),()=>{E66.delete(K)}},[]),A}var zL1;var Vr6=k(()=>{al();zL1=e(W6(),1)});function wsY({shouldShowUpsell:A,isMax20x:q,isExtraUsageCommandEnabled:K,shouldAutoOpenRateLimitOptionsMenu:Y,isTeamOrEnterprise:z,hasBillingAccess:w}){if(!A)return null;if(q){if(K)return"/extra-usage to finish what you’re working on.";return"/login to switch to an API usage-billed account."}if(Y)return"Opening your options…";if(!z&&!K)return"/upgrade to increase your usage limit.";if(z){if(!K)return null;if(w)return"/extra-usage to finish what you’re working on.";return"/extra-usage to request more usage from your admin."}return"/upgrade or /extra-usage to finish what you’re working on."}function jAq(A){let q=Y6(16),{text:K,onOpenRateLimitOptions:Y}=A,z;if(q[0]===Symbol.for("react.memo_cache_sentinel"))z=K3(),q[0]=z;else z=q[0];let w=z,_;if(q[1]===Symbol.for("react.memo_cache_sentinel"))_=$m(),q[1]=_;else _=q[1];let $=_,O=w==="team"||w==="enterprise",H=$==="default_claude_max_20x",j;if(q[2]===Symbol.for("react.memo_cache_sentinel"))j=DG6()||A7(),q[2]=j;else j=q[2];let J=j,M=J&&!H,[D,X]=wL1.useState(!1),P=o86(),W=P.status==="rejected"&&P.resetsAt!==void 0&&!P.isUsingOverage,Z=M&&!D&&W&&Y,G,f;if(q[3]!==Y||q[4]!==Z)G=()=>{if(Z)X(!0),Y()},f=[Z,Y],q[3]=Y,q[4]=Z,q[5]=G,q[6]=f;else G=q[5],f=q[6];wL1.useEffect(G,f);let V;A:{let h;if(q[7]!==Z)h=wsY({shouldShowUpsell:J,isMax20x:H,isExtraUsageCommandEnabled:r86.isEnabled(),shouldAutoOpenRateLimitOptionsMenu:!!Z,isTeamOrEnterprise:O,hasBillingAccess:wx()}),q[7]=Z,q[8]=h;else h=q[8];let B=h;if(!B){V=null;break A}let x;if(q[9]!==B)x=Nr6.default.createElement(T,{dimColor:!0},B),q[9]=B,q[10]=x;else x=q[10];V=x}let N=V,v;if(q[11]!==K)v=Nr6.default.createElement(T,{color:"error"},K),q[11]=K,q[12]=v;else v=q[12];let y=D?null:N,R;if(q[13]!==v||q[14]!==y)R=Nr6.default.createElement(M8,null,Nr6.default.createElement(m,{flexDirection:"column"},v,y)),q[13]=v,q[14]=y,q[15]=R;else R=q[15];return R}var Nr6,wL1;var JAq=k(()=>{K1();bA();vp6();n6();DK();Tr6();Q8();Vr6();Nr6=e(W6(),1),wL1=e(W6(),1)});function _sY(){let A=Y6(2),q;if(A[0]===Symbol.for("react.memo_cache_sentinel"))q=NC4(),A[0]=q;else q=A[0];let K=q,Y;if(A[1]===Symbol.for("react.memo_cache_sentinel"))Y=dY.default.createElement(M8,null,dY.default.createElement(m,{flexDirection:"column"},dY.default.createElement(T,{color:"error"},_W1),K&&dY.default.createElement(T,{dimColor:!0},"· Run in another terminal: security unlock-keychain"))),A[1]=Y;else Y=A[1];return Y}function DAq(A){let q=Y6(30),{param:K,addMargin:Y,shouldShowDot:z,verbose:w,onOpenRateLimitOptions:_}=A,{text:$}=K;if(_L1($))return null;if(jK4($)){let O;if(q[0]!==_||q[1]!==$)O=dY.default.createElement(jAq,{text:$,onOpenRateLimitOptions:_}),q[0]=_,q[1]=$,q[2]=O;else O=q[2];return O}switch($){case mY6:return null;case NF:{let O;if(q[3]===Symbol.for("react.memo_cache_sentinel"))O=MV6("warning"),q[3]=O;else O=q[3];let H=O,j;if(q[4]===Symbol.for("react.memo_cache_sentinel"))j=dY.default.createElement(M8,{height:1},dY.default.createElement(T,{color:"error"},"Context limit reached · /compact or /clear to continue",H?` · ${H}`:"")),q[4]=j;else j=q[4];return j}case wW1:{let O;if(q[5]===Symbol.for("react.memo_cache_sentinel"))O=dY.default.createElement(M8,{height:1},dY.default.createElement(T,{color:"error"},"Credit balance too low · Add funds: https://platform.claude.com/settings/billing")),q[5]=O;else O=q[5];return O}case _W1:{let O;if(q[6]===Symbol.for("react.memo_cache_sentinel"))O=dY.default.createElement(_sY,null),q[6]=O;else O=q[6];return O}case $W1:{let O;if(q[7]===Symbol.for("react.memo_cache_sentinel"))O=dY.default.createElement(M8,{height:1},dY.default.createElement(T,{color:"error"},$W1)),q[7]=O;else O=q[7];return O}case OW1:{let O;if(q[8]===Symbol.for("react.memo_cache_sentinel"))O=dY.default.createElement(M8,{height:1},dY.default.createElement(T,{color:"error"},OW1)),q[8]=O;else O=q[8];return O}case HW1:{let O;if(q[9]===Symbol.for("react.memo_cache_sentinel"))O=dY.default.createElement(M8,{height:1},dY.default.createElement(T,{color:"error"},HW1,process.env.API_TIMEOUT_MS&&dY.default.createElement(dY.default.Fragment,null," ","(API_TIMEOUT_MS=",process.env.API_TIMEOUT_MS,"ms, try increasing it)"))),q[9]=O;else O=q[9];return O}case BY6:{let O;if(q[10]===Symbol.for("react.memo_cache_sentinel"))O=dY.default.createElement(T,{color:"error"},"We are experiencing high demand for Opus 4."),q[10]=O;else O=q[10];let H;if(q[11]===Symbol.for("react.memo_cache_sentinel"))H=dY.default.createElement(M8,null,dY.default.createElement(m,{flexDirection:"column",gap:1},O,dY.default.createElement(T,null,"To continue immediately, use /model to switch to"," ",KP(rf())," and continue coding."))),q[11]=H;else H=q[11];return H}case hi:{let O;if(q[12]===Symbol.for("react.memo_cache_sentinel"))O=dY.default.createElement(M8,{height:1},dY.default.createElement(SF,null)),q[12]=O;else O=q[12];return O}default:{if($.startsWith(wH)){let D=!w&&$.length>MAq,X=$===wH?`${wH}: Please wait a moment and try again.`:D?$.slice(0,MAq)+"…":$,P;if(q[13]!==X)P=dY.default.createElement(T,{color:"error"},X),q[13]=X,q[14]=P;else P=q[14];let W;if(q[15]!==D)W=D&&dY.default.createElement(oM,null),q[15]=D,q[16]=W;else W=q[16];let Z;if(q[17]!==P||q[18]!==W)Z=dY.default.createElement(M8,null,dY.default.createElement(m,{flexDirection:"column"},P,W)),q[17]=P,q[18]=W,q[19]=Z;else Z=q[19];return Z}let O=Y?1:0,H;if(q[20]!==z)H=z&&dY.default.createElement(m,{minWidth:2},dY.default.createElement(T,{color:"text"},B9)),q[20]=z,q[21]=H;else H=q[21];let j;if(q[22]!==$)j=dY.default.createElement(m,{flexDirection:"column"},dY.default.createElement(PO,null,$)),q[22]=$,q[23]=j;else j=q[23];let J;if(q[24]!==H||q[25]!==j)J=dY.default.createElement(m,{flexDirection:"row"},H,j),q[24]=H,q[25]=j,q[26]=J;else J=q[26];let M;if(q[27]!==O||q[28]!==J)M=dY.default.createElement(m,{alignItems:"flex-start",flexDirection:"row",justifyContent:"space-between",marginTop:O,width:"100%"},J),q[27]=O,q[28]=J,q[29]=M;else M=q[29];return M}}}var dY,MAq=1000;var XAq=k(()=>{K1();n6();vF();SA();j$();JL();DK();Xq();uV1();bi();FG6();Hv8();Zw6();JAq();QS();dY=e(W6(),1)});function $L1(A){let q=Y6(8),{param:K,addMargin:Y}=A,{text:z}=K,w;if(q[0]!==z)w=Pq(z,"bash-input"),q[0]=z,q[1]=w;else w=q[1];let _=w;if(!_)return null;let $=Y?1:0,O;if(q[2]===Symbol.for("react.memo_cache_sentinel"))O=W26.createElement(T,{color:"bashBorder"},"! "),q[2]=O;else O=q[2];let H;if(q[3]!==_)H=W26.createElement(T,{color:"text"},_),q[3]=_,q[4]=H;else H=q[4];let j;if(q[5]!==$||q[6]!==H)j=W26.createElement(m,{flexDirection:"row",marginTop:$,backgroundColor:"bashMessageBackgroundColor",paddingRight:1},O,H),q[5]=$,q[6]=H,q[7]=j;else j=q[7];return j}var W26;var pF8=k(()=>{K1();n6();SA();W26=e(W6(),1)});function PAq(A){let q=Y6(19),{addMargin:K,param:Y}=A,{text:z}=Y,w;if(q[0]!==z)w=Pq(z,T0),q[0]=z,q[1]=w;else w=q[1];let _=w,$;if(q[2]!==z)$=Pq(z,"command-args"),q[2]=z,q[3]=$;else $=q[3];let O=$,H=Pq(z,"skill-format")==="true";if(!_)return null;if(H){let W=K?1:0,Z;if(q[4]===Symbol.for("react.memo_cache_sentinel"))Z=xW.createElement(T,{color:"subtle"},q1.pointer," "),q[4]=Z;else Z=q[4];let G;if(q[5]!==_)G=xW.createElement(T,null,Z,xW.createElement(T,{color:"text"},"Skill(",_,")")),q[5]=_,q[6]=G;else G=q[6];let f;if(q[7]!==W||q[8]!==G)f=xW.createElement(m,{flexDirection:"column",marginTop:W,backgroundColor:"userMessageBackground",paddingRight:1},G),q[7]=W,q[8]=G,q[9]=f;else f=q[9];return f}let j;if(q[10]!==O||q[11]!==_)j=[_,O].filter(Boolean),q[10]=O,q[11]=_,q[12]=j;else j=q[12];let J=`/${j.join(" ")}`,M=K?1:0,D;if(q[13]===Symbol.for("react.memo_cache_sentinel"))D=xW.createElement(T,{color:"subtle"},q1.pointer," "),q[13]=D;else D=q[13];let X;if(q[14]!==J)X=xW.createElement(T,null,D,xW.createElement(T,{color:"text"},J)),q[14]=J,q[15]=X;else X=q[15];let P;if(q[16]!==M||q[17]!==X)P=xW.createElement(m,{flexDirection:"column",marginTop:M,backgroundColor:"userMessageBackground",paddingRight:1},X),q[16]=M,q[17]=X,q[18]=P;else P=q[18];return P}var xW;var WAq=k(()=>{K1();t7();n6();SA();Ez();xW=e(W6(),1)});function ZAq(A){let q=Y6(9),{text:K}=A,Y,z;if(q[0]!==K){z=Symbol.for("react.early_return_sentinel");A:{let $=id()?OL1(K):[];if($.length===0){let H;if(q[3]===Symbol.for("react.memo_cache_sentinel"))H=uW.createElement(T,{color:"subtle"},q1.pointer," "),q[3]=H;else H=q[3];let j=uW.createElement(T,{color:"text"},K),J;if(q[4]!==j)J=uW.createElement(T,null,H,j),q[4]=j,q[5]=J;else J=q[5];z=J;break A}Y=[];let O=0;for(let H of $){if(H.start>O)Y.push(uW.createElement(T,{key:`plain-${O}`,color:"text"},K.slice(O,H.start)));for(let j=H.start;j{K1();t7();n6();UI();uW=e(W6(),1)});function fAq(A){let q=Y6(5),{addMargin:K,param:Y}=A,{text:z}=Y;if(!z)return $6(Error("No content found in user prompt message")),null;let w=K?1:0,_;if(q[0]!==z)_=dF8.default.createElement(ZAq,{text:z}),q[0]=z,q[1]=_;else _=q[1];let $;if(q[2]!==w||q[3]!==_)$=dF8.default.createElement(m,{flexDirection:"column",marginTop:w,backgroundColor:"userMessageBackground",paddingRight:1},_),q[2]=w,q[3]=_,q[4]=$;else $=q[4];return $}var dF8;var TAq=k(()=>{K1();n6();x1();GAq();dF8=e(W6(),1)});var vL="(no content)";var VAq=C((kr6,Er6)=>{(function(){var A,q="4.17.21",K=200,Y="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",z="Expected a function",w="Invalid `variable` option passed into `_.template`",_="__lodash_hash_undefined__",$=500,O="__lodash_placeholder__",H=1,j=2,J=4,M=1,D=2,X=1,P=2,W=4,Z=8,G=16,f=32,V=64,N=128,v=256,y=512,R=30,h="...",B=800,x=16,F=1,g=2,b=3,U=1/0,d=9007199254740991,l=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,t=NaN,s=4294967295,H6=s-1,Z6=s>>>1,G6=[["ary",N],["bind",X],["bindKey",P],["curry",Z],["curryRight",G],["flip",y],["partial",f],["partialRight",V],["rearg",v]],q6="[object Arguments]",w6="[object Array]",j6="[object AsyncFunction]",_6="[object Boolean]",k6="[object Date]",P6="[object DOMException]",A6="[object Error]",K6="[object Function]",z6="[object GeneratorFunction]",a="[object Map]",r="[object Number]",X6="[object Null]",O6="[object Object]",D6="[object Promise]",y6="[object Proxy]",C6="[object RegExp]",h6="[object Set]",f6="[object String]",M6="[object Symbol]",V6="[object Undefined]",p6="[object WeakMap]",b6="[object WeakSet]",R6="[object ArrayBuffer]",x6="[object DataView]",d6="[object Float32Array]",t6="[object Float64Array]",L6="[object Int8Array]",u6="[object Int16Array]",e6="[object Int32Array]",H1="[object Uint8Array]",Z1="[object Uint8ClampedArray]",v1="[object Uint16Array]",T6="[object Uint32Array]",v6=/\b__p \+= '';/g,A1=/\b(__p \+=) '' \+/g,F6=/(__e\(.*?\)|\b__t\)) \+\n'';/g,m6=/&(?:amp|lt|gt|quot|#39);/g,l6=/[&<>"']/g,N1=RegExp(m6.source),X1=RegExp(l6.source),k1=/<%-([\s\S]+?)%>/g,i1=/<%([\s\S]+?)%>/g,t8=/<%=([\s\S]+?)%>/g,s8=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_7=/^\w*$/,X7=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,RA=/[\\^$.*+?()[\]{}|]/g,M7=RegExp(RA.source),Fq=/^\s+/,aA=/\s/,a7=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,P7=/\{\n\/\* \[wrapped with (.+)\] \*/,g4=/,? & /,Mq=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,nY=/[()=,{}\[\]\/\s]/,HK=/\\(\\)?/g,Gz=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,CY=/\w*$/,l9=/^[-+]0x[0-9a-f]+$/i,fz=/^0b[01]+$/i,a_=/^\[object .+?Constructor\]$/,VH=/^0o[0-7]+$/i,R9=/^(?:0|[1-9]\d*)$/,DY=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Rw=/($^)/,B$=/['\n\r\u2028\u2029\\]/g,Wq="\\ud800-\\udfff",XY="\\u0300-\\u036f",H_="\\ufe20-\\ufe2f",k4="\\u20d0-\\u20ff",D3=XY+H_+k4,x5="\\u2700-\\u27bf",S9="a-z\\xdf-\\xf6\\xf8-\\xff",H5="\\xac\\xb1\\xd7\\xf7",PY="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",C4="\\u2000-\\u206f",x2=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Tz="A-Z\\xc0-\\xd6\\xd8-\\xde",UK="\\ufe0e\\ufe0f",Sw=H5+PY+C4+x2,NH="['’]",Y1="["+Wq+"]",w1="["+Sw+"]",R1="["+D3+"]",F1="\\d+",e1="["+x5+"]",y8="["+S9+"]",AA="[^"+Wq+Sw+F1+x5+S9+Tz+"]",C1="\\ud83c[\\udffb-\\udfff]",k8="(?:"+R1+"|"+C1+")",g8="[^"+Wq+"]",o8="(?:\\ud83c[\\udde6-\\uddff]){2}",WA="[\\ud800-\\udbff][\\udc00-\\udfff]",y7="["+Tz+"]",N3="\\u200d",x4="(?:"+y8+"|"+AA+")",W4="(?:"+y7+"|"+AA+")",Aq="(?:"+NH+"(?:d|ll|m|re|s|t|ve))?",t5="(?:"+NH+"(?:D|LL|M|RE|S|T|VE))?",pK=k8+"?",C9="["+UK+"]?",j_="(?:"+N3+"(?:"+[g8,o8,WA].join("|")+")"+C9+pK+")*",u2="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Vz="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",F4=C9+pK+j_,yO="(?:"+[e1,o8,WA].join("|")+")"+F4,ww="(?:"+[g8+R1+"?",R1,o8,WA,Y1].join("|")+")",fK=RegExp(NH,"g"),vq=RegExp(R1,"g"),XV=RegExp(C1+"(?="+C1+")|"+ww+F4,"g"),wk=RegExp([y7+"?"+y8+"+"+Aq+"(?="+[w1,y7,"$"].join("|")+")",W4+"+"+t5+"(?="+[w1,y7+x4,"$"].join("|")+")",y7+"?"+x4+"+"+Aq,y7+"+"+t5,Vz,u2,F1,yO].join("|"),"g"),Cw=RegExp("["+N3+Wq+D3+UK+"]"),MZ=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,GD=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Dj=-1,v3={};v3[d6]=v3[t6]=v3[L6]=v3[u6]=v3[e6]=v3[H1]=v3[Z1]=v3[v1]=v3[T6]=!0,v3[q6]=v3[w6]=v3[R6]=v3[_6]=v3[x6]=v3[k6]=v3[A6]=v3[K6]=v3[a]=v3[r]=v3[O6]=v3[C6]=v3[h6]=v3[f6]=v3[p6]=!1;var dK={};dK[q6]=dK[w6]=dK[R6]=dK[x6]=dK[_6]=dK[k6]=dK[d6]=dK[t6]=dK[L6]=dK[u6]=dK[e6]=dK[a]=dK[r]=dK[O6]=dK[C6]=dK[h6]=dK[f6]=dK[M6]=dK[H1]=dK[Z1]=dK[v1]=dK[T6]=!0,dK[A6]=dK[K6]=dK[p6]=!1;var OJ={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},z2={"&":"&","<":"<",">":">",'"':""","'":"'"},vH={"&":"&","<":"<",">":">",""":'"',"'":"'"},HJ={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},zM=parseFloat,WY=parseInt,B2=typeof global=="object"&&global&&global.Object===Object&&global,m2=typeof self=="object"&&self&&self.Object===Object&&self,X3=B2||m2||Function("return this")(),kH=typeof kr6=="object"&&kr6&&!kr6.nodeType&&kr6,RO=kH&&typeof Er6=="object"&&Er6&&!Er6.nodeType&&Er6,Xj=RO&&RO.exports===kH,Pj=Xj&&B2.process,_w=function(){try{var K8=RO&&RO.require&&RO.require("util").types;if(K8)return K8;return Pj&&Pj.binding&&Pj.binding("util")}catch(zA){}}(),TA=_w&&_w.isArrayBuffer,IA=_w&&_w.isDate,qq=_w&&_w.isMap,P3=_w&&_w.isRegExp,Dq=_w&&_w.isSet,i9=_w&&_w.isTypedArray;function hY(K8,zA,F8){switch(F8.length){case 0:return K8.call(zA);case 1:return K8.call(zA,F8[0]);case 2:return K8.call(zA,F8[0],F8[1]);case 3:return K8.call(zA,F8[0],F8[1],F8[2])}return K8.apply(zA,F8)}function z4(K8,zA,F8,Z4){var TK=-1,u5=K8==null?0:K8.length;while(++TK-1}function m$(K8,zA,F8){var Z4=-1,TK=K8==null?0:K8.length;while(++Z4-1);return F8}function e3(K8,zA){var F8=K8.length;while(F8--&&fD(zA,K8[F8],0)>-1);return F8}function g$(K8,zA){var F8=K8.length,Z4=0;while(F8--)if(K8[F8]===zA)++Z4;return Z4}var J_=U8(OJ),hO=U8(z2);function $k(K8){return"\\"+HJ[K8]}function yh(K8,zA){return K8==null?A:K8[zA]}function DZ(K8){return Cw.test(K8)}function w0(K8){return MZ.test(K8)}function Yo(K8){var zA,F8=[];while(!(zA=K8.next()).done)F8.push(zA.value);return F8}function Kf(K8){var zA=-1,F8=Array(K8.size);return K8.forEach(function(Z4,TK){F8[++zA]=[TK,Z4]}),F8}function oU(K8,zA){return function(F8){return K8(zA(F8))}}function IO(K8,zA){var F8=-1,Z4=K8.length,TK=0,u5=[];while(++F8-1}function W61(u,Q){var o=this.__data__,S6=mh(o,u);if(S6<0)++this.size,o.push([u,Q]);else o[S6][1]=Q;return this}j5.prototype.clear=YO6,j5.prototype.delete=P61,j5.prototype.get=aL6,j5.prototype.has=zO6,j5.prototype.set=W61;function Wy(u){var Q=-1,o=u==null?0:u.length;this.clear();while(++Q=Q?u:Q}return u}function fZ(u,Q,o,S6,s6,W1){var b1,r1=Q&H,P8=Q&j,NA=Q&J;if(o)b1=s6?o(u,S6,s6,W1):o(u);if(b1!==A)return b1;if(!yH(u))return u;var yA=H4(u);if(yA){if(b1=Ny6(u),!r1)return TZ(u,b1)}else{var UA=MJ(u),D4=UA==K6||UA==z6;if(Lo(u))return g61(u,r1);if(UA==O6||UA==q6||D4&&!s6){if(b1=P8||D4?{}:e61(u),!r1)return P8?Nm1(u,Yy6(b1,u)):Vm1(u,Ky6(b1,u))}else{if(!dK[UA])return s6?u:{};b1=Rm1(u,UA,r1)}}W1||(W1=new _f);var Iq=W1.get(u);if(Iq)return Iq;if(W1.set(u,b1),hAA(u))u.forEach(function(lK){b1.add(fZ(lK,Q,o,lK,u,W1))});else if(SAA(u))u.forEach(function(lK,o9){b1.set(o9,fZ(lK,Q,o,o9,u,W1))});var cK=NA?P8?NO6:EH:P8?NV:hX,A9=yA?A:cK(u);return J9(A9||u,function(lK,o9){if(A9)o9=lK,lK=u[o9];WB(b1,o9,fZ(lK,Q,o,o9,u,W1))}),b1}function zy6(u){var Q=hX(u);return function(o){return $O6(o,u,Q)}}function $O6(u,Q,o){var S6=o.length;if(u==null)return!S6;u=Nz(u);while(S6--){var s6=o[S6],W1=Q[s6],b1=u[s6];if(b1===A&&!(s6 in u)||!W1(b1))return!1}return!0}function Fh(u,Q,o){if(typeof u!="function")throw new VD(z);return CX(function(){u.apply(A,o)},Q)}function Yp(u,Q,o,S6){var s6=-1,W1=s_,b1=!0,r1=u.length,P8=[],NA=Q.length;if(!r1)return P8;if(o)Q=e5(Q,h1(o));if(S6)W1=m$,b1=!1;else if(Q.length>=K)W1=S7,b1=!1,Q=new wf(Q);A:while(++s6s6?0:s6+o;if(S6=S6===A||S6>s6?s6:m5(S6),S6<0)S6+=s6;S6=o>S6?0:bAA(S6);while(o0&&o(r1))if(Q>1)ND(r1,Q-1,o,S6,s6);else t_(s6,r1);else if(!S6)s6[s6.length]=r1}return s6}var OO6=c61(),Ho=c61(!0);function fy(u,Q){return u&&OO6(u,Q,hX)}function _y6(u,Q){return u&&Ho(u,Q,hX)}function HO6(u,Q){return hw(Q,function(o){return vp(u[o])})}function wp(u,Q){Q=Ny(Q,u);var o=0,S6=Q.length;while(u!=null&&oQ}function JO6(u,Q){return u!=null&&IY.call(u,Q)}function E61(u,Q){return u!=null&&Q in Nz(u)}function Ym1(u,Q,o){return u>=e_(Q,o)&&u=120&&yA.length>=120)?new wf(b1&&yA):A}yA=u[0];var UA=-1,D4=r1[0];A:while(++UA-1){if(r1!==u)ZZ.call(r1,P8,1);ZZ.call(u,P8,1)}}return u}function jo(u,Q){var o=u?Q.length:0,S6=o-1;while(o--){var s6=Q[o];if(o==S6||s6!==W1){var W1=s6;if(ph(s6))ZZ.call(u,s6,1);else Xy6(u,s6)}}return u}function Jy6(u,Q){return u+Ap(yX()*(Q-u+1))}function jm1(u,Q,o,S6){var s6=-1,W1=Jw(eU((Q-u)/(o||1)),0),b1=F8(W1);while(W1--)b1[S6?W1:++s6]=u,u+=o;return b1}function My6(u,Q){var o="";if(!u||Q<1||Q>d)return o;do{if(Q%2)o+=u;if(Q=Ap(Q/2),Q)u+=u}while(Q);return o}function B5(u,Q){return ky(Hp(u,Q,vV),u+"")}function Jm1(u){return _O6(iO6(u))}function Mm1(u,Q){var o=iO6(u);return Gj(o,gh(Q,0,o.length))}function A46(u,Q,o,S6){if(!yH(u))return u;Q=Ny(Q,u);var s6=-1,W1=Q.length,b1=W1-1,r1=u;while(r1!=null&&++s6s6?0:s6+Q;if(o=o>s6?s6:o,o<0)o+=s6;s6=Q>o?0:o-Q>>>0,Q>>>=0;var W1=F8(s6);while(++S6>>1,b1=u[W1];if(b1!==null&&!Tk(b1)&&(o?b1<=Q:b1=K){var NA=Q?null:o61(u);if(NA)return My(NA);b1=!1,s6=S7,P8=new wf}else P8=Q?[]:r1;A:while(++S6=S6?u:WV(u,Q,o)}var m61=Ih||function(u){return X3.clearTimeout(u)};function g61(u,Q){if(Q)return u.slice();var o=u.length,S6=jJ?jJ(o):new u.constructor(o);return u.copy(S6),S6}function XO6(u){var Q=new u.constructor(u.byteLength);return new MB(Q).set(new MB(u)),Q}function Zm1(u,Q){var o=Q?XO6(u.buffer):u.buffer;return new u.constructor(o,u.byteOffset,u.byteLength)}function Gm1(u){var Q=new u.constructor(u.source,CY.exec(u));return Q.lastIndex=u.lastIndex,Q}function fm1(u){return tA?Nz(tA.call(u)):{}}function F61(u,Q){var o=Q?XO6(u.buffer):u.buffer;return new u.constructor(o,u.byteOffset,u.length)}function Q61(u,Q){if(u!==Q){var o=u!==A,S6=u===null,s6=u===u,W1=Tk(u),b1=Q!==A,r1=Q===null,P8=Q===Q,NA=Tk(Q);if(!r1&&!NA&&!W1&&u>Q||W1&&b1&&P8&&!r1&&!NA||S6&&b1&&P8||!o&&P8||!s6)return 1;if(!S6&&!W1&&!NA&&u=r1)return P8;var NA=o[S6];return P8*(NA=="desc"?-1:1)}}return u.index-Q.index}function U61(u,Q,o,S6){var s6=-1,W1=u.length,b1=o.length,r1=-1,P8=Q.length,NA=Jw(W1-b1,0),yA=F8(P8+NA),UA=!S6;while(++r11?o[s6-1]:A,b1=s6>2?o[2]:A;if(W1=u.length>3&&typeof W1=="function"?(s6--,W1):A,b1&&ED(o[0],o[1],b1))W1=s6<3?A:W1,s6=1;Q=Nz(Q);while(++S6-1?s6[W1?Q[b1]:b1]:A}}function n61(u){return Uh(function(Q){var o=Q.length,S6=o,s6=mq.prototype.thru;if(u)Q.reverse();while(S6--){var W1=Q[S6];if(typeof W1!="function")throw new VD(z);if(s6&&!b1&&_46(W1)=="wrapper")var b1=new mq([],!0)}S6=b1?S6:o;while(++S61)bY.reverse();if(yA&&P8r1))return!1;var NA=W1.get(u),yA=W1.get(Q);if(NA&&yA)return NA==Q&&yA==u;var UA=-1,D4=!0,Iq=o&D?new wf:A;W1.set(u,Q),W1.set(Q,u);while(++UA1?"& ":"")+Q[S6],Q=Q.join(o>2?", ":" "),u.replace(a7,`{ /* [wrapped with `+Q+`] */ `)}function A11(u){return H4(u)||oq(u)||!!(wo&&u&&u[wo])}function ph(u,Q){var o=typeof u;return Q=Q==null?d:Q,!!Q&&(o=="number"||o!="symbol"&&R9.test(u))&&(u>-1&&u%1==0&&u0){if(++Q>=B)return arguments[0]}else Q=0;return u.apply(A,arguments)}}function Gj(u,Q){var o=-1,S6=u.length,s6=S6-1;Q=Q===A?S6:Q;while(++o1?u[Q-1]:A;return o=typeof o=="function"?(u.pop(),o):A,uO6(u,o)});function my6(u){var Q=a6(u);return Q.__chain__=!0,Q}function $M(u,Q){return Q(u),u}function Q$(u,Q){return Q(u)}var vZ=Uh(function(u){var Q=u.length,o=Q?u[0]:0,S6=this.__wrapped__,s6=function(W1){return Gy(W1,u)};if(Q>1||this.__actions__.length||!(S6 instanceof Zq)||!ph(o))return this.thru(s6);return S6=S6.slice(o,+o+(Q?1:0)),S6.__actions__.push({func:Q$,args:[s6],thisArg:A}),new mq(S6,this.__chain__).thru(function(W1){if(Q&&!W1.length)W1.push(A);return W1})});function Wk(){return my6(this)}function No(){return new mq(this.value(),this.__chain__)}function xm1(){if(this.__values__===A)this.__values__=IAA(this.value());var u=this.__index__>=this.__values__.length,Q=u?A:this.__values__[this.__index__++];return{done:u,value:Q}}function BO6(){return this}function mO6(u){var Q,o=this;while(o instanceof hq){var S6=q$(o);if(S6.__index__=0,S6.__values__=A,Q)s6.__wrapped__=S6;else Q=S6;var s6=S6;o=o.__wrapped__}return s6.__wrapped__=u,Q}function gO6(){var u=this.__wrapped__;if(u instanceof Zq){var Q=u;if(this.__actions__.length)Q=new Zq(this);return Q=Q.reverse(),Q.__actions__.push({func:Q$,args:[NB],thisArg:A}),new mq(Q,this.__chain__)}return this.thru(NB)}function FO6(){return B61(this.__wrapped__,this.__actions__)}var QO6=PO6(function(u,Q,o){if(IY.call(u,o))++u[o];else Zy(u,o,1)});function D46(u,Q,o){var S6=H4(u)?SO:Km1;if(o&&ED(u,Q,o))Q=A;return S6(u,Qq(Q,3))}function um1(u,Q){var o=H4(u)?hw:v61;return o(u,Qq(Q,3))}var D9=i61(H46),_2=i61(Dp);function X9(u,Q){return ND(Zk(u,Q),1)}function I9(u,Q){return ND(Zk(u,Q),U)}function Mw(u,Q,o){return o=o===A?1:m5(o),ND(Zk(u,Q),o)}function kZ(u,Q){var o=H4(u)?J9:ZB;return o(u,Qq(Q,3))}function ih(u,Q){var o=H4(u)?$w:wy6;return o(u,Qq(Q,3))}var vo=PO6(function(u,Q,o){if(IY.call(u,o))u[o].push(Q);else Zy(u,o,[Q])});function gy6(u,Q,o,S6){u=k3(u)?u:iO6(u),o=o&&!S6?m5(o):0;var s6=u.length;if(o<0)o=Jw(s6+o,0);return H11(u)?o<=s6&&u.indexOf(Q,o)>-1:!!s6&&fD(u,Q,o)>-1}var nh=B5(function(u,Q,o){var S6=-1,s6=typeof Q=="function",W1=k3(u)?F8(u.length):[];return ZB(u,function(b1){W1[++S6]=s6?hY(Q,b1,o):$f(b1,Q,o)}),W1}),bO=PO6(function(u,Q,o){Zy(u,o,Q)});function Zk(u,Q){var o=H4(u)?e5:Hy6;return o(u,Qq(Q,3))}function Tp(u,Q,o,S6){if(u==null)return[];if(!H4(Q))Q=Q==null?[]:[Q];if(o=S6?A:o,!H4(o))o=o==null?[]:[o];return h61(u,Q,o)}var Fy6=PO6(function(u,Q,o){u[o?0:1].push(Q)},function(){return[[],[]]});function Df(u,Q,o){var S6=H4(u)?Ow:R7,s6=arguments.length<3;return S6(u,Qq(Q,4),o,s6,ZB)}function ko(u,Q,o){var S6=H4(u)?LX:R7,s6=arguments.length<3;return S6(u,Qq(Q,4),o,s6,wy6)}function X46(u,Q){var o=H4(u)?hw:v61;return o(u,n(Qq(Q,3)))}function EZ(u){var Q=H4(u)?_O6:Jm1;return Q(u)}function Qy6(u,Q,o){if(o?ED(u,Q,o):Q===A)Q=1;else Q=m5(Q);var S6=H4(u)?M9:Mm1;return S6(u,Q)}function UO6(u){var Q=H4(u)?Ay6:Xm1;return Q(u)}function $11(u){if(u==null)return 0;if(k3(u))return H11(u)?Ok(u):u.length;var Q=MJ(u);if(Q==a||Q==h6)return u.size;return t76(u).length}function P46(u,Q,o){var S6=H4(u)?z0:Pm1;if(o&&ED(u,Q,o))Q=A;return S6(u,Qq(Q,3))}var pO6=B5(function(u,Q){if(u==null)return[];var o=Q.length;if(o>1&&ED(u,Q[0],Q[1]))Q=[];else if(o>2&&ED(Q[0],Q[1],Q[2]))Q=[Q[0]];return h61(u,ND(Q,1),[])}),Gk=tU||function(){return X3.Date.now()};function DJ(u,Q){if(typeof Q!="function")throw new VD(z);return u=m5(u),function(){if(--u<1)return Q.apply(this,arguments)}}function rh(u,Q,o){return Q=o?A:Q,Q=u&&Q==null?u.length:Q,Qh(u,N,A,A,A,A,Q)}function Vp(u,Q){var o;if(typeof Q!="function")throw new VD(z);return u=m5(u),function(){if(--u>0)o=Q.apply(this,arguments);if(u<=1)Q=A;return o}}var fk=B5(function(u,Q,o){var S6=X;if(o.length){var s6=IO(o,Op(fk));S6|=f}return Qh(u,S6,Q,o,s6)}),dO6=B5(function(u,Q,o){var S6=X|P;if(o.length){var s6=IO(o,Op(dO6));S6|=f}return Qh(Q,S6,u,o,s6)});function cO6(u,Q,o){Q=o?A:Q;var S6=Qh(u,Z,A,A,A,A,A,Q);return S6.placeholder=cO6.placeholder,S6}function Uy6(u,Q,o){Q=o?A:Q;var S6=Qh(u,G,A,A,A,A,A,Q);return S6.placeholder=Uy6.placeholder,S6}function Eo(u,Q,o){var S6,s6,W1,b1,r1,P8,NA=0,yA=!1,UA=!1,D4=!0;if(typeof u!="function")throw new VD(z);if(Q=Ly(Q)||0,yH(o))yA=!!o.leading,UA="maxWait"in o,W1=UA?Jw(Ly(o.maxWait)||0,Q):W1,D4="trailing"in o?!!o.trailing:D4;function Iq(XJ){var oh=S6,Ep=s6;return S6=s6=A,NA=XJ,b1=u.apply(Ep,oh),b1}function cK(XJ){return NA=XJ,r1=CX(o9,Q),yA?Iq(XJ):b1}function A9(XJ){var oh=XJ-P8,Ep=XJ-NA,lAA=Q-oh;return UA?e_(lAA,W1-Ep):lAA}function lK(XJ){var oh=XJ-P8,Ep=XJ-NA;return P8===A||oh>=Q||oh<0||UA&&Ep>=W1}function o9(){var XJ=Gk();if(lK(XJ))return bY(XJ);r1=CX(o9,A9(XJ))}function bY(XJ){if(r1=A,D4&&S6)return Iq(XJ);return S6=s6=A,b1}function Vk(){if(r1!==A)m61(r1);NA=0,S6=P8=s6=r1=A}function Xf(){return r1===A?b1:bY(Gk())}function Nk(){var XJ=Gk(),oh=lK(XJ);if(S6=arguments,s6=this,P8=XJ,oh){if(r1===A)return cK(P8);if(UA)return m61(r1),r1=CX(o9,Q),Iq(P8)}if(r1===A)r1=CX(o9,Q);return b1}return Nk.cancel=Vk,Nk.flush=Xf,Nk}var py6=B5(function(u,Q){return Fh(u,1,Q)}),E=B5(function(u,Q,o){return Fh(u,Ly(Q)||0,o)});function S(u){return Qh(u,y)}function p(u,Q){if(typeof u!="function"||Q!=null&&typeof Q!="function")throw new VD(z);var o=function(){var S6=arguments,s6=Q?Q.apply(this,S6):S6[0],W1=o.cache;if(W1.has(s6))return W1.get(s6);var b1=u.apply(this,S6);return o.cache=W1.set(s6,b1)||W1,b1};return o.cache=new(p.Cache||Wy),o}p.Cache=Wy;function n(u){if(typeof u!="function")throw new VD(z);return function(){var Q=arguments;switch(Q.length){case 0:return!u.call(this);case 1:return!u.call(this,Q[0]);case 2:return!u.call(this,Q[0],Q[1]);case 3:return!u.call(this,Q[0],Q[1],Q[2])}return!u.apply(this,Q)}}function J6(u){return Vp(2,u)}var E6=Wm1(function(u,Q){Q=Q.length==1&&H4(Q[0])?e5(Q[0],h1(Qq())):e5(ND(Q,1),h1(Qq()));var o=Q.length;return B5(function(S6){var s6=-1,W1=e_(S6.length,o);while(++s6=Q}),oq=kD(function(){return arguments}())?kD:function(u){return Nj(u)&&IY.call(u,"callee")&&!JJ.call(u,"callee")},H4=F8.isArray,OM=TA?h1(TA):Ty;function k3(u){return u!=null&&O11(u.length)&&!vp(u)}function xw(u){return Nj(u)&&k3(u)}function Bm1(u){return u===!0||u===!1||Nj(u)&&vD(u)==_6}var Lo=oL6||nm1,vaq=IA?h1(IA):SX;function kaq(u){return Nj(u)&&u.nodeType===1&&!dy6(u)}function Eaq(u){if(u==null)return!0;if(k3(u)&&(H4(u)||typeof u=="string"||typeof u.splice=="function"||Lo(u)||lO6(u)||oq(u)))return!u.length;var Q=MJ(u);if(Q==a||Q==h6)return!u.size;if(LD(u))return!t76(u).length;for(var o in u)if(IY.call(u,o))return!1;return!0}function Laq(u,Q){return s76(u,Q)}function yaq(u,Q,o){o=typeof o=="function"?o:A;var S6=o?o(u,Q):A;return S6===A?s76(u,Q,A,o):!!S6}function mm1(u){if(!Nj(u))return!1;var Q=vD(u);return Q==A6||Q==P6||typeof u.message=="string"&&typeof u.name=="string"&&!dy6(u)}function Raq(u){return typeof u=="number"&&qp(u)}function vp(u){if(!yH(u))return!1;var Q=vD(u);return Q==K6||Q==z6||Q==j6||Q==y6}function RAA(u){return typeof u=="number"&&u==m5(u)}function O11(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=d}function yH(u){var Q=typeof u;return u!=null&&(Q=="object"||Q=="function")}function Nj(u){return u!=null&&typeof u=="object"}var SAA=qq?h1(qq):_M;function Saq(u,Q){return u===Q||Dk(u,Q,TB(Q))}function Caq(u,Q,o){return o=typeof o=="function"?o:A,Dk(u,Q,TB(Q),o)}function haq(u){return CAA(u)&&u!=+u}function Iaq(u){if(jf(u))throw new TK(Y);return L61(u)}function baq(u){return u===null}function xaq(u){return u==null}function CAA(u){return typeof u=="number"||Nj(u)&&vD(u)==r}function dy6(u){if(!Nj(u)||vD(u)!=O6)return!1;var Q=_0(u);if(Q===null)return!0;var o=IY.call(Q,"constructor")&&Q.constructor;return typeof o=="function"&&o instanceof o&&sU.call(o)==Jk}var gm1=P3?h1(P3):wm1;function uaq(u){return RAA(u)&&u>=-d&&u<=d}var hAA=Dq?h1(Dq):_m1;function H11(u){return typeof u=="string"||!H4(u)&&Nj(u)&&vD(u)==f6}function Tk(u){return typeof u=="symbol"||Nj(u)&&vD(u)==M6}var lO6=i9?h1(i9):$m1;function Baq(u){return u===A}function maq(u){return Nj(u)&&MJ(u)==p6}function gaq(u){return Nj(u)&&vD(u)==b6}var Faq=w46(Oy6),Qaq=w46(function(u,Q){return u<=Q});function IAA(u){if(!u)return[];if(k3(u))return H11(u)?TD(u):TZ(u);if(hh&&u[hh])return Yo(u[hh]());var Q=MJ(u),o=Q==a?Kf:Q==h6?My:iO6;return o(u)}function kp(u){if(!u)return u===0?u:0;if(u=Ly(u),u===U||u===-U){var Q=u<0?-1:1;return Q*l}return u===u?u:0}function m5(u){var Q=kp(u),o=Q%1;return Q===Q?o?Q-o:Q:0}function bAA(u){return u?gh(m5(u),0,s):0}function Ly(u){if(typeof u=="number")return u;if(Tk(u))return t;if(yH(u)){var Q=typeof u.valueOf=="function"?u.valueOf():u;u=yH(Q)?Q+"":Q}if(typeof u!="string")return u===0?u:+u;u=CO(u);var o=fz.test(u);return o||VH.test(u)?WY(u.slice(2),o?2:8):l9.test(u)?t:+u}function xAA(u){return vy(u,NV(u))}function Uaq(u){return u?gh(m5(u),-d,d):u===0?u:0}function uw(u){return u==null?"":Of(u)}var paq=Jo(function(u,Q){if(LD(Q)||k3(Q)){vy(Q,hX(Q),u);return}for(var o in Q)if(IY.call(Q,o))WB(u,o,Q[o])}),uAA=Jo(function(u,Q){vy(Q,NV(Q),u)}),j11=Jo(function(u,Q,o,S6){vy(Q,NV(Q),u,S6)}),daq=Jo(function(u,Q,o,S6){vy(Q,hX(Q),u,S6)}),caq=Uh(Gy);function laq(u,Q){var o=KK(u);return Q==null?o:Ky6(o,Q)}var iaq=B5(function(u,Q){u=Nz(u);var o=-1,S6=Q.length,s6=S6>2?Q[2]:A;if(s6&&ED(Q[0],Q[1],s6))S6=1;while(++o1),W1}),vy(u,NO6(u),o),S6)o=fZ(o,H|j|J,Lm1);var s6=Q.length;while(s6--)Xy6(o,Q[s6]);return o});function jsq(u,Q){return mAA(u,n(Qq(Q)))}var Jsq=Uh(function(u,Q){return u==null?{}:e76(u,Q)});function mAA(u,Q){if(u==null)return{};var o=e5(NO6(u),function(S6){return[S6]});return Q=Qq(Q),I61(u,o,function(S6,s6){return Q(S6,s6[0])})}function Msq(u,Q,o){Q=Ny(Q,u);var S6=-1,s6=Q.length;if(!s6)s6=1,u=A;while(++S6Q){var S6=u;u=Q,Q=S6}if(o||u%1||Q%1){var s6=yX();return e_(u+s6*(Q-u+zM("1e-"+((s6+"").length-1))),Q)}return Jy6(u,Q)}var vsq=Mo(function(u,Q,o){return Q=Q.toLowerCase(),u+(o?QAA(Q):Q)});function QAA(u){return Um1(uw(u).toLowerCase())}function UAA(u){return u=uw(u),u&&u.replace(DY,J_).replace(vq,"")}function ksq(u,Q,o){u=uw(u),Q=Of(Q);var S6=u.length;o=o===A?S6:gh(m5(o),0,S6);var s6=o;return o-=Q.length,o>=0&&u.slice(o,s6)==Q}function Esq(u){return u=uw(u),u&&X1.test(u)?u.replace(l6,hO):u}function Lsq(u){return u=uw(u),u&&M7.test(u)?u.replace(RA,"\\$&"):u}var ysq=Mo(function(u,Q,o){return u+(o?"-":"")+Q.toLowerCase()}),Rsq=Mo(function(u,Q,o){return u+(o?" ":"")+Q.toLowerCase()}),Ssq=l61("toLowerCase");function Csq(u,Q,o){u=uw(u),Q=m5(Q);var S6=Q?Ok(u):0;if(!Q||S6>=Q)return u;var s6=(Q-S6)/2;return fO6(Ap(s6),o)+u+fO6(eU(s6),o)}function hsq(u,Q,o){u=uw(u),Q=m5(Q);var S6=Q?Ok(u):0;return Q&&S6>>0,!o)return[];if(u=uw(u),u&&(typeof Q=="string"||Q!=null&&!gm1(Q))){if(Q=Of(Q),!Q&&DZ(u))return fB(TD(u),0,o)}return u.split(Q,o)}var gsq=Mo(function(u,Q,o){return u+(o?" ":"")+Um1(Q)});function Fsq(u,Q,o){return u=uw(u),o=o==null?0:gh(m5(o),0,u.length),Q=Of(Q),u.slice(o,o+Q.length)==Q}function Qsq(u,Q,o){var S6=a6.templateSettings;if(o&&ED(u,Q,o))Q=A;u=uw(u),Q=j11({},Q,S6,Gy6);var s6=j11({},Q.imports,S6.imports,Gy6),W1=hX(s6),b1=VA(s6,W1),r1,P8,NA=0,yA=Q.interpolate||Rw,UA="__p += '",D4=Rh((Q.escape||Rw).source+"|"+yA.source+"|"+(yA===t8?Gz:Rw).source+"|"+(Q.evaluate||Rw).source+"|$","g"),Iq="//# sourceURL="+(IY.call(Q,"sourceURL")?(Q.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Dj+"]")+` `;u.replace(D4,function(lK,o9,bY,Vk,Xf,Nk){if(bY||(bY=Vk),UA+=u.slice(NA,Nk).replace(B$,$k),o9)r1=!0,UA+=`' + __e(`+o9+`) + '`;if(Xf)P8=!0,UA+=`'; `+Xf+`; __p += '`;if(bY)UA+=`' + ((__t = (`+bY+`)) == null ? '' : __t) + '`;return NA=Nk+lK.length,lK}),UA+=`'; `;var cK=IY.call(Q,"variable")&&Q.variable;if(!cK)UA=`with (obj) { `+UA+` } `;else if(nY.test(cK))throw new TK(w);UA=(P8?UA.replace(v6,""):UA).replace(A1,"$1").replace(F6,"$1;"),UA="function("+(cK||"obj")+`) { `+(cK?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(r1?", __e = _.escape":"")+(P8?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+UA+`return __p }`;var A9=dAA(function(){return u5(W1,Iq+"return "+UA).apply(A,b1)});if(A9.source=UA,mm1(A9))throw A9;return A9}function Usq(u){return uw(u).toLowerCase()}function psq(u){return uw(u).toUpperCase()}function dsq(u,Q,o){if(u=uw(u),u&&(o||Q===A))return CO(u);if(!u||!(Q=Of(Q)))return u;var S6=TD(u),s6=TD(Q),W1=E4(S6,s6),b1=e3(S6,s6)+1;return fB(S6,W1,b1).join("")}function csq(u,Q,o){if(u=uw(u),u&&(o||Q===A))return u.slice(0,c76(u)+1);if(!u||!(Q=Of(Q)))return u;var S6=TD(u),s6=e3(S6,TD(Q))+1;return fB(S6,0,s6).join("")}function lsq(u,Q,o){if(u=uw(u),u&&(o||Q===A))return u.replace(Fq,"");if(!u||!(Q=Of(Q)))return u;var S6=TD(u),s6=E4(S6,TD(Q));return fB(S6,s6).join("")}function isq(u,Q){var o=R,S6=h;if(yH(Q)){var s6="separator"in Q?Q.separator:s6;o="length"in Q?m5(Q.length):o,S6="omission"in Q?Of(Q.omission):S6}u=uw(u);var W1=u.length;if(DZ(u)){var b1=TD(u);W1=b1.length}if(o>=W1)return u;var r1=o-Ok(S6);if(r1<1)return S6;var P8=b1?fB(b1,0,r1).join(""):u.slice(0,r1);if(s6===A)return P8+S6;if(b1)r1+=P8.length-r1;if(gm1(s6)){if(u.slice(r1).search(s6)){var NA,yA=P8;if(!s6.global)s6=Rh(s6.source,uw(CY.exec(s6))+"g");s6.lastIndex=0;while(NA=s6.exec(yA))var UA=NA.index;P8=P8.slice(0,UA===A?r1:UA)}}else if(u.indexOf(Of(s6),r1)!=r1){var D4=P8.lastIndexOf(s6);if(D4>-1)P8=P8.slice(0,D4)}return P8+S6}function nsq(u){return u=uw(u),u&&N1.test(u)?u.replace(m6,s$6):u}var rsq=Mo(function(u,Q,o){return u+(o?" ":"")+Q.toUpperCase()}),Um1=l61("toUpperCase");function pAA(u,Q,o){if(u=uw(u),Q=o?A:Q,Q===A)return w0(u)?Hw(u):_k(u);return u.match(Q)||[]}var dAA=B5(function(u,Q){try{return hY(u,A,Q)}catch(o){return mm1(o)?o:new TK(o)}}),osq=Uh(function(u,Q){return J9(Q,function(o){o=yD(o),Zy(u,o,fk(u[o],u))}),u});function asq(u){var Q=u==null?0:u.length,o=Qq();return u=!Q?[]:e5(u,function(S6){if(typeof S6[1]!="function")throw new VD(z);return[o(S6[0]),S6[1]]}),B5(function(S6){var s6=-1;while(++s6d)return[];var o=s,S6=e_(u,s);Q=Qq(Q),u-=s;var s6=n9(S6,Q);while(++o0||Q<0))return new Zq(o);if(u<0)o=o.takeRight(-u);else if(u)o=o.drop(u);if(Q!==A)Q=m5(Q),o=Q<0?o.dropRight(-Q):o.take(Q-u);return o},Zq.prototype.takeRightWhile=function(u){return this.reverse().takeWhile(u).reverse()},Zq.prototype.toArray=function(){return this.take(s)},fy(Zq.prototype,function(u,Q){var o=/^(?:filter|find|map|reject)|While$/.test(Q),S6=/^(?:head|last)$/.test(Q),s6=a6[S6?"take"+(Q=="last"?"Right":""):Q],W1=S6||/^find/.test(Q);if(!s6)return;a6.prototype[Q]=function(){var b1=this.__wrapped__,r1=S6?[1]:arguments,P8=b1 instanceof Zq,NA=r1[0],yA=P8||H4(b1),UA=function(o9){var bY=s6.apply(a6,t_([o9],r1));return S6&&D4?bY[0]:bY};if(yA&&o&&typeof NA=="function"&&NA.length!=1)P8=yA=!1;var D4=this.__chain__,Iq=!!this.__actions__.length,cK=W1&&!D4,A9=P8&&!Iq;if(!W1&&yA){b1=A9?b1:new Zq(this);var lK=u.apply(b1,r1);return lK.__actions__.push({func:Q$,args:[UA],thisArg:A}),new mq(lK,D4)}if(cK&&A9)return u.apply(this,r1);return lK=this.thru(UA),cK?S6?lK.value()[0]:lK.value():lK}}),J9(["pop","push","shift","sort","splice","unshift"],function(u){var Q=Sh[u],o=/^(?:push|sort|unshift)$/.test(u)?"tap":"thru",S6=/^(?:pop|shift)$/.test(u);a6.prototype[u]=function(){var s6=arguments;if(S6&&!this.__chain__){var W1=this.value();return Q.apply(H4(W1)?W1:[],s6)}return this[o](function(b1){return Q.apply(H4(b1)?b1:[],s6)})}}),fy(Zq.prototype,function(u,Q){var o=a6[Q];if(o){var S6=o.name+"";if(!IY.call(Yf,S6))Yf[S6]=[];Yf[S6].push({name:Q,func:o})}}),Yf[WO6(A,P).name]=[{name:"wrapper",func:A}],Zq.prototype.clone=vz,Zq.prototype.reverse=Zj,Zq.prototype.value=h9,a6.prototype.at=vZ,a6.prototype.chain=Wk,a6.prototype.commit=No,a6.prototype.next=xm1,a6.prototype.plant=mO6,a6.prototype.reverse=gO6,a6.prototype.toJSON=a6.prototype.valueOf=a6.prototype.value=FO6,a6.prototype.first=a6.prototype.head,hh)a6.prototype[hh]=BO6;return a6},Xy=t$6();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd)X3._=Xy,define(function(){return Xy});else if(RO)(RO.exports=Xy)._=Xy,kH._=Xy;else X3._=Xy}).call(kr6)});function $sY(){return NAq.sample(["Got it.","Good to know.","Noted."])}function vAq(A){let q=Y6(10),{text:K,addMargin:Y}=A,z;if(q[0]!==K)z=Pq(K,"user-memory-input"),q[0]=K,q[1]=z;else z=q[1];let w=z,_;if(q[2]===Symbol.for("react.memo_cache_sentinel"))_=$sY(),q[2]=_;else _=q[2];let $=_;if(!w)return null;let O=Y?1:0,H;if(q[3]===Symbol.for("react.memo_cache_sentinel"))H=kL.createElement(T,{color:"remember",backgroundColor:"memoryBackgroundColor"},"#"),q[3]=H;else H=q[3];let j;if(q[4]!==w)j=kL.createElement(m,null,H,kL.createElement(T,{backgroundColor:"memoryBackgroundColor",color:"text"}," ",w," ")),q[4]=w,q[5]=j;else j=q[5];let J;if(q[6]===Symbol.for("react.memo_cache_sentinel"))J=kL.createElement(M8,{height:1},kL.createElement(T,{dimColor:!0},$)),q[6]=J;else J=q[6];let M;if(q[7]!==O||q[8]!==j)M=kL.createElement(m,{flexDirection:"column",marginTop:O,width:"100%"},j,J),q[7]=O,q[8]=j,q[9]=M;else M=q[9];return M}var kL,NAq;var kAq=k(()=>{K1();n6();SA();DK();kL=e(W6(),1),NAq=e(VAq(),1)});function Lr6(A){let q=Y6(10),{elapsedTimeSeconds:K,timeoutMs:Y}=A;if(K===void 0&&!Y)return null;let z;if(q[0]!==Y)z=Y?G3(Y,{hideTrailingZeros:!0}):void 0,q[0]=Y,q[1]=z;else z=q[1];let w=z;if(K===void 0){let J=`(timeout ${w})`,M;if(q[2]!==J)M=HL1.default.createElement(T,{dimColor:!0},J),q[2]=J,q[3]=M;else M=q[3];return M}let _=K*1000,$;if(q[4]!==_)$=G3(_),q[4]=_,q[5]=$;else $=q[5];let O=$;if(w){let J=`(${O} · timeout ${w})`,M;if(q[6]!==J)M=HL1.default.createElement(T,{dimColor:!0},J),q[6]=J,q[7]=M;else M=q[7];return M}let H=`(${O})`,j;if(q[8]!==H)j=HL1.default.createElement(T,{dimColor:!0},H),q[8]=H,q[9]=j;else j=q[9];return j}var HL1;var cF8=k(()=>{K1();n6();Oq();HL1=e(W6(),1)});function OsY(A){if(!A.match(/([\s\S]*?)<\/sandbox_violations>/))return{cleanedStderr:A};return{cleanedStderr:BW1(A).trim()}}function HsY(A){let q=A.match(EAq);if(!q)return{cleanedStderr:A,cwdResetWarning:null};let K=q[1]??null;return{cleanedStderr:A.replace(EAq,"").trim(),cwdResetWarning:K}}function Z26(A){let q=Y6(34),{content:K,verbose:Y,timeoutMs:z}=A,{stdout:w,stderr:_,isImage:$,returnCodeInterpretation:O,noOutputExpected:H,backgroundTaskId:j}=K,J=w===void 0?"":w,M=_===void 0?"":_,D,X,P,W,Z,G,f;if(q[0]!==$||q[1]!==M||q[2]!==J||q[3]!==Y){f=Symbol.for("react.early_return_sentinel");A:{let{cleanedStderr:R}=OsY(M);if({cleanedStderr:P,cwdResetWarning:X}=HsY(R),$){let h;if(q[11]===Symbol.for("react.memo_cache_sentinel"))h=cT.default.createElement(M8,{height:1},cT.default.createElement(T,{dimColor:!0},"[Image data detected and sent to Claude]")),q[11]=h;else h=q[11];f=h;break A}if(D=m,W="column",q[12]!==J||q[13]!==Y)Z=J!==""?cT.default.createElement(CF,{content:J,verbose:Y}):null,q[12]=J,q[13]=Y,q[14]=Z;else Z=q[14];G=P.trim()!==""?cT.default.createElement(CF,{content:P,verbose:Y,isError:!0}):null}q[0]=$,q[1]=M,q[2]=J,q[3]=Y,q[4]=D,q[5]=X,q[6]=P,q[7]=W,q[8]=Z,q[9]=G,q[10]=f}else D=q[4],X=q[5],P=q[6],W=q[7],Z=q[8],G=q[9],f=q[10];if(f!==Symbol.for("react.early_return_sentinel"))return f;let V;if(q[15]!==X)V=X?cT.default.createElement(M8,null,cT.default.createElement(T,{dimColor:!0},X)):null,q[15]=X,q[16]=V;else V=q[16];let N;if(q[17]!==j||q[18]!==X||q[19]!==H||q[20]!==O||q[21]!==P||q[22]!==J)N=J===""&&P.trim()===""&&!X?cT.default.createElement(M8,{height:1},cT.default.createElement(T,{dimColor:!0},j?cT.default.createElement(cT.default.Fragment,null,"Running in the background"," ",cT.default.createElement(J8,{shortcut:"↓",action:"manage",parens:!0})):O||(H?"Done":"(No output)"))):null,q[17]=j,q[18]=X,q[19]=H,q[20]=O,q[21]=P,q[22]=J,q[23]=N;else N=q[23];let v;if(q[24]!==z)v=z&&cT.default.createElement(M8,null,cT.default.createElement(Lr6,{timeoutMs:z})),q[24]=z,q[25]=v;else v=q[25];let y;if(q[26]!==D||q[27]!==v||q[28]!==W||q[29]!==Z||q[30]!==G||q[31]!==V||q[32]!==N)y=cT.default.createElement(D,{flexDirection:W},Z,G,V,N,v),q[26]=D,q[27]=v,q[28]=W,q[29]=Z,q[30]=G,q[31]=V,q[32]=N,q[33]=y;else y=q[33];return y}var cT,EAq;var jL1=k(()=>{K1();n6();pG6();DK();JK();cF8();cT=e(W6(),1),EAq=/(?:^|\n)(Shell cwd was reset to .+)$/});function LAq(A){let q=Y6(10),{content:K,verbose:Y}=A,z;if(q[0]!==K){let J=Pq(K,"bash-stdout")??"";z=Pq(J,"persisted-output")??J,q[0]=K,q[1]=z}else z=q[1];let w=z,_;if(q[2]!==K)_=Pq(K,"bash-stderr")??"",q[2]=K,q[3]=_;else _=q[3];let $=_,O;if(q[4]!==$||q[5]!==w)O={stdout:w,stderr:$},q[4]=$,q[5]=w,q[6]=O;else O=q[6];let H=!!Y,j;if(q[7]!==O||q[8]!==H)j=lF8.createElement(Z26,{content:O,verbose:H}),q[7]=O,q[8]=H,q[9]=j;else j=q[9];return j}var lF8;var yAq=k(()=>{K1();jL1();SA();lF8=e(W6(),1)});function SAq(A){let q=Y6(4),{content:K}=A,Y,z;if(q[0]!==K){z=Symbol.for("react.early_return_sentinel");A:{let w=Pq(K,"local-command-stdout"),_=Pq(K,"local-command-stderr");if(!w&&!_){let $;if(q[3]===Symbol.for("react.memo_cache_sentinel"))$=BW.createElement(M8,null,BW.createElement(T,{dimColor:!0},vL)),q[3]=$;else $=q[3];z=$;break A}if(Y=[],w?.trim())Y.push(BW.createElement(RAq,{key:"stdout"},w.trim()));if(_?.trim())Y.push(BW.createElement(RAq,{key:"stderr",isError:!0},_.trim()))}q[0]=K,q[1]=Y,q[2]=z}else Y=q[1],z=q[2];if(z!==Symbol.for("react.early_return_sentinel"))return z;return Y}function RAq(A){let q=Y6(7),{children:K,isError:Y}=A,z=Y?"error":"text",w;if(q[0]!==z)w=BW.createElement(T,{color:z}," ⎿ "),q[0]=z,q[1]=w;else w=q[1];let _;if(q[2]!==K)_=BW.createElement(m,{flexDirection:"column",flexGrow:1},BW.createElement(PO,null,K)),q[2]=K,q[3]=_;else _=q[3];let $;if(q[4]!==w||q[5]!==_)$=BW.createElement(m,{flexDirection:"row"},w,_),q[4]=w,q[5]=_,q[6]=$;else $=q[6];return $}var BW;var CAq=k(()=>{K1();SA();n6();DK();JL();BW=e(W6(),1)});function jsY(A){let q=Y6(7),{request:K}=A,Y;if(q[0]!==K.from)Y=Nw.createElement(m,{marginBottom:1},Nw.createElement(T,{color:"warning",bold:!0},"Shutdown request from ",K.from)),q[0]=K.from,q[1]=Y;else Y=q[1];let z;if(q[2]!==K.reason)z=K.reason&&Nw.createElement(m,null,Nw.createElement(T,null,"Reason: ",K.reason)),q[2]=K.reason,q[3]=z;else z=q[3];let w;if(q[4]!==Y||q[5]!==z)w=Nw.createElement(m,{flexDirection:"column",marginY:1},Nw.createElement(m,{borderStyle:"round",borderColor:"warning",flexDirection:"column",paddingX:1,paddingY:1},Y,z)),q[4]=Y,q[5]=z,q[6]=w;else w=q[6];return w}function JsY(A){let q=Y6(8),{response:K}=A,Y;if(q[0]!==K.from)Y=Nw.createElement(T,{color:"subtle",bold:!0},"Shutdown rejected by ",K.from),q[0]=K.from,q[1]=Y;else Y=q[1];let z;if(q[2]!==K.reason)z=Nw.createElement(m,{marginTop:1,borderStyle:"dashed",borderColor:"subtle",borderLeft:!1,borderRight:!1,paddingX:1},Nw.createElement(T,null,"Reason: ",K.reason)),q[2]=K.reason,q[3]=z;else z=q[3];let w;if(q[4]===Symbol.for("react.memo_cache_sentinel"))w=Nw.createElement(m,{marginTop:1},Nw.createElement(T,{dimColor:!0},"Teammate is continuing to work. You may request shutdown again later.")),q[4]=w;else w=q[4];let _;if(q[5]!==Y||q[6]!==z)_=Nw.createElement(m,{flexDirection:"column",marginY:1},Nw.createElement(m,{borderStyle:"round",borderColor:"subtle",flexDirection:"column",paddingX:1,paddingY:1},Y,z,w)),q[5]=Y,q[6]=z,q[7]=_;else _=q[7];return _}function hAq(A){let q=r66(A);if(q)return Nw.createElement(jsY,{request:q});if(LT(A))return null;let K=LZ1(A);if(K)return Nw.createElement(JsY,{response:K});return null}function IAq(A){let q=r66(A);if(q)return`[Shutdown Request from ${q.from}]${q.reason?` ${q.reason}`:""}`;let K=LT(A);if(K)return`[Shutdown Approved] ${K.from} is now exiting`;let Y=LZ1(A);if(Y)return`[Shutdown Rejected] ${Y.from}: ${Y.reason}`;return null}var Nw;var iF8=k(()=>{K1();n6();oH();Nw=e(W6(),1)});function MsY(A){let q=Y6(11),{assignment:K}=A,Y;if(q[0]!==K.assignedBy||q[1]!==K.taskId)Y=OX.createElement(m,{marginBottom:1},OX.createElement(T,{color:"cyan_FOR_SUBAGENTS_ONLY",bold:!0},"Task #",K.taskId," assigned by ",K.assignedBy)),q[0]=K.assignedBy,q[1]=K.taskId,q[2]=Y;else Y=q[2];let z;if(q[3]!==K.subject)z=OX.createElement(m,null,OX.createElement(T,{bold:!0},K.subject)),q[3]=K.subject,q[4]=z;else z=q[4];let w;if(q[5]!==K.description)w=K.description&&OX.createElement(m,{marginTop:1},OX.createElement(T,{dimColor:!0},K.description)),q[5]=K.description,q[6]=w;else w=q[6];let _;if(q[7]!==Y||q[8]!==z||q[9]!==w)_=OX.createElement(m,{flexDirection:"column",marginY:1},OX.createElement(m,{borderStyle:"round",borderColor:"cyan_FOR_SUBAGENTS_ONLY",flexDirection:"column",paddingX:1,paddingY:1},Y,z,w)),q[7]=Y,q[8]=z,q[9]=w,q[10]=_;else _=q[10];return _}function bAq(A){let q=yZ1(A);if(q)return OX.createElement(MsY,{assignment:q});return null}function xAq(A){let q=yZ1(A);if(q)return`[Task Assigned] #${q.taskId} - ${q.subject}`;return null}var OX;var nF8=k(()=>{K1();n6();oH();OX=e(W6(),1)});function DsY(A){let q=Y6(10),{request:K}=A,Y;if(q[0]!==K.from)Y=R3.createElement(m,{marginBottom:1},R3.createElement(T,{color:"planMode",bold:!0},"Plan Approval Request from ",K.from)),q[0]=K.from,q[1]=Y;else Y=q[1];let z;if(q[2]!==K.planContent)z=R3.createElement(m,{borderStyle:"dashed",borderColor:"subtle",borderLeft:!1,borderRight:!1,flexDirection:"column",paddingX:1,marginBottom:1},R3.createElement(PO,null,K.planContent)),q[2]=K.planContent,q[3]=z;else z=q[3];let w;if(q[4]!==K.planFilePath)w=R3.createElement(T,{dimColor:!0},"Plan file: ",K.planFilePath),q[4]=K.planFilePath,q[5]=w;else w=q[5];let _;if(q[6]!==Y||q[7]!==z||q[8]!==w)_=R3.createElement(m,{flexDirection:"column",marginY:1},R3.createElement(m,{borderStyle:"round",borderColor:"planMode",flexDirection:"column",paddingX:1},Y,z,w)),q[6]=Y,q[7]=z,q[8]=w,q[9]=_;else _=q[9];return _}function XsY(A){let q=Y6(13),{response:K,senderName:Y}=A;if(K.approved){let O;if(q[0]!==Y)O=R3.createElement(m,null,R3.createElement(T,{color:"success",bold:!0},"✓ Plan Approved by ",Y)),q[0]=Y,q[1]=O;else O=q[1];let H;if(q[2]===Symbol.for("react.memo_cache_sentinel"))H=R3.createElement(m,{marginTop:1},R3.createElement(T,null,"You can now proceed with implementation. Your plan mode restrictions have been lifted.")),q[2]=H;else H=q[2];let j;if(q[3]!==O)j=R3.createElement(m,{flexDirection:"column",marginY:1},R3.createElement(m,{borderStyle:"round",borderColor:"success",flexDirection:"column",paddingX:1,paddingY:1},O,H)),q[3]=O,q[4]=j;else j=q[4];return j}let z;if(q[5]!==Y)z=R3.createElement(m,null,R3.createElement(T,{color:"error",bold:!0},"✗ Plan Rejected by ",Y)),q[5]=Y,q[6]=z;else z=q[6];let w;if(q[7]!==K.feedback)w=K.feedback&&R3.createElement(m,{marginTop:1,borderStyle:"dashed",borderColor:"subtle",borderLeft:!1,borderRight:!1,paddingX:1},R3.createElement(T,null,"Feedback: ",K.feedback)),q[7]=K.feedback,q[8]=w;else w=q[8];let _;if(q[9]===Symbol.for("react.memo_cache_sentinel"))_=R3.createElement(m,{marginTop:1},R3.createElement(T,{dimColor:!0},"Please revise your plan based on the feedback and call ExitPlanMode again.")),q[9]=_;else _=q[9];let $;if(q[10]!==z||q[11]!==w)$=R3.createElement(m,{flexDirection:"column",marginY:1},R3.createElement(m,{borderStyle:"round",borderColor:"error",flexDirection:"column",paddingX:1,paddingY:1},z,w,_)),q[10]=z,q[11]=w,q[12]=$;else $=q[12];return $}function JL1(A,q){let K=$z6(A);if(K)return R3.createElement(DsY,{request:K});let Y=jf6(A);if(Y)return R3.createElement(XsY,{response:Y,senderName:q});return null}function PsY(A){let q=$z6(A);if(q)return`[Plan Approval Request from ${q.from}]`;let K=jf6(A);if(K)if(K.approved)return"[Plan Approved] You can now proceed with implementation";else return`[Plan Rejected] ${K.feedback||"Please revise your plan"}`;return null}function WsY(A){let q=["Agent idle"];if(A.completedTaskId){let K=A.completedStatus||"completed";q.push(`Task ${A.completedTaskId} ${K}`)}if(A.summary)q.push(`Last DM: ${A.summary}`);return q.join(" · ")}function uAq(A){let q=PsY(A);if(q)return q;let K=IAq(A);if(K)return K;let Y=fd6(A);if(Y)return WsY(Y);let z=xAq(A);if(z)return z;try{let w=O8(A);if(w?.type==="teammate_terminated"&&w.message)return w.message}catch{}return A}var R3;var rF8=k(()=>{K1();n6();JL();oH();a1();iF8();nF8();R3=e(W6(),1)});function GsY(A){let q=[];for(let K of A.matchAll(ZsY))if(K[1]&&K[4])q.push({teammateId:K[1],color:K[2],summary:K[3],content:K[4].trim()});return q}function fsY(A){if(A==="leader")return"leader";return A}function BAq({addMargin:A,param:{text:q},isTranscriptMode:K}){let Y=GsY(q).filter((z)=>{if(LT(z.content))return!1;try{if(O8(z.content)?.type==="teammate_terminated")return!1}catch{}return!0});if(Y.length===0)return null;return r5.createElement(m,{flexDirection:"column",marginTop:A?1:0,width:"100%"},Y.map((z,w)=>{let _=RW(z.color),$=fsY(z.teammateId),O=JL1(z.content,$);if(O)return r5.createElement(r5.Fragment,{key:w},O);let H=hAq(z.content);if(H)return r5.createElement(r5.Fragment,{key:w},H);let j=bAq(z.content);if(j)return r5.createElement(r5.Fragment,{key:w},j);let J=null;try{J=O8(z.content)}catch{}if(J?.type==="idle_notification")return null;if(J?.type==="task_completed"){let M=J;return r5.createElement(m,{key:w,flexDirection:"column",marginTop:1},r5.createElement(T,{color:_},`@${$}${q1.pointer}`),r5.createElement(M8,null,r5.createElement(T,{color:"success"},"✓"),r5.createElement(T,null," ","Completed task #",M.taskId,M.taskSubject&&r5.createElement(T,{dimColor:!0}," (",M.taskSubject,")"))))}return r5.createElement(oF8,{key:w,displayName:$,inkColor:_,content:z.content,summary:z.summary,isTranscriptMode:K})}))}function oF8(A){let q=Y6(14),{displayName:K,inkColor:Y,content:z,summary:w,isTranscriptMode:_}=A,$=`@${K}${q1.pointer}`,O;if(q[0]!==Y||q[1]!==$)O=r5.createElement(T,{color:Y},$),q[0]=Y,q[1]=$,q[2]=O;else O=q[2];let H;if(q[3]!==w)H=w&&r5.createElement(T,null," ",w),q[3]=w,q[4]=H;else H=q[4];let j;if(q[5]!==O||q[6]!==H)j=r5.createElement(m,null,O,H),q[5]=O,q[6]=H,q[7]=j;else j=q[7];let J;if(q[8]!==z||q[9]!==_)J=_&&r5.createElement(m,{paddingLeft:2},r5.createElement(T,null,r5.createElement(CK,null,z))),q[8]=z,q[9]=_,q[10]=J;else J=q[10];let M;if(q[11]!==j||q[12]!==J)M=r5.createElement(m,{flexDirection:"column",marginTop:1},j,J),q[11]=j,q[12]=J,q[13]=M;else M=q[13];return M}var r5,ZsY;var aF8=k(()=>{K1();n6();t7();ti();Ez();a1();rF8();iF8();oH();nF8();DK();r5=e(W6(),1),ZsY=new RegExp(`<${WJ}\\s+teammate_id="([^"]+)"(?:\\s+color="([^"]+)")?(?:\\s+summary="([^"]+)")?>\\n?([\\s\\S]*?)\\n?<\\/${WJ}>`,"g")});function TsY(A){switch(A){case"completed":return"success";case"failed":return"error";case"killed":return"warning";default:return"text"}}function mAq(A){let q=Y6(12),{addMargin:K,param:Y}=A,{text:z}=Y,w;if(q[0]!==z)w=Pq(z,"summary"),q[0]=z,q[1]=w;else w=q[1];let _=w;if(!_)return null;let $;if(q[2]!==z){let D=Pq(z,"status");$=TsY(D),q[2]=z,q[3]=$}else $=q[3];let O=$,H=K?1:0,j;if(q[4]!==O)j=G26.createElement(T,{color:O},B9),q[4]=O,q[5]=j;else j=q[5];let J;if(q[6]!==_||q[7]!==j)J=G26.createElement(T,null,j," ",_),q[6]=_,q[7]=j,q[8]=J;else J=q[8];let M;if(q[9]!==H||q[10]!==J)M=G26.createElement(m,{marginTop:H},J),q[9]=H,q[10]=J,q[11]=M;else M=q[11];return M}var G26;var gAq=k(()=>{K1();n6();j$();SA();G26=e(W6(),1)});function VsY(A){let q=[],K=/]*>(?:[\s\S]*?([^<]+)<\/reason>)?/g,Y;while((Y=K.exec(A))!==null)q.push({kind:"resource",server:Y[1]??"",target:Y[2]??"",reason:Y[3]});let z=/]*>(?:[\s\S]*?([^<]+)<\/reason>)?/g;while((Y=z.exec(A))!==null)q.push({kind:"polling",server:Y[2]??"",target:Y[3]??"",reason:Y[4]});return q}function NsY(A){if(A.startsWith("file://")){let q=A.slice(7),K=q.split("/");return K[K.length-1]||q}if(A.length>40)return A.slice(0,39)+"…";return A}function FAq(A){let q=Y6(12),{addMargin:K,param:Y}=A,{text:z}=Y,w,_,$,O,H;if(q[0]!==K||q[1]!==z){H=Symbol.for("react.early_return_sentinel");A:{let J=VsY(z);if(J.length===0){H=null;break A}w=m,_="column",$=K?1:0,O=J.map(vsY)}q[0]=K,q[1]=z,q[2]=w,q[3]=_,q[4]=$,q[5]=O,q[6]=H}else w=q[2],_=q[3],$=q[4],O=q[5],H=q[6];if(H!==Symbol.for("react.early_return_sentinel"))return H;let j;if(q[7]!==w||q[8]!==_||q[9]!==$||q[10]!==O)j=lT.createElement(w,{flexDirection:_,marginTop:$},O),q[7]=w,q[8]=_,q[9]=$,q[10]=O,q[11]=j;else j=q[11];return j}function vsY(A,q){return lT.createElement(m,{key:q},lT.createElement(T,null,lT.createElement(T,{color:"success"},xv7)," ",lT.createElement(T,{dimColor:!0},A.server,":")," ",lT.createElement(T,{color:"suggestion"},A.kind==="resource"?NsY(A.target):A.target),A.reason&&lT.createElement(T,{dimColor:!0}," · ",A.reason)))}var lT;var QAq=k(()=>{K1();n6();j$();lT=e(W6(),1)});function ML1(A){let q=Y6(6),{addMargin:K,planContent:Y}=A,z=K?1:0,w;if(q[0]===Symbol.for("react.memo_cache_sentinel"))w=Cn.createElement(m,{marginBottom:1},Cn.createElement(T,{bold:!0,color:"planMode"},"Plan to implement")),q[0]=w;else w=q[0];let _;if(q[1]!==Y)_=Cn.createElement(PO,null,Y),q[1]=Y,q[2]=_;else _=q[2];let $;if(q[3]!==z||q[4]!==_)$=Cn.createElement(m,{flexDirection:"column",borderStyle:"round",borderColor:"planMode",marginTop:z,paddingX:1},w,_),q[3]=z,q[4]=_,q[5]=$;else $=q[5];return $}var Cn;var sF8=k(()=>{K1();n6();JL();Cn=e(W6(),1)});function f26(A){let q=Y6(31),{addMargin:K,param:Y,verbose:z,planContent:w,isTranscriptMode:_}=A;if(Y.text.trim()===vL)return null;if(w){let O;if(q[0]!==K||q[1]!==w)O=ZO.createElement(ML1,{addMargin:K,planContent:w}),q[0]=K,q[1]=w,q[2]=O;else O=q[2];return O}if(Pq(Y.text,Qk))return null;if(Y.text.includes(`<${Gh6}>`))return null;if(Y.text.startsWith("")){let O;if(q[9]!==K||q[10]!==Y)O=ZO.createElement($L1,{addMargin:K,param:Y}),q[9]=K,q[10]=Y,q[11]=O;else O=q[11];return O}if(Y.text.includes(`<${T0}>`)){let O;if(q[12]!==K||q[13]!==Y)O=ZO.createElement(PAq,{addMargin:K,param:Y}),q[12]=K,q[13]=Y,q[14]=O;else O=q[14];return O}if(Y.text.includes("")){let O;if(q[15]!==K||q[16]!==Y.text)O=ZO.createElement(vAq,{addMargin:K,text:Y.text}),q[15]=K,q[16]=Y.text,q[17]=O;else O=q[17];return O}if(Z7()&&Y.text.includes(`<${WJ}`)){let O;if(q[18]!==K||q[19]!==_||q[20]!==Y)O=ZO.createElement(BAq,{addMargin:K,param:Y,isTranscriptMode:_}),q[18]=K,q[19]=_,q[20]=Y,q[21]=O;else O=q[21];return O}if(Y.text.includes(`<${yj}`)){let O;if(q[22]!==K||q[23]!==Y)O=ZO.createElement(mAq,{addMargin:K,param:Y}),q[22]=K,q[23]=Y,q[24]=O;else O=q[24];return O}if(Y.text.includes("{K1();pF8();WAq();TAq();kAq();FG6();SA();DK();yAq();CAq();uY();aF8();gAq();QAq();Ez();sF8();SA();ZO=e(W6(),1)});import{pathToFileURL as ksY}from"url";function XL1(A){let q=Y6(7),{imageId:K,addMargin:Y}=A,z=K?`[Image #${K}]`:"[Image]",w;if(q[0]!==K||q[1]!==z){let O=K?mN1(K):null;w=O&&ef()?Pu.createElement(d7,{url:ksY(O).href},Pu.createElement(T,null,z)):Pu.createElement(T,null,z),q[0]=K,q[1]=z,q[2]=w}else w=q[2];let _=w;if(Y){let O;if(q[3]!==_)O=Pu.createElement(m,{marginTop:1},_),q[3]=_,q[4]=O;else O=q[4];return O}let $;if(q[5]!==_)$=Pu.createElement(M8,null,_),q[5]=_,q[6]=$;else $=q[6];return $}var Pu;var tF8=k(()=>{K1();n6();r56();zn();tc();DK();Pu=e(W6(),1)});function PL1(A){let q=Y6(11),{param:K,addMargin:Y,isTranscriptMode:z,verbose:w,hideInTranscript:_}=A,{thinking:$}=K,O=Y===void 0?!1:Y,H=_===void 0?!1:_,j=zK("app:toggleTranscript","Global","ctrl+o");if(!$)return null;if(H)return null;if(!(z||w)){let W=O?1:0,Z=`${"∴ Thinking"} (${j} to expand)`,G;if(q[0]!==Z)G=T26.default.createElement(T,{dimColor:!0,italic:!0},Z),q[0]=Z,q[1]=G;else G=q[1];let f;if(q[2]!==W||q[3]!==G)f=T26.default.createElement(m,{marginTop:W},G),q[2]=W,q[3]=G,q[4]=f;else f=q[4];return f}let M=O?1:0,D;if(q[5]===Symbol.for("react.memo_cache_sentinel"))D=T26.default.createElement(T,{dimColor:!0,italic:!0},"∴ Thinking","…"),q[5]=D;else D=q[5];let X;if(q[6]!==$)X=T26.default.createElement(m,{paddingLeft:2},T26.default.createElement(PO,{dimColor:!0},$)),q[6]=$,q[7]=X;else X=q[7];let P;if(q[8]!==M||q[9]!==X)P=T26.default.createElement(m,{flexDirection:"column",gap:1,marginTop:M,width:"100%"},D,X),q[8]=M,q[9]=X,q[10]=P;else P=q[10];return P}var T26;var eF8=k(()=>{K1();n6();JL();LJ();T26=e(W6(),1)});function UAq(A){let q=Y6(3),{addMargin:K}=A,z=(K===void 0?!1:K)?1:0,w;if(q[0]===Symbol.for("react.memo_cache_sentinel"))w=AQ8.default.createElement(T,{dimColor:!0,italic:!0},"✻ Thinking…"),q[0]=w;else w=q[0];let _;if(q[1]!==z)_=AQ8.default.createElement(m,{marginTop:z},w),q[1]=z,q[2]=_;else _=q[2];return _}var AQ8;var pAq=k(()=>{K1();n6();AQ8=e(W6(),1)});import{relative as EsY}from"path";function dAq(A){let q=Y6(14),{attachment:K,verbose:Y}=A,z=zK("app:toggleTranscript","Global","ctrl+o");if(K.files.length===0)return null;let w;if(q[0]!==K.files)w=K.files.reduce(RsY,0),q[0]=K.files,q[1]=w;else w=q[1];let _=w,$=K.files.length;if(Y){let O;if(q[2]!==K.files)O=K.files.map(LsY),q[2]=K.files,q[3]=O;else O=q[3];let H;if(q[4]!==O)H=EL.default.createElement(m,{flexDirection:"column"},O),q[4]=O,q[5]=H;else H=q[5];return H}else{let O;if(q[6]!==_)O=EL.default.createElement(T,{bold:!0},_),q[6]=_,q[7]=O;else O=q[7];let H=_===1?"issue":"issues",j=$===1?"file":"files",J;if(q[8]!==z||q[9]!==$||q[10]!==O||q[11]!==H||q[12]!==j)J=EL.default.createElement(M8,null,EL.default.createElement(T,{dimColor:!0,wrap:"wrap"},"Found ",O," new diagnostic"," ",H," in ",$," ",j," (",z," to expand)")),q[8]=z,q[9]=$,q[10]=O,q[11]=H,q[12]=j,q[13]=J;else J=q[13];return J}}function LsY(A,q){return EL.default.createElement(EL.default.Fragment,{key:q},EL.default.createElement(M8,null,EL.default.createElement(T,{dimColor:!0,wrap:"wrap"},EL.default.createElement(T,{bold:!0},EsY(I1(),A.uri.replace("file://","").replace("_claude_fs_right:","")))," ",EL.default.createElement(T,{dimColor:!0},A.uri.startsWith("file://")?"(file://)":A.uri.startsWith("_claude_fs_right:")?"(claude_fs_right)":`(${A.uri.split(":")[0]})`),":")),A.diagnostics.map(ysY))}function ysY(A,q){return EL.default.createElement(M8,{key:q},EL.default.createElement(T,{dimColor:!0,wrap:"wrap"}," ",Wu.getSeveritySymbol(A.severity)," [Line ",A.range.start.line+1,":",A.range.start.character+1,"] ",A.message,A.code?` [${A.code}]`:"",A.source?` (${A.source})`:""))}function RsY(A,q){return A+q.diagnostics.length}var EL;var cAq=k(()=>{K1();n6();W7();DK();jz6();LJ();EL=e(W6(),1)});var Zu="TeamCreate";var V26="TeamDelete";function JH(){return!1}var hC=k(()=>{B1();Z8();Dl6();U2();_Q()});import{basename as SsY,sep as CsY}from"path";function lAq({attachment:A,addMargin:q,verbose:K,isTranscriptMode:Y}){if(Z7()&&A.type==="teammate_mailbox"){let z=A.messages.filter((w)=>{if(LT(w.text))return!1;try{let _=O8(w.text);return _?.type!=="idle_notification"&&_?.type!=="teammate_terminated"}catch{return!0}});if(z.length===0)return null;return Q7.default.createElement(m,{flexDirection:"column"},z.map((w,_)=>{let $=null;try{$=O8(w.text)}catch{}if($?.type==="task_assignment")return Q7.default.createElement(m,{key:_,paddingLeft:2},Q7.default.createElement(T,null,B9," "),Q7.default.createElement(T,null,"Task assigned: "),Q7.default.createElement(T,{bold:!0},"#",$.taskId),Q7.default.createElement(T,null," - ",$.subject),Q7.default.createElement(T,{dimColor:!0}," (from ",$.assignedBy||w.from,")"));let O=JL1(w.text,w.from);if(O)return Q7.default.createElement(Q7.default.Fragment,{key:_},O);let H=RW(w.color),j=uAq(w.text)??w.text;return Q7.default.createElement(oF8,{key:_,displayName:w.from,inkColor:H,content:j,summary:w.summary,isTranscriptMode:Y})}))}switch(A.type){case"directory":return Q7.default.createElement(MD,null,"Listed directory ",Q7.default.createElement(T,{bold:!0},A.displayPath+CsY));case"file":case"already_read_file":if(A.content.type==="notebook")return Q7.default.createElement(MD,null,"Read ",Q7.default.createElement(T,{bold:!0},A.displayPath)," (",A.content.file.cells.length," cells)");return Q7.default.createElement(MD,null,"Read ",Q7.default.createElement(T,{bold:!0},A.displayPath)," (",A.content.type==="text"?`${A.content.file.numLines}${A.truncated?"+":""} lines`:RK(A.content.file.originalSize),")");case"compact_file_reference":return Q7.default.createElement(MD,null,"Referenced file ",Q7.default.createElement(T,{bold:!0},A.displayPath));case"pdf_reference":return Q7.default.createElement(MD,null,"Referenced PDF ",Q7.default.createElement(T,{bold:!0},A.displayPath)," (",A.pageCount," pages)");case"selected_lines_in_ide":return Q7.default.createElement(MD,null,"⧉ Selected"," ",Q7.default.createElement(T,{bold:!0},A.lineEnd-A.lineStart+1)," ","lines from ",Q7.default.createElement(T,{bold:!0},A.displayPath)," in"," ",A.ideName);case"nested_memory":return Q7.default.createElement(MD,null,"Loaded ",Q7.default.createElement(T,{bold:!0},A.displayPath));case"relevant_memories":return Q7.default.createElement(m,{flexDirection:"column",marginTop:q?1:0},Q7.default.createElement(m,{flexDirection:"row"},Q7.default.createElement(m,{minWidth:2},Q7.default.createElement(T,{dimColor:!0},B9)),Q7.default.createElement(T,null,"Recalled ",Q7.default.createElement(T,{bold:!0},A.memories.length)," ",A.memories.length===1?"memory":"memories",!Y&&Q7.default.createElement(Q7.default.Fragment,null," ",Q7.default.createElement(oM,null)))),(K||Y)&&A.memories.map((z)=>Q7.default.createElement(m,{key:z.path,flexDirection:"column"},Q7.default.createElement(M8,null,Q7.default.createElement(T,{dimColor:!0},SsY(z.path))),Y&&Q7.default.createElement(m,{paddingLeft:5},Q7.default.createElement(T,null,Q7.default.createElement(CK,null,z.content))))));case"dynamic_skill":{let z=A.skillNames.length;return Q7.default.createElement(MD,null,"Loaded"," ",Q7.default.createElement(T,{bold:!0},z," skill",z!==1?"s":"")," ","from ",Q7.default.createElement(T,{bold:!0},A.displayPath))}case"skill_listing":{if(A.isInitial)return null;return Q7.default.createElement(MD,null,Q7.default.createElement(T,{bold:!0},A.skillCount)," skill",A.skillCount!==1?"s":""," available")}case"queued_command":{let z=typeof A.prompt==="string"?A.prompt:hn(A.prompt)||"",w=A.imagePasteIds&&A.imagePasteIds.length>0;return Q7.default.createElement(m,{flexDirection:"column"},Q7.default.createElement(f26,{addMargin:q,param:{text:z,type:"text"},verbose:K}),w&&A.imagePasteIds?.map((_)=>Q7.default.createElement(XL1,{key:_,imageId:_})))}case"plan_file_reference":return Q7.default.createElement(MD,null,"Plan file referenced (",T3(A.planFilePath),")");case"invoked_skills":{if(A.skills.length===0)return null;let z=A.skills.map((w)=>w.name).join(", ");return Q7.default.createElement(MD,null,"Skills restored (",z,")")}case"diagnostics":return Q7.default.createElement(dAq,{attachment:A,verbose:K});case"mcp_resource":return Q7.default.createElement(MD,null,"Read MCP resource ",Q7.default.createElement(T,{bold:!0},A.name)," from"," ",A.server);case"command_permissions":return null;case"async_hook_response":{if(A.hookEvent==="SessionStart"&&!K)return null;if((A.hookEvent==="PreToolUse"||A.hookEvent==="PostToolUse")&&!Y)return null;return Q7.default.createElement(MD,null,"Async hook ",Q7.default.createElement(T,{bold:!0},A.hookEvent)," completed")}case"hook_blocking_error":{if(A.hookEvent==="Stop"||A.hookEvent==="SubagentStop")return null;let z=A.blockingError.blockingError.trim();return Q7.default.createElement(Q7.default.Fragment,null,Q7.default.createElement(MD,{color:"error"},A.hookName," hook returned blocking error"),z?Q7.default.createElement(MD,{color:"error"},z):null)}case"hook_non_blocking_error":{if(A.hookEvent==="Stop"||A.hookEvent==="SubagentStop")return null;return Q7.default.createElement(MD,{color:"error"},A.hookName," hook error")}case"hook_error_during_execution":if(A.hookEvent==="Stop"||A.hookEvent==="SubagentStop")return null;return Q7.default.createElement(MD,null,A.hookName," hook warning");case"hook_success":return null;case"hook_stopped_continuation":if(A.hookEvent==="Stop"||A.hookEvent==="SubagentStop")return null;return Q7.default.createElement(MD,{color:"warning"},A.hookName," hook stopped continuation: ",A.message);case"hook_system_message":return Q7.default.createElement(MD,null,A.hookName," says: ",A.content);case"hook_permission_decision":{let z=A.decision==="allow"?"Allowed":"Denied";return Q7.default.createElement(MD,null,z," by ",Q7.default.createElement(T,{bold:!0},A.hookEvent)," hook")}case"task_status":return Q7.default.createElement(hsY,{attachment:A});case"teammate_shutdown_batch":return Q7.default.createElement(m,{flexDirection:"row",width:"100%",marginTop:1},Q7.default.createElement(T,{dimColor:!0},B9," "),Q7.default.createElement(T,{dimColor:!0},A.count," teammate",A.count===1?"":"s"," shut down gracefully"));case"agent_mention":case"budget_usd":case"critical_system_reminder":case"edited_image_file":case"edited_text_file":case"hook_additional_context":case"hook_cancelled":case"opened_file_in_ide":case"output_style":case"plan_mode":case"plan_mode_exit":case"plan_mode_reentry":case"structured_output":case"team_context":case"todo_reminder":case"ultramemory":case"context_efficiency":case"deferred_tools_delta":case"mcp_instructions_delta":case"token_usage":case"ultrathink_effort":return null}}function hsY(A){let q=Y6(4),{attachment:K}=A;if(JH()&&K.status==="killed")return null;if(Z7()&&K.taskType==="in_process_teammate"){let z;if(q[0]!==K)z=Q7.default.createElement(IsY,{attachment:K}),q[0]=K,q[1]=z;else z=q[1];return z}let Y;if(q[2]!==K)Y=Q7.default.createElement(iAq,{attachment:K}),q[2]=K,q[3]=Y;else Y=q[3];return Y}function iAq(A){let q=Y6(6),{attachment:K}=A,Y=K.status==="completed"?"completed in background":K.status==="killed"?"stopped":K.status,z;if(q[0]===Symbol.for("react.memo_cache_sentinel"))z=Q7.default.createElement(T,{dimColor:!0},B9," "),q[0]=z;else z=q[0];let w;if(q[1]!==K.description)w=Q7.default.createElement(T,{bold:!0},K.description),q[1]=K.description,q[2]=w;else w=q[2];let _;if(q[3]!==Y||q[4]!==w)_=Q7.default.createElement(m,{flexDirection:"row",width:"100%",marginTop:1},z,Q7.default.createElement(T,{dimColor:!0},'Task "',w,'" ',Y)),q[3]=Y,q[4]=w,q[5]=_;else _=q[5];return _}function IsY(A){let q=Y6(13),{attachment:K}=A,Y;if(q[0]!==K.taskId)Y=(J)=>J.tasks[K.taskId],q[0]=K.taskId,q[1]=Y;else Y=q[1];let z=V1(Y);if(z?.type!=="in_process_teammate"){let J;if(q[2]!==K)J=Q7.default.createElement(iAq,{attachment:K}),q[2]=K,q[3]=J;else J=q[3];return J}let w;if(q[4]!==z.identity.color)w=RW(z.identity.color),q[4]=z.identity.color,q[5]=w;else w=q[5];let _=w,$=K.status==="completed"?"shut down gracefully":K.status,O;if(q[6]===Symbol.for("react.memo_cache_sentinel"))O=Q7.default.createElement(T,{dimColor:!0},B9," "),q[6]=O;else O=q[6];let H;if(q[7]!==_||q[8]!==z.identity.agentName)H=Q7.default.createElement(T,{color:_,bold:!0,dimColor:!1},"@",z.identity.agentName),q[7]=_,q[8]=z.identity.agentName,q[9]=H;else H=q[9];let j;if(q[10]!==$||q[11]!==H)j=Q7.default.createElement(m,{flexDirection:"row",width:"100%",marginTop:1},O,Q7.default.createElement(T,{dimColor:!0},"Teammate"," ",H," ",$)),q[10]=$,q[11]=H,q[12]=j;else j=q[12];return j}function MD(A){let q=Y6(4),{dimColor:K,children:Y,color:z}=A,w=K===void 0?!0:K,_;if(q[0]!==Y||q[1]!==z||q[2]!==w)_=Q7.default.createElement(M8,null,Q7.default.createElement(T,{color:z,dimColor:w,wrap:"wrap"},Y)),q[0]=Y,q[1]=z,q[2]=w,q[3]=_;else _=q[3];return _}var Q7;var nAq=k(()=>{K1();n6();pA();p7();DK();DL1();cAq();SA();tF8();ti();a1();uY();hC();rF8();j$();aF8();oH();QS();Q7=e(W6(),1)});function aAq(A){let q=Y6(33),{message:K,verbose:Y}=A,{retryAttempt:z,error:w,retryInMs:_,maxRetries:$}=K,O=z<4,[H,j]=oAq.useState(0),J=H>=_,M;if(q[0]===Symbol.for("react.memo_cache_sentinel"))M=()=>j(bsY),q[0]=M;else M=q[0];if(BM(M,O||J?null:1000),O)return null;let D;if(q[1]!==H||q[2]!==_)D=Math.round((_-H)/1000),q[1]=H,q[2]=_,q[3]=D;else D=q[3];let X=Math.max(0,D),P,W,Z,G,f,V,N;if(q[4]!==w||q[5]!==Y){let F=B01(w);N=!Y&&F.length>rAq,Z=M8,W=m,V="column",P=T,G="error",f=N?F.slice(0,rAq)+"…":F,q[4]=w,q[5]=Y,q[6]=P,q[7]=W,q[8]=Z,q[9]=G,q[10]=f,q[11]=V,q[12]=N}else P=q[6],W=q[7],Z=q[8],G=q[9],f=q[10],V=q[11],N=q[12];let v;if(q[13]!==P||q[14]!==G||q[15]!==f)v=Gu.createElement(P,{color:G},f),q[13]=P,q[14]=G,q[15]=f,q[16]=v;else v=q[16];let y;if(q[17]!==N)y=N&&Gu.createElement(oM,null),q[17]=N,q[18]=y;else y=q[18];let R=X===1?"second":"seconds",h;if(q[19]!==$||q[20]!==z||q[21]!==X||q[22]!==R)h=Gu.createElement(T,{dimColor:!0},"Retrying in ",X," ",R,"… (attempt"," ",z,"/",$,")",process.env.API_TIMEOUT_MS?` · API_TIMEOUT_MS=${process.env.API_TIMEOUT_MS}ms, try increasing it`:""),q[19]=$,q[20]=z,q[21]=X,q[22]=R,q[23]=h;else h=q[23];let B;if(q[24]!==W||q[25]!==h||q[26]!==V||q[27]!==v||q[28]!==y)B=Gu.createElement(W,{flexDirection:V},v,y,h),q[24]=W,q[25]=h,q[26]=V,q[27]=v,q[28]=y,q[29]=B;else B=q[29];let x;if(q[30]!==Z||q[31]!==B)x=Gu.createElement(Z,null,B),q[30]=Z,q[31]=B,q[32]=x;else x=q[32];return x}function bsY(A){return A+1000}var Gu,oAq,rAq=1000;var sAq=k(()=>{K1();DK();n6();DF();qT();QS();Gu=e(W6(),1),oAq=e(W6(),1)});function mW(A){if(A.status!=="running"&&A.status!=="pending")return!1;if("isBackgrounded"in A&&A.isBackgrounded===!1)return!1;return!0}function tAq(A){let q=Y6(24),{message:K,addMargin:Y,verbose:z,isTranscriptMode:w}=A;if(K.subtype==="turn_duration"){let M;if(q[0]!==Y||q[1]!==K)M=I7.createElement(FsY,{message:K,addMargin:Y}),q[0]=Y,q[1]=K,q[2]=M;else M=q[2];return M}if(K.subtype==="agents_killed"){let M=Y?1:0,D,X;if(q[3]===Symbol.for("react.memo_cache_sentinel"))D=I7.createElement(m,{minWidth:2},I7.createElement(T,{color:"error"},B9)),X=I7.createElement(T,{dimColor:!0},"All background agents killed"),q[3]=D,q[4]=X;else D=q[3],X=q[4];let P;if(q[5]!==M)P=I7.createElement(m,{flexDirection:"row",marginTop:M,width:"100%"},D,X),q[5]=M,q[6]=P;else P=q[6];return P}if(K.subtype==="thinking")return null;if(K.subtype==="bridge_status"){let M;if(q[7]!==Y||q[8]!==K)M=I7.createElement(UsY,{message:K,addMargin:Y}),q[7]=Y,q[8]=K,q[9]=M;else M=q[9];return M}if(K.subtype!=="stop_hook_summary"&&!z&&K.level==="info")return null;if(K.subtype==="api_error"){let M;if(q[10]!==K||q[11]!==z)M=I7.createElement(aAq,{message:K,verbose:z}),q[10]=K,q[11]=z,q[12]=M;else M=q[12];return M}if(K.subtype==="stop_hook_summary"){let M;if(q[13]!==Y||q[14]!==w||q[15]!==K||q[16]!==z)M=I7.createElement(xsY,{message:K,addMargin:Y,verbose:z,isTranscriptMode:w}),q[13]=Y,q[14]=w,q[15]=K,q[16]=z,q[17]=M;else M=q[17];return M}let $=K.content;if(typeof $!=="string")return null;let O=K.level!=="info",H=K.level==="warning"?"warning":void 0,j=K.level==="info",J;if(q[18]!==Y||q[19]!==$||q[20]!==O||q[21]!==H||q[22]!==j)J=I7.createElement(m,{flexDirection:"row",width:"100%"},I7.createElement(gsY,{content:$,addMargin:Y,dot:O,color:H,dimColor:j})),q[18]=Y,q[19]=$,q[20]=O,q[21]=H,q[22]=j,q[23]=J;else J=q[23];return J}function xsY(A){let q=Y6(46),{message:K,addMargin:Y,verbose:z,isTranscriptMode:w}=A,{hookCount:_,hookInfos:$,hookErrors:O,preventedContinuation:H,stopReason:j}=K,{columns:J}=PA(),M;if(q[0]!==$||q[1]!==K.totalDurationMs)M=K.totalDurationMs??$.reduce(msY,0),q[0]=$,q[1]=K.totalDurationMs,q[2]=M;else M=q[2];let D=M;if(O.length===0&&!H&&!K.hookLabel)return null;let X;if(q[3]!==D)X="",q[3]=D,q[4]=X;else X=q[4];let P=X;if(K.hookLabel){let g=_===1?"hook":"hooks",b;if(q[5]!==_||q[6]!==K.hookLabel||q[7]!==g||q[8]!==P)b=I7.createElement(T,{dimColor:!0}," ⎿ ","Ran ",_," ",K.hookLabel," ",g,P),q[5]=_,q[6]=K.hookLabel,q[7]=g,q[8]=P,q[9]=b;else b=q[9];let U;if(q[10]!==$||q[11]!==w)U=w&&$.map(BsY),q[10]=$,q[11]=w,q[12]=U;else U=q[12];let d;if(q[13]!==b||q[14]!==U)d=I7.createElement(m,{flexDirection:"column",width:"100%"},b,U),q[13]=b,q[14]=U,q[15]=d;else d=q[15];return d}let W=Y?1:0,Z;if(q[16]===Symbol.for("react.memo_cache_sentinel"))Z=I7.createElement(m,{minWidth:2},I7.createElement(T,null,B9)),q[16]=Z;else Z=q[16];let G=J-10,f;if(q[17]!==_)f=I7.createElement(T,{bold:!0},_),q[17]=_,q[18]=f;else f=q[18];let V=K.hookLabel??"stop",N=_===1?"hook":"hooks",v;if(q[19]!==$||q[20]!==z)v=!z&&$.length>0&&I7.createElement(I7.Fragment,null," ",I7.createElement(oM,null)),q[19]=$,q[20]=z,q[21]=v;else v=q[21];let y;if(q[22]!==f||q[23]!==V||q[24]!==N||q[25]!==v||q[26]!==P)y=I7.createElement(T,null,"Ran ",f," ",V," ",N,P,v),q[22]=f,q[23]=V,q[24]=N,q[25]=v,q[26]=P,q[27]=y;else y=q[27];let R;if(q[28]!==$||q[29]!==z)R=z&&$.length>0&&$.map(usY),q[28]=$,q[29]=z,q[30]=R;else R=q[30];let h;if(q[31]!==H||q[32]!==j)h=H&&j&&I7.createElement(T,null,"⎿  ",j),q[31]=H,q[32]=j,q[33]=h;else h=q[33];let B;if(q[34]!==O||q[35]!==K.hookLabel)B=O.length>0&&O.map((g,b)=>I7.createElement(T,{key:b},"⎿  ",K.hookLabel??"Stop"," hook error: ",g)),q[34]=O,q[35]=K.hookLabel,q[36]=B;else B=q[36];let x;if(q[37]!==y||q[38]!==R||q[39]!==h||q[40]!==B||q[41]!==G)x=I7.createElement(m,{flexDirection:"column",width:G},y,R,h,B),q[37]=y,q[38]=R,q[39]=h,q[40]=B,q[41]=G,q[42]=x;else x=q[42];let F;if(q[43]!==x||q[44]!==W)F=I7.createElement(m,{flexDirection:"row",marginTop:W,width:"100%"},Z,x),q[43]=x,q[44]=W,q[45]=F;else F=q[45];return F}function usY(A,q){return I7.createElement(T,{key:`cmd-${q}`,dimColor:!0},"⎿  ",A.command==="prompt"?`prompt: ${A.promptText||""}`:A.command,"")}function BsY(A,q){return I7.createElement(T,{key:`cmd-${q}`,dimColor:!0}," ⎿ ",A.command==="prompt"?`prompt: ${A.promptText||""}`:A.command,"")}function msY(A,q){return A+(q.durationMs??0)}function gsY(A){let q=Y6(17),{content:K,addMargin:Y,dot:z,color:w,dimColor:_}=A,{columns:$}=PA(),O=Y?1:0,H;if(q[0]!==w||q[1]!==_||q[2]!==z)H=z&&I7.createElement(m,{minWidth:2},I7.createElement(T,{color:w,dimColor:_},B9)),q[0]=w,q[1]=_,q[2]=z,q[3]=H;else H=q[3];let j=$-10,J;if(q[4]!==K)J=K.trim(),q[4]=K,q[5]=J;else J=q[5];let M;if(q[6]!==w||q[7]!==_||q[8]!==J)M=I7.createElement(T,{color:w,dimColor:_,wrap:"wrap"},J),q[6]=w,q[7]=_,q[8]=J,q[9]=M;else M=q[9];let D;if(q[10]!==j||q[11]!==M)D=I7.createElement(m,{flexDirection:"column",width:j},M),q[10]=j,q[11]=M,q[12]=D;else D=q[12];let X;if(q[13]!==O||q[14]!==H||q[15]!==D)X=I7.createElement(m,{flexDirection:"row",marginTop:O,width:"100%"},H,D),q[13]=O,q[14]=H,q[15]=D,q[16]=X;else X=q[16];return X}function FsY(A){let q=Y6(14),{message:K,addMargin:Y}=A,[z]=qQ8.useState(QsY),w=w_(),_;if(q[0]!==w)_=()=>{let W=w.getState().tasks;return Object.values(W??{}).filter(mW).length},q[0]=w,q[1]=_;else _=q[1];let[$]=qQ8.useState(_);if(!(T1().showTurnDuration??!0))return null;let H;if(q[2]!==K.durationMs)H=G3(K.durationMs),q[2]=K.durationMs,q[3]=H;else H=q[3];let j=H,J=Y?1:0,M;if(q[4]===Symbol.for("react.memo_cache_sentinel"))M=I7.createElement(m,{minWidth:2},I7.createElement(T,{dimColor:!0},lt)),q[4]=M;else M=q[4];let D;if(q[5]!==$)D=$>0&&I7.createElement(I7.Fragment,null,` · ${$} background ${$===1?"task":"tasks"} still running `,I7.createElement(J8,{shortcut:"↓",action:"manage",parens:!0})),q[5]=$,q[6]=D;else D=q[6];let X;if(q[7]!==j||q[8]!==D||q[9]!==z)X=I7.createElement(T,{dimColor:!0},z," for ",j,D),q[7]=j,q[8]=D,q[9]=z,q[10]=X;else X=q[10];let P;if(q[11]!==J||q[12]!==X)P=I7.createElement(m,{flexDirection:"row",marginTop:J,width:"100%"},M,X),q[11]=J,q[12]=X,q[13]=P;else P=q[13];return P}function QsY(){return LW(fV6)??"Worked"}function UsY(A){let q=Y6(7),{message:K,addMargin:Y}=A,z=Y?1:0,w;if(q[0]===Symbol.for("react.memo_cache_sentinel"))w=I7.createElement(m,{minWidth:2}),q[0]=w;else w=q[0];let _;if(q[1]===Symbol.for("react.memo_cache_sentinel"))_=I7.createElement(T,null,I7.createElement(T,{color:"suggestion"},"/remote-control")," is active. Code in CLI or at"),q[1]=_;else _=q[1];let $;if(q[2]!==K.url)$=I7.createElement(m,{flexDirection:"column"},_,I7.createElement(d7,{url:K.url},K.url)),q[2]=K.url,q[3]=$;else $=q[3];let O;if(q[4]!==z||q[5]!==$)O=I7.createElement(m,{flexDirection:"row",marginTop:z,width:999},w,$),q[4]=z,q[5]=$,q[6]=O;else O=q[6];return O}var I7,qQ8;var eAq=k(()=>{K1();n6();z86();j$();AN1();xq();sAq();Oq();Q8();r56();Ig6();QS();pA();JK();I7=e(W6(),1),qQ8=e(W6(),1)});function A7q(){let A=Y6(2),q=zK("app:toggleTranscript","Global","ctrl+o"),K;if(A[0]!==q)K=yr6.createElement(m,{marginY:1},yr6.createElement(T,{dimColor:!0},"✻ Conversation compacted (",q," for history)")),A[0]=q,A[1]=K;else K=A[1];return K}var yr6;var q7q=k(()=>{K1();n6();LJ();yr6=e(W6(),1)});function K7q({message:A,tools:q,lookups:K,inProgressToolUseIDs:Y,shouldAnimate:z}){let w=z5(q,A.toolName);if(!w?.renderGroupedToolUse)return null;let _=new Map;for(let H of A.results)for(let j of H.message.content)if(j.type==="tool_result")_.set(j.tool_use_id,{param:j,output:H.toolUseResult});let $=A.messages.map((H)=>{let j=H.message.content[0],J=_.get(j.id);return{param:j,isResolved:K.resolvedToolUseIDs.has(j.id),isError:K.erroredToolUseIDs.has(j.id),isInProgress:Y.has(j.id),progressMessages:Us(K.progressMessagesByToolUseID.get(j.id)??[]),result:J}}),O=$.some((H)=>H.isInProgress);return w.renderGroupedToolUse($,{shouldAnimate:z&&O,tools:q})}var Y7q=()=>{};var z7q={};m1(z7q,{checkHasTeamMemOps:()=>psY,TeamMemCountParts:()=>dsY});function psY(A){return(A.teamMemorySearchCount??0)>0||(A.teamMemoryReadCount??0)>0||(A.teamMemoryWriteCount??0)>0}function dsY(A){let q=Y6(23),{message:K,isActiveGroup:Y,hasPrecedingParts:z}=A,w=K.teamMemoryReadCount??0,_=K.teamMemorySearchCount??0,$=K.teamMemoryWriteCount??0;if(w===0&&_===0&&$===0)return null;let O;if(q[0]!==z||q[1]!==Y||q[2]!==w||q[3]!==_||q[4]!==$){let H=[],j=z?1:0;if(w>0){let J=Y?j===0?"Recalling":"recalling":j===0?"Recalled":"recalled";if(j>0){let P;if(q[6]===Symbol.for("react.memo_cache_sentinel"))P=fu.default.createElement(T,{key:"comma-tmr"},", "),q[6]=P;else P=q[6];H.push(P)}let M;if(q[7]!==w)M=fu.default.createElement(T,{bold:!0},w),q[7]=w,q[8]=M;else M=q[8];let D=w===1?"memory":"memories",X;if(q[9]!==M||q[10]!==D||q[11]!==J)X=fu.default.createElement(T,{key:"team-mem-read"},J," ",M," team"," ",D),q[9]=M,q[10]=D,q[11]=J,q[12]=X;else X=q[12];H.push(X),j++}if(_>0){let J=Y?j===0?"Searching":"searching":j===0?"Searched":"searched";if(j>0){let X;if(q[13]===Symbol.for("react.memo_cache_sentinel"))X=fu.default.createElement(T,{key:"comma-tms"},", "),q[13]=X;else X=q[13];H.push(X)}let M=`${J} team memories`,D;if(q[14]!==M)D=fu.default.createElement(T,{key:"team-mem-search"},M),q[14]=M,q[15]=D;else D=q[15];H.push(D),j++}if($>0){let J=Y?j===0?"Writing":"writing":j===0?"Wrote":"wrote";if(j>0){let P;if(q[16]===Symbol.for("react.memo_cache_sentinel"))P=fu.default.createElement(T,{key:"comma-tmw"},", "),q[16]=P;else P=q[16];H.push(P)}let M;if(q[17]!==$)M=fu.default.createElement(T,{bold:!0},$),q[17]=$,q[18]=M;else M=q[18];let D=$===1?"memory":"memories",X;if(q[19]!==M||q[20]!==D||q[21]!==J)X=fu.default.createElement(T,{key:"team-mem-write"},J," ",M," team"," ",D),q[19]=M,q[20]=D,q[21]=J,q[22]=X;else X=q[22];H.push(X)}O=fu.default.createElement(fu.default.Fragment,null,H),q[0]=z,q[1]=Y,q[2]=w,q[3]=_,q[4]=$,q[5]=O}else O=q[5];return O}var fu;var w7q=k(()=>{K1();n6();fu=e(W6(),1)});function csY(A){let q=Y6(23),{content:K,tools:Y,lookups:z,inProgressToolUseIDs:w,shouldAnimate:_,theme:$}=A,O,H;if(q[0]!==K.id||q[1]!==K.input||q[2]!==K.name||q[3]!==w||q[4]!==z||q[5]!==_||q[6]!==$||q[7]!==Y){H=Symbol.for("react.early_return_sentinel");A:{let j=z5(Y,K.name);if(!j){H=null;break A}let J;if(q[10]!==K.id||q[11]!==z.resolvedToolUseIDs)J=z.resolvedToolUseIDs.has(K.id),q[10]=K.id,q[11]=z.resolvedToolUseIDs,q[12]=J;else J=q[12];let M=J,D;if(q[13]!==K.id||q[14]!==z.erroredToolUseIDs)D=z.erroredToolUseIDs.has(K.id),q[13]=K.id,q[14]=z.erroredToolUseIDs,q[15]=D;else D=q[15];let X=D,P;if(q[16]!==K.id||q[17]!==w)P=w.has(K.id),q[16]=K.id,q[17]=w,q[18]=P;else P=q[18];let W=P,Z=z.toolResultByToolUseID.get(K.id),G=Z?.type==="user"?Z.toolUseResult:void 0,f=j.outputSchema?.safeParse(G),V=f?.success?f.data:void 0,N=j.inputSchema.safeParse(K.input),v=N.success?N.data:void 0,y=j.userFacingName(v),R=v?j.renderToolUseMessage(v,{theme:$,verbose:!1}):null,h=_&&W,B=!M,x;if(q[19]!==X||q[20]!==h||q[21]!==B)x=$9.default.createElement(Ww6,{shouldAnimate:h,isUnresolved:B,isError:X}),q[19]=X,q[20]=h,q[21]=B,q[22]=x;else x=q[22];O=$9.default.createElement(m,{key:K.id,flexDirection:"column",marginTop:1},$9.default.createElement(m,{flexDirection:"row"},x,$9.default.createElement(T,{bold:!0},y),R&&$9.default.createElement(T,null,"(",R,")"),v&&j.renderToolUseTag?.(v)),M&&!X&&V!==void 0&&$9.default.createElement(m,null,j.renderToolResultMessage(V,[],{verbose:!1,tools:Y,theme:$})))}q[0]=K.id,q[1]=K.input,q[2]=K.name,q[3]=w,q[4]=z,q[5]=_,q[6]=$,q[7]=Y,q[8]=O,q[9]=H}else O=q[8],H=q[9];if(H!==Symbol.for("react.early_return_sentinel"))return H;return O}function O7q({message:A,inProgressToolUseIDs:q,shouldAnimate:K,verbose:Y,tools:z,lookups:w,isActiveGroup:_}){let{searchCount:$,readCount:O,replCount:H,memorySearchCount:j,memoryReadCount:J,memoryWriteCount:M,messages:D}=A,[X]=G7(),{columns:P}=PA(),W=ZV6(A).some((b)=>w.erroredToolUseIDs.has(b)),Z=j>0||J>0||M>0,G=$7q.checkHasTeamMemOps(A),f=$9.useRef(0),V=$9.useRef(0);f.current=Math.max(f.current,O),V.current=Math.max(V.current,$);let N=f.current,v=V.current,y=v>0||N>0||H>0,R=A.readFilePaths,h=A.searchArgs,B=A.latestDisplayHint;if(B===void 0){let b=h?.[h.length-1],U=b!==void 0?`"${b}"`:void 0,d=R?.[R.length-1];B=d!==void 0?T3(d):U}if(Y){let b=[];for(let U of D)if(U.type==="assistant")b.push(U);else if(U.type==="grouped_tool_use")b.push(...U.messages);return $9.default.createElement(m,{flexDirection:"column"},b.map((U)=>{let d=U.message.content[0];if(d?.type!=="tool_use")return null;return $9.default.createElement(csY,{key:d.id,content:d,tools:z,lookups:w,inProgressToolUseIDs:q,shouldAnimate:K,theme:X})}),A.hookInfos&&A.hookInfos.length>0&&$9.default.createElement($9.default.Fragment,null,$9.default.createElement(T,{dimColor:!0}," ⎿ ","Ran ",A.hookCount," PreToolUse"," ",A.hookCount===1?"hook":"hooks"," (",((A.hookTotalMs??0)/1000).toFixed(1),"s)"),A.hookInfos.map((U,d)=>$9.default.createElement(T,{key:`hook-${d}`,dimColor:!0}," ⎿ ",U.command," (",((U.durationMs??0)/1000).toFixed(1),"s)"))))}if(!Z&&!G&&!y)return null;let x=[];if(J>0){let b=_?x.length===0?"Recalling":"recalling":x.length===0?"Recalled":"recalled";x.push($9.default.createElement(T,{key:"mem-read"},b," ",$9.default.createElement(T,{bold:!0},J)," ",J===1?"memory":"memories"))}if(j>0){let b=_?x.length===0?"Searching":"searching":x.length===0?"Searched":"searched";if(x.length>0)x.push($9.default.createElement(T,{key:"comma-ms"},", "));x.push($9.default.createElement(T,{key:"mem-search"},`${b} memories`))}if(M>0){let b=_?x.length===0?"Writing":"writing":x.length===0?"Wrote":"wrote";if(x.length>0)x.push($9.default.createElement(T,{key:"comma-mw"},", "));x.push($9.default.createElement(T,{key:"mem-write"},b," ",$9.default.createElement(T,{bold:!0},M)," ",M===1?"memory":"memories"))}let F=Z||G,g=[];if(v>0){let b=!F&&g.length===0,U=_?b?"Searching for":"searching for":b?"Searched for":"searched for";if(F||g.length>0)g.push($9.default.createElement(T,{key:"comma-s"},", "));g.push($9.default.createElement(T,{key:"search"},U," ",$9.default.createElement(T,{bold:!0},v)," ",v===1?"pattern":"patterns"))}if(N>0){let b=!F&&g.length===0,U=_?b?"Reading":"reading":b?"Read":"read";if(F||g.length>0)g.push($9.default.createElement(T,{key:"comma-r"},", "));g.push($9.default.createElement(T,{key:"read"},U," ",$9.default.createElement(T,{bold:!0},N)," ",N===1?"file":"files"))}if(H>0){let b=_?"REPL'ing":"REPL'd";if(F||g.length>0)g.push($9.default.createElement(T,{key:"comma-repl"},", "));g.push($9.default.createElement(T,{key:"repl"},b," ",$9.default.createElement(T,{bold:!0},H)," ",H===1?"time":"times"))}return $9.default.createElement(m,{flexDirection:"column",marginTop:1},$9.default.createElement(m,{flexDirection:"row"},$9.default.createElement(Ww6,{shouldAnimate:!!_,isUnresolved:!!_,isError:W}),$9.default.createElement(T,null,x,$7q.TeamMemCountParts({message:A,isActiveGroup:_,hasPrecedingParts:x.length>0}),g,_&&$9.default.createElement(T,{key:"ellipsis"},"…")," ",$9.default.createElement(oM,null))),_&&B!==void 0&&$9.default.createElement(T,{dimColor:!0}," ⎿ ",pM6(B,P-6)),A.hookTotalMs!==void 0&&A.hookTotalMs>0&&$9.default.createElement(T,{dimColor:!0}," ⎿ ","Ran ",A.hookCount," PreToolUse"," ",A.hookCount===1?"hook":"hooks"," (",(A.hookTotalMs/1000).toFixed(1),"s)"))}var $9,$7q;var H7q=k(()=>{K1();n6();bV1();QS();XQ();p7();Oq();xq();$9=e(W6(),1),$7q=(w7q(),W3(z7q))});function j7q(A){let q=Y6(24),{message:K,screen:Y}=A,z=Y==="transcript",w;if(q[0]!==K)w=fi(K)||"",q[0]=K,q[1]=w;else w=q[1];let _=w,$=K.summarizeMetadata;if($){let D;if(q[2]===Symbol.for("react.memo_cache_sentinel"))D=H3.createElement(m,{minWidth:2},H3.createElement(T,{color:"text"},B9)),q[2]=D;else D=q[2];let X;if(q[3]===Symbol.for("react.memo_cache_sentinel"))X=H3.createElement(T,{bold:!0},"Summarized conversation"),q[3]=X;else X=q[3];let P;if(q[4]!==z||q[5]!==$)P=!z&&H3.createElement(M8,null,H3.createElement(m,{flexDirection:"column"},H3.createElement(T,{dimColor:!0},"Summarized ",$.messagesSummarized," messages from this point"),$.userContext&&H3.createElement(T,{dimColor:!0},"Context: ","“",$.userContext,"”"),H3.createElement(T,{dimColor:!0},H3.createElement(G8,{action:"app:toggleTranscript",context:"Global",fallback:"ctrl+o",description:"expand history",parens:!0})))),q[4]=z,q[5]=$,q[6]=P;else P=q[6];let W;if(q[7]!==z||q[8]!==_)W=z&&H3.createElement(M8,null,H3.createElement(T,null,_)),q[7]=z,q[8]=_,q[9]=W;else W=q[9];let Z;if(q[10]!==P||q[11]!==W)Z=H3.createElement(m,{flexDirection:"column",marginTop:1},H3.createElement(m,{flexDirection:"row"},D,H3.createElement(m,{flexDirection:"column"},X,P,W))),q[10]=P,q[11]=W,q[12]=Z;else Z=q[12];return Z}let O;if(q[13]===Symbol.for("react.memo_cache_sentinel"))O=H3.createElement(m,{minWidth:2},H3.createElement(T,{color:"text"},B9)),q[13]=O;else O=q[13];let H;if(q[14]!==z)H=!z&&H3.createElement(T,{dimColor:!0}," ",H3.createElement(G8,{action:"app:toggleTranscript",context:"Global",fallback:"ctrl+o",description:"expand",parens:!0})),q[14]=z,q[15]=H;else H=q[15];let j;if(q[16]!==H)j=H3.createElement(m,{flexDirection:"row"},O,H3.createElement(m,{flexDirection:"column"},H3.createElement(T,{bold:!0},"Compact summary",H))),q[16]=H,q[17]=j;else j=q[17];let J;if(q[18]!==z||q[19]!==_)J=z&&H3.createElement(M8,null,H3.createElement(T,null,_)),q[18]=z,q[19]=_,q[20]=J;else J=q[20];let M;if(q[21]!==j||q[22]!==J)M=H3.createElement(m,{flexDirection:"column",marginTop:1},j,J),q[21]=j,q[22]=J,q[23]=M;else M=q[23];return M}var H3;var J7q=k(()=>{K1();n6();SA();j$();DK();hK();H3=e(W6(),1)});function lsY(A){let q=Y6(89),{message:K,lookups:Y,addMargin:z,tools:w,commands:_,verbose:$,inProgressToolUseIDs:O,progressMessagesForMessage:H,shouldAnimate:j,shouldShowDot:J,style:M,width:D,isTranscriptMode:X,onOpenRateLimitOptions:P,isActiveCollapsedGroup:W,isUserContinuation:Z,lastThinkingBlockId:G,latestBashOutputUUID:f}=A,V=Z===void 0?!1:Z;switch(K.type){case"attachment":{let N;if(q[0]!==z||q[1]!==X||q[2]!==K.attachment||q[3]!==$)N=o5.createElement(lAq,{addMargin:z,attachment:K.attachment,verbose:$,isTranscriptMode:X}),q[0]=z,q[1]=X,q[2]=K.attachment,q[3]=$,q[4]=N;else N=q[4];return N}case"assistant":{let N;if(q[5]!==z||q[6]!==_||q[7]!==O||q[8]!==X||q[9]!==G||q[10]!==Y||q[11]!==K.message.content||q[12]!==K.uuid||q[13]!==P||q[14]!==H||q[15]!==j||q[16]!==J||q[17]!==w||q[18]!==$||q[19]!==D){let y;if(q[21]!==z||q[22]!==_||q[23]!==O||q[24]!==X||q[25]!==G||q[26]!==Y||q[27]!==K.uuid||q[28]!==P||q[29]!==H||q[30]!==j||q[31]!==J||q[32]!==w||q[33]!==$||q[34]!==D)y=(R,h)=>o5.createElement(nsY,{key:h,param:R,addMargin:z,tools:w,commands:_,verbose:$,inProgressToolUseIDs:O,progressMessagesForMessage:H,shouldAnimate:j,shouldShowDot:J,width:D,inProgressToolCallCount:O.size,isTranscriptMode:X,lookups:Y,onOpenRateLimitOptions:P,thinkingBlockId:`${K.uuid}:${h}`,lastThinkingBlockId:G}),q[21]=z,q[22]=_,q[23]=O,q[24]=X,q[25]=G,q[26]=Y,q[27]=K.uuid,q[28]=P,q[29]=H,q[30]=j,q[31]=J,q[32]=w,q[33]=$,q[34]=D,q[35]=y;else y=q[35];N=K.message.content.map(y),q[5]=z,q[6]=_,q[7]=O,q[8]=X,q[9]=G,q[10]=Y,q[11]=K.message.content,q[12]=K.uuid,q[13]=P,q[14]=H,q[15]=j,q[16]=J,q[17]=w,q[18]=$,q[19]=D,q[20]=N}else N=q[20];let v;if(q[36]!==N)v=o5.createElement(m,{flexDirection:"column",width:"100%"},N),q[36]=N,q[37]=v;else v=q[37];return v}case"user":{if(K.isCompactSummary){let x=X?"transcript":"prompt",F;if(q[38]!==K||q[39]!==x)F=o5.createElement(j7q,{message:K,screen:x}),q[38]=K,q[39]=x,q[40]=F;else F=q[40];return F}let N;if(q[41]!==K.imagePasteIds||q[42]!==K.message.content){N=[];let x=0;for(let F of K.message.content)if(F.type==="image"){let g=K.imagePasteIds?.[x];x++,N.push(g??x)}else N.push(x);q[41]=K.imagePasteIds,q[42]=K.message.content,q[43]=N}else N=q[43];let v=f===K.uuid,y;if(q[44]!==z||q[45]!==N||q[46]!==X||q[47]!==V||q[48]!==Y||q[49]!==K||q[50]!==H||q[51]!==M||q[52]!==w||q[53]!==$)y=K.message.content.map((x,F)=>o5.createElement(isY,{key:F,message:K,addMargin:z,tools:w,progressMessagesForMessage:H,param:x,style:M,verbose:$,imageIndex:N[F],isUserContinuation:V,lookups:Y,isTranscriptMode:X})),q[44]=z,q[45]=N,q[46]=X,q[47]=V,q[48]=Y,q[49]=K,q[50]=H,q[51]=M,q[52]=w,q[53]=$,q[54]=y;else y=q[54];let R;if(q[55]!==y)R=o5.createElement(m,{flexDirection:"column",width:"100%"},y),q[55]=y,q[56]=R;else R=q[56];let h=R,B;if(q[57]!==h||q[58]!==v)B=v?o5.createElement(Qw4,null,h):h,q[57]=h,q[58]=v,q[59]=B;else B=q[59];return B}case"system":{if(K.subtype==="compact_boundary"){let v;if(q[60]===Symbol.for("react.memo_cache_sentinel"))v=o5.createElement(A7q,null),q[60]=v;else v=q[60];return v}if(K.subtype==="microcompact_boundary")return null;if(K.subtype==="local_command"){let v;if(q[64]!==K.content)v={type:"text",text:K.content},q[64]=K.content,q[65]=v;else v=q[65];let y;if(q[66]!==z||q[67]!==v||q[68]!==$)y=o5.createElement(f26,{addMargin:z,param:v,verbose:$}),q[66]=z,q[67]=v,q[68]=$,q[69]=y;else y=q[69];return y}let N;if(q[70]!==z||q[71]!==X||q[72]!==K||q[73]!==$)N=o5.createElement(tAq,{message:K,addMargin:z,verbose:$,isTranscriptMode:X}),q[70]=z,q[71]=X,q[72]=K,q[73]=$,q[74]=N;else N=q[74];return N}case"grouped_tool_use":{let N;if(q[75]!==O||q[76]!==Y||q[77]!==K||q[78]!==j||q[79]!==w)N=o5.createElement(K7q,{message:K,tools:w,lookups:Y,inProgressToolUseIDs:O,shouldAnimate:j}),q[75]=O,q[76]=Y,q[77]=K,q[78]=j,q[79]=w,q[80]=N;else N=q[80];return N}case"collapsed_read_search":{let N;if(q[81]!==O||q[82]!==W||q[83]!==Y||q[84]!==K||q[85]!==j||q[86]!==w||q[87]!==$)N=o5.createElement(O7q,{message:K,inProgressToolUseIDs:O,shouldAnimate:j,verbose:$,tools:w,lookups:Y,isActiveGroup:W}),q[81]=O,q[82]=W,q[83]=Y,q[84]=K,q[85]=j,q[86]=w,q[87]=$,q[88]=N;else N=q[88];return N}}}function isY(A){let q=Y6(19),{message:K,addMargin:Y,tools:z,progressMessagesForMessage:w,param:_,style:$,verbose:O,imageIndex:H,isUserContinuation:j,lookups:J,isTranscriptMode:M}=A,{columns:D}=PA();switch(_.type){case"text":{let X;if(q[0]!==Y||q[1]!==M||q[2]!==K.planContent||q[3]!==_||q[4]!==O)X=o5.createElement(f26,{addMargin:Y,param:_,verbose:O,planContent:K.planContent,isTranscriptMode:M}),q[0]=Y,q[1]=M,q[2]=K.planContent,q[3]=_,q[4]=O,q[5]=X;else X=q[5];return X}case"image":{let X=Y&&!j,P;if(q[6]!==H||q[7]!==X)P=o5.createElement(XL1,{imageId:H,addMargin:X}),q[6]=H,q[7]=X,q[8]=P;else P=q[8];return P}case"tool_result":{let X=D-5,P;if(q[9]!==M||q[10]!==J||q[11]!==K||q[12]!==_||q[13]!==w||q[14]!==$||q[15]!==X||q[16]!==z||q[17]!==O)P=o5.createElement(HC4,{param:_,message:K,lookups:J,progressMessagesForMessage:w,style:$,tools:z,verbose:O,width:X,isTranscriptMode:M}),q[9]=M,q[10]=J,q[11]=K,q[12]=_,q[13]=w,q[14]=$,q[15]=X,q[16]=z,q[17]=O,q[18]=P;else P=q[18];return P}default:return}}function nsY(A){let q=Y6(28),{param:K,addMargin:Y,tools:z,commands:w,verbose:_,inProgressToolUseIDs:$,progressMessagesForMessage:O,shouldAnimate:H,shouldShowDot:j,width:J,inProgressToolCallCount:M,isTranscriptMode:D,lookups:X,onOpenRateLimitOptions:P,thinkingBlockId:W,lastThinkingBlockId:Z}=A;switch(K.type){case"tool_use":{let G;if(q[0]!==Y||q[1]!==w||q[2]!==M||q[3]!==$||q[4]!==D||q[5]!==X||q[6]!==K||q[7]!==O||q[8]!==H||q[9]!==j||q[10]!==z||q[11]!==_)G=o5.createElement(ZC4,{param:K,addMargin:Y,tools:z,commands:w,verbose:_,inProgressToolUseIDs:$,progressMessagesForMessage:O,shouldAnimate:H,shouldShowDot:j,inProgressToolCallCount:M,lookups:X,isTranscriptMode:D}),q[0]=Y,q[1]=w,q[2]=M,q[3]=$,q[4]=D,q[5]=X,q[6]=K,q[7]=O,q[8]=H,q[9]=j,q[10]=z,q[11]=_,q[12]=G;else G=q[12];return G}case"text":{let G;if(q[13]!==Y||q[14]!==P||q[15]!==K||q[16]!==j||q[17]!==_||q[18]!==J)G=o5.createElement(DAq,{param:K,addMargin:Y,shouldShowDot:j,verbose:_,width:J,onOpenRateLimitOptions:P}),q[13]=Y,q[14]=P,q[15]=K,q[16]=j,q[17]=_,q[18]=J,q[19]=G;else G=q[19];return G}case"redacted_thinking":{if(!D&&!_)return null;let G;if(q[20]!==Y)G=o5.createElement(UAq,{addMargin:Y}),q[20]=Y,q[21]=G;else G=q[21];return G}case"thinking":{if(!D&&!_)return null;let f=D&&!(!Z||W===Z),V;if(q[22]!==Y||q[23]!==D||q[24]!==K||q[25]!==f||q[26]!==_)V=o5.createElement(PL1,{addMargin:Y,param:K,isTranscriptMode:D,verbose:_,hideInTranscript:f}),q[22]=Y,q[23]=D,q[24]=K,q[25]=f,q[26]=_,q[27]=V;else V=q[27];return V}default:return $6(Error(`Unable to render message type: ${K.type}`)),null}}function rsY(A,q){if(A.message.uuid!==q.message.uuid)return!1;if(A.lastThinkingBlockId!==q.lastThinkingBlockId)return!1;if(A.verbose!==q.verbose)return!1;let K=A.latestBashOutputUUID===A.message.uuid,Y=q.latestBashOutputUUID===q.message.uuid;if(K!==Y)return!1;if(A.isStatic&&q.isStatic)return!0;return!1}var o5,IC;var aN6=k(()=>{K1();n6();x1();jC4();GC4();XAq();DL1();tF8();eF8();pAq();xq();nAq();eAq();q7q();Y7q();H7q();GE8();J7q();o5=e(W6(),1);IC=o5.memo(lsY,rsY)});function M7q(A){let q=Y6(33),{agentType:K,description:Y,descriptionColor:z,taskDescription:w,toolUseCount:_,tokens:$,color:O,isLast:H,isResolved:j,isAsync:J,lastToolInfo:M,hideType:D}=A,X=J===void 0?!1:J,P=D===void 0?!1:D,W=H?"└─":"├─",Z=X&&j,G;if(q[0]!==Z||q[1]!==j||q[2]!==M||q[3]!==w)G=()=>{if(!j)return M||"Initializing…";if(Z)return w??"Running in the background";return"Done"},q[0]=Z,q[1]=j,q[2]=M,q[3]=w,q[4]=G;else G=q[4];let f=G,V=!j,N;if(q[5]!==K||q[6]!==O||q[7]!==Y||q[8]!==z||q[9]!==P)N=P?F9.createElement(T,{bold:!0},Y||K):F9.createElement(F9.Fragment,null,F9.createElement(T,{bold:!0,backgroundColor:O,color:O?"inverseText":void 0},K),Y&&F9.createElement(F9.Fragment,null," (",F9.createElement(T,{backgroundColor:z,color:z?"inverseText":void 0},Y),")")),q[5]=K,q[6]=O,q[7]=Y,q[8]=z,q[9]=P,q[10]=N;else N=q[10];let v;if(q[11]!==Z||q[12]!==$||q[13]!==_)v=!Z&&F9.createElement(F9.Fragment,null," · ",_," tool ",_===1?"use":"uses",$!==null&&F9.createElement(F9.Fragment,null," · ",f3($)," tokens")),q[11]=Z,q[12]=$,q[13]=_,q[14]=v;else v=q[14];let y;if(q[15]!==V||q[16]!==N||q[17]!==v||q[18]!==W)y=F9.createElement(m,{paddingLeft:3},F9.createElement(T,{dimColor:V},W," ",N,v)),q[15]=V,q[16]=N,q[17]=v,q[18]=W,q[19]=y;else y=q[19];let R=!j,h=H?" ":"│",B;if(q[20]!==R||q[21]!==h)B=F9.createElement(T,{dimColor:R},h),q[20]=R,q[21]=h,q[22]=B;else B=q[22];let x;if(q[23]!==f)x=f(),q[23]=f,q[24]=x;else x=q[24];let F;if(q[25]!==x)F=F9.createElement(M8,null,F9.createElement(T,{dimColor:!0},x)),q[25]=x,q[26]=F;else F=q[26];let g;if(q[27]!==B||q[28]!==F)g=F9.createElement(m,{paddingLeft:3,flexDirection:"row"},B,F),q[27]=B,q[28]=F,q[29]=g;else g=q[29];let b;if(q[30]!==g||q[31]!==y)b=F9.createElement(m,{flexDirection:"column"},y,g),q[30]=g,q[31]=y,q[32]=b;else b=q[32];return b}var F9;var D7q=k(()=>{K1();n6();Oq();DK();F9=e(W6(),1)});function mG(A){if(!("message"in A))return!1;let q=A.message;return q!=null&&typeof q==="object"&&"type"in q}function Z7q(A,q,K){if(!mG(A.data))return null;let Y=A.data.message;if(Y.type==="assistant")return sl6(Y.message.content[0],q);if(Y.type==="user"){let z=Y.message.content[0];if(z?.type==="tool_result"){let w=K.get(z.tool_use_id);if(w)return sl6(w,q)}}return null}function osY(A,q,K){return A.filter((O)=>mG(O.data)&&O.data.message.type!=="user").map((O)=>({type:"original",message:O}));function w(O){if(z&&(z.searchCount>0||z.readCount>0||z.replCount>0))Y.push({type:"summary",searchCount:z.searchCount,readCount:z.readCount,replCount:z.replCount,uuid:`summary-${z.startUuid}`,isActive:O});z=null}}function Rr6(A){let q=Y6(3),{prompt:K,dim:Y}=A,z;if(q[0]===Symbol.for("react.memo_cache_sentinel"))z=x8.createElement(T,{color:"success",bold:!0},"Prompt:"),q[0]=z;else z=q[0];let w;if(q[1]!==K)w=x8.createElement(m,{flexDirection:"column"},z,x8.createElement(m,{paddingLeft:2},x8.createElement(PO,null,K))),q[1]=K,q[2]=w;else w=q[2];return w}function KQ8(A){let q=Y6(5),{content:K}=A,Y;if(q[0]===Symbol.for("react.memo_cache_sentinel"))Y=x8.createElement(T,{color:"success",bold:!0},"Response:"),q[0]=Y;else Y=q[0];let z;if(q[1]!==K)z=K.map(tsY),q[1]=K,q[2]=z;else z=q[2];let w;if(q[3]!==z)w=x8.createElement(m,{flexDirection:"column"},Y,z),q[3]=z,q[4]=w;else w=q[4];return w}function tsY(A,q){return x8.createElement(m,{key:q,paddingLeft:2,marginTop:q===0?0:1},x8.createElement(PO,null,A.text))}function esY(A){let q=Y6(15),{progressMessages:K,tools:Y,verbose:z}=A,w;if(q[0]!==K)w=Sr6(K.filter(KtY).map(qtY)),q[0]=K,q[1]=w;else w=q[1];let{lookups:_,inProgressToolUseIDs:$}=w,O;if(q[2]!==_||q[3]!==$||q[4]!==K||q[5]!==Y||q[6]!==z){let j=K.filter(AtY),J;if(q[8]!==_||q[9]!==$||q[10]!==Y||q[11]!==z)J=(M)=>x8.createElement(M8,{key:M.uuid,height:1},x8.createElement(IC,{message:M.data.message,lookups:_,addMargin:!1,tools:Y,commands:[],verbose:z,inProgressToolUseIDs:$,progressMessagesForMessage:[],shouldAnimate:!1,shouldShowDot:!1,isTranscriptMode:!1,isStatic:!0})),q[8]=_,q[9]=$,q[10]=Y,q[11]=z,q[12]=J;else J=q[12];O=j.map(J),q[2]=_,q[3]=$,q[4]=K,q[5]=Y,q[6]=z,q[7]=O}else O=q[7];let H;if(q[13]!==O)H=x8.createElement(x8.Fragment,null,O),q[13]=O,q[14]=H;else H=q[14];return H}function AtY(A){if(!mG(A.data))return!1;let q=A.data.message;if(q.type==="user"&&q.toolUseResult===void 0)return!1;return!0}function qtY(A){return A.data}function KtY(A){return mG(A.data)}function G7q(A,q,{tools:K,verbose:Y,theme:z,isTranscriptMode:w=!1}){let _=A;if(_.status==="remote_launched")return x8.createElement(m,{flexDirection:"column"},x8.createElement(M8,{height:1},x8.createElement(T,null,"Remote agent launched"," ",x8.createElement(T,{dimColor:!0},"· ",_.taskId," · ",_.sessionUrl))));if(A.status==="async_launched"){let{prompt:Z}=A;return x8.createElement(m,{flexDirection:"column"},x8.createElement(M8,{height:1},x8.createElement(T,null,"Backgrounded agent",!w&&x8.createElement(T,{dimColor:!0}," (",x8.createElement(e8,null,x8.createElement(J8,{shortcut:"↓",action:"manage"}),Z&&x8.createElement(G8,{action:"app:toggleTranscript",context:"Global",fallback:"ctrl+o",description:"expand"})),")"))),w&&Z&&x8.createElement(M8,null,x8.createElement(Rr6,{prompt:Z,theme:z})))}if(A.status!=="completed")return null;let{agentId:$,totalDurationMs:O,totalToolUseCount:H,totalTokens:j,usage:J,content:M,prompt:D}=A,P=`Done (${[H===1?"1 tool use":`${H} tool uses`,f3(j)+" tokens",G3(O)].join(" · ")})`,W=ZG({content:P,usage:{...J,inference_geo:null,iterations:null,speed:null}});return x8.createElement(m,{flexDirection:"column"},!1,w&&D&&x8.createElement(M8,null,x8.createElement(Rr6,{prompt:D,theme:z})),w?x8.createElement(tp6,null,x8.createElement(esY,{progressMessages:q,tools:K,verbose:Y})):null,w&&M&&M.length>0&&x8.createElement(M8,null,x8.createElement(KQ8,{content:M,theme:z})),x8.createElement(M8,{height:1},x8.createElement(IC,{message:W,lookups:In,addMargin:!1,tools:K,commands:[],verbose:Y,inProgressToolUseIDs:new Set,progressMessagesForMessage:[],shouldAnimate:!1,shouldShowDot:!1,isTranscriptMode:!1,isStatic:!0})),!w&&x8.createElement(T,{dimColor:!0}," ",x8.createElement(oM,null)))}function f7q({description:A,prompt:q}){if(JH())return null;if(!A||!q)return null;return A}function T7q(A){let q=[];if(A.resume)q.push(x8.createElement(m,{key:"resume",flexWrap:"nowrap",marginLeft:1},x8.createElement(T,{dimColor:!0},"resuming ",A.resume)));let K=!1;if(A.model||K){let Y=d5(),z=K?getAgentModel(void 0,Y,A.model,void 0,A.subagent_type):J5(A.model);if(K||z!==Y)q.push(x8.createElement(m,{key:"model",flexWrap:"nowrap",marginLeft:1},x8.createElement(T,{dimColor:!0},KP(z))))}if(q.length===0)return null;return x8.createElement(x8.Fragment,null,q)}function sN6(A,{tools:q,verbose:K,terminalSize:Y,inProgressToolCallCount:z,isTranscriptMode:w=!1}){if(!A.length)return x8.createElement(M8,{height:1},x8.createElement(T,{dimColor:!0},P7q));let _=(z??1)*asY+ssY,$=!w&&Y&&Y.rows&&Y.rows<_,O=()=>{let Z=A.filter((V)=>{if(!mG(V.data))return!1;return V.data.message.message.content.some((v)=>v.type==="tool_use")}).length,G=A.findLast((V)=>mG(V.data)&&V.data.message.type==="assistant"),f=null;if(G?.data.message.type==="assistant"){let V=G.data.message.message.usage;f=(V.cache_creation_input_tokens??0)+(V.cache_read_input_tokens??0)+V.input_tokens+V.output_tokens}return{toolUseCount:Z,tokens:f}};if($){let{toolUseCount:Z,tokens:G}=O();return x8.createElement(M8,{height:1},x8.createElement(T,{dimColor:!0},"In progress… · ",x8.createElement(T,{bold:!0},Z)," tool"," ",Z===1?"use":"uses",G&&` · ${f3(G)} tokens`," ·"," ",x8.createElement(G8,{action:"app:toggleTranscript",context:"Global",fallback:"ctrl+o",description:"expand",parens:!0})))}let H=osY(A,q,!0),j=w?H:H.slice(-X7q),M=(w?[]:H.slice(0,Math.max(0,H.length-X7q))).filter((Z)=>{if(Z.type==="summary")return Z.searchCount+Z.readCount+Z.replCount>0;let G=Z.message.data;if(!mG(G))return!1;return G.message.message.content.some((f)=>f.type==="tool_use")}).length,D=A[0]?.data,X=D&&mG(D)?D.prompt:void 0;if(j.length===0&&!(w&&X))return x8.createElement(M8,{height:1},x8.createElement(T,{dimColor:!0},P7q));let{lookups:P,inProgressToolUseIDs:W}=Sr6(A.filter((Z)=>mG(Z.data)).map((Z)=>Z.data));return x8.createElement(M8,null,x8.createElement(m,{flexDirection:"column"},x8.createElement(tp6,null,w&&X&&x8.createElement(m,{marginBottom:1},x8.createElement(Rr6,{prompt:X})),j.map((Z)=>{if(Z.type==="summary"){let G=iV1(Z.searchCount,Z.readCount,Z.isActive,Z.replCount);return x8.createElement(m,{key:Z.uuid,height:1,overflow:"hidden"},x8.createElement(T,{dimColor:!0},G))}return x8.createElement(IC,{key:Z.message.uuid,message:Z.message.data.message,lookups:P,addMargin:!1,tools:q,commands:[],verbose:K,inProgressToolUseIDs:W,progressMessagesForMessage:[],shouldAnimate:!1,shouldShowDot:!1,style:"condensed",isTranscriptMode:!1,isStatic:!0})})),M>0&&x8.createElement(T,{dimColor:!0},"+",M," more tool"," ",M===1?"use":"uses"," ",x8.createElement(oM,null))))}function V7q(A,{progressMessagesForMessage:q,tools:K,verbose:Y,isTranscriptMode:z}){let w=q[0]?.data,_=w&&mG(w)?w.agentId:void 0;return x8.createElement(x8.Fragment,null,!1,sN6(q,{tools:K,verbose:Y,isTranscriptMode:z}),x8.createElement(N9,null))}function N7q(A,{progressMessagesForMessage:q,tools:K,verbose:Y,isTranscriptMode:z}){return x8.createElement(x8.Fragment,null,sN6(q,{tools:K,verbose:Y,isTranscriptMode:z}),x8.createElement(i3,{result:A,verbose:Y}))}function YtY(A){let q=A.filter((z)=>{if(!mG(z.data))return!1;let w=z.data.message;return w.type==="user"&&w.message.content.some((_)=>_.type==="tool_result")}).length,K=A.findLast((z)=>mG(z.data)&&z.data.message.type==="assistant"),Y=null;if(K?.data.message.type==="assistant"){let z=K.data.message.message.usage;Y=(z.cache_creation_input_tokens??0)+(z.cache_read_input_tokens??0)+z.input_tokens+z.output_tokens}return{toolUseCount:q,tokens:Y}}function v7q(A,q){if(JH())return null;let{shouldAnimate:K,tools:Y}=q,z=A.map(({param:J,isResolved:M,isError:D,progressMessages:X,result:P})=>{let W=YtY(X),Z=ztY(X,Y),G=wQ8().safeParse(J.input),f=P?.output?.status==="teammate_spawned",V,N,v,y,R;if(f&&G.success&&G.data.name){V=`@${G.data.name}`;let g=G.data.subagent_type;N=W7q(g)?g:void 0,R=G.data.description,y=W7q(g)?lz6(g):void 0}else V=G.success?YQ8(G.data):"Agent",N=G.success?G.data.description:void 0,v=G.success?zQ8(G.data):void 0,R=void 0;let h=G.success&&"run_in_background"in G.data&&G.data.run_in_background===!0,B=P?.output?.status,F=h||(B==="async_launched"||B==="remote_launched")||f;return{id:J.id,agentType:V,description:N,toolUseCount:W.toolUseCount,tokens:W.tokens,isResolved:M,isError:D,isAsync:F,color:v,descriptionColor:y,lastToolInfo:Z,taskDescription:R}}),w=A.some((J)=>!J.isResolved),_=A.some((J)=>J.isError),$=!w,O=z.length>0&&z.every((J)=>J.agentType===z[0]?.agentType),H=O&&z[0]?.agentType!=="Agent"?z[0]?.agentType:null,j=z.every((J)=>J.isAsync);return x8.createElement(m,{flexDirection:"column",marginTop:1},x8.createElement(m,{flexDirection:"row"},x8.createElement(Ww6,{shouldAnimate:K&&w,isUnresolved:w,isError:_}),x8.createElement(T,null,$?x8.createElement(x8.Fragment,null,x8.createElement(T,{bold:!0},A.length)," ",H?`${H} agents`:"agents"," ",j?"launched":"finished"):x8.createElement(x8.Fragment,null,"Running ",x8.createElement(T,{bold:!0},A.length)," ",H?`${H} agents`:"agents","…")," "),x8.createElement(oM,null)),z.map((J,M)=>x8.createElement(M7q,{key:J.id,agentType:J.agentType,description:J.description,descriptionColor:J.descriptionColor,taskDescription:J.taskDescription,toolUseCount:J.toolUseCount,tokens:J.tokens,color:J.color,isLast:M===z.length-1,isResolved:J.isResolved,isError:J.isError,isAsync:J.isAsync,shouldAnimate:K,lastToolInfo:J.lastToolInfo,hideType:O})))}function YQ8(A){if(A?.subagent_type&&A.subagent_type!==nz6.agentType){if(A.subagent_type==="worker")return"Agent";return A.subagent_type}return"Agent"}function zQ8(A){if(!A?.subagent_type)return;return lz6(A.subagent_type)}function ztY(A,q){let K=new Map;for(let _ of A){if(!mG(_.data))continue;if(_.data.message.type==="assistant"){for(let $ of _.data.message.message.content)if($.type==="tool_use")K.set($.id,$)}}let Y=0,z=0;for(let _=A.length-1;_>=0;_--){let $=A[_];if(!mG($.data))continue;let O=Z7q($,q,K);if(O&&(O.isSearch||O.isRead)){if($.data.message.type==="user"){if(O.isSearch)Y++;else if(O.isRead)z++}}else break}if(Y+z>=2)return iV1(Y,z,!0);let w=A.findLast((_)=>{if(!mG(_.data))return!1;let $=_.data.message;return $.type==="user"&&$.message.content.some((O)=>O.type==="tool_result")});if(w?.data.message.type==="user"){let _=w.data.message.message.content.find(($)=>$.type==="tool_result");if(_?.type==="tool_result"){let $=K.get(_.tool_use_id);if($){let O=z5(q,$.name);if(!O)return $.name;let H=$.input,j=O.inputSchema.safeParse(H),J=O.userFacingName(j.success?j.data:void 0);if(O.getToolUseSummary){let M=O.getToolUseSummary(j.success?j.data:void 0);if(M)return`${J}: ${M}`}return J}}}return null}function W7q(A){return!!A&&A!==nz6.agentType&&A!=="worker"}var x8,X7q=3,asY=9,ssY=7,P7q="Initializing…";var WL1=k(()=>{K1();n6();rM();$H();Oq();JL();DK();aN6();SA();Qf1();hC();GW();QS();JK();hK();eq();bV1();D7q();mT1();m16();p7();XQ();Xq();x8=e(W6(),1)});function k7q(A){let q=A.trim();if(!q.startsWith("/"))return null;let Y=q.slice(1).split(" ");if(!Y[0])return null;let z=Y[0],w=!1,_=1;if(Y.length>1&&Y[1]==="(MCP)")z=z+" (MCP)",w=!0,_=2;let $=Y.slice(_).join(" ");return{commandName:z,args:$,isMcp:w}}async function E7q(A){let q;do q=await A.next();while(!q.done);return q.value}async function*ZL1(A,q=1/0){let K=(w)=>{let _=w.next().then(({done:$,value:O})=>({done:$,value:O,generator:w,promise:_}));return _},Y=[...A],z=new Set;while(z.size0){let w=Y.shift();z.add(K(w))}while(z.size>0){let{done:w,value:_,generator:$,promise:O}=await Promise.race(z);if(z.delete(O),!w){if(z.add(K($)),_!==void 0)yield _}else if(Y.length>0){let H=Y.shift();z.add(K(H))}}}async function GL1(A){let q=[];for await(let K of A)q.push(K);return q}async function*_Q8(A){for(let q of A)yield q}var NY$;var N26=k(()=>{NY$=Symbol("NO_VALUE")});import{AsyncLocalStorage as wtY}from"async_hooks";function v26(){return L7q.getStore()}function tN6(A,q){return L7q.run(A,q)}function _tY(A){return A?.agentType==="subagent"}function y7q(){let A=v26();if(!_tY(A)||!A.subagentName)return;return A.isBuiltIn?A.subagentName:"user-defined"}var L7q;var k26=k(()=>{uY();L7q=new wtY});function fL1(A,q,K,Y,z){let w=0;for(let _ of Hm){let $=K[_];if(!$)continue;for(let O of $)for(let H of O.hooks){let j=H.once?()=>{L(`Removing one-shot hook for event ${_} in skill '${Y}'`),TcA(A,q,_,H)}:void 0;$51(A,q,_,O.matcher||"",H,j,z),w++}}if(w>0)L(`Registered ${w} hooks from skill '${Y}'`)}var $Q8=k(()=>{yM6();Ld();G1()});function TL1(A){let K=T1().skillUsage?.[A],Y=Date.now(),z=(K?.usageCount??0)+1;if(!K||K.usageCount!==z||K.lastUsedAt!==Y)_8((w)=>({...w,skillUsage:{...w.skillUsage,[A]:{usageCount:z,lastUsedAt:Y}}}))}function VL1(A){let K=T1().skillUsage?.[A];if(!K)return 0;let Y=(Date.now()-K.lastUsedAt)/86400000,z=Math.pow(0.5,Y/7);return K.usageCount*Math.max(z,0.1)}var NL1=k(()=>{Q8()});var vL1={};m1(vL1,{processSlashCommand:()=>HtY,processPromptSlashCommand:()=>MtY,looksLikeCommand:()=>C7q,formatSkillLoadingMetadata:()=>h7q});import{randomUUID as S7q}from"crypto";async function OtY(A,q,K,Y,z,w){let _=Qx();c("tengu_slash_command_forked",{command_name:A.name});let{skillContent:$,modifiedGetAppState:O,baseAgent:H,promptMessages:j}=await EL1(A,q,K);L(`Executing forked slash command /${A.name} with agent ${H.agentType}`);let J=[],M=[],D=`forked-command-${A.name}`,X=0,P=(f)=>{return X++,{type:"progress",data:{message:f,type:"agent_progress",prompt:$,agentId:_},parentToolUseID:D,toolUseID:`${D}-${X}`,timestamp:new Date().toISOString(),uuid:S7q()}},W=()=>{z({jsx:sN6(M,{tools:K.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};W();try{for await(let f of xC({agentDefinition:H,promptMessages:j,toolUseContext:{...K,getAppState:O},canUseTool:w,isAsync:!1,querySource:"agent:custom",model:A.model,availableTools:K.options.tools})){J.push(f);let V=DD([f]);if(f.type==="assistant"){let N=q01(f);if(N>0)K.setResponseLength((y)=>y+N);let v=V[0];if(v&&v.type==="assistant")M.push(P(f)),W()}if(f.type==="user"){let N=V[0];if(N&&N.type==="user")M.push(P(N)),W()}}}finally{z(null)}let Z=LL1(J,"Command completed");return L(`Forked slash command /${A.name} completed with agent ${_}`),{messages:[A8({content:LL({inputString:`/${A.userFacingName()} ${q}`.trim(),precedingInputBlocks:Y})}),A8({content:` ${Z} `})],shouldQuery:!1,command:A,resultText:Z}}function C7q(A){return!/[^a-zA-Z0-9:\-_]/.test(A)}async function HtY(A,q,K,Y,z,w,_,$,O){let H=k7q(A);if(!H){c("tengu_input_slash_missing",{});let R="Commands are in the form `/command [args]`";return{messages:[bC(),...Y,A8({content:LL({inputString:R,precedingInputBlocks:q})})],shouldQuery:!1,resultText:R}}let{commandName:j,args:J,isMcp:M}=H,D=M?"mcp":!aQ().has(j)?"custom":j;if(!sQ(j,z.options.commands)){let R=!1;try{await P1().stat(`/${j}`),R=!0}catch{}if(C7q(j)&&!R){c("tengu_input_slash_invalid",{input:j});let B=`Unknown skill: ${j}`;return{messages:[bC(),...Y,A8({content:LL({inputString:B,precedingInputBlocks:q})})],shouldQuery:!1,resultText:B}}let h=S7q();return VR6(h),c("tengu_input_prompt",{}),AX("user_prompt",{prompt_length:String(A.length),prompt:vT1(A),"prompt.id":h}),{messages:[A8({content:LL({inputString:A,precedingInputBlocks:q}),uuid:_}),...Y],shouldQuery:!0}}let{messages:X,shouldQuery:P,allowedTools:W,model:Z,command:G,resultText:f,nextInput:V,submitNextInput:N}=await jtY(j,J,w,z,q,K,$,O,_);if(X.length===0){let R={input:D};if(G.type==="prompt"&&G.pluginInfo){let{pluginManifest:h,repository:B}=G.pluginInfo,x=B.lastIndexOf("@"),F=x>0&&ak.has(B.slice(x+1));if(R.plugin_repository=F?B:"third-party",R.plugin_name=F?h.name:"third-party",F&&h.version)R.plugin_version=h.version}return c("tengu_input_command",{...R,...{}}),{messages:[],shouldQuery:!1,model:Z,nextInput:V,submitNextInput:N}}if(X.length===2&&X[1].type==="user"&&typeof X[1].message.content==="string"&&X[1].message.content.startsWith("Unknown command:")){if(!(A.startsWith("/var")||A.startsWith("/tmp")||A.startsWith("/private")))c("tengu_input_slash_invalid",{input:j});return{messages:[bC(),...X],shouldQuery:P,allowedTools:W,model:Z}}let v={input:D};if(G.type==="prompt"&&G.pluginInfo){let{pluginManifest:R,repository:h}=G.pluginInfo,B=h.lastIndexOf("@"),x=B>0&&ak.has(h.slice(B+1));if(v.plugin_repository=x?h:"third-party",v.plugin_name=x?R.name:"third-party",x&&R.version)v.plugin_version=R.version}c("tengu_input_command",{...v,...{}});let y=X.length>0&&X[0]&&$L(X[0]);return{messages:P||X.every(HQ8)||y?X:[bC(),...X],shouldQuery:P,allowedTools:W,model:Z,resultText:f,nextInput:V,submitNextInput:N}}async function jtY(A,q,K,Y,z,w,_,$,O){let H=Tu(A,Y.options.commands);if(H.type==="prompt"&&H.userInvocable!==!1)TL1(A);if(H.userInvocable===!1)return{messages:[A8({content:LL({inputString:`/${A}`,precedingInputBlocks:z})}),A8({content:`This skill can only be invoked by Claude, not directly by users. Ask Claude to use the "${A}" skill for you.`})],shouldQuery:!1,command:H};try{switch(H.type){case"local-jsx":return new Promise((j)=>{let J=(M,D)=>{if(D?.display==="skip"){j({messages:[],shouldQuery:!1,command:H,nextInput:D?.nextInput,submitNextInput:D?.submitNextInput});return}let X=(D?.metaMessages??[]).map((P)=>A8({content:P,isMeta:!0}));j({messages:D?.display==="system"?[hr6(Cr6(H,q)),hr6(`${M}`),...X]:[A8({content:LL({inputString:Cr6(H,q),precedingInputBlocks:z})}),M?A8({content:`${M}`}):A8({content:`${vL}`}),...X],shouldQuery:D?.shouldQuery??!1,command:H,nextInput:D?.nextInput,submitNextInput:D?.submitNextInput})};H.load().then((M)=>M.call(J,Y,q)).then((M)=>{if(Y.options.isNonInteractiveSession){j({messages:[],shouldQuery:!1,command:H});return}K({jsx:M,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0})})});case"local":{let j=H.isSensitive&&q.trim()?"***":q,J=A8({content:LL({inputString:Cr6(H,j),precedingInputBlocks:z})});try{let M=bC(),X=await(await H.load()).call(q,Y);if(X.type==="skip")return{messages:[],shouldQuery:!1,command:H};if(X.type==="compact"){let P=[M,J,...X.displayText?[A8({content:`${X.displayText}`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],W={...X.compactionResult,messagesToKeep:[...X.compactionResult.messagesToKeep??[],...P]};return YQ(),{messages:Ii(W),shouldQuery:!1,command:H}}return{messages:[J,hr6(`${X.value}`)],shouldQuery:!1,command:H,resultText:X.value}}catch(M){return $6(M),{messages:[J,hr6(`${String(M)}`)],shouldQuery:!1,command:H}}}case"prompt":try{if(H.context==="fork")return await OtY(H,q,Y,z,K,$??tM);return await I7q(H,q,Y,z,w,O)}catch(j){if(j instanceof Lz)return{messages:[A8({content:LL({inputString:Cr6(H,q),precedingInputBlocks:z})}),A8({content:oQ})],shouldQuery:!1,command:H};return{messages:[A8({content:LL({inputString:Cr6(H,q),precedingInputBlocks:z})}),A8({content:`${String(j)}`})],shouldQuery:!1,command:H}}}}catch(j){if(j instanceof Ym)return{messages:[A8({content:LL({inputString:j.message,precedingInputBlocks:z})})],shouldQuery:!1,command:H};throw j}}function Cr6(A,q){return OQ8(A.userFacingName(),q)}function h7q(A,q="loading"){return[`<${T0}>${A}`,`<${SZ}>${A}`,"true"].join(` `)}function R7q(A,q){return[`<${T0}>${A}`,`<${SZ}>/${A}`,q?`${q}`:null].filter(Boolean).join(` `)}function JtY(A,q){if(A.userInvocable!==!1)return R7q(A.name,q);if(A.loadedFrom==="skills"||A.loadedFrom==="plugin")return h7q(A.name,A.progressMessage);return R7q(A.name,q)}async function MtY(A,q,K,Y,z=[]){if(!sQ(A,K))throw new Ym(`Unknown command: ${A}`);let w=Tu(A,K);if(w.type!=="prompt")throw Error(`Unexpected ${w.type} command. Expected 'prompt' command. Use /${A} directly in the main conversation.`);return I7q(w,q,Y,[],z)}async function I7q(A,q,K,Y=[],z=[],w){let _=await A.getPromptForCommand(q,K);if(A.hooks){let P=d1();fL1(K.setAppState,P,A.hooks,A.name,A.type==="prompt"?A.skillRoot:void 0)}let $=A.source?`${A.source}:${A.name}`:A.name,O=_.filter((P)=>P.type==="text").map((P)=>P.text).join(` `);m46(A.name,$,O,v26()?.agentId??null);let H=JtY(A,q);L(`Metadata string for ${A.userFacingName()}:`),L(` ${H.substring(0,200)}`);let j=(H.match(//g)||[]).length;L(` command-message tags in metadata: ${j}`);let J=tQ(A.allowedTools??[]),M=z.length>0||Y.length>0?[...z,...Y,..._]:_,D=await GL1(Xf6(_.filter((P)=>P.type==="text").map((P)=>P.text).join(" "),K,null,[],K.messages,"repl_main_thread")),X=[A8({content:H,uuid:w}),A8({content:M,isMeta:!0}),...D,m4({type:"command_permissions",allowedTools:J,model:A.model})];return L(`processPromptSlashCommand creating ${X.length} messages for ${A.userFacingName()}`),X.forEach((P,W)=>{if(P.type==="user"&&"message"in P){let Z=typeof P.message.content==="string"?P.message.content:U6(P.message.content),G="isMeta"in P&&P.isMeta?" [META]":"",f=Z.substring(0,200);L(` Message ${W+1}${G}: ${f}`)}else if(P.type==="attachment")L(` Message ${W+1}: [ATTACHMENT]`)}),{messages:X,shouldQuery:!0,allowedTools:J,model:A.model,command:A}}var kL1=k(()=>{WL1();B1();SA();OH();Y7();Q1();B16();L0();Z8();x1();G1();MA();XP();N26();MW();a1();Ez();Q1();JK6();k26();$Q8();E26();xJ();Ux();Bx();jG();m16();p7();NL1();bi();_L();oj();Qj()});import{randomUUID as XtY}from"crypto";async function PtY(A,q){if(!A.mcpServers?.length)return{clients:q,tools:[],cleanup:async()=>{}};let K=[],Y=[],z=[];for(let _ of A.mcpServers){let $=null,O,H=!1;if(typeof _==="string"){if(O=_,$=$v(_),!$){L(`[Agent: ${A.agentType}] MCP server not found: ${_}`,{level:"warn"});continue}}else{let J=Object.entries(_);if(J.length!==1){L(`[Agent: ${A.agentType}] Invalid MCP server spec: expected exactly one key`,{level:"warn"});continue}let[M,D]=J[0];O=M,$={...D,scope:"dynamic"},H=!0}let j=await BC(O,$);if(K.push(j),H)Y.push(j);if(j.type==="connected"){let J=await RL(j);z.push(...J),L(`[Agent: ${A.agentType}] Connected to MCP server '${O}' with ${J.length} tools`)}else L(`[Agent: ${A.agentType}] Failed to connect to MCP server '${O}': ${j.type}`,{level:"warn"})}let w=async()=>{for(let _ of Y)if(_.type==="connected")try{await _.cleanup()}catch($){L(`[Agent: ${A.agentType}] Error cleaning up MCP server '${_.name}': ${$}`,{level:"warn"})}};return{clients:[...q,...K],tools:z,cleanup:w}}function WtY(A){return A.type==="assistant"||A.type==="user"||A.type==="progress"||A.type==="system"&&"subtype"in A&&A.subtype==="compact_boundary"}async function*xC({agentDefinition:A,promptMessages:q,toolUseContext:K,canUseTool:Y,isAsync:z,canShowPermissionPrompts:w,forkContextMessages:_,querySource:$,override:O,model:H,maxTurns:j,preserveToolUseResults:J,availableTools:M,allowedTools:D,onCacheSafeParams:X,useExactTools:P}){let W=K.getAppState(),Z=W.toolPermissionContext.mode,G,f=G??gf1(A.model,K.options.mainLoopModel,H,Z,A.agentType),V=O?.agentId?O.agentId:Qx();if(mi()){let j6=K.agentId??d1();uT1(V,A.agentType,j6)}let v=[..._?jQ8(_):[],...q],y=_!==void 0?dl(K.readFileState):pl(VY6),[R,h]=await Promise.all([O?.userContext??y_(),O?.systemContext??KH()]),B=A.permissionMode,x=()=>{let j6=K.getAppState(),_6=j6.toolPermissionContext;if(B&&j6.toolPermissionContext.mode!=="bypassPermissions"&&j6.toolPermissionContext.mode!=="acceptEdits"&&j6.toolPermissionContext.mode!=="auto")_6={..._6,mode:B};let k6=w!==void 0?!w:B==="bubble"?!1:z;if(k6)_6={..._6,shouldAvoidPermissionPrompts:!0};if(z&&!k6)_6={..._6,awaitAutomatedChecksBeforeDialog:!0};if(D!==void 0)_6={..._6,alwaysAllowRules:{cliArg:j6.toolPermissionContext.alwaysAllowRules.cliArg,session:[...D]}};let P6=A.effort!==void 0?A.effort:j6.effortValue;if(_6===j6.toolPermissionContext&&P6===j6.effortValue)return j6;return{...j6,toolPermissionContext:_6,effortValue:P6}},F=P?M:Fi(A,M,z).resolvedTools,g=Array.from(W.toolPermissionContext.additionalWorkingDirectories.keys()),b=O?.systemPrompt&&!G?O.systemPrompt:MK(await ZtY(A,K,f,g)),U=O?.abortController?O.abortController:z?new AbortController:K.abortController,d=[];for await(let j6 of MQ8(V,A.agentType,U.signal))if(j6.additionalContexts&&j6.additionalContexts.length>0)d.push(...j6.additionalContexts);if(d.length>0){let j6=m4({type:"hook_additional_context",content:d,hookName:"SubagentStart",toolUseID:XtY(),hookEvent:"SubagentStart"});v.push(j6)}if(A.hooks)ff4(K.setAppState,V,A.hooks,`agent '${A.agentType}'`,!0);let l=A.skills??[];if(l.length>0){let j6=await dS(Uz()),_6=[];for(let P6 of l){let A6=GtY(P6,j6,A);if(!A6){L(`[Agent: ${A.agentType}] Warning: Skill '${P6}' specified in frontmatter was not found`,{level:"warn"});continue}let K6=Tu(A6,j6);if(K6.type!=="prompt"){L(`[Agent: ${A.agentType}] Warning: Skill '${P6}' is not a prompt-based skill`,{level:"warn"});continue}_6.push({skillName:P6,skill:K6})}let{formatSkillLoadingMetadata:k6}=await Promise.resolve().then(() => (kL1(),vL1));for(let{skillName:P6,skill:A6}of _6){let K6=await A6.getPromptForCommand("",K);L(`[Agent: ${A.agentType}] Preloaded skill '${P6}'`);let z6=k6(P6,A6.progressMessage);v.push(A8({content:[{type:"text",text:z6},...K6]}))}}let{clients:t,tools:s,cleanup:H6}=await PtY(A,K.options.mcpClients),Z6=zW([...F,...s],"name"),G6={isNonInteractiveSession:P?K.options.isNonInteractiveSession:z?!0:K.options.isNonInteractiveSession??!1,appendSystemPrompt:K.options.appendSystemPrompt,tools:Z6,commands:[],debug:K.options.debug,verbose:K.options.verbose,mainLoopModel:f,thinkingConfig:P?K.options.thinkingConfig:{type:"disabled"},mcpClients:t,mcpResources:K.options.mcpResources,agentDefinitions:K.options.agentDefinitions,...P&&{querySource:$}},q6=br6(K,{options:G6,agentId:V,agentType:A.agentType,messages:v,readFileState:y,abortController:U,getAppState:x,shareSetAppState:!z,shareSetResponseLength:!0,criticalSystemReminder_EXPERIMENTAL:A.criticalSystemReminder_EXPERIMENTAL});if(J)q6.preserveToolUseResults=!0;if(X)X({systemPrompt:b,userContext:R,systemContext:h,toolUseContext:q6,forkContextMessages:v});await L26(v,V).catch((j6)=>L(`Failed to record sidechain transcript: ${j6}`)),await JQ8(V,{agentType:A.agentType}).catch((j6)=>L(`Failed to write agent metadata: ${j6}`));let w6=v.length>0?v[v.length-1].uuid:null;try{for await(let j6 of uC({messages:v,systemPrompt:b,userContext:R,systemContext:h,canUseTool:Y,toolUseContext:q6,querySource:$,maxTurns:j??A.maxTurns})){if(j6.type==="stream_event"&&j6.event.type==="message_start"&&j6.ttftMs!=null){K.pushApiMetricsEntry?.(j6.ttftMs);continue}if(j6.type==="attachment"){if(j6.attachment.type==="max_turns_reached"){L(`[Agent : $ { agentDefinition.agentType } ] Reached max turns limit ($ { message.attachment.maxTurns } )`);break}yield j6;continue}if(WtY(j6))await L26([j6],V,w6).catch((_6)=>L(`Failed to record sidechain transcript: ${_6}`)),w6=j6.uuid,yield j6}if(U.signal.aborted)throw new Lz;if(gJ(A)&&A.callback)A.callback()}finally{if(await H6(),A.hooks)rM6(K.setAppState,V);q6.readFileState.clear(),v.length=0,Yw6(V)}}function jQ8(A){let q=new Set;for(let K of A)if(K?.type==="user"){let z=K.message.content;if(Array.isArray(z)){for(let w of z)if(w.type==="tool_result"&&w.tool_use_id)q.add(w.tool_use_id)}}return A.filter((K)=>{if(K?.type==="assistant"){let z=K.message.content;if(Array.isArray(z))return!z.some((_)=>_.type==="tool_use"&&_.id&&!q.has(_.id))}return!0})}async function ZtY(A,q,K,Y){try{let w=[A.getSystemPrompt({toolUseContext:q})];return await Ir6(w,K,Y)}catch(z){return await Ir6([b7q],K,Y)}}function GtY(A,q,K){if(sQ(A,q))return A;let Y=K.agentType.split(":")[0];if(Y){let _=`${Y}:${A}`;if(sQ(_,q))return _}let z=`:${A}`,w=q.find((_)=>_.name.endsWith(z));if(w)return w.name;return null}var E26=k(()=>{zi();y26();MA();Ux();dE();yL();R16();lT6();fW();OG();J$();Tf4();Ld();B66();MW();uq();G1();m16();p7();OH();Q1();SA();Bx();d0();LG();FT6();Q1()});function XD(A){return A}function gW(A){return A}function ftY(A){for(let q of A){if(typeof q!=="string")continue;let K=(q.match(/{/g)||[]).length,Y=(q.match(/}/g)||[]).length;if(K!==Y)return!0;let z=(q.match(/\(/g)||[]).length,w=(q.match(/\)/g)||[]).length;if(z!==w)return!0;let _=(q.match(/\[/g)||[]).length,$=(q.match(/\]/g)||[]).length;if(_!==$)return!0;if((q.match(/(?&\s*1(?=\s|$)/g,"").replace(/[012]?\s*>\s*\/dev\/null(?=\s|$)/g,"").replace(/\s*<\s*\/dev\/null(?=\s|$)/g,"")}function ktY(A,q){if(q.length!==1)throw Error("hasUnescapedChar only works with single characters");let K=0;while(K>?|<)/.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.INCOMPLETE_COMMANDS,subId:3}),{behavior:"ask",message:"Command appears to be a continuation line (starts with operator)"};return{behavior:"passthrough",message:"Command appears complete"}}function ytY(A){if(!DQ8.test(A))return!1;let q=/\$\(cat[ \t]*<<(-?)[ \t]*(?:'+([A-Za-z_]\w*)'+|\\([A-Za-z_]\w*))/g,K,Y=[];while((K=q.exec(A))!==null){let O=K[2]||K[3];if(O)Y.push({start:K.index,operatorEnd:K.index+K[0].length,delimiter:O,isDash:K[1]==="-"})}if(Y.length===0)return!1;let z=[];for(let{start:O,operatorEnd:H,delimiter:j,isDash:J}of Y){let M=A.slice(H),D=M.indexOf(` `);if(D===-1)return!1;let X=M.slice(0,D);if(!/^[ \t]*$/.test(X))return!1;let P=H+D+1,Z=A.slice(P).split(` `),G=-1,f=-1,V=-1;for(let v=0;v]/.test(h))return!1}}if(G===-1)return!1;let N=P;for(let v=0;vO.start&&H.startH.start-O.start),_=A;for(let{start:O,end:H}of w)_=_.slice(0,O)+_.slice(H);if(_.trim().length>0){let O=Math.min(...z.map((j)=>j.start));if(A.slice(0,O).trim().length===0)return!1}if(!/^[a-zA-Z0-9 \t"'.\-/_@=,:+~]*$/.test(_))return!1;if(mC(_).behavior!=="passthrough")return!1;return!0}function B7q(A){if(!DQ8.test(A))return null;let q=/\$\(cat[ \t]*<<(-?)[ \t]*(?:'+([A-Za-z_]\w*)'+|\\([A-Za-z_]\w*))/g,K=A,Y=!1,z,w=[];while((z=q.exec(A))!==null){if(z.index>0&&A[z.index-1]==="\\")continue;let _=z[2]||z[3];if(!_)continue;let $=z[1]==="-",O=z.index+z[0].length,H=A.slice(O),j=H.indexOf(` `);if(j===-1)continue;if(!/^[ \t]*$/.test(H.slice(0,j)))continue;let J=O+j+1,M=A.slice(J).split(` `);for(let D=0;D0?1:0);Z=A.indexOf(")",G)}else if(W===""){let G=M[D+1];if(G!==void 0&&/^[ \t]*\)/.test(G)){let f=J+M.slice(0,D+1).join(` `).length+1;Z=A.indexOf(")",f)}}if(Z!==-1)w.push({start:z.index,end:Z+1}),Y=!0;break}}}if(!Y)return null;for(let _=w.length-1;_>=0;_--){let $=w[_];K=K.slice(0,$.start)+K.slice($.end)}return K}function RtY(A){let{originalCommand:q}=A;if(!DQ8.test(q))return{behavior:"passthrough",message:"No heredoc in substitution"};if(ytY(q))return{behavior:"allow",updatedInput:{command:q},decisionReason:{type:"other",reason:"Safe command substitution: cat with quoted/escaped heredoc delimiter"}};return{behavior:"passthrough",message:"Command substitution needs validation"}}function StY(A){let{originalCommand:q,baseCommand:K}=A;if(K!=="git"||!/^git\s+commit\s+/.test(q))return{behavior:"passthrough",message:"Not a git commit"};if(q.includes("\\"))return{behavior:"passthrough",message:"Git commit contains backslash, needs full validation"};let Y=q.match(/^git[ \t]+commit[ \t]+[^;&|`$<>()\n\r]*?-m[ \t]+(["'])([\s\S]*?)\1(.*)$/);if(Y){let[,z,w,_]=Y;if(z==='"'&&w&&/\$\(|`|\$\{/.test(w))return c("tengu_bash_security_check_triggered",{checkId:a5.GIT_COMMIT_SUBSTITUTION,subId:1}),{behavior:"ask",message:"Git commit message contains command substitution patterns"};if(_&&/[;|&()`]|\$\(|\$\{/.test(_))return{behavior:"passthrough",message:"Git commit remainder contains shell metacharacters"};if(_){let $="",O=!1,H=!1;for(let j=0;j<_.length;j++){let J=_[j];if(J==="'"&&!H){O=!O;continue}if(J==='"'&&!O){H=!H;continue}if(!O&&!H)$+=J}if(/[<>]/.test($))return{behavior:"passthrough",message:"Git commit remainder contains unquoted redirect operator"}}if(w&&w.startsWith("-"))return c("tengu_bash_security_check_triggered",{checkId:a5.OBFUSCATED_FLAGS,subId:5}),{behavior:"ask",message:"Command contains quoted characters in flag names"};return{behavior:"allow",updatedInput:{command:q},decisionReason:{type:"other",reason:"Git commit with simple quoted message is allowed"}}}return{behavior:"passthrough",message:"Git commit needs validation"}}function CtY(A){let{originalCommand:q,baseCommand:K}=A;if(K!=="jq")return{behavior:"passthrough",message:"Not jq"};if(/\bsystem\s*\(/.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.JQ_SYSTEM_FUNCTION,subId:1}),{behavior:"ask",message:"jq command contains system() function which executes arbitrary commands"};let Y=q.substring(3).trim();if(/(?:^|\s)(?:-f\b|--from-file|--rawfile|--slurpfile|-L\b|--library-path)/.test(Y))return c("tengu_bash_security_check_triggered",{checkId:a5.JQ_FILE_ARGUMENTS,subId:1}),{behavior:"ask",message:"jq command contains dangerous flags that could execute code or read arbitrary files"};return{behavior:"passthrough",message:"jq command is safe"}}function htY(A){let{unquotedContent:q}=A,K="Command contains shell metacharacters (;, |, or &) in arguments";if(/(?:^|\s)["'][^"']*[;&][^"']*["'](?:\s|$)/.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.SHELL_METACHARACTERS,subId:1}),{behavior:"ask",message:"Command contains shell metacharacters (;, |, or &) in arguments"};if([/-name\s+["'][^"']*[;|&][^"']*["']/,/-path\s+["'][^"']*[;|&][^"']*["']/,/-iname\s+["'][^"']*[;|&][^"']*["']/].some((z)=>z.test(q)))return c("tengu_bash_security_check_triggered",{checkId:a5.SHELL_METACHARACTERS,subId:2}),{behavior:"ask",message:"Command contains shell metacharacters (;, |, or &) in arguments"};if(/-regex\s+["'][^"']*[;&][^"']*["']/.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.SHELL_METACHARACTERS,subId:3}),{behavior:"ask",message:"Command contains shell metacharacters (;, |, or &) in arguments"};return{behavior:"passthrough",message:"No metacharacters"}}function ItY(A){let{fullyUnquotedContent:q}=A;if(/[<>|]\s*\$[A-Za-z_]/.test(q)||/\$[A-Za-z_][A-Za-z0-9_]*\s*[|<>]/.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.DANGEROUS_VARIABLES,subId:1}),{behavior:"ask",message:"Command contains variables in dangerous contexts (redirections or pipes)"};return{behavior:"passthrough",message:"No dangerous variables"}}function btY(A){let{unquotedContent:q}=A;if(ktY(q,"`"))return{behavior:"ask",message:"Command contains backticks (`) for command substitution"};for(let{pattern:K,message:Y}of TtY)if(K.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.DANGEROUS_PATTERNS_COMMAND_SUBSTITUTION,subId:1}),{behavior:"ask",message:`Command contains ${Y}`};return{behavior:"passthrough",message:"No dangerous patterns"}}function x7q(A){let{fullyUnquotedContent:q}=A;if(//.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.DANGEROUS_PATTERNS_OUTPUT_REDIRECTION,subId:1}),{behavior:"ask",message:"Command contains output redirection (>) which could write to arbitrary files"};return{behavior:"passthrough",message:"No redirections"}}function u7q(A){let{fullyUnquotedPreStrip:q}=A;if(!/[\n\r]/.test(q))return{behavior:"passthrough",message:"No newlines"};if(/(?typeof w==="object"&&w!==null&&("op"in w)&&(w.op===";"||w.op==="&&"||w.op==="||")))return{behavior:"passthrough",message:"No command separators"};if(ftY(Y))return c("tengu_bash_security_check_triggered",{checkId:a5.MALFORMED_TOKEN_INJECTION,subId:1}),{behavior:"ask",message:"Command contains ambiguous syntax with command separators that could be misinterpreted"};return{behavior:"passthrough",message:"No malformed token injection detected"}}function gtY(A){let{originalCommand:q,baseCommand:K}=A,Y=/[|&;]/.test(q);if(K==="echo"&&!Y)return{behavior:"passthrough",message:"echo command is safe and has no dangerous flags"};if(/\$'[^']*'/.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.OBFUSCATED_FLAGS,subId:5}),{behavior:"ask",message:"Command contains ANSI-C quoting which can hide characters"};if(/\$"[^"]*"/.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.OBFUSCATED_FLAGS,subId:6}),{behavior:"ask",message:"Command contains locale quoting which can hide characters"};if(/\$['"]{2}\s*-/.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.OBFUSCATED_FLAGS,subId:9}),{behavior:"ask",message:"Command contains empty special quotes before dash (potential bypass)"};if(/(?:^|\s)(?:''|"")+\s*-/.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.OBFUSCATED_FLAGS,subId:7}),{behavior:"ask",message:"Command contains empty quotes before dash (potential bypass)"};if(/(?:""|'')+['"]-/.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.OBFUSCATED_FLAGS,subId:10}),{behavior:"ask",message:"Command contains empty quote pair adjacent to quoted dash (potential flag obfuscation)"};if(/(?:^|\s)['"]{3,}/.test(q))return c("tengu_bash_security_check_triggered",{checkId:a5.OBFUSCATED_FLAGS,subId:11}),{behavior:"ask",message:"Command contains consecutive quote characters at word start (potential obfuscation)"};let z=!1,w=!1,_=!1;for(let $=0;$