var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __esm=(fn,res)=>function(){return fn&&(res=(0,fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __commonJS=(cb,mod2)=>function(){return mod2||(0,cb[__getOwnPropNames(cb)[0]])((mod2={exports:{}}).exports,mod2),mod2.exports};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod2,isNodeMode,target)=>(target=mod2!=null?__create(__getProtoOf(mod2)):{},__copyProps(isNodeMode||!mod2||!mod2.__esModule?__defProp(target,"default",{value:mod2,enumerable:!0}):target,mod2)),__toCommonJS=mod2=>__copyProps(__defProp({},"__esModule",{value:!0}),mod2);var require_firestore_client_config=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/v1/firestore_client_config.json"(exports2,module2){module2.exports={interfaces:{"google.firestore.v1.Firestore":{retry_codes:{non_idempotent:[],idempotent:["DEADLINE_EXCEEDED","UNAVAILABLE"],deadline_exceeded_resource_exhausted_internal_unavailable:["DEADLINE_EXCEEDED","RESOURCE_EXHAUSTED","INTERNAL","UNAVAILABLE"],resource_exhausted_unavailable:["RESOURCE_EXHAUSTED","UNAVAILABLE"],resource_exhausted_aborted_unavailable:["RESOURCE_EXHAUSTED","ABORTED","UNAVAILABLE"]},retry_params:{default:{initial_retry_delay_millis:100,retry_delay_multiplier:1.3,max_retry_delay_millis:6e4,initial_rpc_timeout_millis:6e4,rpc_timeout_multiplier:1,max_rpc_timeout_millis:6e4,total_timeout_millis:6e5}},methods:{GetDocument:{timeout_millis:6e4,retry_codes_name:"deadline_exceeded_resource_exhausted_internal_unavailable",retry_params_name:"default"},ListDocuments:{timeout_millis:6e4,retry_codes_name:"deadline_exceeded_resource_exhausted_internal_unavailable",retry_params_name:"default"},UpdateDocument:{timeout_millis:6e4,retry_codes_name:"resource_exhausted_unavailable",retry_params_name:"default"},DeleteDocument:{timeout_millis:6e4,retry_codes_name:"deadline_exceeded_resource_exhausted_internal_unavailable",retry_params_name:"default"},BatchGetDocuments:{timeout_millis:3e5,retry_codes_name:"deadline_exceeded_resource_exhausted_internal_unavailable",retry_params_name:"default"},BeginTransaction:{timeout_millis:6e4,retry_codes_name:"deadline_exceeded_resource_exhausted_internal_unavailable",retry_params_name:"default"},Commit:{timeout_millis:6e4,retry_codes_name:"resource_exhausted_unavailable",retry_params_name:"default"},Rollback:{timeout_millis:6e4,retry_codes_name:"deadline_exceeded_resource_exhausted_internal_unavailable",retry_params_name:"default"},RunQuery:{timeout_millis:3e5,retry_codes_name:"deadline_exceeded_resource_exhausted_internal_unavailable",retry_params_name:"default"},RunAggregationQuery:{timeout_millis:3e5,retry_codes_name:"deadline_exceeded_resource_exhausted_internal_unavailable",retry_params_name:"default"},PartitionQuery:{timeout_millis:3e5,retry_codes_name:"deadline_exceeded_resource_exhausted_internal_unavailable",retry_params_name:"default"},Write:{timeout_millis:864e5,retry_codes_name:"non_idempotent",retry_params_name:"default"},Listen:{timeout_millis:864e5,retry_codes_name:"deadline_exceeded_resource_exhausted_internal_unavailable",retry_params_name:"default"},ListCollectionIds:{timeout_millis:6e4,retry_codes_name:"deadline_exceeded_resource_exhausted_internal_unavailable",retry_params_name:"default"},BatchWrite:{timeout_millis:6e4,retry_codes_name:"resource_exhausted_aborted_unavailable",retry_params_name:"default"},CreateDocument:{timeout_millis:6e4,retry_codes_name:"resource_exhausted_unavailable",retry_params_name:"default"}}}}}}});var require_object_hash=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/object-hash/index.js"(exports2,module2){"use strict";var crypto6=require("crypto");exports2=module2.exports=objectHash;function objectHash(object,options){return options=applyDefaults(object,options),hash(object,options)}__name(objectHash,"objectHash");exports2.sha1=function(object){return objectHash(object)};exports2.keys=function(object){return objectHash(object,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})};exports2.MD5=function(object){return objectHash(object,{algorithm:"md5",encoding:"hex"})};exports2.keysMD5=function(object){return objectHash(object,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var hashes=crypto6.getHashes?crypto6.getHashes().slice():["sha1","md5"];hashes.push("passthrough");var encodings=["buffer","hex","binary","base64"];function applyDefaults(object,sourceOptions){sourceOptions=sourceOptions||{};var options={};if(options.algorithm=sourceOptions.algorithm||"sha1",options.encoding=sourceOptions.encoding||"hex",options.excludeValues=!!sourceOptions.excludeValues,options.algorithm=options.algorithm.toLowerCase(),options.encoding=options.encoding.toLowerCase(),options.ignoreUnknown=sourceOptions.ignoreUnknown===!0,options.respectType=sourceOptions.respectType!==!1,options.respectFunctionNames=sourceOptions.respectFunctionNames!==!1,options.respectFunctionProperties=sourceOptions.respectFunctionProperties!==!1,options.unorderedArrays=sourceOptions.unorderedArrays===!0,options.unorderedSets=sourceOptions.unorderedSets!==!1,options.unorderedObjects=sourceOptions.unorderedObjects!==!1,options.replacer=sourceOptions.replacer||void 0,options.excludeKeys=sourceOptions.excludeKeys||void 0,typeof object>"u")throw new Error("Object argument required.");for(var i=0;i"u"&&(hashingStream.write=hashingStream.update,hashingStream.end=hashingStream.update);var hasher=typeHasher(options,hashingStream);if(hasher.dispatch(object),hashingStream.update||hashingStream.end(""),hashingStream.digest)return hashingStream.digest(options.encoding==="buffer"?void 0:options.encoding);var buf=hashingStream.read();return options.encoding==="buffer"?buf:buf.toString(options.encoding)}__name(hash,"hash");exports2.writeToStream=function(object,options,stream){return typeof stream>"u"&&(stream=options,options={}),options=applyDefaults(object,options),typeHasher(options,stream).dispatch(object)};function typeHasher(options,writeTo,context){context=context||[];var write=__name(function(str){return writeTo.update?writeTo.update(str,"utf8"):writeTo.write(str,"utf8")},"write");return{dispatch:function(value){options.replacer&&(value=options.replacer(value));var type=typeof value;return value===null&&(type="null"),this["_"+type](value)},_object:function(object){var pattern=/\[object (.*)\]/i,objString=Object.prototype.toString.call(object),objType=pattern.exec(objString);objType?objType=objType[1]:objType="unknown:["+objString+"]",objType=objType.toLowerCase();var objectNumber=null;if((objectNumber=context.indexOf(object))>=0)return this.dispatch("[CIRCULAR:"+objectNumber+"]");if(context.push(object),typeof Buffer<"u"&&Buffer.isBuffer&&Buffer.isBuffer(object))return write("buffer:"),write(object);if(objType!=="object"&&objType!=="function"&&objType!=="asyncfunction")if(this["_"+objType])this["_"+objType](object);else{if(options.ignoreUnknown)return write("["+objType+"]");throw new Error('Unknown object type "'+objType+'"')}else{var keys=Object.keys(object);options.unorderedObjects&&(keys=keys.sort()),options.respectType!==!1&&!isNativeFunction(object)&&keys.splice(0,0,"prototype","__proto__","constructor"),options.excludeKeys&&(keys=keys.filter(function(key){return!options.excludeKeys(key)})),write("object:"+keys.length+":");var self2=this;return keys.forEach(function(key){self2.dispatch(key),write(":"),options.excludeValues||self2.dispatch(object[key]),write(",")})}},_array:function(arr,unordered){unordered=typeof unordered<"u"?unordered:options.unorderedArrays!==!1;var self2=this;if(write("array:"+arr.length+":"),!unordered||arr.length<=1)return arr.forEach(function(entry){return self2.dispatch(entry)});var contextAdditions=[],entries=arr.map(function(entry){var strm=new PassThrough,localContext=context.slice(),hasher=typeHasher(options,strm,localContext);return hasher.dispatch(entry),contextAdditions=contextAdditions.concat(localContext.slice(context.length)),strm.read().toString()});return context=context.concat(contextAdditions),entries.sort(),this._array(entries,!1)},_date:function(date){return write("date:"+date.toJSON())},_symbol:function(sym){return write("symbol:"+sym.toString())},_error:function(err){return write("error:"+err.toString())},_boolean:function(bool){return write("bool:"+bool.toString())},_string:function(string){write("string:"+string.length+":"),write(string.toString())},_function:function(fn){write("fn:"),isNativeFunction(fn)?this.dispatch("[native]"):this.dispatch(fn.toString()),options.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(fn.name)),options.respectFunctionProperties&&this._object(fn)},_number:function(number){return write("number:"+number.toString())},_xml:function(xml){return write("xml:"+xml.toString())},_null:function(){return write("Null")},_undefined:function(){return write("Undefined")},_regexp:function(regex){return write("regex:"+regex.toString())},_uint8array:function(arr){return write("uint8array:"),this.dispatch(Array.prototype.slice.call(arr))},_uint8clampedarray:function(arr){return write("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(arr))},_int8array:function(arr){return write("int8array:"),this.dispatch(Array.prototype.slice.call(arr))},_uint16array:function(arr){return write("uint16array:"),this.dispatch(Array.prototype.slice.call(arr))},_int16array:function(arr){return write("int16array:"),this.dispatch(Array.prototype.slice.call(arr))},_uint32array:function(arr){return write("uint32array:"),this.dispatch(Array.prototype.slice.call(arr))},_int32array:function(arr){return write("int32array:"),this.dispatch(Array.prototype.slice.call(arr))},_float32array:function(arr){return write("float32array:"),this.dispatch(Array.prototype.slice.call(arr))},_float64array:function(arr){return write("float64array:"),this.dispatch(Array.prototype.slice.call(arr))},_arraybuffer:function(arr){return write("arraybuffer:"),this.dispatch(new Uint8Array(arr))},_url:function(url){return write("url:"+url.toString(),"utf8")},_map:function(map){write("map:");var arr=Array.from(map);return this._array(arr,options.unorderedSets!==!1)},_set:function(set){write("set:");var arr=Array.from(set);return this._array(arr,options.unorderedSets!==!1)},_file:function(file){return write("file:"),this.dispatch([file.name,file.size,file.type,file.lastModfied])},_blob:function(){if(options.ignoreUnknown)return write("[blob]");throw Error(`Hashing Blob objects is currently not supported (see https://github.com/puleos/object-hash/issues/26) Use "options.replacer" or "options.ignoreUnknown" `)},_domwindow:function(){return write("domwindow")},_bigint:function(number){return write("bigint:"+number.toString())},_process:function(){return write("process")},_timer:function(){return write("timer")},_pipe:function(){return write("pipe")},_tcp:function(){return write("tcp")},_udp:function(){return write("udp")},_tty:function(){return write("tty")},_statwatcher:function(){return write("statwatcher")},_securecontext:function(){return write("securecontext")},_connection:function(){return write("connection")},_zlib:function(){return write("zlib")},_context:function(){return write("context")},_nodescript:function(){return write("nodescript")},_httpparser:function(){return write("httpparser")},_dataview:function(){return write("dataview")},_signal:function(){return write("signal")},_fsevent:function(){return write("fsevent")},_tlswrap:function(){return write("tlswrap")}}}__name(typeHasher,"typeHasher");function PassThrough(){return{buf:"",write:function(b){this.buf+=b},end:function(b){this.buf+=b},read:function(){return this.buf}}}__name(PassThrough,"PassThrough")}});var require_aspromise=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@protobufjs/aspromise/index.js"(exports2,module2){"use strict";module2.exports=asPromise;function asPromise(fn,ctx){for(var params=new Array(arguments.length-1),offset=0,index=2,pending=!0;index1&&string.charAt(p)==="=";)++n;return Math.ceil(string.length*3)/4-n},"length");var b64=new Array(64),s64=new Array(123);for(i=0;i<64;)s64[b64[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;var i;base64.encode=__name(function(buffer,start,end){for(var parts=null,chunk=[],i2=0,j=0,t;start>2],t=(b&3)<<4,j=1;break;case 1:chunk[i2++]=b64[t|b>>4],t=(b&15)<<2,j=2;break;case 2:chunk[i2++]=b64[t|b>>6],chunk[i2++]=b64[b&63],j=0;break}i2>8191&&((parts||(parts=[])).push(String.fromCharCode.apply(String,chunk)),i2=0)}return j&&(chunk[i2++]=b64[t],chunk[i2++]=61,j===1&&(chunk[i2++]=61)),parts?(i2&&parts.push(String.fromCharCode.apply(String,chunk.slice(0,i2))),parts.join("")):String.fromCharCode.apply(String,chunk.slice(0,i2))},"encode");var invalidEncoding="invalid encoding";base64.decode=__name(function(string,buffer,offset){for(var start=offset,j=0,t,i2=0;i21)break;if((c=s64[c])===void 0)throw Error(invalidEncoding);switch(j){case 0:t=c,j=1;break;case 1:buffer[offset++]=t<<2|(c&48)>>4,t=c,j=2;break;case 2:buffer[offset++]=(t&15)<<4|(c&60)>>2,t=c,j=3;break;case 3:buffer[offset++]=(t&3)<<6|c,j=0;break}}if(j===1)throw Error(invalidEncoding);return offset-start},"decode");base64.test=__name(function(string){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string)},"test")}});var require_eventemitter=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@protobufjs/eventemitter/index.js"(exports2,module2){"use strict";module2.exports=EventEmitter;function EventEmitter(){this._listeners={}}__name(EventEmitter,"EventEmitter");EventEmitter.prototype.on=__name(function(evt,fn,ctx){return(this._listeners[evt]||(this._listeners[evt]=[])).push({fn,ctx:ctx||this}),this},"on");EventEmitter.prototype.off=__name(function(evt,fn){if(evt===void 0)this._listeners={};else if(fn===void 0)this._listeners[evt]=[];else for(var listeners=this._listeners[evt],i=0;i0?0:2147483648,buf,pos);else if(isNaN(val))writeUint(2143289344,buf,pos);else if(val>34028234663852886e22)writeUint((sign<<31|2139095040)>>>0,buf,pos);else if(val<11754943508222875e-54)writeUint((sign<<31|Math.round(val/1401298464324817e-60))>>>0,buf,pos);else{var exponent=Math.floor(Math.log(val)/Math.LN2),mantissa=Math.round(val*Math.pow(2,-exponent)*8388608)&8388607;writeUint((sign<<31|exponent+127<<23|mantissa)>>>0,buf,pos)}}__name(writeFloat_ieee754,"writeFloat_ieee754"),exports3.writeFloatLE=writeFloat_ieee754.bind(null,writeUintLE),exports3.writeFloatBE=writeFloat_ieee754.bind(null,writeUintBE);function readFloat_ieee754(readUint,buf,pos){var uint=readUint(buf,pos),sign=(uint>>31)*2+1,exponent=uint>>>23&255,mantissa=uint&8388607;return exponent===255?mantissa?NaN:sign*(1/0):exponent===0?sign*1401298464324817e-60*mantissa:sign*Math.pow(2,exponent-150)*(mantissa+8388608)}__name(readFloat_ieee754,"readFloat_ieee754"),exports3.readFloatLE=readFloat_ieee754.bind(null,readUintLE),exports3.readFloatBE=readFloat_ieee754.bind(null,readUintBE)}(),typeof Float64Array<"u"?function(){var f64=new Float64Array([-0]),f8b=new Uint8Array(f64.buffer),le=f8b[7]===128;function writeDouble_f64_cpy(val,buf,pos){f64[0]=val,buf[pos]=f8b[0],buf[pos+1]=f8b[1],buf[pos+2]=f8b[2],buf[pos+3]=f8b[3],buf[pos+4]=f8b[4],buf[pos+5]=f8b[5],buf[pos+6]=f8b[6],buf[pos+7]=f8b[7]}__name(writeDouble_f64_cpy,"writeDouble_f64_cpy");function writeDouble_f64_rev(val,buf,pos){f64[0]=val,buf[pos]=f8b[7],buf[pos+1]=f8b[6],buf[pos+2]=f8b[5],buf[pos+3]=f8b[4],buf[pos+4]=f8b[3],buf[pos+5]=f8b[2],buf[pos+6]=f8b[1],buf[pos+7]=f8b[0]}__name(writeDouble_f64_rev,"writeDouble_f64_rev"),exports3.writeDoubleLE=le?writeDouble_f64_cpy:writeDouble_f64_rev,exports3.writeDoubleBE=le?writeDouble_f64_rev:writeDouble_f64_cpy;function readDouble_f64_cpy(buf,pos){return f8b[0]=buf[pos],f8b[1]=buf[pos+1],f8b[2]=buf[pos+2],f8b[3]=buf[pos+3],f8b[4]=buf[pos+4],f8b[5]=buf[pos+5],f8b[6]=buf[pos+6],f8b[7]=buf[pos+7],f64[0]}__name(readDouble_f64_cpy,"readDouble_f64_cpy");function readDouble_f64_rev(buf,pos){return f8b[7]=buf[pos],f8b[6]=buf[pos+1],f8b[5]=buf[pos+2],f8b[4]=buf[pos+3],f8b[3]=buf[pos+4],f8b[2]=buf[pos+5],f8b[1]=buf[pos+6],f8b[0]=buf[pos+7],f64[0]}__name(readDouble_f64_rev,"readDouble_f64_rev"),exports3.readDoubleLE=le?readDouble_f64_cpy:readDouble_f64_rev,exports3.readDoubleBE=le?readDouble_f64_rev:readDouble_f64_cpy}():function(){function writeDouble_ieee754(writeUint,off0,off1,val,buf,pos){var sign=val<0?1:0;if(sign&&(val=-val),val===0)writeUint(0,buf,pos+off0),writeUint(1/val>0?0:2147483648,buf,pos+off1);else if(isNaN(val))writeUint(0,buf,pos+off0),writeUint(2146959360,buf,pos+off1);else if(val>17976931348623157e292)writeUint(0,buf,pos+off0),writeUint((sign<<31|2146435072)>>>0,buf,pos+off1);else{var mantissa;if(val<22250738585072014e-324)mantissa=val/5e-324,writeUint(mantissa>>>0,buf,pos+off0),writeUint((sign<<31|mantissa/4294967296)>>>0,buf,pos+off1);else{var exponent=Math.floor(Math.log(val)/Math.LN2);exponent===1024&&(exponent=1023),mantissa=val*Math.pow(2,-exponent),writeUint(mantissa*4503599627370496>>>0,buf,pos+off0),writeUint((sign<<31|exponent+1023<<20|mantissa*1048576&1048575)>>>0,buf,pos+off1)}}}__name(writeDouble_ieee754,"writeDouble_ieee754"),exports3.writeDoubleLE=writeDouble_ieee754.bind(null,writeUintLE,0,4),exports3.writeDoubleBE=writeDouble_ieee754.bind(null,writeUintBE,4,0);function readDouble_ieee754(readUint,off0,off1,buf,pos){var lo=readUint(buf,pos+off0),hi=readUint(buf,pos+off1),sign=(hi>>31)*2+1,exponent=hi>>>20&2047,mantissa=4294967296*(hi&1048575)+lo;return exponent===2047?mantissa?NaN:sign*(1/0):exponent===0?sign*5e-324*mantissa:sign*Math.pow(2,exponent-1075)*(mantissa+4503599627370496)}__name(readDouble_ieee754,"readDouble_ieee754"),exports3.readDoubleLE=readDouble_ieee754.bind(null,readUintLE,0,4),exports3.readDoubleBE=readDouble_ieee754.bind(null,readUintBE,4,0)}(),exports3}__name(factory,"factory");function writeUintLE(val,buf,pos){buf[pos]=val&255,buf[pos+1]=val>>>8&255,buf[pos+2]=val>>>16&255,buf[pos+3]=val>>>24}__name(writeUintLE,"writeUintLE");function writeUintBE(val,buf,pos){buf[pos]=val>>>24,buf[pos+1]=val>>>16&255,buf[pos+2]=val>>>8&255,buf[pos+3]=val&255}__name(writeUintBE,"writeUintBE");function readUintLE(buf,pos){return(buf[pos]|buf[pos+1]<<8|buf[pos+2]<<16|buf[pos+3]<<24)>>>0}__name(readUintLE,"readUintLE");function readUintBE(buf,pos){return(buf[pos]<<24|buf[pos+1]<<16|buf[pos+2]<<8|buf[pos+3])>>>0}__name(readUintBE,"readUintBE")}});var require_inquire=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@protobufjs/inquire/index.js"(exports,module){"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}__name(inquire,"inquire")}});var require_utf8=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@protobufjs/utf8/index.js"(exports2){"use strict";var utf8=exports2;utf8.length=__name(function(string){for(var len=0,c=0,i=0;i191&&t<224?chunk[i++]=(t&31)<<6|buffer[start++]&63:t>239&&t<365?(t=((t&7)<<18|(buffer[start++]&63)<<12|(buffer[start++]&63)<<6|buffer[start++]&63)-65536,chunk[i++]=55296+(t>>10),chunk[i++]=56320+(t&1023)):chunk[i++]=(t&15)<<12|(buffer[start++]&63)<<6|buffer[start++]&63,i>8191&&((parts||(parts=[])).push(String.fromCharCode.apply(String,chunk)),i=0);return parts?(i&&parts.push(String.fromCharCode.apply(String,chunk.slice(0,i))),parts.join("")):String.fromCharCode.apply(String,chunk.slice(0,i))},"utf8_read");utf8.write=__name(function(string,buffer,offset){for(var start=offset,c1,c2,i=0;i>6|192,buffer[offset++]=c1&63|128):(c1&64512)===55296&&((c2=string.charCodeAt(i+1))&64512)===56320?(c1=65536+((c1&1023)<<10)+(c2&1023),++i,buffer[offset++]=c1>>18|240,buffer[offset++]=c1>>12&63|128,buffer[offset++]=c1>>6&63|128,buffer[offset++]=c1&63|128):(buffer[offset++]=c1>>12|224,buffer[offset++]=c1>>6&63|128,buffer[offset++]=c1&63|128);return offset-start},"utf8_write")}});var require_pool=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@protobufjs/pool/index.js"(exports2,module2){"use strict";module2.exports=pool;function pool(alloc,slice,size){var SIZE=size||8192,MAX=SIZE>>>1,slab=null,offset=SIZE;return __name(function(size2){if(size2<1||size2>MAX)return alloc(size2);offset+size2>SIZE&&(slab=alloc(SIZE),offset=0);var buf=slice.call(slab,offset,offset+=size2);return offset&7&&(offset=(offset|7)+1),buf},"pool_alloc")}__name(pool,"pool")}});var require_longbits=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/util/longbits.js"(exports2,module2){"use strict";module2.exports=LongBits;var util=require_minimal();function LongBits(lo,hi){this.lo=lo>>>0,this.hi=hi>>>0}__name(LongBits,"LongBits");var zero=LongBits.zero=new LongBits(0,0);zero.toNumber=function(){return 0};zero.zzEncode=zero.zzDecode=function(){return this};zero.length=function(){return 1};var zeroHash=LongBits.zeroHash="\0\0\0\0\0\0\0\0";LongBits.fromNumber=__name(function(value){if(value===0)return zero;var sign=value<0;sign&&(value=-value);var lo=value>>>0,hi=(value-lo)/4294967296>>>0;return sign&&(hi=~hi>>>0,lo=~lo>>>0,++lo>4294967295&&(lo=0,++hi>4294967295&&(hi=0))),new LongBits(lo,hi)},"fromNumber");LongBits.from=__name(function(value){if(typeof value=="number")return LongBits.fromNumber(value);if(util.isString(value))if(util.Long)value=util.Long.fromString(value);else return LongBits.fromNumber(parseInt(value,10));return value.low||value.high?new LongBits(value.low>>>0,value.high>>>0):zero},"from");LongBits.prototype.toNumber=__name(function(unsigned){if(!unsigned&&this.hi>>>31){var lo=~this.lo+1>>>0,hi=~this.hi>>>0;return lo||(hi=hi+1>>>0),-(lo+hi*4294967296)}return this.lo+this.hi*4294967296},"toNumber");LongBits.prototype.toLong=__name(function(unsigned){return util.Long?new util.Long(this.lo|0,this.hi|0,!!unsigned):{low:this.lo|0,high:this.hi|0,unsigned:!!unsigned}},"toLong");var charCodeAt=String.prototype.charCodeAt;LongBits.fromHash=__name(function(hash){return hash===zeroHash?zero:new LongBits((charCodeAt.call(hash,0)|charCodeAt.call(hash,1)<<8|charCodeAt.call(hash,2)<<16|charCodeAt.call(hash,3)<<24)>>>0,(charCodeAt.call(hash,4)|charCodeAt.call(hash,5)<<8|charCodeAt.call(hash,6)<<16|charCodeAt.call(hash,7)<<24)>>>0)},"fromHash");LongBits.prototype.toHash=__name(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)},"toHash");LongBits.prototype.zzEncode=__name(function(){var mask=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^mask)>>>0,this.lo=(this.lo<<1^mask)>>>0,this},"zzEncode");LongBits.prototype.zzDecode=__name(function(){var mask=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^mask)>>>0,this.hi=(this.hi>>>1^mask)>>>0,this},"zzDecode");LongBits.prototype.length=__name(function(){var part0=this.lo,part1=(this.lo>>>28|this.hi<<4)>>>0,part2=this.hi>>>24;return part2===0?part1===0?part0<16384?part0<128?1:2:part0<2097152?3:4:part1<16384?part1<128?5:6:part1<2097152?7:8:part2<128?9:10},"length")}});var require_minimal=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/util/minimal.js"(exports2){"use strict";var util=exports2;util.asPromise=require_aspromise();util.base64=require_base64();util.EventEmitter=require_eventemitter();util.float=require_float();util.inquire=require_inquire();util.utf8=require_utf8();util.pool=require_pool();util.LongBits=require_longbits();util.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);util.global=util.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||exports2;util.emptyArray=Object.freeze?Object.freeze([]):[];util.emptyObject=Object.freeze?Object.freeze({}):{};util.isInteger=Number.isInteger||__name(function(value){return typeof value=="number"&&isFinite(value)&&Math.floor(value)===value},"isInteger");util.isString=__name(function(value){return typeof value=="string"||value instanceof String},"isString");util.isObject=__name(function(value){return value&&typeof value=="object"},"isObject");util.isset=util.isSet=__name(function(obj,prop){var value=obj[prop];return value!=null&&obj.hasOwnProperty(prop)?typeof value!="object"||(Array.isArray(value)?value.length:Object.keys(value).length)>0:!1},"isSet");util.Buffer=function(){try{var Buffer2=util.inquire("buffer").Buffer;return Buffer2.prototype.utf8Write?Buffer2:null}catch{return null}}();util._Buffer_from=null;util._Buffer_allocUnsafe=null;util.newBuffer=__name(function(sizeOrArray){return typeof sizeOrArray=="number"?util.Buffer?util._Buffer_allocUnsafe(sizeOrArray):new util.Array(sizeOrArray):util.Buffer?util._Buffer_from(sizeOrArray):typeof Uint8Array>"u"?sizeOrArray:new Uint8Array(sizeOrArray)},"newBuffer");util.Array=typeof Uint8Array<"u"?Uint8Array:Array;util.Long=util.global.dcodeIO&&util.global.dcodeIO.Long||util.global.Long||util.inquire("long");util.key2Re=/^true|false|0|1$/;util.key32Re=/^-?(?:0|[1-9][0-9]*)$/;util.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;util.longToHash=__name(function(value){return value?util.LongBits.from(value).toHash():util.LongBits.zeroHash},"longToHash");util.longFromHash=__name(function(hash,unsigned){var bits=util.LongBits.fromHash(hash);return util.Long?util.Long.fromBits(bits.lo,bits.hi,unsigned):bits.toNumber(!!unsigned)},"longFromHash");function merge(dst,src,ifNotSet){for(var keys=Object.keys(src),i=0;i-1;--i2)if(fieldMap[keys[i2]]===1&&this[keys[i2]]!==void 0&&this[keys[i2]]!==null)return keys[i2]}},"getOneOf");util.oneOfSetter=__name(function(fieldNames){return function(name){for(var i=0;i127;)buf[pos++]=val&127|128,val>>>=7;buf[pos]=val}__name(writeVarint32,"writeVarint32");function VarintOp(len,val){this.len=len,this.next=void 0,this.val=val}__name(VarintOp,"VarintOp");VarintOp.prototype=Object.create(Op.prototype);VarintOp.prototype.fn=writeVarint32;Writer.prototype.uint32=__name(function(value){return this.len+=(this.tail=this.tail.next=new VarintOp((value=value>>>0)<128?1:value<16384?2:value<2097152?3:value<268435456?4:5,value)).len,this},"write_uint32");Writer.prototype.int32=__name(function(value){return value<0?this._push(writeVarint64,10,LongBits.fromNumber(value)):this.uint32(value)},"write_int32");Writer.prototype.sint32=__name(function(value){return this.uint32((value<<1^value>>31)>>>0)},"write_sint32");function writeVarint64(val,buf,pos){for(;val.hi;)buf[pos++]=val.lo&127|128,val.lo=(val.lo>>>7|val.hi<<25)>>>0,val.hi>>>=7;for(;val.lo>127;)buf[pos++]=val.lo&127|128,val.lo=val.lo>>>7;buf[pos++]=val.lo}__name(writeVarint64,"writeVarint64");Writer.prototype.uint64=__name(function(value){var bits=LongBits.from(value);return this._push(writeVarint64,bits.length(),bits)},"write_uint64");Writer.prototype.int64=Writer.prototype.uint64;Writer.prototype.sint64=__name(function(value){var bits=LongBits.from(value).zzEncode();return this._push(writeVarint64,bits.length(),bits)},"write_sint64");Writer.prototype.bool=__name(function(value){return this._push(writeByte,1,value?1:0)},"write_bool");function writeFixed32(val,buf,pos){buf[pos]=val&255,buf[pos+1]=val>>>8&255,buf[pos+2]=val>>>16&255,buf[pos+3]=val>>>24}__name(writeFixed32,"writeFixed32");Writer.prototype.fixed32=__name(function(value){return this._push(writeFixed32,4,value>>>0)},"write_fixed32");Writer.prototype.sfixed32=Writer.prototype.fixed32;Writer.prototype.fixed64=__name(function(value){var bits=LongBits.from(value);return this._push(writeFixed32,4,bits.lo)._push(writeFixed32,4,bits.hi)},"write_fixed64");Writer.prototype.sfixed64=Writer.prototype.fixed64;Writer.prototype.float=__name(function(value){return this._push(util.float.writeFloatLE,4,value)},"write_float");Writer.prototype.double=__name(function(value){return this._push(util.float.writeDoubleLE,8,value)},"write_double");var writeBytes=util.Array.prototype.set?__name(function(val,buf,pos){buf.set(val,pos)},"writeBytes_set"):__name(function(val,buf,pos){for(var i=0;i>>0;if(!len)return this._push(writeByte,1,0);if(util.isString(value)){var buf=Writer.alloc(len=base64.length(value));base64.decode(value,buf,0),value=buf}return this.uint32(len)._push(writeBytes,len,value)},"write_bytes");Writer.prototype.string=__name(function(value){var len=utf8.length(value);return len?this.uint32(len)._push(utf8.write,len,value):this._push(writeByte,1,0)},"write_string");Writer.prototype.fork=__name(function(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},"fork");Writer.prototype.reset=__name(function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},"reset");Writer.prototype.ldelim=__name(function(){var head=this.head,tail=this.tail,len=this.len;return this.reset().uint32(len),len&&(this.tail.next=head.next,this.tail=tail,this.len+=len),this},"ldelim");Writer.prototype.finish=__name(function(){for(var head=this.head.next,buf=this.constructor.alloc(this.len),pos=0;head;)head.fn(head.val,buf,pos),pos+=head.len,head=head.next;return buf},"finish");Writer._configure=function(BufferWriter_){BufferWriter=BufferWriter_,Writer.create=create(),BufferWriter._configure()}}});var require_writer_buffer=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/writer_buffer.js"(exports2,module2){"use strict";module2.exports=BufferWriter;var Writer=require_writer();(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util=require_minimal();function BufferWriter(){Writer.call(this)}__name(BufferWriter,"BufferWriter");BufferWriter._configure=function(){BufferWriter.alloc=util._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util.Buffer&&util.Buffer.prototype instanceof Uint8Array&&util.Buffer.prototype.set.name==="set"?__name(function(val,buf,pos){buf.set(val,pos)},"writeBytesBuffer_set"):__name(function(val,buf,pos){if(val.copy)val.copy(buf,pos,0,val.length);else for(var i=0;i>>0;return this.uint32(len),len&&this._push(BufferWriter.writeBytesBuffer,len,value),this},"write_bytes_buffer");function writeStringBuffer(val,buf,pos){val.length<40?util.utf8.write(val,buf,pos):buf.utf8Write?buf.utf8Write(val,pos):buf.write(val,pos)}__name(writeStringBuffer,"writeStringBuffer");BufferWriter.prototype.string=__name(function(value){var len=util.Buffer.byteLength(value);return this.uint32(len),len&&this._push(writeStringBuffer,len,value),this},"write_string_buffer");BufferWriter._configure()}});var require_reader=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/reader.js"(exports2,module2){"use strict";module2.exports=Reader;var util=require_minimal(),BufferReader,LongBits=util.LongBits,utf8=util.utf8;function indexOutOfRange(reader,writeLength){return RangeError("index out of range: "+reader.pos+" + "+(writeLength||1)+" > "+reader.len)}__name(indexOutOfRange,"indexOutOfRange");function Reader(buffer){this.buf=buffer,this.pos=0,this.len=buffer.length}__name(Reader,"Reader");var create_array=typeof Uint8Array<"u"?__name(function(buffer){if(buffer instanceof Uint8Array||Array.isArray(buffer))return new Reader(buffer);throw Error("illegal buffer")},"create_typed_array"):__name(function(buffer){if(Array.isArray(buffer))return new Reader(buffer);throw Error("illegal buffer")},"create_array"),create=__name(function(){return util.Buffer?__name(function(buffer){return(Reader.create=__name(function(buffer2){return util.Buffer.isBuffer(buffer2)?new BufferReader(buffer2):create_array(buffer2)},"create_buffer"))(buffer)},"create_buffer_setup"):create_array},"create");Reader.create=create();Reader.prototype._slice=util.Array.prototype.subarray||util.Array.prototype.slice;Reader.prototype.uint32=__name(function(){var value=4294967295;return __name(function(){if(value=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(value=(value|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(value=(value|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(value=(value|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(value=(value|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return value;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return value},"read_uint32")},"read_uint32_setup")();Reader.prototype.int32=__name(function(){return this.uint32()|0},"read_int32");Reader.prototype.sint32=__name(function(){var value=this.uint32();return value>>>1^-(value&1)|0},"read_sint32");function readLongVarint(){var bits=new LongBits(0,0),i=0;if(this.len-this.pos>4){for(;i<4;++i)if(bits.lo=(bits.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return bits;if(bits.lo=(bits.lo|(this.buf[this.pos]&127)<<28)>>>0,bits.hi=(bits.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return bits;i=0}else{for(;i<3;++i){if(this.pos>=this.len)throw indexOutOfRange(this);if(bits.lo=(bits.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return bits}return bits.lo=(bits.lo|(this.buf[this.pos++]&127)<>>0,bits}if(this.len-this.pos>4){for(;i<5;++i)if(bits.hi=(bits.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return bits}else for(;i<5;++i){if(this.pos>=this.len)throw indexOutOfRange(this);if(bits.hi=(bits.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return bits}throw Error("invalid varint encoding")}__name(readLongVarint,"readLongVarint");Reader.prototype.bool=__name(function(){return this.uint32()!==0},"read_bool");function readFixed32_end(buf,end){return(buf[end-4]|buf[end-3]<<8|buf[end-2]<<16|buf[end-1]<<24)>>>0}__name(readFixed32_end,"readFixed32_end");Reader.prototype.fixed32=__name(function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},"read_fixed32");Reader.prototype.sfixed32=__name(function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0},"read_sfixed32");function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}__name(readFixed64,"readFixed64");Reader.prototype.float=__name(function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var value=util.float.readFloatLE(this.buf,this.pos);return this.pos+=4,value},"read_float");Reader.prototype.double=__name(function(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var value=util.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,value},"read_double");Reader.prototype.bytes=__name(function(){var length=this.uint32(),start=this.pos,end=this.pos+length;if(end>this.len)throw indexOutOfRange(this,length);if(this.pos+=length,Array.isArray(this.buf))return this.buf.slice(start,end);if(start===end){var nativeBuffer=util.Buffer;return nativeBuffer?nativeBuffer.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,start,end)},"read_bytes");Reader.prototype.string=__name(function(){var bytes=this.bytes();return utf8.read(bytes,0,bytes.length)},"read_string");Reader.prototype.skip=__name(function(length){if(typeof length=="number"){if(this.pos+length>this.len)throw indexOutOfRange(this,length);this.pos+=length}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this},"skip");Reader.prototype.skipType=function(wireType){switch(wireType){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(wireType=this.uint32()&7)!==4;)this.skipType(wireType);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+wireType+" at offset "+this.pos)}return this};Reader._configure=function(BufferReader_){BufferReader=BufferReader_,Reader.create=create(),BufferReader._configure();var fn=util.Long?"toLong":"toNumber";util.merge(Reader.prototype,{int64:__name(function(){return readLongVarint.call(this)[fn](!1)},"read_int64"),uint64:__name(function(){return readLongVarint.call(this)[fn](!0)},"read_uint64"),sint64:__name(function(){return readLongVarint.call(this).zzDecode()[fn](!1)},"read_sint64"),fixed64:__name(function(){return readFixed64.call(this)[fn](!0)},"read_fixed64"),sfixed64:__name(function(){return readFixed64.call(this)[fn](!1)},"read_sfixed64")})}}});var require_reader_buffer=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/reader_buffer.js"(exports2,module2){"use strict";module2.exports=BufferReader;var Reader=require_reader();(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util=require_minimal();function BufferReader(buffer){Reader.call(this,buffer)}__name(BufferReader,"BufferReader");BufferReader._configure=function(){util.Buffer&&(BufferReader.prototype._slice=util.Buffer.prototype.slice)};BufferReader.prototype.string=__name(function(){var len=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+len,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+len,this.len))},"read_string_buffer");BufferReader._configure()}});var require_service=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/rpc/service.js"(exports2,module2){"use strict";module2.exports=Service;var util=require_minimal();(Service.prototype=Object.create(util.EventEmitter.prototype)).constructor=Service;function Service(rpcImpl,requestDelimited,responseDelimited){if(typeof rpcImpl!="function")throw TypeError("rpcImpl must be a function");util.EventEmitter.call(this),this.rpcImpl=rpcImpl,this.requestDelimited=!!requestDelimited,this.responseDelimited=!!responseDelimited}__name(Service,"Service");Service.prototype.rpcCall=__name(function rpcCall(method,requestCtor,responseCtor,request,callback){if(!request)throw TypeError("request must be specified");var self2=this;if(!callback)return util.asPromise(rpcCall,self2,method,requestCtor,responseCtor,request);if(!self2.rpcImpl){setTimeout(function(){callback(Error("already ended"))},0);return}try{return self2.rpcImpl(method,requestCtor[self2.requestDelimited?"encodeDelimited":"encode"](request).finish(),__name(function(err,response){if(err)return self2.emit("error",err,method),callback(err);if(response===null){self2.end(!0);return}if(!(response instanceof responseCtor))try{response=responseCtor[self2.responseDelimited?"decodeDelimited":"decode"](response)}catch(err2){return self2.emit("error",err2,method),callback(err2)}return self2.emit("data",response,method),callback(null,response)},"rpcCallback"))}catch(err){self2.emit("error",err,method),setTimeout(function(){callback(err)},0);return}},"rpcCall");Service.prototype.end=__name(function(endedByRPC){return this.rpcImpl&&(endedByRPC||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},"end")}});var require_rpc=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/rpc.js"(exports2){"use strict";var rpc=exports2;rpc.Service=require_service()}});var require_roots=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/roots.js"(exports2,module2){"use strict";module2.exports={}}});var require_index_minimal=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/index-minimal.js"(exports2){"use strict";var protobuf=exports2;protobuf.build="minimal";protobuf.Writer=require_writer();protobuf.BufferWriter=require_writer_buffer();protobuf.Reader=require_reader();protobuf.BufferReader=require_reader_buffer();protobuf.util=require_minimal();protobuf.rpc=require_rpc();protobuf.roots=require_roots();protobuf.configure=configure;function configure(){protobuf.util._configure(),protobuf.Writer._configure(protobuf.BufferWriter),protobuf.Reader._configure(protobuf.BufferReader)}__name(configure,"configure");configure()}});var require_codegen=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@protobufjs/codegen/index.js"(exports2,module2){"use strict";module2.exports=codegen;function codegen(functionParams,functionName){typeof functionParams=="string"&&(functionName=functionParams,functionParams=void 0);var body=[];function Codegen(formatStringOrScope){if(typeof formatStringOrScope!="string"){var source=toString();if(codegen.verbose&&console.log("codegen: "+source),source="return "+source,formatStringOrScope){for(var scopeKeys=Object.keys(formatStringOrScope),scopeParams=new Array(scopeKeys.length+1),scopeValues=new Array(scopeKeys.length),scopeOffset=0;scopeOffset0&&parts[i-1]!==".."?parts.splice(--i,2):absolute?parts.splice(i,1):++i:parts[i]==="."?parts.splice(i,1):++i;return prefix+parts.join("/")},"normalize");path.resolve=__name(function(originPath,includePath,alreadyNormalized){return alreadyNormalized||(includePath=normalize(includePath)),isAbsolute(includePath)?includePath:(alreadyNormalized||(originPath=normalize(originPath)),(originPath=originPath.replace(/(?:\/|^)[^/]+$/,"")).length?normalize(originPath+"/"+includePath):includePath)},"resolve")}});var require_types=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/types.js"(exports2){"use strict";var types=exports2,util=require_util(),s=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function bake(values,offset){var i=0,o={};for(offset|=0;i-1&&this.oneof.splice(index,1),field.partOf=null,this},"remove");OneOf.prototype.onAdd=__name(function(parent){ReflectionObject.prototype.onAdd.call(this,parent);for(var self2=this,i=0;iid)return!0}return!1},"isReservedId");Namespace.isReservedName=__name(function(reserved,name){if(reserved){for(var i=0;i0;){var part=path.shift();if(ptr.nested&&ptr.nested[part]){if(ptr=ptr.nested[part],!(ptr instanceof Namespace))throw Error("path conflicts with non-namespace objects")}else ptr.add(ptr=new Namespace(part))}return json&&ptr.addJSON(json),ptr},"define");Namespace.prototype.resolveAll=__name(function(){for(var nested=this.nestedArray,i=0;i-1)return found}else if(found instanceof Namespace&&(found=found.lookup(path.slice(1),filterTypes,!0)))return found}else for(var i=0;i>>3){");for(var i=0;i>>3){")("case 1: k=r.%s(); break",field.keyType)("case 2:"),types.basic[type]===void 0?gen("value=types[%i].decode(r,r.uint32())",i):gen("value=r.%s()",type),gen("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),types.long[field.keyType]!==void 0?gen('%s[typeof k==="object"?util.longToHash(k):k]=value',ref):gen("%s[k]=value",ref)):field.repeated?(gen("if(!(%s&&%s.length))",ref,ref)("%s=[]",ref),types.packed[type]!==void 0&&gen("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos>>0",prop,prop);break;case"int32":case"sint32":case"sfixed32":gen("m%s=d%s|0",prop,prop);break;case"uint64":isUnsigned=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":gen("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",prop,prop,isUnsigned)('else if(typeof d%s==="string")',prop)("m%s=parseInt(d%s,10)",prop,prop)('else if(typeof d%s==="number")',prop)("m%s=d%s",prop,prop)('else if(typeof d%s==="object")',prop)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",prop,prop,prop,isUnsigned?"true":"");break;case"bytes":gen('if(typeof d%s==="string")',prop)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",prop,prop,prop)("else if(d%s.length >= 0)",prop)("m%s=d%s",prop,prop);break;case"string":gen("m%s=String(d%s)",prop,prop);break;case"bool":gen("m%s=Boolean(d%s)",prop,prop);break}}return gen}__name(genValuePartial_fromObject,"genValuePartial_fromObject");converter.fromObject=__name(function(mtype){var fields=mtype.fieldsArray,gen=util.codegen(["d"],mtype.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!fields.length)return gen("return new this.ctor");gen("var m=new this.ctor");for(var i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s",prop,prop,prop,prop,isUnsigned?"true":"",prop);break;case"bytes":gen("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",prop,prop,prop,prop,prop);break;default:gen("d%s=m%s",prop,prop);break}}return gen}__name(genValuePartial_toObject,"genValuePartial_toObject");converter.toObject=__name(function(mtype){var fields=mtype.fieldsArray.slice().sort(util.compareFieldsById);if(!fields.length)return util.codegen()("return {}");for(var gen=util.codegen(["m","o"],mtype.name+"$toObject")("if(!o)")("o={}")("var d={}"),repeatedFields=[],mapFields=[],normalFields=[],i=0;i-1){var altname=filename2.substring(idx);if(altname in common)return altname}return null}__name(getBundledFileName,"getBundledFileName");function process2(filename2,source){try{if(util.isString(source)&&source.charAt(0)==="{"&&(source=JSON.parse(source)),!util.isString(source))self2.setOptions(source.options).addJSON(source.nested);else{parse2.filename=filename2;var parsed=parse2(source,self2,options),resolved2,i2=0;if(parsed.imports)for(;i2-1)){if(self2.files.push(filename2),filename2 in common){sync?process2(filename2,common[filename2]):(++queued,setTimeout(function(){--queued,process2(filename2,common[filename2])}));return}if(sync){var source;try{source=util.fs.readFileSync(filename2).toString("utf8")}catch(err){weak||finish(err);return}process2(filename2,source)}else++queued,self2.fetch(filename2,function(err,source2){if(--queued,!!callback){if(err){weak?queued||finish(null,self2):finish(err);return}process2(filename2,source2)}})}}__name(fetch,"fetch");var queued=0;util.isString(filename)&&(filename=[filename]);for(var i=0,resolved;i-1&&this.deferred.splice(index,1)}}else if(object instanceof Enum)exposeRe.test(object.name)&&delete object.parent[object.name];else if(object instanceof Namespace){for(var i=0;i0)dst2[part]=setProp(dst2[part]||{},path2,value2);else{var prevValue=dst2[part];prevValue&&(value2=[].concat(prevValue).concat(value2)),dst2[part]=value2}return dst2}if(__name(setProp,"setProp"),typeof dst!="object")throw TypeError("dst must be an object");if(!path)throw TypeError("path must be specified");return path=path.split("."),setProp(dst,path,value)},"setProperty");Object.defineProperty(util,"decorateRoot",{get:function(){return roots.decorated||(roots.decorated=new(require_root()))}})}});var require_object=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/object.js"(exports2,module2){"use strict";module2.exports=ReflectionObject;ReflectionObject.className="ReflectionObject";var util=require_util(),Root;function ReflectionObject(name,options){if(!util.isString(name))throw TypeError("name must be a string");if(options&&!util.isObject(options))throw TypeError("options must be an object");this.options=options,this.parsedOptions=null,this.name=name,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}__name(ReflectionObject,"ReflectionObject");Object.defineProperties(ReflectionObject.prototype,{root:{get:function(){for(var ptr=this;ptr.parent!==null;)ptr=ptr.parent;return ptr}},fullName:{get:function(){for(var path=[this.name],ptr=this.parent;ptr;)path.unshift(ptr.name),ptr=ptr.parent;return path.join(".")}}});ReflectionObject.prototype.toJSON=__name(function(){throw Error()},"toJSON");ReflectionObject.prototype.onAdd=__name(function(parent){this.parent&&this.parent!==parent&&this.parent.remove(this),this.parent=parent,this.resolved=!1;var root=parent.root;root instanceof Root&&root._handleAdd(this)},"onAdd");ReflectionObject.prototype.onRemove=__name(function(parent){var root=parent.root;root instanceof Root&&root._handleRemove(this),this.parent=null,this.resolved=!1},"onRemove");ReflectionObject.prototype.resolve=__name(function(){return this.resolved?this:(this.root instanceof Root&&(this.resolved=!0),this)},"resolve");ReflectionObject.prototype.getOption=__name(function(name){if(this.options)return this.options[name]},"getOption");ReflectionObject.prototype.setOption=__name(function(name,value,ifNotSet){return(!ifNotSet||!this.options||this.options[name]===void 0)&&((this.options||(this.options={}))[name]=value),this},"setOption");ReflectionObject.prototype.setParsedOption=__name(function(name,value,propName){this.parsedOptions||(this.parsedOptions=[]);var parsedOptions=this.parsedOptions;if(propName){var opt=parsedOptions.find(function(opt2){return Object.prototype.hasOwnProperty.call(opt2,name)});if(opt){var newValue=opt[name];util.setProperty(newValue,propName,value)}else opt={},opt[name]=util.setProperty({},propName,value),parsedOptions.push(opt)}else{var newOpt={};newOpt[name]=value,parsedOptions.push(newOpt)}return this},"setParsedOption");ReflectionObject.prototype.setOptions=__name(function(options,ifNotSet){if(options)for(var keys=Object.keys(options),i=0;i>>0,(field.id<<3|4)>>>0):gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",fieldIndex,ref,(field.id<<3|2)>>>0)}__name(genTypePartial,"genTypePartial");function encoder(mtype){for(var gen=util.codegen(["m","w"],mtype.name+"$encode")("if(!w)")("w=Writer.create()"),i,ref,fields=mtype.fieldsArray.slice().sort(util.compareFieldsById),i=0;i>>0,8|types.mapKey[field.keyType],field.keyType),wireType===void 0?gen("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",index,ref):gen(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|wireType,type,ref),gen("}")("}")):field.repeated?(gen("if(%s!=null&&%s.length){",ref,ref),field.packed&&types.packed[type]!==void 0?gen("w.uint32(%i).fork()",(field.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",ref)("w.%s(%s[i])",type,ref)("w.ldelim()"):(gen("for(var i=0;i<%s.length;++i)",ref),wireType===void 0?genTypePartial(gen,field,index,ref+"[i]"):gen("w.uint32(%i).%s(%s[i])",(field.id<<3|wireType)>>>0,type,ref)),gen("}")):(field.optional&&gen("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",ref,field.name),wireType===void 0?genTypePartial(gen,field,index,ref):gen("w.uint32(%i).%s(%s)",(field.id<<3|wireType)>>>0,type,ref))}return gen("return w")}__name(encoder,"encoder")}});var require_index_light=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/index-light.js"(exports2,module2){"use strict";var protobuf=module2.exports=require_index_minimal();protobuf.build="light";function load(filename,root,callback){return typeof root=="function"?(callback=root,root=new protobuf.Root):root||(root=new protobuf.Root),root.load(filename,callback)}__name(load,"load");protobuf.load=load;function loadSync(filename,root){return root||(root=new protobuf.Root),root.loadSync(filename)}__name(loadSync,"loadSync");protobuf.loadSync=loadSync;protobuf.encoder=require_encoder();protobuf.decoder=require_decoder();protobuf.verifier=require_verifier();protobuf.converter=require_converter();protobuf.ReflectionObject=require_object();protobuf.Namespace=require_namespace();protobuf.Root=require_root();protobuf.Enum=require_enum();protobuf.Type=require_type();protobuf.Field=require_field();protobuf.OneOf=require_oneof();protobuf.MapField=require_mapfield();protobuf.Service=require_service2();protobuf.Method=require_method();protobuf.Message=require_message();protobuf.wrappers=require_wrappers();protobuf.types=require_types();protobuf.util=require_util();protobuf.ReflectionObject._configure(protobuf.Root);protobuf.Namespace._configure(protobuf.Type,protobuf.Service,protobuf.Enum);protobuf.Root._configure(protobuf.Type);protobuf.Field._configure(protobuf.Type)}});var require_tokenize=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/tokenize.js"(exports2,module2){"use strict";module2.exports=tokenize;var delimRe=/[\s{}=;:[\],'"()<>]/g,stringDoubleRe=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,stringSingleRe=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,setCommentRe=/^ *[*/]+ */,setCommentAltRe=/^\s*\*?\/*/,setCommentSplitRe=/\n/g,whitespaceRe=/\s/,unescapeRe=/\\(.?)/g,unescapeMap={0:"\0",r:"\r",n:` `,t:" "};function unescape2(str){return str.replace(unescapeRe,function($0,$1){switch($1){case"\\":case"":return $1;default:return unescapeMap[$1]||""}})}__name(unescape2,"unescape");tokenize.unescape=unescape2;function tokenize(source,alternateCommentMode){source=source.toString();var offset=0,length=source.length,line=1,lastCommentLine=0,comments={},stack=[],stringDelim=null;function illegal(subject){return Error("illegal "+subject+" (line "+line+")")}__name(illegal,"illegal");function readString(){var re=stringDelim==="'"?stringSingleRe:stringDoubleRe;re.lastIndex=offset-1;var match=re.exec(source);if(!match)throw illegal("string");return offset=re.lastIndex,push(stringDelim),stringDelim=null,unescape2(match[1])}__name(readString,"readString");function charAt(pos){return source.charAt(pos)}__name(charAt,"charAt");function setComment(start,end,isLeading){var comment={type:source.charAt(start++),lineEmpty:!1,leading:isLeading},lookback;alternateCommentMode?lookback=2:lookback=3;var commentOffset=start-lookback,c;do if(--commentOffset<0||(c=source.charAt(commentOffset))===` `){comment.lineEmpty=!0;break}while(c===" "||c===" ");for(var lines=source.substring(start,end).split(setCommentSplitRe),i=0;i0)return stack.shift();if(stringDelim)return readString();var repeat,prev,curr,start,isDoc,isLeadingComment=offset===0;do{if(offset===length)return null;for(repeat=!1;whitespaceRe.test(curr=charAt(offset));)if(curr===` `&&(isLeadingComment=!0,++line),++offset===length)return null;if(charAt(offset)==="/"){if(++offset===length)throw illegal("comment");if(charAt(offset)==="/")if(alternateCommentMode){if(start=offset,isDoc=!1,isDoubleSlashCommentLine(offset-1)){isDoc=!0;do if(offset=findEndOfLine(offset),offset===length||(offset++,!isLeadingComment))break;while(isDoubleSlashCommentLine(offset))}else offset=Math.min(length,findEndOfLine(offset)+1);isDoc&&(setComment(start,offset,isLeadingComment),isLeadingComment=!0),line++,repeat=!0}else{for(isDoc=charAt(start=offset+1)==="/";charAt(++offset)!==` `;)if(offset===length)return null;++offset,isDoc&&(setComment(start,offset-1,isLeadingComment),isLeadingComment=!0),++line,repeat=!0}else if((curr=charAt(offset))==="*"){start=offset+1,isDoc=alternateCommentMode||charAt(start)==="*";do{if(curr===` `&&++line,++offset===length)throw illegal("comment");prev=curr,curr=charAt(offset)}while(prev!=="*"||curr!=="/");++offset,isDoc&&(setComment(start,offset-2,isLeadingComment),isLeadingComment=!0),repeat=!0}else return"/"}}while(repeat);var end=offset;delimRe.lastIndex=0;var delim=delimRe.test(charAt(end++));if(!delim)for(;end");var name=next();if(!nameRe.test(name))throw illegal(name,"name");skip("=");var field=new MapField(applyCase(name),parseId(next()),keyType,valueType);ifBlock(field,__name(function(token2){if(token2==="option")parseOption(field,token2),skip(";");else throw illegal(token2)},"parseMapField_block"),__name(function(){parseInlineOptions(field)},"parseMapField_line")),parent.add(field)}__name(parseMapField,"parseMapField");function parseOneOf(parent,token2){if(!nameRe.test(token2=next()))throw illegal(token2,"name");var oneof=new OneOf(applyCase(token2));ifBlock(oneof,__name(function(token3){token3==="option"?(parseOption(oneof,token3),skip(";")):(push(token3),parseField(oneof,"optional"))},"parseOneOf_block")),parent.add(oneof)}__name(parseOneOf,"parseOneOf");function parseEnum(parent,token2){if(!nameRe.test(token2=next()))throw illegal(token2,"name");var enm=new Enum(token2);ifBlock(enm,__name(function(token3){switch(token3){case"option":parseOption(enm,token3),skip(";");break;case"reserved":readRanges(enm.reserved||(enm.reserved=[]),!0);break;default:parseEnumValue(enm,token3)}},"parseEnum_block")),parent.add(enm)}__name(parseEnum,"parseEnum");function parseEnumValue(parent,token2){if(!nameRe.test(token2))throw illegal(token2,"name");skip("=");var value=parseId(next(),!0),dummy={options:void 0};dummy.setOption=function(name,value2){this.options===void 0&&(this.options={}),this.options[name]=value2},ifBlock(dummy,__name(function(token3){if(token3==="option")parseOption(dummy,token3),skip(";");else throw illegal(token3)},"parseEnumValue_block"),__name(function(){parseInlineOptions(dummy)},"parseEnumValue_line")),parent.add(token2,value,dummy.comment,dummy.options)}__name(parseEnumValue,"parseEnumValue");function parseOption(parent,token2){var isCustom=skip("(",!0);if(!typeRefRe.test(token2=next()))throw illegal(token2,"name");var name=token2,option=name,propName;isCustom&&(skip(")"),name="("+name+")",option=name,token2=peek(),fqTypeRefRe.test(token2)&&(propName=token2.slice(1),name+=token2,next())),skip("=");var optionValue=parseOptionValue(parent,name);setParsedOption(parent,option,optionValue,propName)}__name(parseOption,"parseOption");function parseOptionValue(parent,name){if(skip("{",!0)){for(var objectResult={};!skip("}",!0);){if(!nameRe.test(token=next()))throw illegal(token,"name");if(token===null)throw illegal(token,"end of input");var value,propName=token;if(skip(":",!0),peek()==="{")value=parseOptionValue(parent,name+"."+token);else if(peek()==="["){value=[];var lastValue;if(skip("[",!0)){do lastValue=readValue(!0),value.push(lastValue);while(skip(",",!0));skip("]"),typeof lastValue<"u"&&setOption(parent,name+"."+token,lastValue)}}else value=readValue(!0),setOption(parent,name+"."+token,value);var prevValue=objectResult[propName];prevValue&&(value=[].concat(prevValue).concat(value)),objectResult[propName]=value,skip(",",!0),skip(";",!0)}return objectResult}var simpleValue=readValue(!0);return setOption(parent,name,simpleValue),simpleValue}__name(parseOptionValue,"parseOptionValue");function setOption(parent,name,value){parent.setOption&&parent.setOption(name,value)}__name(setOption,"setOption");function setParsedOption(parent,name,value,propName){parent.setParsedOption&&parent.setParsedOption(name,value,propName)}__name(setParsedOption,"setParsedOption");function parseInlineOptions(parent){if(skip("[",!0)){do parseOption(parent,"option");while(skip(",",!0));skip("]")}return parent}__name(parseInlineOptions,"parseInlineOptions");function parseService(parent,token2){if(!nameRe.test(token2=next()))throw illegal(token2,"service name");var service=new Service(token2);ifBlock(service,__name(function(token3){if(!parseCommon(service,token3))if(token3==="rpc")parseMethod(service,token3);else throw illegal(token3)},"parseService_block")),parent.add(service)}__name(parseService,"parseService");function parseMethod(parent,token2){var commentText=cmnt(),type=token2;if(!nameRe.test(token2=next()))throw illegal(token2,"name");var name=token2,requestType,requestStream,responseType,responseStream;if(skip("("),skip("stream",!0)&&(requestStream=!0),!typeRefRe.test(token2=next())||(requestType=token2,skip(")"),skip("returns"),skip("("),skip("stream",!0)&&(responseStream=!0),!typeRefRe.test(token2=next())))throw illegal(token2);responseType=token2,skip(")");var method=new Method(name,type,requestType,responseType,requestStream,responseStream);method.comment=commentText,ifBlock(method,__name(function(token3){if(token3==="option")parseOption(method,token3),skip(";");else throw illegal(token3)},"parseMethod_block")),parent.add(method)}__name(parseMethod,"parseMethod");function parseExtension(parent,token2){if(!typeRefRe.test(token2=next()))throw illegal(token2,"reference");var reference=token2;ifBlock(null,__name(function(token3){switch(token3){case"required":case"repeated":parseField(parent,token3,reference);break;case"optional":isProto3?parseField(parent,"proto3_optional",reference):parseField(parent,"optional",reference);break;default:if(!isProto3||!typeRefRe.test(token3))throw illegal(token3);push(token3),parseField(parent,"optional",reference);break}},"parseExtension_block"))}__name(parseExtension,"parseExtension");for(var token;(token=next())!==null;)switch(token){case"package":if(!head)throw illegal(token);parsePackage();break;case"import":if(!head)throw illegal(token);parseImport();break;case"syntax":if(!head)throw illegal(token);parseSyntax();break;case"option":parseOption(ptr,token),skip(";");break;default:if(parseCommon(ptr,token)){head=!1;continue}throw illegal(token)}return parse2.filename=null,{package:pkg,imports,weakImports,syntax,root}}__name(parse2,"parse")}});var require_common=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/common.js"(exports2,module2){"use strict";module2.exports=common;var commonRe=/\/|\./;function common(name,json){commonRe.test(name)||(name="google/protobuf/"+name+".proto",json={nested:{google:{nested:{protobuf:{nested:json}}}}}),common[name]=json}__name(common,"common");common("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var timeType;common("duration",{Duration:timeType={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});common("timestamp",{Timestamp:timeType});common("empty",{Empty:{fields:{}}});common("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}}}});common("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}}}});common("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});common.get=__name(function(file){return common[file]||null},"get")}});var require_src=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/src/index.js"(exports2,module2){"use strict";var protobuf=module2.exports=require_index_light();protobuf.build="full";protobuf.tokenize=require_tokenize();protobuf.parse=require_parse();protobuf.common=require_common();protobuf.Root._configure(protobuf.Type,protobuf.parse,protobuf.common)}});var require_protobufjs=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/index.js"(exports2,module2){"use strict";module2.exports=require_src()}});var require_featureDetection=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/featureDetection.js"(exports2){"use strict";var _a;Object.defineProperty(exports2,"__esModule",{value:!0});exports2.hasAbortController=exports2.isNodeJS=exports2.hasWindowFetch=void 0;var features={windowFetch:typeof window<"u"&&window?.fetch&&typeof window?.fetch=="function",textEncoder:typeof TextEncoder<"u",textDecoder:typeof TextDecoder<"u",nodeJS:typeof process<"u"&&((_a=process==null?void 0:process.versions)===null||_a===void 0?void 0:_a.node),abortController:typeof AbortController<"u"};function hasWindowFetch(){return features.windowFetch}__name(hasWindowFetch,"hasWindowFetch");exports2.hasWindowFetch=hasWindowFetch;function isNodeJS(){return features.nodeJS}__name(isNodeJS,"isNodeJS");exports2.isNodeJS=isNodeJS;function hasAbortController(){return features.abortController}__name(hasAbortController,"hasAbortController");exports2.hasAbortController=hasAbortController}});var require_warnings=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/warnings.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.warn=void 0;var featureDetection_1=require_featureDetection(),emittedWarnings=new Set;function warn(code,message,warnType){emittedWarnings.has(code)||(emittedWarnings.add(code),(0,featureDetection_1.isNodeJS)()?typeof warnType<"u"?process.emitWarning(message,{type:warnType}):process.emitWarning(message):console.warn(message))}__name(warn,"warn");exports2.warn=warn}});function rng(){return poolPtr>rnds8Pool.length-16&&(import_crypto.default.randomFillSync(rnds8Pool),poolPtr=0),rnds8Pool.slice(poolPtr,poolPtr+=16)}var import_crypto,rnds8Pool,poolPtr,init_rng=__esm({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/uuid/dist/esm-node/rng.js"(){import_crypto=__toESM(require("crypto")),rnds8Pool=new Uint8Array(256),poolPtr=rnds8Pool.length;__name(rng,"rng")}});var regex_default,init_regex=__esm({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/uuid/dist/esm-node/regex.js"(){regex_default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i}});function validate(uuid){return typeof uuid=="string"&®ex_default.test(uuid)}var validate_default,init_validate=__esm({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/uuid/dist/esm-node/validate.js"(){init_regex();__name(validate,"validate");validate_default=validate}});function unsafeStringify(arr,offset=0){return byteToHex[arr[offset+0]]+byteToHex[arr[offset+1]]+byteToHex[arr[offset+2]]+byteToHex[arr[offset+3]]+"-"+byteToHex[arr[offset+4]]+byteToHex[arr[offset+5]]+"-"+byteToHex[arr[offset+6]]+byteToHex[arr[offset+7]]+"-"+byteToHex[arr[offset+8]]+byteToHex[arr[offset+9]]+"-"+byteToHex[arr[offset+10]]+byteToHex[arr[offset+11]]+byteToHex[arr[offset+12]]+byteToHex[arr[offset+13]]+byteToHex[arr[offset+14]]+byteToHex[arr[offset+15]]}function stringify(arr,offset=0){let uuid=unsafeStringify(arr,offset);if(!validate_default(uuid))throw TypeError("Stringified UUID is invalid");return uuid}var byteToHex,stringify_default,init_stringify=__esm({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/uuid/dist/esm-node/stringify.js"(){init_validate();byteToHex=[];for(let i=0;i<256;++i)byteToHex.push((i+256).toString(16).slice(1));__name(unsafeStringify,"unsafeStringify");__name(stringify,"stringify");stringify_default=stringify}});function v1(options,buf,offset){let i=buf&&offset||0,b=buf||new Array(16);options=options||{};let node=options.node||_nodeId,clockseq=options.clockseq!==void 0?options.clockseq:_clockseq;if(node==null||clockseq==null){let seedBytes=options.random||(options.rng||rng)();node==null&&(node=_nodeId=[seedBytes[0]|1,seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]]),clockseq==null&&(clockseq=_clockseq=(seedBytes[6]<<8|seedBytes[7])&16383)}let msecs=options.msecs!==void 0?options.msecs:Date.now(),nsecs=options.nsecs!==void 0?options.nsecs:_lastNSecs+1,dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&options.clockseq===void 0&&(clockseq=clockseq+1&16383),(dt<0||msecs>_lastMSecs)&&options.nsecs===void 0&&(nsecs=0),nsecs>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=msecs,_lastNSecs=nsecs,_clockseq=clockseq,msecs+=122192928e5;let tl=((msecs&268435455)*1e4+nsecs)%4294967296;b[i++]=tl>>>24&255,b[i++]=tl>>>16&255,b[i++]=tl>>>8&255,b[i++]=tl&255;let tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255,b[i++]=tmh&255,b[i++]=tmh>>>24&15|16,b[i++]=tmh>>>16&255,b[i++]=clockseq>>>8|128,b[i++]=clockseq&255;for(let n=0;n<6;++n)b[i+n]=node[n];return buf||unsafeStringify(b)}var _nodeId,_clockseq,_lastMSecs,_lastNSecs,v1_default,init_v1=__esm({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/uuid/dist/esm-node/v1.js"(){init_rng();init_stringify();_lastMSecs=0,_lastNSecs=0;__name(v1,"v1");v1_default=v1}});function parse(uuid){if(!validate_default(uuid))throw TypeError("Invalid UUID");let v,arr=new Uint8Array(16);return arr[0]=(v=parseInt(uuid.slice(0,8),16))>>>24,arr[1]=v>>>16&255,arr[2]=v>>>8&255,arr[3]=v&255,arr[4]=(v=parseInt(uuid.slice(9,13),16))>>>8,arr[5]=v&255,arr[6]=(v=parseInt(uuid.slice(14,18),16))>>>8,arr[7]=v&255,arr[8]=(v=parseInt(uuid.slice(19,23),16))>>>8,arr[9]=v&255,arr[10]=(v=parseInt(uuid.slice(24,36),16))/1099511627776&255,arr[11]=v/4294967296&255,arr[12]=v>>>24&255,arr[13]=v>>>16&255,arr[14]=v>>>8&255,arr[15]=v&255,arr}var parse_default,init_parse=__esm({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/uuid/dist/esm-node/parse.js"(){init_validate();__name(parse,"parse");parse_default=parse}});function stringToBytes(str){str=unescape(encodeURIComponent(str));let bytes=[];for(let i=0;inil_default,parse:()=>parse_default,stringify:()=>stringify_default,v1:()=>v1_default,v3:()=>v3_default,v4:()=>v4_default,v5:()=>v5_default,validate:()=>validate_default,version:()=>version_default});var init_esm_node=__esm({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/uuid/dist/esm-node/index.js"(){init_v1();init_v3();init_v4();init_v5();init_nil();init_version();init_validate();init_stringify();init_parse()}});var require_util2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/util.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.makeUUID=exports2.toLowerCamelCase=exports2.toCamelCase=exports2.camelToSnakeCase=void 0;var uuid_1=(init_esm_node(),__toCommonJS(esm_node_exports));function words(str,normalize=!1){return normalize&&(str=str.replace(/([A-Z])([A-Z]+)([A-Z])/g,str2=>str2[0]+str2.slice(1,str2.length-1).toLowerCase()+str2[str2.length-1])),str.split(/(?=[A-Z])|[^A-Za-z0-9.]+/).filter(w=>w.length>0).map((w,index)=>index===0?w:w.toLowerCase())}__name(words,"words");function lowercase(str){return str.length===0?str:str[0].toLowerCase()+str.slice(1)}__name(lowercase,"lowercase");function camelToSnakeCase(str){let wordsList=words(str);if(wordsList.length===0)return str;let result=[wordsList[0]];return result.push(...wordsList.slice(1).map(lowercase)),result.join("_")}__name(camelToSnakeCase,"camelToSnakeCase");exports2.camelToSnakeCase=camelToSnakeCase;function capitalize(str){return str.length===0?str:str[0].toUpperCase()+str.slice(1)}__name(capitalize,"capitalize");function toCamelCase(str){let wordsList=words(str,!0);if(wordsList.length===0)return str;let result=[wordsList[0]];return result.push(...wordsList.slice(1).map(w=>w.match(/^\d+$/)?"_"+w:capitalize(w))),result.join("")}__name(toCamelCase,"toCamelCase");exports2.toCamelCase=toCamelCase;function toLowerCamelCase(str){let camelCase=toCamelCase(str);return camelCase.length===0?camelCase:camelCase[0].toLowerCase()+camelCase.slice(1)}__name(toLowerCamelCase,"toLowerCamelCase");exports2.toLowerCamelCase=toLowerCamelCase;function makeUUID(){return(0,uuid_1.v4)()}__name(makeUUID,"makeUUID");exports2.makeUUID=makeUUID}});var require_status=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/status.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.rpcCodeFromHttpStatusCode=exports2.HttpCodeToRpcCodeMap=exports2.Status=void 0;var Status;(function(Status2){Status2[Status2.OK=0]="OK",Status2[Status2.CANCELLED=1]="CANCELLED",Status2[Status2.UNKNOWN=2]="UNKNOWN",Status2[Status2.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Status2[Status2.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Status2[Status2.NOT_FOUND=5]="NOT_FOUND",Status2[Status2.ALREADY_EXISTS=6]="ALREADY_EXISTS",Status2[Status2.PERMISSION_DENIED=7]="PERMISSION_DENIED",Status2[Status2.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Status2[Status2.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Status2[Status2.ABORTED=10]="ABORTED",Status2[Status2.OUT_OF_RANGE=11]="OUT_OF_RANGE",Status2[Status2.UNIMPLEMENTED=12]="UNIMPLEMENTED",Status2[Status2.INTERNAL=13]="INTERNAL",Status2[Status2.UNAVAILABLE=14]="UNAVAILABLE",Status2[Status2.DATA_LOSS=15]="DATA_LOSS",Status2[Status2.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(Status||(exports2.Status=Status={}));exports2.HttpCodeToRpcCodeMap=new Map([[400,Status.INVALID_ARGUMENT],[401,Status.UNAUTHENTICATED],[403,Status.PERMISSION_DENIED],[404,Status.NOT_FOUND],[409,Status.ABORTED],[416,Status.OUT_OF_RANGE],[429,Status.RESOURCE_EXHAUSTED],[499,Status.CANCELLED],[501,Status.UNIMPLEMENTED],[503,Status.UNAVAILABLE],[504,Status.DEADLINE_EXCEEDED]]);function rpcCodeFromHttpStatusCode(httpStatusCode){return exports2.HttpCodeToRpcCodeMap.has(httpStatusCode)?exports2.HttpCodeToRpcCodeMap.get(httpStatusCode):httpStatusCode>=200&&httpStatusCode<300?Status.OK:httpStatusCode>=400&&httpStatusCode<500?Status.FAILED_PRECONDITION:httpStatusCode>=500&&httpStatusCode<600?Status.INTERNAL:Status.UNKNOWN}__name(rpcCodeFromHttpStatusCode,"rpcCodeFromHttpStatusCode");exports2.rpcCodeFromHttpStatusCode=rpcCodeFromHttpStatusCode}});var require_gax=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/gax.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.createByteLengthFunction=exports2.constructSettings=exports2.createBundleOptions=exports2.createMaxRetriesBackoffSettings=exports2.createDefaultBackoffSettings=exports2.createBackoffSettings=exports2.createRetryOptions=exports2.convertRetryOptions=exports2.CallSettings=exports2.RetryOptions=void 0;var warnings_1=require_warnings(),util_1=require_util2(),status_1=require_status(),RetryOptions=class{constructor(retryCodes,backoffSettings,shouldRetryFn,getResumptionRequestFn){this.retryCodes=retryCodes,this.backoffSettings=backoffSettings,this.shouldRetryFn=shouldRetryFn,this.getResumptionRequestFn=getResumptionRequestFn}};__name(RetryOptions,"RetryOptions");exports2.RetryOptions=RetryOptions;var CallSettings=class{constructor(settings){var _a;settings=settings||{},this.timeout=settings.timeout||30*1e3,this.retry=settings.retry,this.autoPaginate="autoPaginate"in settings?settings.autoPaginate:!0,this.maxResults=settings.maxResults,this.otherArgs=settings.otherArgs||{},this.bundleOptions=settings.bundleOptions,this.isBundling="isBundling"in settings?settings.isBundling:!0,this.longrunning="longrunning"in settings?settings.longrunning:void 0,this.apiName=(_a=settings.apiName)!==null&&_a!==void 0?_a:void 0,this.retryRequestOptions=settings.retryRequestOptions}merge(options){if(!options)return new CallSettings(this);let timeout=this.timeout,retry=this.retry,autoPaginate=this.autoPaginate,maxResults=this.maxResults,otherArgs=this.otherArgs,isBundling=this.isBundling,longrunning=this.longrunning,apiName=this.apiName,retryRequestOptions=this.retryRequestOptions;if("timeout"in options&&(timeout=options.timeout),retry?.retryCodes&&(retry.backoffSettings.initialRpcTimeoutMillis=timeout,retry.backoffSettings.maxRpcTimeoutMillis=timeout,retry.backoffSettings.totalTimeoutMillis=timeout),"retry"in options&&(retry=mergeRetryOptions(retry||{},options.retry)),"autoPaginate"in options&&!options.autoPaginate&&(autoPaginate=!1),"maxResults"in options&&(maxResults=options.maxResults),"otherArgs"in options){otherArgs={};for(let key in this.otherArgs)otherArgs[key]=this.otherArgs[key];for(let optionsKey in options.otherArgs)otherArgs[optionsKey]=options.otherArgs[optionsKey]}return"isBundling"in options&&(isBundling=options.isBundling),"maxRetries"in options&&options.maxRetries!==void 0&&(retry.backoffSettings.maxRetries=options.maxRetries,delete retry.backoffSettings.totalTimeoutMillis),"longrunning"in options&&(longrunning=options.longrunning),"apiName"in options&&(apiName=options.apiName),"retryRequestOptions"in options&&(retryRequestOptions=options.retryRequestOptions),new CallSettings({timeout,retry,bundleOptions:this.bundleOptions,longrunning,autoPaginate,maxResults,otherArgs,isBundling,apiName,retryRequestOptions})}};__name(CallSettings,"CallSettings");exports2.CallSettings=CallSettings;function convertRetryOptions(options,gaxStreamingRetries){var _a,_b,_c,_d;if(!options||!gaxStreamingRetries)return options;if(options.retry&&options.retryRequestOptions)throw new Error("Only one of retry or retryRequestOptions may be set");if(options.retryRequestOptions){options.retryRequestOptions.objectMode!==void 0&&(0,warnings_1.warn)("retry_request_options","objectMode override is not supported. It is set to true internally by default in gax.","UnsupportedParameterWarning"),options.retryRequestOptions.noResponseRetries!==void 0&&(0,warnings_1.warn)("retry_request_options","noResponseRetries override is not supported. Please specify retry codes or a function to determine retry eligibility.","UnsupportedParameterWarning"),options.retryRequestOptions.currentRetryAttempt!==void 0&&(0,warnings_1.warn)("retry_request_options","currentRetryAttempt override is not supported. Retry attempts are tracked internally.","UnsupportedParameterWarning");let retryCodes=[status_1.Status.UNAVAILABLE],shouldRetryFn;options.retryRequestOptions.shouldRetryFn&&(retryCodes=[],shouldRetryFn=options.retryRequestOptions.shouldRetryFn),options.maxRetries=(_b=(_a=options?.retryRequestOptions)===null||_a===void 0?void 0:_a.retries)!==null&&_b!==void 0?_b:options.maxRetries;let backoffSettings=createDefaultBackoffSettings(),maxRetryDelayMillis,totalTimeoutMillis;options.retryRequestOptions.maxRetryDelay!==void 0&&(maxRetryDelayMillis=options.retryRequestOptions.maxRetryDelay*1e3);let retryDelayMultiplier=(_d=(_c=options?.retryRequestOptions)===null||_c===void 0?void 0:_c.retryDelayMultiplier)!==null&&_d!==void 0?_d:backoffSettings.retryDelayMultiplier;options.retryRequestOptions.totalTimeout!==void 0&&(totalTimeoutMillis=options.retryRequestOptions.totalTimeout*1e3),backoffSettings.maxRetryDelayMillis=maxRetryDelayMillis??backoffSettings.maxRetryDelayMillis,backoffSettings.retryDelayMultiplier=retryDelayMultiplier??backoffSettings.retryDelayMultiplier,backoffSettings.totalTimeoutMillis=totalTimeoutMillis??backoffSettings.totalTimeoutMillis;let convertedRetryOptions=createRetryOptions(retryCodes,backoffSettings,shouldRetryFn);options.retry=convertedRetryOptions,delete options.retryRequestOptions,(0,warnings_1.warn)("retry_request_options","retryRequestOptions will be deprecated in a future release. Please use retryOptions to pass retry options at call time","DeprecationWarning")}return options}__name(convertRetryOptions,"convertRetryOptions");exports2.convertRetryOptions=convertRetryOptions;function createRetryOptions(retryCodes,backoffSettings,shouldRetryFn,getResumptionRequestFn){return{retryCodes,backoffSettings,shouldRetryFn,getResumptionRequestFn}}__name(createRetryOptions,"createRetryOptions");exports2.createRetryOptions=createRetryOptions;function createBackoffSettings(initialRetryDelayMillis,retryDelayMultiplier,maxRetryDelayMillis,initialRpcTimeoutMillis,rpcTimeoutMultiplier,maxRpcTimeoutMillis,totalTimeoutMillis){return{initialRetryDelayMillis,retryDelayMultiplier,maxRetryDelayMillis,initialRpcTimeoutMillis,rpcTimeoutMultiplier,maxRpcTimeoutMillis,totalTimeoutMillis}}__name(createBackoffSettings,"createBackoffSettings");exports2.createBackoffSettings=createBackoffSettings;function createDefaultBackoffSettings(){return createBackoffSettings(100,1.3,6e4,null,null,null,null)}__name(createDefaultBackoffSettings,"createDefaultBackoffSettings");exports2.createDefaultBackoffSettings=createDefaultBackoffSettings;function createMaxRetriesBackoffSettings(initialRetryDelayMillis,retryDelayMultiplier,maxRetryDelayMillis,initialRpcTimeoutMillis,rpcTimeoutMultiplier,maxRpcTimeoutMillis,maxRetries){return{initialRetryDelayMillis,retryDelayMultiplier,maxRetryDelayMillis,initialRpcTimeoutMillis,rpcTimeoutMultiplier,maxRpcTimeoutMillis,maxRetries}}__name(createMaxRetriesBackoffSettings,"createMaxRetriesBackoffSettings");exports2.createMaxRetriesBackoffSettings=createMaxRetriesBackoffSettings;function createBundleOptions(options){["element_count_threshold","element_count_limit","request_byte_threshold","request_byte_limit","delay_threshold_millis"].forEach(param=>{if(param in options&&typeof options[param]!="number")throw new Error(`${param} should be a number`)});let elementCountThreshold=options.element_count_threshold||0,elementCountLimit=options.element_count_limit||0,requestByteThreshold=options.request_byte_threshold||0,requestByteLimit=options.request_byte_limit||0,delayThreshold=options.delay_threshold_millis||0;if(elementCountThreshold===0&&requestByteThreshold===0&&delayThreshold===0)throw new Error("one threshold should be > 0");return{elementCountThreshold,elementCountLimit,requestByteThreshold,requestByteLimit,delayThreshold}}__name(createBundleOptions,"createBundleOptions");exports2.createBundleOptions=createBundleOptions;function constructRetry(methodConfig,retryCodes,retryParams,retryNames){if(!methodConfig)return null;let codes=null;if(retryCodes&&"retry_codes_name"in methodConfig){let retryCodesName=methodConfig.retry_codes_name;codes=(retryCodes[retryCodesName]||[]).map(name=>Number(retryNames[name]))}let backoffSettings=null;if(retryParams&&"retry_params_name"in methodConfig){let params=retryParams[methodConfig.retry_params_name];backoffSettings=createBackoffSettings(params.initial_retry_delay_millis,params.retry_delay_multiplier,params.max_retry_delay_millis,params.initial_rpc_timeout_millis,params.rpc_timeout_multiplier,params.max_rpc_timeout_millis,params.total_timeout_millis)}return createRetryOptions(codes,backoffSettings)}__name(constructRetry,"constructRetry");function mergeRetryOptions(retry,overrides){if(!overrides)return null;if(!overrides.retryCodes&&!overrides.backoffSettings&&!overrides.shouldRetryFn&&!overrides.getResumptionRequestFn)return retry;let retryCodes=overrides.retryCodes?overrides.retryCodes:retry.retryCodes,backoffSettings=overrides.backoffSettings?overrides.backoffSettings:retry.backoffSettings,shouldRetryFn=overrides.shouldRetryFn?overrides.shouldRetryFn:retry.shouldRetryFn,getResumptionRequestFn=overrides.getResumptionRequestFn?overrides.getResumptionRequestFn:retry.getResumptionRequestFn;return createRetryOptions(retryCodes,backoffSettings,shouldRetryFn,getResumptionRequestFn)}__name(mergeRetryOptions,"mergeRetryOptions");function constructSettings(serviceName,clientConfig,configOverrides,retryNames,otherArgs){otherArgs=otherArgs||{};let defaults={},serviceConfig=(clientConfig.interfaces||{})[serviceName];if(!serviceConfig)return null;let overrides=(configOverrides.interfaces||{})[serviceName]||{},methods=serviceConfig.methods,overridingMethods=overrides.methods||{};for(let methodName in methods){let methodConfig=methods[methodName],jsName=(0,util_1.toLowerCamelCase)(methodName),retry=constructRetry(methodConfig,serviceConfig.retry_codes,serviceConfig.retry_params,retryNames),bundlingConfig=methodConfig.bundling,timeout=methodConfig.timeout_millis;if(methodName in overridingMethods){let overridingMethod=overridingMethods[methodName];overridingMethod&&("bundling"in overridingMethod&&(bundlingConfig=overridingMethod.bundling),"timeout_millis"in overridingMethod&&(timeout=overridingMethod.timeout_millis)),retry=mergeRetryOptions(retry,constructRetry(overridingMethod,overrides.retry_codes,overrides.retry_params,retryNames))}let apiName=serviceName;defaults[jsName]=new CallSettings({timeout,retry,bundleOptions:bundlingConfig?createBundleOptions(bundlingConfig):null,otherArgs,apiName})}return defaults}__name(constructSettings,"constructSettings");exports2.constructSettings=constructSettings;function createByteLengthFunction(message){return __name(function(obj){try{return message.encode(obj).finish().length}catch(err){let stringified=JSON.stringify(obj);return(0,warnings_1.warn)("error_encoding_protobufjs_object",`Cannot encode protobuf.js object: ${stringified}: ${err}`),stringified.length}},"getByteLength")}__name(createByteLengthFunction,"createByteLengthFunction");exports2.createByteLengthFunction=createByteLengthFunction}});var require_routingHeader=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/routingHeader.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.fromParams=void 0;var querystring=require("querystring");function fromParams(params){return querystring.stringify(params)}__name(fromParams,"fromParams");exports2.fromParams=fromParams}});var require_extend=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/extend/index.js"(exports2,module2){"use strict";var hasOwn=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,defineProperty=Object.defineProperty,gOPD=Object.getOwnPropertyDescriptor,isArray=__name(function(arr){return typeof Array.isArray=="function"?Array.isArray(arr):toStr.call(arr)==="[object Array]"},"isArray"),isPlainObject=__name(function(obj){if(!obj||toStr.call(obj)!=="[object Object]")return!1;var hasOwnConstructor=hasOwn.call(obj,"constructor"),hasIsPrototypeOf=obj.constructor&&obj.constructor.prototype&&hasOwn.call(obj.constructor.prototype,"isPrototypeOf");if(obj.constructor&&!hasOwnConstructor&&!hasIsPrototypeOf)return!1;var key;for(key in obj);return typeof key>"u"||hasOwn.call(obj,key)},"isPlainObject"),setProperty=__name(function(target,options){defineProperty&&options.name==="__proto__"?defineProperty(target,options.name,{enumerable:!0,configurable:!0,value:options.newValue,writable:!0}):target[options.name]=options.newValue},"setProperty"),getProperty=__name(function(obj,name){if(name==="__proto__")if(hasOwn.call(obj,name)){if(gOPD)return gOPD(obj,name).value}else return;return obj[name]},"getProperty");module2.exports=__name(function extend(){var options,name,src,copy,copyIsArray,clone,target=arguments[0],i=1,length=arguments.length,deep=!1;for(typeof target=="boolean"&&(deep=target,target=arguments[1]||{},i=2),(target==null||typeof target!="object"&&typeof target!="function")&&(target={});iupperBound)throw new TypeError("Argument is not in byte range");return x}if(!isNaN(x)&&opts.clamp)return x=evenRound(x),xupperBound&&(x=upperBound),x;if(!Number.isFinite(x)||x===0)return 0;if(x=sign(x)*Math.floor(Math.abs(x)),x=x%moduloVal,!typeOpts.unsigned&&x>=moduloBound)return x-moduloVal;if(typeOpts.unsigned){if(x<0)x+=moduloVal;else if(x===-0)return 0}return x}}__name(createNumberConversion,"createNumberConversion");conversions.void=function(){};conversions.boolean=function(val){return!!val};conversions.byte=createNumberConversion(8,{unsigned:!1});conversions.octet=createNumberConversion(8,{unsigned:!0});conversions.short=createNumberConversion(16,{unsigned:!1});conversions["unsigned short"]=createNumberConversion(16,{unsigned:!0});conversions.long=createNumberConversion(32,{unsigned:!1});conversions["unsigned long"]=createNumberConversion(32,{unsigned:!0});conversions["long long"]=createNumberConversion(32,{unsigned:!1,moduloBitLength:64});conversions["unsigned long long"]=createNumberConversion(32,{unsigned:!0,moduloBitLength:64});conversions.double=function(V){let x=+V;if(!Number.isFinite(x))throw new TypeError("Argument is not a finite floating-point value");return x};conversions["unrestricted double"]=function(V){let x=+V;if(isNaN(x))throw new TypeError("Argument is NaN");return x};conversions.float=conversions.double;conversions["unrestricted float"]=conversions["unrestricted double"];conversions.DOMString=function(V,opts){return opts||(opts={}),opts.treatNullAsEmptyString&&V===null?"":String(V)};conversions.ByteString=function(V,opts){let x=String(V),c;for(let i=0;(c=x.codePointAt(i))!==void 0;++i)if(c>255)throw new TypeError("Argument is not a valid bytestring");return x};conversions.USVString=function(V){let S=String(V),n=S.length,U=[];for(let i=0;i57343)U.push(String.fromCodePoint(c));else if(56320<=c&&c<=57343)U.push(String.fromCodePoint(65533));else if(i===n-1)U.push(String.fromCodePoint(65533));else{let d=S.charCodeAt(i+1);if(56320<=d&&d<=57343){let a=c&1023,b=d&1023;U.push(String.fromCodePoint((2<<15)+(2<<9)*a+b)),++i}else U.push(String.fromCodePoint(65533))}}return U.join("")};conversions.Date=function(V,opts){if(!(V instanceof Date))throw new TypeError("Argument is not a Date object");if(!isNaN(V))return V};conversions.RegExp=function(V,opts){return V instanceof RegExp||(V=new RegExp(V)),V}}});var require_utils=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/whatwg-url/lib/utils.js"(exports2,module2){"use strict";module2.exports.mixin=__name(function(target,source){let keys=Object.getOwnPropertyNames(source);for(let i=0;i=val)return target;target[0][0]>val?end=mid-1:start=mid+1}return null}__name(findStatus,"findStatus");var regexAstralSymbols=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;function countSymbols(string){return string.replace(regexAstralSymbols,"_").length}__name(countSymbols,"countSymbols");function mapChars(domain_name,useSTD3,processing_option){for(var hasError=!1,processed="",len=countSymbols(domain_name),i=0;i253||total.length===0)&&(result.error=!0);for(var i=0;i63||labels.length===0){result.error=!0;break}}return result.error?null:labels.join(".")};module2.exports.toUnicode=function(domain_name,useSTD3){var result=processing(domain_name,useSTD3,PROCESSING_OPTIONS.NONTRANSITIONAL);return{domain:result.string,error:result.error}};module2.exports.PROCESSING_OPTIONS=PROCESSING_OPTIONS}});var require_url_state_machine=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/whatwg-url/lib/url-state-machine.js"(exports2,module2){"use strict";var punycode=require("punycode"),tr46=require_tr46(),specialSchemes={ftp:21,file:null,gopher:70,http:80,https:443,ws:80,wss:443},failure=Symbol("failure");function countSymbols(str){return punycode.ucs2.decode(str).length}__name(countSymbols,"countSymbols");function at(input,idx){let c=input[idx];return isNaN(c)?void 0:String.fromCodePoint(c)}__name(at,"at");function isASCIIDigit(c){return c>=48&&c<=57}__name(isASCIIDigit,"isASCIIDigit");function isASCIIAlpha(c){return c>=65&&c<=90||c>=97&&c<=122}__name(isASCIIAlpha,"isASCIIAlpha");function isASCIIAlphanumeric(c){return isASCIIAlpha(c)||isASCIIDigit(c)}__name(isASCIIAlphanumeric,"isASCIIAlphanumeric");function isASCIIHex(c){return isASCIIDigit(c)||c>=65&&c<=70||c>=97&&c<=102}__name(isASCIIHex,"isASCIIHex");function isSingleDot(buffer){return buffer==="."||buffer.toLowerCase()==="%2e"}__name(isSingleDot,"isSingleDot");function isDoubleDot(buffer){return buffer=buffer.toLowerCase(),buffer===".."||buffer==="%2e."||buffer===".%2e"||buffer==="%2e%2e"}__name(isDoubleDot,"isDoubleDot");function isWindowsDriveLetterCodePoints(cp1,cp2){return isASCIIAlpha(cp1)&&(cp2===58||cp2===124)}__name(isWindowsDriveLetterCodePoints,"isWindowsDriveLetterCodePoints");function isWindowsDriveLetterString(string){return string.length===2&&isASCIIAlpha(string.codePointAt(0))&&(string[1]===":"||string[1]==="|")}__name(isWindowsDriveLetterString,"isWindowsDriveLetterString");function isNormalizedWindowsDriveLetterString(string){return string.length===2&&isASCIIAlpha(string.codePointAt(0))&&string[1]===":"}__name(isNormalizedWindowsDriveLetterString,"isNormalizedWindowsDriveLetterString");function containsForbiddenHostCodePoint(string){return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/)!==-1}__name(containsForbiddenHostCodePoint,"containsForbiddenHostCodePoint");function containsForbiddenHostCodePointExcludingPercent(string){return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/)!==-1}__name(containsForbiddenHostCodePointExcludingPercent,"containsForbiddenHostCodePointExcludingPercent");function isSpecialScheme(scheme){return specialSchemes[scheme]!==void 0}__name(isSpecialScheme,"isSpecialScheme");function isSpecial(url){return isSpecialScheme(url.scheme)}__name(isSpecial,"isSpecial");function defaultPort(scheme){return specialSchemes[scheme]}__name(defaultPort,"defaultPort");function percentEncode(c){let hex=c.toString(16).toUpperCase();return hex.length===1&&(hex="0"+hex),"%"+hex}__name(percentEncode,"percentEncode");function utf8PercentEncode(c){let buf=new Buffer(c),str="";for(let i=0;i126}__name(isC0ControlPercentEncode,"isC0ControlPercentEncode");var extraPathPercentEncodeSet=new Set([32,34,35,60,62,63,96,123,125]);function isPathPercentEncode(c){return isC0ControlPercentEncode(c)||extraPathPercentEncodeSet.has(c)}__name(isPathPercentEncode,"isPathPercentEncode");var extraUserinfoPercentEncodeSet=new Set([47,58,59,61,64,91,92,93,94,124]);function isUserinfoPercentEncode(c){return isPathPercentEncode(c)||extraUserinfoPercentEncodeSet.has(c)}__name(isUserinfoPercentEncode,"isUserinfoPercentEncode");function percentEncodeChar(c,encodeSetPredicate){let cStr=String.fromCodePoint(c);return encodeSetPredicate(c)?utf8PercentEncode(cStr):cStr}__name(percentEncodeChar,"percentEncodeChar");function parseIPv4Number(input){let R=10;return input.length>=2&&input.charAt(0)==="0"&&input.charAt(1).toLowerCase()==="x"?(input=input.substring(2),R=16):input.length>=2&&input.charAt(0)==="0"&&(input=input.substring(1),R=8),input===""?0:(R===10?/[^0-9]/:R===16?/[^0-9A-Fa-f]/:/[^0-7]/).test(input)?failure:parseInt(input,R)}__name(parseIPv4Number,"parseIPv4Number");function parseIPv4(input){let parts=input.split(".");if(parts[parts.length-1]===""&&parts.length>1&&parts.pop(),parts.length>4)return input;let numbers=[];for(let part of parts){if(part==="")return input;let n=parseIPv4Number(part);if(n===failure)return input;numbers.push(n)}for(let i=0;i255)return failure;if(numbers[numbers.length-1]>=Math.pow(256,5-numbers.length))return failure;let ipv4=numbers.pop(),counter=0;for(let n of numbers)ipv4+=n*Math.pow(256,3-counter),++counter;return ipv4}__name(parseIPv4,"parseIPv4");function serializeIPv4(address){let output="",n=address;for(let i=1;i<=4;++i)output=String(n%256)+output,i!==4&&(output="."+output),n=Math.floor(n/256);return output}__name(serializeIPv4,"serializeIPv4");function parseIPv6(input){let address=[0,0,0,0,0,0,0,0],pieceIndex=0,compress=null,pointer=0;if(input=punycode.ucs2.decode(input),input[pointer]===58){if(input[pointer+1]!==58)return failure;pointer+=2,++pieceIndex,compress=pieceIndex}for(;pointer6))return failure;let numbersSeen=0;for(;input[pointer]!==void 0;){let ipv4Piece=null;if(numbersSeen>0)if(input[pointer]===46&&numbersSeen<4)++pointer;else return failure;if(!isASCIIDigit(input[pointer]))return failure;for(;isASCIIDigit(input[pointer]);){let number=parseInt(at(input,pointer));if(ipv4Piece===null)ipv4Piece=number;else{if(ipv4Piece===0)return failure;ipv4Piece=ipv4Piece*10+number}if(ipv4Piece>255)return failure;++pointer}address[pieceIndex]=address[pieceIndex]*256+ipv4Piece,++numbersSeen,(numbersSeen===2||numbersSeen===4)&&++pieceIndex}if(numbersSeen!==4)return failure;break}else if(input[pointer]===58){if(++pointer,input[pointer]===void 0)return failure}else if(input[pointer]!==void 0)return failure;address[pieceIndex]=value,++pieceIndex}if(compress!==null){let swaps=pieceIndex-compress;for(pieceIndex=7;pieceIndex!==0&&swaps>0;){let temp=address[compress+swaps-1];address[compress+swaps-1]=address[pieceIndex],address[pieceIndex]=temp,--pieceIndex,--swaps}}else if(compress===null&&pieceIndex!==8)return failure;return address}__name(parseIPv6,"parseIPv6");function serializeIPv6(address){let output="",compress=findLongestZeroSequence(address).idx,ignore0=!1;for(let pieceIndex=0;pieceIndex<=7;++pieceIndex)if(!(ignore0&&address[pieceIndex]===0)){if(ignore0&&(ignore0=!1),compress===pieceIndex){output+=pieceIndex===0?"::":":",ignore0=!0;continue}output+=address[pieceIndex].toString(16),pieceIndex!==7&&(output+=":")}return output}__name(serializeIPv6,"serializeIPv6");function parseHost(input,isSpecialArg){if(input[0]==="[")return input[input.length-1]!=="]"?failure:parseIPv6(input.substring(1,input.length-1));if(!isSpecialArg)return parseOpaqueHost(input);let domain=utf8PercentDecode(input),asciiDomain=tr46.toASCII(domain,!1,tr46.PROCESSING_OPTIONS.NONTRANSITIONAL,!1);if(asciiDomain===null||containsForbiddenHostCodePoint(asciiDomain))return failure;let ipv4Host=parseIPv4(asciiDomain);return typeof ipv4Host=="number"||ipv4Host===failure?ipv4Host:asciiDomain}__name(parseHost,"parseHost");function parseOpaqueHost(input){if(containsForbiddenHostCodePointExcludingPercent(input))return failure;let output="",decoded=punycode.ucs2.decode(input);for(let i=0;imaxLen&&(maxIdx=currStart,maxLen=currLen),currStart=null,currLen=0):(currStart===null&&(currStart=i),++currLen);return currLen>maxLen&&(maxIdx=currStart,maxLen=currLen),{idx:maxIdx,len:maxLen}}__name(findLongestZeroSequence,"findLongestZeroSequence");function serializeHost(host){return typeof host=="number"?serializeIPv4(host):host instanceof Array?"["+serializeIPv6(host)+"]":host}__name(serializeHost,"serializeHost");function trimControlChars(url){return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g,"")}__name(trimControlChars,"trimControlChars");function trimTabAndNewline(url){return url.replace(/\u0009|\u000A|\u000D/g,"")}__name(trimTabAndNewline,"trimTabAndNewline");function shortenPath(url){let path=url.path;path.length!==0&&(url.scheme==="file"&&path.length===1&&isNormalizedWindowsDriveLetter(path[0])||path.pop())}__name(shortenPath,"shortenPath");function includesCredentials(url){return url.username!==""||url.password!==""}__name(includesCredentials,"includesCredentials");function cannotHaveAUsernamePasswordPort(url){return url.host===null||url.host===""||url.cannotBeABaseURL||url.scheme==="file"}__name(cannotHaveAUsernamePasswordPort,"cannotHaveAUsernamePasswordPort");function isNormalizedWindowsDriveLetter(string){return/^[A-Za-z]:$/.test(string)}__name(isNormalizedWindowsDriveLetter,"isNormalizedWindowsDriveLetter");function URLStateMachine(input,base,encodingOverride,url,stateOverride){if(this.pointer=0,this.input=input,this.base=base||null,this.encodingOverride=encodingOverride||"utf-8",this.stateOverride=stateOverride,this.url=url,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,cannotBeABaseURL:!1};let res2=trimControlChars(this.input);res2!==this.input&&(this.parseError=!0),this.input=res2}let res=trimTabAndNewline(this.input);for(res!==this.input&&(this.parseError=!0),this.input=res,this.state=stateOverride||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=punycode.ucs2.decode(this.input);this.pointer<=this.input.length;++this.pointer){let c=this.input[this.pointer],cStr=isNaN(c)?void 0:String.fromCodePoint(c),ret=this["parse "+this.state](c,cStr);if(ret){if(ret===failure){this.failure=!0;break}}else break}}__name(URLStateMachine,"URLStateMachine");URLStateMachine.prototype["parse scheme start"]=__name(function(c,cStr){if(isASCIIAlpha(c))this.buffer+=cStr.toLowerCase(),this.state="scheme";else if(!this.stateOverride)this.state="no scheme",--this.pointer;else return this.parseError=!0,failure;return!0},"parseSchemeStart");URLStateMachine.prototype["parse scheme"]=__name(function(c,cStr){if(isASCIIAlphanumeric(c)||c===43||c===45||c===46)this.buffer+=cStr.toLowerCase();else if(c===58){if(this.stateOverride&&(isSpecial(this.url)&&!isSpecialScheme(this.buffer)||!isSpecial(this.url)&&isSpecialScheme(this.buffer)||(includesCredentials(this.url)||this.url.port!==null)&&this.buffer==="file"||this.url.scheme==="file"&&(this.url.host===""||this.url.host===null))||(this.url.scheme=this.buffer,this.buffer="",this.stateOverride))return!1;this.url.scheme==="file"?((this.input[this.pointer+1]!==47||this.input[this.pointer+2]!==47)&&(this.parseError=!0),this.state="file"):isSpecial(this.url)&&this.base!==null&&this.base.scheme===this.url.scheme?this.state="special relative or authority":isSpecial(this.url)?this.state="special authority slashes":this.input[this.pointer+1]===47?(this.state="path or authority",++this.pointer):(this.url.cannotBeABaseURL=!0,this.url.path.push(""),this.state="cannot-be-a-base-URL path")}else if(!this.stateOverride)this.buffer="",this.state="no scheme",this.pointer=-1;else return this.parseError=!0,failure;return!0},"parseScheme");URLStateMachine.prototype["parse no scheme"]=__name(function(c){return this.base===null||this.base.cannotBeABaseURL&&c!==35?failure:(this.base.cannotBeABaseURL&&c===35?(this.url.scheme=this.base.scheme,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.url.cannotBeABaseURL=!0,this.state="fragment"):this.base.scheme==="file"?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)},"parseNoScheme");URLStateMachine.prototype["parse special relative or authority"]=__name(function(c){return c===47&&this.input[this.pointer+1]===47?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0},"parseSpecialRelativeOrAuthority");URLStateMachine.prototype["parse path or authority"]=__name(function(c){return c===47?this.state="authority":(this.state="path",--this.pointer),!0},"parsePathOrAuthority");URLStateMachine.prototype["parse relative"]=__name(function(c){return this.url.scheme=this.base.scheme,isNaN(c)?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query):c===47?this.state="relative slash":c===63?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):c===35?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):isSpecial(this.url)&&c===92?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(0,this.base.path.length-1),this.state="path",--this.pointer),!0},"parseRelative");URLStateMachine.prototype["parse relative slash"]=__name(function(c){return isSpecial(this.url)&&(c===47||c===92)?(c===92&&(this.parseError=!0),this.state="special authority ignore slashes"):c===47?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer),!0},"parseRelativeSlash");URLStateMachine.prototype["parse special authority slashes"]=__name(function(c){return c===47&&this.input[this.pointer+1]===47?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0},"parseSpecialAuthoritySlashes");URLStateMachine.prototype["parse special authority ignore slashes"]=__name(function(c){return c!==47&&c!==92?(this.state="authority",--this.pointer):this.parseError=!0,!0},"parseSpecialAuthorityIgnoreSlashes");URLStateMachine.prototype["parse authority"]=__name(function(c,cStr){if(c===64){this.parseError=!0,this.atFlag&&(this.buffer="%40"+this.buffer),this.atFlag=!0;let len=countSymbols(this.buffer);for(let pointer=0;pointerMath.pow(2,16)-1)return this.parseError=!0,failure;this.url.port=port===defaultPort(this.url.scheme)?null:port,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}else return this.parseError=!0,failure;return!0},"parsePort");var fileOtherwiseCodePoints=new Set([47,92,63,35]);URLStateMachine.prototype["parse file"]=__name(function(c){return this.url.scheme="file",c===47||c===92?(c===92&&(this.parseError=!0),this.state="file slash"):this.base!==null&&this.base.scheme==="file"?isNaN(c)?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query):c===63?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):c===35?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):(this.input.length-this.pointer-1===0||!isWindowsDriveLetterCodePoints(c,this.input[this.pointer+1])||this.input.length-this.pointer-1>=2&&!fileOtherwiseCodePoints.has(this.input[this.pointer+2])?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),shortenPath(this.url)):this.parseError=!0,this.state="path",--this.pointer):(this.state="path",--this.pointer),!0},"parseFile");URLStateMachine.prototype["parse file slash"]=__name(function(c){return c===47||c===92?(c===92&&(this.parseError=!0),this.state="file host"):(this.base!==null&&this.base.scheme==="file"&&(isNormalizedWindowsDriveLetterString(this.base.path[0])?this.url.path.push(this.base.path[0]):this.url.host=this.base.host),this.state="path",--this.pointer),!0},"parseFileSlash");URLStateMachine.prototype["parse file host"]=__name(function(c,cStr){if(isNaN(c)||c===47||c===92||c===63||c===35)if(--this.pointer,!this.stateOverride&&isWindowsDriveLetterString(this.buffer))this.parseError=!0,this.state="path";else if(this.buffer===""){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{let host=parseHost(this.buffer,isSpecial(this.url));if(host===failure)return failure;if(host==="localhost"&&(host=""),this.url.host=host,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=cStr;return!0},"parseFileHost");URLStateMachine.prototype["parse path start"]=__name(function(c){return isSpecial(this.url)?(c===92&&(this.parseError=!0),this.state="path",c!==47&&c!==92&&--this.pointer):!this.stateOverride&&c===63?(this.url.query="",this.state="query"):!this.stateOverride&&c===35?(this.url.fragment="",this.state="fragment"):c!==void 0&&(this.state="path",c!==47&&--this.pointer),!0},"parsePathStart");URLStateMachine.prototype["parse path"]=__name(function(c){if(isNaN(c)||c===47||isSpecial(this.url)&&c===92||!this.stateOverride&&(c===63||c===35)){if(isSpecial(this.url)&&c===92&&(this.parseError=!0),isDoubleDot(this.buffer)?(shortenPath(this.url),c!==47&&!(isSpecial(this.url)&&c===92)&&this.url.path.push("")):isSingleDot(this.buffer)&&c!==47&&!(isSpecial(this.url)&&c===92)?this.url.path.push(""):isSingleDot(this.buffer)||(this.url.scheme==="file"&&this.url.path.length===0&&isWindowsDriveLetterString(this.buffer)&&(this.url.host!==""&&this.url.host!==null&&(this.parseError=!0,this.url.host=""),this.buffer=this.buffer[0]+":"),this.url.path.push(this.buffer)),this.buffer="",this.url.scheme==="file"&&(c===void 0||c===63||c===35))for(;this.url.path.length>1&&this.url.path[0]==="";)this.parseError=!0,this.url.path.shift();c===63&&(this.url.query="",this.state="query"),c===35&&(this.url.fragment="",this.state="fragment")}else c===37&&(!isASCIIHex(this.input[this.pointer+1])||!isASCIIHex(this.input[this.pointer+2]))&&(this.parseError=!0),this.buffer+=percentEncodeChar(c,isPathPercentEncode);return!0},"parsePath");URLStateMachine.prototype["parse cannot-be-a-base-URL path"]=__name(function(c){return c===63?(this.url.query="",this.state="query"):c===35?(this.url.fragment="",this.state="fragment"):(!isNaN(c)&&c!==37&&(this.parseError=!0),c===37&&(!isASCIIHex(this.input[this.pointer+1])||!isASCIIHex(this.input[this.pointer+2]))&&(this.parseError=!0),isNaN(c)||(this.url.path[0]=this.url.path[0]+percentEncodeChar(c,isC0ControlPercentEncode))),!0},"parseCannotBeABaseURLPath");URLStateMachine.prototype["parse query"]=__name(function(c,cStr){if(isNaN(c)||!this.stateOverride&&c===35){(!isSpecial(this.url)||this.url.scheme==="ws"||this.url.scheme==="wss")&&(this.encodingOverride="utf-8");let buffer=new Buffer(this.buffer);for(let i=0;i126||buffer[i]===34||buffer[i]===35||buffer[i]===60||buffer[i]===62?this.url.query+=percentEncode(buffer[i]):this.url.query+=String.fromCodePoint(buffer[i]);this.buffer="",c===35&&(this.url.fragment="",this.state="fragment")}else c===37&&(!isASCIIHex(this.input[this.pointer+1])||!isASCIIHex(this.input[this.pointer+2]))&&(this.parseError=!0),this.buffer+=cStr;return!0},"parseQuery");URLStateMachine.prototype["parse fragment"]=__name(function(c){return isNaN(c)||(c===0?this.parseError=!0:(c===37&&(!isASCIIHex(this.input[this.pointer+1])||!isASCIIHex(this.input[this.pointer+2]))&&(this.parseError=!0),this.url.fragment+=percentEncodeChar(c,isC0ControlPercentEncode))),!0},"parseFragment");function serializeURL(url,excludeFragment){let output=url.scheme+":";if(url.host!==null?(output+="//",(url.username!==""||url.password!=="")&&(output+=url.username,url.password!==""&&(output+=":"+url.password),output+="@"),output+=serializeHost(url.host),url.port!==null&&(output+=":"+url.port)):url.host===null&&url.scheme==="file"&&(output+="//"),url.cannotBeABaseURL)output+=url.path[0];else for(let string of url.path)output+="/"+string;return url.query!==null&&(output+="?"+url.query),!excludeFragment&&url.fragment!==null&&(output+="#"+url.fragment),output}__name(serializeURL,"serializeURL");function serializeOrigin(tuple){let result=tuple.scheme+"://";return result+=serializeHost(tuple.host),tuple.port!==null&&(result+=":"+tuple.port),result}__name(serializeOrigin,"serializeOrigin");module2.exports.serializeURL=serializeURL;module2.exports.serializeURLOrigin=function(url){switch(url.scheme){case"blob":try{return module2.exports.serializeURLOrigin(module2.exports.parseURL(url.path[0]))}catch{return"null"}case"ftp":case"gopher":case"http":case"https":case"ws":case"wss":return serializeOrigin({scheme:url.scheme,host:url.host,port:url.port});case"file":return"file://";default:return"null"}};module2.exports.basicURLParse=function(input,options){options===void 0&&(options={});let usm=new URLStateMachine(input,options.baseURL,options.encodingOverride,options.url,options.stateOverride);return usm.failure?"failure":usm.url};module2.exports.setTheUsername=function(url,username){url.username="";let decoded=punycode.ucs2.decode(username);for(let i=0;i1&&arguments[1]!==void 0?arguments[1]:{},_ref$size=_ref.size;let size=_ref$size===void 0?0:_ref$size;var _ref$timeout=_ref.timeout;let timeout=_ref$timeout===void 0?0:_ref$timeout;body==null?body=null:isURLSearchParams(body)?body=Buffer.from(body.toString()):isBlob(body)||Buffer.isBuffer(body)||(Object.prototype.toString.call(body)==="[object ArrayBuffer]"?body=Buffer.from(body):ArrayBuffer.isView(body)?body=Buffer.from(body.buffer,body.byteOffset,body.byteLength):body instanceof Stream||(body=Buffer.from(String(body)))),this[INTERNALS]={body,disturbed:!1,error:null},this.size=size,this.timeout=timeout,body instanceof Stream&&body.on("error",function(err){let error=err.name==="AbortError"?err:new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`,"system",err);_this[INTERNALS].error=error})}__name(Body,"Body");Body.prototype={get body(){return this[INTERNALS].body},get bodyUsed(){return this[INTERNALS].disturbed},arrayBuffer(){return consumeBody.call(this).then(function(buf){return buf.buffer.slice(buf.byteOffset,buf.byteOffset+buf.byteLength)})},blob(){let ct=this.headers&&this.headers.get("content-type")||"";return consumeBody.call(this).then(function(buf){return Object.assign(new Blob([],{type:ct.toLowerCase()}),{[BUFFER]:buf})})},json(){var _this2=this;return consumeBody.call(this).then(function(buffer){try{return JSON.parse(buffer.toString())}catch(err){return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`,"invalid-json"))}})},text(){return consumeBody.call(this).then(function(buffer){return buffer.toString()})},buffer(){return consumeBody.call(this)},textConverted(){var _this3=this;return consumeBody.call(this).then(function(buffer){return convertBody(buffer,_this3.headers)})}};Object.defineProperties(Body.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}});Body.mixIn=function(proto){for(let name of Object.getOwnPropertyNames(Body.prototype))if(!(name in proto)){let desc=Object.getOwnPropertyDescriptor(Body.prototype,name);Object.defineProperty(proto,name,desc)}};function consumeBody(){var _this4=this;if(this[INTERNALS].disturbed)return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[INTERNALS].disturbed=!0,this[INTERNALS].error)return Body.Promise.reject(this[INTERNALS].error);let body=this.body;if(body===null)return Body.Promise.resolve(Buffer.alloc(0));if(isBlob(body)&&(body=body.stream()),Buffer.isBuffer(body))return Body.Promise.resolve(body);if(!(body instanceof Stream))return Body.Promise.resolve(Buffer.alloc(0));let accum=[],accumBytes=0,abort=!1;return new Body.Promise(function(resolve,reject){let resTimeout;_this4.timeout&&(resTimeout=setTimeout(function(){abort=!0,reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`,"body-timeout"))},_this4.timeout)),body.on("error",function(err){err.name==="AbortError"?(abort=!0,reject(err)):reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`,"system",err))}),body.on("data",function(chunk){if(!(abort||chunk===null)){if(_this4.size&&accumBytes+chunk.length>_this4.size){abort=!0,reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`,"max-size"));return}accumBytes+=chunk.length,accum.push(chunk)}}),body.on("end",function(){if(!abort){clearTimeout(resTimeout);try{resolve(Buffer.concat(accum,accumBytes))}catch(err){reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`,"system",err))}}})})}__name(consumeBody,"consumeBody");function convertBody(buffer,headers){if(typeof convert!="function")throw new Error("The package `encoding` must be installed to use the textConverted() function");let ct=headers.get("content-type"),charset="utf-8",res,str;return ct&&(res=/charset=([^;]*)/i.exec(ct)),str=buffer.slice(0,1024).toString(),!res&&str&&(res=/0&&arguments[0]!==void 0?arguments[0]:void 0;if(this[MAP]=Object.create(null),init instanceof Headers){let rawHeaders=init.raw(),headerNames=Object.keys(rawHeaders);for(let headerName of headerNames)for(let value of rawHeaders[headerName])this.append(headerName,value);return}if(init!=null)if(typeof init=="object"){let method=init[Symbol.iterator];if(method!=null){if(typeof method!="function")throw new TypeError("Header pairs must be iterable");let pairs=[];for(let pair of init){if(typeof pair!="object"||typeof pair[Symbol.iterator]!="function")throw new TypeError("Each header pair must be iterable");pairs.push(Array.from(pair))}for(let pair of pairs){if(pair.length!==2)throw new TypeError("Each header pair must be a name/value tuple");this.append(pair[0],pair[1])}}else for(let key of Object.keys(init)){let value=init[key];this.append(key,value)}}else throw new TypeError("Provided initializer must be an object")}get(name){name=`${name}`,validateName(name);let key=find(this[MAP],name);return key===void 0?null:this[MAP][key].join(", ")}forEach(callback){let thisArg=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,pairs=getHeaders(this),i=0;for(;i1&&arguments[1]!==void 0?arguments[1]:"key+value";return Object.keys(headers[MAP]).sort().map(kind==="key"?function(k){return k.toLowerCase()}:kind==="value"?function(k){return headers[MAP][k].join(", ")}:function(k){return[k.toLowerCase(),headers[MAP][k].join(", ")]})}__name(getHeaders,"getHeaders");var INTERNAL=Symbol("internal");function createHeadersIterator(target,kind){let iterator=Object.create(HeadersIteratorPrototype);return iterator[INTERNAL]={target,kind,index:0},iterator}__name(createHeadersIterator,"createHeadersIterator");var HeadersIteratorPrototype=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==HeadersIteratorPrototype)throw new TypeError("Value of `this` is not a HeadersIterator");var _INTERNAL=this[INTERNAL];let target=_INTERNAL.target,kind=_INTERNAL.kind,index=_INTERNAL.index,values=getHeaders(target,kind),len=values.length;return index>=len?{value:void 0,done:!0}:(this[INTERNAL].index=index+1,{value:values[index],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));Object.defineProperty(HeadersIteratorPrototype,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});function exportNodeCompatibleHeaders(headers){let obj=Object.assign({__proto__:null},headers[MAP]),hostHeaderKey=find(headers[MAP],"Host");return hostHeaderKey!==void 0&&(obj[hostHeaderKey]=obj[hostHeaderKey][0]),obj}__name(exportNodeCompatibleHeaders,"exportNodeCompatibleHeaders");function createHeadersLenient(obj){let headers=new Headers;for(let name of Object.keys(obj))if(!invalidTokenRegex.test(name))if(Array.isArray(obj[name]))for(let val of obj[name])invalidHeaderCharRegex.test(val)||(headers[MAP][name]===void 0?headers[MAP][name]=[val]:headers[MAP][name].push(val));else invalidHeaderCharRegex.test(obj[name])||(headers[MAP][name]=[obj[name]]);return headers}__name(createHeadersLenient,"createHeadersLenient");var INTERNALS$1=Symbol("Response internals"),STATUS_CODES=http.STATUS_CODES,Response=class{constructor(){let body=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,opts=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Body.call(this,body,opts);let status=opts.status||200,headers=new Headers(opts.headers);if(body!=null&&!headers.has("Content-Type")){let contentType=extractContentType(body);contentType&&headers.append("Content-Type",contentType)}this[INTERNALS$1]={url:opts.url,status,statusText:opts.statusText||STATUS_CODES[status],headers,counter:opts.counter}}get url(){return this[INTERNALS$1].url||""}get status(){return this[INTERNALS$1].status}get ok(){return this[INTERNALS$1].status>=200&&this[INTERNALS$1].status<300}get redirected(){return this[INTERNALS$1].counter>0}get statusText(){return this[INTERNALS$1].statusText}get headers(){return this[INTERNALS$1].headers}clone(){return new Response(clone(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}};__name(Response,"Response");Body.mixIn(Response.prototype);Object.defineProperties(Response.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});Object.defineProperty(Response.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});var INTERNALS$2=Symbol("Request internals"),URL3=Url.URL||whatwgUrl.URL,parse_url=Url.parse,format_url=Url.format;function parseURL(urlStr){return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)&&(urlStr=new URL3(urlStr).toString()),parse_url(urlStr)}__name(parseURL,"parseURL");var streamDestructionSupported="destroy"in Stream.Readable.prototype;function isRequest(input){return typeof input=="object"&&typeof input[INTERNALS$2]=="object"}__name(isRequest,"isRequest");function isAbortSignal(signal){let proto=signal&&typeof signal=="object"&&Object.getPrototypeOf(signal);return!!(proto&&proto.constructor.name==="AbortSignal")}__name(isAbortSignal,"isAbortSignal");var Request=class{constructor(input){let init=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},parsedURL;isRequest(input)?parsedURL=parseURL(input.url):(input&&input.href?parsedURL=parseURL(input.href):parsedURL=parseURL(`${input}`),input={});let method=init.method||input.method||"GET";if(method=method.toUpperCase(),(init.body!=null||isRequest(input)&&input.body!==null)&&(method==="GET"||method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let inputBody=init.body!=null?init.body:isRequest(input)&&input.body!==null?clone(input):null;Body.call(this,inputBody,{timeout:init.timeout||input.timeout||0,size:init.size||input.size||0});let headers=new Headers(init.headers||input.headers||{});if(inputBody!=null&&!headers.has("Content-Type")){let contentType=extractContentType(inputBody);contentType&&headers.append("Content-Type",contentType)}let signal=isRequest(input)?input.signal:null;if("signal"in init&&(signal=init.signal),signal!=null&&!isAbortSignal(signal))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[INTERNALS$2]={method,redirect:init.redirect||input.redirect||"follow",headers,parsedURL,signal},this.follow=init.follow!==void 0?init.follow:input.follow!==void 0?input.follow:20,this.compress=init.compress!==void 0?init.compress:input.compress!==void 0?input.compress:!0,this.counter=init.counter||input.counter||0,this.agent=init.agent||input.agent}get method(){return this[INTERNALS$2].method}get url(){return format_url(this[INTERNALS$2].parsedURL)}get headers(){return this[INTERNALS$2].headers}get redirect(){return this[INTERNALS$2].redirect}get signal(){return this[INTERNALS$2].signal}clone(){return new Request(this)}};__name(Request,"Request");Body.mixIn(Request.prototype);Object.defineProperty(Request.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(Request.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}});function getNodeRequestOptions(request){let parsedURL=request[INTERNALS$2].parsedURL,headers=new Headers(request[INTERNALS$2].headers);if(headers.has("Accept")||headers.set("Accept","*/*"),!parsedURL.protocol||!parsedURL.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(parsedURL.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(request.signal&&request.body instanceof Stream.Readable&&!streamDestructionSupported)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let contentLengthValue=null;if(request.body==null&&/^(POST|PUT)$/i.test(request.method)&&(contentLengthValue="0"),request.body!=null){let totalBytes=getTotalBytes(request);typeof totalBytes=="number"&&(contentLengthValue=String(totalBytes))}contentLengthValue&&headers.set("Content-Length",contentLengthValue),headers.has("User-Agent")||headers.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),request.compress&&!headers.has("Accept-Encoding")&&headers.set("Accept-Encoding","gzip,deflate");let agent=request.agent;return typeof agent=="function"&&(agent=agent(parsedURL)),Object.assign({},parsedURL,{method:request.method,headers:exportNodeCompatibleHeaders(headers),agent})}__name(getNodeRequestOptions,"getNodeRequestOptions");function AbortError(message){Error.call(this,message),this.type="aborted",this.message=message,Error.captureStackTrace(this,this.constructor)}__name(AbortError,"AbortError");AbortError.prototype=Object.create(Error.prototype);AbortError.prototype.constructor=AbortError;AbortError.prototype.name="AbortError";var URL$1=Url.URL||whatwgUrl.URL,PassThrough$1=Stream.PassThrough,isDomainOrSubdomain=__name(function(destination,original){let orig=new URL$1(original).hostname,dest=new URL$1(destination).hostname;return orig===dest||orig[orig.length-dest.length-1]==="."&&orig.endsWith(dest)},"isDomainOrSubdomain"),isSameProtocol=__name(function(destination,original){let orig=new URL$1(original).protocol,dest=new URL$1(destination).protocol;return orig===dest},"isSameProtocol");function fetch(url,opts){if(!fetch.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return Body.Promise=fetch.Promise,new fetch.Promise(function(resolve,reject){let request=new Request(url,opts),options=getNodeRequestOptions(request),send=(options.protocol==="https:"?https:http).request,signal=request.signal,response=null,abort=__name(function(){let error=new AbortError("The user aborted a request.");reject(error),request.body&&request.body instanceof Stream.Readable&&destroyStream(request.body,error),!(!response||!response.body)&&response.body.emit("error",error)},"abort");if(signal&&signal.aborted){abort();return}let abortAndFinalize=__name(function(){abort(),finalize()},"abortAndFinalize"),req=send(options),reqTimeout;signal&&signal.addEventListener("abort",abortAndFinalize);function finalize(){req.abort(),signal&&signal.removeEventListener("abort",abortAndFinalize),clearTimeout(reqTimeout)}__name(finalize,"finalize"),request.timeout&&req.once("socket",function(socket){reqTimeout=setTimeout(function(){reject(new FetchError(`network timeout at: ${request.url}`,"request-timeout")),finalize()},request.timeout)}),req.on("error",function(err){reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`,"system",err)),response&&response.body&&destroyStream(response.body,err),finalize()}),fixResponseChunkedTransferBadEnding(req,function(err){signal&&signal.aborted||response&&response.body&&destroyStream(response.body,err)}),parseInt(process.version.substring(1))<14&&req.on("socket",function(s){s.addListener("close",function(hadError){let hasDataListener=s.listenerCount("data")>0;if(response&&hasDataListener&&!hadError&&!(signal&&signal.aborted)){let err=new Error("Premature close");err.code="ERR_STREAM_PREMATURE_CLOSE",response.body.emit("error",err)}})}),req.on("response",function(res){clearTimeout(reqTimeout);let headers=createHeadersLenient(res.headers);if(fetch.isRedirect(res.statusCode)){let location=headers.get("Location"),locationURL=null;try{locationURL=location===null?null:new URL$1(location,request.url).toString()}catch{if(request.redirect!=="manual"){reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`,"invalid-redirect")),finalize();return}}switch(request.redirect){case"error":reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`,"no-redirect")),finalize();return;case"manual":if(locationURL!==null)try{headers.set("Location",locationURL)}catch(err){reject(err)}break;case"follow":if(locationURL===null)break;if(request.counter>=request.follow){reject(new FetchError(`maximum redirect reached at: ${request.url}`,"max-redirect")),finalize();return}let requestOpts={headers:new Headers(request.headers),follow:request.follow,counter:request.counter+1,agent:request.agent,compress:request.compress,method:request.method,body:request.body,signal:request.signal,timeout:request.timeout,size:request.size};if(!isDomainOrSubdomain(request.url,locationURL)||!isSameProtocol(request.url,locationURL))for(let name of["authorization","www-authenticate","cookie","cookie2"])requestOpts.headers.delete(name);if(res.statusCode!==303&&request.body&&getTotalBytes(request)===null){reject(new FetchError("Cannot follow redirect with body being a readable stream","unsupported-redirect")),finalize();return}(res.statusCode===303||(res.statusCode===301||res.statusCode===302)&&request.method==="POST")&&(requestOpts.method="GET",requestOpts.body=void 0,requestOpts.headers.delete("content-length")),resolve(fetch(new Request(locationURL,requestOpts))),finalize();return}}res.once("end",function(){signal&&signal.removeEventListener("abort",abortAndFinalize)});let body=res.pipe(new PassThrough$1),response_options={url:request.url,status:res.statusCode,statusText:res.statusMessage,headers,size:request.size,timeout:request.timeout,counter:request.counter},codings=headers.get("Content-Encoding");if(!request.compress||request.method==="HEAD"||codings===null||res.statusCode===204||res.statusCode===304){response=new Response(body,response_options),resolve(response);return}let zlibOptions={flush:zlib.Z_SYNC_FLUSH,finishFlush:zlib.Z_SYNC_FLUSH};if(codings=="gzip"||codings=="x-gzip"){body=body.pipe(zlib.createGunzip(zlibOptions)),response=new Response(body,response_options),resolve(response);return}if(codings=="deflate"||codings=="x-deflate"){let raw=res.pipe(new PassThrough$1);raw.once("data",function(chunk){(chunk[0]&15)===8?body=body.pipe(zlib.createInflate()):body=body.pipe(zlib.createInflateRaw()),response=new Response(body,response_options),resolve(response)}),raw.on("end",function(){response||(response=new Response(body,response_options),resolve(response))});return}if(codings=="br"&&typeof zlib.createBrotliDecompress=="function"){body=body.pipe(zlib.createBrotliDecompress()),response=new Response(body,response_options),resolve(response);return}response=new Response(body,response_options),resolve(response)}),writeToStream(req,request)})}__name(fetch,"fetch");function fixResponseChunkedTransferBadEnding(request,errorCallback){let socket;request.on("socket",function(s){socket=s}),request.on("response",function(response){let headers=response.headers;headers["transfer-encoding"]==="chunked"&&!headers["content-length"]&&response.once("close",function(hadError){if(socket&&socket.listenerCount("data")>0&&!hadError){let err=new Error("Premature close");err.code="ERR_STREAM_PREMATURE_CLOSE",errorCallback(err)}})})}__name(fixResponseChunkedTransferBadEnding,"fixResponseChunkedTransferBadEnding");function destroyStream(stream,err){stream.destroy?stream.destroy(err):(stream.emit("error",err),stream.end())}__name(destroyStream,"destroyStream");fetch.isRedirect=function(code){return code===301||code===302||code===303||code===307||code===308};fetch.Promise=global.Promise;module2.exports=exports2=fetch;Object.defineProperty(exports2,"__esModule",{value:!0});exports2.default=exports2;exports2.Headers=Headers;exports2.Request=Request;exports2.Response=Response;exports2.FetchError=FetchError;exports2.AbortError=AbortError}});var require_is_stream=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/is-stream/index.js"(exports2,module2){"use strict";var isStream=__name(stream=>stream!==null&&typeof stream=="object"&&typeof stream.pipe=="function","isStream");isStream.writable=stream=>isStream(stream)&&stream.writable!==!1&&typeof stream._write=="function"&&typeof stream._writableState=="object";isStream.readable=stream=>isStream(stream)&&stream.readable!==!1&&typeof stream._read=="function"&&typeof stream._readableState=="object";isStream.duplex=stream=>isStream.writable(stream)&&isStream.readable(stream);isStream.transform=stream=>isStream.duplex(stream)&&typeof stream._transform=="function";module2.exports=isStream}});var require_package=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/gaxios/package.json"(exports2,module2){module2.exports={name:"gaxios",version:"6.6.0",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/src/index.js",types:"build/src/index.d.ts",files:["build/src"],scripts:{lint:"gts check",test:"c8 mocha build/test","presystem-test":"npm run compile","system-test":"mocha build/system-test --timeout 80000",compile:"tsc -p .",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"compodoc src/","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean",precompile:"gts clean"},repository:"googleapis/gaxios",keywords:["google"],engines:{node:">=14"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@compodoc/compodoc":"1.1.21","@types/cors":"^2.8.6","@types/express":"^4.16.1","@types/extend":"^3.0.1","@types/mocha":"^9.0.0","@types/multiparty":"0.0.36","@types/mv":"^2.1.0","@types/ncp":"^2.0.1","@types/node":"^20.0.0","@types/node-fetch":"^2.5.7","@types/sinon":"^17.0.0","@types/tmp":"0.2.6","@types/uuid":"^9.0.0","abort-controller":"^3.0.0",assert:"^2.0.0",browserify:"^17.0.0",c8:"^8.0.0",cors:"^2.8.5",execa:"^5.0.0",express:"^4.16.4","form-data":"^4.0.0",gts:"^5.0.0","is-docker":"^2.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"5.0.0",linkinator:"^4.0.0",mocha:"^8.0.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"^13.0.0","null-loader":"^4.0.0",puppeteer:"^21.0.0",sinon:"^17.0.0","stream-browserify":"^3.0.0",tmp:"0.2.3","ts-loader":"^8.0.0",typescript:"^5.1.6",webpack:"^5.35.0","webpack-cli":"^4.0.0"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","is-stream":"^2.0.0","node-fetch":"^2.6.9",uuid:"^9.0.1"}}}});var require_util3=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/gaxios/build/src/util.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.pkg=void 0;exports2.pkg=require_package()}});var require_common2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/gaxios/build/src/common.js"(exports2){"use strict";var __importDefault=exports2&&exports2.__importDefault||function(mod2){return mod2&&mod2.__esModule?mod2:{default:mod2}},_a;Object.defineProperty(exports2,"__esModule",{value:!0});exports2.defaultErrorRedactor=exports2.GaxiosError=exports2.GAXIOS_ERROR_SYMBOL=void 0;var url_1=require("url"),util_1=require_util3(),extend_1=__importDefault(require_extend());exports2.GAXIOS_ERROR_SYMBOL=Symbol.for(`${util_1.pkg.name}-gaxios-error`);var GaxiosError=class extends Error{static[(_a=exports2.GAXIOS_ERROR_SYMBOL,Symbol.hasInstance)](instance){return instance&&typeof instance=="object"&&exports2.GAXIOS_ERROR_SYMBOL in instance&&instance[exports2.GAXIOS_ERROR_SYMBOL]===util_1.pkg.version?!0:Function.prototype[Symbol.hasInstance].call(GaxiosError,instance)}constructor(message,config,response,error){var _b;if(super(message),this.config=config,this.response=response,this.error=error,this[_a]=util_1.pkg.version,this.config=(0,extend_1.default)(!0,{},config),this.response&&(this.response.config=(0,extend_1.default)(!0,{},this.response.config)),this.response){try{this.response.data=translateData(this.config.responseType,(_b=this.response)===null||_b===void 0?void 0:_b.data)}catch{}this.status=this.response.status}error&&"code"in error&&error.code&&(this.code=error.code),config.errorRedactor&&config.errorRedactor({config:this.config,response:this.response})}};__name(GaxiosError,"GaxiosError");exports2.GaxiosError=GaxiosError;function translateData(responseType,data){switch(responseType){case"stream":return data;case"json":return JSON.parse(JSON.stringify(data));case"arraybuffer":return JSON.parse(Buffer.from(data).toString("utf8"));case"blob":return JSON.parse(data.text());default:return data}}__name(translateData,"translateData");function defaultErrorRedactor(data){let REDACT="< - See `errorRedactor` option in `gaxios` for configuration>.";function redactHeaders(headers){if(headers)for(let key of Object.keys(headers))/^authentication$/i.test(key)&&(headers[key]=REDACT),/^authorization$/i.test(key)&&(headers[key]=REDACT),/secret/i.test(key)&&(headers[key]=REDACT)}__name(redactHeaders,"redactHeaders");function redactString(obj,key){if(typeof obj=="object"&&obj!==null&&typeof obj[key]=="string"){let text=obj[key];(/grant_type=/i.test(text)||/assertion=/i.test(text)||/secret/i.test(text))&&(obj[key]=REDACT)}}__name(redactString,"redactString");function redactObject(obj){typeof obj=="object"&&obj!==null&&("grant_type"in obj&&(obj.grant_type=REDACT),"assertion"in obj&&(obj.assertion=REDACT),"client_secret"in obj&&(obj.client_secret=REDACT))}if(__name(redactObject,"redactObject"),data.config){redactHeaders(data.config.headers),redactString(data.config,"data"),redactObject(data.config.data),redactString(data.config,"body"),redactObject(data.config.body);try{let url=new url_1.URL("",data.config.url);url.searchParams.has("token")&&url.searchParams.set("token",REDACT),url.searchParams.has("client_secret")&&url.searchParams.set("client_secret",REDACT),data.config.url=url.toString()}catch{}}return data.response&&(defaultErrorRedactor({config:data.response.config}),redactHeaders(data.response.headers),redactString(data.response,"data"),redactObject(data.response.data)),data}__name(defaultErrorRedactor,"defaultErrorRedactor");exports2.defaultErrorRedactor=defaultErrorRedactor}});var require_retry=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/gaxios/build/src/retry.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.getRetryConfig=void 0;async function getRetryConfig(err){var _a;let config=getConfig(err);if(!err||!err.config||!config&&!err.config.retry)return{shouldRetry:!1};config=config||{},config.currentRetryAttempt=config.currentRetryAttempt||0,config.retry=config.retry===void 0||config.retry===null?3:config.retry,config.httpMethodsToRetry=config.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],config.noResponseRetries=config.noResponseRetries===void 0||config.noResponseRetries===null?2:config.noResponseRetries;let retryRanges=[[100,199],[408,408],[429,429],[500,599]];if(config.statusCodesToRetry=config.statusCodesToRetry||retryRanges,err.config.retryConfig=config,!await(config.shouldRetry||shouldRetryRequest)(err))return{shouldRetry:!1,config:err.config};let delay=(config.currentRetryAttempt?0:(_a=config.retryDelay)!==null&&_a!==void 0?_a:100)+(Math.pow(2,config.currentRetryAttempt)-1)/2*1e3;err.config.retryConfig.currentRetryAttempt+=1;let backoff=config.retryBackoff?config.retryBackoff(err,delay):new Promise(resolve=>{setTimeout(resolve,delay)});return config.onRetryAttempt&&config.onRetryAttempt(err),await backoff,{shouldRetry:!0,config:err.config}}__name(getRetryConfig,"getRetryConfig");exports2.getRetryConfig=getRetryConfig;function shouldRetryRequest(err){var _a;let config=getConfig(err);if(err.name==="AbortError"||((_a=err.error)===null||_a===void 0?void 0:_a.name)==="AbortError"||!config||config.retry===0||!err.response&&(config.currentRetryAttempt||0)>=config.noResponseRetries||!err.config.method||config.httpMethodsToRetry.indexOf(err.config.method.toUpperCase())<0)return!1;if(err.response&&err.response.status){let isInRange=!1;for(let[min,max]of config.statusCodesToRetry){let status=err.response.status;if(status>=min&&status<=max){isInRange=!0;break}}if(!isInRange)return!1}return config.currentRetryAttempt=config.currentRetryAttempt||0,!(config.currentRetryAttempt>=config.retry)}__name(shouldRetryRequest,"shouldRetryRequest");function getConfig(err){if(err&&err.config&&err.config.retryConfig)return err.config.retryConfig}__name(getConfig,"getConfig")}});var require_interceptor=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/gaxios/build/src/interceptor.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.GaxiosInterceptorManager=void 0;var GaxiosInterceptorManager=class extends Set{};__name(GaxiosInterceptorManager,"GaxiosInterceptorManager");exports2.GaxiosInterceptorManager=GaxiosInterceptorManager}});var require_ms=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/ms/index.js"(exports2,module2){var s=1e3,m=s*60,h=m*60,d=h*24,w=d*7,y=d*365.25;module2.exports=function(val,options){options=options||{};var type=typeof val;if(type==="string"&&val.length>0)return parse2(val);if(type==="number"&&isFinite(val))return options.long?fmtLong(val):fmtShort(val);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(val))};function parse2(str){if(str=String(str),!(str.length>100)){var match=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);if(match){var n=parseFloat(match[1]),type=(match[2]||"ms").toLowerCase();switch(type){case"years":case"year":case"yrs":case"yr":case"y":return n*y;case"weeks":case"week":case"w":return n*w;case"days":case"day":case"d":return n*d;case"hours":case"hour":case"hrs":case"hr":case"h":return n*h;case"minutes":case"minute":case"mins":case"min":case"m":return n*m;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}__name(parse2,"parse");function fmtShort(ms){var msAbs=Math.abs(ms);return msAbs>=d?Math.round(ms/d)+"d":msAbs>=h?Math.round(ms/h)+"h":msAbs>=m?Math.round(ms/m)+"m":msAbs>=s?Math.round(ms/s)+"s":ms+"ms"}__name(fmtShort,"fmtShort");function fmtLong(ms){var msAbs=Math.abs(ms);return msAbs>=d?plural(ms,msAbs,d,"day"):msAbs>=h?plural(ms,msAbs,h,"hour"):msAbs>=m?plural(ms,msAbs,m,"minute"):msAbs>=s?plural(ms,msAbs,s,"second"):ms+" ms"}__name(fmtLong,"fmtLong");function plural(ms,msAbs,n,name){var isPlural=msAbs>=n*1.5;return Math.round(ms/n)+" "+name+(isPlural?"s":"")}__name(plural,"plural")}});var require_common3=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/debug/src/common.js"(exports2,module2){function setup(env){createDebug.debug=createDebug,createDebug.default=createDebug,createDebug.coerce=coerce,createDebug.disable=disable,createDebug.enable=enable,createDebug.enabled=enabled,createDebug.humanize=require_ms(),createDebug.destroy=destroy,Object.keys(env).forEach(key=>{createDebug[key]=env[key]}),createDebug.names=[],createDebug.skips=[],createDebug.formatters={};function selectColor(namespace){let hash=0;for(let i=0;i{if(match==="%%")return"%";index++;let formatter=createDebug.formatters[format];if(typeof formatter=="function"){let val=args[index];match=formatter.call(self2,val),args.splice(index,1),index--}return match}),createDebug.formatArgs.call(self2,args),(self2.log||createDebug.log).apply(self2,args)}return __name(debug,"debug"),debug.namespace=namespace,debug.useColors=createDebug.useColors(),debug.color=createDebug.selectColor(namespace),debug.extend=extend,debug.destroy=createDebug.destroy,Object.defineProperty(debug,"enabled",{enumerable:!0,configurable:!1,get:()=>enableOverride!==null?enableOverride:(namespacesCache!==createDebug.namespaces&&(namespacesCache=createDebug.namespaces,enabledCache=createDebug.enabled(namespace)),enabledCache),set:v=>{enableOverride=v}}),typeof createDebug.init=="function"&&createDebug.init(debug),debug}__name(createDebug,"createDebug");function extend(namespace,delimiter){let newDebug=createDebug(this.namespace+(typeof delimiter>"u"?":":delimiter)+namespace);return newDebug.log=this.log,newDebug}__name(extend,"extend");function enable(namespaces){createDebug.save(namespaces),createDebug.namespaces=namespaces,createDebug.names=[],createDebug.skips=[];let i,split=(typeof namespaces=="string"?namespaces:"").split(/[\s,]+/),len=split.length;for(i=0;i"-"+namespace)].join(",");return createDebug.enable(""),namespaces}__name(disable,"disable");function enabled(name){if(name[name.length-1]==="*")return!0;let i,len;for(i=0,len=createDebug.skips.length;i{let warned=!1;return()=>{warned||(warned=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();exports2.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function useColors(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}__name(useColors,"useColors");function formatArgs(args){if(args[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+args[0]+(this.useColors?"%c ":" ")+"+"+module2.exports.humanize(this.diff),!this.useColors)return;let c="color: "+this.color;args.splice(1,0,c,"color: inherit");let index=0,lastC=0;args[0].replace(/%[a-zA-Z%]/g,match=>{match!=="%%"&&(index++,match==="%c"&&(lastC=index))}),args.splice(lastC,0,c)}__name(formatArgs,"formatArgs");exports2.log=console.debug||console.log||(()=>{});function save(namespaces){try{namespaces?exports2.storage.setItem("debug",namespaces):exports2.storage.removeItem("debug")}catch{}}__name(save,"save");function load(){let r;try{r=exports2.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}__name(load,"load");function localstorage(){try{return localStorage}catch{}}__name(localstorage,"localstorage");module2.exports=require_common3()(exports2);var{formatters}=module2.exports;formatters.j=function(v){try{return JSON.stringify(v)}catch(error){return"[UnexpectedJSONParseError]: "+error.message}}}});var require_node=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/debug/src/node.js"(exports2,module2){var tty=require("tty"),util=require("util");exports2.init=init;exports2.log=log;exports2.formatArgs=formatArgs;exports2.save=save;exports2.load=load;exports2.useColors=useColors;exports2.destroy=util.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");exports2.colors=[6,2,3,4,5,1];try{let supportsColor=require("supports-color");supportsColor&&(supportsColor.stderr||supportsColor).level>=2&&(exports2.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}exports2.inspectOpts=Object.keys(process.env).filter(key=>/^debug_/i.test(key)).reduce((obj,key)=>{let prop=key.substring(6).toLowerCase().replace(/_([a-z])/g,(_,k)=>k.toUpperCase()),val=process.env[key];return/^(yes|on|true|enabled)$/i.test(val)?val=!0:/^(no|off|false|disabled)$/i.test(val)?val=!1:val==="null"?val=null:val=Number(val),obj[prop]=val,obj},{});function useColors(){return"colors"in exports2.inspectOpts?!!exports2.inspectOpts.colors:tty.isatty(process.stderr.fd)}__name(useColors,"useColors");function formatArgs(args){let{namespace:name,useColors:useColors2}=this;if(useColors2){let c=this.color,colorCode="\x1B[3"+(c<8?c:"8;5;"+c),prefix=` ${colorCode};1m${name} \x1B[0m`;args[0]=prefix+args[0].split(` `).join(` `+prefix),args.push(colorCode+"m+"+module2.exports.humanize(this.diff)+"\x1B[0m")}else args[0]=getDate()+name+" "+args[0]}__name(formatArgs,"formatArgs");function getDate(){return exports2.inspectOpts.hideDate?"":new Date().toISOString()+" "}__name(getDate,"getDate");function log(...args){return process.stderr.write(util.formatWithOptions(exports2.inspectOpts,...args)+` `)}__name(log,"log");function save(namespaces){namespaces?process.env.DEBUG=namespaces:delete process.env.DEBUG}__name(save,"save");function load(){return process.env.DEBUG}__name(load,"load");function init(debug){debug.inspectOpts={};let keys=Object.keys(exports2.inspectOpts);for(let i=0;istr.trim()).join(" ")};formatters.O=function(v){return this.inspectOpts.colors=this.useColors,util.inspect(v,this.inspectOpts)}}});var require_src2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/debug/src/index.js"(exports2,module2){typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?module2.exports=require_browser():module2.exports=require_node()}});var require_helpers=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/agent-base/dist/helpers.js"(exports2){"use strict";var __createBinding=exports2&&exports2.__createBinding||(Object.create?function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]}),__setModuleDefault=exports2&&exports2.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports2&&exports2.__importStar||function(mod2){if(mod2&&mod2.__esModule)return mod2;var result={};if(mod2!=null)for(var k in mod2)k!=="default"&&Object.prototype.hasOwnProperty.call(mod2,k)&&__createBinding(result,mod2,k);return __setModuleDefault(result,mod2),result};Object.defineProperty(exports2,"__esModule",{value:!0});exports2.req=exports2.json=exports2.toBuffer=void 0;var http=__importStar(require("http")),https=__importStar(require("https"));async function toBuffer(stream){let length=0,chunks=[];for await(let chunk of stream)length+=chunk.length,chunks.push(chunk);return Buffer.concat(chunks,length)}__name(toBuffer,"toBuffer");exports2.toBuffer=toBuffer;async function json(stream){let str=(await toBuffer(stream)).toString("utf8");try{return JSON.parse(str)}catch(_err){let err=_err;throw err.message+=` (input: ${str})`,err}}__name(json,"json");exports2.json=json;function req(url,opts={}){let req2=((typeof url=="string"?url:url.href).startsWith("https:")?https:http).request(url,opts),promise=new Promise((resolve,reject)=>{req2.once("response",resolve).once("error",reject).end()});return req2.then=promise.then.bind(promise),req2}__name(req,"req");exports2.req=req}});var require_dist=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/agent-base/dist/index.js"(exports2){"use strict";var __createBinding=exports2&&exports2.__createBinding||(Object.create?function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]}),__setModuleDefault=exports2&&exports2.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports2&&exports2.__importStar||function(mod2){if(mod2&&mod2.__esModule)return mod2;var result={};if(mod2!=null)for(var k in mod2)k!=="default"&&Object.prototype.hasOwnProperty.call(mod2,k)&&__createBinding(result,mod2,k);return __setModuleDefault(result,mod2),result},__exportStar=exports2&&exports2.__exportStar||function(m,exports3){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports3,p)&&__createBinding(exports3,m,p)};Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Agent=void 0;var net=__importStar(require("net")),http=__importStar(require("http")),https_1=require("https");__exportStar(require_helpers(),exports2);var INTERNAL=Symbol("AgentBaseInternalState"),Agent=class extends http.Agent{constructor(opts){super(opts),this[INTERNAL]={}}isSecureEndpoint(options){if(options){if(typeof options.secureEndpoint=="boolean")return options.secureEndpoint;if(typeof options.protocol=="string")return options.protocol==="https:"}let{stack}=new Error;return typeof stack!="string"?!1:stack.split(` `).some(l=>l.indexOf("(https.js:")!==-1||l.indexOf("node:https:")!==-1)}incrementSockets(name){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[name]||(this.sockets[name]=[]);let fakeSocket=new net.Socket({writable:!1});return this.sockets[name].push(fakeSocket),this.totalSocketCount++,fakeSocket}decrementSockets(name,socket){if(!this.sockets[name]||socket===null)return;let sockets=this.sockets[name],index=sockets.indexOf(socket);index!==-1&&(sockets.splice(index,1),this.totalSocketCount--,sockets.length===0&&delete this.sockets[name])}getName(options){return(typeof options.secureEndpoint=="boolean"?options.secureEndpoint:this.isSecureEndpoint(options))?https_1.Agent.prototype.getName.call(this,options):super.getName(options)}createSocket(req,options,cb){let connectOpts={...options,secureEndpoint:this.isSecureEndpoint(options)},name=this.getName(connectOpts),fakeSocket=this.incrementSockets(name);Promise.resolve().then(()=>this.connect(req,connectOpts)).then(socket=>{if(this.decrementSockets(name,fakeSocket),socket instanceof http.Agent)return socket.addRequest(req,connectOpts);this[INTERNAL].currentSocket=socket,super.createSocket(req,options,cb)},err=>{this.decrementSockets(name,fakeSocket),cb(err)})}createConnection(){let socket=this[INTERNAL].currentSocket;if(this[INTERNAL].currentSocket=void 0,!socket)throw new Error("No socket was returned in the `connect()` function");return socket}get defaultPort(){return this[INTERNAL].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(v){this[INTERNAL]&&(this[INTERNAL].defaultPort=v)}get protocol(){return this[INTERNAL].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(v){this[INTERNAL]&&(this[INTERNAL].protocol=v)}};__name(Agent,"Agent");exports2.Agent=Agent}});var require_parse_proxy_response=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports2){"use strict";var __importDefault=exports2&&exports2.__importDefault||function(mod2){return mod2&&mod2.__esModule?mod2:{default:mod2}};Object.defineProperty(exports2,"__esModule",{value:!0});exports2.parseProxyResponse=void 0;var debug_1=__importDefault(require_src2()),debug=(0,debug_1.default)("https-proxy-agent:parse-proxy-response");function parseProxyResponse(socket){return new Promise((resolve,reject)=>{let buffersLength=0,buffers=[];function read(){let b=socket.read();b?ondata(b):socket.once("readable",read)}__name(read,"read");function cleanup(){socket.removeListener("end",onend),socket.removeListener("error",onerror),socket.removeListener("readable",read)}__name(cleanup,"cleanup");function onend(){cleanup(),debug("onend"),reject(new Error("Proxy connection ended before receiving CONNECT response"))}__name(onend,"onend");function onerror(err){cleanup(),debug("onerror %o",err),reject(err)}__name(onerror,"onerror");function ondata(b){buffers.push(b),buffersLength+=b.length;let buffered=Buffer.concat(buffers,buffersLength),endOfHeaders=buffered.indexOf(`\r \r `);if(endOfHeaders===-1){debug("have not received end of HTTP headers yet..."),read();return}let headerParts=buffered.slice(0,endOfHeaders).toString("ascii").split(`\r `),firstLine=headerParts.shift();if(!firstLine)return socket.destroy(),reject(new Error("No header received from proxy CONNECT response"));let firstLineParts=firstLine.split(" "),statusCode=+firstLineParts[1],statusText=firstLineParts.slice(2).join(" "),headers={};for(let header of headerParts){if(!header)continue;let firstColon=header.indexOf(":");if(firstColon===-1)return socket.destroy(),reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));let key=header.slice(0,firstColon).toLowerCase(),value=header.slice(firstColon+1).trimStart(),current=headers[key];typeof current=="string"?headers[key]=[current,value]:Array.isArray(current)?current.push(value):headers[key]=value}debug("got proxy server response: %o %o",firstLine,headers),cleanup(),resolve({connect:{statusCode,statusText,headers},buffered})}__name(ondata,"ondata"),socket.on("error",onerror),socket.on("end",onend),read()})}__name(parseProxyResponse,"parseProxyResponse");exports2.parseProxyResponse=parseProxyResponse}});var require_dist2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/https-proxy-agent/dist/index.js"(exports2){"use strict";var __createBinding=exports2&&exports2.__createBinding||(Object.create?function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]}),__setModuleDefault=exports2&&exports2.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports2&&exports2.__importStar||function(mod2){if(mod2&&mod2.__esModule)return mod2;var result={};if(mod2!=null)for(var k in mod2)k!=="default"&&Object.prototype.hasOwnProperty.call(mod2,k)&&__createBinding(result,mod2,k);return __setModuleDefault(result,mod2),result},__importDefault=exports2&&exports2.__importDefault||function(mod2){return mod2&&mod2.__esModule?mod2:{default:mod2}};Object.defineProperty(exports2,"__esModule",{value:!0});exports2.HttpsProxyAgent=void 0;var net=__importStar(require("net")),tls=__importStar(require("tls")),assert_1=__importDefault(require("assert")),debug_1=__importDefault(require_src2()),agent_base_1=require_dist(),url_1=require("url"),parse_proxy_response_1=require_parse_proxy_response(),debug=(0,debug_1.default)("https-proxy-agent"),HttpsProxyAgent=class extends agent_base_1.Agent{constructor(proxy,opts){super(opts),this.options={path:void 0},this.proxy=typeof proxy=="string"?new url_1.URL(proxy):proxy,this.proxyHeaders=opts?.headers??{},debug("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let host=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),port=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...opts?omit(opts,"headers"):null,host,port}}async connect(req,opts){let{proxy}=this;if(!opts.host)throw new TypeError('No "host" provided');let socket;if(proxy.protocol==="https:"){debug("Creating `tls.Socket`: %o",this.connectOpts);let servername=this.connectOpts.servername||this.connectOpts.host;socket=tls.connect({...this.connectOpts,servername:servername&&net.isIP(servername)?void 0:servername})}else debug("Creating `net.Socket`: %o",this.connectOpts),socket=net.connect(this.connectOpts);let headers=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},host=net.isIPv6(opts.host)?`[${opts.host}]`:opts.host,payload=`CONNECT ${host}:${opts.port} HTTP/1.1\r `;if(proxy.username||proxy.password){let auth=`${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;headers["Proxy-Authorization"]=`Basic ${Buffer.from(auth).toString("base64")}`}headers.Host=`${host}:${opts.port}`,headers["Proxy-Connection"]||(headers["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let name of Object.keys(headers))payload+=`${name}: ${headers[name]}\r `;let proxyResponsePromise=(0,parse_proxy_response_1.parseProxyResponse)(socket);socket.write(`${payload}\r `);let{connect,buffered}=await proxyResponsePromise;if(req.emit("proxyConnect",connect),this.emit("proxyConnect",connect,req),connect.statusCode===200){if(req.once("socket",resume),opts.secureEndpoint){debug("Upgrading socket connection to TLS");let servername=opts.servername||opts.host;return tls.connect({...omit(opts,"host","path","port"),socket,servername:net.isIP(servername)?void 0:servername})}return socket}socket.destroy();let fakeSocket=new net.Socket({writable:!1});return fakeSocket.readable=!0,req.once("socket",s=>{debug("Replaying proxy buffer for failed request"),(0,assert_1.default)(s.listenerCount("data")>0),s.push(buffered),s.push(null)}),fakeSocket}};__name(HttpsProxyAgent,"HttpsProxyAgent");HttpsProxyAgent.protocols=["http","https"];exports2.HttpsProxyAgent=HttpsProxyAgent;function resume(socket){socket.resume()}__name(resume,"resume");function omit(obj,...keys){let ret={},key;for(key in obj)keys.includes(key)||(ret[key]=obj[key]);return ret}__name(omit,"omit")}});var require_gaxios=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/gaxios/build/src/gaxios.js"(exports2){"use strict";var __createBinding=exports2&&exports2.__createBinding||(Object.create?function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]}),__setModuleDefault=exports2&&exports2.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports2&&exports2.__importStar||function(mod2){if(mod2&&mod2.__esModule)return mod2;var result={};if(mod2!=null)for(var k in mod2)k!=="default"&&Object.prototype.hasOwnProperty.call(mod2,k)&&__createBinding(result,mod2,k);return __setModuleDefault(result,mod2),result},__classPrivateFieldGet=exports2&&exports2.__classPrivateFieldGet||function(receiver,state,kind,f){if(kind==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof state=="function"?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot read private member from an object whose class did not declare it");return kind==="m"?f:kind==="a"?f.call(receiver):f?f.value:state.get(receiver)},__classPrivateFieldSet=exports2&&exports2.__classPrivateFieldSet||function(receiver,state,value,kind,f){if(kind==="m")throw new TypeError("Private method is not writable");if(kind==="a"&&!f)throw new TypeError("Private accessor was defined without a setter");if(typeof state=="function"?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot write private member to an object whose class did not declare it");return kind==="a"?f.call(receiver,value):f?f.value=value:state.set(receiver,value),value},__importDefault=exports2&&exports2.__importDefault||function(mod2){return mod2&&mod2.__esModule?mod2:{default:mod2}},_Gaxios_instances,_a,_Gaxios_urlMayUseProxy,_Gaxios_applyRequestInterceptors,_Gaxios_applyResponseInterceptors,_Gaxios_prepareRequest,_Gaxios_proxyAgent,_Gaxios_getProxyAgent;Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Gaxios=void 0;var extend_1=__importDefault(require_extend()),https_1=require("https"),node_fetch_1=__importDefault(require_lib2()),querystring_1=__importDefault(require("querystring")),is_stream_1=__importDefault(require_is_stream()),url_1=require("url"),common_1=require_common2(),retry_1=require_retry(),stream_1=require("stream"),uuid_1=(init_esm_node(),__toCommonJS(esm_node_exports)),interceptor_1=require_interceptor(),fetch=hasFetch()?window.fetch:node_fetch_1.default;function hasWindow(){return typeof window<"u"&&!!window}__name(hasWindow,"hasWindow");function hasFetch(){return hasWindow()&&!!window.fetch}__name(hasFetch,"hasFetch");function hasBuffer(){return typeof Buffer<"u"}__name(hasBuffer,"hasBuffer");function hasHeader(options,header){return!!getHeader(options,header)}__name(hasHeader,"hasHeader");function getHeader(options,header){header=header.toLowerCase();for(let key of Object.keys(options?.headers||{}))if(header===key.toLowerCase())return options.headers[key]}__name(getHeader,"getHeader");var Gaxios=class{constructor(defaults){_Gaxios_instances.add(this),this.agentCache=new Map,this.defaults=defaults||{},this.interceptors={request:new interceptor_1.GaxiosInterceptorManager,response:new interceptor_1.GaxiosInterceptorManager}}async request(opts={}){return opts=await __classPrivateFieldGet(this,_Gaxios_instances,"m",_Gaxios_prepareRequest).call(this,opts),opts=await __classPrivateFieldGet(this,_Gaxios_instances,"m",_Gaxios_applyRequestInterceptors).call(this,opts),__classPrivateFieldGet(this,_Gaxios_instances,"m",_Gaxios_applyResponseInterceptors).call(this,this._request(opts))}async _defaultAdapter(opts){let res=await(opts.fetchImplementation||fetch)(opts.url,opts),data=await this.getResponseData(opts,res);return this.translateResponse(opts,res,data)}async _request(opts={}){var _b;try{let translatedResponse;if(opts.adapter?translatedResponse=await opts.adapter(opts,this._defaultAdapter.bind(this)):translatedResponse=await this._defaultAdapter(opts),!opts.validateStatus(translatedResponse.status)){if(opts.responseType==="stream"){let response="";await new Promise(resolve=>{(translatedResponse?.data).on("data",chunk=>{response+=chunk}),(translatedResponse?.data).on("end",resolve)}),translatedResponse.data=response}throw new common_1.GaxiosError(`Request failed with status code ${translatedResponse.status}`,opts,translatedResponse)}return translatedResponse}catch(e){let err=e instanceof common_1.GaxiosError?e:new common_1.GaxiosError(e.message,opts,void 0,e),{shouldRetry,config}=await(0,retry_1.getRetryConfig)(err);if(shouldRetry&&config)return err.config.retryConfig.currentRetryAttempt=config.retryConfig.currentRetryAttempt,opts.retryConfig=(_b=err.config)===null||_b===void 0?void 0:_b.retryConfig,this._request(opts);throw err}}async getResponseData(opts,res){switch(opts.responseType){case"stream":return res.body;case"json":{let data=await res.text();try{data=JSON.parse(data)}catch{}return data}case"arraybuffer":return res.arrayBuffer();case"blob":return res.blob();case"text":return res.text();default:return this.getResponseDataFromContentType(res)}}validateStatus(status){return status>=200&&status<300}paramsSerializer(params){return querystring_1.default.stringify(params)}translateResponse(opts,res,data){let headers={};return res.headers.forEach((value,key)=>{headers[key]=value}),{config:opts,data,headers,status:res.status,statusText:res.statusText,request:{responseURL:res.url}}}async getResponseDataFromContentType(response){let contentType=response.headers.get("Content-Type");if(contentType===null)return response.text();if(contentType=contentType.toLowerCase(),contentType.includes("application/json")){let data=await response.text();try{data=JSON.parse(data)}catch{}return data}else return contentType.match(/^text\//)?response.text():response.blob()}async*getMultipartRequest(multipartOptions,boundary){let finale=`--${boundary}--`;for(let currentPart of multipartOptions){let partContentType=currentPart.headers["Content-Type"]||"application/octet-stream";yield`--${boundary}\r Content-Type: ${partContentType}\r \r `,typeof currentPart.content=="string"?yield currentPart.content:yield*currentPart.content,yield`\r `}yield finale}};__name(Gaxios,"Gaxios");exports2.Gaxios=Gaxios;_a=Gaxios,_Gaxios_instances=new WeakSet,_Gaxios_urlMayUseProxy=__name(function(url,noProxy=[]){var _b,_c;let candidate=new url_1.URL(url),noProxyList=[...noProxy],noProxyEnvList=((_c=(_b=process.env.NO_PROXY)!==null&&_b!==void 0?_b:process.env.no_proxy)===null||_c===void 0?void 0:_c.split(","))||[];for(let rule of noProxyEnvList)noProxyList.push(rule.trim());for(let rule of noProxyList)if(rule instanceof RegExp){if(rule.test(candidate.toString()))return!1}else if(rule instanceof url_1.URL){if(rule.origin===candidate.origin)return!1}else if(rule.startsWith("*.")||rule.startsWith(".")){let cleanedRule=rule.replace(/^\*\./,".");if(candidate.hostname.endsWith(cleanedRule))return!1}else if(rule===candidate.origin||rule===candidate.hostname||rule===candidate.href)return!1;return!0},"_Gaxios_urlMayUseProxy"),_Gaxios_applyRequestInterceptors=__name(async function(options){let promiseChain=Promise.resolve(options);for(let interceptor of this.interceptors.request.values())interceptor&&(promiseChain=promiseChain.then(interceptor.resolved,interceptor.rejected));return promiseChain},"_Gaxios_applyRequestInterceptors"),_Gaxios_applyResponseInterceptors=__name(async function(response){let promiseChain=Promise.resolve(response);for(let interceptor of this.interceptors.response.values())interceptor&&(promiseChain=promiseChain.then(interceptor.resolved,interceptor.rejected));return promiseChain},"_Gaxios_applyResponseInterceptors"),_Gaxios_prepareRequest=__name(async function(options){var _b,_c,_d,_e;let opts=(0,extend_1.default)(!0,{},this.defaults,options);if(!opts.url)throw new Error("URL is required.");let baseUrl=opts.baseUrl||opts.baseURL;if(baseUrl&&(opts.url=baseUrl.toString()+opts.url),opts.paramsSerializer=opts.paramsSerializer||this.paramsSerializer,opts.params&&Object.keys(opts.params).length>0){let additionalQueryParams=opts.paramsSerializer(opts.params);additionalQueryParams.startsWith("?")&&(additionalQueryParams=additionalQueryParams.slice(1));let prefix=opts.url.toString().includes("?")?"&":"?";opts.url=opts.url+prefix+additionalQueryParams}if(typeof options.maxContentLength=="number"&&(opts.size=options.maxContentLength),typeof options.maxRedirects=="number"&&(opts.follow=options.maxRedirects),opts.headers=opts.headers||{},opts.multipart===void 0&&opts.data){let isFormData=typeof FormData>"u"?!1:opts?.data instanceof FormData;is_stream_1.default.readable(opts.data)?opts.body=opts.data:hasBuffer()&&Buffer.isBuffer(opts.data)?(opts.body=opts.data,hasHeader(opts,"Content-Type")||(opts.headers["Content-Type"]="application/json")):typeof opts.data=="object"?isFormData||(getHeader(opts,"content-type")==="application/x-www-form-urlencoded"?opts.body=opts.paramsSerializer(opts.data):(hasHeader(opts,"Content-Type")||(opts.headers["Content-Type"]="application/json"),opts.body=JSON.stringify(opts.data))):opts.body=opts.data}else if(opts.multipart&&opts.multipart.length>0){let boundary=(0,uuid_1.v4)();opts.headers["Content-Type"]=`multipart/related; boundary=${boundary}`;let bodyStream=new stream_1.PassThrough;opts.body=bodyStream,(0,stream_1.pipeline)(this.getMultipartRequest(opts.multipart,boundary),bodyStream,()=>{})}opts.validateStatus=opts.validateStatus||this.validateStatus,opts.responseType=opts.responseType||"unknown",!opts.headers.Accept&&opts.responseType==="json"&&(opts.headers.Accept="application/json"),opts.method=opts.method||"GET";let proxy=opts.proxy||((_b=process==null?void 0:process.env)===null||_b===void 0?void 0:_b.HTTPS_PROXY)||((_c=process==null?void 0:process.env)===null||_c===void 0?void 0:_c.https_proxy)||((_d=process==null?void 0:process.env)===null||_d===void 0?void 0:_d.HTTP_PROXY)||((_e=process==null?void 0:process.env)===null||_e===void 0?void 0:_e.http_proxy),urlMayUseProxy=__classPrivateFieldGet(this,_Gaxios_instances,"m",_Gaxios_urlMayUseProxy).call(this,opts.url,opts.noProxy);if(!opts.agent)if(proxy&&urlMayUseProxy){let HttpsProxyAgent=await __classPrivateFieldGet(_a,_a,"m",_Gaxios_getProxyAgent).call(_a);this.agentCache.has(proxy)?opts.agent=this.agentCache.get(proxy):(opts.agent=new HttpsProxyAgent(proxy,{cert:opts.cert,key:opts.key}),this.agentCache.set(proxy,opts.agent))}else opts.cert&&opts.key&&(this.agentCache.has(opts.key)?opts.agent=this.agentCache.get(opts.key):(opts.agent=new https_1.Agent({cert:opts.cert,key:opts.key}),this.agentCache.set(opts.key,opts.agent)));return typeof opts.errorRedactor!="function"&&opts.errorRedactor!==!1&&(opts.errorRedactor=common_1.defaultErrorRedactor),opts},"_Gaxios_prepareRequest"),_Gaxios_getProxyAgent=__name(async function(){return __classPrivateFieldSet(this,_a,__classPrivateFieldGet(this,_a,"f",_Gaxios_proxyAgent)||(await Promise.resolve().then(()=>__importStar(require_dist2()))).HttpsProxyAgent,"f",_Gaxios_proxyAgent),__classPrivateFieldGet(this,_a,"f",_Gaxios_proxyAgent)},"_Gaxios_getProxyAgent");_Gaxios_proxyAgent={value:void 0}}});var require_src3=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/gaxios/build/src/index.js"(exports2){"use strict";var __createBinding=exports2&&exports2.__createBinding||(Object.create?function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]}),__exportStar=exports2&&exports2.__exportStar||function(m,exports3){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports3,p)&&__createBinding(exports3,m,p)};Object.defineProperty(exports2,"__esModule",{value:!0});exports2.request=exports2.instance=exports2.Gaxios=exports2.GaxiosError=void 0;var gaxios_1=require_gaxios();Object.defineProperty(exports2,"Gaxios",{enumerable:!0,get:function(){return gaxios_1.Gaxios}});var common_1=require_common2();Object.defineProperty(exports2,"GaxiosError",{enumerable:!0,get:function(){return common_1.GaxiosError}});__exportStar(require_interceptor(),exports2);exports2.instance=new gaxios_1.Gaxios;async function request(opts){return exports2.instance.request(opts)}__name(request,"request");exports2.request=request}});var require_bignumber=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/bignumber.js/bignumber.js"(exports2,module2){(function(globalObject){"use strict";var BigNumber,isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(configObject){var div,convertBase,parseNumeric,P=BigNumber2.prototype={constructor:BigNumber2,toString:null,valueOf:null},ONE=new BigNumber2(1),DECIMAL_PLACES=20,ROUNDING_MODE=4,TO_EXP_NEG=-7,TO_EXP_POS=21,MIN_EXP=-1e7,MAX_EXP=1e7,CRYPTO=!1,MODULO_MODE=1,POW_PRECISION=0,FORMAT={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ALPHABET="0123456789abcdefghijklmnopqrstuvwxyz",alphabetHasNormalDecimalDigits=!0;function BigNumber2(v,b){var alphabet,c,caseChanged,e,i,isNum,len,str,x=this;if(!(x instanceof BigNumber2))return new BigNumber2(v,b);if(b==null){if(v&&v._isBigNumber===!0){x.s=v.s,!v.c||v.e>MAX_EXP?x.c=x.e=null:v.e=10;i/=10,e++);e>MAX_EXP?x.c=x.e=null:(x.e=e,x.c=[v]);return}str=String(v)}else{if(!isNumeric.test(str=String(v)))return parseNumeric(x,str,isNum);x.s=str.charCodeAt(0)==45?(str=str.slice(1),-1):1}(e=str.indexOf("."))>-1&&(str=str.replace(".","")),(i=str.search(/e/i))>0?(e<0&&(e=i),e+=+str.slice(i+1),str=str.substring(0,i)):e<0&&(e=str.length)}else{if(intCheck(b,2,ALPHABET.length,"Base"),b==10&&alphabetHasNormalDecimalDigits)return x=new BigNumber2(v),round(x,DECIMAL_PLACES+x.e+1,ROUNDING_MODE);if(str=String(v),isNum=typeof v=="number"){if(v*0!=0)return parseNumeric(x,str,isNum,b);if(x.s=1/v<0?(str=str.slice(1),-1):1,BigNumber2.DEBUG&&str.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+v)}else x.s=str.charCodeAt(0)===45?(str=str.slice(1),-1):1;for(alphabet=ALPHABET.slice(0,b),e=i=0,len=str.length;ie){e=len;continue}}else if(!caseChanged&&(str==str.toUpperCase()&&(str=str.toLowerCase())||str==str.toLowerCase()&&(str=str.toUpperCase()))){caseChanged=!0,i=-1,e=0;continue}return parseNumeric(x,String(v),isNum,b)}isNum=!1,str=convertBase(str,b,10,x.s),(e=str.indexOf("."))>-1?str=str.replace(".",""):e=str.length}for(i=0;str.charCodeAt(i)===48;i++);for(len=str.length;str.charCodeAt(--len)===48;);if(str=str.slice(i,++len)){if(len-=i,isNum&&BigNumber2.DEBUG&&len>15&&(v>MAX_SAFE_INTEGER||v!==mathfloor(v)))throw Error(tooManyDigits+x.s*v);if((e=e-i-1)>MAX_EXP)x.c=x.e=null;else if(e=-MAX&&e<=MAX&&e===mathfloor(e)){if(c[0]===0){if(e===0&&c.length===1)return!0;break out}if(i=(e+1)%LOG_BASE,i<1&&(i+=LOG_BASE),String(c[0]).length==i){for(i=0;i=BASE||n!==mathfloor(n))break out;if(n!==0)return!0}}}else if(c===null&&e===null&&(s===null||s===1||s===-1))return!0;throw Error(bignumberError+"Invalid BigNumber: "+v)},BigNumber2.maximum=BigNumber2.max=function(){return maxOrMin(arguments,-1)},BigNumber2.minimum=BigNumber2.min=function(){return maxOrMin(arguments,1)},BigNumber2.random=function(){var pow2_53=9007199254740992,random53bitInt=Math.random()*pow2_53&2097151?function(){return mathfloor(Math.random()*pow2_53)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(dp){var a,b,e,k,v,i=0,c=[],rand=new BigNumber2(ONE);if(dp==null?dp=DECIMAL_PLACES:intCheck(dp,0,MAX),k=mathceil(dp/LOG_BASE),CRYPTO)if(crypto.getRandomValues){for(a=crypto.getRandomValues(new Uint32Array(k*=2));i>>11),v>=9e15?(b=crypto.getRandomValues(new Uint32Array(2)),a[i]=b[0],a[i+1]=b[1]):(c.push(v%1e14),i+=2);i=k/2}else if(crypto.randomBytes){for(a=crypto.randomBytes(k*=7);i=9e15?crypto.randomBytes(7).copy(a,i):(c.push(v%1e14),i+=7);i=k/7}else throw CRYPTO=!1,Error(bignumberError+"crypto unavailable");if(!CRYPTO)for(;i=10;v/=10,i++);ibaseOut-1&&(arr[j+1]==null&&(arr[j+1]=0),arr[j+1]+=arr[j]/baseOut|0,arr[j]%=baseOut)}return arr.reverse()}return __name(toBaseOut,"toBaseOut"),function(str,baseIn,baseOut,sign,callerIsToString){var alphabet,d,e,k,r,x,xc,y,i=str.indexOf("."),dp=DECIMAL_PLACES,rm=ROUNDING_MODE;for(i>=0&&(k=POW_PRECISION,POW_PRECISION=0,str=str.replace(".",""),y=new BigNumber2(baseIn),x=y.pow(str.length-i),POW_PRECISION=k,y.c=toBaseOut(toFixedPoint(coeffToString(x.c),x.e,"0"),10,baseOut,decimal),y.e=y.c.length),xc=toBaseOut(str,baseIn,baseOut,callerIsToString?(alphabet=ALPHABET,decimal):(alphabet=decimal,ALPHABET)),e=k=xc.length;xc[--k]==0;xc.pop());if(!xc[0])return alphabet.charAt(0);if(i<0?--e:(x.c=xc,x.e=e,x.s=sign,x=div(x,y,dp,rm,baseOut),xc=x.c,r=x.r,e=x.e),d=e+dp+1,i=xc[d],k=baseOut/2,r=r||d<0||xc[d+1]!=null,r=rm<4?(i!=null||r)&&(rm==0||rm==(x.s<0?3:2)):i>k||i==k&&(rm==4||r||rm==6&&xc[d-1]&1||rm==(x.s<0?8:7)),d<1||!xc[0])str=r?toFixedPoint(alphabet.charAt(1),-dp,alphabet.charAt(0)):alphabet.charAt(0);else{if(xc.length=d,r)for(--baseOut;++xc[--d]>baseOut;)xc[d]=0,d||(++e,xc=[1].concat(xc));for(k=xc.length;!xc[--k];);for(i=0,str="";i<=k;str+=alphabet.charAt(xc[i++]));str=toFixedPoint(str,e,alphabet.charAt(0))}return str}}(),div=function(){function multiply(x,k,base){var m,temp,xlo,xhi,carry=0,i=x.length,klo=k%SQRT_BASE,khi=k/SQRT_BASE|0;for(x=x.slice();i--;)xlo=x[i]%SQRT_BASE,xhi=x[i]/SQRT_BASE|0,m=khi*xlo+xhi*klo,temp=klo*xlo+m%SQRT_BASE*SQRT_BASE+carry,carry=(temp/base|0)+(m/SQRT_BASE|0)+khi*xhi,x[i]=temp%base;return carry&&(x=[carry].concat(x)),x}__name(multiply,"multiply");function compare2(a,b,aL,bL){var i,cmp;if(aL!=bL)cmp=aL>bL?1:-1;else for(i=cmp=0;ib[i]?1:-1;break}return cmp}__name(compare2,"compare");function subtract(a,b,aL,base){for(var i=0;aL--;)a[aL]-=i,i=a[aL]1;a.splice(0,1));}return __name(subtract,"subtract"),function(x,y,dp,rm,base){var cmp,e,i,more,n,prod,prodL,q,qc,rem,remL,rem0,xi,xL,yc0,yL,yz,s=x.s==y.s?1:-1,xc=x.c,yc=y.c;if(!xc||!xc[0]||!yc||!yc[0])return new BigNumber2(!x.s||!y.s||(xc?yc&&xc[0]==yc[0]:!yc)?NaN:xc&&xc[0]==0||!yc?s*0:s/0);for(q=new BigNumber2(s),qc=q.c=[],e=x.e-y.e,s=dp+e+1,base||(base=BASE,e=bitFloor(x.e/LOG_BASE)-bitFloor(y.e/LOG_BASE),s=s/LOG_BASE|0),i=0;yc[i]==(xc[i]||0);i++);if(yc[i]>(xc[i]||0)&&e--,s<0)qc.push(1),more=!0;else{for(xL=xc.length,yL=yc.length,i=0,s+=2,n=mathfloor(base/(yc[0]+1)),n>1&&(yc=multiply(yc,n,base),xc=multiply(xc,n,base),yL=yc.length,xL=xc.length),xi=yL,rem=xc.slice(0,yL),remL=rem.length;remL=base/2&&yc0++;do{if(n=0,cmp=compare2(yc,rem,yL,remL),cmp<0){if(rem0=rem[0],yL!=remL&&(rem0=rem0*base+(rem[1]||0)),n=mathfloor(rem0/yc0),n>1)for(n>=base&&(n=base-1),prod=multiply(yc,n,base),prodL=prod.length,remL=rem.length;compare2(prod,rem,prodL,remL)==1;)n--,subtract(prod,yL=10;s/=10,i++);round(q,dp+(q.e=i+e*LOG_BASE-1)+1,rm,more)}else q.e=e,q.r=+more;return q}}();function format(n,i,rm,id){var c0,e,ne,len,str;if(rm==null?rm=ROUNDING_MODE:intCheck(rm,0,8),!n.c)return n.toString();if(c0=n.c[0],ne=n.e,i==null)str=coeffToString(n.c),str=id==1||id==2&&(ne<=TO_EXP_NEG||ne>=TO_EXP_POS)?toExponential(str,ne):toFixedPoint(str,ne,"0");else if(n=round(new BigNumber2(n),i,rm),e=n.e,str=coeffToString(n.c),len=str.length,id==1||id==2&&(i<=e||e<=TO_EXP_NEG)){for(;lenlen){if(--i>0)for(str+=".";i--;str+="0");}else if(i+=e-len,i>0)for(e+1==len&&(str+=".");i--;str+="0");return n.s<0&&c0?"-"+str:str}__name(format,"format");function maxOrMin(args,n){for(var k,y,i=1,x=new BigNumber2(args[0]);i=10;j/=10,i++);return(e=i+e*LOG_BASE-1)>MAX_EXP?n.c=n.e=null:e=10;k/=10,d++);if(i=sd-d,i<0)i+=LOG_BASE,j=sd,n=xc[ni=0],rd=mathfloor(n/pows10[d-j-1]%10);else if(ni=mathceil((i+1)/LOG_BASE),ni>=xc.length)if(r){for(;xc.length<=ni;xc.push(0));n=rd=0,d=1,i%=LOG_BASE,j=i-LOG_BASE+1}else break out;else{for(n=k=xc[ni],d=1;k>=10;k/=10,d++);i%=LOG_BASE,j=i-LOG_BASE+d,rd=j<0?0:mathfloor(n/pows10[d-j-1]%10)}if(r=r||sd<0||xc[ni+1]!=null||(j<0?n:n%pows10[d-j-1]),r=rm<4?(rd||r)&&(rm==0||rm==(x.s<0?3:2)):rd>5||rd==5&&(rm==4||r||rm==6&&(i>0?j>0?n/pows10[d-j]:0:xc[ni-1])%10&1||rm==(x.s<0?8:7)),sd<1||!xc[0])return xc.length=0,r?(sd-=x.e+1,xc[0]=pows10[(LOG_BASE-sd%LOG_BASE)%LOG_BASE],x.e=-sd||0):xc[0]=x.e=0,x;if(i==0?(xc.length=ni,k=1,ni--):(xc.length=ni+1,k=pows10[LOG_BASE-i],xc[ni]=j>0?mathfloor(n/pows10[d-j]%pows10[j])*k:0),r)for(;;)if(ni==0){for(i=1,j=xc[0];j>=10;j/=10,i++);for(j=xc[0]+=k,k=1;j>=10;j/=10,k++);i!=k&&(x.e++,xc[0]==BASE&&(xc[0]=1));break}else{if(xc[ni]+=k,xc[ni]!=BASE)break;xc[ni--]=0,k=1}for(i=xc.length;xc[--i]===0;xc.pop());}x.e>MAX_EXP?x.c=x.e=null:x.e=TO_EXP_POS?toExponential(str,e):toFixedPoint(str,e,"0"),n.s<0?"-"+str:str)}return __name(valueOf,"valueOf"),P.absoluteValue=P.abs=function(){var x=new BigNumber2(this);return x.s<0&&(x.s=1),x},P.comparedTo=function(y,b){return compare(this,new BigNumber2(y,b))},P.decimalPlaces=P.dp=function(dp,rm){var c,n,v,x=this;if(dp!=null)return intCheck(dp,0,MAX),rm==null?rm=ROUNDING_MODE:intCheck(rm,0,8),round(new BigNumber2(x),dp+x.e+1,rm);if(!(c=x.c))return null;if(n=((v=c.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,v=c[v])for(;v%10==0;v/=10,n--);return n<0&&(n=0),n},P.dividedBy=P.div=function(y,b){return div(this,new BigNumber2(y,b),DECIMAL_PLACES,ROUNDING_MODE)},P.dividedToIntegerBy=P.idiv=function(y,b){return div(this,new BigNumber2(y,b),0,1)},P.exponentiatedBy=P.pow=function(n,m){var half,isModExp,i,k,more,nIsBig,nIsNeg,nIsOdd,y,x=this;if(n=new BigNumber2(n),n.c&&!n.isInteger())throw Error(bignumberError+"Exponent not an integer: "+valueOf(n));if(m!=null&&(m=new BigNumber2(m)),nIsBig=n.e>14,!x.c||!x.c[0]||x.c[0]==1&&!x.e&&x.c.length==1||!n.c||!n.c[0])return y=new BigNumber2(Math.pow(+valueOf(x),nIsBig?n.s*(2-isOdd(n)):+valueOf(n))),m?y.mod(m):y;if(nIsNeg=n.s<0,m){if(m.c?!m.c[0]:!m.s)return new BigNumber2(NaN);isModExp=!nIsNeg&&x.isInteger()&&m.isInteger(),isModExp&&(x=x.mod(m))}else{if(n.e>9&&(x.e>0||x.e<-1||(x.e==0?x.c[0]>1||nIsBig&&x.c[1]>=24e7:x.c[0]<8e13||nIsBig&&x.c[0]<=9999975e7)))return k=x.s<0&&isOdd(n)?-0:0,x.e>-1&&(k=1/k),new BigNumber2(nIsNeg?1/k:k);POW_PRECISION&&(k=mathceil(POW_PRECISION/LOG_BASE+2))}for(nIsBig?(half=new BigNumber2(.5),nIsNeg&&(n.s=1),nIsOdd=isOdd(n)):(i=Math.abs(+valueOf(n)),nIsOdd=i%2),y=new BigNumber2(ONE);;){if(nIsOdd){if(y=y.times(x),!y.c)break;k?y.c.length>k&&(y.c.length=k):isModExp&&(y=y.mod(m))}if(i){if(i=mathfloor(i/2),i===0)break;nIsOdd=i%2}else if(n=n.times(half),round(n,n.e+1,1),n.e>14)nIsOdd=isOdd(n);else{if(i=+valueOf(n),i===0)break;nIsOdd=i%2}x=x.times(x),k?x.c&&x.c.length>k&&(x.c.length=k):isModExp&&(x=x.mod(m))}return isModExp?y:(nIsNeg&&(y=ONE.div(y)),m?y.mod(m):k?round(y,POW_PRECISION,ROUNDING_MODE,more):y)},P.integerValue=function(rm){var n=new BigNumber2(this);return rm==null?rm=ROUNDING_MODE:intCheck(rm,0,8),round(n,n.e+1,rm)},P.isEqualTo=P.eq=function(y,b){return compare(this,new BigNumber2(y,b))===0},P.isFinite=function(){return!!this.c},P.isGreaterThan=P.gt=function(y,b){return compare(this,new BigNumber2(y,b))>0},P.isGreaterThanOrEqualTo=P.gte=function(y,b){return(b=compare(this,new BigNumber2(y,b)))===1||b===0},P.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},P.isLessThan=P.lt=function(y,b){return compare(this,new BigNumber2(y,b))<0},P.isLessThanOrEqualTo=P.lte=function(y,b){return(b=compare(this,new BigNumber2(y,b)))===-1||b===0},P.isNaN=function(){return!this.s},P.isNegative=function(){return this.s<0},P.isPositive=function(){return this.s>0},P.isZero=function(){return!!this.c&&this.c[0]==0},P.minus=function(y,b){var i,j,t,xLTy,x=this,a=x.s;if(y=new BigNumber2(y,b),b=y.s,!a||!b)return new BigNumber2(NaN);if(a!=b)return y.s=-b,x.plus(y);var xe=x.e/LOG_BASE,ye=y.e/LOG_BASE,xc=x.c,yc=y.c;if(!xe||!ye){if(!xc||!yc)return xc?(y.s=-b,y):new BigNumber2(yc?x:NaN);if(!xc[0]||!yc[0])return yc[0]?(y.s=-b,y):new BigNumber2(xc[0]?x:ROUNDING_MODE==3?-0:0)}if(xe=bitFloor(xe),ye=bitFloor(ye),xc=xc.slice(),a=xe-ye){for((xLTy=a<0)?(a=-a,t=xc):(ye=xe,t=yc),t.reverse(),b=a;b--;t.push(0));t.reverse()}else for(j=(xLTy=(a=xc.length)<(b=yc.length))?a:b,a=b=0;b0)for(;b--;xc[i++]=0);for(b=BASE-1;j>a;){if(xc[--j]=0;){for(c=0,ylo=yc[i]%sqrtBase,yhi=yc[i]/sqrtBase|0,k=xcL,j=i+k;j>i;)xlo=xc[--k]%sqrtBase,xhi=xc[k]/sqrtBase|0,m=yhi*xlo+xhi*ylo,xlo=ylo*xlo+m%sqrtBase*sqrtBase+zc[j]+c,c=(xlo/base|0)+(m/sqrtBase|0)+yhi*xhi,zc[j--]=xlo%base;zc[j]=c}return c?++e:zc.splice(0,1),normalise(y,zc,e)},P.negated=function(){var x=new BigNumber2(this);return x.s=-x.s||null,x},P.plus=function(y,b){var t,x=this,a=x.s;if(y=new BigNumber2(y,b),b=y.s,!a||!b)return new BigNumber2(NaN);if(a!=b)return y.s=-b,x.minus(y);var xe=x.e/LOG_BASE,ye=y.e/LOG_BASE,xc=x.c,yc=y.c;if(!xe||!ye){if(!xc||!yc)return new BigNumber2(a/0);if(!xc[0]||!yc[0])return yc[0]?y:new BigNumber2(xc[0]?x:a*0)}if(xe=bitFloor(xe),ye=bitFloor(ye),xc=xc.slice(),a=xe-ye){for(a>0?(ye=xe,t=yc):(a=-a,t=xc),t.reverse();a--;t.push(0));t.reverse()}for(a=xc.length,b=yc.length,a-b<0&&(t=yc,yc=xc,xc=t,b=a),a=0;b;)a=(xc[--b]=xc[b]+yc[b]+a)/BASE|0,xc[b]=BASE===xc[b]?0:xc[b]%BASE;return a&&(xc=[a].concat(xc),++ye),normalise(y,xc,ye)},P.precision=P.sd=function(sd,rm){var c,n,v,x=this;if(sd!=null&&sd!==!!sd)return intCheck(sd,1,MAX),rm==null?rm=ROUNDING_MODE:intCheck(rm,0,8),round(new BigNumber2(x),sd,rm);if(!(c=x.c))return null;if(v=c.length-1,n=v*LOG_BASE+1,v=c[v]){for(;v%10==0;v/=10,n--);for(v=c[0];v>=10;v/=10,n++);}return sd&&x.e+1>n&&(n=x.e+1),n},P.shiftedBy=function(k){return intCheck(k,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+k)},P.squareRoot=P.sqrt=function(){var m,n,r,rep,t,x=this,c=x.c,s=x.s,e=x.e,dp=DECIMAL_PLACES+4,half=new BigNumber2("0.5");if(s!==1||!c||!c[0])return new BigNumber2(!s||s<0&&(!c||c[0])?NaN:c?x:1/0);if(s=Math.sqrt(+valueOf(x)),s==0||s==1/0?(n=coeffToString(c),(n.length+e)%2==0&&(n+="0"),s=Math.sqrt(+n),e=bitFloor((e+1)/2)-(e<0||e%2),s==1/0?n="5e"+e:(n=s.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),r=new BigNumber2(n)):r=new BigNumber2(s+""),r.c[0]){for(e=r.e,s=e+dp,s<3&&(s=0);;)if(t=r,r=half.times(t.plus(div(x,t,dp,1))),coeffToString(t.c).slice(0,s)===(n=coeffToString(r.c)).slice(0,s))if(r.e0&&len>0){for(i=len%g1||g1,intPart=intDigits.substr(0,i);i0&&(intPart+=groupSeparator+intDigits.slice(i)),isNeg&&(intPart="-"+intPart)}str=fractionPart?intPart+(format2.decimalSeparator||"")+((g2=+format2.fractionGroupSize)?fractionPart.replace(new RegExp("\\d{"+g2+"}\\B","g"),"$&"+(format2.fractionGroupSeparator||"")):fractionPart):intPart}return(format2.prefix||"")+str+(format2.suffix||"")},P.toFraction=function(md){var d,d0,d1,d2,e,exp,n,n0,n1,q,r,s,x=this,xc=x.c;if(md!=null&&(n=new BigNumber2(md),!n.isInteger()&&(n.c||n.s!==1)||n.lt(ONE)))throw Error(bignumberError+"Argument "+(n.isInteger()?"out of range: ":"not an integer: ")+valueOf(n));if(!xc)return new BigNumber2(x);for(d=new BigNumber2(ONE),n1=d0=new BigNumber2(ONE),d1=n0=new BigNumber2(ONE),s=coeffToString(xc),e=d.e=s.length-x.e-1,d.c[0]=POWS_TEN[(exp=e%LOG_BASE)<0?LOG_BASE+exp:exp],md=!md||n.comparedTo(d)>0?e>0?d:n1:n,exp=MAX_EXP,MAX_EXP=1/0,n=new BigNumber2(s),n0.c[0]=0;q=div(n,d,0,1),d2=d0.plus(q.times(d1)),d2.comparedTo(md)!=1;)d0=d1,d1=d2,n1=n0.plus(q.times(d2=n1)),n0=d2,d=n.minus(q.times(d2=d)),n=d2;return d2=div(md.minus(d0),d1,0,1),n0=n0.plus(d2.times(n1)),d0=d0.plus(d2.times(d1)),n0.s=n1.s=x.s,e=e*2,r=div(n1,d1,e,ROUNDING_MODE).minus(x).abs().comparedTo(div(n0,d0,e,ROUNDING_MODE).minus(x).abs())<1?[n1,d1]:[n0,d0],MAX_EXP=exp,r},P.toNumber=function(){return+valueOf(this)},P.toPrecision=function(sd,rm){return sd!=null&&intCheck(sd,1,MAX),format(this,sd,rm,2)},P.toString=function(b){var str,n=this,s=n.s,e=n.e;return e===null?s?(str="Infinity",s<0&&(str="-"+str)):str="NaN":(b==null?str=e<=TO_EXP_NEG||e>=TO_EXP_POS?toExponential(coeffToString(n.c),e):toFixedPoint(coeffToString(n.c),e,"0"):b===10&&alphabetHasNormalDecimalDigits?(n=round(new BigNumber2(n),DECIMAL_PLACES+e+1,ROUNDING_MODE),str=toFixedPoint(coeffToString(n.c),n.e,"0")):(intCheck(b,2,ALPHABET.length,"Base"),str=convertBase(toFixedPoint(coeffToString(n.c),e,"0"),10,b,s,!0)),s<0&&n.c[0]&&(str="-"+str)),str},P.valueOf=P.toJSON=function(){return valueOf(this)},P._isBigNumber=!0,configObject!=null&&BigNumber2.set(configObject),BigNumber2}__name(clone,"clone");function bitFloor(n){var i=n|0;return n>0||n===i?i:i-1}__name(bitFloor,"bitFloor");function coeffToString(a){for(var s,z,i=1,j=a.length,r=a[0]+"";il^a?1:-1;for(j=(k=xc.length)<(l=yc.length)?k:l,i=0;iyc[i]^a?1:-1;return k==l?0:k>l^a?1:-1}__name(compare,"compare");function intCheck(n,min,max,name){if(nmax||n!==mathfloor(n))throw Error(bignumberError+(name||"Argument")+(typeof n=="number"?nmax?" out of range: ":" not an integer: ":" not a primitive number: ")+String(n))}__name(intCheck,"intCheck");function isOdd(n){var k=n.c.length-1;return bitFloor(n.e/LOG_BASE)==k&&n.c[k]%2!=0}__name(isOdd,"isOdd");function toExponential(str,e){return(str.length>1?str.charAt(0)+"."+str.slice(1):str)+(e<0?"e":"e+")+e}__name(toExponential,"toExponential");function toFixedPoint(str,e,z){var len,zs;if(e<0){for(zs=z+".";++e;zs+=z);str=zs+str}else if(len=str.length,++e>len){for(zs=z,e-=len;--e;zs+=z);str+=zs}else e="0"&&ch<="9";)string2+=ch,next();if(ch===".")for(string2+=".";next()&&ch>="0"&&ch<="9";)string2+=ch;if(ch==="e"||ch==="E")for(string2+=ch,next(),(ch==="-"||ch==="+")&&(string2+=ch,next());ch>="0"&&ch<="9";)string2+=ch,next();if(number2=+string2,!isFinite(number2))error("Bad number");else return BigNumber==null&&(BigNumber=require_bignumber()),string2.length>15?_options.storeAsString?string2:_options.useNativeBigInt?BigInt(string2):new BigNumber(string2):_options.alwaysParseAsBig?_options.useNativeBigInt?BigInt(number2):new BigNumber(number2):number2},"number"),string=__name(function(){var hex,i,string2="",uffff;if(ch==='"')for(var startAt=at;next();){if(ch==='"')return at-1>startAt&&(string2+=text.substring(startAt,at-1)),next(),string2;if(ch==="\\"){if(at-1>startAt&&(string2+=text.substring(startAt,at-1)),next(),ch==="u"){for(uffff=0,i=0;i<4&&(hex=parseInt(next(),16),!!isFinite(hex));i+=1)uffff=uffff*16+hex;string2+=String.fromCharCode(uffff)}else if(typeof escapee[ch]=="string")string2+=escapee[ch];else break;startAt=at}}error("Bad string")},"string"),white=__name(function(){for(;ch&&ch<=" ";)next()},"white"),word=__name(function(){switch(ch){case"t":return next("t"),next("r"),next("u"),next("e"),!0;case"f":return next("f"),next("a"),next("l"),next("s"),next("e"),!1;case"n":return next("n"),next("u"),next("l"),next("l"),null}error("Unexpected '"+ch+"'")},"word"),value,array=__name(function(){var array2=[];if(ch==="["){if(next("["),white(),ch==="]")return next("]"),array2;for(;ch;){if(array2.push(value()),white(),ch==="]")return next("]"),array2;next(","),white()}}error("Bad array")},"array"),object=__name(function(){var key,object2=Object.create(null);if(ch==="{"){if(next("{"),white(),ch==="}")return next("}"),object2;for(;ch;){if(key=string(),white(),next(":"),_options.strict===!0&&Object.hasOwnProperty.call(object2,key)&&error('Duplicate key "'+key+'"'),suspectProtoRx.test(key)===!0?_options.protoAction==="error"?error("Object contains forbidden prototype property"):_options.protoAction==="ignore"?value():object2[key]=value():suspectConstructorRx.test(key)===!0?_options.constructorAction==="error"?error("Object contains forbidden constructor property"):_options.constructorAction==="ignore"?value():object2[key]=value():object2[key]=value(),white(),ch==="}")return next("}"),object2;next(","),white()}}error("Bad object")},"object");return value=__name(function(){switch(white(),ch){case"{":return object();case"[":return array();case'"':return string();case"-":return number();default:return ch>="0"&&ch<="9"?number():word()}},"value"),function(source,reviver){var result;return text=source+"",at=0,ch=" ",result=value(),white(),ch&&error("Syntax error"),typeof reviver=="function"?__name(function walk(holder,key){var k,v,value2=holder[key];return value2&&typeof value2=="object"&&Object.keys(value2).forEach(function(k2){v=walk(value2,k2),v!==void 0?value2[k2]=v:delete value2[k2]}),reviver.call(holder,key,value2)},"walk")({"":result},""):result}},"json_parse");module2.exports=json_parse}});var require_json_bigint=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/json-bigint/index.js"(exports2,module2){var json_stringify=require_stringify().stringify,json_parse=require_parse2();module2.exports=function(options){return{parse:json_parse(options),stringify:json_stringify}};module2.exports.parse=json_parse();module2.exports.stringify=json_stringify}});var require_gcp_residency=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/gcp-metadata/build/src/gcp-residency.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.detectGCPResidency=exports2.isGoogleComputeEngine=exports2.isGoogleComputeEngineMACAddress=exports2.isGoogleComputeEngineLinux=exports2.isGoogleCloudServerless=exports2.GCE_LINUX_BIOS_PATHS=void 0;var fs_1=require("fs"),os_1=require("os");exports2.GCE_LINUX_BIOS_PATHS={BIOS_DATE:"/sys/class/dmi/id/bios_date",BIOS_VENDOR:"/sys/class/dmi/id/bios_vendor"};var GCE_MAC_ADDRESS_REGEX=/^42:01/;function isGoogleCloudServerless(){return!!(process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE)}__name(isGoogleCloudServerless,"isGoogleCloudServerless");exports2.isGoogleCloudServerless=isGoogleCloudServerless;function isGoogleComputeEngineLinux(){if((0,os_1.platform)()!=="linux")return!1;try{(0,fs_1.statSync)(exports2.GCE_LINUX_BIOS_PATHS.BIOS_DATE);let biosVendor=(0,fs_1.readFileSync)(exports2.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR,"utf8");return/Google/.test(biosVendor)}catch{return!1}}__name(isGoogleComputeEngineLinux,"isGoogleComputeEngineLinux");exports2.isGoogleComputeEngineLinux=isGoogleComputeEngineLinux;function isGoogleComputeEngineMACAddress(){let interfaces=(0,os_1.networkInterfaces)();for(let item of Object.values(interfaces))if(item){for(let{mac}of item)if(GCE_MAC_ADDRESS_REGEX.test(mac))return!0}return!1}__name(isGoogleComputeEngineMACAddress,"isGoogleComputeEngineMACAddress");exports2.isGoogleComputeEngineMACAddress=isGoogleComputeEngineMACAddress;function isGoogleComputeEngine(){return isGoogleComputeEngineLinux()||isGoogleComputeEngineMACAddress()}__name(isGoogleComputeEngine,"isGoogleComputeEngine");exports2.isGoogleComputeEngine=isGoogleComputeEngine;function detectGCPResidency(){return isGoogleCloudServerless()||isGoogleComputeEngine()}__name(detectGCPResidency,"detectGCPResidency");exports2.detectGCPResidency=detectGCPResidency}});var require_src4=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/gcp-metadata/build/src/index.js"(exports2){"use strict";var __createBinding=exports2&&exports2.__createBinding||(Object.create?function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]}),__exportStar=exports2&&exports2.__exportStar||function(m,exports3){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports3,p)&&__createBinding(exports3,m,p)};Object.defineProperty(exports2,"__esModule",{value:!0});exports2.requestTimeout=exports2.setGCPResidency=exports2.getGCPResidency=exports2.gcpResidencyCache=exports2.resetIsAvailableCache=exports2.isAvailable=exports2.bulk=exports2.universe=exports2.project=exports2.instance=exports2.METADATA_SERVER_DETECTION=exports2.HEADERS=exports2.HEADER_VALUE=exports2.HEADER_NAME=exports2.SECONDARY_HOST_ADDRESS=exports2.HOST_ADDRESS=exports2.BASE_PATH=void 0;var gaxios_1=require_src3(),jsonBigint=require_json_bigint(),gcp_residency_1=require_gcp_residency();exports2.BASE_PATH="/computeMetadata/v1";exports2.HOST_ADDRESS="http://169.254.169.254";exports2.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.";exports2.HEADER_NAME="Metadata-Flavor";exports2.HEADER_VALUE="Google";exports2.HEADERS=Object.freeze({[exports2.HEADER_NAME]:exports2.HEADER_VALUE});exports2.METADATA_SERVER_DETECTION=Object.freeze({"assume-present":"don't try to ping the metadata server, but assume it's present",none:"don't try to ping the metadata server, but don't try to use it either","bios-only":"treat the result of a BIOS probe as canonical (don't fall back to pinging)","ping-only":"skip the BIOS probe, and go straight to pinging"});function getBaseUrl(baseUrl){return baseUrl||(baseUrl=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||exports2.HOST_ADDRESS),/^https?:\/\//.test(baseUrl)||(baseUrl=`http://${baseUrl}`),new URL(exports2.BASE_PATH,baseUrl).href}__name(getBaseUrl,"getBaseUrl");function validate2(options){Object.keys(options).forEach(key=>{switch(key){case"params":case"property":case"headers":break;case"qs":throw new Error("'qs' is not a valid configuration option. Please use 'params' instead.");default:throw new Error(`'${key}' is not a valid configuration option.`)}})}__name(validate2,"validate");async function metadataAccessor(type,options={},noResponseRetries=3,fastFail=!1){let metadataKey="",params={},headers={};if(typeof type=="object"){let metadataAccessor2=type;metadataKey=metadataAccessor2.metadataKey,params=metadataAccessor2.params||params,headers=metadataAccessor2.headers||headers,noResponseRetries=metadataAccessor2.noResponseRetries||noResponseRetries,fastFail=metadataAccessor2.fastFail||fastFail}else metadataKey=type;typeof options=="string"?metadataKey+=`/${options}`:(validate2(options),options.property&&(metadataKey+=`/${options.property}`),headers=options.headers||headers,params=options.params||params);try{let res=await(fastFail?fastFailMetadataRequest:gaxios_1.request)({url:`${getBaseUrl()}/${metadataKey}`,headers:{...exports2.HEADERS,...headers},retryConfig:{noResponseRetries},params,responseType:"text",timeout:requestTimeout()});if(res.headers[exports2.HEADER_NAME.toLowerCase()]!==exports2.HEADER_VALUE)throw new Error(`Invalid response from metadata service: incorrect ${exports2.HEADER_NAME} header.`);if(!res.data)throw new Error("Invalid response from the metadata service");if(typeof res.data=="string")try{return jsonBigint.parse(res.data)}catch{}return res.data}catch(e){let err=e;throw err.response&&err.response.status!==200&&(err.message=`Unsuccessful response status code. ${err.message}`),e}}__name(metadataAccessor,"metadataAccessor");async function fastFailMetadataRequest(options){let secondaryOptions={...options,url:options.url.replace(getBaseUrl(),getBaseUrl(exports2.SECONDARY_HOST_ADDRESS))},responded=!1,r1=(0,gaxios_1.request)(options).then(res=>(responded=!0,res)).catch(err=>{if(responded)return r2;throw responded=!0,err}),r2=(0,gaxios_1.request)(secondaryOptions).then(res=>(responded=!0,res)).catch(err=>{if(responded)return r1;throw responded=!0,err});return Promise.race([r1,r2])}__name(fastFailMetadataRequest,"fastFailMetadataRequest");function instance(options){return metadataAccessor("instance",options)}__name(instance,"instance");exports2.instance=instance;function project(options){return metadataAccessor("project",options)}__name(project,"project");exports2.project=project;function universe(options){return metadataAccessor("universe",options)}__name(universe,"universe");exports2.universe=universe;async function bulk(properties){let r={};return await Promise.all(properties.map(item=>(async()=>{let res=await metadataAccessor(item),key=item.metadataKey;r[key]=res})())),r}__name(bulk,"bulk");exports2.bulk=bulk;function detectGCPAvailableRetries(){return process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0}__name(detectGCPAvailableRetries,"detectGCPAvailableRetries");var cachedIsAvailableResponse;async function isAvailable(){if(process.env.METADATA_SERVER_DETECTION){let value=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(value in exports2.METADATA_SERVER_DETECTION))throw new RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${value}\`, but it should be \`${Object.keys(exports2.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`);switch(value){case"assume-present":return!0;case"none":return!1;case"bios-only":return getGCPResidency();case"ping-only":}}try{return cachedIsAvailableResponse===void 0&&(cachedIsAvailableResponse=metadataAccessor("instance",void 0,detectGCPAvailableRetries(),!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST))),await cachedIsAvailableResponse,!0}catch(e){let err=e;if(process.env.DEBUG_AUTH&&console.info(err),err.type==="request-timeout"||err.response&&err.response.status===404)return!1;if(!(err.response&&err.response.status===404)&&(!err.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes(err.code))){let code="UNKNOWN";err.code&&(code=err.code),process.emitWarning(`received unexpected error = ${err.message} code = ${code}`,"MetadataLookupWarning")}return!1}}__name(isAvailable,"isAvailable");exports2.isAvailable=isAvailable;function resetIsAvailableCache(){cachedIsAvailableResponse=void 0}__name(resetIsAvailableCache,"resetIsAvailableCache");exports2.resetIsAvailableCache=resetIsAvailableCache;exports2.gcpResidencyCache=null;function getGCPResidency(){return exports2.gcpResidencyCache===null&&setGCPResidency(),exports2.gcpResidencyCache}__name(getGCPResidency,"getGCPResidency");exports2.getGCPResidency=getGCPResidency;function setGCPResidency(value=null){exports2.gcpResidencyCache=value!==null?value:(0,gcp_residency_1.detectGCPResidency)()}__name(setGCPResidency,"setGCPResidency");exports2.setGCPResidency=setGCPResidency;function requestTimeout(){return getGCPResidency()?0:3e3}__name(requestTimeout,"requestTimeout");exports2.requestTimeout=requestTimeout;__exportStar(require_gcp_residency(),exports2)}});var require_base64_js=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/base64-js/index.js"(exports2){"use strict";exports2.byteLength=byteLength;exports2.toByteArray=toByteArray;exports2.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(i=0,len=code.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");var validLen=b64.indexOf("=");validLen===-1&&(validLen=len2);var placeHoldersLen=validLen===len2?0:4-validLen%4;return[validLen,placeHoldersLen]}__name(getLens,"getLens");function byteLength(b64){var lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1];return(validLen+placeHoldersLen)*3/4-placeHoldersLen}__name(byteLength,"byteLength");function _byteLength(b64,validLen,placeHoldersLen){return(validLen+placeHoldersLen)*3/4-placeHoldersLen}__name(_byteLength,"_byteLength");function toByteArray(b64){var tmp,lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1],arr=new Arr(_byteLength(b64,validLen,placeHoldersLen)),curByte=0,len2=placeHoldersLen>0?validLen-4:validLen,i2;for(i2=0;i2>16&255,arr[curByte++]=tmp>>8&255,arr[curByte++]=tmp&255;return placeHoldersLen===2&&(tmp=revLookup[b64.charCodeAt(i2)]<<2|revLookup[b64.charCodeAt(i2+1)]>>4,arr[curByte++]=tmp&255),placeHoldersLen===1&&(tmp=revLookup[b64.charCodeAt(i2)]<<10|revLookup[b64.charCodeAt(i2+1)]<<4|revLookup[b64.charCodeAt(i2+2)]>>2,arr[curByte++]=tmp>>8&255,arr[curByte++]=tmp&255),arr}__name(toByteArray,"toByteArray");function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}__name(tripletToBase64,"tripletToBase64");function encodeChunk(uint8,start,end){for(var tmp,output=[],i2=start;i2len22?len22:i2+maxChunkLength));return extraBytes===1?(tmp=uint8[len2-1],parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")):extraBytes===2&&(tmp=(uint8[len2-2]<<8)+uint8[len2-1],parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"=")),parts.join("")}__name(fromByteArray,"fromByteArray")}});var require_crypto=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/crypto/browser/crypto.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.BrowserCrypto=void 0;var base64js=require_base64_js(),crypto_1=require_crypto3(),BrowserCrypto=class{constructor(){if(typeof window>"u"||window.crypto===void 0||window.crypto.subtle===void 0)throw new Error("SubtleCrypto not found. Make sure it's an https:// website.")}async sha256DigestBase64(str){let inputBuffer=new TextEncoder().encode(str),outputBuffer=await window.crypto.subtle.digest("SHA-256",inputBuffer);return base64js.fromByteArray(new Uint8Array(outputBuffer))}randomBytesBase64(count){let array=new Uint8Array(count);return window.crypto.getRandomValues(array),base64js.fromByteArray(array)}static padBase64(base64){for(;base64.length%4!==0;)base64+="=";return base64}async verify(pubkey,data,signature){let algo={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},dataArray=new TextEncoder().encode(data),signatureArray=base64js.toByteArray(BrowserCrypto.padBase64(signature)),cryptoKey=await window.crypto.subtle.importKey("jwk",pubkey,algo,!0,["verify"]);return await window.crypto.subtle.verify(algo,cryptoKey,signatureArray,dataArray)}async sign(privateKey,data){let algo={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},dataArray=new TextEncoder().encode(data),cryptoKey=await window.crypto.subtle.importKey("jwk",privateKey,algo,!0,["sign"]),result=await window.crypto.subtle.sign(algo,cryptoKey,dataArray);return base64js.fromByteArray(new Uint8Array(result))}decodeBase64StringUtf8(base64){let uint8array=base64js.toByteArray(BrowserCrypto.padBase64(base64));return new TextDecoder().decode(uint8array)}encodeBase64StringUtf8(text){let uint8array=new TextEncoder().encode(text);return base64js.fromByteArray(uint8array)}async sha256DigestHex(str){let inputBuffer=new TextEncoder().encode(str),outputBuffer=await window.crypto.subtle.digest("SHA-256",inputBuffer);return(0,crypto_1.fromArrayBufferToHex)(outputBuffer)}async signWithHmacSha256(key,msg){let rawKey=typeof key=="string"?key:String.fromCharCode(...new Uint16Array(key)),enc=new TextEncoder,cryptoKey=await window.crypto.subtle.importKey("raw",enc.encode(rawKey),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return window.crypto.subtle.sign("HMAC",cryptoKey,enc.encode(msg))}};__name(BrowserCrypto,"BrowserCrypto");exports2.BrowserCrypto=BrowserCrypto}});var require_crypto2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/crypto/node/crypto.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.NodeCrypto=void 0;var crypto6=require("crypto"),NodeCrypto=class{async sha256DigestBase64(str){return crypto6.createHash("sha256").update(str).digest("base64")}randomBytesBase64(count){return crypto6.randomBytes(count).toString("base64")}async verify(pubkey,data,signature){let verifier=crypto6.createVerify("RSA-SHA256");return verifier.update(data),verifier.end(),verifier.verify(pubkey,signature,"base64")}async sign(privateKey,data){let signer=crypto6.createSign("RSA-SHA256");return signer.update(data),signer.end(),signer.sign(privateKey,"base64")}decodeBase64StringUtf8(base64){return Buffer.from(base64,"base64").toString("utf-8")}encodeBase64StringUtf8(text){return Buffer.from(text,"utf-8").toString("base64")}async sha256DigestHex(str){return crypto6.createHash("sha256").update(str).digest("hex")}async signWithHmacSha256(key,msg){let cryptoKey=typeof key=="string"?key:toBuffer(key);return toArrayBuffer(crypto6.createHmac("sha256",cryptoKey).update(msg).digest())}};__name(NodeCrypto,"NodeCrypto");exports2.NodeCrypto=NodeCrypto;function toArrayBuffer(buffer){return buffer.buffer.slice(buffer.byteOffset,buffer.byteOffset+buffer.byteLength)}__name(toArrayBuffer,"toArrayBuffer");function toBuffer(arrayBuffer){return Buffer.from(arrayBuffer)}__name(toBuffer,"toBuffer")}});var require_crypto3=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/crypto/crypto.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.fromArrayBufferToHex=exports2.hasBrowserCrypto=exports2.createCrypto=void 0;var crypto_1=require_crypto(),crypto_2=require_crypto2();function createCrypto(){return hasBrowserCrypto()?new crypto_1.BrowserCrypto:new crypto_2.NodeCrypto}__name(createCrypto,"createCrypto");exports2.createCrypto=createCrypto;function hasBrowserCrypto(){return typeof window<"u"&&typeof window.crypto<"u"&&typeof window.crypto.subtle<"u"}__name(hasBrowserCrypto,"hasBrowserCrypto");exports2.hasBrowserCrypto=hasBrowserCrypto;function fromArrayBufferToHex(arrayBuffer){return Array.from(new Uint8Array(arrayBuffer)).map(byte=>byte.toString(16).padStart(2,"0")).join("")}__name(fromArrayBufferToHex,"fromArrayBufferToHex");exports2.fromArrayBufferToHex=fromArrayBufferToHex}});var require_options=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/options.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.validate=void 0;function validate2(options){let vpairs=[{invalid:"uri",expected:"url"},{invalid:"json",expected:"data"},{invalid:"qs",expected:"params"}];for(let pair of vpairs)if(options[pair.invalid]){let e=`'${pair.invalid}' is not a valid configuration option. Please use '${pair.expected}' instead. This library is using Axios for requests. Please see https://github.com/axios/axios to learn more about the valid request options.`;throw new Error(e)}}__name(validate2,"validate");exports2.validate=validate2}});var require_package2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/package.json"(exports2,module2){module2.exports={name:"google-auth-library",version:"9.11.0",author:"Google Inc.",description:"Google APIs Authentication Client Library for Node.js",engines:{node:">=14"},main:"./build/src/index.js",types:"./build/src/index.d.ts",repository:"googleapis/google-auth-library-nodejs.git",keywords:["google","api","google apis","client","client library"],dependencies:{"base64-js":"^1.3.0","ecdsa-sig-formatter":"^1.0.11",gaxios:"^6.1.1","gcp-metadata":"^6.1.0",gtoken:"^7.0.0",jws:"^4.0.0"},devDependencies:{"@compodoc/compodoc":"1.1.23","@types/base64-js":"^1.2.5","@types/chai":"^4.1.7","@types/jws":"^3.1.0","@types/mocha":"^9.0.0","@types/mv":"^2.1.0","@types/ncp":"^2.0.1","@types/node":"^20.4.2","@types/sinon":"^17.0.0","assert-rejects":"^1.0.0",c8:"^8.0.0",chai:"^4.2.0",codecov:"^3.0.2",execa:"^5.0.0",gts:"^5.0.0","is-docker":"^2.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-sourcemap-loader":"^0.4.0","karma-webpack":"5.0.0",keypair:"^1.0.4",linkinator:"^4.0.0",mocha:"^9.2.2",mv:"^2.1.1",ncp:"^2.0.0",nock:"^13.0.0","null-loader":"^4.0.0",puppeteer:"^21.0.0",sinon:"^18.0.0","ts-loader":"^8.0.0",typescript:"^5.1.6",webpack:"^5.21.2","webpack-cli":"^4.0.0"},files:["build/src","!build/src/**/*.map"],scripts:{test:"c8 mocha build/test",clean:"gts clean",prepare:"npm run compile",lint:"gts check",compile:"tsc -p .",fix:"gts fix",pretest:"npm run compile -- --sourceMap",docs:"compodoc src/","samples-setup":"cd samples/ && npm link ../ && npm run setup && cd ../","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","system-test":"mocha build/system-test --timeout 60000","presystem-test":"npm run compile -- --sourceMap",webpack:"webpack","browser-test":"karma start","docs-test":"linkinator docs","predocs-test":"npm run docs",prelint:"cd samples; npm link ../; npm install",precompile:"gts clean"},license:"Apache-2.0"}}});var require_transporters=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/transporters.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.DefaultTransporter=void 0;var gaxios_1=require_src3(),options_1=require_options(),pkg=require_package2(),PRODUCT_NAME="google-api-nodejs-client",DefaultTransporter=class{constructor(){this.instance=new gaxios_1.Gaxios}configure(opts={}){if(opts.headers=opts.headers||{},typeof window>"u"){let uaValue=opts.headers["User-Agent"];if(uaValue?uaValue.includes(`${PRODUCT_NAME}/`)||(opts.headers["User-Agent"]=`${uaValue} ${DefaultTransporter.USER_AGENT}`):opts.headers["User-Agent"]=DefaultTransporter.USER_AGENT,!opts.headers["x-goog-api-client"]){let nodeVersion=process.version.replace(/^v/,"");opts.headers["x-goog-api-client"]=`gl-node/${nodeVersion}`}}return opts}request(opts){return opts=this.configure(opts),(0,options_1.validate)(opts),this.instance.request(opts).catch(e=>{throw this.processError(e)})}get defaults(){return this.instance.defaults}set defaults(opts){this.instance.defaults=opts}processError(e){let res=e.response,err=e,body=res?res.data:null;return res&&body&&body.error&&res.status!==200?typeof body.error=="string"?(err.message=body.error,err.status=res.status):Array.isArray(body.error.errors)?(err.message=body.error.errors.map(err2=>err2.message).join(` `),err.code=body.error.code,err.errors=body.error.errors):(err.message=body.error.message,err.code=body.error.code):res&&res.status>=400&&(err.message=body,err.status=res.status),err}};__name(DefaultTransporter,"DefaultTransporter");exports2.DefaultTransporter=DefaultTransporter;DefaultTransporter.USER_AGENT=`${PRODUCT_NAME}/${pkg.version}`}});var require_safe_buffer=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/safe-buffer/index.js"(exports2,module2){var buffer=require("buffer"),Buffer2=buffer.Buffer;function copyProps(src,dst){for(var key in src)dst[key]=src[key]}__name(copyProps,"copyProps");Buffer2.from&&Buffer2.alloc&&Buffer2.allocUnsafe&&Buffer2.allocUnsafeSlow?module2.exports=buffer:(copyProps(buffer,exports2),exports2.Buffer=SafeBuffer);function SafeBuffer(arg,encodingOrOffset,length){return Buffer2(arg,encodingOrOffset,length)}__name(SafeBuffer,"SafeBuffer");SafeBuffer.prototype=Object.create(Buffer2.prototype);copyProps(Buffer2,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg=="number")throw new TypeError("Argument must not be a number");return Buffer2(arg,encodingOrOffset,length)};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!="number")throw new TypeError("Argument must be a number");var buf=Buffer2(size);return fill!==void 0?typeof encoding=="string"?buf.fill(fill,encoding):buf.fill(fill):buf.fill(0),buf};SafeBuffer.allocUnsafe=function(size){if(typeof size!="number")throw new TypeError("Argument must be a number");return Buffer2(size)};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!="number")throw new TypeError("Argument must be a number");return buffer.SlowBuffer(size)}}});var require_param_bytes_for_alg=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js"(exports2,module2){"use strict";function getParamSize(keySize){var result=(keySize/8|0)+(keySize%8===0?0:1);return result}__name(getParamSize,"getParamSize");var paramBytesForAlg={ES256:getParamSize(256),ES384:getParamSize(384),ES512:getParamSize(521)};function getParamBytesForAlg(alg){var paramBytes=paramBytesForAlg[alg];if(paramBytes)return paramBytes;throw new Error('Unknown algorithm "'+alg+'"')}__name(getParamBytesForAlg,"getParamBytesForAlg");module2.exports=getParamBytesForAlg}});var require_ecdsa_sig_formatter=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js"(exports2,module2){"use strict";var Buffer2=require_safe_buffer().Buffer,getParamBytesForAlg=require_param_bytes_for_alg(),MAX_OCTET=128,CLASS_UNIVERSAL=0,PRIMITIVE_BIT=32,TAG_SEQ=16,TAG_INT=2,ENCODED_TAG_SEQ=TAG_SEQ|PRIMITIVE_BIT|CLASS_UNIVERSAL<<6,ENCODED_TAG_INT=TAG_INT|CLASS_UNIVERSAL<<6;function base64Url(base64){return base64.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}__name(base64Url,"base64Url");function signatureAsBuffer(signature){if(Buffer2.isBuffer(signature))return signature;if(typeof signature=="string")return Buffer2.from(signature,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}__name(signatureAsBuffer,"signatureAsBuffer");function derToJose(signature,alg){signature=signatureAsBuffer(signature);var paramBytes=getParamBytesForAlg(alg),maxEncodedParamLength=paramBytes+1,inputLength=signature.length,offset=0;if(signature[offset++]!==ENCODED_TAG_SEQ)throw new Error('Could not find expected "seq"');var seqLength=signature[offset++];if(seqLength===(MAX_OCTET|1)&&(seqLength=signature[offset++]),inputLength-offset=MAX_OCTET;return needsSign&&--padding,padding}__name(countPadding,"countPadding");function joseToDer(signature,alg){signature=signatureAsBuffer(signature);var paramBytes=getParamBytesForAlg(alg),signatureBytes=signature.length;if(signatureBytes!==paramBytes*2)throw new TypeError('"'+alg+'" signatures must be "'+paramBytes*2+'" bytes, saw "'+signatureBytes+'"');var rPadding=countPadding(signature,0,paramBytes),sPadding=countPadding(signature,paramBytes,signature.length),rLength=paramBytes-rPadding,sLength=paramBytes-sPadding,rsBytes=1+1+rLength+1+1+sLength,shortLength=rsBytesmatch.slice(1).toUpperCase())}__name(snakeToCamel,"snakeToCamel");exports2.snakeToCamel=snakeToCamel;function originalOrCamelOptions(obj){function get(key){var _a;let o=obj||{};return(_a=o[key])!==null&&_a!==void 0?_a:o[snakeToCamel(key)]}return __name(get,"get"),{get}}__name(originalOrCamelOptions,"originalOrCamelOptions");exports2.originalOrCamelOptions=originalOrCamelOptions;var LRUCache=class{constructor(options){_LRUCache_instances.add(this),_LRUCache_cache.set(this,new Map),this.capacity=options.capacity,this.maxAge=options.maxAge}set(key,value){__classPrivateFieldGet(this,_LRUCache_instances,"m",_LRUCache_moveToEnd).call(this,key,value),__classPrivateFieldGet(this,_LRUCache_instances,"m",_LRUCache_evict).call(this)}get(key){let item=__classPrivateFieldGet(this,_LRUCache_cache,"f").get(key);if(item)return __classPrivateFieldGet(this,_LRUCache_instances,"m",_LRUCache_moveToEnd).call(this,key,item.value),__classPrivateFieldGet(this,_LRUCache_instances,"m",_LRUCache_evict).call(this),item.value}};__name(LRUCache,"LRUCache");exports2.LRUCache=LRUCache;_LRUCache_cache=new WeakMap,_LRUCache_instances=new WeakSet,_LRUCache_moveToEnd=__name(function(key,value){__classPrivateFieldGet(this,_LRUCache_cache,"f").delete(key),__classPrivateFieldGet(this,_LRUCache_cache,"f").set(key,{value,lastAccessed:Date.now()})},"_LRUCache_moveToEnd"),_LRUCache_evict=__name(function(){let cutoffDate=this.maxAge?Date.now()-this.maxAge:0,oldestItem=__classPrivateFieldGet(this,_LRUCache_cache,"f").entries().next();for(;!oldestItem.done&&(__classPrivateFieldGet(this,_LRUCache_cache,"f").size>this.capacity||oldestItem.value[1].lastAccessedcallback(null,r.tokens,r.res),e=>callback(e,null,e.response));else return this.getTokenAsync(options)}async getTokenAsync(options){let url=this.endpoints.oauth2TokenUrl.toString(),headers={"Content-Type":"application/x-www-form-urlencoded"},values={client_id:options.client_id||this._clientId,code_verifier:options.codeVerifier,code:options.code,grant_type:"authorization_code",redirect_uri:options.redirect_uri||this.redirectUri};if(this.clientAuthentication===ClientAuthentication.ClientSecretBasic){let basic=Buffer.from(`${this._clientId}:${this._clientSecret}`);headers.Authorization=`Basic ${basic.toString("base64")}`}this.clientAuthentication===ClientAuthentication.ClientSecretPost&&(values.client_secret=this._clientSecret);let res=await this.transporter.request({...OAuth2Client.RETRY_CONFIG,method:"POST",url,data:querystring.stringify(values),headers}),tokens=res.data;return res.data&&res.data.expires_in&&(tokens.expiry_date=new Date().getTime()+res.data.expires_in*1e3,delete tokens.expires_in),this.emit("tokens",tokens),{tokens,res}}async refreshToken(refreshToken){if(!refreshToken)return this.refreshTokenNoCache(refreshToken);if(this.refreshTokenPromises.has(refreshToken))return this.refreshTokenPromises.get(refreshToken);let p=this.refreshTokenNoCache(refreshToken).then(r=>(this.refreshTokenPromises.delete(refreshToken),r),e=>{throw this.refreshTokenPromises.delete(refreshToken),e});return this.refreshTokenPromises.set(refreshToken,p),p}async refreshTokenNoCache(refreshToken){var _a;if(!refreshToken)throw new Error("No refresh token is set.");let url=this.endpoints.oauth2TokenUrl.toString(),data={refresh_token:refreshToken,client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token"},res;try{res=await this.transporter.request({...OAuth2Client.RETRY_CONFIG,method:"POST",url,data:querystring.stringify(data),headers:{"Content-Type":"application/x-www-form-urlencoded"}})}catch(e){throw e instanceof gaxios_1.GaxiosError&&e.message==="invalid_grant"&&(!((_a=e.response)===null||_a===void 0)&&_a.data)&&/ReAuth/i.test(e.response.data.error_description)&&(e.message=JSON.stringify(e.response.data)),e}let tokens=res.data;return res.data&&res.data.expires_in&&(tokens.expiry_date=new Date().getTime()+res.data.expires_in*1e3,delete tokens.expires_in),this.emit("tokens",tokens),{tokens,res}}refreshAccessToken(callback){if(callback)this.refreshAccessTokenAsync().then(r=>callback(null,r.credentials,r.res),callback);else return this.refreshAccessTokenAsync()}async refreshAccessTokenAsync(){let r=await this.refreshToken(this.credentials.refresh_token),tokens=r.tokens;return tokens.refresh_token=this.credentials.refresh_token,this.credentials=tokens,{credentials:this.credentials,res:r.res}}getAccessToken(callback){if(callback)this.getAccessTokenAsync().then(r=>callback(null,r.token,r.res),callback);else return this.getAccessTokenAsync()}async getAccessTokenAsync(){if(!this.credentials.access_token||this.isTokenExpiring()){if(!this.credentials.refresh_token)if(this.refreshHandler){let refreshedAccessToken=await this.processAndValidateRefreshHandler();if(refreshedAccessToken?.access_token)return this.setCredentials(refreshedAccessToken),{token:this.credentials.access_token}}else throw new Error("No refresh token or refresh handler callback is set.");let r=await this.refreshAccessTokenAsync();if(!r.credentials||r.credentials&&!r.credentials.access_token)throw new Error("Could not refresh access token.");return{token:r.credentials.access_token,res:r.res}}else return{token:this.credentials.access_token}}async getRequestHeaders(url){return(await this.getRequestMetadataAsync(url)).headers}async getRequestMetadataAsync(url){let thisCreds=this.credentials;if(!thisCreds.access_token&&!thisCreds.refresh_token&&!this.apiKey&&!this.refreshHandler)throw new Error("No access, refresh token, API key or refresh handler callback is set.");if(thisCreds.access_token&&!this.isTokenExpiring()){thisCreds.token_type=thisCreds.token_type||"Bearer";let headers2={Authorization:thisCreds.token_type+" "+thisCreds.access_token};return{headers:this.addSharedMetadataHeaders(headers2)}}if(this.refreshHandler){let refreshedAccessToken=await this.processAndValidateRefreshHandler();if(refreshedAccessToken?.access_token){this.setCredentials(refreshedAccessToken);let headers2={Authorization:"Bearer "+this.credentials.access_token};return{headers:this.addSharedMetadataHeaders(headers2)}}}if(this.apiKey)return{headers:{"X-Goog-Api-Key":this.apiKey}};let r=null,tokens=null;try{r=await this.refreshToken(thisCreds.refresh_token),tokens=r.tokens}catch(err){let e=err;throw e.response&&(e.response.status===403||e.response.status===404)&&(e.message=`Could not refresh access token: ${e.message}`),e}let credentials=this.credentials;credentials.token_type=credentials.token_type||"Bearer",tokens.refresh_token=credentials.refresh_token,this.credentials=tokens;let headers={Authorization:credentials.token_type+" "+tokens.access_token};return{headers:this.addSharedMetadataHeaders(headers),res:r.res}}static getRevokeTokenUrl(token){return new OAuth2Client().getRevokeTokenURL(token).toString()}getRevokeTokenURL(token){let url=new URL(this.endpoints.oauth2RevokeUrl);return url.searchParams.append("token",token),url}revokeToken(token,callback){let opts={...OAuth2Client.RETRY_CONFIG,url:this.getRevokeTokenURL(token).toString(),method:"POST"};if(callback)this.transporter.request(opts).then(r=>callback(null,r),callback);else return this.transporter.request(opts)}revokeCredentials(callback){if(callback)this.revokeCredentialsAsync().then(res=>callback(null,res),callback);else return this.revokeCredentialsAsync()}async revokeCredentialsAsync(){let token=this.credentials.access_token;if(this.credentials={},token)return this.revokeToken(token);throw new Error("No access token to revoke.")}request(opts,callback){if(callback)this.requestAsync(opts).then(r=>callback(null,r),e=>callback(e,e.response));else return this.requestAsync(opts)}async requestAsync(opts,reAuthRetried=!1){let r2;try{let r=await this.getRequestMetadataAsync(opts.url);opts.headers=opts.headers||{},r.headers&&r.headers["x-goog-user-project"]&&(opts.headers["x-goog-user-project"]=r.headers["x-goog-user-project"]),r.headers&&r.headers.Authorization&&(opts.headers.Authorization=r.headers.Authorization),this.apiKey&&(opts.headers["X-Goog-Api-Key"]=this.apiKey),r2=await this.transporter.request(opts)}catch(e){let res=e.response;if(res){let statusCode=res.status,mayRequireRefresh=this.credentials&&this.credentials.access_token&&this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure),mayRequireRefreshWithNoRefreshToken=this.credentials&&this.credentials.access_token&&!this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure)&&this.refreshHandler,isReadableStream=res.config.data instanceof stream.Readable,isAuthErr=statusCode===401||statusCode===403;if(!reAuthRetried&&isAuthErr&&!isReadableStream&&mayRequireRefresh)return await this.refreshAccessTokenAsync(),this.requestAsync(opts,!0);if(!reAuthRetried&&isAuthErr&&!isReadableStream&&mayRequireRefreshWithNoRefreshToken){let refreshedAccessToken=await this.processAndValidateRefreshHandler();return refreshedAccessToken?.access_token&&this.setCredentials(refreshedAccessToken),this.requestAsync(opts,!0)}}throw e}return r2}verifyIdToken(options,callback){if(callback&&typeof callback!="function")throw new Error("This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.");if(callback)this.verifyIdTokenAsync(options).then(r=>callback(null,r),callback);else return this.verifyIdTokenAsync(options)}async verifyIdTokenAsync(options){if(!options.idToken)throw new Error("The verifyIdToken method requires an ID Token");let response=await this.getFederatedSignonCertsAsync();return await this.verifySignedJwtWithCertsAsync(options.idToken,response.certs,options.audience,this.issuers,options.maxExpiry)}async getTokenInfo(accessToken){let{data}=await this.transporter.request({...OAuth2Client.RETRY_CONFIG,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${accessToken}`},url:this.endpoints.tokenInfoUrl.toString()}),info=Object.assign({expiry_date:new Date().getTime()+data.expires_in*1e3,scopes:data.scope.split(" ")},data);return delete info.expires_in,delete info.scope,info}getFederatedSignonCerts(callback){if(callback)this.getFederatedSignonCertsAsync().then(r=>callback(null,r.certs,r.res),callback);else return this.getFederatedSignonCertsAsync()}async getFederatedSignonCertsAsync(){let nowTime=new Date().getTime(),format=(0,crypto_1.hasBrowserCrypto)()?CertificateFormat.JWK:CertificateFormat.PEM;if(this.certificateExpiry&&nowTimecallback(null,r.pubkeys,r.res),callback);else return this.getIapPublicKeysAsync()}async getIapPublicKeysAsync(){let res,url=this.endpoints.oauth2IapPublicKeyUrl.toString();try{res=await this.transporter.request({...OAuth2Client.RETRY_CONFIG,url})}catch(e){throw e instanceof Error&&(e.message=`Failed to retrieve verification certificates: ${e.message}`),e}return{pubkeys:res.data,res}}verifySignedJwtWithCerts(){throw new Error("verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.")}async verifySignedJwtWithCertsAsync(jwt,certs,requiredAudience,issuers,maxExpiry){let crypto6=(0,crypto_1.createCrypto)();maxExpiry||(maxExpiry=OAuth2Client.DEFAULT_MAX_TOKEN_LIFETIME_SECS_);let segments=jwt.split(".");if(segments.length!==3)throw new Error("Wrong number of segments in token: "+jwt);let signed=segments[0]+"."+segments[1],signature=segments[2],envelope,payload;try{envelope=JSON.parse(crypto6.decodeBase64StringUtf8(segments[0]))}catch(err){throw err instanceof Error&&(err.message=`Can't parse token envelope: ${segments[0]}': ${err.message}`),err}if(!envelope)throw new Error("Can't parse token envelope: "+segments[0]);try{payload=JSON.parse(crypto6.decodeBase64StringUtf8(segments[1]))}catch(err){throw err instanceof Error&&(err.message=`Can't parse token payload '${segments[0]}`),err}if(!payload)throw new Error("Can't parse token payload: "+segments[1]);if(!Object.prototype.hasOwnProperty.call(certs,envelope.kid))throw new Error("No pem found for envelope: "+JSON.stringify(envelope));let cert=certs[envelope.kid];if(envelope.alg==="ES256"&&(signature=formatEcdsa.joseToDer(signature,"ES256").toString("base64")),!await crypto6.verify(cert,signed,signature))throw new Error("Invalid token signature: "+jwt);if(!payload.iat)throw new Error("No issue time in token: "+JSON.stringify(payload));if(!payload.exp)throw new Error("No expiration time in token: "+JSON.stringify(payload));let iat=Number(payload.iat);if(isNaN(iat))throw new Error("iat field using invalid format");let exp=Number(payload.exp);if(isNaN(exp))throw new Error("exp field using invalid format");let now=new Date().getTime()/1e3;if(exp>=now+maxExpiry)throw new Error("Expiration time too far in future: "+JSON.stringify(payload));let earliest=iat-OAuth2Client.CLOCK_SKEW_SECS_,latest=exp+OAuth2Client.CLOCK_SKEW_SECS_;if(nowlatest)throw new Error("Token used too late, "+now+" > "+latest+": "+JSON.stringify(payload));if(issuers&&issuers.indexOf(payload.iss)<0)throw new Error("Invalid issuer, expected one of ["+issuers+"], but got "+payload.iss);if(typeof requiredAudience<"u"&&requiredAudience!==null){let aud=payload.aud,audVerified=!1;if(requiredAudience.constructor===Array?audVerified=requiredAudience.indexOf(aud)>-1:audVerified=aud===requiredAudience,!audVerified)throw new Error("Wrong recipient, payload audience != requiredAudience")}return new loginticket_1.LoginTicket(envelope,payload)}async processAndValidateRefreshHandler(){if(this.refreshHandler){let accessTokenResponse=await this.refreshHandler();if(!accessTokenResponse.access_token)throw new Error("No access token is returned by the refreshHandler callback.");return accessTokenResponse}}isTokenExpiring(){let expiryDate=this.credentials.expiry_date;return expiryDate?expiryDate<=new Date().getTime()+this.eagerRefreshThresholdMillis:!1}};__name(OAuth2Client,"OAuth2Client");exports2.OAuth2Client=OAuth2Client;OAuth2Client.GOOGLE_TOKEN_INFO_URL="https://oauth2.googleapis.com/tokeninfo";OAuth2Client.CLOCK_SKEW_SECS_=300;OAuth2Client.DEFAULT_MAX_TOKEN_LIFETIME_SECS_=86400}});var require_computeclient=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/computeclient.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Compute=void 0;var gaxios_1=require_src3(),gcpMetadata=require_src4(),oauth2client_1=require_oauth2client(),Compute=class extends oauth2client_1.OAuth2Client{constructor(options={}){super(options),this.credentials={expiry_date:1,refresh_token:"compute-placeholder"},this.serviceAccountEmail=options.serviceAccountEmail||"default",this.scopes=Array.isArray(options.scopes)?options.scopes:options.scopes?[options.scopes]:[]}async refreshTokenNoCache(refreshToken){let tokenPath=`service-accounts/${this.serviceAccountEmail}/token`,data;try{let instanceOptions={property:tokenPath};this.scopes.length>0&&(instanceOptions.params={scopes:this.scopes.join(",")}),data=await gcpMetadata.instance(instanceOptions)}catch(e){throw e instanceof gaxios_1.GaxiosError&&(e.message=`Could not refresh access token: ${e.message}`,this.wrapError(e)),e}let tokens=data;return data&&data.expires_in&&(tokens.expiry_date=new Date().getTime()+data.expires_in*1e3,delete tokens.expires_in),this.emit("tokens",tokens),{tokens,res:null}}async fetchIdToken(targetAudience){let idTokenPath=`service-accounts/${this.serviceAccountEmail}/identity?format=full&audience=${targetAudience}`,idToken;try{let instanceOptions={property:idTokenPath};idToken=await gcpMetadata.instance(instanceOptions)}catch(e){throw e instanceof Error&&(e.message=`Could not fetch ID token: ${e.message}`),e}return idToken}wrapError(e){let res=e.response;res&&res.status&&(e.status=res.status,res.status===403?e.message="A Forbidden error was returned while attempting to retrieve an access token for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have the correct permission scopes specified: "+e.message:res.status===404&&(e.message="A Not Found error was returned while attempting to retrieve an accesstoken for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have any permission scopes specified: "+e.message))}};__name(Compute,"Compute");exports2.Compute=Compute}});var require_idtokenclient=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/idtokenclient.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.IdTokenClient=void 0;var oauth2client_1=require_oauth2client(),IdTokenClient=class extends oauth2client_1.OAuth2Client{constructor(options){super(options),this.targetAudience=options.targetAudience,this.idTokenProvider=options.idTokenProvider}async getRequestMetadataAsync(url){if(!this.credentials.id_token||!this.credentials.expiry_date||this.isTokenExpiring()){let idToken=await this.idTokenProvider.fetchIdToken(this.targetAudience);this.credentials={id_token:idToken,expiry_date:this.getIdTokenExpiryDate(idToken)}}return{headers:{Authorization:"Bearer "+this.credentials.id_token}}}getIdTokenExpiryDate(idToken){let payloadB64=idToken.split(".")[1];if(payloadB64)return JSON.parse(Buffer.from(payloadB64,"base64").toString("ascii")).exp*1e3}};__name(IdTokenClient,"IdTokenClient");exports2.IdTokenClient=IdTokenClient}});var require_envDetect=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/envDetect.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.getEnv=exports2.clear=exports2.GCPEnv=void 0;var gcpMetadata=require_src4(),GCPEnv;(function(GCPEnv2){GCPEnv2.APP_ENGINE="APP_ENGINE",GCPEnv2.KUBERNETES_ENGINE="KUBERNETES_ENGINE",GCPEnv2.CLOUD_FUNCTIONS="CLOUD_FUNCTIONS",GCPEnv2.COMPUTE_ENGINE="COMPUTE_ENGINE",GCPEnv2.CLOUD_RUN="CLOUD_RUN",GCPEnv2.NONE="NONE"})(GCPEnv||(exports2.GCPEnv=GCPEnv={}));var envPromise;function clear(){envPromise=void 0}__name(clear,"clear");exports2.clear=clear;async function getEnv(){return envPromise||(envPromise=getEnvMemoized(),envPromise)}__name(getEnv,"getEnv");exports2.getEnv=getEnv;async function getEnvMemoized(){let env=GCPEnv.NONE;return isAppEngine()?env=GCPEnv.APP_ENGINE:isCloudFunction()?env=GCPEnv.CLOUD_FUNCTIONS:await isComputeEngine()?await isKubernetesEngine()?env=GCPEnv.KUBERNETES_ENGINE:isCloudRun()?env=GCPEnv.CLOUD_RUN:env=GCPEnv.COMPUTE_ENGINE:env=GCPEnv.NONE,env}__name(getEnvMemoized,"getEnvMemoized");function isAppEngine(){return!!(process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME)}__name(isAppEngine,"isAppEngine");function isCloudFunction(){return!!(process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET)}__name(isCloudFunction,"isCloudFunction");function isCloudRun(){return!!process.env.K_CONFIGURATION}__name(isCloudRun,"isCloudRun");async function isKubernetesEngine(){try{return await gcpMetadata.instance("attributes/cluster-name"),!0}catch{return!1}}__name(isKubernetesEngine,"isKubernetesEngine");async function isComputeEngine(){return gcpMetadata.isAvailable()}__name(isComputeEngine,"isComputeEngine")}});var require_data_stream=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/jws/lib/data-stream.js"(exports2,module2){var Buffer2=require_safe_buffer().Buffer,Stream=require("stream"),util=require("util");function DataStream(data){if(this.buffer=null,this.writable=!0,this.readable=!0,!data)return this.buffer=Buffer2.alloc(0),this;if(typeof data.pipe=="function")return this.buffer=Buffer2.alloc(0),data.pipe(this),this;if(data.length||typeof data=="object")return this.buffer=data,this.writable=!1,process.nextTick(function(){this.emit("end",data),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof data+")")}__name(DataStream,"DataStream");util.inherits(DataStream,Stream);DataStream.prototype.write=__name(function(data){this.buffer=Buffer2.concat([this.buffer,Buffer2.from(data)]),this.emit("data",data)},"write");DataStream.prototype.end=__name(function(data){data&&this.write(data),this.emit("end",data),this.emit("close"),this.writable=!1,this.readable=!1},"end");module2.exports=DataStream}});var require_buffer_equal_constant_time=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/buffer-equal-constant-time/index.js"(exports2,module2){"use strict";var Buffer2=require("buffer").Buffer,SlowBuffer=require("buffer").SlowBuffer;module2.exports=bufferEq;function bufferEq(a,b){if(!Buffer2.isBuffer(a)||!Buffer2.isBuffer(b)||a.length!==b.length)return!1;for(var c=0,i=0;i{throw new ErrorWithCode("use key rather than keyFile.","MISSING_CREDENTIALS")},GOOGLE_TOKEN_URL="https://www.googleapis.com/oauth2/v4/token",GOOGLE_REVOKE_TOKEN_URL="https://accounts.google.com/o/oauth2/revoke?token=",ErrorWithCode=class extends Error{constructor(message,code){super(message),this.code=code}};__name(ErrorWithCode,"ErrorWithCode");var GoogleToken=class{get accessToken(){return this.rawToken?this.rawToken.access_token:void 0}get idToken(){return this.rawToken?this.rawToken.id_token:void 0}get tokenType(){return this.rawToken?this.rawToken.token_type:void 0}get refreshToken(){return this.rawToken?this.rawToken.refresh_token:void 0}constructor(options){_GoogleToken_instances.add(this),this.transporter={request:opts=>(0,gaxios_1.request)(opts)},_GoogleToken_inFlightRequest.set(this,void 0),__classPrivateFieldGet(this,_GoogleToken_instances,"m",_GoogleToken_configure).call(this,options)}hasExpired(){let now=new Date().getTime();return this.rawToken&&this.expiresAt?now>=this.expiresAt:!0}isTokenExpiring(){var _a;let now=new Date().getTime(),eagerRefreshThresholdMillis=(_a=this.eagerRefreshThresholdMillis)!==null&&_a!==void 0?_a:0;return this.rawToken&&this.expiresAt?this.expiresAt<=now+eagerRefreshThresholdMillis:!0}getToken(callback,opts={}){if(typeof callback=="object"&&(opts=callback,callback=void 0),opts=Object.assign({forceRefresh:!1},opts),callback){let cb=callback;__classPrivateFieldGet(this,_GoogleToken_instances,"m",_GoogleToken_getTokenAsync).call(this,opts).then(t=>cb(null,t),callback);return}return __classPrivateFieldGet(this,_GoogleToken_instances,"m",_GoogleToken_getTokenAsync).call(this,opts)}async getCredentials(keyFile){switch(path.extname(keyFile)){case".json":{let key=await readFile(keyFile,"utf8"),body=JSON.parse(key),privateKey=body.private_key,clientEmail=body.client_email;if(!privateKey||!clientEmail)throw new ErrorWithCode("private_key and client_email are required.","MISSING_CREDENTIALS");return{privateKey,clientEmail}}case".der":case".crt":case".pem":return{privateKey:await readFile(keyFile,"utf8")};case".p12":case".pfx":throw new ErrorWithCode("*.p12 certificates are not supported after v6.1.2. Consider utilizing *.json format or converting *.p12 to *.pem using the OpenSSL CLI.","UNKNOWN_CERTIFICATE_TYPE");default:throw new ErrorWithCode("Unknown certificate type. Type is determined based on file extension. Current supported extensions are *.json, and *.pem.","UNKNOWN_CERTIFICATE_TYPE")}}revokeToken(callback){if(callback){__classPrivateFieldGet(this,_GoogleToken_instances,"m",_GoogleToken_revokeTokenAsync).call(this).then(()=>callback(),callback);return}return __classPrivateFieldGet(this,_GoogleToken_instances,"m",_GoogleToken_revokeTokenAsync).call(this)}};__name(GoogleToken,"GoogleToken");exports2.GoogleToken=GoogleToken;_GoogleToken_inFlightRequest=new WeakMap,_GoogleToken_instances=new WeakSet,_GoogleToken_getTokenAsync=__name(async function(opts){if(__classPrivateFieldGet(this,_GoogleToken_inFlightRequest,"f")&&!opts.forceRefresh)return __classPrivateFieldGet(this,_GoogleToken_inFlightRequest,"f");try{return await __classPrivateFieldSet(this,_GoogleToken_inFlightRequest,__classPrivateFieldGet(this,_GoogleToken_instances,"m",_GoogleToken_getTokenAsyncInner).call(this,opts),"f")}finally{__classPrivateFieldSet(this,_GoogleToken_inFlightRequest,void 0,"f")}},"_GoogleToken_getTokenAsync"),_GoogleToken_getTokenAsyncInner=__name(async function(opts){if(this.isTokenExpiring()===!1&&opts.forceRefresh===!1)return Promise.resolve(this.rawToken);if(!this.key&&!this.keyFile)throw new Error("No key or keyFile set.");if(!this.key&&this.keyFile){let creds=await this.getCredentials(this.keyFile);this.key=creds.privateKey,this.iss=creds.clientEmail||this.iss,creds.clientEmail||__classPrivateFieldGet(this,_GoogleToken_instances,"m",_GoogleToken_ensureEmail).call(this)}return __classPrivateFieldGet(this,_GoogleToken_instances,"m",_GoogleToken_requestToken).call(this)},"_GoogleToken_getTokenAsyncInner"),_GoogleToken_ensureEmail=__name(function(){if(!this.iss)throw new ErrorWithCode("email is required.","MISSING_CREDENTIALS")},"_GoogleToken_ensureEmail"),_GoogleToken_revokeTokenAsync=__name(async function(){if(!this.accessToken)throw new Error("No token to revoke.");let url=GOOGLE_REVOKE_TOKEN_URL+this.accessToken;await this.transporter.request({url,retry:!0}),__classPrivateFieldGet(this,_GoogleToken_instances,"m",_GoogleToken_configure).call(this,{email:this.iss,sub:this.sub,key:this.key,keyFile:this.keyFile,scope:this.scope,additionalClaims:this.additionalClaims})},"_GoogleToken_revokeTokenAsync"),_GoogleToken_configure=__name(function(options={}){this.keyFile=options.keyFile,this.key=options.key,this.rawToken=void 0,this.iss=options.email||options.iss,this.sub=options.sub,this.additionalClaims=options.additionalClaims,typeof options.scope=="object"?this.scope=options.scope.join(" "):this.scope=options.scope,this.eagerRefreshThresholdMillis=options.eagerRefreshThresholdMillis,options.transporter&&(this.transporter=options.transporter)},"_GoogleToken_configure"),_GoogleToken_requestToken=__name(async function(){var _a,_b;let iat=Math.floor(new Date().getTime()/1e3),additionalClaims=this.additionalClaims||{},payload=Object.assign({iss:this.iss,scope:this.scope,aud:GOOGLE_TOKEN_URL,exp:iat+3600,iat,sub:this.sub},additionalClaims),signedJWT=jws.sign({header:{alg:"RS256"},payload,secret:this.key});try{let r=await this.transporter.request({method:"POST",url:GOOGLE_TOKEN_URL,data:{grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:signedJWT},headers:{"Content-Type":"application/x-www-form-urlencoded"},responseType:"json",retryConfig:{httpMethodsToRetry:["POST"]}});return this.rawToken=r.data,this.expiresAt=r.data.expires_in===null||r.data.expires_in===void 0?void 0:(iat+r.data.expires_in)*1e3,this.rawToken}catch(e){this.rawToken=void 0,this.tokenExpires=void 0;let body=e.response&&(!((_a=e.response)===null||_a===void 0)&&_a.data)?(_b=e.response)===null||_b===void 0?void 0:_b.data:{};if(body.error){let desc=body.error_description?`: ${body.error_description}`:"";e.message=`${body.error}${desc}`}throw e}},"_GoogleToken_requestToken")}});var require_jwtaccess=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/jwtaccess.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.JWTAccess=void 0;var jws=require_jws(),util_1=require_util4(),DEFAULT_HEADER={alg:"RS256",typ:"JWT"},JWTAccess=class{constructor(email,key,keyId,eagerRefreshThresholdMillis){this.cache=new util_1.LRUCache({capacity:500,maxAge:60*60*1e3}),this.email=email,this.key=key,this.keyId=keyId,this.eagerRefreshThresholdMillis=eagerRefreshThresholdMillis??5*60*1e3}getCachedKey(url,scopes){let cacheKey=url;if(scopes&&Array.isArray(scopes)&&scopes.length?cacheKey=url?`${url}_${scopes.join("_")}`:`${scopes.join("_")}`:typeof scopes=="string"&&(cacheKey=url?`${url}_${scopes}`:scopes),!cacheKey)throw Error("Scopes or url must be provided");return cacheKey}getRequestHeaders(url,additionalClaims,scopes){let key=this.getCachedKey(url,scopes),cachedToken=this.cache.get(key),now=Date.now();if(cachedToken&&cachedToken.expiration-now>this.eagerRefreshThresholdMillis)return cachedToken.headers;let iat=Math.floor(Date.now()/1e3),exp=JWTAccess.getExpirationTime(iat),defaultClaims;if(Array.isArray(scopes)&&(scopes=scopes.join(" ")),scopes?defaultClaims={iss:this.email,sub:this.email,scope:scopes,exp,iat}:defaultClaims={iss:this.email,sub:this.email,aud:url,exp,iat},additionalClaims){for(let claim in defaultClaims)if(additionalClaims[claim])throw new Error(`The '${claim}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`)}let header=this.keyId?{...DEFAULT_HEADER,kid:this.keyId}:DEFAULT_HEADER,payload=Object.assign(defaultClaims,additionalClaims),headers={Authorization:`Bearer ${jws.sign({header,payload,secret:this.key})}`};return this.cache.set(key,{expiration:exp*1e3,headers}),headers}static getExpirationTime(iat){return iat+3600}fromJSON(json){if(!json)throw new Error("Must pass in a JSON object containing the service account auth settings.");if(!json.client_email)throw new Error("The incoming JSON object does not contain a client_email field");if(!json.private_key)throw new Error("The incoming JSON object does not contain a private_key field");this.email=json.client_email,this.key=json.private_key,this.keyId=json.private_key_id,this.projectId=json.project_id}fromStream(inputStream,callback){if(callback)this.fromStreamAsync(inputStream).then(()=>callback(),callback);else return this.fromStreamAsync(inputStream)}fromStreamAsync(inputStream){return new Promise((resolve,reject)=>{inputStream||reject(new Error("Must pass in a stream containing the service account auth settings."));let s="";inputStream.setEncoding("utf8").on("data",chunk=>s+=chunk).on("error",reject).on("end",()=>{try{let data=JSON.parse(s);this.fromJSON(data),resolve()}catch(err){reject(err)}})})}};__name(JWTAccess,"JWTAccess");exports2.JWTAccess=JWTAccess}});var require_jwtclient=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/jwtclient.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.JWT=void 0;var gtoken_1=require_src5(),jwtaccess_1=require_jwtaccess(),oauth2client_1=require_oauth2client(),authclient_1=require_authclient(),JWT=class extends oauth2client_1.OAuth2Client{constructor(optionsOrEmail,keyFile,key,scopes,subject,keyId){let opts=optionsOrEmail&&typeof optionsOrEmail=="object"?optionsOrEmail:{email:optionsOrEmail,keyFile,key,keyId,scopes,subject};super(opts),this.email=opts.email,this.keyFile=opts.keyFile,this.key=opts.key,this.keyId=opts.keyId,this.scopes=opts.scopes,this.subject=opts.subject,this.additionalClaims=opts.additionalClaims,this.credentials={refresh_token:"jwt-placeholder",expiry_date:1}}createScoped(scopes){let jwt=new JWT(this);return jwt.scopes=scopes,jwt}async getRequestMetadataAsync(url){url=this.defaultServicePath?`https://${this.defaultServicePath}/`:url;let useSelfSignedJWT=!this.hasUserScopes()&&url||this.useJWTAccessWithScope&&this.hasAnyScopes()||this.universeDomain!==authclient_1.DEFAULT_UNIVERSE;if(this.subject&&this.universeDomain!==authclient_1.DEFAULT_UNIVERSE)throw new RangeError(`Service Account user is configured for the credential. Domain-wide delegation is not supported in universes other than ${authclient_1.DEFAULT_UNIVERSE}`);if(!this.apiKey&&useSelfSignedJWT)if(this.additionalClaims&&this.additionalClaims.target_audience){let{tokens}=await this.refreshToken();return{headers:this.addSharedMetadataHeaders({Authorization:`Bearer ${tokens.id_token}`})}}else{this.access||(this.access=new jwtaccess_1.JWTAccess(this.email,this.key,this.keyId,this.eagerRefreshThresholdMillis));let scopes;this.hasUserScopes()?scopes=this.scopes:url||(scopes=this.defaultScopes);let useScopes=this.useJWTAccessWithScope||this.universeDomain!==authclient_1.DEFAULT_UNIVERSE,headers=await this.access.getRequestHeaders(url??void 0,this.additionalClaims,useScopes?scopes:void 0);return{headers:this.addSharedMetadataHeaders(headers)}}else return this.hasAnyScopes()||this.apiKey?super.getRequestMetadataAsync(url):{headers:{}}}async fetchIdToken(targetAudience){let gtoken=new gtoken_1.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:{target_audience:targetAudience},transporter:this.transporter});if(await gtoken.getToken({forceRefresh:!0}),!gtoken.idToken)throw new Error("Unknown error: Failed to fetch ID token");return gtoken.idToken}hasUserScopes(){return this.scopes?this.scopes.length>0:!1}hasAnyScopes(){return!!(this.scopes&&this.scopes.length>0||this.defaultScopes&&this.defaultScopes.length>0)}authorize(callback){if(callback)this.authorizeAsync().then(r=>callback(null,r),callback);else return this.authorizeAsync()}async authorizeAsync(){let result=await this.refreshToken();if(!result)throw new Error("No result returned");return this.credentials=result.tokens,this.credentials.refresh_token="jwt-placeholder",this.key=this.gtoken.key,this.email=this.gtoken.iss,result.tokens}async refreshTokenNoCache(refreshToken){let gtoken=this.createGToken(),tokens={access_token:(await gtoken.getToken({forceRefresh:this.isTokenExpiring()})).access_token,token_type:"Bearer",expiry_date:gtoken.expiresAt,id_token:gtoken.idToken};return this.emit("tokens",tokens),{res:null,tokens}}createGToken(){return this.gtoken||(this.gtoken=new gtoken_1.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:this.additionalClaims,transporter:this.transporter})),this.gtoken}fromJSON(json){if(!json)throw new Error("Must pass in a JSON object containing the service account auth settings.");if(!json.client_email)throw new Error("The incoming JSON object does not contain a client_email field");if(!json.private_key)throw new Error("The incoming JSON object does not contain a private_key field");this.email=json.client_email,this.key=json.private_key,this.keyId=json.private_key_id,this.projectId=json.project_id,this.quotaProjectId=json.quota_project_id,this.universeDomain=json.universe_domain||this.universeDomain}fromStream(inputStream,callback){if(callback)this.fromStreamAsync(inputStream).then(()=>callback(),callback);else return this.fromStreamAsync(inputStream)}fromStreamAsync(inputStream){return new Promise((resolve,reject)=>{if(!inputStream)throw new Error("Must pass in a stream containing the service account auth settings.");let s="";inputStream.setEncoding("utf8").on("error",reject).on("data",chunk=>s+=chunk).on("end",()=>{try{let data=JSON.parse(s);this.fromJSON(data),resolve()}catch(e){reject(e)}})})}fromAPIKey(apiKey){if(typeof apiKey!="string")throw new Error("Must provide an API Key string.");this.apiKey=apiKey}async getCredentials(){if(this.key)return{private_key:this.key,client_email:this.email};if(this.keyFile){let creds=await this.createGToken().getCredentials(this.keyFile);return{private_key:creds.privateKey,client_email:creds.clientEmail}}throw new Error("A key or a keyFile must be provided to getCredentials.")}};__name(JWT,"JWT");exports2.JWT=JWT}});var require_refreshclient=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/refreshclient.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.UserRefreshClient=exports2.USER_REFRESH_ACCOUNT_TYPE=void 0;var oauth2client_1=require_oauth2client(),querystring_1=require("querystring");exports2.USER_REFRESH_ACCOUNT_TYPE="authorized_user";var UserRefreshClient=class extends oauth2client_1.OAuth2Client{constructor(optionsOrClientId,clientSecret,refreshToken,eagerRefreshThresholdMillis,forceRefreshOnFailure){let opts=optionsOrClientId&&typeof optionsOrClientId=="object"?optionsOrClientId:{clientId:optionsOrClientId,clientSecret,refreshToken,eagerRefreshThresholdMillis,forceRefreshOnFailure};super(opts),this._refreshToken=opts.refreshToken,this.credentials.refresh_token=opts.refreshToken}async refreshTokenNoCache(refreshToken){return super.refreshTokenNoCache(this._refreshToken)}async fetchIdToken(targetAudience){return(await this.transporter.request({...UserRefreshClient.RETRY_CONFIG,url:this.endpoints.oauth2TokenUrl,headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:(0,querystring_1.stringify)({client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token",refresh_token:this._refreshToken,target_audience:targetAudience})})).data.id_token}fromJSON(json){if(!json)throw new Error("Must pass in a JSON object containing the user refresh token");if(json.type!=="authorized_user")throw new Error('The incoming JSON object does not have the "authorized_user" type');if(!json.client_id)throw new Error("The incoming JSON object does not contain a client_id field");if(!json.client_secret)throw new Error("The incoming JSON object does not contain a client_secret field");if(!json.refresh_token)throw new Error("The incoming JSON object does not contain a refresh_token field");this._clientId=json.client_id,this._clientSecret=json.client_secret,this._refreshToken=json.refresh_token,this.credentials.refresh_token=json.refresh_token,this.quotaProjectId=json.quota_project_id,this.universeDomain=json.universe_domain||this.universeDomain}fromStream(inputStream,callback){if(callback)this.fromStreamAsync(inputStream).then(()=>callback(),callback);else return this.fromStreamAsync(inputStream)}async fromStreamAsync(inputStream){return new Promise((resolve,reject)=>{if(!inputStream)return reject(new Error("Must pass in a stream containing the user refresh token."));let s="";inputStream.setEncoding("utf8").on("error",reject).on("data",chunk=>s+=chunk).on("end",()=>{try{let data=JSON.parse(s);return this.fromJSON(data),resolve()}catch(err){return reject(err)}})})}};__name(UserRefreshClient,"UserRefreshClient");exports2.UserRefreshClient=UserRefreshClient}});var require_impersonated=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/impersonated.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Impersonated=exports2.IMPERSONATED_ACCOUNT_TYPE=void 0;var oauth2client_1=require_oauth2client(),gaxios_1=require_src3();exports2.IMPERSONATED_ACCOUNT_TYPE="impersonated_service_account";var Impersonated=class extends oauth2client_1.OAuth2Client{constructor(options={}){var _a,_b,_c,_d,_e,_f;super(options),this.credentials={expiry_date:1,refresh_token:"impersonated-placeholder"},this.sourceClient=(_a=options.sourceClient)!==null&&_a!==void 0?_a:new oauth2client_1.OAuth2Client,this.targetPrincipal=(_b=options.targetPrincipal)!==null&&_b!==void 0?_b:"",this.delegates=(_c=options.delegates)!==null&&_c!==void 0?_c:[],this.targetScopes=(_d=options.targetScopes)!==null&&_d!==void 0?_d:[],this.lifetime=(_e=options.lifetime)!==null&&_e!==void 0?_e:3600,this.endpoint=(_f=options.endpoint)!==null&&_f!==void 0?_f:"https://iamcredentials.googleapis.com"}async sign(blobToSign){await this.sourceClient.getAccessToken();let name=`projects/-/serviceAccounts/${this.targetPrincipal}`,u=`${this.endpoint}/v1/${name}:signBlob`,body={delegates:this.delegates,payload:Buffer.from(blobToSign).toString("base64")};return(await this.sourceClient.request({...Impersonated.RETRY_CONFIG,url:u,data:body,method:"POST"})).data}getTargetPrincipal(){return this.targetPrincipal}async refreshToken(){var _a,_b,_c,_d,_e,_f;try{await this.sourceClient.getAccessToken();let name="projects/-/serviceAccounts/"+this.targetPrincipal,u=`${this.endpoint}/v1/${name}:generateAccessToken`,body={delegates:this.delegates,scope:this.targetScopes,lifetime:this.lifetime+"s"},res=await this.sourceClient.request({...Impersonated.RETRY_CONFIG,url:u,data:body,method:"POST"}),tokenResponse=res.data;return this.credentials.access_token=tokenResponse.accessToken,this.credentials.expiry_date=Date.parse(tokenResponse.expireTime),{tokens:this.credentials,res}}catch(error){if(!(error instanceof Error))throw error;let status=0,message="";throw error instanceof gaxios_1.GaxiosError&&(status=(_c=(_b=(_a=error?.response)===null||_a===void 0?void 0:_a.data)===null||_b===void 0?void 0:_b.error)===null||_c===void 0?void 0:_c.status,message=(_f=(_e=(_d=error?.response)===null||_d===void 0?void 0:_d.data)===null||_e===void 0?void 0:_e.error)===null||_f===void 0?void 0:_f.message),status&&message?(error.message=`${status}: unable to impersonate: ${message}`,error):(error.message=`unable to impersonate: ${error}`,error)}}async fetchIdToken(targetAudience,options){var _a;await this.sourceClient.getAccessToken();let name=`projects/-/serviceAccounts/${this.targetPrincipal}`,u=`${this.endpoint}/v1/${name}:generateIdToken`,body={delegates:this.delegates,audience:targetAudience,includeEmail:(_a=options?.includeEmail)!==null&&_a!==void 0?_a:!0};return(await this.sourceClient.request({...Impersonated.RETRY_CONFIG,url:u,data:body,method:"POST"})).data.token}};__name(Impersonated,"Impersonated");exports2.Impersonated=Impersonated}});var require_oauth2common=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/oauth2common.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.getErrorFromOAuthErrorResponse=exports2.OAuthClientAuthHandler=void 0;var querystring=require("querystring"),crypto_1=require_crypto3(),METHODS_SUPPORTING_REQUEST_BODY=["PUT","POST","PATCH"],OAuthClientAuthHandler=class{constructor(clientAuthentication){this.clientAuthentication=clientAuthentication,this.crypto=(0,crypto_1.createCrypto)()}applyClientAuthenticationOptions(opts,bearerToken){this.injectAuthenticatedHeaders(opts,bearerToken),bearerToken||this.injectAuthenticatedRequestBody(opts)}injectAuthenticatedHeaders(opts,bearerToken){var _a;if(bearerToken)opts.headers=opts.headers||{},Object.assign(opts.headers,{Authorization:`Bearer ${bearerToken}}`});else if(((_a=this.clientAuthentication)===null||_a===void 0?void 0:_a.confidentialClientType)==="basic"){opts.headers=opts.headers||{};let clientId=this.clientAuthentication.clientId,clientSecret=this.clientAuthentication.clientSecret||"",base64EncodedCreds=this.crypto.encodeBase64StringUtf8(`${clientId}:${clientSecret}`);Object.assign(opts.headers,{Authorization:`Basic ${base64EncodedCreds}`})}}injectAuthenticatedRequestBody(opts){var _a;if(((_a=this.clientAuthentication)===null||_a===void 0?void 0:_a.confidentialClientType)==="request-body"){let method=(opts.method||"GET").toUpperCase();if(METHODS_SUPPORTING_REQUEST_BODY.indexOf(method)!==-1){let contentType,headers=opts.headers||{};for(let key in headers)if(key.toLowerCase()==="content-type"&&headers[key]){contentType=headers[key].toLowerCase();break}if(contentType==="application/x-www-form-urlencoded"){opts.data=opts.data||"";let data=querystring.parse(opts.data);Object.assign(data,{client_id:this.clientAuthentication.clientId,client_secret:this.clientAuthentication.clientSecret||""}),opts.data=querystring.stringify(data)}else if(contentType==="application/json")opts.data=opts.data||{},Object.assign(opts.data,{client_id:this.clientAuthentication.clientId,client_secret:this.clientAuthentication.clientSecret||""});else throw new Error(`${contentType} content-types are not supported with ${this.clientAuthentication.confidentialClientType} client authentication`)}else throw new Error(`${method} HTTP method does not support ${this.clientAuthentication.confidentialClientType} client authentication`)}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};__name(OAuthClientAuthHandler,"OAuthClientAuthHandler");exports2.OAuthClientAuthHandler=OAuthClientAuthHandler;function getErrorFromOAuthErrorResponse(resp,err){let errorCode=resp.error,errorDescription=resp.error_description,errorUri=resp.error_uri,message=`Error code ${errorCode}`;typeof errorDescription<"u"&&(message+=`: ${errorDescription}`),typeof errorUri<"u"&&(message+=` - ${errorUri}`);let newError=new Error(message);if(err){let keys=Object.keys(err);err.stack&&keys.push("stack"),keys.forEach(key=>{key!=="message"&&Object.defineProperty(newError,key,{value:err[key],writable:!1,enumerable:!0})})}return newError}__name(getErrorFromOAuthErrorResponse,"getErrorFromOAuthErrorResponse");exports2.getErrorFromOAuthErrorResponse=getErrorFromOAuthErrorResponse}});var require_stscredentials=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/stscredentials.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.StsCredentials=void 0;var gaxios_1=require_src3(),querystring=require("querystring"),transporters_1=require_transporters(),oauth2common_1=require_oauth2common(),StsCredentials=class extends oauth2common_1.OAuthClientAuthHandler{constructor(tokenExchangeEndpoint,clientAuthentication){super(clientAuthentication),this.tokenExchangeEndpoint=tokenExchangeEndpoint,this.transporter=new transporters_1.DefaultTransporter}async exchangeToken(stsCredentialsOptions,additionalHeaders,options){var _a,_b,_c;let values={grant_type:stsCredentialsOptions.grantType,resource:stsCredentialsOptions.resource,audience:stsCredentialsOptions.audience,scope:(_a=stsCredentialsOptions.scope)===null||_a===void 0?void 0:_a.join(" "),requested_token_type:stsCredentialsOptions.requestedTokenType,subject_token:stsCredentialsOptions.subjectToken,subject_token_type:stsCredentialsOptions.subjectTokenType,actor_token:(_b=stsCredentialsOptions.actingParty)===null||_b===void 0?void 0:_b.actorToken,actor_token_type:(_c=stsCredentialsOptions.actingParty)===null||_c===void 0?void 0:_c.actorTokenType,options:options&&JSON.stringify(options)};Object.keys(values).forEach(key=>{typeof values[key]>"u"&&delete values[key]});let headers={"Content-Type":"application/x-www-form-urlencoded"};Object.assign(headers,additionalHeaders||{});let opts={...StsCredentials.RETRY_CONFIG,url:this.tokenExchangeEndpoint.toString(),method:"POST",headers,data:querystring.stringify(values),responseType:"json"};this.applyClientAuthenticationOptions(opts);try{let response=await this.transporter.request(opts),stsSuccessfulResponse=response.data;return stsSuccessfulResponse.res=response,stsSuccessfulResponse}catch(error){throw error instanceof gaxios_1.GaxiosError&&error.response?(0,oauth2common_1.getErrorFromOAuthErrorResponse)(error.response.data,error):error}}};__name(StsCredentials,"StsCredentials");exports2.StsCredentials=StsCredentials}});var require_baseexternalclient=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/baseexternalclient.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.BaseExternalAccountClient=exports2.DEFAULT_UNIVERSE=exports2.CLOUD_RESOURCE_MANAGER=exports2.EXTERNAL_ACCOUNT_TYPE=exports2.EXPIRATION_TIME_OFFSET=void 0;var stream=require("stream"),authclient_1=require_authclient(),sts=require_stscredentials(),util_1=require_util4(),STS_GRANT_TYPE="urn:ietf:params:oauth:grant-type:token-exchange",STS_REQUEST_TOKEN_TYPE="urn:ietf:params:oauth:token-type:access_token",DEFAULT_OAUTH_SCOPE="https://www.googleapis.com/auth/cloud-platform",DEFAULT_TOKEN_LIFESPAN=3600;exports2.EXPIRATION_TIME_OFFSET=5*60*1e3;exports2.EXTERNAL_ACCOUNT_TYPE="external_account";exports2.CLOUD_RESOURCE_MANAGER="https://cloudresourcemanager.googleapis.com/v1/projects/";var WORKFORCE_AUDIENCE_PATTERN="//iam\\.googleapis\\.com/locations/[^/]+/workforcePools/[^/]+/providers/.+",DEFAULT_TOKEN_URL="https://sts.{universeDomain}/v1/token",pkg=require_package2(),authclient_2=require_authclient();Object.defineProperty(exports2,"DEFAULT_UNIVERSE",{enumerable:!0,get:function(){return authclient_2.DEFAULT_UNIVERSE}});var BaseExternalAccountClient=class extends authclient_1.AuthClient{constructor(options,additionalOptions){var _a;super({...options,...additionalOptions});let opts=(0,util_1.originalOrCamelOptions)(options),type=opts.get("type");if(type&&type!==exports2.EXTERNAL_ACCOUNT_TYPE)throw new Error(`Expected "${exports2.EXTERNAL_ACCOUNT_TYPE}" type but received "${options.type}"`);let clientId=opts.get("client_id"),clientSecret=opts.get("client_secret"),tokenUrl=(_a=opts.get("token_url"))!==null&&_a!==void 0?_a:DEFAULT_TOKEN_URL.replace("{universeDomain}",this.universeDomain),subjectTokenType=opts.get("subject_token_type"),workforcePoolUserProject=opts.get("workforce_pool_user_project"),serviceAccountImpersonationUrl=opts.get("service_account_impersonation_url"),serviceAccountImpersonation=opts.get("service_account_impersonation"),serviceAccountImpersonationLifetime=(0,util_1.originalOrCamelOptions)(serviceAccountImpersonation).get("token_lifetime_seconds");this.cloudResourceManagerURL=new URL(opts.get("cloud_resource_manager_url")||`https://cloudresourcemanager.${this.universeDomain}/v1/projects/`),clientId&&(this.clientAuth={confidentialClientType:"basic",clientId,clientSecret}),this.stsCredential=new sts.StsCredentials(tokenUrl,this.clientAuth),this.scopes=opts.get("scopes")||[DEFAULT_OAUTH_SCOPE],this.cachedAccessToken=null,this.audience=opts.get("audience"),this.subjectTokenType=subjectTokenType,this.workforcePoolUserProject=workforcePoolUserProject;let workforceAudiencePattern=new RegExp(WORKFORCE_AUDIENCE_PATTERN);if(this.workforcePoolUserProject&&!this.audience.match(workforceAudiencePattern))throw new Error("workforcePoolUserProject should not be set for non-workforce pool credentials.");this.serviceAccountImpersonationUrl=serviceAccountImpersonationUrl,this.serviceAccountImpersonationLifetime=serviceAccountImpersonationLifetime,this.serviceAccountImpersonationLifetime?this.configLifetimeRequested=!0:(this.configLifetimeRequested=!1,this.serviceAccountImpersonationLifetime=DEFAULT_TOKEN_LIFESPAN),this.projectNumber=this.getProjectNumber(this.audience),this.supplierContext={audience:this.audience,subjectTokenType:this.subjectTokenType,transporter:this.transporter}}getServiceAccountEmail(){var _a;if(this.serviceAccountImpersonationUrl){if(this.serviceAccountImpersonationUrl.length>256)throw new RangeError(`URL is too long: ${this.serviceAccountImpersonationUrl}`);let result=/serviceAccounts\/(?[^:]+):generateAccessToken$/.exec(this.serviceAccountImpersonationUrl);return((_a=result?.groups)===null||_a===void 0?void 0:_a.email)||null}return null}setCredentials(credentials){super.setCredentials(credentials),this.cachedAccessToken=credentials}async getAccessToken(){return(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let headers={Authorization:`Bearer ${(await this.getAccessToken()).token}`};return this.addSharedMetadataHeaders(headers)}request(opts,callback){if(callback)this.requestAsync(opts).then(r=>callback(null,r),e=>callback(e,e.response));else return this.requestAsync(opts)}async getProjectId(){let projectNumber=this.projectNumber||this.workforcePoolUserProject;if(this.projectId)return this.projectId;if(projectNumber){let headers=await this.getRequestHeaders(),response=await this.transporter.request({...BaseExternalAccountClient.RETRY_CONFIG,headers,url:`${this.cloudResourceManagerURL.toString()}${projectNumber}`,responseType:"json"});return this.projectId=response.data.projectId,this.projectId}return null}async requestAsync(opts,reAuthRetried=!1){let response;try{let requestHeaders=await this.getRequestHeaders();opts.headers=opts.headers||{},requestHeaders&&requestHeaders["x-goog-user-project"]&&(opts.headers["x-goog-user-project"]=requestHeaders["x-goog-user-project"]),requestHeaders&&requestHeaders.Authorization&&(opts.headers.Authorization=requestHeaders.Authorization),response=await this.transporter.request(opts)}catch(e){let res=e.response;if(res){let statusCode=res.status,isReadableStream=res.config.data instanceof stream.Readable;if(!reAuthRetried&&(statusCode===401||statusCode===403)&&!isReadableStream&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(opts,!0)}throw e}return response}async refreshAccessTokenAsync(){let subjectToken=await this.retrieveSubjectToken(),stsCredentialsOptions={grantType:STS_GRANT_TYPE,audience:this.audience,requestedTokenType:STS_REQUEST_TOKEN_TYPE,subjectToken,subjectTokenType:this.subjectTokenType,scope:this.serviceAccountImpersonationUrl?[DEFAULT_OAUTH_SCOPE]:this.getScopesArray()},additionalOptions=!this.clientAuth&&this.workforcePoolUserProject?{userProject:this.workforcePoolUserProject}:void 0,additionalHeaders={"x-goog-api-client":this.getMetricsHeaderValue()},stsResponse=await this.stsCredential.exchangeToken(stsCredentialsOptions,additionalHeaders,additionalOptions);return this.serviceAccountImpersonationUrl?this.cachedAccessToken=await this.getImpersonatedAccessToken(stsResponse.access_token):stsResponse.expires_in?this.cachedAccessToken={access_token:stsResponse.access_token,expiry_date:new Date().getTime()+stsResponse.expires_in*1e3,res:stsResponse.res}:this.cachedAccessToken={access_token:stsResponse.access_token,res:stsResponse.res},this.credentials={},Object.assign(this.credentials,this.cachedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedAccessToken.expiry_date,access_token:this.cachedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedAccessToken}getProjectNumber(audience){let match=audience.match(/\/projects\/([^/]+)/);return match?match[1]:null}async getImpersonatedAccessToken(token){let opts={...BaseExternalAccountClient.RETRY_CONFIG,url:this.serviceAccountImpersonationUrl,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${token}`},data:{scope:this.getScopesArray(),lifetime:this.serviceAccountImpersonationLifetime+"s"},responseType:"json"},response=await this.transporter.request(opts),successResponse=response.data;return{access_token:successResponse.accessToken,expiry_date:new Date(successResponse.expireTime).getTime(),res:response}}isExpired(accessToken){let now=new Date().getTime();return accessToken.expiry_date?now>=accessToken.expiry_date-this.eagerRefreshThresholdMillis:!1}getScopesArray(){return typeof this.scopes=="string"?[this.scopes]:this.scopes||[DEFAULT_OAUTH_SCOPE]}getMetricsHeaderValue(){let nodeVersion=process.version.replace(/^v/,""),saImpersonation=this.serviceAccountImpersonationUrl!==void 0,credentialSourceType=this.credentialSourceType?this.credentialSourceType:"unknown";return`gl-node/${nodeVersion} auth/${pkg.version} google-byoid-sdk source/${credentialSourceType} sa-impersonation/${saImpersonation} config-lifetime/${this.configLifetimeRequested}`}};__name(BaseExternalAccountClient,"BaseExternalAccountClient");exports2.BaseExternalAccountClient=BaseExternalAccountClient}});var require_filesubjecttokensupplier=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/filesubjecttokensupplier.js"(exports2){"use strict";var _a,_b,_c;Object.defineProperty(exports2,"__esModule",{value:!0});exports2.FileSubjectTokenSupplier=void 0;var util_1=require("util"),fs=require("fs"),readFile=(0,util_1.promisify)((_a=fs.readFile)!==null&&_a!==void 0?_a:()=>{}),realpath=(0,util_1.promisify)((_b=fs.realpath)!==null&&_b!==void 0?_b:()=>{}),lstat=(0,util_1.promisify)((_c=fs.lstat)!==null&&_c!==void 0?_c:()=>{}),FileSubjectTokenSupplier=class{constructor(opts){this.filePath=opts.filePath,this.formatType=opts.formatType,this.subjectTokenFieldName=opts.subjectTokenFieldName}async getSubjectToken(context){let parsedFilePath=this.filePath;try{if(parsedFilePath=await realpath(parsedFilePath),!(await lstat(parsedFilePath)).isFile())throw new Error}catch(err){throw err instanceof Error&&(err.message=`The file at ${parsedFilePath} does not exist, or it is not a file. ${err.message}`),err}let subjectToken,rawText=await readFile(parsedFilePath,{encoding:"utf8"});if(this.formatType==="text"?subjectToken=rawText:this.formatType==="json"&&this.subjectTokenFieldName&&(subjectToken=JSON.parse(rawText)[this.subjectTokenFieldName]),!subjectToken)throw new Error("Unable to parse the subject_token from the credential_source file");return subjectToken}};__name(FileSubjectTokenSupplier,"FileSubjectTokenSupplier");exports2.FileSubjectTokenSupplier=FileSubjectTokenSupplier}});var require_urlsubjecttokensupplier=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/urlsubjecttokensupplier.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.UrlSubjectTokenSupplier=void 0;var UrlSubjectTokenSupplier=class{constructor(opts){this.url=opts.url,this.formatType=opts.formatType,this.subjectTokenFieldName=opts.subjectTokenFieldName,this.headers=opts.headers,this.additionalGaxiosOptions=opts.additionalGaxiosOptions}async getSubjectToken(context){let opts={...this.additionalGaxiosOptions,url:this.url,method:"GET",headers:this.headers,responseType:this.formatType},subjectToken;if(this.formatType==="text"?subjectToken=(await context.transporter.request(opts)).data:this.formatType==="json"&&this.subjectTokenFieldName&&(subjectToken=(await context.transporter.request(opts)).data[this.subjectTokenFieldName]),!subjectToken)throw new Error("Unable to parse the subject_token from the credential_source URL");return subjectToken}};__name(UrlSubjectTokenSupplier,"UrlSubjectTokenSupplier");exports2.UrlSubjectTokenSupplier=UrlSubjectTokenSupplier}});var require_identitypoolclient=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/identitypoolclient.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.IdentityPoolClient=void 0;var baseexternalclient_1=require_baseexternalclient(),util_1=require_util4(),filesubjecttokensupplier_1=require_filesubjecttokensupplier(),urlsubjecttokensupplier_1=require_urlsubjecttokensupplier(),IdentityPoolClient=class extends baseexternalclient_1.BaseExternalAccountClient{constructor(options,additionalOptions){super(options,additionalOptions);let opts=(0,util_1.originalOrCamelOptions)(options),credentialSource=opts.get("credential_source"),subjectTokenSupplier=opts.get("subject_token_supplier");if(!credentialSource&&!subjectTokenSupplier)throw new Error("A credential source or subject token supplier must be specified.");if(credentialSource&&subjectTokenSupplier)throw new Error("Only one of credential source or subject token supplier can be specified.");if(subjectTokenSupplier)this.subjectTokenSupplier=subjectTokenSupplier,this.credentialSourceType="programmatic";else{let credentialSourceOpts=(0,util_1.originalOrCamelOptions)(credentialSource),formatOpts=(0,util_1.originalOrCamelOptions)(credentialSourceOpts.get("format")),formatType=formatOpts.get("type")||"text",formatSubjectTokenFieldName=formatOpts.get("subject_token_field_name");if(formatType!=="json"&&formatType!=="text")throw new Error(`Invalid credential_source format "${formatType}"`);if(formatType==="json"&&!formatSubjectTokenFieldName)throw new Error("Missing subject_token_field_name for JSON credential_source format");let file=credentialSourceOpts.get("file"),url=credentialSourceOpts.get("url"),headers=credentialSourceOpts.get("headers");if(file&&url)throw new Error('No valid Identity Pool "credential_source" provided, must be either file or url.');if(file&&!url)this.credentialSourceType="file",this.subjectTokenSupplier=new filesubjecttokensupplier_1.FileSubjectTokenSupplier({filePath:file,formatType,subjectTokenFieldName:formatSubjectTokenFieldName});else if(!file&&url)this.credentialSourceType="url",this.subjectTokenSupplier=new urlsubjecttokensupplier_1.UrlSubjectTokenSupplier({url,formatType,subjectTokenFieldName:formatSubjectTokenFieldName,headers,additionalGaxiosOptions:IdentityPoolClient.RETRY_CONFIG});else throw new Error('No valid Identity Pool "credential_source" provided, must be either file or url.')}}async retrieveSubjectToken(){return this.subjectTokenSupplier.getSubjectToken(this.supplierContext)}};__name(IdentityPoolClient,"IdentityPoolClient");exports2.IdentityPoolClient=IdentityPoolClient}});var require_awsrequestsigner=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/awsrequestsigner.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.AwsRequestSigner=void 0;var crypto_1=require_crypto3(),AWS_ALGORITHM="AWS4-HMAC-SHA256",AWS_REQUEST_TYPE="aws4_request",AwsRequestSigner=class{constructor(getCredentials,region){this.getCredentials=getCredentials,this.region=region,this.crypto=(0,crypto_1.createCrypto)()}async getRequestOptions(amzOptions){if(!amzOptions.url)throw new Error('"url" is required in "amzOptions"');let requestPayloadData=typeof amzOptions.data=="object"?JSON.stringify(amzOptions.data):amzOptions.data,url=amzOptions.url,method=amzOptions.method||"GET",requestPayload=amzOptions.body||requestPayloadData,additionalAmzHeaders=amzOptions.headers,awsSecurityCredentials=await this.getCredentials(),uri=new URL(url),headerMap=await generateAuthenticationHeaderMap({crypto:this.crypto,host:uri.host,canonicalUri:uri.pathname,canonicalQuerystring:uri.search.substr(1),method,region:this.region,securityCredentials:awsSecurityCredentials,requestPayload,additionalAmzHeaders}),headers=Object.assign(headerMap.amzDate?{"x-amz-date":headerMap.amzDate}:{},{Authorization:headerMap.authorizationHeader,host:uri.host},additionalAmzHeaders||{});awsSecurityCredentials.token&&Object.assign(headers,{"x-amz-security-token":awsSecurityCredentials.token});let awsSignedReq={url,method,headers};return typeof requestPayload<"u"&&(awsSignedReq.body=requestPayload),awsSignedReq}};__name(AwsRequestSigner,"AwsRequestSigner");exports2.AwsRequestSigner=AwsRequestSigner;async function sign(crypto6,key,msg){return await crypto6.signWithHmacSha256(key,msg)}__name(sign,"sign");async function getSigningKey(crypto6,key,dateStamp,region,serviceName){let kDate=await sign(crypto6,`AWS4${key}`,dateStamp),kRegion=await sign(crypto6,kDate,region),kService=await sign(crypto6,kRegion,serviceName);return await sign(crypto6,kService,"aws4_request")}__name(getSigningKey,"getSigningKey");async function generateAuthenticationHeaderMap(options){let additionalAmzHeaders=options.additionalAmzHeaders||{},requestPayload=options.requestPayload||"",serviceName=options.host.split(".")[0],now=new Date,amzDate=now.toISOString().replace(/[-:]/g,"").replace(/\.[0-9]+/,""),dateStamp=now.toISOString().replace(/[-]/g,"").replace(/T.*/,""),reformattedAdditionalAmzHeaders={};Object.keys(additionalAmzHeaders).forEach(key=>{reformattedAdditionalAmzHeaders[key.toLowerCase()]=additionalAmzHeaders[key]}),options.securityCredentials.token&&(reformattedAdditionalAmzHeaders["x-amz-security-token"]=options.securityCredentials.token);let amzHeaders=Object.assign({host:options.host},reformattedAdditionalAmzHeaders.date?{}:{"x-amz-date":amzDate},reformattedAdditionalAmzHeaders),canonicalHeaders="",signedHeadersList=Object.keys(amzHeaders).sort();signedHeadersList.forEach(key=>{canonicalHeaders+=`${key}:${amzHeaders[key]} `});let signedHeaders=signedHeadersList.join(";"),payloadHash=await options.crypto.sha256DigestHex(requestPayload),canonicalRequest=`${options.method} ${options.canonicalUri} ${options.canonicalQuerystring} ${canonicalHeaders} ${signedHeaders} ${payloadHash}`,credentialScope=`${dateStamp}/${options.region}/${serviceName}/${AWS_REQUEST_TYPE}`,stringToSign=`${AWS_ALGORITHM} ${amzDate} ${credentialScope} `+await options.crypto.sha256DigestHex(canonicalRequest),signingKey=await getSigningKey(options.crypto,options.securityCredentials.secretAccessKey,dateStamp,options.region,serviceName),signature=await sign(options.crypto,signingKey,stringToSign),authorizationHeader=`${AWS_ALGORITHM} Credential=${options.securityCredentials.accessKeyId}/${credentialScope}, SignedHeaders=${signedHeaders}, Signature=${(0,crypto_1.fromArrayBufferToHex)(signature)}`;return{amzDate:reformattedAdditionalAmzHeaders.date?void 0:amzDate,authorizationHeader,canonicalQuerystring:options.canonicalQuerystring}}__name(generateAuthenticationHeaderMap,"generateAuthenticationHeaderMap")}});var require_defaultawssecuritycredentialssupplier=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/defaultawssecuritycredentialssupplier.js"(exports2){"use strict";var __classPrivateFieldGet=exports2&&exports2.__classPrivateFieldGet||function(receiver,state,kind,f){if(kind==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof state=="function"?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot read private member from an object whose class did not declare it");return kind==="m"?f:kind==="a"?f.call(receiver):f?f.value:state.get(receiver)},_DefaultAwsSecurityCredentialsSupplier_instances,_DefaultAwsSecurityCredentialsSupplier_getImdsV2SessionToken,_DefaultAwsSecurityCredentialsSupplier_getAwsRoleName,_DefaultAwsSecurityCredentialsSupplier_retrieveAwsSecurityCredentials,_DefaultAwsSecurityCredentialsSupplier_regionFromEnv_get,_DefaultAwsSecurityCredentialsSupplier_securityCredentialsFromEnv_get;Object.defineProperty(exports2,"__esModule",{value:!0});exports2.DefaultAwsSecurityCredentialsSupplier=void 0;var DefaultAwsSecurityCredentialsSupplier=class{constructor(opts){_DefaultAwsSecurityCredentialsSupplier_instances.add(this),this.regionUrl=opts.regionUrl,this.securityCredentialsUrl=opts.securityCredentialsUrl,this.imdsV2SessionTokenUrl=opts.imdsV2SessionTokenUrl,this.additionalGaxiosOptions=opts.additionalGaxiosOptions}async getAwsRegion(context){if(__classPrivateFieldGet(this,_DefaultAwsSecurityCredentialsSupplier_instances,"a",_DefaultAwsSecurityCredentialsSupplier_regionFromEnv_get))return __classPrivateFieldGet(this,_DefaultAwsSecurityCredentialsSupplier_instances,"a",_DefaultAwsSecurityCredentialsSupplier_regionFromEnv_get);let metadataHeaders={};if(!__classPrivateFieldGet(this,_DefaultAwsSecurityCredentialsSupplier_instances,"a",_DefaultAwsSecurityCredentialsSupplier_regionFromEnv_get)&&this.imdsV2SessionTokenUrl&&(metadataHeaders["x-aws-ec2-metadata-token"]=await __classPrivateFieldGet(this,_DefaultAwsSecurityCredentialsSupplier_instances,"m",_DefaultAwsSecurityCredentialsSupplier_getImdsV2SessionToken).call(this,context.transporter)),!this.regionUrl)throw new Error('Unable to determine AWS region due to missing "options.credential_source.region_url"');let opts={...this.additionalGaxiosOptions,url:this.regionUrl,method:"GET",responseType:"text",headers:metadataHeaders},response=await context.transporter.request(opts);return response.data.substr(0,response.data.length-1)}async getAwsSecurityCredentials(context){if(__classPrivateFieldGet(this,_DefaultAwsSecurityCredentialsSupplier_instances,"a",_DefaultAwsSecurityCredentialsSupplier_securityCredentialsFromEnv_get))return __classPrivateFieldGet(this,_DefaultAwsSecurityCredentialsSupplier_instances,"a",_DefaultAwsSecurityCredentialsSupplier_securityCredentialsFromEnv_get);let metadataHeaders={};this.imdsV2SessionTokenUrl&&(metadataHeaders["x-aws-ec2-metadata-token"]=await __classPrivateFieldGet(this,_DefaultAwsSecurityCredentialsSupplier_instances,"m",_DefaultAwsSecurityCredentialsSupplier_getImdsV2SessionToken).call(this,context.transporter));let roleName=await __classPrivateFieldGet(this,_DefaultAwsSecurityCredentialsSupplier_instances,"m",_DefaultAwsSecurityCredentialsSupplier_getAwsRoleName).call(this,metadataHeaders,context.transporter),awsCreds=await __classPrivateFieldGet(this,_DefaultAwsSecurityCredentialsSupplier_instances,"m",_DefaultAwsSecurityCredentialsSupplier_retrieveAwsSecurityCredentials).call(this,roleName,metadataHeaders,context.transporter);return{accessKeyId:awsCreds.AccessKeyId,secretAccessKey:awsCreds.SecretAccessKey,token:awsCreds.Token}}};__name(DefaultAwsSecurityCredentialsSupplier,"DefaultAwsSecurityCredentialsSupplier");exports2.DefaultAwsSecurityCredentialsSupplier=DefaultAwsSecurityCredentialsSupplier;_DefaultAwsSecurityCredentialsSupplier_instances=new WeakSet,_DefaultAwsSecurityCredentialsSupplier_getImdsV2SessionToken=__name(async function(transporter){let opts={...this.additionalGaxiosOptions,url:this.imdsV2SessionTokenUrl,method:"PUT",responseType:"text",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};return(await transporter.request(opts)).data},"_DefaultAwsSecurityCredentialsSupplier_getImdsV2SessionToken"),_DefaultAwsSecurityCredentialsSupplier_getAwsRoleName=__name(async function(headers,transporter){if(!this.securityCredentialsUrl)throw new Error('Unable to determine AWS role name due to missing "options.credential_source.url"');let opts={...this.additionalGaxiosOptions,url:this.securityCredentialsUrl,method:"GET",responseType:"text",headers};return(await transporter.request(opts)).data},"_DefaultAwsSecurityCredentialsSupplier_getAwsRoleName"),_DefaultAwsSecurityCredentialsSupplier_retrieveAwsSecurityCredentials=__name(async function(roleName,headers,transporter){return(await transporter.request({...this.additionalGaxiosOptions,url:`${this.securityCredentialsUrl}/${roleName}`,responseType:"json",headers})).data},"_DefaultAwsSecurityCredentialsSupplier_retrieveAwsSecurityCredentials"),_DefaultAwsSecurityCredentialsSupplier_regionFromEnv_get=__name(function(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||null},"_DefaultAwsSecurityCredentialsSupplier_regionFromEnv_get"),_DefaultAwsSecurityCredentialsSupplier_securityCredentialsFromEnv_get=__name(function(){return process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY?{accessKeyId:process.env.AWS_ACCESS_KEY_ID,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY,token:process.env.AWS_SESSION_TOKEN}:null},"_DefaultAwsSecurityCredentialsSupplier_securityCredentialsFromEnv_get")}});var require_awsclient=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/awsclient.js"(exports2){"use strict";var __classPrivateFieldGet=exports2&&exports2.__classPrivateFieldGet||function(receiver,state,kind,f){if(kind==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof state=="function"?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot read private member from an object whose class did not declare it");return kind==="m"?f:kind==="a"?f.call(receiver):f?f.value:state.get(receiver)},_a,_AwsClient_DEFAULT_AWS_REGIONAL_CREDENTIAL_VERIFICATION_URL;Object.defineProperty(exports2,"__esModule",{value:!0});exports2.AwsClient=void 0;var awsrequestsigner_1=require_awsrequestsigner(),baseexternalclient_1=require_baseexternalclient(),defaultawssecuritycredentialssupplier_1=require_defaultawssecuritycredentialssupplier(),util_1=require_util4(),AwsClient=class extends baseexternalclient_1.BaseExternalAccountClient{constructor(options,additionalOptions){super(options,additionalOptions);let opts=(0,util_1.originalOrCamelOptions)(options),credentialSource=opts.get("credential_source"),awsSecurityCredentialsSupplier=opts.get("aws_security_credentials_supplier");if(!credentialSource&&!awsSecurityCredentialsSupplier)throw new Error("A credential source or AWS security credentials supplier must be specified.");if(credentialSource&&awsSecurityCredentialsSupplier)throw new Error("Only one of credential source or AWS security credentials supplier can be specified.");if(awsSecurityCredentialsSupplier)this.awsSecurityCredentialsSupplier=awsSecurityCredentialsSupplier,this.regionalCredVerificationUrl=__classPrivateFieldGet(_a,_a,"f",_AwsClient_DEFAULT_AWS_REGIONAL_CREDENTIAL_VERIFICATION_URL),this.credentialSourceType="programmatic";else{let credentialSourceOpts=(0,util_1.originalOrCamelOptions)(credentialSource);this.environmentId=credentialSourceOpts.get("environment_id");let regionUrl=credentialSourceOpts.get("region_url"),securityCredentialsUrl=credentialSourceOpts.get("url"),imdsV2SessionTokenUrl=credentialSourceOpts.get("imdsv2_session_token_url");this.awsSecurityCredentialsSupplier=new defaultawssecuritycredentialssupplier_1.DefaultAwsSecurityCredentialsSupplier({regionUrl,securityCredentialsUrl,imdsV2SessionTokenUrl}),this.regionalCredVerificationUrl=credentialSourceOpts.get("regional_cred_verification_url"),this.credentialSourceType="aws",this.validateEnvironmentId()}this.awsRequestSigner=null,this.region=""}validateEnvironmentId(){var _b;let match=(_b=this.environmentId)===null||_b===void 0?void 0:_b.match(/^(aws)(\d+)$/);if(!match||!this.regionalCredVerificationUrl)throw new Error('No valid AWS "credential_source" provided');if(parseInt(match[2],10)!==1)throw new Error(`aws version "${match[2]}" is not supported in the current build.`)}async retrieveSubjectToken(){this.awsRequestSigner||(this.region=await this.awsSecurityCredentialsSupplier.getAwsRegion(this.supplierContext),this.awsRequestSigner=new awsrequestsigner_1.AwsRequestSigner(async()=>this.awsSecurityCredentialsSupplier.getAwsSecurityCredentials(this.supplierContext),this.region));let options=await this.awsRequestSigner.getRequestOptions({..._a.RETRY_CONFIG,url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"}),reformattedHeader=[],extendedHeaders=Object.assign({"x-goog-cloud-target-resource":this.audience},options.headers);for(let key in extendedHeaders)reformattedHeader.push({key,value:extendedHeaders[key]});return encodeURIComponent(JSON.stringify({url:options.url,method:options.method,headers:reformattedHeader}))}};__name(AwsClient,"AwsClient");exports2.AwsClient=AwsClient;_a=AwsClient;_AwsClient_DEFAULT_AWS_REGIONAL_CREDENTIAL_VERIFICATION_URL={value:"https://sts.{region}.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15"};AwsClient.AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";AwsClient.AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254"}});var require_executable_response=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/executable-response.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.InvalidSubjectTokenError=exports2.InvalidMessageFieldError=exports2.InvalidCodeFieldError=exports2.InvalidTokenTypeFieldError=exports2.InvalidExpirationTimeFieldError=exports2.InvalidSuccessFieldError=exports2.InvalidVersionFieldError=exports2.ExecutableResponseError=exports2.ExecutableResponse=void 0;var SAML_SUBJECT_TOKEN_TYPE="urn:ietf:params:oauth:token-type:saml2",OIDC_SUBJECT_TOKEN_TYPE1="urn:ietf:params:oauth:token-type:id_token",OIDC_SUBJECT_TOKEN_TYPE2="urn:ietf:params:oauth:token-type:jwt",ExecutableResponse=class{constructor(responseJson){if(!responseJson.version)throw new InvalidVersionFieldError("Executable response must contain a 'version' field.");if(responseJson.success===void 0)throw new InvalidSuccessFieldError("Executable response must contain a 'success' field.");if(this.version=responseJson.version,this.success=responseJson.success,this.success){if(this.expirationTime=responseJson.expiration_time,this.tokenType=responseJson.token_type,this.tokenType!==SAML_SUBJECT_TOKEN_TYPE&&this.tokenType!==OIDC_SUBJECT_TOKEN_TYPE1&&this.tokenType!==OIDC_SUBJECT_TOKEN_TYPE2)throw new InvalidTokenTypeFieldError(`Executable response must contain a 'token_type' field when successful and it must be one of ${OIDC_SUBJECT_TOKEN_TYPE1}, ${OIDC_SUBJECT_TOKEN_TYPE2}, or ${SAML_SUBJECT_TOKEN_TYPE}.`);if(this.tokenType===SAML_SUBJECT_TOKEN_TYPE){if(!responseJson.saml_response)throw new InvalidSubjectTokenError(`Executable response must contain a 'saml_response' field when token_type=${SAML_SUBJECT_TOKEN_TYPE}.`);this.subjectToken=responseJson.saml_response}else{if(!responseJson.id_token)throw new InvalidSubjectTokenError(`Executable response must contain a 'id_token' field when token_type=${OIDC_SUBJECT_TOKEN_TYPE1} or ${OIDC_SUBJECT_TOKEN_TYPE2}.`);this.subjectToken=responseJson.id_token}}else{if(!responseJson.code)throw new InvalidCodeFieldError("Executable response must contain a 'code' field when unsuccessful.");if(!responseJson.message)throw new InvalidMessageFieldError("Executable response must contain a 'message' field when unsuccessful.");this.errorCode=responseJson.code,this.errorMessage=responseJson.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==void 0&&this.expirationTime{let child=childProcess.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(envMap)}}),output="";child.stdout.on("data",data=>{output+=data}),child.stderr.on("data",err=>{output+=err});let timeout=setTimeout(()=>(child.removeAllListeners(),child.kill(),reject(new Error("The executable failed to finish within the timeout specified."))),this.timeoutMillis);child.on("close",code=>{if(clearTimeout(timeout),code===0)try{let responseJson=JSON.parse(output),response=new executable_response_1.ExecutableResponse(responseJson);return resolve(response)}catch(error){return error instanceof executable_response_1.ExecutableResponseError?reject(error):reject(new executable_response_1.ExecutableResponseError(`The executable returned an invalid response: ${output}`))}else return reject(new pluggable_auth_client_1.ExecutableError(output,code.toString()))})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0)return;let filePath;try{filePath=await fs.promises.realpath(this.outputFile)}catch{return}if(!(await fs.promises.lstat(filePath)).isFile())return;let responseString=await fs.promises.readFile(filePath,{encoding:"utf8"});if(responseString!=="")try{let responseJson=JSON.parse(responseString);return new executable_response_1.ExecutableResponse(responseJson).isValid()?new executable_response_1.ExecutableResponse(responseJson):void 0}catch(error){throw error instanceof executable_response_1.ExecutableResponseError?error:new executable_response_1.ExecutableResponseError(`The output file contained an invalid response: ${responseString}`)}}static parseCommand(command){let components=command.match(/(?:[^\s"]+|"[^"]*")+/g);if(!components)throw new Error(`Provided command: "${command}" could not be parsed.`);for(let i=0;iMAXIMUM_EXECUTABLE_TIMEOUT_MILLIS)throw new Error(`Timeout must be between ${MINIMUM_EXECUTABLE_TIMEOUT_MILLIS} and ${MAXIMUM_EXECUTABLE_TIMEOUT_MILLIS} milliseconds.`);this.outputFile=options.credential_source.executable.output_file,this.handler=new pluggable_auth_handler_1.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile}),this.credentialSourceType="executable"}async retrieveSubjectToken(){if(process.env[GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES]!=="1")throw new Error("Pluggable Auth executables need to be explicitly allowed to run by setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment Variable to 1.");let executableResponse;if(this.outputFile&&(executableResponse=await this.handler.retrieveCachedResponse()),!executableResponse){let envMap=new Map;envMap.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience),envMap.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType),envMap.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0"),this.outputFile&&envMap.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile);let serviceAccountEmail=this.getServiceAccountEmail();serviceAccountEmail&&envMap.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",serviceAccountEmail),executableResponse=await this.handler.retrieveResponseFromExecutable(envMap)}if(executableResponse.version>MAXIMUM_EXECUTABLE_VERSION)throw new Error(`Version of executable is not currently supported, maximum supported version is ${MAXIMUM_EXECUTABLE_VERSION}.`);if(!executableResponse.success)throw new ExecutableError(executableResponse.errorMessage,executableResponse.errorCode);if(this.outputFile&&!executableResponse.expirationTime)throw new executable_response_1.InvalidExpirationTimeFieldError("The executable response must contain the `expiration_time` field for successful responses when an output_file has been specified in the configuration.");if(executableResponse.isExpired())throw new Error("Executable response is expired.");return executableResponse.subjectToken}};__name(PluggableAuthClient,"PluggableAuthClient");exports2.PluggableAuthClient=PluggableAuthClient}});var require_externalclient=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/externalclient.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.ExternalAccountClient=void 0;var baseexternalclient_1=require_baseexternalclient(),identitypoolclient_1=require_identitypoolclient(),awsclient_1=require_awsclient(),pluggable_auth_client_1=require_pluggable_auth_client(),ExternalAccountClient=class{constructor(){throw new Error("ExternalAccountClients should be initialized via: ExternalAccountClient.fromJSON(), directly via explicit constructors, eg. new AwsClient(options), new IdentityPoolClient(options), newPluggableAuthClientOptions, or via new GoogleAuth(options).getClient()")}static fromJSON(options,additionalOptions){var _a,_b;return options&&options.type===baseexternalclient_1.EXTERNAL_ACCOUNT_TYPE?!((_a=options.credential_source)===null||_a===void 0)&&_a.environment_id?new awsclient_1.AwsClient(options,additionalOptions):!((_b=options.credential_source)===null||_b===void 0)&&_b.executable?new pluggable_auth_client_1.PluggableAuthClient(options,additionalOptions):new identitypoolclient_1.IdentityPoolClient(options,additionalOptions):null}};__name(ExternalAccountClient,"ExternalAccountClient");exports2.ExternalAccountClient=ExternalAccountClient}});var require_externalAccountAuthorizedUserClient=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/externalAccountAuthorizedUserClient.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.ExternalAccountAuthorizedUserClient=exports2.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var authclient_1=require_authclient(),oauth2common_1=require_oauth2common(),gaxios_1=require_src3(),stream=require("stream"),baseexternalclient_1=require_baseexternalclient();exports2.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var DEFAULT_TOKEN_URL="https://sts.{universeDomain}/v1/oauthtoken",ExternalAccountAuthorizedUserHandler=class extends oauth2common_1.OAuthClientAuthHandler{constructor(url,transporter,clientAuthentication){super(clientAuthentication),this.url=url,this.transporter=transporter}async refreshToken(refreshToken,additionalHeaders){let values=new URLSearchParams({grant_type:"refresh_token",refresh_token:refreshToken}),headers={"Content-Type":"application/x-www-form-urlencoded",...additionalHeaders},opts={...ExternalAccountAuthorizedUserHandler.RETRY_CONFIG,url:this.url,method:"POST",headers,data:values.toString(),responseType:"json"};this.applyClientAuthenticationOptions(opts);try{let response=await this.transporter.request(opts),tokenRefreshResponse=response.data;return tokenRefreshResponse.res=response,tokenRefreshResponse}catch(error){throw error instanceof gaxios_1.GaxiosError&&error.response?(0,oauth2common_1.getErrorFromOAuthErrorResponse)(error.response.data,error):error}}};__name(ExternalAccountAuthorizedUserHandler,"ExternalAccountAuthorizedUserHandler");var ExternalAccountAuthorizedUserClient=class extends authclient_1.AuthClient{constructor(options,additionalOptions){var _a;super({...options,...additionalOptions}),options.universe_domain&&(this.universeDomain=options.universe_domain),this.refreshToken=options.refresh_token;let clientAuth={confidentialClientType:"basic",clientId:options.client_id,clientSecret:options.client_secret};this.externalAccountAuthorizedUserHandler=new ExternalAccountAuthorizedUserHandler((_a=options.token_url)!==null&&_a!==void 0?_a:DEFAULT_TOKEN_URL.replace("{universeDomain}",this.universeDomain),this.transporter,clientAuth),this.cachedAccessToken=null,this.quotaProjectId=options.quota_project_id,typeof additionalOptions?.eagerRefreshThresholdMillis!="number"?this.eagerRefreshThresholdMillis=baseexternalclient_1.EXPIRATION_TIME_OFFSET:this.eagerRefreshThresholdMillis=additionalOptions.eagerRefreshThresholdMillis,this.forceRefreshOnFailure=!!additionalOptions?.forceRefreshOnFailure}async getAccessToken(){return(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let headers={Authorization:`Bearer ${(await this.getAccessToken()).token}`};return this.addSharedMetadataHeaders(headers)}request(opts,callback){if(callback)this.requestAsync(opts).then(r=>callback(null,r),e=>callback(e,e.response));else return this.requestAsync(opts)}async requestAsync(opts,reAuthRetried=!1){let response;try{let requestHeaders=await this.getRequestHeaders();opts.headers=opts.headers||{},requestHeaders&&requestHeaders["x-goog-user-project"]&&(opts.headers["x-goog-user-project"]=requestHeaders["x-goog-user-project"]),requestHeaders&&requestHeaders.Authorization&&(opts.headers.Authorization=requestHeaders.Authorization),response=await this.transporter.request(opts)}catch(e){let res=e.response;if(res){let statusCode=res.status,isReadableStream=res.config.data instanceof stream.Readable;if(!reAuthRetried&&(statusCode===401||statusCode===403)&&!isReadableStream&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(opts,!0)}throw e}return response}async refreshAccessTokenAsync(){let refreshResponse=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);return this.cachedAccessToken={access_token:refreshResponse.access_token,expiry_date:new Date().getTime()+refreshResponse.expires_in*1e3,res:refreshResponse.res},refreshResponse.refresh_token!==void 0&&(this.refreshToken=refreshResponse.refresh_token),this.cachedAccessToken}isExpired(credentials){let now=new Date().getTime();return credentials.expiry_date?now>=credentials.expiry_date-this.eagerRefreshThresholdMillis:!1}};__name(ExternalAccountAuthorizedUserClient,"ExternalAccountAuthorizedUserClient");exports2.ExternalAccountAuthorizedUserClient=ExternalAccountAuthorizedUserClient}});var require_googleauth=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/googleauth.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.GoogleAuth=exports2.CLOUD_SDK_CLIENT_ID=void 0;var child_process_1=require("child_process"),fs=require("fs"),gcpMetadata=require_src4(),os=require("os"),path=require("path"),crypto_1=require_crypto3(),transporters_1=require_transporters(),computeclient_1=require_computeclient(),idtokenclient_1=require_idtokenclient(),envDetect_1=require_envDetect(),jwtclient_1=require_jwtclient(),refreshclient_1=require_refreshclient(),impersonated_1=require_impersonated(),externalclient_1=require_externalclient(),baseexternalclient_1=require_baseexternalclient(),authclient_1=require_authclient(),externalAccountAuthorizedUserClient_1=require_externalAccountAuthorizedUserClient(),util_1=require_util4();exports2.CLOUD_SDK_CLIENT_ID="764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";var GoogleAuthExceptionMessages={NO_PROJECT_ID_FOUND:`Unable to detect a Project Id in the current environment. To learn more about authentication and Google APIs, visit: https://cloud.google.com/docs/authentication/getting-started`,NO_CREDENTIALS_FOUND:`Unable to find credentials in current environment. To learn more about authentication and Google APIs, visit: https://cloud.google.com/docs/authentication/getting-started`,NO_UNIVERSE_DOMAIN_FOUND:`Unable to detect a Universe Domain in the current environment. To learn more about Universe Domain retrieval, visit: https://cloud.google.com/compute/docs/metadata/predefined-metadata-keys`},GoogleAuth=class{get isGCE(){return this.checkIsGCE}constructor(opts){this.checkIsGCE=void 0,this.jsonContent=null,this.cachedCredential=null,this.clientOptions={},opts=opts||{},this._cachedProjectId=opts.projectId||null,this.cachedCredential=opts.authClient||null,this.keyFilename=opts.keyFilename||opts.keyFile,this.scopes=opts.scopes,this.jsonContent=opts.credentials||null,this.clientOptions=opts.clientOptions||{},opts.universeDomain&&(this.clientOptions.universeDomain=opts.universeDomain)}setGapicJWTValues(client){client.defaultServicePath=this.defaultServicePath,client.useJWTAccessWithScope=this.useJWTAccessWithScope,client.defaultScopes=this.defaultScopes}getProjectId(callback){if(callback)this.getProjectIdAsync().then(r=>callback(null,r),callback);else return this.getProjectIdAsync()}async getProjectIdOptional(){try{return await this.getProjectId()}catch(e){if(e instanceof Error&&e.message===GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)return null;throw e}}async findAndCacheProjectId(){let projectId=null;if(projectId||(projectId=await this.getProductionProjectId()),projectId||(projectId=await this.getFileProjectId()),projectId||(projectId=await this.getDefaultServiceProjectId()),projectId||(projectId=await this.getGCEProjectId()),projectId||(projectId=await this.getExternalAccountClientProjectId()),projectId)return this._cachedProjectId=projectId,projectId;throw new Error(GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)}async getProjectIdAsync(){return this._cachedProjectId?this._cachedProjectId:(this._findProjectIdPromise||(this._findProjectIdPromise=this.findAndCacheProjectId()),this._findProjectIdPromise)}async getUniverseDomainFromMetadataServer(){var _a;let universeDomain;try{universeDomain=await gcpMetadata.universe("universe-domain"),universeDomain||(universeDomain=authclient_1.DEFAULT_UNIVERSE)}catch(e){if(e&&((_a=e?.response)===null||_a===void 0?void 0:_a.status)===404)universeDomain=authclient_1.DEFAULT_UNIVERSE;else throw e}return universeDomain}async getUniverseDomain(){let universeDomain=(0,util_1.originalOrCamelOptions)(this.clientOptions).get("universe_domain");try{universeDomain??(universeDomain=(await this.getClient()).universeDomain)}catch{universeDomain??(universeDomain=authclient_1.DEFAULT_UNIVERSE)}return universeDomain}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(optionsOrCallback={},callback){let options;if(typeof optionsOrCallback=="function"?callback=optionsOrCallback:options=optionsOrCallback,callback)this.getApplicationDefaultAsync(options).then(r=>callback(null,r.credential,r.projectId),callback);else return this.getApplicationDefaultAsync(options)}async getApplicationDefaultAsync(options={}){if(this.cachedCredential)return await this.prepareAndCacheADC(this.cachedCredential);let quotaProjectIdOverride=process.env.GOOGLE_CLOUD_QUOTA_PROJECT,credential;if(credential=await this._tryGetApplicationCredentialsFromEnvironmentVariable(options),credential)return credential instanceof jwtclient_1.JWT?credential.scopes=this.scopes:credential instanceof baseexternalclient_1.BaseExternalAccountClient&&(credential.scopes=this.getAnyScopes()),await this.prepareAndCacheADC(credential,quotaProjectIdOverride);if(credential=await this._tryGetApplicationCredentialsFromWellKnownFile(options),credential)return credential instanceof jwtclient_1.JWT?credential.scopes=this.scopes:credential instanceof baseexternalclient_1.BaseExternalAccountClient&&(credential.scopes=this.getAnyScopes()),await this.prepareAndCacheADC(credential,quotaProjectIdOverride);if(await this._checkIsGCE())return(0,util_1.originalOrCamelOptions)(options).get("universe_domain")||(options.universeDomain=await this.getUniverseDomainFromMetadataServer()),options.scopes=this.getAnyScopes(),await this.prepareAndCacheADC(new computeclient_1.Compute(options),quotaProjectIdOverride);throw new Error("Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.")}async prepareAndCacheADC(credential,quotaProjectIdOverride){let projectId=await this.getProjectIdOptional();return quotaProjectIdOverride&&(credential.quotaProjectId=quotaProjectIdOverride),this.cachedCredential=credential,{credential,projectId}}async _checkIsGCE(){return this.checkIsGCE===void 0&&(this.checkIsGCE=gcpMetadata.getGCPResidency()||await gcpMetadata.isAvailable()),this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(options){let credentialsPath=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials;if(!credentialsPath||credentialsPath.length===0)return null;try{return this._getApplicationCredentialsFromFilePath(credentialsPath,options)}catch(e){throw e instanceof Error&&(e.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${e.message}`),e}}async _tryGetApplicationCredentialsFromWellKnownFile(options){let location=null;if(this._isWindows())location=process.env.APPDATA;else{let home=process.env.HOME;home&&(location=path.join(home,".config"))}return location&&(location=path.join(location,"gcloud","application_default_credentials.json"),fs.existsSync(location)||(location=null)),location?await this._getApplicationCredentialsFromFilePath(location,options):null}async _getApplicationCredentialsFromFilePath(filePath,options={}){if(!filePath||filePath.length===0)throw new Error("The file path is invalid.");try{if(filePath=fs.realpathSync(filePath),!fs.lstatSync(filePath).isFile())throw new Error}catch(err){throw err instanceof Error&&(err.message=`The file at ${filePath} does not exist, or it is not a file. ${err.message}`),err}let readStream=fs.createReadStream(filePath);return this.fromStream(readStream,options)}fromImpersonatedJSON(json){var _a,_b,_c,_d,_e;if(!json)throw new Error("Must pass in a JSON object containing an impersonated refresh token");if(json.type!==impersonated_1.IMPERSONATED_ACCOUNT_TYPE)throw new Error(`The incoming JSON object does not have the "${impersonated_1.IMPERSONATED_ACCOUNT_TYPE}" type`);if(!json.source_credentials)throw new Error("The incoming JSON object does not contain a source_credentials field");if(!json.service_account_impersonation_url)throw new Error("The incoming JSON object does not contain a service_account_impersonation_url field");let sourceClient=new refreshclient_1.UserRefreshClient;if(sourceClient.fromJSON(json.source_credentials),((_a=json.service_account_impersonation_url)===null||_a===void 0?void 0:_a.length)>256)throw new RangeError(`Target principal is too long: ${json.service_account_impersonation_url}`);let targetPrincipal=(_c=(_b=/(?[^/]+):generateAccessToken$/.exec(json.service_account_impersonation_url))===null||_b===void 0?void 0:_b.groups)===null||_c===void 0?void 0:_c.target;if(!targetPrincipal)throw new RangeError(`Cannot extract target principal from ${json.service_account_impersonation_url}`);let targetScopes=(_d=this.getAnyScopes())!==null&&_d!==void 0?_d:[];return new impersonated_1.Impersonated({...json,delegates:(_e=json.delegates)!==null&&_e!==void 0?_e:[],sourceClient,targetPrincipal,targetScopes:Array.isArray(targetScopes)?targetScopes:[targetScopes]})}fromJSON(json,options={}){let client,preferredUniverseDomain=(0,util_1.originalOrCamelOptions)(options).get("universe_domain");return json.type===refreshclient_1.USER_REFRESH_ACCOUNT_TYPE?(client=new refreshclient_1.UserRefreshClient(options),client.fromJSON(json)):json.type===impersonated_1.IMPERSONATED_ACCOUNT_TYPE?client=this.fromImpersonatedJSON(json):json.type===baseexternalclient_1.EXTERNAL_ACCOUNT_TYPE?(client=externalclient_1.ExternalAccountClient.fromJSON(json,options),client.scopes=this.getAnyScopes()):json.type===externalAccountAuthorizedUserClient_1.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE?client=new externalAccountAuthorizedUserClient_1.ExternalAccountAuthorizedUserClient(json,options):(options.scopes=this.scopes,client=new jwtclient_1.JWT(options),this.setGapicJWTValues(client),client.fromJSON(json)),preferredUniverseDomain&&(client.universeDomain=preferredUniverseDomain),client}_cacheClientFromJSON(json,options){let client=this.fromJSON(json,options);return this.jsonContent=json,this.cachedCredential=client,client}fromStream(inputStream,optionsOrCallback={},callback){let options={};if(typeof optionsOrCallback=="function"?callback=optionsOrCallback:options=optionsOrCallback,callback)this.fromStreamAsync(inputStream,options).then(r=>callback(null,r),callback);else return this.fromStreamAsync(inputStream,options)}fromStreamAsync(inputStream,options){return new Promise((resolve,reject)=>{if(!inputStream)throw new Error("Must pass in a stream containing the Google auth settings.");let s="";inputStream.setEncoding("utf8").on("error",reject).on("data",chunk=>s+=chunk).on("end",()=>{try{try{let data=JSON.parse(s),r=this._cacheClientFromJSON(data,options);return resolve(r)}catch(err){if(!this.keyFilename)throw err;let client=new jwtclient_1.JWT({...this.clientOptions,keyFile:this.keyFilename});return this.cachedCredential=client,this.setGapicJWTValues(client),resolve(client)}}catch(err){return reject(err)}})})}fromAPIKey(apiKey,options){options=options||{};let client=new jwtclient_1.JWT(options);return client.fromAPIKey(apiKey),client}_isWindows(){let sys=os.platform();return!!(sys&&sys.length>=3&&sys.substring(0,3).toLowerCase()==="win")}async getDefaultServiceProjectId(){return new Promise(resolve=>{(0,child_process_1.exec)("gcloud config config-helper --format json",(err,stdout)=>{if(!err&&stdout)try{let projectId=JSON.parse(stdout).configuration.properties.core.project;resolve(projectId);return}catch{}resolve(null)})})}getProductionProjectId(){return process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project}async getFileProjectId(){if(this.cachedCredential)return this.cachedCredential.projectId;if(this.keyFilename){let creds=await this.getClient();if(creds&&creds.projectId)return creds.projectId}let r=await this._tryGetApplicationCredentialsFromEnvironmentVariable();return r?r.projectId:null}async getExternalAccountClientProjectId(){return!this.jsonContent||this.jsonContent.type!==baseexternalclient_1.EXTERNAL_ACCOUNT_TYPE?null:await(await this.getClient()).getProjectId()}async getGCEProjectId(){try{return await gcpMetadata.project("project-id")}catch{return null}}getCredentials(callback){if(callback)this.getCredentialsAsync().then(r=>callback(null,r),callback);else return this.getCredentialsAsync()}async getCredentialsAsync(){let client=await this.getClient();if(client instanceof impersonated_1.Impersonated)return{client_email:client.getTargetPrincipal()};if(client instanceof baseexternalclient_1.BaseExternalAccountClient){let serviceAccountEmail=client.getServiceAccountEmail();if(serviceAccountEmail)return{client_email:serviceAccountEmail,universe_domain:client.universeDomain}}if(this.jsonContent)return{client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key,universe_domain:this.jsonContent.universe_domain};if(await this._checkIsGCE()){let[client_email,universe_domain]=await Promise.all([gcpMetadata.instance("service-accounts/default/email"),this.getUniverseDomain()]);return{client_email,universe_domain}}throw new Error(GoogleAuthExceptionMessages.NO_CREDENTIALS_FOUND)}async getClient(){if(!this.cachedCredential)if(this.jsonContent)this._cacheClientFromJSON(this.jsonContent,this.clientOptions);else if(this.keyFilename){let filePath=path.resolve(this.keyFilename),stream=fs.createReadStream(filePath);await this.fromStreamAsync(stream,this.clientOptions)}else await this.getApplicationDefaultAsync(this.clientOptions);return this.cachedCredential}async getIdTokenClient(targetAudience){let client=await this.getClient();if(!("fetchIdToken"in client))throw new Error("Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.");return new idtokenclient_1.IdTokenClient({targetAudience,idTokenProvider:client})}async getAccessToken(){return(await(await this.getClient()).getAccessToken()).token}async getRequestHeaders(url){return(await this.getClient()).getRequestHeaders(url)}async authorizeRequest(opts){opts=opts||{};let url=opts.url||opts.uri,headers=await(await this.getClient()).getRequestHeaders(url);return opts.headers=Object.assign(opts.headers||{},headers),opts}async request(opts){return(await this.getClient()).request(opts)}getEnv(){return(0,envDetect_1.getEnv)()}async sign(data,endpoint){let client=await this.getClient(),universe=await this.getUniverseDomain();if(endpoint=endpoint||`https://iamcredentials.${universe}/v1/projects/-/serviceAccounts/`,client instanceof impersonated_1.Impersonated)return(await client.sign(data)).signedBlob;let crypto6=(0,crypto_1.createCrypto)();if(client instanceof jwtclient_1.JWT&&client.key)return await crypto6.sign(client.key,data);let creds=await this.getCredentials();if(!creds.client_email)throw new Error("Cannot sign data without `client_email`.");return this.signBlob(crypto6,creds.client_email,data,endpoint)}async signBlob(crypto6,emailOrUniqueId,data,endpoint){let url=new URL(endpoint+`${emailOrUniqueId}:signBlob`);return(await this.request({method:"POST",url:url.href,data:{payload:crypto6.encodeBase64StringUtf8(data)},retry:!0,retryConfig:{httpMethodsToRetry:["POST"]}})).data.signedBlob}};__name(GoogleAuth,"GoogleAuth");exports2.GoogleAuth=GoogleAuth;GoogleAuth.DefaultTransporter=transporters_1.DefaultTransporter}});var require_iam=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/iam.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.IAMAuth=void 0;var IAMAuth=class{constructor(selector,token){this.selector=selector,this.token=token,this.selector=selector,this.token=token}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}};__name(IAMAuth,"IAMAuth");exports2.IAMAuth=IAMAuth}});var require_downscopedclient=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/downscopedclient.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.DownscopedClient=exports2.EXPIRATION_TIME_OFFSET=exports2.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var stream=require("stream"),authclient_1=require_authclient(),sts=require_stscredentials(),STS_GRANT_TYPE="urn:ietf:params:oauth:grant-type:token-exchange",STS_REQUEST_TOKEN_TYPE="urn:ietf:params:oauth:token-type:access_token",STS_SUBJECT_TOKEN_TYPE="urn:ietf:params:oauth:token-type:access_token";exports2.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;exports2.EXPIRATION_TIME_OFFSET=5*60*1e3;var DownscopedClient=class extends authclient_1.AuthClient{constructor(authClient,credentialAccessBoundary,additionalOptions,quotaProjectId){if(super({...additionalOptions,quotaProjectId}),this.authClient=authClient,this.credentialAccessBoundary=credentialAccessBoundary,credentialAccessBoundary.accessBoundary.accessBoundaryRules.length===0)throw new Error("At least one access boundary rule needs to be defined.");if(credentialAccessBoundary.accessBoundary.accessBoundaryRules.length>exports2.MAX_ACCESS_BOUNDARY_RULES_COUNT)throw new Error(`The provided access boundary has more than ${exports2.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`);for(let rule of credentialAccessBoundary.accessBoundary.accessBoundaryRules)if(rule.availablePermissions.length===0)throw new Error("At least one permission should be defined in access boundary rules.");this.stsCredential=new sts.StsCredentials(`https://sts.${this.universeDomain}/v1/token`),this.cachedDownscopedAccessToken=null}setCredentials(credentials){if(!credentials.expiry_date)throw new Error("The access token expiry_date field is missing in the provided credentials.");super.setCredentials(credentials),this.cachedDownscopedAccessToken=credentials}async getAccessToken(){return(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){let headers={Authorization:`Bearer ${(await this.getAccessToken()).token}`};return this.addSharedMetadataHeaders(headers)}request(opts,callback){if(callback)this.requestAsync(opts).then(r=>callback(null,r),e=>callback(e,e.response));else return this.requestAsync(opts)}async requestAsync(opts,reAuthRetried=!1){let response;try{let requestHeaders=await this.getRequestHeaders();opts.headers=opts.headers||{},requestHeaders&&requestHeaders["x-goog-user-project"]&&(opts.headers["x-goog-user-project"]=requestHeaders["x-goog-user-project"]),requestHeaders&&requestHeaders.Authorization&&(opts.headers.Authorization=requestHeaders.Authorization),response=await this.transporter.request(opts)}catch(e){let res=e.response;if(res){let statusCode=res.status,isReadableStream=res.config.data instanceof stream.Readable;if(!reAuthRetried&&(statusCode===401||statusCode===403)&&!isReadableStream&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(opts,!0)}throw e}return response}async refreshAccessTokenAsync(){var _a;let subjectToken=(await this.authClient.getAccessToken()).token,stsCredentialsOptions={grantType:STS_GRANT_TYPE,requestedTokenType:STS_REQUEST_TOKEN_TYPE,subjectToken,subjectTokenType:STS_SUBJECT_TOKEN_TYPE},stsResponse=await this.stsCredential.exchangeToken(stsCredentialsOptions,void 0,this.credentialAccessBoundary),sourceCredExpireDate=((_a=this.authClient.credentials)===null||_a===void 0?void 0:_a.expiry_date)||null,expiryDate=stsResponse.expires_in?new Date().getTime()+stsResponse.expires_in*1e3:sourceCredExpireDate;return this.cachedDownscopedAccessToken={access_token:stsResponse.access_token,expiry_date:expiryDate,res:stsResponse.res},this.credentials={},Object.assign(this.credentials,this.cachedDownscopedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedDownscopedAccessToken}isExpired(downscopedAccessToken){let now=new Date().getTime();return downscopedAccessToken.expiry_date?now>=downscopedAccessToken.expiry_date-this.eagerRefreshThresholdMillis:!1}};__name(DownscopedClient,"DownscopedClient");exports2.DownscopedClient=DownscopedClient}});var require_passthrough=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/auth/passthrough.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.PassThroughClient=void 0;var authclient_1=require_authclient(),PassThroughClient=class extends authclient_1.AuthClient{async request(opts){return this.transporter.request(opts)}async getAccessToken(){return{}}async getRequestHeaders(){return{}}};__name(PassThroughClient,"PassThroughClient");exports2.PassThroughClient=PassThroughClient;var a=new PassThroughClient;a.getAccessToken()}});var require_src6=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-auth-library/build/src/index.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.GoogleAuth=exports2.auth=exports2.DefaultTransporter=exports2.PassThroughClient=exports2.PluggableAuthClient=exports2.DownscopedClient=exports2.BaseExternalAccountClient=exports2.ExternalAccountClient=exports2.IdentityPoolClient=exports2.AwsClient=exports2.UserRefreshClient=exports2.LoginTicket=exports2.ClientAuthentication=exports2.OAuth2Client=exports2.CodeChallengeMethod=exports2.Impersonated=exports2.JWT=exports2.JWTAccess=exports2.IdTokenClient=exports2.IAMAuth=exports2.GCPEnv=exports2.Compute=exports2.DEFAULT_UNIVERSE=exports2.AuthClient=exports2.gaxios=exports2.gcpMetadata=void 0;var googleauth_1=require_googleauth();Object.defineProperty(exports2,"GoogleAuth",{enumerable:!0,get:function(){return googleauth_1.GoogleAuth}});exports2.gcpMetadata=require_src4();exports2.gaxios=require_src3();var authclient_1=require_authclient();Object.defineProperty(exports2,"AuthClient",{enumerable:!0,get:function(){return authclient_1.AuthClient}});Object.defineProperty(exports2,"DEFAULT_UNIVERSE",{enumerable:!0,get:function(){return authclient_1.DEFAULT_UNIVERSE}});var computeclient_1=require_computeclient();Object.defineProperty(exports2,"Compute",{enumerable:!0,get:function(){return computeclient_1.Compute}});var envDetect_1=require_envDetect();Object.defineProperty(exports2,"GCPEnv",{enumerable:!0,get:function(){return envDetect_1.GCPEnv}});var iam_1=require_iam();Object.defineProperty(exports2,"IAMAuth",{enumerable:!0,get:function(){return iam_1.IAMAuth}});var idtokenclient_1=require_idtokenclient();Object.defineProperty(exports2,"IdTokenClient",{enumerable:!0,get:function(){return idtokenclient_1.IdTokenClient}});var jwtaccess_1=require_jwtaccess();Object.defineProperty(exports2,"JWTAccess",{enumerable:!0,get:function(){return jwtaccess_1.JWTAccess}});var jwtclient_1=require_jwtclient();Object.defineProperty(exports2,"JWT",{enumerable:!0,get:function(){return jwtclient_1.JWT}});var impersonated_1=require_impersonated();Object.defineProperty(exports2,"Impersonated",{enumerable:!0,get:function(){return impersonated_1.Impersonated}});var oauth2client_1=require_oauth2client();Object.defineProperty(exports2,"CodeChallengeMethod",{enumerable:!0,get:function(){return oauth2client_1.CodeChallengeMethod}});Object.defineProperty(exports2,"OAuth2Client",{enumerable:!0,get:function(){return oauth2client_1.OAuth2Client}});Object.defineProperty(exports2,"ClientAuthentication",{enumerable:!0,get:function(){return oauth2client_1.ClientAuthentication}});var loginticket_1=require_loginticket();Object.defineProperty(exports2,"LoginTicket",{enumerable:!0,get:function(){return loginticket_1.LoginTicket}});var refreshclient_1=require_refreshclient();Object.defineProperty(exports2,"UserRefreshClient",{enumerable:!0,get:function(){return refreshclient_1.UserRefreshClient}});var awsclient_1=require_awsclient();Object.defineProperty(exports2,"AwsClient",{enumerable:!0,get:function(){return awsclient_1.AwsClient}});var identitypoolclient_1=require_identitypoolclient();Object.defineProperty(exports2,"IdentityPoolClient",{enumerable:!0,get:function(){return identitypoolclient_1.IdentityPoolClient}});var externalclient_1=require_externalclient();Object.defineProperty(exports2,"ExternalAccountClient",{enumerable:!0,get:function(){return externalclient_1.ExternalAccountClient}});var baseexternalclient_1=require_baseexternalclient();Object.defineProperty(exports2,"BaseExternalAccountClient",{enumerable:!0,get:function(){return baseexternalclient_1.BaseExternalAccountClient}});var downscopedclient_1=require_downscopedclient();Object.defineProperty(exports2,"DownscopedClient",{enumerable:!0,get:function(){return downscopedclient_1.DownscopedClient}});var pluggable_auth_client_1=require_pluggable_auth_client();Object.defineProperty(exports2,"PluggableAuthClient",{enumerable:!0,get:function(){return pluggable_auth_client_1.PluggableAuthClient}});var passthrough_1=require_passthrough();Object.defineProperty(exports2,"PassThroughClient",{enumerable:!0,get:function(){return passthrough_1.PassThroughClient}});var transporters_1=require_transporters();Object.defineProperty(exports2,"DefaultTransporter",{enumerable:!0,get:function(){return transporters_1.DefaultTransporter}});var auth=new googleauth_1.GoogleAuth;exports2.auth=auth}});var require_bytes=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/proto3-json-serializer/build/src/bytes.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.bytesFromProto3JSON=exports2.bytesToProto3JSON=void 0;function bytesToProto3JSON(obj){return Buffer.isBuffer(obj)?obj.toString("base64"):Buffer.from(obj.buffer,0,obj.byteLength).toString("base64")}__name(bytesToProto3JSON,"bytesToProto3JSON");exports2.bytesToProto3JSON=bytesToProto3JSON;function bytesFromProto3JSON(json){return Buffer.from(json,"base64")}__name(bytesFromProto3JSON,"bytesFromProto3JSON");exports2.bytesFromProto3JSON=bytesFromProto3JSON}});var require_enum2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/proto3-json-serializer/build/src/enum.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.resolveEnumValueToNumber=exports2.resolveEnumValueToString=void 0;function resolveEnumValueToString(enumType,enumValue){if(typeof enumValue=="number"){let value=enumType.valuesById[enumValue];return typeof value>"u"?enumValue:value}if(typeof enumValue=="string")return enumValue;throw new Error("resolveEnumValueToString: enum value must be a string or a number")}__name(resolveEnumValueToString,"resolveEnumValueToString");exports2.resolveEnumValueToString=resolveEnumValueToString;function resolveEnumValueToNumber(enumType,enumValue){if(typeof enumValue=="number")return enumValue;if(typeof enumValue=="string"){let num=enumType.values[enumValue];return typeof num>"u"?enumValue:num}throw new Error("resolveEnumValueToNumber: enum value must be a string or a number")}__name(resolveEnumValueToNumber,"resolveEnumValueToNumber");exports2.resolveEnumValueToNumber=resolveEnumValueToNumber}});var require_util5=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/proto3-json-serializer/build/src/util.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.assert=exports2.wrapperTypes=exports2.getFullyQualifiedTypeName=void 0;function getFullyQualifiedTypeName(type){let fullyQualifiedTypeName="";for(;type.parent;)fullyQualifiedTypeName=`.${type.name}${fullyQualifiedTypeName}`,type=type.parent;return fullyQualifiedTypeName}__name(getFullyQualifiedTypeName,"getFullyQualifiedTypeName");exports2.getFullyQualifiedTypeName=getFullyQualifiedTypeName;exports2.wrapperTypes=new Set([".google.protobuf.DoubleValue",".google.protobuf.FloatValue",".google.protobuf.Int64Value",".google.protobuf.UInt64Value",".google.protobuf.Int32Value",".google.protobuf.UInt32Value",".google.protobuf.BoolValue",".google.protobuf.StringValue",".google.protobuf.BytesValue"]);function assert(assertion,message){if(!assertion)throw new Error(message)}__name(assert,"assert");exports2.assert=assert}});var require_value=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/proto3-json-serializer/build/src/value.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.googleProtobufValueFromProto3JSON=exports2.googleProtobufListValueFromProto3JSON=exports2.googleProtobufStructFromProto3JSON=exports2.googleProtobufValueToProto3JSON=exports2.googleProtobufListValueToProto3JSON=exports2.googleProtobufStructToProto3JSON=void 0;var util_1=require_util5();function googleProtobufStructToProto3JSON(obj){let result={},fields=obj.fields;for(let[key,value]of Object.entries(fields))result[key]=googleProtobufValueToProto3JSON(value);return result}__name(googleProtobufStructToProto3JSON,"googleProtobufStructToProto3JSON");exports2.googleProtobufStructToProto3JSON=googleProtobufStructToProto3JSON;function googleProtobufListValueToProto3JSON(obj){return(0,util_1.assert)(Array.isArray(obj.values),"ListValue internal representation must contain array of values"),obj.values.map(googleProtobufValueToProto3JSON)}__name(googleProtobufListValueToProto3JSON,"googleProtobufListValueToProto3JSON");exports2.googleProtobufListValueToProto3JSON=googleProtobufListValueToProto3JSON;function googleProtobufValueToProto3JSON(obj){return Object.prototype.hasOwnProperty.call(obj,"nullValue")?null:Object.prototype.hasOwnProperty.call(obj,"numberValue")&&typeof obj.numberValue=="number"?Number.isFinite(obj.numberValue)?obj.numberValue:obj.numberValue.toString():Object.prototype.hasOwnProperty.call(obj,"stringValue")&&typeof obj.stringValue=="string"?obj.stringValue:Object.prototype.hasOwnProperty.call(obj,"boolValue")&&typeof obj.boolValue=="boolean"?obj.boolValue:Object.prototype.hasOwnProperty.call(obj,"structValue")&&typeof obj.structValue=="object"?googleProtobufStructToProto3JSON(obj.structValue):Object.prototype.hasOwnProperty.call(obj,"listValue")&&typeof obj=="object"&&typeof obj.listValue=="object"?googleProtobufListValueToProto3JSON(obj.listValue):null}__name(googleProtobufValueToProto3JSON,"googleProtobufValueToProto3JSON");exports2.googleProtobufValueToProto3JSON=googleProtobufValueToProto3JSON;function googleProtobufStructFromProto3JSON(json){let fields={};for(let[key,value]of Object.entries(json))fields[key]=googleProtobufValueFromProto3JSON(value);return{fields}}__name(googleProtobufStructFromProto3JSON,"googleProtobufStructFromProto3JSON");exports2.googleProtobufStructFromProto3JSON=googleProtobufStructFromProto3JSON;function googleProtobufListValueFromProto3JSON(json){return{values:json.map(element=>googleProtobufValueFromProto3JSON(element))}}__name(googleProtobufListValueFromProto3JSON,"googleProtobufListValueFromProto3JSON");exports2.googleProtobufListValueFromProto3JSON=googleProtobufListValueFromProto3JSON;function googleProtobufValueFromProto3JSON(json){if(json===null)return{nullValue:"NULL_VALUE"};if(typeof json=="number")return{numberValue:json};if(typeof json=="string")return{stringValue:json};if(typeof json=="boolean")return{boolValue:json};if(Array.isArray(json))return{listValue:googleProtobufListValueFromProto3JSON(json)};if(typeof json=="object")return{structValue:googleProtobufStructFromProto3JSON(json)};throw new Error(`googleProtobufValueFromProto3JSON: incorrect parameter type: ${typeof json}`)}__name(googleProtobufValueFromProto3JSON,"googleProtobufValueFromProto3JSON");exports2.googleProtobufValueFromProto3JSON=googleProtobufValueFromProto3JSON}});var require_duration=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/proto3-json-serializer/build/src/duration.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.googleProtobufDurationFromProto3JSON=exports2.googleProtobufDurationToProto3JSON=void 0;function googleProtobufDurationToProto3JSON(obj){let durationSeconds=obj.seconds.toString();if(typeof obj.nanos=="number"&&obj.nanos>0){let nanosStr=obj.nanos.toString().padStart(9,"0").replace(/^((?:\d\d\d)+?)(?:0*)$/,"$1");durationSeconds+="."+nanosStr}return durationSeconds+="s",durationSeconds}__name(googleProtobufDurationToProto3JSON,"googleProtobufDurationToProto3JSON");exports2.googleProtobufDurationToProto3JSON=googleProtobufDurationToProto3JSON;function googleProtobufDurationFromProto3JSON(json){let match=json.match(/^(\d*)(?:\.(\d*))?s$/);if(!match)throw new Error(`googleProtobufDurationFromProto3JSON: incorrect value ${json} passed as google.protobuf.Duration`);let seconds=0,nanos=0;typeof match[1]=="string"&&match[1].length>0&&(seconds=parseInt(match[1])),typeof match[2]=="string"&&match[2].length>0&&(nanos=parseInt(match[2].padEnd(9,"0")));let result={};return seconds!==0&&(result.seconds=seconds),nanos!==0&&(result.nanos=nanos),result}__name(googleProtobufDurationFromProto3JSON,"googleProtobufDurationFromProto3JSON");exports2.googleProtobufDurationFromProto3JSON=googleProtobufDurationFromProto3JSON}});var require_timestamp=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/proto3-json-serializer/build/src/timestamp.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.googleProtobufTimestampFromProto3JSON=exports2.googleProtobufTimestampToProto3JSON=void 0;function googleProtobufTimestampToProto3JSON(obj){var _a;let durationSeconds=obj.seconds,date=new Date(durationSeconds*1e3).toISOString(),nanos=(_a=obj.nanos)===null||_a===void 0?void 0:_a.toString().padStart(9,"0");for(;nanos&&nanos.length>3&&nanos.endsWith("000");)nanos=nanos.slice(0,-3);return date.replace(/(?:\.\d{0,9})/,"."+nanos)}__name(googleProtobufTimestampToProto3JSON,"googleProtobufTimestampToProto3JSON");exports2.googleProtobufTimestampToProto3JSON=googleProtobufTimestampToProto3JSON;function googleProtobufTimestampFromProto3JSON(json){if(!json.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?/))throw new Error(`googleProtobufDurationFromProto3JSON: incorrect value ${json} passed as google.protobuf.Duration`);let millisecondsSinceEpoch=new Date(json).getTime(),seconds=Math.floor(millisecondsSinceEpoch/1e3),nanos=0,secondsFromDate=json.split(".")[1];secondsFromDate&&(nanos=parseInt(secondsFromDate.slice(0,-1).padEnd(9,"0")));let result={};return seconds!==0&&(result.seconds=seconds),nanos!==0&&(result.nanos=nanos),result}__name(googleProtobufTimestampFromProto3JSON,"googleProtobufTimestampFromProto3JSON");exports2.googleProtobufTimestampFromProto3JSON=googleProtobufTimestampFromProto3JSON}});var require_wrappers2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/proto3-json-serializer/build/src/wrappers.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.wrapperFromProto3JSON=exports2.wrapperToProto3JSON=void 0;var bytes_1=require_bytes(),util_1=require_util5();function wrapperToProto3JSON(obj){return Object.prototype.hasOwnProperty.call(obj,"value")?Buffer.isBuffer(obj.value)||obj.value instanceof Uint8Array?(0,bytes_1.bytesToProto3JSON)(obj.value):typeof obj.value=="object"?((0,util_1.assert)(obj.value.constructor.name==="Long",`wrapperToProto3JSON: expected to see a number, a string, a boolean, or a Long, but got ${obj.value}`),obj.value.toString()):typeof obj.value=="number"&&!Number.isFinite(obj.value)?obj.value.toString():obj.value:null}__name(wrapperToProto3JSON,"wrapperToProto3JSON");exports2.wrapperToProto3JSON=wrapperToProto3JSON;function wrapperFromProto3JSON(typeName,json){if(json===null)return{value:null};if(typeName===".google.protobuf.BytesValue"){if(typeof json!="string")throw new Error(`numberWrapperFromProto3JSON: expected to get a string for google.protobuf.BytesValue but got ${typeof json}`);return{value:(0,bytes_1.bytesFromProto3JSON)(json)}}return{value:json}}__name(wrapperFromProto3JSON,"wrapperFromProto3JSON");exports2.wrapperFromProto3JSON=wrapperFromProto3JSON}});var require_fieldmask=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/proto3-json-serializer/build/src/fieldmask.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.googleProtobufFieldMaskFromProto3JSON=exports2.googleProtobufFieldMaskToProto3JSON=void 0;function googleProtobufFieldMaskToProto3JSON(obj){return obj.paths.join(",")}__name(googleProtobufFieldMaskToProto3JSON,"googleProtobufFieldMaskToProto3JSON");exports2.googleProtobufFieldMaskToProto3JSON=googleProtobufFieldMaskToProto3JSON;function googleProtobufFieldMaskFromProto3JSON(json){return{paths:json.split(",")}}__name(googleProtobufFieldMaskFromProto3JSON,"googleProtobufFieldMaskFromProto3JSON");exports2.googleProtobufFieldMaskFromProto3JSON=googleProtobufFieldMaskFromProto3JSON}});var require_fromproto3json=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/proto3-json-serializer/build/src/fromproto3json.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.fromProto3JSON=exports2.fromProto3JSONToInternalRepresentation=void 0;var any_1=require_any(),bytes_1=require_bytes(),enum_1=require_enum2(),value_1=require_value(),util_1=require_util5(),duration_1=require_duration(),timestamp_1=require_timestamp(),wrappers_1=require_wrappers2(),fieldmask_1=require_fieldmask();function fromProto3JSONToInternalRepresentation(type,json){let fullyQualifiedTypeName=typeof type=="string"?type:(0,util_1.getFullyQualifiedTypeName)(type);if(typeof type!="string"&&"values"in type)return fullyQualifiedTypeName===".google.protobuf.NullValue"?"NULL_VALUE":(0,enum_1.resolveEnumValueToString)(type,json);if(typeof type!="string"&&type.resolveAll(),typeof type=="string")return json;if(fullyQualifiedTypeName===".google.protobuf.Value")return(0,value_1.googleProtobufValueFromProto3JSON)(json);if(util_1.wrapperTypes.has(fullyQualifiedTypeName)){if(json!==null&&typeof json=="object"||Array.isArray(json))throw new Error(`fromProto3JSONToInternalRepresentation: JSON representation for ${fullyQualifiedTypeName} expects a string, a number, or a boolean, but got ${typeof json}`);return(0,wrappers_1.wrapperFromProto3JSON)(fullyQualifiedTypeName,json)}if(json===null)return null;if(fullyQualifiedTypeName===".google.protobuf.Any")return(0,any_1.googleProtobufAnyFromProto3JSON)(type.root,json);if(fullyQualifiedTypeName===".google.protobuf.Struct"){if(typeof json!="object")throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.Struct must be an object but got ${typeof json}`);if(Array.isArray(json))throw new Error("fromProto3JSONToInternalRepresentation: google.protobuf.Struct must be an object but got an array");return(0,value_1.googleProtobufStructFromProto3JSON)(json)}if(fullyQualifiedTypeName===".google.protobuf.ListValue"){if(!Array.isArray(json))throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.ListValue must be an array but got ${typeof json}`);return(0,value_1.googleProtobufListValueFromProto3JSON)(json)}if(fullyQualifiedTypeName===".google.protobuf.Duration"){if(typeof json!="string")throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.Duration must be a string but got ${typeof json}`);return(0,duration_1.googleProtobufDurationFromProto3JSON)(json)}if(fullyQualifiedTypeName===".google.protobuf.Timestamp"){if(typeof json!="string")throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.Timestamp must be a string but got ${typeof json}`);return(0,timestamp_1.googleProtobufTimestampFromProto3JSON)(json)}if(fullyQualifiedTypeName===".google.protobuf.FieldMask"){if(typeof json!="string")throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.FieldMask must be a string but got ${typeof json}`);return(0,fieldmask_1.googleProtobufFieldMaskFromProto3JSON)(json)}let result={};for(let[key,value]of Object.entries(json)){let field=type.fields[key];if(!field)continue;let resolvedType=field.resolvedType,fieldType=field.type;if(field.repeated)if(value===null)result[key]=[];else{if(!Array.isArray(value))throw new Error(`fromProto3JSONToInternalRepresentation: expected an array for field ${key}`);result[key]=value.map(element=>fromProto3JSONToInternalRepresentation(resolvedType||fieldType,element))}else if(field.map){let map={};for(let[mapKey,mapValue]of Object.entries(value))map[mapKey]=fromProto3JSONToInternalRepresentation(resolvedType||fieldType,mapValue);result[key]=map}else if(fieldType.match(/^(?:(?:(?:u?int|fixed)(?:32|64))|float|double)$/)){if(typeof value!="number"&&typeof value!="string")throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`);result[key]=value}else if(fieldType==="string"){if(typeof value!="string")throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`);result[key]=value}else if(fieldType==="bool"){if(typeof value!="boolean")throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`);result[key]=value}else if(fieldType==="bytes"){if(typeof value!="string")throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`);result[key]=(0,bytes_1.bytesFromProto3JSON)(value)}else{(0,util_1.assert)(resolvedType!==null,`Expected to be able to resolve type for field ${field.name}`);let deserializedValue=fromProto3JSONToInternalRepresentation(resolvedType,value);result[key]=deserializedValue}}return result}__name(fromProto3JSONToInternalRepresentation,"fromProto3JSONToInternalRepresentation");exports2.fromProto3JSONToInternalRepresentation=fromProto3JSONToInternalRepresentation;function fromProto3JSON(type,json){let internalRepr=fromProto3JSONToInternalRepresentation(type,json);return internalRepr===null?null:((0,util_1.assert)(typeof internalRepr=="object"&&!Array.isArray(internalRepr),`fromProto3JSON: expected an object, not ${json}`),type.fromObject(internalRepr))}__name(fromProto3JSON,"fromProto3JSON");exports2.fromProto3JSON=fromProto3JSON}});var require_any=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/proto3-json-serializer/build/src/any.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.googleProtobufAnyFromProto3JSON=exports2.googleProtobufAnyToProto3JSON=void 0;var fromproto3json_1=require_fromproto3json(),toproto3json_1=require_toproto3json(),specialJSON=new Set(["google.protobuf.Any","google.protobuf.Duration","google.protobuf.FieldMask","google.protobuf.ListValue","google.protobuf.Struct","google.protobuf.Timestamp","google.protobuf.Value"]);function googleProtobufAnyToProto3JSON(obj,options){let typeName=obj.type_url.replace(/^.*\//,""),type;try{type=obj.$type.root.lookupType(typeName)}catch(err){throw new Error(`googleProtobufAnyToProto3JSON: cannot find type ${typeName}: ${err}`)}let valueMessage=type.decode(obj.value),valueProto3JSON=(0,toproto3json_1.toProto3JSON)(valueMessage,options);return specialJSON.has(typeName)?{"@type":obj.type_url,value:valueProto3JSON}:(valueProto3JSON["@type"]=obj.type_url,valueProto3JSON)}__name(googleProtobufAnyToProto3JSON,"googleProtobufAnyToProto3JSON");exports2.googleProtobufAnyToProto3JSON=googleProtobufAnyToProto3JSON;function googleProtobufAnyFromProto3JSON(root,json){if(json===null||typeof json!="object"||Array.isArray(json))throw new Error("googleProtobufAnyFromProto3JSON: must be an object to decode google.protobuf.Any");let typeUrl=json["@type"];if(!typeUrl||typeof typeUrl!="string")throw new Error("googleProtobufAnyFromProto3JSON: JSON serialization of google.protobuf.Any must contain @type field");let typeName=typeUrl.replace(/^.*\//,""),type;try{type=root.lookupType(typeName)}catch(err){throw new Error(`googleProtobufAnyFromProto3JSON: cannot find type ${typeName}: ${err}`)}let value=json;if(specialJSON.has(typeName)){if(!("value"in json))throw new Error(`googleProtobufAnyFromProto3JSON: JSON representation of google.protobuf.Any with type ${typeName} must contain the value field`);value=json.value}let valueMessage=(0,fromproto3json_1.fromProto3JSON)(type,value);if(valueMessage===null)return{type_url:typeUrl,value:null};let uint8array=type.encode(valueMessage).finish(),base64=Buffer.from(uint8array,0,uint8array.byteLength).toString("base64");return{type_url:typeUrl,value:base64}}__name(googleProtobufAnyFromProto3JSON,"googleProtobufAnyFromProto3JSON");exports2.googleProtobufAnyFromProto3JSON=googleProtobufAnyFromProto3JSON}});var require_toproto3json=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/proto3-json-serializer/build/src/toproto3json.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.toProto3JSON=void 0;var any_1=require_any(),bytes_1=require_bytes(),util_1=require_util5(),enum_1=require_enum2(),value_1=require_value(),duration_1=require_duration(),timestamp_1=require_timestamp(),wrappers_1=require_wrappers2(),fieldmask_1=require_fieldmask();function convertSingleValue(value){var _a;if(typeof value=="object"){if(((_a=value?.constructor)===null||_a===void 0?void 0:_a.name)==="Long")return value.toString();throw new Error(`toProto3JSON: don't know how to convert value ${value}`)}return value}__name(convertSingleValue,"convertSingleValue");function toProto3JSON(obj,options){let objType=obj.$type;if(!objType)throw new Error("Cannot serialize object to proto3 JSON since its .$type is unknown. Use Type.fromObject(obj) before calling toProto3JSON.");objType.resolveAll();let typeName=(0,util_1.getFullyQualifiedTypeName)(objType);if(typeName===".google.protobuf.Any")return(0,any_1.googleProtobufAnyToProto3JSON)(obj,options);if(typeName===".google.protobuf.Value")return(0,value_1.googleProtobufValueToProto3JSON)(obj);if(typeName===".google.protobuf.Struct")return(0,value_1.googleProtobufStructToProto3JSON)(obj);if(typeName===".google.protobuf.ListValue")return(0,value_1.googleProtobufListValueToProto3JSON)(obj);if(typeName===".google.protobuf.Duration")return(0,duration_1.googleProtobufDurationToProto3JSON)(obj);if(typeName===".google.protobuf.Timestamp")return(0,timestamp_1.googleProtobufTimestampToProto3JSON)(obj);if(typeName===".google.protobuf.FieldMask")return(0,fieldmask_1.googleProtobufFieldMaskToProto3JSON)(obj);if(util_1.wrapperTypes.has(typeName))return(0,wrappers_1.wrapperToProto3JSON)(obj);let result={};for(let[key,value]of Object.entries(obj)){let field=objType.fields[key],fieldResolvedType=field.resolvedType,fieldFullyQualifiedTypeName=fieldResolvedType?(0,util_1.getFullyQualifiedTypeName)(fieldResolvedType):null;if(value===null){result[key]=null;continue}if(Array.isArray(value)){if(value.length===0)continue;result[key]=value.map(fieldResolvedType?element=>toProto3JSON(element,options):convertSingleValue);continue}if(field.map){let map={};for(let[mapKey,mapValue]of Object.entries(value))map[mapKey]=fieldResolvedType?toProto3JSON(mapValue,options):convertSingleValue(mapValue);result[key]=map;continue}if(fieldFullyQualifiedTypeName===".google.protobuf.NullValue"){result[key]=null;continue}if(fieldResolvedType&&"values"in fieldResolvedType&&value!==null){options?.numericEnums?result[key]=(0,enum_1.resolveEnumValueToNumber)(fieldResolvedType,value):result[key]=(0,enum_1.resolveEnumValueToString)(fieldResolvedType,value);continue}if(fieldResolvedType){result[key]=toProto3JSON(value,options);continue}if(typeof value=="string"||typeof value=="number"||typeof value=="boolean"||value===null){if(typeof value=="number"&&!Number.isFinite(value)){result[key]=value.toString();continue}result[key]=value;continue}if(Buffer.isBuffer(value)||value instanceof Uint8Array){result[key]=(0,bytes_1.bytesToProto3JSON)(value);continue}result[key]=convertSingleValue(value)}return result}__name(toProto3JSON,"toProto3JSON");exports2.toProto3JSON=toProto3JSON}});var require_src7=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/proto3-json-serializer/build/src/index.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.fromProto3JSON=exports2.toProto3JSON=void 0;var toproto3json_1=require_toproto3json();Object.defineProperty(exports2,"toProto3JSON",{enumerable:!0,get:function(){return toproto3json_1.toProto3JSON}});var fromproto3json_1=require_fromproto3json();Object.defineProperty(exports2,"fromProto3JSON",{enumerable:!0,get:function(){return fromproto3json_1.fromProto3JSON}})}});var require_status2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/protos/status.json"(exports2,module2){module2.exports={nested:{google:{nested:{protobuf:{nested:{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},Duration:{fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}},rpc:{options:{cc_enable_arenas:!0,go_package:"google.golang.org/genproto/googleapis/rpc/errdetails;errdetails",java_multiple_files:!0,java_outer_classname:"ErrorDetailsProto",java_package:"com.google.rpc",objc_class_prefix:"RPC"},nested:{Status:{fields:{code:{type:"int32",id:1},message:{type:"string",id:2},details:{rule:"repeated",type:"google.protobuf.Any",id:3}}},RetryInfo:{fields:{retryDelay:{type:"google.protobuf.Duration",id:1}}},DebugInfo:{fields:{stackEntries:{rule:"repeated",type:"string",id:1},detail:{type:"string",id:2}}},QuotaFailure:{fields:{violations:{rule:"repeated",type:"Violation",id:1}},nested:{Violation:{fields:{subject:{type:"string",id:1},description:{type:"string",id:2}}}}},ErrorInfo:{fields:{reason:{type:"string",id:1},domain:{type:"string",id:2},metadata:{keyType:"string",type:"string",id:3}}},PreconditionFailure:{fields:{violations:{rule:"repeated",type:"Violation",id:1}},nested:{Violation:{fields:{type:{type:"string",id:1},subject:{type:"string",id:2},description:{type:"string",id:3}}}}},BadRequest:{fields:{fieldViolations:{rule:"repeated",type:"FieldViolation",id:1}},nested:{FieldViolation:{fields:{field:{type:"string",id:1},description:{type:"string",id:2}}}}},RequestInfo:{fields:{requestId:{type:"string",id:1},servingData:{type:"string",id:2}}},ResourceInfo:{fields:{resourceType:{type:"string",id:1},resourceName:{type:"string",id:2},owner:{type:"string",id:3},description:{type:"string",id:4}}},Help:{fields:{links:{rule:"repeated",type:"Link",id:1}},nested:{Link:{fields:{description:{type:"string",id:1},url:{type:"string",id:2}}}}},LocalizedMessage:{fields:{locale:{type:"string",id:1},message:{type:"string",id:2}}}}}}}}}}});var require_googleError=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/googleError.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.GoogleErrorDecoder=exports2.GoogleError=void 0;var status_1=require_status(),protobuf=require_protobufjs(),serializer=require_src7(),fallback_1=require_fallback(),GoogleError=class extends Error{static parseGRPCStatusDetails(err){let decoder=new GoogleErrorDecoder;try{if(err.metadata&&err.metadata.get("grpc-status-details-bin")){let statusDetailsObj=decoder.decodeGRPCStatusDetails(err.metadata.get("grpc-status-details-bin"));statusDetailsObj&&statusDetailsObj.details&&statusDetailsObj.details.length>0&&(err.statusDetails=statusDetailsObj.details),statusDetailsObj&&statusDetailsObj.errorInfo&&(err.reason=statusDetailsObj.errorInfo.reason,err.domain=statusDetailsObj.errorInfo.domain,err.errorInfoMetadata=statusDetailsObj.errorInfo.metadata)}}catch{}return err}static parseHttpError(json){Array.isArray(json)&&(json=json.find(obj=>"error"in obj)),json.error||(json.error={},Object.keys(json).filter(key=>key!=="error").forEach(key=>{json.error[key]=json[key],delete json[key]}));let decoder=new GoogleErrorDecoder,proto3Error=decoder.decodeHTTPError(json.error),error=Object.assign(new GoogleError(json.error.message),proto3Error);if(json.error.code?error.code=(0,status_1.rpcCodeFromHttpStatusCode)(json.error.code):delete error.code,error.details)try{let statusDetailsObj=decoder.decodeHttpStatusDetails(error.details);statusDetailsObj&&statusDetailsObj.details&&statusDetailsObj.details.length>0&&(error.statusDetails=statusDetailsObj.details),statusDetailsObj&&statusDetailsObj.errorInfo&&(error.reason=statusDetailsObj.errorInfo.reason,error.domain=statusDetailsObj.errorInfo.domain,error.errorInfoMetadata=statusDetailsObj.errorInfo.metadata)}catch{}return error}};__name(GoogleError,"GoogleError");exports2.GoogleError=GoogleError;var GoogleErrorDecoder=class{constructor(){let errorProtoJson=require_status2();this.root=protobuf.Root.fromJSON(errorProtoJson),this.anyType=this.root.lookupType("google.protobuf.Any"),this.statusType=this.root.lookupType("google.rpc.Status")}decodeProtobufAny(anyValue){let match=anyValue.type_url.match(/^type.googleapis.com\/(.*)/);if(!match)throw new Error(`Unknown type encoded in google.protobuf.any: ${anyValue.type_url}`);let typeName=match[1],type=this.root.lookupType(typeName);if(!type)throw new Error(`Cannot lookup type ${typeName}`);return type.decode(anyValue.value)}decodeRpcStatus(buffer){let uint8array=new Uint8Array(buffer),status=this.statusType.decode(uint8array),details=[],errorInfo;for(let detail of status.details)try{let decodedDetail=this.decodeProtobufAny(detail);details.push(decodedDetail),detail.type_url==="type.googleapis.com/google.rpc.ErrorInfo"&&(errorInfo=decodedDetail)}catch{}return{code:status.code,message:status.message,statusDetails:details,reason:errorInfo?.reason,domain:errorInfo?.domain,errorInfoMetadata:errorInfo?.metadata}}callErrorFromStatus(status){return status.message=`${status.code} ${status_1.Status[status.code]}: ${status.message}`,Object.assign(new GoogleError(status.message),status)}decodeErrorFromBuffer(buffer){return this.callErrorFromStatus(this.decodeRpcStatus(buffer))}decodeGRPCStatusDetails(bufferArr){let details=[],errorInfo;return bufferArr.forEach(buffer=>{let uint8array=new Uint8Array(buffer),rpcStatus=this.statusType.decode(uint8array);for(let detail of rpcStatus.details)try{let decodedDetail=this.decodeProtobufAny(detail);details.push(decodedDetail),detail.type_url==="type.googleapis.com/google.rpc.ErrorInfo"&&(errorInfo=decodedDetail)}catch{}}),{details,errorInfo}}decodeHTTPError(json){let errorMessage=serializer.fromProto3JSON(this.statusType,json);if(!errorMessage)throw new Error(`Received error message ${json}, but failed to serialize as proto3 message`);return this.statusType.toObject(errorMessage,fallback_1.defaultToObjectOptions)}decodeHttpStatusDetails(rawDetails){let details=[],errorInfo;for(let detail of rawDetails)try{let decodedDetail=this.decodeProtobufAny(detail);details.push(decodedDetail),detail.type_url==="type.googleapis.com/google.rpc.ErrorInfo"&&(errorInfo=decodedDetail)}catch{}return{details,errorInfo}}};__name(GoogleErrorDecoder,"GoogleErrorDecoder");exports2.GoogleErrorDecoder=GoogleErrorDecoder}});var require_call=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/call.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.OngoingCallPromise=exports2.OngoingCall=void 0;var status_1=require_status(),googleError_1=require_googleError(),OngoingCall=class{constructor(callback){this.callback=callback,this.completed=!1}cancel(){if(!this.completed)if(this.completed=!0,this.cancelFunc)this.cancelFunc();else{let error=new googleError_1.GoogleError("cancelled");error.code=status_1.Status.CANCELLED,this.callback(error)}}call(func,argument){if(this.completed)return;let canceller=func(argument,(err,response,next,rawResponse)=>{this.completed=!0,setImmediate(this.callback,err,response,next,rawResponse)});canceller instanceof Promise&&canceller.catch(err=>{setImmediate(this.callback,new googleError_1.GoogleError(err),null,null,null)}),this.cancelFunc=()=>canceller.cancel()}};__name(OngoingCall,"OngoingCall");exports2.OngoingCall=OngoingCall;var OngoingCallPromise=class extends OngoingCall{constructor(){let resolveCallback,rejectCallback,callback=__name((err,response,next,rawResponse)=>{if(err)err.metadata?rejectCallback(googleError_1.GoogleError.parseGRPCStatusDetails(err)):rejectCallback(err);else if(response!==void 0)resolveCallback([response,next||null,rawResponse||null]);else throw new googleError_1.GoogleError("Neither error nor response are defined")},"callback"),promise=new Promise((resolve,reject)=>{resolveCallback=resolve,rejectCallback=reject});super(callback),this.promise=promise,this.promise.cancel=()=>{this.cancel()}}};__name(OngoingCallPromise,"OngoingCallPromise");exports2.OngoingCallPromise=OngoingCallPromise}});var require_normalApiCaller=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/normalCalls/normalApiCaller.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.NormalApiCaller=void 0;var call_1=require_call(),NormalApiCaller=class{init(callback){return callback?new call_1.OngoingCall(callback):new call_1.OngoingCallPromise}wrap(func){return func}call(apiCall,argument,settings,canceller){canceller.call(apiCall,argument)}fail(canceller,err){canceller.callback(err)}result(canceller){return canceller.promise}};__name(NormalApiCaller,"NormalApiCaller");exports2.NormalApiCaller=NormalApiCaller}});var require_apiCaller=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/apiCaller.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.createAPICaller=void 0;var normalApiCaller_1=require_normalApiCaller();function createAPICaller(settings,descriptor){return descriptor?descriptor.getApiCaller(settings):new normalApiCaller_1.NormalApiCaller}__name(createAPICaller,"createAPICaller");exports2.createAPICaller=createAPICaller}});var require_timeout=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/normalCalls/timeout.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.addTimeoutArg=void 0;function addTimeoutArg(func,timeout,otherArgs,abTests){return(argument,callback)=>{let now=new Date,options=otherArgs.options||{};options.deadline=new Date(now.getTime()+timeout);let metadata=otherArgs.metadataBuilder?otherArgs.metadataBuilder(abTests,otherArgs.headers||{}):null;return func(argument,metadata,options,callback)}}__name(addTimeoutArg,"addTimeoutArg");exports2.addTimeoutArg=addTimeoutArg}});var require_retries=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/normalCalls/retries.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.retryable=void 0;var status_1=require_status(),googleError_1=require_googleError(),timeout_1=require_timeout();function retryable(func,retry,otherArgs,apiName){let delayMult=retry.backoffSettings.retryDelayMultiplier,maxDelay=retry.backoffSettings.maxRetryDelayMillis,timeoutMult=retry.backoffSettings.rpcTimeoutMultiplier,maxTimeout=retry.backoffSettings.maxRpcTimeoutMillis,delay=retry.backoffSettings.initialRetryDelayMillis,timeout=retry.backoffSettings.initialRpcTimeoutMillis;return(argument,callback)=>{let canceller,timeoutId,now=new Date,deadline;retry.backoffSettings.totalTimeoutMillis&&(deadline=now.getTime()+retry.backoffSettings.totalTimeoutMillis);let retries=0,maxRetries=retry.backoffSettings.maxRetries;function repeat(){if(timeoutId=null,deadline&&now.getTime()>=deadline){let error=new googleError_1.GoogleError(`Total timeout of API ${apiName} exceeded ${retry.backoffSettings.totalTimeoutMillis} milliseconds before any response was received.`);error.code=status_1.Status.DEADLINE_EXCEEDED,callback(error);return}if(retries&&retries>=maxRetries){let error=new googleError_1.GoogleError("Exceeded maximum number of retries before any response was received");error.code=status_1.Status.DEADLINE_EXCEEDED,callback(error);return}retries++,canceller=(0,timeout_1.addTimeoutArg)(func,timeout,otherArgs)(argument,(err,response,next,rawResponse)=>{if(!err){callback(null,response,next,rawResponse);return}if(canceller=null,retry.retryCodes.length>0&&retry.retryCodes.indexOf(err.code)<0)err.note="Exception occurred in retry method that was not classified as transient",callback(err);else{let toSleep=Math.random()*delay;timeoutId=setTimeout(()=>{now=new Date,delay=Math.min(delay*delayMult,maxDelay);let timeoutCal=timeout&&timeoutMult?timeout*timeoutMult:0,rpcTimeout=maxTimeout||0,newDeadline=deadline?deadline-now.getTime():0;timeout=Math.min(timeoutCal,rpcTimeout,newDeadline),repeat()},toSleep)}}),canceller instanceof Promise&&canceller.catch(err=>{callback(new googleError_1.GoogleError(err))})}if(__name(repeat,"repeat"),maxRetries&&deadline){let error=new googleError_1.GoogleError("Cannot set both totalTimeoutMillis and maxRetries in backoffSettings.");error.code=status_1.Status.INVALID_ARGUMENT,callback(error)}else repeat();return{cancel(){if(timeoutId&&clearTimeout(timeoutId),canceller)canceller.cancel();else{let error=new googleError_1.GoogleError("cancelled");error.code=status_1.Status.CANCELLED,callback(error)}}}}}__name(retryable,"retryable");exports2.retryable=retryable}});var require_streamingRetryRequest=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/streamingRetryRequest.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.streamingRetryRequest=void 0;var{PassThrough}=require("stream"),DEFAULTS={maxRetries:2},requestOps=null,objectMode=!0;function streamingRetryRequest(opts){if(opts=Object.assign({},DEFAULTS,opts),opts.request===void 0)throw new Error("A request function must be provided");let numNoResponseAttempts=0,streamResponseHandled=!1,requestStream,delayStream,retryStream=new PassThrough({objectMode});return makeRequest(),retryStream;function makeRequest(){streamResponseHandled=!1,delayStream=new PassThrough({objectMode}),requestStream=opts.request(requestOps),requestStream.on("error",err=>{streamResponseHandled||(streamResponseHandled=!0,onResponse(err))}).on("response",resp=>{streamResponseHandled||(streamResponseHandled=!0,onResponse(null,resp))}),requestStream.pipe(delayStream)}__name(makeRequest,"makeRequest");function onResponse(err,response=null){if(err){numNoResponseAttempts++,numNoResponseAttempts<=opts.maxRetries?makeRequest():retryStream.emit("error",err);return}retryStream.emit("response",response),delayStream.pipe(retryStream),requestStream.on("error",()=>{retryStream.destroy()})}__name(onResponse,"onResponse")}__name(streamingRetryRequest,"streamingRetryRequest");exports2.streamingRetryRequest=streamingRetryRequest}});var require_stream=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/readable-stream/lib/internal/streams/stream.js"(exports2,module2){module2.exports=require("stream")}});var require_buffer_list=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports2,module2){"use strict";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}__name(ownKeys,"ownKeys");function _objectSpread(target){for(var i=1;i0?this.tail.next=entry:this.head=entry,this.tail=entry,++this.length},"push")},{key:"unshift",value:__name(function(v){var entry={data:v,next:this.head};this.length===0&&(this.tail=entry),this.head=entry,++this.length},"unshift")},{key:"shift",value:__name(function(){if(this.length!==0){var ret=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,ret}},"shift")},{key:"clear",value:__name(function(){this.head=this.tail=null,this.length=0},"clear")},{key:"join",value:__name(function(s){if(this.length===0)return"";for(var p=this.head,ret=""+p.data;p=p.next;)ret+=s+p.data;return ret},"join")},{key:"concat",value:__name(function(n){if(this.length===0)return Buffer2.alloc(0);for(var ret=Buffer2.allocUnsafe(n>>>0),p=this.head,i=0;p;)copyBuffer(p.data,ret,i),i+=p.data.length,p=p.next;return ret},"concat")},{key:"consume",value:__name(function(n,hasStrings){var ret;return nstr.length?str.length:n;if(nb===str.length?ret+=str:ret+=str.slice(0,n),n-=nb,n===0){nb===str.length?(++c,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=str.slice(nb));break}++c}return this.length-=c,ret},"_getString")},{key:"_getBuffer",value:__name(function(n){var ret=Buffer2.allocUnsafe(n),p=this.head,c=1;for(p.data.copy(ret),n-=p.data.length;p=p.next;){var buf=p.data,nb=n>buf.length?buf.length:n;if(buf.copy(ret,ret.length-n,0,nb),n-=nb,n===0){nb===buf.length?(++c,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=buf.slice(nb));break}++c}return this.length-=c,ret},"_getBuffer")},{key:custom,value:__name(function(_,options){return inspect(this,_objectSpread(_objectSpread({},options),{},{depth:0,customInspect:!1}))},"value")}]),BufferList}()}});var require_destroy=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2,module2){"use strict";function destroy(err,cb){var _this=this,readableDestroyed=this._readableState&&this._readableState.destroyed,writableDestroyed=this._writableState&&this._writableState.destroyed;return readableDestroyed||writableDestroyed?(cb?cb(err):err&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(emitErrorNT,this,err)):process.nextTick(emitErrorNT,this,err)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(err||null,function(err2){!cb&&err2?_this._writableState?_this._writableState.errorEmitted?process.nextTick(emitCloseNT,_this):(_this._writableState.errorEmitted=!0,process.nextTick(emitErrorAndCloseNT,_this,err2)):process.nextTick(emitErrorAndCloseNT,_this,err2):cb?(process.nextTick(emitCloseNT,_this),cb(err2)):process.nextTick(emitCloseNT,_this)}),this)}__name(destroy,"destroy");function emitErrorAndCloseNT(self2,err){emitErrorNT(self2,err),emitCloseNT(self2)}__name(emitErrorAndCloseNT,"emitErrorAndCloseNT");function emitCloseNT(self2){self2._writableState&&!self2._writableState.emitClose||self2._readableState&&!self2._readableState.emitClose||self2.emit("close")}__name(emitCloseNT,"emitCloseNT");function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}__name(undestroy,"undestroy");function emitErrorNT(self2,err){self2.emit("error",err)}__name(emitErrorNT,"emitErrorNT");function errorOrDestroy(stream,err){var rState=stream._readableState,wState=stream._writableState;rState&&rState.autoDestroy||wState&&wState.autoDestroy?stream.destroy(err):stream.emit("error",err)}__name(errorOrDestroy,"errorOrDestroy");module2.exports={destroy,undestroy,errorOrDestroy}}});var require_errors=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/readable-stream/errors.js"(exports2,module2){"use strict";var codes={};function createErrorType(code,message,Base){Base||(Base=Error);function getMessage(arg1,arg2,arg3){return typeof message=="string"?message:message(arg1,arg2,arg3)}__name(getMessage,"getMessage");class NodeError extends Base{constructor(arg1,arg2,arg3){super(getMessage(arg1,arg2,arg3))}}__name(NodeError,"NodeError"),NodeError.prototype.name=Base.name,NodeError.prototype.code=code,codes[code]=NodeError}__name(createErrorType,"createErrorType");function oneOf(expected,thing){if(Array.isArray(expected)){let len=expected.length;return expected=expected.map(i=>String(i)),len>2?`one of ${thing} ${expected.slice(0,len-1).join(", ")}, or `+expected[len-1]:len===2?`one of ${thing} ${expected[0]} or ${expected[1]}`:`of ${thing} ${expected[0]}`}else return`of ${thing} ${String(expected)}`}__name(oneOf,"oneOf");function startsWith(str,search,pos){return str.substr(!pos||pos<0?0:+pos,search.length)===search}__name(startsWith,"startsWith");function endsWith(str,search,this_len){return(this_len===void 0||this_len>str.length)&&(this_len=str.length),str.substring(this_len-search.length,this_len)===search}__name(endsWith,"endsWith");function includes(str,search,start){return typeof start!="number"&&(start=0),start+search.length>str.length?!1:str.indexOf(search,start)!==-1}__name(includes,"includes");createErrorType("ERR_INVALID_OPT_VALUE",function(name,value){return'The value "'+value+'" is invalid for option "'+name+'"'},TypeError);createErrorType("ERR_INVALID_ARG_TYPE",function(name,expected,actual){let determiner;typeof expected=="string"&&startsWith(expected,"not ")?(determiner="must not be",expected=expected.replace(/^not /,"")):determiner="must be";let msg;if(endsWith(name," argument"))msg=`The ${name} ${determiner} ${oneOf(expected,"type")}`;else{let type=includes(name,".")?"property":"argument";msg=`The "${name}" ${type} ${determiner} ${oneOf(expected,"type")}`}return msg+=`. Received type ${typeof actual}`,msg},TypeError);createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");createErrorType("ERR_METHOD_NOT_IMPLEMENTED",function(name){return"The "+name+" method is not implemented"});createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close");createErrorType("ERR_STREAM_DESTROYED",function(name){return"Cannot call "+name+" after a stream was destroyed"});createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times");createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end");createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);createErrorType("ERR_UNKNOWN_ENCODING",function(arg){return"Unknown encoding: "+arg},TypeError);createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");module2.exports.codes=codes}});var require_state=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/readable-stream/lib/internal/streams/state.js"(exports2,module2){"use strict";var ERR_INVALID_OPT_VALUE=require_errors().codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(options,isDuplex,duplexKey){return options.highWaterMark!=null?options.highWaterMark:isDuplex?options[duplexKey]:null}__name(highWaterMarkFrom,"highWaterMarkFrom");function getHighWaterMark(state,options,duplexKey,isDuplex){var hwm=highWaterMarkFrom(options,isDuplex,duplexKey);if(hwm!=null){if(!(isFinite(hwm)&&Math.floor(hwm)===hwm)||hwm<0){var name=isDuplex?duplexKey:"highWaterMark";throw new ERR_INVALID_OPT_VALUE(name,hwm)}return Math.floor(hwm)}return state.objectMode?16:16*1024}__name(getHighWaterMark,"getHighWaterMark");module2.exports={getHighWaterMark}}});var require_inherits_browser=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/inherits/inherits_browser.js"(exports2,module2){typeof Object.create=="function"?module2.exports=__name(function(ctor,superCtor){superCtor&&(ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):module2.exports=__name(function(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=__name(function(){},"TempCtor");TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},"inherits")}});var require_inherits=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/inherits/inherits.js"(exports2,module2){try{if(util=require("util"),typeof util.inherits!="function")throw"";module2.exports=util.inherits}catch{module2.exports=require_inherits_browser()}var util}});var require_node2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/util-deprecate/node.js"(exports2,module2){module2.exports=require("util").deprecate}});var require_stream_writable=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/readable-stream/lib/_stream_writable.js"(exports2,module2){"use strict";module2.exports=Writable;function CorkedRequest(state){var _this=this;this.next=null,this.entry=null,this.finish=function(){onCorkedFinish(_this,state)}}__name(CorkedRequest,"CorkedRequest");var Duplex;Writable.WritableState=WritableState;var internalUtil={deprecate:require_node2()},Stream=require_stream(),Buffer2=require("buffer").Buffer,OurUint8Array=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer2.from(chunk)}__name(_uint8ArrayToBuffer,"_uint8ArrayToBuffer");function _isUint8Array(obj){return Buffer2.isBuffer(obj)||obj instanceof OurUint8Array}__name(_isUint8Array,"_isUint8Array");var destroyImpl=require_destroy(),_require=require_state(),getHighWaterMark=_require.getHighWaterMark,_require$codes=require_errors().codes,ERR_INVALID_ARG_TYPE=_require$codes.ERR_INVALID_ARG_TYPE,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK=_require$codes.ERR_MULTIPLE_CALLBACK,ERR_STREAM_CANNOT_PIPE=_require$codes.ERR_STREAM_CANNOT_PIPE,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED,ERR_STREAM_NULL_VALUES=_require$codes.ERR_STREAM_NULL_VALUES,ERR_STREAM_WRITE_AFTER_END=_require$codes.ERR_STREAM_WRITE_AFTER_END,ERR_UNKNOWN_ENCODING=_require$codes.ERR_UNKNOWN_ENCODING,errorOrDestroy=destroyImpl.errorOrDestroy;require_inherits()(Writable,Stream);function nop(){}__name(nop,"nop");function WritableState(options,stream,isDuplex){Duplex=Duplex||require_stream_duplex(),options=options||{},typeof isDuplex!="boolean"&&(isDuplex=stream instanceof Duplex),this.objectMode=!!options.objectMode,isDuplex&&(this.objectMode=this.objectMode||!!options.writableObjectMode),this.highWaterMark=getHighWaterMark(this,options,"writableHighWaterMark",isDuplex),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var noDecode=options.decodeStrings===!1;this.decodeStrings=!noDecode,this.defaultEncoding=options.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(er){onwrite(stream,er)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=options.emitClose!==!1,this.autoDestroy=!!options.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}__name(WritableState,"WritableState");WritableState.prototype.getBuffer=__name(function(){for(var current=this.bufferedRequest,out=[];current;)out.push(current),current=current.next;return out},"getBuffer");(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(__name(function(){return this.getBuffer()},"writableStateBufferGetter"),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var realHasInstance;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(realHasInstance=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:__name(function(object){return realHasInstance.call(this,object)?!0:this!==Writable?!1:object&&object._writableState instanceof WritableState},"value")})):realHasInstance=__name(function(object){return object instanceof this},"realHasInstance");function Writable(options){Duplex=Duplex||require_stream_duplex();var isDuplex=this instanceof Duplex;if(!isDuplex&&!realHasInstance.call(Writable,this))return new Writable(options);this._writableState=new WritableState(options,this,isDuplex),this.writable=!0,options&&(typeof options.write=="function"&&(this._write=options.write),typeof options.writev=="function"&&(this._writev=options.writev),typeof options.destroy=="function"&&(this._destroy=options.destroy),typeof options.final=="function"&&(this._final=options.final)),Stream.call(this)}__name(Writable,"Writable");Writable.prototype.pipe=function(){errorOrDestroy(this,new ERR_STREAM_CANNOT_PIPE)};function writeAfterEnd(stream,cb){var er=new ERR_STREAM_WRITE_AFTER_END;errorOrDestroy(stream,er),process.nextTick(cb,er)}__name(writeAfterEnd,"writeAfterEnd");function validChunk(stream,state,chunk,cb){var er;return chunk===null?er=new ERR_STREAM_NULL_VALUES:typeof chunk!="string"&&!state.objectMode&&(er=new ERR_INVALID_ARG_TYPE("chunk",["string","Buffer"],chunk)),er?(errorOrDestroy(stream,er),process.nextTick(cb,er),!1):!0}__name(validChunk,"validChunk");Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState,ret=!1,isBuf=!state.objectMode&&_isUint8Array(chunk);return isBuf&&!Buffer2.isBuffer(chunk)&&(chunk=_uint8ArrayToBuffer(chunk)),typeof encoding=="function"&&(cb=encoding,encoding=null),isBuf?encoding="buffer":encoding||(encoding=state.defaultEncoding),typeof cb!="function"&&(cb=nop),state.ending?writeAfterEnd(this,cb):(isBuf||validChunk(this,state,chunk,cb))&&(state.pendingcb++,ret=writeOrBuffer(this,state,isBuf,chunk,encoding,cb)),ret};Writable.prototype.cork=function(){this._writableState.corked++};Writable.prototype.uncork=function(){var state=this._writableState;state.corked&&(state.corked--,!state.writing&&!state.corked&&!state.bufferProcessing&&state.bufferedRequest&&clearBuffer(this,state))};Writable.prototype.setDefaultEncoding=__name(function(encoding){if(typeof encoding=="string"&&(encoding=encoding.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new ERR_UNKNOWN_ENCODING(encoding);return this._writableState.defaultEncoding=encoding,this},"setDefaultEncoding");Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:__name(function(){return this._writableState&&this._writableState.getBuffer()},"get")});function decodeChunk(state,chunk,encoding){return!state.objectMode&&state.decodeStrings!==!1&&typeof chunk=="string"&&(chunk=Buffer2.from(chunk,encoding)),chunk}__name(decodeChunk,"decodeChunk");Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:__name(function(){return this._writableState.highWaterMark},"get")});function writeOrBuffer(stream,state,isBuf,chunk,encoding,cb){if(!isBuf){var newChunk=decodeChunk(state,chunk,encoding);chunk!==newChunk&&(isBuf=!0,encoding="buffer",chunk=newChunk)}var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length>5===6?2:byte>>4===14?3:byte>>3===30?4:byte>>6===2?-1:-2}__name(utf8CheckByte,"utf8CheckByte");function utf8CheckIncomplete(self2,buf,i){var j=buf.length-1;if(j=0?(nb>0&&(self2.lastNeed=nb-1),nb):--j=0?(nb>0&&(self2.lastNeed=nb-2),nb):--j=0?(nb>0&&(nb===2?nb=0:self2.lastNeed=nb-3),nb):0))}__name(utf8CheckIncomplete,"utf8CheckIncomplete");function utf8CheckExtraBytes(self2,buf,p){if((buf[0]&192)!==128)return self2.lastNeed=0,"\uFFFD";if(self2.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128)return self2.lastNeed=1,"\uFFFD";if(self2.lastNeed>2&&buf.length>2&&(buf[2]&192)!==128)return self2.lastNeed=2,"\uFFFD"}}__name(utf8CheckExtraBytes,"utf8CheckExtraBytes");function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed,r=utf8CheckExtraBytes(this,buf,p);if(r!==void 0)return r;if(this.lastNeed<=buf.length)return buf.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);buf.copy(this.lastChar,p,0,buf.length),this.lastNeed-=buf.length}__name(utf8FillLast,"utf8FillLast");function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);return buf.copy(this.lastChar,0,end),buf.toString("utf8",i,end)}__name(utf8Text,"utf8Text");function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";return this.lastNeed?r+"\uFFFD":r}__name(utf8End,"utf8End");function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=buf[buf.length-1],buf.toString("utf16le",i,buf.length-1)}__name(utf16Text,"utf16Text");function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}__name(utf16End,"utf16End");function base64Text(buf,i){var n=(buf.length-i)%3;return n===0?buf.toString("base64",i):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=buf[buf.length-1]:(this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1]),buf.toString("base64",i,buf.length-n))}__name(base64Text,"base64Text");function base64End(buf){var r=buf&&buf.length?this.write(buf):"";return this.lastNeed?r+this.lastChar.toString("base64",0,3-this.lastNeed):r}__name(base64End,"base64End");function simpleWrite(buf){return buf.toString(this.encoding)}__name(simpleWrite,"simpleWrite");function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}__name(simpleEnd,"simpleEnd")}});var require_end_of_stream=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports2,module2){"use strict";var ERR_STREAM_PREMATURE_CLOSE=require_errors().codes.ERR_STREAM_PREMATURE_CLOSE;function once(callback){var called=!1;return function(){if(!called){called=!0;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];callback.apply(this,args)}}}__name(once,"once");function noop(){}__name(noop,"noop");function isRequest(stream){return stream.setHeader&&typeof stream.abort=="function"}__name(isRequest,"isRequest");function eos(stream,opts,callback){if(typeof opts=="function")return eos(stream,null,opts);opts||(opts={}),callback=once(callback||noop);var readable=opts.readable||opts.readable!==!1&&stream.readable,writable=opts.writable||opts.writable!==!1&&stream.writable,onlegacyfinish=__name(function(){stream.writable||onfinish()},"onlegacyfinish"),writableEnded=stream._writableState&&stream._writableState.finished,onfinish=__name(function(){writable=!1,writableEnded=!0,readable||callback.call(stream)},"onfinish"),readableEnded=stream._readableState&&stream._readableState.endEmitted,onend=__name(function(){readable=!1,readableEnded=!0,writable||callback.call(stream)},"onend"),onerror=__name(function(err){callback.call(stream,err)},"onerror"),onclose=__name(function(){var err;if(readable&&!readableEnded)return(!stream._readableState||!stream._readableState.ended)&&(err=new ERR_STREAM_PREMATURE_CLOSE),callback.call(stream,err);if(writable&&!writableEnded)return(!stream._writableState||!stream._writableState.ended)&&(err=new ERR_STREAM_PREMATURE_CLOSE),callback.call(stream,err)},"onclose"),onrequest=__name(function(){stream.req.on("finish",onfinish)},"onrequest");return isRequest(stream)?(stream.on("complete",onfinish),stream.on("abort",onclose),stream.req?onrequest():stream.on("request",onrequest)):writable&&!stream._writableState&&(stream.on("end",onlegacyfinish),stream.on("close",onlegacyfinish)),stream.on("end",onend),stream.on("finish",onfinish),opts.error!==!1&&stream.on("error",onerror),stream.on("close",onclose),function(){stream.removeListener("complete",onfinish),stream.removeListener("abort",onclose),stream.removeListener("request",onrequest),stream.req&&stream.req.removeListener("finish",onfinish),stream.removeListener("end",onlegacyfinish),stream.removeListener("close",onlegacyfinish),stream.removeListener("finish",onfinish),stream.removeListener("end",onend),stream.removeListener("error",onerror),stream.removeListener("close",onclose)}}__name(eos,"eos");module2.exports=eos}});var require_async_iterator=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports2,module2){"use strict";var _Object$setPrototypeO;function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}__name(_defineProperty,"_defineProperty");function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key=="symbol"?key:String(key)}__name(_toPropertyKey,"_toPropertyKey");function _toPrimitive(input,hint){if(typeof input!="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if(typeof res!="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}__name(_toPrimitive,"_toPrimitive");var finished=require_end_of_stream(),kLastResolve=Symbol("lastResolve"),kLastReject=Symbol("lastReject"),kError=Symbol("error"),kEnded=Symbol("ended"),kLastPromise=Symbol("lastPromise"),kHandlePromise=Symbol("handlePromise"),kStream=Symbol("stream");function createIterResult(value,done){return{value,done}}__name(createIterResult,"createIterResult");function readAndResolve(iter){var resolve=iter[kLastResolve];if(resolve!==null){var data=iter[kStream].read();data!==null&&(iter[kLastPromise]=null,iter[kLastResolve]=null,iter[kLastReject]=null,resolve(createIterResult(data,!1)))}}__name(readAndResolve,"readAndResolve");function onReadable(iter){process.nextTick(readAndResolve,iter)}__name(onReadable,"onReadable");function wrapForNext(lastPromise,iter){return function(resolve,reject){lastPromise.then(function(){if(iter[kEnded]){resolve(createIterResult(void 0,!0));return}iter[kHandlePromise](resolve,reject)},reject)}}__name(wrapForNext,"wrapForNext");var AsyncIteratorPrototype=Object.getPrototypeOf(function(){}),ReadableStreamAsyncIteratorPrototype=Object.setPrototypeOf((_Object$setPrototypeO={get stream(){return this[kStream]},next:__name(function(){var _this=this,error=this[kError];if(error!==null)return Promise.reject(error);if(this[kEnded])return Promise.resolve(createIterResult(void 0,!0));if(this[kStream].destroyed)return new Promise(function(resolve,reject){process.nextTick(function(){_this[kError]?reject(_this[kError]):resolve(createIterResult(void 0,!0))})});var lastPromise=this[kLastPromise],promise;if(lastPromise)promise=new Promise(wrapForNext(lastPromise,this));else{var data=this[kStream].read();if(data!==null)return Promise.resolve(createIterResult(data,!1));promise=new Promise(this[kHandlePromise])}return this[kLastPromise]=promise,promise},"next")},_defineProperty(_Object$setPrototypeO,Symbol.asyncIterator,function(){return this}),_defineProperty(_Object$setPrototypeO,"return",__name(function(){var _this2=this;return new Promise(function(resolve,reject){_this2[kStream].destroy(null,function(err){if(err){reject(err);return}resolve(createIterResult(void 0,!0))})})},"_return")),_Object$setPrototypeO),AsyncIteratorPrototype),createReadableStreamAsyncIterator=__name(function(stream){var _Object$create,iterator=Object.create(ReadableStreamAsyncIteratorPrototype,(_Object$create={},_defineProperty(_Object$create,kStream,{value:stream,writable:!0}),_defineProperty(_Object$create,kLastResolve,{value:null,writable:!0}),_defineProperty(_Object$create,kLastReject,{value:null,writable:!0}),_defineProperty(_Object$create,kError,{value:null,writable:!0}),_defineProperty(_Object$create,kEnded,{value:stream._readableState.endEmitted,writable:!0}),_defineProperty(_Object$create,kHandlePromise,{value:__name(function(resolve,reject){var data=iterator[kStream].read();data?(iterator[kLastPromise]=null,iterator[kLastResolve]=null,iterator[kLastReject]=null,resolve(createIterResult(data,!1))):(iterator[kLastResolve]=resolve,iterator[kLastReject]=reject)},"value"),writable:!0}),_Object$create));return iterator[kLastPromise]=null,finished(stream,function(err){if(err&&err.code!=="ERR_STREAM_PREMATURE_CLOSE"){var reject=iterator[kLastReject];reject!==null&&(iterator[kLastPromise]=null,iterator[kLastResolve]=null,iterator[kLastReject]=null,reject(err)),iterator[kError]=err;return}var resolve=iterator[kLastResolve];resolve!==null&&(iterator[kLastPromise]=null,iterator[kLastResolve]=null,iterator[kLastReject]=null,resolve(createIterResult(void 0,!0))),iterator[kEnded]=!0}),stream.on("readable",onReadable.bind(null,iterator)),iterator},"createReadableStreamAsyncIterator");module2.exports=createReadableStreamAsyncIterator}});var require_from=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/readable-stream/lib/internal/streams/from.js"(exports2,module2){"use strict";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){reject(error);return}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}__name(asyncGeneratorStep,"asyncGeneratorStep");function _asyncToGenerator(fn){return function(){var self2=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self2,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}__name(_next,"_next");function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}__name(_throw,"_throw"),_next(void 0)})}}__name(_asyncToGenerator,"_asyncToGenerator");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}__name(ownKeys,"ownKeys");function _objectSpread(target){for(var i=1;i0)if(typeof chunk!="string"&&!state.objectMode&&Object.getPrototypeOf(chunk)!==Buffer2.prototype&&(chunk=_uint8ArrayToBuffer(chunk)),addToFront)state.endEmitted?errorOrDestroy(stream,new ERR_STREAM_UNSHIFT_AFTER_END_EVENT):addChunk(stream,state,chunk,!0);else if(state.ended)errorOrDestroy(stream,new ERR_STREAM_PUSH_AFTER_EOF);else{if(state.destroyed)return!1;state.reading=!1,state.decoder&&!encoding?(chunk=state.decoder.write(chunk),state.objectMode||chunk.length!==0?addChunk(stream,state,chunk,!1):maybeReadMore(stream,state)):addChunk(stream,state,chunk,!1)}else addToFront||(state.reading=!1,maybeReadMore(stream,state))}return!state.ended&&(state.length=MAX_HWM?n=MAX_HWM:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n}__name(computeNewHighWaterMark,"computeNewHighWaterMark");function howMuchToRead(n,state){return n<=0||state.length===0&&state.ended?0:state.objectMode?1:n!==n?state.flowing&&state.length?state.buffer.head.data.length:state.length:(n>state.highWaterMark&&(state.highWaterMark=computeNewHighWaterMark(n)),n<=state.length?n:state.ended?state.length:(state.needReadable=!0,0))}__name(howMuchToRead,"howMuchToRead");Readable.prototype.read=function(n){debug("read",n),n=parseInt(n,10);var state=this._readableState,nOrig=n;if(n!==0&&(state.emittedReadable=!1),n===0&&state.needReadable&&((state.highWaterMark!==0?state.length>=state.highWaterMark:state.length>0)||state.ended))return debug("read: emitReadable",state.length,state.ended),state.length===0&&state.ended?endReadable(this):emitReadable(this),null;if(n=howMuchToRead(n,state),n===0&&state.ended)return state.length===0&&endReadable(this),null;var doRead=state.needReadable;debug("need readable",doRead),(state.length===0||state.length-n0?ret=fromList(n,state):ret=null,ret===null?(state.needReadable=state.length<=state.highWaterMark,n=0):(state.length-=n,state.awaitDrain=0),state.length===0&&(state.ended||(state.needReadable=!0),nOrig!==n&&state.ended&&endReadable(this)),ret!==null&&this.emit("data",ret),ret};function onEofChunk(stream,state){if(debug("onEofChunk"),!state.ended){if(state.decoder){var chunk=state.decoder.end();chunk&&chunk.length&&(state.buffer.push(chunk),state.length+=state.objectMode?1:chunk.length)}state.ended=!0,state.sync?emitReadable(stream):(state.needReadable=!1,state.emittedReadable||(state.emittedReadable=!0,emitReadable_(stream)))}}__name(onEofChunk,"onEofChunk");function emitReadable(stream){var state=stream._readableState;debug("emitReadable",state.needReadable,state.emittedReadable),state.needReadable=!1,state.emittedReadable||(debug("emitReadable",state.flowing),state.emittedReadable=!0,process.nextTick(emitReadable_,stream))}__name(emitReadable,"emitReadable");function emitReadable_(stream){var state=stream._readableState;debug("emitReadable_",state.destroyed,state.length,state.ended),!state.destroyed&&(state.length||state.ended)&&(stream.emit("readable"),state.emittedReadable=!1),state.needReadable=!state.flowing&&!state.ended&&state.length<=state.highWaterMark,flow(stream)}__name(emitReadable_,"emitReadable_");function maybeReadMore(stream,state){state.readingMore||(state.readingMore=!0,process.nextTick(maybeReadMore_,stream,state))}__name(maybeReadMore,"maybeReadMore");function maybeReadMore_(stream,state){for(;!state.reading&&!state.ended&&(state.length1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp&&(debug("false write response, pause",state.awaitDrain),state.awaitDrain++),src.pause())}__name(ondata,"ondata");function onerror(er){debug("onerror",er),unpipe(),dest.removeListener("error",onerror),EElistenerCount(dest,"error")===0&&errorOrDestroy(dest,er)}__name(onerror,"onerror"),prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish),unpipe()}__name(onclose,"onclose"),dest.once("close",onclose);function onfinish(){debug("onfinish"),dest.removeListener("close",onclose),unpipe()}__name(onfinish,"onfinish"),dest.once("finish",onfinish);function unpipe(){debug("unpipe"),src.unpipe(dest)}return __name(unpipe,"unpipe"),dest.emit("pipe",src),state.flowing||(debug("pipe resume"),src.resume()),dest};function pipeOnDrain(src){return __name(function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain),state.awaitDrain&&state.awaitDrain--,state.awaitDrain===0&&EElistenerCount(src,"data")&&(state.flowing=!0,flow(src))},"pipeOnDrainFunctionResult")}__name(pipeOnDrain,"pipeOnDrain");Readable.prototype.unpipe=function(dest){var state=this._readableState,unpipeInfo={hasUnpiped:!1};if(state.pipesCount===0)return this;if(state.pipesCount===1)return dest&&dest!==state.pipes?this:(dest||(dest=state.pipes),state.pipes=null,state.pipesCount=0,state.flowing=!1,dest&&dest.emit("unpipe",this,unpipeInfo),this);if(!dest){var dests=state.pipes,len=state.pipesCount;state.pipes=null,state.pipesCount=0,state.flowing=!1;for(var i=0;i0,state.flowing!==!1&&this.resume()):ev==="readable"&&!state.endEmitted&&!state.readableListening&&(state.readableListening=state.needReadable=!0,state.flowing=!1,state.emittedReadable=!1,debug("on readable",state.length,state.reading),state.length?emitReadable(this):state.reading||process.nextTick(nReadingNextTick,this)),res};Readable.prototype.addListener=Readable.prototype.on;Readable.prototype.removeListener=function(ev,fn){var res=Stream.prototype.removeListener.call(this,ev,fn);return ev==="readable"&&process.nextTick(updateReadableListening,this),res};Readable.prototype.removeAllListeners=function(ev){var res=Stream.prototype.removeAllListeners.apply(this,arguments);return(ev==="readable"||ev===void 0)&&process.nextTick(updateReadableListening,this),res};function updateReadableListening(self2){var state=self2._readableState;state.readableListening=self2.listenerCount("readable")>0,state.resumeScheduled&&!state.paused?state.flowing=!0:self2.listenerCount("data")>0&&self2.resume()}__name(updateReadableListening,"updateReadableListening");function nReadingNextTick(self2){debug("readable nexttick read 0"),self2.read(0)}__name(nReadingNextTick,"nReadingNextTick");Readable.prototype.resume=function(){var state=this._readableState;return state.flowing||(debug("resume"),state.flowing=!state.readableListening,resume(this,state)),state.paused=!1,this};function resume(stream,state){state.resumeScheduled||(state.resumeScheduled=!0,process.nextTick(resume_,stream,state))}__name(resume,"resume");function resume_(stream,state){debug("resume",state.reading),state.reading||stream.read(0),state.resumeScheduled=!1,stream.emit("resume"),flow(stream),state.flowing&&!state.reading&&stream.read(0)}__name(resume_,"resume_");Readable.prototype.pause=function(){return debug("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(debug("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function flow(stream){var state=stream._readableState;for(debug("flow",state.flowing);state.flowing&&stream.read()!==null;);}__name(flow,"flow");Readable.prototype.wrap=function(stream){var _this=this,state=this._readableState,paused=!1;stream.on("end",function(){if(debug("wrapped end"),state.decoder&&!state.ended){var chunk=state.decoder.end();chunk&&chunk.length&&_this.push(chunk)}_this.push(null)}),stream.on("data",function(chunk){if(debug("wrapped data"),state.decoder&&(chunk=state.decoder.write(chunk)),!(state.objectMode&&chunk==null)&&!(!state.objectMode&&(!chunk||!chunk.length))){var ret=_this.push(chunk);ret||(paused=!0,stream.pause())}});for(var i in stream)this[i]===void 0&&typeof stream[i]=="function"&&(this[i]=__name(function(method){return __name(function(){return stream[method].apply(stream,arguments)},"methodWrapReturnFunction")},"methodWrap")(i));for(var n=0;n=state.length?(state.decoder?ret=state.buffer.join(""):state.buffer.length===1?ret=state.buffer.first():ret=state.buffer.concat(state.length),state.buffer.clear()):ret=state.buffer.consume(n,state.decoder),ret}__name(fromList,"fromList");function endReadable(stream){var state=stream._readableState;debug("endReadable",state.endEmitted),state.endEmitted||(state.ended=!0,process.nextTick(endReadableNT,state,stream))}__name(endReadable,"endReadable");function endReadableNT(state,stream){if(debug("endReadableNT",state.endEmitted,state.length),!state.endEmitted&&state.length===0&&(state.endEmitted=!0,stream.readable=!1,stream.emit("end"),state.autoDestroy)){var wState=stream._writableState;(!wState||wState.autoDestroy&&wState.finished)&&stream.destroy()}}__name(endReadableNT,"endReadableNT");typeof Symbol=="function"&&(Readable.from=function(iterable,opts){return from===void 0&&(from=require_from()),from(Readable,iterable,opts)});function indexOf(xs,x){for(var i=0,l=xs.length;i0;return destroyer(stream,reading,writing,function(err){error||(error=err),err&&destroys.forEach(call),!reading&&(destroys.forEach(call),callback(error))})});return streams.reduce(pipe)}__name(pipeline,"pipeline");module2.exports=pipeline}});var require_readable=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/readable-stream/readable.js"(exports2,module2){var Stream=require("stream");process.env.READABLE_STREAM==="disable"&&Stream?(module2.exports=Stream.Readable,Object.assign(module2.exports,Stream),module2.exports.Stream=Stream):(exports2=module2.exports=require_stream_readable(),exports2.Stream=Stream||exports2,exports2.Readable=exports2,exports2.Writable=require_stream_writable(),exports2.Duplex=require_stream_duplex(),exports2.Transform=require_stream_transform(),exports2.PassThrough=require_stream_passthrough(),exports2.finished=require_end_of_stream(),exports2.pipeline=require_pipeline())}});var require_wrappy=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/wrappy/wrappy.js"(exports2,module2){module2.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!="function")throw new TypeError("need wrapper function");return Object.keys(fn).forEach(function(k){wrapper[k]=fn[k]}),wrapper;function wrapper(){for(var args=new Array(arguments.length),i=0;i0&&state.buffer[idx])return state.buffer[idx].length}return state.length}__name(getStateLength,"getStateLength")}});var require_duplexify=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/duplexify/index.js"(exports2,module2){var stream=require_readable(),eos=require_end_of_stream2(),inherits=require_inherits(),shift=require_stream_shift(),SIGNAL_FLUSH=Buffer.from&&Buffer.from!==Uint8Array.from?Buffer.from([0]):new Buffer([0]),onuncork=__name(function(self2,fn){self2._corked?self2.once("uncork",fn):fn()},"onuncork"),autoDestroy=__name(function(self2,err){self2._autoDestroy&&self2.destroy(err)},"autoDestroy"),destroyer=__name(function(self2,end2){return function(err){err?autoDestroy(self2,err.message==="premature close"?null:err):end2&&!self2._ended&&self2.end()}},"destroyer"),end=__name(function(ws,fn){if(!ws||ws._writableState&&ws._writableState.finished)return fn();if(ws._writableState)return ws.end(fn);ws.end(),fn()},"end"),noop=__name(function(){},"noop"),toStreams2=__name(function(rs){return new stream.Readable({objectMode:!0,highWaterMark:16}).wrap(rs)},"toStreams2"),Duplexify=__name(function(writable,readable,opts){if(!(this instanceof Duplexify))return new Duplexify(writable,readable,opts);stream.Duplex.call(this,opts),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!opts||opts.autoDestroy!==!1,this._forwardDestroy=!opts||opts.destroy!==!1,this._forwardEnd=!opts||opts.end!==!1,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,writable&&this.setWritable(writable),readable&&this.setReadable(readable)},"Duplexify");inherits(Duplexify,stream.Duplex);Duplexify.obj=function(writable,readable,opts){return opts||(opts={}),opts.objectMode=!0,opts.highWaterMark=16,new Duplexify(writable,readable,opts)};Duplexify.prototype.cork=function(){++this._corked===1&&this.emit("cork")};Duplexify.prototype.uncork=function(){this._corked&&--this._corked===0&&this.emit("uncork")};Duplexify.prototype.setWritable=function(writable){if(this._unwrite&&this._unwrite(),this.destroyed){writable&&writable.destroy&&writable.destroy();return}if(writable===null||writable===!1){this.end();return}var self2=this,unend=eos(writable,{writable:!0,readable:!1},destroyer(this,this._forwardEnd)),ondrain=__name(function(){var ondrain2=self2._ondrain;self2._ondrain=null,ondrain2&&ondrain2()},"ondrain"),clear=__name(function(){self2._writable.removeListener("drain",ondrain),unend()},"clear");this._unwrite&&process.nextTick(ondrain),this._writable=writable,this._writable.on("drain",ondrain),this._unwrite=clear,this.uncork()};Duplexify.prototype.setReadable=function(readable){if(this._unread&&this._unread(),this.destroyed){readable&&readable.destroy&&readable.destroy();return}if(readable===null||readable===!1){this.push(null),this.resume();return}var self2=this,unend=eos(readable,{writable:!1,readable:!0},destroyer(this)),onreadable=__name(function(){self2._forward()},"onreadable"),onend=__name(function(){self2.push(null)},"onend"),clear=__name(function(){self2._readable2.removeListener("readable",onreadable),self2._readable2.removeListener("end",onend),unend()},"clear");this._drained=!0,this._readable=readable,this._readable2=readable._readableState?readable:toStreams2(readable),this._readable2.on("readable",onreadable),this._readable2.on("end",onend),this._unread=clear,this._forward()};Duplexify.prototype._read=function(){this._drained=!0,this._forward()};Duplexify.prototype._forward=function(){if(!(this._forwarding||!this._readable2||!this._drained)){this._forwarding=!0;for(var data;this._drained&&(data=shift(this._readable2))!==null;)this.destroyed||(this._drained=this.push(data));this._forwarding=!1}};Duplexify.prototype.destroy=function(err,cb){if(cb||(cb=noop),this.destroyed)return cb(null);this.destroyed=!0;var self2=this;process.nextTick(function(){self2._destroy(err),cb(null)})};Duplexify.prototype._destroy=function(err){if(err){var ondrain=this._ondrain;this._ondrain=null,ondrain?ondrain(err):this.emit("error",err)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")};Duplexify.prototype._write=function(data,enc,cb){if(!this.destroyed){if(this._corked)return onuncork(this,this._write.bind(this,data,enc,cb));if(data===SIGNAL_FLUSH)return this._finish(cb);if(!this._writable)return cb();this._writable.write(data)===!1?this._ondrain=cb:this.destroyed||cb()}};Duplexify.prototype._finish=function(cb){var self2=this;this.emit("preend"),onuncork(this,function(){end(self2._forwardEnd&&self2._writable,function(){self2._writableState.prefinished===!1&&(self2._writableState.prefinished=!0),self2.emit("prefinish"),onuncork(self2,cb)})})};Duplexify.prototype.end=function(data,enc,cb){return typeof data=="function"?this.end(null,null,data):typeof enc=="function"?this.end(data,null,enc):(this._ended=!0,data&&this.write(data),!this._writableState.ending&&!this._writableState.destroyed&&this.write(SIGNAL_FLUSH),stream.Writable.prototype.end.call(this,cb))};module2.exports=Duplexify}});var require_retry_request=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/retry-request/index.js"(exports2,module2){"use strict";var{PassThrough}=require("stream"),extend=require_extend(),debug=__name(()=>{},"debug");typeof process<"u"&&"env"in process&&typeof process.env=="object"&&process.env.DEBUG==="retry-request"&&(debug=__name(message=>{console.log("retry-request:",message)},"debug"));var DEFAULTS={objectMode:!1,retries:2,maxRetryDelay:64,retryDelayMultiplier:2,totalTimeout:600,noResponseRetries:2,currentRetryAttempt:0,shouldRetryFn:function(response){let retryRanges=[[100,199],[429,429],[500,599]],statusCode=response.statusCode;debug(`Response status: ${statusCode}`);let range;for(;range=retryRanges.shift();)if(statusCode>=range[0]&&statusCode<=range[1])return!0}};function retryRequest(requestOpts,opts,callback){typeof requestOpts=="string"&&(requestOpts={url:requestOpts});let streamMode=typeof arguments[arguments.length-1]!="function";typeof opts=="function"&&(callback=opts);let manualCurrentRetryAttemptWasSet=opts&&typeof opts.currentRetryAttempt=="number";if(opts=extend({},DEFAULTS,opts),typeof opts.request>"u")throw new Error("A request library must be provided to retry-request.");let currentRetryAttempt=opts.currentRetryAttempt,numNoResponseAttempts=0,streamResponseHandled=!1,retryStream,requestStream,delayStream,activeRequest,retryRequest2={abort:function(){activeRequest&&activeRequest.abort&&activeRequest.abort()}};streamMode&&(retryStream=new PassThrough({objectMode:opts.objectMode}),retryStream.abort=resetStreams);let timeOfFirstRequest=Date.now();if(currentRetryAttempt>0?retryAfterDelay(currentRetryAttempt):makeRequest(),streamMode)return retryStream;return retryRequest2;function resetStreams(){delayStream=null,requestStream&&(requestStream.abort&&requestStream.abort(),requestStream.cancel&&requestStream.cancel(),requestStream.destroy?requestStream.destroy():requestStream.end&&requestStream.end())}function makeRequest(){let finishHandled=!1;currentRetryAttempt++,debug(`Current retry attempt: ${currentRetryAttempt}`);function handleFinish(args=[]){finishHandled||(finishHandled=!0,retryStream.emit("complete",...args))}__name(handleFinish,"handleFinish"),streamMode?(streamResponseHandled=!1,delayStream=new PassThrough({objectMode:opts.objectMode}),requestStream=opts.request(requestOpts),setImmediate(()=>{retryStream.emit("request")}),requestStream.on("error",err=>{streamResponseHandled||(streamResponseHandled=!0,onResponse(err))}).on("response",(resp,body)=>{streamResponseHandled||(streamResponseHandled=!0,onResponse(null,resp,body))}).on("complete",(...params)=>handleFinish(params)).on("finish",(...params)=>handleFinish(params)),requestStream.pipe(delayStream)):activeRequest=opts.request(requestOpts,onResponse)}function retryAfterDelay(currentRetryAttempt2){streamMode&&resetStreams();let nextRetryDelay=getNextRetryDelay({maxRetryDelay:opts.maxRetryDelay,retryDelayMultiplier:opts.retryDelayMultiplier,retryNumber:currentRetryAttempt2,timeOfFirstRequest,totalTimeout:opts.totalTimeout});if(debug(`Next retry delay: ${nextRetryDelay}`),nextRetryDelay<=0){numNoResponseAttempts=opts.noResponseRetries+1;return}setTimeout(makeRequest,nextRetryDelay)}function onResponse(err,response,body){if(err){numNoResponseAttempts++,numNoResponseAttempts<=opts.noResponseRetries?retryAfterDelay(numNoResponseAttempts):streamMode?(retryStream.emit("error",err),retryStream.end()):callback(err,response,body);return}if((manualCurrentRetryAttemptWasSet?currentRetryAttempt:currentRetryAttempt-1){retryStream.destroy(err2)})):callback(err,response,body)}}__name(retryRequest,"retryRequest");module2.exports=retryRequest;function getNextRetryDelay(config){let{maxRetryDelay,retryDelayMultiplier,retryNumber,timeOfFirstRequest,totalTimeout}=config,maxRetryDelayMs=maxRetryDelay*1e3,totalTimeoutMs=totalTimeout*1e3,jitter=Math.floor(Math.random()*1e3),calculatedNextRetryDelay=Math.pow(retryDelayMultiplier,retryNumber)*1e3+jitter,maxAllowableDelayMs=totalTimeoutMs-(Date.now()-timeOfFirstRequest);return Math.min(calculatedNextRetryDelay,maxAllowableDelayMs,maxRetryDelayMs)}__name(getNextRetryDelay,"getNextRetryDelay");module2.exports.defaults=DEFAULTS;module2.exports.getNextRetryDelay=getNextRetryDelay}});var require_streaming=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/streamingCalls/streaming.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.StreamProxy=exports2.StreamType=void 0;var googleError_1=require_googleError(),streamingRetryRequest_1=require_streamingRetryRequest(),status_1=require_status(),duplexify=require_duplexify(),retryRequest=require_retry_request(),StreamType;(function(StreamType2){StreamType2[StreamType2.SERVER_STREAMING=1]="SERVER_STREAMING",StreamType2[StreamType2.CLIENT_STREAMING=2]="CLIENT_STREAMING",StreamType2[StreamType2.BIDI_STREAMING=3]="BIDI_STREAMING"})(StreamType||(exports2.StreamType=StreamType={}));var StreamProxy=class extends duplexify{constructor(type,callback,rest,gaxServerStreamingRetries){super(void 0,void 0,{objectMode:!0,readable:type!==StreamType.CLIENT_STREAMING,writable:type!==StreamType.SERVER_STREAMING}),this.retries=0,this.type=type,this._callback=callback,this._isCancelCalled=!1,this._responseHasSent=!1,this.rest=rest,this.gaxServerStreamingRetries=gaxServerStreamingRetries}cancel(){this.stream?this.stream.cancel():this._isCancelCalled=!0}retry(stream,retry){let retryArgument=this.argument;if(typeof retry.getResumptionRequestFn=="function"){let resumptionRetryArgument=retry.getResumptionRequestFn(retryArgument);resumptionRetryArgument!==void 0&&(retryArgument=resumptionRetryArgument)}this.resetStreams(stream);let newStream=this.apiCall(retryArgument,this._callback);return this.stream=newStream,this.streamHandoffHelper(newStream,retry),newStream}throwIfMaxRetriesOrTotalTimeoutExceeded(deadline,maxRetries,totalTimeoutMillis){let now=new Date;if(this.prevDeadline!==void 0&&deadline&&now.getTime()>=this.prevDeadline){let error=new googleError_1.GoogleError(`Total timeout of API exceeded ${totalTimeoutMillis} milliseconds before any response was received.`);throw error.code=status_1.Status.DEADLINE_EXCEEDED,this.emit("error",error),this.destroy(),error}if(this.retries&&this.retries>=maxRetries){let error=new googleError_1.GoogleError("Exceeded maximum number of retries before any response was received");throw error.code=status_1.Status.DEADLINE_EXCEEDED,this.emit("error",error),this.destroy(),error}}streamHandoffErrorHandler(stream,retry,error){let retryStream=this.stream,delayMult=retry.backoffSettings.retryDelayMultiplier,maxDelay=retry.backoffSettings.maxRetryDelayMillis,timeoutMult=retry.backoffSettings.rpcTimeoutMultiplier,maxTimeout=retry.backoffSettings.maxRpcTimeoutMillis,delay=retry.backoffSettings.initialRetryDelayMillis,timeout=retry.backoffSettings.initialRpcTimeoutMillis,now=new Date,deadline=0;retry.backoffSettings.totalTimeoutMillis&&(deadline=now.getTime()+retry.backoffSettings.totalTimeoutMillis);let maxRetries=retry.backoffSettings.maxRetries;try{this.throwIfMaxRetriesOrTotalTimeoutExceeded(deadline,maxRetries,retry.backoffSettings.totalTimeoutMillis)}catch{return}this.retries++;let e=googleError_1.GoogleError.parseGRPCStatusDetails(error),shouldRetry=this.defaultShouldRetry(e,retry);if(retry.shouldRetryFn&&(shouldRetry=retry.shouldRetryFn(e)),shouldRetry){let toSleep=Math.random()*delay;setTimeout(()=>{now=new Date,delay=Math.min(delay*delayMult,maxDelay);let timeoutCal=timeout&&timeoutMult?timeout*timeoutMult:0,rpcTimeout=maxTimeout||0;this.prevDeadline=deadline;let newDeadline=deadline?deadline-now.getTime():0;timeout=Math.min(timeoutCal,rpcTimeout,newDeadline)},toSleep)}else{e.note="Exception occurred in retry method that was not classified as transient",this.emit("error",e),this.destroy();return}retryStream=this.retry(stream,retry),this.stream=retryStream}streamHandoffHelper(stream,retry){let enteredError=!1;this.eventForwardHelper(stream),stream.on("error",error=>{enteredError=!0,this.streamHandoffErrorHandler(stream,retry,error)}),stream.on("data",data=>{this.retries=0,this.emit.bind(this,"data")(data)}),stream.on("end",()=>{enteredError||(enteredError=!0,this.emit("end"),this.cancel())})}eventForwardHelper(stream){["metadata","response","status"].forEach(event=>{stream.on(event,this.emit.bind(this,event))})}statusMetadataHelper(stream){stream.on("status",()=>{this._responseHasSent||stream.emit("response",{code:200,details:"",message:"OK"})}),stream.on("metadata",metadata=>{stream.emit("response",{code:200,details:"",message:"OK",metadata}),this._responseHasSent=!0})}forwardEvents(stream){this.eventForwardHelper(stream),this.statusMetadataHelper(stream),stream.on("error",error=>{googleError_1.GoogleError.parseGRPCStatusDetails(error)})}defaultShouldRetry(error,retry){return!(retry.retryCodes.length>0&&retry.retryCodes.indexOf(error.code)<0||retry.retryCodes.length===0)}forwardEventsWithRetries(stream,retry){let retryStream=this.stream;return this.eventForwardHelper(stream),this.statusMetadataHelper(stream),stream.on("error",error=>{let timeout=retry.backoffSettings.totalTimeoutMillis,maxRetries=retry.backoffSettings.maxRetries;if(maxRetries&&maxRetries>0||timeout&&timeout>0){let e=googleError_1.GoogleError.parseGRPCStatusDetails(error),shouldRetry=this.defaultShouldRetry(e,retry);if(retry.shouldRetryFn&&(shouldRetry=retry.shouldRetryFn(e)),shouldRetry)if(maxRetries&&timeout){let newError=new googleError_1.GoogleError("Cannot set both totalTimeoutMillis and maxRetries in backoffSettings.");newError.code=status_1.Status.INVALID_ARGUMENT,this.emit("error",newError),this.destroy();return}else return this.retries++,retryStream=this.retry(stream,retry),this.stream=retryStream,retryStream;else{let e2=googleError_1.GoogleError.parseGRPCStatusDetails(error);e2.note="Exception occurred in retry method that was not classified as transient",this.destroy(e2);return}}else{if(maxRetries===0){let e=googleError_1.GoogleError.parseGRPCStatusDetails(error);e.note="Max retries is set to zero.",this.destroy(e);return}return googleError_1.GoogleError.parseGRPCStatusDetails(error)}}),retryStream}resetStreams(requestStream){requestStream&&(requestStream.cancel&&requestStream.cancel(),requestStream.destroy?requestStream.destroy():requestStream.end&&requestStream.end())}setStream(apiCall,argument,retryRequestOptions={},retry){if(this.apiCall=apiCall,this.argument=argument,this.type===StreamType.SERVER_STREAMING){if(this.rest){let stream2=apiCall(argument,this._callback);this.stream=stream2,this.setReadable(stream2)}else if(this.gaxServerStreamingRetries){let retryStream=(0,streamingRetryRequest_1.streamingRetryRequest)({request:()=>{if(this._isCancelCalled){this.stream&&this.stream.cancel();return}let stream2=apiCall(argument,this._callback);return this.stream=stream2,this.stream=this.forwardEventsWithRetries(stream2,retry),this.stream}});this.setReadable(retryStream)}else{let retryStream=retryRequest(null,{objectMode:!0,request:()=>{if(this._isCancelCalled){this.stream&&this.stream.cancel();return}let stream2=apiCall(argument,this._callback);return this.stream=stream2,this.forwardEvents(stream2),stream2},retries:retryRequestOptions.retries,currentRetryAttempt:retryRequestOptions.currentRetryAttempt,noResponseRetries:retryRequestOptions.noResponseRetries,shouldRetryFn:retryRequestOptions.shouldRetryFn});this.setReadable(retryStream)}return}let stream=apiCall(argument,this._callback);this.stream=stream,this.forwardEvents(stream),this.type===StreamType.CLIENT_STREAMING&&this.setWritable(stream),this.type===StreamType.BIDI_STREAMING&&(this.setReadable(stream),this.setWritable(stream)),this._isCancelCalled&&this.stream&&this.stream.cancel()}};__name(StreamProxy,"StreamProxy");exports2.StreamProxy=StreamProxy}});var require_streamingApiCaller=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/streamingCalls/streamingApiCaller.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.StreamingApiCaller=void 0;var warnings_1=require_warnings(),streaming_1=require_streaming(),StreamingApiCaller=class{constructor(descriptor){this.descriptor=descriptor}init(callback){return new streaming_1.StreamProxy(this.descriptor.type,callback,this.descriptor.rest,this.descriptor.gaxStreamingRetries)}wrap(func){switch(this.descriptor.type){case streaming_1.StreamType.SERVER_STREAMING:return(argument,metadata,options)=>func(argument,metadata,options);case streaming_1.StreamType.CLIENT_STREAMING:return(argument,metadata,options,callback)=>func(metadata,options,callback);case streaming_1.StreamType.BIDI_STREAMING:return(argument,metadata,options)=>func(metadata,options);default:(0,warnings_1.warn)("streaming_wrap_unknown_stream_type",`Unknown stream type: ${this.descriptor.type}`)}return func}call(apiCall,argument,settings,stream){stream.setStream(apiCall,argument,settings.retryRequestOptions,settings.retry)}fail(stream,err){stream.emit("error",err)}result(stream){return stream}};__name(StreamingApiCaller,"StreamingApiCaller");exports2.StreamingApiCaller=StreamingApiCaller}});var require_createApiCall=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/createApiCall.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.createApiCall=void 0;var apiCaller_1=require_apiCaller(),gax_1=require_gax(),retries_1=require_retries(),timeout_1=require_timeout(),streamingApiCaller_1=require_streamingApiCaller(),warnings_1=require_warnings();function createApiCall(func,settings,descriptor,_fallback){let funcPromise=typeof func=="function"?Promise.resolve(func):func,apiCaller=(0,apiCaller_1.createAPICaller)(settings,descriptor);return(request,callOptions,callback)=>{var _a,_b;let currentApiCaller=apiCaller,thisSettings;if(currentApiCaller instanceof streamingApiCaller_1.StreamingApiCaller){let gaxStreamingRetries=(_b=(_a=currentApiCaller.descriptor)===null||_a===void 0?void 0:_a.gaxStreamingRetries)!==null&&_b!==void 0?_b:!1,convertedRetryOptions=(0,gax_1.convertRetryOptions)(callOptions,gaxStreamingRetries);thisSettings=settings.merge(convertedRetryOptions)}else thisSettings=settings.merge(callOptions);settings.isBundling&&!thisSettings.isBundling&&(currentApiCaller=(0,apiCaller_1.createAPICaller)(settings,void 0));let ongoingCall=currentApiCaller.init(callback);return funcPromise.then(func2=>{var _a2,_b2,_c;func2=currentApiCaller.wrap(func2);let streaming=(_a2=currentApiCaller.descriptor)===null||_a2===void 0?void 0:_a2.streaming,retry=thisSettings.retry;if(streaming&&retry&&(retry.retryCodes.length>0&&retry.shouldRetryFn&&((0,warnings_1.warn)("either_retrycodes_or_shouldretryfn","Only one of retryCodes or shouldRetryFn may be defined. Ignoring retryCodes."),retry.retryCodes=[]),!currentApiCaller.descriptor.gaxStreamingRetries&&retry.getResumptionRequestFn))throw new Error("getResumptionRequestFn can only be used when gaxStreamingRetries is set to true.");if(!streaming&&retry){if(retry.shouldRetryFn)throw new Error("Using a function to determine retry eligibility is only supported with server streaming calls");if(retry.getResumptionRequestFn)throw new Error("Resumption strategy can only be used with server streaming retries");if(retry.retryCodes&&retry.retryCodes.length>0)return(_b2=(_c=retry.backoffSettings).initialRpcTimeoutMillis)!==null&&_b2!==void 0||(_c.initialRpcTimeoutMillis=thisSettings.timeout),(0,retries_1.retryable)(func2,thisSettings.retry,thisSettings.otherArgs,thisSettings.apiName)}return(0,timeout_1.addTimeoutArg)(func2,thisSettings.timeout,thisSettings.otherArgs)}).then(apiCall=>{currentApiCaller.call(apiCall,request,thisSettings,ongoingCall)}).catch(err=>{currentApiCaller.fail(ongoingCall,err)}),currentApiCaller.result(ongoingCall)}}__name(createApiCall,"createApiCall");exports2.createApiCall=createApiCall}});var require_minimal2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/node_modules/protobufjs/minimal.js"(exports2,module2){"use strict";module2.exports=require_index_minimal()}});var require_operations=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/protos/operations.js"(exports2,module2){(function(e){typeof define=="function"&&define.amd?define(["protobufjs/minimal"],e):typeof require=="function"&&typeof module2=="object"&&module2&&module2.exports&&(module2.exports=e(require_minimal2()))})(function(o){"use strict";var e,t,n,F,a=o.Reader,r=o.Writer,i=o.util,p=o.roots.operations_protos||(o.roots.operations_protos={});function G(e2,t2,n2){o.rpc.Service.call(this,e2,t2,n2)}__name(G,"G");function l(e2){if(e2)for(var t2=Object.keys(e2),n2=0;n2>>3){case 1:o2.name=e2.string();break;case 2:o2.metadata=p.google.protobuf.Any.decode(e2,e2.uint32());break;case 3:o2.done=e2.bool();break;case 4:o2.error=p.google.rpc.Status.decode(e2,e2.uint32());break;case 5:o2.response=p.google.protobuf.Any.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},l.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},l.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";var t2,n2={};if(e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name))return"name: string expected";if(e2.metadata!=null&&e2.hasOwnProperty("metadata")&&(t2=p.google.protobuf.Any.verify(e2.metadata)))return"metadata."+t2;if(e2.done!=null&&e2.hasOwnProperty("done")&&typeof e2.done!="boolean")return"done: boolean expected";if(e2.error!=null&&e2.hasOwnProperty("error")&&(n2.result=1,t2=p.google.rpc.Status.verify(e2.error)))return"error."+t2;if(e2.response!=null&&e2.hasOwnProperty("response")){if(n2.result===1)return"result: multiple values";if(n2.result=1,t2=p.google.protobuf.Any.verify(e2.response))return"response."+t2}return null},l.fromObject=function(e2){if(e2 instanceof p.google.longrunning.Operation)return e2;var t2=new p.google.longrunning.Operation;if(e2.name!=null&&(t2.name=String(e2.name)),e2.metadata!=null){if(typeof e2.metadata!="object")throw TypeError(".google.longrunning.Operation.metadata: object expected");t2.metadata=p.google.protobuf.Any.fromObject(e2.metadata)}if(e2.done!=null&&(t2.done=!!e2.done),e2.error!=null){if(typeof e2.error!="object")throw TypeError(".google.longrunning.Operation.error: object expected");t2.error=p.google.rpc.Status.fromObject(e2.error)}if(e2.response!=null){if(typeof e2.response!="object")throw TypeError(".google.longrunning.Operation.response: object expected");t2.response=p.google.protobuf.Any.fromObject(e2.response)}return t2},l.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.metadata=null,n2.done=!1),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.metadata!=null&&e2.hasOwnProperty("metadata")&&(n2.metadata=p.google.protobuf.Any.toObject(e2.metadata,t2)),e2.done!=null&&e2.hasOwnProperty("done")&&(n2.done=e2.done),e2.error!=null&&e2.hasOwnProperty("error")&&(n2.error=p.google.rpc.Status.toObject(e2.error,t2),t2.oneofs)&&(n2.result="error"),e2.response!=null&&e2.hasOwnProperty("response")&&(n2.response=p.google.protobuf.Any.toObject(e2.response,t2),t2.oneofs)&&(n2.result="response"),n2},l.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},l),t.GetOperationRequest=(B.prototype.name="",B.create=function(e2){return new B(e2)},B.encode=function(e2,t2){return t2=t2||r.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),t2},B.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},B.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new p.google.longrunning.GetOperationRequest;e2.pos>>3==1?o2.name=e2.string():e2.skipType(7&r2)}return o2},B.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},B.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name)?"name: string expected":null},B.fromObject=function(e2){var t2;return e2 instanceof p.google.longrunning.GetOperationRequest?e2:(t2=new p.google.longrunning.GetOperationRequest,e2.name!=null&&(t2.name=String(e2.name)),t2)},B.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name=""),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),n2},B.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},B),t.ListOperationsRequest=(s.prototype.name="",s.prototype.filter="",s.prototype.pageSize=0,s.prototype.pageToken="",s.create=function(e2){return new s(e2)},s.encode=function(e2,t2){return t2=t2||r.create(),e2.filter!=null&&Object.hasOwnProperty.call(e2,"filter")&&t2.uint32(10).string(e2.filter),e2.pageSize!=null&&Object.hasOwnProperty.call(e2,"pageSize")&&t2.uint32(16).int32(e2.pageSize),e2.pageToken!=null&&Object.hasOwnProperty.call(e2,"pageToken")&&t2.uint32(26).string(e2.pageToken),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(34).string(e2.name),t2},s.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},s.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new p.google.longrunning.ListOperationsRequest;e2.pos>>3){case 4:o2.name=e2.string();break;case 1:o2.filter=e2.string();break;case 2:o2.pageSize=e2.int32();break;case 3:o2.pageToken=e2.string();break;default:e2.skipType(7&r2)}}return o2},s.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},s.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name)?"name: string expected":e2.filter!=null&&e2.hasOwnProperty("filter")&&!i.isString(e2.filter)?"filter: string expected":e2.pageSize!=null&&e2.hasOwnProperty("pageSize")&&!i.isInteger(e2.pageSize)?"pageSize: integer expected":e2.pageToken!=null&&e2.hasOwnProperty("pageToken")&&!i.isString(e2.pageToken)?"pageToken: string expected":null},s.fromObject=function(e2){var t2;return e2 instanceof p.google.longrunning.ListOperationsRequest?e2:(t2=new p.google.longrunning.ListOperationsRequest,e2.name!=null&&(t2.name=String(e2.name)),e2.filter!=null&&(t2.filter=String(e2.filter)),e2.pageSize!=null&&(t2.pageSize=0|e2.pageSize),e2.pageToken!=null&&(t2.pageToken=String(e2.pageToken)),t2)},s.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.filter="",n2.pageSize=0,n2.pageToken="",n2.name=""),e2.filter!=null&&e2.hasOwnProperty("filter")&&(n2.filter=e2.filter),e2.pageSize!=null&&e2.hasOwnProperty("pageSize")&&(n2.pageSize=e2.pageSize),e2.pageToken!=null&&e2.hasOwnProperty("pageToken")&&(n2.pageToken=e2.pageToken),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),n2},s.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},s),t.ListOperationsResponse=(u.prototype.operations=i.emptyArray,u.prototype.nextPageToken="",u.create=function(e2){return new u(e2)},u.encode=function(e2,t2){if(t2=t2||r.create(),e2.operations!=null&&e2.operations.length)for(var n2=0;n2>>3){case 1:o2.operations&&o2.operations.length||(o2.operations=[]),o2.operations.push(p.google.longrunning.Operation.decode(e2,e2.uint32()));break;case 2:o2.nextPageToken=e2.string();break;default:e2.skipType(7&r2)}}return o2},u.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},u.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.operations!=null&&e2.hasOwnProperty("operations")){if(!Array.isArray(e2.operations))return"operations: array expected";for(var t2=0;t2>>3==1?o2.name=e2.string():e2.skipType(7&r2)}return o2},L.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},L.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name)?"name: string expected":null},L.fromObject=function(e2){var t2;return e2 instanceof p.google.longrunning.CancelOperationRequest?e2:(t2=new p.google.longrunning.CancelOperationRequest,e2.name!=null&&(t2.name=String(e2.name)),t2)},L.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name=""),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),n2},L.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},L),t.DeleteOperationRequest=(U.prototype.name="",U.create=function(e2){return new U(e2)},U.encode=function(e2,t2){return t2=t2||r.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),t2},U.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},U.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new p.google.longrunning.DeleteOperationRequest;e2.pos>>3==1?o2.name=e2.string():e2.skipType(7&r2)}return o2},U.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},U.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name)?"name: string expected":null},U.fromObject=function(e2){var t2;return e2 instanceof p.google.longrunning.DeleteOperationRequest?e2:(t2=new p.google.longrunning.DeleteOperationRequest,e2.name!=null&&(t2.name=String(e2.name)),t2)},U.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name=""),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),n2},U.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},U),t.WaitOperationRequest=(c.prototype.name="",c.prototype.timeout=null,c.create=function(e2){return new c(e2)},c.encode=function(e2,t2){return t2=t2||r.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.timeout!=null&&Object.hasOwnProperty.call(e2,"timeout")&&p.google.protobuf.Duration.encode(e2.timeout,t2.uint32(18).fork()).ldelim(),t2},c.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},c.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new p.google.longrunning.WaitOperationRequest;e2.pos>>3){case 1:o2.name=e2.string();break;case 2:o2.timeout=p.google.protobuf.Duration.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},c.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},c.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name)?"name: string expected":e2.timeout!=null&&e2.hasOwnProperty("timeout")&&(e2=p.google.protobuf.Duration.verify(e2.timeout),e2)?"timeout."+e2:null},c.fromObject=function(e2){if(e2 instanceof p.google.longrunning.WaitOperationRequest)return e2;var t2=new p.google.longrunning.WaitOperationRequest;if(e2.name!=null&&(t2.name=String(e2.name)),e2.timeout!=null){if(typeof e2.timeout!="object")throw TypeError(".google.longrunning.WaitOperationRequest.timeout: object expected");t2.timeout=p.google.protobuf.Duration.fromObject(e2.timeout)}return t2},c.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.timeout=null),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.timeout!=null&&e2.hasOwnProperty("timeout")&&(n2.timeout=p.google.protobuf.Duration.toObject(e2.timeout,t2)),n2},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c),t.OperationInfo=(d.prototype.responseType="",d.prototype.metadataType="",d.create=function(e2){return new d(e2)},d.encode=function(e2,t2){return t2=t2||r.create(),e2.responseType!=null&&Object.hasOwnProperty.call(e2,"responseType")&&t2.uint32(10).string(e2.responseType),e2.metadataType!=null&&Object.hasOwnProperty.call(e2,"metadataType")&&t2.uint32(18).string(e2.metadataType),t2},d.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},d.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new p.google.longrunning.OperationInfo;e2.pos>>3){case 1:o2.responseType=e2.string();break;case 2:o2.metadataType=e2.string();break;default:e2.skipType(7&r2)}}return o2},d.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},d.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.responseType!=null&&e2.hasOwnProperty("responseType")&&!i.isString(e2.responseType)?"responseType: string expected":e2.metadataType!=null&&e2.hasOwnProperty("metadataType")&&!i.isString(e2.metadataType)?"metadataType: string expected":null},d.fromObject=function(e2){var t2;return e2 instanceof p.google.longrunning.OperationInfo?e2:(t2=new p.google.longrunning.OperationInfo,e2.responseType!=null&&(t2.responseType=String(e2.responseType)),e2.metadataType!=null&&(t2.metadataType=String(e2.metadataType)),t2)},d.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.responseType="",n2.metadataType=""),e2.responseType!=null&&e2.hasOwnProperty("responseType")&&(n2.responseType=e2.responseType),e2.metadataType!=null&&e2.hasOwnProperty("metadataType")&&(n2.metadataType=e2.metadataType),n2},d.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},d),t),F.api=((n={}).Http=(g.prototype.rules=i.emptyArray,g.prototype.fullyDecodeReservedExpansion=!1,g.create=function(e2){return new g(e2)},g.encode=function(e2,t2){if(t2=t2||r.create(),e2.rules!=null&&e2.rules.length)for(var n2=0;n2>>3){case 1:o2.rules&&o2.rules.length||(o2.rules=[]),o2.rules.push(p.google.api.HttpRule.decode(e2,e2.uint32()));break;case 2:o2.fullyDecodeReservedExpansion=e2.bool();break;default:e2.skipType(7&r2)}}return o2},g.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},g.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.rules!=null&&e2.hasOwnProperty("rules")){if(!Array.isArray(e2.rules))return"rules: array expected";for(var t2=0;t2>>3){case 1:o2.selector=e2.string();break;case 2:o2.get=e2.string();break;case 3:o2.put=e2.string();break;case 4:o2.post=e2.string();break;case 5:o2.delete=e2.string();break;case 6:o2.patch=e2.string();break;case 8:o2.custom=p.google.api.CustomHttpPattern.decode(e2,e2.uint32());break;case 7:o2.body=e2.string();break;case 12:o2.responseBody=e2.string();break;case 11:o2.additionalBindings&&o2.additionalBindings.length||(o2.additionalBindings=[]),o2.additionalBindings.push(p.google.api.HttpRule.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},f.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},f.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";var t2={};if(e2.selector!=null&&e2.hasOwnProperty("selector")&&!i.isString(e2.selector))return"selector: string expected";if(e2.get!=null&&e2.hasOwnProperty("get")&&(t2.pattern=1,!i.isString(e2.get)))return"get: string expected";if(e2.put!=null&&e2.hasOwnProperty("put")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,!i.isString(e2.put))return"put: string expected"}if(e2.post!=null&&e2.hasOwnProperty("post")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,!i.isString(e2.post))return"post: string expected"}if(e2.delete!=null&&e2.hasOwnProperty("delete")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,!i.isString(e2.delete))return"delete: string expected"}if(e2.patch!=null&&e2.hasOwnProperty("patch")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,!i.isString(e2.patch))return"patch: string expected"}if(e2.custom!=null&&e2.hasOwnProperty("custom")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,n2=p.google.api.CustomHttpPattern.verify(e2.custom))return"custom."+n2}if(e2.body!=null&&e2.hasOwnProperty("body")&&!i.isString(e2.body))return"body: string expected";if(e2.responseBody!=null&&e2.hasOwnProperty("responseBody")&&!i.isString(e2.responseBody))return"responseBody: string expected";if(e2.additionalBindings!=null&&e2.hasOwnProperty("additionalBindings")){if(!Array.isArray(e2.additionalBindings))return"additionalBindings: array expected";for(var n2,o2=0;o2>>3){case 1:o2.kind=e2.string();break;case 2:o2.path=e2.string();break;default:e2.skipType(7&r2)}}return o2},y.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},y.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.kind!=null&&e2.hasOwnProperty("kind")&&!i.isString(e2.kind)?"kind: string expected":e2.path!=null&&e2.hasOwnProperty("path")&&!i.isString(e2.path)?"path: string expected":null},y.fromObject=function(e2){var t2;return e2 instanceof p.google.api.CustomHttpPattern?e2:(t2=new p.google.api.CustomHttpPattern,e2.kind!=null&&(t2.kind=String(e2.kind)),e2.path!=null&&(t2.path=String(e2.path)),t2)},y.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.kind="",n2.path=""),e2.kind!=null&&e2.hasOwnProperty("kind")&&(n2.kind=e2.kind),e2.path!=null&&e2.hasOwnProperty("path")&&(n2.path=e2.path),n2},y.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},y),n),F.protobuf=((t={}).FileDescriptorSet=(J.prototype.file=i.emptyArray,J.create=function(e2){return new J(e2)},J.encode=function(e2,t2){if(t2=t2||r.create(),e2.file!=null&&e2.file.length)for(var n2=0;n2>>3==1?(o2.file&&o2.file.length||(o2.file=[]),o2.file.push(p.google.protobuf.FileDescriptorProto.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},J.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},J.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.file!=null&&e2.hasOwnProperty("file")){if(!Array.isArray(e2.file))return"file: array expected";for(var t2=0;t2>>3){case 1:o2.name=e2.string();break;case 2:o2.package=e2.string();break;case 3:o2.dependency&&o2.dependency.length||(o2.dependency=[]),o2.dependency.push(e2.string());break;case 10:if(o2.publicDependency&&o2.publicDependency.length||(o2.publicDependency=[]),(7&r2)==2)for(var i2=e2.uint32()+e2.pos;e2.pos>>3){case 1:o2.name=e2.string();break;case 2:o2.field&&o2.field.length||(o2.field=[]),o2.field.push(p.google.protobuf.FieldDescriptorProto.decode(e2,e2.uint32()));break;case 6:o2.extension&&o2.extension.length||(o2.extension=[]),o2.extension.push(p.google.protobuf.FieldDescriptorProto.decode(e2,e2.uint32()));break;case 3:o2.nestedType&&o2.nestedType.length||(o2.nestedType=[]),o2.nestedType.push(p.google.protobuf.DescriptorProto.decode(e2,e2.uint32()));break;case 4:o2.enumType&&o2.enumType.length||(o2.enumType=[]),o2.enumType.push(p.google.protobuf.EnumDescriptorProto.decode(e2,e2.uint32()));break;case 5:o2.extensionRange&&o2.extensionRange.length||(o2.extensionRange=[]),o2.extensionRange.push(p.google.protobuf.DescriptorProto.ExtensionRange.decode(e2,e2.uint32()));break;case 8:o2.oneofDecl&&o2.oneofDecl.length||(o2.oneofDecl=[]),o2.oneofDecl.push(p.google.protobuf.OneofDescriptorProto.decode(e2,e2.uint32()));break;case 7:o2.options=p.google.protobuf.MessageOptions.decode(e2,e2.uint32());break;case 9:o2.reservedRange&&o2.reservedRange.length||(o2.reservedRange=[]),o2.reservedRange.push(p.google.protobuf.DescriptorProto.ReservedRange.decode(e2,e2.uint32()));break;case 10:o2.reservedName&&o2.reservedName.length||(o2.reservedName=[]),o2.reservedName.push(e2.string());break;default:e2.skipType(7&r2)}}return o2},O.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},O.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name))return"name: string expected";if(e2.field!=null&&e2.hasOwnProperty("field")){if(!Array.isArray(e2.field))return"field: array expected";for(var t2=0;t2>>3){case 1:o2.start=e2.int32();break;case 2:o2.end=e2.int32();break;case 3:o2.options=p.google.protobuf.ExtensionRangeOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},b.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},b.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.start!=null&&e2.hasOwnProperty("start")&&!i.isInteger(e2.start)?"start: integer expected":e2.end!=null&&e2.hasOwnProperty("end")&&!i.isInteger(e2.end)?"end: integer expected":e2.options!=null&&e2.hasOwnProperty("options")&&(e2=p.google.protobuf.ExtensionRangeOptions.verify(e2.options),e2)?"options."+e2:null},b.fromObject=function(e2){if(e2 instanceof p.google.protobuf.DescriptorProto.ExtensionRange)return e2;var t2=new p.google.protobuf.DescriptorProto.ExtensionRange;if(e2.start!=null&&(t2.start=0|e2.start),e2.end!=null&&(t2.end=0|e2.end),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected");t2.options=p.google.protobuf.ExtensionRangeOptions.fromObject(e2.options)}return t2},b.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.start=0,n2.end=0,n2.options=null),e2.start!=null&&e2.hasOwnProperty("start")&&(n2.start=e2.start),e2.end!=null&&e2.hasOwnProperty("end")&&(n2.end=e2.end),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=p.google.protobuf.ExtensionRangeOptions.toObject(e2.options,t2)),n2},b.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},b),O.ReservedRange=(m.prototype.start=0,m.prototype.end=0,m.create=function(e2){return new m(e2)},m.encode=function(e2,t2){return t2=t2||r.create(),e2.start!=null&&Object.hasOwnProperty.call(e2,"start")&&t2.uint32(8).int32(e2.start),e2.end!=null&&Object.hasOwnProperty.call(e2,"end")&&t2.uint32(16).int32(e2.end),t2},m.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},m.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new p.google.protobuf.DescriptorProto.ReservedRange;e2.pos>>3){case 1:o2.start=e2.int32();break;case 2:o2.end=e2.int32();break;default:e2.skipType(7&r2)}}return o2},m.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},m.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.start!=null&&e2.hasOwnProperty("start")&&!i.isInteger(e2.start)?"start: integer expected":e2.end!=null&&e2.hasOwnProperty("end")&&!i.isInteger(e2.end)?"end: integer expected":null},m.fromObject=function(e2){var t2;return e2 instanceof p.google.protobuf.DescriptorProto.ReservedRange?e2:(t2=new p.google.protobuf.DescriptorProto.ReservedRange,e2.start!=null&&(t2.start=0|e2.start),e2.end!=null&&(t2.end=0|e2.end),t2)},m.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.start=0,n2.end=0),e2.start!=null&&e2.hasOwnProperty("start")&&(n2.start=e2.start),e2.end!=null&&e2.hasOwnProperty("end")&&(n2.end=e2.end),n2},m.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},m),O),t.ExtensionRangeOptions=(M.prototype.uninterpretedOption=i.emptyArray,M.create=function(e2){return new M(e2)},M.encode=function(e2,t2){if(t2=t2||r.create(),e2.uninterpretedOption!=null&&e2.uninterpretedOption.length)for(var n2=0;n2>>3==999?(o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},M.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},M.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 1:o2.name=e2.string();break;case 3:o2.number=e2.int32();break;case 4:o2.label=e2.int32();break;case 5:o2.type=e2.int32();break;case 6:o2.typeName=e2.string();break;case 2:o2.extendee=e2.string();break;case 7:o2.defaultValue=e2.string();break;case 9:o2.oneofIndex=e2.int32();break;case 10:o2.jsonName=e2.string();break;case 8:o2.options=p.google.protobuf.FieldOptions.decode(e2,e2.uint32());break;case 17:o2.proto3Optional=e2.bool();break;default:e2.skipType(7&r2)}}return o2},v.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},v.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name))return"name: string expected";if(e2.number!=null&&e2.hasOwnProperty("number")&&!i.isInteger(e2.number))return"number: integer expected";if(e2.label!=null&&e2.hasOwnProperty("label"))switch(e2.label){default:return"label: enum value expected";case 1:case 2:case 3:}if(e2.type!=null&&e2.hasOwnProperty("type"))switch(e2.type){default:return"type: enum value expected";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:}if(e2.typeName!=null&&e2.hasOwnProperty("typeName")&&!i.isString(e2.typeName))return"typeName: string expected";if(e2.extendee!=null&&e2.hasOwnProperty("extendee")&&!i.isString(e2.extendee))return"extendee: string expected";if(e2.defaultValue!=null&&e2.hasOwnProperty("defaultValue")&&!i.isString(e2.defaultValue))return"defaultValue: string expected";if(e2.oneofIndex!=null&&e2.hasOwnProperty("oneofIndex")&&!i.isInteger(e2.oneofIndex))return"oneofIndex: integer expected";if(e2.jsonName!=null&&e2.hasOwnProperty("jsonName")&&!i.isString(e2.jsonName))return"jsonName: string expected";if(e2.options!=null&&e2.hasOwnProperty("options")){var t2=p.google.protobuf.FieldOptions.verify(e2.options);if(t2)return"options."+t2}return e2.proto3Optional!=null&&e2.hasOwnProperty("proto3Optional")&&typeof e2.proto3Optional!="boolean"?"proto3Optional: boolean expected":null},v.fromObject=function(e2){if(e2 instanceof p.google.protobuf.FieldDescriptorProto)return e2;var t2=new p.google.protobuf.FieldDescriptorProto;switch(e2.name!=null&&(t2.name=String(e2.name)),e2.number!=null&&(t2.number=0|e2.number),e2.label){case"LABEL_OPTIONAL":case 1:t2.label=1;break;case"LABEL_REQUIRED":case 2:t2.label=2;break;case"LABEL_REPEATED":case 3:t2.label=3}switch(e2.type){case"TYPE_DOUBLE":case 1:t2.type=1;break;case"TYPE_FLOAT":case 2:t2.type=2;break;case"TYPE_INT64":case 3:t2.type=3;break;case"TYPE_UINT64":case 4:t2.type=4;break;case"TYPE_INT32":case 5:t2.type=5;break;case"TYPE_FIXED64":case 6:t2.type=6;break;case"TYPE_FIXED32":case 7:t2.type=7;break;case"TYPE_BOOL":case 8:t2.type=8;break;case"TYPE_STRING":case 9:t2.type=9;break;case"TYPE_GROUP":case 10:t2.type=10;break;case"TYPE_MESSAGE":case 11:t2.type=11;break;case"TYPE_BYTES":case 12:t2.type=12;break;case"TYPE_UINT32":case 13:t2.type=13;break;case"TYPE_ENUM":case 14:t2.type=14;break;case"TYPE_SFIXED32":case 15:t2.type=15;break;case"TYPE_SFIXED64":case 16:t2.type=16;break;case"TYPE_SINT32":case 17:t2.type=17;break;case"TYPE_SINT64":case 18:t2.type=18}if(e2.typeName!=null&&(t2.typeName=String(e2.typeName)),e2.extendee!=null&&(t2.extendee=String(e2.extendee)),e2.defaultValue!=null&&(t2.defaultValue=String(e2.defaultValue)),e2.oneofIndex!=null&&(t2.oneofIndex=0|e2.oneofIndex),e2.jsonName!=null&&(t2.jsonName=String(e2.jsonName)),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected");t2.options=p.google.protobuf.FieldOptions.fromObject(e2.options)}return e2.proto3Optional!=null&&(t2.proto3Optional=!!e2.proto3Optional),t2},v.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.extendee="",n2.number=0,n2.label=t2.enums===String?"LABEL_OPTIONAL":1,n2.type=t2.enums===String?"TYPE_DOUBLE":1,n2.typeName="",n2.defaultValue="",n2.options=null,n2.oneofIndex=0,n2.jsonName="",n2.proto3Optional=!1),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.extendee!=null&&e2.hasOwnProperty("extendee")&&(n2.extendee=e2.extendee),e2.number!=null&&e2.hasOwnProperty("number")&&(n2.number=e2.number),e2.label!=null&&e2.hasOwnProperty("label")&&(n2.label=t2.enums===String?p.google.protobuf.FieldDescriptorProto.Label[e2.label]:e2.label),e2.type!=null&&e2.hasOwnProperty("type")&&(n2.type=t2.enums===String?p.google.protobuf.FieldDescriptorProto.Type[e2.type]:e2.type),e2.typeName!=null&&e2.hasOwnProperty("typeName")&&(n2.typeName=e2.typeName),e2.defaultValue!=null&&e2.hasOwnProperty("defaultValue")&&(n2.defaultValue=e2.defaultValue),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=p.google.protobuf.FieldOptions.toObject(e2.options,t2)),e2.oneofIndex!=null&&e2.hasOwnProperty("oneofIndex")&&(n2.oneofIndex=e2.oneofIndex),e2.jsonName!=null&&e2.hasOwnProperty("jsonName")&&(n2.jsonName=e2.jsonName),e2.proto3Optional!=null&&e2.hasOwnProperty("proto3Optional")&&(n2.proto3Optional=e2.proto3Optional),n2},v.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},v.Type=(n={},(e=Object.create(n))[n[1]="TYPE_DOUBLE"]=1,e[n[2]="TYPE_FLOAT"]=2,e[n[3]="TYPE_INT64"]=3,e[n[4]="TYPE_UINT64"]=4,e[n[5]="TYPE_INT32"]=5,e[n[6]="TYPE_FIXED64"]=6,e[n[7]="TYPE_FIXED32"]=7,e[n[8]="TYPE_BOOL"]=8,e[n[9]="TYPE_STRING"]=9,e[n[10]="TYPE_GROUP"]=10,e[n[11]="TYPE_MESSAGE"]=11,e[n[12]="TYPE_BYTES"]=12,e[n[13]="TYPE_UINT32"]=13,e[n[14]="TYPE_ENUM"]=14,e[n[15]="TYPE_SFIXED32"]=15,e[n[16]="TYPE_SFIXED64"]=16,e[n[17]="TYPE_SINT32"]=17,e[n[18]="TYPE_SINT64"]=18,e),v.Label=(n={},(e=Object.create(n))[n[1]="LABEL_OPTIONAL"]=1,e[n[2]="LABEL_REQUIRED"]=2,e[n[3]="LABEL_REPEATED"]=3,e),v),t.OneofDescriptorProto=(w.prototype.name="",w.prototype.options=null,w.create=function(e2){return new w(e2)},w.encode=function(e2,t2){return t2=t2||r.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.options!=null&&Object.hasOwnProperty.call(e2,"options")&&p.google.protobuf.OneofOptions.encode(e2.options,t2.uint32(18).fork()).ldelim(),t2},w.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},w.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new p.google.protobuf.OneofDescriptorProto;e2.pos>>3){case 1:o2.name=e2.string();break;case 2:o2.options=p.google.protobuf.OneofOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},w.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},w.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name)?"name: string expected":e2.options!=null&&e2.hasOwnProperty("options")&&(e2=p.google.protobuf.OneofOptions.verify(e2.options),e2)?"options."+e2:null},w.fromObject=function(e2){if(e2 instanceof p.google.protobuf.OneofDescriptorProto)return e2;var t2=new p.google.protobuf.OneofDescriptorProto;if(e2.name!=null&&(t2.name=String(e2.name)),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected");t2.options=p.google.protobuf.OneofOptions.fromObject(e2.options)}return t2},w.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.options=null),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=p.google.protobuf.OneofOptions.toObject(e2.options,t2)),n2},w.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},w),t.EnumDescriptorProto=(P.prototype.name="",P.prototype.value=i.emptyArray,P.prototype.options=null,P.prototype.reservedRange=i.emptyArray,P.prototype.reservedName=i.emptyArray,P.create=function(e2){return new P(e2)},P.encode=function(e2,t2){if(t2=t2||r.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.value!=null&&e2.value.length)for(var n2=0;n2>>3){case 1:o2.name=e2.string();break;case 2:o2.value&&o2.value.length||(o2.value=[]),o2.value.push(p.google.protobuf.EnumValueDescriptorProto.decode(e2,e2.uint32()));break;case 3:o2.options=p.google.protobuf.EnumOptions.decode(e2,e2.uint32());break;case 4:o2.reservedRange&&o2.reservedRange.length||(o2.reservedRange=[]),o2.reservedRange.push(p.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(e2,e2.uint32()));break;case 5:o2.reservedName&&o2.reservedName.length||(o2.reservedName=[]),o2.reservedName.push(e2.string());break;default:e2.skipType(7&r2)}}return o2},P.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},P.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name))return"name: string expected";if(e2.value!=null&&e2.hasOwnProperty("value")){if(!Array.isArray(e2.value))return"value: array expected";for(var t2=0;t2>>3){case 1:o2.start=e2.int32();break;case 2:o2.end=e2.int32();break;default:e2.skipType(7&r2)}}return o2},_.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},_.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.start!=null&&e2.hasOwnProperty("start")&&!i.isInteger(e2.start)?"start: integer expected":e2.end!=null&&e2.hasOwnProperty("end")&&!i.isInteger(e2.end)?"end: integer expected":null},_.fromObject=function(e2){var t2;return e2 instanceof p.google.protobuf.EnumDescriptorProto.EnumReservedRange?e2:(t2=new p.google.protobuf.EnumDescriptorProto.EnumReservedRange,e2.start!=null&&(t2.start=0|e2.start),e2.end!=null&&(t2.end=0|e2.end),t2)},_.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.start=0,n2.end=0),e2.start!=null&&e2.hasOwnProperty("start")&&(n2.start=e2.start),e2.end!=null&&e2.hasOwnProperty("end")&&(n2.end=e2.end),n2},_.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},_),P),t.EnumValueDescriptorProto=(j.prototype.name="",j.prototype.number=0,j.prototype.options=null,j.create=function(e2){return new j(e2)},j.encode=function(e2,t2){return t2=t2||r.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.number!=null&&Object.hasOwnProperty.call(e2,"number")&&t2.uint32(16).int32(e2.number),e2.options!=null&&Object.hasOwnProperty.call(e2,"options")&&p.google.protobuf.EnumValueOptions.encode(e2.options,t2.uint32(26).fork()).ldelim(),t2},j.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},j.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new p.google.protobuf.EnumValueDescriptorProto;e2.pos>>3){case 1:o2.name=e2.string();break;case 2:o2.number=e2.int32();break;case 3:o2.options=p.google.protobuf.EnumValueOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},j.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},j.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name)?"name: string expected":e2.number!=null&&e2.hasOwnProperty("number")&&!i.isInteger(e2.number)?"number: integer expected":e2.options!=null&&e2.hasOwnProperty("options")&&(e2=p.google.protobuf.EnumValueOptions.verify(e2.options),e2)?"options."+e2:null},j.fromObject=function(e2){if(e2 instanceof p.google.protobuf.EnumValueDescriptorProto)return e2;var t2=new p.google.protobuf.EnumValueDescriptorProto;if(e2.name!=null&&(t2.name=String(e2.name)),e2.number!=null&&(t2.number=0|e2.number),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected");t2.options=p.google.protobuf.EnumValueOptions.fromObject(e2.options)}return t2},j.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.number=0,n2.options=null),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.number!=null&&e2.hasOwnProperty("number")&&(n2.number=e2.number),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=p.google.protobuf.EnumValueOptions.toObject(e2.options,t2)),n2},j.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},j),t.ServiceDescriptorProto=(S.prototype.name="",S.prototype.method=i.emptyArray,S.prototype.options=null,S.create=function(e2){return new S(e2)},S.encode=function(e2,t2){if(t2=t2||r.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.method!=null&&e2.method.length)for(var n2=0;n2>>3){case 1:o2.name=e2.string();break;case 2:o2.method&&o2.method.length||(o2.method=[]),o2.method.push(p.google.protobuf.MethodDescriptorProto.decode(e2,e2.uint32()));break;case 3:o2.options=p.google.protobuf.ServiceOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},S.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},S.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name))return"name: string expected";if(e2.method!=null&&e2.hasOwnProperty("method")){if(!Array.isArray(e2.method))return"method: array expected";for(var t2=0;t2>>3){case 1:o2.name=e2.string();break;case 2:o2.inputType=e2.string();break;case 3:o2.outputType=e2.string();break;case 4:o2.options=p.google.protobuf.MethodOptions.decode(e2,e2.uint32());break;case 5:o2.clientStreaming=e2.bool();break;case 6:o2.serverStreaming=e2.bool();break;default:e2.skipType(7&r2)}}return o2},x.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},x.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!i.isString(e2.name))return"name: string expected";if(e2.inputType!=null&&e2.hasOwnProperty("inputType")&&!i.isString(e2.inputType))return"inputType: string expected";if(e2.outputType!=null&&e2.hasOwnProperty("outputType")&&!i.isString(e2.outputType))return"outputType: string expected";if(e2.options!=null&&e2.hasOwnProperty("options")){var t2=p.google.protobuf.MethodOptions.verify(e2.options);if(t2)return"options."+t2}return e2.clientStreaming!=null&&e2.hasOwnProperty("clientStreaming")&&typeof e2.clientStreaming!="boolean"?"clientStreaming: boolean expected":e2.serverStreaming!=null&&e2.hasOwnProperty("serverStreaming")&&typeof e2.serverStreaming!="boolean"?"serverStreaming: boolean expected":null},x.fromObject=function(e2){if(e2 instanceof p.google.protobuf.MethodDescriptorProto)return e2;var t2=new p.google.protobuf.MethodDescriptorProto;if(e2.name!=null&&(t2.name=String(e2.name)),e2.inputType!=null&&(t2.inputType=String(e2.inputType)),e2.outputType!=null&&(t2.outputType=String(e2.outputType)),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected");t2.options=p.google.protobuf.MethodOptions.fromObject(e2.options)}return e2.clientStreaming!=null&&(t2.clientStreaming=!!e2.clientStreaming),e2.serverStreaming!=null&&(t2.serverStreaming=!!e2.serverStreaming),t2},x.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.inputType="",n2.outputType="",n2.options=null,n2.clientStreaming=!1,n2.serverStreaming=!1),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.inputType!=null&&e2.hasOwnProperty("inputType")&&(n2.inputType=e2.inputType),e2.outputType!=null&&e2.hasOwnProperty("outputType")&&(n2.outputType=e2.outputType),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=p.google.protobuf.MethodOptions.toObject(e2.options,t2)),e2.clientStreaming!=null&&e2.hasOwnProperty("clientStreaming")&&(n2.clientStreaming=e2.clientStreaming),e2.serverStreaming!=null&&e2.hasOwnProperty("serverStreaming")&&(n2.serverStreaming=e2.serverStreaming),n2},x.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},x),t.FileOptions=(k.prototype.javaPackage="",k.prototype.javaOuterClassname="",k.prototype.javaMultipleFiles=!1,k.prototype.javaGenerateEqualsAndHash=!1,k.prototype.javaStringCheckUtf8=!1,k.prototype.optimizeFor=1,k.prototype.goPackage="",k.prototype.ccGenericServices=!1,k.prototype.javaGenericServices=!1,k.prototype.pyGenericServices=!1,k.prototype.phpGenericServices=!1,k.prototype.deprecated=!1,k.prototype.ccEnableArenas=!0,k.prototype.objcClassPrefix="",k.prototype.csharpNamespace="",k.prototype.swiftPrefix="",k.prototype.phpClassPrefix="",k.prototype.phpNamespace="",k.prototype.phpMetadataNamespace="",k.prototype.rubyPackage="",k.prototype.uninterpretedOption=i.emptyArray,k.create=function(e2){return new k(e2)},k.encode=function(e2,t2){if(t2=t2||r.create(),e2.javaPackage!=null&&Object.hasOwnProperty.call(e2,"javaPackage")&&t2.uint32(10).string(e2.javaPackage),e2.javaOuterClassname!=null&&Object.hasOwnProperty.call(e2,"javaOuterClassname")&&t2.uint32(66).string(e2.javaOuterClassname),e2.optimizeFor!=null&&Object.hasOwnProperty.call(e2,"optimizeFor")&&t2.uint32(72).int32(e2.optimizeFor),e2.javaMultipleFiles!=null&&Object.hasOwnProperty.call(e2,"javaMultipleFiles")&&t2.uint32(80).bool(e2.javaMultipleFiles),e2.goPackage!=null&&Object.hasOwnProperty.call(e2,"goPackage")&&t2.uint32(90).string(e2.goPackage),e2.ccGenericServices!=null&&Object.hasOwnProperty.call(e2,"ccGenericServices")&&t2.uint32(128).bool(e2.ccGenericServices),e2.javaGenericServices!=null&&Object.hasOwnProperty.call(e2,"javaGenericServices")&&t2.uint32(136).bool(e2.javaGenericServices),e2.pyGenericServices!=null&&Object.hasOwnProperty.call(e2,"pyGenericServices")&&t2.uint32(144).bool(e2.pyGenericServices),e2.javaGenerateEqualsAndHash!=null&&Object.hasOwnProperty.call(e2,"javaGenerateEqualsAndHash")&&t2.uint32(160).bool(e2.javaGenerateEqualsAndHash),e2.deprecated!=null&&Object.hasOwnProperty.call(e2,"deprecated")&&t2.uint32(184).bool(e2.deprecated),e2.javaStringCheckUtf8!=null&&Object.hasOwnProperty.call(e2,"javaStringCheckUtf8")&&t2.uint32(216).bool(e2.javaStringCheckUtf8),e2.ccEnableArenas!=null&&Object.hasOwnProperty.call(e2,"ccEnableArenas")&&t2.uint32(248).bool(e2.ccEnableArenas),e2.objcClassPrefix!=null&&Object.hasOwnProperty.call(e2,"objcClassPrefix")&&t2.uint32(290).string(e2.objcClassPrefix),e2.csharpNamespace!=null&&Object.hasOwnProperty.call(e2,"csharpNamespace")&&t2.uint32(298).string(e2.csharpNamespace),e2.swiftPrefix!=null&&Object.hasOwnProperty.call(e2,"swiftPrefix")&&t2.uint32(314).string(e2.swiftPrefix),e2.phpClassPrefix!=null&&Object.hasOwnProperty.call(e2,"phpClassPrefix")&&t2.uint32(322).string(e2.phpClassPrefix),e2.phpNamespace!=null&&Object.hasOwnProperty.call(e2,"phpNamespace")&&t2.uint32(330).string(e2.phpNamespace),e2.phpGenericServices!=null&&Object.hasOwnProperty.call(e2,"phpGenericServices")&&t2.uint32(336).bool(e2.phpGenericServices),e2.phpMetadataNamespace!=null&&Object.hasOwnProperty.call(e2,"phpMetadataNamespace")&&t2.uint32(354).string(e2.phpMetadataNamespace),e2.rubyPackage!=null&&Object.hasOwnProperty.call(e2,"rubyPackage")&&t2.uint32(362).string(e2.rubyPackage),e2.uninterpretedOption!=null&&e2.uninterpretedOption.length)for(var n2=0;n2>>3){case 1:o2.javaPackage=e2.string();break;case 8:o2.javaOuterClassname=e2.string();break;case 10:o2.javaMultipleFiles=e2.bool();break;case 20:o2.javaGenerateEqualsAndHash=e2.bool();break;case 27:o2.javaStringCheckUtf8=e2.bool();break;case 9:o2.optimizeFor=e2.int32();break;case 11:o2.goPackage=e2.string();break;case 16:o2.ccGenericServices=e2.bool();break;case 17:o2.javaGenericServices=e2.bool();break;case 18:o2.pyGenericServices=e2.bool();break;case 42:o2.phpGenericServices=e2.bool();break;case 23:o2.deprecated=e2.bool();break;case 31:o2.ccEnableArenas=e2.bool();break;case 36:o2.objcClassPrefix=e2.string();break;case 37:o2.csharpNamespace=e2.string();break;case 39:o2.swiftPrefix=e2.string();break;case 40:o2.phpClassPrefix=e2.string();break;case 41:o2.phpNamespace=e2.string();break;case 44:o2.phpMetadataNamespace=e2.string();break;case 45:o2.rubyPackage=e2.string();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},k.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},k.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.javaPackage!=null&&e2.hasOwnProperty("javaPackage")&&!i.isString(e2.javaPackage))return"javaPackage: string expected";if(e2.javaOuterClassname!=null&&e2.hasOwnProperty("javaOuterClassname")&&!i.isString(e2.javaOuterClassname))return"javaOuterClassname: string expected";if(e2.javaMultipleFiles!=null&&e2.hasOwnProperty("javaMultipleFiles")&&typeof e2.javaMultipleFiles!="boolean")return"javaMultipleFiles: boolean expected";if(e2.javaGenerateEqualsAndHash!=null&&e2.hasOwnProperty("javaGenerateEqualsAndHash")&&typeof e2.javaGenerateEqualsAndHash!="boolean")return"javaGenerateEqualsAndHash: boolean expected";if(e2.javaStringCheckUtf8!=null&&e2.hasOwnProperty("javaStringCheckUtf8")&&typeof e2.javaStringCheckUtf8!="boolean")return"javaStringCheckUtf8: boolean expected";if(e2.optimizeFor!=null&&e2.hasOwnProperty("optimizeFor"))switch(e2.optimizeFor){default:return"optimizeFor: enum value expected";case 1:case 2:case 3:}if(e2.goPackage!=null&&e2.hasOwnProperty("goPackage")&&!i.isString(e2.goPackage))return"goPackage: string expected";if(e2.ccGenericServices!=null&&e2.hasOwnProperty("ccGenericServices")&&typeof e2.ccGenericServices!="boolean")return"ccGenericServices: boolean expected";if(e2.javaGenericServices!=null&&e2.hasOwnProperty("javaGenericServices")&&typeof e2.javaGenericServices!="boolean")return"javaGenericServices: boolean expected";if(e2.pyGenericServices!=null&&e2.hasOwnProperty("pyGenericServices")&&typeof e2.pyGenericServices!="boolean")return"pyGenericServices: boolean expected";if(e2.phpGenericServices!=null&&e2.hasOwnProperty("phpGenericServices")&&typeof e2.phpGenericServices!="boolean")return"phpGenericServices: boolean expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.ccEnableArenas!=null&&e2.hasOwnProperty("ccEnableArenas")&&typeof e2.ccEnableArenas!="boolean")return"ccEnableArenas: boolean expected";if(e2.objcClassPrefix!=null&&e2.hasOwnProperty("objcClassPrefix")&&!i.isString(e2.objcClassPrefix))return"objcClassPrefix: string expected";if(e2.csharpNamespace!=null&&e2.hasOwnProperty("csharpNamespace")&&!i.isString(e2.csharpNamespace))return"csharpNamespace: string expected";if(e2.swiftPrefix!=null&&e2.hasOwnProperty("swiftPrefix")&&!i.isString(e2.swiftPrefix))return"swiftPrefix: string expected";if(e2.phpClassPrefix!=null&&e2.hasOwnProperty("phpClassPrefix")&&!i.isString(e2.phpClassPrefix))return"phpClassPrefix: string expected";if(e2.phpNamespace!=null&&e2.hasOwnProperty("phpNamespace")&&!i.isString(e2.phpNamespace))return"phpNamespace: string expected";if(e2.phpMetadataNamespace!=null&&e2.hasOwnProperty("phpMetadataNamespace")&&!i.isString(e2.phpMetadataNamespace))return"phpMetadataNamespace: string expected";if(e2.rubyPackage!=null&&e2.hasOwnProperty("rubyPackage")&&!i.isString(e2.rubyPackage))return"rubyPackage: string expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 1:o2.messageSetWireFormat=e2.bool();break;case 2:o2.noStandardDescriptorAccessor=e2.bool();break;case 3:o2.deprecated=e2.bool();break;case 7:o2.mapEntry=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},D.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},D.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.messageSetWireFormat!=null&&e2.hasOwnProperty("messageSetWireFormat")&&typeof e2.messageSetWireFormat!="boolean")return"messageSetWireFormat: boolean expected";if(e2.noStandardDescriptorAccessor!=null&&e2.hasOwnProperty("noStandardDescriptorAccessor")&&typeof e2.noStandardDescriptorAccessor!="boolean")return"noStandardDescriptorAccessor: boolean expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.mapEntry!=null&&e2.hasOwnProperty("mapEntry")&&typeof e2.mapEntry!="boolean")return"mapEntry: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 1:o2.ctype=e2.int32();break;case 2:o2.packed=e2.bool();break;case 6:o2.jstype=e2.int32();break;case 5:o2.lazy=e2.bool();break;case 3:o2.deprecated=e2.bool();break;case 10:o2.weak=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},T.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},T.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.ctype!=null&&e2.hasOwnProperty("ctype"))switch(e2.ctype){default:return"ctype: enum value expected";case 0:case 1:case 2:}if(e2.packed!=null&&e2.hasOwnProperty("packed")&&typeof e2.packed!="boolean")return"packed: boolean expected";if(e2.jstype!=null&&e2.hasOwnProperty("jstype"))switch(e2.jstype){default:return"jstype: enum value expected";case 0:case 1:case 2:}if(e2.lazy!=null&&e2.hasOwnProperty("lazy")&&typeof e2.lazy!="boolean")return"lazy: boolean expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.weak!=null&&e2.hasOwnProperty("weak")&&typeof e2.weak!="boolean")return"weak: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3==999?(o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},H.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},H.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 2:o2.allowAlias=e2.bool();break;case 3:o2.deprecated=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},E.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},E.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.allowAlias!=null&&e2.hasOwnProperty("allowAlias")&&typeof e2.allowAlias!="boolean")return"allowAlias: boolean expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 1:o2.deprecated=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},z.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},z.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 33:o2.deprecated=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;case 1049:o2[".google.api.defaultHost"]=e2.string();break;case 1050:o2[".google.api.oauthScopes"]=e2.string();break;default:e2.skipType(7&r2)}}return o2},A.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},A.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 33:o2.deprecated=e2.bool();break;case 34:o2.idempotencyLevel=e2.int32();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;case 1049:o2[".google.longrunning.operationInfo"]=p.google.longrunning.OperationInfo.decode(e2,e2.uint32());break;case 72295728:o2[".google.api.http"]=p.google.api.HttpRule.decode(e2,e2.uint32());break;case 1051:o2[".google.api.methodSignature"]&&o2[".google.api.methodSignature"].length||(o2[".google.api.methodSignature"]=[]),o2[".google.api.methodSignature"].push(e2.string());break;default:e2.skipType(7&r2)}}return o2},N.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},N.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.idempotencyLevel!=null&&e2.hasOwnProperty("idempotencyLevel"))switch(e2.idempotencyLevel){default:return"idempotencyLevel: enum value expected";case 0:case 1:case 2:}if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 2:o2.name&&o2.name.length||(o2.name=[]),o2.name.push(p.google.protobuf.UninterpretedOption.NamePart.decode(e2,e2.uint32()));break;case 3:o2.identifierValue=e2.string();break;case 4:o2.positiveIntValue=e2.uint64();break;case 5:o2.negativeIntValue=e2.int64();break;case 6:o2.doubleValue=e2.double();break;case 7:o2.stringValue=e2.bytes();break;case 8:o2.aggregateValue=e2.string();break;default:e2.skipType(7&r2)}}return o2},I.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},I.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")){if(!Array.isArray(e2.name))return"name: array expected";for(var t2=0;t2>>0,e2.positiveIntValue.high>>>0).toNumber(!0))),e2.negativeIntValue!=null&&(i.Long?(t2.negativeIntValue=i.Long.fromValue(e2.negativeIntValue)).unsigned=!1:typeof e2.negativeIntValue=="string"?t2.negativeIntValue=parseInt(e2.negativeIntValue,10):typeof e2.negativeIntValue=="number"?t2.negativeIntValue=e2.negativeIntValue:typeof e2.negativeIntValue=="object"&&(t2.negativeIntValue=new i.LongBits(e2.negativeIntValue.low>>>0,e2.negativeIntValue.high>>>0).toNumber())),e2.doubleValue!=null&&(t2.doubleValue=Number(e2.doubleValue)),e2.stringValue!=null&&(typeof e2.stringValue=="string"?i.base64.decode(e2.stringValue,t2.stringValue=i.newBuffer(i.base64.length(e2.stringValue)),0):e2.stringValue.length&&(t2.stringValue=e2.stringValue)),e2.aggregateValue!=null&&(t2.aggregateValue=String(e2.aggregateValue)),t2},I.toObject=function(e2,t2){var n2,o2={};if(((t2=t2||{}).arrays||t2.defaults)&&(o2.name=[]),t2.defaults&&(o2.identifierValue="",i.Long?(n2=new i.Long(0,0,!0),o2.positiveIntValue=t2.longs===String?n2.toString():t2.longs===Number?n2.toNumber():n2):o2.positiveIntValue=t2.longs===String?"0":0,i.Long?(n2=new i.Long(0,0,!1),o2.negativeIntValue=t2.longs===String?n2.toString():t2.longs===Number?n2.toNumber():n2):o2.negativeIntValue=t2.longs===String?"0":0,o2.doubleValue=0,t2.bytes===String?o2.stringValue="":(o2.stringValue=[],t2.bytes!==Array&&(o2.stringValue=i.newBuffer(o2.stringValue))),o2.aggregateValue=""),e2.name&&e2.name.length){o2.name=[];for(var r2=0;r2>>0,e2.positiveIntValue.high>>>0).toNumber(!0):e2.positiveIntValue),e2.negativeIntValue!=null&&e2.hasOwnProperty("negativeIntValue")&&(typeof e2.negativeIntValue=="number"?o2.negativeIntValue=t2.longs===String?String(e2.negativeIntValue):e2.negativeIntValue:o2.negativeIntValue=t2.longs===String?i.Long.prototype.toString.call(e2.negativeIntValue):t2.longs===Number?new i.LongBits(e2.negativeIntValue.low>>>0,e2.negativeIntValue.high>>>0).toNumber():e2.negativeIntValue),e2.doubleValue!=null&&e2.hasOwnProperty("doubleValue")&&(o2.doubleValue=t2.json&&!isFinite(e2.doubleValue)?String(e2.doubleValue):e2.doubleValue),e2.stringValue!=null&&e2.hasOwnProperty("stringValue")&&(o2.stringValue=t2.bytes===String?i.base64.encode(e2.stringValue,0,e2.stringValue.length):t2.bytes===Array?Array.prototype.slice.call(e2.stringValue):e2.stringValue),e2.aggregateValue!=null&&e2.hasOwnProperty("aggregateValue")&&(o2.aggregateValue=e2.aggregateValue),o2},I.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},I.NamePart=(q.prototype.namePart="",q.prototype.isExtension=!1,q.create=function(e2){return new q(e2)},q.encode=function(e2,t2){return(t2=t2||r.create()).uint32(10).string(e2.namePart),t2.uint32(16).bool(e2.isExtension),t2},q.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},q.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new p.google.protobuf.UninterpretedOption.NamePart;e2.pos>>3){case 1:o2.namePart=e2.string();break;case 2:o2.isExtension=e2.bool();break;default:e2.skipType(7&r2)}}if(!o2.hasOwnProperty("namePart"))throw i.ProtocolError("missing required 'namePart'",{instance:o2});if(o2.hasOwnProperty("isExtension"))return o2;throw i.ProtocolError("missing required 'isExtension'",{instance:o2})},q.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},q.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":i.isString(e2.namePart)?typeof e2.isExtension!="boolean"?"isExtension: boolean expected":null:"namePart: string expected"},q.fromObject=function(e2){var t2;return e2 instanceof p.google.protobuf.UninterpretedOption.NamePart?e2:(t2=new p.google.protobuf.UninterpretedOption.NamePart,e2.namePart!=null&&(t2.namePart=String(e2.namePart)),e2.isExtension!=null&&(t2.isExtension=!!e2.isExtension),t2)},q.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.namePart="",n2.isExtension=!1),e2.namePart!=null&&e2.hasOwnProperty("namePart")&&(n2.namePart=e2.namePart),e2.isExtension!=null&&e2.hasOwnProperty("isExtension")&&(n2.isExtension=e2.isExtension),n2},q.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},q),I),t.SourceCodeInfo=(Y.prototype.location=i.emptyArray,Y.create=function(e2){return new Y(e2)},Y.encode=function(e2,t2){if(t2=t2||r.create(),e2.location!=null&&e2.location.length)for(var n2=0;n2>>3==1?(o2.location&&o2.location.length||(o2.location=[]),o2.location.push(p.google.protobuf.SourceCodeInfo.Location.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},Y.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},Y.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.location!=null&&e2.hasOwnProperty("location")){if(!Array.isArray(e2.location))return"location: array expected";for(var t2=0;t2>>3){case 1:if(o2.path&&o2.path.length||(o2.path=[]),(7&r2)==2)for(var i2=e2.uint32()+e2.pos;e2.pos>>3==1?(o2.annotation&&o2.annotation.length||(o2.annotation=[]),o2.annotation.push(p.google.protobuf.GeneratedCodeInfo.Annotation.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},W.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},W.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.annotation!=null&&e2.hasOwnProperty("annotation")){if(!Array.isArray(e2.annotation))return"annotation: array expected";for(var t2=0;t2>>3){case 1:if(o2.path&&o2.path.length||(o2.path=[]),(7&r2)==2)for(var i2=e2.uint32()+e2.pos;e2.pos>>3){case 1:o2.type_url=e2.string();break;case 2:o2.value=e2.bytes();break;default:e2.skipType(7&r2)}}return o2},X.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},X.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.type_url!=null&&e2.hasOwnProperty("type_url")&&!i.isString(e2.type_url)?"type_url: string expected":e2.value!=null&&e2.hasOwnProperty("value")&&!(e2.value&&typeof e2.value.length=="number"||i.isString(e2.value))?"value: buffer expected":null},X.fromObject=function(e2){var t2;return e2 instanceof p.google.protobuf.Any?e2:(t2=new p.google.protobuf.Any,e2.type_url!=null&&(t2.type_url=String(e2.type_url)),e2.value!=null&&(typeof e2.value=="string"?i.base64.decode(e2.value,t2.value=i.newBuffer(i.base64.length(e2.value)),0):e2.value.length&&(t2.value=e2.value)),t2)},X.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.type_url="",t2.bytes===String?n2.value="":(n2.value=[],t2.bytes!==Array&&(n2.value=i.newBuffer(n2.value)))),e2.type_url!=null&&e2.hasOwnProperty("type_url")&&(n2.type_url=e2.type_url),e2.value!=null&&e2.hasOwnProperty("value")&&(n2.value=t2.bytes===String?i.base64.encode(e2.value,0,e2.value.length):t2.bytes===Array?Array.prototype.slice.call(e2.value):e2.value),n2},X.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},X),t.Duration=(K.prototype.seconds=i.Long?i.Long.fromBits(0,0,!1):0,K.prototype.nanos=0,K.create=function(e2){return new K(e2)},K.encode=function(e2,t2){return t2=t2||r.create(),e2.seconds!=null&&Object.hasOwnProperty.call(e2,"seconds")&&t2.uint32(8).int64(e2.seconds),e2.nanos!=null&&Object.hasOwnProperty.call(e2,"nanos")&&t2.uint32(16).int32(e2.nanos),t2},K.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},K.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new p.google.protobuf.Duration;e2.pos>>3){case 1:o2.seconds=e2.int64();break;case 2:o2.nanos=e2.int32();break;default:e2.skipType(7&r2)}}return o2},K.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},K.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.seconds!=null&&e2.hasOwnProperty("seconds")&&!(i.isInteger(e2.seconds)||e2.seconds&&i.isInteger(e2.seconds.low)&&i.isInteger(e2.seconds.high))?"seconds: integer|Long expected":e2.nanos!=null&&e2.hasOwnProperty("nanos")&&!i.isInteger(e2.nanos)?"nanos: integer expected":null},K.fromObject=function(e2){var t2;return e2 instanceof p.google.protobuf.Duration?e2:(t2=new p.google.protobuf.Duration,e2.seconds!=null&&(i.Long?(t2.seconds=i.Long.fromValue(e2.seconds)).unsigned=!1:typeof e2.seconds=="string"?t2.seconds=parseInt(e2.seconds,10):typeof e2.seconds=="number"?t2.seconds=e2.seconds:typeof e2.seconds=="object"&&(t2.seconds=new i.LongBits(e2.seconds.low>>>0,e2.seconds.high>>>0).toNumber())),e2.nanos!=null&&(t2.nanos=0|e2.nanos),t2)},K.toObject=function(e2,t2){var n2,o2={};return(t2=t2||{}).defaults&&(i.Long?(n2=new i.Long(0,0,!1),o2.seconds=t2.longs===String?n2.toString():t2.longs===Number?n2.toNumber():n2):o2.seconds=t2.longs===String?"0":0,o2.nanos=0),e2.seconds!=null&&e2.hasOwnProperty("seconds")&&(typeof e2.seconds=="number"?o2.seconds=t2.longs===String?String(e2.seconds):e2.seconds:o2.seconds=t2.longs===String?i.Long.prototype.toString.call(e2.seconds):t2.longs===Number?new i.LongBits(e2.seconds.low>>>0,e2.seconds.high>>>0).toNumber():e2.seconds),e2.nanos!=null&&e2.hasOwnProperty("nanos")&&(o2.nanos=e2.nanos),o2},K.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},K),t.Empty=(Q.create=function(e2){return new Q(e2)},Q.encode=function(e2,t2){return t2=t2||r.create()},Q.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},Q.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,t2=new p.google.protobuf.Empty;e2.pos>>3){case 1:o2.code=e2.int32();break;case 2:o2.message=e2.string();break;case 3:o2.details&&o2.details.length||(o2.details=[]),o2.details.push(p.google.protobuf.Any.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},V.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},V.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.code!=null&&e2.hasOwnProperty("code")&&!i.isInteger(e2.code))return"code: integer expected";if(e2.message!=null&&e2.hasOwnProperty("message")&&!i.isString(e2.message))return"message: string expected";if(e2.details!=null&&e2.hasOwnProperty("details")){if(!Array.isArray(e2.details))return"details: array expected";for(var t2=0;t2{event==="complete"&&(this.completeListeners++,this.hasActiveListeners||(this.hasActiveListeners=!0,this.startPolling_()))}),this.on("removeListener",event=>{event==="complete"&&--this.completeListeners===0&&(this.hasActiveListeners=!1)})}cancel(){this.currentCallPromise_&&this.currentCallPromise_.cancel();let operationsClient=this.longrunningDescriptor.operationsClient,cancelRequest=new operationProtos.google.longrunning.CancelOperationRequest;return cancelRequest.name=this.latestResponse.name,operationsClient.cancelOperation(cancelRequest)}getOperation(callback){let self2=this,operationsClient=this.longrunningDescriptor.operationsClient;function promisifyResponse(){if(!callback)return new Promise((resolve,reject)=>{if(self2.latestResponse.error){let error=new googleError_1.GoogleError(self2.latestResponse.error.message);error.code=self2.latestResponse.error.code,reject(error)}else resolve([self2.result,self2.metadata,self2.latestResponse])})}if(__name(promisifyResponse,"promisifyResponse"),this.latestResponse.done)return this._unpackResponse(this.latestResponse,callback),promisifyResponse();let request=new operationProtos.google.longrunning.GetOperationRequest;request.name=this.latestResponse.name,this.currentCallPromise_=operationsClient.getOperationInternal(request,this._callOptions);let noCallbackPromise=this.currentCallPromise_.then(responses=>(self2.latestResponse=responses[0],self2._unpackResponse(responses[0],callback),promisifyResponse()),err=>{if(callback){callback(err);return}return Promise.reject(err)});if(!callback)return noCallbackPromise}_unpackResponse(op,callback){let responseDecoder=this.longrunningDescriptor.responseDecoder,metadataDecoder=this.longrunningDescriptor.metadataDecoder,response,metadata;if(op.done){if(op.result==="error"){let error=new googleError_1.GoogleError(op.error.message);error.code=op.error.code,this.error=error,callback&&callback(error);return}responseDecoder&&op.response&&(this.response=op.response,response=responseDecoder(op.response.value),this.result=response,this.done=!0)}metadataDecoder&&op.metadata&&(metadata=metadataDecoder(op.metadata.value),this.metadata=metadata),callback&&callback(null,response,metadata,op)}startPolling_(){let self2=this,now=new Date,delayMult=this.backoffSettings.retryDelayMultiplier,maxDelay=this.backoffSettings.maxRetryDelayMillis,delay=this.backoffSettings.initialRetryDelayMillis,deadline=1/0;this.backoffSettings.totalTimeoutMillis&&(deadline=now.getTime()+this.backoffSettings.totalTimeoutMillis);let previousMetadataBytes;this.latestResponse.metadata&&(previousMetadataBytes=this.latestResponse.metadata.value);function emit(event,...args){self2.emit(event,...args)}__name(emit,"emit");function arrayEquals(a,b){if(a.byteLength!==b.byteLength)return!1;for(let i=0;i=deadline){let error=new googleError_1.GoogleError("Total timeout exceeded before any response was received");error.code=status_1.Status.DEADLINE_EXCEEDED,setImmediate(emit,"error",error);return}self2.getOperation((err,result,metadata,rawResponse)=>{if(err){setImmediate(emit,"error",err);return}if(!result){if(rawResponse.metadata&&(!previousMetadataBytes||rawResponse&&!arrayEquals(rawResponse.metadata.value,previousMetadataBytes))&&(setImmediate(emit,"progress",metadata,rawResponse),previousMetadataBytes=rawResponse.metadata.value),rawResponse.done){setImmediate(emit,"complete",{},metadata,rawResponse);return}setTimeout(()=>{now=new Date,delay=Math.min(delay*delayMult,maxDelay),retry()},delay);return}setImmediate(emit,"complete",result,metadata,rawResponse)})}}__name(retry,"retry"),retry()}promise(){return new Promise((resolve,reject)=>{this.on("error",reject).on("complete",(result,metadata,rawResponse)=>{resolve([result,metadata,rawResponse])})})}};__name(Operation,"Operation");exports2.Operation=Operation;function operation(op,longrunningDescriptor,backoffSettings,callOptions){return new Operation(op,longrunningDescriptor,backoffSettings,callOptions)}__name(operation,"operation");exports2.operation=operation}});var require_longRunningApiCaller=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/longRunningCalls/longRunningApiCaller.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.LongrunningApiCaller=void 0;var call_1=require_call(),gax_1=require_gax(),longrunning_1=require_longrunning(),LongrunningApiCaller=class{constructor(longrunningDescriptor){this.longrunningDescriptor=longrunningDescriptor}init(callback){return callback?new call_1.OngoingCall(callback):new call_1.OngoingCallPromise}wrap(func){return func}call(apiCall,argument,settings,canceller){canceller.call((argument2,callback)=>this._wrapOperation(apiCall,settings,argument2,callback),argument)}_wrapOperation(apiCall,settings,argument,callback){let backoffSettings=settings.longrunning;backoffSettings||(backoffSettings=(0,gax_1.createDefaultBackoffSettings)());let longrunningDescriptor=this.longrunningDescriptor;return apiCall(argument,(err,rawResponse)=>{if(err){callback(err,null,null,rawResponse);return}let operation=new longrunning_1.Operation(rawResponse,longrunningDescriptor,backoffSettings,settings);callback(null,operation,rawResponse)})}fail(canceller,err){canceller.callback(err)}result(canceller){return canceller.promise}};__name(LongrunningApiCaller,"LongrunningApiCaller");exports2.LongrunningApiCaller=LongrunningApiCaller}});var require_longRunningDescriptor=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/longRunningCalls/longRunningDescriptor.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.LongRunningDescriptor=void 0;var longRunningApiCaller_1=require_longRunningApiCaller(),LongRunningDescriptor=class{constructor(operationsClient,responseDecoder,metadataDecoder){this.operationsClient=operationsClient,this.responseDecoder=responseDecoder,this.metadataDecoder=metadataDecoder}getApiCaller(){return new longRunningApiCaller_1.LongrunningApiCaller(this)}};__name(LongRunningDescriptor,"LongRunningDescriptor");exports2.LongRunningDescriptor=LongRunningDescriptor}});var require_resourceCollector=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/paginationCalls/resourceCollector.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.ResourceCollector=void 0;var ResourceCollector=class{constructor(apiCall,maxResults=-1){this.apiCall=apiCall,this.resources=[],this.maxResults=maxResults}callback(err,resources,nextPageRequest){if(err){this.rejectCallback(err);return}for(let resource of resources)if(this.resources.push(resource),this.resources.length===this.maxResults){nextPageRequest=null;break}if(!nextPageRequest){this.resolveCallback(this.resources);return}let callback=__name((...args)=>this.callback(...args),"callback");setImmediate(this.apiCall,nextPageRequest,callback)}processAllPages(firstRequest){return new Promise((resolve,reject)=>{this.resolveCallback=resolve,this.rejectCallback=reject;let callback=__name((...args)=>this.callback(...args),"callback");setImmediate(this.apiCall,firstRequest,callback)})}};__name(ResourceCollector,"ResourceCollector");exports2.ResourceCollector=ResourceCollector}});var require_pagedApiCaller=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/paginationCalls/pagedApiCaller.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.PagedApiCaller=void 0;var call_1=require_call(),googleError_1=require_googleError(),resourceCollector_1=require_resourceCollector(),PagedApiCaller=class{constructor(pageDescriptor){this.pageDescriptor=pageDescriptor}generateParseResponseCallback(request,callback){let resourceFieldName=this.pageDescriptor.resourceField,responsePageTokenFieldName=this.pageDescriptor.responsePageTokenField,requestPageTokenFieldName=this.pageDescriptor.requestPageTokenField;return(err,response)=>{if(err){callback(err);return}if(!request){callback(new googleError_1.GoogleError("Undefined request in pagination method callback."));return}if(!response){callback(new googleError_1.GoogleError("Undefined response in pagination method callback."));return}let resources=response[resourceFieldName]||[],pageToken=response[responsePageTokenFieldName],nextPageRequest=null;pageToken&&(nextPageRequest=Object.assign({},request),nextPageRequest[requestPageTokenFieldName]=pageToken),callback(err,resources,nextPageRequest,response)}}wrap(func){let self2=this;return __name(function(argument,metadata,options,callback){return func(argument,metadata,options,self2.generateParseResponseCallback(argument,callback))},"wrappedCall")}init(callback){return callback?new call_1.OngoingCall(callback):new call_1.OngoingCallPromise}call(apiCall,request,settings,ongoingCall){if(request=Object.assign({},request),!settings.autoPaginate){ongoingCall.call(apiCall,request);return}let maxResults=settings.maxResults||-1;new resourceCollector_1.ResourceCollector(apiCall,maxResults).processAllPages(request).then(resources=>ongoingCall.callback(null,resources),err=>ongoingCall.callback(err))}fail(ongoingCall,err){ongoingCall.callback(err)}result(ongoingCall){return ongoingCall.promise}};__name(PagedApiCaller,"PagedApiCaller");exports2.PagedApiCaller=PagedApiCaller}});var require_pageDescriptor=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/paginationCalls/pageDescriptor.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.PageDescriptor=void 0;var stream_1=require("stream"),normalApiCaller_1=require_normalApiCaller(),pagedApiCaller_1=require_pagedApiCaller(),maxAttemptsEmptyResponse=10,PageDescriptor=class{constructor(requestPageTokenField,responsePageTokenField,resourceField){this.requestPageTokenField=requestPageTokenField,this.responsePageTokenField=responsePageTokenField,this.resourceField=resourceField}createStream(apiCall,request,options){let stream=new stream_1.PassThrough({objectMode:!0});options=Object.assign({},options,{autoPaginate:!1});let maxResults="maxResults"in options?options.maxResults:-1,pushCount=0,started=!1;function callback(err,resources,next,apiResp){if(err){stream.emit("error",err);return}stream.emit("response",apiResp);for(let i=0;i{started||(started=!0,apiCall(request,options,callback))}),stream}asyncIterate(apiCall,request,options){return options=Object.assign({},options,{autoPaginate:!1}),this.createIterator(apiCall,request,options)}createIterator(apiCall,request,options){return{[Symbol.asyncIterator](){let nextPageRequest=request,cache=[];return{async next(){if(cache.length>0)return Promise.resolve({done:!1,value:cache.shift()});let attempts=0;for(;cache.length===0&&nextPageRequest;){let result;if([result,nextPageRequest]=await apiCall(nextPageRequest,options),result&&!Array.isArray(result))for(let[key,value]of Object.entries(result))cache.push([key,value]);else cache.push(...result);if(cache.length===0&&(++attempts,attempts>maxAttemptsEmptyResponse))break}return cache.length===0?Promise.resolve({done:!0,value:void 0}):Promise.resolve({done:!1,value:cache.shift()})}}}}}getApiCaller(settings){return settings.autoPaginate?new pagedApiCaller_1.PagedApiCaller(this):new normalApiCaller_1.NormalApiCaller}};__name(PageDescriptor,"PageDescriptor");exports2.PageDescriptor=PageDescriptor}});var require_streamDescriptor=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/streamingCalls/streamDescriptor.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.StreamDescriptor=void 0;var streamingApiCaller_1=require_streamingApiCaller(),StreamDescriptor=class{constructor(streamType,rest,gaxStreamingRetries){this.type=streamType,this.streaming=!0,this.rest=rest,this.gaxStreamingRetries=gaxStreamingRetries}getApiCaller(){return new streamingApiCaller_1.StreamingApiCaller(this)}};__name(StreamDescriptor,"StreamDescriptor");exports2.StreamDescriptor=StreamDescriptor}});var require_bundleApiCaller=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/bundlingCalls/bundleApiCaller.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.BundleApiCaller=void 0;var call_1=require_call(),googleError_1=require_googleError(),BundleApiCaller=class{constructor(bundler){this.bundler=bundler}init(callback){return callback?new call_1.OngoingCall(callback):new call_1.OngoingCallPromise}wrap(func){return func}call(apiCall,argument,settings,status){if(!settings.isBundling)throw new googleError_1.GoogleError("Bundling enabled with no isBundling!");status.call((argument2,callback)=>(this.bundler.schedule(apiCall,argument2,callback),status),argument)}fail(canceller,err){canceller.callback(err)}result(canceller){return canceller.promise}};__name(BundleApiCaller,"BundleApiCaller");exports2.BundleApiCaller=BundleApiCaller}});var require_bundlingUtils=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/bundlingCalls/bundlingUtils.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.computeBundleId=void 0;function computeBundleId(obj,discriminatorFields){let ids=[],hasIds=!1;for(let field of discriminatorFields){let id=at(obj,field);id===void 0?ids.push(null):(hasIds=!0,ids.push(id))}if(hasIds)return JSON.stringify(ids)}__name(computeBundleId,"computeBundleId");exports2.computeBundleId=computeBundleId;function at(obj,field){let pathParts=field.split("."),currentObj=obj;for(let pathPart of pathParts)currentObj=currentObj?.[pathPart];return currentObj}__name(at,"at")}});var require_task=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/bundlingCalls/task.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Task=exports2.deepCopyForResponse=void 0;var status_1=require_status(),googleError_1=require_googleError();function deepCopyForResponse(obj,subresponseInfo){let result;if(obj===null)return null;if(obj!==void 0)return Array.isArray(obj)?(result=[],obj.forEach(element=>{result.push(deepCopyForResponse(element,null))}),result):obj.copy!==void 0?obj.copy():obj instanceof ArrayBuffer?obj.slice(0):typeof obj=="object"?(result={},Object.keys(obj).forEach(key=>{subresponseInfo&&key===subresponseInfo.field&&Array.isArray(obj[key])?result[key]=obj[key].slice(subresponseInfo.start,subresponseInfo.end):result[key]=deepCopyForResponse(obj[key],null)}),result):obj}__name(deepCopyForResponse,"deepCopyForResponse");exports2.deepCopyForResponse=deepCopyForResponse;var Task=class{constructor(apiCall,bundlingRequest,bundledField,subresponseField){this._apiCall=apiCall,this._request=bundlingRequest,this._bundledField=bundledField,this._subresponseField=subresponseField,this._data=[]}getElementCount(){let count=0;for(let i=0;i{let responses=[];if(err)self2._data.forEach(()=>{responses.push(void 0)});else{let subresponseInfo=null;self2._subresponseField&&(subresponseInfo={field:self2._subresponseField,start:0}),self2._data.forEach(data=>{subresponseInfo&&(subresponseInfo.end=subresponseInfo.start+data.elements.length),responses.push(deepCopyForResponse(response,subresponseInfo)),subresponseInfo&&(subresponseInfo.start=subresponseInfo.end)})}for(let i=0;i{d.callback.id===id&&(d.cancelled=!0),d.cancelled||(allCancelled=!1)}),allCancelled&&this.callCanceller.cancel(),allCancelled}for(let i=0;i{requestBytes+=this._descriptor.byteLengthFunction(obj)});let countLimit=this._options.elementCountLimit||0,byteLimit=this._options.requestByteLimit||0;if(countLimit>0&&elementCount>countLimit||byteLimit>0&&requestBytes>=byteLimit){let message;countLimit>0&&elementCount>countLimit?message="The number of elements "+elementCount+" exceeds the limit "+this._options.elementCountLimit:message="The required bytes "+requestBytes+" exceeds the limit "+this._options.requestByteLimit;let error=new googleError_1.GoogleError(message);return error.code=status_1.Status.INVALID_ARGUMENT,callback(error),{cancel:noop}}let existingCount=task.getElementCount(),existingBytes=task.getRequestByteSize();(countLimit>0&&elementCount+existingCount>=countLimit||byteLimit>0&&requestBytes+existingBytes>=byteLimit)&&(this._runNow(bundleId),this._tasks[bundleId]=new task_1.Task(apiCall,request,this._descriptor.bundledField,this._descriptor.subresponseField),task=this._tasks[bundleId]),task.extend(bundledField,requestBytes,callback);let ret={cancel(){self2._cancel(callback.id)}},countThreshold=this._options.elementCountThreshold||0,sizeThreshold=this._options.requestByteThreshold||0;return countThreshold>0&&task.getElementCount()>=countThreshold||sizeThreshold>0&&task.getRequestByteSize()>=sizeThreshold?(this._runNow(bundleId),ret):(!(bundleId in this._timers)&&this._options.delayThreshold>0&&(this._timers[bundleId]=setTimeout(()=>{delete this._timers[bundleId],this._runNow(bundleId)},this._options.delayThreshold)),ret)}_maybeClearTimeout(bundleId){if(bundleId in this._timers){let timerId=this._timers[bundleId];delete this._timers[bundleId],clearTimeout(timerId)}}_cancel(id){if(!(id in this._invocations))return;let bundleId=this._invocations[id];if(!(bundleId in this._tasks))return;let task=this._tasks[bundleId];delete this._invocations[id],task.cancel(id)&&(this._maybeClearTimeout(bundleId),delete this._tasks[bundleId])}_runNow(bundleId){if(!(bundleId in this._tasks)){(0,warnings_1.warn)("bundle_runnow_bundleid_unknown",`No such bundleid: ${bundleId}`);return}this._maybeClearTimeout(bundleId);let task=this._tasks[bundleId];delete this._tasks[bundleId],task.run().forEach(id=>{delete this._invocations[id]})}};__name(BundleExecutor,"BundleExecutor");exports2.BundleExecutor=BundleExecutor}});var require_bundleDescriptor=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/bundlingCalls/bundleDescriptor.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.BundleDescriptor=void 0;var normalApiCaller_1=require_normalApiCaller(),bundleApiCaller_1=require_bundleApiCaller(),bundleExecutor_1=require_bundleExecutor(),util_1=require_util2(),BundleDescriptor=class{constructor(bundledField,requestDiscriminatorFields,subresponseField,byteLengthFunction){!byteLengthFunction&&typeof subresponseField=="function"&&(byteLengthFunction=subresponseField,subresponseField=null),this.bundledField=bundledField,this.requestDiscriminatorFields=requestDiscriminatorFields.map(util_1.toCamelCase),this.subresponseField=subresponseField,this.byteLengthFunction=byteLengthFunction}getApiCaller(settings){return settings.isBundling===!1?new normalApiCaller_1.NormalApiCaller:new bundleApiCaller_1.BundleApiCaller(new bundleExecutor_1.BundleExecutor(settings.bundleOptions,this))}};__name(BundleDescriptor,"BundleDescriptor");exports2.BundleDescriptor=BundleDescriptor}});var require_descriptor=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/descriptor.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.BundleDescriptor=exports2.StreamDescriptor=exports2.PageDescriptor=exports2.LongrunningDescriptor=void 0;var longRunningDescriptor_1=require_longRunningDescriptor();Object.defineProperty(exports2,"LongrunningDescriptor",{enumerable:!0,get:function(){return longRunningDescriptor_1.LongRunningDescriptor}});var pageDescriptor_1=require_pageDescriptor();Object.defineProperty(exports2,"PageDescriptor",{enumerable:!0,get:function(){return pageDescriptor_1.PageDescriptor}});var streamDescriptor_1=require_streamDescriptor();Object.defineProperty(exports2,"StreamDescriptor",{enumerable:!0,get:function(){return streamDescriptor_1.StreamDescriptor}});var bundleDescriptor_1=require_bundleDescriptor();Object.defineProperty(exports2,"BundleDescriptor",{enumerable:!0,get:function(){return bundleDescriptor_1.BundleDescriptor}})}});var require_operations_client_config=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/operations_client_config.json"(exports2,module2){module2.exports={interfaces:{"google.longrunning.Operations":{retry_codes:{idempotent:["DEADLINE_EXCEEDED","UNAVAILABLE"],non_idempotent:[]},retry_params:{default:{initial_retry_delay_millis:100,retry_delay_multiplier:1.3,max_retry_delay_millis:6e4,initial_rpc_timeout_millis:9e4,rpc_timeout_multiplier:1,max_rpc_timeout_millis:9e4,total_timeout_millis:6e5}},methods:{GetOperation:{timeout_millis:6e4,retry_codes_name:"idempotent",retry_params_name:"default"},ListOperations:{timeout_millis:6e4,retry_codes_name:"idempotent",retry_params_name:"default"},CancelOperation:{timeout_millis:6e4,retry_codes_name:"idempotent",retry_params_name:"default"},DeleteOperation:{timeout_millis:6e4,retry_codes_name:"idempotent",retry_params_name:"default"}}}}}}});var require_operations2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/protos/operations.json"(exports2,module2){module2.exports={nested:{google:{nested:{longrunning:{options:{cc_enable_arenas:!0,csharp_namespace:"Google.LongRunning",go_package:"google.golang.org/genproto/googleapis/longrunning;longrunning",java_multiple_files:!0,java_outer_classname:"OperationsProto",java_package:"com.google.longrunning",php_namespace:"Google\\LongRunning"},nested:{operationInfo:{type:"google.longrunning.OperationInfo",id:1049,extend:"google.protobuf.MethodOptions"},Operations:{options:{"(google.api.default_host)":"longrunning.googleapis.com"},methods:{ListOperations:{requestType:"ListOperationsRequest",responseType:"ListOperationsResponse",options:{"(google.api.http).get":"/v1/{name=operations}","(google.api.method_signature)":"name,filter"},parsedOptions:[{"(google.api.http)":{get:"/v1/{name=operations}"}},{"(google.api.method_signature)":"name,filter"}]},GetOperation:{requestType:"GetOperationRequest",responseType:"Operation",options:{"(google.api.http).get":"/v1/operations/{name}","(google.api.method_signature)":"name"},parsedOptions:[{"(google.api.http)":{get:"/v1/operations/{name}"}},{"(google.api.method_signature)":"name"}]},DeleteOperation:{requestType:"DeleteOperationRequest",responseType:"google.protobuf.Empty",options:{"(google.api.http).delete":"/v1/{name=operations/**}","(google.api.method_signature)":"name"},parsedOptions:[{"(google.api.http)":{delete:"/v1/{name=operations/**}"}},{"(google.api.method_signature)":"name"}]},CancelOperation:{requestType:"CancelOperationRequest",responseType:"google.protobuf.Empty",options:{"(google.api.http).post":"/v1/{name=operations/**}:cancel","(google.api.http).body":"*","(google.api.method_signature)":"name"},parsedOptions:[{"(google.api.http)":{post:"/v1/{name=operations/**}:cancel",body:"*"}},{"(google.api.method_signature)":"name"}]},WaitOperation:{requestType:"WaitOperationRequest",responseType:"Operation"}}},Operation:{oneofs:{result:{oneof:["error","response"]}},fields:{name:{type:"string",id:1},metadata:{type:"google.protobuf.Any",id:2},done:{type:"bool",id:3},error:{type:"google.rpc.Status",id:4},response:{type:"google.protobuf.Any",id:5}}},GetOperationRequest:{fields:{name:{type:"string",id:1}}},ListOperationsRequest:{fields:{name:{type:"string",id:4},filter:{type:"string",id:1},pageSize:{type:"int32",id:2},pageToken:{type:"string",id:3}}},ListOperationsResponse:{fields:{operations:{rule:"repeated",type:"Operation",id:1},nextPageToken:{type:"string",id:2}}},CancelOperationRequest:{fields:{name:{type:"string",id:1}}},DeleteOperationRequest:{fields:{name:{type:"string",id:1}}},WaitOperationRequest:{fields:{name:{type:"string",id:1},timeout:{type:"google.protobuf.Duration",id:2}}},OperationInfo:{fields:{responseType:{type:"string",id:1},metadataType:{type:"string",id:2}}}}},api:{options:{go_package:"google.golang.org/genproto/googleapis/api/annotations;annotations",java_multiple_files:!0,java_outer_classname:"ClientProto",java_package:"com.google.api",objc_class_prefix:"GAPI",cc_enable_arenas:!0},nested:{http:{type:"HttpRule",id:72295728,extend:"google.protobuf.MethodOptions"},Http:{fields:{rules:{rule:"repeated",type:"HttpRule",id:1},fullyDecodeReservedExpansion:{type:"bool",id:2}}},HttpRule:{oneofs:{pattern:{oneof:["get","put","post","delete","patch","custom"]}},fields:{selector:{type:"string",id:1},get:{type:"string",id:2},put:{type:"string",id:3},post:{type:"string",id:4},delete:{type:"string",id:5},patch:{type:"string",id:6},custom:{type:"CustomHttpPattern",id:8},body:{type:"string",id:7},responseBody:{type:"string",id:12},additionalBindings:{rule:"repeated",type:"HttpRule",id:11}}},CustomHttpPattern:{fields:{kind:{type:"string",id:1},path:{type:"string",id:2}}},methodSignature:{rule:"repeated",type:"string",id:1051,extend:"google.protobuf.MethodOptions"},defaultHost:{type:"string",id:1049,extend:"google.protobuf.ServiceOptions"},oauthScopes:{type:"string",id:1050,extend:"google.protobuf.ServiceOptions"}}},protobuf:{options:{go_package:"github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor",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:{fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}}},FileDescriptorProto:{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,options:{packed:!1}},weakDependency:{rule:"repeated",type:"int32",id:11,options:{packed:!1}},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}}},DescriptorProto:{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}},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:{fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},FieldDescriptorProto:{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_REQUIRED:2,LABEL_REPEATED:3}}}},OneofDescriptorProto:{fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{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}},nested:{EnumReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},EnumValueDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{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,options:{default:!1}},serverStreaming:{type:"bool",id:6,options:{default:!1}}}},FileOptions:{fields:{javaPackage:{type:"string",id:1},javaOuterClassname:{type:"string",id:8},javaMultipleFiles:{type:"bool",id:10,options:{default:!1}},javaGenerateEqualsAndHash:{type:"bool",id:20,options:{deprecated:!0}},javaStringCheckUtf8:{type:"bool",id:27,options:{default:!1}},optimizeFor:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},goPackage:{type:"string",id:11},ccGenericServices:{type:"bool",id:16,options:{default:!1}},javaGenericServices:{type:"bool",id:17,options:{default:!1}},pyGenericServices:{type:"bool",id:18,options:{default:!1}},phpGenericServices:{type:"bool",id:42,options:{default:!1}},deprecated:{type:"bool",id:23,options:{default:!1}},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},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[38,38]],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{fields:{messageSetWireFormat:{type:"bool",id:1,options:{default:!1}},noStandardDescriptorAccessor:{type:"bool",id:2,options:{default:!1}},deprecated:{type:"bool",id:3,options:{default:!1}},mapEntry:{type:"bool",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[8,8],[9,9]]},FieldOptions:{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,options:{default:!1}},deprecated:{type:"bool",id:3,options:{default:!1}},weak:{type:"bool",id:10,options:{default:!1}},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}}}},OneofOptions:{fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3,options:{default:!1}},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[5,5]]},EnumValueOptions:{fields:{deprecated:{type:"bool",id:1,options:{default:!1}},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{fields:{deprecated:{type:"bool",id:33,options:{default:!1}},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{fields:{deprecated:{type:"bool",id:33,options:{default:!1}},idempotencyLevel:{type:"IdempotencyLevel",id:34,options:{default:"IDEMPOTENCY_UNKNOWN"}},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],nested:{IdempotencyLevel:{values:{IDEMPOTENCY_UNKNOWN:0,NO_SIDE_EFFECTS:1,IDEMPOTENT:2}}}},UninterpretedOption:{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}}}}},SourceCodeInfo:{fields:{location:{rule:"repeated",type:"Location",id:1}},nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1},span:{rule:"repeated",type:"int32",id:2},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4}}}}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},Duration:{fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}},Empty:{fields:{}}}},rpc:{options:{cc_enable_arenas:!0,go_package:"google.golang.org/genproto/googleapis/rpc/status;status",java_multiple_files:!0,java_outer_classname:"StatusProto",java_package:"com.google.rpc",objc_class_prefix:"RPC"},nested:{Status:{fields:{code:{type:"int32",id:1},message:{type:"string",id:2},details:{rule:"repeated",type:"google.protobuf.Any",id:3}}}}}}}}}}});var require_transcoding=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/transcoding.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.overrideHttpRules=exports2.transcode=exports2.isProto3OptionalField=exports2.flattenObject=exports2.match=exports2.applyPattern=exports2.encodeWithoutSlashes=exports2.encodeWithSlashes=exports2.buildQueryStringComponents=exports2.deleteField=exports2.deepCopyWithoutMatchedFields=exports2.getField=void 0;var util_1=require_util2(),httpOptionName="(google.api.http)",proto3OptionalName="proto3_optional",supportedHttpMethods=["get","post","put","patch","delete"];function getField(request,field,allowObjects=!1){let parts=field.split("."),value=request;for(let part of parts){if(typeof value!="object")return;value=value[part]}if(!(!allowObjects&&typeof value=="object"&&!Array.isArray(value)&&value!==null))return value}__name(getField,"getField");exports2.getField=getField;function deepCopyWithoutMatchedFields(request,fieldsToSkip,fullNamePrefix=""){if(typeof request!="object"||request===null)return request;let copy=Object.assign({},request);for(let key in copy){if(fieldsToSkip.has(`${fullNamePrefix}${key}`)){delete copy[key];continue}let nextFullNamePrefix=`${fullNamePrefix}${key}.`;Array.isArray(copy[key])?copy[key]=copy[key].map(value=>deepCopyWithoutMatchedFields(value,new Set)):typeof copy[key]=="object"&©[key]!==null&&(copy[key]=deepCopyWithoutMatchedFields(copy[key],fieldsToSkip,nextFullNamePrefix))}return copy}__name(deepCopyWithoutMatchedFields,"deepCopyWithoutMatchedFields");exports2.deepCopyWithoutMatchedFields=deepCopyWithoutMatchedFields;function deleteField(request,field){let parts=field.split(".");for(;parts.length>1;){if(typeof request!="object")return;let part2=parts.shift();request=request[part2]}let part=parts.shift();typeof request=="object"&&delete request[part]}__name(deleteField,"deleteField");exports2.deleteField=deleteField;function buildQueryStringComponents(request,prefix=""){let resultList=[];for(let key in request)if(Array.isArray(request[key]))for(let value of request[key])resultList.push(`${prefix}${encodeWithoutSlashes(key)}=${encodeWithoutSlashes(value.toString())}`);else typeof request[key]=="object"&&request[key]!==null?resultList.push(...buildQueryStringComponents(request[key],`${key}.`)):resultList.push(`${prefix}${encodeWithoutSlashes(key)}=${encodeWithoutSlashes(request[key]===null?"null":request[key].toString())}`);return resultList}__name(buildQueryStringComponents,"buildQueryStringComponents");exports2.buildQueryStringComponents=buildQueryStringComponents;function encodeWithSlashes(str){return str.split("").map(c=>c.match(/[-_.~0-9a-zA-Z]/)?c:encodeURIComponent(c)).join("")}__name(encodeWithSlashes,"encodeWithSlashes");exports2.encodeWithSlashes=encodeWithSlashes;function encodeWithoutSlashes(str){return str.split("").map(c=>c.match(/[-_.~0-9a-zA-Z/]/)?c:encodeURIComponent(c)).join("")}__name(encodeWithoutSlashes,"encodeWithoutSlashes");exports2.encodeWithoutSlashes=encodeWithoutSlashes;function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}__name(escapeRegExp,"escapeRegExp");function applyPattern(pattern,fieldValue){if(!pattern||pattern==="*")return encodeWithSlashes(fieldValue);if(!pattern.includes("*")&&pattern!==fieldValue)return;let regex=new RegExp("^"+escapeRegExp(pattern).replace(/\\\*\\\*/g,"(.+)").replace(/\\\*/g,"([^/]+)")+"$");if(fieldValue.match(regex))return encodeWithoutSlashes(fieldValue)}__name(applyPattern,"applyPattern");exports2.applyPattern=applyPattern;function fieldToCamelCase(field){return field.split(".").map(part=>(0,util_1.toCamelCase)(part)).join(".")}__name(fieldToCamelCase,"fieldToCamelCase");function match(request,pattern){let url=pattern,matchedFields=[];for(;;){let match2=url.match(/^(.*)\{([^}=]+)(?:=([^}]*))?\}(.*)/);if(!match2)break;let[,before,field,pattern2,after]=match2,camelCasedField=fieldToCamelCase(field);matchedFields.push(fieldToCamelCase(camelCasedField));let fieldValue=getField(request,camelCasedField);if(fieldValue===void 0)return;let appliedPattern=applyPattern(pattern2,fieldValue===null?"null":fieldValue.toString());if(appliedPattern===void 0)return;url=before+appliedPattern+after}return{matchedFields,url}}__name(match,"match");exports2.match=match;function flattenObject(request){let result={};for(let key in request)if(request[key]!==void 0){if(Array.isArray(request[key])){result[key]=request[key];continue}if(typeof request[key]=="object"&&request[key]!==null){let nested=flattenObject(request[key]);for(let nestedKey in nested)result[`${key}.${nestedKey}`]=nested[nestedKey];continue}result[key]=request[key]}return result}__name(flattenObject,"flattenObject");exports2.flattenObject=flattenObject;function isProto3OptionalField(field){return field&&field.options&&field.options[proto3OptionalName]}__name(isProto3OptionalField,"isProto3OptionalField");exports2.isProto3OptionalField=isProto3OptionalField;function transcode(request,parsedOptions){let httpRules=[];for(let option of parsedOptions){if(!(httpOptionName in option))continue;let httpRule=option[httpOptionName];if(httpRules.push(httpRule),httpRule?.additional_bindings){let additionalBindings=Array.isArray(httpRule.additional_bindings)?httpRule.additional_bindings:[httpRule.additional_bindings];httpRules.push(...additionalBindings)}}for(let httpRule of httpRules)for(let httpMethod of supportedHttpMethods){if(!(httpMethod in httpRule))continue;let pathTemplate=httpRule[httpMethod],matchResult=match(request,pathTemplate);if(matchResult===void 0)continue;let{url,matchedFields}=matchResult,data=deepCopyWithoutMatchedFields(request,new Set(matchedFields));if(httpRule.body==="*")return{httpMethod,url,queryString:"",data};let queryStringObject=data;httpRule.body?(data=getField(queryStringObject,fieldToCamelCase(httpRule.body),!0),deleteField(queryStringObject,fieldToCamelCase(httpRule.body))):data="";let queryString=buildQueryStringComponents(queryStringObject).join("&");return(!data||typeof data=="object"&&Object.keys(data).length===0)&&(data=""),{httpMethod,url,queryString,data}}}__name(transcode,"transcode");exports2.transcode=transcode;function overrideHttpRules(httpRules,protoJson){for(let rule of httpRules){if(!rule.selector)continue;let rpc=protoJson.lookup(rule.selector);if(!(!rpc||!rpc.parsedOptions))for(let item of rpc.parsedOptions){if(!(httpOptionName in item))continue;let httpOptions=item[httpOptionName];for(let httpMethod in httpOptions){if(httpMethod in rule){if(httpMethod==="additional_bindings")continue;httpOptions[httpMethod]=rule[httpMethod]}rule.additional_bindings&&(httpOptions.additional_bindings=httpOptions.additional_bindings?Array.isArray(httpOptions.additional_bindings)?httpOptions.additional_bindings:[httpOptions.additional_bindings]:[],httpOptions.additional_bindings.push(...rule.additional_bindings))}}}}__name(overrideHttpRules,"overrideHttpRules");exports2.overrideHttpRules=overrideHttpRules}});var require_package3=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/package.json"(exports2,module2){module2.exports={name:"google-gax",version:"4.3.6",description:"Google API Extensions",main:"build/src/index.js",types:"build/src/index.d.ts",files:["build/src","build/protos/","!build/src/**/*.map"],dependencies:{"@grpc/grpc-js":"~1.10.3","@grpc/proto-loader":"^0.7.13","@types/long":"^4.0.0","abort-controller":"^3.0.0",duplexify:"^4.0.0","google-auth-library":"^9.3.0","node-fetch":"^2.6.1","object-hash":"^3.0.0","proto3-json-serializer":"^2.0.0","retry-request":"^7.0.0",uuid:"^9.0.1",protobufjs:"7.3.0"},devDependencies:{"@types/uuid":"^9.0.7","@babel/plugin-proposal-private-methods":"^7.18.6","@compodoc/compodoc":"1.1.23","@types/mocha":"^9.0.0","@types/ncp":"^2.0.1","@types/node":"^20.5.0","@types/node-fetch":"^2.5.4","@types/object-hash":"^3.0.0","@types/proxyquire":"^1.3.28","@types/pumpify":"^1.4.1","@types/sinon":"^17.0.0","@types/uglify-js":"^3.17.0",c8:"^9.0.0",codecov:"^3.1.0",execa:"^5.0.0","google-proto-files":"^4.2.0",gts:"^5.0.0",linkinator:"^4.0.0",long:"^4.0.0",mkdirp:"^2.0.0",mocha:"^9.0.0",ncp:"^2.0.0","null-loader":"^4.0.0","protobufjs-cli":"1.1.2",proxyquire:"^2.0.1",pumpify:"^2.0.0",rimraf:"^5.0.1",sinon:"^17.0.0","stream-events":"^1.0.4","ts-loader":"^8.0.0",typescript:"^5.1.6","uglify-js":"^3.17.0",walkdir:"^0.4.0",webpack:"^4.0.0","webpack-cli":"^4.0.0"},scripts:{docs:"compodoc src/",pretest:"npm run prepare",test:"c8 mocha build/test/unit",lint:"gts check src samples test",clean:"gts clean",compile:"tsc -p . && cp src/*.json build/src && cp -r test/fixtures build/test && cp -r protos build/","compile-operation-protos":"pbjs -t json google/longrunning/operations.proto -p ./protos > protos/operations.json && pbjs -t static-module -r operations_protos google/longrunning/operations.proto -p ./protos > protos/operations.js && pbts protos/operations.js -o protos/operations.d.ts","compile-compute-operations-protos":"pbjs -t json google/longrunning/compute_operations.proto -p ./protos > protos/compute_operations.json && pbjs -t static-module -r compute_operations_protos google/longrunning/compute_operations.proto -p ./protos > protos/compute_operations.js && pbts protos/compute_operations.js -o protos/compute_operations.d.ts","compile-iam-protos":"pbjs -t json google/iam/v1/iam_policy.proto google/iam/v1/options.proto google/iam/v1/policy.proto google/iam/v1/logging/audit_data.proto -p ./protos > protos/iam_service.json && pbjs -t static-module -r iam_protos google/iam/v1/iam_policy.proto google/iam/v1/options.proto google/iam/v1/policy.proto google/iam/v1/logging/audit_data.proto -p ./protos > protos/iam_service.js && pbts protos/iam_service.js -o protos/iam_service.d.ts","compile-location-protos":"pbjs -t json google/cloud/location/locations.proto -p ./protos > protos/locations.json && pbjs -t static-module -r locations_protos google/cloud/location/locations.proto -p ./protos > protos/locations.js && pbts protos/locations.js -o protos/locations.d.ts","compile-status-protos":"pbjs -t json google/rpc/status.proto google/rpc/error_details.proto -p ./protos > protos/status.json","compile-http-protos":"pbjs -t static-module -r http_proto --keep-case google/api/http.proto -p ./protos > protos/http.js && pbts protos/http.js -o protos/http.d.ts",fix:"gts fix",prepare:"npm run compile && cd ../tools && npm i && npm run compile && cd ../gax && pwd && node ../tools/build/src/prepublish.js . && mkdirp build/protos && cp -r protos/* build/protos/ && npm run minify-proto-json","system-test":"c8 mocha build/test/system-test --timeout 600000 && npm run test-application","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","docs-test":"linkinator docs","predocs-test":"npm run docs","browser-test":"cd test/browser-test && npm run prefetch && npm install && npm test","test-application":"cd test/test-application && npm run prefetch && npm install && npm start",prelint:"cd samples; npm link ../; npm install",precompile:"gts clean","update-protos":"cd ../tools && npm i && npm run compile && cd ../gax && node ../tools/build/src/listProtos.js .","minify-proto-json":"cd ../tools && npm i && npm run compile && cd ../gax && node ../tools/build/src/minify.js","@compodoc/compodoc":"1.1.21"},keywords:["grpc"],repository:{type:"git",url:"https://github.com/googleapis/gax-nodejs.git",directory:"gax"},author:"Google API Authors",license:"Apache-2.0",bugs:{url:"https://github.com/googleapis/gax-nodejs/issues"},homepage:"https://github.com/googleapis/gax-nodejs#readme",engines:{node:">=14"},browser:"build/src/fallback.js"}}});var require_operationsClient=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/operationsClient.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.OperationsClientBuilder=exports2.OperationsClient=exports2.ALL_SCOPES=exports2.SERVICE_ADDRESS=void 0;var createApiCall_1=require_createApiCall(),descriptor_1=require_descriptor(),gax=require_gax(),configData=require_operations_client_config(),operationProtoJson=require_operations2(),transcoding_1=require_transcoding();exports2.SERVICE_ADDRESS="longrunning.googleapis.com";var version2=require_package3().version,DEFAULT_SERVICE_PORT=443,CODE_GEN_NAME_VERSION="gapic/0.7.1";exports2.ALL_SCOPES=[];var OperationsClient=class{constructor(gaxGrpc,operationsProtos,options){let opts=Object.assign({servicePath:exports2.SERVICE_ADDRESS,port:DEFAULT_SERVICE_PORT,clientConfig:{}},options),googleApiClient=["gl-node/"+process.versions.node];opts.libName&&opts.libVersion&&googleApiClient.push(opts.libName+"/"+opts.libVersion),googleApiClient.push(CODE_GEN_NAME_VERSION,"gax/"+version2),opts.fallback?googleApiClient.push("gl-web/"+version2):googleApiClient.push("grpc/"+gaxGrpc.grpcVersion);let defaults=gaxGrpc.constructSettings("google.longrunning.Operations",configData,opts.clientConfig||{},{"x-goog-api-client":googleApiClient.join(" ")});this.auth=gaxGrpc.auth,this.innerApiCalls={},this.descriptor={listOperations:new descriptor_1.PageDescriptor("pageToken","nextPageToken","operations")},this.operationsStub=gaxGrpc.createStub(opts.fallback?operationsProtos.lookupService("google.longrunning.Operations"):operationsProtos.google.longrunning.Operations,opts);let operationsStubMethods=["getOperation","listOperations","cancelOperation","deleteOperation"];for(let methodName of operationsStubMethods){let innerCallPromise=this.operationsStub.then(stub=>(...args)=>stub[methodName].apply(stub,args),err=>()=>{throw err});this.innerApiCalls[methodName]=(0,createApiCall_1.createApiCall)(innerCallPromise,defaults[methodName],this.descriptor[methodName])}}close(){this.operationsStub.then(stub=>stub.close())}getProjectId(callback){if(this.auth&&"getProjectId"in this.auth)return this.auth.getProjectId(callback);if(callback)callback(new Error("Cannot determine project ID."));else return Promise.reject("Cannot determine project ID.")}getOperationInternal(request,options,callback){return request=request||{},options=options||{},this.innerApiCalls.getOperation(request,options,callback)}getOperation(request,optionsOrCallback,callback){let options;return optionsOrCallback instanceof Function&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,request=request||{},options=options||{},this.innerApiCalls.getOperation(request,options,callback)}listOperations(request,optionsOrCallback,callback){let options;return optionsOrCallback instanceof Function&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,request=request||{},options=options||{},this.innerApiCalls.listOperations(request,options,callback)}listOperationsStream(request,options){let callSettings=new gax.CallSettings(options);return this.descriptor.listOperations.createStream(this.innerApiCalls.listOperations,request,callSettings)}listOperationsAsync(request,options){request=request||{},options=options||{};let callSettings=new gax.CallSettings(options);return this.descriptor.listOperations.asyncIterate(this.innerApiCalls.listOperations,request,callSettings)}cancelOperation(request,optionsOrCallback,callback){let options;return optionsOrCallback instanceof Function&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,request=request||{},options=options||{},this.innerApiCalls.cancelOperation(request,options,callback)}deleteOperation(request,optionsOrCallback,callback){let options;return optionsOrCallback instanceof Function&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,request=request||{},options=options||{},this.innerApiCalls.deleteOperation(request,options,callback)}};__name(OperationsClient,"OperationsClient");exports2.OperationsClient=OperationsClient;var OperationsClientBuilder=class{constructor(gaxGrpc,protoJson){protoJson&&gaxGrpc.httpRules&&(0,transcoding_1.overrideHttpRules)(gaxGrpc.httpRules,protoJson);let operationsProtos=protoJson??gaxGrpc.loadProtoJSON(operationProtoJson);this.operationsClient=opts=>(gaxGrpc.fallback&&(opts.fallback=gaxGrpc.fallback),new OperationsClient(gaxGrpc,operationsProtos,opts)),Object.assign(this.operationsClient,OperationsClient)}};__name(OperationsClientBuilder,"OperationsClientBuilder");exports2.OperationsClientBuilder=OperationsClientBuilder}});var require_fallbackRest=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/fallbackRest.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.decodeResponse=exports2.encodeRequest=void 0;var serializer=require_src7(),fallback_1=require_fallback(),googleError_1=require_googleError(),transcoding_1=require_transcoding();function encodeRequest(rpc,protocol,servicePath,servicePort,request,numericEnums){let headers={"Content-Type":"application/json"},message=rpc.resolvedRequestType.fromObject(request),json=serializer.toProto3JSON(message,{numericEnums});if(!json)throw new Error(`Cannot send null request to RPC ${rpc.name}.`);if(typeof json!="object"||Array.isArray(json))throw new Error(`Request to RPC ${rpc.name} must be an object.`);let transcoded=(0,transcoding_1.transcode)(json,rpc.parsedOptions);if(!transcoded)throw new Error(`Cannot build HTTP request for ${JSON.stringify(json)}, method: ${rpc.name}`);numericEnums&&(transcoded.queryString=(transcoded.queryString?`${transcoded.queryString}&`:"")+"$alt=json%3Benum-encoding=int");let method=transcoded.httpMethod.toUpperCase(),body=JSON.stringify(transcoded.data),url=`${protocol}://${servicePath}:${servicePort}/${transcoded.url.replace(/^\//,"")}?${transcoded.queryString}`;return{method,url,headers,body}}__name(encodeRequest,"encodeRequest");exports2.encodeRequest=encodeRequest;function decodeResponse(rpc,ok,response){let decodedString=new TextDecoder().decode(response),json=JSON.parse(decodedString);if(!ok)throw googleError_1.GoogleError.parseHttpError(json);let message=serializer.fromProto3JSON(rpc.resolvedResponseType,json);if(!message)throw new Error(`Received null response from RPC ${rpc.name}`);return rpc.resolvedResponseType.toObject(message,fallback_1.defaultToObjectOptions)}__name(decodeResponse,"decodeResponse");exports2.decodeResponse=decodeResponse}});var require_event_target_shim=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/event-target-shim/dist/event-target-shim.js"(exports2,module2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});var privateData=new WeakMap,wrappers=new WeakMap;function pd(event){let retv=privateData.get(event);return console.assert(retv!=null,"'this' is expected an Event object, but got",event),retv}__name(pd,"pd");function setCancelFlag(data){if(data.passiveListener!=null){typeof console<"u"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",data.passiveListener);return}data.event.cancelable&&(data.canceled=!0,typeof data.event.preventDefault=="function"&&data.event.preventDefault())}__name(setCancelFlag,"setCancelFlag");function Event(eventTarget,event){privateData.set(this,{eventTarget,event,eventPhase:2,currentTarget:eventTarget,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:event.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let keys=Object.keys(event);for(let i=0;i0){let types=new Array(arguments.length);for(let i=0;i1&&(this._prevBlock=Buffer.concat([this._prevBlock,chunk.slice(objectStart,curIndex)])),callback()}_flush(callback){callback()}cancel(){this._done=!0,this.cancelRequested=!0,this.cancelController.abort(),this.end()}};__name(StreamArrayParser,"StreamArrayParser");exports2.StreamArrayParser=StreamArrayParser}});var require_fallbackServiceStub=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/fallbackServiceStub.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.generateServiceStub=void 0;var node_fetch_1=require_lib2(),abort_controller_1=require_abort_controller(),featureDetection_1=require_featureDetection(),streamArrayParser_1=require_streamArrayParser(),stream_1=require("stream");function generateServiceStub(rpcs,protocol,servicePath,servicePort,authClient,requestEncoder,responseDecoder,numericEnums){let fetch=(0,featureDetection_1.hasWindowFetch)()?window.fetch:node_fetch_1.default,serviceStub={close:()=>({cancel:()=>{}})};for(let[rpcName,rpc]of Object.entries(rpcs))serviceStub[rpcName]=(request,options,_metadata,callback)=>{options??(options={});let fetchParameters;try{fetchParameters=requestEncoder(rpc,protocol,servicePath,servicePort,request,numericEnums)}catch(err){return callback&&callback(err),{cancel(){}}}let cancelController=(0,featureDetection_1.hasAbortController)()?new AbortController:new abort_controller_1.AbortController,cancelSignal=cancelController.signal,cancelRequested=!1,url=fetchParameters.url,headers=fetchParameters.headers;for(let key of Object.keys(options))headers[key]=options[key][0];let streamArrayParser=new streamArrayParser_1.StreamArrayParser(rpc);return authClient.getRequestHeaders().then(authHeader=>{let fetchRequest={headers:{...authHeader,...headers},body:fetchParameters.body,method:fetchParameters.method,signal:cancelSignal};return(fetchParameters.method==="GET"||fetchParameters.method==="DELETE")&&delete fetchRequest.body,fetch(url,fetchRequest)}).then(response=>{if(response.ok&&rpc.responseStream){(0,stream_1.pipeline)(response.body,streamArrayParser,err=>{err&&(!cancelRequested||err instanceof Error&&err.name!=="AbortError")&&(callback&&callback(err),streamArrayParser.emit("error",err))});return}else return Promise.all([Promise.resolve(response.ok),response.arrayBuffer()]).then(([ok,buffer])=>{let response2=responseDecoder(rpc,ok,buffer);callback(null,response2)}).catch(err=>{if(!cancelRequested||err.name!=="AbortError")if(rpc.responseStream)callback&&callback(err),streamArrayParser.emit("error",err);else if(callback)callback(err);else throw err})}).catch(err=>{if(rpc.responseStream)callback&&callback(err),streamArrayParser.emit("error",err);else if(callback)callback(err);else throw err}),rpc.responseStream?streamArrayParser:{cancel:()=>{cancelRequested=!0,cancelController.abort()}}};return serviceStub}__name(generateServiceStub,"generateServiceStub");exports2.generateServiceStub=generateServiceStub}});var require_iam_service=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/protos/iam_service.js"(exports2,module2){(function(e){typeof define=="function"&&define.amd?define(["protobufjs/minimal"],e):typeof require=="function"&&typeof module2=="object"&&module2&&module2.exports&&(module2.exports=e(require_minimal2()))})(function(o){"use strict";var e,t,n,r,F,a=o.Reader,i=o.Writer,p=o.util,l=o.roots.iam_protos||(o.roots.iam_protos={});function B(e2,t2,n2){o.rpc.Service.call(this,e2,t2,n2)}__name(B,"B");function s(e2){if(e2)for(var t2=Object.keys(e2),n2=0;n2>>3){case 1:o2.resource=e2.string();break;case 2:o2.policy=l.google.iam.v1.Policy.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},s.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},s.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.resource!=null&&e2.hasOwnProperty("resource")&&!p.isString(e2.resource)?"resource: string expected":e2.policy!=null&&e2.hasOwnProperty("policy")&&(e2=l.google.iam.v1.Policy.verify(e2.policy),e2)?"policy."+e2:null},s.fromObject=function(e2){if(e2 instanceof l.google.iam.v1.SetIamPolicyRequest)return e2;var t2=new l.google.iam.v1.SetIamPolicyRequest;if(e2.resource!=null&&(t2.resource=String(e2.resource)),e2.policy!=null){if(typeof e2.policy!="object")throw TypeError(".google.iam.v1.SetIamPolicyRequest.policy: object expected");t2.policy=l.google.iam.v1.Policy.fromObject(e2.policy)}return t2},s.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.resource="",n2.policy=null),e2.resource!=null&&e2.hasOwnProperty("resource")&&(n2.resource=e2.resource),e2.policy!=null&&e2.hasOwnProperty("policy")&&(n2.policy=l.google.iam.v1.Policy.toObject(e2.policy,t2)),n2},s.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},s),t.GetIamPolicyRequest=(u.prototype.resource="",u.prototype.options=null,u.create=function(e2){return new u(e2)},u.encode=function(e2,t2){return t2=t2||i.create(),e2.resource!=null&&Object.hasOwnProperty.call(e2,"resource")&&t2.uint32(10).string(e2.resource),e2.options!=null&&Object.hasOwnProperty.call(e2,"options")&&l.google.iam.v1.GetPolicyOptions.encode(e2.options,t2.uint32(18).fork()).ldelim(),t2},u.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},u.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new l.google.iam.v1.GetIamPolicyRequest;e2.pos>>3){case 1:o2.resource=e2.string();break;case 2:o2.options=l.google.iam.v1.GetPolicyOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},u.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},u.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.resource!=null&&e2.hasOwnProperty("resource")&&!p.isString(e2.resource)?"resource: string expected":e2.options!=null&&e2.hasOwnProperty("options")&&(e2=l.google.iam.v1.GetPolicyOptions.verify(e2.options),e2)?"options."+e2:null},u.fromObject=function(e2){if(e2 instanceof l.google.iam.v1.GetIamPolicyRequest)return e2;var t2=new l.google.iam.v1.GetIamPolicyRequest;if(e2.resource!=null&&(t2.resource=String(e2.resource)),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.iam.v1.GetIamPolicyRequest.options: object expected");t2.options=l.google.iam.v1.GetPolicyOptions.fromObject(e2.options)}return t2},u.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.resource="",n2.options=null),e2.resource!=null&&e2.hasOwnProperty("resource")&&(n2.resource=e2.resource),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=l.google.iam.v1.GetPolicyOptions.toObject(e2.options,t2)),n2},u.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},u),t.TestIamPermissionsRequest=(c.prototype.resource="",c.prototype.permissions=p.emptyArray,c.create=function(e2){return new c(e2)},c.encode=function(e2,t2){if(t2=t2||i.create(),e2.resource!=null&&Object.hasOwnProperty.call(e2,"resource")&&t2.uint32(10).string(e2.resource),e2.permissions!=null&&e2.permissions.length)for(var n2=0;n2>>3){case 1:o2.resource=e2.string();break;case 2:o2.permissions&&o2.permissions.length||(o2.permissions=[]),o2.permissions.push(e2.string());break;default:e2.skipType(7&r2)}}return o2},c.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},c.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.resource!=null&&e2.hasOwnProperty("resource")&&!p.isString(e2.resource))return"resource: string expected";if(e2.permissions!=null&&e2.hasOwnProperty("permissions")){if(!Array.isArray(e2.permissions))return"permissions: array expected";for(var t2=0;t2>>3==1?(o2.permissions&&o2.permissions.length||(o2.permissions=[]),o2.permissions.push(e2.string())):e2.skipType(7&r2)}return o2},G.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},G.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.permissions!=null&&e2.hasOwnProperty("permissions")){if(!Array.isArray(e2.permissions))return"permissions: array expected";for(var t2=0;t2>>3==1?o2.requestedPolicyVersion=e2.int32():e2.skipType(7&r2)}return o2},U.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},U.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.requestedPolicyVersion!=null&&e2.hasOwnProperty("requestedPolicyVersion")&&!p.isInteger(e2.requestedPolicyVersion)?"requestedPolicyVersion: integer expected":null},U.fromObject=function(e2){var t2;return e2 instanceof l.google.iam.v1.GetPolicyOptions?e2:(t2=new l.google.iam.v1.GetPolicyOptions,e2.requestedPolicyVersion!=null&&(t2.requestedPolicyVersion=0|e2.requestedPolicyVersion),t2)},U.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.requestedPolicyVersion=0),e2.requestedPolicyVersion!=null&&e2.hasOwnProperty("requestedPolicyVersion")&&(n2.requestedPolicyVersion=e2.requestedPolicyVersion),n2},U.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},U),t.Policy=(d.prototype.version=0,d.prototype.bindings=p.emptyArray,d.prototype.etag=p.newBuffer([]),d.create=function(e2){return new d(e2)},d.encode=function(e2,t2){if(t2=t2||i.create(),e2.version!=null&&Object.hasOwnProperty.call(e2,"version")&&t2.uint32(8).int32(e2.version),e2.etag!=null&&Object.hasOwnProperty.call(e2,"etag")&&t2.uint32(26).bytes(e2.etag),e2.bindings!=null&&e2.bindings.length)for(var n2=0;n2>>3){case 1:o2.version=e2.int32();break;case 4:o2.bindings&&o2.bindings.length||(o2.bindings=[]),o2.bindings.push(l.google.iam.v1.Binding.decode(e2,e2.uint32()));break;case 3:o2.etag=e2.bytes();break;default:e2.skipType(7&r2)}}return o2},d.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},d.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.version!=null&&e2.hasOwnProperty("version")&&!p.isInteger(e2.version))return"version: integer expected";if(e2.bindings!=null&&e2.hasOwnProperty("bindings")){if(!Array.isArray(e2.bindings))return"bindings: array expected";for(var t2=0;t2>>3){case 1:o2.role=e2.string();break;case 2:o2.members&&o2.members.length||(o2.members=[]),o2.members.push(e2.string());break;case 3:o2.condition=l.google.type.Expr.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},g.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},g.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.role!=null&&e2.hasOwnProperty("role")&&!p.isString(e2.role))return"role: string expected";if(e2.members!=null&&e2.hasOwnProperty("members")){if(!Array.isArray(e2.members))return"members: array expected";for(var t2=0;t2>>3){case 1:o2.bindingDeltas&&o2.bindingDeltas.length||(o2.bindingDeltas=[]),o2.bindingDeltas.push(l.google.iam.v1.BindingDelta.decode(e2,e2.uint32()));break;case 2:o2.auditConfigDeltas&&o2.auditConfigDeltas.length||(o2.auditConfigDeltas=[]),o2.auditConfigDeltas.push(l.google.iam.v1.AuditConfigDelta.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},M.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},M.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.bindingDeltas!=null&&e2.hasOwnProperty("bindingDeltas")){if(!Array.isArray(e2.bindingDeltas))return"bindingDeltas: array expected";for(var t2=0;t2>>3){case 1:o2.action=e2.int32();break;case 2:o2.role=e2.string();break;case 3:o2.member=e2.string();break;case 4:o2.condition=l.google.type.Expr.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},f.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},f.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.action!=null&&e2.hasOwnProperty("action"))switch(e2.action){default:return"action: enum value expected";case 0:case 1:case 2:}return e2.role!=null&&e2.hasOwnProperty("role")&&!p.isString(e2.role)?"role: string expected":e2.member!=null&&e2.hasOwnProperty("member")&&!p.isString(e2.member)?"member: string expected":e2.condition!=null&&e2.hasOwnProperty("condition")&&(e2=l.google.type.Expr.verify(e2.condition),e2)?"condition."+e2:null},f.fromObject=function(e2){if(e2 instanceof l.google.iam.v1.BindingDelta)return e2;var t2=new l.google.iam.v1.BindingDelta;switch(e2.action){case"ACTION_UNSPECIFIED":case 0:t2.action=0;break;case"ADD":case 1:t2.action=1;break;case"REMOVE":case 2:t2.action=2}if(e2.role!=null&&(t2.role=String(e2.role)),e2.member!=null&&(t2.member=String(e2.member)),e2.condition!=null){if(typeof e2.condition!="object")throw TypeError(".google.iam.v1.BindingDelta.condition: object expected");t2.condition=l.google.type.Expr.fromObject(e2.condition)}return t2},f.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.action=t2.enums===String?"ACTION_UNSPECIFIED":0,n2.role="",n2.member="",n2.condition=null),e2.action!=null&&e2.hasOwnProperty("action")&&(n2.action=t2.enums===String?l.google.iam.v1.BindingDelta.Action[e2.action]:e2.action),e2.role!=null&&e2.hasOwnProperty("role")&&(n2.role=e2.role),e2.member!=null&&e2.hasOwnProperty("member")&&(n2.member=e2.member),e2.condition!=null&&e2.hasOwnProperty("condition")&&(n2.condition=l.google.type.Expr.toObject(e2.condition,t2)),n2},f.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},f.Action=(e={},(r=Object.create(e))[e[0]="ACTION_UNSPECIFIED"]=0,r[e[1]="ADD"]=1,r[e[2]="REMOVE"]=2,r),f),t.AuditConfigDelta=(y.prototype.action=0,y.prototype.service="",y.prototype.exemptedMember="",y.prototype.logType="",y.create=function(e2){return new y(e2)},y.encode=function(e2,t2){return t2=t2||i.create(),e2.action!=null&&Object.hasOwnProperty.call(e2,"action")&&t2.uint32(8).int32(e2.action),e2.service!=null&&Object.hasOwnProperty.call(e2,"service")&&t2.uint32(18).string(e2.service),e2.exemptedMember!=null&&Object.hasOwnProperty.call(e2,"exemptedMember")&&t2.uint32(26).string(e2.exemptedMember),e2.logType!=null&&Object.hasOwnProperty.call(e2,"logType")&&t2.uint32(34).string(e2.logType),t2},y.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},y.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new l.google.iam.v1.AuditConfigDelta;e2.pos>>3){case 1:o2.action=e2.int32();break;case 2:o2.service=e2.string();break;case 3:o2.exemptedMember=e2.string();break;case 4:o2.logType=e2.string();break;default:e2.skipType(7&r2)}}return o2},y.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},y.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.action!=null&&e2.hasOwnProperty("action"))switch(e2.action){default:return"action: enum value expected";case 0:case 1:case 2:}return e2.service!=null&&e2.hasOwnProperty("service")&&!p.isString(e2.service)?"service: string expected":e2.exemptedMember!=null&&e2.hasOwnProperty("exemptedMember")&&!p.isString(e2.exemptedMember)?"exemptedMember: string expected":e2.logType!=null&&e2.hasOwnProperty("logType")&&!p.isString(e2.logType)?"logType: string expected":null},y.fromObject=function(e2){if(e2 instanceof l.google.iam.v1.AuditConfigDelta)return e2;var t2=new l.google.iam.v1.AuditConfigDelta;switch(e2.action){case"ACTION_UNSPECIFIED":case 0:t2.action=0;break;case"ADD":case 1:t2.action=1;break;case"REMOVE":case 2:t2.action=2}return e2.service!=null&&(t2.service=String(e2.service)),e2.exemptedMember!=null&&(t2.exemptedMember=String(e2.exemptedMember)),e2.logType!=null&&(t2.logType=String(e2.logType)),t2},y.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.action=t2.enums===String?"ACTION_UNSPECIFIED":0,n2.service="",n2.exemptedMember="",n2.logType=""),e2.action!=null&&e2.hasOwnProperty("action")&&(n2.action=t2.enums===String?l.google.iam.v1.AuditConfigDelta.Action[e2.action]:e2.action),e2.service!=null&&e2.hasOwnProperty("service")&&(n2.service=e2.service),e2.exemptedMember!=null&&e2.hasOwnProperty("exemptedMember")&&(n2.exemptedMember=e2.exemptedMember),e2.logType!=null&&e2.hasOwnProperty("logType")&&(n2.logType=e2.logType),n2},y.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},y.Action=(e={},(r=Object.create(e))[e[0]="ACTION_UNSPECIFIED"]=0,r[e[1]="ADD"]=1,r[e[2]="REMOVE"]=2,r),y),t.logging=((e={}).AuditData=(L.prototype.policyDelta=null,L.create=function(e2){return new L(e2)},L.encode=function(e2,t2){return t2=t2||i.create(),e2.policyDelta!=null&&Object.hasOwnProperty.call(e2,"policyDelta")&&l.google.iam.v1.PolicyDelta.encode(e2.policyDelta,t2.uint32(18).fork()).ldelim(),t2},L.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},L.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new l.google.iam.v1.logging.AuditData;e2.pos>>3==2?o2.policyDelta=l.google.iam.v1.PolicyDelta.decode(e2,e2.uint32()):e2.skipType(7&r2)}return o2},L.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},L.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.policyDelta!=null&&e2.hasOwnProperty("policyDelta")&&(e2=l.google.iam.v1.PolicyDelta.verify(e2.policyDelta),e2)?"policyDelta."+e2:null},L.fromObject=function(e2){if(e2 instanceof l.google.iam.v1.logging.AuditData)return e2;var t2=new l.google.iam.v1.logging.AuditData;if(e2.policyDelta!=null){if(typeof e2.policyDelta!="object")throw TypeError(".google.iam.v1.logging.AuditData.policyDelta: object expected");t2.policyDelta=l.google.iam.v1.PolicyDelta.fromObject(e2.policyDelta)}return t2},L.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.policyDelta=null),e2.policyDelta!=null&&e2.hasOwnProperty("policyDelta")&&(n2.policyDelta=l.google.iam.v1.PolicyDelta.toObject(e2.policyDelta,t2)),n2},L.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},L),e),t),n),F.api=((r={}).Http=(J.prototype.rules=p.emptyArray,J.prototype.fullyDecodeReservedExpansion=!1,J.create=function(e2){return new J(e2)},J.encode=function(e2,t2){if(t2=t2||i.create(),e2.rules!=null&&e2.rules.length)for(var n2=0;n2>>3){case 1:o2.rules&&o2.rules.length||(o2.rules=[]),o2.rules.push(l.google.api.HttpRule.decode(e2,e2.uint32()));break;case 2:o2.fullyDecodeReservedExpansion=e2.bool();break;default:e2.skipType(7&r2)}}return o2},J.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},J.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.rules!=null&&e2.hasOwnProperty("rules")){if(!Array.isArray(e2.rules))return"rules: array expected";for(var t2=0;t2>>3){case 1:o2.selector=e2.string();break;case 2:o2.get=e2.string();break;case 3:o2.put=e2.string();break;case 4:o2.post=e2.string();break;case 5:o2.delete=e2.string();break;case 6:o2.patch=e2.string();break;case 8:o2.custom=l.google.api.CustomHttpPattern.decode(e2,e2.uint32());break;case 7:o2.body=e2.string();break;case 12:o2.responseBody=e2.string();break;case 11:o2.additionalBindings&&o2.additionalBindings.length||(o2.additionalBindings=[]),o2.additionalBindings.push(l.google.api.HttpRule.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},h.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},h.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";var t2={};if(e2.selector!=null&&e2.hasOwnProperty("selector")&&!p.isString(e2.selector))return"selector: string expected";if(e2.get!=null&&e2.hasOwnProperty("get")&&(t2.pattern=1,!p.isString(e2.get)))return"get: string expected";if(e2.put!=null&&e2.hasOwnProperty("put")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,!p.isString(e2.put))return"put: string expected"}if(e2.post!=null&&e2.hasOwnProperty("post")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,!p.isString(e2.post))return"post: string expected"}if(e2.delete!=null&&e2.hasOwnProperty("delete")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,!p.isString(e2.delete))return"delete: string expected"}if(e2.patch!=null&&e2.hasOwnProperty("patch")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,!p.isString(e2.patch))return"patch: string expected"}if(e2.custom!=null&&e2.hasOwnProperty("custom")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,n2=l.google.api.CustomHttpPattern.verify(e2.custom))return"custom."+n2}if(e2.body!=null&&e2.hasOwnProperty("body")&&!p.isString(e2.body))return"body: string expected";if(e2.responseBody!=null&&e2.hasOwnProperty("responseBody")&&!p.isString(e2.responseBody))return"responseBody: string expected";if(e2.additionalBindings!=null&&e2.hasOwnProperty("additionalBindings")){if(!Array.isArray(e2.additionalBindings))return"additionalBindings: array expected";for(var n2,o2=0;o2>>3){case 1:o2.kind=e2.string();break;case 2:o2.path=e2.string();break;default:e2.skipType(7&r2)}}return o2},_.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},_.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.kind!=null&&e2.hasOwnProperty("kind")&&!p.isString(e2.kind)?"kind: string expected":e2.path!=null&&e2.hasOwnProperty("path")&&!p.isString(e2.path)?"path: string expected":null},_.fromObject=function(e2){var t2;return e2 instanceof l.google.api.CustomHttpPattern?e2:(t2=new l.google.api.CustomHttpPattern,e2.kind!=null&&(t2.kind=String(e2.kind)),e2.path!=null&&(t2.path=String(e2.path)),t2)},_.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.kind="",n2.path=""),e2.kind!=null&&e2.hasOwnProperty("kind")&&(n2.kind=e2.kind),e2.path!=null&&e2.hasOwnProperty("path")&&(n2.path=e2.path),n2},_.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},_),r.FieldBehavior=(e={},(t=Object.create(e))[e[0]="FIELD_BEHAVIOR_UNSPECIFIED"]=0,t[e[1]="OPTIONAL"]=1,t[e[2]="REQUIRED"]=2,t[e[3]="OUTPUT_ONLY"]=3,t[e[4]="INPUT_ONLY"]=4,t[e[5]="IMMUTABLE"]=5,t),r.ResourceDescriptor=(b.prototype.type="",b.prototype.pattern=p.emptyArray,b.prototype.nameField="",b.prototype.history=0,b.prototype.plural="",b.prototype.singular="",b.create=function(e2){return new b(e2)},b.encode=function(e2,t2){if(t2=t2||i.create(),e2.type!=null&&Object.hasOwnProperty.call(e2,"type")&&t2.uint32(10).string(e2.type),e2.pattern!=null&&e2.pattern.length)for(var n2=0;n2>>3){case 1:o2.type=e2.string();break;case 2:o2.pattern&&o2.pattern.length||(o2.pattern=[]),o2.pattern.push(e2.string());break;case 3:o2.nameField=e2.string();break;case 4:o2.history=e2.int32();break;case 5:o2.plural=e2.string();break;case 6:o2.singular=e2.string();break;default:e2.skipType(7&r2)}}return o2},b.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},b.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.type!=null&&e2.hasOwnProperty("type")&&!p.isString(e2.type))return"type: string expected";if(e2.pattern!=null&&e2.hasOwnProperty("pattern")){if(!Array.isArray(e2.pattern))return"pattern: array expected";for(var t2=0;t2>>3){case 1:o2.type=e2.string();break;case 2:o2.childType=e2.string();break;default:e2.skipType(7&r2)}}return o2},H.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},H.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.type!=null&&e2.hasOwnProperty("type")&&!p.isString(e2.type)?"type: string expected":e2.childType!=null&&e2.hasOwnProperty("childType")&&!p.isString(e2.childType)?"childType: string expected":null},H.fromObject=function(e2){var t2;return e2 instanceof l.google.api.ResourceReference?e2:(t2=new l.google.api.ResourceReference,e2.type!=null&&(t2.type=String(e2.type)),e2.childType!=null&&(t2.childType=String(e2.childType)),t2)},H.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.type="",n2.childType=""),e2.type!=null&&e2.hasOwnProperty("type")&&(n2.type=e2.type),e2.childType!=null&&e2.hasOwnProperty("childType")&&(n2.childType=e2.childType),n2},H.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},H),r),F.protobuf=((n={}).FileDescriptorSet=(q.prototype.file=p.emptyArray,q.create=function(e2){return new q(e2)},q.encode=function(e2,t2){if(t2=t2||i.create(),e2.file!=null&&e2.file.length)for(var n2=0;n2>>3==1?(o2.file&&o2.file.length||(o2.file=[]),o2.file.push(l.google.protobuf.FileDescriptorProto.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},q.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},q.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.file!=null&&e2.hasOwnProperty("file")){if(!Array.isArray(e2.file))return"file: array expected";for(var t2=0;t2>>3){case 1:o2.name=e2.string();break;case 2:o2.package=e2.string();break;case 3:o2.dependency&&o2.dependency.length||(o2.dependency=[]),o2.dependency.push(e2.string());break;case 10:if(o2.publicDependency&&o2.publicDependency.length||(o2.publicDependency=[]),(7&r2)==2)for(var i2=e2.uint32()+e2.pos;e2.pos>>3){case 1:o2.name=e2.string();break;case 2:o2.field&&o2.field.length||(o2.field=[]),o2.field.push(l.google.protobuf.FieldDescriptorProto.decode(e2,e2.uint32()));break;case 6:o2.extension&&o2.extension.length||(o2.extension=[]),o2.extension.push(l.google.protobuf.FieldDescriptorProto.decode(e2,e2.uint32()));break;case 3:o2.nestedType&&o2.nestedType.length||(o2.nestedType=[]),o2.nestedType.push(l.google.protobuf.DescriptorProto.decode(e2,e2.uint32()));break;case 4:o2.enumType&&o2.enumType.length||(o2.enumType=[]),o2.enumType.push(l.google.protobuf.EnumDescriptorProto.decode(e2,e2.uint32()));break;case 5:o2.extensionRange&&o2.extensionRange.length||(o2.extensionRange=[]),o2.extensionRange.push(l.google.protobuf.DescriptorProto.ExtensionRange.decode(e2,e2.uint32()));break;case 8:o2.oneofDecl&&o2.oneofDecl.length||(o2.oneofDecl=[]),o2.oneofDecl.push(l.google.protobuf.OneofDescriptorProto.decode(e2,e2.uint32()));break;case 7:o2.options=l.google.protobuf.MessageOptions.decode(e2,e2.uint32());break;case 9:o2.reservedRange&&o2.reservedRange.length||(o2.reservedRange=[]),o2.reservedRange.push(l.google.protobuf.DescriptorProto.ReservedRange.decode(e2,e2.uint32()));break;case 10:o2.reservedName&&o2.reservedName.length||(o2.reservedName=[]),o2.reservedName.push(e2.string());break;default:e2.skipType(7&r2)}}return o2},O.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},O.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!p.isString(e2.name))return"name: string expected";if(e2.field!=null&&e2.hasOwnProperty("field")){if(!Array.isArray(e2.field))return"field: array expected";for(var t2=0;t2>>3){case 1:o2.start=e2.int32();break;case 2:o2.end=e2.int32();break;case 3:o2.options=l.google.protobuf.ExtensionRangeOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},v.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},v.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.start!=null&&e2.hasOwnProperty("start")&&!p.isInteger(e2.start)?"start: integer expected":e2.end!=null&&e2.hasOwnProperty("end")&&!p.isInteger(e2.end)?"end: integer expected":e2.options!=null&&e2.hasOwnProperty("options")&&(e2=l.google.protobuf.ExtensionRangeOptions.verify(e2.options),e2)?"options."+e2:null},v.fromObject=function(e2){if(e2 instanceof l.google.protobuf.DescriptorProto.ExtensionRange)return e2;var t2=new l.google.protobuf.DescriptorProto.ExtensionRange;if(e2.start!=null&&(t2.start=0|e2.start),e2.end!=null&&(t2.end=0|e2.end),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected");t2.options=l.google.protobuf.ExtensionRangeOptions.fromObject(e2.options)}return t2},v.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.start=0,n2.end=0,n2.options=null),e2.start!=null&&e2.hasOwnProperty("start")&&(n2.start=e2.start),e2.end!=null&&e2.hasOwnProperty("end")&&(n2.end=e2.end),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=l.google.protobuf.ExtensionRangeOptions.toObject(e2.options,t2)),n2},v.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},v),O.ReservedRange=(Y.prototype.start=0,Y.prototype.end=0,Y.create=function(e2){return new Y(e2)},Y.encode=function(e2,t2){return t2=t2||i.create(),e2.start!=null&&Object.hasOwnProperty.call(e2,"start")&&t2.uint32(8).int32(e2.start),e2.end!=null&&Object.hasOwnProperty.call(e2,"end")&&t2.uint32(16).int32(e2.end),t2},Y.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},Y.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new l.google.protobuf.DescriptorProto.ReservedRange;e2.pos>>3){case 1:o2.start=e2.int32();break;case 2:o2.end=e2.int32();break;default:e2.skipType(7&r2)}}return o2},Y.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},Y.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.start!=null&&e2.hasOwnProperty("start")&&!p.isInteger(e2.start)?"start: integer expected":e2.end!=null&&e2.hasOwnProperty("end")&&!p.isInteger(e2.end)?"end: integer expected":null},Y.fromObject=function(e2){var t2;return e2 instanceof l.google.protobuf.DescriptorProto.ReservedRange?e2:(t2=new l.google.protobuf.DescriptorProto.ReservedRange,e2.start!=null&&(t2.start=0|e2.start),e2.end!=null&&(t2.end=0|e2.end),t2)},Y.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.start=0,n2.end=0),e2.start!=null&&e2.hasOwnProperty("start")&&(n2.start=e2.start),e2.end!=null&&e2.hasOwnProperty("end")&&(n2.end=e2.end),n2},Y.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},Y),O),n.ExtensionRangeOptions=(z.prototype.uninterpretedOption=p.emptyArray,z.create=function(e2){return new z(e2)},z.encode=function(e2,t2){if(t2=t2||i.create(),e2.uninterpretedOption!=null&&e2.uninterpretedOption.length)for(var n2=0;n2>>3==999?(o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},z.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},z.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 1:o2.name=e2.string();break;case 3:o2.number=e2.int32();break;case 4:o2.label=e2.int32();break;case 5:o2.type=e2.int32();break;case 6:o2.typeName=e2.string();break;case 2:o2.extendee=e2.string();break;case 7:o2.defaultValue=e2.string();break;case 9:o2.oneofIndex=e2.int32();break;case 10:o2.jsonName=e2.string();break;case 8:o2.options=l.google.protobuf.FieldOptions.decode(e2,e2.uint32());break;case 17:o2.proto3Optional=e2.bool();break;default:e2.skipType(7&r2)}}return o2},P.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},P.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!p.isString(e2.name))return"name: string expected";if(e2.number!=null&&e2.hasOwnProperty("number")&&!p.isInteger(e2.number))return"number: integer expected";if(e2.label!=null&&e2.hasOwnProperty("label"))switch(e2.label){default:return"label: enum value expected";case 1:case 2:case 3:}if(e2.type!=null&&e2.hasOwnProperty("type"))switch(e2.type){default:return"type: enum value expected";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:}if(e2.typeName!=null&&e2.hasOwnProperty("typeName")&&!p.isString(e2.typeName))return"typeName: string expected";if(e2.extendee!=null&&e2.hasOwnProperty("extendee")&&!p.isString(e2.extendee))return"extendee: string expected";if(e2.defaultValue!=null&&e2.hasOwnProperty("defaultValue")&&!p.isString(e2.defaultValue))return"defaultValue: string expected";if(e2.oneofIndex!=null&&e2.hasOwnProperty("oneofIndex")&&!p.isInteger(e2.oneofIndex))return"oneofIndex: integer expected";if(e2.jsonName!=null&&e2.hasOwnProperty("jsonName")&&!p.isString(e2.jsonName))return"jsonName: string expected";if(e2.options!=null&&e2.hasOwnProperty("options")){var t2=l.google.protobuf.FieldOptions.verify(e2.options);if(t2)return"options."+t2}return e2.proto3Optional!=null&&e2.hasOwnProperty("proto3Optional")&&typeof e2.proto3Optional!="boolean"?"proto3Optional: boolean expected":null},P.fromObject=function(e2){if(e2 instanceof l.google.protobuf.FieldDescriptorProto)return e2;var t2=new l.google.protobuf.FieldDescriptorProto;switch(e2.name!=null&&(t2.name=String(e2.name)),e2.number!=null&&(t2.number=0|e2.number),e2.label){case"LABEL_OPTIONAL":case 1:t2.label=1;break;case"LABEL_REQUIRED":case 2:t2.label=2;break;case"LABEL_REPEATED":case 3:t2.label=3}switch(e2.type){case"TYPE_DOUBLE":case 1:t2.type=1;break;case"TYPE_FLOAT":case 2:t2.type=2;break;case"TYPE_INT64":case 3:t2.type=3;break;case"TYPE_UINT64":case 4:t2.type=4;break;case"TYPE_INT32":case 5:t2.type=5;break;case"TYPE_FIXED64":case 6:t2.type=6;break;case"TYPE_FIXED32":case 7:t2.type=7;break;case"TYPE_BOOL":case 8:t2.type=8;break;case"TYPE_STRING":case 9:t2.type=9;break;case"TYPE_GROUP":case 10:t2.type=10;break;case"TYPE_MESSAGE":case 11:t2.type=11;break;case"TYPE_BYTES":case 12:t2.type=12;break;case"TYPE_UINT32":case 13:t2.type=13;break;case"TYPE_ENUM":case 14:t2.type=14;break;case"TYPE_SFIXED32":case 15:t2.type=15;break;case"TYPE_SFIXED64":case 16:t2.type=16;break;case"TYPE_SINT32":case 17:t2.type=17;break;case"TYPE_SINT64":case 18:t2.type=18}if(e2.typeName!=null&&(t2.typeName=String(e2.typeName)),e2.extendee!=null&&(t2.extendee=String(e2.extendee)),e2.defaultValue!=null&&(t2.defaultValue=String(e2.defaultValue)),e2.oneofIndex!=null&&(t2.oneofIndex=0|e2.oneofIndex),e2.jsonName!=null&&(t2.jsonName=String(e2.jsonName)),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected");t2.options=l.google.protobuf.FieldOptions.fromObject(e2.options)}return e2.proto3Optional!=null&&(t2.proto3Optional=!!e2.proto3Optional),t2},P.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.extendee="",n2.number=0,n2.label=t2.enums===String?"LABEL_OPTIONAL":1,n2.type=t2.enums===String?"TYPE_DOUBLE":1,n2.typeName="",n2.defaultValue="",n2.options=null,n2.oneofIndex=0,n2.jsonName="",n2.proto3Optional=!1),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.extendee!=null&&e2.hasOwnProperty("extendee")&&(n2.extendee=e2.extendee),e2.number!=null&&e2.hasOwnProperty("number")&&(n2.number=e2.number),e2.label!=null&&e2.hasOwnProperty("label")&&(n2.label=t2.enums===String?l.google.protobuf.FieldDescriptorProto.Label[e2.label]:e2.label),e2.type!=null&&e2.hasOwnProperty("type")&&(n2.type=t2.enums===String?l.google.protobuf.FieldDescriptorProto.Type[e2.type]:e2.type),e2.typeName!=null&&e2.hasOwnProperty("typeName")&&(n2.typeName=e2.typeName),e2.defaultValue!=null&&e2.hasOwnProperty("defaultValue")&&(n2.defaultValue=e2.defaultValue),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=l.google.protobuf.FieldOptions.toObject(e2.options,t2)),e2.oneofIndex!=null&&e2.hasOwnProperty("oneofIndex")&&(n2.oneofIndex=e2.oneofIndex),e2.jsonName!=null&&e2.hasOwnProperty("jsonName")&&(n2.jsonName=e2.jsonName),e2.proto3Optional!=null&&e2.hasOwnProperty("proto3Optional")&&(n2.proto3Optional=e2.proto3Optional),n2},P.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},P.Type=(e={},(t=Object.create(e))[e[1]="TYPE_DOUBLE"]=1,t[e[2]="TYPE_FLOAT"]=2,t[e[3]="TYPE_INT64"]=3,t[e[4]="TYPE_UINT64"]=4,t[e[5]="TYPE_INT32"]=5,t[e[6]="TYPE_FIXED64"]=6,t[e[7]="TYPE_FIXED32"]=7,t[e[8]="TYPE_BOOL"]=8,t[e[9]="TYPE_STRING"]=9,t[e[10]="TYPE_GROUP"]=10,t[e[11]="TYPE_MESSAGE"]=11,t[e[12]="TYPE_BYTES"]=12,t[e[13]="TYPE_UINT32"]=13,t[e[14]="TYPE_ENUM"]=14,t[e[15]="TYPE_SFIXED32"]=15,t[e[16]="TYPE_SFIXED64"]=16,t[e[17]="TYPE_SINT32"]=17,t[e[18]="TYPE_SINT64"]=18,t),P.Label=(e={},(t=Object.create(e))[e[1]="LABEL_OPTIONAL"]=1,t[e[2]="LABEL_REQUIRED"]=2,t[e[3]="LABEL_REPEATED"]=3,t),P),n.OneofDescriptorProto=(W.prototype.name="",W.prototype.options=null,W.create=function(e2){return new W(e2)},W.encode=function(e2,t2){return t2=t2||i.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.options!=null&&Object.hasOwnProperty.call(e2,"options")&&l.google.protobuf.OneofOptions.encode(e2.options,t2.uint32(18).fork()).ldelim(),t2},W.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},W.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new l.google.protobuf.OneofDescriptorProto;e2.pos>>3){case 1:o2.name=e2.string();break;case 2:o2.options=l.google.protobuf.OneofOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},W.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},W.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!p.isString(e2.name)?"name: string expected":e2.options!=null&&e2.hasOwnProperty("options")&&(e2=l.google.protobuf.OneofOptions.verify(e2.options),e2)?"options."+e2:null},W.fromObject=function(e2){if(e2 instanceof l.google.protobuf.OneofDescriptorProto)return e2;var t2=new l.google.protobuf.OneofDescriptorProto;if(e2.name!=null&&(t2.name=String(e2.name)),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected");t2.options=l.google.protobuf.OneofOptions.fromObject(e2.options)}return t2},W.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.options=null),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=l.google.protobuf.OneofOptions.toObject(e2.options,t2)),n2},W.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},W),n.EnumDescriptorProto=(w.prototype.name="",w.prototype.value=p.emptyArray,w.prototype.options=null,w.prototype.reservedRange=p.emptyArray,w.prototype.reservedName=p.emptyArray,w.create=function(e2){return new w(e2)},w.encode=function(e2,t2){if(t2=t2||i.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.value!=null&&e2.value.length)for(var n2=0;n2>>3){case 1:o2.name=e2.string();break;case 2:o2.value&&o2.value.length||(o2.value=[]),o2.value.push(l.google.protobuf.EnumValueDescriptorProto.decode(e2,e2.uint32()));break;case 3:o2.options=l.google.protobuf.EnumOptions.decode(e2,e2.uint32());break;case 4:o2.reservedRange&&o2.reservedRange.length||(o2.reservedRange=[]),o2.reservedRange.push(l.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(e2,e2.uint32()));break;case 5:o2.reservedName&&o2.reservedName.length||(o2.reservedName=[]),o2.reservedName.push(e2.string());break;default:e2.skipType(7&r2)}}return o2},w.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},w.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!p.isString(e2.name))return"name: string expected";if(e2.value!=null&&e2.hasOwnProperty("value")){if(!Array.isArray(e2.value))return"value: array expected";for(var t2=0;t2>>3){case 1:o2.start=e2.int32();break;case 2:o2.end=e2.int32();break;default:e2.skipType(7&r2)}}return o2},X.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},X.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.start!=null&&e2.hasOwnProperty("start")&&!p.isInteger(e2.start)?"start: integer expected":e2.end!=null&&e2.hasOwnProperty("end")&&!p.isInteger(e2.end)?"end: integer expected":null},X.fromObject=function(e2){var t2;return e2 instanceof l.google.protobuf.EnumDescriptorProto.EnumReservedRange?e2:(t2=new l.google.protobuf.EnumDescriptorProto.EnumReservedRange,e2.start!=null&&(t2.start=0|e2.start),e2.end!=null&&(t2.end=0|e2.end),t2)},X.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.start=0,n2.end=0),e2.start!=null&&e2.hasOwnProperty("start")&&(n2.start=e2.start),e2.end!=null&&e2.hasOwnProperty("end")&&(n2.end=e2.end),n2},X.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},X),w),n.EnumValueDescriptorProto=(j.prototype.name="",j.prototype.number=0,j.prototype.options=null,j.create=function(e2){return new j(e2)},j.encode=function(e2,t2){return t2=t2||i.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.number!=null&&Object.hasOwnProperty.call(e2,"number")&&t2.uint32(16).int32(e2.number),e2.options!=null&&Object.hasOwnProperty.call(e2,"options")&&l.google.protobuf.EnumValueOptions.encode(e2.options,t2.uint32(26).fork()).ldelim(),t2},j.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},j.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new l.google.protobuf.EnumValueDescriptorProto;e2.pos>>3){case 1:o2.name=e2.string();break;case 2:o2.number=e2.int32();break;case 3:o2.options=l.google.protobuf.EnumValueOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},j.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},j.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!p.isString(e2.name)?"name: string expected":e2.number!=null&&e2.hasOwnProperty("number")&&!p.isInteger(e2.number)?"number: integer expected":e2.options!=null&&e2.hasOwnProperty("options")&&(e2=l.google.protobuf.EnumValueOptions.verify(e2.options),e2)?"options."+e2:null},j.fromObject=function(e2){if(e2 instanceof l.google.protobuf.EnumValueDescriptorProto)return e2;var t2=new l.google.protobuf.EnumValueDescriptorProto;if(e2.name!=null&&(t2.name=String(e2.name)),e2.number!=null&&(t2.number=0|e2.number),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected");t2.options=l.google.protobuf.EnumValueOptions.fromObject(e2.options)}return t2},j.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.number=0,n2.options=null),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.number!=null&&e2.hasOwnProperty("number")&&(n2.number=e2.number),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=l.google.protobuf.EnumValueOptions.toObject(e2.options,t2)),n2},j.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},j),n.ServiceDescriptorProto=(D.prototype.name="",D.prototype.method=p.emptyArray,D.prototype.options=null,D.create=function(e2){return new D(e2)},D.encode=function(e2,t2){if(t2=t2||i.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.method!=null&&e2.method.length)for(var n2=0;n2>>3){case 1:o2.name=e2.string();break;case 2:o2.method&&o2.method.length||(o2.method=[]),o2.method.push(l.google.protobuf.MethodDescriptorProto.decode(e2,e2.uint32()));break;case 3:o2.options=l.google.protobuf.ServiceOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},D.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},D.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!p.isString(e2.name))return"name: string expected";if(e2.method!=null&&e2.hasOwnProperty("method")){if(!Array.isArray(e2.method))return"method: array expected";for(var t2=0;t2>>3){case 1:o2.name=e2.string();break;case 2:o2.inputType=e2.string();break;case 3:o2.outputType=e2.string();break;case 4:o2.options=l.google.protobuf.MethodOptions.decode(e2,e2.uint32());break;case 5:o2.clientStreaming=e2.bool();break;case 6:o2.serverStreaming=e2.bool();break;default:e2.skipType(7&r2)}}return o2},x.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},x.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!p.isString(e2.name))return"name: string expected";if(e2.inputType!=null&&e2.hasOwnProperty("inputType")&&!p.isString(e2.inputType))return"inputType: string expected";if(e2.outputType!=null&&e2.hasOwnProperty("outputType")&&!p.isString(e2.outputType))return"outputType: string expected";if(e2.options!=null&&e2.hasOwnProperty("options")){var t2=l.google.protobuf.MethodOptions.verify(e2.options);if(t2)return"options."+t2}return e2.clientStreaming!=null&&e2.hasOwnProperty("clientStreaming")&&typeof e2.clientStreaming!="boolean"?"clientStreaming: boolean expected":e2.serverStreaming!=null&&e2.hasOwnProperty("serverStreaming")&&typeof e2.serverStreaming!="boolean"?"serverStreaming: boolean expected":null},x.fromObject=function(e2){if(e2 instanceof l.google.protobuf.MethodDescriptorProto)return e2;var t2=new l.google.protobuf.MethodDescriptorProto;if(e2.name!=null&&(t2.name=String(e2.name)),e2.inputType!=null&&(t2.inputType=String(e2.inputType)),e2.outputType!=null&&(t2.outputType=String(e2.outputType)),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected");t2.options=l.google.protobuf.MethodOptions.fromObject(e2.options)}return e2.clientStreaming!=null&&(t2.clientStreaming=!!e2.clientStreaming),e2.serverStreaming!=null&&(t2.serverStreaming=!!e2.serverStreaming),t2},x.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.inputType="",n2.outputType="",n2.options=null,n2.clientStreaming=!1,n2.serverStreaming=!1),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.inputType!=null&&e2.hasOwnProperty("inputType")&&(n2.inputType=e2.inputType),e2.outputType!=null&&e2.hasOwnProperty("outputType")&&(n2.outputType=e2.outputType),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=l.google.protobuf.MethodOptions.toObject(e2.options,t2)),e2.clientStreaming!=null&&e2.hasOwnProperty("clientStreaming")&&(n2.clientStreaming=e2.clientStreaming),e2.serverStreaming!=null&&e2.hasOwnProperty("serverStreaming")&&(n2.serverStreaming=e2.serverStreaming),n2},x.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},x),n.FileOptions=(S.prototype.javaPackage="",S.prototype.javaOuterClassname="",S.prototype.javaMultipleFiles=!1,S.prototype.javaGenerateEqualsAndHash=!1,S.prototype.javaStringCheckUtf8=!1,S.prototype.optimizeFor=1,S.prototype.goPackage="",S.prototype.ccGenericServices=!1,S.prototype.javaGenericServices=!1,S.prototype.pyGenericServices=!1,S.prototype.phpGenericServices=!1,S.prototype.deprecated=!1,S.prototype.ccEnableArenas=!0,S.prototype.objcClassPrefix="",S.prototype.csharpNamespace="",S.prototype.swiftPrefix="",S.prototype.phpClassPrefix="",S.prototype.phpNamespace="",S.prototype.phpMetadataNamespace="",S.prototype.rubyPackage="",S.prototype.uninterpretedOption=p.emptyArray,S.prototype[".google.api.resourceDefinition"]=p.emptyArray,S.create=function(e2){return new S(e2)},S.encode=function(e2,t2){if(t2=t2||i.create(),e2.javaPackage!=null&&Object.hasOwnProperty.call(e2,"javaPackage")&&t2.uint32(10).string(e2.javaPackage),e2.javaOuterClassname!=null&&Object.hasOwnProperty.call(e2,"javaOuterClassname")&&t2.uint32(66).string(e2.javaOuterClassname),e2.optimizeFor!=null&&Object.hasOwnProperty.call(e2,"optimizeFor")&&t2.uint32(72).int32(e2.optimizeFor),e2.javaMultipleFiles!=null&&Object.hasOwnProperty.call(e2,"javaMultipleFiles")&&t2.uint32(80).bool(e2.javaMultipleFiles),e2.goPackage!=null&&Object.hasOwnProperty.call(e2,"goPackage")&&t2.uint32(90).string(e2.goPackage),e2.ccGenericServices!=null&&Object.hasOwnProperty.call(e2,"ccGenericServices")&&t2.uint32(128).bool(e2.ccGenericServices),e2.javaGenericServices!=null&&Object.hasOwnProperty.call(e2,"javaGenericServices")&&t2.uint32(136).bool(e2.javaGenericServices),e2.pyGenericServices!=null&&Object.hasOwnProperty.call(e2,"pyGenericServices")&&t2.uint32(144).bool(e2.pyGenericServices),e2.javaGenerateEqualsAndHash!=null&&Object.hasOwnProperty.call(e2,"javaGenerateEqualsAndHash")&&t2.uint32(160).bool(e2.javaGenerateEqualsAndHash),e2.deprecated!=null&&Object.hasOwnProperty.call(e2,"deprecated")&&t2.uint32(184).bool(e2.deprecated),e2.javaStringCheckUtf8!=null&&Object.hasOwnProperty.call(e2,"javaStringCheckUtf8")&&t2.uint32(216).bool(e2.javaStringCheckUtf8),e2.ccEnableArenas!=null&&Object.hasOwnProperty.call(e2,"ccEnableArenas")&&t2.uint32(248).bool(e2.ccEnableArenas),e2.objcClassPrefix!=null&&Object.hasOwnProperty.call(e2,"objcClassPrefix")&&t2.uint32(290).string(e2.objcClassPrefix),e2.csharpNamespace!=null&&Object.hasOwnProperty.call(e2,"csharpNamespace")&&t2.uint32(298).string(e2.csharpNamespace),e2.swiftPrefix!=null&&Object.hasOwnProperty.call(e2,"swiftPrefix")&&t2.uint32(314).string(e2.swiftPrefix),e2.phpClassPrefix!=null&&Object.hasOwnProperty.call(e2,"phpClassPrefix")&&t2.uint32(322).string(e2.phpClassPrefix),e2.phpNamespace!=null&&Object.hasOwnProperty.call(e2,"phpNamespace")&&t2.uint32(330).string(e2.phpNamespace),e2.phpGenericServices!=null&&Object.hasOwnProperty.call(e2,"phpGenericServices")&&t2.uint32(336).bool(e2.phpGenericServices),e2.phpMetadataNamespace!=null&&Object.hasOwnProperty.call(e2,"phpMetadataNamespace")&&t2.uint32(354).string(e2.phpMetadataNamespace),e2.rubyPackage!=null&&Object.hasOwnProperty.call(e2,"rubyPackage")&&t2.uint32(362).string(e2.rubyPackage),e2.uninterpretedOption!=null&&e2.uninterpretedOption.length)for(var n2=0;n2>>3){case 1:o2.javaPackage=e2.string();break;case 8:o2.javaOuterClassname=e2.string();break;case 10:o2.javaMultipleFiles=e2.bool();break;case 20:o2.javaGenerateEqualsAndHash=e2.bool();break;case 27:o2.javaStringCheckUtf8=e2.bool();break;case 9:o2.optimizeFor=e2.int32();break;case 11:o2.goPackage=e2.string();break;case 16:o2.ccGenericServices=e2.bool();break;case 17:o2.javaGenericServices=e2.bool();break;case 18:o2.pyGenericServices=e2.bool();break;case 42:o2.phpGenericServices=e2.bool();break;case 23:o2.deprecated=e2.bool();break;case 31:o2.ccEnableArenas=e2.bool();break;case 36:o2.objcClassPrefix=e2.string();break;case 37:o2.csharpNamespace=e2.string();break;case 39:o2.swiftPrefix=e2.string();break;case 40:o2.phpClassPrefix=e2.string();break;case 41:o2.phpNamespace=e2.string();break;case 44:o2.phpMetadataNamespace=e2.string();break;case 45:o2.rubyPackage=e2.string();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;case 1053:o2[".google.api.resourceDefinition"]&&o2[".google.api.resourceDefinition"].length||(o2[".google.api.resourceDefinition"]=[]),o2[".google.api.resourceDefinition"].push(l.google.api.ResourceDescriptor.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},S.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},S.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.javaPackage!=null&&e2.hasOwnProperty("javaPackage")&&!p.isString(e2.javaPackage))return"javaPackage: string expected";if(e2.javaOuterClassname!=null&&e2.hasOwnProperty("javaOuterClassname")&&!p.isString(e2.javaOuterClassname))return"javaOuterClassname: string expected";if(e2.javaMultipleFiles!=null&&e2.hasOwnProperty("javaMultipleFiles")&&typeof e2.javaMultipleFiles!="boolean")return"javaMultipleFiles: boolean expected";if(e2.javaGenerateEqualsAndHash!=null&&e2.hasOwnProperty("javaGenerateEqualsAndHash")&&typeof e2.javaGenerateEqualsAndHash!="boolean")return"javaGenerateEqualsAndHash: boolean expected";if(e2.javaStringCheckUtf8!=null&&e2.hasOwnProperty("javaStringCheckUtf8")&&typeof e2.javaStringCheckUtf8!="boolean")return"javaStringCheckUtf8: boolean expected";if(e2.optimizeFor!=null&&e2.hasOwnProperty("optimizeFor"))switch(e2.optimizeFor){default:return"optimizeFor: enum value expected";case 1:case 2:case 3:}if(e2.goPackage!=null&&e2.hasOwnProperty("goPackage")&&!p.isString(e2.goPackage))return"goPackage: string expected";if(e2.ccGenericServices!=null&&e2.hasOwnProperty("ccGenericServices")&&typeof e2.ccGenericServices!="boolean")return"ccGenericServices: boolean expected";if(e2.javaGenericServices!=null&&e2.hasOwnProperty("javaGenericServices")&&typeof e2.javaGenericServices!="boolean")return"javaGenericServices: boolean expected";if(e2.pyGenericServices!=null&&e2.hasOwnProperty("pyGenericServices")&&typeof e2.pyGenericServices!="boolean")return"pyGenericServices: boolean expected";if(e2.phpGenericServices!=null&&e2.hasOwnProperty("phpGenericServices")&&typeof e2.phpGenericServices!="boolean")return"phpGenericServices: boolean expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.ccEnableArenas!=null&&e2.hasOwnProperty("ccEnableArenas")&&typeof e2.ccEnableArenas!="boolean")return"ccEnableArenas: boolean expected";if(e2.objcClassPrefix!=null&&e2.hasOwnProperty("objcClassPrefix")&&!p.isString(e2.objcClassPrefix))return"objcClassPrefix: string expected";if(e2.csharpNamespace!=null&&e2.hasOwnProperty("csharpNamespace")&&!p.isString(e2.csharpNamespace))return"csharpNamespace: string expected";if(e2.swiftPrefix!=null&&e2.hasOwnProperty("swiftPrefix")&&!p.isString(e2.swiftPrefix))return"swiftPrefix: string expected";if(e2.phpClassPrefix!=null&&e2.hasOwnProperty("phpClassPrefix")&&!p.isString(e2.phpClassPrefix))return"phpClassPrefix: string expected";if(e2.phpNamespace!=null&&e2.hasOwnProperty("phpNamespace")&&!p.isString(e2.phpNamespace))return"phpNamespace: string expected";if(e2.phpMetadataNamespace!=null&&e2.hasOwnProperty("phpMetadataNamespace")&&!p.isString(e2.phpMetadataNamespace))return"phpMetadataNamespace: string expected";if(e2.rubyPackage!=null&&e2.hasOwnProperty("rubyPackage")&&!p.isString(e2.rubyPackage))return"rubyPackage: string expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 1:o2.messageSetWireFormat=e2.bool();break;case 2:o2.noStandardDescriptorAccessor=e2.bool();break;case 3:o2.deprecated=e2.bool();break;case 7:o2.mapEntry=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;case 1053:o2[".google.api.resource"]=l.google.api.ResourceDescriptor.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},k.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},k.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.messageSetWireFormat!=null&&e2.hasOwnProperty("messageSetWireFormat")&&typeof e2.messageSetWireFormat!="boolean")return"messageSetWireFormat: boolean expected";if(e2.noStandardDescriptorAccessor!=null&&e2.hasOwnProperty("noStandardDescriptorAccessor")&&typeof e2.noStandardDescriptorAccessor!="boolean")return"noStandardDescriptorAccessor: boolean expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.mapEntry!=null&&e2.hasOwnProperty("mapEntry")&&typeof e2.mapEntry!="boolean")return"mapEntry: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 1:o2.ctype=e2.int32();break;case 2:o2.packed=e2.bool();break;case 6:o2.jstype=e2.int32();break;case 5:o2.lazy=e2.bool();break;case 3:o2.deprecated=e2.bool();break;case 10:o2.weak=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;case 1052:if(o2[".google.api.fieldBehavior"]&&o2[".google.api.fieldBehavior"].length||(o2[".google.api.fieldBehavior"]=[]),(7&r2)==2)for(var i2=e2.uint32()+e2.pos;e2.pos>>3==999?(o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},Q.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},Q.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 2:o2.allowAlias=e2.bool();break;case 3:o2.deprecated=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},E.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},E.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.allowAlias!=null&&e2.hasOwnProperty("allowAlias")&&typeof e2.allowAlias!="boolean")return"allowAlias: boolean expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 1:o2.deprecated=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},K.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},K.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 33:o2.deprecated=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;case 1049:o2[".google.api.defaultHost"]=e2.string();break;case 1050:o2[".google.api.oauthScopes"]=e2.string();break;default:e2.skipType(7&r2)}}return o2},A.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},A.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 33:o2.deprecated=e2.bool();break;case 34:o2.idempotencyLevel=e2.int32();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;case 72295728:o2[".google.api.http"]=l.google.api.HttpRule.decode(e2,e2.uint32());break;case 1051:o2[".google.api.methodSignature"]&&o2[".google.api.methodSignature"].length||(o2[".google.api.methodSignature"]=[]),o2[".google.api.methodSignature"].push(e2.string());break;default:e2.skipType(7&r2)}}return o2},N.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},N.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.idempotencyLevel!=null&&e2.hasOwnProperty("idempotencyLevel"))switch(e2.idempotencyLevel){default:return"idempotencyLevel: enum value expected";case 0:case 1:case 2:}if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 2:o2.name&&o2.name.length||(o2.name=[]),o2.name.push(l.google.protobuf.UninterpretedOption.NamePart.decode(e2,e2.uint32()));break;case 3:o2.identifierValue=e2.string();break;case 4:o2.positiveIntValue=e2.uint64();break;case 5:o2.negativeIntValue=e2.int64();break;case 6:o2.doubleValue=e2.double();break;case 7:o2.stringValue=e2.bytes();break;case 8:o2.aggregateValue=e2.string();break;default:e2.skipType(7&r2)}}return o2},R.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},R.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")){if(!Array.isArray(e2.name))return"name: array expected";for(var t2=0;t2>>0,e2.positiveIntValue.high>>>0).toNumber(!0))),e2.negativeIntValue!=null&&(p.Long?(t2.negativeIntValue=p.Long.fromValue(e2.negativeIntValue)).unsigned=!1:typeof e2.negativeIntValue=="string"?t2.negativeIntValue=parseInt(e2.negativeIntValue,10):typeof e2.negativeIntValue=="number"?t2.negativeIntValue=e2.negativeIntValue:typeof e2.negativeIntValue=="object"&&(t2.negativeIntValue=new p.LongBits(e2.negativeIntValue.low>>>0,e2.negativeIntValue.high>>>0).toNumber())),e2.doubleValue!=null&&(t2.doubleValue=Number(e2.doubleValue)),e2.stringValue!=null&&(typeof e2.stringValue=="string"?p.base64.decode(e2.stringValue,t2.stringValue=p.newBuffer(p.base64.length(e2.stringValue)),0):e2.stringValue.length&&(t2.stringValue=e2.stringValue)),e2.aggregateValue!=null&&(t2.aggregateValue=String(e2.aggregateValue)),t2},R.toObject=function(e2,t2){var n2,o2={};if(((t2=t2||{}).arrays||t2.defaults)&&(o2.name=[]),t2.defaults&&(o2.identifierValue="",p.Long?(n2=new p.Long(0,0,!0),o2.positiveIntValue=t2.longs===String?n2.toString():t2.longs===Number?n2.toNumber():n2):o2.positiveIntValue=t2.longs===String?"0":0,p.Long?(n2=new p.Long(0,0,!1),o2.negativeIntValue=t2.longs===String?n2.toString():t2.longs===Number?n2.toNumber():n2):o2.negativeIntValue=t2.longs===String?"0":0,o2.doubleValue=0,t2.bytes===String?o2.stringValue="":(o2.stringValue=[],t2.bytes!==Array&&(o2.stringValue=p.newBuffer(o2.stringValue))),o2.aggregateValue=""),e2.name&&e2.name.length){o2.name=[];for(var r2=0;r2>>0,e2.positiveIntValue.high>>>0).toNumber(!0):e2.positiveIntValue),e2.negativeIntValue!=null&&e2.hasOwnProperty("negativeIntValue")&&(typeof e2.negativeIntValue=="number"?o2.negativeIntValue=t2.longs===String?String(e2.negativeIntValue):e2.negativeIntValue:o2.negativeIntValue=t2.longs===String?p.Long.prototype.toString.call(e2.negativeIntValue):t2.longs===Number?new p.LongBits(e2.negativeIntValue.low>>>0,e2.negativeIntValue.high>>>0).toNumber():e2.negativeIntValue),e2.doubleValue!=null&&e2.hasOwnProperty("doubleValue")&&(o2.doubleValue=t2.json&&!isFinite(e2.doubleValue)?String(e2.doubleValue):e2.doubleValue),e2.stringValue!=null&&e2.hasOwnProperty("stringValue")&&(o2.stringValue=t2.bytes===String?p.base64.encode(e2.stringValue,0,e2.stringValue.length):t2.bytes===Array?Array.prototype.slice.call(e2.stringValue):e2.stringValue),e2.aggregateValue!=null&&e2.hasOwnProperty("aggregateValue")&&(o2.aggregateValue=e2.aggregateValue),o2},R.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},R.NamePart=(Z.prototype.namePart="",Z.prototype.isExtension=!1,Z.create=function(e2){return new Z(e2)},Z.encode=function(e2,t2){return(t2=t2||i.create()).uint32(10).string(e2.namePart),t2.uint32(16).bool(e2.isExtension),t2},Z.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},Z.decode=function(e2,t2){e2 instanceof a||(e2=a.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new l.google.protobuf.UninterpretedOption.NamePart;e2.pos>>3){case 1:o2.namePart=e2.string();break;case 2:o2.isExtension=e2.bool();break;default:e2.skipType(7&r2)}}if(!o2.hasOwnProperty("namePart"))throw p.ProtocolError("missing required 'namePart'",{instance:o2});if(o2.hasOwnProperty("isExtension"))return o2;throw p.ProtocolError("missing required 'isExtension'",{instance:o2})},Z.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},Z.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":p.isString(e2.namePart)?typeof e2.isExtension!="boolean"?"isExtension: boolean expected":null:"namePart: string expected"},Z.fromObject=function(e2){var t2;return e2 instanceof l.google.protobuf.UninterpretedOption.NamePart?e2:(t2=new l.google.protobuf.UninterpretedOption.NamePart,e2.namePart!=null&&(t2.namePart=String(e2.namePart)),e2.isExtension!=null&&(t2.isExtension=!!e2.isExtension),t2)},Z.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.namePart="",n2.isExtension=!1),e2.namePart!=null&&e2.hasOwnProperty("namePart")&&(n2.namePart=e2.namePart),e2.isExtension!=null&&e2.hasOwnProperty("isExtension")&&(n2.isExtension=e2.isExtension),n2},Z.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},Z),R),n.SourceCodeInfo=($.prototype.location=p.emptyArray,$.create=function(e2){return new $(e2)},$.encode=function(e2,t2){if(t2=t2||i.create(),e2.location!=null&&e2.location.length)for(var n2=0;n2>>3==1?(o2.location&&o2.location.length||(o2.location=[]),o2.location.push(l.google.protobuf.SourceCodeInfo.Location.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},$.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},$.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.location!=null&&e2.hasOwnProperty("location")){if(!Array.isArray(e2.location))return"location: array expected";for(var t2=0;t2>>3){case 1:if(o2.path&&o2.path.length||(o2.path=[]),(7&r2)==2)for(var i2=e2.uint32()+e2.pos;e2.pos>>3==1?(o2.annotation&&o2.annotation.length||(o2.annotation=[]),o2.annotation.push(l.google.protobuf.GeneratedCodeInfo.Annotation.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},ee.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},ee.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.annotation!=null&&e2.hasOwnProperty("annotation")){if(!Array.isArray(e2.annotation))return"annotation: array expected";for(var t2=0;t2>>3){case 1:if(o2.path&&o2.path.length||(o2.path=[]),(7&r2)==2)for(var i2=e2.uint32()+e2.pos;e2.pos>>3){case 1:o2.expression=e2.string();break;case 2:o2.title=e2.string();break;case 3:o2.description=e2.string();break;case 4:o2.location=e2.string();break;default:e2.skipType(7&r2)}}return o2},V.decodeDelimited=function(e2){return e2 instanceof a||(e2=new a(e2)),this.decode(e2,e2.uint32())},V.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.expression!=null&&e2.hasOwnProperty("expression")&&!p.isString(e2.expression)?"expression: string expected":e2.title!=null&&e2.hasOwnProperty("title")&&!p.isString(e2.title)?"title: string expected":e2.description!=null&&e2.hasOwnProperty("description")&&!p.isString(e2.description)?"description: string expected":e2.location!=null&&e2.hasOwnProperty("location")&&!p.isString(e2.location)?"location: string expected":null},V.fromObject=function(e2){var t2;return e2 instanceof l.google.type.Expr?e2:(t2=new l.google.type.Expr,e2.expression!=null&&(t2.expression=String(e2.expression)),e2.title!=null&&(t2.title=String(e2.title)),e2.description!=null&&(t2.description=String(e2.description)),e2.location!=null&&(t2.location=String(e2.location)),t2)},V.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.expression="",n2.title="",n2.description="",n2.location=""),e2.expression!=null&&e2.hasOwnProperty("expression")&&(n2.expression=e2.expression),e2.title!=null&&e2.hasOwnProperty("title")&&(n2.title=e2.title),e2.description!=null&&e2.hasOwnProperty("description")&&(n2.description=e2.description),e2.location!=null&&e2.hasOwnProperty("location")&&(n2.location=e2.location),n2},V.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},V),r),F),l})}});var require_locations=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/protos/locations.js"(exports2,module2){(function(e){typeof define=="function"&&define.amd?define(["protobufjs/minimal"],e):typeof require=="function"&&typeof module2=="object"&&module2&&module2.exports&&(module2.exports=e(require_minimal2()))})(function(o){"use strict";var e,t,n,F,s=o.Reader,r=o.Writer,u=o.util,c=o.roots.locations_protos||(o.roots.locations_protos={});function L(e2,t2,n2){o.rpc.Service.call(this,e2,t2,n2)}__name(L,"L");function i(e2){if(e2)for(var t2=Object.keys(e2),n2=0;n2>>3){case 1:o2.name=e2.string();break;case 2:o2.filter=e2.string();break;case 3:o2.pageSize=e2.int32();break;case 4:o2.pageToken=e2.string();break;default:e2.skipType(7&r2)}}return o2},i.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},i.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!u.isString(e2.name)?"name: string expected":e2.filter!=null&&e2.hasOwnProperty("filter")&&!u.isString(e2.filter)?"filter: string expected":e2.pageSize!=null&&e2.hasOwnProperty("pageSize")&&!u.isInteger(e2.pageSize)?"pageSize: integer expected":e2.pageToken!=null&&e2.hasOwnProperty("pageToken")&&!u.isString(e2.pageToken)?"pageToken: string expected":null},i.fromObject=function(e2){var t2;return e2 instanceof c.google.cloud.location.ListLocationsRequest?e2:(t2=new c.google.cloud.location.ListLocationsRequest,e2.name!=null&&(t2.name=String(e2.name)),e2.filter!=null&&(t2.filter=String(e2.filter)),e2.pageSize!=null&&(t2.pageSize=0|e2.pageSize),e2.pageToken!=null&&(t2.pageToken=String(e2.pageToken)),t2)},i.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.filter="",n2.pageSize=0,n2.pageToken=""),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.filter!=null&&e2.hasOwnProperty("filter")&&(n2.filter=e2.filter),e2.pageSize!=null&&e2.hasOwnProperty("pageSize")&&(n2.pageSize=e2.pageSize),e2.pageToken!=null&&e2.hasOwnProperty("pageToken")&&(n2.pageToken=e2.pageToken),n2},i.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},i),e.ListLocationsResponse=(a.prototype.locations=u.emptyArray,a.prototype.nextPageToken="",a.create=function(e2){return new a(e2)},a.encode=function(e2,t2){if(t2=t2||r.create(),e2.locations!=null&&e2.locations.length)for(var n2=0;n2>>3){case 1:o2.locations&&o2.locations.length||(o2.locations=[]),o2.locations.push(c.google.cloud.location.Location.decode(e2,e2.uint32()));break;case 2:o2.nextPageToken=e2.string();break;default:e2.skipType(7&r2)}}return o2},a.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},a.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.locations!=null&&e2.hasOwnProperty("locations")){if(!Array.isArray(e2.locations))return"locations: array expected";for(var t2=0;t2>>3==1?o2.name=e2.string():e2.skipType(7&r2)}return o2},G.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},G.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!u.isString(e2.name)?"name: string expected":null},G.fromObject=function(e2){var t2;return e2 instanceof c.google.cloud.location.GetLocationRequest?e2:(t2=new c.google.cloud.location.GetLocationRequest,e2.name!=null&&(t2.name=String(e2.name)),t2)},G.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name=""),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),n2},G.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},G),e.Location=(p.prototype.name="",p.prototype.locationId="",p.prototype.displayName="",p.prototype.labels=u.emptyObject,p.prototype.metadata=null,p.create=function(e2){return new p(e2)},p.encode=function(e2,t2){if(t2=t2||r.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.labels!=null&&Object.hasOwnProperty.call(e2,"labels"))for(var n2=Object.keys(e2.labels),o2=0;o2>>3){case 1:o2.name=e2.string();break;case 4:o2.locationId=e2.string();break;case 5:o2.displayName=e2.string();break;case 2:o2.labels===u.emptyObject&&(o2.labels={});for(var i2=e2.uint32()+e2.pos,a2="",p2="";e2.pos>>3){case 1:a2=e2.string();break;case 2:p2=e2.string();break;default:e2.skipType(7&l2)}}o2.labels[a2]=p2;break;case 3:o2.metadata=c.google.protobuf.Any.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},p.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},p.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!u.isString(e2.name))return"name: string expected";if(e2.locationId!=null&&e2.hasOwnProperty("locationId")&&!u.isString(e2.locationId))return"locationId: string expected";if(e2.displayName!=null&&e2.hasOwnProperty("displayName")&&!u.isString(e2.displayName))return"displayName: string expected";if(e2.labels!=null&&e2.hasOwnProperty("labels")){if(!u.isObject(e2.labels))return"labels: object expected";for(var t2=Object.keys(e2.labels),n2=0;n2>>3){case 1:o2.rules&&o2.rules.length||(o2.rules=[]),o2.rules.push(c.google.api.HttpRule.decode(e2,e2.uint32()));break;case 2:o2.fullyDecodeReservedExpansion=e2.bool();break;default:e2.skipType(7&r2)}}return o2},l.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},l.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.rules!=null&&e2.hasOwnProperty("rules")){if(!Array.isArray(e2.rules))return"rules: array expected";for(var t2=0;t2>>3){case 1:o2.selector=e2.string();break;case 2:o2.get=e2.string();break;case 3:o2.put=e2.string();break;case 4:o2.post=e2.string();break;case 5:o2.delete=e2.string();break;case 6:o2.patch=e2.string();break;case 8:o2.custom=c.google.api.CustomHttpPattern.decode(e2,e2.uint32());break;case 7:o2.body=e2.string();break;case 12:o2.responseBody=e2.string();break;case 11:o2.additionalBindings&&o2.additionalBindings.length||(o2.additionalBindings=[]),o2.additionalBindings.push(c.google.api.HttpRule.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},d.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},d.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";var t2={};if(e2.selector!=null&&e2.hasOwnProperty("selector")&&!u.isString(e2.selector))return"selector: string expected";if(e2.get!=null&&e2.hasOwnProperty("get")&&(t2.pattern=1,!u.isString(e2.get)))return"get: string expected";if(e2.put!=null&&e2.hasOwnProperty("put")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,!u.isString(e2.put))return"put: string expected"}if(e2.post!=null&&e2.hasOwnProperty("post")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,!u.isString(e2.post))return"post: string expected"}if(e2.delete!=null&&e2.hasOwnProperty("delete")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,!u.isString(e2.delete))return"delete: string expected"}if(e2.patch!=null&&e2.hasOwnProperty("patch")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,!u.isString(e2.patch))return"patch: string expected"}if(e2.custom!=null&&e2.hasOwnProperty("custom")){if(t2.pattern===1)return"pattern: multiple values";if(t2.pattern=1,n2=c.google.api.CustomHttpPattern.verify(e2.custom))return"custom."+n2}if(e2.body!=null&&e2.hasOwnProperty("body")&&!u.isString(e2.body))return"body: string expected";if(e2.responseBody!=null&&e2.hasOwnProperty("responseBody")&&!u.isString(e2.responseBody))return"responseBody: string expected";if(e2.additionalBindings!=null&&e2.hasOwnProperty("additionalBindings")){if(!Array.isArray(e2.additionalBindings))return"additionalBindings: array expected";for(var n2,o2=0;o2>>3){case 1:o2.kind=e2.string();break;case 2:o2.path=e2.string();break;default:e2.skipType(7&r2)}}return o2},g.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},g.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.kind!=null&&e2.hasOwnProperty("kind")&&!u.isString(e2.kind)?"kind: string expected":e2.path!=null&&e2.hasOwnProperty("path")&&!u.isString(e2.path)?"path: string expected":null},g.fromObject=function(e2){var t2;return e2 instanceof c.google.api.CustomHttpPattern?e2:(t2=new c.google.api.CustomHttpPattern,e2.kind!=null&&(t2.kind=String(e2.kind)),e2.path!=null&&(t2.path=String(e2.path)),t2)},g.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.kind="",n2.path=""),e2.kind!=null&&e2.hasOwnProperty("kind")&&(n2.kind=e2.kind),e2.path!=null&&e2.hasOwnProperty("path")&&(n2.path=e2.path),n2},g.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},g),e),F.protobuf=((n={}).FileDescriptorSet=(B.prototype.file=u.emptyArray,B.create=function(e2){return new B(e2)},B.encode=function(e2,t2){if(t2=t2||r.create(),e2.file!=null&&e2.file.length)for(var n2=0;n2>>3==1?(o2.file&&o2.file.length||(o2.file=[]),o2.file.push(c.google.protobuf.FileDescriptorProto.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},B.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},B.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.file!=null&&e2.hasOwnProperty("file")){if(!Array.isArray(e2.file))return"file: array expected";for(var t2=0;t2>>3){case 1:o2.name=e2.string();break;case 2:o2.package=e2.string();break;case 3:o2.dependency&&o2.dependency.length||(o2.dependency=[]),o2.dependency.push(e2.string());break;case 10:if(o2.publicDependency&&o2.publicDependency.length||(o2.publicDependency=[]),(7&r2)==2)for(var i2=e2.uint32()+e2.pos;e2.pos>>3){case 1:o2.name=e2.string();break;case 2:o2.field&&o2.field.length||(o2.field=[]),o2.field.push(c.google.protobuf.FieldDescriptorProto.decode(e2,e2.uint32()));break;case 6:o2.extension&&o2.extension.length||(o2.extension=[]),o2.extension.push(c.google.protobuf.FieldDescriptorProto.decode(e2,e2.uint32()));break;case 3:o2.nestedType&&o2.nestedType.length||(o2.nestedType=[]),o2.nestedType.push(c.google.protobuf.DescriptorProto.decode(e2,e2.uint32()));break;case 4:o2.enumType&&o2.enumType.length||(o2.enumType=[]),o2.enumType.push(c.google.protobuf.EnumDescriptorProto.decode(e2,e2.uint32()));break;case 5:o2.extensionRange&&o2.extensionRange.length||(o2.extensionRange=[]),o2.extensionRange.push(c.google.protobuf.DescriptorProto.ExtensionRange.decode(e2,e2.uint32()));break;case 8:o2.oneofDecl&&o2.oneofDecl.length||(o2.oneofDecl=[]),o2.oneofDecl.push(c.google.protobuf.OneofDescriptorProto.decode(e2,e2.uint32()));break;case 7:o2.options=c.google.protobuf.MessageOptions.decode(e2,e2.uint32());break;case 9:o2.reservedRange&&o2.reservedRange.length||(o2.reservedRange=[]),o2.reservedRange.push(c.google.protobuf.DescriptorProto.ReservedRange.decode(e2,e2.uint32()));break;case 10:o2.reservedName&&o2.reservedName.length||(o2.reservedName=[]),o2.reservedName.push(e2.string());break;default:e2.skipType(7&r2)}}return o2},y.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},y.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!u.isString(e2.name))return"name: string expected";if(e2.field!=null&&e2.hasOwnProperty("field")){if(!Array.isArray(e2.field))return"field: array expected";for(var t2=0;t2>>3){case 1:o2.start=e2.int32();break;case 2:o2.end=e2.int32();break;case 3:o2.options=c.google.protobuf.ExtensionRangeOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},h.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},h.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.start!=null&&e2.hasOwnProperty("start")&&!u.isInteger(e2.start)?"start: integer expected":e2.end!=null&&e2.hasOwnProperty("end")&&!u.isInteger(e2.end)?"end: integer expected":e2.options!=null&&e2.hasOwnProperty("options")&&(e2=c.google.protobuf.ExtensionRangeOptions.verify(e2.options),e2)?"options."+e2:null},h.fromObject=function(e2){if(e2 instanceof c.google.protobuf.DescriptorProto.ExtensionRange)return e2;var t2=new c.google.protobuf.DescriptorProto.ExtensionRange;if(e2.start!=null&&(t2.start=0|e2.start),e2.end!=null&&(t2.end=0|e2.end),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected");t2.options=c.google.protobuf.ExtensionRangeOptions.fromObject(e2.options)}return t2},h.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.start=0,n2.end=0,n2.options=null),e2.start!=null&&e2.hasOwnProperty("start")&&(n2.start=e2.start),e2.end!=null&&e2.hasOwnProperty("end")&&(n2.end=e2.end),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=c.google.protobuf.ExtensionRangeOptions.toObject(e2.options,t2)),n2},h.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},h),y.ReservedRange=(b.prototype.start=0,b.prototype.end=0,b.create=function(e2){return new b(e2)},b.encode=function(e2,t2){return t2=t2||r.create(),e2.start!=null&&Object.hasOwnProperty.call(e2,"start")&&t2.uint32(8).int32(e2.start),e2.end!=null&&Object.hasOwnProperty.call(e2,"end")&&t2.uint32(16).int32(e2.end),t2},b.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},b.decode=function(e2,t2){e2 instanceof s||(e2=s.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new c.google.protobuf.DescriptorProto.ReservedRange;e2.pos>>3){case 1:o2.start=e2.int32();break;case 2:o2.end=e2.int32();break;default:e2.skipType(7&r2)}}return o2},b.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},b.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.start!=null&&e2.hasOwnProperty("start")&&!u.isInteger(e2.start)?"start: integer expected":e2.end!=null&&e2.hasOwnProperty("end")&&!u.isInteger(e2.end)?"end: integer expected":null},b.fromObject=function(e2){var t2;return e2 instanceof c.google.protobuf.DescriptorProto.ReservedRange?e2:(t2=new c.google.protobuf.DescriptorProto.ReservedRange,e2.start!=null&&(t2.start=0|e2.start),e2.end!=null&&(t2.end=0|e2.end),t2)},b.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.start=0,n2.end=0),e2.start!=null&&e2.hasOwnProperty("start")&&(n2.start=e2.start),e2.end!=null&&e2.hasOwnProperty("end")&&(n2.end=e2.end),n2},b.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},b),y),n.ExtensionRangeOptions=(U.prototype.uninterpretedOption=u.emptyArray,U.create=function(e2){return new U(e2)},U.encode=function(e2,t2){if(t2=t2||r.create(),e2.uninterpretedOption!=null&&e2.uninterpretedOption.length)for(var n2=0;n2>>3==999?(o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},U.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},U.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 1:o2.name=e2.string();break;case 3:o2.number=e2.int32();break;case 4:o2.label=e2.int32();break;case 5:o2.type=e2.int32();break;case 6:o2.typeName=e2.string();break;case 2:o2.extendee=e2.string();break;case 7:o2.defaultValue=e2.string();break;case 9:o2.oneofIndex=e2.int32();break;case 10:o2.jsonName=e2.string();break;case 8:o2.options=c.google.protobuf.FieldOptions.decode(e2,e2.uint32());break;case 17:o2.proto3Optional=e2.bool();break;default:e2.skipType(7&r2)}}return o2},O.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},O.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!u.isString(e2.name))return"name: string expected";if(e2.number!=null&&e2.hasOwnProperty("number")&&!u.isInteger(e2.number))return"number: integer expected";if(e2.label!=null&&e2.hasOwnProperty("label"))switch(e2.label){default:return"label: enum value expected";case 1:case 2:case 3:}if(e2.type!=null&&e2.hasOwnProperty("type"))switch(e2.type){default:return"type: enum value expected";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:}if(e2.typeName!=null&&e2.hasOwnProperty("typeName")&&!u.isString(e2.typeName))return"typeName: string expected";if(e2.extendee!=null&&e2.hasOwnProperty("extendee")&&!u.isString(e2.extendee))return"extendee: string expected";if(e2.defaultValue!=null&&e2.hasOwnProperty("defaultValue")&&!u.isString(e2.defaultValue))return"defaultValue: string expected";if(e2.oneofIndex!=null&&e2.hasOwnProperty("oneofIndex")&&!u.isInteger(e2.oneofIndex))return"oneofIndex: integer expected";if(e2.jsonName!=null&&e2.hasOwnProperty("jsonName")&&!u.isString(e2.jsonName))return"jsonName: string expected";if(e2.options!=null&&e2.hasOwnProperty("options")){var t2=c.google.protobuf.FieldOptions.verify(e2.options);if(t2)return"options."+t2}return e2.proto3Optional!=null&&e2.hasOwnProperty("proto3Optional")&&typeof e2.proto3Optional!="boolean"?"proto3Optional: boolean expected":null},O.fromObject=function(e2){if(e2 instanceof c.google.protobuf.FieldDescriptorProto)return e2;var t2=new c.google.protobuf.FieldDescriptorProto;switch(e2.name!=null&&(t2.name=String(e2.name)),e2.number!=null&&(t2.number=0|e2.number),e2.label){case"LABEL_OPTIONAL":case 1:t2.label=1;break;case"LABEL_REQUIRED":case 2:t2.label=2;break;case"LABEL_REPEATED":case 3:t2.label=3}switch(e2.type){case"TYPE_DOUBLE":case 1:t2.type=1;break;case"TYPE_FLOAT":case 2:t2.type=2;break;case"TYPE_INT64":case 3:t2.type=3;break;case"TYPE_UINT64":case 4:t2.type=4;break;case"TYPE_INT32":case 5:t2.type=5;break;case"TYPE_FIXED64":case 6:t2.type=6;break;case"TYPE_FIXED32":case 7:t2.type=7;break;case"TYPE_BOOL":case 8:t2.type=8;break;case"TYPE_STRING":case 9:t2.type=9;break;case"TYPE_GROUP":case 10:t2.type=10;break;case"TYPE_MESSAGE":case 11:t2.type=11;break;case"TYPE_BYTES":case 12:t2.type=12;break;case"TYPE_UINT32":case 13:t2.type=13;break;case"TYPE_ENUM":case 14:t2.type=14;break;case"TYPE_SFIXED32":case 15:t2.type=15;break;case"TYPE_SFIXED64":case 16:t2.type=16;break;case"TYPE_SINT32":case 17:t2.type=17;break;case"TYPE_SINT64":case 18:t2.type=18}if(e2.typeName!=null&&(t2.typeName=String(e2.typeName)),e2.extendee!=null&&(t2.extendee=String(e2.extendee)),e2.defaultValue!=null&&(t2.defaultValue=String(e2.defaultValue)),e2.oneofIndex!=null&&(t2.oneofIndex=0|e2.oneofIndex),e2.jsonName!=null&&(t2.jsonName=String(e2.jsonName)),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected");t2.options=c.google.protobuf.FieldOptions.fromObject(e2.options)}return e2.proto3Optional!=null&&(t2.proto3Optional=!!e2.proto3Optional),t2},O.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.extendee="",n2.number=0,n2.label=t2.enums===String?"LABEL_OPTIONAL":1,n2.type=t2.enums===String?"TYPE_DOUBLE":1,n2.typeName="",n2.defaultValue="",n2.options=null,n2.oneofIndex=0,n2.jsonName="",n2.proto3Optional=!1),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.extendee!=null&&e2.hasOwnProperty("extendee")&&(n2.extendee=e2.extendee),e2.number!=null&&e2.hasOwnProperty("number")&&(n2.number=e2.number),e2.label!=null&&e2.hasOwnProperty("label")&&(n2.label=t2.enums===String?c.google.protobuf.FieldDescriptorProto.Label[e2.label]:e2.label),e2.type!=null&&e2.hasOwnProperty("type")&&(n2.type=t2.enums===String?c.google.protobuf.FieldDescriptorProto.Type[e2.type]:e2.type),e2.typeName!=null&&e2.hasOwnProperty("typeName")&&(n2.typeName=e2.typeName),e2.defaultValue!=null&&e2.hasOwnProperty("defaultValue")&&(n2.defaultValue=e2.defaultValue),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=c.google.protobuf.FieldOptions.toObject(e2.options,t2)),e2.oneofIndex!=null&&e2.hasOwnProperty("oneofIndex")&&(n2.oneofIndex=e2.oneofIndex),e2.jsonName!=null&&e2.hasOwnProperty("jsonName")&&(n2.jsonName=e2.jsonName),e2.proto3Optional!=null&&e2.hasOwnProperty("proto3Optional")&&(n2.proto3Optional=e2.proto3Optional),n2},O.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},O.Type=(e={},(t=Object.create(e))[e[1]="TYPE_DOUBLE"]=1,t[e[2]="TYPE_FLOAT"]=2,t[e[3]="TYPE_INT64"]=3,t[e[4]="TYPE_UINT64"]=4,t[e[5]="TYPE_INT32"]=5,t[e[6]="TYPE_FIXED64"]=6,t[e[7]="TYPE_FIXED32"]=7,t[e[8]="TYPE_BOOL"]=8,t[e[9]="TYPE_STRING"]=9,t[e[10]="TYPE_GROUP"]=10,t[e[11]="TYPE_MESSAGE"]=11,t[e[12]="TYPE_BYTES"]=12,t[e[13]="TYPE_UINT32"]=13,t[e[14]="TYPE_ENUM"]=14,t[e[15]="TYPE_SFIXED32"]=15,t[e[16]="TYPE_SFIXED64"]=16,t[e[17]="TYPE_SINT32"]=17,t[e[18]="TYPE_SINT64"]=18,t),O.Label=(e={},(t=Object.create(e))[e[1]="LABEL_OPTIONAL"]=1,t[e[2]="LABEL_REQUIRED"]=2,t[e[3]="LABEL_REPEATED"]=3,t),O),n.OneofDescriptorProto=(m.prototype.name="",m.prototype.options=null,m.create=function(e2){return new m(e2)},m.encode=function(e2,t2){return t2=t2||r.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.options!=null&&Object.hasOwnProperty.call(e2,"options")&&c.google.protobuf.OneofOptions.encode(e2.options,t2.uint32(18).fork()).ldelim(),t2},m.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},m.decode=function(e2,t2){e2 instanceof s||(e2=s.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new c.google.protobuf.OneofDescriptorProto;e2.pos>>3){case 1:o2.name=e2.string();break;case 2:o2.options=c.google.protobuf.OneofOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},m.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},m.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!u.isString(e2.name)?"name: string expected":e2.options!=null&&e2.hasOwnProperty("options")&&(e2=c.google.protobuf.OneofOptions.verify(e2.options),e2)?"options."+e2:null},m.fromObject=function(e2){if(e2 instanceof c.google.protobuf.OneofDescriptorProto)return e2;var t2=new c.google.protobuf.OneofDescriptorProto;if(e2.name!=null&&(t2.name=String(e2.name)),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected");t2.options=c.google.protobuf.OneofOptions.fromObject(e2.options)}return t2},m.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.options=null),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=c.google.protobuf.OneofOptions.toObject(e2.options,t2)),n2},m.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},m),n.EnumDescriptorProto=(v.prototype.name="",v.prototype.value=u.emptyArray,v.prototype.options=null,v.prototype.reservedRange=u.emptyArray,v.prototype.reservedName=u.emptyArray,v.create=function(e2){return new v(e2)},v.encode=function(e2,t2){if(t2=t2||r.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.value!=null&&e2.value.length)for(var n2=0;n2>>3){case 1:o2.name=e2.string();break;case 2:o2.value&&o2.value.length||(o2.value=[]),o2.value.push(c.google.protobuf.EnumValueDescriptorProto.decode(e2,e2.uint32()));break;case 3:o2.options=c.google.protobuf.EnumOptions.decode(e2,e2.uint32());break;case 4:o2.reservedRange&&o2.reservedRange.length||(o2.reservedRange=[]),o2.reservedRange.push(c.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(e2,e2.uint32()));break;case 5:o2.reservedName&&o2.reservedName.length||(o2.reservedName=[]),o2.reservedName.push(e2.string());break;default:e2.skipType(7&r2)}}return o2},v.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},v.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!u.isString(e2.name))return"name: string expected";if(e2.value!=null&&e2.hasOwnProperty("value")){if(!Array.isArray(e2.value))return"value: array expected";for(var t2=0;t2>>3){case 1:o2.start=e2.int32();break;case 2:o2.end=e2.int32();break;default:e2.skipType(7&r2)}}return o2},P.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},P.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.start!=null&&e2.hasOwnProperty("start")&&!u.isInteger(e2.start)?"start: integer expected":e2.end!=null&&e2.hasOwnProperty("end")&&!u.isInteger(e2.end)?"end: integer expected":null},P.fromObject=function(e2){var t2;return e2 instanceof c.google.protobuf.EnumDescriptorProto.EnumReservedRange?e2:(t2=new c.google.protobuf.EnumDescriptorProto.EnumReservedRange,e2.start!=null&&(t2.start=0|e2.start),e2.end!=null&&(t2.end=0|e2.end),t2)},P.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.start=0,n2.end=0),e2.start!=null&&e2.hasOwnProperty("start")&&(n2.start=e2.start),e2.end!=null&&e2.hasOwnProperty("end")&&(n2.end=e2.end),n2},P.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},P),v),n.EnumValueDescriptorProto=(w.prototype.name="",w.prototype.number=0,w.prototype.options=null,w.create=function(e2){return new w(e2)},w.encode=function(e2,t2){return t2=t2||r.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.number!=null&&Object.hasOwnProperty.call(e2,"number")&&t2.uint32(16).int32(e2.number),e2.options!=null&&Object.hasOwnProperty.call(e2,"options")&&c.google.protobuf.EnumValueOptions.encode(e2.options,t2.uint32(26).fork()).ldelim(),t2},w.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},w.decode=function(e2,t2){e2 instanceof s||(e2=s.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new c.google.protobuf.EnumValueDescriptorProto;e2.pos>>3){case 1:o2.name=e2.string();break;case 2:o2.number=e2.int32();break;case 3:o2.options=c.google.protobuf.EnumValueOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},w.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},w.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.name!=null&&e2.hasOwnProperty("name")&&!u.isString(e2.name)?"name: string expected":e2.number!=null&&e2.hasOwnProperty("number")&&!u.isInteger(e2.number)?"number: integer expected":e2.options!=null&&e2.hasOwnProperty("options")&&(e2=c.google.protobuf.EnumValueOptions.verify(e2.options),e2)?"options."+e2:null},w.fromObject=function(e2){if(e2 instanceof c.google.protobuf.EnumValueDescriptorProto)return e2;var t2=new c.google.protobuf.EnumValueDescriptorProto;if(e2.name!=null&&(t2.name=String(e2.name)),e2.number!=null&&(t2.number=0|e2.number),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected");t2.options=c.google.protobuf.EnumValueOptions.fromObject(e2.options)}return t2},w.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.number=0,n2.options=null),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.number!=null&&e2.hasOwnProperty("number")&&(n2.number=e2.number),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=c.google.protobuf.EnumValueOptions.toObject(e2.options,t2)),n2},w.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},w),n.ServiceDescriptorProto=(j.prototype.name="",j.prototype.method=u.emptyArray,j.prototype.options=null,j.create=function(e2){return new j(e2)},j.encode=function(e2,t2){if(t2=t2||r.create(),e2.name!=null&&Object.hasOwnProperty.call(e2,"name")&&t2.uint32(10).string(e2.name),e2.method!=null&&e2.method.length)for(var n2=0;n2>>3){case 1:o2.name=e2.string();break;case 2:o2.method&&o2.method.length||(o2.method=[]),o2.method.push(c.google.protobuf.MethodDescriptorProto.decode(e2,e2.uint32()));break;case 3:o2.options=c.google.protobuf.ServiceOptions.decode(e2,e2.uint32());break;default:e2.skipType(7&r2)}}return o2},j.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},j.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!u.isString(e2.name))return"name: string expected";if(e2.method!=null&&e2.hasOwnProperty("method")){if(!Array.isArray(e2.method))return"method: array expected";for(var t2=0;t2>>3){case 1:o2.name=e2.string();break;case 2:o2.inputType=e2.string();break;case 3:o2.outputType=e2.string();break;case 4:o2.options=c.google.protobuf.MethodOptions.decode(e2,e2.uint32());break;case 5:o2.clientStreaming=e2.bool();break;case 6:o2.serverStreaming=e2.bool();break;default:e2.skipType(7&r2)}}return o2},x.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},x.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")&&!u.isString(e2.name))return"name: string expected";if(e2.inputType!=null&&e2.hasOwnProperty("inputType")&&!u.isString(e2.inputType))return"inputType: string expected";if(e2.outputType!=null&&e2.hasOwnProperty("outputType")&&!u.isString(e2.outputType))return"outputType: string expected";if(e2.options!=null&&e2.hasOwnProperty("options")){var t2=c.google.protobuf.MethodOptions.verify(e2.options);if(t2)return"options."+t2}return e2.clientStreaming!=null&&e2.hasOwnProperty("clientStreaming")&&typeof e2.clientStreaming!="boolean"?"clientStreaming: boolean expected":e2.serverStreaming!=null&&e2.hasOwnProperty("serverStreaming")&&typeof e2.serverStreaming!="boolean"?"serverStreaming: boolean expected":null},x.fromObject=function(e2){if(e2 instanceof c.google.protobuf.MethodDescriptorProto)return e2;var t2=new c.google.protobuf.MethodDescriptorProto;if(e2.name!=null&&(t2.name=String(e2.name)),e2.inputType!=null&&(t2.inputType=String(e2.inputType)),e2.outputType!=null&&(t2.outputType=String(e2.outputType)),e2.options!=null){if(typeof e2.options!="object")throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected");t2.options=c.google.protobuf.MethodOptions.fromObject(e2.options)}return e2.clientStreaming!=null&&(t2.clientStreaming=!!e2.clientStreaming),e2.serverStreaming!=null&&(t2.serverStreaming=!!e2.serverStreaming),t2},x.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.name="",n2.inputType="",n2.outputType="",n2.options=null,n2.clientStreaming=!1,n2.serverStreaming=!1),e2.name!=null&&e2.hasOwnProperty("name")&&(n2.name=e2.name),e2.inputType!=null&&e2.hasOwnProperty("inputType")&&(n2.inputType=e2.inputType),e2.outputType!=null&&e2.hasOwnProperty("outputType")&&(n2.outputType=e2.outputType),e2.options!=null&&e2.hasOwnProperty("options")&&(n2.options=c.google.protobuf.MethodOptions.toObject(e2.options,t2)),e2.clientStreaming!=null&&e2.hasOwnProperty("clientStreaming")&&(n2.clientStreaming=e2.clientStreaming),e2.serverStreaming!=null&&e2.hasOwnProperty("serverStreaming")&&(n2.serverStreaming=e2.serverStreaming),n2},x.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},x),n.FileOptions=(S.prototype.javaPackage="",S.prototype.javaOuterClassname="",S.prototype.javaMultipleFiles=!1,S.prototype.javaGenerateEqualsAndHash=!1,S.prototype.javaStringCheckUtf8=!1,S.prototype.optimizeFor=1,S.prototype.goPackage="",S.prototype.ccGenericServices=!1,S.prototype.javaGenericServices=!1,S.prototype.pyGenericServices=!1,S.prototype.phpGenericServices=!1,S.prototype.deprecated=!1,S.prototype.ccEnableArenas=!0,S.prototype.objcClassPrefix="",S.prototype.csharpNamespace="",S.prototype.swiftPrefix="",S.prototype.phpClassPrefix="",S.prototype.phpNamespace="",S.prototype.phpMetadataNamespace="",S.prototype.rubyPackage="",S.prototype.uninterpretedOption=u.emptyArray,S.create=function(e2){return new S(e2)},S.encode=function(e2,t2){if(t2=t2||r.create(),e2.javaPackage!=null&&Object.hasOwnProperty.call(e2,"javaPackage")&&t2.uint32(10).string(e2.javaPackage),e2.javaOuterClassname!=null&&Object.hasOwnProperty.call(e2,"javaOuterClassname")&&t2.uint32(66).string(e2.javaOuterClassname),e2.optimizeFor!=null&&Object.hasOwnProperty.call(e2,"optimizeFor")&&t2.uint32(72).int32(e2.optimizeFor),e2.javaMultipleFiles!=null&&Object.hasOwnProperty.call(e2,"javaMultipleFiles")&&t2.uint32(80).bool(e2.javaMultipleFiles),e2.goPackage!=null&&Object.hasOwnProperty.call(e2,"goPackage")&&t2.uint32(90).string(e2.goPackage),e2.ccGenericServices!=null&&Object.hasOwnProperty.call(e2,"ccGenericServices")&&t2.uint32(128).bool(e2.ccGenericServices),e2.javaGenericServices!=null&&Object.hasOwnProperty.call(e2,"javaGenericServices")&&t2.uint32(136).bool(e2.javaGenericServices),e2.pyGenericServices!=null&&Object.hasOwnProperty.call(e2,"pyGenericServices")&&t2.uint32(144).bool(e2.pyGenericServices),e2.javaGenerateEqualsAndHash!=null&&Object.hasOwnProperty.call(e2,"javaGenerateEqualsAndHash")&&t2.uint32(160).bool(e2.javaGenerateEqualsAndHash),e2.deprecated!=null&&Object.hasOwnProperty.call(e2,"deprecated")&&t2.uint32(184).bool(e2.deprecated),e2.javaStringCheckUtf8!=null&&Object.hasOwnProperty.call(e2,"javaStringCheckUtf8")&&t2.uint32(216).bool(e2.javaStringCheckUtf8),e2.ccEnableArenas!=null&&Object.hasOwnProperty.call(e2,"ccEnableArenas")&&t2.uint32(248).bool(e2.ccEnableArenas),e2.objcClassPrefix!=null&&Object.hasOwnProperty.call(e2,"objcClassPrefix")&&t2.uint32(290).string(e2.objcClassPrefix),e2.csharpNamespace!=null&&Object.hasOwnProperty.call(e2,"csharpNamespace")&&t2.uint32(298).string(e2.csharpNamespace),e2.swiftPrefix!=null&&Object.hasOwnProperty.call(e2,"swiftPrefix")&&t2.uint32(314).string(e2.swiftPrefix),e2.phpClassPrefix!=null&&Object.hasOwnProperty.call(e2,"phpClassPrefix")&&t2.uint32(322).string(e2.phpClassPrefix),e2.phpNamespace!=null&&Object.hasOwnProperty.call(e2,"phpNamespace")&&t2.uint32(330).string(e2.phpNamespace),e2.phpGenericServices!=null&&Object.hasOwnProperty.call(e2,"phpGenericServices")&&t2.uint32(336).bool(e2.phpGenericServices),e2.phpMetadataNamespace!=null&&Object.hasOwnProperty.call(e2,"phpMetadataNamespace")&&t2.uint32(354).string(e2.phpMetadataNamespace),e2.rubyPackage!=null&&Object.hasOwnProperty.call(e2,"rubyPackage")&&t2.uint32(362).string(e2.rubyPackage),e2.uninterpretedOption!=null&&e2.uninterpretedOption.length)for(var n2=0;n2>>3){case 1:o2.javaPackage=e2.string();break;case 8:o2.javaOuterClassname=e2.string();break;case 10:o2.javaMultipleFiles=e2.bool();break;case 20:o2.javaGenerateEqualsAndHash=e2.bool();break;case 27:o2.javaStringCheckUtf8=e2.bool();break;case 9:o2.optimizeFor=e2.int32();break;case 11:o2.goPackage=e2.string();break;case 16:o2.ccGenericServices=e2.bool();break;case 17:o2.javaGenericServices=e2.bool();break;case 18:o2.pyGenericServices=e2.bool();break;case 42:o2.phpGenericServices=e2.bool();break;case 23:o2.deprecated=e2.bool();break;case 31:o2.ccEnableArenas=e2.bool();break;case 36:o2.objcClassPrefix=e2.string();break;case 37:o2.csharpNamespace=e2.string();break;case 39:o2.swiftPrefix=e2.string();break;case 40:o2.phpClassPrefix=e2.string();break;case 41:o2.phpNamespace=e2.string();break;case 44:o2.phpMetadataNamespace=e2.string();break;case 45:o2.rubyPackage=e2.string();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},S.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},S.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.javaPackage!=null&&e2.hasOwnProperty("javaPackage")&&!u.isString(e2.javaPackage))return"javaPackage: string expected";if(e2.javaOuterClassname!=null&&e2.hasOwnProperty("javaOuterClassname")&&!u.isString(e2.javaOuterClassname))return"javaOuterClassname: string expected";if(e2.javaMultipleFiles!=null&&e2.hasOwnProperty("javaMultipleFiles")&&typeof e2.javaMultipleFiles!="boolean")return"javaMultipleFiles: boolean expected";if(e2.javaGenerateEqualsAndHash!=null&&e2.hasOwnProperty("javaGenerateEqualsAndHash")&&typeof e2.javaGenerateEqualsAndHash!="boolean")return"javaGenerateEqualsAndHash: boolean expected";if(e2.javaStringCheckUtf8!=null&&e2.hasOwnProperty("javaStringCheckUtf8")&&typeof e2.javaStringCheckUtf8!="boolean")return"javaStringCheckUtf8: boolean expected";if(e2.optimizeFor!=null&&e2.hasOwnProperty("optimizeFor"))switch(e2.optimizeFor){default:return"optimizeFor: enum value expected";case 1:case 2:case 3:}if(e2.goPackage!=null&&e2.hasOwnProperty("goPackage")&&!u.isString(e2.goPackage))return"goPackage: string expected";if(e2.ccGenericServices!=null&&e2.hasOwnProperty("ccGenericServices")&&typeof e2.ccGenericServices!="boolean")return"ccGenericServices: boolean expected";if(e2.javaGenericServices!=null&&e2.hasOwnProperty("javaGenericServices")&&typeof e2.javaGenericServices!="boolean")return"javaGenericServices: boolean expected";if(e2.pyGenericServices!=null&&e2.hasOwnProperty("pyGenericServices")&&typeof e2.pyGenericServices!="boolean")return"pyGenericServices: boolean expected";if(e2.phpGenericServices!=null&&e2.hasOwnProperty("phpGenericServices")&&typeof e2.phpGenericServices!="boolean")return"phpGenericServices: boolean expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.ccEnableArenas!=null&&e2.hasOwnProperty("ccEnableArenas")&&typeof e2.ccEnableArenas!="boolean")return"ccEnableArenas: boolean expected";if(e2.objcClassPrefix!=null&&e2.hasOwnProperty("objcClassPrefix")&&!u.isString(e2.objcClassPrefix))return"objcClassPrefix: string expected";if(e2.csharpNamespace!=null&&e2.hasOwnProperty("csharpNamespace")&&!u.isString(e2.csharpNamespace))return"csharpNamespace: string expected";if(e2.swiftPrefix!=null&&e2.hasOwnProperty("swiftPrefix")&&!u.isString(e2.swiftPrefix))return"swiftPrefix: string expected";if(e2.phpClassPrefix!=null&&e2.hasOwnProperty("phpClassPrefix")&&!u.isString(e2.phpClassPrefix))return"phpClassPrefix: string expected";if(e2.phpNamespace!=null&&e2.hasOwnProperty("phpNamespace")&&!u.isString(e2.phpNamespace))return"phpNamespace: string expected";if(e2.phpMetadataNamespace!=null&&e2.hasOwnProperty("phpMetadataNamespace")&&!u.isString(e2.phpMetadataNamespace))return"phpMetadataNamespace: string expected";if(e2.rubyPackage!=null&&e2.hasOwnProperty("rubyPackage")&&!u.isString(e2.rubyPackage))return"rubyPackage: string expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 1:o2.messageSetWireFormat=e2.bool();break;case 2:o2.noStandardDescriptorAccessor=e2.bool();break;case 3:o2.deprecated=e2.bool();break;case 7:o2.mapEntry=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},k.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},k.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.messageSetWireFormat!=null&&e2.hasOwnProperty("messageSetWireFormat")&&typeof e2.messageSetWireFormat!="boolean")return"messageSetWireFormat: boolean expected";if(e2.noStandardDescriptorAccessor!=null&&e2.hasOwnProperty("noStandardDescriptorAccessor")&&typeof e2.noStandardDescriptorAccessor!="boolean")return"noStandardDescriptorAccessor: boolean expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.mapEntry!=null&&e2.hasOwnProperty("mapEntry")&&typeof e2.mapEntry!="boolean")return"mapEntry: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 1:o2.ctype=e2.int32();break;case 2:o2.packed=e2.bool();break;case 6:o2.jstype=e2.int32();break;case 5:o2.lazy=e2.bool();break;case 3:o2.deprecated=e2.bool();break;case 10:o2.weak=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},D.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},D.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.ctype!=null&&e2.hasOwnProperty("ctype"))switch(e2.ctype){default:return"ctype: enum value expected";case 0:case 1:case 2:}if(e2.packed!=null&&e2.hasOwnProperty("packed")&&typeof e2.packed!="boolean")return"packed: boolean expected";if(e2.jstype!=null&&e2.hasOwnProperty("jstype"))switch(e2.jstype){default:return"jstype: enum value expected";case 0:case 1:case 2:}if(e2.lazy!=null&&e2.hasOwnProperty("lazy")&&typeof e2.lazy!="boolean")return"lazy: boolean expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.weak!=null&&e2.hasOwnProperty("weak")&&typeof e2.weak!="boolean")return"weak: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3==999?(o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},M.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},M.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 2:o2.allowAlias=e2.bool();break;case 3:o2.deprecated=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},T.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},T.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.allowAlias!=null&&e2.hasOwnProperty("allowAlias")&&typeof e2.allowAlias!="boolean")return"allowAlias: boolean expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 1:o2.deprecated=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;default:e2.skipType(7&r2)}}return o2},E.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},E.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 33:o2.deprecated=e2.bool();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;case 1049:o2[".google.api.defaultHost"]=e2.string();break;case 1050:o2[".google.api.oauthScopes"]=e2.string();break;default:e2.skipType(7&r2)}}return o2},A.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},A.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 33:o2.deprecated=e2.bool();break;case 34:o2.idempotencyLevel=e2.int32();break;case 999:o2.uninterpretedOption&&o2.uninterpretedOption.length||(o2.uninterpretedOption=[]),o2.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e2,e2.uint32()));break;case 72295728:o2[".google.api.http"]=c.google.api.HttpRule.decode(e2,e2.uint32());break;case 1051:o2[".google.api.methodSignature"]&&o2[".google.api.methodSignature"].length||(o2[".google.api.methodSignature"]=[]),o2[".google.api.methodSignature"].push(e2.string());break;default:e2.skipType(7&r2)}}return o2},N.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},N.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.deprecated!=null&&e2.hasOwnProperty("deprecated")&&typeof e2.deprecated!="boolean")return"deprecated: boolean expected";if(e2.idempotencyLevel!=null&&e2.hasOwnProperty("idempotencyLevel"))switch(e2.idempotencyLevel){default:return"idempotencyLevel: enum value expected";case 0:case 1:case 2:}if(e2.uninterpretedOption!=null&&e2.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e2.uninterpretedOption))return"uninterpretedOption: array expected";for(var t2=0;t2>>3){case 2:o2.name&&o2.name.length||(o2.name=[]),o2.name.push(c.google.protobuf.UninterpretedOption.NamePart.decode(e2,e2.uint32()));break;case 3:o2.identifierValue=e2.string();break;case 4:o2.positiveIntValue=e2.uint64();break;case 5:o2.negativeIntValue=e2.int64();break;case 6:o2.doubleValue=e2.double();break;case 7:o2.stringValue=e2.bytes();break;case 8:o2.aggregateValue=e2.string();break;default:e2.skipType(7&r2)}}return o2},I.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},I.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.name!=null&&e2.hasOwnProperty("name")){if(!Array.isArray(e2.name))return"name: array expected";for(var t2=0;t2>>0,e2.positiveIntValue.high>>>0).toNumber(!0))),e2.negativeIntValue!=null&&(u.Long?(t2.negativeIntValue=u.Long.fromValue(e2.negativeIntValue)).unsigned=!1:typeof e2.negativeIntValue=="string"?t2.negativeIntValue=parseInt(e2.negativeIntValue,10):typeof e2.negativeIntValue=="number"?t2.negativeIntValue=e2.negativeIntValue:typeof e2.negativeIntValue=="object"&&(t2.negativeIntValue=new u.LongBits(e2.negativeIntValue.low>>>0,e2.negativeIntValue.high>>>0).toNumber())),e2.doubleValue!=null&&(t2.doubleValue=Number(e2.doubleValue)),e2.stringValue!=null&&(typeof e2.stringValue=="string"?u.base64.decode(e2.stringValue,t2.stringValue=u.newBuffer(u.base64.length(e2.stringValue)),0):e2.stringValue.length&&(t2.stringValue=e2.stringValue)),e2.aggregateValue!=null&&(t2.aggregateValue=String(e2.aggregateValue)),t2},I.toObject=function(e2,t2){var n2,o2={};if(((t2=t2||{}).arrays||t2.defaults)&&(o2.name=[]),t2.defaults&&(o2.identifierValue="",u.Long?(n2=new u.Long(0,0,!0),o2.positiveIntValue=t2.longs===String?n2.toString():t2.longs===Number?n2.toNumber():n2):o2.positiveIntValue=t2.longs===String?"0":0,u.Long?(n2=new u.Long(0,0,!1),o2.negativeIntValue=t2.longs===String?n2.toString():t2.longs===Number?n2.toNumber():n2):o2.negativeIntValue=t2.longs===String?"0":0,o2.doubleValue=0,t2.bytes===String?o2.stringValue="":(o2.stringValue=[],t2.bytes!==Array&&(o2.stringValue=u.newBuffer(o2.stringValue))),o2.aggregateValue=""),e2.name&&e2.name.length){o2.name=[];for(var r2=0;r2>>0,e2.positiveIntValue.high>>>0).toNumber(!0):e2.positiveIntValue),e2.negativeIntValue!=null&&e2.hasOwnProperty("negativeIntValue")&&(typeof e2.negativeIntValue=="number"?o2.negativeIntValue=t2.longs===String?String(e2.negativeIntValue):e2.negativeIntValue:o2.negativeIntValue=t2.longs===String?u.Long.prototype.toString.call(e2.negativeIntValue):t2.longs===Number?new u.LongBits(e2.negativeIntValue.low>>>0,e2.negativeIntValue.high>>>0).toNumber():e2.negativeIntValue),e2.doubleValue!=null&&e2.hasOwnProperty("doubleValue")&&(o2.doubleValue=t2.json&&!isFinite(e2.doubleValue)?String(e2.doubleValue):e2.doubleValue),e2.stringValue!=null&&e2.hasOwnProperty("stringValue")&&(o2.stringValue=t2.bytes===String?u.base64.encode(e2.stringValue,0,e2.stringValue.length):t2.bytes===Array?Array.prototype.slice.call(e2.stringValue):e2.stringValue),e2.aggregateValue!=null&&e2.hasOwnProperty("aggregateValue")&&(o2.aggregateValue=e2.aggregateValue),o2},I.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},I.NamePart=(R.prototype.namePart="",R.prototype.isExtension=!1,R.create=function(e2){return new R(e2)},R.encode=function(e2,t2){return(t2=t2||r.create()).uint32(10).string(e2.namePart),t2.uint32(16).bool(e2.isExtension),t2},R.encodeDelimited=function(e2,t2){return this.encode(e2,t2).ldelim()},R.decode=function(e2,t2){e2 instanceof s||(e2=s.create(e2));for(var n2=t2===void 0?e2.len:e2.pos+t2,o2=new c.google.protobuf.UninterpretedOption.NamePart;e2.pos>>3){case 1:o2.namePart=e2.string();break;case 2:o2.isExtension=e2.bool();break;default:e2.skipType(7&r2)}}if(!o2.hasOwnProperty("namePart"))throw u.ProtocolError("missing required 'namePart'",{instance:o2});if(o2.hasOwnProperty("isExtension"))return o2;throw u.ProtocolError("missing required 'isExtension'",{instance:o2})},R.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},R.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":u.isString(e2.namePart)?typeof e2.isExtension!="boolean"?"isExtension: boolean expected":null:"namePart: string expected"},R.fromObject=function(e2){var t2;return e2 instanceof c.google.protobuf.UninterpretedOption.NamePart?e2:(t2=new c.google.protobuf.UninterpretedOption.NamePart,e2.namePart!=null&&(t2.namePart=String(e2.namePart)),e2.isExtension!=null&&(t2.isExtension=!!e2.isExtension),t2)},R.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.namePart="",n2.isExtension=!1),e2.namePart!=null&&e2.hasOwnProperty("namePart")&&(n2.namePart=e2.namePart),e2.isExtension!=null&&e2.hasOwnProperty("isExtension")&&(n2.isExtension=e2.isExtension),n2},R.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},R),I),n.SourceCodeInfo=(_.prototype.location=u.emptyArray,_.create=function(e2){return new _(e2)},_.encode=function(e2,t2){if(t2=t2||r.create(),e2.location!=null&&e2.location.length)for(var n2=0;n2>>3==1?(o2.location&&o2.location.length||(o2.location=[]),o2.location.push(c.google.protobuf.SourceCodeInfo.Location.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},_.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},_.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.location!=null&&e2.hasOwnProperty("location")){if(!Array.isArray(e2.location))return"location: array expected";for(var t2=0;t2>>3){case 1:if(o2.path&&o2.path.length||(o2.path=[]),(7&r2)==2)for(var i2=e2.uint32()+e2.pos;e2.pos>>3==1?(o2.annotation&&o2.annotation.length||(o2.annotation=[]),o2.annotation.push(c.google.protobuf.GeneratedCodeInfo.Annotation.decode(e2,e2.uint32()))):e2.skipType(7&r2)}return o2},J.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},J.verify=function(e2){if(typeof e2!="object"||e2===null)return"object expected";if(e2.annotation!=null&&e2.hasOwnProperty("annotation")){if(!Array.isArray(e2.annotation))return"annotation: array expected";for(var t2=0;t2>>3){case 1:if(o2.path&&o2.path.length||(o2.path=[]),(7&r2)==2)for(var i2=e2.uint32()+e2.pos;e2.pos>>3){case 1:o2.type_url=e2.string();break;case 2:o2.value=e2.bytes();break;default:e2.skipType(7&r2)}}return o2},H.decodeDelimited=function(e2){return e2 instanceof s||(e2=new s(e2)),this.decode(e2,e2.uint32())},H.verify=function(e2){return typeof e2!="object"||e2===null?"object expected":e2.type_url!=null&&e2.hasOwnProperty("type_url")&&!u.isString(e2.type_url)?"type_url: string expected":e2.value!=null&&e2.hasOwnProperty("value")&&!(e2.value&&typeof e2.value.length=="number"||u.isString(e2.value))?"value: buffer expected":null},H.fromObject=function(e2){var t2;return e2 instanceof c.google.protobuf.Any?e2:(t2=new c.google.protobuf.Any,e2.type_url!=null&&(t2.type_url=String(e2.type_url)),e2.value!=null&&(typeof e2.value=="string"?u.base64.decode(e2.value,t2.value=u.newBuffer(u.base64.length(e2.value)),0):e2.value.length&&(t2.value=e2.value)),t2)},H.toObject=function(e2,t2){var n2={};return(t2=t2||{}).defaults&&(n2.type_url="",t2.bytes===String?n2.value="":(n2.value=[],t2.bytes!==Array&&(n2.value=u.newBuffer(n2.value)))),e2.type_url!=null&&e2.hasOwnProperty("type_url")&&(n2.type_url=e2.type_url),e2.value!=null&&e2.hasOwnProperty("value")&&(n2.value=t2.bytes===String?u.base64.encode(e2.value,0,e2.value.length):t2.bytes===Array?Array.prototype.slice.call(e2.value):e2.value),n2},H.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},H),n),F),c})}});var require_pathTemplate=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/pathTemplate.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.PathTemplate=void 0;var PathTemplate=class{constructor(data){this.bindings={},this.data=data,this.segments=this.parsePathTemplate(data),this.size=this.segments.length}match(path){let pathSegments=path.split("/"),bindings={};if(pathSegments.length!==this.segments.length)if(this.data.includes("**")){if(pathSegments.length!==this.segments.length+1)throw new TypeError(`This path ${path} does not match path template ${this.data}, the number of parameters is not same with one wildcard.`)}else throw new TypeError(`This path ${path} does not match path template ${this.data}, the number of parameters is not same.`);for(let index=0;index0;index++)if(this.segments[index]!==pathSegments[0])if(this.segments[index].includes("*")){let segment=this.segments[index],matches=segment.match(/\{[$0-9a-zA-Z_]+=.*?\}/g);if(!matches)throw new Error(`Error processing path template segment ${segment}`);let variables=matches.map(str=>str.replace(/^\{/,"").replace(/=.*/,""));if(segment.includes("**"))bindings[variables[0]]=pathSegments[0]+"/"+pathSegments[1],pathSegments=pathSegments.slice(2);else{if(variables.length===1)bindings[variables[0]]=pathSegments[0];else{let value=pathSegments[0].split(/[-_.~]/);if(value.length!==variables.length)throw new Error(`segment ${segment} does not match ${pathSegments[0]}`);for(let v of variables)bindings[v]=value[0],segment=segment.replace(`{${v}=*}`,`${value[0]}`),value.shift();if(segment!==pathSegments[0])throw new TypeError(`non slash resource pattern ${this.segments[index]} and ${pathSegments[0]} should have same separator`)}pathSegments.shift()}}else throw new TypeError(`segment does not match, ${this.segments[index]} and ${pathSegments[index]}.`);else pathSegments.shift();return bindings}render(bindings){if(Object.keys(bindings).length!==Object.keys(this.bindings).length)throw new TypeError(`The number of variables ${Object.keys(bindings).length} does not match the number of needed variables ${Object.keys(this.bindings).length}`);let path=this.inspect();for(let key of Object.keys(bindings)){let b=bindings[key].toString();if(!this.bindings[key])throw new TypeError(`render fails for not matching ${bindings[key]}`);let variable=this.bindings[key];if(variable==="*"){if(!b.match(/[^/{}]+/))throw new TypeError(`render fails for not matching ${b}`);path=path.replace(`{${key}=*}`,`${b}`)}else if(variable==="**"){if(!b.match(/[^{}]+/))throw new TypeError(`render fails for not matching ${b}`);path=path.replace(`{${key}=**}`,`${b}`)}}return path}inspect(){return this.segments.join("/")}parsePathTemplate(data){let pathSegments=splitPathTemplate(data),index=0,wildCardCount=0,segments=[],matches;if(pathSegments.forEach(segment=>{if(segment==="*"||segment==="**")this.bindings[`$${index}`]=segment,segments.push(`{$${index}=${segment}}`),index=index+1,segment==="**"&&++wildCardCount;else if(matches=segment.match(/\{[0-9a-zA-Z-.~_]+(?:=.*?)?\}/g)){for(let subsegment of matches){let pairMatch=subsegment.match(/^\{([0-9a-zA-Z-.~_]+)(?:=(.*?))?\}$/);if(!pairMatch)throw new Error(`Cannot process path template segment ${subsegment}`);let key=pairMatch[1],value=pairMatch[2];value?value==="*"?this.bindings[key]=value:value==="**"&&(++wildCardCount,this.bindings[key]=value):(value="*",segment=segment.replace(key,key+"=*"),this.bindings[key]=value)}segments.push(segment)}else segment.match(/[0-9a-zA-Z-.~_]+/)&&segments.push(segment)}),wildCardCount>1)throw new TypeError("Can not have more than one wildcard.");return segments}};__name(PathTemplate,"PathTemplate");exports2.PathTemplate=PathTemplate;function splitPathTemplate(data){let left=0,right=0,bracketCount=0,segments=[];for(;right>=left&&right(...args)=>this._terminated?Promise.reject("The client has already been closed."):stub[methodName].apply(stub,args),err=>()=>{throw err});this.innerApiCalls[methodName]=(0,createApiCall_1.createApiCall)(innerCallPromise,this._defaults[methodName],this.descriptors.page[methodName])}return this.iamPolicyStub}static get servicePath(){return"cloudkms.googleapis.com"}static get apiEndpoint(){return"cloudkms.googleapis.com"}static get port(){return 443}static get scopes(){return["https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudkms"]}getProjectId(callback){if(this.auth&&"getProjectId"in this.auth)return this.auth.getProjectId(callback);if(callback)callback(new Error("Cannot determine project ID."));else return Promise.reject("Cannot determine project ID.")}getIamPolicy(request,optionsOrCallback,callback){let options;return optionsOrCallback instanceof Function&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=routingHeader.fromParams({resource:request.resource}),this.initialize(),this.innerApiCalls.getIamPolicy(request,options,callback)}setIamPolicy(request,optionsOrCallback,callback){let options;return optionsOrCallback instanceof Function&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=routingHeader.fromParams({resource:request.resource}),this.initialize(),this.innerApiCalls.setIamPolicy(request,options,callback)}testIamPermissions(request,optionsOrCallback,callback){let options;return optionsOrCallback instanceof Function&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=routingHeader.fromParams({resource:request.resource}),this.initialize(),this.innerApiCalls.testIamPermissions(request,options,callback)}close(){return this.initialize(),this._terminated?Promise.resolve():this.iamPolicyStub.then(stub=>{this._terminated=!0,stub.close()})}};__name(IamClient,"IamClient");exports2.IamClient=IamClient}});var require_locations2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/protos/locations.json"(exports2,module2){module2.exports={nested:{google:{nested:{cloud:{nested:{location:{options:{cc_enable_arenas:!0,go_package:"google.golang.org/genproto/googleapis/cloud/location;location",java_multiple_files:!0,java_outer_classname:"LocationsProto",java_package:"com.google.cloud.location"},nested:{Locations:{options:{"(google.api.default_host)":"cloud.googleapis.com","(google.api.oauth_scopes)":"https://www.googleapis.com/auth/cloud-platform"},methods:{ListLocations:{requestType:"ListLocationsRequest",responseType:"ListLocationsResponse",options:{"(google.api.http).get":"/v1/{name=locations}","(google.api.http).additional_bindings.get":"/v1/{name=projects/*}/locations"},parsedOptions:[{"(google.api.http)":{get:"/v1/{name=locations}",additional_bindings:{get:"/v1/{name=projects/*}/locations"}}}]},GetLocation:{requestType:"GetLocationRequest",responseType:"Location",options:{"(google.api.http).get":"/v1/{name=locations/*}","(google.api.http).additional_bindings.get":"/v1/{name=projects/*/locations/*}"},parsedOptions:[{"(google.api.http)":{get:"/v1/{name=locations/*}",additional_bindings:{get:"/v1/{name=projects/*/locations/*}"}}}]}}},ListLocationsRequest:{fields:{name:{type:"string",id:1},filter:{type:"string",id:2},pageSize:{type:"int32",id:3},pageToken:{type:"string",id:4}}},ListLocationsResponse:{fields:{locations:{rule:"repeated",type:"Location",id:1},nextPageToken:{type:"string",id:2}}},GetLocationRequest:{fields:{name:{type:"string",id:1}}},Location:{fields:{name:{type:"string",id:1},locationId:{type:"string",id:4},displayName:{type:"string",id:5},labels:{keyType:"string",type:"string",id:2},metadata:{type:"google.protobuf.Any",id:3}}}}}}},api:{options:{go_package:"google.golang.org/genproto/googleapis/api/annotations;annotations",java_multiple_files:!0,java_outer_classname:"ClientProto",java_package:"com.google.api",objc_class_prefix:"GAPI",cc_enable_arenas:!0},nested:{http:{type:"HttpRule",id:72295728,extend:"google.protobuf.MethodOptions"},Http:{fields:{rules:{rule:"repeated",type:"HttpRule",id:1},fullyDecodeReservedExpansion:{type:"bool",id:2}}},HttpRule:{oneofs:{pattern:{oneof:["get","put","post","delete","patch","custom"]}},fields:{selector:{type:"string",id:1},get:{type:"string",id:2},put:{type:"string",id:3},post:{type:"string",id:4},delete:{type:"string",id:5},patch:{type:"string",id:6},custom:{type:"CustomHttpPattern",id:8},body:{type:"string",id:7},responseBody:{type:"string",id:12},additionalBindings:{rule:"repeated",type:"HttpRule",id:11}}},CustomHttpPattern:{fields:{kind:{type:"string",id:1},path:{type:"string",id:2}}},methodSignature:{rule:"repeated",type:"string",id:1051,extend:"google.protobuf.MethodOptions"},defaultHost:{type:"string",id:1049,extend:"google.protobuf.ServiceOptions"},oauthScopes:{type:"string",id:1050,extend:"google.protobuf.ServiceOptions"}}},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:{fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}}},FileDescriptorProto:{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,options:{packed:!1}},weakDependency:{rule:"repeated",type:"int32",id:11,options:{packed:!1}},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}}},DescriptorProto:{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}},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:{fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},FieldDescriptorProto:{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_REQUIRED:2,LABEL_REPEATED:3}}}},OneofDescriptorProto:{fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{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}},nested:{EnumReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},EnumValueDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{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,options:{default:!1}},serverStreaming:{type:"bool",id:6,options:{default:!1}}}},FileOptions:{fields:{javaPackage:{type:"string",id:1},javaOuterClassname:{type:"string",id:8},javaMultipleFiles:{type:"bool",id:10,options:{default:!1}},javaGenerateEqualsAndHash:{type:"bool",id:20,options:{deprecated:!0}},javaStringCheckUtf8:{type:"bool",id:27,options:{default:!1}},optimizeFor:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},goPackage:{type:"string",id:11},ccGenericServices:{type:"bool",id:16,options:{default:!1}},javaGenericServices:{type:"bool",id:17,options:{default:!1}},pyGenericServices:{type:"bool",id:18,options:{default:!1}},phpGenericServices:{type:"bool",id:42,options:{default:!1}},deprecated:{type:"bool",id:23,options:{default:!1}},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},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[38,38]],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{fields:{messageSetWireFormat:{type:"bool",id:1,options:{default:!1}},noStandardDescriptorAccessor:{type:"bool",id:2,options:{default:!1}},deprecated:{type:"bool",id:3,options:{default:!1}},mapEntry:{type:"bool",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[8,8],[9,9]]},FieldOptions:{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,options:{default:!1}},deprecated:{type:"bool",id:3,options:{default:!1}},weak:{type:"bool",id:10,options:{default:!1}},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}}}},OneofOptions:{fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3,options:{default:!1}},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[5,5]]},EnumValueOptions:{fields:{deprecated:{type:"bool",id:1,options:{default:!1}},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{fields:{deprecated:{type:"bool",id:33,options:{default:!1}},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{fields:{deprecated:{type:"bool",id:33,options:{default:!1}},idempotencyLevel:{type:"IdempotencyLevel",id:34,options:{default:"IDEMPOTENCY_UNKNOWN"}},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],nested:{IdempotencyLevel:{values:{IDEMPOTENCY_UNKNOWN:0,NO_SIDE_EFFECTS:1,IDEMPOTENT:2}}}},UninterpretedOption:{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}}}}},SourceCodeInfo:{fields:{location:{rule:"repeated",type:"Location",id:1}},nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1},span:{rule:"repeated",type:"int32",id:2},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4}}}}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}}}}}}}});var require_locations_client_config=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/locations_client_config.json"(exports2,module2){module2.exports={interfaces:{"google.cloud.location.Locations":{retry_codes:{non_idempotent:[],idempotent:["DEADLINE_EXCEEDED","UNAVAILABLE"]},retry_params:{default:{initial_retry_delay_millis:100,retry_delay_multiplier:1.3,max_retry_delay_millis:6e4,initial_rpc_timeout_millis:6e4,rpc_timeout_multiplier:1,max_rpc_timeout_millis:6e4,total_timeout_millis:6e5}},methods:{ListLocations:{retry_codes_name:"non_idempotent",retry_params_name:"default"},GetLocation:{retry_codes_name:"non_idempotent",retry_params_name:"default"}}}}}}});var require_locationService=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/locationService.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.LocationsClient=void 0;var gax=require_gax(),warnings_1=require_warnings(),createApiCall_1=require_createApiCall(),routingHeader=require_routingHeader(),pageDescriptor_1=require_pageDescriptor(),jsonProtos=require_locations2(),gapicConfig=require_locations_client_config(),version2=require_package3().version,LocationsClient=class{constructor(gaxGrpc,opts){var _a,_b;this._terminated=!1,this.descriptors={page:{},stream:{},longrunning:{},batching:{}},this.gaxGrpc=gaxGrpc;let staticMembers=this.constructor,servicePath=opts?.servicePath||opts?.apiEndpoint||staticMembers.servicePath;this._providedCustomServicePath=!!(opts?.servicePath||opts?.apiEndpoint);let port=opts?.port||staticMembers.port,clientConfig=(_a=opts?.clientConfig)!==null&&_a!==void 0?_a:{},fallback=(_b=opts?.fallback)!==null&&_b!==void 0?_b:typeof window<"u"&&typeof window?.fetch=="function";opts=Object.assign({servicePath,port,clientConfig,fallback},opts),servicePath!==staticMembers.servicePath&&!("scopes"in opts)&&(opts.scopes=staticMembers.scopes),this._opts=opts,this.auth=gaxGrpc.auth,servicePath===staticMembers.servicePath&&(this.auth.defaultScopes=staticMembers.scopes);let clientHeader=[`gax/${version2}`,`gapic/${version2}`];typeof process<"u"&&"versions"in process?clientHeader.push(`gl-node/${process.versions.node}`):clientHeader.push(`gl-web/${version2}`),opts.fallback?opts.fallback==="rest"&&clientHeader.push(`rest/${gaxGrpc.grpcVersion}`):clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`),opts.libName&&opts.libVersion&&clientHeader.push(`${opts.libName}/${opts.libVersion}`),this._protos=gaxGrpc.loadProtoJSON(jsonProtos),this.descriptors.page={listLocations:new pageDescriptor_1.PageDescriptor("pageToken","nextPageToken","locations")},this._defaults=gaxGrpc.constructSettings("google.cloud.location.Locations",gapicConfig,opts.clientConfig||{},{"x-goog-api-client":clientHeader.join(" ")}),this.innerApiCalls={},this.warn=warnings_1.warn}initialize(){if(this.locationsStub)return this.locationsStub;this.locationsStub=this.gaxGrpc.createStub(this._opts.fallback?this._protos.lookupService("google.cloud.location.Locations"):this._protos.google.cloud.location.Locations,this._opts,this._providedCustomServicePath);let locationsStubMethods=["listLocations","getLocation"];for(let methodName of locationsStubMethods){let callPromise=this.locationsStub.then(stub=>(...args)=>this._terminated?Promise.reject("The client has already been closed."):stub[methodName].apply(stub,args),err=>()=>{throw err}),descriptor=this.descriptors.page[methodName]||void 0,apiCall=(0,createApiCall_1.createApiCall)(callPromise,this._defaults[methodName],descriptor);this.innerApiCalls[methodName]=apiCall}return this.locationsStub}static get servicePath(){return"cloud.googleapis.com"}static get apiEndpoint(){return"cloud.googleapis.com"}static get port(){return 443}static get scopes(){return["https://www.googleapis.com/auth/cloud-platform"]}getProjectId(callback){if(callback){this.auth.getProjectId(callback);return}return this.auth.getProjectId()}getLocation(request,optionsOrCallback,callback){request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=routingHeader.fromParams({name:request.name||""}),this.initialize(),this.innerApiCalls.getLocation(request,options,callback)}listLocations(request,optionsOrCallback,callback){request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=routingHeader.fromParams({name:request.name||""}),this.initialize(),this.innerApiCalls.listLocations(request,options,callback)}listLocationsAsync(request,options){request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=routingHeader.fromParams({name:request.name||""}),options=options||{};let callSettings=new gax.CallSettings(options);return this.initialize(),this.descriptors.page.listLocations.asyncIterate(this.innerApiCalls.listLocations,request,callSettings)}close(){return this.initialize(),this._terminated?Promise.resolve():this.locationsStub.then(stub=>{this._terminated=!0,stub.close()})}};__name(LocationsClient,"LocationsClient");exports2.LocationsClient=LocationsClient}});var require_fallback=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/fallback.js"(exports2,module2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.fallback=exports2.GoogleError=exports2.operation=exports2.Operation=exports2.warn=exports2.protobufMinimal=exports2.protobuf=exports2.createApiCall=exports2.LocationProtos=exports2.IamProtos=exports2.operationsProtos=exports2.lro=exports2.GrpcClient=exports2.defaultToObjectOptions=exports2.makeUUID=exports2.LocationsClient=exports2.IamClient=exports2.OperationsClient=exports2.StreamType=exports2.StreamDescriptor=exports2.PageDescriptor=exports2.LongrunningDescriptor=exports2.BundleDescriptor=exports2.version=exports2.createDefaultBackoffSettings=exports2.RetryOptions=exports2.constructSettings=exports2.CallSettings=exports2.routingHeader=exports2.PathTemplate=void 0;var objectHash=require_object_hash(),protobuf=require_protobufjs();exports2.protobuf=protobuf;var gax=require_gax(),routingHeader=require_routingHeader();exports2.routingHeader=routingHeader;var status_1=require_status(),google_auth_library_1=require_src6(),operationsClient_1=require_operationsClient(),createApiCall_1=require_createApiCall(),fallbackRest=require_fallbackRest(),featureDetection_1=require_featureDetection(),fallbackServiceStub_1=require_fallbackServiceStub(),streaming_1=require_streaming(),util_1=require_util2(),IamProtos=require_iam_service();exports2.IamProtos=IamProtos;var LocationProtos=require_locations();exports2.LocationProtos=LocationProtos;var operationsProtos=require_operations();exports2.operationsProtos=operationsProtos;var pathTemplate_1=require_pathTemplate();Object.defineProperty(exports2,"PathTemplate",{enumerable:!0,get:function(){return pathTemplate_1.PathTemplate}});var gax_1=require_gax();Object.defineProperty(exports2,"CallSettings",{enumerable:!0,get:function(){return gax_1.CallSettings}});Object.defineProperty(exports2,"constructSettings",{enumerable:!0,get:function(){return gax_1.constructSettings}});Object.defineProperty(exports2,"RetryOptions",{enumerable:!0,get:function(){return gax_1.RetryOptions}});Object.defineProperty(exports2,"createDefaultBackoffSettings",{enumerable:!0,get:function(){return gax_1.createDefaultBackoffSettings}});exports2.version=require_package3().version+"-fallback";var descriptor_1=require_descriptor();Object.defineProperty(exports2,"BundleDescriptor",{enumerable:!0,get:function(){return descriptor_1.BundleDescriptor}});Object.defineProperty(exports2,"LongrunningDescriptor",{enumerable:!0,get:function(){return descriptor_1.LongrunningDescriptor}});Object.defineProperty(exports2,"PageDescriptor",{enumerable:!0,get:function(){return descriptor_1.PageDescriptor}});Object.defineProperty(exports2,"StreamDescriptor",{enumerable:!0,get:function(){return descriptor_1.StreamDescriptor}});var streaming_2=require_streaming();Object.defineProperty(exports2,"StreamType",{enumerable:!0,get:function(){return streaming_2.StreamType}});var operationsClient_2=require_operationsClient();Object.defineProperty(exports2,"OperationsClient",{enumerable:!0,get:function(){return operationsClient_2.OperationsClient}});var iamService_1=require_iamService();Object.defineProperty(exports2,"IamClient",{enumerable:!0,get:function(){return iamService_1.IamClient}});var locationService_1=require_locationService();Object.defineProperty(exports2,"LocationsClient",{enumerable:!0,get:function(){return locationService_1.LocationsClient}});var util_2=require_util2();Object.defineProperty(exports2,"makeUUID",{enumerable:!0,get:function(){return util_2.makeUUID}});exports2.defaultToObjectOptions={keepCase:!1,longs:String,enums:String,defaults:!0,oneofs:!0};var CLIENT_VERSION_HEADER="x-goog-api-client",GrpcClient=class{static clearProtoCache(){GrpcClient.protoCache.clear()}constructor(options={}){var _a;if((0,featureDetection_1.isNodeJS)())this.auth=options.auth||new google_auth_library_1.GoogleAuth(options);else{if(!options.auth)throw new Error(JSON.stringify(options)+"You need to pass auth instance to use gRPC-fallback client in browser or other non-Node.js environments. Use OAuth2Client from google-auth-library.");this.auth=options.auth}this.fallback=!!options.fallback,this.grpcVersion=require_package3().version,this.httpRules=options.httpRules,this.numericEnums=(_a=options.numericEnums)!==null&&_a!==void 0?_a:!1}loadProto(jsonObject){return protobuf.Root.fromJSON(jsonObject)}loadProtoJSON(json,ignoreCache=!1){let hash=objectHash(JSON.stringify(json)).toString(),cached=GrpcClient.protoCache.get(hash);if(cached&&!ignoreCache)return cached;let root=protobuf.Root.fromJSON(json);return GrpcClient.protoCache.set(hash,root),root}static getServiceMethods(service){let methods={};for(let[methodName,methodObject]of Object.entries(service.methods)){let methodNameLowerCamelCase=(0,util_1.toLowerCamelCase)(methodName);methods[methodNameLowerCamelCase]=methodObject}return methods}constructSettings(serviceName,clientConfig,configOverrides,headers){function buildMetadata(abTests,moreHeaders){let metadata={};headers||(headers={});for(let key in headers)metadata[key]=Array.isArray(headers[key])?headers[key]:[headers[key]];let clientVersions=[];if(metadata[CLIENT_VERSION_HEADER]&&metadata[CLIENT_VERSION_HEADER][0]&&clientVersions.push(...metadata[CLIENT_VERSION_HEADER][0].split(" ")),clientVersions.push(`grpc-web/${exports2.version}`),metadata[CLIENT_VERSION_HEADER]=[clientVersions.join(" ")],!moreHeaders)return metadata;for(let key in moreHeaders)if(key.toLowerCase()!==CLIENT_VERSION_HEADER){let value=moreHeaders[key];if(Array.isArray(value))if(metadata[key]===void 0)metadata[key]=value;else if(Array.isArray(metadata[key]))metadata[key].push(...value);else throw new Error(`Can not add value ${value} to the call metadata.`);else metadata[key]=[value]}return metadata}return __name(buildMetadata,"buildMetadata"),gax.constructSettings(serviceName,clientConfig,configOverrides,status_1.Status,{metadataBuilder:buildMetadata})}async createStub(service,opts,customServicePath){if(this.authClient||(this.auth&&"getClient"in this.auth?this.authClient=await this.auth.getClient():this.auth&&"getRequestHeaders"in this.auth&&(this.authClient=this.auth)),!this.authClient)throw new Error("No authentication was provided");if(opts.universeDomain||(opts.universeDomain="googleapis.com"),opts.universeDomain){let universeFromAuth=this.authClient.universeDomain;if(universeFromAuth&&opts.universeDomain!==universeFromAuth)throw new Error(`The configured universe domain (${opts.universeDomain}) does not match the universe domain found in the credentials (${universeFromAuth}). If you haven't configured the universe domain explicitly, googleapis.com is the default.`)}service.resolveAll();let methods=GrpcClient.getServiceMethods(service),protocol=opts.protocol||"https",servicePath=opts.servicePath;if(!servicePath&&service.options&&service.options["(google.api.default_host)"]&&(servicePath=service.options["(google.api.default_host)"]),!servicePath)throw new Error(`Cannot determine service API path for service ${service.name}.`);let servicePort,match=servicePath.match(/^(.*):(\d+)$/);match&&(servicePath=match[1],servicePort=parseInt(match[2])),opts.port?servicePort=opts.port:servicePort||(servicePort=443);let encoder=fallbackRest.encodeRequest,decoder=fallbackRest.decodeResponse;return(0,fallbackServiceStub_1.generateServiceStub)(methods,protocol,servicePath,servicePort,this.authClient,encoder,decoder,this.numericEnums)}static createByteLengthFunction(message){return gax.createByteLengthFunction(message)}};__name(GrpcClient,"GrpcClient");exports2.GrpcClient=GrpcClient;GrpcClient.protoCache=new Map;function lro(options){options=Object.assign({scopes:[]},options),options.protoJson&&(options=Object.assign(options,{fallback:!0}));let gaxGrpc=new GrpcClient(options);return new operationsClient_1.OperationsClientBuilder(gaxGrpc,options.protoJson)}__name(lro,"lro");exports2.lro=lro;function createApiCall(func,settings,descriptor,_fallback){return descriptor&&"streaming"in descriptor&&descriptor.type!==streaming_1.StreamType.SERVER_STREAMING?()=>{throw new Error("The REST transport currently does not support client-streaming or bidi-stream calls.")}:descriptor&&"streaming"in descriptor&&!(0,featureDetection_1.isNodeJS)()?()=>{throw new Error("Server streaming over the REST transport is only supported in Node.js.")}:(0,createApiCall_1.createApiCall)(func,settings,descriptor)}__name(createApiCall,"createApiCall");exports2.createApiCall=createApiCall;exports2.protobufMinimal=require_minimal2();var warnings_1=require_warnings();Object.defineProperty(exports2,"warn",{enumerable:!0,get:function(){return warnings_1.warn}});var longrunning_1=require_longrunning();Object.defineProperty(exports2,"Operation",{enumerable:!0,get:function(){return longrunning_1.Operation}});Object.defineProperty(exports2,"operation",{enumerable:!0,get:function(){return longrunning_1.operation}});var googleError_1=require_googleError();Object.defineProperty(exports2,"GoogleError",{enumerable:!0,get:function(){return googleError_1.GoogleError}});var fallback=module2.exports;exports2.fallback=fallback}});var require_util6=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/util.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.mapToArray=exports2.tryGetPreferRestEnvironmentVariable=exports2.wrapError=exports2.silencePromise=exports2.getRetryParams=exports2.getRetryCodes=exports2.isPermanentRpcError=exports2.isFunction=exports2.isEmpty=exports2.isPlainObject=exports2.isObject=exports2.requestTag=exports2.autoId=exports2.Deferred=void 0;var crypto_1=require("crypto"),gapicConfig=require_firestore_client_config(),Deferred=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promise=new Promise((resolve,reject)=>{this.resolve=resolve,this.reject=reject})}};__name(Deferred,"Deferred");exports2.Deferred=Deferred;function autoId(){let chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",autoId2="";for(;autoId2.length<20;)(0,crypto_1.randomBytes)(40).forEach(b=>{autoId2.length<20&&b<=247&&(autoId2+=chars.charAt(b%62))});return autoId2}__name(autoId,"autoId");exports2.autoId=autoId;function requestTag(){return autoId().substr(0,5)}__name(requestTag,"requestTag");exports2.requestTag=requestTag;function isObject(value){return Object.prototype.toString.call(value)==="[object Object]"}__name(isObject,"isObject");exports2.isObject=isObject;function isPlainObject(input){return isObject(input)&&(Object.getPrototypeOf(input)===Object.prototype||Object.getPrototypeOf(input)===null||input.constructor.name==="Object")}__name(isPlainObject,"isPlainObject");exports2.isPlainObject=isPlainObject;function isEmpty(value){return Object.keys(value).length===0}__name(isEmpty,"isEmpty");exports2.isEmpty=isEmpty;function isFunction(value){return typeof value=="function"}__name(isFunction,"isFunction");exports2.isFunction=isFunction;function isPermanentRpcError(err,methodName){return err.code!==void 0?getRetryCodes(methodName).indexOf(err.code)===-1:!1}__name(isPermanentRpcError,"isPermanentRpcError");exports2.isPermanentRpcError=isPermanentRpcError;var serviceConfig;function getServiceConfig(methodName){return serviceConfig||(serviceConfig=require_fallback().constructSettings("google.firestore.v1.Firestore",gapicConfig,{},require_status().Status)),serviceConfig[methodName]}__name(getServiceConfig,"getServiceConfig");function getRetryCodes(methodName){var _a,_b,_c;return(_c=(_b=(_a=getServiceConfig(methodName))===null||_a===void 0?void 0:_a.retry)===null||_b===void 0?void 0:_b.retryCodes)!==null&&_c!==void 0?_c:[]}__name(getRetryCodes,"getRetryCodes");exports2.getRetryCodes=getRetryCodes;function getRetryParams(methodName){var _a,_b,_c;return(_c=(_b=(_a=getServiceConfig(methodName))===null||_a===void 0?void 0:_a.retry)===null||_b===void 0?void 0:_b.backoffSettings)!==null&&_c!==void 0?_c:require_fallback().createDefaultBackoffSettings()}__name(getRetryParams,"getRetryParams");exports2.getRetryParams=getRetryParams;function silencePromise(promise){return promise.then(()=>{},()=>{})}__name(silencePromise,"silencePromise");exports2.silencePromise=silencePromise;function wrapError(err,stack){return err.stack+=` Caused by: `+stack,err}__name(wrapError,"wrapError");exports2.wrapError=wrapError;function tryGetPreferRestEnvironmentVariable(){var _a;let rawValue=(_a=process.env.FIRESTORE_PREFER_REST)===null||_a===void 0?void 0:_a.trim().toLowerCase();if(rawValue!==void 0){if(rawValue==="1"||rawValue==="true")return!0;if(rawValue==="0"||rawValue==="false")return!1;console.warn(`An unsupported value was specified for the environment variable FIRESTORE_PREFER_REST. Value ${rawValue} is unsupported.`);return}}__name(tryGetPreferRestEnvironmentVariable,"tryGetPreferRestEnvironmentVariable");exports2.tryGetPreferRestEnvironmentVariable=tryGetPreferRestEnvironmentVariable;function mapToArray(obj,fn){let result=[];for(let key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&result.push(fn(obj[key],key,obj));return result}__name(mapToArray,"mapToArray");exports2.mapToArray=mapToArray}});var require_timestamp2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/timestamp.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Timestamp=void 0;var validate_1=require_validate();var MS_TO_NANOS=1e6;var MIN_SECONDS=-62135596800;var MAX_SECONDS=253402300799,Timestamp2=class{static now(){return Timestamp2.fromMillis(Date.now())}static fromDate(date){return Timestamp2.fromMillis(date.getTime())}static fromMillis(milliseconds){let seconds=Math.floor(milliseconds/1e3),nanos=Math.floor((milliseconds-seconds*1e3)*MS_TO_NANOS);return new Timestamp2(seconds,nanos)}static fromProto(timestamp){return new Timestamp2(Number(timestamp.seconds||0),timestamp.nanos||0)}constructor(seconds,nanoseconds){(0,validate_1.validateInteger)("seconds",seconds,{minValue:MIN_SECONDS,maxValue:MAX_SECONDS}),(0,validate_1.validateInteger)("nanoseconds",nanoseconds,{minValue:0,maxValue:999999999}),this._seconds=seconds,this._nanoseconds=nanoseconds}get seconds(){return this._seconds}get nanoseconds(){return this._nanoseconds}toDate(){return new Date(this._seconds*1e3+Math.round(this._nanoseconds/MS_TO_NANOS))}toMillis(){return this._seconds*1e3+Math.floor(this._nanoseconds/MS_TO_NANOS)}isEqual(other){return this===other||other instanceof Timestamp2&&this._seconds===other.seconds&&this._nanoseconds===other.nanoseconds}toProto(){let timestamp={};return this.seconds&&(timestamp.seconds=this.seconds.toString()),this.nanoseconds&&(timestamp.nanos=this.nanoseconds),{timestampValue:timestamp}}valueOf(){let adjustedSeconds=this.seconds-MIN_SECONDS,formattedSeconds=String(adjustedSeconds).padStart(12,"0"),formattedNanoseconds=String(this.nanoseconds).padStart(9,"0");return formattedSeconds+"."+formattedNanoseconds}};__name(Timestamp2,"Timestamp");exports2.Timestamp=Timestamp2}});var require_validate=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/validate.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.validateEnumValue=exports2.validateMaxNumberOfArguments=exports2.validateMinNumberOfArguments=exports2.validateOptional=exports2.invalidArgumentMessage=exports2.validateTimestamp=exports2.validateInteger=exports2.validateNumber=exports2.validateBoolean=exports2.validateHost=exports2.validateString=exports2.validateObject=exports2.validateFunction=exports2.customObjectMessage=void 0;var url_1=require("url"),util_1=require_util6(),timestamp_1=require_timestamp2();function customObjectMessage(arg,value,path){let fieldPathMessage=path?` (found in field "${path}")`:"";if((0,util_1.isObject)(value)){let typeName=value.constructor.name;switch(typeName){case"DocumentReference":case"FieldPath":case"FieldValue":case"GeoPoint":case"Timestamp":return`${invalidArgumentMessage(arg,"Firestore document")} Detected an object of type "${typeName}" that doesn't match the expected instance${fieldPathMessage}. Please ensure that the Firestore types you are using are from the same NPM package.)`;case"Object":return`${invalidArgumentMessage(arg,"Firestore document")} Invalid use of type "${typeof value}" as a Firestore argument${fieldPathMessage}.`;default:return`${invalidArgumentMessage(arg,"Firestore document")} Couldn't serialize object of type "${typeName}"${fieldPathMessage}. Firestore doesn't support JavaScript objects with custom prototypes (i.e. objects that were created via the "new" operator).`}}else return`${invalidArgumentMessage(arg,"Firestore document")} Input is not a plain JavaScript object${fieldPathMessage}.`}__name(customObjectMessage,"customObjectMessage");exports2.customObjectMessage=customObjectMessage;function validateFunction(arg,value,options){if(!validateOptional(value,options)&&!(0,util_1.isFunction)(value))throw new Error(invalidArgumentMessage(arg,"function"))}__name(validateFunction,"validateFunction");exports2.validateFunction=validateFunction;function validateObject(arg,value,options){if(!validateOptional(value,options)&&!(0,util_1.isObject)(value))throw new Error(invalidArgumentMessage(arg,"object"))}__name(validateObject,"validateObject");exports2.validateObject=validateObject;function validateString(arg,value,options){if(!validateOptional(value,options)&&typeof value!="string")throw new Error(invalidArgumentMessage(arg,"string"))}__name(validateString,"validateString");exports2.validateString=validateString;function validateHost(arg,value,options){if(!validateOptional(value,options)){validateString(arg,value);let urlString=`http://${value}/`,parsed;try{parsed=new url_1.URL(urlString)}catch{throw new Error(invalidArgumentMessage(arg,"host"))}if(parsed.search!==""||parsed.pathname!=="/"||parsed.username!=="")throw new Error(invalidArgumentMessage(arg,"host"))}}__name(validateHost,"validateHost");exports2.validateHost=validateHost;function validateBoolean(arg,value,options){if(!validateOptional(value,options)&&typeof value!="boolean")throw new Error(invalidArgumentMessage(arg,"boolean"))}__name(validateBoolean,"validateBoolean");exports2.validateBoolean=validateBoolean;function validateNumber(arg,value,options){let min=options!==void 0&&options.minValue!==void 0?options.minValue:-1/0,max=options!==void 0&&options.maxValue!==void 0?options.maxValue:1/0;if(!validateOptional(value,options)){if(typeof value!="number"||isNaN(value))throw new Error(invalidArgumentMessage(arg,"number"));if(valuemax)throw new Error(`${formatArgumentName(arg)} must be within [${min}, ${max}] inclusive, but was: ${value}`)}}__name(validateNumber,"validateNumber");exports2.validateNumber=validateNumber;function validateInteger(arg,value,options){let min=options!==void 0&&options.minValue!==void 0?options.minValue:-1/0,max=options!==void 0&&options.maxValue!==void 0?options.maxValue:1/0;if(!validateOptional(value,options)){if(typeof value!="number"||isNaN(value)||value%1!==0)throw new Error(invalidArgumentMessage(arg,"integer"));if(valuemax)throw new Error(`${formatArgumentName(arg)} must be within [${min}, ${max}] inclusive, but was: ${value}`)}}__name(validateInteger,"validateInteger");exports2.validateInteger=validateInteger;function validateTimestamp(arg,value,options){if(!validateOptional(value,options)&&!(value instanceof timestamp_1.Timestamp))throw new Error(invalidArgumentMessage(arg,"Timestamp"))}__name(validateTimestamp,"validateTimestamp");exports2.validateTimestamp=validateTimestamp;function invalidArgumentMessage(arg,expectedType){return`${formatArgumentName(arg)} is not a valid ${expectedType}.`}__name(invalidArgumentMessage,"invalidArgumentMessage");exports2.invalidArgumentMessage=invalidArgumentMessage;function validateOptional(value,options){return value===void 0&&options!==void 0&&options.optional===!0}__name(validateOptional,"validateOptional");exports2.validateOptional=validateOptional;function formatPlural(num,str){return`${num} ${str}`+(num===1?"":"s")}__name(formatPlural,"formatPlural");function formatArgumentName(arg){return typeof arg=="string"?`Value for argument "${arg}"`:`Element at index ${arg}`}__name(formatArgumentName,"formatArgumentName");function validateMinNumberOfArguments(funcName,args,minSize){if(args.lengthmaxSize)throw new Error(`Function "${funcName}()" accepts at most ${formatPlural(maxSize,"argument")}.`)}__name(validateMaxNumberOfArguments,"validateMaxNumberOfArguments");exports2.validateMaxNumberOfArguments=validateMaxNumberOfArguments;function validateEnumValue(arg,value,allowedValues,options){if(!validateOptional(value,options)){let expectedDescription=[];for(let allowed of allowedValues){if(allowed===value)return;expectedDescription.push(allowed)}throw new Error(`${formatArgumentName(arg)} is invalid. Acceptable values are: ${expectedDescription.join(", ")}`)}}__name(validateEnumValue,"validateEnumValue");exports2.validateEnumValue=validateEnumValue}});var require_logger=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/logger.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.setLibVersion=exports2.setLogFunction=exports2.logger=void 0;var util=require("util"),validate_1=require_validate();var libVersion;var logFunction=null;function logger(methodName,requestTag,logMessage,...additionalArgs){if(requestTag=requestTag||"#####",logFunction){let formattedMessage=util.format(logMessage,...additionalArgs),time=new Date().toISOString();logFunction(`Firestore (${libVersion}) ${time} ${requestTag} [${methodName}]: `+formattedMessage)}}__name(logger,"logger");exports2.logger=logger;function setLogFunction(logger2){logger2!==null&&(0,validate_1.validateFunction)("logger",logger2),logFunction=logger2}__name(setLogFunction,"setLogFunction");exports2.setLogFunction=setLogFunction;function setLibVersion(version2){libVersion=version2}__name(setLibVersion,"setLibVersion");exports2.setLibVersion=setLibVersion}});var require_backoff=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/backoff.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.ExponentialBackoff=exports2.setTimeoutHandler=exports2.delayExecution=exports2.MAX_RETRY_ATTEMPTS=exports2.DEFAULT_BACKOFF_FACTOR=exports2.DEFAULT_BACKOFF_MAX_DELAY_MS=exports2.DEFAULT_BACKOFF_INITIAL_DELAY_MS=void 0;var logger_1=require_logger();exports2.DEFAULT_BACKOFF_INITIAL_DELAY_MS=1e3;exports2.DEFAULT_BACKOFF_MAX_DELAY_MS=60*1e3;exports2.DEFAULT_BACKOFF_FACTOR=1.5;var DEFAULT_JITTER_FACTOR=1;exports2.MAX_RETRY_ATTEMPTS=10;exports2.delayExecution=setTimeout;function setTimeoutHandler(handler){exports2.delayExecution=(f,ms)=>(handler(f,ms),{hasRef:()=>{throw new Error("For tests only. Not Implemented")},ref:()=>{throw new Error("For tests only. Not Implemented")},refresh:()=>{throw new Error("For tests only. Not Implemented")},unref:()=>{throw new Error("For tests only. Not Implemented")},[Symbol.toPrimitive]:()=>{throw new Error("For tests only. Not Implemented")}})}__name(setTimeoutHandler,"setTimeoutHandler");exports2.setTimeoutHandler=setTimeoutHandler;var ExponentialBackoff=class{constructor(options={}){this._retryCount=0,this.currentBaseMs=0,this.awaitingBackoffCompletion=!1,this.initialDelayMs=options.initialDelayMs!==void 0?options.initialDelayMs:exports2.DEFAULT_BACKOFF_INITIAL_DELAY_MS,this.backoffFactor=options.backoffFactor!==void 0?options.backoffFactor:exports2.DEFAULT_BACKOFF_FACTOR,this.maxDelayMs=options.maxDelayMs!==void 0?options.maxDelayMs:exports2.DEFAULT_BACKOFF_MAX_DELAY_MS,this.jitterFactor=options.jitterFactor!==void 0?options.jitterFactor:DEFAULT_JITTER_FACTOR}reset(){this._retryCount=0,this.currentBaseMs=0}resetToMax(){this.currentBaseMs=this.maxDelayMs}backoffAndWait(){if(this.awaitingBackoffCompletion)return Promise.reject(new Error("A backoff operation is already in progress."));if(this.retryCount>exports2.MAX_RETRY_ATTEMPTS)return Promise.reject(new Error("Exceeded maximum number of retries allowed."));let delayWithJitterMs=this.currentBaseMs+this.jitterDelayMs();return this.currentBaseMs>0&&(0,logger_1.logger)("ExponentialBackoff.backoffAndWait",null,`Backing off for ${delayWithJitterMs} ms (base delay: ${this.currentBaseMs} ms)`),this.currentBaseMs*=this.backoffFactor,this.currentBaseMs=Math.max(this.currentBaseMs,this.initialDelayMs),this.currentBaseMs=Math.min(this.currentBaseMs,this.maxDelayMs),this._retryCount+=1,new Promise(resolve=>{this.awaitingBackoffCompletion=!0,(0,exports2.delayExecution)(()=>{this.awaitingBackoffCompletion=!1,resolve()},delayWithJitterMs)})}get retryCount(){return this._retryCount}jitterDelayMs(){return(Math.random()-.5)*this.jitterFactor*this.currentBaseMs}};__name(ExponentialBackoff,"ExponentialBackoff");exports2.ExponentialBackoff=ExponentialBackoff}});var require_rate_limiter=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/rate-limiter.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.RateLimiter=void 0;var assert=require("assert"),logger_1=require_logger(),RateLimiter=class{constructor(initialCapacity,multiplier,multiplierMillis,maximumCapacity,startTimeMillis=Date.now()){this.initialCapacity=initialCapacity,this.multiplier=multiplier,this.multiplierMillis=multiplierMillis,this.maximumCapacity=maximumCapacity,this.startTimeMillis=startTimeMillis,this.availableTokens=initialCapacity,this.lastRefillTimeMillis=startTimeMillis,this.previousCapacity=initialCapacity}tryMakeRequest(numOperations,requestTimeMillis=Date.now()){return this.refillTokens(requestTimeMillis),numOperations<=this.availableTokens?(this.availableTokens-=numOperations,!0):!1}getNextRequestDelayMs(numOperations,requestTimeMillis=Date.now()){if(this.refillTokens(requestTimeMillis),numOperations=this.lastRefillTimeMillis){let elapsedTime=requestTimeMillis-this.lastRefillTimeMillis,capacity=this.calculateCapacity(requestTimeMillis),tokensToAdd=Math.floor(elapsedTime*capacity/1e3);tokensToAdd>0&&(this.availableTokens=Math.min(capacity,this.availableTokens+tokensToAdd),this.lastRefillTimeMillis=requestTimeMillis)}else throw new Error("Request time should not be before the last token refill time.")}calculateCapacity(requestTimeMillis){assert(requestTimeMillis>=this.startTimeMillis,"startTime cannot be after currentTime");let millisElapsed=requestTimeMillis-this.startTimeMillis,operationsPerSecond=Math.min(Math.floor(Math.pow(this.multiplier,Math.floor(millisElapsed/this.multiplierMillis))*this.initialCapacity),this.maximumCapacity);return operationsPerSecond!==this.previousCapacity&&(0,logger_1.logger)("RateLimiter.calculateCapacity",null,`New request capacity: ${operationsPerSecond} operations per second.`),this.previousCapacity=operationsPerSecond,operationsPerSecond}};__name(RateLimiter,"RateLimiter");exports2.RateLimiter=RateLimiter}});var require_fast_deep_equal=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/fast-deep-equal/index.js"(exports2,module2){"use strict";module2.exports=__name(function equal(a,b){if(a===b)return!0;if(a&&b&&typeof a=="object"&&typeof b=="object"){if(a.constructor!==b.constructor)return!1;var length,i,keys;if(Array.isArray(a)){if(length=a.length,length!=b.length)return!1;for(i=length;i--!==0;)if(!equal(a[i],b[i]))return!1;return!0}if(a.constructor===RegExp)return a.source===b.source&&a.flags===b.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===b.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===b.toString();if(keys=Object.keys(a),length=keys.length,length!==Object.keys(b).length)return!1;for(i=length;i--!==0;)if(!Object.prototype.hasOwnProperty.call(b,keys[i]))return!1;for(i=length;i--!==0;){var key=keys[i];if(!equal(a[key],b[key]))return!1}return!0}return a!==a&&b!==b},"equal")}});var require_convert=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/convert.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.fieldsFromJson=exports2.valueFromJson=exports2.detectValueType=exports2.timestampFromJson=void 0;var validate_1=require_validate();function timestampFromJson(timestampValue,argumentName){let timestampProto={};if(typeof timestampValue=="string"){let date=new Date(timestampValue),seconds=Math.floor(date.getTime()/1e3),nanos=0;if(timestampValue.length>20){let nanoString=timestampValue.substring(20,timestampValue.length-1),trailingZeroes=9-nanoString.length;nanos=Number(nanoString)*Math.pow(10,trailingZeroes)}if(isNaN(seconds)||isNaN(nanos))throw argumentName=argumentName||"timestampValue",new Error(`Specify a valid ISO 8601 timestamp for "${argumentName}".`);timestampProto={seconds:seconds||void 0,nanos:nanos||void 0}}else timestampValue!==void 0&&((0,validate_1.validateObject)("timestampValue",timestampValue),timestampProto={seconds:timestampValue.seconds||void 0,nanos:timestampValue.nanos||void 0});return timestampProto}__name(timestampFromJson,"timestampFromJson");exports2.timestampFromJson=timestampFromJson;function bytesFromJson(bytesValue){return typeof bytesValue=="string"?Buffer.from(bytesValue,"base64"):bytesValue}__name(bytesFromJson,"bytesFromJson");function detectValueType(proto){if(proto.valueType)return proto.valueType;let detectedValues=[];if(proto.stringValue!==void 0&&detectedValues.push("stringValue"),proto.booleanValue!==void 0&&detectedValues.push("booleanValue"),proto.integerValue!==void 0&&detectedValues.push("integerValue"),proto.doubleValue!==void 0&&detectedValues.push("doubleValue"),proto.timestampValue!==void 0&&detectedValues.push("timestampValue"),proto.referenceValue!==void 0&&detectedValues.push("referenceValue"),proto.arrayValue!==void 0&&detectedValues.push("arrayValue"),proto.nullValue!==void 0&&detectedValues.push("nullValue"),proto.mapValue!==void 0&&detectedValues.push("mapValue"),proto.geoPointValue!==void 0&&detectedValues.push("geoPointValue"),proto.bytesValue!==void 0&&detectedValues.push("bytesValue"),detectedValues.length!==1)throw new Error(`Unable to infer type value from '${JSON.stringify(proto)}'.`);return detectedValues[0]}__name(detectValueType,"detectValueType");exports2.detectValueType=detectValueType;function valueFromJson(fieldValue){switch(detectValueType(fieldValue)){case"timestampValue":return{timestampValue:timestampFromJson(fieldValue.timestampValue)};case"bytesValue":return{bytesValue:bytesFromJson(fieldValue.bytesValue)};case"doubleValue":return{doubleValue:Number(fieldValue.doubleValue)};case"arrayValue":{let arrayValue=[];if(Array.isArray(fieldValue.arrayValue.values))for(let value of fieldValue.arrayValue.values)arrayValue.push(valueFromJson(value));return{arrayValue:{values:arrayValue}}}case"mapValue":{let mapValue={},fields=fieldValue.mapValue.fields;if(fields)for(let prop of Object.keys(fields))mapValue[prop]=valueFromJson(fieldValue.mapValue.fields[prop]);return{mapValue:{fields:mapValue}}}default:return fieldValue}}__name(valueFromJson,"valueFromJson");exports2.valueFromJson=valueFromJson;function fieldsFromJson(document2){let result={};for(let prop of Object.keys(document2))result[prop]=valueFromJson(document2[prop]);return result}__name(fieldsFromJson,"fieldsFromJson");exports2.fieldsFromJson=fieldsFromJson}});var require_geo_point=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/geo-point.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.GeoPoint=void 0;var validate_1=require_validate(),GeoPoint=class{constructor(latitude,longitude){(0,validate_1.validateNumber)("latitude",latitude,{minValue:-90,maxValue:90}),(0,validate_1.validateNumber)("longitude",longitude,{minValue:-180,maxValue:180}),this._latitude=latitude,this._longitude=longitude}get latitude(){return this._latitude}get longitude(){return this._longitude}isEqual(other){return this===other||other instanceof GeoPoint&&this.latitude===other.latitude&&this.longitude===other.longitude}toProto(){return{geoPointValue:{latitude:this.latitude,longitude:this.longitude}}}static fromProto(proto){return new GeoPoint(proto.latitude||0,proto.longitude||0)}};__name(GeoPoint,"GeoPoint");exports2.GeoPoint=GeoPoint}});var require_path2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/path.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.validateFieldPath=exports2.FieldPath=exports2.validateResourcePath=exports2.QualifiedResourcePath=exports2.ResourcePath=exports2.DEFAULT_DATABASE_ID=void 0;var util_1=require_util6(),validate_1=require_validate();exports2.DEFAULT_DATABASE_ID="(default)";var RESOURCE_PATH_RE=/^projects\/([^/]*)\/databases\/([^/]*)(?:\/documents\/)?([\s\S]*)$/;var UNESCAPED_FIELD_NAME_RE=/^[_a-zA-Z][_a-zA-Z0-9]*$/;var FIELD_PATH_RE=/^[^*~/[\]]+$/,Path=class{constructor(segments){this.segments=segments}get size(){return this.segments.length}append(relativePath){return relativePath instanceof Path?this.construct(this.segments.concat(relativePath.segments)):this.construct(this.segments.concat(this.split(relativePath)))}parent(){return this.segments.length===0?null:this.construct(this.segments.slice(0,this.segments.length-1))}isPrefixOf(other){if(other.segments.lengthother.segments[i])return 1}return this.segments.lengthother.segments.length?1:0}toArray(){return this.segments.slice()}popLast(){return this.segments.pop(),this.construct(this.segments)}isEqual(other){return this===other||this.compareTo(other)===0}};__name(Path,"Path");var ResourcePath=class extends Path{constructor(...segments){super(segments)}get isDocument(){return this.segments.length>0&&this.segments.length%2===0}get isCollection(){return this.segments.length%2===1}get id(){return this.segments.length>0?this.segments[this.segments.length-1]:null}get relativeName(){return this.segments.join("/")}construct(segments){return new ResourcePath(...segments)}split(relativePath){return relativePath.split("/").filter(segment=>segment.length>0)}toQualifiedResourcePath(projectId,databaseId){return new QualifiedResourcePath(projectId,databaseId,...this.segments)}};__name(ResourcePath,"ResourcePath");exports2.ResourcePath=ResourcePath;ResourcePath.EMPTY=new ResourcePath;var QualifiedResourcePath=class extends ResourcePath{constructor(projectId,databaseId,...segments){super(...segments),this.projectId=projectId,this.databaseId=databaseId}get relativeName(){return this.segments.join("/")}static fromSlashSeparatedString(absolutePath){let elements=RESOURCE_PATH_RE.exec(absolutePath);if(elements){let project=elements[1],database=elements[2],path=elements[3];return new QualifiedResourcePath(project,database).append(path)}throw new Error(`Resource name '${absolutePath}' is not valid.`)}append(relativePath){return super.append(relativePath)}parent(){return super.parent()}get formattedName(){return["projects",this.projectId,"databases",this.databaseId,"documents",...this.segments].join("/")}construct(segments){return new QualifiedResourcePath(this.projectId,this.databaseId,...segments)}toQualifiedResourcePath(){return this}compareTo(other){if(other instanceof QualifiedResourcePath){if(this.projectIdother.projectId)return 1;if(this.databaseIdother.databaseId)return 1}return super.compareTo(other)}toProto(){return{referenceValue:this.formattedName}}};__name(QualifiedResourcePath,"QualifiedResourcePath");exports2.QualifiedResourcePath=QualifiedResourcePath;function validateResourcePath(arg,resourcePath){if(typeof resourcePath!="string"||resourcePath==="")throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"resource path")} Path must be a non-empty string.`);if(resourcePath.indexOf("//")>=0)throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"resource path")} Paths must not contain //.`)}__name(validateResourcePath,"validateResourcePath");exports2.validateResourcePath=validateResourcePath;var FieldPath=class extends Path{constructor(...segments){if(Array.isArray(segments[0]))throw new Error("The FieldPath constructor no longer supports an array as its first argument. Please unpack your array and call FieldPath() with individual arguments.");(0,validate_1.validateMinNumberOfArguments)("FieldPath",segments,1);for(let i=0;iUNESCAPED_FIELD_NAME_RE.test(str)?str:"`"+str.replace("\\","\\\\").replace("`","\\`")+"`").join(".")}toString(){return this.formattedName}split(fieldPath){return fieldPath.split(".")}construct(segments){return new FieldPath(...segments)}isEqual(other){return super.isEqual(other)}};__name(FieldPath,"FieldPath");exports2.FieldPath=FieldPath;FieldPath._DOCUMENT_ID=new FieldPath("__name__");function validateFieldPath(arg,fieldPath){if(!(fieldPath instanceof FieldPath)){if(fieldPath===void 0)throw new Error((0,validate_1.invalidArgumentMessage)(arg,"field path")+" The path cannot be omitted.");if((0,util_1.isObject)(fieldPath)&&fieldPath.constructor.name==="FieldPath")throw new Error((0,validate_1.customObjectMessage)(arg,fieldPath));if(typeof fieldPath!="string")throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"field path")} Paths can only be specified as strings or via a FieldPath object.`);if(fieldPath.indexOf("..")>=0)throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"field path")} Paths must not contain ".." in them.`);if(fieldPath.startsWith(".")||fieldPath.endsWith("."))throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"field path")} Paths must not start or end with ".".`);if(!FIELD_PATH_RE.test(fieldPath))throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"field path")} Paths can't be empty and must not contain "*~/[]".`)}}__name(validateFieldPath,"validateFieldPath");exports2.validateFieldPath=validateFieldPath}});var require_serializer=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/serializer.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.validateUserInput=exports2.Serializer=void 0;var convert_1=require_convert(),field_value_1=require_field_value(),geo_point_1=require_geo_point(),index_1=require_src12(),path_1=require_path2(),timestamp_1=require_timestamp2(),util_1=require_util6(),validate_1=require_validate(),MAX_DEPTH=20,Serializer=class{constructor(firestore){this.createReference=path=>firestore.doc(path),this.createInteger=n=>firestore._settings.useBigInt?BigInt(n):Number(n),this.allowUndefined=!!firestore._settings.ignoreUndefinedProperties}encodeFields(obj){let fields={};for(let prop of Object.keys(obj)){let val=this.encodeValue(obj[prop]);val&&(fields[prop]=val)}return fields}encodeValue(val){if(val instanceof field_value_1.FieldTransform)return null;if(typeof val=="string")return{stringValue:val};if(typeof val=="boolean")return{booleanValue:val};if(typeof val=="number"){let isNegativeZero=val===0&&1/val===-1/0;return Number.isSafeInteger(val)&&!isNegativeZero?{integerValue:val}:{doubleValue:val}}if(typeof val=="bigint")return{integerValue:val.toString()};if(val instanceof Date){let timestamp=timestamp_1.Timestamp.fromDate(val);return{timestampValue:{seconds:timestamp.seconds,nanos:timestamp.nanoseconds}}}if(isMomentJsType(val)){let timestamp=timestamp_1.Timestamp.fromDate(val.toDate());return{timestampValue:{seconds:timestamp.seconds,nanos:timestamp.nanoseconds}}}if(val===null)return{nullValue:"NULL_VALUE"};if(val instanceof Buffer||val instanceof Uint8Array)return{bytesValue:val};if((0,util_1.isObject)(val)){let toProto=val.toProto;if(typeof toProto=="function")return toProto.bind(val)()}if(Array.isArray(val)){let array={arrayValue:{}};if(val.length>0){array.arrayValue.values=[];for(let i=0;iMAX_DEPTH)throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,desc)} Input object is deeper than ${MAX_DEPTH} levels or contains a cycle.`);level=level||0,inArray=inArray||!1;let fieldPathMessage=path?` (found in field "${path}")`:"";if(Array.isArray(value))for(let i=0;iright?1:0}__name(primitiveComparator,"primitiveComparator");exports2.primitiveComparator=primitiveComparator;function compareNumbers(left,right){return leftright?1:left===right?0:isNaN(left)?isNaN(right)?0:-1:1}__name(compareNumbers,"compareNumbers");function compareNumberProtos(left,right){let leftValue,rightValue;return left.integerValue!==void 0?leftValue=Number(left.integerValue):leftValue=Number(left.doubleValue),right.integerValue!==void 0?rightValue=Number(right.integerValue):rightValue=Number(right.doubleValue),compareNumbers(leftValue,rightValue)}__name(compareNumberProtos,"compareNumberProtos");function compareTimestamps(left,right){let seconds=primitiveComparator(left.seconds||0,right.seconds||0);return seconds!==0?seconds:primitiveComparator(left.nanos||0,right.nanos||0)}__name(compareTimestamps,"compareTimestamps");function compareBlobs(left,right){if(!(left instanceof Buffer)||!(right instanceof Buffer))throw new Error("Blobs can only be compared if they are Buffers.");return Buffer.compare(left,right)}__name(compareBlobs,"compareBlobs");function compareReferenceProtos(left,right){let leftPath=path_1.QualifiedResourcePath.fromSlashSeparatedString(left.referenceValue),rightPath=path_1.QualifiedResourcePath.fromSlashSeparatedString(right.referenceValue);return leftPath.compareTo(rightPath)}__name(compareReferenceProtos,"compareReferenceProtos");function compareGeoPoints(left,right){return primitiveComparator(left.latitude||0,right.latitude||0)||primitiveComparator(left.longitude||0,right.longitude||0)}__name(compareGeoPoints,"compareGeoPoints");function compareArrays(left,right){for(let i=0;i=0;--s){var n=n_stack[s];d_stack[s]<=0?n_stack[s]=new RBNode(n._color,n.key,n.value,n_stack[s+1],n.right,n._count+1):n_stack[s]=new RBNode(n._color,n.key,n.value,n.left,n_stack[s+1],n._count+1)}for(var s=n_stack.length-1;s>1;--s){var p=n_stack[s-1],n=n_stack[s];if(p._color===BLACK||n._color===BLACK)break;var pp=n_stack[s-2];if(pp.left===p)if(p.left===n){var y=pp.right;if(y&&y._color===RED)p._color=BLACK,pp.right=repaint(BLACK,y),pp._color=RED,s-=1;else{if(pp._color=RED,pp.left=p.right,p._color=BLACK,p.right=pp,n_stack[s-2]=p,n_stack[s-1]=n,recount(pp),recount(p),s>=3){var ppp=n_stack[s-3];ppp.left===pp?ppp.left=p:ppp.right=p}break}}else{var y=pp.right;if(y&&y._color===RED)p._color=BLACK,pp.right=repaint(BLACK,y),pp._color=RED,s-=1;else{if(p.right=n.left,pp._color=RED,pp.left=n.right,n._color=BLACK,n.left=p,n.right=pp,n_stack[s-2]=n,n_stack[s-1]=p,recount(pp),recount(p),recount(n),s>=3){var ppp=n_stack[s-3];ppp.left===pp?ppp.left=n:ppp.right=n}break}}else if(p.right===n){var y=pp.left;if(y&&y._color===RED)p._color=BLACK,pp.left=repaint(BLACK,y),pp._color=RED,s-=1;else{if(pp._color=RED,pp.right=p.left,p._color=BLACK,p.left=pp,n_stack[s-2]=p,n_stack[s-1]=n,recount(pp),recount(p),s>=3){var ppp=n_stack[s-3];ppp.right===pp?ppp.right=p:ppp.left=p}break}}else{var y=pp.left;if(y&&y._color===RED)p._color=BLACK,pp.left=repaint(BLACK,y),pp._color=RED,s-=1;else{if(p.left=n.right,pp._color=RED,pp.right=n.left,n._color=BLACK,n.right=p,n.left=pp,n_stack[s-2]=n,n_stack[s-1]=p,recount(pp),recount(p),recount(n),s>=3){var ppp=n_stack[s-3];ppp.right===pp?ppp.right=n:ppp.left=n}break}}}return n_stack[0]._color=BLACK,new RedBlackTree(cmp,n_stack[0])};function doVisitFull(visit,node){if(node.left){var v=doVisitFull(visit,node.left);if(v)return v}var v=visit(node.key,node.value);if(v)return v;if(node.right)return doVisitFull(visit,node.right)}__name(doVisitFull,"doVisitFull");function doVisitHalf(lo,compare,visit,node){var l=compare(lo,node.key);if(l<=0){if(node.left){var v=doVisitHalf(lo,compare,visit,node.left);if(v)return v}var v=visit(node.key,node.value);if(v)return v}if(node.right)return doVisitHalf(lo,compare,visit,node.right)}__name(doVisitHalf,"doVisitHalf");function doVisit(lo,hi,compare,visit,node){var l=compare(lo,node.key),h=compare(hi,node.key),v;if(l<=0&&(node.left&&(v=doVisit(lo,hi,compare,visit,node.left),v)||h>0&&(v=visit(node.key,node.value),v)))return v;if(h>0&&node.right)return doVisit(lo,hi,compare,visit,node.right)}__name(doVisit,"doVisit");proto.forEach=__name(function(visit,lo,hi){if(this.root)switch(arguments.length){case 1:return doVisitFull(visit,this.root);case 2:return doVisitHalf(lo,this._compare,visit,this.root);case 3:return this._compare(lo,hi)>=0?void 0:doVisit(lo,hi,this._compare,visit,this.root)}},"rbTreeForEach");Object.defineProperty(proto,"begin",{get:function(){for(var stack=[],n=this.root;n;)stack.push(n),n=n.left;return new RedBlackTreeIterator(this,stack)}});Object.defineProperty(proto,"end",{get:function(){for(var stack=[],n=this.root;n;)stack.push(n),n=n.right;return new RedBlackTreeIterator(this,stack)}});proto.at=function(idx){if(idx<0)return new RedBlackTreeIterator(this,[]);for(var n=this.root,stack=[];;){if(stack.push(n),n.left){if(idx=n.right._count)break;n=n.right}else break}return new RedBlackTreeIterator(this,[])};proto.ge=function(key){for(var cmp=this._compare,n=this.root,stack=[],last_ptr=0;n;){var d=cmp(key,n.key);stack.push(n),d<=0&&(last_ptr=stack.length),d<=0?n=n.left:n=n.right}return stack.length=last_ptr,new RedBlackTreeIterator(this,stack)};proto.gt=function(key){for(var cmp=this._compare,n=this.root,stack=[],last_ptr=0;n;){var d=cmp(key,n.key);stack.push(n),d<0&&(last_ptr=stack.length),d<0?n=n.left:n=n.right}return stack.length=last_ptr,new RedBlackTreeIterator(this,stack)};proto.lt=function(key){for(var cmp=this._compare,n=this.root,stack=[],last_ptr=0;n;){var d=cmp(key,n.key);stack.push(n),d>0&&(last_ptr=stack.length),d<=0?n=n.left:n=n.right}return stack.length=last_ptr,new RedBlackTreeIterator(this,stack)};proto.le=function(key){for(var cmp=this._compare,n=this.root,stack=[],last_ptr=0;n;){var d=cmp(key,n.key);stack.push(n),d>=0&&(last_ptr=stack.length),d<0?n=n.left:n=n.right}return stack.length=last_ptr,new RedBlackTreeIterator(this,stack)};proto.find=function(key){for(var cmp=this._compare,n=this.root,stack=[];n;){var d=cmp(key,n.key);if(stack.push(n),d===0)return new RedBlackTreeIterator(this,stack);d<=0?n=n.left:n=n.right}return new RedBlackTreeIterator(this,[])};proto.remove=function(key){var iter=this.find(key);return iter?iter.remove():this};proto.get=function(key){for(var cmp=this._compare,n=this.root;n;){var d=cmp(key,n.key);if(d===0)return n.value;d<=0?n=n.left:n=n.right}};function RedBlackTreeIterator(tree,stack){this.tree=tree,this._stack=stack}__name(RedBlackTreeIterator,"RedBlackTreeIterator");var iproto=RedBlackTreeIterator.prototype;Object.defineProperty(iproto,"valid",{get:function(){return this._stack.length>0}});Object.defineProperty(iproto,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0});iproto.clone=function(){return new RedBlackTreeIterator(this.tree,this._stack.slice())};function swapNode(n,v){n.key=v.key,n.value=v.value,n.left=v.left,n.right=v.right,n._color=v._color,n._count=v._count}__name(swapNode,"swapNode");function fixDoubleBlack(stack){for(var n,p,s,z,i=stack.length-1;i>=0;--i){if(n=stack[i],i===0){n._color=BLACK;return}if(p=stack[i-1],p.left===n){if(s=p.right,s.right&&s.right._color===RED){if(s=p.right=cloneNode(s),z=s.right=cloneNode(s.right),p.right=s.left,s.left=p,s.right=z,s._color=p._color,n._color=BLACK,p._color=BLACK,z._color=BLACK,recount(p),recount(s),i>1){var pp=stack[i-2];pp.left===p?pp.left=s:pp.right=s}stack[i-1]=s;return}else if(s.left&&s.left._color===RED){if(s=p.right=cloneNode(s),z=s.left=cloneNode(s.left),p.right=z.left,s.left=z.right,z.left=p,z.right=s,z._color=p._color,p._color=BLACK,s._color=BLACK,n._color=BLACK,recount(p),recount(s),recount(z),i>1){var pp=stack[i-2];pp.left===p?pp.left=z:pp.right=z}stack[i-1]=z;return}if(s._color===BLACK)if(p._color===RED){p._color=BLACK,p.right=repaint(RED,s);return}else{p.right=repaint(RED,s);continue}else{if(s=cloneNode(s),p.right=s.left,s.left=p,s._color=p._color,p._color=RED,recount(p),recount(s),i>1){var pp=stack[i-2];pp.left===p?pp.left=s:pp.right=s}stack[i-1]=s,stack[i]=p,i+11){var pp=stack[i-2];pp.right===p?pp.right=s:pp.left=s}stack[i-1]=s;return}else if(s.right&&s.right._color===RED){if(s=p.left=cloneNode(s),z=s.right=cloneNode(s.right),p.left=z.right,s.right=z.left,z.right=p,z.left=s,z._color=p._color,p._color=BLACK,s._color=BLACK,n._color=BLACK,recount(p),recount(s),recount(z),i>1){var pp=stack[i-2];pp.right===p?pp.right=z:pp.left=z}stack[i-1]=z;return}if(s._color===BLACK)if(p._color===RED){p._color=BLACK,p.left=repaint(RED,s);return}else{p.left=repaint(RED,s);continue}else{if(s=cloneNode(s),p.left=s.right,s.right=p,s._color=p._color,p._color=RED,recount(p),recount(s),i>1){var pp=stack[i-2];pp.right===p?pp.right=s:pp.left=s}stack[i-1]=s,stack[i]=p,i+1=0;--i){var n=stack[i];n.left===stack[i+1]?cstack[i]=new RBNode(n._color,n.key,n.value,cstack[i+1],n.right,n._count):cstack[i]=new RBNode(n._color,n.key,n.value,n.left,cstack[i+1],n._count)}if(n=cstack[cstack.length-1],n.left&&n.right){var split=cstack.length;for(n=n.left;n.right;)cstack.push(n),n=n.right;var v=cstack[split-1];cstack.push(new RBNode(n._color,v.key,v.value,n.left,n.right,n._count)),cstack[split-1].key=n.key,cstack[split-1].value=n.value;for(var i=cstack.length-2;i>=split;--i)n=cstack[i],cstack[i]=new RBNode(n._color,n.key,n.value,n.left,cstack[i+1],n._count);cstack[split-1].left=cstack[split]}if(n=cstack[cstack.length-1],n._color===RED){var p=cstack[cstack.length-2];p.left===n?p.left=null:p.right===n&&(p.right=null),cstack.pop();for(var i=0;i0)return this._stack[this._stack.length-1].key},enumerable:!0});Object.defineProperty(iproto,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0});Object.defineProperty(iproto,"index",{get:function(){var idx=0,stack=this._stack;if(stack.length===0){var r=this.tree.root;return r?r._count:0}else stack[stack.length-1].left&&(idx=stack[stack.length-1].left._count);for(var s=stack.length-2;s>=0;--s)stack[s+1]===stack[s].right&&(++idx,stack[s].left&&(idx+=stack[s].left._count));return idx},enumerable:!0});iproto.next=function(){var stack=this._stack;if(stack.length!==0){var n=stack[stack.length-1];if(n.right)for(n=n.right;n;)stack.push(n),n=n.left;else for(stack.pop();stack.length>0&&stack[stack.length-1].right===n;)n=stack[stack.length-1],stack.pop()}};Object.defineProperty(iproto,"hasNext",{get:function(){var stack=this._stack;if(stack.length===0)return!1;if(stack[stack.length-1].right)return!0;for(var s=stack.length-1;s>0;--s)if(stack[s-1].left===stack[s])return!0;return!1}});iproto.update=function(value){var stack=this._stack;if(stack.length===0)throw new Error("Can't update empty node!");var cstack=new Array(stack.length),n=stack[stack.length-1];cstack[cstack.length-1]=new RBNode(n._color,n.key,value,n.left,n.right,n._count);for(var i=stack.length-2;i>=0;--i)n=stack[i],n.left===stack[i+1]?cstack[i]=new RBNode(n._color,n.key,n.value,cstack[i+1],n.right,n._count):cstack[i]=new RBNode(n._color,n.key,n.value,n.left,cstack[i+1],n._count);return new RedBlackTree(this.tree._compare,cstack[0])};iproto.prev=function(){var stack=this._stack;if(stack.length!==0){var n=stack[stack.length-1];if(n.left)for(n=n.left;n;)stack.push(n),n=n.right;else for(stack.pop();stack.length>0&&stack[stack.length-1].left===n;)n=stack[stack.length-1],stack.pop()}};Object.defineProperty(iproto,"hasPrev",{get:function(){var stack=this._stack;if(stack.length===0)return!1;if(stack[stack.length-1].left)return!0;for(var s=stack.length-1;s>0;--s)if(stack[s-1].right===stack[s])return!0;return!1}});function defaultCompare(a,b){return ab?1:0}__name(defaultCompare,"defaultCompare");function createRBTree(compare){return new RedBlackTree(compare||defaultCompare,null)}__name(createRBTree,"createRBTree")}});var require_constants=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/constants.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=exports2.DEFAULT_MAX_SEND_MESSAGE_LENGTH=exports2.Propagate=exports2.LogVerbosity=exports2.Status=void 0;var Status;(function(Status2){Status2[Status2.OK=0]="OK",Status2[Status2.CANCELLED=1]="CANCELLED",Status2[Status2.UNKNOWN=2]="UNKNOWN",Status2[Status2.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Status2[Status2.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Status2[Status2.NOT_FOUND=5]="NOT_FOUND",Status2[Status2.ALREADY_EXISTS=6]="ALREADY_EXISTS",Status2[Status2.PERMISSION_DENIED=7]="PERMISSION_DENIED",Status2[Status2.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Status2[Status2.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Status2[Status2.ABORTED=10]="ABORTED",Status2[Status2.OUT_OF_RANGE=11]="OUT_OF_RANGE",Status2[Status2.UNIMPLEMENTED=12]="UNIMPLEMENTED",Status2[Status2.INTERNAL=13]="INTERNAL",Status2[Status2.UNAVAILABLE=14]="UNAVAILABLE",Status2[Status2.DATA_LOSS=15]="DATA_LOSS",Status2[Status2.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(Status||(exports2.Status=Status={}));var LogVerbosity;(function(LogVerbosity2){LogVerbosity2[LogVerbosity2.DEBUG=0]="DEBUG",LogVerbosity2[LogVerbosity2.INFO=1]="INFO",LogVerbosity2[LogVerbosity2.ERROR=2]="ERROR",LogVerbosity2[LogVerbosity2.NONE=3]="NONE"})(LogVerbosity||(exports2.LogVerbosity=LogVerbosity={}));var Propagate;(function(Propagate2){Propagate2[Propagate2.DEADLINE=1]="DEADLINE",Propagate2[Propagate2.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",Propagate2[Propagate2.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",Propagate2[Propagate2.CANCELLATION=8]="CANCELLATION",Propagate2[Propagate2.DEFAULTS=65535]="DEFAULTS"})(Propagate||(exports2.Propagate=Propagate={}));exports2.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1;exports2.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4*1024*1024}});var require_package4=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/package.json"(exports2,module2){module2.exports={name:"@grpc/grpc-js",version:"1.10.9",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:{"@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 generate-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 test/fixtures/ -O src/generated/ --grpcLib ../index channelz.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"},dependencies:{"@grpc/proto-loader":"^0.7.13","@js-sdsl/ordered-map":"^4.4.2"},files:["src/**/*.ts","build/src/**/*.{js,d.ts,js.map}","proto/*.proto","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 require_logging=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/logging.js"(exports2){"use strict";var _a,_b,_c,_d;Object.defineProperty(exports2,"__esModule",{value:!0});exports2.isTracerEnabled=exports2.trace=exports2.log=exports2.setLoggerVerbosity=exports2.setLogger=exports2.getLogger=void 0;var constants_1=require_constants(),process_1=require("process"),clientVersion=require_package4().version,DEFAULT_LOGGER={error:(message,...optionalParams)=>{console.error("E "+message,...optionalParams)},info:(message,...optionalParams)=>{console.error("I "+message,...optionalParams)},debug:(message,...optionalParams)=>{console.error("D "+message,...optionalParams)}},_logger=DEFAULT_LOGGER,_logVerbosity=constants_1.LogVerbosity.ERROR,verbosityString=(_b=(_a=process.env.GRPC_NODE_VERBOSITY)!==null&&_a!==void 0?_a:process.env.GRPC_VERBOSITY)!==null&&_b!==void 0?_b:"";switch(verbosityString.toUpperCase()){case"DEBUG":_logVerbosity=constants_1.LogVerbosity.DEBUG;break;case"INFO":_logVerbosity=constants_1.LogVerbosity.INFO;break;case"ERROR":_logVerbosity=constants_1.LogVerbosity.ERROR;break;case"NONE":_logVerbosity=constants_1.LogVerbosity.NONE;break;default:}var getLogger=__name(()=>_logger,"getLogger");exports2.getLogger=getLogger;var setLogger=__name(logger=>{_logger=logger},"setLogger");exports2.setLogger=setLogger;var setLoggerVerbosity=__name(verbosity=>{_logVerbosity=verbosity},"setLoggerVerbosity");exports2.setLoggerVerbosity=setLoggerVerbosity;var log=__name((severity,...args)=>{let logFunction;if(severity>=_logVerbosity){switch(severity){case constants_1.LogVerbosity.DEBUG:logFunction=_logger.debug;break;case constants_1.LogVerbosity.INFO:logFunction=_logger.info;break;case constants_1.LogVerbosity.ERROR:logFunction=_logger.error;break}logFunction||(logFunction=_logger.error),logFunction&&logFunction.bind(_logger)(...args)}},"log");exports2.log=log;var tracersString=(_d=(_c=process.env.GRPC_NODE_TRACE)!==null&&_c!==void 0?_c:process.env.GRPC_TRACE)!==null&&_d!==void 0?_d:"",enabledTracers=new Set,disabledTracers=new Set;for(let tracerName of tracersString.split(","))tracerName.startsWith("-")?disabledTracers.add(tracerName.substring(1)):enabledTracers.add(tracerName);var allEnabled=enabledTracers.has("all");function trace(severity,tracer,text){isTracerEnabled(tracer)&&(0,exports2.log)(severity,new Date().toISOString()+" | v"+clientVersion+" "+process_1.pid+" | "+tracer+" | "+text)}__name(trace,"trace");exports2.trace=trace;function isTracerEnabled(tracer){return!disabledTracers.has(tracer)&&(allEnabled||enabledTracers.has(tracer))}__name(isTracerEnabled,"isTracerEnabled");exports2.isTracerEnabled=isTracerEnabled}});var require_error=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/error.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.getErrorCode=exports2.getErrorMessage=void 0;function getErrorMessage(error){return error instanceof Error?error.message:String(error)}__name(getErrorMessage,"getErrorMessage");exports2.getErrorMessage=getErrorMessage;function getErrorCode(error){return typeof error=="object"&&error!==null&&"code"in error&&typeof error.code=="number"?error.code:null}__name(getErrorCode,"getErrorCode");exports2.getErrorCode=getErrorCode}});var require_metadata=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/metadata.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Metadata=void 0;var logging_1=require_logging(),constants_1=require_constants(),error_1=require_error(),LEGAL_KEY_REGEX=/^[0-9a-z_.-]+$/,LEGAL_NON_BINARY_VALUE_REGEX=/^[ -~]*$/;function isLegalKey(key){return LEGAL_KEY_REGEX.test(key)}__name(isLegalKey,"isLegalKey");function isLegalNonBinaryValue(value){return LEGAL_NON_BINARY_VALUE_REGEX.test(value)}__name(isLegalNonBinaryValue,"isLegalNonBinaryValue");function isBinaryKey(key){return key.endsWith("-bin")}__name(isBinaryKey,"isBinaryKey");function isCustomMetadata(key){return!key.startsWith("grpc-")}__name(isCustomMetadata,"isCustomMetadata");function normalizeKey(key){return key.toLowerCase()}__name(normalizeKey,"normalizeKey");function validate2(key,value){if(!isLegalKey(key))throw new Error('Metadata key "'+key+'" contains illegal characters');if(value!=null)if(isBinaryKey(key)){if(!Buffer.isBuffer(value))throw new Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(value))throw new Error("keys that don't end with '-bin' must have String values");if(!isLegalNonBinaryValue(value))throw new Error('Metadata string value "'+value+'" contains illegal characters')}}__name(validate2,"validate");var Metadata=class{constructor(options={}){this.internalRepr=new Map,this.options=options}set(key,value){key=normalizeKey(key),validate2(key,value),this.internalRepr.set(key,[value])}add(key,value){key=normalizeKey(key),validate2(key,value);let existingValue=this.internalRepr.get(key);existingValue===void 0?this.internalRepr.set(key,[value]):existingValue.push(value)}remove(key){key=normalizeKey(key),this.internalRepr.delete(key)}get(key){return key=normalizeKey(key),this.internalRepr.get(key)||[]}getMap(){let result={};for(let[key,values]of this.internalRepr)if(values.length>0){let v=values[0];result[key]=Buffer.isBuffer(v)?Buffer.from(v):v}return result}clone(){let newMetadata=new Metadata(this.options),newInternalRepr=newMetadata.internalRepr;for(let[key,value]of this.internalRepr){let clonedValue=value.map(v=>Buffer.isBuffer(v)?Buffer.from(v):v);newInternalRepr.set(key,clonedValue)}return newMetadata}merge(other){for(let[key,values]of other.internalRepr){let mergedValue=(this.internalRepr.get(key)||[]).concat(values);this.internalRepr.set(key,mergedValue)}}setOptions(options){this.options=options}getOptions(){return this.options}toHttp2Headers(){let result={};for(let[key,values]of this.internalRepr)result[key]=values.map(bufToString);return result}toJSON(){let result={};for(let[key,values]of this.internalRepr)result[key]=values;return result}static fromHttp2Headers(headers){let result=new Metadata;for(let key of Object.keys(headers)){if(key.charAt(0)===":")continue;let values=headers[key];try{isBinaryKey(key)?Array.isArray(values)?values.forEach(value=>{result.add(key,Buffer.from(value,"base64"))}):values!==void 0&&(isCustomMetadata(key)?values.split(",").forEach(v=>{result.add(key,Buffer.from(v.trim(),"base64"))}):result.add(key,Buffer.from(values,"base64"))):Array.isArray(values)?values.forEach(value=>{result.add(key,value)}):values!==void 0&&result.add(key,values)}catch(error){let message=`Failed to add metadata entry ${key}: ${values}. ${(0,error_1.getErrorMessage)(error)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,logging_1.log)(constants_1.LogVerbosity.ERROR,message)}}return result}};__name(Metadata,"Metadata");exports2.Metadata=Metadata;var bufToString=__name(val=>Buffer.isBuffer(val)?val.toString("base64"):val,"bufToString")}});var require_call_credentials=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/call-credentials.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.CallCredentials=void 0;var metadata_1=require_metadata();function isCurrentOauth2Client(client){return"getRequestHeaders"in client&&typeof client.getRequestHeaders=="function"}__name(isCurrentOauth2Client,"isCurrentOauth2Client");var CallCredentials=class{static createFromMetadataGenerator(metadataGenerator){return new SingleCallCredentials(metadataGenerator)}static createFromGoogleCredential(googleCredentials){return CallCredentials.createFromMetadataGenerator((options,callback)=>{let getHeaders;isCurrentOauth2Client(googleCredentials)?getHeaders=googleCredentials.getRequestHeaders(options.service_url):getHeaders=new Promise((resolve,reject)=>{googleCredentials.getRequestMetadata(options.service_url,(err,headers)=>{if(err){reject(err);return}if(!headers){reject(new Error("Headers not set by metadata plugin"));return}resolve(headers)})}),getHeaders.then(headers=>{let metadata=new metadata_1.Metadata;for(let key of Object.keys(headers))metadata.add(key,headers[key]);callback(null,metadata)},err=>{callback(err)})})}static createEmpty(){return new EmptyCallCredentials}};__name(CallCredentials,"CallCredentials");exports2.CallCredentials=CallCredentials;var ComposedCallCredentials=class extends CallCredentials{constructor(creds){super(),this.creds=creds}async generateMetadata(options){let base=new metadata_1.Metadata,generated=await Promise.all(this.creds.map(cred=>cred.generateMetadata(options)));for(let gen of generated)base.merge(gen);return base}compose(other){return new ComposedCallCredentials(this.creds.concat([other]))}_equals(other){return this===other?!0:other instanceof ComposedCallCredentials?this.creds.every((value,index)=>value._equals(other.creds[index])):!1}};__name(ComposedCallCredentials,"ComposedCallCredentials");var SingleCallCredentials=class extends CallCredentials{constructor(metadataGenerator){super(),this.metadataGenerator=metadataGenerator}generateMetadata(options){return new Promise((resolve,reject)=>{this.metadataGenerator(options,(err,metadata)=>{metadata!==void 0?resolve(metadata):reject(err)})})}compose(other){return new ComposedCallCredentials([this,other])}_equals(other){return this===other?!0:other instanceof SingleCallCredentials?this.metadataGenerator===other.metadataGenerator:!1}};__name(SingleCallCredentials,"SingleCallCredentials");var EmptyCallCredentials=class extends CallCredentials{generateMetadata(options){return Promise.resolve(new metadata_1.Metadata)}compose(other){return other}_equals(other){return other instanceof EmptyCallCredentials}};__name(EmptyCallCredentials,"EmptyCallCredentials")}});var require_tls_helpers=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/tls-helpers.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.getDefaultRootsData=exports2.CIPHER_SUITES=void 0;var fs=require("fs");exports2.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;var DEFAULT_ROOTS_FILE_PATH=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH,defaultRootsData=null;function getDefaultRootsData(){return DEFAULT_ROOTS_FILE_PATH?(defaultRootsData===null&&(defaultRootsData=fs.readFileSync(DEFAULT_ROOTS_FILE_PATH)),defaultRootsData):null}__name(getDefaultRootsData,"getDefaultRootsData");exports2.getDefaultRootsData=getDefaultRootsData}});var require_channel_credentials=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/channel-credentials.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.ChannelCredentials=void 0;var tls_1=require("tls"),call_credentials_1=require_call_credentials(),tls_helpers_1=require_tls_helpers();function verifyIsBufferOrNull(obj,friendlyName){if(obj&&!(obj instanceof Buffer))throw new TypeError(`${friendlyName}, if provided, must be a Buffer.`)}__name(verifyIsBufferOrNull,"verifyIsBufferOrNull");var ChannelCredentials=class{constructor(callCredentials){this.callCredentials=callCredentials||call_credentials_1.CallCredentials.createEmpty()}_getCallCredentials(){return this.callCredentials}static createSsl(rootCerts,privateKey,certChain,verifyOptions){var _a;if(verifyIsBufferOrNull(rootCerts,"Root certificate"),verifyIsBufferOrNull(privateKey,"Private key"),verifyIsBufferOrNull(certChain,"Certificate chain"),privateKey&&!certChain)throw new Error("Private key must be given with accompanying certificate chain");if(!privateKey&&certChain)throw new Error("Certificate chain must be given with accompanying private key");let secureContext=(0,tls_1.createSecureContext)({ca:(_a=rootCerts??(0,tls_helpers_1.getDefaultRootsData)())!==null&&_a!==void 0?_a:void 0,key:privateKey??void 0,cert:certChain??void 0,ciphers:tls_helpers_1.CIPHER_SUITES});return new SecureChannelCredentialsImpl(secureContext,verifyOptions??{})}static createFromSecureContext(secureContext,verifyOptions){return new SecureChannelCredentialsImpl(secureContext,verifyOptions??{})}static createInsecure(){return new InsecureChannelCredentialsImpl}};__name(ChannelCredentials,"ChannelCredentials");exports2.ChannelCredentials=ChannelCredentials;var InsecureChannelCredentialsImpl=class extends ChannelCredentials{constructor(){super()}compose(callCredentials){throw new Error("Cannot compose insecure credentials")}_getConnectionOptions(){return null}_isSecure(){return!1}_equals(other){return other instanceof InsecureChannelCredentialsImpl}};__name(InsecureChannelCredentialsImpl,"InsecureChannelCredentialsImpl");var SecureChannelCredentialsImpl=class extends ChannelCredentials{constructor(secureContext,verifyOptions){super(),this.secureContext=secureContext,this.verifyOptions=verifyOptions,this.connectionOptions={secureContext},verifyOptions?.checkServerIdentity&&(this.connectionOptions.checkServerIdentity=verifyOptions.checkServerIdentity)}compose(callCredentials){let combinedCallCredentials=this.callCredentials.compose(callCredentials);return new ComposedChannelCredentialsImpl(this,combinedCallCredentials)}_getConnectionOptions(){return Object.assign({},this.connectionOptions)}_isSecure(){return!0}_equals(other){return this===other?!0:other instanceof SecureChannelCredentialsImpl?this.secureContext===other.secureContext&&this.verifyOptions.checkServerIdentity===other.verifyOptions.checkServerIdentity:!1}};__name(SecureChannelCredentialsImpl,"SecureChannelCredentialsImpl");var ComposedChannelCredentialsImpl=class extends ChannelCredentials{constructor(channelCredentials,callCreds){super(callCreds),this.channelCredentials=channelCredentials}compose(callCredentials){let combinedCallCredentials=this.callCredentials.compose(callCredentials);return new ComposedChannelCredentialsImpl(this.channelCredentials,combinedCallCredentials)}_getConnectionOptions(){return this.channelCredentials._getConnectionOptions()}_isSecure(){return!0}_equals(other){return this===other?!0:other instanceof ComposedChannelCredentialsImpl?this.channelCredentials._equals(other.channelCredentials)&&this.callCredentials._equals(other.callCredentials):!1}};__name(ComposedChannelCredentialsImpl,"ComposedChannelCredentialsImpl")}});var require_load_balancer=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/load-balancer.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.selectLbConfigFromList=exports2.getDefaultConfig=exports2.parseLoadBalancingConfig=exports2.isLoadBalancerNameRegistered=exports2.createLoadBalancer=exports2.registerDefaultLoadBalancerType=exports2.registerLoadBalancerType=exports2.createChildChannelControlHelper=void 0;var logging_1=require_logging(),constants_1=require_constants();function createChildChannelControlHelper(parent,overrides){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k;return{createSubchannel:(_b=(_a=overrides.createSubchannel)===null||_a===void 0?void 0:_a.bind(overrides))!==null&&_b!==void 0?_b:parent.createSubchannel.bind(parent),updateState:(_d=(_c=overrides.updateState)===null||_c===void 0?void 0:_c.bind(overrides))!==null&&_d!==void 0?_d:parent.updateState.bind(parent),requestReresolution:(_f=(_e=overrides.requestReresolution)===null||_e===void 0?void 0:_e.bind(overrides))!==null&&_f!==void 0?_f:parent.requestReresolution.bind(parent),addChannelzChild:(_h=(_g=overrides.addChannelzChild)===null||_g===void 0?void 0:_g.bind(overrides))!==null&&_h!==void 0?_h:parent.addChannelzChild.bind(parent),removeChannelzChild:(_k=(_j=overrides.removeChannelzChild)===null||_j===void 0?void 0:_j.bind(overrides))!==null&&_k!==void 0?_k:parent.removeChannelzChild.bind(parent)}}__name(createChildChannelControlHelper,"createChildChannelControlHelper");exports2.createChildChannelControlHelper=createChildChannelControlHelper;var registeredLoadBalancerTypes={},defaultLoadBalancerType=null;function registerLoadBalancerType(typeName,loadBalancerType,loadBalancingConfigType){registeredLoadBalancerTypes[typeName]={LoadBalancer:loadBalancerType,LoadBalancingConfig:loadBalancingConfigType}}__name(registerLoadBalancerType,"registerLoadBalancerType");exports2.registerLoadBalancerType=registerLoadBalancerType;function registerDefaultLoadBalancerType(typeName){defaultLoadBalancerType=typeName}__name(registerDefaultLoadBalancerType,"registerDefaultLoadBalancerType");exports2.registerDefaultLoadBalancerType=registerDefaultLoadBalancerType;function createLoadBalancer(config,channelControlHelper,options){let typeName=config.getLoadBalancerName();return typeName in registeredLoadBalancerTypes?new registeredLoadBalancerTypes[typeName].LoadBalancer(channelControlHelper,options):null}__name(createLoadBalancer,"createLoadBalancer");exports2.createLoadBalancer=createLoadBalancer;function isLoadBalancerNameRegistered(typeName){return typeName in registeredLoadBalancerTypes}__name(isLoadBalancerNameRegistered,"isLoadBalancerNameRegistered");exports2.isLoadBalancerNameRegistered=isLoadBalancerNameRegistered;function parseLoadBalancingConfig(rawConfig){let keys=Object.keys(rawConfig);if(keys.length!==1)throw new Error("Provided load balancing config has multiple conflicting entries");let typeName=keys[0];if(typeName in registeredLoadBalancerTypes)try{return registeredLoadBalancerTypes[typeName].LoadBalancingConfig.createFromJson(rawConfig[typeName])}catch(e){throw new Error(`${typeName}: ${e.message}`)}else throw new Error(`Unrecognized load balancing config name ${typeName}`)}__name(parseLoadBalancingConfig,"parseLoadBalancingConfig");exports2.parseLoadBalancingConfig=parseLoadBalancingConfig;function getDefaultConfig(){if(!defaultLoadBalancerType)throw new Error("No default load balancer type registered");return new registeredLoadBalancerTypes[defaultLoadBalancerType].LoadBalancingConfig}__name(getDefaultConfig,"getDefaultConfig");exports2.getDefaultConfig=getDefaultConfig;function selectLbConfigFromList(configs,fallbackTodefault=!1){for(let config of configs)try{return parseLoadBalancingConfig(config)}catch(e){(0,logging_1.log)(constants_1.LogVerbosity.DEBUG,"Config parsing failed with error",e.message);continue}return fallbackTodefault&&defaultLoadBalancerType?new registeredLoadBalancerTypes[defaultLoadBalancerType].LoadBalancingConfig:null}__name(selectLbConfigFromList,"selectLbConfigFromList");exports2.selectLbConfigFromList=selectLbConfigFromList}});var require_service_config=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/service-config.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.extractAndSelectServiceConfig=exports2.validateServiceConfig=exports2.validateRetryThrottling=void 0;var os=require("os"),constants_1=require_constants(),DURATION_REGEX=/^\d+(\.\d{1,9})?s$/,CLIENT_LANGUAGE_STRING="node";function validateName(obj){if("service"in obj&&obj.service!==""){if(typeof obj.service!="string")throw new Error(`Invalid method config name: invalid service: expected type string, got ${typeof obj.service}`);if("method"in obj&&obj.method!==""){if(typeof obj.method!="string")throw new Error(`Invalid method config name: invalid method: expected type string, got ${typeof obj.service}`);return{service:obj.service,method:obj.method}}else return{service:obj.service}}else{if("method"in obj&&obj.method!==void 0)throw new Error("Invalid method config name: method set with empty or unset service");return{}}}__name(validateName,"validateName");function validateRetryPolicy(obj){if(!("maxAttempts"in obj)||!Number.isInteger(obj.maxAttempts)||obj.maxAttempts<2)throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in obj)||typeof obj.initialBackoff!="string"||!DURATION_REGEX.test(obj.initialBackoff))throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer followed by s");if(!("maxBackoff"in obj)||typeof obj.maxBackoff!="string"||!DURATION_REGEX.test(obj.maxBackoff))throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer followed by s");if(!("backoffMultiplier"in obj)||typeof obj.backoffMultiplier!="number"||obj.backoffMultiplier<=0)throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!("retryableStatusCodes"in obj&&Array.isArray(obj.retryableStatusCodes)))throw new Error("Invalid method config retry policy: retryableStatusCodes is required");if(obj.retryableStatusCodes.length===0)throw new Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(let value of obj.retryableStatusCodes)if(typeof value=="number"){if(!Object.values(constants_1.Status).includes(value))throw new Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else if(typeof value=="string"){if(!Object.values(constants_1.Status).includes(value.toUpperCase()))throw new Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}else throw new Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");return{maxAttempts:obj.maxAttempts,initialBackoff:obj.initialBackoff,maxBackoff:obj.maxBackoff,backoffMultiplier:obj.backoffMultiplier,retryableStatusCodes:obj.retryableStatusCodes}}__name(validateRetryPolicy,"validateRetryPolicy");function validateHedgingPolicy(obj){if(!("maxAttempts"in obj)||!Number.isInteger(obj.maxAttempts)||obj.maxAttempts<2)throw new Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in obj&&(typeof obj.hedgingDelay!="string"||!DURATION_REGEX.test(obj.hedgingDelay)))throw new Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in obj&&Array.isArray(obj.nonFatalStatusCodes))for(let value of obj.nonFatalStatusCodes)if(typeof value=="number"){if(!Object.values(constants_1.Status).includes(value))throw new Error("Invlid method config hedging policy: nonFatalStatusCodes value not in status code range")}else if(typeof value=="string"){if(!Object.values(constants_1.Status).includes(value.toUpperCase()))throw new Error("Invlid method config hedging policy: nonFatalStatusCodes value not a status code name")}else throw new Error("Invlid method config hedging policy: nonFatalStatusCodes value must be a string or number");let result={maxAttempts:obj.maxAttempts};return obj.hedgingDelay&&(result.hedgingDelay=obj.hedgingDelay),obj.nonFatalStatusCodes&&(result.nonFatalStatusCodes=obj.nonFatalStatusCodes),result}__name(validateHedgingPolicy,"validateHedgingPolicy");function validateMethodConfig(obj){var _a;let result={name:[]};if(!("name"in obj)||!Array.isArray(obj.name))throw new Error("Invalid method config: invalid name array");for(let name of obj.name)result.name.push(validateName(name));if("waitForReady"in obj){if(typeof obj.waitForReady!="boolean")throw new Error("Invalid method config: invalid waitForReady");result.waitForReady=obj.waitForReady}if("timeout"in obj)if(typeof obj.timeout=="object"){if(!("seconds"in obj.timeout)||typeof obj.timeout.seconds!="number")throw new Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in obj.timeout)||typeof obj.timeout.nanos!="number")throw new Error("Invalid method config: invalid timeout.nanos");result.timeout=obj.timeout}else if(typeof obj.timeout=="string"&&DURATION_REGEX.test(obj.timeout)){let timeoutParts=obj.timeout.substring(0,obj.timeout.length-1).split(".");result.timeout={seconds:timeoutParts[0]|0,nanos:((_a=timeoutParts[1])!==null&&_a!==void 0?_a:0)|0}}else throw new Error("Invalid method config: invalid timeout");if("maxRequestBytes"in obj){if(typeof obj.maxRequestBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");result.maxRequestBytes=obj.maxRequestBytes}if("maxResponseBytes"in obj){if(typeof obj.maxResponseBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");result.maxResponseBytes=obj.maxResponseBytes}if("retryPolicy"in obj){if("hedgingPolicy"in obj)throw new Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");result.retryPolicy=validateRetryPolicy(obj.retryPolicy)}else"hedgingPolicy"in obj&&(result.hedgingPolicy=validateHedgingPolicy(obj.hedgingPolicy));return result}__name(validateMethodConfig,"validateMethodConfig");function validateRetryThrottling(obj){if(!("maxTokens"in obj)||typeof obj.maxTokens!="number"||obj.maxTokens<=0||obj.maxTokens>1e3)throw new Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in obj)||typeof obj.tokenRatio!="number"||obj.tokenRatio<=0)throw new Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+obj.maxTokens.toFixed(3),tokenRatio:+obj.tokenRatio.toFixed(3)}}__name(validateRetryThrottling,"validateRetryThrottling");exports2.validateRetryThrottling=validateRetryThrottling;function validateLoadBalancingConfig(obj){if(!(typeof obj=="object"&&obj!==null))throw new Error(`Invalid loadBalancingConfig: unexpected type ${typeof obj}`);let keys=Object.keys(obj);if(keys.length>1)throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${keys}`);if(keys.length===0)throw new Error("Invalid loadBalancingConfig: load balancing policy name required");return{[keys[0]]:obj[keys[0]]}}__name(validateLoadBalancingConfig,"validateLoadBalancingConfig");function validateServiceConfig(obj){let result={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in obj)if(typeof obj.loadBalancingPolicy=="string")result.loadBalancingPolicy=obj.loadBalancingPolicy;else throw new Error("Invalid service config: invalid loadBalancingPolicy");if("loadBalancingConfig"in obj)if(Array.isArray(obj.loadBalancingConfig))for(let config of obj.loadBalancingConfig)result.loadBalancingConfig.push(validateLoadBalancingConfig(config));else throw new Error("Invalid service config: invalid loadBalancingConfig");if("methodConfig"in obj&&Array.isArray(obj.methodConfig))for(let methodConfig of obj.methodConfig)result.methodConfig.push(validateMethodConfig(methodConfig));"retryThrottling"in obj&&(result.retryThrottling=validateRetryThrottling(obj.retryThrottling));let seenMethodNames=[];for(let methodConfig of result.methodConfig)for(let name of methodConfig.name){for(let seenName of seenMethodNames)if(name.service===seenName.service&&name.method===seenName.method)throw new Error(`Invalid service config: duplicate name ${name.service}/${name.method}`);seenMethodNames.push(name)}return result}__name(validateServiceConfig,"validateServiceConfig");exports2.validateServiceConfig=validateServiceConfig;function validateCanaryConfig(obj){if(!("serviceConfig"in obj))throw new Error("Invalid service config choice: missing service config");let result={serviceConfig:validateServiceConfig(obj.serviceConfig)};if("clientLanguage"in obj)if(Array.isArray(obj.clientLanguage)){result.clientLanguage=[];for(let lang of obj.clientLanguage)if(typeof lang=="string")result.clientLanguage.push(lang);else throw new Error("Invalid service config choice: invalid clientLanguage")}else throw new Error("Invalid service config choice: invalid clientLanguage");if("clientHostname"in obj)if(Array.isArray(obj.clientHostname)){result.clientHostname=[];for(let lang of obj.clientHostname)if(typeof lang=="string")result.clientHostname.push(lang);else throw new Error("Invalid service config choice: invalid clientHostname")}else throw new Error("Invalid service config choice: invalid clientHostname");if("percentage"in obj)if(typeof obj.percentage=="number"&&0<=obj.percentage&&obj.percentage<=100)result.percentage=obj.percentage;else throw new Error("Invalid service config choice: invalid percentage");let allowedFields=["clientLanguage","percentage","clientHostname","serviceConfig"];for(let field in obj)if(!allowedFields.includes(field))throw new Error(`Invalid service config choice: unexpected field ${field}`);return result}__name(validateCanaryConfig,"validateCanaryConfig");function validateAndSelectCanaryConfig(obj,percentage){if(!Array.isArray(obj))throw new Error("Invalid service config list");for(let config of obj){let validatedConfig=validateCanaryConfig(config);if(!(typeof validatedConfig.percentage=="number"&&percentage>validatedConfig.percentage)){if(Array.isArray(validatedConfig.clientHostname)){let hostnameMatched=!1;for(let hostname of validatedConfig.clientHostname)hostname===os.hostname()&&(hostnameMatched=!0);if(!hostnameMatched)continue}if(Array.isArray(validatedConfig.clientLanguage)){let languageMatched=!1;for(let language of validatedConfig.clientLanguage)language===CLIENT_LANGUAGE_STRING&&(languageMatched=!0);if(!languageMatched)continue}return validatedConfig.serviceConfig}}throw new Error("No matching service config found")}__name(validateAndSelectCanaryConfig,"validateAndSelectCanaryConfig");function extractAndSelectServiceConfig(txtRecord,percentage){for(let record of txtRecord)if(record.length>0&&record[0].startsWith("grpc_config=")){let recordString=record.join("").substring(12),recordJson=JSON.parse(recordString);return validateAndSelectCanaryConfig(recordJson,percentage)}return null}__name(extractAndSelectServiceConfig,"extractAndSelectServiceConfig");exports2.extractAndSelectServiceConfig=extractAndSelectServiceConfig}});var require_connectivity_state=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/connectivity-state.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.ConnectivityState=void 0;var ConnectivityState;(function(ConnectivityState2){ConnectivityState2[ConnectivityState2.IDLE=0]="IDLE",ConnectivityState2[ConnectivityState2.CONNECTING=1]="CONNECTING",ConnectivityState2[ConnectivityState2.READY=2]="READY",ConnectivityState2[ConnectivityState2.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",ConnectivityState2[ConnectivityState2.SHUTDOWN=4]="SHUTDOWN"})(ConnectivityState||(exports2.ConnectivityState=ConnectivityState={}))}});var require_uri_parser=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/uri-parser.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.uriToString=exports2.combineHostPort=exports2.splitHostPort=exports2.parseUri=void 0;var URI_REGEX=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;function parseUri(uriString){let parsedUri=URI_REGEX.exec(uriString);return parsedUri===null?null:{scheme:parsedUri[1],authority:parsedUri[2],path:parsedUri[3]}}__name(parseUri,"parseUri");exports2.parseUri=parseUri;var NUMBER_REGEX=/^\d+$/;function splitHostPort(path){if(path.startsWith("[")){let hostEnd=path.indexOf("]");if(hostEnd===-1)return null;let host=path.substring(1,hostEnd);if(host.indexOf(":")===-1)return null;if(path.length>hostEnd+1)if(path[hostEnd+1]===":"){let portString=path.substring(hostEnd+2);return NUMBER_REGEX.test(portString)?{host,port:+portString}:null}else return null;else return{host}}else{let splitPath=path.split(":");return splitPath.length===2?NUMBER_REGEX.test(splitPath[1])?{host:splitPath[0],port:+splitPath[1]}:null:{host:path}}}__name(splitHostPort,"splitHostPort");exports2.splitHostPort=splitHostPort;function combineHostPort(hostPort){return hostPort.port===void 0?hostPort.host:hostPort.host.includes(":")?`[${hostPort.host}]:${hostPort.port}`:`${hostPort.host}:${hostPort.port}`}__name(combineHostPort,"combineHostPort");exports2.combineHostPort=combineHostPort;function uriToString(uri){let result="";return uri.scheme!==void 0&&(result+=uri.scheme+":"),uri.authority!==void 0&&(result+="//"+uri.authority+"/"),result+=uri.path,result}__name(uriToString,"uriToString");exports2.uriToString=uriToString}});var require_resolver=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/resolver.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.mapUriDefaultScheme=exports2.getDefaultAuthority=exports2.createResolver=exports2.registerDefaultScheme=exports2.registerResolver=void 0;var uri_parser_1=require_uri_parser(),registeredResolvers={},defaultScheme=null;function registerResolver(scheme,resolverClass){registeredResolvers[scheme]=resolverClass}__name(registerResolver,"registerResolver");exports2.registerResolver=registerResolver;function registerDefaultScheme(scheme){defaultScheme=scheme}__name(registerDefaultScheme,"registerDefaultScheme");exports2.registerDefaultScheme=registerDefaultScheme;function createResolver(target,listener,options){if(target.scheme!==void 0&&target.scheme in registeredResolvers)return new registeredResolvers[target.scheme](target,listener,options);throw new Error(`No resolver could be created for target ${(0,uri_parser_1.uriToString)(target)}`)}__name(createResolver,"createResolver");exports2.createResolver=createResolver;function getDefaultAuthority(target){if(target.scheme!==void 0&&target.scheme in registeredResolvers)return registeredResolvers[target.scheme].getDefaultAuthority(target);throw new Error(`Invalid target ${(0,uri_parser_1.uriToString)(target)}`)}__name(getDefaultAuthority,"getDefaultAuthority");exports2.getDefaultAuthority=getDefaultAuthority;function mapUriDefaultScheme(target){return target.scheme===void 0||!(target.scheme in registeredResolvers)?defaultScheme!==null?{scheme:defaultScheme,authority:void 0,path:(0,uri_parser_1.uriToString)(target)}:null:target}__name(mapUriDefaultScheme,"mapUriDefaultScheme");exports2.mapUriDefaultScheme=mapUriDefaultScheme}});var require_picker=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/picker.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.QueuePicker=exports2.UnavailablePicker=exports2.PickResultType=void 0;var metadata_1=require_metadata(),constants_1=require_constants(),PickResultType;(function(PickResultType2){PickResultType2[PickResultType2.COMPLETE=0]="COMPLETE",PickResultType2[PickResultType2.QUEUE=1]="QUEUE",PickResultType2[PickResultType2.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",PickResultType2[PickResultType2.DROP=3]="DROP"})(PickResultType||(exports2.PickResultType=PickResultType={}));var UnavailablePicker=class{constructor(status){this.status=Object.assign({code:constants_1.Status.UNAVAILABLE,details:"No connection established",metadata:new metadata_1.Metadata},status)}pick(pickArgs){return{pickResultType:PickResultType.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}};__name(UnavailablePicker,"UnavailablePicker");exports2.UnavailablePicker=UnavailablePicker;var QueuePicker=class{constructor(loadBalancer,childPicker){this.loadBalancer=loadBalancer,this.childPicker=childPicker,this.calledExitIdle=!1}pick(pickArgs){return this.calledExitIdle||(process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0),this.childPicker?this.childPicker.pick(pickArgs):{pickResultType:PickResultType.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}};__name(QueuePicker,"QueuePicker");exports2.QueuePicker=QueuePicker}});var require_backoff_timeout=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/backoff-timeout.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.BackoffTimeout=void 0;var INITIAL_BACKOFF_MS=1e3,BACKOFF_MULTIPLIER=1.6,MAX_BACKOFF_MS=12e4,BACKOFF_JITTER=.2;function uniformRandom(min,max){return Math.random()*(max-min)+min}__name(uniformRandom,"uniformRandom");var BackoffTimeout=class{constructor(callback,options){this.callback=callback,this.initialDelay=INITIAL_BACKOFF_MS,this.multiplier=BACKOFF_MULTIPLIER,this.maxDelay=MAX_BACKOFF_MS,this.jitter=BACKOFF_JITTER,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,options&&(options.initialDelay&&(this.initialDelay=options.initialDelay),options.multiplier&&(this.multiplier=options.multiplier),options.jitter&&(this.jitter=options.jitter),options.maxDelay&&(this.maxDelay=options.maxDelay)),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}runTimer(delay){var _a,_b;this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.callback(),this.running=!1},delay),this.hasRef||(_b=(_a=this.timerId).unref)===null||_b===void 0||_b.call(_a)}runOnce(){this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);let nextBackoff=Math.min(this.nextDelay*this.multiplier,this.maxDelay),jitterMagnitude=nextBackoff*this.jitter;this.nextDelay=nextBackoff+uniformRandom(-jitterMagnitude,jitterMagnitude)}stop(){clearTimeout(this.timerId),this.running=!1}reset(){if(this.nextDelay=this.initialDelay,this.running){let now=new Date,newEndTime=this.startTime;newEndTime.setMilliseconds(newEndTime.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),nowx.length>0),service=(_a=splitName[0])!==null&&_a!==void 0?_a:"",method=(_b=splitName[1])!==null&&_b!==void 0?_b:"";if(serviceConfig&&serviceConfig.methodConfig)for(let matchLevel of NAME_MATCH_LEVEL_ORDER){let matchingConfig=findMatchingConfig(service,method,serviceConfig.methodConfig,matchLevel);if(matchingConfig)return{methodConfig:matchingConfig,pickInformation:{},status:constants_1.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:constants_1.Status.OK,dynamicFilterFactories:[]}},"defaultConfigSelector")}__name(getDefaultConfigSelector,"getDefaultConfigSelector");var ResolvingLoadBalancer=class{constructor(target,channelControlHelper,channelOptions,onSuccessfulResolution,onFailedResolution){this.target=target,this.channelControlHelper=channelControlHelper,this.onSuccessfulResolution=onSuccessfulResolution,this.onFailedResolution=onFailedResolution,this.latestChildState=connectivity_state_1.ConnectivityState.IDLE,this.latestChildPicker=new picker_1.QueuePicker(this),this.currentState=connectivity_state_1.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,channelOptions["grpc.service_config"]?this.defaultServiceConfig=(0,service_config_1.validateServiceConfig)(JSON.parse(channelOptions["grpc.service_config"])):this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]},this.updateState(connectivity_state_1.ConnectivityState.IDLE,new picker_1.QueuePicker(this)),this.childLoadBalancer=new load_balancer_child_handler_1.ChildLoadBalancerHandler({createSubchannel:channelControlHelper.createSubchannel.bind(channelControlHelper),requestReresolution:()=>{this.backoffTimeout.isRunning()?(trace("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0):this.updateResolution()},updateState:(newState,picker)=>{this.latestChildState=newState,this.latestChildPicker=picker,this.updateState(newState,picker)},addChannelzChild:channelControlHelper.addChannelzChild.bind(channelControlHelper),removeChannelzChild:channelControlHelper.removeChannelzChild.bind(channelControlHelper)},channelOptions),this.innerResolver=(0,resolver_1.createResolver)(target,{onSuccessfulResolution:(endpointList,serviceConfig,serviceConfigError,configSelector,attributes)=>{var _a;this.backoffTimeout.stop(),this.backoffTimeout.reset();let workingServiceConfig=null;serviceConfig===null?serviceConfigError===null?(this.previousServiceConfig=null,workingServiceConfig=this.defaultServiceConfig):this.previousServiceConfig===null?this.handleResolutionFailure(serviceConfigError):workingServiceConfig=this.previousServiceConfig:(workingServiceConfig=serviceConfig,this.previousServiceConfig=serviceConfig);let workingConfigList=(_a=workingServiceConfig?.loadBalancingConfig)!==null&&_a!==void 0?_a:[],loadBalancingConfig=(0,load_balancer_1.selectLbConfigFromList)(workingConfigList,!0);if(loadBalancingConfig===null){this.handleResolutionFailure({code:constants_1.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new metadata_1.Metadata});return}this.childLoadBalancer.updateAddressList(endpointList,loadBalancingConfig,attributes);let finalServiceConfig=workingServiceConfig??this.defaultServiceConfig;this.onSuccessfulResolution(finalServiceConfig,configSelector??getDefaultConfigSelector(finalServiceConfig))},onError:error=>{this.handleResolutionFailure(error)}},channelOptions);let backoffOptions={initialDelay:channelOptions["grpc.initial_reconnect_backoff_ms"],maxDelay:channelOptions["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new backoff_timeout_1.BackoffTimeout(()=>{this.continueResolving?(this.updateResolution(),this.continueResolving=!1):this.updateState(this.latestChildState,this.latestChildPicker)},backoffOptions),this.backoffTimeout.unref()}updateResolution(){this.innerResolver.updateResolution(),this.currentState===connectivity_state_1.ConnectivityState.IDLE&&this.updateState(connectivity_state_1.ConnectivityState.CONNECTING,this.latestChildPicker),this.backoffTimeout.runOnce()}updateState(connectivityState,picker){trace((0,uri_parser_1.uriToString)(this.target)+" "+connectivity_state_1.ConnectivityState[this.currentState]+" -> "+connectivity_state_1.ConnectivityState[connectivityState]),connectivityState===connectivity_state_1.ConnectivityState.IDLE&&(picker=new picker_1.QueuePicker(this,picker)),this.currentState=connectivityState,this.channelControlHelper.updateState(connectivityState,picker)}handleResolutionFailure(error){this.latestChildState===connectivity_state_1.ConnectivityState.IDLE&&(this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE,new picker_1.UnavailablePicker(error)),this.onFailedResolution(error))}exitIdle(){(this.currentState===connectivity_state_1.ConnectivityState.IDLE||this.currentState===connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE)&&(this.backoffTimeout.isRunning()?this.continueResolving=!0:this.updateResolution()),this.childLoadBalancer.exitIdle()}updateAddressList(endpointList,lbConfig){throw new 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=connectivity_state_1.ConnectivityState.IDLE,this.latestChildPicker=new picker_1.QueuePicker(this),this.currentState=connectivity_state_1.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}};__name(ResolvingLoadBalancer,"ResolvingLoadBalancer");exports2.ResolvingLoadBalancer=ResolvingLoadBalancer}});var require_channel_options=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/channel-options.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.channelOptionsEqual=exports2.recognizedOptions=void 0;exports2.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};function channelOptionsEqual(options1,options2){let keys1=Object.keys(options1).sort(),keys2=Object.keys(options2).sort();if(keys1.length!==keys2.length)return!1;for(let i=0;ie2?1:0},e=!1){super(),this.v=void 0,this.A=t,this.enableIndex=e,this.N=e?TreeNodeEnableIndex:TreeNode,this.C=new this.N}R(t,e){let s=this.C;for(;t;){let i=this.A(t.u,e);if(i<0)t=t.h;else if(i>0)s=t,t=t.i;else return t}return s}K(t,e){let s=this.C;for(;t;)this.A(t.u,e)<=0?t=t.h:(s=t,t=t.i);return s}L(t,e){let s=this.C;for(;t;){let i=this.A(t.u,e);if(i<0)s=t,t=t.h;else if(i>0)t=t.i;else return t}return s}k(t,e){let s=this.C;for(;t;)this.A(t.u,e)<0?(s=t,t=t.h):t=t.i;return s}P(t){for(;;){let e=t.o;if(e===this.C)return;if(t.p===1){t.p=0;return}if(t===e.i){let s=e.h;if(s.p===1)s.p=0,e.p=1,e===this.v?this.v=e._():e._();else if(s.h&&s.h.p===1){s.p=e.p,e.p=0,s.h.p=0,e===this.v?this.v=e._():e._();return}else s.i&&s.i.p===1?(s.p=1,s.i.p=0,s.g()):(s.p=1,t=e)}else{let s=e.i;if(s.p===1)s.p=0,e.p=1,e===this.v?this.v=e.g():e.g();else if(s.i&&s.i.p===1){s.p=e.p,e.p=0,s.i.p=0,e===this.v?this.v=e.g():e.g();return}else s.h&&s.h.p===1?(s.p=1,s.h.p=0,s._()):(s.p=1,t=e)}}}S(t){if(this.m===1){this.clear();return}let e=t;for(;e.i||e.h;){if(e.h)for(e=e.h;e.i;)e=e.i;else e=e.i;let s2=t.u;t.u=e.u,e.u=s2;let i=t.l;t.l=e.l,e.l=i,t=e}this.C.i===e?this.C.i=e.o:this.C.h===e&&(this.C.h=e.o),this.P(e);let s=e.o;if(e===s.i?s.i=void 0:s.h=void 0,this.m-=1,this.v.p=0,this.enableIndex)for(;s!==this.C;)s.M-=1,s=s.o}U(t){let e=typeof t=="number"?t:void 0,s=typeof t=="function"?t:void 0,i=typeof t>"u"?[]:void 0,r=0,n=this.v,h=[];for(;h.length||n;)if(n)h.push(n),n=n.i;else{if(n=h.pop(),r===e)return n;i&&i.push(n),s&&s(n,r,this),r+=1,n=n.h}return i}j(t){for(;;){let e=t.o;if(e.p===0)return;let s=e.o;if(e===s.i){let i=s.h;if(i&&i.p===1){if(i.p=e.p=0,s===this.v)return;s.p=1,t=s;continue}else if(t===e.h){if(t.p=0,t.i&&(t.i.o=e),t.h&&(t.h.o=s),e.h=t.i,s.i=t.h,t.i=e,t.h=s,s===this.v)this.v=t,this.C.o=t;else{let e2=s.o;e2.i===s?e2.i=t:e2.h=t}t.o=s.o,e.o=t,s.o=t,s.p=1}else{e.p=0,s===this.v?this.v=s.g():s.g(),s.p=1;return}}else{let i=s.i;if(i&&i.p===1){if(i.p=e.p=0,s===this.v)return;s.p=1,t=s;continue}else if(t===e.i){if(t.p=0,t.i&&(t.i.o=s),t.h&&(t.h.o=e),s.h=t.i,e.i=t.h,t.i=s,t.h=e,s===this.v)this.v=t,this.C.o=t;else{let e2=s.o;e2.i===s?e2.i=t:e2.h=t}t.o=s.o,e.o=t,s.o=t,s.p=1}else{e.p=0,s===this.v?this.v=s._():s._(),s.p=1;return}}this.enableIndex&&(e.O(),s.O(),t.O());return}}q(t,e,s){if(this.v===void 0)return this.m+=1,this.v=new this.N(t,e,0),this.v.o=this.C,this.C.o=this.C.i=this.C.h=this.v,this.m;let i,r=this.C.i,n=this.A(r.u,t);if(n===0)return r.l=e,this.m;if(n>0)r.i=new this.N(t,e),r.i.o=r,i=r.i,this.C.i=i;else{let r2=this.C.h,n2=this.A(r2.u,t);if(n2===0)return r2.l=e,this.m;if(n2<0)r2.h=new this.N(t,e),r2.h.o=r2,i=r2.h,this.C.h=i;else{if(s!==void 0){let r3=s.T;if(r3!==this.C){let s2=this.A(r3.u,t);if(s2===0)return r3.l=e,this.m;if(s2>0){let s3=r3.I(),n3=this.A(s3.u,t);if(n3===0)return s3.l=e,this.m;n3<0&&(i=new this.N(t,e),s3.h===void 0?(s3.h=i,i.o=s3):(r3.i=i,i.o=r3))}}}if(i===void 0)for(i=this.v;;){let s2=this.A(i.u,t);if(s2>0){if(i.i===void 0){i.i=new this.N(t,e),i.i.o=i,i=i.i;break}i=i.i}else if(s2<0){if(i.h===void 0){i.h=new this.N(t,e),i.h.o=i,i=i.h;break}i=i.h}else return i.l=e,this.m}}}if(this.enableIndex){let t2=i.o;for(;t2!==this.C;)t2.M+=1,t2=t2.o}return this.j(i),this.m+=1,this.m}H(t,e){for(;t;){let s=this.A(t.u,e);if(s<0)t=t.h;else if(s>0)t=t.i;else return t}return t||this.C}clear(){this.m=0,this.v=void 0,this.C.o=void 0,this.C.i=this.C.h=void 0}updateKeyByIterator(t,e){let s=t.T;if(s===this.C&&throwIteratorAccessError(),this.m===1)return s.u=e,!0;let i=s.B().u;if(s===this.C.i)return this.A(i,e)>0?(s.u=e,!0):!1;let r=s.I().u;return s===this.C.h?this.A(r,e)<0?(s.u=e,!0):!1:this.A(r,e)>=0||this.A(i,e)<=0?!1:(s.u=e,!0)}eraseElementByPos(t){if(t<0||t>this.m-1)throw new RangeError;let e=this.U(t);return this.S(e),this.m}eraseElementByKey(t){if(this.m===0)return!1;let e=this.H(this.v,t);return e===this.C?!1:(this.S(e),!0)}eraseElementByIterator(t){let e=t.T;e===this.C&&throwIteratorAccessError();let s=e.h===void 0;return t.iteratorType===0?s&&t.next():(!s||e.i===void 0)&&t.next(),this.S(e),t}getHeight(){if(this.m===0)return 0;function traversal(t){return t?Math.max(traversal(t.i),traversal(t.h))+1:0}return __name(traversal,"traversal"),traversal(this.v)}};__name(TreeContainer,"TreeContainer");var TreeIterator=class extends ContainerIterator{constructor(t,e,s){super(s),this.T=t,this.C=e,this.iteratorType===0?(this.pre=function(){return this.T===this.C.i&&throwIteratorAccessError(),this.T=this.T.I(),this},this.next=function(){return this.T===this.C&&throwIteratorAccessError(),this.T=this.T.B(),this}):(this.pre=function(){return this.T===this.C.h&&throwIteratorAccessError(),this.T=this.T.B(),this},this.next=function(){return this.T===this.C&&throwIteratorAccessError(),this.T=this.T.I(),this})}get index(){let t=this.T,e=this.C.o;if(t===this.C)return e?e.M-1:0;let s=0;for(t.i&&(s+=t.i.M);t!==e;){let e2=t.o;t===e2.h&&(s+=1,e2.i&&(s+=e2.i.M)),t=e2}return s}isAccessible(){return this.T!==this.C}};__name(TreeIterator,"TreeIterator");var OrderedMapIterator=class extends TreeIterator{constructor(t,e,s,i){super(t,e,i),this.container=s}get pointer(){this.T===this.C&&throwIteratorAccessError();let t=this;return new Proxy([],{get(e,s){return s==="0"?t.T.u:s==="1"?t.T.l:(e[0]=t.T.u,e[1]=t.T.l,e[s])},set(e,s,i){if(s!=="1")throw new TypeError("prop must be 1");return t.T.l=i,!0}})}copy(){return new OrderedMapIterator(this.T,this.C,this.container,this.iteratorType)}};__name(OrderedMapIterator,"OrderedMapIterator");var OrderedMap=class extends TreeContainer{constructor(t=[],e,s){super(e,s);let i=this;t.forEach(function(t2){i.setElement(t2[0],t2[1])})}begin(){return new OrderedMapIterator(this.C.i||this.C,this.C,this)}end(){return new OrderedMapIterator(this.C,this.C,this)}rBegin(){return new OrderedMapIterator(this.C.h||this.C,this.C,this,1)}rEnd(){return new OrderedMapIterator(this.C,this.C,this,1)}front(){if(this.m===0)return;let t=this.C.i;return[t.u,t.l]}back(){if(this.m===0)return;let t=this.C.h;return[t.u,t.l]}lowerBound(t){let e=this.R(this.v,t);return new OrderedMapIterator(e,this.C,this)}upperBound(t){let e=this.K(this.v,t);return new OrderedMapIterator(e,this.C,this)}reverseLowerBound(t){let e=this.L(this.v,t);return new OrderedMapIterator(e,this.C,this)}reverseUpperBound(t){let e=this.k(this.v,t);return new OrderedMapIterator(e,this.C,this)}forEach(t){this.U(function(e,s,i){t([e.u,e.l],s,i)})}setElement(t,e,s){return this.q(t,e,s)}getElementByPos(t){if(t<0||t>this.m-1)throw new RangeError;let e=this.U(t);return[e.u,e.l]}find(t){let e=this.H(this.v,t);return new OrderedMapIterator(e,this.C,this)}getElementByKey(t){return this.H(this.v,t).l}union(t){let e=this;return t.forEach(function(t2){e.setElement(t2[0],t2[1])}),this.m}*[Symbol.iterator](){let t=this.m,e=this.U();for(let s=0;s{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(metadata2),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(message){this.processingMessage=!0,this.listener.onReceiveMessage(message,msg=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=msg,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(msg),this.processPendingStatus())})}onReceiveStatus(status){this.listener.onReceiveStatus(status,processedStatus=>{this.processingMetadata||this.processingMessage?this.pendingStatus=processedStatus:this.nextListener.onReceiveStatus(processedStatus)})}};__name(InterceptingListenerImpl,"InterceptingListenerImpl");exports2.InterceptingListenerImpl=InterceptingListenerImpl}});var require_client_interceptors=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/client-interceptors.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.getInterceptingCall=exports2.InterceptingCall=exports2.RequesterBuilder=exports2.ListenerBuilder=exports2.InterceptorConfigurationError=void 0;var metadata_1=require_metadata(),call_interface_1=require_call_interface(),constants_1=require_constants(),error_1=require_error(),InterceptorConfigurationError=class extends Error{constructor(message){super(message),this.name="InterceptorConfigurationError",Error.captureStackTrace(this,InterceptorConfigurationError)}};__name(InterceptorConfigurationError,"InterceptorConfigurationError");exports2.InterceptorConfigurationError=InterceptorConfigurationError;var ListenerBuilder=class{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(onReceiveMetadata){return this.metadata=onReceiveMetadata,this}withOnReceiveMessage(onReceiveMessage){return this.message=onReceiveMessage,this}withOnReceiveStatus(onReceiveStatus){return this.status=onReceiveStatus,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}};__name(ListenerBuilder,"ListenerBuilder");exports2.ListenerBuilder=ListenerBuilder;var RequesterBuilder=class{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(start){return this.start=start,this}withSendMessage(sendMessage){return this.message=sendMessage,this}withHalfClose(halfClose){return this.halfClose=halfClose,this}withCancel(cancel){return this.cancel=cancel,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}};__name(RequesterBuilder,"RequesterBuilder");exports2.RequesterBuilder=RequesterBuilder;var defaultListener={onReceiveMetadata:(metadata,next)=>{next(metadata)},onReceiveMessage:(message,next)=>{next(message)},onReceiveStatus:(status,next)=>{next(status)}},defaultRequester={start:(metadata,listener,next)=>{next(metadata,listener)},sendMessage:(message,next)=>{next(message)},halfClose:next=>{next()},cancel:next=>{next()}},InterceptingCall=class{constructor(nextCall,requester){var _a,_b,_c,_d;this.nextCall=nextCall,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,requester?this.requester={start:(_a=requester.start)!==null&&_a!==void 0?_a:defaultRequester.start,sendMessage:(_b=requester.sendMessage)!==null&&_b!==void 0?_b:defaultRequester.sendMessage,halfClose:(_c=requester.halfClose)!==null&&_c!==void 0?_c:defaultRequester.halfClose,cancel:(_d=requester.cancel)!==null&&_d!==void 0?_d:defaultRequester.cancel}:this.requester=defaultRequester}cancelWithStatus(status,details){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(status,details)})}getPeer(){return this.nextCall.getPeer()}processPendingMessage(){this.pendingMessageContext&&(this.nextCall.sendMessageWithContext(this.pendingMessageContext,this.pendingMessage),this.pendingMessageContext=null,this.pendingMessage=null)}processPendingHalfClose(){this.pendingHalfClose&&this.nextCall.halfClose()}start(metadata,interceptingListener){var _a,_b,_c,_d,_e,_f;let fullInterceptingListener={onReceiveMetadata:(_b=(_a=interceptingListener?.onReceiveMetadata)===null||_a===void 0?void 0:_a.bind(interceptingListener))!==null&&_b!==void 0?_b:metadata2=>{},onReceiveMessage:(_d=(_c=interceptingListener?.onReceiveMessage)===null||_c===void 0?void 0:_c.bind(interceptingListener))!==null&&_d!==void 0?_d:message=>{},onReceiveStatus:(_f=(_e=interceptingListener?.onReceiveStatus)===null||_e===void 0?void 0:_e.bind(interceptingListener))!==null&&_f!==void 0?_f:status=>{}};this.processingMetadata=!0,this.requester.start(metadata,fullInterceptingListener,(md,listener)=>{var _a2,_b2,_c2;this.processingMetadata=!1;let finalInterceptingListener;if((0,call_interface_1.isInterceptingListener)(listener))finalInterceptingListener=listener;else{let fullListener={onReceiveMetadata:(_a2=listener.onReceiveMetadata)!==null&&_a2!==void 0?_a2:defaultListener.onReceiveMetadata,onReceiveMessage:(_b2=listener.onReceiveMessage)!==null&&_b2!==void 0?_b2:defaultListener.onReceiveMessage,onReceiveStatus:(_c2=listener.onReceiveStatus)!==null&&_c2!==void 0?_c2:defaultListener.onReceiveStatus};finalInterceptingListener=new call_interface_1.InterceptingListenerImpl(fullListener,fullInterceptingListener)}this.nextCall.start(md,finalInterceptingListener),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(context,message){this.processingMessage=!0,this.requester.sendMessage(message,finalMessage=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessageContext=context,this.pendingMessage=message):(this.nextCall.sendMessageWithContext(context,finalMessage),this.processPendingHalfClose())})}sendMessage(message){this.sendMessageWithContext({},message)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{this.processingMetadata||this.processingMessage?this.pendingHalfClose=!0:this.nextCall.halfClose()})}};__name(InterceptingCall,"InterceptingCall");exports2.InterceptingCall=InterceptingCall;function getCall(channel,path,options){var _a,_b;let deadline=(_a=options.deadline)!==null&&_a!==void 0?_a:1/0,host=options.host,parent=(_b=options.parent)!==null&&_b!==void 0?_b:null,propagateFlags=options.propagate_flags,credentials=options.credentials,call=channel.createCall(path,deadline,host,parent,propagateFlags);return credentials&&call.setCredentials(credentials),call}__name(getCall,"getCall");var BaseInterceptingCall=class{constructor(call,methodDefinition){this.call=call,this.methodDefinition=methodDefinition}cancelWithStatus(status,details){this.call.cancelWithStatus(status,details)}getPeer(){return this.call.getPeer()}sendMessageWithContext(context,message){let serialized;try{serialized=this.methodDefinition.requestSerialize(message)}catch(e){this.call.cancelWithStatus(constants_1.Status.INTERNAL,`Request message serialization failure: ${(0,error_1.getErrorMessage)(e)}`);return}this.call.sendMessageWithContext(context,serialized)}sendMessage(message){this.sendMessageWithContext({},message)}start(metadata,interceptingListener){let readError=null;this.call.start(metadata,{onReceiveMetadata:metadata2=>{var _a;(_a=interceptingListener?.onReceiveMetadata)===null||_a===void 0||_a.call(interceptingListener,metadata2)},onReceiveMessage:message=>{var _a;let deserialized;try{deserialized=this.methodDefinition.responseDeserialize(message)}catch(e){readError={code:constants_1.Status.INTERNAL,details:`Response message parsing error: ${(0,error_1.getErrorMessage)(e)}`,metadata:new metadata_1.Metadata},this.call.cancelWithStatus(readError.code,readError.details);return}(_a=interceptingListener?.onReceiveMessage)===null||_a===void 0||_a.call(interceptingListener,deserialized)},onReceiveStatus:status=>{var _a,_b;readError?(_a=interceptingListener?.onReceiveStatus)===null||_a===void 0||_a.call(interceptingListener,readError):(_b=interceptingListener?.onReceiveStatus)===null||_b===void 0||_b.call(interceptingListener,status)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}};__name(BaseInterceptingCall,"BaseInterceptingCall");var BaseUnaryInterceptingCall=class extends BaseInterceptingCall{constructor(call,methodDefinition){super(call,methodDefinition)}start(metadata,listener){var _a,_b;let receivedMessage=!1,wrapperListener={onReceiveMetadata:(_b=(_a=listener?.onReceiveMetadata)===null||_a===void 0?void 0:_a.bind(listener))!==null&&_b!==void 0?_b:metadata2=>{},onReceiveMessage:message=>{var _a2;receivedMessage=!0,(_a2=listener?.onReceiveMessage)===null||_a2===void 0||_a2.call(listener,message)},onReceiveStatus:status=>{var _a2,_b2;receivedMessage||(_a2=listener?.onReceiveMessage)===null||_a2===void 0||_a2.call(listener,null),(_b2=listener?.onReceiveStatus)===null||_b2===void 0||_b2.call(listener,status)}};super.start(metadata,wrapperListener),this.call.startRead()}};__name(BaseUnaryInterceptingCall,"BaseUnaryInterceptingCall");var BaseStreamingInterceptingCall=class extends BaseInterceptingCall{};__name(BaseStreamingInterceptingCall,"BaseStreamingInterceptingCall");function getBottomInterceptingCall(channel,options,methodDefinition){let call=getCall(channel,methodDefinition.path,options);return methodDefinition.responseStream?new BaseStreamingInterceptingCall(call,methodDefinition):new BaseUnaryInterceptingCall(call,methodDefinition)}__name(getBottomInterceptingCall,"getBottomInterceptingCall");function getInterceptingCall(interceptorArgs,methodDefinition,options,channel){if(interceptorArgs.clientInterceptors.length>0&&interceptorArgs.clientInterceptorProviders.length>0)throw new InterceptorConfigurationError("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(interceptorArgs.callInterceptors.length>0&&interceptorArgs.callInterceptorProviders.length>0)throw new InterceptorConfigurationError("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let interceptors=[];interceptorArgs.callInterceptors.length>0||interceptorArgs.callInterceptorProviders.length>0?interceptors=[].concat(interceptorArgs.callInterceptors,interceptorArgs.callInterceptorProviders.map(provider=>provider(methodDefinition))).filter(interceptor=>interceptor):interceptors=[].concat(interceptorArgs.clientInterceptors,interceptorArgs.clientInterceptorProviders.map(provider=>provider(methodDefinition))).filter(interceptor=>interceptor);let interceptorOptions=Object.assign({},options,{method_definition:methodDefinition});return interceptors.reduceRight((nextCall,nextInterceptor)=>currentOptions=>nextInterceptor(currentOptions,nextCall),finalOptions=>getBottomInterceptingCall(channel,finalOptions,methodDefinition))(interceptorOptions)}__name(getInterceptingCall,"getInterceptingCall");exports2.getInterceptingCall=getInterceptingCall}});var require_client=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/client.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Client=void 0;var call_1=require_call2(),channel_1=require_channel(),connectivity_state_1=require_connectivity_state(),constants_1=require_constants(),metadata_1=require_metadata(),client_interceptors_1=require_client_interceptors(),CHANNEL_SYMBOL=Symbol(),INTERCEPTOR_SYMBOL=Symbol(),INTERCEPTOR_PROVIDER_SYMBOL=Symbol(),CALL_INVOCATION_TRANSFORMER_SYMBOL=Symbol();function isFunction(arg){return typeof arg=="function"}__name(isFunction,"isFunction");function getErrorStackString(error){var _a;return((_a=error.stack)===null||_a===void 0?void 0:_a.split(` `).slice(1).join(` `))||"no stack trace available"}__name(getErrorStackString,"getErrorStackString");var Client=class{constructor(address,credentials,options={}){var _a,_b;if(options=Object.assign({},options),this[INTERCEPTOR_SYMBOL]=(_a=options.interceptors)!==null&&_a!==void 0?_a:[],delete options.interceptors,this[INTERCEPTOR_PROVIDER_SYMBOL]=(_b=options.interceptor_providers)!==null&&_b!==void 0?_b:[],delete options.interceptor_providers,this[INTERCEPTOR_SYMBOL].length>0&&this[INTERCEPTOR_PROVIDER_SYMBOL].length>0)throw new Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[CALL_INVOCATION_TRANSFORMER_SYMBOL]=options.callInvocationTransformer,delete options.callInvocationTransformer,options.channelOverride)this[CHANNEL_SYMBOL]=options.channelOverride;else if(options.channelFactoryOverride){let channelFactoryOverride=options.channelFactoryOverride;delete options.channelFactoryOverride,this[CHANNEL_SYMBOL]=channelFactoryOverride(address,credentials,options)}else this[CHANNEL_SYMBOL]=new channel_1.ChannelImplementation(address,credentials,options)}close(){this[CHANNEL_SYMBOL].close()}getChannel(){return this[CHANNEL_SYMBOL]}waitForReady(deadline,callback){let checkState=__name(err=>{if(err){callback(new Error("Failed to connect before the deadline"));return}let newState;try{newState=this[CHANNEL_SYMBOL].getConnectivityState(!0)}catch{callback(new Error("The channel has been closed"));return}if(newState===connectivity_state_1.ConnectivityState.READY)callback();else try{this[CHANNEL_SYMBOL].watchConnectivityState(newState,deadline,checkState)}catch{callback(new Error("The channel has been closed"))}},"checkState");setImmediate(checkState)}checkOptionalUnaryResponseArguments(arg1,arg2,arg3){if(isFunction(arg1))return{metadata:new metadata_1.Metadata,options:{},callback:arg1};if(isFunction(arg2))return arg1 instanceof metadata_1.Metadata?{metadata:arg1,options:{},callback:arg2}:{metadata:new metadata_1.Metadata,options:arg1,callback:arg2};if(!(arg1 instanceof metadata_1.Metadata&&arg2 instanceof Object&&isFunction(arg3)))throw new Error("Incorrect arguments passed");return{metadata:arg1,options:arg2,callback:arg3}}makeUnaryRequest(method,serialize,deserialize,argument,metadata,options,callback){var _a,_b;let checkedArguments=this.checkOptionalUnaryResponseArguments(metadata,options,callback),methodDefinition={path:method,requestStream:!1,responseStream:!1,requestSerialize:serialize,responseDeserialize:deserialize},callProperties={argument,metadata:checkedArguments.metadata,call:new call_1.ClientUnaryCallImpl,channel:this[CHANNEL_SYMBOL],methodDefinition,callOptions:checkedArguments.options,callback:checkedArguments.callback};this[CALL_INVOCATION_TRANSFORMER_SYMBOL]&&(callProperties=this[CALL_INVOCATION_TRANSFORMER_SYMBOL](callProperties));let emitter=callProperties.call,interceptorArgs={clientInterceptors:this[INTERCEPTOR_SYMBOL],clientInterceptorProviders:this[INTERCEPTOR_PROVIDER_SYMBOL],callInterceptors:(_a=callProperties.callOptions.interceptors)!==null&&_a!==void 0?_a:[],callInterceptorProviders:(_b=callProperties.callOptions.interceptor_providers)!==null&&_b!==void 0?_b:[]},call=(0,client_interceptors_1.getInterceptingCall)(interceptorArgs,callProperties.methodDefinition,callProperties.callOptions,callProperties.channel);emitter.call=call;let responseMessage=null,receivedStatus=!1,callerStackError=new Error;return call.start(callProperties.metadata,{onReceiveMetadata:metadata2=>{emitter.emit("metadata",metadata2)},onReceiveMessage(message){responseMessage!==null&&call.cancelWithStatus(constants_1.Status.INTERNAL,"Too many responses received"),responseMessage=message},onReceiveStatus(status){if(!receivedStatus){if(receivedStatus=!0,status.code===constants_1.Status.OK)if(responseMessage===null){let callerStack=getErrorStackString(callerStackError);callProperties.callback((0,call_1.callErrorFromStatus)({code:constants_1.Status.INTERNAL,details:"No message received",metadata:status.metadata},callerStack))}else callProperties.callback(null,responseMessage);else{let callerStack=getErrorStackString(callerStackError);callProperties.callback((0,call_1.callErrorFromStatus)(status,callerStack))}callerStackError=null,emitter.emit("status",status)}}}),call.sendMessage(argument),call.halfClose(),emitter}makeClientStreamRequest(method,serialize,deserialize,metadata,options,callback){var _a,_b;let checkedArguments=this.checkOptionalUnaryResponseArguments(metadata,options,callback),methodDefinition={path:method,requestStream:!0,responseStream:!1,requestSerialize:serialize,responseDeserialize:deserialize},callProperties={metadata:checkedArguments.metadata,call:new call_1.ClientWritableStreamImpl(serialize),channel:this[CHANNEL_SYMBOL],methodDefinition,callOptions:checkedArguments.options,callback:checkedArguments.callback};this[CALL_INVOCATION_TRANSFORMER_SYMBOL]&&(callProperties=this[CALL_INVOCATION_TRANSFORMER_SYMBOL](callProperties));let emitter=callProperties.call,interceptorArgs={clientInterceptors:this[INTERCEPTOR_SYMBOL],clientInterceptorProviders:this[INTERCEPTOR_PROVIDER_SYMBOL],callInterceptors:(_a=callProperties.callOptions.interceptors)!==null&&_a!==void 0?_a:[],callInterceptorProviders:(_b=callProperties.callOptions.interceptor_providers)!==null&&_b!==void 0?_b:[]},call=(0,client_interceptors_1.getInterceptingCall)(interceptorArgs,callProperties.methodDefinition,callProperties.callOptions,callProperties.channel);emitter.call=call;let responseMessage=null,receivedStatus=!1,callerStackError=new Error;return call.start(callProperties.metadata,{onReceiveMetadata:metadata2=>{emitter.emit("metadata",metadata2)},onReceiveMessage(message){responseMessage!==null&&call.cancelWithStatus(constants_1.Status.INTERNAL,"Too many responses received"),responseMessage=message},onReceiveStatus(status){if(!receivedStatus){if(receivedStatus=!0,status.code===constants_1.Status.OK)if(responseMessage===null){let callerStack=getErrorStackString(callerStackError);callProperties.callback((0,call_1.callErrorFromStatus)({code:constants_1.Status.INTERNAL,details:"No message received",metadata:status.metadata},callerStack))}else callProperties.callback(null,responseMessage);else{let callerStack=getErrorStackString(callerStackError);callProperties.callback((0,call_1.callErrorFromStatus)(status,callerStack))}callerStackError=null,emitter.emit("status",status)}}}),emitter}checkMetadataAndOptions(arg1,arg2){let metadata,options;return arg1 instanceof metadata_1.Metadata?(metadata=arg1,arg2?options=arg2:options={}):(arg1?options=arg1:options={},metadata=new metadata_1.Metadata),{metadata,options}}makeServerStreamRequest(method,serialize,deserialize,argument,metadata,options){var _a,_b;let checkedArguments=this.checkMetadataAndOptions(metadata,options),methodDefinition={path:method,requestStream:!1,responseStream:!0,requestSerialize:serialize,responseDeserialize:deserialize},callProperties={argument,metadata:checkedArguments.metadata,call:new call_1.ClientReadableStreamImpl(deserialize),channel:this[CHANNEL_SYMBOL],methodDefinition,callOptions:checkedArguments.options};this[CALL_INVOCATION_TRANSFORMER_SYMBOL]&&(callProperties=this[CALL_INVOCATION_TRANSFORMER_SYMBOL](callProperties));let stream=callProperties.call,interceptorArgs={clientInterceptors:this[INTERCEPTOR_SYMBOL],clientInterceptorProviders:this[INTERCEPTOR_PROVIDER_SYMBOL],callInterceptors:(_a=callProperties.callOptions.interceptors)!==null&&_a!==void 0?_a:[],callInterceptorProviders:(_b=callProperties.callOptions.interceptor_providers)!==null&&_b!==void 0?_b:[]},call=(0,client_interceptors_1.getInterceptingCall)(interceptorArgs,callProperties.methodDefinition,callProperties.callOptions,callProperties.channel);stream.call=call;let receivedStatus=!1,callerStackError=new Error;return call.start(callProperties.metadata,{onReceiveMetadata(metadata2){stream.emit("metadata",metadata2)},onReceiveMessage(message){stream.push(message)},onReceiveStatus(status){if(!receivedStatus){if(receivedStatus=!0,stream.push(null),status.code!==constants_1.Status.OK){let callerStack=getErrorStackString(callerStackError);stream.emit("error",(0,call_1.callErrorFromStatus)(status,callerStack))}callerStackError=null,stream.emit("status",status)}}}),call.sendMessage(argument),call.halfClose(),stream}makeBidiStreamRequest(method,serialize,deserialize,metadata,options){var _a,_b;let checkedArguments=this.checkMetadataAndOptions(metadata,options),methodDefinition={path:method,requestStream:!0,responseStream:!0,requestSerialize:serialize,responseDeserialize:deserialize},callProperties={metadata:checkedArguments.metadata,call:new call_1.ClientDuplexStreamImpl(serialize,deserialize),channel:this[CHANNEL_SYMBOL],methodDefinition,callOptions:checkedArguments.options};this[CALL_INVOCATION_TRANSFORMER_SYMBOL]&&(callProperties=this[CALL_INVOCATION_TRANSFORMER_SYMBOL](callProperties));let stream=callProperties.call,interceptorArgs={clientInterceptors:this[INTERCEPTOR_SYMBOL],clientInterceptorProviders:this[INTERCEPTOR_PROVIDER_SYMBOL],callInterceptors:(_a=callProperties.callOptions.interceptors)!==null&&_a!==void 0?_a:[],callInterceptorProviders:(_b=callProperties.callOptions.interceptor_providers)!==null&&_b!==void 0?_b:[]},call=(0,client_interceptors_1.getInterceptingCall)(interceptorArgs,callProperties.methodDefinition,callProperties.callOptions,callProperties.channel);stream.call=call;let receivedStatus=!1,callerStackError=new Error;return call.start(callProperties.metadata,{onReceiveMetadata(metadata2){stream.emit("metadata",metadata2)},onReceiveMessage(message){stream.push(message)},onReceiveStatus(status){if(!receivedStatus){if(receivedStatus=!0,stream.push(null),status.code!==constants_1.Status.OK){let callerStack=getErrorStackString(callerStackError);stream.emit("error",(0,call_1.callErrorFromStatus)(status,callerStack))}callerStackError=null,stream.emit("status",status)}}}),stream}};__name(Client,"Client");exports2.Client=Client}});var require_make_client=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/make-client.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.loadPackageDefinition=exports2.makeClientConstructor=void 0;var client_1=require_client(),requesterFuncs={unary:client_1.Client.prototype.makeUnaryRequest,server_stream:client_1.Client.prototype.makeServerStreamRequest,client_stream:client_1.Client.prototype.makeClientStreamRequest,bidi:client_1.Client.prototype.makeBidiStreamRequest};function isPrototypePolluted(key){return["__proto__","prototype","constructor"].includes(key)}__name(isPrototypePolluted,"isPrototypePolluted");function makeClientConstructor(methods,serviceName,classOptions){classOptions||(classOptions={});class ServiceClientImpl extends client_1.Client{}return __name(ServiceClientImpl,"ServiceClientImpl"),Object.keys(methods).forEach(name=>{if(isPrototypePolluted(name))return;let attrs=methods[name],methodType;if(typeof name=="string"&&name.charAt(0)==="$")throw new Error("Method names cannot start with $");attrs.requestStream?attrs.responseStream?methodType="bidi":methodType="client_stream":attrs.responseStream?methodType="server_stream":methodType="unary";let serialize=attrs.requestSerialize,deserialize=attrs.responseDeserialize,methodFunc=partial(requesterFuncs[methodType],attrs.path,serialize,deserialize);ServiceClientImpl.prototype[name]=methodFunc,Object.assign(ServiceClientImpl.prototype[name],attrs),attrs.originalName&&!isPrototypePolluted(attrs.originalName)&&(ServiceClientImpl.prototype[attrs.originalName]=ServiceClientImpl.prototype[name])}),ServiceClientImpl.service=methods,ServiceClientImpl.serviceName=serviceName,ServiceClientImpl}__name(makeClientConstructor,"makeClientConstructor");exports2.makeClientConstructor=makeClientConstructor;function partial(fn,path,serialize,deserialize){return function(...args){return fn.call(this,path,serialize,deserialize,...args)}}__name(partial,"partial");function isProtobufTypeDefinition(obj){return"format"in obj}__name(isProtobufTypeDefinition,"isProtobufTypeDefinition");function loadPackageDefinition(packageDef){let result={};for(let serviceFqn in packageDef)if(Object.prototype.hasOwnProperty.call(packageDef,serviceFqn)){let service=packageDef[serviceFqn],nameComponents=serviceFqn.split(".");if(nameComponents.some(comp=>isPrototypePolluted(comp)))continue;let serviceName=nameComponents[nameComponents.length-1],current=result;for(let packageName of nameComponents.slice(0,-1))current[packageName]||(current[packageName]={}),current=current[packageName];isProtobufTypeDefinition(service)?current[serviceName]=service:current[serviceName]=makeClientConstructor(service,serviceName,{})}return result}__name(loadPackageDefinition,"loadPackageDefinition");exports2.loadPackageDefinition=loadPackageDefinition}});var require_lodash=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/lodash.camelcase/index.js"(exports2,module2){var INFINITY=1/0,symbolTag="[object Symbol]",reAsciiWord=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,reLatin=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f\\ufe20-\\ufe23",rsComboSymbolsRange="\\u20d0-\\u20f0",rsDingbatRange="\\u2700-\\u27bf",rsLowerRange="a-z\\xdf-\\xf6\\xf8-\\xff",rsMathOpRange="\\xac\\xb1\\xd7\\xf7",rsNonCharRange="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",rsPunctuationRange="\\u2000-\\u206f",rsSpaceRange=" \\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",rsUpperRange="A-Z\\xc0-\\xd6\\xd8-\\xde",rsVarRange="\\ufe0e\\ufe0f",rsBreakRange=rsMathOpRange+rsNonCharRange+rsPunctuationRange+rsSpaceRange,rsApos="['\u2019]",rsAstral="["+rsAstralRange+"]",rsBreak="["+rsBreakRange+"]",rsCombo="["+rsComboMarksRange+rsComboSymbolsRange+"]",rsDigits="\\d+",rsDingbat="["+rsDingbatRange+"]",rsLower="["+rsLowerRange+"]",rsMisc="[^"+rsAstralRange+rsBreakRange+rsDigits+rsDingbatRange+rsLowerRange+rsUpperRange+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral="[^"+rsAstralRange+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsUpper="["+rsUpperRange+"]",rsZWJ="\\u200d",rsLowerMisc="(?:"+rsLower+"|"+rsMisc+")",rsUpperMisc="(?:"+rsUpper+"|"+rsMisc+")",rsOptLowerContr="(?:"+rsApos+"(?:d|ll|m|re|s|t|ve))?",rsOptUpperContr="(?:"+rsApos+"(?:D|LL|M|RE|S|T|VE))?",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange+"]?",rsOptJoin="(?:"+rsZWJ+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+")*",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsEmoji="(?:"+[rsDingbat,rsRegional,rsSurrPair].join("|")+")"+rsSeq,rsSymbol="(?:"+[rsNonAstral+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,rsAstral].join("|")+")",reApos=RegExp(rsApos,"g"),reComboMark=RegExp(rsCombo,"g"),reUnicode=RegExp(rsFitz+"(?="+rsFitz+")|"+rsSymbol+rsSeq,"g"),reUnicodeWord=RegExp([rsUpper+"?"+rsLower+"+"+rsOptLowerContr+"(?="+[rsBreak,rsUpper,"$"].join("|")+")",rsUpperMisc+"+"+rsOptUpperContr+"(?="+[rsBreak,rsUpper+rsLowerMisc,"$"].join("|")+")",rsUpper+"?"+rsLowerMisc+"+"+rsOptLowerContr,rsUpper+"+"+rsOptUpperContr,rsDigits,rsEmoji].join("|"),"g"),reHasUnicode=RegExp("["+rsZWJ+rsAstralRange+rsComboMarksRange+rsComboSymbolsRange+rsVarRange+"]"),reHasUnicodeWord=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,deburredLetters={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")();function arrayReduce(array,iteratee,accumulator,initAccum){var index=-1,length=array?array.length:0;for(initAccum&&length&&(accumulator=array[++index]);++indexlength?0:length+start),end=end>length?length:end,end<0&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);++index=length?array:baseSlice(array,start,end)}__name(castSlice,"castSlice");function createCaseFirst(methodName){return function(string){string=toString(string);var strSymbols=hasUnicode(string)?stringToArray(string):void 0,chr=strSymbols?strSymbols[0]:string.charAt(0),trailing=strSymbols?castSlice(strSymbols,1).join(""):string.slice(1);return chr[methodName]()+trailing}}__name(createCaseFirst,"createCaseFirst");function createCompounder(callback){return function(string){return arrayReduce(words(deburr(string).replace(reApos,"")),callback,"")}}__name(createCompounder,"createCompounder");function isObjectLike(value){return!!value&&typeof value=="object"}__name(isObjectLike,"isObjectLike");function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&objectToString.call(value)==symbolTag}__name(isSymbol,"isSymbol");function toString(value){return value==null?"":baseToString(value)}__name(toString,"toString");var camelCase=createCompounder(function(result,word,index){return word=word.toLowerCase(),result+(index?capitalize(word):word)});function capitalize(string){return upperFirst(toString(string).toLowerCase())}__name(capitalize,"capitalize");function deburr(string){return string=toString(string),string&&string.replace(reLatin,deburrLetter).replace(reComboMark,"")}__name(deburr,"deburr");var upperFirst=createCaseFirst("toUpperCase");function words(string,pattern,guard){return string=toString(string),pattern=guard?void 0:pattern,pattern===void 0?hasUnicodeWord(string)?unicodeWords(string):asciiWords(string):string.match(pattern)||[]}__name(words,"words");module2.exports=camelCase}});var require_longbits2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/util/longbits.js"(exports2,module2){"use strict";module2.exports=LongBits;var util=require_minimal3();function LongBits(lo,hi){this.lo=lo>>>0,this.hi=hi>>>0}__name(LongBits,"LongBits");var zero=LongBits.zero=new LongBits(0,0);zero.toNumber=function(){return 0};zero.zzEncode=zero.zzDecode=function(){return this};zero.length=function(){return 1};var zeroHash=LongBits.zeroHash="\0\0\0\0\0\0\0\0";LongBits.fromNumber=__name(function(value){if(value===0)return zero;var sign=value<0;sign&&(value=-value);var lo=value>>>0,hi=(value-lo)/4294967296>>>0;return sign&&(hi=~hi>>>0,lo=~lo>>>0,++lo>4294967295&&(lo=0,++hi>4294967295&&(hi=0))),new LongBits(lo,hi)},"fromNumber");LongBits.from=__name(function(value){if(typeof value=="number")return LongBits.fromNumber(value);if(util.isString(value))if(util.Long)value=util.Long.fromString(value);else return LongBits.fromNumber(parseInt(value,10));return value.low||value.high?new LongBits(value.low>>>0,value.high>>>0):zero},"from");LongBits.prototype.toNumber=__name(function(unsigned){if(!unsigned&&this.hi>>>31){var lo=~this.lo+1>>>0,hi=~this.hi>>>0;return lo||(hi=hi+1>>>0),-(lo+hi*4294967296)}return this.lo+this.hi*4294967296},"toNumber");LongBits.prototype.toLong=__name(function(unsigned){return util.Long?new util.Long(this.lo|0,this.hi|0,!!unsigned):{low:this.lo|0,high:this.hi|0,unsigned:!!unsigned}},"toLong");var charCodeAt=String.prototype.charCodeAt;LongBits.fromHash=__name(function(hash){return hash===zeroHash?zero:new LongBits((charCodeAt.call(hash,0)|charCodeAt.call(hash,1)<<8|charCodeAt.call(hash,2)<<16|charCodeAt.call(hash,3)<<24)>>>0,(charCodeAt.call(hash,4)|charCodeAt.call(hash,5)<<8|charCodeAt.call(hash,6)<<16|charCodeAt.call(hash,7)<<24)>>>0)},"fromHash");LongBits.prototype.toHash=__name(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)},"toHash");LongBits.prototype.zzEncode=__name(function(){var mask=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^mask)>>>0,this.lo=(this.lo<<1^mask)>>>0,this},"zzEncode");LongBits.prototype.zzDecode=__name(function(){var mask=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^mask)>>>0,this.hi=(this.hi>>>1^mask)>>>0,this},"zzDecode");LongBits.prototype.length=__name(function(){var part0=this.lo,part1=(this.lo>>>28|this.hi<<4)>>>0,part2=this.hi>>>24;return part2===0?part1===0?part0<16384?part0<128?1:2:part0<2097152?3:4:part1<16384?part1<128?5:6:part1<2097152?7:8:part2<128?9:10},"length")}});var require_minimal3=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/util/minimal.js"(exports2){"use strict";var util=exports2;util.asPromise=require_aspromise();util.base64=require_base64();util.EventEmitter=require_eventemitter();util.float=require_float();util.inquire=require_inquire();util.utf8=require_utf8();util.pool=require_pool();util.LongBits=require_longbits2();util.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);util.global=util.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||exports2;util.emptyArray=Object.freeze?Object.freeze([]):[];util.emptyObject=Object.freeze?Object.freeze({}):{};util.isInteger=Number.isInteger||__name(function(value){return typeof value=="number"&&isFinite(value)&&Math.floor(value)===value},"isInteger");util.isString=__name(function(value){return typeof value=="string"||value instanceof String},"isString");util.isObject=__name(function(value){return value&&typeof value=="object"},"isObject");util.isset=util.isSet=__name(function(obj,prop){var value=obj[prop];return value!=null&&obj.hasOwnProperty(prop)?typeof value!="object"||(Array.isArray(value)?value.length:Object.keys(value).length)>0:!1},"isSet");util.Buffer=function(){try{var Buffer2=util.inquire("buffer").Buffer;return Buffer2.prototype.utf8Write?Buffer2:null}catch{return null}}();util._Buffer_from=null;util._Buffer_allocUnsafe=null;util.newBuffer=__name(function(sizeOrArray){return typeof sizeOrArray=="number"?util.Buffer?util._Buffer_allocUnsafe(sizeOrArray):new util.Array(sizeOrArray):util.Buffer?util._Buffer_from(sizeOrArray):typeof Uint8Array>"u"?sizeOrArray:new Uint8Array(sizeOrArray)},"newBuffer");util.Array=typeof Uint8Array<"u"?Uint8Array:Array;util.Long=util.global.dcodeIO&&util.global.dcodeIO.Long||util.global.Long||util.inquire("long");util.key2Re=/^true|false|0|1$/;util.key32Re=/^-?(?:0|[1-9][0-9]*)$/;util.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;util.longToHash=__name(function(value){return value?util.LongBits.from(value).toHash():util.LongBits.zeroHash},"longToHash");util.longFromHash=__name(function(hash,unsigned){var bits=util.LongBits.fromHash(hash);return util.Long?util.Long.fromBits(bits.lo,bits.hi,unsigned):bits.toNumber(!!unsigned)},"longFromHash");function merge(dst,src,ifNotSet){for(var keys=Object.keys(src),i=0;i-1;--i2)if(fieldMap[keys[i2]]===1&&this[keys[i2]]!==void 0&&this[keys[i2]]!==null)return keys[i2]}},"getOneOf");util.oneOfSetter=__name(function(fieldNames){return function(name){for(var i=0;i127;)buf[pos++]=val&127|128,val>>>=7;buf[pos]=val}__name(writeVarint32,"writeVarint32");function VarintOp(len,val){this.len=len,this.next=void 0,this.val=val}__name(VarintOp,"VarintOp");VarintOp.prototype=Object.create(Op.prototype);VarintOp.prototype.fn=writeVarint32;Writer.prototype.uint32=__name(function(value){return this.len+=(this.tail=this.tail.next=new VarintOp((value=value>>>0)<128?1:value<16384?2:value<2097152?3:value<268435456?4:5,value)).len,this},"write_uint32");Writer.prototype.int32=__name(function(value){return value<0?this._push(writeVarint64,10,LongBits.fromNumber(value)):this.uint32(value)},"write_int32");Writer.prototype.sint32=__name(function(value){return this.uint32((value<<1^value>>31)>>>0)},"write_sint32");function writeVarint64(val,buf,pos){for(;val.hi;)buf[pos++]=val.lo&127|128,val.lo=(val.lo>>>7|val.hi<<25)>>>0,val.hi>>>=7;for(;val.lo>127;)buf[pos++]=val.lo&127|128,val.lo=val.lo>>>7;buf[pos++]=val.lo}__name(writeVarint64,"writeVarint64");Writer.prototype.uint64=__name(function(value){var bits=LongBits.from(value);return this._push(writeVarint64,bits.length(),bits)},"write_uint64");Writer.prototype.int64=Writer.prototype.uint64;Writer.prototype.sint64=__name(function(value){var bits=LongBits.from(value).zzEncode();return this._push(writeVarint64,bits.length(),bits)},"write_sint64");Writer.prototype.bool=__name(function(value){return this._push(writeByte,1,value?1:0)},"write_bool");function writeFixed32(val,buf,pos){buf[pos]=val&255,buf[pos+1]=val>>>8&255,buf[pos+2]=val>>>16&255,buf[pos+3]=val>>>24}__name(writeFixed32,"writeFixed32");Writer.prototype.fixed32=__name(function(value){return this._push(writeFixed32,4,value>>>0)},"write_fixed32");Writer.prototype.sfixed32=Writer.prototype.fixed32;Writer.prototype.fixed64=__name(function(value){var bits=LongBits.from(value);return this._push(writeFixed32,4,bits.lo)._push(writeFixed32,4,bits.hi)},"write_fixed64");Writer.prototype.sfixed64=Writer.prototype.fixed64;Writer.prototype.float=__name(function(value){return this._push(util.float.writeFloatLE,4,value)},"write_float");Writer.prototype.double=__name(function(value){return this._push(util.float.writeDoubleLE,8,value)},"write_double");var writeBytes=util.Array.prototype.set?__name(function(val,buf,pos){buf.set(val,pos)},"writeBytes_set"):__name(function(val,buf,pos){for(var i=0;i>>0;if(!len)return this._push(writeByte,1,0);if(util.isString(value)){var buf=Writer.alloc(len=base64.length(value));base64.decode(value,buf,0),value=buf}return this.uint32(len)._push(writeBytes,len,value)},"write_bytes");Writer.prototype.string=__name(function(value){var len=utf8.length(value);return len?this.uint32(len)._push(utf8.write,len,value):this._push(writeByte,1,0)},"write_string");Writer.prototype.fork=__name(function(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},"fork");Writer.prototype.reset=__name(function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},"reset");Writer.prototype.ldelim=__name(function(){var head=this.head,tail=this.tail,len=this.len;return this.reset().uint32(len),len&&(this.tail.next=head.next,this.tail=tail,this.len+=len),this},"ldelim");Writer.prototype.finish=__name(function(){for(var head=this.head.next,buf=this.constructor.alloc(this.len),pos=0;head;)head.fn(head.val,buf,pos),pos+=head.len,head=head.next;return buf},"finish");Writer._configure=function(BufferWriter_){BufferWriter=BufferWriter_,Writer.create=create(),BufferWriter._configure()}}});var require_writer_buffer2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/writer_buffer.js"(exports2,module2){"use strict";module2.exports=BufferWriter;var Writer=require_writer2();(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util=require_minimal3();function BufferWriter(){Writer.call(this)}__name(BufferWriter,"BufferWriter");BufferWriter._configure=function(){BufferWriter.alloc=util._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util.Buffer&&util.Buffer.prototype instanceof Uint8Array&&util.Buffer.prototype.set.name==="set"?__name(function(val,buf,pos){buf.set(val,pos)},"writeBytesBuffer_set"):__name(function(val,buf,pos){if(val.copy)val.copy(buf,pos,0,val.length);else for(var i=0;i>>0;return this.uint32(len),len&&this._push(BufferWriter.writeBytesBuffer,len,value),this},"write_bytes_buffer");function writeStringBuffer(val,buf,pos){val.length<40?util.utf8.write(val,buf,pos):buf.utf8Write?buf.utf8Write(val,pos):buf.write(val,pos)}__name(writeStringBuffer,"writeStringBuffer");BufferWriter.prototype.string=__name(function(value){var len=util.Buffer.byteLength(value);return this.uint32(len),len&&this._push(writeStringBuffer,len,value),this},"write_string_buffer");BufferWriter._configure()}});var require_reader2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/reader.js"(exports2,module2){"use strict";module2.exports=Reader;var util=require_minimal3(),BufferReader,LongBits=util.LongBits,utf8=util.utf8;function indexOutOfRange(reader,writeLength){return RangeError("index out of range: "+reader.pos+" + "+(writeLength||1)+" > "+reader.len)}__name(indexOutOfRange,"indexOutOfRange");function Reader(buffer){this.buf=buffer,this.pos=0,this.len=buffer.length}__name(Reader,"Reader");var create_array=typeof Uint8Array<"u"?__name(function(buffer){if(buffer instanceof Uint8Array||Array.isArray(buffer))return new Reader(buffer);throw Error("illegal buffer")},"create_typed_array"):__name(function(buffer){if(Array.isArray(buffer))return new Reader(buffer);throw Error("illegal buffer")},"create_array"),create=__name(function(){return util.Buffer?__name(function(buffer){return(Reader.create=__name(function(buffer2){return util.Buffer.isBuffer(buffer2)?new BufferReader(buffer2):create_array(buffer2)},"create_buffer"))(buffer)},"create_buffer_setup"):create_array},"create");Reader.create=create();Reader.prototype._slice=util.Array.prototype.subarray||util.Array.prototype.slice;Reader.prototype.uint32=__name(function(){var value=4294967295;return __name(function(){if(value=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(value=(value|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(value=(value|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(value=(value|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(value=(value|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return value;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return value},"read_uint32")},"read_uint32_setup")();Reader.prototype.int32=__name(function(){return this.uint32()|0},"read_int32");Reader.prototype.sint32=__name(function(){var value=this.uint32();return value>>>1^-(value&1)|0},"read_sint32");function readLongVarint(){var bits=new LongBits(0,0),i=0;if(this.len-this.pos>4){for(;i<4;++i)if(bits.lo=(bits.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return bits;if(bits.lo=(bits.lo|(this.buf[this.pos]&127)<<28)>>>0,bits.hi=(bits.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return bits;i=0}else{for(;i<3;++i){if(this.pos>=this.len)throw indexOutOfRange(this);if(bits.lo=(bits.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return bits}return bits.lo=(bits.lo|(this.buf[this.pos++]&127)<>>0,bits}if(this.len-this.pos>4){for(;i<5;++i)if(bits.hi=(bits.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return bits}else for(;i<5;++i){if(this.pos>=this.len)throw indexOutOfRange(this);if(bits.hi=(bits.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return bits}throw Error("invalid varint encoding")}__name(readLongVarint,"readLongVarint");Reader.prototype.bool=__name(function(){return this.uint32()!==0},"read_bool");function readFixed32_end(buf,end){return(buf[end-4]|buf[end-3]<<8|buf[end-2]<<16|buf[end-1]<<24)>>>0}__name(readFixed32_end,"readFixed32_end");Reader.prototype.fixed32=__name(function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},"read_fixed32");Reader.prototype.sfixed32=__name(function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0},"read_sfixed32");function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}__name(readFixed64,"readFixed64");Reader.prototype.float=__name(function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var value=util.float.readFloatLE(this.buf,this.pos);return this.pos+=4,value},"read_float");Reader.prototype.double=__name(function(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var value=util.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,value},"read_double");Reader.prototype.bytes=__name(function(){var length=this.uint32(),start=this.pos,end=this.pos+length;if(end>this.len)throw indexOutOfRange(this,length);if(this.pos+=length,Array.isArray(this.buf))return this.buf.slice(start,end);if(start===end){var nativeBuffer=util.Buffer;return nativeBuffer?nativeBuffer.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,start,end)},"read_bytes");Reader.prototype.string=__name(function(){var bytes=this.bytes();return utf8.read(bytes,0,bytes.length)},"read_string");Reader.prototype.skip=__name(function(length){if(typeof length=="number"){if(this.pos+length>this.len)throw indexOutOfRange(this,length);this.pos+=length}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this},"skip");Reader.prototype.skipType=function(wireType){switch(wireType){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(wireType=this.uint32()&7)!==4;)this.skipType(wireType);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+wireType+" at offset "+this.pos)}return this};Reader._configure=function(BufferReader_){BufferReader=BufferReader_,Reader.create=create(),BufferReader._configure();var fn=util.Long?"toLong":"toNumber";util.merge(Reader.prototype,{int64:__name(function(){return readLongVarint.call(this)[fn](!1)},"read_int64"),uint64:__name(function(){return readLongVarint.call(this)[fn](!0)},"read_uint64"),sint64:__name(function(){return readLongVarint.call(this).zzDecode()[fn](!1)},"read_sint64"),fixed64:__name(function(){return readFixed64.call(this)[fn](!0)},"read_fixed64"),sfixed64:__name(function(){return readFixed64.call(this)[fn](!1)},"read_sfixed64")})}}});var require_reader_buffer2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/reader_buffer.js"(exports2,module2){"use strict";module2.exports=BufferReader;var Reader=require_reader2();(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util=require_minimal3();function BufferReader(buffer){Reader.call(this,buffer)}__name(BufferReader,"BufferReader");BufferReader._configure=function(){util.Buffer&&(BufferReader.prototype._slice=util.Buffer.prototype.slice)};BufferReader.prototype.string=__name(function(){var len=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+len,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+len,this.len))},"read_string_buffer");BufferReader._configure()}});var require_service3=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/rpc/service.js"(exports2,module2){"use strict";module2.exports=Service;var util=require_minimal3();(Service.prototype=Object.create(util.EventEmitter.prototype)).constructor=Service;function Service(rpcImpl,requestDelimited,responseDelimited){if(typeof rpcImpl!="function")throw TypeError("rpcImpl must be a function");util.EventEmitter.call(this),this.rpcImpl=rpcImpl,this.requestDelimited=!!requestDelimited,this.responseDelimited=!!responseDelimited}__name(Service,"Service");Service.prototype.rpcCall=__name(function rpcCall(method,requestCtor,responseCtor,request,callback){if(!request)throw TypeError("request must be specified");var self2=this;if(!callback)return util.asPromise(rpcCall,self2,method,requestCtor,responseCtor,request);if(!self2.rpcImpl){setTimeout(function(){callback(Error("already ended"))},0);return}try{return self2.rpcImpl(method,requestCtor[self2.requestDelimited?"encodeDelimited":"encode"](request).finish(),__name(function(err,response){if(err)return self2.emit("error",err,method),callback(err);if(response===null){self2.end(!0);return}if(!(response instanceof responseCtor))try{response=responseCtor[self2.responseDelimited?"decodeDelimited":"decode"](response)}catch(err2){return self2.emit("error",err2,method),callback(err2)}return self2.emit("data",response,method),callback(null,response)},"rpcCallback"))}catch(err){self2.emit("error",err,method),setTimeout(function(){callback(err)},0);return}},"rpcCall");Service.prototype.end=__name(function(endedByRPC){return this.rpcImpl&&(endedByRPC||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},"end")}});var require_rpc2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/rpc.js"(exports2){"use strict";var rpc=exports2;rpc.Service=require_service3()}});var require_roots2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/roots.js"(exports2,module2){"use strict";module2.exports={}}});var require_index_minimal2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/index-minimal.js"(exports2){"use strict";var protobuf=exports2;protobuf.build="minimal";protobuf.Writer=require_writer2();protobuf.BufferWriter=require_writer_buffer2();protobuf.Reader=require_reader2();protobuf.BufferReader=require_reader_buffer2();protobuf.util=require_minimal3();protobuf.rpc=require_rpc2();protobuf.roots=require_roots2();protobuf.configure=configure;function configure(){protobuf.util._configure(),protobuf.Writer._configure(protobuf.BufferWriter),protobuf.Reader._configure(protobuf.BufferReader)}__name(configure,"configure");configure()}});var require_types3=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/types.js"(exports2){"use strict";var types=exports2,util=require_util7(),s=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function bake(values,offset){var i=0,o={};for(offset|=0;i-1&&this.oneof.splice(index,1),field.partOf=null,this},"remove");OneOf.prototype.onAdd=__name(function(parent){ReflectionObject.prototype.onAdd.call(this,parent);for(var self2=this,i=0;iid)return!0}return!1},"isReservedId");Namespace.isReservedName=__name(function(reserved,name){if(reserved){for(var i=0;i0;){var part=path.shift();if(ptr.nested&&ptr.nested[part]){if(ptr=ptr.nested[part],!(ptr instanceof Namespace))throw Error("path conflicts with non-namespace objects")}else ptr.add(ptr=new Namespace(part))}return json&&ptr.addJSON(json),ptr},"define");Namespace.prototype.resolveAll=__name(function(){for(var nested=this.nestedArray,i=0;i-1)return found}else if(found instanceof Namespace&&(found=found.lookup(path.slice(1),filterTypes,!0)))return found}else for(var i=0;i>>3){");for(var i=0;i>>3){")("case 1: k=r.%s(); break",field.keyType)("case 2:"),types.basic[type]===void 0?gen("value=types[%i].decode(r,r.uint32())",i):gen("value=r.%s()",type),gen("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),types.long[field.keyType]!==void 0?gen('%s[typeof k==="object"?util.longToHash(k):k]=value',ref):gen("%s[k]=value",ref)):field.repeated?(gen("if(!(%s&&%s.length))",ref,ref)("%s=[]",ref),types.packed[type]!==void 0&&gen("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos>>0",prop,prop);break;case"int32":case"sint32":case"sfixed32":gen("m%s=d%s|0",prop,prop);break;case"uint64":isUnsigned=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":gen("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",prop,prop,isUnsigned)('else if(typeof d%s==="string")',prop)("m%s=parseInt(d%s,10)",prop,prop)('else if(typeof d%s==="number")',prop)("m%s=d%s",prop,prop)('else if(typeof d%s==="object")',prop)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",prop,prop,prop,isUnsigned?"true":"");break;case"bytes":gen('if(typeof d%s==="string")',prop)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",prop,prop,prop)("else if(d%s.length >= 0)",prop)("m%s=d%s",prop,prop);break;case"string":gen("m%s=String(d%s)",prop,prop);break;case"bool":gen("m%s=Boolean(d%s)",prop,prop);break}}return gen}__name(genValuePartial_fromObject,"genValuePartial_fromObject");converter.fromObject=__name(function(mtype){var fields=mtype.fieldsArray,gen=util.codegen(["d"],mtype.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!fields.length)return gen("return new this.ctor");gen("var m=new this.ctor");for(var i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s",prop,prop,prop,prop,isUnsigned?"true":"",prop);break;case"bytes":gen("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",prop,prop,prop,prop,prop);break;default:gen("d%s=m%s",prop,prop);break}}return gen}__name(genValuePartial_toObject,"genValuePartial_toObject");converter.toObject=__name(function(mtype){var fields=mtype.fieldsArray.slice().sort(util.compareFieldsById);if(!fields.length)return util.codegen()("return {}");for(var gen=util.codegen(["m","o"],mtype.name+"$toObject")("if(!o)")("o={}")("var d={}"),repeatedFields=[],mapFields=[],normalFields=[],i=0;i-1){var altname=filename2.substring(idx);if(altname in common)return altname}return null}__name(getBundledFileName,"getBundledFileName");function process2(filename2,source){try{if(util.isString(source)&&source.charAt(0)==="{"&&(source=JSON.parse(source)),!util.isString(source))self2.setOptions(source.options).addJSON(source.nested);else{parse2.filename=filename2;var parsed=parse2(source,self2,options),resolved2,i2=0;if(parsed.imports)for(;i2-1)){if(self2.files.push(filename2),filename2 in common){sync?process2(filename2,common[filename2]):(++queued,setTimeout(function(){--queued,process2(filename2,common[filename2])}));return}if(sync){var source;try{source=util.fs.readFileSync(filename2).toString("utf8")}catch(err){weak||finish(err);return}process2(filename2,source)}else++queued,self2.fetch(filename2,function(err,source2){if(--queued,!!callback){if(err){weak?queued||finish(null,self2):finish(err);return}process2(filename2,source2)}})}}__name(fetch,"fetch");var queued=0;util.isString(filename)&&(filename=[filename]);for(var i=0,resolved;i-1&&this.deferred.splice(index,1)}}else if(object instanceof Enum)exposeRe.test(object.name)&&delete object.parent[object.name];else if(object instanceof Namespace){for(var i=0;i0)dst2[part]=setProp(dst2[part]||{},path2,value2);else{var prevValue=dst2[part];prevValue&&(value2=[].concat(prevValue).concat(value2)),dst2[part]=value2}return dst2}if(__name(setProp,"setProp"),typeof dst!="object")throw TypeError("dst must be an object");if(!path)throw TypeError("path must be specified");return path=path.split("."),setProp(dst,path,value)},"setProperty");Object.defineProperty(util,"decorateRoot",{get:function(){return roots.decorated||(roots.decorated=new(require_root2()))}})}});var require_object2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/object.js"(exports2,module2){"use strict";module2.exports=ReflectionObject;ReflectionObject.className="ReflectionObject";var util=require_util7(),Root;function ReflectionObject(name,options){if(!util.isString(name))throw TypeError("name must be a string");if(options&&!util.isObject(options))throw TypeError("options must be an object");this.options=options,this.parsedOptions=null,this.name=name,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}__name(ReflectionObject,"ReflectionObject");Object.defineProperties(ReflectionObject.prototype,{root:{get:function(){for(var ptr=this;ptr.parent!==null;)ptr=ptr.parent;return ptr}},fullName:{get:function(){for(var path=[this.name],ptr=this.parent;ptr;)path.unshift(ptr.name),ptr=ptr.parent;return path.join(".")}}});ReflectionObject.prototype.toJSON=__name(function(){throw Error()},"toJSON");ReflectionObject.prototype.onAdd=__name(function(parent){this.parent&&this.parent!==parent&&this.parent.remove(this),this.parent=parent,this.resolved=!1;var root=parent.root;root instanceof Root&&root._handleAdd(this)},"onAdd");ReflectionObject.prototype.onRemove=__name(function(parent){var root=parent.root;root instanceof Root&&root._handleRemove(this),this.parent=null,this.resolved=!1},"onRemove");ReflectionObject.prototype.resolve=__name(function(){return this.resolved?this:(this.root instanceof Root&&(this.resolved=!0),this)},"resolve");ReflectionObject.prototype.getOption=__name(function(name){if(this.options)return this.options[name]},"getOption");ReflectionObject.prototype.setOption=__name(function(name,value,ifNotSet){return(!ifNotSet||!this.options||this.options[name]===void 0)&&((this.options||(this.options={}))[name]=value),this},"setOption");ReflectionObject.prototype.setParsedOption=__name(function(name,value,propName){this.parsedOptions||(this.parsedOptions=[]);var parsedOptions=this.parsedOptions;if(propName){var opt=parsedOptions.find(function(opt2){return Object.prototype.hasOwnProperty.call(opt2,name)});if(opt){var newValue=opt[name];util.setProperty(newValue,propName,value)}else opt={},opt[name]=util.setProperty({},propName,value),parsedOptions.push(opt)}else{var newOpt={};newOpt[name]=value,parsedOptions.push(newOpt)}return this},"setParsedOption");ReflectionObject.prototype.setOptions=__name(function(options,ifNotSet){if(options)for(var keys=Object.keys(options),i=0;i>>0,(field.id<<3|4)>>>0):gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",fieldIndex,ref,(field.id<<3|2)>>>0)}__name(genTypePartial,"genTypePartial");function encoder(mtype){for(var gen=util.codegen(["m","w"],mtype.name+"$encode")("if(!w)")("w=Writer.create()"),i,ref,fields=mtype.fieldsArray.slice().sort(util.compareFieldsById),i=0;i>>0,8|types.mapKey[field.keyType],field.keyType),wireType===void 0?gen("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",index,ref):gen(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|wireType,type,ref),gen("}")("}")):field.repeated?(gen("if(%s!=null&&%s.length){",ref,ref),field.packed&&types.packed[type]!==void 0?gen("w.uint32(%i).fork()",(field.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",ref)("w.%s(%s[i])",type,ref)("w.ldelim()"):(gen("for(var i=0;i<%s.length;++i)",ref),wireType===void 0?genTypePartial(gen,field,index,ref+"[i]"):gen("w.uint32(%i).%s(%s[i])",(field.id<<3|wireType)>>>0,type,ref)),gen("}")):(field.optional&&gen("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",ref,field.name),wireType===void 0?genTypePartial(gen,field,index,ref):gen("w.uint32(%i).%s(%s)",(field.id<<3|wireType)>>>0,type,ref))}return gen("return w")}__name(encoder,"encoder")}});var require_index_light2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/index-light.js"(exports2,module2){"use strict";var protobuf=module2.exports=require_index_minimal2();protobuf.build="light";function load(filename,root,callback){return typeof root=="function"?(callback=root,root=new protobuf.Root):root||(root=new protobuf.Root),root.load(filename,callback)}__name(load,"load");protobuf.load=load;function loadSync(filename,root){return root||(root=new protobuf.Root),root.loadSync(filename)}__name(loadSync,"loadSync");protobuf.loadSync=loadSync;protobuf.encoder=require_encoder2();protobuf.decoder=require_decoder2();protobuf.verifier=require_verifier2();protobuf.converter=require_converter2();protobuf.ReflectionObject=require_object2();protobuf.Namespace=require_namespace2();protobuf.Root=require_root2();protobuf.Enum=require_enum3();protobuf.Type=require_type2();protobuf.Field=require_field2();protobuf.OneOf=require_oneof2();protobuf.MapField=require_mapfield2();protobuf.Service=require_service4();protobuf.Method=require_method2();protobuf.Message=require_message2();protobuf.wrappers=require_wrappers3();protobuf.types=require_types3();protobuf.util=require_util7();protobuf.ReflectionObject._configure(protobuf.Root);protobuf.Namespace._configure(protobuf.Type,protobuf.Service,protobuf.Enum);protobuf.Root._configure(protobuf.Type);protobuf.Field._configure(protobuf.Type)}});var require_tokenize2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/tokenize.js"(exports2,module2){"use strict";module2.exports=tokenize;var delimRe=/[\s{}=;:[\],'"()<>]/g,stringDoubleRe=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,stringSingleRe=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,setCommentRe=/^ *[*/]+ */,setCommentAltRe=/^\s*\*?\/*/,setCommentSplitRe=/\n/g,whitespaceRe=/\s/,unescapeRe=/\\(.?)/g,unescapeMap={0:"\0",r:"\r",n:` `,t:" "};function unescape2(str){return str.replace(unescapeRe,function($0,$1){switch($1){case"\\":case"":return $1;default:return unescapeMap[$1]||""}})}__name(unescape2,"unescape");tokenize.unescape=unescape2;function tokenize(source,alternateCommentMode){source=source.toString();var offset=0,length=source.length,line=1,lastCommentLine=0,comments={},stack=[],stringDelim=null;function illegal(subject){return Error("illegal "+subject+" (line "+line+")")}__name(illegal,"illegal");function readString(){var re=stringDelim==="'"?stringSingleRe:stringDoubleRe;re.lastIndex=offset-1;var match=re.exec(source);if(!match)throw illegal("string");return offset=re.lastIndex,push(stringDelim),stringDelim=null,unescape2(match[1])}__name(readString,"readString");function charAt(pos){return source.charAt(pos)}__name(charAt,"charAt");function setComment(start,end,isLeading){var comment={type:source.charAt(start++),lineEmpty:!1,leading:isLeading},lookback;alternateCommentMode?lookback=2:lookback=3;var commentOffset=start-lookback,c;do if(--commentOffset<0||(c=source.charAt(commentOffset))===` `){comment.lineEmpty=!0;break}while(c===" "||c===" ");for(var lines=source.substring(start,end).split(setCommentSplitRe),i=0;i0)return stack.shift();if(stringDelim)return readString();var repeat,prev,curr,start,isDoc,isLeadingComment=offset===0;do{if(offset===length)return null;for(repeat=!1;whitespaceRe.test(curr=charAt(offset));)if(curr===` `&&(isLeadingComment=!0,++line),++offset===length)return null;if(charAt(offset)==="/"){if(++offset===length)throw illegal("comment");if(charAt(offset)==="/")if(alternateCommentMode){if(start=offset,isDoc=!1,isDoubleSlashCommentLine(offset-1)){isDoc=!0;do if(offset=findEndOfLine(offset),offset===length||(offset++,!isLeadingComment))break;while(isDoubleSlashCommentLine(offset))}else offset=Math.min(length,findEndOfLine(offset)+1);isDoc&&(setComment(start,offset,isLeadingComment),isLeadingComment=!0),line++,repeat=!0}else{for(isDoc=charAt(start=offset+1)==="/";charAt(++offset)!==` `;)if(offset===length)return null;++offset,isDoc&&(setComment(start,offset-1,isLeadingComment),isLeadingComment=!0),++line,repeat=!0}else if((curr=charAt(offset))==="*"){start=offset+1,isDoc=alternateCommentMode||charAt(start)==="*";do{if(curr===` `&&++line,++offset===length)throw illegal("comment");prev=curr,curr=charAt(offset)}while(prev!=="*"||curr!=="/");++offset,isDoc&&(setComment(start,offset-2,isLeadingComment),isLeadingComment=!0),repeat=!0}else return"/"}}while(repeat);var end=offset;delimRe.lastIndex=0;var delim=delimRe.test(charAt(end++));if(!delim)for(;end");var name=next();if(!nameRe.test(name))throw illegal(name,"name");skip("=");var field=new MapField(applyCase(name),parseId(next()),keyType,valueType);ifBlock(field,__name(function(token2){if(token2==="option")parseOption(field,token2),skip(";");else throw illegal(token2)},"parseMapField_block"),__name(function(){parseInlineOptions(field)},"parseMapField_line")),parent.add(field)}__name(parseMapField,"parseMapField");function parseOneOf(parent,token2){if(!nameRe.test(token2=next()))throw illegal(token2,"name");var oneof=new OneOf(applyCase(token2));ifBlock(oneof,__name(function(token3){token3==="option"?(parseOption(oneof,token3),skip(";")):(push(token3),parseField(oneof,"optional"))},"parseOneOf_block")),parent.add(oneof)}__name(parseOneOf,"parseOneOf");function parseEnum(parent,token2){if(!nameRe.test(token2=next()))throw illegal(token2,"name");var enm=new Enum(token2);ifBlock(enm,__name(function(token3){switch(token3){case"option":parseOption(enm,token3),skip(";");break;case"reserved":readRanges(enm.reserved||(enm.reserved=[]),!0);break;default:parseEnumValue(enm,token3)}},"parseEnum_block")),parent.add(enm)}__name(parseEnum,"parseEnum");function parseEnumValue(parent,token2){if(!nameRe.test(token2))throw illegal(token2,"name");skip("=");var value=parseId(next(),!0),dummy={options:void 0};dummy.setOption=function(name,value2){this.options===void 0&&(this.options={}),this.options[name]=value2},ifBlock(dummy,__name(function(token3){if(token3==="option")parseOption(dummy,token3),skip(";");else throw illegal(token3)},"parseEnumValue_block"),__name(function(){parseInlineOptions(dummy)},"parseEnumValue_line")),parent.add(token2,value,dummy.comment,dummy.options)}__name(parseEnumValue,"parseEnumValue");function parseOption(parent,token2){var isCustom=skip("(",!0);if(!typeRefRe.test(token2=next()))throw illegal(token2,"name");var name=token2,option=name,propName;isCustom&&(skip(")"),name="("+name+")",option=name,token2=peek(),fqTypeRefRe.test(token2)&&(propName=token2.slice(1),name+=token2,next())),skip("=");var optionValue=parseOptionValue(parent,name);setParsedOption(parent,option,optionValue,propName)}__name(parseOption,"parseOption");function parseOptionValue(parent,name){if(skip("{",!0)){for(var objectResult={};!skip("}",!0);){if(!nameRe.test(token=next()))throw illegal(token,"name");if(token===null)throw illegal(token,"end of input");var value,propName=token;if(skip(":",!0),peek()==="{")value=parseOptionValue(parent,name+"."+token);else if(peek()==="["){value=[];var lastValue;if(skip("[",!0)){do lastValue=readValue(!0),value.push(lastValue);while(skip(",",!0));skip("]"),typeof lastValue<"u"&&setOption(parent,name+"."+token,lastValue)}}else value=readValue(!0),setOption(parent,name+"."+token,value);var prevValue=objectResult[propName];prevValue&&(value=[].concat(prevValue).concat(value)),objectResult[propName]=value,skip(",",!0),skip(";",!0)}return objectResult}var simpleValue=readValue(!0);return setOption(parent,name,simpleValue),simpleValue}__name(parseOptionValue,"parseOptionValue");function setOption(parent,name,value){parent.setOption&&parent.setOption(name,value)}__name(setOption,"setOption");function setParsedOption(parent,name,value,propName){parent.setParsedOption&&parent.setParsedOption(name,value,propName)}__name(setParsedOption,"setParsedOption");function parseInlineOptions(parent){if(skip("[",!0)){do parseOption(parent,"option");while(skip(",",!0));skip("]")}return parent}__name(parseInlineOptions,"parseInlineOptions");function parseService(parent,token2){if(!nameRe.test(token2=next()))throw illegal(token2,"service name");var service=new Service(token2);ifBlock(service,__name(function(token3){if(!parseCommon(service,token3))if(token3==="rpc")parseMethod(service,token3);else throw illegal(token3)},"parseService_block")),parent.add(service)}__name(parseService,"parseService");function parseMethod(parent,token2){var commentText=cmnt(),type=token2;if(!nameRe.test(token2=next()))throw illegal(token2,"name");var name=token2,requestType,requestStream,responseType,responseStream;if(skip("("),skip("stream",!0)&&(requestStream=!0),!typeRefRe.test(token2=next())||(requestType=token2,skip(")"),skip("returns"),skip("("),skip("stream",!0)&&(responseStream=!0),!typeRefRe.test(token2=next())))throw illegal(token2);responseType=token2,skip(")");var method=new Method(name,type,requestType,responseType,requestStream,responseStream);method.comment=commentText,ifBlock(method,__name(function(token3){if(token3==="option")parseOption(method,token3),skip(";");else throw illegal(token3)},"parseMethod_block")),parent.add(method)}__name(parseMethod,"parseMethod");function parseExtension(parent,token2){if(!typeRefRe.test(token2=next()))throw illegal(token2,"reference");var reference=token2;ifBlock(null,__name(function(token3){switch(token3){case"required":case"repeated":parseField(parent,token3,reference);break;case"optional":isProto3?parseField(parent,"proto3_optional",reference):parseField(parent,"optional",reference);break;default:if(!isProto3||!typeRefRe.test(token3))throw illegal(token3);push(token3),parseField(parent,"optional",reference);break}},"parseExtension_block"))}__name(parseExtension,"parseExtension");for(var token;(token=next())!==null;)switch(token){case"package":if(!head)throw illegal(token);parsePackage();break;case"import":if(!head)throw illegal(token);parseImport();break;case"syntax":if(!head)throw illegal(token);parseSyntax();break;case"option":parseOption(ptr,token),skip(";");break;default:if(parseCommon(ptr,token)){head=!1;continue}throw illegal(token)}return parse2.filename=null,{package:pkg,imports,weakImports,syntax,root}}__name(parse2,"parse")}});var require_common4=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/common.js"(exports2,module2){"use strict";module2.exports=common;var commonRe=/\/|\./;function common(name,json){commonRe.test(name)||(name="google/protobuf/"+name+".proto",json={nested:{google:{nested:{protobuf:{nested:json}}}}}),common[name]=json}__name(common,"common");common("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var timeType;common("duration",{Duration:timeType={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});common("timestamp",{Timestamp:timeType});common("empty",{Empty:{fields:{}}});common("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}}}});common("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}}}});common("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});common.get=__name(function(file){return common[file]||null},"get")}});var require_src8=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/src/index.js"(exports2,module2){"use strict";var protobuf=module2.exports=require_index_light2();protobuf.build="full";protobuf.tokenize=require_tokenize2();protobuf.parse=require_parse3();protobuf.common=require_common4();protobuf.Root._configure(protobuf.Type,protobuf.parse,protobuf.common)}});var require_protobufjs2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/index.js"(exports2,module2){"use strict";module2.exports=require_src8()}});var require_descriptor2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/google/protobuf/descriptor.json"(exports2,module2){module2.exports={nested:{google:{nested:{protobuf:{nested:{FileDescriptorSet:{fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}}},FileDescriptorProto:{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,options:{packed:!1}},weakDependency:{rule:"repeated",type:"int32",id:11,options:{packed:!1}},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}}},DescriptorProto:{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}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},FieldDescriptorProto:{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}},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_REQUIRED:2,LABEL_REPEATED:3}}}},OneofDescriptorProto:{fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3}}},EnumValueDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{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:{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},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[38,38]],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[8,8]]},FieldOptions:{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},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}}}},OneofOptions:{fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumValueOptions:{fields:{deprecated:{type:"bool",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{fields:{deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{fields:{deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},UninterpretedOption:{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}}}}},SourceCodeInfo:{fields:{location:{rule:"repeated",type:"Location",id:1}},nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1},span:{rule:"repeated",type:"int32",id:2},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4}}}}}}}}}}}}});var require_descriptor3=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/ext/descriptor/index.js"(exports2,module2){"use strict";var $protobuf=require_protobufjs2();module2.exports=exports2=$protobuf.descriptor=$protobuf.Root.fromJSON(require_descriptor2()).lookup(".google.protobuf");var Namespace=$protobuf.Namespace,Root=$protobuf.Root,Enum=$protobuf.Enum,Type=$protobuf.Type,Field=$protobuf.Field,MapField=$protobuf.MapField,OneOf=$protobuf.OneOf,Service=$protobuf.Service,Method=$protobuf.Method;Root.fromDescriptor=__name(function(descriptor){typeof descriptor.length=="number"&&(descriptor=exports2.FileDescriptorSet.decode(descriptor));var root=new Root;if(descriptor.file)for(var fileDescriptor,filePackage,j=0,i;j{if(path.isAbsolute(target))return target;for(let directory of includePaths){let fullPath=path.join(directory,target);try{return fs.accessSync(fullPath,fs.constants.R_OK),fullPath}catch{continue}}return process.emitWarning(`${target} not found in any of the include paths ${includePaths}`),originalResolvePath(origin,target)}}__name(addIncludePathResolver,"addIncludePathResolver");async function loadProtosWithOptions(filename,options){let root=new Protobuf.Root;if(options=options||{},options.includeDirs){if(!Array.isArray(options.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));addIncludePathResolver(root,options.includeDirs)}let loadedRoot=await root.load(filename,options);return loadedRoot.resolveAll(),loadedRoot}__name(loadProtosWithOptions,"loadProtosWithOptions");exports2.loadProtosWithOptions=loadProtosWithOptions;function loadProtosWithOptionsSync(filename,options){let root=new Protobuf.Root;if(options=options||{},options.includeDirs){if(!Array.isArray(options.includeDirs))throw new Error("The includeDirs option must be an array");addIncludePathResolver(root,options.includeDirs)}let loadedRoot=root.loadSync(filename,options);return loadedRoot.resolveAll(),loadedRoot}__name(loadProtosWithOptionsSync,"loadProtosWithOptionsSync");exports2.loadProtosWithOptionsSync=loadProtosWithOptionsSync;function addCommonProtos(){let apiDescriptor=require_api(),descriptorDescriptor=require_descriptor2(),sourceContextDescriptor=require_source_context(),typeDescriptor=require_type3();Protobuf.common("api",apiDescriptor.nested.google.nested.protobuf.nested),Protobuf.common("descriptor",descriptorDescriptor.nested.google.nested.protobuf.nested),Protobuf.common("source_context",sourceContextDescriptor.nested.google.nested.protobuf.nested),Protobuf.common("type",typeDescriptor.nested.google.nested.protobuf.nested)}__name(addCommonProtos,"addCommonProtos");exports2.addCommonProtos=addCommonProtos}});var require_umd=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/long/umd/index.js"(exports2,module2){var Long=function(exports3){"use strict";Object.defineProperty(exports3,"__esModule",{value:!0}),exports3.default=void 0;var wasm=null;try{wasm=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 Long2(low,high,unsigned){this.low=low|0,this.high=high|0,this.unsigned=!!unsigned}__name(Long2,"Long"),Long2.prototype.__isLong__,Object.defineProperty(Long2.prototype,"__isLong__",{value:!0});function isLong(obj){return(obj&&obj.__isLong__)===!0}__name(isLong,"isLong");function ctz32(value){var c=Math.clz32(value&-value);return value?31-c:c}__name(ctz32,"ctz32"),Long2.isLong=isLong;var INT_CACHE={},UINT_CACHE={};function fromInt(value,unsigned){var obj,cachedObj,cache;return unsigned?(value>>>=0,(cache=0<=value&&value<256)&&(cachedObj=UINT_CACHE[value],cachedObj)?cachedObj:(obj=fromBits(value,0,!0),cache&&(UINT_CACHE[value]=obj),obj)):(value|=0,(cache=-128<=value&&value<128)&&(cachedObj=INT_CACHE[value],cachedObj)?cachedObj:(obj=fromBits(value,value<0?-1:0,!1),cache&&(INT_CACHE[value]=obj),obj))}__name(fromInt,"fromInt"),Long2.fromInt=fromInt;function fromNumber(value,unsigned){if(isNaN(value))return unsigned?UZERO:ZERO;if(unsigned){if(value<0)return UZERO;if(value>=TWO_PWR_64_DBL)return MAX_UNSIGNED_VALUE}else{if(value<=-TWO_PWR_63_DBL)return MIN_VALUE;if(value+1>=TWO_PWR_63_DBL)return MAX_VALUE}return value<0?fromNumber(-value,unsigned).neg():fromBits(value%TWO_PWR_32_DBL|0,value/TWO_PWR_32_DBL|0,unsigned)}__name(fromNumber,"fromNumber"),Long2.fromNumber=fromNumber;function fromBits(lowBits,highBits,unsigned){return new Long2(lowBits,highBits,unsigned)}__name(fromBits,"fromBits"),Long2.fromBits=fromBits;var pow_dbl=Math.pow;function fromString(str,unsigned,radix){if(str.length===0)throw Error("empty string");if(typeof unsigned=="number"?(radix=unsigned,unsigned=!1):unsigned=!!unsigned,str==="NaN"||str==="Infinity"||str==="+Infinity"||str==="-Infinity")return unsigned?UZERO:ZERO;if(radix=radix||10,radix<2||360)throw Error("interior hyphen");if(p===0)return fromString(str.substring(1),unsigned,radix).neg();for(var radixToPower=fromNumber(pow_dbl(radix,8)),result=ZERO,i=0;i>>0:this.low},"toInt"),LongPrototype.toNumber=__name(function(){return this.unsigned?(this.high>>>0)*TWO_PWR_32_DBL+(this.low>>>0):this.high*TWO_PWR_32_DBL+(this.low>>>0)},"toNumber"),LongPrototype.toString=__name(function(radix){if(radix=radix||10,radix<2||36>>0,digits=intval.toString(radix);if(rem=remDiv,rem.isZero())return digits+result;for(;digits.length<6;)digits="0"+digits;result=""+digits+result}},"toString"),LongPrototype.getHighBits=__name(function(){return this.high},"getHighBits"),LongPrototype.getHighBitsUnsigned=__name(function(){return this.high>>>0},"getHighBitsUnsigned"),LongPrototype.getLowBits=__name(function(){return this.low},"getLowBits"),LongPrototype.getLowBitsUnsigned=__name(function(){return this.low>>>0},"getLowBitsUnsigned"),LongPrototype.getNumBitsAbs=__name(function(){if(this.isNegative())return this.eq(MIN_VALUE)?64:this.neg().getNumBitsAbs();for(var val=this.high!=0?this.high:this.low,bit=31;bit>0&&!(val&1<=0},"isPositive"),LongPrototype.isOdd=__name(function(){return(this.low&1)===1},"isOdd"),LongPrototype.isEven=__name(function(){return(this.low&1)===0},"isEven"),LongPrototype.equals=__name(function(other){return isLong(other)||(other=fromValue(other)),this.unsigned!==other.unsigned&&this.high>>>31===1&&other.high>>>31===1?!1:this.high===other.high&&this.low===other.low},"equals"),LongPrototype.eq=LongPrototype.equals,LongPrototype.notEquals=__name(function(other){return!this.eq(other)},"notEquals"),LongPrototype.neq=LongPrototype.notEquals,LongPrototype.ne=LongPrototype.notEquals,LongPrototype.lessThan=__name(function(other){return this.comp(other)<0},"lessThan"),LongPrototype.lt=LongPrototype.lessThan,LongPrototype.lessThanOrEqual=__name(function(other){return this.comp(other)<=0},"lessThanOrEqual"),LongPrototype.lte=LongPrototype.lessThanOrEqual,LongPrototype.le=LongPrototype.lessThanOrEqual,LongPrototype.greaterThan=__name(function(other){return this.comp(other)>0},"greaterThan"),LongPrototype.gt=LongPrototype.greaterThan,LongPrototype.greaterThanOrEqual=__name(function(other){return this.comp(other)>=0},"greaterThanOrEqual"),LongPrototype.gte=LongPrototype.greaterThanOrEqual,LongPrototype.ge=LongPrototype.greaterThanOrEqual,LongPrototype.compare=__name(function(other){if(isLong(other)||(other=fromValue(other)),this.eq(other))return 0;var thisNeg=this.isNegative(),otherNeg=other.isNegative();return thisNeg&&!otherNeg?-1:!thisNeg&&otherNeg?1:this.unsigned?other.high>>>0>this.high>>>0||other.high===this.high&&other.low>>>0>this.low>>>0?-1:1:this.sub(other).isNegative()?-1:1},"compare"),LongPrototype.comp=LongPrototype.compare,LongPrototype.negate=__name(function(){return!this.unsigned&&this.eq(MIN_VALUE)?MIN_VALUE:this.not().add(ONE)},"negate"),LongPrototype.neg=LongPrototype.negate,LongPrototype.add=__name(function(addend){isLong(addend)||(addend=fromValue(addend));var a48=this.high>>>16,a32=this.high&65535,a16=this.low>>>16,a00=this.low&65535,b48=addend.high>>>16,b32=addend.high&65535,b16=addend.low>>>16,b00=addend.low&65535,c48=0,c32=0,c16=0,c00=0;return c00+=a00+b00,c16+=c00>>>16,c00&=65535,c16+=a16+b16,c32+=c16>>>16,c16&=65535,c32+=a32+b32,c48+=c32>>>16,c32&=65535,c48+=a48+b48,c48&=65535,fromBits(c16<<16|c00,c48<<16|c32,this.unsigned)},"add"),LongPrototype.subtract=__name(function(subtrahend){return isLong(subtrahend)||(subtrahend=fromValue(subtrahend)),this.add(subtrahend.neg())},"subtract"),LongPrototype.sub=LongPrototype.subtract,LongPrototype.multiply=__name(function(multiplier){if(this.isZero())return this;if(isLong(multiplier)||(multiplier=fromValue(multiplier)),wasm){var low=wasm.mul(this.low,this.high,multiplier.low,multiplier.high);return fromBits(low,wasm.get_high(),this.unsigned)}if(multiplier.isZero())return this.unsigned?UZERO:ZERO;if(this.eq(MIN_VALUE))return multiplier.isOdd()?MIN_VALUE:ZERO;if(multiplier.eq(MIN_VALUE))return this.isOdd()?MIN_VALUE:ZERO;if(this.isNegative())return multiplier.isNegative()?this.neg().mul(multiplier.neg()):this.neg().mul(multiplier).neg();if(multiplier.isNegative())return this.mul(multiplier.neg()).neg();if(this.lt(TWO_PWR_24)&&multiplier.lt(TWO_PWR_24))return fromNumber(this.toNumber()*multiplier.toNumber(),this.unsigned);var a48=this.high>>>16,a32=this.high&65535,a16=this.low>>>16,a00=this.low&65535,b48=multiplier.high>>>16,b32=multiplier.high&65535,b16=multiplier.low>>>16,b00=multiplier.low&65535,c48=0,c32=0,c16=0,c00=0;return c00+=a00*b00,c16+=c00>>>16,c00&=65535,c16+=a16*b00,c32+=c16>>>16,c16&=65535,c16+=a00*b16,c32+=c16>>>16,c16&=65535,c32+=a32*b00,c48+=c32>>>16,c32&=65535,c32+=a16*b16,c48+=c32>>>16,c32&=65535,c32+=a00*b32,c48+=c32>>>16,c32&=65535,c48+=a48*b00+a32*b16+a16*b32+a00*b48,c48&=65535,fromBits(c16<<16|c00,c48<<16|c32,this.unsigned)},"multiply"),LongPrototype.mul=LongPrototype.multiply,LongPrototype.divide=__name(function(divisor){if(isLong(divisor)||(divisor=fromValue(divisor)),divisor.isZero())throw Error("division by zero");if(wasm){if(!this.unsigned&&this.high===-2147483648&&divisor.low===-1&&divisor.high===-1)return this;var low=(this.unsigned?wasm.div_u:wasm.div_s)(this.low,this.high,divisor.low,divisor.high);return fromBits(low,wasm.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?UZERO:ZERO;var approx,rem,res;if(this.unsigned){if(divisor.unsigned||(divisor=divisor.toUnsigned()),divisor.gt(this))return UZERO;if(divisor.gt(this.shru(1)))return UONE;res=UZERO}else{if(this.eq(MIN_VALUE)){if(divisor.eq(ONE)||divisor.eq(NEG_ONE))return MIN_VALUE;if(divisor.eq(MIN_VALUE))return ONE;var halfThis=this.shr(1);return approx=halfThis.div(divisor).shl(1),approx.eq(ZERO)?divisor.isNegative()?ONE:NEG_ONE:(rem=this.sub(divisor.mul(approx)),res=approx.add(rem.div(divisor)),res)}else if(divisor.eq(MIN_VALUE))return this.unsigned?UZERO:ZERO;if(this.isNegative())return divisor.isNegative()?this.neg().div(divisor.neg()):this.neg().div(divisor).neg();if(divisor.isNegative())return this.div(divisor.neg()).neg();res=ZERO}for(rem=this;rem.gte(divisor);){approx=Math.max(1,Math.floor(rem.toNumber()/divisor.toNumber()));for(var log2=Math.ceil(Math.log(approx)/Math.LN2),delta=log2<=48?1:pow_dbl(2,log2-48),approxRes=fromNumber(approx),approxRem=approxRes.mul(divisor);approxRem.isNegative()||approxRem.gt(rem);)approx-=delta,approxRes=fromNumber(approx,this.unsigned),approxRem=approxRes.mul(divisor);approxRes.isZero()&&(approxRes=ONE),res=res.add(approxRes),rem=rem.sub(approxRem)}return res},"divide"),LongPrototype.div=LongPrototype.divide,LongPrototype.modulo=__name(function(divisor){if(isLong(divisor)||(divisor=fromValue(divisor)),wasm){var low=(this.unsigned?wasm.rem_u:wasm.rem_s)(this.low,this.high,divisor.low,divisor.high);return fromBits(low,wasm.get_high(),this.unsigned)}return this.sub(this.div(divisor).mul(divisor))},"modulo"),LongPrototype.mod=LongPrototype.modulo,LongPrototype.rem=LongPrototype.modulo,LongPrototype.not=__name(function(){return fromBits(~this.low,~this.high,this.unsigned)},"not"),LongPrototype.countLeadingZeros=__name(function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},"countLeadingZeros"),LongPrototype.clz=LongPrototype.countLeadingZeros,LongPrototype.countTrailingZeros=__name(function(){return this.low?ctz32(this.low):ctz32(this.high)+32},"countTrailingZeros"),LongPrototype.ctz=LongPrototype.countTrailingZeros,LongPrototype.and=__name(function(other){return isLong(other)||(other=fromValue(other)),fromBits(this.low&other.low,this.high&other.high,this.unsigned)},"and"),LongPrototype.or=__name(function(other){return isLong(other)||(other=fromValue(other)),fromBits(this.low|other.low,this.high|other.high,this.unsigned)},"or"),LongPrototype.xor=__name(function(other){return isLong(other)||(other=fromValue(other)),fromBits(this.low^other.low,this.high^other.high,this.unsigned)},"xor"),LongPrototype.shiftLeft=__name(function(numBits){return isLong(numBits)&&(numBits=numBits.toInt()),(numBits&=63)===0?this:numBits<32?fromBits(this.low<>>32-numBits,this.unsigned):fromBits(0,this.low<>>numBits|this.high<<32-numBits,this.high>>numBits,this.unsigned):fromBits(this.high>>numBits-32,this.high>=0?0:-1,this.unsigned)},"shiftRight"),LongPrototype.shr=LongPrototype.shiftRight,LongPrototype.shiftRightUnsigned=__name(function(numBits){return isLong(numBits)&&(numBits=numBits.toInt()),(numBits&=63)===0?this:numBits<32?fromBits(this.low>>>numBits|this.high<<32-numBits,this.high>>>numBits,this.unsigned):numBits===32?fromBits(this.high,0,this.unsigned):fromBits(this.high>>>numBits-32,0,this.unsigned)},"shiftRightUnsigned"),LongPrototype.shru=LongPrototype.shiftRightUnsigned,LongPrototype.shr_u=LongPrototype.shiftRightUnsigned,LongPrototype.rotateLeft=__name(function(numBits){var b;return isLong(numBits)&&(numBits=numBits.toInt()),(numBits&=63)===0?this:numBits===32?fromBits(this.high,this.low,this.unsigned):numBits<32?(b=32-numBits,fromBits(this.low<>>b,this.high<>>b,this.unsigned)):(numBits-=32,b=32-numBits,fromBits(this.high<>>b,this.low<>>b,this.unsigned))},"rotateLeft"),LongPrototype.rotl=LongPrototype.rotateLeft,LongPrototype.rotateRight=__name(function(numBits){var b;return isLong(numBits)&&(numBits=numBits.toInt()),(numBits&=63)===0?this:numBits===32?fromBits(this.high,this.low,this.unsigned):numBits<32?(b=32-numBits,fromBits(this.high<>>numBits,this.low<>>numBits,this.unsigned)):(numBits-=32,b=32-numBits,fromBits(this.low<>>numBits,this.high<>>numBits,this.unsigned))},"rotateRight"),LongPrototype.rotr=LongPrototype.rotateRight,LongPrototype.toSigned=__name(function(){return this.unsigned?fromBits(this.low,this.high,!1):this},"toSigned"),LongPrototype.toUnsigned=__name(function(){return this.unsigned?this:fromBits(this.low,this.high,!0)},"toUnsigned"),LongPrototype.toBytes=__name(function(le){return le?this.toBytesLE():this.toBytesBE()},"toBytes"),LongPrototype.toBytesLE=__name(function(){var hi=this.high,lo=this.low;return[lo&255,lo>>>8&255,lo>>>16&255,lo>>>24,hi&255,hi>>>8&255,hi>>>16&255,hi>>>24]},"toBytesLE"),LongPrototype.toBytesBE=__name(function(){var hi=this.high,lo=this.low;return[hi>>>24,hi>>>16&255,hi>>>8&255,hi&255,lo>>>24,lo>>>16&255,lo>>>8&255,lo&255]},"toBytesBE"),Long2.fromBytes=__name(function(bytes,unsigned,le){return le?Long2.fromBytesLE(bytes,unsigned):Long2.fromBytesBE(bytes,unsigned)},"fromBytes"),Long2.fromBytesLE=__name(function(bytes,unsigned){return new Long2(bytes[0]|bytes[1]<<8|bytes[2]<<16|bytes[3]<<24,bytes[4]|bytes[5]<<8|bytes[6]<<16|bytes[7]<<24,unsigned)},"fromBytesLE"),Long2.fromBytesBE=__name(function(bytes,unsigned){return new Long2(bytes[4]<<24|bytes[5]<<16|bytes[6]<<8|bytes[7],bytes[0]<<24|bytes[1]<<16|bytes[2]<<8|bytes[3],unsigned)},"fromBytesBE");var _default=Long2;return exports3.default=_default,"default"in exports3?exports3.default:exports3}({});typeof define=="function"&&define.amd?define([],function(){return Long}):typeof module2=="object"&&typeof exports2=="object"&&(module2.exports=Long)}});var require_src9=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/proto-loader/build/src/index.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.loadFileDescriptorSetFromObject=exports2.loadFileDescriptorSetFromBuffer=exports2.fromJSON=exports2.loadSync=exports2.load=exports2.IdempotencyLevel=exports2.isAnyExtension=exports2.Long=void 0;var camelCase=require_lodash(),Protobuf=require_protobufjs2(),descriptor=require_descriptor3(),util_1=require_util8(),Long=require_umd();exports2.Long=Long;function isAnyExtension(obj){return"@type"in obj&&typeof obj["@type"]=="string"}__name(isAnyExtension,"isAnyExtension");exports2.isAnyExtension=isAnyExtension;var IdempotencyLevel;(function(IdempotencyLevel2){IdempotencyLevel2.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",IdempotencyLevel2.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",IdempotencyLevel2.IDEMPOTENT="IDEMPOTENT"})(IdempotencyLevel=exports2.IdempotencyLevel||(exports2.IdempotencyLevel={}));var descriptorOptions={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function joinName(baseName,name){return baseName===""?name:baseName+"."+name}__name(joinName,"joinName");function isHandledReflectionObject(obj){return obj instanceof Protobuf.Service||obj instanceof Protobuf.Type||obj instanceof Protobuf.Enum}__name(isHandledReflectionObject,"isHandledReflectionObject");function isNamespaceBase(obj){return obj instanceof Protobuf.Namespace||obj instanceof Protobuf.Root}__name(isNamespaceBase,"isNamespaceBase");function getAllHandledReflectionObjects(obj,parentName){let objName=joinName(parentName,obj.name);return isHandledReflectionObject(obj)?[[objName,obj]]:isNamespaceBase(obj)&&typeof obj.nested<"u"?Object.keys(obj.nested).map(name=>getAllHandledReflectionObjects(obj.nested[name],objName)).reduce((accumulator,currentValue)=>accumulator.concat(currentValue),[]):[]}__name(getAllHandledReflectionObjects,"getAllHandledReflectionObjects");function createDeserializer(cls,options){return __name(function(argBuf){return cls.toObject(cls.decode(argBuf),options)},"deserialize")}__name(createDeserializer,"createDeserializer");function createSerializer(cls){return __name(function(arg){if(Array.isArray(arg))throw new Error(`Failed to serialize message: expected object with ${cls.name} structure, got array instead`);let message=cls.fromObject(arg);return cls.encode(message).finish()},"serialize")}__name(createSerializer,"createSerializer");function mapMethodOptions(options){return(options||[]).reduce((obj,item)=>{for(let[key,value]of Object.entries(item))switch(key){case"uninterpreted_option":obj.uninterpreted_option.push(item.uninterpreted_option);break;default:obj[key]=value}return obj},{deprecated:!1,idempotency_level:IdempotencyLevel.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}__name(mapMethodOptions,"mapMethodOptions");function createMethodDefinition(method,serviceName,options,fileDescriptors){let requestType=method.resolvedRequestType,responseType=method.resolvedResponseType;return{path:"/"+serviceName+"/"+method.name,requestStream:!!method.requestStream,responseStream:!!method.responseStream,requestSerialize:createSerializer(requestType),requestDeserialize:createDeserializer(requestType,options),responseSerialize:createSerializer(responseType),responseDeserialize:createDeserializer(responseType,options),originalName:camelCase(method.name),requestType:createMessageDefinition(requestType,fileDescriptors),responseType:createMessageDefinition(responseType,fileDescriptors),options:mapMethodOptions(method.parsedOptions)}}__name(createMethodDefinition,"createMethodDefinition");function createServiceDefinition(service,name,options,fileDescriptors){let def={};for(let method of service.methodsArray)def[method.name]=createMethodDefinition(method,name,options,fileDescriptors);return def}__name(createServiceDefinition,"createServiceDefinition");function createMessageDefinition(message,fileDescriptors){let messageDescriptor=message.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:messageDescriptor.$type.toObject(messageDescriptor,descriptorOptions),fileDescriptorProtos:fileDescriptors}}__name(createMessageDefinition,"createMessageDefinition");function createEnumDefinition(enumType,fileDescriptors){let enumDescriptor=enumType.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:enumDescriptor.$type.toObject(enumDescriptor,descriptorOptions),fileDescriptorProtos:fileDescriptors}}__name(createEnumDefinition,"createEnumDefinition");function createDefinition(obj,name,options,fileDescriptors){if(obj instanceof Protobuf.Service)return createServiceDefinition(obj,name,options,fileDescriptors);if(obj instanceof Protobuf.Type)return createMessageDefinition(obj,fileDescriptors);if(obj instanceof Protobuf.Enum)return createEnumDefinition(obj,fileDescriptors);throw new Error("Type mismatch in reflection object handling")}__name(createDefinition,"createDefinition");function createPackageDefinition(root,options){let def={};root.resolveAll();let bufferList=root.toDescriptor("proto3").file.map(value=>Buffer.from(descriptor.FileDescriptorProto.encode(value).finish()));for(let[name,obj]of getAllHandledReflectionObjects(root,""))def[name]=createDefinition(obj,name,options,bufferList);return def}__name(createPackageDefinition,"createPackageDefinition");function createPackageDefinitionFromDescriptorSet(decodedDescriptorSet,options){options=options||{};let root=Protobuf.Root.fromDescriptor(decodedDescriptorSet);return root.resolveAll(),createPackageDefinition(root,options)}__name(createPackageDefinitionFromDescriptorSet,"createPackageDefinitionFromDescriptorSet");function load(filename,options){return(0,util_1.loadProtosWithOptions)(filename,options).then(loadedRoot=>createPackageDefinition(loadedRoot,options))}__name(load,"load");exports2.load=load;function loadSync(filename,options){let loadedRoot=(0,util_1.loadProtosWithOptionsSync)(filename,options);return createPackageDefinition(loadedRoot,options)}__name(loadSync,"loadSync");exports2.loadSync=loadSync;function fromJSON(json,options){options=options||{};let loadedRoot=Protobuf.Root.fromJSON(json);return loadedRoot.resolveAll(),createPackageDefinition(loadedRoot,options)}__name(fromJSON,"fromJSON");exports2.fromJSON=fromJSON;function loadFileDescriptorSetFromBuffer(descriptorSet,options){let decodedDescriptorSet=descriptor.FileDescriptorSet.decode(descriptorSet);return createPackageDefinitionFromDescriptorSet(decodedDescriptorSet,options)}__name(loadFileDescriptorSetFromBuffer,"loadFileDescriptorSetFromBuffer");exports2.loadFileDescriptorSetFromBuffer=loadFileDescriptorSetFromBuffer;function loadFileDescriptorSetFromObject(descriptorSet,options){let decodedDescriptorSet=descriptor.FileDescriptorSet.fromObject(descriptorSet);return createPackageDefinitionFromDescriptorSet(decodedDescriptorSet,options)}__name(loadFileDescriptorSetFromObject,"loadFileDescriptorSetFromObject");exports2.loadFileDescriptorSetFromObject=loadFileDescriptorSetFromObject;(0,util_1.addCommonProtos)()}});var require_channelz=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/channelz.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.setup=exports2.getChannelzServiceDefinition=exports2.getChannelzHandlers=exports2.unregisterChannelzRef=exports2.registerChannelzSocket=exports2.registerChannelzServer=exports2.registerChannelzSubchannel=exports2.registerChannelzChannel=exports2.ChannelzCallTrackerStub=exports2.ChannelzCallTracker=exports2.ChannelzChildrenTrackerStub=exports2.ChannelzChildrenTracker=exports2.ChannelzTrace=exports2.ChannelzTraceStub=void 0;var net_1=require("net"),ordered_map_1=require_cjs(),connectivity_state_1=require_connectivity_state(),constants_1=require_constants(),subchannel_address_1=require_subchannel_address(),admin_1=require_admin(),make_client_1=require_make_client();function channelRefToMessage(ref){return{channel_id:ref.id,name:ref.name}}__name(channelRefToMessage,"channelRefToMessage");function subchannelRefToMessage(ref){return{subchannel_id:ref.id,name:ref.name}}__name(subchannelRefToMessage,"subchannelRefToMessage");function serverRefToMessage(ref){return{server_id:ref.id}}__name(serverRefToMessage,"serverRefToMessage");function socketRefToMessage(ref){return{socket_id:ref.id,name:ref.name}}__name(socketRefToMessage,"socketRefToMessage");var TARGET_RETAINED_TRACES=32,DEFAULT_MAX_RESULTS=100,ChannelzTraceStub=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:dateToProtoTimestamp(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};__name(ChannelzTraceStub,"ChannelzTraceStub");exports2.ChannelzTraceStub=ChannelzTraceStub;var ChannelzTrace=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(severity,description,child){let timestamp=new Date;this.events.push({description,severity,timestamp,childChannel:child?.kind==="channel"?child:void 0,childSubchannel:child?.kind==="subchannel"?child:void 0}),this.events.length>=TARGET_RETAINED_TRACES*2&&(this.events=this.events.slice(TARGET_RETAINED_TRACES)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:dateToProtoTimestamp(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(event=>({description:event.description,severity:event.severity,timestamp:dateToProtoTimestamp(event.timestamp),channel_ref:event.childChannel?channelRefToMessage(event.childChannel):null,subchannel_ref:event.childSubchannel?subchannelRefToMessage(event.childSubchannel):null}))}}};__name(ChannelzTrace,"ChannelzTrace");exports2.ChannelzTrace=ChannelzTrace;var ChannelzChildrenTracker=class{constructor(){this.channelChildren=new ordered_map_1.OrderedMap,this.subchannelChildren=new ordered_map_1.OrderedMap,this.socketChildren=new ordered_map_1.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(child){let tracker=this.trackerMap[child.kind],trackedChild=tracker.find(child.id);trackedChild.equals(tracker.end())?tracker.setElement(child.id,{ref:child,count:1},trackedChild):trackedChild.pointer[1].count+=1}unrefChild(child){let tracker=this.trackerMap[child.kind],trackedChild=tracker.getElementByKey(child.id);trackedChild!==void 0&&(trackedChild.count-=1,trackedChild.count===0&&tracker.eraseElementByKey(child.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}};__name(ChannelzChildrenTracker,"ChannelzChildrenTracker");exports2.ChannelzChildrenTracker=ChannelzChildrenTracker;var ChannelzChildrenTrackerStub=class extends ChannelzChildrenTracker{refChild(){}unrefChild(){}};__name(ChannelzChildrenTrackerStub,"ChannelzChildrenTrackerStub");exports2.ChannelzChildrenTrackerStub=ChannelzChildrenTrackerStub;var ChannelzCallTracker=class{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}};__name(ChannelzCallTracker,"ChannelzCallTracker");exports2.ChannelzCallTracker=ChannelzCallTracker;var ChannelzCallTrackerStub=class extends ChannelzCallTracker{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};__name(ChannelzCallTrackerStub,"ChannelzCallTrackerStub");exports2.ChannelzCallTrackerStub=ChannelzCallTrackerStub;var entityMaps={channel:new ordered_map_1.OrderedMap,subchannel:new ordered_map_1.OrderedMap,server:new ordered_map_1.OrderedMap,socket:new ordered_map_1.OrderedMap},generateRegisterFn=__name(kind=>{let nextId=1;function getNextId(){return nextId++}__name(getNextId,"getNextId");let entityMap=entityMaps[kind];return(name,getInfo,channelzEnabled)=>{let id=getNextId(),ref={id,name,kind};return channelzEnabled&&entityMap.setElement(id,{ref,getInfo}),ref}},"generateRegisterFn");exports2.registerChannelzChannel=generateRegisterFn("channel");exports2.registerChannelzSubchannel=generateRegisterFn("subchannel");exports2.registerChannelzServer=generateRegisterFn("server");exports2.registerChannelzSocket=generateRegisterFn("socket");function unregisterChannelzRef(ref){entityMaps[ref.kind].eraseElementByKey(ref.id)}__name(unregisterChannelzRef,"unregisterChannelzRef");exports2.unregisterChannelzRef=unregisterChannelzRef;function parseIPv6Section(addressSection){let numberValue=Number.parseInt(addressSection,16);return[numberValue/256|0,numberValue%256]}__name(parseIPv6Section,"parseIPv6Section");function parseIPv6Chunk(addressChunk){if(addressChunk==="")return[];let bytePairs=addressChunk.split(":").map(section=>parseIPv6Section(section));return[].concat(...bytePairs)}__name(parseIPv6Chunk,"parseIPv6Chunk");function ipAddressStringToBuffer(ipAddress){if((0,net_1.isIPv4)(ipAddress))return Buffer.from(Uint8Array.from(ipAddress.split(".").map(segment=>Number.parseInt(segment))));if((0,net_1.isIPv6)(ipAddress)){let leftSection,rightSection,doubleColonIndex=ipAddress.indexOf("::");doubleColonIndex===-1?(leftSection=ipAddress,rightSection=""):(leftSection=ipAddress.substring(0,doubleColonIndex),rightSection=ipAddress.substring(doubleColonIndex+2));let leftBuffer=Buffer.from(parseIPv6Chunk(leftSection)),rightBuffer=Buffer.from(parseIPv6Chunk(rightSection)),middleBuffer=Buffer.alloc(16-leftBuffer.length-rightBuffer.length,0);return Buffer.concat([leftBuffer,middleBuffer,rightBuffer])}else return null}__name(ipAddressStringToBuffer,"ipAddressStringToBuffer");function connectivityStateToMessage(state){switch(state){case connectivity_state_1.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case connectivity_state_1.ConnectivityState.IDLE:return{state:"IDLE"};case connectivity_state_1.ConnectivityState.READY:return{state:"READY"};case connectivity_state_1.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}__name(connectivityStateToMessage,"connectivityStateToMessage");function dateToProtoTimestamp(date){if(!date)return null;let millisSinceEpoch=date.getTime();return{seconds:millisSinceEpoch/1e3|0,nanos:millisSinceEpoch%1e3*1e6}}__name(dateToProtoTimestamp,"dateToProtoTimestamp");function getChannelMessage(channelEntry){let resolvedInfo=channelEntry.getInfo(),channelRef=[],subchannelRef=[];return resolvedInfo.children.channels.forEach(el=>{channelRef.push(channelRefToMessage(el[1].ref))}),resolvedInfo.children.subchannels.forEach(el=>{subchannelRef.push(subchannelRefToMessage(el[1].ref))}),{ref:channelRefToMessage(channelEntry.ref),data:{target:resolvedInfo.target,state:connectivityStateToMessage(resolvedInfo.state),calls_started:resolvedInfo.callTracker.callsStarted,calls_succeeded:resolvedInfo.callTracker.callsSucceeded,calls_failed:resolvedInfo.callTracker.callsFailed,last_call_started_timestamp:dateToProtoTimestamp(resolvedInfo.callTracker.lastCallStartedTimestamp),trace:resolvedInfo.trace.getTraceMessage()},channel_ref:channelRef,subchannel_ref:subchannelRef}}__name(getChannelMessage,"getChannelMessage");function GetChannel(call,callback){let channelId=parseInt(call.request.channel_id,10),channelEntry=entityMaps.channel.getElementByKey(channelId);if(channelEntry===void 0){callback({code:constants_1.Status.NOT_FOUND,details:"No channel data found for id "+channelId});return}callback(null,{channel:getChannelMessage(channelEntry)})}__name(GetChannel,"GetChannel");function GetTopChannels(call,callback){let maxResults=parseInt(call.request.max_results,10)||DEFAULT_MAX_RESULTS,resultList=[],startId=parseInt(call.request.start_channel_id,10),channelEntries=entityMaps.channel,i;for(i=channelEntries.lowerBound(startId);!i.equals(channelEntries.end())&&resultList.length{listenSocket.push(socketRefToMessage(el[1].ref))}),{ref:serverRefToMessage(serverEntry.ref),data:{calls_started:resolvedInfo.callTracker.callsStarted,calls_succeeded:resolvedInfo.callTracker.callsSucceeded,calls_failed:resolvedInfo.callTracker.callsFailed,last_call_started_timestamp:dateToProtoTimestamp(resolvedInfo.callTracker.lastCallStartedTimestamp),trace:resolvedInfo.trace.getTraceMessage()},listen_socket:listenSocket}}__name(getServerMessage,"getServerMessage");function GetServer(call,callback){let serverId=parseInt(call.request.server_id,10),serverEntry=entityMaps.server.getElementByKey(serverId);if(serverEntry===void 0){callback({code:constants_1.Status.NOT_FOUND,details:"No server data found for id "+serverId});return}callback(null,{server:getServerMessage(serverEntry)})}__name(GetServer,"GetServer");function GetServers(call,callback){let maxResults=parseInt(call.request.max_results,10)||DEFAULT_MAX_RESULTS,startId=parseInt(call.request.start_server_id,10),serverEntries=entityMaps.server,resultList=[],i;for(i=serverEntries.lowerBound(startId);!i.equals(serverEntries.end())&&resultList.length{listenSocket.push(socketRefToMessage(el[1].ref))});let subchannelMessage={ref:subchannelRefToMessage(subchannelEntry.ref),data:{target:resolvedInfo.target,state:connectivityStateToMessage(resolvedInfo.state),calls_started:resolvedInfo.callTracker.callsStarted,calls_succeeded:resolvedInfo.callTracker.callsSucceeded,calls_failed:resolvedInfo.callTracker.callsFailed,last_call_started_timestamp:dateToProtoTimestamp(resolvedInfo.callTracker.lastCallStartedTimestamp),trace:resolvedInfo.trace.getTraceMessage()},socket_ref:listenSocket};callback(null,{subchannel:subchannelMessage})}__name(GetSubchannel,"GetSubchannel");function subchannelAddressToAddressMessage(subchannelAddress){var _a;return(0,subchannel_address_1.isTcpSubchannelAddress)(subchannelAddress)?{address:"tcpip_address",tcpip_address:{ip_address:(_a=ipAddressStringToBuffer(subchannelAddress.host))!==null&&_a!==void 0?_a:void 0,port:subchannelAddress.port}}:{address:"uds_address",uds_address:{filename:subchannelAddress.path}}}__name(subchannelAddressToAddressMessage,"subchannelAddressToAddressMessage");function GetSocket(call,callback){var _a,_b,_c,_d,_e;let socketId=parseInt(call.request.socket_id,10),socketEntry=entityMaps.socket.getElementByKey(socketId);if(socketEntry===void 0){callback({code:constants_1.Status.NOT_FOUND,details:"No socket data found for id "+socketId});return}let resolvedInfo=socketEntry.getInfo(),securityMessage=resolvedInfo.security?{model:"tls",tls:{cipher_suite:resolvedInfo.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:(_a=resolvedInfo.security.cipherSuiteStandardName)!==null&&_a!==void 0?_a:void 0,other_name:(_b=resolvedInfo.security.cipherSuiteOtherName)!==null&&_b!==void 0?_b:void 0,local_certificate:(_c=resolvedInfo.security.localCertificate)!==null&&_c!==void 0?_c:void 0,remote_certificate:(_d=resolvedInfo.security.remoteCertificate)!==null&&_d!==void 0?_d:void 0}}:null,socketMessage={ref:socketRefToMessage(socketEntry.ref),local:resolvedInfo.localAddress?subchannelAddressToAddressMessage(resolvedInfo.localAddress):null,remote:resolvedInfo.remoteAddress?subchannelAddressToAddressMessage(resolvedInfo.remoteAddress):null,remote_name:(_e=resolvedInfo.remoteName)!==null&&_e!==void 0?_e:void 0,security:securityMessage,data:{keep_alives_sent:resolvedInfo.keepAlivesSent,streams_started:resolvedInfo.streamsStarted,streams_succeeded:resolvedInfo.streamsSucceeded,streams_failed:resolvedInfo.streamsFailed,last_local_stream_created_timestamp:dateToProtoTimestamp(resolvedInfo.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:dateToProtoTimestamp(resolvedInfo.lastRemoteStreamCreatedTimestamp),messages_received:resolvedInfo.messagesReceived,messages_sent:resolvedInfo.messagesSent,last_message_received_timestamp:dateToProtoTimestamp(resolvedInfo.lastMessageReceivedTimestamp),last_message_sent_timestamp:dateToProtoTimestamp(resolvedInfo.lastMessageSentTimestamp),local_flow_control_window:resolvedInfo.localFlowControlWindow?{value:resolvedInfo.localFlowControlWindow}:null,remote_flow_control_window:resolvedInfo.remoteFlowControlWindow?{value:resolvedInfo.remoteFlowControlWindow}:null}};callback(null,{socket:socketMessage})}__name(GetSocket,"GetSocket");function GetServerSockets(call,callback){let serverId=parseInt(call.request.server_id,10),serverEntry=entityMaps.server.getElementByKey(serverId);if(serverEntry===void 0){callback({code:constants_1.Status.NOT_FOUND,details:"No server data found for id "+serverId});return}let startId=parseInt(call.request.start_socket_id,10),maxResults=parseInt(call.request.max_results,10)||DEFAULT_MAX_RESULTS,allSockets=serverEntry.getInfo().sessionChildren.sockets,resultList=[],i;for(i=allSockets.lowerBound(startId);!i.equals(allSockets.end())&&resultList.length{this.handleBackoffTimer()},backoffOptions),this.backoffTimeout.unref(),this.subchannelAddressString=(0,subchannel_address_1.subchannelAddressToString)(subchannelAddress),this.keepaliveTime=(_a=options["grpc.keepalive_time_ms"])!==null&&_a!==void 0?_a:-1,options["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new channelz_1.ChannelzTraceStub,this.callTracker=new channelz_1.ChannelzCallTrackerStub,this.childrenTracker=new channelz_1.ChannelzChildrenTrackerStub,this.streamTracker=new channelz_1.ChannelzCallTrackerStub):(this.channelzTrace=new channelz_1.ChannelzTrace,this.callTracker=new channelz_1.ChannelzCallTracker,this.childrenTracker=new channelz_1.ChannelzChildrenTracker,this.streamTracker=new channelz_1.ChannelzCallTracker),this.channelzRef=(0,channelz_1.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(options,void 0,2))}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(text){logging.trace(constants_1.LogVerbosity.DEBUG,TRACER_NAME,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+text)}refTrace(text){logging.trace(constants_1.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+text)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE],connectivity_state_1.ConnectivityState.CONNECTING):this.transitionToState([connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE],connectivity_state_1.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let options=this.options;if(options["grpc.keepalive_time_ms"]){let adjustedKeepaliveTime=Math.min(this.keepaliveTime,KEEPALIVE_MAX_TIME_MS);options=Object.assign(Object.assign({},options),{"grpc.keepalive_time_ms":adjustedKeepaliveTime})}this.connector.connect(this.subchannelAddress,this.credentials,options).then(transport=>{this.transitionToState([connectivity_state_1.ConnectivityState.CONNECTING],connectivity_state_1.ConnectivityState.READY)?(this.transport=transport,this.channelzEnabled&&this.childrenTracker.refChild(transport.getChannelzRef()),transport.addDisconnectListener(tooManyPings=>{this.transitionToState([connectivity_state_1.ConnectivityState.READY],connectivity_state_1.ConnectivityState.IDLE),tooManyPings&&this.keepaliveTime>0&&(this.keepaliveTime*=2,logging.log(constants_1.LogVerbosity.ERROR,`Connection to ${(0,uri_parser_1.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):transport.shutdown()},error=>{this.transitionToState([connectivity_state_1.ConnectivityState.CONNECTING],connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE,`${error}`)})}transitionToState(oldStates,newState,errorMessage){var _a,_b;if(oldStates.indexOf(this.connectivityState)===-1)return!1;this.trace(connectivity_state_1.ConnectivityState[this.connectivityState]+" -> "+connectivity_state_1.ConnectivityState[newState]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+connectivity_state_1.ConnectivityState[newState]);let previousState=this.connectivityState;switch(this.connectivityState=newState,newState){case connectivity_state_1.ConnectivityState.READY:this.stopBackoff();break;case connectivity_state_1.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(_a=this.transport)===null||_a===void 0||_a.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case connectivity_state_1.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(_b=this.transport)===null||_b===void 0||_b.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${newState}`)}for(let listener of this.stateListeners)listener(this,previousState,newState,this.keepaliveTime,errorMessage);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,this.refcount===0&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,channelz_1.unregisterChannelzRef)(this.channelzRef),process.nextTick(()=>{this.transitionToState([connectivity_state_1.ConnectivityState.CONNECTING,connectivity_state_1.ConnectivityState.READY],connectivity_state_1.ConnectivityState.IDLE)}))}unrefIfOneRef(){return this.refcount===1?(this.unref(),!0):!1}createCall(metadata,host,method,listener){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let statsTracker;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),statsTracker={onCallEnd:status=>{status.code===constants_1.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):statsTracker={},this.transport.createCall(metadata,host,method,listener,statsTracker)}startConnecting(){process.nextTick(()=>{this.transitionToState([connectivity_state_1.ConnectivityState.IDLE],connectivity_state_1.ConnectivityState.CONNECTING)||this.connectivityState===connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(listener){this.stateListeners.add(listener)}removeConnectivityStateListener(listener){this.stateListeners.delete(listener)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE],connectivity_state_1.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(listener){}removeHealthStateWatcher(listener){}getRealSubchannel(){return this}realSubchannelEquals(other){return other.getRealSubchannel()===this}throttleKeepalive(newKeepaliveTime){newKeepaliveTime>this.keepaliveTime&&(this.keepaliveTime=newKeepaliveTime)}};__name(Subchannel,"Subchannel");exports2.Subchannel=Subchannel}});var require_resolver_dns=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/resolver-dns.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.setup=exports2.DEFAULT_PORT=void 0;var resolver_1=require_resolver(),dns=require("dns"),util=require("util"),service_config_1=require_service_config(),constants_1=require_constants(),metadata_1=require_metadata(),logging=require_logging(),constants_2=require_constants(),uri_parser_1=require_uri_parser(),net_1=require("net"),backoff_timeout_1=require_backoff_timeout(),TRACER_NAME="dns_resolver";function trace(text){logging.trace(constants_2.LogVerbosity.DEBUG,TRACER_NAME,text)}__name(trace,"trace");exports2.DEFAULT_PORT=443;var DEFAULT_MIN_TIME_BETWEEN_RESOLUTIONS_MS=3e4,resolveTxtPromise=util.promisify(dns.resolveTxt),dnsLookupPromise=util.promisify(dns.lookup),DnsResolver=class{constructor(target,listener,channelOptions){var _a,_b,_c;this.target=target,this.listener=listener,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfig=null,this.latestServiceConfigError=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,trace("Resolver constructed for target "+(0,uri_parser_1.uriToString)(target));let hostPort=(0,uri_parser_1.splitHostPort)(target.path);hostPort===null?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,net_1.isIPv4)(hostPort.host)||(0,net_1.isIPv6)(hostPort.host)?(this.ipResult=[{addresses:[{host:hostPort.host,port:(_a=hostPort.port)!==null&&_a!==void 0?_a:exports2.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=hostPort.host,this.port=(_b=hostPort.port)!==null&&_b!==void 0?_b:exports2.DEFAULT_PORT),this.percentage=Math.random()*100,channelOptions["grpc.service_config_disable_resolution"]===1&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:constants_1.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,uri_parser_1.uriToString)(this.target)}`,metadata:new metadata_1.Metadata};let backoffOptions={initialDelay:channelOptions["grpc.initial_reconnect_backoff_ms"],maxDelay:channelOptions["grpc.max_reconnect_backoff_ms"]};this.backoff=new backoff_timeout_1.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},backoffOptions),this.backoff.unref(),this.minTimeBetweenResolutionsMs=(_c=channelOptions["grpc.dns_min_time_between_resolutions_ms"])!==null&&_c!==void 0?_c:DEFAULT_MIN_TIME_BETWEEN_RESOLUTIONS_MS,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){this.returnedIpResult||(trace("Returning IP address for target "+(0,uri_parser_1.uriToString)(this.target)),setImmediate(()=>{this.listener.onSuccessfulResolution(this.ipResult,null,null,null,{})}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),this.stopNextResolutionTimer();return}if(this.dnsHostname===null)trace("Failed to parse DNS address "+(0,uri_parser_1.uriToString)(this.target)),setImmediate(()=>{this.listener.onError({code:constants_1.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,uri_parser_1.uriToString)(this.target)}`,metadata:new metadata_1.Metadata})}),this.stopNextResolutionTimer();else{if(this.pendingLookupPromise!==null)return;trace("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;let hostname=this.dnsHostname;this.pendingLookupPromise=dnsLookupPromise(hostname,{all:!0}),this.pendingLookupPromise.then(addressList=>{if(this.pendingLookupPromise===null)return;this.pendingLookupPromise=null,this.backoff.reset(),this.backoff.stop();let subchannelAddresses=addressList.map(addr=>({host:addr.address,port:+this.port}));this.latestLookupResult=subchannelAddresses.map(address=>({addresses:[address]}));let allAddressesString="["+subchannelAddresses.map(addr=>addr.host+":"+addr.port).join(",")+"]";if(trace("Resolved addresses for target "+(0,uri_parser_1.uriToString)(this.target)+": "+allAddressesString),this.latestLookupResult.length===0){this.listener.onError(this.defaultResolutionError);return}this.listener.onSuccessfulResolution(this.latestLookupResult,this.latestServiceConfig,this.latestServiceConfigError,null,{})},err=>{this.pendingLookupPromise!==null&&(trace("Resolution error for target "+(0,uri_parser_1.uriToString)(this.target)+": "+err.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener.onError(this.defaultResolutionError))}),this.isServiceConfigEnabled&&this.pendingTxtPromise===null&&(this.pendingTxtPromise=resolveTxtPromise(hostname),this.pendingTxtPromise.then(txtRecord=>{if(this.pendingTxtPromise!==null){this.pendingTxtPromise=null;try{this.latestServiceConfig=(0,service_config_1.extractAndSelectServiceConfig)(txtRecord,this.percentage)}catch(err){this.latestServiceConfigError={code:constants_1.Status.UNAVAILABLE,details:`Parsing service config failed with error ${err.message}`,metadata:new metadata_1.Metadata}}this.latestLookupResult!==null&&this.listener.onSuccessfulResolution(this.latestLookupResult,this.latestServiceConfig,this.latestServiceConfigError,null,{})}},err=>{}))}}startNextResolutionTimer(){var _a,_b;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),(_b=(_a=this.nextResolutionTimer).unref)===null||_b===void 0||_b.call(_a),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){this.pendingLookupPromise===null&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){this.pendingLookupPromise===null&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?trace('resolution update delayed by "min time between resolutions" rate limit'):trace("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfig=null,this.latestServiceConfigError=null,this.returnedIpResult=!1}static getDefaultAuthority(target){return target.path}};__name(DnsResolver,"DnsResolver");function setup(){(0,resolver_1.registerResolver)("dns",DnsResolver),(0,resolver_1.registerDefaultScheme)("dns")}__name(setup,"setup");exports2.setup=setup}});var require_http_proxy=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/http_proxy.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.getProxiedConnection=exports2.mapProxyName=void 0;var logging_1=require_logging(),constants_1=require_constants(),resolver_1=require_resolver(),http=require("http"),tls=require("tls"),logging=require_logging(),subchannel_address_1=require_subchannel_address(),uri_parser_1=require_uri_parser(),url_1=require("url"),resolver_dns_1=require_resolver_dns(),TRACER_NAME="proxy";function trace(text){logging.trace(constants_1.LogVerbosity.DEBUG,TRACER_NAME,text)}__name(trace,"trace");function getProxyInfo(){let proxyEnv="",envVar="";if(process.env.grpc_proxy)envVar="grpc_proxy",proxyEnv=process.env.grpc_proxy;else if(process.env.https_proxy)envVar="https_proxy",proxyEnv=process.env.https_proxy;else if(process.env.http_proxy)envVar="http_proxy",proxyEnv=process.env.http_proxy;else return{};let proxyUrl;try{proxyUrl=new url_1.URL(proxyEnv)}catch{return(0,logging_1.log)(constants_1.LogVerbosity.ERROR,`cannot parse value of "${envVar}" env var`),{}}if(proxyUrl.protocol!=="http:")return(0,logging_1.log)(constants_1.LogVerbosity.ERROR,`"${proxyUrl.protocol}" scheme not supported in proxy URI`),{};let userCred=null;proxyUrl.username&&(proxyUrl.password?((0,logging_1.log)(constants_1.LogVerbosity.INFO,"userinfo found in proxy URI"),userCred=`${proxyUrl.username}:${proxyUrl.password}`):userCred=proxyUrl.username);let hostname=proxyUrl.hostname,port=proxyUrl.port;port===""&&(port="80");let result={address:`${hostname}:${port}`};return userCred&&(result.creds=userCred),trace("Proxy server "+result.address+" set by environment variable "+envVar),result}__name(getProxyInfo,"getProxyInfo");function getNoProxyHostList(){let noProxyStr=process.env.no_grpc_proxy,envVar="no_grpc_proxy";return noProxyStr||(noProxyStr=process.env.no_proxy,envVar="no_proxy"),noProxyStr?(trace("No proxy server list set by environment variable "+envVar),noProxyStr.split(",")):[]}__name(getNoProxyHostList,"getNoProxyHostList");function mapProxyName(target,options){var _a;let noProxyResult={target,extraOptions:{}};if(((_a=options["grpc.enable_http_proxy"])!==null&&_a!==void 0?_a:1)===0||target.scheme==="unix")return noProxyResult;let proxyInfo=getProxyInfo();if(!proxyInfo.address)return noProxyResult;let hostPort=(0,uri_parser_1.splitHostPort)(target.path);if(!hostPort)return noProxyResult;let serverHost=hostPort.host;for(let host of getNoProxyHostList())if(host===serverHost)return trace("Not using proxy for target in no_proxy list: "+(0,uri_parser_1.uriToString)(target)),noProxyResult;let extraOptions={"grpc.http_connect_target":(0,uri_parser_1.uriToString)(target)};return proxyInfo.creds&&(extraOptions["grpc.http_connect_creds"]=proxyInfo.creds),{target:{scheme:"dns",path:proxyInfo.address},extraOptions}}__name(mapProxyName,"mapProxyName");exports2.mapProxyName=mapProxyName;function getProxiedConnection(address,channelOptions,connectionOptions){var _a;if(!("grpc.http_connect_target"in channelOptions))return Promise.resolve({});let realTarget=channelOptions["grpc.http_connect_target"],parsedTarget=(0,uri_parser_1.parseUri)(realTarget);if(parsedTarget===null)return Promise.resolve({});let splitHostPost=(0,uri_parser_1.splitHostPort)(parsedTarget.path);if(splitHostPost===null)return Promise.resolve({});let hostPort=`${splitHostPost.host}:${(_a=splitHostPost.port)!==null&&_a!==void 0?_a:resolver_dns_1.DEFAULT_PORT}`,options={method:"CONNECT",path:hostPort},headers={Host:hostPort};(0,subchannel_address_1.isTcpSubchannelAddress)(address)?(options.host=address.host,options.port=address.port):options.socketPath=address.path,"grpc.http_connect_creds"in channelOptions&&(headers["Proxy-Authorization"]="Basic "+Buffer.from(channelOptions["grpc.http_connect_creds"]).toString("base64")),options.headers=headers;let proxyAddressString=(0,subchannel_address_1.subchannelAddressToString)(address);return trace("Using proxy "+proxyAddressString+" to connect to "+options.path),new Promise((resolve,reject)=>{let request=http.request(options);request.once("connect",(res,socket,head)=>{var _a2;if(request.removeAllListeners(),socket.removeAllListeners(),res.statusCode===200)if(trace("Successfully connected to "+options.path+" through proxy "+proxyAddressString),"secureContext"in connectionOptions){let targetPath=(0,resolver_1.getDefaultAuthority)(parsedTarget),hostPort2=(0,uri_parser_1.splitHostPort)(targetPath),remoteHost=(_a2=hostPort2?.host)!==null&&_a2!==void 0?_a2:targetPath,cts=tls.connect(Object.assign({host:remoteHost,servername:remoteHost,socket},connectionOptions),()=>{trace("Successfully established a TLS connection to "+options.path+" through proxy "+proxyAddressString),resolve({socket:cts,realTarget:parsedTarget})});cts.on("error",error=>{trace("Failed to establish a TLS connection to "+options.path+" through proxy "+proxyAddressString+" with error "+error.message),reject()})}else trace("Successfully established a plaintext connection to "+options.path+" through proxy "+proxyAddressString),resolve({socket,realTarget:parsedTarget});else(0,logging_1.log)(constants_1.LogVerbosity.ERROR,"Failed to connect to "+options.path+" through proxy "+proxyAddressString+" with status "+res.statusCode),reject()}),request.once("error",err=>{request.removeAllListeners(),(0,logging_1.log)(constants_1.LogVerbosity.ERROR,"Failed to connect to proxy "+proxyAddressString+" with error "+err.message),reject()}),request.end()})}__name(getProxiedConnection,"getProxiedConnection");exports2.getProxiedConnection=getProxiedConnection}});var require_stream_decoder=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/stream-decoder.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.StreamDecoder=void 0;var ReadState;(function(ReadState2){ReadState2[ReadState2.NO_DATA=0]="NO_DATA",ReadState2[ReadState2.READING_SIZE=1]="READING_SIZE",ReadState2[ReadState2.READING_MESSAGE=2]="READING_MESSAGE"})(ReadState||(ReadState={}));var StreamDecoder=class{constructor(maxReadMessageLength){this.maxReadMessageLength=maxReadMessageLength,this.readState=ReadState.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(data){let readHead=0,toRead,result=[];for(;readHeadthis.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=ReadState.READING_MESSAGE;else{let message=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=ReadState.NO_DATA,result.push(message)}}break;case ReadState.READING_MESSAGE:if(toRead=Math.min(data.length-readHead,this.readMessageRemaining),this.readPartialMessage.push(data.slice(readHead,readHead+toRead)),this.readMessageRemaining-=toRead,readHead+=toRead,this.readMessageRemaining===0){let framedMessageBuffers=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),framedMessage=Buffer.concat(framedMessageBuffers,this.readMessageSize+5);this.readState=ReadState.NO_DATA,result.push(framedMessage)}break;default:throw new Error("Unexpected read state")}return result}};__name(StreamDecoder,"StreamDecoder");exports2.StreamDecoder=StreamDecoder}});var require_subchannel_call=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/subchannel-call.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Http2SubchannelCall=void 0;var http2=require("http2"),os=require("os"),constants_1=require_constants(),metadata_1=require_metadata(),stream_decoder_1=require_stream_decoder(),logging=require_logging(),constants_2=require_constants(),TRACER_NAME="subchannel_call";function getSystemErrorName(errno){for(let[name,num]of Object.entries(os.constants.errno))if(num===errno)return name;return"Unknown system error "+errno}__name(getSystemErrorName,"getSystemErrorName");function mapHttpStatusCode(code){let details=`Received HTTP status code ${code}`,mappedStatusCode;switch(code){case 400:mappedStatusCode=constants_1.Status.INTERNAL;break;case 401:mappedStatusCode=constants_1.Status.UNAUTHENTICATED;break;case 403:mappedStatusCode=constants_1.Status.PERMISSION_DENIED;break;case 404:mappedStatusCode=constants_1.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:mappedStatusCode=constants_1.Status.UNAVAILABLE;break;default:mappedStatusCode=constants_1.Status.UNKNOWN}return{code:mappedStatusCode,details,metadata:new metadata_1.Metadata}}__name(mapHttpStatusCode,"mapHttpStatusCode");var Http2SubchannelCall=class{constructor(http2Stream,callEventTracker,listener,transport,callId){var _a;this.http2Stream=http2Stream,this.callEventTracker=callEventTracker,this.listener=listener,this.transport=transport,this.callId=callId,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;let maxReceiveMessageLength=(_a=transport.getOptions()["grpc.max_receive_message_length"])!==null&&_a!==void 0?_a:constants_1.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new stream_decoder_1.StreamDecoder(maxReceiveMessageLength),http2Stream.on("response",(headers,flags)=>{let headersString="";for(let header of Object.keys(headers))headersString+=" "+header+": "+headers[header]+` `;if(this.trace(`Received server headers: `+headersString),this.httpStatusCode=headers[":status"],flags&http2.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(headers);else{let metadata;try{metadata=metadata_1.Metadata.fromHttp2Headers(headers)}catch(error){this.endCall({code:constants_1.Status.UNKNOWN,details:error.message,metadata:new metadata_1.Metadata});return}this.listener.onReceiveMetadata(metadata)}}),http2Stream.on("trailers",headers=>{this.handleTrailers(headers)}),http2Stream.on("data",data=>{if(this.statusOutput)return;this.trace("receive HTTP/2 data frame of length "+data.length);let messages;try{messages=this.decoder.write(data)}catch(e){this.cancelWithStatus(constants_1.Status.RESOURCE_EXHAUSTED,e.message);return}for(let message of messages)this.trace("parsed message of length "+message.length),this.callEventTracker.addMessageReceived(),this.tryPush(message)}),http2Stream.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),http2Stream.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var _a2;if(this.trace("HTTP/2 stream closed with code "+http2Stream.rstCode),((_a2=this.finalStatus)===null||_a2===void 0?void 0:_a2.code)===constants_1.Status.OK)return;let code,details="";switch(http2Stream.rstCode){case http2.constants.NGHTTP2_NO_ERROR:if(this.finalStatus!==null)return;if(this.httpStatusCode&&this.httpStatusCode!==200){let mappedStatus=mapHttpStatusCode(this.httpStatusCode);code=mappedStatus.code,details=mappedStatus.details}else code=constants_1.Status.INTERNAL,details=`Received RST_STREAM with code ${http2Stream.rstCode} (Call ended without gRPC status)`;break;case http2.constants.NGHTTP2_REFUSED_STREAM:code=constants_1.Status.UNAVAILABLE,details="Stream refused by server";break;case http2.constants.NGHTTP2_CANCEL:code=constants_1.Status.CANCELLED,details="Call cancelled";break;case http2.constants.NGHTTP2_ENHANCE_YOUR_CALM:code=constants_1.Status.RESOURCE_EXHAUSTED,details="Bandwidth exhausted or memory limit exceeded";break;case http2.constants.NGHTTP2_INADEQUATE_SECURITY:code=constants_1.Status.PERMISSION_DENIED,details="Protocol not secure enough";break;case http2.constants.NGHTTP2_INTERNAL_ERROR:code=constants_1.Status.INTERNAL,this.internalError===null?details=`Received RST_STREAM with code ${http2Stream.rstCode} (Internal server error)`:this.internalError.code==="ECONNRESET"||this.internalError.code==="ETIMEDOUT"?(code=constants_1.Status.UNAVAILABLE,details=this.internalError.message):details=`Received RST_STREAM with code ${http2Stream.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:code=constants_1.Status.INTERNAL,details=`Received RST_STREAM with code ${http2Stream.rstCode}`}this.endCall({code,details,metadata:new metadata_1.Metadata,rstCode:http2Stream.rstCode})})}),http2Stream.on("error",err=>{err.code!=="ERR_HTTP2_STREAM_ERROR"&&(this.trace("Node error event: message="+err.message+" code="+err.code+" errno="+getSystemErrorName(err.errno)+" syscall="+err.syscall),this.internalError=err),this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.endCall({code:constants_1.Status.UNAVAILABLE,details:"Connection dropped",metadata:new metadata_1.Metadata})}outputStatus(){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(text){logging.trace(constants_2.LogVerbosity.DEBUG,TRACER_NAME,"["+this.callId+"] "+text)}endCall(status){(this.finalStatus===null||this.finalStatus.code===constants_1.Status.OK)&&(this.finalStatus=status,this.maybeOutputStatus()),this.destroyHttp2Stream()}maybeOutputStatus(){this.finalStatus!==null&&(this.finalStatus.code!==constants_1.Status.OK||this.readsClosed&&this.unpushedReadMessages.length===0&&!this.isReadFilterPending&&!this.isPushPending)&&this.outputStatus()}push(message){this.trace("pushing to reader message of length "+(message instanceof Buffer?message.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{this.isPushPending=!1,!this.statusOutput&&(this.listener.onReceiveMessage(message),this.maybeOutputStatus())})}tryPush(messageBytes){this.canPush?(this.http2Stream.pause(),this.push(messageBytes)):(this.trace("unpushedReadMessages.push message of length "+messageBytes.length),this.unpushedReadMessages.push(messageBytes))}handleTrailers(headers){this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0);let headersString="";for(let header of Object.keys(headers))headersString+=" "+header+": "+headers[header]+` `;this.trace(`Received server trailers: `+headersString);let metadata;try{metadata=metadata_1.Metadata.fromHttp2Headers(headers)}catch{metadata=new metadata_1.Metadata}let metadataMap=metadata.getMap(),status;if(typeof metadataMap["grpc-status"]=="string"){let receivedStatus=Number(metadataMap["grpc-status"]);this.trace("received status code "+receivedStatus+" from server"),metadata.remove("grpc-status");let details="";if(typeof metadataMap["grpc-message"]=="string"){try{details=decodeURI(metadataMap["grpc-message"])}catch{details=metadataMap["grpc-message"]}metadata.remove("grpc-message"),this.trace('received status details string "'+details+'" from server')}status={code:receivedStatus,details,metadata}}else this.httpStatusCode?(status=mapHttpStatusCode(this.httpStatusCode),status.metadata=metadata):status={code:constants_1.Status.UNKNOWN,details:"No status information received",metadata};this.endCall(status)}destroyHttp2Stream(){var _a;if(!this.http2Stream.destroyed)if(this.serverEndedCall)this.http2Stream.end();else{let code;((_a=this.finalStatus)===null||_a===void 0?void 0:_a.code)===constants_1.Status.OK?code=http2.constants.NGHTTP2_NO_ERROR:code=http2.constants.NGHTTP2_CANCEL,this.trace("close http2 stream with code "+code),this.http2Stream.close(code)}}cancelWithStatus(status,details){this.trace("cancelWithStatus code: "+status+' details: "'+details+'"'),this.endCall({code:status,details,metadata:new metadata_1.Metadata})}getStatus(){return this.finalStatus}getPeer(){return this.transport.getPeerName()}getCallNumber(){return this.callId}startRead(){if(this.finalStatus!==null&&this.finalStatus.code!==constants_1.Status.OK){this.readsClosed=!0,this.maybeOutputStatus();return}if(this.canPush=!0,this.unpushedReadMessages.length>0){let nextMessage=this.unpushedReadMessages.shift();this.push(nextMessage);return}this.http2Stream.resume()}sendMessageWithContext(context,message){this.trace("write() called with message of length "+message.length);let cb=__name(error=>{process.nextTick(()=>{var _a;let code=constants_1.Status.UNAVAILABLE;error?.code==="ERR_STREAM_WRITE_AFTER_END"&&(code=constants_1.Status.INTERNAL),error&&this.cancelWithStatus(code,`Write error: ${error.message}`),(_a=context.callback)===null||_a===void 0||_a.call(context)})},"cb");this.trace("sending data chunk of length "+message.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(message,cb)}catch(error){this.endCall({code:constants_1.Status.UNAVAILABLE,details:`Write failed with error ${error.message}`,metadata:new metadata_1.Metadata})}}halfClose(){this.trace("end() called"),this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end()}};__name(Http2SubchannelCall,"Http2SubchannelCall");exports2.Http2SubchannelCall=Http2SubchannelCall}});var require_call_number=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/call-number.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.getNextCallNumber=void 0;var nextCallNumber=0;function getNextCallNumber(){return nextCallNumber++}__name(getNextCallNumber,"getNextCallNumber");exports2.getNextCallNumber=getNextCallNumber}});var require_transport=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/transport.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Http2SubchannelConnector=void 0;var http2=require("http2"),tls_1=require("tls"),channelz_1=require_channelz(),constants_1=require_constants(),http_proxy_1=require_http_proxy(),logging=require_logging(),resolver_1=require_resolver(),subchannel_address_1=require_subchannel_address(),uri_parser_1=require_uri_parser(),net=require("net"),subchannel_call_1=require_subchannel_call(),call_number_1=require_call_number(),TRACER_NAME="transport",FLOW_CONTROL_TRACER_NAME="transport_flowctrl",clientVersion=require_package4().version,{HTTP2_HEADER_AUTHORITY,HTTP2_HEADER_CONTENT_TYPE,HTTP2_HEADER_METHOD,HTTP2_HEADER_PATH,HTTP2_HEADER_TE,HTTP2_HEADER_USER_AGENT}=http2.constants,KEEPALIVE_TIMEOUT_MS=2e4,tooManyPingsData=Buffer.from("too_many_pings","ascii"),Http2Transport=class{constructor(session,subchannelAddress,options,remoteName){this.session=session,this.options=options,this.remoteName=remoteName,this.keepaliveTimeMs=-1,this.keepaliveTimeoutMs=KEEPALIVE_TIMEOUT_MS,this.keepaliveTimerId=null,this.pendingSendKeepalivePing=!1,this.keepaliveTimeoutId=null,this.keepaliveWithoutCalls=!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,subchannel_address_1.subchannelAddressToString)(subchannelAddress),options["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.streamTracker=new channelz_1.ChannelzCallTrackerStub):this.streamTracker=new channelz_1.ChannelzCallTracker,this.channelzRef=(0,channelz_1.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[options["grpc.primary_user_agent"],`grpc-node-js/${clientVersion}`,options["grpc.secondary_user_agent"]].filter(e=>e).join(" "),"grpc.keepalive_time_ms"in options&&(this.keepaliveTimeMs=options["grpc.keepalive_time_ms"]),"grpc.keepalive_timeout_ms"in options&&(this.keepaliveTimeoutMs=options["grpc.keepalive_timeout_ms"]),"grpc.keepalive_permit_without_calls"in options?this.keepaliveWithoutCalls=options["grpc.keepalive_permit_without_calls"]===1:this.keepaliveWithoutCalls=!1,session.once("close",()=>{this.trace("session closed"),this.stopKeepalivePings(),this.handleDisconnect()}),session.once("goaway",(errorCode,lastStreamID,opaqueData)=>{let tooManyPings=!1;errorCode===http2.constants.NGHTTP2_ENHANCE_YOUR_CALM&&opaqueData&&opaqueData.equals(tooManyPingsData)&&(tooManyPings=!0),this.trace("connection closed by GOAWAY with code "+errorCode+" and data "+opaqueData?.toString()),this.reportDisconnectToOwner(tooManyPings)}),session.once("error",error=>{this.trace("connection closed with error "+error.message)}),logging.isTracerEnabled(TRACER_NAME)&&(session.on("remoteSettings",settings=>{this.trace("new settings received"+(this.session!==session?" on the old connection":"")+": "+JSON.stringify(settings))}),session.on("localSettings",settings=>{this.trace("local settings acknowledged by remote"+(this.session!==session?" on the old connection":"")+": "+JSON.stringify(settings))})),this.keepaliveWithoutCalls&&this.maybeStartKeepalivePingTimer()}getChannelzInfo(){var _a,_b,_c;let sessionSocket=this.session.socket,remoteAddress=sessionSocket.remoteAddress?(0,subchannel_address_1.stringToSubchannelAddress)(sessionSocket.remoteAddress,sessionSocket.remotePort):null,localAddress=sessionSocket.localAddress?(0,subchannel_address_1.stringToSubchannelAddress)(sessionSocket.localAddress,sessionSocket.localPort):null,tlsInfo;if(this.session.encrypted){let tlsSocket=sessionSocket,cipherInfo=tlsSocket.getCipher(),certificate=tlsSocket.getCertificate(),peerCertificate=tlsSocket.getPeerCertificate();tlsInfo={cipherSuiteStandardName:(_a=cipherInfo.standardName)!==null&&_a!==void 0?_a:null,cipherSuiteOtherName:cipherInfo.standardName?null:cipherInfo.name,localCertificate:certificate&&"raw"in certificate?certificate.raw:null,remoteCertificate:peerCertificate&&"raw"in peerCertificate?peerCertificate.raw:null}}else tlsInfo=null;return{remoteAddress,localAddress,security:tlsInfo,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:(_b=this.session.state.localWindowSize)!==null&&_b!==void 0?_b:null,remoteFlowControlWindow:(_c=this.session.state.remoteWindowSize)!==null&&_c!==void 0?_c:null}}trace(text){logging.trace(constants_1.LogVerbosity.DEBUG,TRACER_NAME,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+text)}keepaliveTrace(text){logging.trace(constants_1.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+text)}flowControlTrace(text){logging.trace(constants_1.LogVerbosity.DEBUG,FLOW_CONTROL_TRACER_NAME,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+text)}internalsTrace(text){logging.trace(constants_1.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+text)}reportDisconnectToOwner(tooManyPings){this.disconnectHandled||(this.disconnectHandled=!0,this.disconnectListeners.forEach(listener=>listener(tooManyPings)))}handleDisconnect(){this.reportDisconnectToOwner(!1),setImmediate(()=>{for(let call of this.activeCalls)call.onDisconnect()})}addDisconnectListener(listener){this.disconnectListeners.push(listener)}clearKeepaliveTimer(){this.keepaliveTimerId&&(clearTimeout(this.keepaliveTimerId),this.keepaliveTimerId=null)}clearKeepaliveTimeout(){this.keepaliveTimeoutId&&(clearTimeout(this.keepaliveTimeoutId),this.keepaliveTimeoutId=null)}canSendPing(){return this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var _a,_b;if(this.clearKeepaliveTimer(),!this.canSendPing()){this.pendingSendKeepalivePing=!0;return}this.channelzEnabled&&(this.keepalivesSent+=1),this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimeoutId||(this.keepaliveTimeoutId=setTimeout(()=>{this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),(_b=(_a=this.keepaliveTimeoutId).unref)===null||_b===void 0||_b.call(_a));try{this.session.ping((err,duration,payload)=>{err&&(this.keepaliveTrace("Ping failed with error "+err.message),this.handleDisconnect()),this.keepaliveTrace("Received ping response"),this.clearKeepaliveTimeout(),this.maybeStartKeepalivePingTimer()})}catch{this.handleDisconnect()}}maybeStartKeepalivePingTimer(){var _a,_b;this.canSendPing()&&(this.pendingSendKeepalivePing?(this.pendingSendKeepalivePing=!1,this.maybeSendPing()):!this.keepaliveTimerId&&!this.keepaliveTimeoutId&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimerId=setTimeout(()=>{this.maybeSendPing()},this.keepaliveTimeMs),(_b=(_a=this.keepaliveTimerId).unref)===null||_b===void 0||_b.call(_a)))}stopKeepalivePings(){this.keepaliveTimerId&&(clearTimeout(this.keepaliveTimerId),this.keepaliveTimerId=null),this.clearKeepaliveTimeout()}removeActiveCall(call){this.activeCalls.delete(call),this.activeCalls.size===0&&this.session.unref()}addActiveCall(call){this.activeCalls.add(call),this.activeCalls.size===1&&(this.session.ref(),this.keepaliveWithoutCalls||this.maybeStartKeepalivePingTimer())}createCall(metadata,host,method,listener,subchannelCallStatsTracker){let headers=metadata.toHttp2Headers();headers[HTTP2_HEADER_AUTHORITY]=host,headers[HTTP2_HEADER_USER_AGENT]=this.userAgent,headers[HTTP2_HEADER_CONTENT_TYPE]="application/grpc",headers[HTTP2_HEADER_METHOD]="POST",headers[HTTP2_HEADER_PATH]=method,headers[HTTP2_HEADER_TE]="trailers";let http2Stream;try{http2Stream=this.session.request(headers)}catch(e){throw this.handleDisconnect(),e}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 eventTracker,call;return this.channelzEnabled?(this.streamTracker.addCallStarted(),eventTracker={addMessageSent:()=>{var _a;this.messagesSent+=1,this.lastMessageSentTimestamp=new Date,(_a=subchannelCallStatsTracker.addMessageSent)===null||_a===void 0||_a.call(subchannelCallStatsTracker)},addMessageReceived:()=>{var _a;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,(_a=subchannelCallStatsTracker.addMessageReceived)===null||_a===void 0||_a.call(subchannelCallStatsTracker)},onCallEnd:status=>{var _a;(_a=subchannelCallStatsTracker.onCallEnd)===null||_a===void 0||_a.call(subchannelCallStatsTracker,status),this.removeActiveCall(call)},onStreamEnd:success=>{var _a;success?this.streamTracker.addCallSucceeded():this.streamTracker.addCallFailed(),(_a=subchannelCallStatsTracker.onStreamEnd)===null||_a===void 0||_a.call(subchannelCallStatsTracker,success)}}):eventTracker={addMessageSent:()=>{var _a;(_a=subchannelCallStatsTracker.addMessageSent)===null||_a===void 0||_a.call(subchannelCallStatsTracker)},addMessageReceived:()=>{var _a;(_a=subchannelCallStatsTracker.addMessageReceived)===null||_a===void 0||_a.call(subchannelCallStatsTracker)},onCallEnd:status=>{var _a;(_a=subchannelCallStatsTracker.onCallEnd)===null||_a===void 0||_a.call(subchannelCallStatsTracker,status),this.removeActiveCall(call)},onStreamEnd:success=>{var _a;(_a=subchannelCallStatsTracker.onStreamEnd)===null||_a===void 0||_a.call(subchannelCallStatsTracker,success)}},call=new subchannel_call_1.Http2SubchannelCall(http2Stream,eventTracker,listener,this,(0,call_number_1.getNextCallNumber)()),this.addActiveCall(call),call}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}shutdown(){this.session.close(),(0,channelz_1.unregisterChannelzRef)(this.channelzRef)}};__name(Http2Transport,"Http2Transport");var Http2SubchannelConnector=class{constructor(channelTarget){this.channelTarget=channelTarget,this.session=null,this.isShutdown=!1}trace(text){logging.trace(constants_1.LogVerbosity.DEBUG,TRACER_NAME,(0,uri_parser_1.uriToString)(this.channelTarget)+" "+text)}createSession(address,credentials,options,proxyConnectionResult){return this.isShutdown?Promise.reject():new Promise((resolve,reject)=>{var _a,_b,_c,_d;let remoteName;proxyConnectionResult.realTarget?(remoteName=(0,uri_parser_1.uriToString)(proxyConnectionResult.realTarget),this.trace("creating HTTP/2 session through proxy to "+(0,uri_parser_1.uriToString)(proxyConnectionResult.realTarget))):(remoteName=null,this.trace("creating HTTP/2 session to "+(0,subchannel_address_1.subchannelAddressToString)(address)));let targetAuthority=(0,resolver_1.getDefaultAuthority)((_a=proxyConnectionResult.realTarget)!==null&&_a!==void 0?_a:this.channelTarget),connectionOptions=credentials._getConnectionOptions()||{};connectionOptions.maxSendHeaderBlockLength=Number.MAX_SAFE_INTEGER,"grpc-node.max_session_memory"in options?connectionOptions.maxSessionMemory=options["grpc-node.max_session_memory"]:connectionOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER;let addressScheme="http://";if("secureContext"in connectionOptions){if(addressScheme="https://",options["grpc.ssl_target_name_override"]){let sslTargetNameOverride=options["grpc.ssl_target_name_override"],originalCheckServerIdentity=(_b=connectionOptions.checkServerIdentity)!==null&&_b!==void 0?_b:tls_1.checkServerIdentity;connectionOptions.checkServerIdentity=(host,cert)=>originalCheckServerIdentity(sslTargetNameOverride,cert),connectionOptions.servername=sslTargetNameOverride}else{let authorityHostname=(_d=(_c=(0,uri_parser_1.splitHostPort)(targetAuthority))===null||_c===void 0?void 0:_c.host)!==null&&_d!==void 0?_d:"localhost";connectionOptions.servername=authorityHostname}proxyConnectionResult.socket&&(connectionOptions.createConnection=(authority,option)=>proxyConnectionResult.socket)}else connectionOptions.createConnection=(authority,option)=>proxyConnectionResult.socket?proxyConnectionResult.socket:net.connect(address);connectionOptions=Object.assign(Object.assign(Object.assign({},connectionOptions),address),{enableTrace:options["grpc-node.tls_enable_trace"]===1});let session=http2.connect(addressScheme+targetAuthority,connectionOptions);this.session=session;let errorMessage="Failed to connect";session.unref(),session.once("connect",()=>{session.removeAllListeners(),resolve(new Http2Transport(session,address,options,remoteName)),this.session=null}),session.once("close",()=>{this.session=null,setImmediate(()=>{reject(`${errorMessage} (${new Date().toISOString()})`)})}),session.once("error",error=>{errorMessage=error.message,this.trace("connection failed with error "+errorMessage)})})}connect(address,credentials,options){var _a,_b,_c;if(this.isShutdown)return Promise.reject();let connectionOptions=credentials._getConnectionOptions()||{};if("secureContext"in connectionOptions){if(connectionOptions.ALPNProtocols=["h2"],options["grpc.ssl_target_name_override"]){let sslTargetNameOverride=options["grpc.ssl_target_name_override"],originalCheckServerIdentity=(_a=connectionOptions.checkServerIdentity)!==null&&_a!==void 0?_a:tls_1.checkServerIdentity;connectionOptions.checkServerIdentity=(host,cert)=>originalCheckServerIdentity(sslTargetNameOverride,cert),connectionOptions.servername=sslTargetNameOverride}else if("grpc.http_connect_target"in options){let targetPath=(0,resolver_1.getDefaultAuthority)((_b=(0,uri_parser_1.parseUri)(options["grpc.http_connect_target"]))!==null&&_b!==void 0?_b:{path:"localhost"}),hostPort=(0,uri_parser_1.splitHostPort)(targetPath);connectionOptions.servername=(_c=hostPort?.host)!==null&&_c!==void 0?_c:targetPath}options["grpc-node.tls_enable_trace"]&&(connectionOptions.enableTrace=!0)}return(0,http_proxy_1.getProxiedConnection)(address,options,connectionOptions).then(result=>this.createSession(address,credentials,options,result))}shutdown(){var _a;this.isShutdown=!0,(_a=this.session)===null||_a===void 0||_a.close(),this.session=null}};__name(Http2SubchannelConnector,"Http2SubchannelConnector");exports2.Http2SubchannelConnector=Http2SubchannelConnector}});var require_subchannel_pool=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/subchannel-pool.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.getSubchannelPool=exports2.SubchannelPool=void 0;var channel_options_1=require_channel_options(),subchannel_1=require_subchannel(),subchannel_address_1=require_subchannel_address(),uri_parser_1=require_uri_parser(),transport_1=require_transport(),REF_CHECK_INTERVAL=1e4,SubchannelPool=class{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let allSubchannelsUnrefed=!0;for(let channelTarget in this.pool){let refedSubchannels=this.pool[channelTarget].filter(value=>!value.subchannel.unrefIfOneRef());refedSubchannels.length>0&&(allSubchannelsUnrefed=!1),this.pool[channelTarget]=refedSubchannels}allSubchannelsUnrefed&&this.cleanupTimer!==null&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}ensureCleanupTask(){var _a,_b;this.cleanupTimer===null&&(this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},REF_CHECK_INTERVAL),(_b=(_a=this.cleanupTimer).unref)===null||_b===void 0||_b.call(_a))}getOrCreateSubchannel(channelTargetUri,subchannelTarget,channelArguments,channelCredentials){this.ensureCleanupTask();let channelTarget=(0,uri_parser_1.uriToString)(channelTargetUri);if(channelTarget in this.pool){let subchannelObjArray=this.pool[channelTarget];for(let subchannelObj of subchannelObjArray)if((0,subchannel_address_1.subchannelAddressEqual)(subchannelTarget,subchannelObj.subchannelAddress)&&(0,channel_options_1.channelOptionsEqual)(channelArguments,subchannelObj.channelArguments)&&channelCredentials._equals(subchannelObj.channelCredentials))return subchannelObj.subchannel}let subchannel=new subchannel_1.Subchannel(channelTargetUri,subchannelTarget,channelArguments,channelCredentials,new transport_1.Http2SubchannelConnector(channelTargetUri));return channelTarget in this.pool||(this.pool[channelTarget]=[]),this.pool[channelTarget].push({subchannelAddress:subchannelTarget,channelArguments,channelCredentials,subchannel}),subchannel.ref(),subchannel}};__name(SubchannelPool,"SubchannelPool");exports2.SubchannelPool=SubchannelPool;var globalSubchannelPool=new SubchannelPool;function getSubchannelPool(global2){return global2?globalSubchannelPool:new SubchannelPool}__name(getSubchannelPool,"getSubchannelPool");exports2.getSubchannelPool=getSubchannelPool}});var require_filter_stack=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/filter-stack.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.FilterStackFactory=exports2.FilterStack=void 0;var FilterStack=class{constructor(filters){this.filters=filters}sendMetadata(metadata){let result=metadata;for(let i=0;i=0;i--)result=this.filters[i].receiveMetadata(result);return result}sendMessage(message){let result=message;for(let i=0;i=0;i--)result=this.filters[i].receiveMessage(result);return result}receiveTrailers(status){let result=status;for(let i=this.filters.length-1;i>=0;i--)result=this.filters[i].receiveTrailers(result);return result}push(filters){this.filters.unshift(...filters)}getFilters(){return this.filters}};__name(FilterStack,"FilterStack");exports2.FilterStack=FilterStack;var FilterStackFactory=class{constructor(factories){this.factories=factories}push(filterFactories){this.factories.unshift(...filterFactories)}clone(){return new FilterStackFactory([...this.factories])}createFilter(){return new FilterStack(this.factories.map(factory=>factory.createFilter()))}};__name(FilterStackFactory,"FilterStackFactory");exports2.FilterStackFactory=FilterStackFactory}});var require_compression_algorithms=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/compression-algorithms.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.CompressionAlgorithms=void 0;var CompressionAlgorithms;(function(CompressionAlgorithms2){CompressionAlgorithms2[CompressionAlgorithms2.identity=0]="identity",CompressionAlgorithms2[CompressionAlgorithms2.deflate=1]="deflate",CompressionAlgorithms2[CompressionAlgorithms2.gzip=2]="gzip"})(CompressionAlgorithms||(exports2.CompressionAlgorithms=CompressionAlgorithms={}))}});var require_filter2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/filter.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.BaseFilter=void 0;var BaseFilter=class{async sendMetadata(metadata){return metadata}receiveMetadata(metadata){return metadata}async sendMessage(message){return message}async receiveMessage(message){return message}receiveTrailers(status){return status}};__name(BaseFilter,"BaseFilter");exports2.BaseFilter=BaseFilter}});var require_compression_filter=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/compression-filter.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.CompressionFilterFactory=exports2.CompressionFilter=void 0;var zlib=require("zlib"),compression_algorithms_1=require_compression_algorithms(),constants_1=require_constants(),filter_1=require_filter2(),logging=require_logging(),isCompressionAlgorithmKey=__name(key=>typeof key=="number"&&typeof compression_algorithms_1.CompressionAlgorithms[key]=="string","isCompressionAlgorithmKey"),CompressionHandler=class{async writeMessage(message,compress){let messageBuffer=message;compress&&(messageBuffer=await this.compressMessage(messageBuffer));let output=Buffer.allocUnsafe(messageBuffer.length+5);return output.writeUInt8(compress?1:0,0),output.writeUInt32BE(messageBuffer.length,1),messageBuffer.copy(output,5),output}async readMessage(data){let compressed=data.readUInt8(0)===1,messageBuffer=data.slice(5);return compressed&&(messageBuffer=await this.decompressMessage(messageBuffer)),messageBuffer}};__name(CompressionHandler,"CompressionHandler");var IdentityHandler=class extends CompressionHandler{async compressMessage(message){return message}async writeMessage(message,compress){let output=Buffer.allocUnsafe(message.length+5);return output.writeUInt8(0,0),output.writeUInt32BE(message.length,1),message.copy(output,5),output}decompressMessage(message){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}};__name(IdentityHandler,"IdentityHandler");var DeflateHandler=class extends CompressionHandler{constructor(maxRecvMessageLength){super(),this.maxRecvMessageLength=maxRecvMessageLength}compressMessage(message){return new Promise((resolve,reject)=>{zlib.deflate(message,(err,output)=>{err?reject(err):resolve(output)})})}decompressMessage(message){return new Promise((resolve,reject)=>{let totalLength=0,messageParts=[],decompresser=zlib.createInflate();decompresser.on("data",chunk=>{messageParts.push(chunk),totalLength+=chunk.byteLength,this.maxRecvMessageLength!==-1&&totalLength>this.maxRecvMessageLength&&(decompresser.destroy(),reject({code:constants_1.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),decompresser.on("end",()=>{resolve(Buffer.concat(messageParts))}),decompresser.write(message),decompresser.end()})}};__name(DeflateHandler,"DeflateHandler");var GzipHandler=class extends CompressionHandler{constructor(maxRecvMessageLength){super(),this.maxRecvMessageLength=maxRecvMessageLength}compressMessage(message){return new Promise((resolve,reject)=>{zlib.gzip(message,(err,output)=>{err?reject(err):resolve(output)})})}decompressMessage(message){return new Promise((resolve,reject)=>{let totalLength=0,messageParts=[],decompresser=zlib.createGunzip();decompresser.on("data",chunk=>{messageParts.push(chunk),totalLength+=chunk.byteLength,this.maxRecvMessageLength!==-1&&totalLength>this.maxRecvMessageLength&&(decompresser.destroy(),reject({code:constants_1.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),decompresser.on("end",()=>{resolve(Buffer.concat(messageParts))}),decompresser.write(message),decompresser.end()})}};__name(GzipHandler,"GzipHandler");var UnknownHandler=class extends CompressionHandler{constructor(compressionName){super(),this.compressionName=compressionName}compressMessage(message){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(message){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}};__name(UnknownHandler,"UnknownHandler");function getCompressionHandler(compressionName,maxReceiveMessageSize){switch(compressionName){case"identity":return new IdentityHandler;case"deflate":return new DeflateHandler(maxReceiveMessageSize);case"gzip":return new GzipHandler(maxReceiveMessageSize);default:return new UnknownHandler(compressionName)}}__name(getCompressionHandler,"getCompressionHandler");var CompressionFilter=class extends filter_1.BaseFilter{constructor(channelOptions,sharedFilterConfig){var _a,_b;super(),this.sharedFilterConfig=sharedFilterConfig,this.sendCompression=new IdentityHandler,this.receiveCompression=new IdentityHandler,this.currentCompressionAlgorithm="identity";let compressionAlgorithmKey=channelOptions["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=(_a=channelOptions["grpc.max_receive_message_length"])!==null&&_a!==void 0?_a:constants_1.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,compressionAlgorithmKey!==void 0)if(isCompressionAlgorithmKey(compressionAlgorithmKey)){let clientSelectedEncoding=compression_algorithms_1.CompressionAlgorithms[compressionAlgorithmKey],serverSupportedEncodings=(_b=sharedFilterConfig.serverSupportedEncodingHeader)===null||_b===void 0?void 0:_b.split(",");(!serverSupportedEncodings||serverSupportedEncodings.includes(clientSelectedEncoding))&&(this.currentCompressionAlgorithm=clientSelectedEncoding,this.sendCompression=getCompressionHandler(this.currentCompressionAlgorithm,-1))}else logging.log(constants_1.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${compressionAlgorithmKey}`)}async sendMetadata(metadata){let headers=await metadata;return headers.set("grpc-accept-encoding","identity,deflate,gzip"),headers.set("accept-encoding","identity"),this.currentCompressionAlgorithm==="identity"?headers.remove("grpc-encoding"):headers.set("grpc-encoding",this.currentCompressionAlgorithm),headers}receiveMetadata(metadata){let receiveEncoding=metadata.get("grpc-encoding");if(receiveEncoding.length>0){let encoding=receiveEncoding[0];typeof encoding=="string"&&(this.receiveCompression=getCompressionHandler(encoding,this.maxReceiveMessageLength))}metadata.remove("grpc-encoding");let serverSupportedEncodingsHeader=metadata.get("grpc-accept-encoding")[0];return serverSupportedEncodingsHeader&&(this.sharedFilterConfig.serverSupportedEncodingHeader=serverSupportedEncodingsHeader,serverSupportedEncodingsHeader.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new IdentityHandler,this.currentCompressionAlgorithm="identity")),metadata.remove("grpc-accept-encoding"),metadata}async sendMessage(message){var _a;let resolvedMessage=await message,compress;return this.sendCompression instanceof IdentityHandler?compress=!1:compress=(((_a=resolvedMessage.flags)!==null&&_a!==void 0?_a:0)&2)===0,{message:await this.sendCompression.writeMessage(resolvedMessage.message,compress),flags:resolvedMessage.flags}}async receiveMessage(message){return this.receiveCompression.readMessage(await message)}};__name(CompressionFilter,"CompressionFilter");exports2.CompressionFilter=CompressionFilter;var CompressionFilterFactory=class{constructor(channel,options){this.options=options,this.sharedFilterConfig={}}createFilter(){return new CompressionFilter(this.options,this.sharedFilterConfig)}};__name(CompressionFilterFactory,"CompressionFilterFactory");exports2.CompressionFilterFactory=CompressionFilterFactory}});var require_deadline=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/deadline.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.formatDateDifference=exports2.deadlineToString=exports2.getRelativeTimeout=exports2.getDeadlineTimeoutString=exports2.minDeadline=void 0;function minDeadline(...deadlineList){let minValue=1/0;for(let deadline of deadlineList){let deadlineMsecs=deadline instanceof Date?deadline.getTime():deadline;deadlineMsecsMAX_TIMEOUT_TIME?1/0:timeout}__name(getRelativeTimeout,"getRelativeTimeout");exports2.getRelativeTimeout=getRelativeTimeout;function deadlineToString(deadline){if(deadline instanceof Date)return deadline.toISOString();{let dateDeadline=new Date(deadline);return Number.isNaN(dateDeadline.getTime())?""+deadline:dateDeadline.toISOString()}}__name(deadlineToString,"deadlineToString");exports2.deadlineToString=deadlineToString;function formatDateDifference(startDate,endDate){return((endDate.getTime()-startDate.getTime())/1e3).toFixed(3)+"s"}__name(formatDateDifference,"formatDateDifference");exports2.formatDateDifference=formatDateDifference}});var require_control_plane_status=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/control-plane-status.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.restrictControlPlaneStatusCode=void 0;var constants_1=require_constants(),INAPPROPRIATE_CONTROL_PLANE_CODES=[constants_1.Status.OK,constants_1.Status.INVALID_ARGUMENT,constants_1.Status.NOT_FOUND,constants_1.Status.ALREADY_EXISTS,constants_1.Status.FAILED_PRECONDITION,constants_1.Status.ABORTED,constants_1.Status.OUT_OF_RANGE,constants_1.Status.DATA_LOSS];function restrictControlPlaneStatusCode(code,details){return INAPPROPRIATE_CONTROL_PLANE_CODES.includes(code)?{code:constants_1.Status.INTERNAL,details:`Invalid status from control plane: ${code} ${constants_1.Status[code]} ${details}`}:{code,details}}__name(restrictControlPlaneStatusCode,"restrictControlPlaneStatusCode");exports2.restrictControlPlaneStatusCode=restrictControlPlaneStatusCode}});var require_load_balancing_call=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/load-balancing-call.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.LoadBalancingCall=void 0;var connectivity_state_1=require_connectivity_state(),constants_1=require_constants(),deadline_1=require_deadline(),metadata_1=require_metadata(),picker_1=require_picker(),uri_parser_1=require_uri_parser(),logging=require_logging(),control_plane_status_1=require_control_plane_status(),http2=require("http2"),TRACER_NAME="load_balancing_call",LoadBalancingCall=class{constructor(channel,callConfig,methodName,host,credentials,deadline,callNumber){var _a,_b;this.channel=channel,this.callConfig=callConfig,this.methodName=methodName,this.host=host,this.credentials=credentials,this.deadline=deadline,this.callNumber=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 splitPath=this.methodName.split("/"),serviceName="";splitPath.length>=2&&(serviceName=splitPath[1]);let hostname=(_b=(_a=(0,uri_parser_1.splitHostPort)(this.host))===null||_a===void 0?void 0:_a.host)!==null&&_b!==void 0?_b:"localhost";this.serviceUrl=`https://${hostname}/${serviceName}`,this.startTime=new Date}getDeadlineInfo(){var _a,_b;let deadlineInfo=[];return this.childStartTime?(this.childStartTime>this.startTime&&(!((_a=this.metadata)===null||_a===void 0)&&_a.getOptions().waitForReady&&deadlineInfo.push("wait_for_ready"),deadlineInfo.push(`LB pick: ${(0,deadline_1.formatDateDifference)(this.startTime,this.childStartTime)}`)),deadlineInfo.push(...this.child.getDeadlineInfo()),deadlineInfo):(!((_b=this.metadata)===null||_b===void 0)&&_b.getOptions().waitForReady&&deadlineInfo.push("wait_for_ready"),deadlineInfo.push("Waiting for LB pick"),deadlineInfo)}trace(text){logging.trace(constants_1.LogVerbosity.DEBUG,TRACER_NAME,"["+this.callNumber+"] "+text)}outputStatus(status,progress){var _a,_b;if(!this.ended){this.ended=!0,this.trace("ended with status: code="+status.code+' details="'+status.details+'" start time='+this.startTime.toISOString());let finalStatus=Object.assign(Object.assign({},status),{progress});(_a=this.listener)===null||_a===void 0||_a.onReceiveStatus(finalStatus),(_b=this.onCallEnded)===null||_b===void 0||_b.call(this,finalStatus.code)}}doPick(){var _a,_b;if(this.ended)return;if(!this.metadata)throw new Error("doPick called before start");this.trace("Pick called");let finalMetadata=this.metadata.clone(),pickResult=this.channel.doPick(finalMetadata,this.callConfig.pickInformation),subchannelString=pickResult.subchannel?"("+pickResult.subchannel.getChannelzRef().id+") "+pickResult.subchannel.getAddress():""+pickResult.subchannel;switch(this.trace("Pick result: "+picker_1.PickResultType[pickResult.pickResultType]+" subchannel: "+subchannelString+" status: "+((_a=pickResult.status)===null||_a===void 0?void 0:_a.code)+" "+((_b=pickResult.status)===null||_b===void 0?void 0:_b.details)),pickResult.pickResultType){case picker_1.PickResultType.COMPLETE:this.credentials.generateMetadata({service_url:this.serviceUrl}).then(credsMetadata=>{var _a2,_b2,_c;if(this.ended){this.trace("Credentials metadata generation finished after call ended");return}if(finalMetadata.merge(credsMetadata),finalMetadata.get("authorization").length>1&&this.outputStatus({code:constants_1.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new metadata_1.Metadata},"PROCESSED"),pickResult.subchannel.getConnectivityState()!==connectivity_state_1.ConnectivityState.READY){this.trace("Picked subchannel "+subchannelString+" has state "+connectivity_state_1.ConnectivityState[pickResult.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),this.doPick();return}this.deadline!==1/0&&finalMetadata.set("grpc-timeout",(0,deadline_1.getDeadlineTimeoutString)(this.deadline));try{this.child=pickResult.subchannel.getRealSubchannel().createCall(finalMetadata,this.host,this.methodName,{onReceiveMetadata:metadata=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(metadata)},onReceiveMessage:message=>{this.trace("Received message"),this.listener.onReceiveMessage(message)},onReceiveStatus:status=>{this.trace("Received status"),status.rstCode===http2.constants.NGHTTP2_REFUSED_STREAM?this.outputStatus(status,"REFUSED"):this.outputStatus(status,"PROCESSED")}}),this.childStartTime=new Date}catch(error){this.trace("Failed to start call on picked subchannel "+subchannelString+" with error "+error.message),this.outputStatus({code:constants_1.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+error.message,metadata:new metadata_1.Metadata},"NOT_STARTED");return}(_b2=(_a2=this.callConfig).onCommitted)===null||_b2===void 0||_b2.call(_a2),(_c=pickResult.onCallStarted)===null||_c===void 0||_c.call(pickResult),this.onCallEnded=pickResult.onCallEnded,this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending&&this.child.startRead(),this.pendingMessage&&this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.pendingHalfClose&&this.child.halfClose()},error=>{let{code:code2,details:details2}=(0,control_plane_status_1.restrictControlPlaneStatusCode)(typeof error.code=="number"?error.code:constants_1.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${error.message}`);this.outputStatus({code:code2,details:details2,metadata:new metadata_1.Metadata},"PROCESSED")});break;case picker_1.PickResultType.DROP:let{code,details}=(0,control_plane_status_1.restrictControlPlaneStatusCode)(pickResult.status.code,pickResult.status.details);setImmediate(()=>{this.outputStatus({code,details,metadata:pickResult.status.metadata},"DROP")});break;case picker_1.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{let{code:code2,details:details2}=(0,control_plane_status_1.restrictControlPlaneStatusCode)(pickResult.status.code,pickResult.status.details);setImmediate(()=>{this.outputStatus({code:code2,details:details2,metadata:pickResult.status.metadata},"PROCESSED")})}break;case picker_1.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(status,details){var _a;this.trace("cancelWithStatus code: "+status+' details: "'+details+'"'),(_a=this.child)===null||_a===void 0||_a.cancelWithStatus(status,details),this.outputStatus({code:status,details,metadata:new metadata_1.Metadata},"PROCESSED")}getPeer(){var _a,_b;return(_b=(_a=this.child)===null||_a===void 0?void 0:_a.getPeer())!==null&&_b!==void 0?_b:this.channel.getTarget()}start(metadata,listener){this.trace("start called"),this.listener=listener,this.metadata=metadata,this.doPick()}sendMessageWithContext(context,message){this.trace("write() called with message of length "+message.length),this.child?this.child.sendMessageWithContext(context,message):this.pendingMessage={context,message}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(credentials){throw new Error("Method not implemented.")}getCallNumber(){return this.callNumber}};__name(LoadBalancingCall,"LoadBalancingCall");exports2.LoadBalancingCall=LoadBalancingCall}});var require_resolving_call=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/resolving-call.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.ResolvingCall=void 0;var constants_1=require_constants(),deadline_1=require_deadline(),metadata_1=require_metadata(),logging=require_logging(),control_plane_status_1=require_control_plane_status(),TRACER_NAME="resolving_call",ResolvingCall=class{constructor(channel,method,options,filterStackFactory,credentials,callNumber){this.channel=channel,this.method=method,this.filterStackFactory=filterStackFactory,this.credentials=credentials,this.callNumber=callNumber,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.deadline=options.deadline,this.host=options.host,options.parentCall&&(options.flags&constants_1.Propagate.CANCELLATION&&options.parentCall.on("cancelled",()=>{this.cancelWithStatus(constants_1.Status.CANCELLED,"Cancelled by parent call")}),options.flags&constants_1.Propagate.DEADLINE&&(this.trace("Propagating deadline from parent: "+options.parentCall.getDeadline()),this.deadline=(0,deadline_1.minDeadline)(this.deadline,options.parentCall.getDeadline()))),this.trace("Created"),this.runDeadlineTimer()}trace(text){logging.trace(constants_1.LogVerbosity.DEBUG,TRACER_NAME,"["+this.callNumber+"] "+text)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.trace("Deadline: "+(0,deadline_1.deadlineToString)(this.deadline));let timeout=(0,deadline_1.getRelativeTimeout)(this.deadline);if(timeout!==1/0){this.trace("Deadline will be reached in "+timeout+"ms");let handleDeadline=__name(()=>{if(!this.deadlineStartTime){this.cancelWithStatus(constants_1.Status.DEADLINE_EXCEEDED,"Deadline exceeded");return}let deadlineInfo=[],deadlineEndTime=new Date;deadlineInfo.push(`Deadline exceeded after ${(0,deadline_1.formatDateDifference)(this.deadlineStartTime,deadlineEndTime)}`),this.configReceivedTime?(this.configReceivedTime>this.deadlineStartTime&&deadlineInfo.push(`name resolution: ${(0,deadline_1.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`),this.childStartTime?this.childStartTime>this.configReceivedTime&&deadlineInfo.push(`metadata filters: ${(0,deadline_1.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`):deadlineInfo.push("waiting for metadata filters")):deadlineInfo.push("waiting for name resolution"),this.child&&deadlineInfo.push(...this.child.getDeadlineInfo()),this.cancelWithStatus(constants_1.Status.DEADLINE_EXCEEDED,deadlineInfo.join(","))},"handleDeadline");timeout<=0?process.nextTick(handleDeadline):this.deadlineTimer=setTimeout(handleDeadline,timeout)}}outputStatus(status){if(!this.ended){this.ended=!0,this.filterStack||(this.filterStack=this.filterStackFactory.createFilter()),clearTimeout(this.deadlineTimer);let filteredStatus=this.filterStack.receiveTrailers(status);this.trace("ended with status: code="+filteredStatus.code+' details="'+filteredStatus.details+'"'),this.statusWatchers.forEach(watcher=>watcher(filteredStatus)),process.nextTick(()=>{var _a;(_a=this.listener)===null||_a===void 0||_a.onReceiveStatus(filteredStatus)})}}sendMessageOnChild(context,message){if(!this.child)throw new Error("sendMessageonChild called with child not populated");let child=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message,flags:context.flags})).then(filteredMessage=>{this.writeFilterPending=!1,child.sendMessageWithContext(context,filteredMessage.message),this.pendingHalfClose&&child.halfClose()},status=>{this.cancelWithStatus(status.code,status.details)})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw new Error("getConfig called before start");let configResult=this.channel.getConfig(this.method,this.metadata);if(configResult.type==="NONE"){this.channel.queueCallForConfig(this);return}else if(configResult.type==="ERROR"){this.metadata.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(configResult.error);return}this.configReceivedTime=new Date;let config=configResult.config;if(config.status!==constants_1.Status.OK){let{code,details}=(0,control_plane_status_1.restrictControlPlaneStatusCode)(config.status,"Failed to route call to method "+this.method);this.outputStatus({code,details,metadata:new metadata_1.Metadata});return}if(config.methodConfig.timeout){let configDeadline=new Date;configDeadline.setSeconds(configDeadline.getSeconds()+config.methodConfig.timeout.seconds),configDeadline.setMilliseconds(configDeadline.getMilliseconds()+config.methodConfig.timeout.nanos/1e6),this.deadline=(0,deadline_1.minDeadline)(this.deadline,configDeadline),this.runDeadlineTimer()}this.filterStackFactory.push(config.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then(filteredMetadata=>{this.child=this.channel.createInnerCall(config,this.method,this.host,this.credentials,this.deadline),this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=new Date,this.child.start(filteredMetadata,{onReceiveMetadata:metadata=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(metadata))},onReceiveMessage:message=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(message).then(filteredMesssage=>{this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(filteredMesssage),this.pendingChildStatus&&this.outputStatus(this.pendingChildStatus)},status=>{this.cancelWithStatus(status.code,status.details)})},onReceiveStatus:status=>{this.trace("Received status"),this.readFilterPending?this.pendingChildStatus=status:this.outputStatus(status)}}),this.readPending&&this.child.startRead(),this.pendingMessage?this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message):this.pendingHalfClose&&this.child.halfClose()},status=>{this.outputStatus(status)})}reportResolverError(status){var _a;!((_a=this.metadata)===null||_a===void 0)&&_a.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(status)}cancelWithStatus(status,details){var _a;this.trace("cancelWithStatus code: "+status+' details: "'+details+'"'),(_a=this.child)===null||_a===void 0||_a.cancelWithStatus(status,details),this.outputStatus({code:status,details,metadata:new metadata_1.Metadata})}getPeer(){var _a,_b;return(_b=(_a=this.child)===null||_a===void 0?void 0:_a.getPeer())!==null&&_b!==void 0?_b:this.channel.getTarget()}start(metadata,listener){this.trace("start called"),this.metadata=metadata.clone(),this.listener=listener,this.getConfig()}sendMessageWithContext(context,message){this.trace("write() called with message of length "+message.length),this.child?this.sendMessageOnChild(context,message):this.pendingMessage={context,message}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child&&!this.writeFilterPending?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(credentials){this.credentials=this.credentials.compose(credentials)}addStatusWatcher(watcher){this.statusWatchers.push(watcher)}getCallNumber(){return this.callNumber}};__name(ResolvingCall,"ResolvingCall");exports2.ResolvingCall=ResolvingCall}});var require_retrying_call=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/retrying-call.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.RetryingCall=exports2.MessageBufferTracker=exports2.RetryThrottler=void 0;var constants_1=require_constants(),deadline_1=require_deadline(),metadata_1=require_metadata(),logging=require_logging(),TRACER_NAME="retrying_call",RetryThrottler=class{constructor(maxTokens,tokenRatio,previousRetryThrottler){this.maxTokens=maxTokens,this.tokenRatio=tokenRatio,previousRetryThrottler?this.tokens=previousRetryThrottler.tokens*(maxTokens/previousRetryThrottler.maxTokens):this.tokens=maxTokens}addCallSucceeded(){this.tokens=Math.max(this.tokens+this.tokenRatio,this.maxTokens)}addCallFailed(){this.tokens=Math.min(this.tokens-1,0)}canRetryCall(){return this.tokens>this.maxTokens/2}};__name(RetryThrottler,"RetryThrottler");exports2.RetryThrottler=RetryThrottler;var MessageBufferTracker=class{constructor(totalLimit,limitPerCall){this.totalLimit=totalLimit,this.limitPerCall=limitPerCall,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(size,callId){var _a;let currentPerCall=(_a=this.allocatedPerCall.get(callId))!==null&&_a!==void 0?_a:0;return this.limitPerCall-currentPerCall total allocated ${this.totalAllocated}`);this.totalAllocated-=size;let currentPerCall=(_a=this.allocatedPerCall.get(callId))!==null&&_a!==void 0?_a:0;if(currentPerCall allocated for call ${currentPerCall}`);this.allocatedPerCall.set(callId,currentPerCall-size)}freeAll(callId){var _a;let currentPerCall=(_a=this.allocatedPerCall.get(callId))!==null&&_a!==void 0?_a:0;if(this.totalAllocated total allocated ${this.totalAllocated}`);this.totalAllocated-=currentPerCall,this.allocatedPerCall.delete(callId)}};__name(MessageBufferTracker,"MessageBufferTracker");exports2.MessageBufferTracker=MessageBufferTracker;var PREVIONS_RPC_ATTEMPTS_METADATA_KEY="grpc-previous-rpc-attempts",RetryingCall=class{constructor(channel,callConfig,methodName,host,credentials,deadline,callNumber,bufferTracker,retryThrottler){if(this.channel=channel,this.callConfig=callConfig,this.methodName=methodName,this.host=host,this.credentials=credentials,this.deadline=deadline,this.callNumber=callNumber,this.bufferTracker=bufferTracker,this.retryThrottler=retryThrottler,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,callConfig.methodConfig.retryPolicy){this.state="RETRY";let retryPolicy=callConfig.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(retryPolicy.initialBackoff.substring(0,retryPolicy.initialBackoff.length-1))}else callConfig.methodConfig.hedgingPolicy?this.state="HEDGING":this.state="TRANSPARENT_ONLY";this.startTime=new Date}getDeadlineInfo(){if(this.underlyingCalls.length===0)return[];let deadlineInfo=[],latestCall=this.underlyingCalls[this.underlyingCalls.length-1];return this.underlyingCalls.length>1&&deadlineInfo.push(`previous attempts: ${this.underlyingCalls.length-1}`),latestCall.startTime>this.startTime&&deadlineInfo.push(`time to current attempt start: ${(0,deadline_1.formatDateDifference)(this.startTime,latestCall.startTime)}`),deadlineInfo.push(...latestCall.call.getDeadlineInfo()),deadlineInfo}getCallNumber(){return this.callNumber}trace(text){logging.trace(constants_1.LogVerbosity.DEBUG,TRACER_NAME,"["+this.callNumber+"] "+text)}reportStatus(statusObject){this.trace("ended with status: code="+statusObject.code+' details="'+statusObject.details+'" start time='+this.startTime.toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var _a;(_a=this.listener)===null||_a===void 0||_a.onReceiveStatus({code:statusObject.code,details:statusObject.details,metadata:statusObject.metadata})})}cancelWithStatus(status,details){this.trace("cancelWithStatus code: "+status+' details: "'+details+'"'),this.reportStatus({code:status,details,metadata:new metadata_1.Metadata});for(let{call}of this.underlyingCalls)call.cancelWithStatus(status,details)}getPeer(){return this.committedCallIndex!==null?this.underlyingCalls[this.committedCallIndex].call.getPeer():"unknown"}getBufferEntry(messageIndex){var _a;return(_a=this.writeBuffer[messageIndex-this.writeBufferOffset])!==null&&_a!==void 0?_a:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if(this.state!=="COMMITTED")return;let earliestNeededMessageIndex=this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let messageIndex=this.writeBufferOffset;messageIndexmostMessages&&(mostMessages=childCall.nextMessageToSend,callWithMostMessages=index);callWithMostMessages===-1?this.state="TRANSPARENT_ONLY":this.commitCall(callWithMostMessages)}isStatusCodeInList(list,code){return list.some(value=>value===code||value.toString().toLowerCase()===constants_1.Status[code].toLowerCase())}getNextRetryBackoffMs(){var _a;let retryPolicy=(_a=this.callConfig)===null||_a===void 0?void 0:_a.methodConfig.retryPolicy;if(!retryPolicy)return 0;let nextBackoffMs=Math.random()*this.nextRetryBackoffSec*1e3,maxBackoffSec=Number(retryPolicy.maxBackoff.substring(0,retryPolicy.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*retryPolicy.backoffMultiplier,maxBackoffSec),nextBackoffMs}maybeRetryCall(pushback,callback){if(this.state!=="RETRY"){callback(!1);return}let retryPolicy=this.callConfig.methodConfig.retryPolicy;if(this.attempts>=Math.min(retryPolicy.maxAttempts,5)){callback(!1);return}let retryDelayMs;if(pushback===null)retryDelayMs=this.getNextRetryBackoffMs();else if(pushback<0){this.state="TRANSPARENT_ONLY",callback(!1);return}else retryDelayMs=pushback,this.nextRetryBackoffSec=this.initialRetryBackoffSec;setTimeout(()=>{var _a,_b;if(this.state!=="RETRY"){callback(!1);return}(!((_b=(_a=this.retryThrottler)===null||_a===void 0?void 0:_a.canRetryCall())!==null&&_b!==void 0)||_b)&&(callback(!0),this.attempts+=1,this.startNewAttempt())},retryDelayMs)}countActiveCalls(){let count=0;for(let call of this.underlyingCalls)call?.state==="ACTIVE"&&(count+=1);return count}handleProcessedStatus(status,callIndex,pushback){var _a,_b,_c;switch(this.state){case"COMMITTED":case"TRANSPARENT_ONLY":this.commitCall(callIndex),this.reportStatus(status);break;case"HEDGING":if(this.isStatusCodeInList((_a=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)!==null&&_a!==void 0?_a:[],status.code)){(_b=this.retryThrottler)===null||_b===void 0||_b.addCallFailed();let delayMs;if(pushback===null)delayMs=0;else if(pushback<0){this.state="TRANSPARENT_ONLY",this.commitCall(callIndex),this.reportStatus(status);return}else delayMs=pushback;setTimeout(()=>{this.maybeStartHedgingAttempt(),this.countActiveCalls()===0&&(this.commitCall(callIndex),this.reportStatus(status))},delayMs)}else this.commitCall(callIndex),this.reportStatus(status);break;case"RETRY":this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,status.code)?((_c=this.retryThrottler)===null||_c===void 0||_c.addCallFailed(),this.maybeRetryCall(pushback,retried=>{retried||(this.commitCall(callIndex),this.reportStatus(status))})):(this.commitCall(callIndex),this.reportStatus(status));break}}getPushback(metadata){let mdValue=metadata.get("grpc-retry-pushback-ms");if(mdValue.length===0)return null;try{return parseInt(mdValue[0])}catch{return-1}}handleChildStatus(status,callIndex){var _a;if(this.underlyingCalls[callIndex].state==="COMPLETED")return;if(this.trace("state="+this.state+" handling status with progress "+status.progress+" from child ["+this.underlyingCalls[callIndex].call.getCallNumber()+"] in state "+this.underlyingCalls[callIndex].state),this.underlyingCalls[callIndex].state="COMPLETED",status.code===constants_1.Status.OK){(_a=this.retryThrottler)===null||_a===void 0||_a.addCallSucceeded(),this.commitCall(callIndex),this.reportStatus(status);return}if(this.state==="COMMITTED"){this.reportStatus(status);return}let pushback=this.getPushback(status.metadata);switch(status.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":this.transparentRetryUsed?this.handleProcessedStatus(status,callIndex,pushback):(this.transparentRetryUsed=!0,this.startNewAttempt());break;case"DROP":this.commitCall(callIndex),this.reportStatus(status);break;case"PROCESSED":this.handleProcessedStatus(status,callIndex,pushback);break}}maybeStartHedgingAttempt(){if(this.state!=="HEDGING"||!this.callConfig.methodConfig.hedgingPolicy)return;let hedgingPolicy=this.callConfig.methodConfig.hedgingPolicy;this.attempts>=Math.min(hedgingPolicy.maxAttempts,5)||(this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer())}maybeStartHedgingTimer(){var _a,_b,_c;if(this.hedgingTimer&&clearTimeout(this.hedgingTimer),this.state!=="HEDGING"||!this.callConfig.methodConfig.hedgingPolicy)return;let hedgingPolicy=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=Math.min(hedgingPolicy.maxAttempts,5))return;let hedgingDelayString=(_a=hedgingPolicy.hedgingDelay)!==null&&_a!==void 0?_a:"0s",hedgingDelaySec=Number(hedgingDelayString.substring(0,hedgingDelayString.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},hedgingDelaySec*1e3),(_c=(_b=this.hedgingTimer).unref)===null||_c===void 0||_c.call(_b)}startNewAttempt(){let child=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline);this.trace("Created child call ["+child.getCallNumber()+"] for attempt "+this.attempts);let index=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:child,nextMessageToSend:0,startTime:new Date});let previousAttempts=this.attempts-1,initialMetadata=this.initialMetadata.clone();previousAttempts>0&&initialMetadata.set(PREVIONS_RPC_ATTEMPTS_METADATA_KEY,`${previousAttempts}`);let receivedMetadata=!1;child.start(initialMetadata,{onReceiveMetadata:metadata=>{this.trace("Received metadata from child ["+child.getCallNumber()+"]"),this.commitCall(index),receivedMetadata=!0,previousAttempts>0&&metadata.set(PREVIONS_RPC_ATTEMPTS_METADATA_KEY,`${previousAttempts}`),this.underlyingCalls[index].state==="ACTIVE"&&this.listener.onReceiveMetadata(metadata)},onReceiveMessage:message=>{this.trace("Received message from child ["+child.getCallNumber()+"]"),this.commitCall(index),this.underlyingCalls[index].state==="ACTIVE"&&this.listener.onReceiveMessage(message)},onReceiveStatus:status=>{this.trace("Received status from child ["+child.getCallNumber()+"]"),!receivedMetadata&&previousAttempts>0&&status.metadata.set(PREVIONS_RPC_ATTEMPTS_METADATA_KEY,`${previousAttempts}`),this.handleChildStatus(status,index)}}),this.sendNextChildMessage(index),this.readStarted&&child.startRead()}start(metadata,listener){this.trace("start called"),this.listener=listener,this.initialMetadata=metadata,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(childIndex){var _a,_b;let childCall=this.underlyingCalls[childIndex],messageIndex=childCall.nextMessageToSend;(_b=(_a=this.getBufferEntry(messageIndex)).callback)===null||_b===void 0||_b.call(_a),this.clearSentMessages(),childCall.nextMessageToSend+=1,this.sendNextChildMessage(childIndex)}sendNextChildMessage(childIndex){let childCall=this.underlyingCalls[childIndex];if(childCall.state!=="COMPLETED"&&this.getBufferEntry(childCall.nextMessageToSend)){let bufferEntry=this.getBufferEntry(childCall.nextMessageToSend);switch(bufferEntry.entryType){case"MESSAGE":childCall.call.sendMessageWithContext({callback:error=>{this.handleChildWriteCompleted(childIndex)}},bufferEntry.message.message);break;case"HALF_CLOSE":childCall.nextMessageToSend+=1,childCall.call.halfClose();break;case"FREED":break}}}sendMessageWithContext(context,message){var _a;this.trace("write() called with message of length "+message.length);let writeObj={message,flags:context.flags},messageIndex=this.getNextBufferIndex(),bufferEntry={entryType:"MESSAGE",message:writeObj,allocated:this.bufferTracker.allocate(message.length,this.callNumber)};if(this.writeBuffer.push(bufferEntry),bufferEntry.allocated){(_a=context.callback)===null||_a===void 0||_a.call(context);for(let[callIndex,call]of this.underlyingCalls.entries())call.state==="ACTIVE"&&call.nextMessageToSend===messageIndex&&call.call.sendMessageWithContext({callback:error=>{this.handleChildWriteCompleted(callIndex)}},message)}else{if(this.commitCallWithMostMessages(),this.committedCallIndex===null)return;let call=this.underlyingCalls[this.committedCallIndex];bufferEntry.callback=context.callback,call.state==="ACTIVE"&&call.nextMessageToSend===messageIndex&&call.call.sendMessageWithContext({callback:error=>{this.handleChildWriteCompleted(this.committedCallIndex)}},message)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(let underlyingCall of this.underlyingCalls)underlyingCall?.state==="ACTIVE"&&underlyingCall.call.startRead()}halfClose(){this.trace("halfClose called");let halfCloseIndex=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(let call of this.underlyingCalls)call?.state==="ACTIVE"&&call.nextMessageToSend===halfCloseIndex&&(call.nextMessageToSend+=1,call.call.halfClose())}setCredentials(newCredentials){throw new Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}};__name(RetryingCall,"RetryingCall");exports2.RetryingCall=RetryingCall}});var require_subchannel_interface=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/subchannel-interface.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.BaseSubchannelWrapper=void 0;var BaseSubchannelWrapper=class{constructor(child){this.child=child,this.healthy=!0,this.healthListeners=new Set,child.addHealthStateWatcher(childHealthy=>{this.healthy&&this.updateHealthListeners()})}updateHealthListeners(){for(let listener of this.healthListeners)listener(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(listener){this.child.addConnectivityStateListener(listener)}removeConnectivityStateListener(listener){this.child.removeConnectivityStateListener(listener)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(newKeepaliveTime){this.child.throttleKeepalive(newKeepaliveTime)}ref(){this.child.ref()}unref(){this.child.unref()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(listener){this.healthListeners.add(listener)}removeHealthStateWatcher(listener){this.healthListeners.delete(listener)}setHealthy(healthy){healthy!==this.healthy&&(this.healthy=healthy,this.child.isHealthy()&&this.updateHealthListeners())}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(other){return this.getRealSubchannel()===other.getRealSubchannel()}};__name(BaseSubchannelWrapper,"BaseSubchannelWrapper");exports2.BaseSubchannelWrapper=BaseSubchannelWrapper}});var require_internal_channel=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/internal-channel.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.InternalChannel=void 0;var channel_credentials_1=require_channel_credentials(),resolving_load_balancer_1=require_resolving_load_balancer(),subchannel_pool_1=require_subchannel_pool(),picker_1=require_picker(),constants_1=require_constants(),filter_stack_1=require_filter_stack(),compression_filter_1=require_compression_filter(),resolver_1=require_resolver(),logging_1=require_logging(),http_proxy_1=require_http_proxy(),uri_parser_1=require_uri_parser(),connectivity_state_1=require_connectivity_state(),channelz_1=require_channelz(),load_balancing_call_1=require_load_balancing_call(),deadline_1=require_deadline(),resolving_call_1=require_resolving_call(),call_number_1=require_call_number(),control_plane_status_1=require_control_plane_status(),retrying_call_1=require_retrying_call(),subchannel_interface_1=require_subchannel_interface(),MAX_TIMEOUT_TIME=2147483647,MIN_IDLE_TIMEOUT_MS=1e3,DEFAULT_IDLE_TIMEOUT_MS=30*60*1e3,RETRY_THROTTLER_MAP=new Map,DEFAULT_RETRY_BUFFER_SIZE_BYTES=1<<24,DEFAULT_PER_RPC_RETRY_BUFFER_SIZE_BYTES=1<<20,ChannelSubchannelWrapper=class extends subchannel_interface_1.BaseSubchannelWrapper{constructor(childSubchannel,channel){super(childSubchannel),this.channel=channel,this.refCount=0,this.subchannelStateListener=(subchannel,previousState,newState,keepaliveTime)=>{channel.throttleKeepalive(keepaliveTime)},childSubchannel.addConnectivityStateListener(this.subchannelStateListener)}ref(){this.child.ref(),this.refCount+=1}unref(){this.child.unref(),this.refCount-=1,this.refCount<=0&&(this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this))}};__name(ChannelSubchannelWrapper,"ChannelSubchannelWrapper");var InternalChannel=class{constructor(target,credentials,options){var _a,_b,_c,_d,_e,_f,_g,_h;if(this.credentials=credentials,this.options=options,this.connectivityState=connectivity_state_1.ConnectivityState.IDLE,this.currentPicker=new picker_1.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.configSelector=null,this.currentResolutionError=null,this.wrappedSubchannels=new Set,this.callCount=0,this.idleTimer=null,this.channelzEnabled=!0,this.callTracker=new channelz_1.ChannelzCallTracker,this.childrenTracker=new channelz_1.ChannelzChildrenTracker,this.randomChannelId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),typeof target!="string")throw new TypeError("Channel target must be a string");if(!(credentials instanceof channel_credentials_1.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(options&&typeof options!="object")throw new TypeError("Channel options must be an object");this.originalTarget=target;let originalTargetUri=(0,uri_parser_1.parseUri)(target);if(originalTargetUri===null)throw new Error(`Could not parse target name "${target}"`);let defaultSchemeMapResult=(0,resolver_1.mapUriDefaultScheme)(originalTargetUri);if(defaultSchemeMapResult===null)throw new Error(`Could not find a default scheme for target name "${target}"`);this.callRefTimer=setInterval(()=>{},MAX_TIMEOUT_TIME),(_b=(_a=this.callRefTimer).unref)===null||_b===void 0||_b.call(_a),this.options["grpc.enable_channelz"]===0&&(this.channelzEnabled=!1),this.channelzTrace=new channelz_1.ChannelzTrace,this.channelzRef=(0,channelz_1.registerChannelzChannel)(target,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Channel created"),this.options["grpc.default_authority"]?this.defaultAuthority=this.options["grpc.default_authority"]:this.defaultAuthority=(0,resolver_1.getDefaultAuthority)(defaultSchemeMapResult);let proxyMapResult=(0,http_proxy_1.mapProxyName)(defaultSchemeMapResult,options);this.target=proxyMapResult.target,this.options=Object.assign({},this.options,proxyMapResult.extraOptions),this.subchannelPool=(0,subchannel_pool_1.getSubchannelPool)(((_c=options["grpc.use_local_subchannel_pool"])!==null&&_c!==void 0?_c:0)===0),this.retryBufferTracker=new retrying_call_1.MessageBufferTracker((_d=options["grpc.retry_buffer_size"])!==null&&_d!==void 0?_d:DEFAULT_RETRY_BUFFER_SIZE_BYTES,(_e=options["grpc.per_rpc_retry_buffer_size"])!==null&&_e!==void 0?_e:DEFAULT_PER_RPC_RETRY_BUFFER_SIZE_BYTES),this.keepaliveTime=(_f=options["grpc.keepalive_time_ms"])!==null&&_f!==void 0?_f:-1,this.idleTimeoutMs=Math.max((_g=options["grpc.client_idle_timeout_ms"])!==null&&_g!==void 0?_g:DEFAULT_IDLE_TIMEOUT_MS,MIN_IDLE_TIMEOUT_MS);let channelControlHelper={createSubchannel:(subchannelAddress,subchannelArgs)=>{let subchannel=this.subchannelPool.getOrCreateSubchannel(this.target,subchannelAddress,Object.assign({},this.options,subchannelArgs),this.credentials);subchannel.throttleKeepalive(this.keepaliveTime),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Created subchannel or used existing subchannel",subchannel.getChannelzRef());let wrappedSubchannel=new ChannelSubchannelWrapper(subchannel,this);return this.wrappedSubchannels.add(wrappedSubchannel),wrappedSubchannel},updateState:(connectivityState,picker)=>{this.currentPicker=picker;let queueCopy=this.pickQueue.slice();this.pickQueue=[],queueCopy.length>0&&this.callRefTimerUnref();for(let call of queueCopy)call.doPick();this.updateState(connectivityState)},requestReresolution:()=>{throw new Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:child=>{this.channelzEnabled&&this.childrenTracker.refChild(child)},removeChannelzChild:child=>{this.channelzEnabled&&this.childrenTracker.unrefChild(child)}};this.resolvingLoadBalancer=new resolving_load_balancer_1.ResolvingLoadBalancer(this.target,channelControlHelper,options,(serviceConfig,configSelector)=>{serviceConfig.retryThrottling?RETRY_THROTTLER_MAP.set(this.getTarget(),new retrying_call_1.RetryThrottler(serviceConfig.retryThrottling.maxTokens,serviceConfig.retryThrottling.tokenRatio,RETRY_THROTTLER_MAP.get(this.getTarget()))):RETRY_THROTTLER_MAP.delete(this.getTarget()),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Address resolution succeeded"),this.configSelector=configSelector,this.currentResolutionError=null,process.nextTick(()=>{let localQueue=this.configSelectionQueue;this.configSelectionQueue=[],localQueue.length>0&&this.callRefTimerUnref();for(let call of localQueue)call.getConfig()})},status=>{this.channelzEnabled&&this.channelzTrace.addTrace("CT_WARNING","Address resolution failed with code "+status.code+' and details "'+status.details+'"'),this.configSelectionQueue.length>0&&this.trace("Name resolution failed with calls queued for config selection"),this.configSelector===null&&(this.currentResolutionError=Object.assign(Object.assign({},(0,control_plane_status_1.restrictControlPlaneStatusCode)(status.code,status.details)),{metadata:status.metadata}));let localQueue=this.configSelectionQueue;this.configSelectionQueue=[],localQueue.length>0&&this.callRefTimerUnref();for(let call of localQueue)call.reportResolverError(status)}),this.filterStackFactory=new filter_stack_1.FilterStackFactory([new compression_filter_1.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(options,void 0,2));let error=new Error;(0,logging_1.trace)(constants_1.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+`) Channel constructed `+((_h=error.stack)===null||_h===void 0?void 0:_h.substring(error.stack.indexOf(` `)+1))),this.lastActivityTimestamp=new Date}getChannelzInfo(){return{target:this.originalTarget,state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}}trace(text,verbosityOverride){(0,logging_1.trace)(verbosityOverride??constants_1.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,uri_parser_1.uriToString)(this.target)+" "+text)}callRefTimerRef(){var _a,_b,_c,_d;!((_b=(_a=this.callRefTimer).hasRef)===null||_b===void 0)&&_b.call(_a)||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(_d=(_c=this.callRefTimer).ref)===null||_d===void 0||_d.call(_c))}callRefTimerUnref(){var _a,_b;(!this.callRefTimer.hasRef||this.callRefTimer.hasRef())&&(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(_b=(_a=this.callRefTimer).unref)===null||_b===void 0||_b.call(_a))}removeConnectivityStateWatcher(watcherObject){let watcherIndex=this.connectivityStateWatchers.findIndex(value=>value===watcherObject);watcherIndex>=0&&this.connectivityStateWatchers.splice(watcherIndex,1)}updateState(newState){(0,logging_1.trace)(constants_1.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,uri_parser_1.uriToString)(this.target)+" "+connectivity_state_1.ConnectivityState[this.connectivityState]+" -> "+connectivity_state_1.ConnectivityState[newState]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+connectivity_state_1.ConnectivityState[newState]),this.connectivityState=newState;let watchersCopy=this.connectivityStateWatchers.slice();for(let watcherObject of watchersCopy)newState!==watcherObject.currentState&&(watcherObject.timer&&clearTimeout(watcherObject.timer),this.removeConnectivityStateWatcher(watcherObject),watcherObject.callback());newState!==connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(newKeepaliveTime){if(newKeepaliveTime>this.keepaliveTime){this.keepaliveTime=newKeepaliveTime;for(let wrappedSubchannel of this.wrappedSubchannels)wrappedSubchannel.throttleKeepalive(newKeepaliveTime)}}removeWrappedSubchannel(wrappedSubchannel){this.wrappedSubchannels.delete(wrappedSubchannel)}doPick(metadata,extraPickInfo){return this.currentPicker.pick({metadata,extraPickInfo})}queueCallForPick(call){this.pickQueue.push(call),this.callRefTimerRef()}getConfig(method,metadata){return this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector(method,metadata,this.randomChannelId)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(call){this.configSelectionQueue.push(call),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState(connectivity_state_1.ConnectivityState.IDLE),this.currentPicker=new picker_1.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null)}startIdleTimeout(timeoutMs){var _a,_b;this.idleTimer=setTimeout(()=>{if(this.callCount>0){this.startIdleTimeout(this.idleTimeoutMs);return}let timeSinceLastActivity=new Date().valueOf()-this.lastActivityTimestamp.valueOf();timeSinceLastActivity>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-timeSinceLastActivity)},timeoutMs),(_b=(_a=this.idleTimer).unref)===null||_b===void 0||_b.call(_a)}maybeStartIdleTimer(){this.connectivityState!==connectivity_state_1.ConnectivityState.SHUTDOWN&&!this.idleTimer&&this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(status){this.channelzEnabled&&(status.code===constants_1.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(callConfig,method,host,credentials,deadline){let callNumber=(0,call_number_1.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+callNumber+'] method="'+method+'"'),new load_balancing_call_1.LoadBalancingCall(this,callConfig,method,host,credentials,deadline,callNumber)}createRetryingCall(callConfig,method,host,credentials,deadline){let callNumber=(0,call_number_1.getNextCallNumber)();return this.trace("createRetryingCall ["+callNumber+'] method="'+method+'"'),new retrying_call_1.RetryingCall(this,callConfig,method,host,credentials,deadline,callNumber,this.retryBufferTracker,RETRY_THROTTLER_MAP.get(this.getTarget()))}createInnerCall(callConfig,method,host,credentials,deadline){return this.options["grpc.enable_retries"]===0?this.createLoadBalancingCall(callConfig,method,host,credentials,deadline):this.createRetryingCall(callConfig,method,host,credentials,deadline)}createResolvingCall(method,deadline,host,parentCall,propagateFlags){let callNumber=(0,call_number_1.getNextCallNumber)();this.trace("createResolvingCall ["+callNumber+'] method="'+method+'", deadline='+(0,deadline_1.deadlineToString)(deadline));let finalOptions={deadline,flags:propagateFlags??constants_1.Propagate.DEFAULTS,host:host??this.defaultAuthority,parentCall},call=new resolving_call_1.ResolvingCall(this,method,finalOptions,this.filterStackFactory.clone(),this.credentials._getCallCredentials(),callNumber);return this.onCallStart(),call.addStatusWatcher(status=>{this.onCallEnd(status)}),call}close(){this.resolvingLoadBalancer.destroy(),this.updateState(connectivity_state_1.ConnectivityState.SHUTDOWN),clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,channelz_1.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels()}getTarget(){return(0,uri_parser_1.uriToString)(this.target)}getConnectivityState(tryToConnect){let connectivityState=this.connectivityState;return tryToConnect&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()),connectivityState}watchConnectivityState(currentState,deadline,callback){if(this.connectivityState===connectivity_state_1.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let timer=null;if(deadline!==1/0){let deadlineDate=deadline instanceof Date?deadline:new Date(deadline),now=new Date;if(deadline===-1/0||deadlineDate<=now){process.nextTick(callback,new Error("Deadline passed without connectivity state change"));return}timer=setTimeout(()=>{this.removeConnectivityStateWatcher(watcherObject),callback(new Error("Deadline passed without connectivity state change"))},deadlineDate.getTime()-now.getTime())}let watcherObject={currentState,callback,timer};this.connectivityStateWatchers.push(watcherObject)}getChannelzRef(){return this.channelzRef}createCall(method,deadline,host,parentCall,propagateFlags){if(typeof method!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof deadline=="number"||deadline instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===connectivity_state_1.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(method,deadline,host,parentCall,propagateFlags)}};__name(InternalChannel,"InternalChannel");exports2.InternalChannel=InternalChannel}});var require_channel=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/channel.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.ChannelImplementation=void 0;var channel_credentials_1=require_channel_credentials(),internal_channel_1=require_internal_channel(),ChannelImplementation=class{constructor(target,credentials,options){if(typeof target!="string")throw new TypeError("Channel target must be a string");if(!(credentials instanceof channel_credentials_1.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(options&&typeof options!="object")throw new TypeError("Channel options must be an object");this.internalChannel=new internal_channel_1.InternalChannel(target,credentials,options)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(tryToConnect){return this.internalChannel.getConnectivityState(tryToConnect)}watchConnectivityState(currentState,deadline,callback){this.internalChannel.watchConnectivityState(currentState,deadline,callback)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(method,deadline,host,parentCall,propagateFlags){if(typeof method!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof deadline=="number"||deadline instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(method,deadline,host,parentCall,propagateFlags)}};__name(ChannelImplementation,"ChannelImplementation");exports2.ChannelImplementation=ChannelImplementation}});var require_server_call=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/server-call.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.ServerDuplexStreamImpl=exports2.ServerWritableStreamImpl=exports2.ServerReadableStreamImpl=exports2.ServerUnaryCallImpl=exports2.serverErrorToStatus=void 0;var events_1=require("events"),stream_1=require("stream"),constants_1=require_constants(),metadata_1=require_metadata();function serverErrorToStatus(error,overrideTrailers){var _a;let status={code:constants_1.Status.UNKNOWN,details:"message"in error?error.message:"Unknown Error",metadata:(_a=overrideTrailers??error.metadata)!==null&&_a!==void 0?_a:null};return"code"in error&&typeof error.code=="number"&&Number.isInteger(error.code)&&(status.code=error.code,"details"in error&&typeof error.details=="string"&&(status.details=error.details)),status}__name(serverErrorToStatus,"serverErrorToStatus");exports2.serverErrorToStatus=serverErrorToStatus;var ServerUnaryCallImpl=class extends events_1.EventEmitter{constructor(path,call,metadata,request){super(),this.path=path,this.call=call,this.metadata=metadata,this.request=request,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(responseMetadata){this.call.sendMetadata(responseMetadata)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}};__name(ServerUnaryCallImpl,"ServerUnaryCallImpl");exports2.ServerUnaryCallImpl=ServerUnaryCallImpl;var ServerReadableStreamImpl=class extends stream_1.Readable{constructor(path,call,metadata){super({objectMode:!0}),this.path=path,this.call=call,this.metadata=metadata,this.cancelled=!1}_read(size){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(responseMetadata){this.call.sendMetadata(responseMetadata)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}};__name(ServerReadableStreamImpl,"ServerReadableStreamImpl");exports2.ServerReadableStreamImpl=ServerReadableStreamImpl;var ServerWritableStreamImpl=class extends stream_1.Writable{constructor(path,call,metadata,request){super({objectMode:!0}),this.path=path,this.call=call,this.metadata=metadata,this.request=request,this.pendingStatus={code:constants_1.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new metadata_1.Metadata,this.on("error",err=>{this.pendingStatus=serverErrorToStatus(err),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(responseMetadata){this.call.sendMetadata(responseMetadata)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}_write(chunk,encoding,callback){this.call.sendMessage(chunk,callback)}_final(callback){var _a;callback(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(_a=this.pendingStatus.metadata)!==null&&_a!==void 0?_a:this.trailingMetadata}))}end(metadata){return metadata&&(this.trailingMetadata=metadata),super.end()}};__name(ServerWritableStreamImpl,"ServerWritableStreamImpl");exports2.ServerWritableStreamImpl=ServerWritableStreamImpl;var ServerDuplexStreamImpl=class extends stream_1.Duplex{constructor(path,call,metadata){super({objectMode:!0}),this.path=path,this.call=call,this.metadata=metadata,this.pendingStatus={code:constants_1.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new metadata_1.Metadata,this.on("error",err=>{this.pendingStatus=serverErrorToStatus(err),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(responseMetadata){this.call.sendMetadata(responseMetadata)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}_read(size){this.call.startRead()}_write(chunk,encoding,callback){this.call.sendMessage(chunk,callback)}_final(callback){var _a;callback(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(_a=this.pendingStatus.metadata)!==null&&_a!==void 0?_a:this.trailingMetadata}))}end(metadata){return metadata&&(this.trailingMetadata=metadata),super.end()}};__name(ServerDuplexStreamImpl,"ServerDuplexStreamImpl");exports2.ServerDuplexStreamImpl=ServerDuplexStreamImpl}});var require_server_credentials=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/server-credentials.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.ServerCredentials=void 0;var tls_helpers_1=require_tls_helpers(),ServerCredentials=class{static createInsecure(){return new InsecureServerCredentials}static createSsl(rootCerts,keyCertPairs,checkClientCertificate=!1){var _a;if(rootCerts!==null&&!Buffer.isBuffer(rootCerts))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(keyCertPairs))throw new TypeError("keyCertPairs must be an array");if(typeof checkClientCertificate!="boolean")throw new TypeError("checkClientCertificate must be a boolean");let cert=[],key=[];for(let i=0;i{this.processingMetadata=!1,!this.cancelled&&(this.nextListener.onReceiveMetadata(interceptedMetadata),this.processPendingMessage(),this.processPendingHalfClose())}))}onReceiveMessage(message){this.cancelled||(this.processingMessage=!0,this.listener.onReceiveMessage(message,msg=>{this.processingMessage=!1,!this.cancelled&&(this.processingMetadata?(this.pendingMessage=msg,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(msg),this.processPendingHalfClose()))}))}onReceiveHalfClose(){this.cancelled||this.listener.onReceiveHalfClose(()=>{this.cancelled||(this.processingMetadata||this.processingMessage?this.hasPendingHalfClose=!0:this.nextListener.onReceiveHalfClose())})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}};__name(InterceptingServerListenerImpl,"InterceptingServerListenerImpl");var ResponderBuilder=class{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(start){return this.start=start,this}withSendMetadata(sendMetadata){return this.metadata=sendMetadata,this}withSendMessage(sendMessage){return this.message=sendMessage,this}withSendStatus(sendStatus){return this.status=sendStatus,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}};__name(ResponderBuilder,"ResponderBuilder");exports2.ResponderBuilder=ResponderBuilder;var defaultServerListener={onReceiveMetadata:(metadata,next)=>{next(metadata)},onReceiveMessage:(message,next)=>{next(message)},onReceiveHalfClose:next=>{next()},onCancel:()=>{}},defaultResponder={start:next=>{next()},sendMetadata:(metadata,next)=>{next(metadata)},sendMessage:(message,next)=>{next(message)},sendStatus:(status,next)=>{next(status)}},ServerInterceptingCall=class{constructor(nextCall,responder){var _a,_b,_c,_d;this.nextCall=nextCall,this.processingMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:(_a=responder?.start)!==null&&_a!==void 0?_a:defaultResponder.start,sendMetadata:(_b=responder?.sendMetadata)!==null&&_b!==void 0?_b:defaultResponder.sendMetadata,sendMessage:(_c=responder?.sendMessage)!==null&&_c!==void 0?_c:defaultResponder.sendMessage,sendStatus:(_d=responder?.sendStatus)!==null&&_d!==void 0?_d:defaultResponder.sendStatus}}processPendingMessage(){this.pendingMessageCallback&&(this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null)}processPendingStatus(){this.pendingStatus&&(this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null)}start(listener){this.responder.start(interceptedListener=>{var _a,_b,_c,_d;let fullInterceptedListener={onReceiveMetadata:(_a=interceptedListener?.onReceiveMetadata)!==null&&_a!==void 0?_a:defaultServerListener.onReceiveMetadata,onReceiveMessage:(_b=interceptedListener?.onReceiveMessage)!==null&&_b!==void 0?_b:defaultServerListener.onReceiveMessage,onReceiveHalfClose:(_c=interceptedListener?.onReceiveHalfClose)!==null&&_c!==void 0?_c:defaultServerListener.onReceiveHalfClose,onCancel:(_d=interceptedListener?.onCancel)!==null&&_d!==void 0?_d:defaultServerListener.onCancel},finalInterceptingListener=new InterceptingServerListenerImpl(fullInterceptedListener,listener);this.nextCall.start(finalInterceptingListener)})}sendMetadata(metadata){this.processingMetadata=!0,this.responder.sendMetadata(metadata,interceptedMetadata=>{this.processingMetadata=!1,this.nextCall.sendMetadata(interceptedMetadata),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(message,callback){this.processingMessage=!0,this.responder.sendMessage(message,interceptedMessage=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=interceptedMessage,this.pendingMessageCallback=callback):this.nextCall.sendMessage(interceptedMessage,callback)})}sendStatus(status){this.responder.sendStatus(status,interceptedStatus=>{this.processingMetadata||this.processingMessage?this.pendingStatus=interceptedStatus:this.nextCall.sendStatus(interceptedStatus)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}};__name(ServerInterceptingCall,"ServerInterceptingCall");exports2.ServerInterceptingCall=ServerInterceptingCall;var GRPC_ACCEPT_ENCODING_HEADER="grpc-accept-encoding",GRPC_ENCODING_HEADER="grpc-encoding",GRPC_MESSAGE_HEADER="grpc-message",GRPC_STATUS_HEADER="grpc-status",GRPC_TIMEOUT_HEADER="grpc-timeout",DEADLINE_REGEX=/(\d{1,8})\s*([HMSmun])/,deadlineUnitsToMs={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},defaultCompressionHeaders={[GRPC_ACCEPT_ENCODING_HEADER]:"identity,deflate,gzip",[GRPC_ENCODING_HEADER]:"identity"},defaultResponseHeaders={[http2.constants.HTTP2_HEADER_STATUS]:http2.constants.HTTP_STATUS_OK,[http2.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},defaultResponseOptions={waitForTrailers:!0},BaseServerInterceptingCall=class{constructor(stream,headers,callEventTracker,handler,options){this.stream=stream,this.callEventTracker=callEventTracker,this.handler=handler,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=constants_1.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=constants_1.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.stream.once("error",err=>{}),this.stream.once("close",()=>{var _a;trace("Request to method "+((_a=this.handler)===null||_a===void 0?void 0:_a.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:constants_1.Status.CANCELLED,details:"Stream closed before sending status",metadata:null})),this.notifyOnCancel()}),this.stream.on("data",data=>{this.handleDataFrame(data)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in options&&(this.maxSendMessageSize=options["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in options&&(this.maxReceiveMessageSize=options["grpc.max_receive_message_length"]),this.decoder=new stream_decoder_1.StreamDecoder(this.maxReceiveMessageSize);let metadata=metadata_1.Metadata.fromHttp2Headers(headers);logging.isTracerEnabled(TRACER_NAME)&&trace("Request to "+this.handler.path+" received headers "+JSON.stringify(metadata.toJSON()));let timeoutHeader=metadata.get(GRPC_TIMEOUT_HEADER);timeoutHeader.length>0&&this.handleTimeoutHeader(timeoutHeader[0]);let encodingHeader=metadata.get(GRPC_ENCODING_HEADER);encodingHeader.length>0&&(this.incomingEncoding=encodingHeader[0]),metadata.remove(GRPC_TIMEOUT_HEADER),metadata.remove(GRPC_ENCODING_HEADER),metadata.remove(GRPC_ACCEPT_ENCODING_HEADER),metadata.remove(http2.constants.HTTP2_HEADER_ACCEPT_ENCODING),metadata.remove(http2.constants.HTTP2_HEADER_TE),metadata.remove(http2.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=metadata}handleTimeoutHeader(timeoutHeader){let match=timeoutHeader.toString().match(DEADLINE_REGEX);if(match===null){let status={code:constants_1.Status.INTERNAL,details:`Invalid ${GRPC_TIMEOUT_HEADER} value "${timeoutHeader}"`,metadata:null};process.nextTick(()=>{this.sendStatus(status)});return}let timeout=+match[1]*deadlineUnitsToMs[match[2]]|0,now=new Date;this.deadline=now.setMilliseconds(now.getMilliseconds()+timeout),this.deadlineTimer=setTimeout(()=>{let status={code:constants_1.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(status)},timeout)}checkCancelled(){return!this.cancelled&&(this.stream.destroyed||this.stream.closed)&&(this.notifyOnCancel(),this.cancelled=!0),this.cancelled}notifyOnCancel(){this.cancelNotified||(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(){this.metadataSent||this.sendMetadata(new metadata_1.Metadata)}serializeMessage(value){let messageBuffer=this.handler.serialize(value),byteLength=messageBuffer.byteLength,output=Buffer.allocUnsafe(byteLength+5);return output.writeUInt8(0,0),output.writeUInt32BE(byteLength,1),messageBuffer.copy(output,5),output}decompressMessage(message,encoding){let messageContents=message.subarray(5);if(encoding==="identity")return messageContents;if(encoding==="deflate"||encoding==="gzip"){let decompresser;return encoding==="deflate"?decompresser=zlib.createInflate():decompresser=zlib.createGunzip(),new Promise((resolve,reject)=>{let totalLength=0,messageParts=[];decompresser.on("data",chunk=>{messageParts.push(chunk),totalLength+=chunk.byteLength,this.maxReceiveMessageSize!==-1&&totalLength>this.maxReceiveMessageSize&&(decompresser.destroy(),reject({code:constants_1.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`}))}),decompresser.on("end",()=>{resolve(Buffer.concat(messageParts))}),decompresser.write(messageContents),decompresser.end()})}else return Promise.reject({code:constants_1.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${encoding}"`})}async decompressAndMaybePush(queueEntry){if(queueEntry.type!=="COMPRESSED")throw new Error(`Invalid queue entry type: ${queueEntry.type}`);let compressedMessageEncoding=queueEntry.compressedMessage.readUInt8(0)===1?this.incomingEncoding:"identity",decompressedMessage;try{decompressedMessage=await this.decompressMessage(queueEntry.compressedMessage,compressedMessageEncoding)}catch(err){this.sendStatus(err);return}try{queueEntry.parsedMessage=this.handler.deserialize(decompressedMessage)}catch(err){this.sendStatus({code:constants_1.Status.INTERNAL,details:`Error deserializing request: ${err.message}`});return}queueEntry.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&this.readQueue[0].type!=="COMPRESSED"){this.isReadPending=!1;let nextQueueEntry=this.readQueue.shift();nextQueueEntry.type==="READABLE"?this.listener.onReceiveMessage(nextQueueEntry.parsedMessage):this.listener.onReceiveHalfClose()}}handleDataFrame(data){var _a;if(this.checkCancelled())return;trace("Request to "+this.handler.path+" received data frame of size "+data.length);let rawMessages;try{rawMessages=this.decoder.write(data)}catch(e){this.sendStatus({code:constants_1.Status.RESOURCE_EXHAUSTED,details:e.message});return}for(let messageBytes of rawMessages){this.stream.pause();let queueEntry={type:"COMPRESSED",compressedMessage:messageBytes,parsedMessage:null};this.readQueue.push(queueEntry),this.decompressAndMaybePush(queueEntry),(_a=this.callEventTracker)===null||_a===void 0||_a.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(listener){trace("Request to "+this.handler.path+" start called"),!this.checkCancelled()&&(this.listener=listener,listener.onReceiveMetadata(this.metadata))}sendMetadata(metadata){if(this.checkCancelled()||this.metadataSent)return;this.metadataSent=!0;let custom=metadata?metadata.toHttp2Headers():null,headers=Object.assign(Object.assign(Object.assign({},defaultResponseHeaders),defaultCompressionHeaders),custom);this.stream.respond(headers,defaultResponseOptions)}sendMessage(message,callback){if(this.checkCancelled())return;let response;try{response=this.serializeMessage(message)}catch(e){this.sendStatus({code:constants_1.Status.INTERNAL,details:`Error serializing response: ${(0,error_1.getErrorMessage)(e)}`,metadata:null});return}if(this.maxSendMessageSize!==-1&&response.length-5>this.maxSendMessageSize){this.sendStatus({code:constants_1.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${response.length} vs. ${this.maxSendMessageSize})`,metadata:null});return}this.maybeSendMetadata(),trace("Request to "+this.handler.path+" sent data frame of size "+response.length),this.stream.write(response,error=>{var _a;if(error){this.sendStatus({code:constants_1.Status.INTERNAL,details:`Error writing message: ${(0,error_1.getErrorMessage)(error)}`,metadata:null});return}(_a=this.callEventTracker)===null||_a===void 0||_a.addMessageSent(),callback()})}sendStatus(status){var _a,_b;if(!this.checkCancelled())if(trace("Request to method "+((_a=this.handler)===null||_a===void 0?void 0:_a.path)+" ended with status code: "+constants_1.Status[status.code]+" details: "+status.details),this.metadataSent)this.wantTrailers?this.notifyOnCancel():(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{var _a2;this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(status));let trailersToSend=Object.assign({[GRPC_STATUS_HEADER]:status.code,[GRPC_MESSAGE_HEADER]:encodeURI(status.details)},(_a2=status.metadata)===null||_a2===void 0?void 0:_a2.toHttp2Headers());this.stream.sendTrailers(trailersToSend),this.notifyOnCancel()}),this.stream.end());else{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(status));let trailersToSend=Object.assign(Object.assign({[GRPC_STATUS_HEADER]:status.code,[GRPC_MESSAGE_HEADER]:encodeURI(status.details)},defaultResponseHeaders),(_b=status.metadata)===null||_b===void 0?void 0:_b.toHttp2Headers());this.stream.respond(trailersToSend,{endStream:!0}),this.notifyOnCancel()}}startRead(){trace("Request to "+this.handler.path+" startRead called"),!this.checkCancelled()&&(this.isReadPending=!0,this.readQueue.length===0?this.receivedHalfClose||this.stream.resume():this.maybePushNextMessage())}getPeer(){var _a;let socket=(_a=this.stream.session)===null||_a===void 0?void 0:_a.socket;return socket?.remoteAddress?socket.remotePort?`${socket.remoteAddress}:${socket.remotePort}`:socket.remoteAddress:"unknown"}getDeadline(){return this.deadline}};__name(BaseServerInterceptingCall,"BaseServerInterceptingCall");exports2.BaseServerInterceptingCall=BaseServerInterceptingCall;function getServerInterceptingCall(interceptors,stream,headers,callEventTracker,handler,options){let methodDefinition={path:handler.path,requestStream:handler.type==="clientStream"||handler.type==="bidi",responseStream:handler.type==="serverStream"||handler.type==="bidi",requestDeserialize:handler.deserialize,responseSerialize:handler.serialize},baseCall=new BaseServerInterceptingCall(stream,headers,callEventTracker,handler,options);return interceptors.reduce((call,interceptor)=>interceptor(methodDefinition,call),baseCall)}__name(getServerInterceptingCall,"getServerInterceptingCall");exports2.getServerInterceptingCall=getServerInterceptingCall}});var require_server=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/server.js"(exports2){"use strict";var __runInitializers=exports2&&exports2.__runInitializers||function(thisArg,initializers,value){for(var useValue=arguments.length>2,i=0;i=0;i--){var context={};for(var p in contextIn)context[p]=p==="access"?{}:contextIn[p];for(var p in contextIn.access)context.access[p]=contextIn.access[p];context.addInitializer=function(f){if(done)throw new TypeError("Cannot add initializers after decoration has completed");extraInitializers.push(accept(f||null))};var result=(0,decorators[i])(kind==="accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key],context);if(kind==="accessor"){if(result===void 0)continue;if(result===null||typeof result!="object")throw new TypeError("Object expected");(_=accept(result.get))&&(descriptor.get=_),(_=accept(result.set))&&(descriptor.set=_),(_=accept(result.init))&&initializers.unshift(_)}else(_=accept(result))&&(kind==="field"?initializers.unshift(_):descriptor[key]=_)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0};Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Server=void 0;var http2=require("http2"),util=require("util"),constants_1=require_constants(),server_call_1=require_server_call(),server_credentials_1=require_server_credentials(),resolver_1=require_resolver(),logging=require_logging(),subchannel_address_1=require_subchannel_address(),uri_parser_1=require_uri_parser(),channelz_1=require_channelz(),server_interceptors_1=require_server_interceptors(),UNLIMITED_CONNECTION_AGE_MS=~(1<<31),KEEPALIVE_MAX_TIME_MS=~(1<<31),KEEPALIVE_TIMEOUT_MS=2e4,MAX_CONNECTION_IDLE_MS=~(1<<31),{HTTP2_HEADER_PATH}=http2.constants,TRACER_NAME="server",kMaxAge=Buffer.from("max_age");function noop(){}__name(noop,"noop");function deprecate(message){return function(target,context){return util.deprecate(target,message)}}__name(deprecate,"deprecate");function getUnimplementedStatusResponse(methodName){return{code:constants_1.Status.UNIMPLEMENTED,details:`The server does not implement the method ${methodName}`}}__name(getUnimplementedStatusResponse,"getUnimplementedStatusResponse");function getDefaultHandler(handlerType,methodName){let unimplementedStatusResponse=getUnimplementedStatusResponse(methodName);switch(handlerType){case"unary":return(call,callback)=>{callback(unimplementedStatusResponse,null)};case"clientStream":return(call,callback)=>{callback(unimplementedStatusResponse,null)};case"serverStream":return call=>{call.emit("error",unimplementedStatusResponse)};case"bidi":return call=>{call.emit("error",unimplementedStatusResponse)};default:throw new Error(`Invalid handlerType ${handlerType}`)}}__name(getDefaultHandler,"getDefaultHandler");var Server=(()=>{var _a;let _instanceExtraInitializers=[],_start_decorators;return _a=__name(class{constructor(options){var _b,_c,_d,_e,_f,_g;this.boundPorts=(__runInitializers(this,_instanceExtraInitializers),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=options??{},this.options["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new channelz_1.ChannelzTraceStub,this.callTracker=new channelz_1.ChannelzCallTrackerStub,this.listenerChildrenTracker=new channelz_1.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new channelz_1.ChannelzChildrenTrackerStub):(this.channelzTrace=new channelz_1.ChannelzTrace,this.callTracker=new channelz_1.ChannelzCallTracker,this.listenerChildrenTracker=new channelz_1.ChannelzChildrenTracker,this.sessionChildrenTracker=new channelz_1.ChannelzChildrenTracker),this.channelzRef=(0,channelz_1.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=(_b=this.options["grpc.max_connection_age_ms"])!==null&&_b!==void 0?_b:UNLIMITED_CONNECTION_AGE_MS,this.maxConnectionAgeGraceMs=(_c=this.options["grpc.max_connection_age_grace_ms"])!==null&&_c!==void 0?_c:UNLIMITED_CONNECTION_AGE_MS,this.keepaliveTimeMs=(_d=this.options["grpc.keepalive_time_ms"])!==null&&_d!==void 0?_d:KEEPALIVE_MAX_TIME_MS,this.keepaliveTimeoutMs=(_e=this.options["grpc.keepalive_timeout_ms"])!==null&&_e!==void 0?_e:KEEPALIVE_TIMEOUT_MS,this.sessionIdleTimeout=(_f=this.options["grpc.max_connection_idle_ms"])!==null&&_f!==void 0?_f:MAX_CONNECTION_IDLE_MS,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"]:this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]}),this.interceptors=(_g=this.options.interceptors)!==null&&_g!==void 0?_g:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(session){var _b,_c,_d;let sessionInfo=this.sessions.get(session),sessionSocket=session.socket,remoteAddress=sessionSocket.remoteAddress?(0,subchannel_address_1.stringToSubchannelAddress)(sessionSocket.remoteAddress,sessionSocket.remotePort):null,localAddress=sessionSocket.localAddress?(0,subchannel_address_1.stringToSubchannelAddress)(sessionSocket.localAddress,sessionSocket.localPort):null,tlsInfo;if(session.encrypted){let tlsSocket=sessionSocket,cipherInfo=tlsSocket.getCipher(),certificate=tlsSocket.getCertificate(),peerCertificate=tlsSocket.getPeerCertificate();tlsInfo={cipherSuiteStandardName:(_b=cipherInfo.standardName)!==null&&_b!==void 0?_b:null,cipherSuiteOtherName:cipherInfo.standardName?null:cipherInfo.name,localCertificate:certificate&&"raw"in certificate?certificate.raw:null,remoteCertificate:peerCertificate&&"raw"in peerCertificate?peerCertificate.raw:null}}else tlsInfo=null;return{remoteAddress,localAddress,security:tlsInfo,remoteName:null,streamsStarted:sessionInfo.streamTracker.callsStarted,streamsSucceeded:sessionInfo.streamTracker.callsSucceeded,streamsFailed:sessionInfo.streamTracker.callsFailed,messagesSent:sessionInfo.messagesSent,messagesReceived:sessionInfo.messagesReceived,keepAlivesSent:sessionInfo.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:sessionInfo.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:sessionInfo.lastMessageSentTimestamp,lastMessageReceivedTimestamp:sessionInfo.lastMessageReceivedTimestamp,localFlowControlWindow:(_c=session.state.localWindowSize)!==null&&_c!==void 0?_c:null,remoteFlowControlWindow:(_d=session.state.remoteWindowSize)!==null&&_d!==void 0?_d:null}}trace(text){logging.trace(constants_1.LogVerbosity.DEBUG,TRACER_NAME,"("+this.channelzRef.id+") "+text)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(service,implementation){if(service===null||typeof service!="object"||implementation===null||typeof implementation!="object")throw new Error("addService() requires two objects as arguments");let serviceKeys=Object.keys(service);if(serviceKeys.length===0)throw new Error("Cannot add an empty service to a server");serviceKeys.forEach(name=>{let attrs=service[name],methodType;attrs.requestStream?attrs.responseStream?methodType="bidi":methodType="clientStream":attrs.responseStream?methodType="serverStream":methodType="unary";let implFn=implementation[name],impl;if(implFn===void 0&&typeof attrs.originalName=="string"&&(implFn=implementation[attrs.originalName]),implFn!==void 0?impl=implFn.bind(implementation):impl=getDefaultHandler(methodType,name),this.register(attrs.path,impl,attrs.responseSerialize,attrs.requestDeserialize,methodType)===!1)throw new Error(`Method handler for ${attrs.path} already provided.`)})}removeService(service){if(service===null||typeof service!="object")throw new Error("removeService() requires object as argument");Object.keys(service).forEach(name=>{let attrs=service[name];this.unregister(attrs.path)})}bind(port,creds){throw new Error("Not implemented. Use bindAsync() instead")}registerListenerToChannelz(boundAddress){return(0,channelz_1.registerChannelzSocket)((0,subchannel_address_1.subchannelAddressToString)(boundAddress),()=>({localAddress:boundAddress,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)}createHttp2Server(credentials){let http2Server;if(credentials._isSecure()){let secureServerOptions=Object.assign(this.commonServerOptions,credentials._getSettings());secureServerOptions.enableTrace=this.options["grpc-node.tls_enable_trace"]===1,http2Server=http2.createSecureServer(secureServerOptions),http2Server.on("secureConnection",socket=>{socket.on("error",e=>{this.trace("An incoming TLS connection closed with error: "+e.message)})})}else http2Server=http2.createServer(this.commonServerOptions);return http2Server.setTimeout(0,noop),this._setupHandlers(http2Server),http2Server}bindOneAddress(address,boundPortObject){this.trace("Attempting to bind "+(0,subchannel_address_1.subchannelAddressToString)(address));let http2Server=this.createHttp2Server(boundPortObject.credentials);return new Promise((resolve,reject)=>{let onError=__name(err=>{this.trace("Failed to bind "+(0,subchannel_address_1.subchannelAddressToString)(address)+" with error "+err.message),resolve({port:"port"in address?address.port:1,error:err.message})},"onError");http2Server.once("error",onError),http2Server.listen(address,()=>{let boundAddress=http2Server.address(),boundSubchannelAddress;typeof boundAddress=="string"?boundSubchannelAddress={path:boundAddress}:boundSubchannelAddress={host:boundAddress.address,port:boundAddress.port};let channelzRef=this.registerListenerToChannelz(boundSubchannelAddress);this.listenerChildrenTracker.refChild(channelzRef),this.http2Servers.set(http2Server,{channelzRef,sessions:new Set}),boundPortObject.listeningServers.add(http2Server),this.trace("Successfully bound "+(0,subchannel_address_1.subchannelAddressToString)(boundSubchannelAddress)),resolve({port:"port"in boundSubchannelAddress?boundSubchannelAddress.port:1}),http2Server.removeListener("error",onError)})})}async bindManyPorts(addressList,boundPortObject){if(addressList.length===0)return{count:0,port:0,errors:[]};if((0,subchannel_address_1.isTcpSubchannelAddress)(addressList[0])&&addressList[0].port===0){let firstAddressResult=await this.bindOneAddress(addressList[0],boundPortObject);if(firstAddressResult.error){let restAddressResult=await this.bindManyPorts(addressList.slice(1),boundPortObject);return Object.assign(Object.assign({},restAddressResult),{errors:[firstAddressResult.error,...restAddressResult.errors]})}else{let restAddresses=addressList.slice(1).map(address=>(0,subchannel_address_1.isTcpSubchannelAddress)(address)?{host:address.host,port:firstAddressResult.port}:address),restAddressResult=await Promise.all(restAddresses.map(address=>this.bindOneAddress(address,boundPortObject))),allResults=[firstAddressResult,...restAddressResult];return{count:allResults.filter(result=>result.error===void 0).length,port:firstAddressResult.port,errors:allResults.filter(result=>result.error).map(result=>result.error)}}}else{let allResults=await Promise.all(addressList.map(address=>this.bindOneAddress(address,boundPortObject)));return{count:allResults.filter(result=>result.error===void 0).length,port:allResults[0].port,errors:allResults.filter(result=>result.error).map(result=>result.error)}}}async bindAddressList(addressList,boundPortObject){let bindResult=await this.bindManyPorts(addressList,boundPortObject);if(bindResult.count>0)return bindResult.count{let resolverListener={onSuccessfulResolution:(endpointList,serviceConfig,serviceConfigError)=>{resolverListener.onSuccessfulResolution=()=>{};let addressList=[].concat(...endpointList.map(endpoint=>endpoint.addresses));if(addressList.length===0){reject(new Error(`No addresses resolved for port ${port}`));return}resolve(addressList)},onError:error=>{reject(new Error(error.details))}};(0,resolver_1.createResolver)(port,resolverListener,this.options).updateResolution()})}async bindPort(port,boundPortObject){let addressList=await this.resolvePort(port);if(boundPortObject.cancelled)throw this.completeUnbind(boundPortObject),new Error("bindAsync operation cancelled by unbind call");let portNumber=await this.bindAddressList(addressList,boundPortObject);if(boundPortObject.cancelled)throw this.completeUnbind(boundPortObject),new Error("bindAsync operation cancelled by unbind call");return portNumber}normalizePort(port){let initialPortUri=(0,uri_parser_1.parseUri)(port);if(initialPortUri===null)throw new Error(`Could not parse port "${port}"`);let portUri=(0,resolver_1.mapUriDefaultScheme)(initialPortUri);if(portUri===null)throw new Error(`Could not get a default scheme for port "${port}"`);return portUri}bindAsync(port,creds,callback){if(this.shutdown)throw new Error("bindAsync called after shutdown");if(typeof port!="string")throw new TypeError("port must be a string");if(creds===null||!(creds instanceof server_credentials_1.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if(typeof callback!="function")throw new TypeError("callback must be a function");this.trace("bindAsync port="+port);let portUri=this.normalizePort(port),deferredCallback=__name((error,port2)=>{process.nextTick(()=>callback(error,port2))},"deferredCallback"),boundPortObject=this.boundPorts.get((0,uri_parser_1.uriToString)(portUri));if(boundPortObject){if(!creds._equals(boundPortObject.credentials)){deferredCallback(new Error(`${port} already bound with incompatible credentials`),0);return}boundPortObject.cancelled=!1,boundPortObject.completionPromise?boundPortObject.completionPromise.then(portNum=>callback(null,portNum),error=>callback(error,0)):deferredCallback(null,boundPortObject.portNumber);return}boundPortObject={mapKey:(0,uri_parser_1.uriToString)(portUri),originalUri:portUri,completionPromise:null,cancelled:!1,portNumber:0,credentials:creds,listeningServers:new Set};let splitPort=(0,uri_parser_1.splitHostPort)(portUri.path),completionPromise=this.bindPort(portUri,boundPortObject);boundPortObject.completionPromise=completionPromise,splitPort?.port===0?completionPromise.then(portNum=>{let finalUri={scheme:portUri.scheme,authority:portUri.authority,path:(0,uri_parser_1.combineHostPort)({host:splitPort.host,port:portNum})};boundPortObject.mapKey=(0,uri_parser_1.uriToString)(finalUri),boundPortObject.completionPromise=null,boundPortObject.portNumber=portNum,this.boundPorts.set(boundPortObject.mapKey,boundPortObject),callback(null,portNum)},error=>{callback(error,0)}):(this.boundPorts.set(boundPortObject.mapKey,boundPortObject),completionPromise.then(portNum=>{boundPortObject.completionPromise=null,boundPortObject.portNumber=portNum,callback(null,portNum)},error=>{callback(error,0)}))}closeServer(server,callback){this.trace("Closing server with address "+JSON.stringify(server.address()));let serverInfo=this.http2Servers.get(server);server.close(()=>{serverInfo&&(this.listenerChildrenTracker.unrefChild(serverInfo.channelzRef),(0,channelz_1.unregisterChannelzRef)(serverInfo.channelzRef)),this.http2Servers.delete(server),callback?.()})}closeSession(session,callback){var _b;this.trace("Closing session initiated by "+((_b=session.socket)===null||_b===void 0?void 0:_b.remoteAddress));let sessionInfo=this.sessions.get(session),closeCallback=__name(()=>{sessionInfo&&(this.sessionChildrenTracker.unrefChild(sessionInfo.ref),(0,channelz_1.unregisterChannelzRef)(sessionInfo.ref)),callback?.()},"closeCallback");session.closed?queueMicrotask(closeCallback):session.close(closeCallback)}completeUnbind(boundPortObject){for(let server of boundPortObject.listeningServers){let serverInfo=this.http2Servers.get(server);if(this.closeServer(server,()=>{boundPortObject.listeningServers.delete(server)}),serverInfo)for(let session of serverInfo.sessions)this.closeSession(session)}this.boundPorts.delete(boundPortObject.mapKey)}unbind(port){this.trace("unbind port="+port);let portUri=this.normalizePort(port),splitPort=(0,uri_parser_1.splitHostPort)(portUri.path);if(splitPort?.port===0)throw new Error("Cannot unbind port 0");let boundPortObject=this.boundPorts.get((0,uri_parser_1.uriToString)(portUri));boundPortObject&&(this.trace("unbinding "+boundPortObject.mapKey+" originally bound as "+(0,uri_parser_1.uriToString)(boundPortObject.originalUri)),boundPortObject.completionPromise?boundPortObject.cancelled=!0:this.completeUnbind(boundPortObject))}drain(port,graceTimeMs){var _b,_c;this.trace("drain port="+port+" graceTimeMs="+graceTimeMs);let portUri=this.normalizePort(port),splitPort=(0,uri_parser_1.splitHostPort)(portUri.path);if(splitPort?.port===0)throw new Error("Cannot drain port 0");let boundPortObject=this.boundPorts.get((0,uri_parser_1.uriToString)(portUri));if(!boundPortObject)return;let allSessions=new Set;for(let http2Server of boundPortObject.listeningServers){let serverEntry=this.http2Servers.get(http2Server);if(serverEntry)for(let session of serverEntry.sessions)allSessions.add(session),this.closeSession(session,()=>{allSessions.delete(session)})}(_c=(_b=setTimeout(()=>{for(let session of allSessions)session.destroy(http2.constants.NGHTTP2_CANCEL)},graceTimeMs)).unref)===null||_c===void 0||_c.call(_b)}forceShutdown(){for(let boundPortObject of this.boundPorts.values())boundPortObject.cancelled=!0;this.boundPorts.clear();for(let server of this.http2Servers.keys())this.closeServer(server);this.sessions.forEach((channelzInfo,session)=>{this.closeSession(session),session.destroy(http2.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,channelz_1.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(name,handler,serialize,deserialize,type){return this.handlers.has(name)?!1:(this.handlers.set(name,{func:handler,serialize,deserialize,type,path:name}),!0)}unregister(name){return this.handlers.delete(name)}start(){if(this.http2Servers.size===0||[...this.http2Servers.keys()].every(server=>!server.listening))throw new Error("server must be bound in order to start");if(this.started===!0)throw new Error("server is already started");this.started=!0}tryShutdown(callback){var _b;let wrappedCallback=__name(error=>{(0,channelz_1.unregisterChannelzRef)(this.channelzRef),callback(error)},"wrappedCallback"),pendingChecks=0;function maybeCallback(){pendingChecks--,pendingChecks===0&&wrappedCallback()}__name(maybeCallback,"maybeCallback"),this.shutdown=!0;for(let[serverKey,server]of this.http2Servers.entries()){pendingChecks++;let serverString=server.channelzRef.name;this.trace("Waiting for server "+serverString+" to close"),this.closeServer(serverKey,()=>{this.trace("Server "+serverString+" finished closing"),maybeCallback()});for(let session of server.sessions.keys()){pendingChecks++;let sessionString=(_b=session.socket)===null||_b===void 0?void 0:_b.remoteAddress;this.trace("Waiting for session "+sessionString+" to close"),this.closeSession(session,()=>{this.trace("Session "+sessionString+" finished closing"),maybeCallback()})}}pendingChecks===0&&wrappedCallback()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(stream,headers){let contentType=headers[http2.constants.HTTP2_HEADER_CONTENT_TYPE];return typeof contentType!="string"||!contentType.startsWith("application/grpc")?(stream.respond({[http2.constants.HTTP2_HEADER_STATUS]:http2.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1):!0}_retrieveHandler(path){this.trace("Received call to method "+path+" at address "+this.serverAddressString);let handler=this.handlers.get(path);return handler===void 0?(this.trace("No handler registered for method "+path+". Sending UNIMPLEMENTED status."),null):handler}_respondWithError(err,stream,channelzSessionInfo=null){var _b,_c;let trailersToSend=Object.assign({"grpc-status":(_b=err.code)!==null&&_b!==void 0?_b:constants_1.Status.INTERNAL,"grpc-message":err.details,[http2.constants.HTTP2_HEADER_STATUS]:http2.constants.HTTP_STATUS_OK,[http2.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},(_c=err.metadata)===null||_c===void 0?void 0:_c.toHttp2Headers());stream.respond(trailersToSend,{endStream:!0}),this.callTracker.addCallFailed(),channelzSessionInfo?.streamTracker.addCallFailed()}_channelzHandler(stream,headers){this.onStreamOpened(stream);let channelzSessionInfo=this.sessions.get(stream.session);if(this.callTracker.addCallStarted(),channelzSessionInfo?.streamTracker.addCallStarted(),!this._verifyContentType(stream,headers)){this.callTracker.addCallFailed(),channelzSessionInfo?.streamTracker.addCallFailed();return}let path=headers[HTTP2_HEADER_PATH],handler=this._retrieveHandler(path);if(!handler){this._respondWithError(getUnimplementedStatusResponse(path),stream,channelzSessionInfo);return}let callEventTracker={addMessageSent:()=>{channelzSessionInfo&&(channelzSessionInfo.messagesSent+=1,channelzSessionInfo.lastMessageSentTimestamp=new Date)},addMessageReceived:()=>{channelzSessionInfo&&(channelzSessionInfo.messagesReceived+=1,channelzSessionInfo.lastMessageReceivedTimestamp=new Date)},onCallEnd:status=>{status.code===constants_1.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()},onStreamEnd:success=>{channelzSessionInfo&&(success?channelzSessionInfo.streamTracker.addCallSucceeded():channelzSessionInfo.streamTracker.addCallFailed())}},call=(0,server_interceptors_1.getServerInterceptingCall)(this.interceptors,stream,headers,callEventTracker,handler,this.options);this._runHandlerForCall(call,handler)||(this.callTracker.addCallFailed(),channelzSessionInfo?.streamTracker.addCallFailed(),call.sendStatus({code:constants_1.Status.INTERNAL,details:`Unknown handler type: ${handler.type}`}))}_streamHandler(stream,headers){if(this.onStreamOpened(stream),this._verifyContentType(stream,headers)!==!0)return;let path=headers[HTTP2_HEADER_PATH],handler=this._retrieveHandler(path);if(!handler){this._respondWithError(getUnimplementedStatusResponse(path),stream,null);return}let call=(0,server_interceptors_1.getServerInterceptingCall)(this.interceptors,stream,headers,null,handler,this.options);this._runHandlerForCall(call,handler)||call.sendStatus({code:constants_1.Status.INTERNAL,details:`Unknown handler type: ${handler.type}`})}_runHandlerForCall(call,handler){let{type}=handler;if(type==="unary")handleUnary(call,handler);else if(type==="clientStream")handleClientStreaming(call,handler);else if(type==="serverStream")handleServerStreaming(call,handler);else if(type==="bidi")handleBidiStreaming(call,handler);else return!1;return!0}_setupHandlers(http2Server){if(http2Server===null)return;let serverAddress=http2Server.address(),serverAddressString="null";serverAddress&&(typeof serverAddress=="string"?serverAddressString=serverAddress:serverAddressString=serverAddress.address+":"+serverAddress.port),this.serverAddressString=serverAddressString;let handler=this.channelzEnabled?this._channelzHandler:this._streamHandler,sessionHandler=this.channelzEnabled?this._channelzSessionHandler(http2Server):this._sessionHandler(http2Server);http2Server.on("stream",handler.bind(this)),http2Server.on("session",sessionHandler)}_sessionHandler(http2Server){return session=>{var _b,_c,_d;(_b=this.http2Servers.get(http2Server))===null||_b===void 0||_b.sessions.add(session);let connectionAgeTimer=null,connectionAgeGraceTimer=null,keeapliveTimeTimer=null,keepaliveTimeoutTimer=null,sessionClosedByServer=!1,idleTimeoutObj=this.enableIdleTimeout(session);if(this.maxConnectionAgeMs!==UNLIMITED_CONNECTION_AGE_MS){let jitterMagnitude=this.maxConnectionAgeMs/10,jitter=Math.random()*jitterMagnitude*2-jitterMagnitude;connectionAgeTimer=setTimeout(()=>{var _b2,_c2;sessionClosedByServer=!0,this.trace("Connection dropped by max connection age: "+((_b2=session.socket)===null||_b2===void 0?void 0:_b2.remoteAddress));try{session.goaway(http2.constants.NGHTTP2_NO_ERROR,~(1<<31),kMaxAge)}catch{session.destroy();return}session.close(),this.maxConnectionAgeGraceMs!==UNLIMITED_CONNECTION_AGE_MS&&(connectionAgeGraceTimer=setTimeout(()=>{session.destroy()},this.maxConnectionAgeGraceMs),(_c2=connectionAgeGraceTimer.unref)===null||_c2===void 0||_c2.call(connectionAgeGraceTimer))},this.maxConnectionAgeMs+jitter),(_c=connectionAgeTimer.unref)===null||_c===void 0||_c.call(connectionAgeTimer)}this.keepaliveTimeMs{var _b2;keepaliveTimeoutTimer=setTimeout(()=>{sessionClosedByServer=!0,session.close()},this.keepaliveTimeoutMs),(_b2=keepaliveTimeoutTimer.unref)===null||_b2===void 0||_b2.call(keepaliveTimeoutTimer);try{session.ping((err,duration,payload)=>{keepaliveTimeoutTimer&&clearTimeout(keepaliveTimeoutTimer),err&&(sessionClosedByServer=!0,this.trace("Connection dropped due to error of a ping frame "+err.message+" return in "+duration),session.close())})}catch{clearTimeout(keepaliveTimeoutTimer),session.destroy()}},this.keepaliveTimeMs),(_d=keeapliveTimeTimer.unref)===null||_d===void 0||_d.call(keeapliveTimeTimer)),session.on("close",()=>{var _b2,_c2;sessionClosedByServer||this.trace(`Connection dropped by client ${(_b2=session.socket)===null||_b2===void 0?void 0:_b2.remoteAddress}`),connectionAgeTimer&&clearTimeout(connectionAgeTimer),connectionAgeGraceTimer&&clearTimeout(connectionAgeGraceTimer),keeapliveTimeTimer&&(clearInterval(keeapliveTimeTimer),keepaliveTimeoutTimer&&clearTimeout(keepaliveTimeoutTimer)),idleTimeoutObj!==null&&(clearTimeout(idleTimeoutObj.timeout),this.sessionIdleTimeouts.delete(session)),(_c2=this.http2Servers.get(http2Server))===null||_c2===void 0||_c2.sessions.delete(session)})}}_channelzSessionHandler(http2Server){return session=>{var _b,_c,_d,_e,_f;let channelzRef=(0,channelz_1.registerChannelzSocket)((_c=(_b=session.socket)===null||_b===void 0?void 0:_b.remoteAddress)!==null&&_c!==void 0?_c:"unknown",this.getChannelzSessionInfo.bind(this,session),this.channelzEnabled),channelzSessionInfo={ref:channelzRef,streamTracker:new channelz_1.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};(_d=this.http2Servers.get(http2Server))===null||_d===void 0||_d.sessions.add(session),this.sessions.set(session,channelzSessionInfo);let clientAddress=`${session.socket.remoteAddress}:${session.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+clientAddress),this.trace("Connection established by client "+clientAddress),this.sessionChildrenTracker.refChild(channelzRef);let connectionAgeTimer=null,connectionAgeGraceTimer=null,keeapliveTimeTimer=null,keepaliveTimeoutTimer=null,sessionClosedByServer=!1,idleTimeoutObj=this.enableIdleTimeout(session);if(this.maxConnectionAgeMs!==UNLIMITED_CONNECTION_AGE_MS){let jitterMagnitude=this.maxConnectionAgeMs/10,jitter=Math.random()*jitterMagnitude*2-jitterMagnitude;connectionAgeTimer=setTimeout(()=>{var _b2;sessionClosedByServer=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+clientAddress);try{session.goaway(http2.constants.NGHTTP2_NO_ERROR,~(1<<31),kMaxAge)}catch{session.destroy();return}session.close(),this.maxConnectionAgeGraceMs!==UNLIMITED_CONNECTION_AGE_MS&&(connectionAgeGraceTimer=setTimeout(()=>{session.destroy()},this.maxConnectionAgeGraceMs),(_b2=connectionAgeGraceTimer.unref)===null||_b2===void 0||_b2.call(connectionAgeGraceTimer))},this.maxConnectionAgeMs+jitter),(_e=connectionAgeTimer.unref)===null||_e===void 0||_e.call(connectionAgeTimer)}this.keepaliveTimeMs{var _b2;keepaliveTimeoutTimer=setTimeout(()=>{sessionClosedByServer=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+clientAddress),session.close()},this.keepaliveTimeoutMs),(_b2=keepaliveTimeoutTimer.unref)===null||_b2===void 0||_b2.call(keepaliveTimeoutTimer);try{session.ping((err,duration,payload)=>{keepaliveTimeoutTimer&&clearTimeout(keepaliveTimeoutTimer),err&&(sessionClosedByServer=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+err.message+" return in "+duration),session.close())}),channelzSessionInfo.keepAlivesSent+=1}catch{clearTimeout(keepaliveTimeoutTimer),session.destroy()}},this.keepaliveTimeMs),(_f=keeapliveTimeTimer.unref)===null||_f===void 0||_f.call(keeapliveTimeTimer)),session.on("close",()=>{var _b2;sessionClosedByServer||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+clientAddress),this.sessionChildrenTracker.unrefChild(channelzRef),(0,channelz_1.unregisterChannelzRef)(channelzRef),connectionAgeTimer&&clearTimeout(connectionAgeTimer),connectionAgeGraceTimer&&clearTimeout(connectionAgeGraceTimer),keeapliveTimeTimer&&(clearInterval(keeapliveTimeTimer),keepaliveTimeoutTimer&&clearTimeout(keepaliveTimeoutTimer)),idleTimeoutObj!==null&&(clearTimeout(idleTimeoutObj.timeout),this.sessionIdleTimeouts.delete(session)),(_b2=this.http2Servers.get(http2Server))===null||_b2===void 0||_b2.sessions.delete(session),this.sessions.delete(session)})}}enableIdleTimeout(session){var _b,_c;if(this.sessionIdleTimeout>=MAX_CONNECTION_IDLE_MS)return null;let idleTimeoutObj={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,session),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,session)};(_c=(_b=idleTimeoutObj.timeout).unref)===null||_c===void 0||_c.call(_b),this.sessionIdleTimeouts.set(session,idleTimeoutObj);let{socket}=session;return this.trace("Enable idle timeout for "+socket.remoteAddress+":"+socket.remotePort),idleTimeoutObj}onIdleTimeout(ctx,session){let{socket}=session,sessionInfo=ctx.sessionIdleTimeouts.get(session);sessionInfo!==void 0&&sessionInfo.activeStreams===0&&Date.now()-sessionInfo.lastIdle>=ctx.sessionIdleTimeout&&(ctx.trace("Session idle timeout triggered for "+socket?.remoteAddress+":"+socket?.remotePort+" last idle at "+sessionInfo.lastIdle),ctx.closeSession(session))}onStreamOpened(stream){let session=stream.session,idleTimeoutObj=this.sessionIdleTimeouts.get(session);idleTimeoutObj&&(idleTimeoutObj.activeStreams+=1,stream.once("close",idleTimeoutObj.onClose))}onStreamClose(session){var _b,_c;let idleTimeoutObj=this.sessionIdleTimeouts.get(session);idleTimeoutObj&&(idleTimeoutObj.activeStreams-=1,idleTimeoutObj.activeStreams===0&&(idleTimeoutObj.lastIdle=Date.now(),idleTimeoutObj.timeout.refresh(),this.trace("Session onStreamClose"+((_b=session.socket)===null||_b===void 0?void 0:_b.remoteAddress)+":"+((_c=session.socket)===null||_c===void 0?void 0:_c.remotePort)+" at "+idleTimeoutObj.lastIdle)))}},"Server"),(()=>{let _metadata=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;_start_decorators=[deprecate("Calling start() is no longer necessary. It can be safely omitted.")],__esDecorate(_a,null,_start_decorators,{kind:"method",name:"start",static:!1,private:!1,access:{has:obj=>"start"in obj,get:obj=>obj.start},metadata:_metadata},null,_instanceExtraInitializers),_metadata&&Object.defineProperty(_a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})})(),_a})();exports2.Server=Server;async function handleUnary(call,handler){let stream;function respond(err,value,trailer,flags){if(err){call.sendStatus((0,server_call_1.serverErrorToStatus)(err,trailer));return}call.sendMessage(value,()=>{call.sendStatus({code:constants_1.Status.OK,details:"OK",metadata:trailer??null})})}__name(respond,"respond");let requestMetadata,requestMessage=null;call.start({onReceiveMetadata(metadata){requestMetadata=metadata,call.startRead()},onReceiveMessage(message){if(requestMessage){call.sendStatus({code:constants_1.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${handler.path}`,metadata:null});return}requestMessage=message,call.startRead()},onReceiveHalfClose(){if(!requestMessage){call.sendStatus({code:constants_1.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${handler.path}`,metadata:null});return}stream=new server_call_1.ServerWritableStreamImpl(handler.path,call,requestMetadata,requestMessage);try{handler.func(stream,respond)}catch(err){call.sendStatus({code:constants_1.Status.UNKNOWN,details:`Server method handler threw error ${err.message}`,metadata:null})}},onCancel(){stream&&(stream.cancelled=!0,stream.emit("cancelled","cancelled"))}})}__name(handleUnary,"handleUnary");function handleClientStreaming(call,handler){let stream;function respond(err,value,trailer,flags){if(err){call.sendStatus((0,server_call_1.serverErrorToStatus)(err,trailer));return}call.sendMessage(value,()=>{call.sendStatus({code:constants_1.Status.OK,details:"OK",metadata:trailer??null})})}__name(respond,"respond"),call.start({onReceiveMetadata(metadata){stream=new server_call_1.ServerDuplexStreamImpl(handler.path,call,metadata);try{handler.func(stream,respond)}catch(err){call.sendStatus({code:constants_1.Status.UNKNOWN,details:`Server method handler threw error ${err.message}`,metadata:null})}},onReceiveMessage(message){stream.push(message)},onReceiveHalfClose(){stream.push(null)},onCancel(){stream&&(stream.cancelled=!0,stream.emit("cancelled","cancelled"),stream.destroy())}})}__name(handleClientStreaming,"handleClientStreaming");function handleServerStreaming(call,handler){let stream,requestMetadata,requestMessage=null;call.start({onReceiveMetadata(metadata){requestMetadata=metadata,call.startRead()},onReceiveMessage(message){if(requestMessage){call.sendStatus({code:constants_1.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${handler.path}`,metadata:null});return}requestMessage=message,call.startRead()},onReceiveHalfClose(){if(!requestMessage){call.sendStatus({code:constants_1.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${handler.path}`,metadata:null});return}stream=new server_call_1.ServerWritableStreamImpl(handler.path,call,requestMetadata,requestMessage);try{handler.func(stream)}catch(err){call.sendStatus({code:constants_1.Status.UNKNOWN,details:`Server method handler threw error ${err.message}`,metadata:null})}},onCancel(){stream&&(stream.cancelled=!0,stream.emit("cancelled","cancelled"),stream.destroy())}})}__name(handleServerStreaming,"handleServerStreaming");function handleBidiStreaming(call,handler){let stream;call.start({onReceiveMetadata(metadata){stream=new server_call_1.ServerDuplexStreamImpl(handler.path,call,metadata);try{handler.func(stream)}catch(err){call.sendStatus({code:constants_1.Status.UNKNOWN,details:`Server method handler threw error ${err.message}`,metadata:null})}},onReceiveMessage(message){stream.push(message)},onReceiveHalfClose(){stream.push(null)},onCancel(){stream&&(stream.cancelled=!0,stream.emit("cancelled","cancelled"),stream.destroy())}})}__name(handleBidiStreaming,"handleBidiStreaming")}});var require_status_builder=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/status-builder.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.StatusBuilder=void 0;var StatusBuilder=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(code){return this.code=code,this}withDetails(details){return this.details=details,this}withMetadata(metadata){return this.metadata=metadata,this}build(){let status={};return this.code!==null&&(status.code=this.code),this.details!==null&&(status.details=this.details),this.metadata!==null&&(status.metadata=this.metadata),status}};__name(StatusBuilder,"StatusBuilder");exports2.StatusBuilder=StatusBuilder}});var require_duration2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/duration.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.isDuration=exports2.durationToMs=exports2.msToDuration=void 0;function msToDuration(millis){return{seconds:millis/1e3|0,nanos:millis%1e3*1e6|0}}__name(msToDuration,"msToDuration");exports2.msToDuration=msToDuration;function durationToMs(duration){return duration.seconds*1e3+duration.nanos/1e6|0}__name(durationToMs,"durationToMs");exports2.durationToMs=durationToMs;function isDuration(value){return typeof value.seconds=="number"&&typeof value.nanos=="number"}__name(isDuration,"isDuration");exports2.isDuration=isDuration}});var require_load_balancer_pick_first=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.setup=exports2.LeafLoadBalancer=exports2.PickFirstLoadBalancer=exports2.shuffled=exports2.PickFirstLoadBalancingConfig=void 0;var load_balancer_1=require_load_balancer(),connectivity_state_1=require_connectivity_state(),picker_1=require_picker(),logging=require_logging(),constants_1=require_constants(),subchannel_address_1=require_subchannel_address(),net_1=require("net"),TRACER_NAME="pick_first";function trace(text){logging.trace(constants_1.LogVerbosity.DEBUG,TRACER_NAME,text)}__name(trace,"trace");var TYPE_NAME="pick_first",CONNECTION_DELAY_INTERVAL_MS=250,PickFirstLoadBalancingConfig=class{constructor(shuffleAddressList){this.shuffleAddressList=shuffleAddressList}getLoadBalancerName(){return TYPE_NAME}toJsonObject(){return{[TYPE_NAME]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(obj){if("shuffleAddressList"in obj&&typeof obj.shuffleAddressList!="boolean")throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new PickFirstLoadBalancingConfig(obj.shuffleAddressList===!0)}};__name(PickFirstLoadBalancingConfig,"PickFirstLoadBalancingConfig");exports2.PickFirstLoadBalancingConfig=PickFirstLoadBalancingConfig;var PickFirstPicker=class{constructor(subchannel){this.subchannel=subchannel}pick(pickArgs){return{pickResultType:picker_1.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}};__name(PickFirstPicker,"PickFirstPicker");function shuffled(list){let result=list.slice();for(let i=result.length-1;i>1;i--){let j=Math.floor(Math.random()*(i+1)),temp=result[i];result[i]=result[j],result[j]=temp}return result}__name(shuffled,"shuffled");exports2.shuffled=shuffled;function interleaveAddressFamilies(addressList){let result=[],ipv6Addresses=[],ipv4Addresses=[],ipv6First=(0,subchannel_address_1.isTcpSubchannelAddress)(addressList[0])&&(0,net_1.isIPv6)(addressList[0].host);for(let address of addressList)(0,subchannel_address_1.isTcpSubchannelAddress)(address)&&(0,net_1.isIPv6)(address.host)?ipv6Addresses.push(address):ipv4Addresses.push(address);let firstList=ipv6First?ipv6Addresses:ipv4Addresses,secondList=ipv6First?ipv4Addresses:ipv6Addresses;for(let i=0;i{this.onSubchannelStateUpdate(subchannel,previousState,newState,errorMessage)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.triedAllSubchannels=!1,this.stickyTransientFailureMode=!1,this.requestedResolutionSinceLastUpdate=!1,this.lastError=null,this.latestAddressList=null,this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout),this.reportHealthStatus=options[REPORT_HEALTH_STATUS_OPTION_NAME]}allChildrenHaveReportedTF(){return this.children.every(child=>child.hasReportedTransientFailure)}calculateAndReportNewState(){this.currentPick?this.reportHealthStatus&&!this.currentPick.isHealthy()?this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE,new picker_1.UnavailablePicker({details:`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`})):this.updateState(connectivity_state_1.ConnectivityState.READY,new PickFirstPicker(this.currentPick)):this.children.length===0?this.updateState(connectivity_state_1.ConnectivityState.IDLE,new picker_1.QueuePicker(this)):this.stickyTransientFailureMode?this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE,new picker_1.UnavailablePicker({details:`No connection established. Last error: ${this.lastError}`})):this.updateState(connectivity_state_1.ConnectivityState.CONNECTING,new picker_1.QueuePicker(this))}requestReresolution(){this.requestedResolutionSinceLastUpdate=!0,this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF()&&(this.requestedResolutionSinceLastUpdate||this.requestReresolution(),!this.stickyTransientFailureMode)){this.stickyTransientFailureMode=!0;for(let{subchannel}of this.children)subchannel.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){if(this.currentPick!==null){let currentPick=this.currentPick;this.currentPick=null,currentPick.unref(),currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(currentPick.getChannelzRef()),this.reportHealthStatus&¤tPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener)}}onSubchannelStateUpdate(subchannel,previousState,newState,errorMessage){var _a;if(!((_a=this.currentPick)===null||_a===void 0)&&_a.realSubchannelEquals(subchannel)){newState!==connectivity_state_1.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState(),this.requestReresolution());return}for(let[index,child]of this.children.entries())if(subchannel.realSubchannelEquals(child.subchannel)){newState===connectivity_state_1.ConnectivityState.READY&&this.pickSubchannel(child.subchannel),newState===connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE&&(child.hasReportedTransientFailure=!0,errorMessage&&(this.lastError=errorMessage),this.maybeEnterStickyTransientFailureMode(),index===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(index+1)),child.subchannel.startConnecting();return}}startNextSubchannelConnecting(startIndex){if(clearTimeout(this.connectionDelayTimeout),!this.triedAllSubchannels){for(let[index,child]of this.children.entries())if(index>=startIndex){let subchannelState=child.subchannel.getConnectivityState();if(subchannelState===connectivity_state_1.ConnectivityState.IDLE||subchannelState===connectivity_state_1.ConnectivityState.CONNECTING){this.startConnecting(index);return}}this.triedAllSubchannels=!0,this.maybeEnterStickyTransientFailureMode()}}startConnecting(subchannelIndex){var _a,_b;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=subchannelIndex,this.children[subchannelIndex].subchannel.getConnectivityState()===connectivity_state_1.ConnectivityState.IDLE&&(trace("Start connecting to subchannel with address "+this.children[subchannelIndex].subchannel.getAddress()),process.nextTick(()=>{var _a2;(_a2=this.children[subchannelIndex])===null||_a2===void 0||_a2.subchannel.startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(subchannelIndex+1)},CONNECTION_DELAY_INTERVAL_MS),(_b=(_a=this.connectionDelayTimeout).unref)===null||_b===void 0||_b.call(_a)}pickSubchannel(subchannel){this.currentPick&&subchannel.realSubchannelEquals(this.currentPick)||(trace("Pick subchannel with address "+subchannel.getAddress()),this.stickyTransientFailureMode=!1,this.removeCurrentPick(),this.currentPick=subchannel,subchannel.ref(),this.reportHealthStatus&&subchannel.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.channelControlHelper.addChannelzChild(subchannel.getChannelzRef()),this.resetSubchannelList(),clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState())}updateState(newState,picker){trace(connectivity_state_1.ConnectivityState[this.currentState]+" -> "+connectivity_state_1.ConnectivityState[newState]),this.currentState=newState,this.channelControlHelper.updateState(newState,picker)}resetSubchannelList(){for(let child of this.children)this.currentPick&&child.subchannel.realSubchannelEquals(this.currentPick)||child.subchannel.removeConnectivityStateListener(this.subchannelStateListener),child.subchannel.unref(),this.channelControlHelper.removeChannelzChild(child.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[],this.triedAllSubchannels=!1,this.requestedResolutionSinceLastUpdate=!1}connectToAddressList(addressList){let newChildrenList=addressList.map(address=>({subchannel:this.channelControlHelper.createSubchannel(address,{}),hasReportedTransientFailure:!1}));for(let{subchannel}of newChildrenList)subchannel.ref(),this.channelControlHelper.addChannelzChild(subchannel.getChannelzRef());this.resetSubchannelList(),this.children=newChildrenList;for(let{subchannel}of this.children)if(subchannel.addConnectivityStateListener(this.subchannelStateListener),subchannel.getConnectivityState()===connectivity_state_1.ConnectivityState.READY){this.pickSubchannel(subchannel);return}for(let child of this.children)child.subchannel.getConnectivityState()===connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE&&(child.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(endpointList,lbConfig){if(!(lbConfig instanceof PickFirstLoadBalancingConfig))return;lbConfig.getShuffleAddressList()&&(endpointList=shuffled(endpointList));let rawAddressList=[].concat(...endpointList.map(endpoint=>endpoint.addresses));if(rawAddressList.length===0)throw new Error("No addresses in endpoint list passed to pick_first");let addressList=interleaveAddressFamilies(rawAddressList);this.latestAddressList=addressList,this.connectToAddressList(addressList)}exitIdle(){this.currentState===connectivity_state_1.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return TYPE_NAME}};__name(PickFirstLoadBalancer,"PickFirstLoadBalancer");exports2.PickFirstLoadBalancer=PickFirstLoadBalancer;var LEAF_CONFIG=new PickFirstLoadBalancingConfig(!1),LeafLoadBalancer=class{constructor(endpoint,channelControlHelper,options){this.endpoint=endpoint,this.latestState=connectivity_state_1.ConnectivityState.IDLE;let childChannelControlHelper=(0,load_balancer_1.createChildChannelControlHelper)(channelControlHelper,{updateState:(connectivityState,picker)=>{this.latestState=connectivityState,this.latestPicker=picker,channelControlHelper.updateState(connectivityState,picker)}});this.pickFirstBalancer=new PickFirstLoadBalancer(childChannelControlHelper,Object.assign(Object.assign({},options),{[REPORT_HEALTH_STATUS_OPTION_NAME]:!0})),this.latestPicker=new picker_1.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList([this.endpoint],LEAF_CONFIG)}updateEndpoint(newEndpoint){this.endpoint=newEndpoint,this.latestState!==connectivity_state_1.ConnectivityState.IDLE&&this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}};__name(LeafLoadBalancer,"LeafLoadBalancer");exports2.LeafLoadBalancer=LeafLoadBalancer;function setup(){(0,load_balancer_1.registerLoadBalancerType)(TYPE_NAME,PickFirstLoadBalancer,PickFirstLoadBalancingConfig),(0,load_balancer_1.registerDefaultLoadBalancerType)(TYPE_NAME)}__name(setup,"setup");exports2.setup=setup}});var require_experimental=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/experimental.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.BaseSubchannelWrapper=exports2.registerAdminService=exports2.FilterStackFactory=exports2.BaseFilter=exports2.PickResultType=exports2.QueuePicker=exports2.UnavailablePicker=exports2.ChildLoadBalancerHandler=exports2.EndpointMap=exports2.endpointHasAddress=exports2.endpointToString=exports2.subchannelAddressToString=exports2.LeafLoadBalancer=exports2.isLoadBalancerNameRegistered=exports2.parseLoadBalancingConfig=exports2.selectLbConfigFromList=exports2.registerLoadBalancerType=exports2.createChildChannelControlHelper=exports2.BackoffTimeout=exports2.durationToMs=exports2.uriToString=exports2.createResolver=exports2.registerResolver=exports2.log=exports2.trace=void 0;var logging_1=require_logging();Object.defineProperty(exports2,"trace",{enumerable:!0,get:function(){return logging_1.trace}});Object.defineProperty(exports2,"log",{enumerable:!0,get:function(){return logging_1.log}});var resolver_1=require_resolver();Object.defineProperty(exports2,"registerResolver",{enumerable:!0,get:function(){return resolver_1.registerResolver}});Object.defineProperty(exports2,"createResolver",{enumerable:!0,get:function(){return resolver_1.createResolver}});var uri_parser_1=require_uri_parser();Object.defineProperty(exports2,"uriToString",{enumerable:!0,get:function(){return uri_parser_1.uriToString}});var duration_1=require_duration2();Object.defineProperty(exports2,"durationToMs",{enumerable:!0,get:function(){return duration_1.durationToMs}});var backoff_timeout_1=require_backoff_timeout();Object.defineProperty(exports2,"BackoffTimeout",{enumerable:!0,get:function(){return backoff_timeout_1.BackoffTimeout}});var load_balancer_1=require_load_balancer();Object.defineProperty(exports2,"createChildChannelControlHelper",{enumerable:!0,get:function(){return load_balancer_1.createChildChannelControlHelper}});Object.defineProperty(exports2,"registerLoadBalancerType",{enumerable:!0,get:function(){return load_balancer_1.registerLoadBalancerType}});Object.defineProperty(exports2,"selectLbConfigFromList",{enumerable:!0,get:function(){return load_balancer_1.selectLbConfigFromList}});Object.defineProperty(exports2,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return load_balancer_1.parseLoadBalancingConfig}});Object.defineProperty(exports2,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return load_balancer_1.isLoadBalancerNameRegistered}});var load_balancer_pick_first_1=require_load_balancer_pick_first();Object.defineProperty(exports2,"LeafLoadBalancer",{enumerable:!0,get:function(){return load_balancer_pick_first_1.LeafLoadBalancer}});var subchannel_address_1=require_subchannel_address();Object.defineProperty(exports2,"subchannelAddressToString",{enumerable:!0,get:function(){return subchannel_address_1.subchannelAddressToString}});Object.defineProperty(exports2,"endpointToString",{enumerable:!0,get:function(){return subchannel_address_1.endpointToString}});Object.defineProperty(exports2,"endpointHasAddress",{enumerable:!0,get:function(){return subchannel_address_1.endpointHasAddress}});Object.defineProperty(exports2,"EndpointMap",{enumerable:!0,get:function(){return subchannel_address_1.EndpointMap}});var load_balancer_child_handler_1=require_load_balancer_child_handler();Object.defineProperty(exports2,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return load_balancer_child_handler_1.ChildLoadBalancerHandler}});var picker_1=require_picker();Object.defineProperty(exports2,"UnavailablePicker",{enumerable:!0,get:function(){return picker_1.UnavailablePicker}});Object.defineProperty(exports2,"QueuePicker",{enumerable:!0,get:function(){return picker_1.QueuePicker}});Object.defineProperty(exports2,"PickResultType",{enumerable:!0,get:function(){return picker_1.PickResultType}});var filter_1=require_filter2();Object.defineProperty(exports2,"BaseFilter",{enumerable:!0,get:function(){return filter_1.BaseFilter}});var filter_stack_1=require_filter_stack();Object.defineProperty(exports2,"FilterStackFactory",{enumerable:!0,get:function(){return filter_stack_1.FilterStackFactory}});var admin_1=require_admin();Object.defineProperty(exports2,"registerAdminService",{enumerable:!0,get:function(){return admin_1.registerAdminService}});var subchannel_interface_1=require_subchannel_interface();Object.defineProperty(exports2,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return subchannel_interface_1.BaseSubchannelWrapper}})}});var require_resolver_uds=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/resolver-uds.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.setup=void 0;var resolver_1=require_resolver(),UdsResolver=class{constructor(target,listener,channelOptions){this.listener=listener,this.hasReturnedResult=!1,this.endpoints=[];let path;target.authority===""?path="/"+target.path:path=target.path,this.endpoints=[{addresses:[{path}]}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener.onSuccessfulResolution,this.endpoints,null,null,null,{}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(target){return"localhost"}};__name(UdsResolver,"UdsResolver");function setup(){(0,resolver_1.registerResolver)("unix",UdsResolver)}__name(setup,"setup");exports2.setup=setup}});var require_resolver_ip=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/resolver-ip.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.setup=void 0;var net_1=require("net"),constants_1=require_constants(),metadata_1=require_metadata(),resolver_1=require_resolver(),uri_parser_1=require_uri_parser(),logging=require_logging(),TRACER_NAME="ip_resolver";function trace(text){logging.trace(constants_1.LogVerbosity.DEBUG,TRACER_NAME,text)}__name(trace,"trace");var IPV4_SCHEME="ipv4",IPV6_SCHEME="ipv6",DEFAULT_PORT=443,IpResolver=class{constructor(target,listener,channelOptions){var _a;this.listener=listener,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,trace("Resolver constructed for target "+(0,uri_parser_1.uriToString)(target));let addresses=[];if(!(target.scheme===IPV4_SCHEME||target.scheme===IPV6_SCHEME)){this.error={code:constants_1.Status.UNAVAILABLE,details:`Unrecognized scheme ${target.scheme} in IP resolver`,metadata:new metadata_1.Metadata};return}let pathList=target.path.split(",");for(let path of pathList){let hostPort=(0,uri_parser_1.splitHostPort)(path);if(hostPort===null){this.error={code:constants_1.Status.UNAVAILABLE,details:`Failed to parse ${target.scheme} address ${path}`,metadata:new metadata_1.Metadata};return}if(target.scheme===IPV4_SCHEME&&!(0,net_1.isIPv4)(hostPort.host)||target.scheme===IPV6_SCHEME&&!(0,net_1.isIPv6)(hostPort.host)){this.error={code:constants_1.Status.UNAVAILABLE,details:`Failed to parse ${target.scheme} address ${path}`,metadata:new metadata_1.Metadata};return}addresses.push({host:hostPort.host,port:(_a=hostPort.port)!==null&&_a!==void 0?_a:DEFAULT_PORT})}this.endpoints=addresses.map(address=>({addresses:[address]})),trace("Parsed "+target.scheme+" address list "+addresses)}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener.onError(this.error):this.listener.onSuccessfulResolution(this.endpoints,null,null,null,{})}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(target){return target.path.split(",")[0]}};__name(IpResolver,"IpResolver");function setup(){(0,resolver_1.registerResolver)(IPV4_SCHEME,IpResolver),(0,resolver_1.registerResolver)(IPV6_SCHEME,IpResolver)}__name(setup,"setup");exports2.setup=setup}});var require_load_balancer_round_robin=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/load-balancer-round-robin.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.setup=exports2.RoundRobinLoadBalancer=void 0;var load_balancer_1=require_load_balancer(),connectivity_state_1=require_connectivity_state(),picker_1=require_picker(),logging=require_logging(),constants_1=require_constants(),subchannel_address_1=require_subchannel_address(),load_balancer_pick_first_1=require_load_balancer_pick_first(),TRACER_NAME="round_robin";function trace(text){logging.trace(constants_1.LogVerbosity.DEBUG,TRACER_NAME,text)}__name(trace,"trace");var TYPE_NAME="round_robin",RoundRobinLoadBalancingConfig=class{getLoadBalancerName(){return TYPE_NAME}constructor(){}toJsonObject(){return{[TYPE_NAME]:{}}}static createFromJson(obj){return new RoundRobinLoadBalancingConfig}};__name(RoundRobinLoadBalancingConfig,"RoundRobinLoadBalancingConfig");var RoundRobinPicker=class{constructor(children,nextIndex=0){this.children=children,this.nextIndex=nextIndex}pick(pickArgs){let childPicker=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,childPicker.pick(pickArgs)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}};__name(RoundRobinPicker,"RoundRobinPicker");var RoundRobinLoadBalancer=class{constructor(channelControlHelper,options){this.channelControlHelper=channelControlHelper,this.options=options,this.children=[],this.currentState=connectivity_state_1.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,load_balancer_1.createChildChannelControlHelper)(channelControlHelper,{updateState:(connectivityState,picker)=>{this.calculateAndUpdateState()}})}countChildrenWithState(state){return this.children.filter(child=>child.getConnectivityState()===state).length}calculateAndUpdateState(){if(!this.updatesPaused){if(this.countChildrenWithState(connectivity_state_1.ConnectivityState.READY)>0){let readyChildren=this.children.filter(child=>child.getConnectivityState()===connectivity_state_1.ConnectivityState.READY),index=0;if(this.currentReadyPicker!==null){let nextPickedEndpoint=this.currentReadyPicker.peekNextEndpoint();index=readyChildren.findIndex(child=>(0,subchannel_address_1.endpointEqual)(child.getEndpoint(),nextPickedEndpoint)),index<0&&(index=0)}this.updateState(connectivity_state_1.ConnectivityState.READY,new RoundRobinPicker(readyChildren.map(child=>({endpoint:child.getEndpoint(),picker:child.getPicker()})),index))}else this.countChildrenWithState(connectivity_state_1.ConnectivityState.CONNECTING)>0?this.updateState(connectivity_state_1.ConnectivityState.CONNECTING,new picker_1.QueuePicker(this)):this.countChildrenWithState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE)>0?this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE,new picker_1.UnavailablePicker({details:`No connection established. Last error: ${this.lastError}`})):this.updateState(connectivity_state_1.ConnectivityState.IDLE,new picker_1.QueuePicker(this));for(let child of this.children)child.getConnectivityState()===connectivity_state_1.ConnectivityState.IDLE&&child.exitIdle()}}updateState(newState,picker){trace(connectivity_state_1.ConnectivityState[this.currentState]+" -> "+connectivity_state_1.ConnectivityState[newState]),newState===connectivity_state_1.ConnectivityState.READY?this.currentReadyPicker=picker:this.currentReadyPicker=null,this.currentState=newState,this.channelControlHelper.updateState(newState,picker)}resetSubchannelList(){for(let child of this.children)child.destroy()}updateAddressList(endpointList,lbConfig){this.resetSubchannelList(),trace("Connect to endpoint list "+endpointList.map(subchannel_address_1.endpointToString)),this.updatesPaused=!0,this.children=endpointList.map(endpoint=>new load_balancer_pick_first_1.LeafLoadBalancer(endpoint,this.childChannelControlHelper,this.options));for(let child of this.children)child.startConnecting();this.updatesPaused=!1,this.calculateAndUpdateState()}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return TYPE_NAME}};__name(RoundRobinLoadBalancer,"RoundRobinLoadBalancer");exports2.RoundRobinLoadBalancer=RoundRobinLoadBalancer;function setup(){(0,load_balancer_1.registerLoadBalancerType)(TYPE_NAME,RoundRobinLoadBalancer,RoundRobinLoadBalancingConfig)}__name(setup,"setup");exports2.setup=setup}});var require_load_balancer_outlier_detection=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@grpc/grpc-js/build/src/load-balancer-outlier-detection.js"(exports2){"use strict";var _a;Object.defineProperty(exports2,"__esModule",{value:!0});exports2.setup=exports2.OutlierDetectionLoadBalancer=exports2.OutlierDetectionLoadBalancingConfig=void 0;var connectivity_state_1=require_connectivity_state(),constants_1=require_constants(),duration_1=require_duration2(),experimental_1=require_experimental(),load_balancer_1=require_load_balancer(),load_balancer_child_handler_1=require_load_balancer_child_handler(),picker_1=require_picker(),subchannel_address_1=require_subchannel_address(),subchannel_interface_1=require_subchannel_interface(),logging=require_logging(),TRACER_NAME="outlier_detection";function trace(text){logging.trace(constants_1.LogVerbosity.DEBUG,TRACER_NAME,text)}__name(trace,"trace");var TYPE_NAME="outlier_detection",OUTLIER_DETECTION_ENABLED=((_a=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)!==null&&_a!==void 0?_a:"true")==="true",defaultSuccessRateEjectionConfig={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},defaultFailurePercentageEjectionConfig={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function validateFieldType(obj,fieldName,expectedType,objectName){if(fieldName in obj&&obj[fieldName]!==void 0&&typeof obj[fieldName]!==expectedType){let fullFieldName=objectName?`${objectName}.${fieldName}`:fieldName;throw new Error(`outlier detection config ${fullFieldName} parse error: expected ${expectedType}, got ${typeof obj[fieldName]}`)}}__name(validateFieldType,"validateFieldType");function validatePositiveDuration(obj,fieldName,objectName){let fullFieldName=objectName?`${objectName}.${fieldName}`:fieldName;if(fieldName in obj&&obj[fieldName]!==void 0){if(!(0,duration_1.isDuration)(obj[fieldName]))throw new Error(`outlier detection config ${fullFieldName} parse error: expected Duration, got ${typeof obj[fieldName]}`);if(!(obj[fieldName].seconds>=0&&obj[fieldName].seconds<=315576e6&&obj[fieldName].nanos>=0&&obj[fieldName].nanos<=999999999))throw new Error(`outlier detection config ${fullFieldName} parse error: values out of range for non-negative Duaration`)}}__name(validatePositiveDuration,"validatePositiveDuration");function validatePercentage(obj,fieldName,objectName){let fullFieldName=objectName?`${objectName}.${fieldName}`:fieldName;if(validateFieldType(obj,fieldName,"number",objectName),fieldName in obj&&obj[fieldName]!==void 0&&!(obj[fieldName]>=0&&obj[fieldName]<=100))throw new Error(`outlier detection config ${fullFieldName} parse error: value out of range for percentage (0-100)`)}__name(validatePercentage,"validatePercentage");var OutlierDetectionLoadBalancingConfig=class{constructor(intervalMs,baseEjectionTimeMs,maxEjectionTimeMs,maxEjectionPercent,successRateEjection,failurePercentageEjection,childPolicy){if(this.childPolicy=childPolicy,childPolicy.getLoadBalancerName()==="pick_first")throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=intervalMs??1e4,this.baseEjectionTimeMs=baseEjectionTimeMs??3e4,this.maxEjectionTimeMs=maxEjectionTimeMs??3e5,this.maxEjectionPercent=maxEjectionPercent??10,this.successRateEjection=successRateEjection?Object.assign(Object.assign({},defaultSuccessRateEjectionConfig),successRateEjection):null,this.failurePercentageEjection=failurePercentageEjection?Object.assign(Object.assign({},defaultFailurePercentageEjectionConfig),failurePercentageEjection):null}getLoadBalancerName(){return TYPE_NAME}toJsonObject(){var _a2,_b;return{outlier_detection:{interval:(0,duration_1.msToDuration)(this.intervalMs),base_ejection_time:(0,duration_1.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,duration_1.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:(_a2=this.successRateEjection)!==null&&_a2!==void 0?_a2:void 0,failure_percentage_ejection:(_b=this.failurePercentageEjection)!==null&&_b!==void 0?_b: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(obj){var _a2;if(validatePositiveDuration(obj,"interval"),validatePositiveDuration(obj,"base_ejection_time"),validatePositiveDuration(obj,"max_ejection_time"),validatePercentage(obj,"max_ejection_percent"),"success_rate_ejection"in obj&&obj.success_rate_ejection!==void 0){if(typeof obj.success_rate_ejection!="object")throw new Error("outlier detection config success_rate_ejection must be an object");validateFieldType(obj.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),validatePercentage(obj.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),validateFieldType(obj.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),validateFieldType(obj.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in obj&&obj.failure_percentage_ejection!==void 0){if(typeof obj.failure_percentage_ejection!="object")throw new Error("outlier detection config failure_percentage_ejection must be an object");validatePercentage(obj.failure_percentage_ejection,"threshold","failure_percentage_ejection"),validatePercentage(obj.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),validateFieldType(obj.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),validateFieldType(obj.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in obj)||!Array.isArray(obj.child_policy))throw new Error("outlier detection config child_policy must be an array");let childPolicy=(0,load_balancer_1.selectLbConfigFromList)(obj.child_policy);if(!childPolicy)throw new Error("outlier detection config child_policy: no valid recognized policy found");return new OutlierDetectionLoadBalancingConfig(obj.interval?(0,duration_1.durationToMs)(obj.interval):null,obj.base_ejection_time?(0,duration_1.durationToMs)(obj.base_ejection_time):null,obj.max_ejection_time?(0,duration_1.durationToMs)(obj.max_ejection_time):null,(_a2=obj.max_ejection_percent)!==null&&_a2!==void 0?_a2:null,obj.success_rate_ejection,obj.failure_percentage_ejection,childPolicy)}};__name(OutlierDetectionLoadBalancingConfig,"OutlierDetectionLoadBalancingConfig");exports2.OutlierDetectionLoadBalancingConfig=OutlierDetectionLoadBalancingConfig;var OutlierDetectionSubchannelWrapper=class extends subchannel_interface_1.BaseSubchannelWrapper{constructor(childSubchannel,mapEntry){super(childSubchannel),this.mapEntry=mapEntry,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){let index=this.mapEntry.subchannelWrappers.indexOf(this);index>=0&&this.mapEntry.subchannelWrappers.splice(index,1)}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}};__name(OutlierDetectionSubchannelWrapper,"OutlierDetectionSubchannelWrapper");function createEmptyBucket(){return{success:0,failure:0}}__name(createEmptyBucket,"createEmptyBucket");var CallCounter=class{constructor(){this.activeBucket=createEmptyBucket(),this.inactiveBucket=createEmptyBucket()}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket=createEmptyBucket()}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}};__name(CallCounter,"CallCounter");var OutlierDetectionPicker=class{constructor(wrappedPicker,countCalls){this.wrappedPicker=wrappedPicker,this.countCalls=countCalls}pick(pickArgs){let wrappedPick=this.wrappedPicker.pick(pickArgs);if(wrappedPick.pickResultType===picker_1.PickResultType.COMPLETE){let subchannelWrapper=wrappedPick.subchannel,mapEntry=subchannelWrapper.getMapEntry();if(mapEntry){let onCallEnded=wrappedPick.onCallEnded;return this.countCalls&&(onCallEnded=__name(statusCode=>{var _a2;statusCode===constants_1.Status.OK?mapEntry.counter.addSuccess():mapEntry.counter.addFailure(),(_a2=wrappedPick.onCallEnded)===null||_a2===void 0||_a2.call(wrappedPick,statusCode)},"onCallEnded")),Object.assign(Object.assign({},wrappedPick),{subchannel:subchannelWrapper.getWrappedSubchannel(),onCallEnded})}else return Object.assign(Object.assign({},wrappedPick),{subchannel:subchannelWrapper.getWrappedSubchannel()})}else return wrappedPick}};__name(OutlierDetectionPicker,"OutlierDetectionPicker");var OutlierDetectionLoadBalancer=class{constructor(channelControlHelper,options){this.entryMap=new subchannel_address_1.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new load_balancer_child_handler_1.ChildLoadBalancerHandler((0,experimental_1.createChildChannelControlHelper)(channelControlHelper,{createSubchannel:(subchannelAddress,subchannelArgs)=>{let originalSubchannel=channelControlHelper.createSubchannel(subchannelAddress,subchannelArgs),mapEntry=this.entryMap.getForSubchannelAddress(subchannelAddress),subchannelWrapper=new OutlierDetectionSubchannelWrapper(originalSubchannel,mapEntry);return mapEntry?.currentEjectionTimestamp!==null&&subchannelWrapper.eject(),mapEntry?.subchannelWrappers.push(subchannelWrapper),subchannelWrapper},updateState:(connectivityState,picker)=>{connectivityState===connectivity_state_1.ConnectivityState.READY?channelControlHelper.updateState(connectivityState,new OutlierDetectionPicker(picker,this.isCountingEnabled())):channelControlHelper.updateState(connectivityState,picker)}}),options),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return this.latestConfig!==null&&(this.latestConfig.getSuccessRateEjectionConfig()!==null||this.latestConfig.getFailurePercentageEjectionConfig()!==null)}getCurrentEjectionPercent(){let ejectionCount=0;for(let mapEntry of this.entryMap.values())mapEntry.currentEjectionTimestamp!==null&&(ejectionCount+=1);return ejectionCount*100/this.entryMap.size}runSuccessRateCheck(ejectionTimestamp){if(!this.latestConfig)return;let successRateConfig=this.latestConfig.getSuccessRateEjectionConfig();if(!successRateConfig)return;trace("Running success rate check");let targetRequestVolume=successRateConfig.request_volume,addresesWithTargetVolume=0,successRates=[];for(let[endpoint,mapEntry]of this.entryMap.entries()){let successes=mapEntry.counter.getLastSuccesses(),failures=mapEntry.counter.getLastFailures();trace("Stats for "+(0,subchannel_address_1.endpointToString)(endpoint)+": successes="+successes+" failures="+failures+" targetRequestVolume="+targetRequestVolume),successes+failures>=targetRequestVolume&&(addresesWithTargetVolume+=1,successRates.push(successes/(successes+failures)))}if(trace("Found "+addresesWithTargetVolume+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+successRates+"]"),addresesWithTargetVolumea+b)/successRates.length,successRateDeviationSum=0;for(let rate of successRates){let deviation=rate-successRateMean;successRateDeviationSum+=deviation*deviation}let successRateVariance=successRateDeviationSum/successRates.length,successRateStdev=Math.sqrt(successRateVariance),ejectionThreshold=successRateMean-successRateStdev*(successRateConfig.stdev_factor/1e3);trace("stdev="+successRateStdev+" ejectionThreshold="+ejectionThreshold);for(let[address,mapEntry]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let successes=mapEntry.counter.getLastSuccesses(),failures=mapEntry.counter.getLastFailures();if(successes+failuresthis.runChecks(),delayMs),(_b=(_a2=this.ejectionTimer).unref)===null||_b===void 0||_b.call(_a2)}runChecks(){let ejectionTimestamp=new Date;if(trace("Ejection timer running"),this.switchAllBuckets(),!!this.latestConfig){this.timerStartTime=ejectionTimestamp,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(ejectionTimestamp),this.runFailurePercentageCheck(ejectionTimestamp);for(let[address,mapEntry]of this.entryMap.entries())if(mapEntry.currentEjectionTimestamp===null)mapEntry.ejectionTimeMultiplier>0&&(mapEntry.ejectionTimeMultiplier-=1);else{let baseEjectionTimeMs=this.latestConfig.getBaseEjectionTimeMs(),maxEjectionTimeMs=this.latestConfig.getMaxEjectionTimeMs(),returnTime=new Date(mapEntry.currentEjectionTimestamp.getTime());returnTime.setMilliseconds(returnTime.getMilliseconds()+Math.min(baseEjectionTimeMs*mapEntry.ejectionTimeMultiplier,Math.max(baseEjectionTimeMs,maxEjectionTimeMs))),returnTimecallCredentials.reduce((acc,other)=>acc.compose(other),channelCredentials),combineCallCredentials:(first,...additional)=>additional.reduce((acc,other)=>acc.compose(other),first),createInsecure:channel_credentials_1.ChannelCredentials.createInsecure,createSsl:channel_credentials_1.ChannelCredentials.createSsl,createFromSecureContext:channel_credentials_1.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:call_credentials_1.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:call_credentials_1.CallCredentials.createFromGoogleCredential,createEmpty:call_credentials_1.CallCredentials.createEmpty};var closeClient=__name(client=>client.close(),"closeClient");exports2.closeClient=closeClient;var waitForClientReady=__name((client,deadline,callback)=>client.waitForReady(deadline,callback),"waitForClientReady");exports2.waitForClientReady=waitForClientReady;var loadObject=__name((value,options)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")},"loadObject");exports2.loadObject=loadObject;var load=__name((filename,format,options)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")},"load");exports2.load=load;var setLogger=__name(logger=>{logging.setLogger(logger)},"setLogger");exports2.setLogger=setLogger;var setLogVerbosity=__name(verbosity=>{logging.setLoggerVerbosity(verbosity)},"setLogVerbosity");exports2.setLogVerbosity=setLogVerbosity;var getClientChannel=__name(client=>client_1.Client.prototype.getChannel.call(client),"getClientChannel");exports2.getClientChannel=getClientChannel;var client_interceptors_1=require_client_interceptors();Object.defineProperty(exports2,"ListenerBuilder",{enumerable:!0,get:function(){return client_interceptors_1.ListenerBuilder}});Object.defineProperty(exports2,"RequesterBuilder",{enumerable:!0,get:function(){return client_interceptors_1.RequesterBuilder}});Object.defineProperty(exports2,"InterceptingCall",{enumerable:!0,get:function(){return client_interceptors_1.InterceptingCall}});Object.defineProperty(exports2,"InterceptorConfigurationError",{enumerable:!0,get:function(){return client_interceptors_1.InterceptorConfigurationError}});var channelz_1=require_channelz();Object.defineProperty(exports2,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return channelz_1.getChannelzServiceDefinition}});Object.defineProperty(exports2,"getChannelzHandlers",{enumerable:!0,get:function(){return channelz_1.getChannelzHandlers}});var admin_1=require_admin();Object.defineProperty(exports2,"addAdminServicesToServer",{enumerable:!0,get:function(){return admin_1.addAdminServicesToServer}});var server_interceptors_1=require_server_interceptors();Object.defineProperty(exports2,"ServerListenerBuilder",{enumerable:!0,get:function(){return server_interceptors_1.ServerListenerBuilder}});Object.defineProperty(exports2,"ResponderBuilder",{enumerable:!0,get:function(){return server_interceptors_1.ResponderBuilder}});Object.defineProperty(exports2,"ServerInterceptingCall",{enumerable:!0,get:function(){return server_interceptors_1.ServerInterceptingCall}});var experimental=require_experimental();exports2.experimental=experimental;var resolver_dns=require_resolver_dns(),resolver_uds=require_resolver_uds(),resolver_ip=require_resolver_ip(),load_balancer_pick_first=require_load_balancer_pick_first(),load_balancer_round_robin=require_load_balancer_round_robin(),load_balancer_outlier_detection=require_load_balancer_outlier_detection(),channelz=require_channelz();resolver_dns.setup(),resolver_uds.setup(),resolver_ip.setup(),load_balancer_pick_first.setup(),load_balancer_round_robin.setup(),load_balancer_outlier_detection.setup(),channelz.setup()}});var require_protosList=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/protosList.json"(exports2,module2){module2.exports=["google/api/annotations.proto","google/api/apikeys/v2/apikeys.proto","google/api/apikeys/v2/resources.proto","google/api/auth.proto","google/api/backend.proto","google/api/billing.proto","google/api/client.proto","google/api/cloudquotas/v1/cloudquotas.proto","google/api/cloudquotas/v1/resources.proto","google/api/config_change.proto","google/api/consumer.proto","google/api/context.proto","google/api/control.proto","google/api/distribution.proto","google/api/documentation.proto","google/api/endpoint.proto","google/api/error_reason.proto","google/api/expr/conformance/v1alpha1/conformance_service.proto","google/api/expr/v1alpha1/checked.proto","google/api/expr/v1alpha1/eval.proto","google/api/expr/v1alpha1/explain.proto","google/api/expr/v1alpha1/syntax.proto","google/api/expr/v1alpha1/value.proto","google/api/expr/v1beta1/decl.proto","google/api/expr/v1beta1/eval.proto","google/api/expr/v1beta1/expr.proto","google/api/expr/v1beta1/source.proto","google/api/expr/v1beta1/value.proto","google/api/field_behavior.proto","google/api/field_info.proto","google/api/http.proto","google/api/httpbody.proto","google/api/label.proto","google/api/launch_stage.proto","google/api/log.proto","google/api/logging.proto","google/api/metric.proto","google/api/monitored_resource.proto","google/api/monitoring.proto","google/api/policy.proto","google/api/quota.proto","google/api/resource.proto","google/api/routing.proto","google/api/service.proto","google/api/servicecontrol/v1/check_error.proto","google/api/servicecontrol/v1/distribution.proto","google/api/servicecontrol/v1/http_request.proto","google/api/servicecontrol/v1/log_entry.proto","google/api/servicecontrol/v1/metric_value.proto","google/api/servicecontrol/v1/operation.proto","google/api/servicecontrol/v1/quota_controller.proto","google/api/servicecontrol/v1/service_controller.proto","google/api/servicecontrol/v2/service_controller.proto","google/api/servicemanagement/v1/resources.proto","google/api/servicemanagement/v1/servicemanager.proto","google/api/serviceusage/v1/resources.proto","google/api/serviceusage/v1/serviceusage.proto","google/api/serviceusage/v1beta1/resources.proto","google/api/serviceusage/v1beta1/serviceusage.proto","google/api/source_info.proto","google/api/system_parameter.proto","google/api/usage.proto","google/api/visibility.proto","google/cloud/location/locations.proto","google/iam/v1/iam_policy.proto","google/iam/v1/logging/audit_data.proto","google/iam/v1/options.proto","google/iam/v1/policy.proto","google/logging/type/http_request.proto","google/logging/type/log_severity.proto","google/longrunning/operations.proto","google/monitoring/v3/alert.proto","google/monitoring/v3/alert_service.proto","google/monitoring/v3/common.proto","google/monitoring/v3/dropped_labels.proto","google/monitoring/v3/group.proto","google/monitoring/v3/group_service.proto","google/monitoring/v3/metric.proto","google/monitoring/v3/metric_service.proto","google/monitoring/v3/mutation_record.proto","google/monitoring/v3/notification.proto","google/monitoring/v3/notification_service.proto","google/monitoring/v3/query_service.proto","google/monitoring/v3/service.proto","google/monitoring/v3/service_service.proto","google/monitoring/v3/snooze.proto","google/monitoring/v3/snooze_service.proto","google/monitoring/v3/span_context.proto","google/monitoring/v3/uptime.proto","google/monitoring/v3/uptime_service.proto","google/protobuf/any.proto","google/protobuf/api.proto","google/protobuf/bridge/message_set.proto","google/protobuf/compiler/plugin.proto","google/protobuf/compiler/ruby/ruby_generated_code.proto","google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto","google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto","google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto","google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto","google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto","google/protobuf/cpp_features.proto","google/protobuf/descriptor.proto","google/protobuf/duration.proto","google/protobuf/empty.proto","google/protobuf/field_mask.proto","google/protobuf/source_context.proto","google/protobuf/struct.proto","google/protobuf/timestamp.proto","google/protobuf/type.proto","google/protobuf/util/json_format.proto","google/protobuf/util/json_format_proto3.proto","google/protobuf/wrappers.proto","google/rpc/code.proto","google/rpc/context/attribute_context.proto","google/rpc/context/audit_context.proto","google/rpc/error_details.proto","google/rpc/http.proto","google/rpc/status.proto","google/type/calendar_period.proto","google/type/color.proto","google/type/date.proto","google/type/datetime.proto","google/type/dayofweek.proto","google/type/decimal.proto","google/type/expr.proto","google/type/fraction.proto","google/type/interval.proto","google/type/latlng.proto","google/type/localized_text.proto","google/type/money.proto","google/type/month.proto","google/type/phone_number.proto","google/type/postal_address.proto","google/type/quaternion.proto","google/type/timeofday.proto"]}});var require_grpc=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/grpc.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.GoogleProtoFilesRoot=exports2.GrpcClient=exports2.ClientStub=void 0;var grpcProtoLoader=require_src9(),child_process_1=require("child_process"),fs=require("fs"),google_auth_library_1=require_src6(),grpc=require_src10(),os=require("os"),path_1=require("path"),path=require("path"),protobuf=require_protobufjs(),objectHash=require_object_hash(),gax=require_gax(),googleProtoFilesDir=path.join(__dirname,"..","..","build","protos"),INCLUDE_DIRS=[];INCLUDE_DIRS.push(googleProtoFilesDir);var commonProtoFiles=require_protosList(),COMMON_PROTO_FILES=commonProtoFiles.map(file=>file.replace(/[/\\]/g,path.sep));async function readFileAsync(path2){return new Promise((resolve,reject)=>{fs.readFile(path2,"utf8",(err,content)=>{if(err)return reject(err);resolve(content)})})}__name(readFileAsync,"readFileAsync");async function execFileAsync(command,args){return new Promise((resolve,reject)=>{(0,child_process_1.execFile)(command,args,(err,stdout)=>{if(err)return reject(err);resolve(stdout)})})}__name(execFileAsync,"execFileAsync");var ClientStub=class extends grpc.Client{};__name(ClientStub,"ClientStub");exports2.ClientStub=ClientStub;var GrpcClient=class{static protoCacheKey(filename,options){if(!(!filename||Array.isArray(filename)&&(filename.length===0||!filename[0])))return JSON.stringify(filename)+" "+JSON.stringify(options)}static clearProtoCache(){GrpcClient.protoCache.clear()}constructor(options={}){var _a;this.auth=options.auth||new google_auth_library_1.GoogleAuth(options),this.fallback=!1;let minimumVersion=10,major=Number((_a=process.version.match(/^v(\d+)/))===null||_a===void 0?void 0:_a[1]);if(Number.isNaN(major)||major-1)return path.join(googleProtoFilesDir,filename);throw new Error(filename+" could not be found in "+protoPath)}loadProtoJSON(json,ignoreCache=!1){let hash=objectHash(JSON.stringify(json)).toString(),cached=GrpcClient.protoCache.get(hash);if(cached&&!ignoreCache)return cached;let options=GrpcClient.defaultOptions(),packageDefinition=grpcProtoLoader.fromJSON(json,options),grpcPackage=this.grpc.loadPackageDefinition(packageDefinition);return GrpcClient.protoCache.set(hash,grpcPackage),grpcPackage}metadataBuilder(headers){let Metadata=this.grpc.Metadata,baseMetadata=new Metadata;for(let key in headers){let value=headers[key];Array.isArray(value)?value.forEach(v=>baseMetadata.add(key,v)):baseMetadata.set(key,`${value}`)}return __name(function(abTests,moreHeaders){let copied=!1,metadata=baseMetadata;if(moreHeaders){for(let key in moreHeaders)if(key.toLowerCase()!=="x-goog-api-client"){copied||(copied=!0,metadata=metadata.clone());let value=moreHeaders[key];Array.isArray(value)?value.forEach(v=>metadata.add(key,v)):metadata.set(key,`${value}`)}}return metadata},"buildMetadata")}constructSettings(serviceName,clientConfig,configOverrides,headers){return gax.constructSettings(serviceName,clientConfig,configOverrides,this.grpc.status,{metadataBuilder:this.metadataBuilder(headers)})}async createStub(CreateStub,options,customServicePath){let grpcGcpOptions=["grpc.callInvocationTransformer","grpc.channelFactoryOverride","grpc.gcpApiConfig"],[cert,key]=await this._detectClientCertificate(options,options.universeDomain),servicePath=this._mtlsServicePath(options.servicePath,customServicePath,cert&&key),opts=Object.assign({},options,{cert,key,servicePath}),serviceAddress=servicePath+":"+opts.port;if(options.universeDomain||(options.universeDomain="googleapis.com"),options.universeDomain){let universeFromAuth=await this.auth.getUniverseDomain();if(universeFromAuth&&options.universeDomain!==universeFromAuth)throw new Error(`The configured universe domain (${options.universeDomain}) does not match the universe domain found in the credentials (${universeFromAuth}). If you haven't configured the universe domain explicitly, googleapis.com is the default.`)}let creds=await this._getCredentials(opts),grpcOptions={};return grpcOptions["grpc.max_receive_message_length"]=-1,grpcOptions["grpc.max_send_message_length"]=-1,grpcOptions["grpc.initial_reconnect_backoff_ms"]=1e3,Object.keys(opts).forEach(key2=>{let value=options[key2];key2.startsWith("grpc.grpc.")&&(key2=key2.replace(/^grpc\./,"")),key2.startsWith("grpc.")&&(grpcGcpOptions.includes(key2)&&(key2=key2.replace(/^grpc\./,"")),grpcOptions[key2]=value),key2.startsWith("grpc-node.")&&(grpcOptions[key2]=value)}),new CreateStub(serviceAddress,creds,grpcOptions)}async _detectClientCertificate(opts,universeDomain){var _a;let certRegex=/(?-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----)/s,keyRegex=/(?-----BEGIN PRIVATE KEY-----.*?-----END PRIVATE KEY-----)/s;if(typeof process<"u"&&((_a=process==null?void 0:process.env)===null||_a===void 0?void 0:_a.GOOGLE_API_USE_CLIENT_CERTIFICATE)==="true"){if(universeDomain&&universeDomain!=="googleapis.com")throw new Error("mTLS is not supported outside of googleapis.com universe domain.");if(opts?.cert&&opts?.key)return[opts.cert,opts.key];let metadataPath=(0,path_1.join)(os.homedir(),".secureConnect","context_aware_metadata.json"),metadata=JSON.parse(await readFileAsync(metadataPath));if(!metadata.cert_provider_command)throw Error("no cert_provider_command found");let stdout=await execFileAsync(metadata.cert_provider_command[0],metadata.cert_provider_command.slice(1)),matchCert=stdout.toString().match(certRegex),matchKey=stdout.toString().match(keyRegex);if(matchCert?.groups&&matchKey?.groups)return[matchCert.groups.cert,matchKey.groups.key];throw Error("unable to parse certificate and key")}return[void 0,void 0]}_mtlsServicePath(servicePath,customServicePath,hasCertificate){var _a,_b;return customServicePath||!servicePath||typeof process<"u"&&((_a=process==null?void 0:process.env)===null||_a===void 0?void 0:_a.GOOGLE_API_USE_MTLS_ENDPOINT)==="never"?servicePath:typeof process<"u"&&((_b=process==null?void 0:process.env)===null||_b===void 0?void 0:_b.GOOGLE_API_USE_MTLS_ENDPOINT)==="always"||hasCertificate?servicePath.replace("googleapis.com","mtls.googleapis.com"):servicePath}static createByteLengthFunction(message){return gax.createByteLengthFunction(message)}};__name(GrpcClient,"GrpcClient");exports2.GrpcClient=GrpcClient;GrpcClient.protoCache=new Map;var GoogleProtoFilesRoot=class extends protobuf.Root{constructor(...args){super(...args)}resolvePath(originPath,includePath){if(originPath=path.normalize(originPath),includePath=path.normalize(includePath),path.isAbsolute(includePath)){if(!fs.existsSync(includePath))throw new Error("The include `"+includePath+"` was not found.");return includePath}return COMMON_PROTO_FILES.indexOf(includePath)>-1?path.join(googleProtoFilesDir,includePath):GoogleProtoFilesRoot._findIncludePath(originPath,includePath)}static _findIncludePath(originPath,includePath){originPath=path.normalize(originPath),includePath=path.normalize(includePath);let current=originPath,found=fs.existsSync(path.join(current,includePath));for(;!found&¤t.length>0;)current=current.substring(0,current.lastIndexOf(path.sep)),found=fs.existsSync(path.join(current,includePath));if(!found)throw new Error("The include `"+includePath+"` was not found.");return path.join(current,includePath)}};__name(GoogleProtoFilesRoot,"GoogleProtoFilesRoot");exports2.GoogleProtoFilesRoot=GoogleProtoFilesRoot}});var require_src11=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/google-gax/build/src/index.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.serializer=exports2.warn=exports2.ChannelCredentials=exports2.makeUUID=exports2.fallback=exports2.protobufMinimal=exports2.protobuf=exports2.version=exports2.createByteLengthFunction=exports2.LocationsClient=exports2.IamClient=exports2.OperationsClient=exports2.LocationProtos=exports2.IamProtos=exports2.operationsProtos=exports2.lro=exports2.routingHeader=exports2.StreamType=exports2.Status=exports2.PathTemplate=exports2.operation=exports2.Operation=exports2.GrpcClient=exports2.GoogleProtoFilesRoot=exports2.ClientStub=exports2.GoogleError=exports2.createMaxRetriesBackoffSettings=exports2.createDefaultBackoffSettings=exports2.createBackoffSettings=exports2.createBundleOptions=exports2.createRetryOptions=exports2.RetryOptions=exports2.constructSettings=exports2.CallSettings=exports2.StreamDescriptor=exports2.PageDescriptor=exports2.LongrunningDescriptor=exports2.BundleDescriptor=exports2.createApiCall=exports2.OngoingCall=exports2.grpc=exports2.GoogleAuth=void 0;var grpc=require_src10();exports2.grpc=grpc;var grpc_1=require_grpc(),IamProtos=require_iam_service();exports2.IamProtos=IamProtos;var LocationProtos=require_locations();exports2.LocationProtos=LocationProtos;var operationsProtos=require_operations();exports2.operationsProtos=operationsProtos;var operationsClient=require_operationsClient(),routingHeader=require_routingHeader();exports2.routingHeader=routingHeader;var google_auth_library_1=require_src6();Object.defineProperty(exports2,"GoogleAuth",{enumerable:!0,get:function(){return google_auth_library_1.GoogleAuth}});var call_1=require_call();Object.defineProperty(exports2,"OngoingCall",{enumerable:!0,get:function(){return call_1.OngoingCall}});var createApiCall_1=require_createApiCall();Object.defineProperty(exports2,"createApiCall",{enumerable:!0,get:function(){return createApiCall_1.createApiCall}});var descriptor_1=require_descriptor();Object.defineProperty(exports2,"BundleDescriptor",{enumerable:!0,get:function(){return descriptor_1.BundleDescriptor}});Object.defineProperty(exports2,"LongrunningDescriptor",{enumerable:!0,get:function(){return descriptor_1.LongrunningDescriptor}});Object.defineProperty(exports2,"PageDescriptor",{enumerable:!0,get:function(){return descriptor_1.PageDescriptor}});Object.defineProperty(exports2,"StreamDescriptor",{enumerable:!0,get:function(){return descriptor_1.StreamDescriptor}});var gax_1=require_gax();Object.defineProperty(exports2,"CallSettings",{enumerable:!0,get:function(){return gax_1.CallSettings}});Object.defineProperty(exports2,"constructSettings",{enumerable:!0,get:function(){return gax_1.constructSettings}});Object.defineProperty(exports2,"RetryOptions",{enumerable:!0,get:function(){return gax_1.RetryOptions}});Object.defineProperty(exports2,"createRetryOptions",{enumerable:!0,get:function(){return gax_1.createRetryOptions}});Object.defineProperty(exports2,"createBundleOptions",{enumerable:!0,get:function(){return gax_1.createBundleOptions}});Object.defineProperty(exports2,"createBackoffSettings",{enumerable:!0,get:function(){return gax_1.createBackoffSettings}});Object.defineProperty(exports2,"createDefaultBackoffSettings",{enumerable:!0,get:function(){return gax_1.createDefaultBackoffSettings}});Object.defineProperty(exports2,"createMaxRetriesBackoffSettings",{enumerable:!0,get:function(){return gax_1.createMaxRetriesBackoffSettings}});var googleError_1=require_googleError();Object.defineProperty(exports2,"GoogleError",{enumerable:!0,get:function(){return googleError_1.GoogleError}});var grpc_2=require_grpc();Object.defineProperty(exports2,"ClientStub",{enumerable:!0,get:function(){return grpc_2.ClientStub}});Object.defineProperty(exports2,"GoogleProtoFilesRoot",{enumerable:!0,get:function(){return grpc_2.GoogleProtoFilesRoot}});Object.defineProperty(exports2,"GrpcClient",{enumerable:!0,get:function(){return grpc_2.GrpcClient}});var longrunning_1=require_longrunning();Object.defineProperty(exports2,"Operation",{enumerable:!0,get:function(){return longrunning_1.Operation}});Object.defineProperty(exports2,"operation",{enumerable:!0,get:function(){return longrunning_1.operation}});var pathTemplate_1=require_pathTemplate();Object.defineProperty(exports2,"PathTemplate",{enumerable:!0,get:function(){return pathTemplate_1.PathTemplate}});var status_1=require_status();Object.defineProperty(exports2,"Status",{enumerable:!0,get:function(){return status_1.Status}});var streaming_1=require_streaming();Object.defineProperty(exports2,"StreamType",{enumerable:!0,get:function(){return streaming_1.StreamType}});function lro(options){options=Object.assign({scopes:lro.ALL_SCOPES},options);let gaxGrpc=new grpc_1.GrpcClient(options);return new operationsClient.OperationsClientBuilder(gaxGrpc)}__name(lro,"lro");exports2.lro=lro;lro.SERVICE_ADDRESS=operationsClient.SERVICE_ADDRESS;lro.ALL_SCOPES=operationsClient.ALL_SCOPES;var operationsClient_1=require_operationsClient();Object.defineProperty(exports2,"OperationsClient",{enumerable:!0,get:function(){return operationsClient_1.OperationsClient}});var iamService_1=require_iamService();Object.defineProperty(exports2,"IamClient",{enumerable:!0,get:function(){return iamService_1.IamClient}});var locationService_1=require_locationService();Object.defineProperty(exports2,"LocationsClient",{enumerable:!0,get:function(){return locationService_1.LocationsClient}});exports2.createByteLengthFunction=grpc_1.GrpcClient.createByteLengthFunction;exports2.version=require_package3().version;var protobuf=require_protobufjs();exports2.protobuf=protobuf;exports2.protobufMinimal=require_minimal2();var fallback=require_fallback();exports2.fallback=fallback;var util_1=require_util2();Object.defineProperty(exports2,"makeUUID",{enumerable:!0,get:function(){return util_1.makeUUID}});var grpc_js_1=require_src10();Object.defineProperty(exports2,"ChannelCredentials",{enumerable:!0,get:function(){return grpc_js_1.ChannelCredentials}});var warnings_1=require_warnings();Object.defineProperty(exports2,"warn",{enumerable:!0,get:function(){return warnings_1.warn}});var serializer=require_src7();exports2.serializer=serializer}});var require_watch=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/watch.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.QueryWatch=exports2.DocumentWatch=exports2.WATCH_IDLE_TIMEOUT_MS=void 0;var assert=require("assert"),rbtree=require_rbtree(),google_gax_1=require_src11(),backoff_1=require_backoff(),document_1=require_document(),document_change_1=require_document_change(),logger_1=require_logger(),path_1=require_path2(),timestamp_1=require_timestamp2(),types_1=require_types2(),util_1=require_util6();var WATCH_TARGET_ID=1;exports2.WATCH_IDLE_TIMEOUT_MS=120*1e3;var REMOVED={};var ChangeType={added:"added",modified:"modified",removed:"removed"};var DOCUMENT_WATCH_COMPARATOR=__name((doc1,doc2)=>(assert(doc1===doc2,"Document watches only support one document."),0),"DOCUMENT_WATCH_COMPARATOR"),EMPTY_FUNCTION=__name(()=>{},"EMPTY_FUNCTION"),Watch=class{constructor(firestore,_converter=(0,types_1.defaultConverter)()){this._converter=_converter,this.isActive=!0,this.currentStream=null,this.resumeToken=void 0,this.docMap=new Map,this.changeMap=new Map,this.current=!1,this.hasPushed=!1,this.firestore=firestore,this.backoff=new backoff_1.ExponentialBackoff,this.requestTag=(0,util_1.requestTag)(),this.onNext=EMPTY_FUNCTION,this.onError=EMPTY_FUNCTION}onSnapshot(onNext,onError){assert(this.onNext===EMPTY_FUNCTION,"onNext should not already be defined."),assert(this.onError===EMPTY_FUNCTION,"onError should not already be defined."),assert(this.docTree===void 0,"docTree should not already be defined."),this.onNext=onNext,this.onError=onError,this.docTree=rbtree(this.getComparator()),this.initStream();let unsubscribe=__name(()=>{(0,logger_1.logger)("Watch.onSnapshot",this.requestTag,"Unsubscribe called"),this.onNext=()=>{},this.onError=()=>{},this.shutdown()},"unsubscribe");return this.firestore.registerListener(),unsubscribe}currentSize(){let changes=this.extractCurrentChanges(timestamp_1.Timestamp.now());return this.docMap.size+changes.adds.length-changes.deletes.length}extractCurrentChanges(readTime){let deletes=[],adds=[],updates=[];return this.changeMap.forEach((value,name)=>{value===REMOVED?this.docMap.has(name)&&deletes.push(name):this.docMap.has(name)?(value.readTime=readTime,updates.push(value.build())):(value.readTime=readTime,adds.push(value.build()))}),{deletes,adds,updates}}resetDocs(){(0,logger_1.logger)("Watch.resetDocs",this.requestTag,"Resetting documents"),this.changeMap.clear(),this.resumeToken=void 0,this.docTree.forEach(snapshot=>{this.changeMap.set(snapshot.ref.path,REMOVED)}),this.current=!1}closeStream(err){this.isActive&&((0,logger_1.logger)("Watch.closeStream",this.requestTag,"Invoking onError: ",err),this.onError(err)),this.shutdown()}maybeReopenStream(err){this.isActive&&!this.isPermanentWatchError(err)?((0,logger_1.logger)("Watch.maybeReopenStream",this.requestTag,"Stream ended, re-opening after retryable error:",err),this.changeMap.clear(),this.isResourceExhaustedError(err)&&this.backoff.resetToMax(),this.initStream()):this.closeStream(err)}resetIdleTimeout(){this.idleTimeoutHandle&&clearTimeout(this.idleTimeoutHandle),this.idleTimeoutHandle=(0,backoff_1.delayExecution)(()=>{var _a;(0,logger_1.logger)("Watch.resetIdleTimeout",this.requestTag,"Resetting stream after idle timeout"),(_a=this.currentStream)===null||_a===void 0||_a.end(),this.currentStream=null;let error=new google_gax_1.GoogleError("Watch stream idle timeout");error.code=google_gax_1.Status.UNKNOWN,this.maybeReopenStream(error)},exports2.WATCH_IDLE_TIMEOUT_MS)}resetStream(){(0,logger_1.logger)("Watch.resetStream",this.requestTag,"Restarting stream"),this.currentStream&&(this.currentStream.end(),this.currentStream=null),this.initStream()}initStream(){this.backoff.backoffAndWait().then(async()=>{if(!this.isActive){(0,logger_1.logger)("Watch.initStream",this.requestTag,"Not initializing inactive stream");return}await this.firestore.initializeIfNeeded(this.requestTag);let request={};return request.database=this.firestore.formattedName,request.addTarget=this.getTarget(this.resumeToken),this.firestore.requestStream("listen",!0,request,this.requestTag).then(backendStream=>{if(!this.isActive){(0,logger_1.logger)("Watch.initStream",this.requestTag,"Closing inactive stream"),backendStream.emit("end");return}(0,logger_1.logger)("Watch.initStream",this.requestTag,"Opened new stream"),this.currentStream=backendStream,this.resetIdleTimeout(),this.currentStream.on("data",proto=>{this.resetIdleTimeout(),this.onData(proto)}).on("error",err=>{this.currentStream===backendStream&&(this.currentStream=null,this.maybeReopenStream(err))}).on("end",()=>{if(this.currentStream===backendStream){this.currentStream=null;let err=new google_gax_1.GoogleError("Stream ended unexpectedly");err.code=google_gax_1.Status.UNKNOWN,this.maybeReopenStream(err)}}),this.currentStream.resume()})}).catch(err=>{this.closeStream(err)})}onData(proto){if(proto.targetChange){(0,logger_1.logger)("Watch.onData",this.requestTag,"Processing target change");let change=proto.targetChange,noTargetIds=!change.targetIds||change.targetIds.length===0;if(change.targetChangeType==="NO_CHANGE")noTargetIds&&change.readTime&&this.current&&this.pushSnapshot(timestamp_1.Timestamp.fromProto(change.readTime),change.resumeToken);else if(change.targetChangeType==="ADD")WATCH_TARGET_ID!==change.targetIds[0]&&this.closeStream(Error("Unexpected target ID sent by server"));else if(change.targetChangeType==="REMOVE"){let code=google_gax_1.Status.INTERNAL,message="internal error";change.cause&&(code=change.cause.code,message=change.cause.message),this.closeStream(new Error("Error "+code+": "+message))}else change.targetChangeType==="RESET"?this.resetDocs():change.targetChangeType==="CURRENT"?this.current=!0:this.closeStream(new Error("Unknown target change type: "+JSON.stringify(change)));change.resumeToken&&this.affectsTarget(change.targetIds,WATCH_TARGET_ID)&&this.backoff.reset()}else if(proto.documentChange){(0,logger_1.logger)("Watch.onData",this.requestTag,"Processing change event");let targetIds=proto.documentChange.targetIds||[],removedTargetIds=proto.documentChange.removedTargetIds||[],changed=!1,removed=!1;for(let i=0;i0){(0,logger_1.logger)("Watch.pushSnapshot",this.requestTag,"Sending snapshot with %d changes and %d documents",String(appliedChanges.length),this.docTree.length);let currentTree=this.docTree;this.onNext(readTime,currentTree.length,()=>currentTree.keys,()=>appliedChanges),this.hasPushed=!0}this.changeMap.clear(),this.resumeToken=nextResumeToken}deleteDoc(name){assert(this.docMap.has(name),"Document to delete does not exist");let oldDocument=this.docMap.get(name),existing=this.docTree.find(oldDocument),oldIndex=existing.index;return this.docTree=existing.remove(),this.docMap.delete(name),new document_change_1.DocumentChange(ChangeType.removed,oldDocument,oldIndex,-1)}addDoc(newDocument){let name=newDocument.ref.path;assert(!this.docMap.has(name),"Document to add already exists"),this.docTree=this.docTree.insert(newDocument,null);let newIndex=this.docTree.find(newDocument).index;return this.docMap.set(name,newDocument),new document_change_1.DocumentChange(ChangeType.added,newDocument,-1,newIndex)}modifyDoc(newDocument){let name=newDocument.ref.path;if(assert(this.docMap.has(name),"Document to modify does not exist"),!this.docMap.get(name).updateTime.isEqual(newDocument.updateTime)){let removeChange=this.deleteDoc(name),addChange=this.addDoc(newDocument);return new document_change_1.DocumentChange(ChangeType.modified,newDocument,removeChange.oldIndex,addChange.newIndex)}return null}computeSnapshot(readTime){let changeSet=this.extractCurrentChanges(readTime),appliedChanges=[];return changeSet.deletes.sort((name1,name2)=>this.getComparator()(this.docMap.get(name1),this.docMap.get(name2))),changeSet.deletes.forEach(name=>{let change=this.deleteDoc(name);appliedChanges.push(change)}),changeSet.adds.sort(this.getComparator()),changeSet.adds.forEach(snapshot=>{let change=this.addDoc(snapshot);appliedChanges.push(change)}),changeSet.updates.sort(this.getComparator()),changeSet.updates.forEach(snapshot=>{let change=this.modifyDoc(snapshot);change&&appliedChanges.push(change)}),assert(this.docTree.length===this.docMap.size,"The update document tree and document map should have the same number of entries."),appliedChanges}isPermanentWatchError(error){if(error.code===void 0)return(0,logger_1.logger)("Watch.isPermanentError",this.requestTag,"Unable to determine error code: ",error),!1;switch(error.code){case google_gax_1.Status.ABORTED:case google_gax_1.Status.CANCELLED:case google_gax_1.Status.UNKNOWN:case google_gax_1.Status.DEADLINE_EXCEEDED:case google_gax_1.Status.RESOURCE_EXHAUSTED:case google_gax_1.Status.INTERNAL:case google_gax_1.Status.UNAVAILABLE:case google_gax_1.Status.UNAUTHENTICATED:return!1;default:return!0}}isResourceExhaustedError(error){return error.code===google_gax_1.Status.RESOURCE_EXHAUSTED}shutdown(){var _a;this.isActive&&(this.isActive=!1,this.idleTimeoutHandle&&(clearTimeout(this.idleTimeoutHandle),this.idleTimeoutHandle=void 0),this.firestore.unregisterListener()),(_a=this.currentStream)===null||_a===void 0||_a.end(),this.currentStream=null}};__name(Watch,"Watch");var DocumentWatch=class extends Watch{constructor(firestore,ref){super(firestore,ref._converter),this.ref=ref}getComparator(){return DOCUMENT_WATCH_COMPARATOR}getTarget(resumeToken){return{documents:{documents:[this.ref.formattedName]},targetId:WATCH_TARGET_ID,resumeToken}}};__name(DocumentWatch,"DocumentWatch");exports2.DocumentWatch=DocumentWatch;var QueryWatch=class extends Watch{constructor(firestore,query,converter){super(firestore,converter),this.query=query,this.comparator=query.comparator()}getComparator(){return this.query.comparator()}getTarget(resumeToken){return{query:this.query.toProto(),targetId:WATCH_TARGET_ID,resumeToken}}};__name(QueryWatch,"QueryWatch");exports2.QueryWatch=QueryWatch}});var require_reference=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/reference.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.validateDocumentReference=exports2.validateQueryOperator=exports2.validateQueryOrder=exports2.AggregateQuerySnapshot=exports2.AggregateQuery=exports2.CollectionReference=exports2.Query=exports2.QueryOptions=exports2.QuerySnapshot=exports2.FieldOrder=exports2.DocumentReference=void 0;var assert=require("assert"),stream_1=require("stream"),deepEqual=require_fast_deep_equal(),document_1=require_document(),document_change_1=require_document_change(),logger_1=require_logger(),order_1=require_order(),path_1=require_path2(),serializer_1=require_serializer(),timestamp_1=require_timestamp2(),types_1=require_types2(),util_1=require_util6(),validate_1=require_validate(),write_batch_1=require_write_batch(),filter_1=require_filter(),aggregate_1=require_aggregate(),directionOperators={asc:"ASCENDING",desc:"DESCENDING"},comparisonOperators={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},NOOP_MESSAGE=Symbol("a noop message"),DocumentReference2=class{constructor(_firestore,_path,_converter=(0,types_1.defaultConverter)()){this._firestore=_firestore,this._path=_path,this._converter=_converter}get formattedName(){let projectId=this.firestore.projectId,databaseId=this.firestore.databaseId;return this._path.toQualifiedResourcePath(projectId,databaseId).formattedName}get firestore(){return this._firestore}get path(){return this._path.relativeName}get id(){return this._path.id}get _resourcePath(){return this._path}get parent(){return new CollectionReference(this._firestore,this._path.parent(),this._converter)}get(){return this._firestore.getAll(this).then(([result])=>result)}collection(collectionPath){(0,path_1.validateResourcePath)("collectionPath",collectionPath);let path=this._path.append(collectionPath);if(!path.isCollection)throw new Error(`Value for argument "collectionPath" must point to a collection, but was "${collectionPath}". Your path does not contain an odd number of components.`);return new CollectionReference(this._firestore,path)}listCollections(){let tag=(0,util_1.requestTag)();return this.firestore.initializeIfNeeded(tag).then(()=>{let request={parent:this.formattedName,pageSize:Math.pow(2,16)-1};return this._firestore.request("listCollectionIds",request,tag).then(collectionIds=>{let collections=[];collectionIds.sort();for(let collectionId of collectionIds)collections.push(this.collection(collectionId));return collections})})}create(data){return new write_batch_1.WriteBatch(this._firestore).create(this,data).commit().then(([writeResult])=>writeResult)}delete(precondition){return new write_batch_1.WriteBatch(this._firestore).delete(this,precondition).commit().then(([writeResult])=>writeResult)}set(data,options){let writeBatch=new write_batch_1.WriteBatch(this._firestore);return options?writeBatch=writeBatch.set(this,data,options):writeBatch=writeBatch.set(this,data),writeBatch.commit().then(([writeResult])=>writeResult)}update(dataOrField,...preconditionOrValues){return(0,validate_1.validateMinNumberOfArguments)("DocumentReference.update",arguments,1),new write_batch_1.WriteBatch(this._firestore).update(this,dataOrField,...preconditionOrValues).commit().then(([writeResult])=>writeResult)}onSnapshot(onNext,onError){return(0,validate_1.validateFunction)("onNext",onNext),(0,validate_1.validateFunction)("onError",onError,{optional:!0}),new(require_watch()).DocumentWatch(this.firestore,this).onSnapshot((readTime,size,docs)=>{for(let document3 of docs())if(document3.ref.path===this.path){onNext(document3);return}let ref=new DocumentReference2(this._firestore,this._path,this._converter),document2=new document_1.DocumentSnapshotBuilder(ref);document2.readTime=readTime,onNext(document2.build())},onError||console.error)}isEqual(other){return this===other||other instanceof DocumentReference2&&this._firestore===other._firestore&&this._path.isEqual(other._path)&&this._converter===other._converter}toProto(){return{referenceValue:this.formattedName}}withConverter(converter){return new DocumentReference2(this.firestore,this._path,converter??(0,types_1.defaultConverter)())}};__name(DocumentReference2,"DocumentReference");exports2.DocumentReference=DocumentReference2;var FieldOrder=class{constructor(field,direction="ASCENDING"){this.field=field,this.direction=direction}toProto(){return{field:{fieldPath:this.field.formattedName},direction:this.direction}}};__name(FieldOrder,"FieldOrder");exports2.FieldOrder=FieldOrder;var FilterInternal=class{};__name(FilterInternal,"FilterInternal");var CompositeFilterInternal=class extends FilterInternal{constructor(filters,operator){super(),this.filters=filters,this.operator=operator,this.memoizedFlattenedFilters=null}getFilters(){return this.filters}isConjunction(){return this.operator==="AND"}getFlattenedFilters(){return this.memoizedFlattenedFilters!==null?this.memoizedFlattenedFilters:(this.memoizedFlattenedFilters=this.filters.reduce((allFilters,subfilter)=>allFilters.concat(subfilter.getFlattenedFilters()),[]),this.memoizedFlattenedFilters)}toProto(){return this.filters.length===1?this.filters[0].toProto():{compositeFilter:{op:this.operator,filters:this.filters.map(filter=>filter.toProto())}}}isEqual(other){if(other instanceof CompositeFilterInternal){let otherFilters=other.getFilters();return this.operator===other.operator&&this.getFilters().length===other.getFilters().length&&this.getFilters().every((filter,index)=>filter.isEqual(otherFilters[index]))}else return!1}};__name(CompositeFilterInternal,"CompositeFilterInternal");var FieldFilterInternal=class extends FilterInternal{getFlattenedFilters(){return[this]}getFilters(){return[this]}constructor(serializer,field,op,value){super(),this.serializer=serializer,this.field=field,this.op=op,this.value=value}isInequalityFilter(){switch(this.op){case"GREATER_THAN":case"GREATER_THAN_OR_EQUAL":case"LESS_THAN":case"LESS_THAN_OR_EQUAL":case"NOT_EQUAL":case"NOT_IN":return!0;default:return!1}}toProto(){return typeof this.value=="number"&&isNaN(this.value)?{unaryFilter:{field:{fieldPath:this.field.formattedName},op:this.op==="EQUAL"?"IS_NAN":"IS_NOT_NAN"}}:this.value===null?{unaryFilter:{field:{fieldPath:this.field.formattedName},op:this.op==="EQUAL"?"IS_NULL":"IS_NOT_NULL"}}:{fieldFilter:{field:{fieldPath:this.field.formattedName},op:this.op,value:this.serializer.encodeValue(this.value)}}}isEqual(other){return other instanceof FieldFilterInternal&&this.field.isEqual(other.field)&&this.op===other.op&&deepEqual(this.value,other.value)}};__name(FieldFilterInternal,"FieldFilterInternal");var QuerySnapshot=class{constructor(_query,_readTime,_size,docs,changes){this._query=_query,this._readTime=_readTime,this._size=_size,this._materializedDocs=null,this._materializedChanges=null,this._docs=null,this._changes=null,this._docs=docs,this._changes=changes}get query(){return this._query}get docs(){return this._materializedDocs?this._materializedDocs:(this._materializedDocs=this._docs(),this._docs=null,this._materializedDocs)}get empty(){return this._size===0}get size(){return this._size}get readTime(){return this._readTime}docChanges(){return this._materializedChanges?this._materializedChanges:(this._materializedChanges=this._changes(),this._changes=null,this._materializedChanges)}forEach(callback,thisArg){(0,validate_1.validateFunction)("callback",callback);for(let doc of this.docs)callback.call(thisArg,doc)}isEqual(other){return this===other?!0:!(other instanceof QuerySnapshot)||this._size!==other._size||!this._query.isEqual(other._query)?!1:this._materializedDocs&&!this._materializedChanges?isArrayEqual(this.docs,other.docs)&&isArrayEqual(this.docChanges(),other.docChanges()):isArrayEqual(this.docChanges(),other.docChanges())&&isArrayEqual(this.docs,other.docs)}};__name(QuerySnapshot,"QuerySnapshot");exports2.QuerySnapshot=QuerySnapshot;var LimitType;(function(LimitType2){LimitType2[LimitType2.First=0]="First",LimitType2[LimitType2.Last=1]="Last"})(LimitType||(LimitType={}));var QueryOptions=class{constructor(parentPath,collectionId,converter,allDescendants,filters,fieldOrders,startAt,endAt,limit,limitType,offset,projection,kindless=!1,requireConsistency=!0){this.parentPath=parentPath,this.collectionId=collectionId,this.converter=converter,this.allDescendants=allDescendants,this.filters=filters,this.fieldOrders=fieldOrders,this.startAt=startAt,this.endAt=endAt,this.limit=limit,this.limitType=limitType,this.offset=offset,this.projection=projection,this.kindless=kindless,this.requireConsistency=requireConsistency}static forCollectionGroupQuery(collectionId,converter=(0,types_1.defaultConverter)()){return new QueryOptions(path_1.ResourcePath.EMPTY,collectionId,converter,!0,[],[])}static forCollectionQuery(collectionRef,converter=(0,types_1.defaultConverter)()){return new QueryOptions(collectionRef.parent(),collectionRef.id,converter,!1,[],[])}static forKindlessAllDescendants(parent,id,requireConsistency=!0){let options=new QueryOptions(parent,id,(0,types_1.defaultConverter)(),!0,[],[]);return options=options.with({kindless:!0,requireConsistency}),options}with(settings){return new QueryOptions(coalesce(settings.parentPath,this.parentPath),coalesce(settings.collectionId,this.collectionId),this.converter,coalesce(settings.allDescendants,this.allDescendants),coalesce(settings.filters,this.filters),coalesce(settings.fieldOrders,this.fieldOrders),coalesce(settings.startAt,this.startAt),coalesce(settings.endAt,this.endAt),coalesce(settings.limit,this.limit),coalesce(settings.limitType,this.limitType),coalesce(settings.offset,this.offset),coalesce(settings.projection,this.projection),coalesce(settings.kindless,this.kindless),coalesce(settings.requireConsistency,this.requireConsistency))}withConverter(converter){return new QueryOptions(this.parentPath,this.collectionId,converter,this.allDescendants,this.filters,this.fieldOrders,this.startAt,this.endAt,this.limit,this.limitType,this.offset,this.projection)}hasFieldOrders(){return this.fieldOrders.length>0}isEqual(other){return this===other?!0:other instanceof QueryOptions&&this.parentPath.isEqual(other.parentPath)&&this.filtersEqual(other.filters)&&this.collectionId===other.collectionId&&this.converter===other.converter&&this.allDescendants===other.allDescendants&&this.limit===other.limit&&this.offset===other.offset&&deepEqual(this.fieldOrders,other.fieldOrders)&&deepEqual(this.startAt,other.startAt)&&deepEqual(this.endAt,other.endAt)&&deepEqual(this.projection,other.projection)&&this.kindless===other.kindless&&this.requireConsistency===other.requireConsistency}filtersEqual(other){if(this.filters.length!==other.length)return!1;for(let i=0;ithis.validateReference(el))}else value=this.validateReference(value)}return new FieldFilterInternal(this._serializer,path,comparisonOperators[operator],value)}_parseCompositeFilter(compositeFilterData){let parsedFilters=compositeFilterData._getFilters().map(filter=>this._parseFilter(filter)).filter(parsedFilter=>parsedFilter.getFilters().length>0);return parsedFilters.length===1?parsedFilters[0]:new CompositeFilterInternal(parsedFilters,compositeFilterData._getOperator()==="AND"?"AND":"OR")}select(...fieldPaths){let fields=[];if(fieldPaths.length===0)fields.push({fieldPath:path_1.FieldPath.documentId().formattedName});else for(let i=0;ia.compareTo(b))}createImplicitOrderBy(cursorValuesOrDocumentSnapshot){if(cursorValuesOrDocumentSnapshot.length!==1||!(cursorValuesOrDocumentSnapshot[0]instanceof document_1.DocumentSnapshot))return this._queryOptions.fieldOrders;let fieldOrders=this._queryOptions.fieldOrders.slice(),fieldsNormalized=new Set([...fieldOrders.map(item=>item.field.toString())]),lastDirection=fieldOrders.length===0?directionOperators.ASC:fieldOrders[fieldOrders.length-1].direction,inequalityFields=this.getInequalityFilterFields();for(let field of inequalityFields)!fieldsNormalized.has(field.toString())&&!field.isEqual(path_1.FieldPath.documentId())&&(fieldOrders.push(new FieldOrder(field,lastDirection)),fieldsNormalized.add(field.toString()));return fieldsNormalized.has(path_1.FieldPath.documentId().toString())||fieldOrders.push(new FieldOrder(path_1.FieldPath.documentId(),lastDirection)),fieldOrders}createCursor(fieldOrders,cursorValuesOrDocumentSnapshot,before){let fieldValues;if(cursorValuesOrDocumentSnapshot.length===1&&cursorValuesOrDocumentSnapshot[0]instanceof document_1.DocumentSnapshot?fieldValues=Query._extractFieldValues(cursorValuesOrDocumentSnapshot[0],fieldOrders):fieldValues=cursorValuesOrDocumentSnapshot,fieldValues.length>fieldOrders.length)throw new Error("Too many cursor values specified. The specified values must match the orderBy() constraints of the query.");let options={values:[],before};for(let i=0;i{let readTime;this._stream(transactionId).on("error",err=>{reject((0,util_1.wrapError)(err,stack))}).on("data",result=>{readTime=result.readTime,result.document&&docs.push(result.document)}).on("end",()=>{this._queryOptions.limitType===LimitType.Last&&docs.reverse(),resolve(new QuerySnapshot(this,readTime,docs.length,()=>docs,()=>{let changes=[];for(let i=0;itransform.destroy(e)),transform}toCursor(cursor){if(cursor)return cursor.before?{before:!0,values:cursor.values}:{values:cursor.values}}toProto(transactionIdOrReadTime){let projectId=this.firestore.projectId,databaseId=this.firestore.databaseId,parentPath=this._queryOptions.parentPath.toQualifiedResourcePath(projectId,databaseId),structuredQuery=this.toStructuredQuery();if(this._queryOptions.limitType===LimitType.Last){if(!this._queryOptions.hasFieldOrders())throw new Error("limitToLast() queries require specifying at least one orderBy() clause.");structuredQuery.orderBy=this._queryOptions.fieldOrders.map(order=>{let dir=order.direction==="DESCENDING"?"ASCENDING":"DESCENDING";return new FieldOrder(order.field,dir).toProto()}),structuredQuery.startAt=this._queryOptions.endAt?this.toCursor({values:this._queryOptions.endAt.values,before:!this._queryOptions.endAt.before}):void 0,structuredQuery.endAt=this._queryOptions.startAt?this.toCursor({values:this._queryOptions.startAt.values,before:!this._queryOptions.startAt.before}):void 0}let runQueryRequest={parent:parentPath.formattedName,structuredQuery};return transactionIdOrReadTime instanceof Uint8Array?runQueryRequest.transaction=transactionIdOrReadTime:transactionIdOrReadTime instanceof timestamp_1.Timestamp&&(runQueryRequest.readTime=transactionIdOrReadTime.toProto().timestampValue),runQueryRequest}_toBundledQuery(){let projectId=this.firestore.projectId,databaseId=this.firestore.databaseId,parentPath=this._queryOptions.parentPath.toQualifiedResourcePath(projectId,databaseId),structuredQuery=this.toStructuredQuery(),bundledQuery={parent:parentPath.formattedName,structuredQuery};return this._queryOptions.limitType===LimitType.First?bundledQuery.limitType="FIRST":this._queryOptions.limitType===LimitType.Last&&(bundledQuery.limitType="LAST"),bundledQuery}toStructuredQuery(){let structuredQuery={from:[{}]};return this._queryOptions.allDescendants&&(structuredQuery.from[0].allDescendants=!0),this._queryOptions.kindless||(structuredQuery.from[0].collectionId=this._queryOptions.collectionId),this._queryOptions.filters.length>=1&&(structuredQuery.where=new CompositeFilterInternal(this._queryOptions.filters,"AND").toProto()),this._queryOptions.hasFieldOrders()&&(structuredQuery.orderBy=this._queryOptions.fieldOrders.map(o=>o.toProto())),structuredQuery.startAt=this.toCursor(this._queryOptions.startAt),structuredQuery.endAt=this.toCursor(this._queryOptions.endAt),this._queryOptions.limit&&(structuredQuery.limit={value:this._queryOptions.limit}),structuredQuery.offset=this._queryOptions.offset,structuredQuery.select=this._queryOptions.projection,structuredQuery}_isPermanentRpcError(err,methodName){return(0,util_1.isPermanentRpcError)(err,methodName)}_stream(transactionId){let tag=(0,util_1.requestTag)(),lastReceivedDocument=null,backendStream,stream=new stream_1.Transform({objectMode:!0,transform:(proto,enc,callback)=>{if(proto===NOOP_MESSAGE){callback(void 0);return}let readTime=timestamp_1.Timestamp.fromProto(proto.readTime);if(proto.document){let document2=this.firestore.snapshot_(proto.document,proto.readTime),finalDoc=new document_1.DocumentSnapshotBuilder(document2.ref.withConverter(this._queryOptions.converter));finalDoc.fieldsProto=document2._fieldsProto,finalDoc.readTime=document2.readTime,finalDoc.createTime=document2.createTime,finalDoc.updateTime=document2.updateTime,lastReceivedDocument=finalDoc.build(),callback(void 0,{document:lastReceivedDocument,readTime}),proto.done&&((0,logger_1.logger)("Query._stream",tag,"Trigger Logical Termination."),backendStream.unpipe(stream),backendStream.resume(),backendStream.end(),stream.end())}else callback(void 0,{readTime})}});return this.firestore.initializeIfNeeded(tag).then(async()=>{let request=this.toProto(transactionId),streamActive;do streamActive=new util_1.Deferred,backendStream=await this._firestore.requestStream("runQuery",!1,request,tag),backendStream.on("error",err=>{backendStream.unpipe(stream),!transactionId&&!this._isPermanentRpcError(err,"runQuery")?((0,logger_1.logger)("Query._stream",tag,"Query failed with retryable stream error:",err),stream.write(NOOP_MESSAGE,()=>{lastReceivedDocument&&(this._queryOptions.requireConsistency?request=this.startAfter(lastReceivedDocument).toProto(lastReceivedDocument.readTime):request=this.startAfter(lastReceivedDocument).toProto()),streamActive.resolve(!0)})):((0,logger_1.logger)("Query._stream",tag,"Query failed with stream error:",err),stream.destroy(err),streamActive.resolve(!1))}),backendStream.on("end",()=>{streamActive.resolve(!1)}),backendStream.resume(),backendStream.pipe(stream);while(await streamActive.promise)}).catch(e=>stream.destroy(e)),stream}onSnapshot(onNext,onError){return(0,validate_1.validateFunction)("onNext",onNext),(0,validate_1.validateFunction)("onError",onError,{optional:!0}),new(require_watch()).QueryWatch(this.firestore,this,this._queryOptions.converter).onSnapshot((readTime,size,docs,changes)=>{onNext(new QuerySnapshot(this,readTime,size,docs,changes))},onError||console.error)}comparator(){return(doc1,doc2)=>{let lastDirection=this._queryOptions.hasFieldOrders()?this._queryOptions.fieldOrders[this._queryOptions.fieldOrders.length-1].direction:"ASCENDING",orderBys=this._queryOptions.fieldOrders.concat(new FieldOrder(path_1.FieldPath.documentId(),lastDirection));for(let orderBy of orderBys){let comp;if(path_1.FieldPath.documentId().isEqual(orderBy.field))comp=doc1.ref._path.compareTo(doc2.ref._path);else{let v12=doc1.protoField(orderBy.field),v2=doc2.protoField(orderBy.field);if(v12===void 0||v2===void 0)throw new Error("Trying to compare documents on fields that don't exist. Please include the fields you are ordering on in your select() call.");comp=(0,order_1.compare)(v12,v2)}if(comp!==0)return(orderBy.direction==="ASCENDING"?1:-1)*comp}return 0}}withConverter(converter){return new Query(this.firestore,this._queryOptions.withConverter(converter??(0,types_1.defaultConverter)()))}};__name(Query,"Query");exports2.Query=Query;var CollectionReference=class extends Query{constructor(firestore,path,converter){super(firestore,QueryOptions.forCollectionQuery(path,converter))}get _resourcePath(){return this._queryOptions.parentPath.append(this._queryOptions.collectionId)}get id(){return this._queryOptions.collectionId}get parent(){return this._queryOptions.parentPath.isDocument?new DocumentReference2(this.firestore,this._queryOptions.parentPath):null}get path(){return this._resourcePath.relativeName}listDocuments(){let tag=(0,util_1.requestTag)();return this.firestore.initializeIfNeeded(tag).then(()=>{let request={parent:this._queryOptions.parentPath.toQualifiedResourcePath(this.firestore.projectId,this.firestore.databaseId).formattedName,collectionId:this.id,showMissing:!0,pageSize:Math.pow(2,16)-1,mask:{fieldPaths:[]}};return this.firestore.request("listDocuments",request,tag).then(documents=>documents.map(doc=>{let path=path_1.QualifiedResourcePath.fromSlashSeparatedString(doc.name);return this.doc(path.id)}))})}doc(documentPath){arguments.length===0?documentPath=(0,util_1.autoId)():(0,path_1.validateResourcePath)("documentPath",documentPath);let path=this._resourcePath.append(documentPath);if(!path.isDocument)throw new Error(`Value for argument "documentPath" must point to a document, but was "${documentPath}". Your path does not contain an even number of components.`);return new DocumentReference2(this.firestore,path,this._queryOptions.converter)}add(data){let firestoreData=this._queryOptions.converter.toFirestore(data);(0,write_batch_1.validateDocumentData)("data",firestoreData,!1,this._allowUndefined);let documentRef=this.doc();return documentRef.create(data).then(()=>documentRef)}isEqual(other){return this===other||other instanceof CollectionReference&&super.isEqual(other)}withConverter(converter){return new CollectionReference(this.firestore,this._resourcePath,converter??(0,types_1.defaultConverter)())}};__name(CollectionReference,"CollectionReference");exports2.CollectionReference=CollectionReference;var AggregateQuery=class{constructor(_query,_aggregates){this._query=_query,this._aggregates=_aggregates,this.clientAliasToServerAliasMap={},this.serverAliasToClientAliasMap={};let aggregationNum=0;for(let clientAlias in this._aggregates)if(Object.prototype.hasOwnProperty.call(this._aggregates,clientAlias)){let serverAlias=`aggregate_${aggregationNum++}`;this.clientAliasToServerAliasMap[clientAlias]=serverAlias,this.serverAliasToClientAliasMap[serverAlias]=clientAlias}}get query(){return this._query}get(){return this._get()}_get(transactionId){let stack=Error().stack;return new Promise((resolve,reject)=>{let stream=this._stream(transactionId);stream.on("error",err=>{reject((0,util_1.wrapError)(err,stack))}),stream.once("data",result=>{stream.destroy(),resolve(result)}),stream.on("end",()=>{reject("No AggregateQuery results")})})}_stream(transactionId){let tag=(0,util_1.requestTag)(),firestore=this._query.firestore,stream=new stream_1.Transform({objectMode:!0,transform:(proto,enc,callback)=>{if(proto.result){let readTime=timestamp_1.Timestamp.fromProto(proto.readTime),data=this.decodeResult(proto.result);callback(void 0,new AggregateQuerySnapshot(this,readTime,data))}else callback(Error("RunAggregationQueryResponse is missing result"))}});return firestore.initializeIfNeeded(tag).then(async()=>{let request=this.toProto(transactionId),streamActive;do{streamActive=new util_1.Deferred;let backendStream=await firestore.requestStream("runAggregationQuery",!1,request,tag);stream.on("close",()=>{backendStream.resume(),backendStream.end()}),backendStream.on("error",err=>{backendStream.unpipe(stream),!transactionId&&!(0,util_1.isPermanentRpcError)(err,"runAggregationQuery")?((0,logger_1.logger)("AggregateQuery._stream",tag,"AggregateQuery failed with retryable stream error:",err),streamActive.resolve(!0)):((0,logger_1.logger)("AggregateQuery._stream",tag,"AggregateQuery failed with stream error:",err),stream.destroy(err),streamActive.resolve(!1))}),backendStream.resume(),backendStream.pipe(stream)}while(await streamActive.promise)}).catch(e=>stream.destroy(e)),stream}decodeResult(proto){let data={},fields=proto.aggregateFields;if(fields){let serializer=this._query.firestore._serializer;for(let prop of Object.keys(fields)){let alias=this.serverAliasToClientAliasMap[prop];if(assert(alias!=null,`'${prop}' not present in server-client alias mapping.`),this._aggregates[alias]===void 0)throw new Error(`Unexpected alias [${prop}] in result aggregate result`);data[alias]=serializer.decodeValue(fields[prop])}}return data}toProto(transactionId){let queryProto=this._query.toProto(),runQueryRequest={parent:queryProto.parent,structuredAggregationQuery:{structuredQuery:queryProto.structuredQuery,aggregations:(0,util_1.mapToArray)(this._aggregates,(aggregate,clientAlias)=>{let serverAlias=this.clientAliasToServerAliasMap[clientAlias];return assert(serverAlias!=null,`'${clientAlias}' not present in client-server alias mapping.`),new aggregate_1.Aggregate(serverAlias,aggregate.aggregateType,aggregate._field).toProto()})}};return transactionId instanceof Uint8Array&&(runQueryRequest.transaction=transactionId),runQueryRequest}isEqual(other){return this===other?!0:!(other instanceof AggregateQuery)||!this.query.isEqual(other.query)?!1:deepEqual(this._aggregates,other._aggregates)}};__name(AggregateQuery,"AggregateQuery");exports2.AggregateQuery=AggregateQuery;var AggregateQuerySnapshot=class{constructor(_query,_readTime,_data){this._query=_query,this._readTime=_readTime,this._data=_data}get query(){return this._query}get readTime(){return this._readTime}data(){return this._data}isEqual(other){return this===other?!0:!(other instanceof AggregateQuerySnapshot)||!this.query.isEqual(other.query)?!1:deepEqual(this._data,other._data)}};__name(AggregateQuerySnapshot,"AggregateQuerySnapshot");exports2.AggregateQuerySnapshot=AggregateQuerySnapshot;function validateQueryOrder(arg,op){return op=typeof op=="string"?op.toLowerCase():op,(0,validate_1.validateEnumValue)(arg,op,Object.keys(directionOperators),{optional:!0}),op}__name(validateQueryOrder,"validateQueryOrder");exports2.validateQueryOrder=validateQueryOrder;function validateQueryOperator(arg,op,fieldValue){if(op==="="&&(op="=="),(0,validate_1.validateEnumValue)(arg,op,Object.keys(comparisonOperators)),typeof fieldValue=="number"&&isNaN(fieldValue)&&op!=="=="&&op!=="!=")throw new Error("Invalid query. You can only perform '==' and '!=' comparisons on NaN.");if(fieldValue===null&&op!=="=="&&op!=="!=")throw new Error("Invalid query. You can only perform '==' and '!=' comparisons on Null.");return op}__name(validateQueryOperator,"validateQueryOperator");exports2.validateQueryOperator=validateQueryOperator;function validateDocumentReference(arg,value){if(!(value instanceof DocumentReference2))throw new Error((0,validate_1.invalidArgumentMessage)(arg,"DocumentReference"));return value}__name(validateDocumentReference,"validateDocumentReference");exports2.validateDocumentReference=validateDocumentReference;function validateQueryValue(arg,value,allowUndefined){(0,serializer_1.validateUserInput)(arg,value,"query constraint",{allowDeletes:"none",allowTransforms:!1,allowUndefined})}__name(validateQueryValue,"validateQueryValue");function isArrayEqual(left,right){if(left.length!==right.length)return!1;for(let i=0;ivalue!==void 0)}__name(coalesce,"coalesce")}});var require_document=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/document.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Precondition=exports2.DocumentTransform=exports2.DocumentMask=exports2.QueryDocumentSnapshot=exports2.DocumentSnapshot=exports2.DocumentSnapshotBuilder=void 0;var deepEqual=require_fast_deep_equal(),assert=require("assert"),field_value_1=require_field_value(),path_1=require_path2(),reference_1=require_reference(),types_1=require_types2(),util_1=require_util6(),DocumentSnapshotBuilder=class{constructor(ref){this.ref=ref}build(){return assert(this.fieldsProto!==void 0==(this.createTime!==void 0),"Create time should be set iff document exists."),assert(this.fieldsProto!==void 0==(this.updateTime!==void 0),"Update time should be set iff document exists."),this.fieldsProto?new QueryDocumentSnapshot(this.ref,this.fieldsProto,this.readTime,this.createTime,this.updateTime):new DocumentSnapshot(this.ref,void 0,this.readTime)}};__name(DocumentSnapshotBuilder,"DocumentSnapshotBuilder");exports2.DocumentSnapshotBuilder=DocumentSnapshotBuilder;var DocumentSnapshot=class{constructor(ref,_fieldsProto,readTime,createTime,updateTime){this._fieldsProto=_fieldsProto,this._ref=ref,this._serializer=ref.firestore._serializer,this._readTime=readTime,this._createTime=createTime,this._updateTime=updateTime}static fromObject(ref,obj){let serializer=ref.firestore._serializer;return new DocumentSnapshot(ref,serializer.encodeFields(obj))}static fromUpdateMap(ref,data){let serializer=ref.firestore._serializer;function merge(target,value,path,pos){let key=path[pos],isLast=pos===path.length-1;if(target[key]===void 0)if(isLast){if(value instanceof field_value_1.FieldTransform)return(0,util_1.isEmpty)(target)?null:target;let leafNode=serializer.encodeValue(value);return leafNode&&(target[key]=leafNode),target}else{let childNode={mapValue:{fields:{}}},nestedValue=merge(childNode.mapValue.fields,value,path,pos+1);return nestedValue?(childNode.mapValue.fields=nestedValue,target[key]=childNode,target):(0,util_1.isEmpty)(target)?null:target}else return assert(!isLast,"Can't merge current value into a nested object"),target[key].mapValue.fields=merge(target[key].mapValue.fields,value,path,pos+1),target}__name(merge,"merge");let res={};for(let[key,value]of data){let path=key.toArray();merge(res,value,path,0)}return new DocumentSnapshot(ref,res)}get exists(){return this._fieldsProto!==void 0}get ref(){return this._ref}get id(){return this._ref.id}get createTime(){return this._createTime}get updateTime(){return this._updateTime}get readTime(){if(this._readTime===void 0)throw new Error("Called 'readTime' on a local document");return this._readTime}data(){let fields=this._fieldsProto;if(fields!==void 0)if(this.ref._converter!==(0,types_1.defaultConverter)()){let untypedReference=new reference_1.DocumentReference(this.ref.firestore,this.ref._path);return this.ref._converter.fromFirestore(new QueryDocumentSnapshot(untypedReference,this._fieldsProto,this.readTime,this.createTime,this.updateTime))}else{let obj={};for(let prop of Object.keys(fields))obj[prop]=this._serializer.decodeValue(fields[prop]);return obj}}get(field){(0,path_1.validateFieldPath)("field",field);let protoField=this.protoField(field);if(protoField!==void 0)return this._serializer.decodeValue(protoField)}protoField(field){let fields=this._fieldsProto;if(fields===void 0)return;let components=path_1.FieldPath.fromArgument(field).toArray();for(;components.length>1;){if(fields=fields[components.shift()],!fields||!fields.mapValue)return;fields=fields.mapValue.fields}return fields[components[0]]}toWriteProto(){return{update:{name:this._ref.formattedName,fields:this._fieldsProto}}}toDocumentProto(){var _a,_b;return{name:this._ref.formattedName,createTime:(_a=this.createTime)===null||_a===void 0?void 0:_a.toProto().timestampValue,updateTime:(_b=this.updateTime)===null||_b===void 0?void 0:_b.toProto().timestampValue,fields:this._fieldsProto}}isEqual(other){return this===other||other instanceof DocumentSnapshot&&this._ref.isEqual(other._ref)&&deepEqual(this._fieldsProto,other._fieldsProto)}};__name(DocumentSnapshot,"DocumentSnapshot");exports2.DocumentSnapshot=DocumentSnapshot;var QueryDocumentSnapshot=class extends DocumentSnapshot{get createTime(){return super.createTime}get updateTime(){return super.updateTime}data(){let data=super.data();if(!data)throw new Error("The data in a QueryDocumentSnapshot should always exist.");return data}};__name(QueryDocumentSnapshot,"QueryDocumentSnapshot");exports2.QueryDocumentSnapshot=QueryDocumentSnapshot;var DocumentMask=class{constructor(fieldPaths){this._sortedPaths=fieldPaths,this._sortedPaths.sort((a,b)=>a.compareTo(b))}static fromUpdateMap(data){let fieldPaths=[];return data.forEach((value,key)=>{(!(value instanceof field_value_1.FieldTransform)||value.includeInDocumentMask)&&fieldPaths.push(path_1.FieldPath.fromArgument(key))}),new DocumentMask(fieldPaths)}static fromFieldMask(fieldMask){let fieldPaths=[];for(let fieldPath of fieldMask)fieldPaths.push(path_1.FieldPath.fromArgument(fieldPath));return new DocumentMask(fieldPaths)}static fromObject(data){let fieldPaths=[];function extractFieldPaths(currentData,currentPath){let isEmpty=!0;for(let key of Object.keys(currentData)){isEmpty=!1;let childSegment=new path_1.FieldPath(key),childPath=currentPath?currentPath.append(childSegment):childSegment,value=currentData[key];value instanceof field_value_1.FieldTransform?value.includeInDocumentMask&&fieldPaths.push(childPath):(0,util_1.isPlainObject)(value)?extractFieldPaths(value,childPath):value!==void 0&&fieldPaths.push(childPath)}currentPath&&isEmpty&&fieldPaths.push(currentPath)}return __name(extractFieldPaths,"extractFieldPaths"),extractFieldPaths(data),new DocumentMask(fieldPaths)}get isEmpty(){return this._sortedPaths.length===0}static removeFromSortedArray(input,values){for(let i=0;i0)return!1}return!1}applyTo(data){let result=__name(data2=>{let remainingPaths=this._sortedPaths.slice(0),processObject=__name((currentData,currentPath)=>{let result2=null;return Object.keys(currentData).forEach(key=>{let childPath=currentPath?currentPath.append(key):new path_1.FieldPath(key);if(this.contains(childPath))DocumentMask.removeFromSortedArray(remainingPaths,[childPath]),result2=result2||{},result2[key]=currentData[key];else if((0,util_1.isObject)(currentData[key])){let childObject=processObject(currentData[key],childPath);childObject&&(result2=result2||{},result2[key]=childObject)}}),result2},"processObject");return{filteredData:processObject(data2)||{},remainingPaths}},"applyDocumentMask")(data);if(result.remainingPaths.length!==0)throw new Error(`Input data is missing for field "${result.remainingPaths[0]}".`);return result.filteredData}toProto(){if(this.isEmpty)return{};let encodedPaths=[];for(let fieldPath of this._sortedPaths)encodedPaths.push(fieldPath.formattedName);return{fieldPaths:encodedPaths}}};__name(DocumentMask,"DocumentMask");exports2.DocumentMask=DocumentMask;var DocumentTransform=class{constructor(ref,transforms){this.ref=ref,this.transforms=transforms}static fromObject(ref,obj){let updateMap=new Map;for(let prop of Object.keys(obj))updateMap.set(new path_1.FieldPath(prop),obj[prop]);return DocumentTransform.fromUpdateMap(ref,updateMap)}static fromUpdateMap(ref,data){let transforms=new Map;function encode_(val,path,allowTransforms){if(val instanceof field_value_1.FieldTransform&&val.includeInDocumentTransform)if(allowTransforms)transforms.set(path,val);else throw new Error(`${val.methodName}() is not supported inside of array values.`);else if(Array.isArray(val))for(let i=0;i{encode_(value,path_1.FieldPath.fromArgument(key),!0)}),new DocumentTransform(ref,transforms)}get isEmpty(){return this.transforms.size===0}get fields(){return Array.from(this.transforms.keys())}validate(){let allowUndefined=!!this.ref.firestore._settings.ignoreUndefinedProperties;this.transforms.forEach(transform=>transform.validate(allowUndefined))}toProto(serializer){return Array.from(this.transforms,([path,transform])=>transform.toProto(serializer,path))}};__name(DocumentTransform,"DocumentTransform");exports2.DocumentTransform=DocumentTransform;var Precondition=class{constructor(options){options!==void 0&&(this._exists=options.exists,this._lastUpdateTime=options.lastUpdateTime)}toProto(){if(this.isEmpty)return null;let proto={};return this._lastUpdateTime!==void 0?proto.updateTime=this._lastUpdateTime.toProto().timestampValue:proto.exists=this._exists,proto}get isEmpty(){return this._exists===void 0&&!this._lastUpdateTime}};__name(Precondition,"Precondition");exports2.Precondition=Precondition}});var require_write_batch=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/write-batch.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.validateFieldValue=exports2.validateDocumentData=exports2.validateSetOptions=exports2.WriteBatch=exports2.WriteResult=void 0;var document_1=require_document(),logger_1=require_logger(),path_1=require_path2(),reference_1=require_reference(),serializer_1=require_serializer(),timestamp_1=require_timestamp2(),util_1=require_util6(),validate_1=require_validate(),WriteResult=class{constructor(_writeTime){this._writeTime=_writeTime}get writeTime(){return this._writeTime}isEqual(other){return this===other||other instanceof WriteResult&&this._writeTime.isEqual(other._writeTime)}};__name(WriteResult,"WriteResult");exports2.WriteResult=WriteResult;var WriteBatch=class{get _opCount(){return this._ops.length}constructor(firestore){this._ops=[],this._committed=!1,this._firestore=firestore,this._serializer=new serializer_1.Serializer(firestore),this._allowUndefined=!!firestore._settings.ignoreUndefinedProperties}get isEmpty(){return this._ops.length===0}verifyNotCommitted(){if(this._committed)throw new Error("Cannot modify a WriteBatch that has been committed.")}create(documentRef,data){let ref=(0,reference_1.validateDocumentReference)("documentRef",documentRef),firestoreData=ref._converter.toFirestore(data);validateDocumentData("data",firestoreData,!1,this._allowUndefined),this.verifyNotCommitted();let transform=document_1.DocumentTransform.fromObject(ref,firestoreData);transform.validate();let precondition=new document_1.Precondition({exists:!1}),op=__name(()=>{let write=document_1.DocumentSnapshot.fromObject(ref,firestoreData).toWriteProto();return transform.isEmpty||(write.updateTransforms=transform.toProto(this._serializer)),write.currentDocument=precondition.toProto(),write},"op");return this._ops.push({docPath:documentRef.path,op}),this}delete(documentRef,precondition){let ref=(0,reference_1.validateDocumentReference)("documentRef",documentRef);validateDeletePrecondition("precondition",precondition,{optional:!0}),this.verifyNotCommitted();let conditions=new document_1.Precondition(precondition),op=__name(()=>{let write={delete:ref.formattedName};return conditions.isEmpty||(write.currentDocument=conditions.toProto()),write},"op");return this._ops.push({docPath:documentRef.path,op}),this}set(documentRef,data,options){validateSetOptions("options",options,{optional:!0});let mergeLeaves=options&&"merge"in options&&options.merge,mergePaths=options&&"mergeFields"in options,ref=(0,reference_1.validateDocumentReference)("documentRef",documentRef),firestoreData;mergeLeaves||mergePaths?firestoreData=ref._converter.toFirestore(data,options):firestoreData=ref._converter.toFirestore(data),validateDocumentData("data",firestoreData,!!(mergePaths||mergeLeaves),this._allowUndefined),this.verifyNotCommitted();let documentMask;mergePaths&&(documentMask=document_1.DocumentMask.fromFieldMask(options.mergeFields),firestoreData=documentMask.applyTo(firestoreData));let transform=document_1.DocumentTransform.fromObject(ref,firestoreData);transform.validate();let op=__name(()=>{let document2=document_1.DocumentSnapshot.fromObject(ref,firestoreData);mergePaths?documentMask.removeFields(transform.fields):mergeLeaves&&(documentMask=document_1.DocumentMask.fromObject(firestoreData));let write=document2.toWriteProto();return transform.isEmpty||(write.updateTransforms=transform.toProto(this._serializer)),(mergePaths||mergeLeaves)&&(write.updateMask=documentMask.toProto()),write},"op");return this._ops.push({docPath:documentRef.path,op}),this}update(documentRef,dataOrField,...preconditionOrValues){(0,validate_1.validateMinNumberOfArguments)("WriteBatch.update",arguments,2),(0,reference_1.validateDocumentReference)("documentRef",documentRef),this.verifyNotCommitted();let updateMap=new Map,precondition=new document_1.Precondition({exists:!0}),argumentError="Update() requires either a single JavaScript object or an alternating list of field/value pairs that can be followed by an optional precondition.";if(typeof dataOrField=="string"||dataOrField instanceof path_1.FieldPath){let fieldOrValues=[dataOrField,...preconditionOrValues];try{for(let i=0;i{value!==void 0&&((0,path_1.validateFieldPath)(key,key),updateMap.set(path_1.FieldPath.fromArgument(key),value))}),preconditionOrValues.length>0&&(validateUpdatePrecondition("preconditionOrValues",preconditionOrValues[0]),precondition=new document_1.Precondition(preconditionOrValues[0]))}catch(err){throw(0,logger_1.logger)("WriteBatch.update",null,"Non-varargs validation failed:",err),new Error(`${argumentError} ${err.message}`)}validateNoConflictingFields("dataOrField",updateMap);let transform=document_1.DocumentTransform.fromUpdateMap(documentRef,updateMap);transform.validate();let documentMask=document_1.DocumentMask.fromUpdateMap(updateMap),op=__name(()=>{let write=document_1.DocumentSnapshot.fromUpdateMap(documentRef,updateMap).toWriteProto();return write.updateMask=documentMask.toProto(),transform.isEmpty||(write.updateTransforms=transform.toProto(this._serializer)),write.currentDocument=precondition.toProto(),write},"op");return this._ops.push({docPath:documentRef.path,op}),this}commit(){let stack=Error().stack,retryCodes=[10,...(0,util_1.getRetryCodes)("commit")];return this._commit({retryCodes}).then(response=>(response.writeResults||[]).map(writeResult=>new WriteResult(timestamp_1.Timestamp.fromProto(writeResult.updateTime||response.commitTime)))).catch(err=>{throw(0,util_1.wrapError)(err,stack)})}async _commit(commitOptions){var _a;this._committed=!0;let tag=(_a=commitOptions?.requestTag)!==null&&_a!==void 0?_a:(0,util_1.requestTag)();await this._firestore.initializeIfNeeded(tag);let request={database:this._firestore.formattedName,writes:this._ops.map(op=>op.op())};return commitOptions?.transactionId&&(request.transaction=commitOptions.transactionId),(0,logger_1.logger)("WriteBatch.commit",tag,"Sending %d writes",request.writes.length),this._firestore.request(commitOptions?.methodName||"commit",request,tag,commitOptions?.retryCodes)}_reset(){this._ops.splice(0),this._committed=!1}};__name(WriteBatch,"WriteBatch");exports2.WriteBatch=WriteBatch;function validatePrecondition(arg,value,allowExists){if(typeof value!="object"||value===null)throw new Error("Input is not an object.");let precondition=value,conditions=0;if(precondition.exists!==void 0){if(++conditions,!allowExists)throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"precondition")} "exists" is not an allowed precondition.`);if(typeof precondition.exists!="boolean")throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"precondition")} "exists" is not a boolean.'`)}if(precondition.lastUpdateTime!==void 0&&(++conditions,!(precondition.lastUpdateTime instanceof timestamp_1.Timestamp)))throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"precondition")} "lastUpdateTime" is not a Firestore Timestamp.`);if(conditions>1)throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"precondition")} Input specifies more than one precondition.`)}__name(validatePrecondition,"validatePrecondition");function validateUpdatePrecondition(arg,value,options){(0,validate_1.validateOptional)(value,options)||validatePrecondition(arg,value,!1)}__name(validateUpdatePrecondition,"validateUpdatePrecondition");function validateDeletePrecondition(arg,value,options){(0,validate_1.validateOptional)(value,options)||validatePrecondition(arg,value,!0)}__name(validateDeletePrecondition,"validateDeletePrecondition");function validateSetOptions(arg,value,options){if(!(0,validate_1.validateOptional)(value,options)){if(!(0,util_1.isObject)(value))throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"set() options argument")} Input is not an object.`);let setOptions=value;if("mergeFields"in setOptions)for(let i=0;i{fields.push(key)}),fields.sort((left,right)=>left.compareTo(right));for(let i=1;i({})),status:ops.map(()=>err)}}for(let i=0;i<(response.writeResults||[]).length;++i){let DELETE_TIMESTAMP_SENTINEL=timestamp_1.Timestamp.fromMillis(0),status=(response.status||[])[i];if(status.code===0){let updateTime=timestamp_1.Timestamp.fromProto(response.writeResults[i].updateTime||DELETE_TIMESTAMP_SENTINEL);this.pendingOps[i].onSuccess(new write_batch_1.WriteResult(updateTime))}else{let error=new(require_fallback()).GoogleError(status.message||void 0);error.code=status.code,this.pendingOps[i].onError((0,util_1.wrapError)(error,stack))}}}processLastOperation(op){assert(!this.docPaths.has(op.ref.path),"Batch should not contain writes to the same document"),this.docPaths.add(op.ref.path),this.pendingOps.push(op)}};__name(BulkCommitBatch,"BulkCommitBatch");var BufferedOperation=class{constructor(operation,sendFn){this.operation=operation,this.sendFn=sendFn}};__name(BufferedOperation,"BufferedOperation");var BulkWriterError=class extends Error{constructor(code,message,documentRef,operationType,failedAttempts){super(message),this.code=code,this.message=message,this.documentRef=documentRef,this.operationType=operationType,this.failedAttempts=failedAttempts}};__name(BulkWriterError,"BulkWriterError");exports2.BulkWriterError=BulkWriterError;var BulkWriter=class{_getBufferedOperationsCount(){return this._bufferedOperations.length}_setMaxBatchSize(size){assert(this._bulkCommitBatch.pendingOps.length===0,"BulkCommitBatch should be empty"),this._maxBatchSize=size,this._bulkCommitBatch=new BulkCommitBatch(this.firestore,size)}_setMaxPendingOpCount(newMax){this._maxPendingOpCount=newMax}constructor(firestore,options){var _a,_b;if(this.firestore=firestore,this._maxBatchSize=MAX_BATCH_SIZE,this._bulkCommitBatch=new BulkCommitBatch(this.firestore,this._maxBatchSize),this._lastOp=Promise.resolve(),this._closing=!1,this._pendingOpsCount=0,this._bufferedOperations=[],this._errorHandlerSet=!1,this._maxPendingOpCount=DEFAULT_MAXIMUM_PENDING_OPERATIONS_COUNT,this._successFn=()=>{},this._errorFn=error=>{let isRetryableDeleteError=error.operationType==="delete"&&error.code===13;return((0,util_1.getRetryCodes)("batchWrite").includes(error.code)||isRetryableDeleteError)&&error.failedAttemptsbulkCommitBatch.create(documentRef,data))}delete(documentRef,precondition){return this._verifyNotClosed(),this._enqueue(documentRef,"delete",bulkCommitBatch=>bulkCommitBatch.delete(documentRef,precondition))}set(documentRef,data,options){return this._verifyNotClosed(),this._enqueue(documentRef,"set",bulkCommitBatch=>options?bulkCommitBatch.set(documentRef,data,options):bulkCommitBatch.set(documentRef,data))}update(documentRef,dataOrField,...preconditionOrValues){return this._verifyNotClosed(),this._enqueue(documentRef,"update",bulkCommitBatch=>bulkCommitBatch.update(documentRef,dataOrField,...preconditionOrValues))}onWriteResult(successCallback){this._successFn=successCallback}onWriteError(shouldRetryCallback){this._errorHandlerSet=!0,this._errorFn=shouldRetryCallback}flush(){return this._verifyNotClosed(),this._scheduleCurrentBatch(!0),this._bufferedOperations.length>0&&this._bufferedOperations[this._bufferedOperations.length-1].operation.markFlushed(),this._lastOp}close(){this._verifyNotClosed(),this.firestore._decrementBulkWritersCount();let flushPromise=this.flush();return this._closing=!0,flushPromise}_verifyNotClosed(){if(this._closing)throw new Error("BulkWriter has already been closed.")}_scheduleCurrentBatch(flush=!1){if(this._bulkCommitBatch._opCount===0)return;let pendingBatch=this._bulkCommitBatch;this._bulkCommitBatch=new BulkCommitBatch(this.firestore,this._maxBatchSize);let highestBackoffDuration=pendingBatch.pendingOps.reduce((prev,cur)=>prev.backoffDuration>cur.backoffDuration?prev:cur).backoffDuration,backoffMsWithJitter=BulkWriter._applyJitter(highestBackoffDuration),delayedExecution=new util_1.Deferred;backoffMsWithJitter>0?(0,backoff_1.delayExecution)(()=>delayedExecution.resolve(),backoffMsWithJitter):delayedExecution.resolve(),delayedExecution.promise.then(()=>this._sendBatch(pendingBatch,flush))}async _sendBatch(batch,flush=!1){let tag=(0,util_1.requestTag)();if(this._rateLimiter.tryMakeRequest(batch._opCount))await batch.bulkCommit({requestTag:tag}),flush&&this._scheduleCurrentBatch(flush);else{let delayMs=this._rateLimiter.getNextRequestDelayMs(batch._opCount);(0,logger_1.logger)("BulkWriter._sendBatch",tag,`Backing off for ${delayMs} seconds`),(0,backoff_1.delayExecution)(()=>this._sendBatch(batch,flush),delayMs)}}static _applyJitter(backoffMs){if(backoffMs===0)return 0;let jitter=exports2.DEFAULT_JITTER_FACTOR*(Math.random()*2-1);return Math.min(backoff_1.DEFAULT_BACKOFF_MAX_DELAY_MS,backoffMs+jitter*backoffMs)}_enqueue(ref,type,enqueueOnBatchCallback){let bulkWriterOp=new BulkWriterOperation(ref,type,this._sendFn.bind(this,enqueueOnBatchCallback),this._errorFn.bind(this),this._successFn.bind(this)),userPromise=bulkWriterOp.promise.catch(err=>{if(this._errorHandlerSet)return bulkWriterOp.promise;throw err});return this._lastOp=this._lastOp.then(()=>(0,util_1.silencePromise)(userPromise)),this._pendingOpsCount{this._pendingOpsCount++,this._sendFn(enqueueOnBatchCallback,bulkWriterOp)})),userPromise.then(res=>(this._pendingOpsCount--,this._processBufferedOps(),res)).catch(err=>{throw this._pendingOpsCount--,this._processBufferedOps(),err})}_processBufferedOps(){this._pendingOpsCount0&&this._bufferedOperations.shift().sendFn()}_sendFn(enqueueOnBatchCallback,op){op.backoffDuration>0&&(this._bulkCommitBatch.pendingOps.length>=exports2.RETRY_MAX_BATCH_SIZE&&this._scheduleCurrentBatch(!1),this._bulkCommitBatch.setMaxBatchSize(exports2.RETRY_MAX_BATCH_SIZE)),this._bulkCommitBatch.has(op.ref)&&this._scheduleCurrentBatch(),enqueueOnBatchCallback(this._bulkCommitBatch),this._bulkCommitBatch.processLastOperation(op),this._bulkCommitBatch._opCount===this._bulkCommitBatch.maxBatchSize?this._scheduleCurrentBatch():op.flushed&&this._scheduleCurrentBatch(!0)}};__name(BulkWriter,"BulkWriter");exports2.BulkWriter=BulkWriter;function validateBulkWriterOptions(value){if((0,validate_1.validateOptional)(value,{optional:!0}))return;let argName="options";if(!(0,util_1.isObject)(value))throw new Error(`${(0,validate_1.invalidArgumentMessage)(argName,"bulkWriter() options argument")} Input is not an object.`);let options=value;if(!(options.throttling===void 0||typeof options.throttling=="boolean")&&(options.throttling.initialOpsPerSecond!==void 0&&(0,validate_1.validateInteger)("initialOpsPerSecond",options.throttling.initialOpsPerSecond,{minValue:1}),options.throttling.maxOpsPerSecond!==void 0&&((0,validate_1.validateInteger)("maxOpsPerSecond",options.throttling.maxOpsPerSecond,{minValue:1}),options.throttling.initialOpsPerSecond!==void 0&&options.throttling.initialOpsPerSecond>options.throttling.maxOpsPerSecond)))throw new Error(`${(0,validate_1.invalidArgumentMessage)(argName,"bulkWriter() options argument")} "maxOpsPerSecond" cannot be less than "initialOpsPerSecond".`)}__name(validateBulkWriterOptions,"validateBulkWriterOptions")}});var require_minimal4=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/protobufjs/minimal.js"(exports2,module2){"use strict";module2.exports=require_index_minimal2()}});var require_firestore_v1_proto_api=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/protos/firestore_v1_proto_api.js"(exports2,module2){(function(e){typeof define=="function"&&define.amd?define(["protobufjs/minimal"],e):typeof require=="function"&&typeof module2=="object"&&module2&&module2.exports&&(module2.exports=e(require_minimal4()))})(function(r){"use strict";var e,t,o,n,L,i=r.util,a=r.roots.firestore_v1||(r.roots.firestore_v1={});function U(e2){if(e2)for(var t2=Object.keys(e2),o2=0;o2>>0),e2.totalDocuments!=null&&(t2.totalDocuments=e2.totalDocuments>>>0),e2.totalBytes!=null&&(i.Long?(t2.totalBytes=i.Long.fromValue(e2.totalBytes)).unsigned=!0:typeof e2.totalBytes=="string"?t2.totalBytes=parseInt(e2.totalBytes,10):typeof e2.totalBytes=="number"?t2.totalBytes=e2.totalBytes:typeof e2.totalBytes=="object"&&(t2.totalBytes=new i.LongBits(e2.totalBytes.low>>>0,e2.totalBytes.high>>>0).toNumber(!0))),t2},Q.toObject=function(e2,t2){var o2,r2={};return(t2=t2||{}).defaults&&(r2.id="",r2.createTime=null,r2.version=0,r2.totalDocuments=0,i.Long?(o2=new i.Long(0,0,!0),r2.totalBytes=t2.longs===String?o2.toString():t2.longs===Number?o2.toNumber():o2):r2.totalBytes=t2.longs===String?"0":0),e2.id!=null&&e2.hasOwnProperty("id")&&(r2.id=e2.id),e2.createTime!=null&&e2.hasOwnProperty("createTime")&&(r2.createTime=a.google.protobuf.Timestamp.toObject(e2.createTime,t2)),e2.version!=null&&e2.hasOwnProperty("version")&&(r2.version=e2.version),e2.totalDocuments!=null&&e2.hasOwnProperty("totalDocuments")&&(r2.totalDocuments=e2.totalDocuments),e2.totalBytes!=null&&e2.hasOwnProperty("totalBytes")&&(typeof e2.totalBytes=="number"?r2.totalBytes=t2.longs===String?String(e2.totalBytes):e2.totalBytes:r2.totalBytes=t2.longs===String?i.Long.prototype.toString.call(e2.totalBytes):t2.longs===Number?new i.LongBits(e2.totalBytes.low>>>0,e2.totalBytes.high>>>0).toNumber(!0):e2.totalBytes),r2},Q.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},Q.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/firestore.BundleMetadata"},Q),e.BundleElement=(J.prototype.metadata=null,J.prototype.namedQuery=null,J.prototype.documentMetadata=null,J.prototype.document=null,Object.defineProperty(J.prototype,"elementType",{get:i.oneOfGetter(t=["metadata","namedQuery","documentMetadata","document"]),set:i.oneOfSetter(t)}),J.fromObject=function(e2){if(e2 instanceof a.firestore.BundleElement)return e2;var t2=new a.firestore.BundleElement;if(e2.metadata!=null){if(typeof e2.metadata!="object")throw TypeError(".firestore.BundleElement.metadata: object expected");t2.metadata=a.firestore.BundleMetadata.fromObject(e2.metadata)}if(e2.namedQuery!=null){if(typeof e2.namedQuery!="object")throw TypeError(".firestore.BundleElement.namedQuery: object expected");t2.namedQuery=a.firestore.NamedQuery.fromObject(e2.namedQuery)}if(e2.documentMetadata!=null){if(typeof e2.documentMetadata!="object")throw TypeError(".firestore.BundleElement.documentMetadata: object expected");t2.documentMetadata=a.firestore.BundledDocumentMetadata.fromObject(e2.documentMetadata)}if(e2.document!=null){if(typeof e2.document!="object")throw TypeError(".firestore.BundleElement.document: object expected");t2.document=a.google.firestore.v1.Document.fromObject(e2.document)}return t2},J.toObject=function(e2,t2){t2=t2||{};var o2={};return e2.metadata!=null&&e2.hasOwnProperty("metadata")&&(o2.metadata=a.firestore.BundleMetadata.toObject(e2.metadata,t2),t2.oneofs)&&(o2.elementType="metadata"),e2.namedQuery!=null&&e2.hasOwnProperty("namedQuery")&&(o2.namedQuery=a.firestore.NamedQuery.toObject(e2.namedQuery,t2),t2.oneofs)&&(o2.elementType="namedQuery"),e2.documentMetadata!=null&&e2.hasOwnProperty("documentMetadata")&&(o2.documentMetadata=a.firestore.BundledDocumentMetadata.toObject(e2.documentMetadata,t2),t2.oneofs)&&(o2.elementType="documentMetadata"),e2.document!=null&&e2.hasOwnProperty("document")&&(o2.document=a.google.firestore.v1.Document.toObject(e2.document,t2),t2.oneofs)&&(o2.elementType="document"),o2},J.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},J.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/firestore.BundleElement"},J),e),a.google=((L={}).protobuf=((t={}).Timestamp=(_.prototype.seconds=i.Long?i.Long.fromBits(0,0,!1):0,_.prototype.nanos=0,_.fromObject=function(e2){var t2;return e2 instanceof a.google.protobuf.Timestamp?e2:(t2=new a.google.protobuf.Timestamp,e2.seconds!=null&&(i.Long?(t2.seconds=i.Long.fromValue(e2.seconds)).unsigned=!1:typeof e2.seconds=="string"?t2.seconds=parseInt(e2.seconds,10):typeof e2.seconds=="number"?t2.seconds=e2.seconds:typeof e2.seconds=="object"&&(t2.seconds=new i.LongBits(e2.seconds.low>>>0,e2.seconds.high>>>0).toNumber())),e2.nanos!=null&&(t2.nanos=0|e2.nanos),t2)},_.toObject=function(e2,t2){var o2,r2={};return(t2=t2||{}).defaults&&(i.Long?(o2=new i.Long(0,0,!1),r2.seconds=t2.longs===String?o2.toString():t2.longs===Number?o2.toNumber():o2):r2.seconds=t2.longs===String?"0":0,r2.nanos=0),e2.seconds!=null&&e2.hasOwnProperty("seconds")&&(typeof e2.seconds=="number"?r2.seconds=t2.longs===String?String(e2.seconds):e2.seconds:r2.seconds=t2.longs===String?i.Long.prototype.toString.call(e2.seconds):t2.longs===Number?new i.LongBits(e2.seconds.low>>>0,e2.seconds.high>>>0).toNumber():e2.seconds),e2.nanos!=null&&e2.hasOwnProperty("nanos")&&(r2.nanos=e2.nanos),r2},_.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},_.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.protobuf.Timestamp"},_),t.Struct=(M.prototype.fields=i.emptyObject,M.fromObject=function(e2){if(e2 instanceof a.google.protobuf.Struct)return e2;var t2=new a.google.protobuf.Struct;if(e2.fields){if(typeof e2.fields!="object")throw TypeError(".google.protobuf.Struct.fields: object expected");t2.fields={};for(var o2=Object.keys(e2.fields),r2=0;r2>>0,e2.positiveIntValue.high>>>0).toNumber(!0))),e2.negativeIntValue!=null&&(i.Long?(t2.negativeIntValue=i.Long.fromValue(e2.negativeIntValue)).unsigned=!1:typeof e2.negativeIntValue=="string"?t2.negativeIntValue=parseInt(e2.negativeIntValue,10):typeof e2.negativeIntValue=="number"?t2.negativeIntValue=e2.negativeIntValue:typeof e2.negativeIntValue=="object"&&(t2.negativeIntValue=new i.LongBits(e2.negativeIntValue.low>>>0,e2.negativeIntValue.high>>>0).toNumber())),e2.doubleValue!=null&&(t2.doubleValue=Number(e2.doubleValue)),e2.stringValue!=null&&(typeof e2.stringValue=="string"?i.base64.decode(e2.stringValue,t2.stringValue=i.newBuffer(i.base64.length(e2.stringValue)),0):0<=e2.stringValue.length&&(t2.stringValue=e2.stringValue)),e2.aggregateValue!=null&&(t2.aggregateValue=String(e2.aggregateValue)),t2},d.toObject=function(e2,t2){var o2,r2={};if(((t2=t2||{}).arrays||t2.defaults)&&(r2.name=[]),t2.defaults&&(r2.identifierValue="",i.Long?(o2=new i.Long(0,0,!0),r2.positiveIntValue=t2.longs===String?o2.toString():t2.longs===Number?o2.toNumber():o2):r2.positiveIntValue=t2.longs===String?"0":0,i.Long?(o2=new i.Long(0,0,!1),r2.negativeIntValue=t2.longs===String?o2.toString():t2.longs===Number?o2.toNumber():o2):r2.negativeIntValue=t2.longs===String?"0":0,r2.doubleValue=0,t2.bytes===String?r2.stringValue="":(r2.stringValue=[],t2.bytes!==Array&&(r2.stringValue=i.newBuffer(r2.stringValue))),r2.aggregateValue=""),e2.name&&e2.name.length){r2.name=[];for(var n2=0;n2>>0,e2.positiveIntValue.high>>>0).toNumber(!0):e2.positiveIntValue),e2.negativeIntValue!=null&&e2.hasOwnProperty("negativeIntValue")&&(typeof e2.negativeIntValue=="number"?r2.negativeIntValue=t2.longs===String?String(e2.negativeIntValue):e2.negativeIntValue:r2.negativeIntValue=t2.longs===String?i.Long.prototype.toString.call(e2.negativeIntValue):t2.longs===Number?new i.LongBits(e2.negativeIntValue.low>>>0,e2.negativeIntValue.high>>>0).toNumber():e2.negativeIntValue),e2.doubleValue!=null&&e2.hasOwnProperty("doubleValue")&&(r2.doubleValue=t2.json&&!isFinite(e2.doubleValue)?String(e2.doubleValue):e2.doubleValue),e2.stringValue!=null&&e2.hasOwnProperty("stringValue")&&(r2.stringValue=t2.bytes===String?i.base64.encode(e2.stringValue,0,e2.stringValue.length):t2.bytes===Array?Array.prototype.slice.call(e2.stringValue):e2.stringValue),e2.aggregateValue!=null&&e2.hasOwnProperty("aggregateValue")&&(r2.aggregateValue=e2.aggregateValue),r2},d.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},d.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.protobuf.UninterpretedOption"},d.NamePart=(re.prototype.namePart="",re.prototype.isExtension=!1,re.fromObject=function(e2){var t2;return e2 instanceof a.google.protobuf.UninterpretedOption.NamePart?e2:(t2=new a.google.protobuf.UninterpretedOption.NamePart,e2.namePart!=null&&(t2.namePart=String(e2.namePart)),e2.isExtension!=null&&(t2.isExtension=!!e2.isExtension),t2)},re.toObject=function(e2,t2){var o2={};return(t2=t2||{}).defaults&&(o2.namePart="",o2.isExtension=!1),e2.namePart!=null&&e2.hasOwnProperty("namePart")&&(o2.namePart=e2.namePart),e2.isExtension!=null&&e2.hasOwnProperty("isExtension")&&(o2.isExtension=e2.isExtension),o2},re.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},re.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.protobuf.UninterpretedOption.NamePart"},re),d),t.SourceCodeInfo=(ne.prototype.location=i.emptyArray,ne.fromObject=function(e2){if(e2 instanceof a.google.protobuf.SourceCodeInfo)return e2;var t2=new a.google.protobuf.SourceCodeInfo;if(e2.location){if(!Array.isArray(e2.location))throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected");t2.location=[];for(var o2=0;o2>>0,e2.value.high>>>0).toNumber())),t2)},ce.toObject=function(e2,t2){var o2,r2={};return(t2=t2||{}).defaults&&(i.Long?(o2=new i.Long(0,0,!1),r2.value=t2.longs===String?o2.toString():t2.longs===Number?o2.toNumber():o2):r2.value=t2.longs===String?"0":0),e2.value!=null&&e2.hasOwnProperty("value")&&(typeof e2.value=="number"?r2.value=t2.longs===String?String(e2.value):e2.value:r2.value=t2.longs===String?i.Long.prototype.toString.call(e2.value):t2.longs===Number?new i.LongBits(e2.value.low>>>0,e2.value.high>>>0).toNumber():e2.value),r2},ce.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},ce.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.protobuf.Int64Value"},ce),t.UInt64Value=(ge.prototype.value=i.Long?i.Long.fromBits(0,0,!0):0,ge.fromObject=function(e2){var t2;return e2 instanceof a.google.protobuf.UInt64Value?e2:(t2=new a.google.protobuf.UInt64Value,e2.value!=null&&(i.Long?(t2.value=i.Long.fromValue(e2.value)).unsigned=!0:typeof e2.value=="string"?t2.value=parseInt(e2.value,10):typeof e2.value=="number"?t2.value=e2.value:typeof e2.value=="object"&&(t2.value=new i.LongBits(e2.value.low>>>0,e2.value.high>>>0).toNumber(!0))),t2)},ge.toObject=function(e2,t2){var o2,r2={};return(t2=t2||{}).defaults&&(i.Long?(o2=new i.Long(0,0,!0),r2.value=t2.longs===String?o2.toString():t2.longs===Number?o2.toNumber():o2):r2.value=t2.longs===String?"0":0),e2.value!=null&&e2.hasOwnProperty("value")&&(typeof e2.value=="number"?r2.value=t2.longs===String?String(e2.value):e2.value:r2.value=t2.longs===String?i.Long.prototype.toString.call(e2.value):t2.longs===Number?new i.LongBits(e2.value.low>>>0,e2.value.high>>>0).toNumber(!0):e2.value),r2},ge.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},ge.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.protobuf.UInt64Value"},ge),t.Int32Value=(fe.prototype.value=0,fe.fromObject=function(e2){var t2;return e2 instanceof a.google.protobuf.Int32Value?e2:(t2=new a.google.protobuf.Int32Value,e2.value!=null&&(t2.value=0|e2.value),t2)},fe.toObject=function(e2,t2){var o2={};return(t2=t2||{}).defaults&&(o2.value=0),e2.value!=null&&e2.hasOwnProperty("value")&&(o2.value=e2.value),o2},fe.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},fe.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.protobuf.Int32Value"},fe),t.UInt32Value=(ye.prototype.value=0,ye.fromObject=function(e2){var t2;return e2 instanceof a.google.protobuf.UInt32Value?e2:(t2=new a.google.protobuf.UInt32Value,e2.value!=null&&(t2.value=e2.value>>>0),t2)},ye.toObject=function(e2,t2){var o2={};return(t2=t2||{}).defaults&&(o2.value=0),e2.value!=null&&e2.hasOwnProperty("value")&&(o2.value=e2.value),o2},ye.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},ye.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.protobuf.UInt32Value"},ye),t.BoolValue=(de.prototype.value=!1,de.fromObject=function(e2){var t2;return e2 instanceof a.google.protobuf.BoolValue?e2:(t2=new a.google.protobuf.BoolValue,e2.value!=null&&(t2.value=!!e2.value),t2)},de.toObject=function(e2,t2){var o2={};return(t2=t2||{}).defaults&&(o2.value=!1),e2.value!=null&&e2.hasOwnProperty("value")&&(o2.value=e2.value),o2},de.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},de.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.protobuf.BoolValue"},de),t.StringValue=(me.prototype.value="",me.fromObject=function(e2){var t2;return e2 instanceof a.google.protobuf.StringValue?e2:(t2=new a.google.protobuf.StringValue,e2.value!=null&&(t2.value=String(e2.value)),t2)},me.toObject=function(e2,t2){var o2={};return(t2=t2||{}).defaults&&(o2.value=""),e2.value!=null&&e2.hasOwnProperty("value")&&(o2.value=e2.value),o2},me.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},me.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.protobuf.StringValue"},me),t.BytesValue=(be.prototype.value=i.newBuffer([]),be.fromObject=function(e2){var t2;return e2 instanceof a.google.protobuf.BytesValue?e2:(t2=new a.google.protobuf.BytesValue,e2.value!=null&&(typeof e2.value=="string"?i.base64.decode(e2.value,t2.value=i.newBuffer(i.base64.length(e2.value)),0):0<=e2.value.length&&(t2.value=e2.value)),t2)},be.toObject=function(e2,t2){var o2={};return(t2=t2||{}).defaults&&(t2.bytes===String?o2.value="":(o2.value=[],t2.bytes!==Array&&(o2.value=i.newBuffer(o2.value)))),e2.value!=null&&e2.hasOwnProperty("value")&&(o2.value=t2.bytes===String?i.base64.encode(e2.value,0,e2.value.length):t2.bytes===Array?Array.prototype.slice.call(e2.value):e2.value),o2},be.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},be.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.protobuf.BytesValue"},be),t.Any=(Oe.prototype.type_url="",Oe.prototype.value=i.newBuffer([]),Oe.fromObject=function(e2){var t2;return e2 instanceof a.google.protobuf.Any?e2:(t2=new a.google.protobuf.Any,e2.type_url!=null&&(t2.type_url=String(e2.type_url)),e2.value!=null&&(typeof e2.value=="string"?i.base64.decode(e2.value,t2.value=i.newBuffer(i.base64.length(e2.value)),0):0<=e2.value.length&&(t2.value=e2.value)),t2)},Oe.toObject=function(e2,t2){var o2={};return(t2=t2||{}).defaults&&(o2.type_url="",t2.bytes===String?o2.value="":(o2.value=[],t2.bytes!==Array&&(o2.value=i.newBuffer(o2.value)))),e2.type_url!=null&&e2.hasOwnProperty("type_url")&&(o2.type_url=e2.type_url),e2.value!=null&&e2.hasOwnProperty("value")&&(o2.value=t2.bytes===String?i.base64.encode(e2.value,0,e2.value.length):t2.bytes===Array?Array.prototype.slice.call(e2.value):e2.value),o2},Oe.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},Oe.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.protobuf.Any"},Oe),t.FieldMask=(he.prototype.paths=i.emptyArray,he.fromObject=function(e2){if(e2 instanceof a.google.protobuf.FieldMask)return e2;var t2=new a.google.protobuf.FieldMask;if(e2.paths){if(!Array.isArray(e2.paths))throw TypeError(".google.protobuf.FieldMask.paths: array expected");t2.paths=[];for(var o2=0;o2>>0,e2.seconds.high>>>0).toNumber())),e2.nanos!=null&&(t2.nanos=0|e2.nanos),t2)},ve.toObject=function(e2,t2){var o2,r2={};return(t2=t2||{}).defaults&&(i.Long?(o2=new i.Long(0,0,!1),r2.seconds=t2.longs===String?o2.toString():t2.longs===Number?o2.toNumber():o2):r2.seconds=t2.longs===String?"0":0,r2.nanos=0),e2.seconds!=null&&e2.hasOwnProperty("seconds")&&(typeof e2.seconds=="number"?r2.seconds=t2.longs===String?String(e2.seconds):e2.seconds:r2.seconds=t2.longs===String?i.Long.prototype.toString.call(e2.seconds):t2.longs===Number?new i.LongBits(e2.seconds.low>>>0,e2.seconds.high>>>0).toNumber():e2.seconds),e2.nanos!=null&&e2.hasOwnProperty("nanos")&&(r2.nanos=e2.nanos),r2},ve.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},ve.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.protobuf.Duration"},ve),t),L.firestore=((e={}).v1=((n={}).AggregationResult=(Te.prototype.aggregateFields=i.emptyObject,Te.fromObject=function(e2){if(e2 instanceof a.google.firestore.v1.AggregationResult)return e2;var t2=new a.google.firestore.v1.AggregationResult;if(e2.aggregateFields){if(typeof e2.aggregateFields!="object")throw TypeError(".google.firestore.v1.AggregationResult.aggregateFields: object expected");t2.aggregateFields={};for(var o2=Object.keys(e2.aggregateFields),r2=0;r2>>0,e2.integerValue.high>>>0).toNumber())),e2.doubleValue!=null&&(t2.doubleValue=Number(e2.doubleValue)),e2.timestampValue!=null){if(typeof e2.timestampValue!="object")throw TypeError(".google.firestore.v1.Value.timestampValue: object expected");t2.timestampValue=a.google.protobuf.Timestamp.fromObject(e2.timestampValue)}if(e2.stringValue!=null&&(t2.stringValue=String(e2.stringValue)),e2.bytesValue!=null&&(typeof e2.bytesValue=="string"?i.base64.decode(e2.bytesValue,t2.bytesValue=i.newBuffer(i.base64.length(e2.bytesValue)),0):0<=e2.bytesValue.length&&(t2.bytesValue=e2.bytesValue)),e2.referenceValue!=null&&(t2.referenceValue=String(e2.referenceValue)),e2.geoPointValue!=null){if(typeof e2.geoPointValue!="object")throw TypeError(".google.firestore.v1.Value.geoPointValue: object expected");t2.geoPointValue=a.google.type.LatLng.fromObject(e2.geoPointValue)}if(e2.arrayValue!=null){if(typeof e2.arrayValue!="object")throw TypeError(".google.firestore.v1.Value.arrayValue: object expected");t2.arrayValue=a.google.firestore.v1.ArrayValue.fromObject(e2.arrayValue)}if(e2.mapValue!=null){if(typeof e2.mapValue!="object")throw TypeError(".google.firestore.v1.Value.mapValue: object expected");t2.mapValue=a.google.firestore.v1.MapValue.fromObject(e2.mapValue)}return t2},m.toObject=function(e2,t2){t2=t2||{};var o2={};return e2.booleanValue!=null&&e2.hasOwnProperty("booleanValue")&&(o2.booleanValue=e2.booleanValue,t2.oneofs)&&(o2.valueType="booleanValue"),e2.integerValue!=null&&e2.hasOwnProperty("integerValue")&&(typeof e2.integerValue=="number"?o2.integerValue=t2.longs===String?String(e2.integerValue):e2.integerValue:o2.integerValue=t2.longs===String?i.Long.prototype.toString.call(e2.integerValue):t2.longs===Number?new i.LongBits(e2.integerValue.low>>>0,e2.integerValue.high>>>0).toNumber():e2.integerValue,t2.oneofs)&&(o2.valueType="integerValue"),e2.doubleValue!=null&&e2.hasOwnProperty("doubleValue")&&(o2.doubleValue=t2.json&&!isFinite(e2.doubleValue)?String(e2.doubleValue):e2.doubleValue,t2.oneofs)&&(o2.valueType="doubleValue"),e2.referenceValue!=null&&e2.hasOwnProperty("referenceValue")&&(o2.referenceValue=e2.referenceValue,t2.oneofs)&&(o2.valueType="referenceValue"),e2.mapValue!=null&&e2.hasOwnProperty("mapValue")&&(o2.mapValue=a.google.firestore.v1.MapValue.toObject(e2.mapValue,t2),t2.oneofs)&&(o2.valueType="mapValue"),e2.geoPointValue!=null&&e2.hasOwnProperty("geoPointValue")&&(o2.geoPointValue=a.google.type.LatLng.toObject(e2.geoPointValue,t2),t2.oneofs)&&(o2.valueType="geoPointValue"),e2.arrayValue!=null&&e2.hasOwnProperty("arrayValue")&&(o2.arrayValue=a.google.firestore.v1.ArrayValue.toObject(e2.arrayValue,t2),t2.oneofs)&&(o2.valueType="arrayValue"),e2.timestampValue!=null&&e2.hasOwnProperty("timestampValue")&&(o2.timestampValue=a.google.protobuf.Timestamp.toObject(e2.timestampValue,t2),t2.oneofs)&&(o2.valueType="timestampValue"),e2.nullValue!=null&&e2.hasOwnProperty("nullValue")&&(o2.nullValue=t2.enums!==String||a.google.protobuf.NullValue[e2.nullValue]===void 0?e2.nullValue:a.google.protobuf.NullValue[e2.nullValue],t2.oneofs)&&(o2.valueType="nullValue"),e2.stringValue!=null&&e2.hasOwnProperty("stringValue")&&(o2.stringValue=e2.stringValue,t2.oneofs)&&(o2.valueType="stringValue"),e2.bytesValue!=null&&e2.hasOwnProperty("bytesValue")&&(o2.bytesValue=t2.bytes===String?i.base64.encode(e2.bytesValue,0,e2.bytesValue.length):t2.bytes===Array?Array.prototype.slice.call(e2.bytesValue):e2.bytesValue,t2.oneofs)&&(o2.valueType="bytesValue"),o2},m.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},m.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.firestore.v1.Value"},m),n.ArrayValue=(De.prototype.values=i.emptyArray,De.fromObject=function(e2){if(e2 instanceof a.google.firestore.v1.ArrayValue)return e2;var t2=new a.google.firestore.v1.ArrayValue;if(e2.values){if(!Array.isArray(e2.values))throw TypeError(".google.firestore.v1.ArrayValue.values: array expected");t2.values=[];for(var o2=0;o2>>0,e2.partitionCount.high>>>0).toNumber())),e2.pageToken!=null&&(t2.pageToken=String(e2.pageToken)),e2.pageSize!=null&&(t2.pageSize=0|e2.pageSize),e2.readTime!=null){if(typeof e2.readTime!="object")throw TypeError(".google.firestore.v1.PartitionQueryRequest.readTime: object expected");t2.readTime=a.google.protobuf.Timestamp.fromObject(e2.readTime)}return t2},S.toObject=function(e2,t2){var o2,r2={};return(t2=t2||{}).defaults&&(r2.parent="",i.Long?(o2=new i.Long(0,0,!1),r2.partitionCount=t2.longs===String?o2.toString():t2.longs===Number?o2.toNumber():o2):r2.partitionCount=t2.longs===String?"0":0,r2.pageToken="",r2.pageSize=0),e2.parent!=null&&e2.hasOwnProperty("parent")&&(r2.parent=e2.parent),e2.structuredQuery!=null&&e2.hasOwnProperty("structuredQuery")&&(r2.structuredQuery=a.google.firestore.v1.StructuredQuery.toObject(e2.structuredQuery,t2),t2.oneofs)&&(r2.queryType="structuredQuery"),e2.partitionCount!=null&&e2.hasOwnProperty("partitionCount")&&(typeof e2.partitionCount=="number"?r2.partitionCount=t2.longs===String?String(e2.partitionCount):e2.partitionCount:r2.partitionCount=t2.longs===String?i.Long.prototype.toString.call(e2.partitionCount):t2.longs===Number?new i.LongBits(e2.partitionCount.low>>>0,e2.partitionCount.high>>>0).toNumber():e2.partitionCount),e2.pageToken!=null&&e2.hasOwnProperty("pageToken")&&(r2.pageToken=e2.pageToken),e2.pageSize!=null&&e2.hasOwnProperty("pageSize")&&(r2.pageSize=e2.pageSize),e2.readTime!=null&&e2.hasOwnProperty("readTime")&&(r2.readTime=a.google.protobuf.Timestamp.toObject(e2.readTime,t2),t2.oneofs)&&(r2.consistencySelector="readTime"),r2},S.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},S.getTypeUrl=function(e2){return(e2=e2===void 0?"type.googleapis.com":e2)+"/google.firestore.v1.PartitionQueryRequest"},S),n.PartitionQueryResponse=(Ge.prototype.partitions=i.emptyArray,Ge.prototype.nextPageToken="",Ge.fromObject=function(e2){if(e2 instanceof a.google.firestore.v1.PartitionQueryResponse)return e2;var t2=new a.google.firestore.v1.PartitionQueryResponse;if(e2.partitions){if(!Array.isArray(e2.partitions))throw TypeError(".google.firestore.v1.PartitionQueryResponse.partitions: array expected");t2.partitions=[];for(var o2=0;o2this.latestReadTime&&(this.latestReadTime=snap.readTime)}addNamedQuery(name,querySnap){if(this.namedQueries.has(name))throw new Error(`Query name conflict: ${name} has already been added.`);this.namedQueries.set(name,{name,bundledQuery:querySnap.query._toBundledQuery(),readTime:querySnap.readTime.toProto().timestampValue});for(let snap of querySnap.docs)this.addBundledDocument(snap,name);querySnap.readTime>this.latestReadTime&&(this.latestReadTime=querySnap.readTime)}elementToLengthPrefixedBuffer(bundleElement){let message=require_firestore_v1_proto_api().firestore.BundleElement.fromObject(bundleElement).toJSON(),buffer=Buffer.from(JSON.stringify(message),"utf-8"),lengthBuffer=Buffer.from(buffer.length.toString());return Buffer.concat([lengthBuffer,buffer])}build(){let bundleBuffer=Buffer.alloc(0);for(let namedQuery of this.namedQueries.values())bundleBuffer=Buffer.concat([bundleBuffer,this.elementToLengthPrefixedBuffer({namedQuery})]);for(let bundledDocument of this.documents.values()){let documentMetadata=bundledDocument.metadata;bundleBuffer=Buffer.concat([bundleBuffer,this.elementToLengthPrefixedBuffer({documentMetadata})]);let document2=bundledDocument.document;document2&&(bundleBuffer=Buffer.concat([bundleBuffer,this.elementToLengthPrefixedBuffer({document:document2})]))}let metadata={id:this.bundleId,createTime:this.latestReadTime.toProto().timestampValue,version:BUNDLE_VERSION,totalDocuments:this.documents.size,totalBytes:bundleBuffer.length};return bundleBuffer=Buffer.concat([this.elementToLengthPrefixedBuffer({metadata}),bundleBuffer]),bundleBuffer}};__name(BundleBuilder,"BundleBuilder");exports2.BundleBuilder=BundleBuilder;function validateDocumentSnapshot(arg,value){if(!(value instanceof document_1.DocumentSnapshot))throw new Error((0,validate_1.invalidArgumentMessage)(arg,"DocumentSnapshot"))}__name(validateDocumentSnapshot,"validateDocumentSnapshot");function validateQuerySnapshot(arg,value){if(!(value instanceof reference_1.QuerySnapshot))throw new Error((0,validate_1.invalidArgumentMessage)(arg,"QuerySnapshot"))}__name(validateQuerySnapshot,"validateQuerySnapshot")}});var require_document_reader=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/document-reader.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.DocumentReader=void 0;var document_1=require_document(),util_1=require_util6(),logger_1=require_logger(),DocumentReader=class{constructor(firestore,allDocuments){this.firestore=firestore,this.allDocuments=allDocuments,this.outstandingDocuments=new Set,this.retrievedDocuments=new Map;for(let docRef of this.allDocuments)this.outstandingDocuments.add(docRef.formattedName)}async get(requestTag){await this.fetchDocuments(requestTag);let orderedDocuments=[];for(let docRef of this.allDocuments){let document2=this.retrievedDocuments.get(docRef.formattedName);if(document2!==void 0){let finalDoc=new document_1.DocumentSnapshotBuilder(docRef);finalDoc.fieldsProto=document2._fieldsProto,finalDoc.readTime=document2.readTime,finalDoc.createTime=document2.createTime,finalDoc.updateTime=document2.updateTime,orderedDocuments.push(finalDoc.build())}else throw new Error(`Did not receive document for "${docRef.path}".`)}return orderedDocuments}async fetchDocuments(requestTag){if(!this.outstandingDocuments.size)return;let request={database:this.firestore.formattedName,transaction:this.transactionId,documents:Array.from(this.outstandingDocuments)};if(this.fieldMask){let fieldPaths=this.fieldMask.map(fieldPath=>fieldPath.formattedName);request.mask={fieldPaths}}let resultCount=0;try{let stream=await this.firestore.requestStream("batchGetDocuments",!1,request,requestTag);stream.resume();for await(let response of stream){let snapshot;response.found?((0,logger_1.logger)("DocumentReader.fetchDocuments",requestTag,"Received document: %s",response.found.name),snapshot=this.firestore.snapshot_(response.found,response.readTime)):((0,logger_1.logger)("DocumentReader.fetchDocuments",requestTag,"Document missing: %s",response.missing),snapshot=this.firestore.snapshot_(response.missing,response.readTime));let path=snapshot.ref.formattedName;this.outstandingDocuments.delete(path),this.retrievedDocuments.set(path,snapshot),++resultCount}}catch(error){let shouldRetry=!this.transactionId&&resultCount>0&&error.code!==void 0&&!(0,util_1.isPermanentRpcError)(error,"batchGetDocuments");if((0,logger_1.logger)("DocumentReader.fetchDocuments",requestTag,"BatchGetDocuments failed with error: %s. Retrying: %s",error,shouldRetry),shouldRetry)return this.fetchDocuments(requestTag);throw error}finally{(0,logger_1.logger)("DocumentReader.fetchDocuments",requestTag,"Received %d results",resultCount)}}};__name(DocumentReader,"DocumentReader");exports2.DocumentReader=DocumentReader}});var require_pool2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/pool.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.ClientPool=exports2.CLIENT_TERMINATED_ERROR_MSG=void 0;var assert=require("assert"),logger_1=require_logger(),util_1=require_util6();exports2.CLIENT_TERMINATED_ERROR_MSG="The client has already been terminated";var ClientPool=class{constructor(concurrentOperationLimit,maxIdleClients,clientFactory,clientDestructor=()=>Promise.resolve()){this.concurrentOperationLimit=concurrentOperationLimit,this.maxIdleClients=maxIdleClients,this.clientFactory=clientFactory,this.clientDestructor=clientDestructor,this.grpcEnabled=!1,this.activeClients=new Map,this.failedClients=new Set,this.terminated=!1,this.terminateDeferred=new util_1.Deferred}acquire(requestTag,requiresGrpc){let selectedClient=null,selectedClientRequestCount=-1;this.grpcEnabled=this.grpcEnabled||requiresGrpc,requiresGrpc=requiresGrpc||this.grpcEnabled;for(let[client,metadata]of this.activeClients)!this.failedClients.has(client)&&metadata.activeRequestCount>selectedClientRequestCount&&metadata.activeRequestCount0,"No active requests"),this.activeClients.set(client,{grpcEnabled:metadata.grpcEnabled,activeRequestCount:metadata.activeRequestCount-1}),this.terminated&&this.opCount===0&&this.terminateDeferred.resolve(),this.shouldGarbageCollectClient(client)&&(this.activeClients.delete(client),this.failedClients.delete(client),await this.clientDestructor(client),(0,logger_1.logger)("ClientPool.release",requestTag,"Garbage collected 1 client"))}shouldGarbageCollectClient(client){let clientMetadata=this.activeClients.get(client);if(clientMetadata.activeRequestCount!==0)return!1;if(this.grpcEnabled!==clientMetadata.grpcEnabled||this.failedClients.has(client))return!0;let idleCapacityCount=0;for(let[,metadata]of this.activeClients)idleCapacityCount+=this.concurrentOperationLimit-metadata.activeRequestCount;return idleCapacityCount>this.maxIdleClients*this.concurrentOperationLimit}get size(){return this.activeClients.size}get opCount(){let activeOperationCount=0;return this.activeClients.forEach(metadata=>activeOperationCount+=metadata.activeRequestCount),activeOperationCount}get _activeClients(){return this.activeClients}run(requestTag,requiresGrpc,op){if(this.terminated)return Promise.reject(new Error(exports2.CLIENT_TERMINATED_ERROR_MSG));let client=this.acquire(requestTag,requiresGrpc);return op(client).catch(async err=>{var _a;return!((_a=err.message)===null||_a===void 0)&&_a.match(/RST_STREAM/)&&this.failedClients.add(client),await this.release(requestTag,client),Promise.reject(err)}).then(async res=>(await this.release(requestTag,client),res))}async terminate(){this.terminated=!0,this.opCount>0&&((0,logger_1.logger)("ClientPool.terminate",null,"Waiting for %s pending operations to complete before terminating",this.opCount),await this.terminateDeferred.promise);for(let[client]of this.activeClients)this.activeClients.delete(client),await this.clientDestructor(client)}};__name(ClientPool,"ClientPool");exports2.ClientPool=ClientPool}});var require_transaction=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/transaction.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.parseGetAllArguments=exports2.Transaction=void 0;var backoff_1=require_backoff(),logger_1=require_logger(),path_1=require_path2(),reference_1=require_reference(),util_1=require_util6(),validate_1=require_validate(),document_reader_1=require_document_reader();var READ_AFTER_WRITE_ERROR_MSG="Firestore transactions require all reads to be executed before all writes.",Transaction=class{constructor(firestore,requestTag){this._firestore=firestore,this._writeBatch=firestore.batch(),this._requestTag=requestTag,this._backoff=new backoff_1.ExponentialBackoff}get(refOrQuery){if(!this._writeBatch.isEmpty)throw new Error(READ_AFTER_WRITE_ERROR_MSG);if(refOrQuery instanceof reference_1.DocumentReference){let documentReader=new document_reader_1.DocumentReader(this._firestore,[refOrQuery]);return documentReader.transactionId=this._transactionId,documentReader.get(this._requestTag).then(([res])=>res)}if(refOrQuery instanceof reference_1.Query)return refOrQuery._get(this._transactionId);if(refOrQuery instanceof reference_1.AggregateQuery)return refOrQuery._get(this._transactionId);throw new Error('Value for argument "refOrQuery" must be a DocumentReference, Query, or AggregateQuery.')}getAll(...documentRefsOrReadOptions){if(!this._writeBatch.isEmpty)throw new Error(READ_AFTER_WRITE_ERROR_MSG);(0,validate_1.validateMinNumberOfArguments)("Transaction.getAll",documentRefsOrReadOptions,1);let{documents,fieldMask}=parseGetAllArguments(documentRefsOrReadOptions),documentReader=new document_reader_1.DocumentReader(this._firestore,documents);return documentReader.fieldMask=fieldMask||void 0,documentReader.transactionId=this._transactionId,documentReader.get(this._requestTag)}create(documentRef,data){return this._writeBatch.create(documentRef,data),this}set(documentRef,data,options){return options?this._writeBatch.set(documentRef,data,options):this._writeBatch.set(documentRef,data),this}update(documentRef,dataOrField,...preconditionOrValues){return(0,validate_1.validateMinNumberOfArguments)("Transaction.update",arguments,2),this._writeBatch.update(documentRef,dataOrField,...preconditionOrValues),this}delete(documentRef,precondition){return this._writeBatch.delete(documentRef,precondition),this}begin(readOnly,readTime){var _a;let request={database:this._firestore.formattedName};return readOnly?request.options={readOnly:{readTime:(_a=readTime?.toProto())===null||_a===void 0?void 0:_a.timestampValue}}:this._transactionId&&(request.options={readWrite:{retryTransaction:this._transactionId}}),this._firestore.request("beginTransaction",request,this._requestTag).then(resp=>{this._transactionId=resp.transaction})}commit(){return this._writeBatch._commit({transactionId:this._transactionId,requestTag:this._requestTag}).then(()=>{})}rollback(){let request={database:this._firestore.formattedName,transaction:this._transactionId};return this._firestore.request("rollback",request,this._requestTag)}async runTransaction(updateFunction,options){let result,lastError;for(let attempt=0;attempt0&&(0,util_1.isPlainObject)(documentRefsOrReadOptions[documentRefsOrReadOptions.length-1])&&(readOptions=documentRefsOrReadOptions.pop()),documents=documentRefsOrReadOptions;for(let i=0;ipath_1.FieldPath.fromArgument(fieldPath)):null,documents}}__name(parseGetAllArguments,"parseGetAllArguments");exports2.parseGetAllArguments=parseGetAllArguments;function validateReadOptions(arg,value,options){if(!(0,validate_1.validateOptional)(value,options)){if(!(0,util_1.isObject)(value))throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"read option")} Input is not an object.'`);let options2=value;if(options2.fieldMask!==void 0){if(!Array.isArray(options2.fieldMask))throw new Error(`${(0,validate_1.invalidArgumentMessage)(arg,"read option")} "fieldMask" is not an array.`);for(let i=0;ithis._serializer.decodeValue(v))),this._memoizedStartAt}get endBefore(){return this._endBefore&&!this._memoizedEndBefore&&(this._memoizedEndBefore=this._endBefore.map(v=>this._serializer.decodeValue(v))),this._memoizedEndBefore}toQuery(){let queryOptions=reference_1.QueryOptions.forCollectionGroupQuery(this._collectionId,this._converter);return queryOptions=queryOptions.with({fieldOrders:[new reference_1.FieldOrder(path_1.FieldPath.documentId())]}),this._startAt!==void 0&&(queryOptions=queryOptions.with({startAt:{before:!0,values:this._startAt}})),this._endBefore!==void 0&&(queryOptions=queryOptions.with({endAt:{before:!0,values:this._endBefore}})),new reference_1.Query(this._firestore,queryOptions)}};__name(QueryPartition,"QueryPartition");exports2.QueryPartition=QueryPartition}});var require_collection_group=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/collection-group.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.CollectionGroup=void 0;var query_partition_1=require_query_partition(),util_1=require_util6(),logger_1=require_logger(),reference_1=require_reference(),path_1=require_path2(),validate_1=require_validate(),types_1=require_types2(),order_1=require_order(),CollectionGroup=class extends reference_1.Query{constructor(firestore,collectionId,converter){super(firestore,reference_1.QueryOptions.forCollectionGroupQuery(collectionId,converter))}async*getPartitions(desiredPartitionCount){var _a;(0,validate_1.validateInteger)("desiredPartitionCount",desiredPartitionCount,{minValue:1});let tag=(0,util_1.requestTag)();await this.firestore.initializeIfNeeded(tag);let partitions=[];if(desiredPartitionCount>1){let request=this.orderBy(path_1.FieldPath.documentId()).toProto();request.partitionCount=desiredPartitionCount-1;let stream=await this.firestore.requestStream("partitionQueryStream",!1,request,tag);stream.resume();for await(let currentCursor of stream)partitions.push((_a=currentCursor.values)!==null&&_a!==void 0?_a:[])}(0,logger_1.logger)("Firestore.getPartitions",tag,"Received %d partitions",partitions.length),partitions.sort((l,r)=>(0,order_1.compareArrays)(l,r));for(let i=0;i0?partitions[i-1]:void 0,partitions[i]);yield new query_partition_1.QueryPartition(this._firestore,this._queryOptions.collectionId,this._queryOptions.converter,partitions.pop(),void 0)}withConverter(converter){return new CollectionGroup(this.firestore,this._queryOptions.collectionId,converter??(0,types_1.defaultConverter)())}};__name(CollectionGroup,"CollectionGroup");exports2.CollectionGroup=CollectionGroup}});var require_recursive_delete=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/recursive-delete.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.RecursiveDelete=exports2.RECURSIVE_DELETE_MIN_PENDING_OPS=exports2.RECURSIVE_DELETE_MAX_PENDING_OPS=exports2.REFERENCE_NAME_MIN_ID=void 0;var assert=require("assert"),_1=require_src12(),util_1=require_util6(),reference_1=require_reference();exports2.REFERENCE_NAME_MIN_ID="__id-9223372036854775808__";exports2.RECURSIVE_DELETE_MAX_PENDING_OPS=5e3;exports2.RECURSIVE_DELETE_MIN_PENDING_OPS=1e3;var RecursiveDelete=class{constructor(firestore,writer,ref,maxLimit,minLimit){this.firestore=firestore,this.writer=writer,this.ref=ref,this.maxLimit=maxLimit,this.minLimit=minLimit,this.errorCount=0,this.documentsPending=!0,this.started=!1,this.completionDeferred=new util_1.Deferred,this.streamInProgress=!1,this.pendingOpsCount=0,this.errorStack="",this.maxPendingOps=maxLimit,this.minPendingOps=minLimit}run(){return assert(!this.started,"RecursiveDelete.run() should only be called once."),this.errorStack=Error().stack,this.writer._verifyNotClosed(),this.setupStream(),this.completionDeferred.promise}setupStream(){let stream=this.getAllDescendants(this.ref instanceof _1.CollectionReference?this.ref:this.ref);this.streamInProgress=!0;let streamedDocsCount=0;stream.on("error",err=>{err.code=14,err.stack="Failed to fetch children documents: "+err.stack,this.lastError=err,this.onQueryEnd()}).on("data",snap=>{streamedDocsCount++,this.lastDocumentSnap=snap,this.deleteRef(snap.ref)}).on("end",()=>{this.streamInProgress=!1,streamedDocsCount=",startAt).where(_1.FieldPath.documentId(),"<",endAt)}return this.lastDocumentSnap&&(query=query.startAfter(this.lastDocumentSnap)),query.stream()}onQueryEnd(){this.documentsPending=!1,this.ref instanceof _1.DocumentReference&&this.writer.delete(this.ref).catch(err=>this.incrementErrorCount(err)),this.writer.flush().then(async()=>{var _a;if(this.lastError===void 0)this.completionDeferred.resolve();else{let error=new(require_fallback()).GoogleError(`${this.errorCount} ${this.errorCount!==1?"deletes":"delete"} failed. The last delete failed with: `);this.lastError.code!==void 0&&(error.code=this.lastError.code),error=(0,util_1.wrapError)(error,this.errorStack),this.completionDeferred.reject(this.lastError.stack?(0,util_1.wrapError)(error,(_a=this.lastError.stack)!==null&&_a!==void 0?_a:""):error)}})}deleteRef(docRef){this.pendingOpsCount++,this.writer.delete(docRef).catch(err=>{this.incrementErrorCount(err)}).then(()=>{this.pendingOpsCount--,this.documentsPending&&!this.streamInProgress&&this.pendingOpsCount=14.0.0"},repository:"googleapis/nodejs-firestore",main:"./build/src/index.js",types:"./types/firestore.d.ts",files:["build/protos","build/src","!build/src/**/*.map","types"],keywords:["google apis client","google api client","google apis","google api","google","google cloud platform","google cloud","cloud","firestore"],scripts:{predocs:"npm run compile",docs:"jsdoc -c .jsdoc.js","system-test:rest":"FIRESTORE_PREFER_REST=true mocha build/system-test --timeout 600000","system-test:named-db:rest":"FIRESTORE_NAMED_DATABASE=test-db FIRESTORE_PREFER_REST=true mocha build/system-test --timeout 600000","system-test:grpc":"mocha build/system-test --timeout 600000","system-test:named-db:grpc":"FIRESTORE_NAMED_DATABASE=test-db mocha build/system-test --timeout 600000","system-test:emulator:rest":"FIRESTORE_EMULATOR_HOST=localhost:8080 FIRESTORE_PREFER_REST=true mocha build/system-test --timeout 600000","system-test:named-db:emulator:rest":"FIRESTORE_NAMED_DATABASE=test-db FIRESTORE_EMULATOR_HOST=localhost:8080 FIRESTORE_PREFER_REST=true mocha build/system-test --timeout 600000","system-test:emulator:grpc":"FIRESTORE_EMULATOR_HOST=localhost:8080 mocha build/system-test --timeout 600000","system-test:named-db:emulator:grpc":"FIRESTORE_NAMED_DATABASE=test-db FIRESTORE_EMULATOR_HOST=localhost:8080 mocha build/system-test --timeout 600000","system-test":"npm run system-test:grpc && npm run system-test:rest && npm run system-test:named-db:grpc && npm run system-test:named-db:rest","system-test:emulator":"npm run system-test:emulator:grpc && npm run system-test:emulator:rest && npm run system-test:named-db:emulator:grpc && npm run system-test:named-db:emulator:rest","presystem-test":"npm run compile","samples-test":"npm link && cd samples/ && npm link ../ && npm test && cd ../",conformance:"mocha build/conformance",preconformance:"npm run compile","test-only":"c8 mocha build/test","pretest-only":"npm run compile",test:"npm run test-only && npm run conformance",lint:"gts check",clean:"gts clean",compile:"tsc -p .",postcompile:"node scripts/init-directories.js && cp -r dev/protos build && cp dev/src/v1beta1/*.json build/src/v1beta1/ && cp dev/src/v1/*.json build/src/v1/ && cp dev/conformance/test-definition.proto build/conformance && cp dev/conformance/conformance-tests/*.json build/conformance/conformance-tests && minifyProtoJson",fix:"gts fix",prepare:"npm run compile","docs-test":"linkinator docs","predocs-test":"npm run docs",prelint:"cd samples; npm link ../; npm install",precompile:"gts clean"},dependencies:{"fast-deep-equal":"^3.1.1","functional-red-black-tree":"^1.0.1","google-gax":"^4.0.4",protobufjs:"^7.2.5"},devDependencies:{"@types/assert":"^1.4.0","@types/chai":"^4.2.7","@types/chai-as-promised":"^7.1.2","@types/duplexify":"^3.5.0","@types/extend":"^3.0.0","@types/mocha":"^9.0.0","@types/node":"^18.0.0","@types/sinon":"^10.0.0","@types/through2":"^2.0.34",c8:"^8.0.0",chai:"^4.1.2","chai-as-promised":"^7.1.1",codecov:"^3.6.1",duplexify:"^4.0.0",extend:"^3.0.2","gapic-tools":"^0.2.0",gts:"^5.0.1",jsdoc:"^4.0.0","jsdoc-fresh":"^3.0.0","jsdoc-region-tag":"^3.0.0","length-prefixed-json-stream":"^1.0.1",linkinator:"^5.0.0",mocha:"^9.2.2","protobufjs-cli":"^1.1.2",proxyquire:"^2.1.3",sinon:"^16.0.0",through2:"^4.0.0","ts-node":"^10.0.0",typescript:"^5.2.2"}}}});var require_v1beta1=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/protos/v1beta1.json"(exports2,module2){module2.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:{Timestamp:{fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}},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}}},FileDescriptorSet:{fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}}},FileDescriptorProto:{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,options:{packed:!1}},weakDependency:{rule:"repeated",type:"int32",id:11,options:{packed:!1}},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}}},DescriptorProto:{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}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},FieldDescriptorProto:{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}},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_REQUIRED:2,LABEL_REPEATED:3}}}},OneofDescriptorProto:{fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3}}},EnumValueDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{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:{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},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[38,38]],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[8,8]]},FieldOptions:{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},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}}}},OneofOptions:{fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumValueOptions:{fields:{deprecated:{type:"bool",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{fields:{deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{fields:{deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},UninterpretedOption:{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}}}}},SourceCodeInfo:{fields:{location:{rule:"repeated",type:"Location",id:1}},nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1},span:{rule:"repeated",type:"int32",id:2},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4}}}}},Empty:{fields:{}},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}}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}},Duration:{fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}},firestore:{nested:{v1beta1:{options:{csharp_namespace:"Google.Cloud.Firestore.V1Beta1",go_package:"cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb",java_multiple_files:!0,java_outer_classname:"WriteProto",java_package:"com.google.firestore.v1beta1",objc_class_prefix:"GCFS",php_namespace:"Google\\Cloud\\Firestore\\V1beta1",ruby_package:"Google::Cloud::Firestore::V1beta1"},nested:{DocumentMask:{fields:{fieldPaths:{rule:"repeated",type:"string",id:1}}},Precondition:{oneofs:{conditionType:{oneof:["exists","updateTime"]}},fields:{exists:{type:"bool",id:1},updateTime:{type:"google.protobuf.Timestamp",id:2}}},TransactionOptions:{oneofs:{mode:{oneof:["readOnly","readWrite"]}},fields:{readOnly:{type:"ReadOnly",id:2},readWrite:{type:"ReadWrite",id:3}},nested:{ReadWrite:{fields:{retryTransaction:{type:"bytes",id:1}}},ReadOnly:{oneofs:{consistencySelector:{oneof:["readTime"]}},fields:{readTime:{type:"google.protobuf.Timestamp",id:2}}}}},Document:{fields:{name:{type:"string",id:1},fields:{keyType:"string",type:"Value",id:2},createTime:{type:"google.protobuf.Timestamp",id:3},updateTime:{type:"google.protobuf.Timestamp",id:4}}},Value:{oneofs:{valueType:{oneof:["nullValue","booleanValue","integerValue","doubleValue","timestampValue","stringValue","bytesValue","referenceValue","geoPointValue","arrayValue","mapValue"]}},fields:{nullValue:{type:"google.protobuf.NullValue",id:11},booleanValue:{type:"bool",id:1},integerValue:{type:"int64",id:2},doubleValue:{type:"double",id:3},timestampValue:{type:"google.protobuf.Timestamp",id:10},stringValue:{type:"string",id:17},bytesValue:{type:"bytes",id:18},referenceValue:{type:"string",id:5},geoPointValue:{type:"google.type.LatLng",id:8},arrayValue:{type:"ArrayValue",id:9},mapValue:{type:"MapValue",id:6}}},ArrayValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}},MapValue:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Firestore:{options:{"(google.api.default_host)":"firestore.googleapis.com","(google.api.oauth_scopes)":"https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/datastore"},methods:{GetDocument:{requestType:"GetDocumentRequest",responseType:"Document",options:{"(google.api.http).get":"/v1beta1/{name=projects/*/databases/*/documents/*/**}"},parsedOptions:[{"(google.api.http)":{get:"/v1beta1/{name=projects/*/databases/*/documents/*/**}"}}]},ListDocuments:{requestType:"ListDocumentsRequest",responseType:"ListDocumentsResponse",options:{"(google.api.http).get":"/v1beta1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}"},parsedOptions:[{"(google.api.http)":{get:"/v1beta1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}"}}]},UpdateDocument:{requestType:"UpdateDocumentRequest",responseType:"Document",options:{"(google.api.http).patch":"/v1beta1/{document.name=projects/*/databases/*/documents/*/**}","(google.api.http).body":"document","(google.api.method_signature)":"document,update_mask"},parsedOptions:[{"(google.api.http)":{patch:"/v1beta1/{document.name=projects/*/databases/*/documents/*/**}",body:"document"}},{"(google.api.method_signature)":"document,update_mask"}]},DeleteDocument:{requestType:"DeleteDocumentRequest",responseType:"google.protobuf.Empty",options:{"(google.api.http).delete":"/v1beta1/{name=projects/*/databases/*/documents/*/**}","(google.api.method_signature)":"name"},parsedOptions:[{"(google.api.http)":{delete:"/v1beta1/{name=projects/*/databases/*/documents/*/**}"}},{"(google.api.method_signature)":"name"}]},BatchGetDocuments:{requestType:"BatchGetDocumentsRequest",responseType:"BatchGetDocumentsResponse",responseStream:!0,options:{"(google.api.http).post":"/v1beta1/{database=projects/*/databases/*}/documents:batchGet","(google.api.http).body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1beta1/{database=projects/*/databases/*}/documents:batchGet",body:"*"}}]},BeginTransaction:{requestType:"BeginTransactionRequest",responseType:"BeginTransactionResponse",options:{"(google.api.http).post":"/v1beta1/{database=projects/*/databases/*}/documents:beginTransaction","(google.api.http).body":"*","(google.api.method_signature)":"database"},parsedOptions:[{"(google.api.http)":{post:"/v1beta1/{database=projects/*/databases/*}/documents:beginTransaction",body:"*"}},{"(google.api.method_signature)":"database"}]},Commit:{requestType:"CommitRequest",responseType:"CommitResponse",options:{"(google.api.http).post":"/v1beta1/{database=projects/*/databases/*}/documents:commit","(google.api.http).body":"*","(google.api.method_signature)":"database,writes"},parsedOptions:[{"(google.api.http)":{post:"/v1beta1/{database=projects/*/databases/*}/documents:commit",body:"*"}},{"(google.api.method_signature)":"database,writes"}]},Rollback:{requestType:"RollbackRequest",responseType:"google.protobuf.Empty",options:{"(google.api.http).post":"/v1beta1/{database=projects/*/databases/*}/documents:rollback","(google.api.http).body":"*","(google.api.method_signature)":"database,transaction"},parsedOptions:[{"(google.api.http)":{post:"/v1beta1/{database=projects/*/databases/*}/documents:rollback",body:"*"}},{"(google.api.method_signature)":"database,transaction"}]},RunQuery:{requestType:"RunQueryRequest",responseType:"RunQueryResponse",responseStream:!0,options:{"(google.api.http).post":"/v1beta1/{parent=projects/*/databases/*/documents}:runQuery","(google.api.http).body":"*","(google.api.http).additional_bindings.post":"/v1beta1/{parent=projects/*/databases/*/documents/*/**}:runQuery","(google.api.http).additional_bindings.body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1beta1/{parent=projects/*/databases/*/documents}:runQuery",body:"*",additional_bindings:{post:"/v1beta1/{parent=projects/*/databases/*/documents/*/**}:runQuery",body:"*"}}}]},PartitionQuery:{requestType:"PartitionQueryRequest",responseType:"PartitionQueryResponse",options:{"(google.api.http).post":"/v1beta1/{parent=projects/*/databases/*/documents}:partitionQuery","(google.api.http).body":"*","(google.api.http).additional_bindings.post":"/v1beta1/{parent=projects/*/databases/*/documents/*/**}:partitionQuery","(google.api.http).additional_bindings.body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1beta1/{parent=projects/*/databases/*/documents}:partitionQuery",body:"*",additional_bindings:{post:"/v1beta1/{parent=projects/*/databases/*/documents/*/**}:partitionQuery",body:"*"}}}]},Write:{requestType:"WriteRequest",requestStream:!0,responseType:"WriteResponse",responseStream:!0,options:{"(google.api.http).post":"/v1beta1/{database=projects/*/databases/*}/documents:write","(google.api.http).body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1beta1/{database=projects/*/databases/*}/documents:write",body:"*"}}]},Listen:{requestType:"ListenRequest",requestStream:!0,responseType:"ListenResponse",responseStream:!0,options:{"(google.api.http).post":"/v1beta1/{database=projects/*/databases/*}/documents:listen","(google.api.http).body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1beta1/{database=projects/*/databases/*}/documents:listen",body:"*"}}]},ListCollectionIds:{requestType:"ListCollectionIdsRequest",responseType:"ListCollectionIdsResponse",options:{"(google.api.http).post":"/v1beta1/{parent=projects/*/databases/*/documents}:listCollectionIds","(google.api.http).body":"*","(google.api.http).additional_bindings.post":"/v1beta1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds","(google.api.http).additional_bindings.body":"*","(google.api.method_signature)":"parent"},parsedOptions:[{"(google.api.http)":{post:"/v1beta1/{parent=projects/*/databases/*/documents}:listCollectionIds",body:"*",additional_bindings:{post:"/v1beta1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds",body:"*"}}},{"(google.api.method_signature)":"parent"}]},BatchWrite:{requestType:"BatchWriteRequest",responseType:"BatchWriteResponse",options:{"(google.api.http).post":"/v1beta1/{database=projects/*/databases/*}/documents:batchWrite","(google.api.http).body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1beta1/{database=projects/*/databases/*}/documents:batchWrite",body:"*"}}]},CreateDocument:{requestType:"CreateDocumentRequest",responseType:"Document",options:{"(google.api.http).post":"/v1beta1/{parent=projects/*/databases/*/documents/**}/{collection_id}","(google.api.http).body":"document"},parsedOptions:[{"(google.api.http)":{post:"/v1beta1/{parent=projects/*/databases/*/documents/**}/{collection_id}",body:"document"}}]}}},GetDocumentRequest:{oneofs:{consistencySelector:{oneof:["transaction","readTime"]}},fields:{name:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},mask:{type:"DocumentMask",id:2},transaction:{type:"bytes",id:3},readTime:{type:"google.protobuf.Timestamp",id:5}}},ListDocumentsRequest:{oneofs:{consistencySelector:{oneof:["transaction","readTime"]}},fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},collectionId:{type:"string",id:2,options:{"(google.api.field_behavior)":"REQUIRED"}},pageSize:{type:"int32",id:3},pageToken:{type:"string",id:4},orderBy:{type:"string",id:6},mask:{type:"DocumentMask",id:7},transaction:{type:"bytes",id:8},readTime:{type:"google.protobuf.Timestamp",id:10},showMissing:{type:"bool",id:12}}},ListDocumentsResponse:{fields:{documents:{rule:"repeated",type:"Document",id:1},nextPageToken:{type:"string",id:2}}},CreateDocumentRequest:{fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},collectionId:{type:"string",id:2,options:{"(google.api.field_behavior)":"REQUIRED"}},documentId:{type:"string",id:3},document:{type:"Document",id:4,options:{"(google.api.field_behavior)":"REQUIRED"}},mask:{type:"DocumentMask",id:5}}},UpdateDocumentRequest:{fields:{document:{type:"Document",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},updateMask:{type:"DocumentMask",id:2},mask:{type:"DocumentMask",id:3},currentDocument:{type:"Precondition",id:4}}},DeleteDocumentRequest:{fields:{name:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},currentDocument:{type:"Precondition",id:2}}},BatchGetDocumentsRequest:{oneofs:{consistencySelector:{oneof:["transaction","newTransaction","readTime"]}},fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},documents:{rule:"repeated",type:"string",id:2},mask:{type:"DocumentMask",id:3},transaction:{type:"bytes",id:4},newTransaction:{type:"TransactionOptions",id:5},readTime:{type:"google.protobuf.Timestamp",id:7}}},BatchGetDocumentsResponse:{oneofs:{result:{oneof:["found","missing"]}},fields:{found:{type:"Document",id:1},missing:{type:"string",id:2},transaction:{type:"bytes",id:3},readTime:{type:"google.protobuf.Timestamp",id:4}}},BeginTransactionRequest:{fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},options:{type:"TransactionOptions",id:2}}},BeginTransactionResponse:{fields:{transaction:{type:"bytes",id:1}}},CommitRequest:{fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},writes:{rule:"repeated",type:"Write",id:2},transaction:{type:"bytes",id:3}}},CommitResponse:{fields:{writeResults:{rule:"repeated",type:"WriteResult",id:1},commitTime:{type:"google.protobuf.Timestamp",id:2}}},RollbackRequest:{fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},transaction:{type:"bytes",id:2,options:{"(google.api.field_behavior)":"REQUIRED"}}}},RunQueryRequest:{oneofs:{queryType:{oneof:["structuredQuery"]},consistencySelector:{oneof:["transaction","newTransaction","readTime"]}},fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},structuredQuery:{type:"StructuredQuery",id:2},transaction:{type:"bytes",id:5},newTransaction:{type:"TransactionOptions",id:6},readTime:{type:"google.protobuf.Timestamp",id:7}}},RunQueryResponse:{fields:{transaction:{type:"bytes",id:2},document:{type:"Document",id:1},readTime:{type:"google.protobuf.Timestamp",id:3},skippedResults:{type:"int32",id:4}}},PartitionQueryRequest:{oneofs:{queryType:{oneof:["structuredQuery"]}},fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},structuredQuery:{type:"StructuredQuery",id:2},partitionCount:{type:"int64",id:3},pageToken:{type:"string",id:4},pageSize:{type:"int32",id:5}}},PartitionQueryResponse:{fields:{partitions:{rule:"repeated",type:"Cursor",id:1},nextPageToken:{type:"string",id:2}}},WriteRequest:{fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},streamId:{type:"string",id:2},writes:{rule:"repeated",type:"Write",id:3},streamToken:{type:"bytes",id:4},labels:{keyType:"string",type:"string",id:5}}},WriteResponse:{fields:{streamId:{type:"string",id:1},streamToken:{type:"bytes",id:2},writeResults:{rule:"repeated",type:"WriteResult",id:3},commitTime:{type:"google.protobuf.Timestamp",id:4}}},ListenRequest:{oneofs:{targetChange:{oneof:["addTarget","removeTarget"]}},fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},addTarget:{type:"Target",id:2},removeTarget:{type:"int32",id:3},labels:{keyType:"string",type:"string",id:4}}},ListenResponse:{oneofs:{responseType:{oneof:["targetChange","documentChange","documentDelete","documentRemove","filter"]}},fields:{targetChange:{type:"TargetChange",id:2},documentChange:{type:"DocumentChange",id:3},documentDelete:{type:"DocumentDelete",id:4},documentRemove:{type:"DocumentRemove",id:6},filter:{type:"ExistenceFilter",id:5}}},Target:{oneofs:{targetType:{oneof:["query","documents"]},resumeType:{oneof:["resumeToken","readTime"]}},fields:{query:{type:"QueryTarget",id:2},documents:{type:"DocumentsTarget",id:3},resumeToken:{type:"bytes",id:4},readTime:{type:"google.protobuf.Timestamp",id:11},targetId:{type:"int32",id:5},once:{type:"bool",id:6}},nested:{DocumentsTarget:{fields:{documents:{rule:"repeated",type:"string",id:2}}},QueryTarget:{oneofs:{queryType:{oneof:["structuredQuery"]}},fields:{parent:{type:"string",id:1},structuredQuery:{type:"StructuredQuery",id:2}}}}},TargetChange:{fields:{targetChangeType:{type:"TargetChangeType",id:1},targetIds:{rule:"repeated",type:"int32",id:2},cause:{type:"google.rpc.Status",id:3},resumeToken:{type:"bytes",id:4},readTime:{type:"google.protobuf.Timestamp",id:6}},nested:{TargetChangeType:{values:{NO_CHANGE:0,ADD:1,REMOVE:2,CURRENT:3,RESET:4}}}},ListCollectionIdsRequest:{fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},pageSize:{type:"int32",id:2},pageToken:{type:"string",id:3}}},ListCollectionIdsResponse:{fields:{collectionIds:{rule:"repeated",type:"string",id:1},nextPageToken:{type:"string",id:2}}},BatchWriteRequest:{fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},writes:{rule:"repeated",type:"Write",id:2},labels:{keyType:"string",type:"string",id:3}}},BatchWriteResponse:{fields:{writeResults:{rule:"repeated",type:"WriteResult",id:1},status:{rule:"repeated",type:"google.rpc.Status",id:2}}},StructuredQuery:{fields:{select:{type:"Projection",id:1},from:{rule:"repeated",type:"CollectionSelector",id:2},where:{type:"Filter",id:3},orderBy:{rule:"repeated",type:"Order",id:4},startAt:{type:"Cursor",id:7},endAt:{type:"Cursor",id:8},offset:{type:"int32",id:6},limit:{type:"google.protobuf.Int32Value",id:5}},nested:{CollectionSelector:{fields:{collectionId:{type:"string",id:2},allDescendants:{type:"bool",id:3}}},Filter:{oneofs:{filterType:{oneof:["compositeFilter","fieldFilter","unaryFilter"]}},fields:{compositeFilter:{type:"CompositeFilter",id:1},fieldFilter:{type:"FieldFilter",id:2},unaryFilter:{type:"UnaryFilter",id:3}}},CompositeFilter:{fields:{op:{type:"Operator",id:1},filters:{rule:"repeated",type:"Filter",id:2}},nested:{Operator:{values:{OPERATOR_UNSPECIFIED:0,AND:1}}}},FieldFilter:{fields:{field:{type:"FieldReference",id:1},op:{type:"Operator",id:2},value:{type:"Value",id:3}},nested:{Operator:{values:{OPERATOR_UNSPECIFIED:0,LESS_THAN:1,LESS_THAN_OR_EQUAL:2,GREATER_THAN:3,GREATER_THAN_OR_EQUAL:4,EQUAL:5,NOT_EQUAL:6,ARRAY_CONTAINS:7,IN:8,ARRAY_CONTAINS_ANY:9,NOT_IN:10}}}},UnaryFilter:{oneofs:{operandType:{oneof:["field"]}},fields:{op:{type:"Operator",id:1},field:{type:"FieldReference",id:2}},nested:{Operator:{values:{OPERATOR_UNSPECIFIED:0,IS_NAN:2,IS_NULL:3,IS_NOT_NAN:4,IS_NOT_NULL:5}}}},FieldReference:{fields:{fieldPath:{type:"string",id:2}}},Order:{fields:{field:{type:"FieldReference",id:1},direction:{type:"Direction",id:2}}},Projection:{fields:{fields:{rule:"repeated",type:"FieldReference",id:2}}},Direction:{values:{DIRECTION_UNSPECIFIED:0,ASCENDING:1,DESCENDING:2}}}},Cursor:{fields:{values:{rule:"repeated",type:"Value",id:1},before:{type:"bool",id:2}}},Write:{oneofs:{operation:{oneof:["update","delete","transform"]}},fields:{update:{type:"Document",id:1},delete:{type:"string",id:2},transform:{type:"DocumentTransform",id:6},updateMask:{type:"DocumentMask",id:3},updateTransforms:{rule:"repeated",type:"DocumentTransform.FieldTransform",id:7},currentDocument:{type:"Precondition",id:4}}},DocumentTransform:{fields:{document:{type:"string",id:1},fieldTransforms:{rule:"repeated",type:"FieldTransform",id:2}},nested:{FieldTransform:{oneofs:{transformType:{oneof:["setToServerValue","increment","maximum","minimum","appendMissingElements","removeAllFromArray"]}},fields:{fieldPath:{type:"string",id:1},setToServerValue:{type:"ServerValue",id:2},increment:{type:"Value",id:3},maximum:{type:"Value",id:4},minimum:{type:"Value",id:5},appendMissingElements:{type:"ArrayValue",id:6},removeAllFromArray:{type:"ArrayValue",id:7}},nested:{ServerValue:{values:{SERVER_VALUE_UNSPECIFIED:0,REQUEST_TIME:1}}}}}},WriteResult:{fields:{updateTime:{type:"google.protobuf.Timestamp",id:1},transformResults:{rule:"repeated",type:"Value",id:2}}},DocumentChange:{fields:{document:{type:"Document",id:1},targetIds:{rule:"repeated",type:"int32",id:5},removedTargetIds:{rule:"repeated",type:"int32",id:6}}},DocumentDelete:{fields:{document:{type:"string",id:1},removedTargetIds:{rule:"repeated",type:"int32",id:6},readTime:{type:"google.protobuf.Timestamp",id:4}}},DocumentRemove:{fields:{document:{type:"string",id:1},removedTargetIds:{rule:"repeated",type:"int32",id:2},readTime:{type:"google.protobuf.Timestamp",id:4}}},ExistenceFilter:{fields:{targetId:{type:"int32",id:1},count:{type:"int32",id:2}}}}}}},api:{options:{go_package:"google.golang.org/genproto/googleapis/api/annotations;annotations",java_multiple_files:!0,java_outer_classname:"ResourceProto",java_package:"com.google.api",objc_class_prefix:"GAPI",cc_enable_arenas:!0},nested:{http:{type:"HttpRule",id:72295728,extend:"google.protobuf.MethodOptions"},Http:{fields:{rules:{rule:"repeated",type:"HttpRule",id:1}}},HttpRule:{oneofs:{pattern:{oneof:["get","put","post","delete","patch","custom"]}},fields:{get:{type:"string",id:2},put:{type:"string",id:3},post:{type:"string",id:4},delete:{type:"string",id:5},patch:{type:"string",id:6},custom:{type:"CustomHttpPattern",id:8},selector:{type:"string",id:1},body:{type:"string",id:7},additionalBindings:{rule:"repeated",type:"HttpRule",id:11}}},CustomHttpPattern:{fields:{kind:{type:"string",id:1},path:{type:"string",id:2}}},methodSignature:{rule:"repeated",type:"string",id:1051,extend:"google.protobuf.MethodOptions"},defaultHost:{type:"string",id:1049,extend:"google.protobuf.ServiceOptions"},oauthScopes:{type:"string",id:1050,extend:"google.protobuf.ServiceOptions"},CommonLanguageSettings:{fields:{referenceDocsUri:{type:"string",id:1,options:{deprecated:!0}},destinations:{rule:"repeated",type:"ClientLibraryDestination",id:2}}},ClientLibrarySettings:{fields:{version:{type:"string",id:1},launchStage:{type:"LaunchStage",id:2},restNumericEnums:{type:"bool",id:3},javaSettings:{type:"JavaSettings",id:21},cppSettings:{type:"CppSettings",id:22},phpSettings:{type:"PhpSettings",id:23},pythonSettings:{type:"PythonSettings",id:24},nodeSettings:{type:"NodeSettings",id:25},dotnetSettings:{type:"DotnetSettings",id:26},rubySettings:{type:"RubySettings",id:27},goSettings:{type:"GoSettings",id:28}}},Publishing:{fields:{methodSettings:{rule:"repeated",type:"MethodSettings",id:2},newIssueUri:{type:"string",id:101},documentationUri:{type:"string",id:102},apiShortName:{type:"string",id:103},githubLabel:{type:"string",id:104},codeownerGithubTeams:{rule:"repeated",type:"string",id:105},docTagPrefix:{type:"string",id:106},organization:{type:"ClientLibraryOrganization",id:107},librarySettings:{rule:"repeated",type:"ClientLibrarySettings",id:109},protoReferenceDocumentationUri:{type:"string",id:110}}},JavaSettings:{fields:{libraryPackage:{type:"string",id:1},serviceClassNames:{keyType:"string",type:"string",id:2},common:{type:"CommonLanguageSettings",id:3}}},CppSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},PhpSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},PythonSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},NodeSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},DotnetSettings:{fields:{common:{type:"CommonLanguageSettings",id:1},renamedServices:{keyType:"string",type:"string",id:2},renamedResources:{keyType:"string",type:"string",id:3},ignoredResources:{rule:"repeated",type:"string",id:4},forcedNamespaceAliases:{rule:"repeated",type:"string",id:5},handwrittenSignatures:{rule:"repeated",type:"string",id:6}}},RubySettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},GoSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},MethodSettings:{fields:{selector:{type:"string",id:1},longRunning:{type:"LongRunning",id:2}},nested:{LongRunning:{fields:{initialPollDelay:{type:"google.protobuf.Duration",id:1},pollDelayMultiplier:{type:"float",id:2},maxPollDelay:{type:"google.protobuf.Duration",id:3},totalPollTimeout:{type:"google.protobuf.Duration",id:4}}}}},ClientLibraryOrganization:{values:{CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED:0,CLOUD:1,ADS:2,PHOTOS:3,STREET_VIEW:4,SHOPPING:5,GEO:6,GENERATIVE_AI:7}},ClientLibraryDestination:{values:{CLIENT_LIBRARY_DESTINATION_UNSPECIFIED:0,GITHUB:10,PACKAGE_MANAGER:20}},fieldBehavior:{rule:"repeated",type:"google.api.FieldBehavior",id:1052,extend:"google.protobuf.FieldOptions"},FieldBehavior:{values:{FIELD_BEHAVIOR_UNSPECIFIED:0,OPTIONAL:1,REQUIRED:2,OUTPUT_ONLY:3,INPUT_ONLY:4,IMMUTABLE:5,UNORDERED_LIST:6,NON_EMPTY_DEFAULT:7}},LaunchStage:{values:{LAUNCH_STAGE_UNSPECIFIED:0,UNIMPLEMENTED:6,PRELAUNCH:7,EARLY_ACCESS:1,ALPHA:2,BETA:3,GA:4,DEPRECATED:5}},resourceReference:{type:"google.api.ResourceReference",id:1055,extend:"google.protobuf.FieldOptions"},resourceDefinition:{rule:"repeated",type:"google.api.ResourceDescriptor",id:1053,extend:"google.protobuf.FileOptions"},resource:{type:"google.api.ResourceDescriptor",id:1053,extend:"google.protobuf.MessageOptions"},ResourceDescriptor:{fields:{type:{type:"string",id:1},pattern:{rule:"repeated",type:"string",id:2},nameField:{type:"string",id:3},history:{type:"History",id:4},plural:{type:"string",id:5},singular:{type:"string",id:6},style:{rule:"repeated",type:"Style",id:10}},nested:{History:{values:{HISTORY_UNSPECIFIED:0,ORIGINALLY_SINGLE_PATTERN:1,FUTURE_MULTI_PATTERN:2}},Style:{values:{STYLE_UNSPECIFIED:0,DECLARATIVE_FRIENDLY:1}}}},ResourceReference:{fields:{type:{type:"string",id:1},childType:{type:"string",id:2}}}}},type:{options:{cc_enable_arenas:!0,go_package:"google.golang.org/genproto/googleapis/type/latlng;latlng",java_multiple_files:!0,java_outer_classname:"LatLngProto",java_package:"com.google.type",objc_class_prefix:"GTP"},nested:{LatLng:{fields:{latitude:{type:"double",id:1},longitude:{type:"double",id:2}}}}},rpc:{options:{cc_enable_arenas:!0,go_package:"google.golang.org/genproto/googleapis/rpc/status;status",java_multiple_files:!0,java_outer_classname:"StatusProto",java_package:"com.google.rpc",objc_class_prefix:"RPC"},nested:{Status:{fields:{code:{type:"int32",id:1},message:{type:"string",id:2},details:{rule:"repeated",type:"google.protobuf.Any",id:3}}}}}}}}}}});var require_firestore_client_config2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/v1beta1/firestore_client_config.json"(exports2,module2){module2.exports={interfaces:{"google.firestore.v1beta1.Firestore":{retry_codes:{non_idempotent:[],idempotent:["DEADLINE_EXCEEDED","UNAVAILABLE"]},retry_params:{default:{initial_retry_delay_millis:100,retry_delay_multiplier:1.3,max_retry_delay_millis:6e4,initial_rpc_timeout_millis:6e4,rpc_timeout_multiplier:1,max_rpc_timeout_millis:6e4,total_timeout_millis:6e5}},methods:{GetDocument:{timeout_millis:6e4,retry_codes_name:"idempotent",retry_params_name:"default"},ListDocuments:{timeout_millis:6e4,retry_codes_name:"idempotent",retry_params_name:"default"},UpdateDocument:{timeout_millis:6e4,retry_codes_name:"non_idempotent",retry_params_name:"default"},DeleteDocument:{timeout_millis:6e4,retry_codes_name:"idempotent",retry_params_name:"default"},BatchGetDocuments:{timeout_millis:3e5,retry_codes_name:"idempotent",retry_params_name:"default"},BeginTransaction:{timeout_millis:6e4,retry_codes_name:"idempotent",retry_params_name:"default"},Commit:{timeout_millis:6e4,retry_codes_name:"non_idempotent",retry_params_name:"default"},Rollback:{timeout_millis:6e4,retry_codes_name:"idempotent",retry_params_name:"default"},RunQuery:{timeout_millis:3e5,retry_codes_name:"idempotent",retry_params_name:"default"},PartitionQuery:{retry_codes_name:"non_idempotent",retry_params_name:"default"},Write:{timeout_millis:864e5,retry_codes_name:"non_idempotent",retry_params_name:"default"},Listen:{timeout_millis:864e5,retry_codes_name:"idempotent",retry_params_name:"default"},ListCollectionIds:{timeout_millis:6e4,retry_codes_name:"idempotent",retry_params_name:"default"},BatchWrite:{retry_codes_name:"non_idempotent",retry_params_name:"default"},CreateDocument:{timeout_millis:6e4,retry_codes_name:"non_idempotent",retry_params_name:"default"}}}}}}});var require_firestore_client=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/v1beta1/firestore_client.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.FirestoreClient=void 0;var stream_1=require("stream"),jsonProtos=require_v1beta1(),gapicConfig=require_firestore_client_config2(),version2=require_package5().version,FirestoreClient=class{constructor(opts,gaxInstance){var _a,_b;this._terminated=!1,this.descriptors={page:{},stream:{},longrunning:{},batching:{}};let staticMembers=this.constructor,servicePath=opts?.servicePath||opts?.apiEndpoint||staticMembers.servicePath;this._providedCustomServicePath=!!(opts?.servicePath||opts?.apiEndpoint);let port=opts?.port||staticMembers.port,clientConfig=(_a=opts?.clientConfig)!==null&&_a!==void 0?_a:{},fallback=(_b=opts?.fallback)!==null&&_b!==void 0?_b:typeof window<"u"&&typeof window?.fetch=="function";opts=Object.assign({servicePath,port,clientConfig,fallback},opts),opts.numericEnums=!0,servicePath!==staticMembers.servicePath&&!("scopes"in opts)&&(opts.scopes=staticMembers.scopes),gaxInstance||(gaxInstance=require_src11()),this._gaxModule=opts.fallback?gaxInstance.fallback:gaxInstance,this._gaxGrpc=new this._gaxModule.GrpcClient(opts),this._opts=opts,this.auth=this._gaxGrpc.auth,this.auth.useJWTAccessWithScope=!0,this.auth.defaultServicePath=staticMembers.servicePath,servicePath===staticMembers.servicePath&&(this.auth.defaultScopes=staticMembers.scopes);let clientHeader=[`gax/${this._gaxModule.version}`,`gapic/${version2}`];typeof process<"u"&&"versions"in process?clientHeader.push(`gl-node/${process.versions.node}`):clientHeader.push(`gl-web/${this._gaxModule.version}`),opts.fallback?opts.fallback==="rest"&&clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`):clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`),opts.libName&&opts.libVersion&&clientHeader.push(`${opts.libName}/${opts.libVersion}`),this._protos=this._gaxGrpc.loadProtoJSON(jsonProtos),this.descriptors.page={listDocuments:new this._gaxModule.PageDescriptor("pageToken","nextPageToken","documents"),partitionQuery:new this._gaxModule.PageDescriptor("pageToken","nextPageToken","partitions"),listCollectionIds:new this._gaxModule.PageDescriptor("pageToken","nextPageToken","collectionIds")},this.descriptors.stream={batchGetDocuments:new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING,opts.fallback==="rest"),runQuery:new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING,opts.fallback==="rest"),write:new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING,opts.fallback==="rest"),listen:new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING,opts.fallback==="rest")},this._defaults=this._gaxGrpc.constructSettings("google.firestore.v1beta1.Firestore",gapicConfig,opts.clientConfig||{},{"x-goog-api-client":clientHeader.join(" ")}),this.innerApiCalls={},this.warn=this._gaxModule.warn}initialize(){if(this.firestoreStub)return this.firestoreStub;this.firestoreStub=this._gaxGrpc.createStub(this._opts.fallback?this._protos.lookupService("google.firestore.v1beta1.Firestore"):this._protos.google.firestore.v1beta1.Firestore,this._opts,this._providedCustomServicePath);let firestoreStubMethods=["getDocument","listDocuments","updateDocument","deleteDocument","batchGetDocuments","beginTransaction","commit","rollback","runQuery","partitionQuery","write","listen","listCollectionIds","batchWrite","createDocument"];for(let methodName of firestoreStubMethods){let callPromise=this.firestoreStub.then(stub=>(...args)=>{if(this._terminated){if(methodName in this.descriptors.stream){let stream=new stream_1.PassThrough;return setImmediate(()=>{stream.emit("error",new this._gaxModule.GoogleError("The client has already been closed."))}),stream}return Promise.reject("The client has already been closed.")}return stub[methodName].apply(stub,args)},err=>()=>{throw err}),descriptor=this.descriptors.page[methodName]||this.descriptors.stream[methodName]||void 0,apiCall=this._gaxModule.createApiCall(callPromise,this._defaults[methodName],descriptor,this._opts.fallback);this.innerApiCalls[methodName]=apiCall}return this.firestoreStub}static get servicePath(){return"firestore.googleapis.com"}static get apiEndpoint(){return"firestore.googleapis.com"}static get port(){return 443}static get scopes(){return["https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/datastore"]}getProjectId(callback){if(callback){this.auth.getProjectId(callback);return}return this.auth.getProjectId()}getDocument(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({name:(_a=request.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.getDocument(request,options,callback)}updateDocument(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({"document.name":(_a=request.document.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.updateDocument(request,options,callback)}deleteDocument(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({name:(_a=request.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.deleteDocument(request,options,callback)}beginTransaction(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({database:(_a=request.database)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.beginTransaction(request,options,callback)}commit(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({database:(_a=request.database)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.commit(request,options,callback)}rollback(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({database:(_a=request.database)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.rollback(request,options,callback)}batchWrite(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({database:(_a=request.database)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.batchWrite(request,options,callback)}createDocument(request,optionsOrCallback,callback){var _a,_b;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:"",collection_id:(_b=request.collectionId)!==null&&_b!==void 0?_b:""}),this.initialize(),this.innerApiCalls.createDocument(request,options,callback)}batchGetDocuments(request,options){var _a;return request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({database:(_a=request.database)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.batchGetDocuments(request,options)}runQuery(request,options){var _a;return request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.runQuery(request,options)}write(options){return this.initialize(),this.innerApiCalls.write(null,options)}listen(options){return this.initialize(),this.innerApiCalls.listen(null,options)}listDocuments(request,optionsOrCallback,callback){var _a,_b;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:"",collection_id:(_b=request.collectionId)!==null&&_b!==void 0?_b:""}),this.initialize(),this.innerApiCalls.listDocuments(request,options,callback)}listDocumentsStream(request,options){var _a,_b;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:"",collection_id:(_b=request.collectionId)!==null&&_b!==void 0?_b:""});let callSettings=this._defaults.listDocuments.merge(options);return this.initialize(),this.descriptors.page.listDocuments.createStream(this.innerApiCalls.listDocuments,request,callSettings)}listDocumentsAsync(request,options){var _a,_b;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:"",collection_id:(_b=request.collectionId)!==null&&_b!==void 0?_b:""});let callSettings=this._defaults.listDocuments.merge(options);return this.initialize(),this.descriptors.page.listDocuments.asyncIterate(this.innerApiCalls.listDocuments,request,callSettings)}partitionQuery(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.partitionQuery(request,options,callback)}partitionQueryStream(request,options){var _a;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""});let callSettings=this._defaults.partitionQuery.merge(options);return this.initialize(),this.descriptors.page.partitionQuery.createStream(this.innerApiCalls.partitionQuery,request,callSettings)}partitionQueryAsync(request,options){var _a;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""});let callSettings=this._defaults.partitionQuery.merge(options);return this.initialize(),this.descriptors.page.partitionQuery.asyncIterate(this.innerApiCalls.partitionQuery,request,callSettings)}listCollectionIds(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.listCollectionIds(request,options,callback)}listCollectionIdsStream(request,options){var _a;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""});let callSettings=this._defaults.listCollectionIds.merge(options);return this.initialize(),this.descriptors.page.listCollectionIds.createStream(this.innerApiCalls.listCollectionIds,request,callSettings)}listCollectionIdsAsync(request,options){var _a;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""});let callSettings=this._defaults.listCollectionIds.merge(options);return this.initialize(),this.descriptors.page.listCollectionIds.asyncIterate(this.innerApiCalls.listCollectionIds,request,callSettings)}close(){return this.firestoreStub&&!this._terminated?this.firestoreStub.then(stub=>{this._terminated=!0,stub.close()}):Promise.resolve()}};__name(FirestoreClient,"FirestoreClient");exports2.FirestoreClient=FirestoreClient}});var require_v1beta12=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/v1beta1/index.js"(exports2,module2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.FirestoreClient=void 0;var firestore_client_1=require_firestore_client();Object.defineProperty(exports2,"FirestoreClient",{enumerable:!0,get:function(){return firestore_client_1.FirestoreClient}});var existingExports=module2.exports;module2.exports=firestore_client_1.FirestoreClient;module2.exports=Object.assign(module2.exports,existingExports)}});var require_admin_v1=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/protos/admin_v1.json"(exports2,module2){module2.exports={nested:{google:{nested:{firestore:{nested:{admin:{nested:{v1:{options:{csharp_namespace:"Google.Cloud.Firestore.Admin.V1",go_package:"cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb",java_multiple_files:!0,java_outer_classname:"OperationProto",java_package:"com.google.firestore.admin.v1",objc_class_prefix:"GCFS",php_namespace:"Google\\Cloud\\Firestore\\Admin\\V1",ruby_package:"Google::Cloud::Firestore::Admin::V1","(google.api.resource_definition).type":"firestore.googleapis.com/CollectionGroup","(google.api.resource_definition).pattern":"projects/{project}/databases/{database}/collectionGroups/{collection}"},nested:{Database:{options:{"(google.api.resource).type":"firestore.googleapis.com/Database","(google.api.resource).pattern":"projects/{project}/databases/{database}","(google.api.resource).style":"DECLARATIVE_FRIENDLY"},fields:{name:{type:"string",id:1},locationId:{type:"string",id:9},type:{type:"DatabaseType",id:10},concurrencyMode:{type:"ConcurrencyMode",id:15},appEngineIntegrationMode:{type:"AppEngineIntegrationMode",id:19},keyPrefix:{type:"string",id:20,options:{"(google.api.field_behavior)":"OUTPUT_ONLY"}},etag:{type:"string",id:99}},nested:{DatabaseType:{values:{DATABASE_TYPE_UNSPECIFIED:0,FIRESTORE_NATIVE:1,DATASTORE_MODE:2}},ConcurrencyMode:{values:{CONCURRENCY_MODE_UNSPECIFIED:0,OPTIMISTIC:1,PESSIMISTIC:2,OPTIMISTIC_WITH_ENTITY_GROUPS:3}},AppEngineIntegrationMode:{values:{APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED:0,ENABLED:1,DISABLED:2}}}},Field:{options:{"(google.api.resource).type":"firestore.googleapis.com/Field","(google.api.resource).pattern":"projects/{project}/databases/{database}/collectionGroups/{collection}/fields/{field}"},fields:{name:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},indexConfig:{type:"IndexConfig",id:2},ttlConfig:{type:"TtlConfig",id:3}},nested:{IndexConfig:{fields:{indexes:{rule:"repeated",type:"Index",id:1},usesAncestorConfig:{type:"bool",id:2},ancestorField:{type:"string",id:3},reverting:{type:"bool",id:4}}},TtlConfig:{fields:{state:{type:"State",id:1,options:{"(google.api.field_behavior)":"OUTPUT_ONLY"}}},nested:{State:{values:{STATE_UNSPECIFIED:0,CREATING:1,ACTIVE:2,NEEDS_REPAIR:3}}}}}},FirestoreAdmin:{options:{"(google.api.default_host)":"firestore.googleapis.com","(google.api.oauth_scopes)":"https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/datastore"},methods:{CreateIndex:{requestType:"CreateIndexRequest",responseType:"google.longrunning.Operation",options:{"(google.api.http).post":"/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes","(google.api.http).body":"index","(google.api.method_signature)":"parent,index","(google.longrunning.operation_info).response_type":"Index","(google.longrunning.operation_info).metadata_type":"IndexOperationMetadata"},parsedOptions:[{"(google.api.http)":{post:"/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes",body:"index"}},{"(google.api.method_signature)":"parent,index"},{"(google.longrunning.operation_info)":{response_type:"Index",metadata_type:"IndexOperationMetadata"}}]},ListIndexes:{requestType:"ListIndexesRequest",responseType:"ListIndexesResponse",options:{"(google.api.http).get":"/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes","(google.api.method_signature)":"parent"},parsedOptions:[{"(google.api.http)":{get:"/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes"}},{"(google.api.method_signature)":"parent"}]},GetIndex:{requestType:"GetIndexRequest",responseType:"Index",options:{"(google.api.http).get":"/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}","(google.api.method_signature)":"name"},parsedOptions:[{"(google.api.http)":{get:"/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}"}},{"(google.api.method_signature)":"name"}]},DeleteIndex:{requestType:"DeleteIndexRequest",responseType:"google.protobuf.Empty",options:{"(google.api.http).delete":"/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}","(google.api.method_signature)":"name"},parsedOptions:[{"(google.api.http)":{delete:"/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}"}},{"(google.api.method_signature)":"name"}]},GetField:{requestType:"GetFieldRequest",responseType:"Field",options:{"(google.api.http).get":"/v1/{name=projects/*/databases/*/collectionGroups/*/fields/*}","(google.api.method_signature)":"name"},parsedOptions:[{"(google.api.http)":{get:"/v1/{name=projects/*/databases/*/collectionGroups/*/fields/*}"}},{"(google.api.method_signature)":"name"}]},UpdateField:{requestType:"UpdateFieldRequest",responseType:"google.longrunning.Operation",options:{"(google.api.http).patch":"/v1/{field.name=projects/*/databases/*/collectionGroups/*/fields/*}","(google.api.http).body":"field","(google.api.method_signature)":"field","(google.longrunning.operation_info).response_type":"Field","(google.longrunning.operation_info).metadata_type":"FieldOperationMetadata"},parsedOptions:[{"(google.api.http)":{patch:"/v1/{field.name=projects/*/databases/*/collectionGroups/*/fields/*}",body:"field"}},{"(google.api.method_signature)":"field"},{"(google.longrunning.operation_info)":{response_type:"Field",metadata_type:"FieldOperationMetadata"}}]},ListFields:{requestType:"ListFieldsRequest",responseType:"ListFieldsResponse",options:{"(google.api.http).get":"/v1/{parent=projects/*/databases/*/collectionGroups/*}/fields","(google.api.method_signature)":"parent"},parsedOptions:[{"(google.api.http)":{get:"/v1/{parent=projects/*/databases/*/collectionGroups/*}/fields"}},{"(google.api.method_signature)":"parent"}]},ExportDocuments:{requestType:"ExportDocumentsRequest",responseType:"google.longrunning.Operation",options:{"(google.api.http).post":"/v1/{name=projects/*/databases/*}:exportDocuments","(google.api.http).body":"*","(google.api.method_signature)":"name","(google.longrunning.operation_info).response_type":"ExportDocumentsResponse","(google.longrunning.operation_info).metadata_type":"ExportDocumentsMetadata"},parsedOptions:[{"(google.api.http)":{post:"/v1/{name=projects/*/databases/*}:exportDocuments",body:"*"}},{"(google.api.method_signature)":"name"},{"(google.longrunning.operation_info)":{response_type:"ExportDocumentsResponse",metadata_type:"ExportDocumentsMetadata"}}]},ImportDocuments:{requestType:"ImportDocumentsRequest",responseType:"google.longrunning.Operation",options:{"(google.api.http).post":"/v1/{name=projects/*/databases/*}:importDocuments","(google.api.http).body":"*","(google.api.method_signature)":"name","(google.longrunning.operation_info).response_type":"google.protobuf.Empty","(google.longrunning.operation_info).metadata_type":"ImportDocumentsMetadata"},parsedOptions:[{"(google.api.http)":{post:"/v1/{name=projects/*/databases/*}:importDocuments",body:"*"}},{"(google.api.method_signature)":"name"},{"(google.longrunning.operation_info)":{response_type:"google.protobuf.Empty",metadata_type:"ImportDocumentsMetadata"}}]},CreateDatabase:{requestType:"CreateDatabaseRequest",responseType:"google.longrunning.Operation",options:{"(google.api.http).post":"/v1/{parent=projects/*}/databases","(google.api.http).body":"database","(google.api.method_signature)":"parent,database,database_id","(google.longrunning.operation_info).response_type":"Database","(google.longrunning.operation_info).metadata_type":"CreateDatabaseMetadata"},parsedOptions:[{"(google.api.http)":{post:"/v1/{parent=projects/*}/databases",body:"database"}},{"(google.api.method_signature)":"parent,database,database_id"},{"(google.longrunning.operation_info)":{response_type:"Database",metadata_type:"CreateDatabaseMetadata"}}]},GetDatabase:{requestType:"GetDatabaseRequest",responseType:"Database",options:{"(google.api.http).get":"/v1/{name=projects/*/databases/*}","(google.api.method_signature)":"name"},parsedOptions:[{"(google.api.http)":{get:"/v1/{name=projects/*/databases/*}"}},{"(google.api.method_signature)":"name"}]},ListDatabases:{requestType:"ListDatabasesRequest",responseType:"ListDatabasesResponse",options:{"(google.api.http).get":"/v1/{parent=projects/*}/databases","(google.api.method_signature)":"parent"},parsedOptions:[{"(google.api.http)":{get:"/v1/{parent=projects/*}/databases"}},{"(google.api.method_signature)":"parent"}]},UpdateDatabase:{requestType:"UpdateDatabaseRequest",responseType:"google.longrunning.Operation",options:{"(google.api.http).patch":"/v1/{database.name=projects/*/databases/*}","(google.api.http).body":"database","(google.api.method_signature)":"database,update_mask","(google.longrunning.operation_info).response_type":"Database","(google.longrunning.operation_info).metadata_type":"UpdateDatabaseMetadata"},parsedOptions:[{"(google.api.http)":{patch:"/v1/{database.name=projects/*/databases/*}",body:"database"}},{"(google.api.method_signature)":"database,update_mask"},{"(google.longrunning.operation_info)":{response_type:"Database",metadata_type:"UpdateDatabaseMetadata"}}]}}},ListDatabasesRequest:{fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"firestore.googleapis.com/Database"}}}},CreateDatabaseRequest:{fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"firestore.googleapis.com/Database"}},database:{type:"Database",id:2,options:{"(google.api.field_behavior)":"REQUIRED"}},databaseId:{type:"string",id:3,options:{"(google.api.field_behavior)":"REQUIRED"}}}},CreateDatabaseMetadata:{fields:{}},ListDatabasesResponse:{fields:{databases:{rule:"repeated",type:"Database",id:1}}},GetDatabaseRequest:{fields:{name:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"firestore.googleapis.com/Database"}}}},UpdateDatabaseRequest:{fields:{database:{type:"Database",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},updateMask:{type:"google.protobuf.FieldMask",id:2}}},UpdateDatabaseMetadata:{fields:{}},CreateIndexRequest:{fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"firestore.googleapis.com/CollectionGroup"}},index:{type:"Index",id:2,options:{"(google.api.field_behavior)":"REQUIRED"}}}},ListIndexesRequest:{fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"firestore.googleapis.com/CollectionGroup"}},filter:{type:"string",id:2},pageSize:{type:"int32",id:3},pageToken:{type:"string",id:4}}},ListIndexesResponse:{fields:{indexes:{rule:"repeated",type:"Index",id:1},nextPageToken:{type:"string",id:2}}},GetIndexRequest:{fields:{name:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"firestore.googleapis.com/Index"}}}},DeleteIndexRequest:{fields:{name:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"firestore.googleapis.com/Index"}}}},UpdateFieldRequest:{fields:{field:{type:"Field",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},updateMask:{type:"google.protobuf.FieldMask",id:2}}},GetFieldRequest:{fields:{name:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"firestore.googleapis.com/Field"}}}},ListFieldsRequest:{fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"firestore.googleapis.com/CollectionGroup"}},filter:{type:"string",id:2},pageSize:{type:"int32",id:3},pageToken:{type:"string",id:4}}},ListFieldsResponse:{fields:{fields:{rule:"repeated",type:"Field",id:1},nextPageToken:{type:"string",id:2}}},ExportDocumentsRequest:{fields:{name:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"firestore.googleapis.com/Database"}},collectionIds:{rule:"repeated",type:"string",id:2},outputUriPrefix:{type:"string",id:3}}},ImportDocumentsRequest:{fields:{name:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"firestore.googleapis.com/Database"}},collectionIds:{rule:"repeated",type:"string",id:2},inputUriPrefix:{type:"string",id:3}}},Index:{options:{"(google.api.resource).type":"firestore.googleapis.com/Index","(google.api.resource).pattern":"projects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}"},fields:{name:{type:"string",id:1},queryScope:{type:"QueryScope",id:2},apiScope:{type:"ApiScope",id:5},fields:{rule:"repeated",type:"IndexField",id:3},state:{type:"State",id:4}},nested:{QueryScope:{values:{QUERY_SCOPE_UNSPECIFIED:0,COLLECTION:1,COLLECTION_GROUP:2,COLLECTION_RECURSIVE:3}},ApiScope:{values:{ANY_API:0,DATASTORE_MODE_API:1}},IndexField:{oneofs:{valueMode:{oneof:["order","arrayConfig"]}},fields:{fieldPath:{type:"string",id:1},order:{type:"Order",id:2},arrayConfig:{type:"ArrayConfig",id:3}},nested:{Order:{values:{ORDER_UNSPECIFIED:0,ASCENDING:1,DESCENDING:2}},ArrayConfig:{values:{ARRAY_CONFIG_UNSPECIFIED:0,CONTAINS:1}}}},State:{values:{STATE_UNSPECIFIED:0,CREATING:1,READY:2,NEEDS_REPAIR:3}}}},LocationMetadata:{fields:{}},IndexOperationMetadata:{fields:{startTime:{type:"google.protobuf.Timestamp",id:1},endTime:{type:"google.protobuf.Timestamp",id:2},index:{type:"string",id:3},state:{type:"OperationState",id:4},progressDocuments:{type:"Progress",id:5},progressBytes:{type:"Progress",id:6}}},FieldOperationMetadata:{fields:{startTime:{type:"google.protobuf.Timestamp",id:1},endTime:{type:"google.protobuf.Timestamp",id:2},field:{type:"string",id:3},indexConfigDeltas:{rule:"repeated",type:"IndexConfigDelta",id:4},state:{type:"OperationState",id:5},progressDocuments:{type:"Progress",id:6},progressBytes:{type:"Progress",id:7},ttlConfigDelta:{type:"TtlConfigDelta",id:8}},nested:{IndexConfigDelta:{fields:{changeType:{type:"ChangeType",id:1},index:{type:"Index",id:2}},nested:{ChangeType:{values:{CHANGE_TYPE_UNSPECIFIED:0,ADD:1,REMOVE:2}}}},TtlConfigDelta:{fields:{changeType:{type:"ChangeType",id:1}},nested:{ChangeType:{values:{CHANGE_TYPE_UNSPECIFIED:0,ADD:1,REMOVE:2}}}}}},ExportDocumentsMetadata:{fields:{startTime:{type:"google.protobuf.Timestamp",id:1},endTime:{type:"google.protobuf.Timestamp",id:2},operationState:{type:"OperationState",id:3},progressDocuments:{type:"Progress",id:4},progressBytes:{type:"Progress",id:5},collectionIds:{rule:"repeated",type:"string",id:6},outputUriPrefix:{type:"string",id:7}}},ImportDocumentsMetadata:{fields:{startTime:{type:"google.protobuf.Timestamp",id:1},endTime:{type:"google.protobuf.Timestamp",id:2},operationState:{type:"OperationState",id:3},progressDocuments:{type:"Progress",id:4},progressBytes:{type:"Progress",id:5},collectionIds:{rule:"repeated",type:"string",id:6},inputUriPrefix:{type:"string",id:7}}},ExportDocumentsResponse:{fields:{outputUriPrefix:{type:"string",id:1}}},OperationState:{values:{OPERATION_STATE_UNSPECIFIED:0,INITIALIZING:1,PROCESSING:2,CANCELLING:3,FINALIZING:4,SUCCESSFUL:5,FAILED:6,CANCELLED:7}},Progress:{fields:{estimatedWork:{type:"int64",id:1},completedWork:{type:"int64",id:2}}}}}}}}},api:{options:{go_package:"google.golang.org/genproto/googleapis/api/annotations;annotations",java_multiple_files:!0,java_outer_classname:"ResourceProto",java_package:"com.google.api",objc_class_prefix:"GAPI",cc_enable_arenas:!0},nested:{http:{type:"HttpRule",id:72295728,extend:"google.protobuf.MethodOptions"},Http:{fields:{rules:{rule:"repeated",type:"HttpRule",id:1}}},HttpRule:{oneofs:{pattern:{oneof:["get","put","post","delete","patch","custom"]}},fields:{get:{type:"string",id:2},put:{type:"string",id:3},post:{type:"string",id:4},delete:{type:"string",id:5},patch:{type:"string",id:6},custom:{type:"CustomHttpPattern",id:8},selector:{type:"string",id:1},body:{type:"string",id:7},additionalBindings:{rule:"repeated",type:"HttpRule",id:11}}},CustomHttpPattern:{fields:{kind:{type:"string",id:1},path:{type:"string",id:2}}},methodSignature:{rule:"repeated",type:"string",id:1051,extend:"google.protobuf.MethodOptions"},defaultHost:{type:"string",id:1049,extend:"google.protobuf.ServiceOptions"},oauthScopes:{type:"string",id:1050,extend:"google.protobuf.ServiceOptions"},CommonLanguageSettings:{fields:{referenceDocsUri:{type:"string",id:1,options:{deprecated:!0}},destinations:{rule:"repeated",type:"ClientLibraryDestination",id:2}}},ClientLibrarySettings:{fields:{version:{type:"string",id:1},launchStage:{type:"LaunchStage",id:2},restNumericEnums:{type:"bool",id:3},javaSettings:{type:"JavaSettings",id:21},cppSettings:{type:"CppSettings",id:22},phpSettings:{type:"PhpSettings",id:23},pythonSettings:{type:"PythonSettings",id:24},nodeSettings:{type:"NodeSettings",id:25},dotnetSettings:{type:"DotnetSettings",id:26},rubySettings:{type:"RubySettings",id:27},goSettings:{type:"GoSettings",id:28}}},Publishing:{fields:{methodSettings:{rule:"repeated",type:"MethodSettings",id:2},newIssueUri:{type:"string",id:101},documentationUri:{type:"string",id:102},apiShortName:{type:"string",id:103},githubLabel:{type:"string",id:104},codeownerGithubTeams:{rule:"repeated",type:"string",id:105},docTagPrefix:{type:"string",id:106},organization:{type:"ClientLibraryOrganization",id:107},librarySettings:{rule:"repeated",type:"ClientLibrarySettings",id:109},protoReferenceDocumentationUri:{type:"string",id:110}}},JavaSettings:{fields:{libraryPackage:{type:"string",id:1},serviceClassNames:{keyType:"string",type:"string",id:2},common:{type:"CommonLanguageSettings",id:3}}},CppSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},PhpSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},PythonSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},NodeSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},DotnetSettings:{fields:{common:{type:"CommonLanguageSettings",id:1},renamedServices:{keyType:"string",type:"string",id:2},renamedResources:{keyType:"string",type:"string",id:3},ignoredResources:{rule:"repeated",type:"string",id:4},forcedNamespaceAliases:{rule:"repeated",type:"string",id:5},handwrittenSignatures:{rule:"repeated",type:"string",id:6}}},RubySettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},GoSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},MethodSettings:{fields:{selector:{type:"string",id:1},longRunning:{type:"LongRunning",id:2}},nested:{LongRunning:{fields:{initialPollDelay:{type:"google.protobuf.Duration",id:1},pollDelayMultiplier:{type:"float",id:2},maxPollDelay:{type:"google.protobuf.Duration",id:3},totalPollTimeout:{type:"google.protobuf.Duration",id:4}}}}},ClientLibraryOrganization:{values:{CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED:0,CLOUD:1,ADS:2,PHOTOS:3,STREET_VIEW:4,SHOPPING:5,GEO:6,GENERATIVE_AI:7}},ClientLibraryDestination:{values:{CLIENT_LIBRARY_DESTINATION_UNSPECIFIED:0,GITHUB:10,PACKAGE_MANAGER:20}},fieldBehavior:{rule:"repeated",type:"google.api.FieldBehavior",id:1052,extend:"google.protobuf.FieldOptions"},FieldBehavior:{values:{FIELD_BEHAVIOR_UNSPECIFIED:0,OPTIONAL:1,REQUIRED:2,OUTPUT_ONLY:3,INPUT_ONLY:4,IMMUTABLE:5,UNORDERED_LIST:6,NON_EMPTY_DEFAULT:7}},LaunchStage:{values:{LAUNCH_STAGE_UNSPECIFIED:0,UNIMPLEMENTED:6,PRELAUNCH:7,EARLY_ACCESS:1,ALPHA:2,BETA:3,GA:4,DEPRECATED:5}},resourceReference:{type:"google.api.ResourceReference",id:1055,extend:"google.protobuf.FieldOptions"},resourceDefinition:{rule:"repeated",type:"google.api.ResourceDescriptor",id:1053,extend:"google.protobuf.FileOptions"},resource:{type:"google.api.ResourceDescriptor",id:1053,extend:"google.protobuf.MessageOptions"},ResourceDescriptor:{fields:{type:{type:"string",id:1},pattern:{rule:"repeated",type:"string",id:2},nameField:{type:"string",id:3},history:{type:"History",id:4},plural:{type:"string",id:5},singular:{type:"string",id:6},style:{rule:"repeated",type:"Style",id:10}},nested:{History:{values:{HISTORY_UNSPECIFIED:0,ORIGINALLY_SINGLE_PATTERN:1,FUTURE_MULTI_PATTERN:2}},Style:{values:{STYLE_UNSPECIFIED:0,DECLARATIVE_FRIENDLY:1}}}},ResourceReference:{fields:{type:{type:"string",id:1},childType:{type:"string",id:2}}}}},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:{fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}}},FileDescriptorProto:{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,options:{packed:!1}},weakDependency:{rule:"repeated",type:"int32",id:11,options:{packed:!1}},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}}},DescriptorProto:{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}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},FieldDescriptorProto:{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}},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_REQUIRED:2,LABEL_REPEATED:3}}}},OneofDescriptorProto:{fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3}}},EnumValueDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{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:{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},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[38,38]],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[8,8]]},FieldOptions:{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},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}}}},OneofOptions:{fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumValueOptions:{fields:{deprecated:{type:"bool",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{fields:{deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{fields:{deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},UninterpretedOption:{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}}}}},SourceCodeInfo:{fields:{location:{rule:"repeated",type:"Location",id:1}},nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1},span:{rule:"repeated",type:"int32",id:2},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4}}}}},Empty:{fields:{}},FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}},Timestamp:{fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},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}}},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}}},Duration:{fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}},type:{options:{cc_enable_arenas:!0,go_package:"google.golang.org/genproto/googleapis/type/latlng;latlng",java_multiple_files:!0,java_outer_classname:"LatLngProto",java_package:"com.google.type",objc_class_prefix:"GTP"},nested:{LatLng:{fields:{latitude:{type:"double",id:1},longitude:{type:"double",id:2}}}}},rpc:{options:{cc_enable_arenas:!0,go_package:"google.golang.org/genproto/googleapis/rpc/status;status",java_multiple_files:!0,java_outer_classname:"StatusProto",java_package:"com.google.rpc",objc_class_prefix:"RPC"},nested:{Status:{fields:{code:{type:"int32",id:1},message:{type:"string",id:2},details:{rule:"repeated",type:"google.protobuf.Any",id:3}}}}},longrunning:{options:{cc_enable_arenas:!0,csharp_namespace:"Google.LongRunning",go_package:"cloud.google.com/go/longrunning/autogen/longrunningpb;longrunningpb",java_multiple_files:!0,java_outer_classname:"OperationsProto",java_package:"com.google.longrunning",php_namespace:"Google\\LongRunning"},nested:{operationInfo:{type:"google.longrunning.OperationInfo",id:1049,extend:"google.protobuf.MethodOptions"},Operations:{options:{"(google.api.default_host)":"longrunning.googleapis.com"},methods:{ListOperations:{requestType:"ListOperationsRequest",responseType:"ListOperationsResponse",options:{"(google.api.http).get":"/v1/{name=operations}","(google.api.method_signature)":"name,filter"},parsedOptions:[{"(google.api.http)":{get:"/v1/{name=operations}"}},{"(google.api.method_signature)":"name,filter"}]},GetOperation:{requestType:"GetOperationRequest",responseType:"Operation",options:{"(google.api.http).get":"/v1/{name=operations/**}","(google.api.method_signature)":"name"},parsedOptions:[{"(google.api.http)":{get:"/v1/{name=operations/**}"}},{"(google.api.method_signature)":"name"}]},DeleteOperation:{requestType:"DeleteOperationRequest",responseType:"google.protobuf.Empty",options:{"(google.api.http).delete":"/v1/{name=operations/**}","(google.api.method_signature)":"name"},parsedOptions:[{"(google.api.http)":{delete:"/v1/{name=operations/**}"}},{"(google.api.method_signature)":"name"}]},CancelOperation:{requestType:"CancelOperationRequest",responseType:"google.protobuf.Empty",options:{"(google.api.http).post":"/v1/{name=operations/**}:cancel","(google.api.http).body":"*","(google.api.method_signature)":"name"},parsedOptions:[{"(google.api.http)":{post:"/v1/{name=operations/**}:cancel",body:"*"}},{"(google.api.method_signature)":"name"}]},WaitOperation:{requestType:"WaitOperationRequest",responseType:"Operation"}}},Operation:{oneofs:{result:{oneof:["error","response"]}},fields:{name:{type:"string",id:1},metadata:{type:"google.protobuf.Any",id:2},done:{type:"bool",id:3},error:{type:"google.rpc.Status",id:4},response:{type:"google.protobuf.Any",id:5}}},GetOperationRequest:{fields:{name:{type:"string",id:1}}},ListOperationsRequest:{fields:{name:{type:"string",id:4},filter:{type:"string",id:1},pageSize:{type:"int32",id:2},pageToken:{type:"string",id:3}}},ListOperationsResponse:{fields:{operations:{rule:"repeated",type:"Operation",id:1},nextPageToken:{type:"string",id:2}}},CancelOperationRequest:{fields:{name:{type:"string",id:1}}},DeleteOperationRequest:{fields:{name:{type:"string",id:1}}},WaitOperationRequest:{fields:{name:{type:"string",id:1},timeout:{type:"google.protobuf.Duration",id:2}}},OperationInfo:{fields:{responseType:{type:"string",id:1},metadataType:{type:"string",id:2}}}}}}}}}}});var require_firestore_admin_client_config=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/v1/firestore_admin_client_config.json"(exports2,module2){module2.exports={interfaces:{"google.firestore.admin.v1.FirestoreAdmin":{retry_codes:{non_idempotent:[],idempotent:["DEADLINE_EXCEEDED","UNAVAILABLE"],deadline_exceeded_internal_unavailable:["DEADLINE_EXCEEDED","INTERNAL","UNAVAILABLE"]},retry_params:{default:{initial_retry_delay_millis:100,retry_delay_multiplier:1.3,max_retry_delay_millis:6e4,initial_rpc_timeout_millis:6e4,rpc_timeout_multiplier:1,max_rpc_timeout_millis:6e4,total_timeout_millis:6e5}},methods:{CreateIndex:{timeout_millis:6e4,retry_codes_name:"non_idempotent",retry_params_name:"default"},ListIndexes:{timeout_millis:6e4,retry_codes_name:"deadline_exceeded_internal_unavailable",retry_params_name:"default"},GetIndex:{timeout_millis:6e4,retry_codes_name:"deadline_exceeded_internal_unavailable",retry_params_name:"default"},DeleteIndex:{timeout_millis:6e4,retry_codes_name:"deadline_exceeded_internal_unavailable",retry_params_name:"default"},GetField:{timeout_millis:6e4,retry_codes_name:"deadline_exceeded_internal_unavailable",retry_params_name:"default"},UpdateField:{timeout_millis:6e4,retry_codes_name:"non_idempotent",retry_params_name:"default"},ListFields:{timeout_millis:6e4,retry_codes_name:"deadline_exceeded_internal_unavailable",retry_params_name:"default"},ExportDocuments:{timeout_millis:6e4,retry_codes_name:"non_idempotent",retry_params_name:"default"},ImportDocuments:{timeout_millis:6e4,retry_codes_name:"non_idempotent",retry_params_name:"default"},CreateDatabase:{retry_codes_name:"non_idempotent",retry_params_name:"default"},GetDatabase:{retry_codes_name:"non_idempotent",retry_params_name:"default"},ListDatabases:{retry_codes_name:"non_idempotent",retry_params_name:"default"},UpdateDatabase:{retry_codes_name:"non_idempotent",retry_params_name:"default"}}}}}}});var require_firestore_admin_client=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/v1/firestore_admin_client.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.FirestoreAdminClient=void 0;var jsonProtos=require_admin_v1(),gapicConfig=require_firestore_admin_client_config(),version2=require_package5().version,FirestoreAdminClient=class{constructor(opts,gaxInstance){var _a,_b;this._terminated=!1,this.descriptors={page:{},stream:{},longrunning:{},batching:{}};let staticMembers=this.constructor,servicePath=opts?.servicePath||opts?.apiEndpoint||staticMembers.servicePath;this._providedCustomServicePath=!!(opts?.servicePath||opts?.apiEndpoint);let port=opts?.port||staticMembers.port,clientConfig=(_a=opts?.clientConfig)!==null&&_a!==void 0?_a:{},fallback=(_b=opts?.fallback)!==null&&_b!==void 0?_b:typeof window<"u"&&typeof window?.fetch=="function";opts=Object.assign({servicePath,port,clientConfig,fallback},opts),opts.numericEnums=!0,servicePath!==staticMembers.servicePath&&!("scopes"in opts)&&(opts.scopes=staticMembers.scopes),gaxInstance||(gaxInstance=require_src11()),this._gaxModule=opts.fallback?gaxInstance.fallback:gaxInstance,this._gaxGrpc=new this._gaxModule.GrpcClient(opts),this._opts=opts,this.auth=this._gaxGrpc.auth,this.auth.useJWTAccessWithScope=!0,this.auth.defaultServicePath=staticMembers.servicePath,servicePath===staticMembers.servicePath&&(this.auth.defaultScopes=staticMembers.scopes),this.locationsClient=new this._gaxModule.LocationsClient(this._gaxGrpc,opts);let clientHeader=[`gax/${this._gaxModule.version}`,`gapic/${version2}`];typeof process<"u"&&"versions"in process?clientHeader.push(`gl-node/${process.versions.node}`):clientHeader.push(`gl-web/${this._gaxModule.version}`),opts.fallback?opts.fallback==="rest"&&clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`):clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`),opts.libName&&opts.libVersion&&clientHeader.push(`${opts.libName}/${opts.libVersion}`),this._protos=this._gaxGrpc.loadProtoJSON(jsonProtos),this.pathTemplates={collectionGroupPathTemplate:new this._gaxModule.PathTemplate("projects/{project}/databases/{database}/collectionGroups/{collection}"),databasePathTemplate:new this._gaxModule.PathTemplate("projects/{project}/databases/{database}"),fieldPathTemplate:new this._gaxModule.PathTemplate("projects/{project}/databases/{database}/collectionGroups/{collection}/fields/{field}"),indexPathTemplate:new this._gaxModule.PathTemplate("projects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}"),projectPathTemplate:new this._gaxModule.PathTemplate("projects/{project}")},this.descriptors.page={listIndexes:new this._gaxModule.PageDescriptor("pageToken","nextPageToken","indexes"),listFields:new this._gaxModule.PageDescriptor("pageToken","nextPageToken","fields")};let protoFilesRoot=this._gaxModule.protobuf.Root.fromJSON(jsonProtos),lroOptions={auth:this.auth,grpc:"grpc"in this._gaxGrpc?this._gaxGrpc.grpc:void 0};opts.fallback==="rest"&&(lroOptions.protoJson=protoFilesRoot,lroOptions.httpRules=[{selector:"google.longrunning.Operations.CancelOperation",post:"/v1/{name=projects/*/databases/*/operations/*}:cancel",body:"*"},{selector:"google.longrunning.Operations.DeleteOperation",delete:"/v1/{name=projects/*/databases/*/operations/*}"},{selector:"google.longrunning.Operations.GetOperation",get:"/v1/{name=projects/*/databases/*/operations/*}"},{selector:"google.longrunning.Operations.ListOperations",get:"/v1/{name=projects/*/databases/*}/operations"}]),this.operationsClient=this._gaxModule.lro(lroOptions).operationsClient(opts);let createIndexResponse=protoFilesRoot.lookup(".google.firestore.admin.v1.Index"),createIndexMetadata=protoFilesRoot.lookup(".google.firestore.admin.v1.IndexOperationMetadata"),updateFieldResponse=protoFilesRoot.lookup(".google.firestore.admin.v1.Field"),updateFieldMetadata=protoFilesRoot.lookup(".google.firestore.admin.v1.FieldOperationMetadata"),exportDocumentsResponse=protoFilesRoot.lookup(".google.firestore.admin.v1.ExportDocumentsResponse"),exportDocumentsMetadata=protoFilesRoot.lookup(".google.firestore.admin.v1.ExportDocumentsMetadata"),importDocumentsResponse=protoFilesRoot.lookup(".google.protobuf.Empty"),importDocumentsMetadata=protoFilesRoot.lookup(".google.firestore.admin.v1.ImportDocumentsMetadata"),createDatabaseResponse=protoFilesRoot.lookup(".google.firestore.admin.v1.Database"),createDatabaseMetadata=protoFilesRoot.lookup(".google.firestore.admin.v1.CreateDatabaseMetadata"),updateDatabaseResponse=protoFilesRoot.lookup(".google.firestore.admin.v1.Database"),updateDatabaseMetadata=protoFilesRoot.lookup(".google.firestore.admin.v1.UpdateDatabaseMetadata");this.descriptors.longrunning={createIndex:new this._gaxModule.LongrunningDescriptor(this.operationsClient,createIndexResponse.decode.bind(createIndexResponse),createIndexMetadata.decode.bind(createIndexMetadata)),updateField:new this._gaxModule.LongrunningDescriptor(this.operationsClient,updateFieldResponse.decode.bind(updateFieldResponse),updateFieldMetadata.decode.bind(updateFieldMetadata)),exportDocuments:new this._gaxModule.LongrunningDescriptor(this.operationsClient,exportDocumentsResponse.decode.bind(exportDocumentsResponse),exportDocumentsMetadata.decode.bind(exportDocumentsMetadata)),importDocuments:new this._gaxModule.LongrunningDescriptor(this.operationsClient,importDocumentsResponse.decode.bind(importDocumentsResponse),importDocumentsMetadata.decode.bind(importDocumentsMetadata)),createDatabase:new this._gaxModule.LongrunningDescriptor(this.operationsClient,createDatabaseResponse.decode.bind(createDatabaseResponse),createDatabaseMetadata.decode.bind(createDatabaseMetadata)),updateDatabase:new this._gaxModule.LongrunningDescriptor(this.operationsClient,updateDatabaseResponse.decode.bind(updateDatabaseResponse),updateDatabaseMetadata.decode.bind(updateDatabaseMetadata))},this._defaults=this._gaxGrpc.constructSettings("google.firestore.admin.v1.FirestoreAdmin",gapicConfig,opts.clientConfig||{},{"x-goog-api-client":clientHeader.join(" ")}),this.innerApiCalls={},this.warn=this._gaxModule.warn}initialize(){if(this.firestoreAdminStub)return this.firestoreAdminStub;this.firestoreAdminStub=this._gaxGrpc.createStub(this._opts.fallback?this._protos.lookupService("google.firestore.admin.v1.FirestoreAdmin"):this._protos.google.firestore.admin.v1.FirestoreAdmin,this._opts,this._providedCustomServicePath);let firestoreAdminStubMethods=["createIndex","listIndexes","getIndex","deleteIndex","getField","updateField","listFields","exportDocuments","importDocuments","createDatabase","getDatabase","listDatabases","updateDatabase"];for(let methodName of firestoreAdminStubMethods){let callPromise=this.firestoreAdminStub.then(stub=>(...args)=>this._terminated?Promise.reject("The client has already been closed."):stub[methodName].apply(stub,args),err=>()=>{throw err}),descriptor=this.descriptors.page[methodName]||this.descriptors.longrunning[methodName]||void 0,apiCall=this._gaxModule.createApiCall(callPromise,this._defaults[methodName],descriptor,this._opts.fallback);this.innerApiCalls[methodName]=apiCall}return this.firestoreAdminStub}static get servicePath(){return"firestore.googleapis.com"}static get apiEndpoint(){return"firestore.googleapis.com"}static get port(){return 443}static get scopes(){return["https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/datastore"]}getProjectId(callback){if(callback){this.auth.getProjectId(callback);return}return this.auth.getProjectId()}getIndex(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({name:(_a=request.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.getIndex(request,options,callback)}deleteIndex(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({name:(_a=request.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.deleteIndex(request,options,callback)}getField(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({name:(_a=request.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.getField(request,options,callback)}getDatabase(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({name:(_a=request.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.getDatabase(request,options,callback)}listDatabases(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.listDatabases(request,options,callback)}createIndex(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.createIndex(request,options,callback)}async checkCreateIndexProgress(name){let request=new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}),[operation]=await this.operationsClient.getOperation(request);return new this._gaxModule.Operation(operation,this.descriptors.longrunning.createIndex,this._gaxModule.createDefaultBackoffSettings())}updateField(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({"field.name":(_a=request.field.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.updateField(request,options,callback)}async checkUpdateFieldProgress(name){let request=new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}),[operation]=await this.operationsClient.getOperation(request);return new this._gaxModule.Operation(operation,this.descriptors.longrunning.updateField,this._gaxModule.createDefaultBackoffSettings())}exportDocuments(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({name:(_a=request.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.exportDocuments(request,options,callback)}async checkExportDocumentsProgress(name){let request=new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}),[operation]=await this.operationsClient.getOperation(request);return new this._gaxModule.Operation(operation,this.descriptors.longrunning.exportDocuments,this._gaxModule.createDefaultBackoffSettings())}importDocuments(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({name:(_a=request.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.importDocuments(request,options,callback)}async checkImportDocumentsProgress(name){let request=new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}),[operation]=await this.operationsClient.getOperation(request);return new this._gaxModule.Operation(operation,this.descriptors.longrunning.importDocuments,this._gaxModule.createDefaultBackoffSettings())}createDatabase(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.createDatabase(request,options,callback)}async checkCreateDatabaseProgress(name){let request=new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}),[operation]=await this.operationsClient.getOperation(request);return new this._gaxModule.Operation(operation,this.descriptors.longrunning.createDatabase,this._gaxModule.createDefaultBackoffSettings())}updateDatabase(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({"database.name":(_a=request.database.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.updateDatabase(request,options,callback)}async checkUpdateDatabaseProgress(name){let request=new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}),[operation]=await this.operationsClient.getOperation(request);return new this._gaxModule.Operation(operation,this.descriptors.longrunning.updateDatabase,this._gaxModule.createDefaultBackoffSettings())}listIndexes(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.listIndexes(request,options,callback)}listIndexesStream(request,options){var _a;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""});let callSettings=this._defaults.listIndexes.merge(options);return this.initialize(),this.descriptors.page.listIndexes.createStream(this.innerApiCalls.listIndexes,request,callSettings)}listIndexesAsync(request,options){var _a;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""});let callSettings=this._defaults.listIndexes.merge(options);return this.initialize(),this.descriptors.page.listIndexes.asyncIterate(this.innerApiCalls.listIndexes,request,callSettings)}listFields(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.listFields(request,options,callback)}listFieldsStream(request,options){var _a;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""});let callSettings=this._defaults.listFields.merge(options);return this.initialize(),this.descriptors.page.listFields.createStream(this.innerApiCalls.listFields,request,callSettings)}listFieldsAsync(request,options){var _a;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""});let callSettings=this._defaults.listFields.merge(options);return this.initialize(),this.descriptors.page.listFields.asyncIterate(this.innerApiCalls.listFields,request,callSettings)}getLocation(request,options,callback){return this.locationsClient.getLocation(request,options,callback)}listLocationsAsync(request,options){return this.locationsClient.listLocationsAsync(request,options)}getOperation(request,options,callback){return this.operationsClient.getOperation(request,options,callback)}listOperationsAsync(request,options){return this.operationsClient.listOperationsAsync(request,options)}cancelOperation(request,options,callback){return this.operationsClient.cancelOperation(request,options,callback)}deleteOperation(request,options,callback){return this.operationsClient.deleteOperation(request,options,callback)}collectionGroupPath(project,database,collection){return this.pathTemplates.collectionGroupPathTemplate.render({project,database,collection})}matchProjectFromCollectionGroupName(collectionGroupName){return this.pathTemplates.collectionGroupPathTemplate.match(collectionGroupName).project}matchDatabaseFromCollectionGroupName(collectionGroupName){return this.pathTemplates.collectionGroupPathTemplate.match(collectionGroupName).database}matchCollectionFromCollectionGroupName(collectionGroupName){return this.pathTemplates.collectionGroupPathTemplate.match(collectionGroupName).collection}databasePath(project,database){return this.pathTemplates.databasePathTemplate.render({project,database})}matchProjectFromDatabaseName(databaseName){return this.pathTemplates.databasePathTemplate.match(databaseName).project}matchDatabaseFromDatabaseName(databaseName){return this.pathTemplates.databasePathTemplate.match(databaseName).database}fieldPath(project,database,collection,field){return this.pathTemplates.fieldPathTemplate.render({project,database,collection,field})}matchProjectFromFieldName(fieldName){return this.pathTemplates.fieldPathTemplate.match(fieldName).project}matchDatabaseFromFieldName(fieldName){return this.pathTemplates.fieldPathTemplate.match(fieldName).database}matchCollectionFromFieldName(fieldName){return this.pathTemplates.fieldPathTemplate.match(fieldName).collection}matchFieldFromFieldName(fieldName){return this.pathTemplates.fieldPathTemplate.match(fieldName).field}indexPath(project,database,collection,index){return this.pathTemplates.indexPathTemplate.render({project,database,collection,index})}matchProjectFromIndexName(indexName){return this.pathTemplates.indexPathTemplate.match(indexName).project}matchDatabaseFromIndexName(indexName){return this.pathTemplates.indexPathTemplate.match(indexName).database}matchCollectionFromIndexName(indexName){return this.pathTemplates.indexPathTemplate.match(indexName).collection}matchIndexFromIndexName(indexName){return this.pathTemplates.indexPathTemplate.match(indexName).index}projectPath(project){return this.pathTemplates.projectPathTemplate.render({project})}matchProjectFromProjectName(projectName){return this.pathTemplates.projectPathTemplate.match(projectName).project}close(){return this.firestoreAdminStub&&!this._terminated?this.firestoreAdminStub.then(stub=>{this._terminated=!0,stub.close(),this.locationsClient.close(),this.operationsClient.close()}):Promise.resolve()}};__name(FirestoreAdminClient,"FirestoreAdminClient");exports2.FirestoreAdminClient=FirestoreAdminClient}});var require_v1=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/protos/v1.json"(exports2,module2){module2.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:{Timestamp:{fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}},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}}},FileDescriptorSet:{fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}}},FileDescriptorProto:{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,options:{packed:!1}},weakDependency:{rule:"repeated",type:"int32",id:11,options:{packed:!1}},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}}},DescriptorProto:{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}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},FieldDescriptorProto:{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}},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_REQUIRED:2,LABEL_REPEATED:3}}}},OneofDescriptorProto:{fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3}}},EnumValueDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{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:{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},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[38,38]],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[8,8]]},FieldOptions:{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},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}}}},OneofOptions:{fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumValueOptions:{fields:{deprecated:{type:"bool",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{fields:{deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{fields:{deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},UninterpretedOption:{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}}}}},SourceCodeInfo:{fields:{location:{rule:"repeated",type:"Location",id:1}},nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1},span:{rule:"repeated",type:"int32",id:2},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4}}}}},Empty:{fields:{}},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}}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}},Duration:{fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}},firestore:{nested:{v1:{options:{csharp_namespace:"Google.Cloud.Firestore.V1",go_package:"cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb",java_multiple_files:!0,java_outer_classname:"WriteProto",java_package:"com.google.firestore.v1",objc_class_prefix:"GCFS",php_namespace:"Google\\Cloud\\Firestore\\V1",ruby_package:"Google::Cloud::Firestore::V1"},nested:{AggregationResult:{fields:{aggregateFields:{keyType:"string",type:"Value",id:2}}},BitSequence:{fields:{bitmap:{type:"bytes",id:1},padding:{type:"int32",id:2}}},BloomFilter:{fields:{bits:{type:"BitSequence",id:1},hashCount:{type:"int32",id:2}}},DocumentMask:{fields:{fieldPaths:{rule:"repeated",type:"string",id:1}}},Precondition:{oneofs:{conditionType:{oneof:["exists","updateTime"]}},fields:{exists:{type:"bool",id:1},updateTime:{type:"google.protobuf.Timestamp",id:2}}},TransactionOptions:{oneofs:{mode:{oneof:["readOnly","readWrite"]}},fields:{readOnly:{type:"ReadOnly",id:2},readWrite:{type:"ReadWrite",id:3}},nested:{ReadWrite:{fields:{retryTransaction:{type:"bytes",id:1}}},ReadOnly:{oneofs:{consistencySelector:{oneof:["readTime"]}},fields:{readTime:{type:"google.protobuf.Timestamp",id:2}}}}},Document:{fields:{name:{type:"string",id:1},fields:{keyType:"string",type:"Value",id:2},createTime:{type:"google.protobuf.Timestamp",id:3},updateTime:{type:"google.protobuf.Timestamp",id:4}}},Value:{oneofs:{valueType:{oneof:["nullValue","booleanValue","integerValue","doubleValue","timestampValue","stringValue","bytesValue","referenceValue","geoPointValue","arrayValue","mapValue"]}},fields:{nullValue:{type:"google.protobuf.NullValue",id:11},booleanValue:{type:"bool",id:1},integerValue:{type:"int64",id:2},doubleValue:{type:"double",id:3},timestampValue:{type:"google.protobuf.Timestamp",id:10},stringValue:{type:"string",id:17},bytesValue:{type:"bytes",id:18},referenceValue:{type:"string",id:5},geoPointValue:{type:"google.type.LatLng",id:8},arrayValue:{type:"ArrayValue",id:9},mapValue:{type:"MapValue",id:6}}},ArrayValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}},MapValue:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Firestore:{options:{"(google.api.default_host)":"firestore.googleapis.com","(google.api.oauth_scopes)":"https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/datastore"},methods:{GetDocument:{requestType:"GetDocumentRequest",responseType:"Document",options:{"(google.api.http).get":"/v1/{name=projects/*/databases/*/documents/*/**}"},parsedOptions:[{"(google.api.http)":{get:"/v1/{name=projects/*/databases/*/documents/*/**}"}}]},ListDocuments:{requestType:"ListDocumentsRequest",responseType:"ListDocumentsResponse",options:{"(google.api.http).get":"/v1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}","(google.api.http).additional_bindings.get":"/v1/{parent=projects/*/databases/*/documents}/{collection_id}"},parsedOptions:[{"(google.api.http)":{get:"/v1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}",additional_bindings:{get:"/v1/{parent=projects/*/databases/*/documents}/{collection_id}"}}}]},UpdateDocument:{requestType:"UpdateDocumentRequest",responseType:"Document",options:{"(google.api.http).patch":"/v1/{document.name=projects/*/databases/*/documents/*/**}","(google.api.http).body":"document","(google.api.method_signature)":"document,update_mask"},parsedOptions:[{"(google.api.http)":{patch:"/v1/{document.name=projects/*/databases/*/documents/*/**}",body:"document"}},{"(google.api.method_signature)":"document,update_mask"}]},DeleteDocument:{requestType:"DeleteDocumentRequest",responseType:"google.protobuf.Empty",options:{"(google.api.http).delete":"/v1/{name=projects/*/databases/*/documents/*/**}","(google.api.method_signature)":"name"},parsedOptions:[{"(google.api.http)":{delete:"/v1/{name=projects/*/databases/*/documents/*/**}"}},{"(google.api.method_signature)":"name"}]},BatchGetDocuments:{requestType:"BatchGetDocumentsRequest",responseType:"BatchGetDocumentsResponse",responseStream:!0,options:{"(google.api.http).post":"/v1/{database=projects/*/databases/*}/documents:batchGet","(google.api.http).body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1/{database=projects/*/databases/*}/documents:batchGet",body:"*"}}]},BeginTransaction:{requestType:"BeginTransactionRequest",responseType:"BeginTransactionResponse",options:{"(google.api.http).post":"/v1/{database=projects/*/databases/*}/documents:beginTransaction","(google.api.http).body":"*","(google.api.method_signature)":"database"},parsedOptions:[{"(google.api.http)":{post:"/v1/{database=projects/*/databases/*}/documents:beginTransaction",body:"*"}},{"(google.api.method_signature)":"database"}]},Commit:{requestType:"CommitRequest",responseType:"CommitResponse",options:{"(google.api.http).post":"/v1/{database=projects/*/databases/*}/documents:commit","(google.api.http).body":"*","(google.api.method_signature)":"database,writes"},parsedOptions:[{"(google.api.http)":{post:"/v1/{database=projects/*/databases/*}/documents:commit",body:"*"}},{"(google.api.method_signature)":"database,writes"}]},Rollback:{requestType:"RollbackRequest",responseType:"google.protobuf.Empty",options:{"(google.api.http).post":"/v1/{database=projects/*/databases/*}/documents:rollback","(google.api.http).body":"*","(google.api.method_signature)":"database,transaction"},parsedOptions:[{"(google.api.http)":{post:"/v1/{database=projects/*/databases/*}/documents:rollback",body:"*"}},{"(google.api.method_signature)":"database,transaction"}]},RunQuery:{requestType:"RunQueryRequest",responseType:"RunQueryResponse",responseStream:!0,options:{"(google.api.http).post":"/v1/{parent=projects/*/databases/*/documents}:runQuery","(google.api.http).body":"*","(google.api.http).additional_bindings.post":"/v1/{parent=projects/*/databases/*/documents/*/**}:runQuery","(google.api.http).additional_bindings.body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1/{parent=projects/*/databases/*/documents}:runQuery",body:"*",additional_bindings:{post:"/v1/{parent=projects/*/databases/*/documents/*/**}:runQuery",body:"*"}}}]},RunAggregationQuery:{requestType:"RunAggregationQueryRequest",responseType:"RunAggregationQueryResponse",responseStream:!0,options:{"(google.api.http).post":"/v1/{parent=projects/*/databases/*/documents}:runAggregationQuery","(google.api.http).body":"*","(google.api.http).additional_bindings.post":"/v1/{parent=projects/*/databases/*/documents/*/**}:runAggregationQuery","(google.api.http).additional_bindings.body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1/{parent=projects/*/databases/*/documents}:runAggregationQuery",body:"*",additional_bindings:{post:"/v1/{parent=projects/*/databases/*/documents/*/**}:runAggregationQuery",body:"*"}}}]},PartitionQuery:{requestType:"PartitionQueryRequest",responseType:"PartitionQueryResponse",options:{"(google.api.http).post":"/v1/{parent=projects/*/databases/*/documents}:partitionQuery","(google.api.http).body":"*","(google.api.http).additional_bindings.post":"/v1/{parent=projects/*/databases/*/documents/*/**}:partitionQuery","(google.api.http).additional_bindings.body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1/{parent=projects/*/databases/*/documents}:partitionQuery",body:"*",additional_bindings:{post:"/v1/{parent=projects/*/databases/*/documents/*/**}:partitionQuery",body:"*"}}}]},Write:{requestType:"WriteRequest",requestStream:!0,responseType:"WriteResponse",responseStream:!0,options:{"(google.api.http).post":"/v1/{database=projects/*/databases/*}/documents:write","(google.api.http).body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1/{database=projects/*/databases/*}/documents:write",body:"*"}}]},Listen:{requestType:"ListenRequest",requestStream:!0,responseType:"ListenResponse",responseStream:!0,options:{"(google.api.http).post":"/v1/{database=projects/*/databases/*}/documents:listen","(google.api.http).body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1/{database=projects/*/databases/*}/documents:listen",body:"*"}}]},ListCollectionIds:{requestType:"ListCollectionIdsRequest",responseType:"ListCollectionIdsResponse",options:{"(google.api.http).post":"/v1/{parent=projects/*/databases/*/documents}:listCollectionIds","(google.api.http).body":"*","(google.api.http).additional_bindings.post":"/v1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds","(google.api.http).additional_bindings.body":"*","(google.api.method_signature)":"parent"},parsedOptions:[{"(google.api.http)":{post:"/v1/{parent=projects/*/databases/*/documents}:listCollectionIds",body:"*",additional_bindings:{post:"/v1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds",body:"*"}}},{"(google.api.method_signature)":"parent"}]},BatchWrite:{requestType:"BatchWriteRequest",responseType:"BatchWriteResponse",options:{"(google.api.http).post":"/v1/{database=projects/*/databases/*}/documents:batchWrite","(google.api.http).body":"*"},parsedOptions:[{"(google.api.http)":{post:"/v1/{database=projects/*/databases/*}/documents:batchWrite",body:"*"}}]},CreateDocument:{requestType:"CreateDocumentRequest",responseType:"Document",options:{"(google.api.http).post":"/v1/{parent=projects/*/databases/*/documents/**}/{collection_id}","(google.api.http).body":"document"},parsedOptions:[{"(google.api.http)":{post:"/v1/{parent=projects/*/databases/*/documents/**}/{collection_id}",body:"document"}}]}}},GetDocumentRequest:{oneofs:{consistencySelector:{oneof:["transaction","readTime"]}},fields:{name:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},mask:{type:"DocumentMask",id:2},transaction:{type:"bytes",id:3},readTime:{type:"google.protobuf.Timestamp",id:5}}},ListDocumentsRequest:{oneofs:{consistencySelector:{oneof:["transaction","readTime"]}},fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},collectionId:{type:"string",id:2,options:{"(google.api.field_behavior)":"OPTIONAL"}},pageSize:{type:"int32",id:3,options:{"(google.api.field_behavior)":"OPTIONAL"}},pageToken:{type:"string",id:4,options:{"(google.api.field_behavior)":"OPTIONAL"}},orderBy:{type:"string",id:6,options:{"(google.api.field_behavior)":"OPTIONAL"}},mask:{type:"DocumentMask",id:7,options:{"(google.api.field_behavior)":"OPTIONAL"}},transaction:{type:"bytes",id:8},readTime:{type:"google.protobuf.Timestamp",id:10},showMissing:{type:"bool",id:12}}},ListDocumentsResponse:{fields:{documents:{rule:"repeated",type:"Document",id:1},nextPageToken:{type:"string",id:2}}},CreateDocumentRequest:{fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},collectionId:{type:"string",id:2,options:{"(google.api.field_behavior)":"REQUIRED"}},documentId:{type:"string",id:3},document:{type:"Document",id:4,options:{"(google.api.field_behavior)":"REQUIRED"}},mask:{type:"DocumentMask",id:5}}},UpdateDocumentRequest:{fields:{document:{type:"Document",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},updateMask:{type:"DocumentMask",id:2},mask:{type:"DocumentMask",id:3},currentDocument:{type:"Precondition",id:4}}},DeleteDocumentRequest:{fields:{name:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},currentDocument:{type:"Precondition",id:2}}},BatchGetDocumentsRequest:{oneofs:{consistencySelector:{oneof:["transaction","newTransaction","readTime"]}},fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},documents:{rule:"repeated",type:"string",id:2},mask:{type:"DocumentMask",id:3},transaction:{type:"bytes",id:4},newTransaction:{type:"TransactionOptions",id:5},readTime:{type:"google.protobuf.Timestamp",id:7}}},BatchGetDocumentsResponse:{oneofs:{result:{oneof:["found","missing"]}},fields:{found:{type:"Document",id:1},missing:{type:"string",id:2},transaction:{type:"bytes",id:3},readTime:{type:"google.protobuf.Timestamp",id:4}}},BeginTransactionRequest:{fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},options:{type:"TransactionOptions",id:2}}},BeginTransactionResponse:{fields:{transaction:{type:"bytes",id:1}}},CommitRequest:{fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},writes:{rule:"repeated",type:"Write",id:2},transaction:{type:"bytes",id:3}}},CommitResponse:{fields:{writeResults:{rule:"repeated",type:"WriteResult",id:1},commitTime:{type:"google.protobuf.Timestamp",id:2}}},RollbackRequest:{fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},transaction:{type:"bytes",id:2,options:{"(google.api.field_behavior)":"REQUIRED"}}}},RunQueryRequest:{oneofs:{queryType:{oneof:["structuredQuery"]},consistencySelector:{oneof:["transaction","newTransaction","readTime"]}},fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},structuredQuery:{type:"StructuredQuery",id:2},transaction:{type:"bytes",id:5},newTransaction:{type:"TransactionOptions",id:6},readTime:{type:"google.protobuf.Timestamp",id:7}}},RunQueryResponse:{oneofs:{continuationSelector:{oneof:["done"]}},fields:{transaction:{type:"bytes",id:2},document:{type:"Document",id:1},readTime:{type:"google.protobuf.Timestamp",id:3},skippedResults:{type:"int32",id:4},done:{type:"bool",id:6}}},RunAggregationQueryRequest:{oneofs:{queryType:{oneof:["structuredAggregationQuery"]},consistencySelector:{oneof:["transaction","newTransaction","readTime"]}},fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},structuredAggregationQuery:{type:"StructuredAggregationQuery",id:2},transaction:{type:"bytes",id:4},newTransaction:{type:"TransactionOptions",id:5},readTime:{type:"google.protobuf.Timestamp",id:6}}},RunAggregationQueryResponse:{fields:{result:{type:"AggregationResult",id:1},transaction:{type:"bytes",id:2},readTime:{type:"google.protobuf.Timestamp",id:3}}},PartitionQueryRequest:{oneofs:{queryType:{oneof:["structuredQuery"]},consistencySelector:{oneof:["readTime"]}},fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},structuredQuery:{type:"StructuredQuery",id:2},partitionCount:{type:"int64",id:3},pageToken:{type:"string",id:4},pageSize:{type:"int32",id:5},readTime:{type:"google.protobuf.Timestamp",id:6}}},PartitionQueryResponse:{fields:{partitions:{rule:"repeated",type:"Cursor",id:1},nextPageToken:{type:"string",id:2}}},WriteRequest:{fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},streamId:{type:"string",id:2},writes:{rule:"repeated",type:"Write",id:3},streamToken:{type:"bytes",id:4},labels:{keyType:"string",type:"string",id:5}}},WriteResponse:{fields:{streamId:{type:"string",id:1},streamToken:{type:"bytes",id:2},writeResults:{rule:"repeated",type:"WriteResult",id:3},commitTime:{type:"google.protobuf.Timestamp",id:4}}},ListenRequest:{oneofs:{targetChange:{oneof:["addTarget","removeTarget"]}},fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},addTarget:{type:"Target",id:2},removeTarget:{type:"int32",id:3},labels:{keyType:"string",type:"string",id:4}}},ListenResponse:{oneofs:{responseType:{oneof:["targetChange","documentChange","documentDelete","documentRemove","filter"]}},fields:{targetChange:{type:"TargetChange",id:2},documentChange:{type:"DocumentChange",id:3},documentDelete:{type:"DocumentDelete",id:4},documentRemove:{type:"DocumentRemove",id:6},filter:{type:"ExistenceFilter",id:5}}},Target:{oneofs:{targetType:{oneof:["query","documents"]},resumeType:{oneof:["resumeToken","readTime"]}},fields:{query:{type:"QueryTarget",id:2},documents:{type:"DocumentsTarget",id:3},resumeToken:{type:"bytes",id:4},readTime:{type:"google.protobuf.Timestamp",id:11},targetId:{type:"int32",id:5},once:{type:"bool",id:6},expectedCount:{type:"google.protobuf.Int32Value",id:12}},nested:{DocumentsTarget:{fields:{documents:{rule:"repeated",type:"string",id:2}}},QueryTarget:{oneofs:{queryType:{oneof:["structuredQuery"]}},fields:{parent:{type:"string",id:1},structuredQuery:{type:"StructuredQuery",id:2}}}}},TargetChange:{fields:{targetChangeType:{type:"TargetChangeType",id:1},targetIds:{rule:"repeated",type:"int32",id:2},cause:{type:"google.rpc.Status",id:3},resumeToken:{type:"bytes",id:4},readTime:{type:"google.protobuf.Timestamp",id:6}},nested:{TargetChangeType:{values:{NO_CHANGE:0,ADD:1,REMOVE:2,CURRENT:3,RESET:4}}}},ListCollectionIdsRequest:{oneofs:{consistencySelector:{oneof:["readTime"]}},fields:{parent:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},pageSize:{type:"int32",id:2},pageToken:{type:"string",id:3},readTime:{type:"google.protobuf.Timestamp",id:4}}},ListCollectionIdsResponse:{fields:{collectionIds:{rule:"repeated",type:"string",id:1},nextPageToken:{type:"string",id:2}}},BatchWriteRequest:{fields:{database:{type:"string",id:1,options:{"(google.api.field_behavior)":"REQUIRED"}},writes:{rule:"repeated",type:"Write",id:2},labels:{keyType:"string",type:"string",id:3}}},BatchWriteResponse:{fields:{writeResults:{rule:"repeated",type:"WriteResult",id:1},status:{rule:"repeated",type:"google.rpc.Status",id:2}}},StructuredQuery:{fields:{select:{type:"Projection",id:1},from:{rule:"repeated",type:"CollectionSelector",id:2},where:{type:"Filter",id:3},orderBy:{rule:"repeated",type:"Order",id:4},startAt:{type:"Cursor",id:7},endAt:{type:"Cursor",id:8},offset:{type:"int32",id:6},limit:{type:"google.protobuf.Int32Value",id:5}},nested:{CollectionSelector:{fields:{collectionId:{type:"string",id:2},allDescendants:{type:"bool",id:3}}},Filter:{oneofs:{filterType:{oneof:["compositeFilter","fieldFilter","unaryFilter"]}},fields:{compositeFilter:{type:"CompositeFilter",id:1},fieldFilter:{type:"FieldFilter",id:2},unaryFilter:{type:"UnaryFilter",id:3}}},CompositeFilter:{fields:{op:{type:"Operator",id:1},filters:{rule:"repeated",type:"Filter",id:2}},nested:{Operator:{values:{OPERATOR_UNSPECIFIED:0,AND:1,OR:2}}}},FieldFilter:{fields:{field:{type:"FieldReference",id:1},op:{type:"Operator",id:2},value:{type:"Value",id:3}},nested:{Operator:{values:{OPERATOR_UNSPECIFIED:0,LESS_THAN:1,LESS_THAN_OR_EQUAL:2,GREATER_THAN:3,GREATER_THAN_OR_EQUAL:4,EQUAL:5,NOT_EQUAL:6,ARRAY_CONTAINS:7,IN:8,ARRAY_CONTAINS_ANY:9,NOT_IN:10}}}},UnaryFilter:{oneofs:{operandType:{oneof:["field"]}},fields:{op:{type:"Operator",id:1},field:{type:"FieldReference",id:2}},nested:{Operator:{values:{OPERATOR_UNSPECIFIED:0,IS_NAN:2,IS_NULL:3,IS_NOT_NAN:4,IS_NOT_NULL:5}}}},Order:{fields:{field:{type:"FieldReference",id:1},direction:{type:"Direction",id:2}}},Direction:{values:{DIRECTION_UNSPECIFIED:0,ASCENDING:1,DESCENDING:2}},FieldReference:{fields:{fieldPath:{type:"string",id:2}}},Projection:{fields:{fields:{rule:"repeated",type:"FieldReference",id:2}}}}},StructuredAggregationQuery:{oneofs:{queryType:{oneof:["structuredQuery"]}},fields:{structuredQuery:{type:"StructuredQuery",id:1},aggregations:{rule:"repeated",type:"Aggregation",id:3,options:{"(google.api.field_behavior)":"OPTIONAL"}}},nested:{Aggregation:{oneofs:{operator:{oneof:["count","sum","avg"]}},fields:{count:{type:"Count",id:1},sum:{type:"Sum",id:2},avg:{type:"Avg",id:3},alias:{type:"string",id:7,options:{"(google.api.field_behavior)":"OPTIONAL"}}},nested:{Count:{fields:{upTo:{type:"google.protobuf.Int64Value",id:1,options:{"(google.api.field_behavior)":"OPTIONAL"}}}},Sum:{fields:{field:{type:"StructuredQuery.FieldReference",id:1}}},Avg:{fields:{field:{type:"StructuredQuery.FieldReference",id:1}}}}}}},Cursor:{fields:{values:{rule:"repeated",type:"Value",id:1},before:{type:"bool",id:2}}},Write:{oneofs:{operation:{oneof:["update","delete","transform"]}},fields:{update:{type:"Document",id:1},delete:{type:"string",id:2},transform:{type:"DocumentTransform",id:6},updateMask:{type:"DocumentMask",id:3},updateTransforms:{rule:"repeated",type:"DocumentTransform.FieldTransform",id:7},currentDocument:{type:"Precondition",id:4}}},DocumentTransform:{fields:{document:{type:"string",id:1},fieldTransforms:{rule:"repeated",type:"FieldTransform",id:2}},nested:{FieldTransform:{oneofs:{transformType:{oneof:["setToServerValue","increment","maximum","minimum","appendMissingElements","removeAllFromArray"]}},fields:{fieldPath:{type:"string",id:1},setToServerValue:{type:"ServerValue",id:2},increment:{type:"Value",id:3},maximum:{type:"Value",id:4},minimum:{type:"Value",id:5},appendMissingElements:{type:"ArrayValue",id:6},removeAllFromArray:{type:"ArrayValue",id:7}},nested:{ServerValue:{values:{SERVER_VALUE_UNSPECIFIED:0,REQUEST_TIME:1}}}}}},WriteResult:{fields:{updateTime:{type:"google.protobuf.Timestamp",id:1},transformResults:{rule:"repeated",type:"Value",id:2}}},DocumentChange:{fields:{document:{type:"Document",id:1},targetIds:{rule:"repeated",type:"int32",id:5},removedTargetIds:{rule:"repeated",type:"int32",id:6}}},DocumentDelete:{fields:{document:{type:"string",id:1},removedTargetIds:{rule:"repeated",type:"int32",id:6},readTime:{type:"google.protobuf.Timestamp",id:4}}},DocumentRemove:{fields:{document:{type:"string",id:1},removedTargetIds:{rule:"repeated",type:"int32",id:2},readTime:{type:"google.protobuf.Timestamp",id:4}}},ExistenceFilter:{fields:{targetId:{type:"int32",id:1},count:{type:"int32",id:2},unchangedNames:{type:"BloomFilter",id:3}}}}}}},api:{options:{go_package:"google.golang.org/genproto/googleapis/api/annotations;annotations",java_multiple_files:!0,java_outer_classname:"ResourceProto",java_package:"com.google.api",objc_class_prefix:"GAPI",cc_enable_arenas:!0},nested:{http:{type:"HttpRule",id:72295728,extend:"google.protobuf.MethodOptions"},Http:{fields:{rules:{rule:"repeated",type:"HttpRule",id:1}}},HttpRule:{oneofs:{pattern:{oneof:["get","put","post","delete","patch","custom"]}},fields:{get:{type:"string",id:2},put:{type:"string",id:3},post:{type:"string",id:4},delete:{type:"string",id:5},patch:{type:"string",id:6},custom:{type:"CustomHttpPattern",id:8},selector:{type:"string",id:1},body:{type:"string",id:7},additionalBindings:{rule:"repeated",type:"HttpRule",id:11}}},CustomHttpPattern:{fields:{kind:{type:"string",id:1},path:{type:"string",id:2}}},methodSignature:{rule:"repeated",type:"string",id:1051,extend:"google.protobuf.MethodOptions"},defaultHost:{type:"string",id:1049,extend:"google.protobuf.ServiceOptions"},oauthScopes:{type:"string",id:1050,extend:"google.protobuf.ServiceOptions"},CommonLanguageSettings:{fields:{referenceDocsUri:{type:"string",id:1,options:{deprecated:!0}},destinations:{rule:"repeated",type:"ClientLibraryDestination",id:2}}},ClientLibrarySettings:{fields:{version:{type:"string",id:1},launchStage:{type:"LaunchStage",id:2},restNumericEnums:{type:"bool",id:3},javaSettings:{type:"JavaSettings",id:21},cppSettings:{type:"CppSettings",id:22},phpSettings:{type:"PhpSettings",id:23},pythonSettings:{type:"PythonSettings",id:24},nodeSettings:{type:"NodeSettings",id:25},dotnetSettings:{type:"DotnetSettings",id:26},rubySettings:{type:"RubySettings",id:27},goSettings:{type:"GoSettings",id:28}}},Publishing:{fields:{methodSettings:{rule:"repeated",type:"MethodSettings",id:2},newIssueUri:{type:"string",id:101},documentationUri:{type:"string",id:102},apiShortName:{type:"string",id:103},githubLabel:{type:"string",id:104},codeownerGithubTeams:{rule:"repeated",type:"string",id:105},docTagPrefix:{type:"string",id:106},organization:{type:"ClientLibraryOrganization",id:107},librarySettings:{rule:"repeated",type:"ClientLibrarySettings",id:109},protoReferenceDocumentationUri:{type:"string",id:110}}},JavaSettings:{fields:{libraryPackage:{type:"string",id:1},serviceClassNames:{keyType:"string",type:"string",id:2},common:{type:"CommonLanguageSettings",id:3}}},CppSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},PhpSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},PythonSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},NodeSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},DotnetSettings:{fields:{common:{type:"CommonLanguageSettings",id:1},renamedServices:{keyType:"string",type:"string",id:2},renamedResources:{keyType:"string",type:"string",id:3},ignoredResources:{rule:"repeated",type:"string",id:4},forcedNamespaceAliases:{rule:"repeated",type:"string",id:5},handwrittenSignatures:{rule:"repeated",type:"string",id:6}}},RubySettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},GoSettings:{fields:{common:{type:"CommonLanguageSettings",id:1}}},MethodSettings:{fields:{selector:{type:"string",id:1},longRunning:{type:"LongRunning",id:2}},nested:{LongRunning:{fields:{initialPollDelay:{type:"google.protobuf.Duration",id:1},pollDelayMultiplier:{type:"float",id:2},maxPollDelay:{type:"google.protobuf.Duration",id:3},totalPollTimeout:{type:"google.protobuf.Duration",id:4}}}}},ClientLibraryOrganization:{values:{CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED:0,CLOUD:1,ADS:2,PHOTOS:3,STREET_VIEW:4,SHOPPING:5,GEO:6,GENERATIVE_AI:7}},ClientLibraryDestination:{values:{CLIENT_LIBRARY_DESTINATION_UNSPECIFIED:0,GITHUB:10,PACKAGE_MANAGER:20}},fieldBehavior:{rule:"repeated",type:"google.api.FieldBehavior",id:1052,extend:"google.protobuf.FieldOptions"},FieldBehavior:{values:{FIELD_BEHAVIOR_UNSPECIFIED:0,OPTIONAL:1,REQUIRED:2,OUTPUT_ONLY:3,INPUT_ONLY:4,IMMUTABLE:5,UNORDERED_LIST:6,NON_EMPTY_DEFAULT:7}},LaunchStage:{values:{LAUNCH_STAGE_UNSPECIFIED:0,UNIMPLEMENTED:6,PRELAUNCH:7,EARLY_ACCESS:1,ALPHA:2,BETA:3,GA:4,DEPRECATED:5}},resourceReference:{type:"google.api.ResourceReference",id:1055,extend:"google.protobuf.FieldOptions"},resourceDefinition:{rule:"repeated",type:"google.api.ResourceDescriptor",id:1053,extend:"google.protobuf.FileOptions"},resource:{type:"google.api.ResourceDescriptor",id:1053,extend:"google.protobuf.MessageOptions"},ResourceDescriptor:{fields:{type:{type:"string",id:1},pattern:{rule:"repeated",type:"string",id:2},nameField:{type:"string",id:3},history:{type:"History",id:4},plural:{type:"string",id:5},singular:{type:"string",id:6},style:{rule:"repeated",type:"Style",id:10}},nested:{History:{values:{HISTORY_UNSPECIFIED:0,ORIGINALLY_SINGLE_PATTERN:1,FUTURE_MULTI_PATTERN:2}},Style:{values:{STYLE_UNSPECIFIED:0,DECLARATIVE_FRIENDLY:1}}}},ResourceReference:{fields:{type:{type:"string",id:1},childType:{type:"string",id:2}}}}},type:{options:{cc_enable_arenas:!0,go_package:"google.golang.org/genproto/googleapis/type/latlng;latlng",java_multiple_files:!0,java_outer_classname:"LatLngProto",java_package:"com.google.type",objc_class_prefix:"GTP"},nested:{LatLng:{fields:{latitude:{type:"double",id:1},longitude:{type:"double",id:2}}}}},rpc:{options:{cc_enable_arenas:!0,go_package:"google.golang.org/genproto/googleapis/rpc/status;status",java_multiple_files:!0,java_outer_classname:"StatusProto",java_package:"com.google.rpc",objc_class_prefix:"RPC"},nested:{Status:{fields:{code:{type:"int32",id:1},message:{type:"string",id:2},details:{rule:"repeated",type:"google.protobuf.Any",id:3}}}}}}}}}}});var require_firestore_client2=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/v1/firestore_client.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.FirestoreClient=void 0;var stream_1=require("stream"),jsonProtos=require_v1(),gapicConfig=require_firestore_client_config(),version2=require_package5().version,FirestoreClient=class{constructor(opts,gaxInstance){var _a,_b;this._terminated=!1,this.descriptors={page:{},stream:{},longrunning:{},batching:{}};let staticMembers=this.constructor,servicePath=opts?.servicePath||opts?.apiEndpoint||staticMembers.servicePath;this._providedCustomServicePath=!!(opts?.servicePath||opts?.apiEndpoint);let port=opts?.port||staticMembers.port,clientConfig=(_a=opts?.clientConfig)!==null&&_a!==void 0?_a:{},fallback=(_b=opts?.fallback)!==null&&_b!==void 0?_b:typeof window<"u"&&typeof window?.fetch=="function";opts=Object.assign({servicePath,port,clientConfig,fallback},opts),opts.numericEnums=!0,servicePath!==staticMembers.servicePath&&!("scopes"in opts)&&(opts.scopes=staticMembers.scopes),gaxInstance||(gaxInstance=require_src11()),this._gaxModule=opts.fallback?gaxInstance.fallback:gaxInstance,this._gaxGrpc=new this._gaxModule.GrpcClient(opts),this._opts=opts,this.auth=this._gaxGrpc.auth,this.auth.useJWTAccessWithScope=!0,this.auth.defaultServicePath=staticMembers.servicePath,servicePath===staticMembers.servicePath&&(this.auth.defaultScopes=staticMembers.scopes),this.locationsClient=new this._gaxModule.LocationsClient(this._gaxGrpc,opts);let clientHeader=[`gax/${this._gaxModule.version}`,`gapic/${version2}`];typeof process<"u"&&"versions"in process?clientHeader.push(`gl-node/${process.versions.node}`):clientHeader.push(`gl-web/${this._gaxModule.version}`),opts.fallback?opts.fallback==="rest"&&clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`):clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`),opts.libName&&opts.libVersion&&clientHeader.push(`${opts.libName}/${opts.libVersion}`),this._protos=this._gaxGrpc.loadProtoJSON(jsonProtos),this.descriptors.page={listDocuments:new this._gaxModule.PageDescriptor("pageToken","nextPageToken","documents"),partitionQuery:new this._gaxModule.PageDescriptor("pageToken","nextPageToken","partitions"),listCollectionIds:new this._gaxModule.PageDescriptor("pageToken","nextPageToken","collectionIds")},this.descriptors.stream={batchGetDocuments:new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING,opts.fallback==="rest"),runQuery:new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING,opts.fallback==="rest"),runAggregationQuery:new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING,opts.fallback==="rest"),write:new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING,opts.fallback==="rest"),listen:new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING,opts.fallback==="rest")},this._defaults=this._gaxGrpc.constructSettings("google.firestore.v1.Firestore",gapicConfig,opts.clientConfig||{},{"x-goog-api-client":clientHeader.join(" ")}),this.innerApiCalls={},this.warn=this._gaxModule.warn}initialize(){if(this.firestoreStub)return this.firestoreStub;this.firestoreStub=this._gaxGrpc.createStub(this._opts.fallback?this._protos.lookupService("google.firestore.v1.Firestore"):this._protos.google.firestore.v1.Firestore,this._opts,this._providedCustomServicePath);let firestoreStubMethods=["getDocument","listDocuments","updateDocument","deleteDocument","batchGetDocuments","beginTransaction","commit","rollback","runQuery","runAggregationQuery","partitionQuery","write","listen","listCollectionIds","batchWrite","createDocument"];for(let methodName of firestoreStubMethods){let callPromise=this.firestoreStub.then(stub=>(...args)=>{if(this._terminated){if(methodName in this.descriptors.stream){let stream=new stream_1.PassThrough;return setImmediate(()=>{stream.emit("error",new this._gaxModule.GoogleError("The client has already been closed."))}),stream}return Promise.reject("The client has already been closed.")}return stub[methodName].apply(stub,args)},err=>()=>{throw err}),descriptor=this.descriptors.page[methodName]||this.descriptors.stream[methodName]||void 0,apiCall=this._gaxModule.createApiCall(callPromise,this._defaults[methodName],descriptor,this._opts.fallback);this.innerApiCalls[methodName]=apiCall}return this.firestoreStub}static get servicePath(){return"firestore.googleapis.com"}static get apiEndpoint(){return"firestore.googleapis.com"}static get port(){return 443}static get scopes(){return["https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/datastore"]}getProjectId(callback){if(callback){this.auth.getProjectId(callback);return}return this.auth.getProjectId()}getDocument(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({name:(_a=request.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.getDocument(request,options,callback)}updateDocument(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({"document.name":(_a=request.document.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.updateDocument(request,options,callback)}deleteDocument(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({name:(_a=request.name)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.deleteDocument(request,options,callback)}beginTransaction(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({database:(_a=request.database)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.beginTransaction(request,options,callback)}commit(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({database:(_a=request.database)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.commit(request,options,callback)}rollback(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({database:(_a=request.database)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.rollback(request,options,callback)}batchWrite(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({database:(_a=request.database)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.batchWrite(request,options,callback)}createDocument(request,optionsOrCallback,callback){var _a,_b;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:"",collection_id:(_b=request.collectionId)!==null&&_b!==void 0?_b:""}),this.initialize(),this.innerApiCalls.createDocument(request,options,callback)}batchGetDocuments(request,options){var _a;return request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({database:(_a=request.database)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.batchGetDocuments(request,options)}runQuery(request,options){var _a;return request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.runQuery(request,options)}runAggregationQuery(request,options){var _a;return request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.runAggregationQuery(request,options)}write(options){return this.initialize(),this.innerApiCalls.write(null,options)}listen(options){return this.initialize(),this.innerApiCalls.listen(null,options)}listDocuments(request,optionsOrCallback,callback){var _a,_b;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:"",collection_id:(_b=request.collectionId)!==null&&_b!==void 0?_b:""}),this.initialize(),this.innerApiCalls.listDocuments(request,options,callback)}listDocumentsStream(request,options){var _a,_b;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:"",collection_id:(_b=request.collectionId)!==null&&_b!==void 0?_b:""});let callSettings=this._defaults.listDocuments.merge(options);return this.initialize(),this.descriptors.page.listDocuments.createStream(this.innerApiCalls.listDocuments,request,callSettings)}listDocumentsAsync(request,options){var _a,_b;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:"",collection_id:(_b=request.collectionId)!==null&&_b!==void 0?_b:""});let callSettings=this._defaults.listDocuments.merge(options);return this.initialize(),this.descriptors.page.listDocuments.asyncIterate(this.innerApiCalls.listDocuments,request,callSettings)}partitionQuery(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.partitionQuery(request,options,callback)}partitionQueryStream(request,options){var _a;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""});let callSettings=this._defaults.partitionQuery.merge(options);return this.initialize(),this.descriptors.page.partitionQuery.createStream(this.innerApiCalls.partitionQuery,request,callSettings)}partitionQueryAsync(request,options){var _a;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""});let callSettings=this._defaults.partitionQuery.merge(options);return this.initialize(),this.descriptors.page.partitionQuery.asyncIterate(this.innerApiCalls.partitionQuery,request,callSettings)}listCollectionIds(request,optionsOrCallback,callback){var _a;request=request||{};let options;return typeof optionsOrCallback=="function"&&callback===void 0?(callback=optionsOrCallback,options={}):options=optionsOrCallback,options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""}),this.initialize(),this.innerApiCalls.listCollectionIds(request,options,callback)}listCollectionIdsStream(request,options){var _a;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""});let callSettings=this._defaults.listCollectionIds.merge(options);return this.initialize(),this.descriptors.page.listCollectionIds.createStream(this.innerApiCalls.listCollectionIds,request,callSettings)}listCollectionIdsAsync(request,options){var _a;request=request||{},options=options||{},options.otherArgs=options.otherArgs||{},options.otherArgs.headers=options.otherArgs.headers||{},options.otherArgs.headers["x-goog-request-params"]=this._gaxModule.routingHeader.fromParams({parent:(_a=request.parent)!==null&&_a!==void 0?_a:""});let callSettings=this._defaults.listCollectionIds.merge(options);return this.initialize(),this.descriptors.page.listCollectionIds.asyncIterate(this.innerApiCalls.listCollectionIds,request,callSettings)}getLocation(request,options,callback){return this.locationsClient.getLocation(request,options,callback)}listLocationsAsync(request,options){return this.locationsClient.listLocationsAsync(request,options)}close(){return this.firestoreStub&&!this._terminated?this.firestoreStub.then(stub=>{this._terminated=!0,stub.close(),this.locationsClient.close()}):Promise.resolve()}};__name(FirestoreClient,"FirestoreClient");exports2.FirestoreClient=FirestoreClient}});var require_v12=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/v1/index.js"(exports2,module2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.FirestoreAdminClient=exports2.FirestoreClient=void 0;var firestore_admin_client_1=require_firestore_admin_client();Object.defineProperty(exports2,"FirestoreAdminClient",{enumerable:!0,get:function(){return firestore_admin_client_1.FirestoreAdminClient}});var firestore_client_1=require_firestore_client2();Object.defineProperty(exports2,"FirestoreClient",{enumerable:!0,get:function(){return firestore_client_1.FirestoreClient}});var existingExports=module2.exports;module2.exports=firestore_client_1.FirestoreClient;module2.exports=Object.assign(module2.exports,existingExports)}});var require_src12=__commonJS({"../../../tmp/create-firestore-documentXXXXXXtszh1z/node_modules/@google-cloud/firestore/build/src/index.js"(exports2,module2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.Firestore=exports2.DEFAULT_MAX_TRANSACTION_ATTEMPTS=exports2.MAX_REQUEST_RETRIES=exports2.Aggregate=exports2.AggregateField=exports2.setLogFunction=exports2.QueryPartition=exports2.CollectionGroup=exports2.GeoPoint=exports2.FieldPath=exports2.DocumentChange=exports2.Timestamp=exports2.Transaction=exports2.WriteResult=exports2.WriteBatch=exports2.Filter=exports2.FieldValue=exports2.QueryDocumentSnapshot=exports2.DocumentSnapshot=exports2.BulkWriter=exports2.Query=exports2.QuerySnapshot=exports2.DocumentReference=exports2.CollectionReference=void 0;var stream_1=require("stream"),url_1=require("url"),backoff_1=require_backoff(),bulk_writer_1=require_bulk_writer(),bundle_1=require_bundle(),convert_1=require_convert(),document_reader_1=require_document_reader(),document_1=require_document(),logger_1=require_logger(),path_1=require_path2(),pool_1=require_pool2(),reference_1=require_reference(),serializer_1=require_serializer(),timestamp_1=require_timestamp2(),transaction_1=require_transaction(),util_1=require_util6(),validate_1=require_validate(),write_batch_1=require_write_batch(),firestore_client_config_json_1=require_firestore_client_config(),serviceConfig=firestore_client_config_json_1.interfaces["google.firestore.v1.Firestore"],collection_group_1=require_collection_group();Object.defineProperty(exports2,"CollectionGroup",{enumerable:!0,get:function(){return collection_group_1.CollectionGroup}});var recursive_delete_1=require_recursive_delete(),querystring_1=require("querystring"),reference_2=require_reference();Object.defineProperty(exports2,"CollectionReference",{enumerable:!0,get:function(){return reference_2.CollectionReference}});Object.defineProperty(exports2,"DocumentReference",{enumerable:!0,get:function(){return reference_2.DocumentReference}});Object.defineProperty(exports2,"QuerySnapshot",{enumerable:!0,get:function(){return reference_2.QuerySnapshot}});Object.defineProperty(exports2,"Query",{enumerable:!0,get:function(){return reference_2.Query}});var bulk_writer_2=require_bulk_writer();Object.defineProperty(exports2,"BulkWriter",{enumerable:!0,get:function(){return bulk_writer_2.BulkWriter}});var document_2=require_document();Object.defineProperty(exports2,"DocumentSnapshot",{enumerable:!0,get:function(){return document_2.DocumentSnapshot}});Object.defineProperty(exports2,"QueryDocumentSnapshot",{enumerable:!0,get:function(){return document_2.QueryDocumentSnapshot}});var field_value_1=require_field_value();Object.defineProperty(exports2,"FieldValue",{enumerable:!0,get:function(){return field_value_1.FieldValue}});var filter_1=require_filter();Object.defineProperty(exports2,"Filter",{enumerable:!0,get:function(){return filter_1.Filter}});var write_batch_2=require_write_batch();Object.defineProperty(exports2,"WriteBatch",{enumerable:!0,get:function(){return write_batch_2.WriteBatch}});Object.defineProperty(exports2,"WriteResult",{enumerable:!0,get:function(){return write_batch_2.WriteResult}});var transaction_2=require_transaction();Object.defineProperty(exports2,"Transaction",{enumerable:!0,get:function(){return transaction_2.Transaction}});var timestamp_2=require_timestamp2();Object.defineProperty(exports2,"Timestamp",{enumerable:!0,get:function(){return timestamp_2.Timestamp}});var document_change_1=require_document_change();Object.defineProperty(exports2,"DocumentChange",{enumerable:!0,get:function(){return document_change_1.DocumentChange}});var path_2=require_path2();Object.defineProperty(exports2,"FieldPath",{enumerable:!0,get:function(){return path_2.FieldPath}});var geo_point_1=require_geo_point();Object.defineProperty(exports2,"GeoPoint",{enumerable:!0,get:function(){return geo_point_1.GeoPoint}});var query_partition_1=require_query_partition();Object.defineProperty(exports2,"QueryPartition",{enumerable:!0,get:function(){return query_partition_1.QueryPartition}});var logger_2=require_logger();Object.defineProperty(exports2,"setLogFunction",{enumerable:!0,get:function(){return logger_2.setLogFunction}});var aggregate_1=require_aggregate();Object.defineProperty(exports2,"AggregateField",{enumerable:!0,get:function(){return aggregate_1.AggregateField}});Object.defineProperty(exports2,"Aggregate",{enumerable:!0,get:function(){return aggregate_1.Aggregate}});var libVersion=require_package5().version;(0,logger_1.setLibVersion)(libVersion);var CLOUD_RESOURCE_HEADER="google-cloud-resource-prefix";exports2.MAX_REQUEST_RETRIES=5;exports2.DEFAULT_MAX_TRANSACTION_ATTEMPTS=5;var DEFAULT_MAX_IDLE_CHANNELS=1;var MAX_CONCURRENT_REQUESTS_PER_CLIENT=100,Firestore2=class{getBulkWriter(){return this._bulkWriter||(this._bulkWriter=this.bulkWriter()),this._bulkWriter}constructor(settings){this._settings={},this._settingsFrozen=!1,this._serializer=null,this._projectId=void 0,this._databaseId=void 0,this.registeredListenersCount=0,this.bulkWritersCount=0;let libraryHeader={libName:"gccl",libVersion};settings&&settings.firebaseVersion&&(libraryHeader.libVersion+=" fire/"+settings.firebaseVersion),this.validateAndApplySettings({...settings,...libraryHeader});let retryConfig=serviceConfig.retry_params.default;this._backoffSettings={initialDelayMs:retryConfig.initial_retry_delay_millis,maxDelayMs:retryConfig.max_retry_delay_millis,backoffFactor:retryConfig.retry_delay_multiplier};let maxIdleChannels=this._settings.maxIdleChannels===void 0?DEFAULT_MAX_IDLE_CHANNELS:this._settings.maxIdleChannels;this._clientPool=new pool_1.ClientPool(MAX_CONCURRENT_REQUESTS_PER_CLIENT,maxIdleChannels,requiresGrpc=>{var _a;let client,useFallback=!this._settings.preferRest||requiresGrpc?!1:"rest",gax;if(useFallback?this._gaxFallback?gax=this._gaxFallback:gax=this._gaxFallback=require_fallback():this._gax?gax=this._gax:gax=this._gax=require_src11(),gax.routingHeader.fromParams=params=>(0,querystring_1.stringify)(params,void 0,void 0,{encodeURIComponent:val=>val.split("/").map(component=>encodeURIComponent(component)).join("/")}),this._settings.ssl===!1){let settings2={sslCreds:((_a=this._settings.grpc)!==null&&_a!==void 0?_a:require_src11().grpc).credentials.createInsecure(),...this._settings,fallback:useFallback};useFallback&&(settings2.protocol="http"),client=new module2.exports.v1(settings2,gax)}else client=new module2.exports.v1({...this._settings,fallback:useFallback},gax);return(0,logger_1.logger)("clientFactory",null,"Initialized Firestore GAPIC Client (useFallback: %s)",useFallback),client},client=>client.close()),(0,logger_1.logger)("Firestore",null,"Initialized Firestore")}settings(settings){if((0,validate_1.validateObject)("settings",settings),(0,validate_1.validateString)("settings.projectId",settings.projectId,{optional:!0}),(0,validate_1.validateString)("settings.databaseId",settings.databaseId,{optional:!0}),this._settingsFrozen)throw new Error("Firestore has already been initialized. You can only call settings() once, and only before calling any other methods on a Firestore object.");let mergedSettings={...this._settings,...settings};this.validateAndApplySettings(mergedSettings),this._settingsFrozen=!0}validateAndApplySettings(settings){var _a;settings.projectId!==void 0&&((0,validate_1.validateString)("settings.projectId",settings.projectId),this._projectId=settings.projectId),settings.databaseId!==void 0&&((0,validate_1.validateString)("settings.databaseId",settings.databaseId),this._databaseId=settings.databaseId);let url=null,preferRestEnvValue=(0,util_1.tryGetPreferRestEnvironmentVariable)();settings.preferRest===void 0&&preferRestEnvValue!==void 0&&(settings={...settings,preferRest:preferRestEnvValue}),process.env.FIRESTORE_EMULATOR_HOST?((0,validate_1.validateHost)("FIRESTORE_EMULATOR_HOST",process.env.FIRESTORE_EMULATOR_HOST),settings={...settings,host:process.env.FIRESTORE_EMULATOR_HOST,ssl:!1},url=new url_1.URL(`http://${settings.host}`)):settings.host!==void 0&&((0,validate_1.validateHost)("settings.host",settings.host),url=new url_1.URL(`http://${settings.host}`)),url!==null&&((settings.servicePath!==void 0&&settings.servicePath!==url.hostname||settings.apiEndpoint!==void 0&&settings.apiEndpoint!==url.hostname)&&console.warn(`The provided host (${url.hostname}) in "settings" does not match the existing host (${(_a=settings.servicePath)!==null&&_a!==void 0?_a:settings.apiEndpoint}). Using the provided host.`),settings.servicePath=url.hostname,url.port!==""&&settings.port===void 0&&(settings.port=Number(url.port)),delete settings.host,delete settings.apiEndpoint),settings.ssl!==void 0&&(0,validate_1.validateBoolean)("settings.ssl",settings.ssl),settings.maxIdleChannels!==void 0&&(0,validate_1.validateInteger)("settings.maxIdleChannels",settings.maxIdleChannels,{minValue:0}),this._settings=settings,this._settings.toJson=function(){let temp=Object.assign({},this);return temp.credentials&&(temp.credentials={private_key:"***",client_email:"***"}),temp},this._serializer=new serializer_1.Serializer(this)}get projectId(){if(this._projectId===void 0)throw new Error("INTERNAL ERROR: Client is not yet ready to issue requests.");return this._projectId}get databaseId(){return this._databaseId||path_1.DEFAULT_DATABASE_ID}get formattedName(){return`projects/${this.projectId}/databases/${this.databaseId}`}doc(documentPath){(0,path_1.validateResourcePath)("documentPath",documentPath);let path=path_1.ResourcePath.EMPTY.append(documentPath);if(!path.isDocument)throw new Error(`Value for argument "documentPath" must point to a document, but was "${documentPath}". Your path does not contain an even number of components.`);return new reference_1.DocumentReference(this,path)}collection(collectionPath){(0,path_1.validateResourcePath)("collectionPath",collectionPath);let path=path_1.ResourcePath.EMPTY.append(collectionPath);if(!path.isCollection)throw new Error(`Value for argument "collectionPath" must point to a collection, but was "${collectionPath}". Your path does not contain an odd number of components.`);return new reference_1.CollectionReference(this,path)}collectionGroup(collectionId){if(collectionId.indexOf("/")!==-1)throw new Error(`Invalid collectionId '${collectionId}'. Collection IDs must not contain '/'.`);return new collection_group_1.CollectionGroup(this,collectionId,void 0)}batch(){return new write_batch_1.WriteBatch(this)}bulkWriter(options){return new bulk_writer_1.BulkWriter(this,options)}snapshot_(documentOrName,readTime,encoding){let convertTimestamp,convertFields;if(encoding===void 0||encoding==="protobufJS")convertTimestamp=__name(data=>data,"convertTimestamp"),convertFields=__name(data=>data,"convertFields");else if(encoding==="json")convertTimestamp=convert_1.timestampFromJson,convertFields=convert_1.fieldsFromJson;else throw new Error(`Unsupported encoding format. Expected "json" or "protobufJS", but was "${encoding}".`);let ref,document2;return typeof documentOrName=="string"?(ref=new reference_1.DocumentReference(this,path_1.QualifiedResourcePath.fromSlashSeparatedString(documentOrName)),document2=new document_1.DocumentSnapshotBuilder(ref)):(ref=new reference_1.DocumentReference(this,path_1.QualifiedResourcePath.fromSlashSeparatedString(documentOrName.name)),document2=new document_1.DocumentSnapshotBuilder(ref),document2.fieldsProto=documentOrName.fields?convertFields(documentOrName.fields):{},document2.createTime=timestamp_1.Timestamp.fromProto(convertTimestamp(documentOrName.createTime,"documentOrName.createTime")),document2.updateTime=timestamp_1.Timestamp.fromProto(convertTimestamp(documentOrName.updateTime,"documentOrName.updateTime"))),readTime&&(document2.readTime=timestamp_1.Timestamp.fromProto(convertTimestamp(readTime,"readTime"))),document2.build()}bundle(name){return new bundle_1.BundleBuilder(name||(0,util_1.autoId)())}runTransaction(updateFunction,transactionOptions){(0,validate_1.validateFunction)("updateFunction",updateFunction);let tag=(0,util_1.requestTag)(),maxAttempts=exports2.DEFAULT_MAX_TRANSACTION_ATTEMPTS,readOnly=!1,readTime;transactionOptions&&((0,validate_1.validateObject)("transactionOptions",transactionOptions),(0,validate_1.validateBoolean)("transactionOptions.readOnly",transactionOptions.readOnly,{optional:!0}),transactionOptions.readOnly?((0,validate_1.validateTimestamp)("transactionOptions.readTime",transactionOptions.readTime,{optional:!0}),readOnly=!0,readTime=transactionOptions.readTime,maxAttempts=1):((0,validate_1.validateInteger)("transactionOptions.maxAttempts",transactionOptions.maxAttempts,{optional:!0,minValue:1}),maxAttempts=transactionOptions.maxAttempts||exports2.DEFAULT_MAX_TRANSACTION_ATTEMPTS));let transaction=new transaction_1.Transaction(this,tag);return this.initializeIfNeeded(tag).then(()=>transaction.runTransaction(updateFunction,{maxAttempts,readOnly,readTime}))}listCollections(){return new reference_1.DocumentReference(this,path_1.ResourcePath.EMPTY).listCollections()}getAll(...documentRefsOrReadOptions){(0,validate_1.validateMinNumberOfArguments)("Firestore.getAll",documentRefsOrReadOptions,1);let{documents,fieldMask}=(0,transaction_1.parseGetAllArguments)(documentRefsOrReadOptions),tag=(0,util_1.requestTag)(),stack=Error().stack;return this.initializeIfNeeded(tag).then(()=>{let reader=new document_reader_1.DocumentReader(this,documents);return reader.fieldMask=fieldMask||void 0,reader.get(tag)}).catch(err=>{throw(0,util_1.wrapError)(err,stack)})}registerListener(){this.registeredListenersCount+=1}unregisterListener(){this.registeredListenersCount-=1}_incrementBulkWritersCount(){this.bulkWritersCount+=1}_decrementBulkWritersCount(){this.bulkWritersCount-=1}recursiveDelete(ref,bulkWriter){return this._recursiveDelete(ref,recursive_delete_1.RECURSIVE_DELETE_MAX_PENDING_OPS,recursive_delete_1.RECURSIVE_DELETE_MIN_PENDING_OPS,bulkWriter)}_recursiveDelete(ref,maxPendingOps,minPendingOps,bulkWriter){let writer=bulkWriter??this.getBulkWriter();return new recursive_delete_1.RecursiveDelete(this,writer,ref,maxPendingOps,minPendingOps).run()}terminate(){return this.registeredListenersCount>0||this.bulkWritersCount>0?Promise.reject(`All onSnapshot() listeners must be unsubscribed, and all BulkWriter instances must be closed before terminating the client. There are ${this.registeredListenersCount} active listeners and ${this.bulkWritersCount} open BulkWriter instances.`):this._clientPool.terminate()}toJSON(){return{projectId:this._projectId}}async initializeIfNeeded(requestTag){if(this._settingsFrozen=!0,this._settings.ssl===!1&&(this._settings.customHeaders={Authorization:"Bearer owner",...this._settings.customHeaders}),this._projectId===void 0)try{this._projectId=await this._clientPool.run(requestTag,!1,gapicClient=>gapicClient.getProjectId()),(0,logger_1.logger)("Firestore.initializeIfNeeded",null,"Detected project ID: %s",this._projectId)}catch(err){return(0,logger_1.logger)("Firestore.initializeIfNeeded",null,"Failed to detect project ID: %s",err),Promise.reject(err)}}createCallOptions(methodName,retryCodes){var _a;let callOptions={otherArgs:{headers:{[CLOUD_RESOURCE_HEADER]:this.formattedName,...this._settings.customHeaders,...(_a=this._settings[methodName])===null||_a===void 0?void 0:_a.customHeaders}}};if(retryCodes){let retryParams=(0,util_1.getRetryParams)(methodName);callOptions.retry=new(require_fallback()).RetryOptions(retryCodes,retryParams)}return callOptions}async _retry(methodName,requestTag,func){let backoff=new backoff_1.ExponentialBackoff,lastError;for(let attempt=0;attempt{function streamReady(){streamInitialized||(streamInitialized=!0,(0,logger_1.logger)("Firestore._initializeStream",requestTag,"Releasing stream"),resolve(resultStream))}__name(streamReady,"streamReady");function streamEnded(){(0,logger_1.logger)("Firestore._initializeStream",requestTag,"Received stream end"),resultStream.unpipe(backendStream),resolve(resultStream),lifetime.resolve()}__name(streamEnded,"streamEnded");function streamFailed(err){streamInitialized?((0,logger_1.logger)("Firestore._initializeStream",requestTag,"Received stream error:",err),setImmediate(()=>{resultStream.emit("error",err)})):((0,logger_1.logger)("Firestore._initializeStream",requestTag,"Received initial error:",err),reject(err))}__name(streamFailed,"streamFailed"),backendStream.on("data",()=>streamReady()),backendStream.on("error",err=>streamFailed(err)),backendStream.on("end",()=>streamEnded()),backendStream.on("close",()=>streamEnded()),backendStream.on("finish",()=>streamEnded()),backendStream.pipe(resultStream),request&&((0,logger_1.logger)("Firestore._initializeStream",requestTag,"Sending request: %j",request),backendStream.write(request,"utf-8",err=>{err?streamFailed(err):((0,logger_1.logger)("Firestore._initializeStream",requestTag,"Marking stream as healthy"),streamReady())}))})}request(methodName,request,requestTag,retryCodes){let callOptions=this.createCallOptions(methodName,retryCodes);return this._clientPool.run(requestTag,!1,async gapicClient=>{try{(0,logger_1.logger)("Firestore.request",requestTag,"Sending request: %j",request);let[result]=await gapicClient[methodName](request,callOptions);return(0,logger_1.logger)("Firestore.request",requestTag,"Received response: %j",result),result}catch(err){return(0,logger_1.logger)("Firestore.request",requestTag,"Received error:",err),Promise.reject(err)}})}requestStream(methodName,bidrectional,request,requestTag){let callOptions=this.createCallOptions(methodName),bidirectional=methodName==="listen";return this._retry(methodName,requestTag,()=>{let result=new util_1.Deferred;return this._clientPool.run(requestTag,bidrectional,async gapicClient=>{(0,logger_1.logger)("Firestore.requestStream",requestTag,"Sending request: %j",request);try{let stream=bidirectional?gapicClient[methodName](callOptions):gapicClient[methodName](request,callOptions),logStream=new stream_1.Transform({objectMode:!0,transform:(chunk,encoding,callback)=>{(0,logger_1.logger)("Firestore.requestStream",requestTag,"Received response: %j",chunk),callback()}});stream.pipe(logStream);let lifetime=new util_1.Deferred,resultStream=await this._initializeStream(stream,lifetime,requestTag,bidirectional?request:void 0);return resultStream.on("end",()=>stream.end()),result.resolve(resultStream),lifetime.promise}catch(e){result.reject(e)}}),result.promise})}};__name(Firestore2,"Firestore");exports2.Firestore=Firestore2;exports2.default=Firestore2;var existingExports=module2.exports;module2.exports=Firestore2;module2.exports=Object.assign(module2.exports,existingExports);Object.defineProperty(module2.exports,"v1beta1",{get:()=>require_v1beta12()});Object.defineProperty(module2.exports,"v1",{get:()=>require_v12()});Object.defineProperty(module2.exports,"GrpcStatus",{get:()=>require_src11().Status})}});var create_firestore_documentXXXXXXtszh1z_exports={};__export(create_firestore_documentXXXXXXtszh1z_exports,{default:()=>createDocument});module.exports=__toCommonJS(create_firestore_documentXXXXXXtszh1z_exports);var import_firestore=__toESM(require_src12());function convertDataToReferences(firestore,data){let convertedData={};for(let key in data){let value=data[key];if(value instanceof Date)convertedData[key]=import_firestore.Timestamp.fromDate(value);else if(typeof value=="string"&&value.includes("/")&&value.startsWith("_ref:")){let path=value.split("_ref:")[1];try{let ref=firestore.doc(path);ref instanceof import_firestore.DocumentReference?convertedData[key]=ref:convertedData[key]=value}catch{convertedData[key]=value}}else typeof value=="object"&&value!==null?convertedData[key]=convertDataToReferences(firestore,value):convertedData[key]=value}return convertedData}__name(convertDataToReferences,"convertDataToReferences");async function createDocument({collectionName,id,data,merge,projectId}){console.log("createDocument");let firestore=new import_firestore.Firestore(projectId&&projectId.length>1?{projectId:projectId.trim()}:void 0),convertedData=convertDataToReferences(firestore,data);if(id)return await firestore.collection(collectionName).doc(id).set(convertedData,{merge}),{id,path:`${collectionName}/${id}`,status:"success!"};{let ref=await firestore.collection(collectionName).add(convertedData);return{id:ref.id,path:ref.path,status:"success!"}}}__name(createDocument,"createDocument"); /*! Bundled license information: safe-buffer/index.js: (*! safe-buffer. MIT License. Feross Aboukhadijeh *) @google-cloud/firestore/build/src/util.js: (*! * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @google-cloud/firestore/build/src/timestamp.js: (*! * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) (*! * Number of nanoseconds in a millisecond. * * @type {number} *) (*! * The minimum legal value for the "seconds" property of a Timestamp object. * * This value corresponds to 0001-01-01T00:00:00Z. * * @type {number} *) (*! * The maximum legal value for the "seconds" property of a Timestamp object. * * This value corresponds to 9999-12-31T23:59:59.999999999Z. * * @type {number} *) @google-cloud/firestore/build/src/validate.js: (*! * Copyright 2017 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @google-cloud/firestore/build/src/logger.js: (*! * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) (*! The Firestore library version *) (*! The external function used to emit logs. *) @google-cloud/firestore/build/src/backoff.js: (*! * Copyright 2017 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) (*! * The default initial backoff time in milliseconds after an error. * Set to 1s according to https://cloud.google.com/apis/design/errors. *) (*! * The default maximum backoff time in milliseconds. *) (*! * The default factor to increase the backup by after each failed attempt. *) (*! * The default jitter to distribute the backoff attempts by (0 means no * randomization, 1.0 means +/-50% randomization). *) (*! * The maximum number of retries that will be attempted by backoff * before stopping all retry attempts. *) (*! * The timeout handler used by `ExponentialBackoff` and `BulkWriter`. *) @google-cloud/firestore/build/src/rate-limiter.js: (*! * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @google-cloud/firestore/build/src/convert.js: (*! * Copyright 2019 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) (*! * @module firestore/convert * @private * @internal * * This module contains utility functions to convert * `firestore.v1.Documents` from Proto3 JSON to their equivalent * representation in Protobuf JS. Protobuf JS is the only encoding supported by * this client, and dependencies that use Proto3 JSON (such as the Google Cloud * Functions SDK) are supported through this conversion and its usage in * {@see Firestore#snapshot_}. *) @google-cloud/firestore/build/src/geo-point.js: (*! * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @google-cloud/firestore/build/src/path.js: (*! * Copyright 2017 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) (*! * The default database ID for this Firestore client. We do not yet expose the * ability to use different databases. *) (*! * A regular expression to verify an absolute Resource Path in Firestore. It * extracts the project ID, the database name and the relative resource path * if available. * * @type {RegExp} *) (*! * A regular expression to verify whether a field name can be passed to the * backend without escaping. * * @type {RegExp} *) (*! * A regular expression to verify field paths that are passed to the API as * strings. Field paths that do not match this expression have to be provided * as a [FieldPath]{@link FieldPath} object. * * @type {RegExp} *) @google-cloud/firestore/build/src/serializer.js: (*! * Copyright 2019 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @google-cloud/firestore/build/src/field-value.js: (*! * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @google-cloud/firestore/build/src/document-change.js: (*! * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @google-cloud/firestore/build/src/order.js: (*! * Copyright 2017 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) (*! * The type order as defined by the backend. *) (*! * @private * @internal *) (*! * Utility function to compare doubles (using Firestore semantics for NaN). * @private * @internal *) @google-cloud/firestore/build/src/types.js: (*! * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @google-cloud/firestore/build/src/filter.js: (*! * Copyright 2023 Google LLC. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @google-cloud/firestore/build/src/aggregate.js: (** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @grpc/proto-loader/build/src/util.js: (** * @license * Copyright 2018 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *) long/umd/index.js: (** * @license * Copyright 2009 The Closure Library Authors * Copyright 2020 Daniel Wirtz / The long.js Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0 *) @grpc/proto-loader/build/src/index.js: (** * @license * Copyright 2018 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *) @google-cloud/firestore/build/src/watch.js: (*! * Copyright 2017 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) (*! * Target ID used by watch. Watch uses a fixed target id since we only support * one target per stream. * @type {number} *) (*! * Idle timeout used to detect Watch streams that stall (see * https://github.com/googleapis/nodejs-firestore/issues/1057, b/156308554). * Under normal load, the Watch backend will send a TARGET_CHANGE message * roughly every 30 seconds. As discussed with the backend team, we reset the * Watch stream if we do not receive any message within 120 seconds. *) (*! * Sentinel value for a document remove. *) (*! * The change type for document change events. *) (*! * The comparator used for document watches (which should always get called with * the same document). *) @google-cloud/firestore/build/src/reference.js: (*! * Copyright 2017 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) (*! * Denotes whether a provided limit is applied to the beginning or the end of * the result set. *) @google-cloud/firestore/build/src/document.js: (*! * Copyright 2019 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) (*! * Applies this DocumentMask to 'data' and computes the list of field paths * that were specified in the mask but are not present in 'data'. *) @google-cloud/firestore/build/src/write-batch.js: (*! * Copyright 2019 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @google-cloud/firestore/build/src/bulk-writer.js: (*! * The maximum number of writes that can be in a single batch. *) (*! * The maximum number of writes can be can in a single batch that is being retried. *) (*! * The starting maximum number of operations per second as allowed by the * 500/50/5 rule. * * https://firebase.google.com/docs/firestore/best-practices#ramping_up_traffic. *) (*! * The maximum number of operations per second as allowed by the 500/50/5 rule. * By default the rate limiter will not exceed this value. * * https://firebase.google.com/docs/firestore/best-practices#ramping_up_traffic. *) (*! * The default jitter to apply to the exponential backoff used in retries. For * example, a factor of 0.3 means a 30% jitter is applied. *) (*! * The rate by which to increase the capacity as specified by the 500/50/5 rule. *) (*! * How often the operations per second capacity should increase in milliseconds * as specified by the 500/50/5 rule. *) (*! * The default maximum number of pending operations that can be enqueued onto a * BulkWriter instance. An operation is considered pending if BulkWriter has * sent it via RPC and is awaiting the result. BulkWriter buffers additional * writes after this many pending operations in order to avoiding going OOM. *) @google-cloud/firestore/build/src/document-reader.js: (*! * Copyright 2021 Google LLC. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @google-cloud/firestore/build/src/pool.js: (*! * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) @google-cloud/firestore/build/src/transaction.js: (*! * Copyright 2017 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) (*! * Error message for transactional reads that were executed after performing * writes. *) @google-cloud/firestore/build/src/recursive-delete.js: (*! * Datastore allowed numeric IDs where Firestore only allows strings. Numeric * IDs are exposed to Firestore as __idNUM__, so this is the lowest possible * negative numeric value expressed in that format. * * This constant is used to specify startAt/endAt values when querying for all * descendants in a single collection. *) (*! * The query limit used for recursive deletes when fetching all descendants of * the specified reference to delete. This is done to prevent the query stream * from streaming documents faster than Firestore can delete. *) (*! * The number of pending BulkWriter operations at which RecursiveDelete * starts the next limit query to fetch descendants. By starting the query * while there are pending operations, Firestore can improve BulkWriter * throughput. This helps prevent BulkWriter from idling while Firestore * fetches the next query. *) @google-cloud/firestore/build/src/index.js: (*! * Copyright 2017 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *) (*! * DO NOT REMOVE THE FOLLOWING NAMESPACE DEFINITIONS *) (*! * HTTP header for the resource prefix to improve routing and project isolation * by the backend. *) (*! * The default number of idle GRPC channel to keep. *) (*! * The maximum number of concurrent requests supported by a single GRPC channel, * as enforced by Google's Frontend. If the SDK issues more than 100 concurrent * operations, we need to use more than one GAPIC client since these clients * multiplex all requests over a single channel. *) */