@oceanum/datamesh 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -6,4 +6,4 @@
6
6
  Use "options.replacer" or "options.ignoreUnknown"
7
7
  `)},_domwindow:function(){return S("domwindow")},_bigint:function(w){return S("bigint:"+w.toString())},_process:function(){return S("process")},_timer:function(){return S("timer")},_pipe:function(){return S("pipe")},_tcp:function(){return S("tcp")},_udp:function(){return S("udp")},_tty:function(){return S("tty")},_statwatcher:function(){return S("statwatcher")},_securecontext:function(){return S("securecontext")},_connection:function(){return S("connection")},_zlib:function(){return S("zlib")},_context:function(){return S("context")},_nodescript:function(){return S("nodescript")},_httpparser:function(){return S("httpparser")},_dataview:function(){return S("dataview")},_signal:function(){return S("signal")},_fsevent:function(){return S("fsevent")},_tlswrap:function(){return S("tlswrap")}}}function W(){return{buf:"",write:function(A){this.buf+=A},end:function(A){this.buf+=A},read:function(){return this.buf}}}s.writeToStream=function(A,N,m){return m===void 0&&(m=N,N={}),z(N=C(A,N),m).dispatch(A)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){(function(E){var L=typeof Uint8Array<"u"?Uint8Array:Array,F=43,k=47,C=48,U=97,z=65,W=45,A=95;function N(m){return m=m.charCodeAt(0),m===F||m===W?62:m===k||m===A?63:m<C?-1:m<C+10?m-C+26+26:m<z+26?m-z:m<U+26?m-U+26:void 0}E.toByteArray=function(m){var S,w;if(0<m.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var v=m.length,v=m.charAt(v-2)==="="?2:m.charAt(v-1)==="="?1:0,O=new L(3*m.length/4-v),Q=0<v?m.length-4:m.length,j=0;function P(D){O[j++]=D}for(S=0;S<Q;S+=4,0)P((16711680&(w=N(m.charAt(S))<<18|N(m.charAt(S+1))<<12|N(m.charAt(S+2))<<6|N(m.charAt(S+3))))>>16),P((65280&w)>>8),P(255&w);return v==2?P(255&(w=N(m.charAt(S))<<2|N(m.charAt(S+1))>>4)):v==1&&(P((w=N(m.charAt(S))<<10|N(m.charAt(S+1))<<4|N(m.charAt(S+2))>>2)>>8&255),P(255&w)),O},E.fromByteArray=function(m){var S,w,v,O,Q=m.length%3,j="";function P(D){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(D)}for(S=0,v=m.length-Q;S<v;S+=3)w=(m[S]<<16)+(m[S+1]<<8)+m[S+2],j+=P((O=w)>>18&63)+P(O>>12&63)+P(O>>6&63)+P(63&O);switch(Q){case 1:j=(j+=P((w=m[m.length-1])>>2))+P(w<<4&63)+"==";break;case 2:j=(j=(j+=P((w=(m[m.length-2]<<8)+m[m.length-1])>>10))+P(w>>4&63))+P(w<<2&63)+"="}return j}})(s===void 0?this.base64js={}:s)}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(e,n,s){(function(i,c,F,d,f,y,B,R,x){var E=e("base64-js"),L=e("ieee754");function F(g,_,M){if(!(this instanceof F))return new F(g,_,M);var V,$,J,bt,Ot=typeof g;if(_==="base64"&&Ot=="string")for(g=(bt=g).trim?bt.trim():bt.replace(/^\s+|\s+$/g,"");g.length%4!=0;)g+="=";if(Ot=="number")V=G(g);else if(Ot=="string")V=F.byteLength(g,_);else{if(Ot!="object")throw new Error("First argument needs to be a number, array or string.");V=G(g.length)}if(F._useTypedArrays?$=F._augment(new Uint8Array(V)):(($=this).length=V,$._isBuffer=!0),F._useTypedArrays&&typeof g.byteLength=="number")$._set(g);else if(X(bt=g)||F.isBuffer(bt)||bt&&typeof bt=="object"&&typeof bt.length=="number")for(J=0;J<V;J++)F.isBuffer(g)?$[J]=g.readUInt8(J):$[J]=g[J];else if(Ot=="string")$.write(g,0,_);else if(Ot=="number"&&!F._useTypedArrays&&!M)for(J=0;J<V;J++)$[J]=0;return $}function k(g,_,M,V){return F._charsWritten=At((function($){for(var J=[],bt=0;bt<$.length;bt++)J.push(255&$.charCodeAt(bt));return J})(_),g,M,V)}function C(g,_,M,V){return F._charsWritten=At((function($){for(var J,bt,Ot=[],kt=0;kt<$.length;kt++)bt=$.charCodeAt(kt),J=bt>>8,bt=bt%256,Ot.push(bt),Ot.push(J);return Ot})(_),g,M,V)}function U(g,_,M){var V="";M=Math.min(g.length,M);for(var $=_;$<M;$++)V+=String.fromCharCode(g[$]);return V}function z(g,_,M,J){J||(Z(typeof M=="boolean","missing or invalid endian"),Z(_!=null,"missing offset"),Z(_+1<g.length,"Trying to read beyond buffer length"));var $,J=g.length;if(!(J<=_))return M?($=g[_],_+1<J&&($|=g[_+1]<<8)):($=g[_]<<8,_+1<J&&($|=g[_+1])),$}function W(g,_,M,J){J||(Z(typeof M=="boolean","missing or invalid endian"),Z(_!=null,"missing offset"),Z(_+3<g.length,"Trying to read beyond buffer length"));var $,J=g.length;if(!(J<=_))return M?(_+2<J&&($=g[_+2]<<16),_+1<J&&($|=g[_+1]<<8),$|=g[_],_+3<J&&($+=g[_+3]<<24>>>0)):(_+1<J&&($=g[_+1]<<16),_+2<J&&($|=g[_+2]<<8),_+3<J&&($|=g[_+3]),$+=g[_]<<24>>>0),$}function A(g,_,M,V){if(V||(Z(typeof M=="boolean","missing or invalid endian"),Z(_!=null,"missing offset"),Z(_+1<g.length,"Trying to read beyond buffer length")),!(g.length<=_))return V=z(g,_,M,!0),32768&V?-1*(65535-V+1):V}function N(g,_,M,V){if(V||(Z(typeof M=="boolean","missing or invalid endian"),Z(_!=null,"missing offset"),Z(_+3<g.length,"Trying to read beyond buffer length")),!(g.length<=_))return V=W(g,_,M,!0),2147483648&V?-1*(4294967295-V+1):V}function m(g,_,M,V){return V||(Z(typeof M=="boolean","missing or invalid endian"),Z(_+3<g.length,"Trying to read beyond buffer length")),L.read(g,_,M,23,4)}function S(g,_,M,V){return V||(Z(typeof M=="boolean","missing or invalid endian"),Z(_+7<g.length,"Trying to read beyond buffer length")),L.read(g,_,M,52,8)}function w(g,_,M,V,$){if($||(Z(_!=null,"missing value"),Z(typeof V=="boolean","missing or invalid endian"),Z(M!=null,"missing offset"),Z(M+1<g.length,"trying to write beyond buffer length"),Pt(_,65535)),$=g.length,!($<=M))for(var J=0,bt=Math.min($-M,2);J<bt;J++)g[M+J]=(_&255<<8*(V?J:1-J))>>>8*(V?J:1-J)}function v(g,_,M,V,$){if($||(Z(_!=null,"missing value"),Z(typeof V=="boolean","missing or invalid endian"),Z(M!=null,"missing offset"),Z(M+3<g.length,"trying to write beyond buffer length"),Pt(_,4294967295)),$=g.length,!($<=M))for(var J=0,bt=Math.min($-M,4);J<bt;J++)g[M+J]=_>>>8*(V?J:3-J)&255}function O(g,_,M,V,$){$||(Z(_!=null,"missing value"),Z(typeof V=="boolean","missing or invalid endian"),Z(M!=null,"missing offset"),Z(M+1<g.length,"Trying to write beyond buffer length"),Gt(_,32767,-32768)),g.length<=M||w(g,0<=_?_:65535+_+1,M,V,$)}function Q(g,_,M,V,$){$||(Z(_!=null,"missing value"),Z(typeof V=="boolean","missing or invalid endian"),Z(M!=null,"missing offset"),Z(M+3<g.length,"Trying to write beyond buffer length"),Gt(_,2147483647,-2147483648)),g.length<=M||v(g,0<=_?_:4294967295+_+1,M,V,$)}function j(g,_,M,V,$){$||(Z(_!=null,"missing value"),Z(typeof V=="boolean","missing or invalid endian"),Z(M!=null,"missing offset"),Z(M+3<g.length,"Trying to write beyond buffer length"),Yt(_,34028234663852886e22,-34028234663852886e22)),g.length<=M||L.write(g,_,M,V,23,4)}function P(g,_,M,V,$){$||(Z(_!=null,"missing value"),Z(typeof V=="boolean","missing or invalid endian"),Z(M!=null,"missing offset"),Z(M+7<g.length,"Trying to write beyond buffer length"),Yt(_,17976931348623157e292,-17976931348623157e292)),g.length<=M||L.write(g,_,M,V,52,8)}s.Buffer=F,s.SlowBuffer=F,s.INSPECT_MAX_BYTES=50,F.poolSize=8192,F._useTypedArrays=(function(){try{var g=new ArrayBuffer(0),_=new Uint8Array(g);return _.foo=function(){return 42},_.foo()===42&&typeof _.subarray=="function"}catch{return!1}})(),F.isEncoding=function(g){switch(String(g).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},F.isBuffer=function(g){return!(g==null||!g._isBuffer)},F.byteLength=function(g,_){var M;switch(g+="",_||"utf8"){case"hex":M=g.length/2;break;case"utf8":case"utf-8":M=q(g).length;break;case"ascii":case"binary":case"raw":M=g.length;break;case"base64":M=rt(g).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":M=2*g.length;break;default:throw new Error("Unknown encoding")}return M},F.concat=function(g,_){if(Z(X(g),`Usage: Buffer.concat(list, [totalLength])
8
8
  list should be an Array.`),g.length===0)return new F(0);if(g.length===1)return g[0];if(typeof _!="number")for($=_=0;$<g.length;$++)_+=g[$].length;for(var M=new F(_),V=0,$=0;$<g.length;$++){var J=g[$];J.copy(M,V),V+=J.length}return M},F.prototype.write=function(g,_,M,V){isFinite(_)?isFinite(M)||(V=M,M=void 0):(kt=V,V=_,_=M,M=kt),_=Number(_)||0;var $,J,bt,Ot,kt=this.length-_;switch((!M||kt<(M=Number(M)))&&(M=kt),V=String(V||"utf8").toLowerCase()){case"hex":$=(function(Ht,Wt,$t,Nt){$t=Number($t)||0;var mt=Ht.length-$t;(!Nt||mt<(Nt=Number(Nt)))&&(Nt=mt),Z((mt=Wt.length)%2==0,"Invalid hex string"),mt/2<Nt&&(Nt=mt/2);for(var Qt=0;Qt<Nt;Qt++){var or=parseInt(Wt.substr(2*Qt,2),16);Z(!isNaN(or),"Invalid hex string"),Ht[$t+Qt]=or}return F._charsWritten=2*Qt,Qt})(this,g,_,M);break;case"utf8":case"utf-8":J=this,bt=_,Ot=M,$=F._charsWritten=At(q(g),J,bt,Ot);break;case"ascii":case"binary":$=k(this,g,_,M);break;case"base64":J=this,bt=_,Ot=M,$=F._charsWritten=At(rt(g),J,bt,Ot);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":$=C(this,g,_,M);break;default:throw new Error("Unknown encoding")}return $},F.prototype.toString=function(g,_,M){var V,$,J,bt,Ot=this;if(g=String(g||"utf8").toLowerCase(),_=Number(_)||0,(M=M!==void 0?Number(M):Ot.length)===_)return"";switch(g){case"hex":V=(function(kt,Ht,Wt){var $t=kt.length;(!Ht||Ht<0)&&(Ht=0),(!Wt||Wt<0||$t<Wt)&&(Wt=$t);for(var Nt="",mt=Ht;mt<Wt;mt++)Nt+=K(kt[mt]);return Nt})(Ot,_,M);break;case"utf8":case"utf-8":V=(function(kt,Ht,Wt){var $t="",Nt="";Wt=Math.min(kt.length,Wt);for(var mt=Ht;mt<Wt;mt++)kt[mt]<=127?($t+=Ut(Nt)+String.fromCharCode(kt[mt]),Nt=""):Nt+="%"+kt[mt].toString(16);return $t+Ut(Nt)})(Ot,_,M);break;case"ascii":case"binary":V=U(Ot,_,M);break;case"base64":$=Ot,bt=M,V=(J=_)===0&&bt===$.length?E.fromByteArray($):E.fromByteArray($.slice(J,bt));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":V=(function(kt,Ht,Wt){for(var $t=kt.slice(Ht,Wt),Nt="",mt=0;mt<$t.length;mt+=2)Nt+=String.fromCharCode($t[mt]+256*$t[mt+1]);return Nt})(Ot,_,M);break;default:throw new Error("Unknown encoding")}return V},F.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},F.prototype.copy=function(g,_,M,V){if(_=_||0,(V=V||V===0?V:this.length)!==(M=M||0)&&g.length!==0&&this.length!==0){Z(M<=V,"sourceEnd < sourceStart"),Z(0<=_&&_<g.length,"targetStart out of bounds"),Z(0<=M&&M<this.length,"sourceStart out of bounds"),Z(0<=V&&V<=this.length,"sourceEnd out of bounds"),V>this.length&&(V=this.length);var $=(V=g.length-_<V-M?g.length-_+M:V)-M;if($<100||!F._useTypedArrays)for(var J=0;J<$;J++)g[J+_]=this[J+M];else g._set(this.subarray(M,M+$),_)}},F.prototype.slice=function(g,_){var M=this.length;if(g=Y(g,M,0),_=Y(_,M,M),F._useTypedArrays)return F._augment(this.subarray(g,_));for(var V=_-g,$=new F(V,void 0,!0),J=0;J<V;J++)$[J]=this[J+g];return $},F.prototype.get=function(g){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(g)},F.prototype.set=function(g,_){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(g,_)},F.prototype.readUInt8=function(g,_){if(_||(Z(g!=null,"missing offset"),Z(g<this.length,"Trying to read beyond buffer length")),!(g>=this.length))return this[g]},F.prototype.readUInt16LE=function(g,_){return z(this,g,!0,_)},F.prototype.readUInt16BE=function(g,_){return z(this,g,!1,_)},F.prototype.readUInt32LE=function(g,_){return W(this,g,!0,_)},F.prototype.readUInt32BE=function(g,_){return W(this,g,!1,_)},F.prototype.readInt8=function(g,_){if(_||(Z(g!=null,"missing offset"),Z(g<this.length,"Trying to read beyond buffer length")),!(g>=this.length))return 128&this[g]?-1*(255-this[g]+1):this[g]},F.prototype.readInt16LE=function(g,_){return A(this,g,!0,_)},F.prototype.readInt16BE=function(g,_){return A(this,g,!1,_)},F.prototype.readInt32LE=function(g,_){return N(this,g,!0,_)},F.prototype.readInt32BE=function(g,_){return N(this,g,!1,_)},F.prototype.readFloatLE=function(g,_){return m(this,g,!0,_)},F.prototype.readFloatBE=function(g,_){return m(this,g,!1,_)},F.prototype.readDoubleLE=function(g,_){return S(this,g,!0,_)},F.prototype.readDoubleBE=function(g,_){return S(this,g,!1,_)},F.prototype.writeUInt8=function(g,_,M){M||(Z(g!=null,"missing value"),Z(_!=null,"missing offset"),Z(_<this.length,"trying to write beyond buffer length"),Pt(g,255)),_>=this.length||(this[_]=g)},F.prototype.writeUInt16LE=function(g,_,M){w(this,g,_,!0,M)},F.prototype.writeUInt16BE=function(g,_,M){w(this,g,_,!1,M)},F.prototype.writeUInt32LE=function(g,_,M){v(this,g,_,!0,M)},F.prototype.writeUInt32BE=function(g,_,M){v(this,g,_,!1,M)},F.prototype.writeInt8=function(g,_,M){M||(Z(g!=null,"missing value"),Z(_!=null,"missing offset"),Z(_<this.length,"Trying to write beyond buffer length"),Gt(g,127,-128)),_>=this.length||(0<=g?this.writeUInt8(g,_,M):this.writeUInt8(255+g+1,_,M))},F.prototype.writeInt16LE=function(g,_,M){O(this,g,_,!0,M)},F.prototype.writeInt16BE=function(g,_,M){O(this,g,_,!1,M)},F.prototype.writeInt32LE=function(g,_,M){Q(this,g,_,!0,M)},F.prototype.writeInt32BE=function(g,_,M){Q(this,g,_,!1,M)},F.prototype.writeFloatLE=function(g,_,M){j(this,g,_,!0,M)},F.prototype.writeFloatBE=function(g,_,M){j(this,g,_,!1,M)},F.prototype.writeDoubleLE=function(g,_,M){P(this,g,_,!0,M)},F.prototype.writeDoubleBE=function(g,_,M){P(this,g,_,!1,M)},F.prototype.fill=function(g,_,M){if(_=_||0,M=M||this.length,Z(typeof(g=typeof(g=g||0)=="string"?g.charCodeAt(0):g)=="number"&&!isNaN(g),"value is not a number"),Z(_<=M,"end < start"),M!==_&&this.length!==0){Z(0<=_&&_<this.length,"start out of bounds"),Z(0<=M&&M<=this.length,"end out of bounds");for(var V=_;V<M;V++)this[V]=g}},F.prototype.inspect=function(){for(var g=[],_=this.length,M=0;M<_;M++)if(g[M]=K(this[M]),M===s.INSPECT_MAX_BYTES){g[M+1]="...";break}return"<Buffer "+g.join(" ")+">"},F.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(F._useTypedArrays)return new F(this).buffer;for(var g=new Uint8Array(this.length),_=0,M=g.length;_<M;_+=1)g[_]=this[_];return g.buffer};var D=F.prototype;function Y(g,_,M){return typeof g!="number"?M:_<=(g=~~g)?_:0<=g||0<=(g+=_)?g:0}function G(g){return(g=~~Math.ceil(+g))<0?0:g}function X(g){return(Array.isArray||function(_){return Object.prototype.toString.call(_)==="[object Array]"})(g)}function K(g){return g<16?"0"+g.toString(16):g.toString(16)}function q(g){for(var _=[],M=0;M<g.length;M++){var V=g.charCodeAt(M);if(V<=127)_.push(g.charCodeAt(M));else for(var $=M,J=(55296<=V&&V<=57343&&M++,encodeURIComponent(g.slice($,M+1)).substr(1).split("%")),bt=0;bt<J.length;bt++)_.push(parseInt(J[bt],16))}return _}function rt(g){return E.toByteArray(g)}function At(g,_,M,V){for(var $=0;$<V&&!($+M>=_.length||$>=g.length);$++)_[$+M]=g[$];return $}function Ut(g){try{return decodeURIComponent(g)}catch{return"�"}}function Pt(g,_){Z(typeof g=="number","cannot write a non-number as a number"),Z(0<=g,"specified a negative value for writing an unsigned value"),Z(g<=_,"value is larger than maximum value for type"),Z(Math.floor(g)===g,"value has a fractional component")}function Gt(g,_,M){Z(typeof g=="number","cannot write a non-number as a number"),Z(g<=_,"value larger than maximum allowed value"),Z(M<=g,"value smaller than minimum allowed value"),Z(Math.floor(g)===g,"value has a fractional component")}function Yt(g,_,M){Z(typeof g=="number","cannot write a non-number as a number"),Z(g<=_,"value larger than maximum allowed value"),Z(M<=g,"value smaller than minimum allowed value")}function Z(g,_){if(!g)throw new Error(_||"Failed assertion")}F._augment=function(g){return g._isBuffer=!0,g._get=g.get,g._set=g.set,g.get=D.get,g.set=D.set,g.write=D.write,g.toString=D.toString,g.toLocaleString=D.toString,g.toJSON=D.toJSON,g.copy=D.copy,g.slice=D.slice,g.readUInt8=D.readUInt8,g.readUInt16LE=D.readUInt16LE,g.readUInt16BE=D.readUInt16BE,g.readUInt32LE=D.readUInt32LE,g.readUInt32BE=D.readUInt32BE,g.readInt8=D.readInt8,g.readInt16LE=D.readInt16LE,g.readInt16BE=D.readInt16BE,g.readInt32LE=D.readInt32LE,g.readInt32BE=D.readInt32BE,g.readFloatLE=D.readFloatLE,g.readFloatBE=D.readFloatBE,g.readDoubleLE=D.readDoubleLE,g.readDoubleBE=D.readDoubleBE,g.writeUInt8=D.writeUInt8,g.writeUInt16LE=D.writeUInt16LE,g.writeUInt16BE=D.writeUInt16BE,g.writeUInt32LE=D.writeUInt32LE,g.writeUInt32BE=D.writeUInt32BE,g.writeInt8=D.writeInt8,g.writeInt16LE=D.writeInt16LE,g.writeInt16BE=D.writeInt16BE,g.writeInt32LE=D.writeInt32LE,g.writeInt32BE=D.writeInt32BE,g.writeFloatLE=D.writeFloatLE,g.writeFloatBE=D.writeFloatBE,g.writeDoubleLE=D.writeDoubleLE,g.writeDoubleBE=D.writeDoubleBE,g.fill=D.fill,g.inspect=D.inspect,g.toArrayBuffer=D.toArrayBuffer,g}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(e,n,s){(function(i,c,E,d,f,y,B,R,x){var E=e("buffer").Buffer,L=4,F=new E(L);F.fill(0),n.exports={hash:function(k,C,U,z){for(var W=C((function(w,v){w.length%L!=0&&(O=w.length+(L-w.length%L),w=E.concat([w,F],O));for(var O,Q=[],j=v?w.readInt32BE:w.readInt32LE,P=0;P<w.length;P+=L)Q.push(j.call(w,P));return Q})(k=E.isBuffer(k)?k:new E(k),z),8*k.length),C=z,A=new E(U),N=C?A.writeInt32BE:A.writeInt32LE,m=0;m<W.length;m++)N.call(A,W[m],4*m,!0);return A}}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(e,n,s){(function(i,c,E,d,f,y,B,R,x){var E=e("buffer").Buffer,L=e("./sha"),F=e("./sha256"),k=e("./rng"),C={sha1:L,sha256:F,md5:e("./md5")},U=64,z=new E(U);function W(w,v){var O=C[w=w||"sha1"],Q=[];return O||A("algorithm:",w,"is not yet supported"),{update:function(j){return E.isBuffer(j)||(j=new E(j)),Q.push(j),j.length,this},digest:function(j){var P=E.concat(Q),P=v?(function(D,Y,G){E.isBuffer(Y)||(Y=new E(Y)),E.isBuffer(G)||(G=new E(G)),Y.length>U?Y=D(Y):Y.length<U&&(Y=E.concat([Y,z],U));for(var X=new E(U),K=new E(U),q=0;q<U;q++)X[q]=54^Y[q],K[q]=92^Y[q];return G=D(E.concat([X,G])),D(E.concat([K,G]))})(O,v,P):O(P);return Q=null,j?P.toString(j):P}}}function A(){var w=[].slice.call(arguments).join(" ");throw new Error([w,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
9
- `))}z.fill(0),s.createHash=function(w){return W(w)},s.createHmac=W,s.randomBytes=function(w,v){if(!v||!v.call)return new E(k(w));try{v.call(this,void 0,new E(k(w)))}catch(O){v(O)}};var N,m=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],S=function(w){s[w]=function(){A("sorry,",w,"is not implemented yet")}};for(N in m)S(m[N])}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){var E=e("./helpers");function L(A,N){A[N>>5]|=128<<N%32,A[14+(N+64>>>9<<4)]=N;for(var m=1732584193,S=-271733879,w=-1732584194,v=271733878,O=0;O<A.length;O+=16){var Q=m,j=S,P=w,D=v,m=k(m,S,w,v,A[O+0],7,-680876936),v=k(v,m,S,w,A[O+1],12,-389564586),w=k(w,v,m,S,A[O+2],17,606105819),S=k(S,w,v,m,A[O+3],22,-1044525330);m=k(m,S,w,v,A[O+4],7,-176418897),v=k(v,m,S,w,A[O+5],12,1200080426),w=k(w,v,m,S,A[O+6],17,-1473231341),S=k(S,w,v,m,A[O+7],22,-45705983),m=k(m,S,w,v,A[O+8],7,1770035416),v=k(v,m,S,w,A[O+9],12,-1958414417),w=k(w,v,m,S,A[O+10],17,-42063),S=k(S,w,v,m,A[O+11],22,-1990404162),m=k(m,S,w,v,A[O+12],7,1804603682),v=k(v,m,S,w,A[O+13],12,-40341101),w=k(w,v,m,S,A[O+14],17,-1502002290),m=C(m,S=k(S,w,v,m,A[O+15],22,1236535329),w,v,A[O+1],5,-165796510),v=C(v,m,S,w,A[O+6],9,-1069501632),w=C(w,v,m,S,A[O+11],14,643717713),S=C(S,w,v,m,A[O+0],20,-373897302),m=C(m,S,w,v,A[O+5],5,-701558691),v=C(v,m,S,w,A[O+10],9,38016083),w=C(w,v,m,S,A[O+15],14,-660478335),S=C(S,w,v,m,A[O+4],20,-405537848),m=C(m,S,w,v,A[O+9],5,568446438),v=C(v,m,S,w,A[O+14],9,-1019803690),w=C(w,v,m,S,A[O+3],14,-187363961),S=C(S,w,v,m,A[O+8],20,1163531501),m=C(m,S,w,v,A[O+13],5,-1444681467),v=C(v,m,S,w,A[O+2],9,-51403784),w=C(w,v,m,S,A[O+7],14,1735328473),m=U(m,S=C(S,w,v,m,A[O+12],20,-1926607734),w,v,A[O+5],4,-378558),v=U(v,m,S,w,A[O+8],11,-2022574463),w=U(w,v,m,S,A[O+11],16,1839030562),S=U(S,w,v,m,A[O+14],23,-35309556),m=U(m,S,w,v,A[O+1],4,-1530992060),v=U(v,m,S,w,A[O+4],11,1272893353),w=U(w,v,m,S,A[O+7],16,-155497632),S=U(S,w,v,m,A[O+10],23,-1094730640),m=U(m,S,w,v,A[O+13],4,681279174),v=U(v,m,S,w,A[O+0],11,-358537222),w=U(w,v,m,S,A[O+3],16,-722521979),S=U(S,w,v,m,A[O+6],23,76029189),m=U(m,S,w,v,A[O+9],4,-640364487),v=U(v,m,S,w,A[O+12],11,-421815835),w=U(w,v,m,S,A[O+15],16,530742520),m=z(m,S=U(S,w,v,m,A[O+2],23,-995338651),w,v,A[O+0],6,-198630844),v=z(v,m,S,w,A[O+7],10,1126891415),w=z(w,v,m,S,A[O+14],15,-1416354905),S=z(S,w,v,m,A[O+5],21,-57434055),m=z(m,S,w,v,A[O+12],6,1700485571),v=z(v,m,S,w,A[O+3],10,-1894986606),w=z(w,v,m,S,A[O+10],15,-1051523),S=z(S,w,v,m,A[O+1],21,-2054922799),m=z(m,S,w,v,A[O+8],6,1873313359),v=z(v,m,S,w,A[O+15],10,-30611744),w=z(w,v,m,S,A[O+6],15,-1560198380),S=z(S,w,v,m,A[O+13],21,1309151649),m=z(m,S,w,v,A[O+4],6,-145523070),v=z(v,m,S,w,A[O+11],10,-1120210379),w=z(w,v,m,S,A[O+2],15,718787259),S=z(S,w,v,m,A[O+9],21,-343485551),m=W(m,Q),S=W(S,j),w=W(w,P),v=W(v,D)}return Array(m,S,w,v)}function F(A,N,m,S,w,v){return W((N=W(W(N,A),W(S,v)))<<w|N>>>32-w,m)}function k(A,N,m,S,w,v,O){return F(N&m|~N&S,A,N,w,v,O)}function C(A,N,m,S,w,v,O){return F(N&S|m&~S,A,N,w,v,O)}function U(A,N,m,S,w,v,O){return F(N^m^S,A,N,w,v,O)}function z(A,N,m,S,w,v,O){return F(m^(N|~S),A,N,w,v,O)}function W(A,N){var m=(65535&A)+(65535&N);return(A>>16)+(N>>16)+(m>>16)<<16|65535&m}n.exports=function(A){return E.hash(A,L,16)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){n.exports=function(E){for(var L,F=new Array(E),k=0;k<E;k++)(3&k)==0&&(L=4294967296*Math.random()),F[k]=L>>>((3&k)<<3)&255;return F}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){var E=e("./helpers");function L(C,U){C[U>>5]|=128<<24-U%32,C[15+(U+64>>9<<4)]=U;for(var z,W,A,N=Array(80),m=1732584193,S=-271733879,w=-1732584194,v=271733878,O=-1009589776,Q=0;Q<C.length;Q+=16){for(var j=m,P=S,D=w,Y=v,G=O,X=0;X<80;X++){N[X]=X<16?C[Q+X]:k(N[X-3]^N[X-8]^N[X-14]^N[X-16],1);var K=F(F(k(m,5),(K=S,W=w,A=v,(z=X)<20?K&W|~K&A:!(z<40)&&z<60?K&W|K&A|W&A:K^W^A)),F(F(O,N[X]),(z=X)<20?1518500249:z<40?1859775393:z<60?-1894007588:-899497514)),O=v,v=w,w=k(S,30),S=m,m=K}m=F(m,j),S=F(S,P),w=F(w,D),v=F(v,Y),O=F(O,G)}return Array(m,S,w,v,O)}function F(C,U){var z=(65535&C)+(65535&U);return(C>>16)+(U>>16)+(z>>16)<<16|65535&z}function k(C,U){return C<<U|C>>>32-U}n.exports=function(C){return E.hash(C,L,20,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){function E(U,z){var W=(65535&U)+(65535&z);return(U>>16)+(z>>16)+(W>>16)<<16|65535&W}function L(U,z){var W,A=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),N=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),m=new Array(64);U[z>>5]|=128<<24-z%32,U[15+(z+64>>9<<4)]=z;for(var S,w,v=0;v<U.length;v+=16){for(var O=N[0],Q=N[1],j=N[2],P=N[3],D=N[4],Y=N[5],G=N[6],X=N[7],K=0;K<64;K++)m[K]=K<16?U[K+v]:E(E(E((w=m[K-2],k(w,17)^k(w,19)^C(w,10)),m[K-7]),(w=m[K-15],k(w,7)^k(w,18)^C(w,3))),m[K-16]),W=E(E(E(E(X,k(w=D,6)^k(w,11)^k(w,25)),D&Y^~D&G),A[K]),m[K]),S=E(k(S=O,2)^k(S,13)^k(S,22),O&Q^O&j^Q&j),X=G,G=Y,Y=D,D=E(P,W),P=j,j=Q,Q=O,O=E(W,S);N[0]=E(O,N[0]),N[1]=E(Q,N[1]),N[2]=E(j,N[2]),N[3]=E(P,N[3]),N[4]=E(D,N[4]),N[5]=E(Y,N[5]),N[6]=E(G,N[6]),N[7]=E(X,N[7])}return N}var F=e("./helpers"),k=function(U,z){return U>>>z|U<<32-z},C=function(U,z){return U>>>z};n.exports=function(U){return F.hash(U,L,32,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){s.read=function(E,L,F,k,v){var U,z,W=8*v-k-1,A=(1<<W)-1,N=A>>1,m=-7,S=F?v-1:0,w=F?-1:1,v=E[L+S];for(S+=w,U=v&(1<<-m)-1,v>>=-m,m+=W;0<m;U=256*U+E[L+S],S+=w,m-=8);for(z=U&(1<<-m)-1,U>>=-m,m+=k;0<m;z=256*z+E[L+S],S+=w,m-=8);if(U===0)U=1-N;else{if(U===A)return z?NaN:1/0*(v?-1:1);z+=Math.pow(2,k),U-=N}return(v?-1:1)*z*Math.pow(2,U-k)},s.write=function(E,L,F,k,C,O){var z,W,A=8*O-C-1,N=(1<<A)-1,m=N>>1,S=C===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=k?0:O-1,v=k?1:-1,O=L<0||L===0&&1/L<0?1:0;for(L=Math.abs(L),isNaN(L)||L===1/0?(W=isNaN(L)?1:0,z=N):(z=Math.floor(Math.log(L)/Math.LN2),L*(k=Math.pow(2,-z))<1&&(z--,k*=2),2<=(L+=1<=z+m?S/k:S*Math.pow(2,1-m))*k&&(z++,k/=2),N<=z+m?(W=0,z=N):1<=z+m?(W=(L*k-1)*Math.pow(2,C),z+=m):(W=L*Math.pow(2,m-1)*Math.pow(2,C),z=0));8<=C;E[F+w]=255&W,w+=v,W/=256,C-=8);for(z=z<<C|W,A+=C;0<A;E[F+w]=255&z,w+=v,z/=256,A-=8);E[F+w-v]|=128*O}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){var E,L,F;function k(){}(i=n.exports={}).nextTick=(L=typeof window<"u"&&window.setImmediate,F=typeof window<"u"&&window.postMessage&&window.addEventListener,L?function(C){return window.setImmediate(C)}:F?(E=[],window.addEventListener("message",function(C){var U=C.source;U!==window&&U!==null||C.data!=="process-tick"||(C.stopPropagation(),0<E.length&&E.shift()())},!0),function(C){E.push(C),window.postMessage("process-tick","*")}):function(C){setTimeout(C,0)}),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=k,i.addListener=k,i.once=k,i.off=k,i.removeListener=k,i.removeAllListeners=k,i.emit=k,i.binding=function(C){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(C){throw new Error("process.chdir is not supported")}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})})(Wi)),Wi.exports}var _f=bf();const Sf=js(_f);new TextEncoder;const If=4096;function Mu(r,t,e){let n=t;const s=n+e,i=[];let c="";for(;n<s;){const a=r[n++];if((a&128)===0)i.push(a);else if((a&224)===192){const d=r[n++]&63;i.push((a&31)<<6|d)}else if((a&240)===224){const d=r[n++]&63,f=r[n++]&63;i.push((a&31)<<12|d<<6|f)}else if((a&248)===240){const d=r[n++]&63,f=r[n++]&63,y=r[n++]&63;let B=(a&7)<<18|d<<12|f<<6|y;B>65535&&(B-=65536,i.push(B>>>10&1023|55296),B=56320|B&1023),i.push(B)}else i.push(a);i.length>=If&&(c+=String.fromCharCode(...i),i.length=0)}return i.length>0&&(c+=String.fromCharCode(...i)),c}const Bf=new TextDecoder,vf=200;function xf(r,t,e){const n=r.subarray(t,t+e);return Bf.decode(n)}function Af(r,t,e){return e>vf?xf(r,t,e):Mu(r,t,e)}class En{type;data;constructor(t,e){this.type=t,this.data=e}}class se extends Error{constructor(t){super(t);const e=Object.create(se.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:se.name})}}const Hr=4294967295;function Ef(r,t,e){const n=Math.floor(e/4294967296),s=e;r.setUint32(t,n),r.setUint32(t+4,s)}function Nu(r,t){const e=r.getInt32(t),n=r.getUint32(t+4);return e*4294967296+n}function Tf(r,t){const e=r.getUint32(t),n=r.getUint32(t+4);return e*4294967296+n}const Mf=-1,Nf=4294967296-1,Ff=17179869184-1;function Of({sec:r,nsec:t}){if(r>=0&&t>=0&&r<=Ff)if(t===0&&r<=Nf){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,r),e}else{const e=r/4294967296,n=r&4294967295,s=new Uint8Array(8),i=new DataView(s.buffer);return i.setUint32(0,t<<2|e&3),i.setUint32(4,n),s}else{const e=new Uint8Array(12),n=new DataView(e.buffer);return n.setUint32(0,t),Ef(n,4,r),e}}function kf(r){const t=r.getTime(),e=Math.floor(t/1e3),n=(t-e*1e3)*1e6,s=Math.floor(n/1e9);return{sec:e+s,nsec:n-s*1e9}}function Df(r){if(r instanceof Date){const t=kf(r);return Of(t)}else return null}function Uf(r){const t=new DataView(r.buffer,r.byteOffset,r.byteLength);switch(r.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),n=t.getUint32(4),s=(e&3)*4294967296+n,i=e>>>2;return{sec:s,nsec:i}}case 12:{const e=Nu(t,4),n=t.getUint32(0);return{sec:e,nsec:n}}default:throw new se(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function Lf(r){const t=Uf(r);return new Date(t.sec*1e3+t.nsec/1e6)}const Cf={type:Mf,encode:Df,decode:Lf};class Zs{static defaultCodec=new Zs;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(Cf)}register({type:t,encode:e,decode:n}){if(t>=0)this.encoders[t]=e,this.decoders[t]=n;else{const s=-1-t;this.builtInEncoders[s]=e,this.builtInDecoders[s]=n}}tryToEncode(t,e){for(let n=0;n<this.builtInEncoders.length;n++){const s=this.builtInEncoders[n];if(s!=null){const i=s(t,e);if(i!=null){const c=-1-n;return new En(c,i)}}}for(let n=0;n<this.encoders.length;n++){const s=this.encoders[n];if(s!=null){const i=s(t,e);if(i!=null){const c=n;return new En(c,i)}}}return t instanceof En?t:null}decode(t,e,n){const s=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return s?s(t,e,n):new En(e,t)}}function Rf(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function na(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):Rf(r)?new Uint8Array(r):Uint8Array.from(r)}function Zi(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const Pf=16,$f=16;class zf{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(t=Pf,e=$f){this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,n){const s=this.caches[n-1];t:for(const i of s){const c=i.bytes;for(let a=0;a<n;a++)if(c[a]!==t[e+a])continue t;return i.str}return null}store(t,e){const n=this.caches[t.length-1],s={bytes:t,str:e};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=s:n.push(s)}decode(t,e,n){const s=this.find(t,e,n);if(s!=null)return this.hit++,s;this.miss++;const i=Mu(t,e,n),c=Uint8Array.prototype.slice.call(t,e,e+n);return this.store(c,i),i}}const us="array",cn="map_key",Fu="map_value",jf=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new se("The type of key must be string or number but "+typeof r)};class Vf{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=us,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=cn,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===us){const n=t;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(t.type===cn||t.type===Fu){const n=t;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const qr=-1,Gs=new DataView(new ArrayBuffer(0)),Wf=new Uint8Array(Gs.buffer);try{Gs.getInt8(0)}catch(r){if(!(r instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const ia=new RangeError("Insufficient data"),Zf=new zf;class Ys{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=Gs;bytes=Wf;headByte=qr;stack=new Vf;entered=!1;constructor(t){this.extensionCodec=t?.extensionCodec??Zs.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.rawStrings=t?.rawStrings??!1,this.maxStrLength=t?.maxStrLength??Hr,this.maxBinLength=t?.maxBinLength??Hr,this.maxArrayLength=t?.maxArrayLength??Hr,this.maxMapLength=t?.maxMapLength??Hr,this.maxExtLength=t?.maxExtLength??Hr,this.keyDecoder=t?.keyDecoder!==void 0?t.keyDecoder:Zf,this.mapKeyConverter=t?.mapKeyConverter??jf}clone(){return new Ys({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=qr,this.stack.reset()}setBuffer(t){const e=na(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===qr&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),n=na(t),s=new Uint8Array(e.length+n.length);s.set(e),s.set(n,e.length),this.setBuffer(s)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:n}=this;return new RangeError(`Extra ${e.byteLength-n} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,n;for await(const a of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{n=this.doDecodeSync(),e=!0}catch(d){if(!(d instanceof RangeError))throw d}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:s,pos:i,totalPos:c}=this;throw new RangeError(`Insufficient data in parsing ${Zi(s)} at ${c} (${i} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let n=e,s=-1;for await(const i of t){if(e&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),n&&(s=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--s!==0;);}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){t:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const s=t-128;if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t<160){const s=t-144;if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else{const s=t-160;e=this.decodeString(s,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const s=this.lookU8();e=this.decodeString(s,1)}else if(t===218){const s=this.lookU16();e=this.decodeString(s,2)}else if(t===219){const s=this.lookU32();e=this.decodeString(s,4)}else if(t===220){const s=this.readU16();if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else if(t===221){const s=this.readU32();if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else if(t===222){const s=this.readU16();if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t===223){const s=this.readU32();if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t===196){const s=this.lookU8();e=this.decodeBinary(s,1)}else if(t===197){const s=this.lookU16();e=this.decodeBinary(s,2)}else if(t===198){const s=this.lookU32();e=this.decodeBinary(s,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const s=this.lookU8();e=this.decodeExtension(s,1)}else if(t===200){const s=this.lookU16();e=this.decodeExtension(s,2)}else if(t===201){const s=this.lookU32();e=this.decodeExtension(s,4)}else throw new se(`Unrecognized type byte: ${Zi(t)}`);this.complete();const n=this.stack;for(;n.length>0;){const s=n.top();if(s.type===us)if(s.array[s.position]=e,s.position++,s.position===s.size)e=s.array,n.release(s);else continue t;else if(s.type===cn){if(e==="__proto__")throw new se("The key __proto__ is not allowed");s.key=this.mapKeyConverter(e),s.type=Fu;continue t}else if(s.map[s.key]=e,s.readCount++,s.readCount===s.size)e=s.map,n.release(s);else{s.key=null,s.type=cn;continue t}}return e}}readHeadByte(){return this.headByte===qr&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=qr}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new se(`Unrecognized array type byte: ${Zi(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new se(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new se(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){if(t>this.maxStrLength)throw new se(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw ia;const n=this.pos+e;let s;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(t)?s=this.keyDecoder.decode(this.bytes,n,t):s=Af(this.bytes,n,t),this.pos+=e+t,s}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===cn:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new se(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw ia;const n=this.pos+e,s=this.bytes.subarray(n,n+t);return this.pos+=e+t,s}decodeExtension(t,e){if(t>this.maxExtLength)throw new se(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+e),s=this.decodeBinary(t,e+1);return this.extensionCodec.decode(s,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=Tf(this.view,this.pos);return this.pos+=8,t}readI64(){const t=Nu(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function Gf(r,t){return new Ys(t).decode(r)}pa.set("msgpack2",async()=>({kind:"array_to_bytes",fromConfig:(r,t)=>({kind:"array_to_bytes",async encode(e){throw new Error("msgpack2 encode not implemented")},async decode(e){const n=Gf(e),{shape:s}=t,i=new Array(s.length);let c=1;for(let a=s.length-1;a>=0;a--)i[a]=c,c*=s[a];return{data:n,shape:s,stride:i}}})}));function Yf(r){return new Promise(t=>setTimeout(t,r))}const Gi="__cache_created_at";class Jf{cache;url;params;cache_prefix;fetchOptions;timeout;ttl;_pending={};_cacheValid;constructor(t,e,n={}){const s={...e};n.parameters&&(s["x-parameters"]=JSON.stringify(n.parameters)),n.chunks&&(s["x-chunks"]=n.chunks),n.downsample&&(s["x-downsample"]=JSON.stringify(n.downsample)),s["x-filtered"]="True",this.params={},e["x-datamesh-auth"]&&(this.params.auth=e["x-datamesh-auth"]),e["x-datamesh-sig"]&&(this.params.sig=e["x-datamesh-sig"]),this.fetchOptions={headers:s},this.url=t,n.nocache&&console.warn("CachedHTTPStore: 'nocache' option is deprecated, use 'ttl: 0' instead"),n.ttl===0||n.nocache||typeof window>"u"?this.cache=void 0:this.cache=Tu("zarr","cache"),this.cache_prefix=Sf({root:t,...n.parameters,chunks:n.chunks,downsample:n.downsample}),this.timeout=n.timeout||6e4,this.ttl=n.ttl}async checkCacheTTL(){if(!this.ttl||!this.cache)return!1;if(this._cacheValid!==void 0)return this._cacheValid;const t=`${this.cache_prefix}${Gi}`,e=await Vi(t,this.cache);return e?(Date.now()-e)/1e3>this.ttl?(this._cacheValid=!1,!1):(this._cacheValid=!0,!0):(this._cacheValid=!1,!1)}async setCacheTimestamp(){if(!this.cache||!this.ttl)return;const t=`${this.cache_prefix}${Gi}`;await Vi(t,this.cache)||await ea(t,Date.now(),this.cache)}async invalidateCache(){if(!this.cache)return;const t=`${this.cache_prefix}${Gi}`;await xn(t,this.cache),this._cacheValid=!1}async get(t,e,n=0){const s=`${this.cache_prefix}${t}`;let i=null;if(this.cache&&(await this.checkCacheTTL()?i=await Vi(s,this.cache):await this.invalidateCache(),i&&delete this._pending[s],this._pending[s]))if(await Yf(200),n>this.timeout){await xn(s,this.cache),delete this._pending[s],console.error("Zarr timeout");return}else return await this.get(t,e,n+200);if(!i){this._pending[s]=!0;try{const c={...this.fetchOptions,...e,headers:{...this.fetchOptions.headers||{},...e?.headers||{}},signal:AbortSignal.timeout(this.timeout)},a=new URLSearchParams(this.params).toString(),d=await fetch(`${this.url}${t}?${a}`,c);if(d.status===404){this.cache&&await xn(s,this.cache);return}if(d.status>=400)throw new Error(`HTTP error: ${d.status}`);i=new Uint8Array(await d.arrayBuffer()),this.cache&&(await ea(s,i,this.cache),await this.setCacheTimestamp())}catch(c){if(console.debug("Zarr retry:"+s),n<this.timeout/200)return delete this._pending[s],await this.get(t,e,n+200);this.cache&&await xn(s,this.cache),console.error(c);return}finally{delete this._pending[s]}}return i}}const sa=async(r,t=".zarray")=>{const{path:e}=r.resolve(t),n=await r.store.get(e);return n?JSON.parse(new TextDecoder().decode(n)):{}};async function Hf(r){const t=await sa(r,".zattrs"),e=await sa(r);e.dtype.startsWith("<M8")&&(t._dtype=e.dtype),e.fill_value!==void 0&&(t._fill_value=e.fill_value);const n=[];e.order==="F"&&n.push({name:"transpose",configuration:{order:"F"}}),typeof e.dtype=="string"&&e.dtype.startsWith(">")&&n.push({name:"bytes",configuration:{endian:"big"}});for(const{id:i,...c}of e.filters??[])n.push({name:i,configuration:c});if(e.compressor){const{id:i,...c}=e.compressor;n.push({name:i,configuration:c})}const s={zarr_format:3,node_type:"array",shape:e.shape,data_type:"int64",chunk_grid:{name:"regular",configuration:{chunk_shape:e.chunks}},chunk_key_encoding:{name:"v2",configuration:{separator:e.dimension_separator??"."}},codecs:n,fill_value:e.fill_value,attributes:t};return new xr(r.store,r.path,s)}let Ou=typeof process<"u"&&!!process.env&&process.env.DATAMESH_DEBUG==="true";function oa(){return Ou}function Ti(r,t,e){if(!Ou)return e;const n=e.value;return e.value=function(...s){const i=s.map(a=>{if(!a||typeof a!="object")return a;try{return JSON.parse(JSON.stringify(a,(d,f)=>{if(typeof d=="string"){const y=d.toLowerCase();if(y.includes("token")||y.includes("authorization")||y.includes("jwt"))return"[redacted]"}return f}))}catch{return"[unserializable]"}}),c=Date.now();try{const a=n.apply(this,s);if(a&&typeof a.then=="function")return a.finally(()=>{const f=Date.now()-c;console.debug(`@oceanum/datamesh debug: ${t} took ${f}ms`,i)});const d=Date.now()-c;return console.debug(`@oceanum/datamesh debug: ${t} took ${d}ms`,i),a}catch(a){const d=Date.now()-c;throw console.debug(`@oceanum/datamesh debug: ${t} threw after ${d}ms`,i),a}},e}const Js={microseconds:.001,milliseconds:1,seconds:1e3,minutes:60*1e3,hours:3600*1e3,days:1440*60*1e3},qf={day:"days",days:"days",d:"days",hour:"hours",hours:"hours",hr:"hours",hrs:"hours",h:"hours",minute:"minutes",minutes:"minutes",min:"minutes",mins:"minutes",second:"seconds",seconds:"seconds",sec:"seconds",secs:"seconds",s:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds",msec:"milliseconds",msecs:"milliseconds",ms:"milliseconds",microsecond:"microseconds",microseconds:"microseconds",usec:"microseconds",usecs:"microseconds",us:"microseconds"},Mi=new Set(["standard","gregorian","proleptic_gregorian"]);function Ni(r){const t=/^\s*(\w+)\s+since\s+(.+?)\s*$/i,e=r.match(t);if(!e)throw new Error(`Invalid CF time units: "${r}". Expected format: "<unit> since <reference_time>"`);const[,n,s]=e,i=n.toLowerCase(),c=qf[i];if(!c)throw new Error(`Unsupported time unit: "${n}". Supported units: days, hours, minutes, seconds, milliseconds, microseconds`);const a=Kf(s),d=a.getTime();return{unit:c,referenceDate:a,referenceMs:d,original:r}}function Kf(r){const t=r.trim().replace("T"," ").replace(/Z$/i,""),e=/^(-?\d+)-(\d{1,2})-(\d{1,2})(?:\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?)?$/,n=t.match(e);if(!n){const C=new Date(r);if(isNaN(C.getTime()))throw new Error(`Cannot parse reference time: "${r}"`);return C}const[,s,i,c,a,d,f,y]=n,B=parseInt(s,10),R=parseInt(i,10)-1,x=parseInt(c,10),E=a?parseInt(a,10):0,L=d?parseInt(d,10):0,F=f?parseInt(f,10):0;let k=0;if(y){const C=y.padEnd(3,"0").slice(0,3);k=parseInt(C,10)}return new Date(Date.UTC(B,R,x,E,L,F,k))}function Xf(r,t,e="standard"){if(!Mi.has(e))throw new Error(`Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`);const n=Ni(t),s=Js[n.unit];if(typeof r=="number")return new Date(n.referenceMs+r*s);const i=[];for(let c=0;c<r.length;c++){const a=r[c];a==null||Number.isNaN(a)?i.push(new Date(NaN)):i.push(new Date(n.referenceMs+a*s))}return i}function Qf(r,t,e="standard"){if(!Mi.has(e))throw new Error(`Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`);const n=Ni(t),s=Js[n.unit];return r instanceof Date?(r.getTime()-n.referenceMs)/s:r.map(i=>!i||isNaN(i.getTime())?NaN:(i.getTime()-n.referenceMs)/s)}function ku(r){return Mi.has(r.toLowerCase())}function tp(){return Array.from(Mi)}function Du(r){const t=r.units;return typeof t=="string"&&/^\s*\w+\s+since\s+.+$/i.test(t)}function Uu(r,t,e="standard"){if(!ku(e))return null;const n=Ni(t),s=Js[n.unit],i=n.referenceMs,c=new Float64Array(r.length);for(let a=0;a<r.length;a++){const d=Number(r[a]);Number.isNaN(d)?c[a]=NaN:c[a]=(i+d*s)/1e3}return c}var ep=Object.defineProperty,rp=Object.getOwnPropertyDescriptor,np=(r,t,e,n)=>{for(var s=rp(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&ep(t,e,s),s};const aa=(r,t,e,n,s)=>n?.variables?.[r]?n.variables[r]:s||(n?.dimensions?t.map((i,c)=>n.dimensions?.[i]??e[c]):e),Lu=r=>{const t=new Eu.Buffer(r,"base64");return mf.Geometry.parse(t).toGeoJSON()},mi=r=>r&&(Array.isArray(r)||ArrayBuffer.isView(r)),Yi=r=>{const t=[];if(!mi(r))return t;for(;t.push(r.length),mi(r[0]);)r=r[0];return t},ip=r=>{for(;Array.isArray(r);)r=r[0];if(r==null)return"uint8";switch(r.constructor.name){case"Boolean":return"bool";case"Number":return"float32";case"Int8Array":return"int8";case"Int16Array":return"int16";case"Int32Array":return"int32";case"BigInt64Array":return"int64";case"Uint8Array":return"uint8";case"Uint16Array":return"uint16";case"Uint32Array":return"uint32";case"Float32Array":return"float32";case"Float64Array":return"float64";case"String":return"v2:object";case"Object":return"v2:object"}throw new Error("Unsupported data type: "+r.constructor.name)},sp=r=>{let t=r.toString().toLowerCase();return r.typeId==5?t="v2:object":r.typeId==1&&(t="uint8"),t},ca=r=>{if(!Array.isArray(r))return r;const t=r.flat(1/0);if(mi(t[0])){const e=t[0].length,n=new t[0].constructor(t.length*e);for(let s=0;s<t.length;s++)n.set(t[s],s*e);return n}else return t},ua=r=>{const t=r.length,e=Array(t);for(let n=t-1,s=1;n>=0;n--)e[n]=s,s*=r[n];return e},pn=(r,t,e,n=0)=>{if(t.length===0)return r[0];if(t.length===1){const i=new r.constructor(t[0]);return i.set(r.slice(n,n+t[0])),i}const s=new Array(t[0]);for(let i=0;i<t[0];i++)s[i]=pn(r,t.slice(1),e.slice(1),n+i*e[0]);return s},op=(r,t)=>{const[e,n]=t.split("<M8"),s=new Float64Array(r.data.length);let i=1n;switch(n){case"[ms]":i=1000n;break;case"[us]":i=1000000n;break;case"[ns]":i=1000000000n;break;default:i=1n;break}for(let c=0;c<r.data.length;c++){const a=r.data[c];s[c]=Number(a/i)}return pn(s,r.shape,r.stride)},ap=(r,t,e="standard")=>{const n=Uu(r.data,t,e);return n===null?(console.warn(`Unsupported calendar "${e}" for cftime conversion. Returning raw values. Supported: standard, gregorian, proleptic_gregorian`),pn(r.data,r.shape,r.stride)):pn(n,r.shape,r.stride)},cp=r=>{if(r==null)return!0;if(typeof r=="string"){const t=r.toLowerCase();return t==="nan"||t==="-nan"||t==="+nan"}return typeof r=="number"?Number.isNaN(r):!1},up=(r,t,e)=>{if(!e.startsWith("float")||cp(t))return r;if(typeof t=="number"&&!Number.isNaN(t)){const n=e==="float64"?new Float64Array(r.length):new Float32Array(r.length);for(let s=0;s<r.length;s++){const i=r[s];n[s]=Math.abs(i-t)<Math.abs(t*1e-6)?NaN:i}return n}return r},Cu=(r,t,e)=>{const n=Object.keys(t),s={};for(const i in r)mi(r[i].data)&&(s[i]=!0);if(n.length==1)for(let i=0;i<t[n[0]];i++){const c={};for(const a in r)s[a]?r[a].data.length>1&&(c[a]=r[a].data[i]):c[a]=r[a].data;e.push(c)}else for(let i=0;i<t[n[0]];i++){const c={};for(const d in r)r[d].dimensions.includes(n[0])?c[d]={attributes:r[d].attributes,data:r[d].data[i],dimensions:r[d].dimensions.slice(1)}:c[d]=r[d];const a={...t};delete a[n[0]],Cu(c,a,e)}return e};class wi{id;dimensions;attributes;arr;constructor(t,e,n,s){this.id=t,this.dimensions=e,this.attributes=n,this.arr=s}async get(t){if(this.arr.shape.length==0||this.arr.shape[0]==0)return[];const e=t&&t.map(s=>{if(typeof s=="string"){const[i,c,a]=s.split(":");return Hi(parseInt(i),parseInt(c),parseInt(a))}else return s}),n=await Th(this.arr,e);if(this.arr.dtype=="v2:object"||!n.shape)return n.data;if(this.arr.dtype=="bool")return[...n.data];{const s=this.arr.attrs,i=this.arr.dtype,c=s._dtype;if(c?.startsWith("<M8"))return op(n,c);if(Du(s)){const f=s.units,y=s.calendar||"standard";return ap(n,f,y)}const a=this.attributes._fill_value,d=a?up(n.data,a,i):n.data;return pn(d,n.shape,n.stride)}}}np([Ti],wi.prototype,"get");class Ye{dimensions;variables;attributes;coordkeys;root;constructor(t,e,n,s,i){this.dimensions=t,this.variables=e,this.attributes=n,this.coordkeys=s,this.root=i}static async zarr(t,e,n={}){const s=new Jf(t,e,{chunks:n.chunks,downsample:n.downsample,parameters:n.parameters,timeout:n.timeout,nocache:n.nocache,ttl:n.ttl}),i=await kh(s);if(!("contents"in i&&typeof i.contents=="function"))throw new Error("Zarr store does not have consolidated metadata (.zmetadata). Consolidated metadata is required for auto-discovery of variables. For zarr v2 stores, run `zarr.consolidate_metadata(store)` in Python.");const a=i,d=n.group?n.group.startsWith("/")?n.group:`/${n.group}`:void 0,f=await Ue(a,{kind:"group"}),y=d?await Ue(f.resolve(d),{kind:"group"}):f,B={},R={};for(const E of a.contents()){if(E.kind!="array"||d&&!E.path.startsWith(d+"/"))continue;let L;d?L=E.path.slice(d.length+1):L=E.path.replace(/^\//,"");let F;try{F=await Ue(f.resolve(E.path),{kind:"array"})}catch(U){const z=typeof U=="object"&&U&&"message"in U?String(U.message):void 0;if(z&&z.includes("<M8"))F=await Hf(f.resolve(E.path));else throw U}const k={...F.attrs};if(k._fill_value===void 0){const U=`${E.path}/.zarray`.replace(/^\//,""),z=await a.get(`/${U}`);if(z){const W=JSON.parse(new TextDecoder().decode(z));W.fill_value!==void 0&&(k._fill_value=W.fill_value)}}let C=k._ARRAY_DIMENSIONS;(!C||!Array.isArray(C))&&(C=F.shape.map((U,z)=>`dim_${z}`)),B[L]=new wi(L,C,k,F),C.map((U,z)=>{const W=F.shape[z];if(R[U]&&R[U]!=W)throw new Error(`Inconsistent dimension size for ${U}: ${R[U]} != ${W}`);R[U]=W})}let x;try{const E=y.attrs._coordinates;typeof E=="string"?x=JSON.parse(E)||{}:E&&typeof E=="object"?x=E:x={}}catch{x={}}return new Ye(R,B,y.attrs,n.coordkeys||x,y)}static async fromArrow(t,e){const n={},s={record:t.numRows},i={};return t.schema.fields.forEach(c=>{const a=t.getChild(c.name);let d={},f=a?.toArray(),y=sp(c.type);if(tt.isTimestamp(c.type)){const B=new Float64Array(f.length),R=BigInt(1e3**(c.type.unit-0));for(let x=0;x<f.length;x++)B[x]=Number(f[x]/R);f=B,y="float64",d={unit:"Unix timestamp (s)"}}else if(tt.isBinary(c.type)){const B=[];for(let R=0;R<f.length;R++)B.push(new Eu.Buffer(f[R]).toString("base64"));f=B,y="v2:object"}i[c.name]={dimensions:["record"],attributes:d,data:f,dtype:y}}),await Ye.init({dimensions:s,variables:i,attributes:n},e)}static async fromGeojson(t,e){if(!("features"in t&&Array.isArray(t.features))&&!("geometry"in t))throw new Error("Invalid GeoJSON");const n="features"in t&&t.features?t.features:[t];if(n.length===0)throw new Error("FeatureCollection contains no features");const s=new Set;n.forEach(d=>{d.properties&&Object.keys(d.properties).forEach(f=>s.add(f))});const i=n.map(d=>{const f={geometry:d.geometry};return d.properties&&Object.assign(f,d.properties),f}),c={dimensions:{index:i.length},variables:{},attributes:{}},a=await Ye.init(c,{...e,g:"geometry"});await a.assign("geometry",["index"],i.map(d=>d.geometry),{description:"GeoJSON geometry"});for(const d of s){const f=i.map(y=>y[d]);await a.assign(d,["index"],f,{description:`Property: ${d}`})}return a}static async init(t,e,n){const s=await _n(new Map,{attributes:{created:new Date}}),i=new Ye(t.dimensions,{},t.attributes||{},e||{},s);for(const c in t.variables){const{dimensions:a,attributes:d,data:f,dtype:y,chunks:B}=t.variables[c],R=Yi(f),x=aa(c,a,R,n,B);await i.assign(c,a,f,d,y&&y==="string"?"v2:object":y,x)}return i}async asDataframe(){const t={},e=[];for(const s in this.variables)t[s]={attributes:this.variables[s].attributes,dimensions:this.variables[s].dimensions},t[s].data=await this.variables[s].get(),this.variables[s].arr.dtype=="int64"&&s!=this.coordkeys.t&&e.push(s);const n=Cu(t,{...this.dimensions},[]);if(this.coordkeys.t)for(let s=0;s<n.length;s++)n[s][this.coordkeys.t]=new Date(1e3*n[s][this.coordkeys.t]).toISOString();if(e.length>0)for(const s of e)for(let i=0;i<n.length;i++)n[i][s]=Number(n[i][s]);return n}async asGeojson(t){if(!this.coordkeys.g&&!t)throw new Error("No geometry found");const e=[],n=await this.asDataframe();for(let s=0;s<n.length;s++){const{...i}=n[s];let c=t;if(!c&&this.coordkeys.g){delete i[this.coordkeys.g];const a=n[s][this.coordkeys.g];a.slice(0,7)=='{"type:'?c=JSON.parse(a):c=Lu(a)}e.push({type:"Feature",geometry:c,properties:i})}return{type:"FeatureCollection",features:e}}async assign(t,e,n,s,i,c){const a=Yi(n);if(a.length!=e.length)throw new Error("Data shape does not match dimensions");e.map((B,R)=>{if(this.dimensions[B]){if(this.dimensions[B]!=a[R])throw new Error(`Existing size of dimension ${B} does not match new data`)}else this.dimensions[B]=a[R]});const d=i||ip(n),f=await _n(this.root.resolve(t),{shape:a,data_type:d,chunk_shape:c||a,codecs:d=="v2:object"?[{name:"json2"}]:[]});let y=ca(n);y.length==0?y=null:d=="bool"?y=new $n(y):Array.isArray(y)&&d=="float32"?y=Float32Array.from(y,B=>B??NaN):Array.isArray(y)&&d=="float64"?y=Float64Array.from(y,B=>B??NaN):Array.isArray(y)&&d=="int8"?y=Int8Array.from(y):Array.isArray(y)&&d=="int16"?y=Int16Array.from(y):Array.isArray(y)&&d=="int32"?y=Int32Array.from(y):Array.isArray(y)&&d=="int64"?y=BigInt64Array.from(y.map(B=>BigInt(B))):Array.isArray(y)&&d=="uint8"?y=Uint8Array.from(y):Array.isArray(y)&&d=="uint16"?y=Uint16Array.from(y):Array.isArray(y)&&d=="uint32"?y=Uint32Array.from(y):Array.isArray(y)&&d=="uint64"&&(y=BigUint64Array.from(y.map(B=>BigInt(B)))),y&&await oo(f,a.map(()=>null),{data:y,shape:a,stride:ua(a)}),this.variables[t]=new wi(t,e,s||{},f)}async toZarr(t){const e=t?.chunks,n=new Map,s=await _n(n,{attributes:{...this.attributes,_coordinates:JSON.stringify(this.coordkeys)}});for(const i in this.variables){const c=this.variables[i],a=await c.get(),d=Yi(a),f=c.dimensions,y=aa(i,f,d,e,e?void 0:c.arr.chunks),B=c.arr.dtype,R=await _n(s.resolve(i),{shape:d,data_type:B,chunk_shape:y,codecs:B==="v2:object"?[{name:"json2"}]:void 0,attributes:{...c.attributes,_ARRAY_DIMENSIONS:f}});let x=ca(a);x&&x.length>0&&(B==="bool"?x=new $n(x):Array.isArray(x)&&B==="float32"?x=Float32Array.from(x,E=>E??NaN):Array.isArray(x)&&B==="float64"?x=Float64Array.from(x,E=>E??NaN):Array.isArray(x)&&B==="int8"?x=Int8Array.from(x):Array.isArray(x)&&B==="int16"?x=Int16Array.from(x):Array.isArray(x)&&B==="int32"?x=Int32Array.from(x):Array.isArray(x)&&B==="int64"?x=BigInt64Array.from(x.map(E=>BigInt(E))):Array.isArray(x)&&B==="uint8"?x=Uint8Array.from(x):Array.isArray(x)&&B==="uint16"?x=Uint16Array.from(x):Array.isArray(x)&&B==="uint32"?x=Uint32Array.from(x):Array.isArray(x)&&B==="uint64"&&(x=BigUint64Array.from(x.map(E=>BigInt(E)))),await oo(R,d.map(()=>null),{data:x,shape:d,stride:ua(d)}))}return n}}var hp=Object.defineProperty,lp=Object.getOwnPropertyDescriptor,dp=(r,t,e,n)=>{for(var s=lp(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&hp(t,e,s),s};const Ru=class hs{id;user;creationTime;endTime;write;verified=!1;_connection;_closePromise=null;_closed=!1;_beforeExitHandler=null;static async acquire(t,e={}){if(!t._isV1){const n=new hs;return n.id="dummy_session",n.user="dummy_user",n.creationTime=new Date,n.endTime=new Date(Date.now()+(e.duration||3600)*1e3),n.write=!1,n.verified=!1,n._connection=t,typeof process<"u"&&process.on&&(n._beforeExitHandler=()=>{n.close()},process.once("beforeExit",n._beforeExitHandler)),n}try{const n={...t._authHeaders};n["Cache-Control"]="no-store";const s=new URLSearchParams({duration:String(e.duration??3600)}),i=await fetch(`${t._gateway}/session/?${s.toString()}`,{headers:n});if(i.status!==200)throw new Error(`Failed to create session: ${await i.text()}`);const c=await i.json(),a=new hs;return a.id=c.id,a.user=c.user,a.creationTime=new Date(c.creation_time),a.endTime=new Date(c.end_time),a.write=c.write,a.verified=c.verified||!1,a._connection=t,typeof process<"u"&&process.on&&(a._beforeExitHandler=()=>{a.close()},process.once("beforeExit",a._beforeExitHandler)),a}catch(n){throw new Error(`Error when acquiring datamesh session: ${n}`)}}get header(){return{"X-DATAMESH-SESSIONID":this.id}}addHeader(t){return{...t,...this.header}}async close(t=!1){if(this._connection._isV1&&!this._closed)return this._closePromise?this._closePromise:(this._closePromise=(async()=>{try{this._beforeExitHandler&&typeof process<"u"&&process.off&&(process.off("beforeExit",this._beforeExitHandler),this._beforeExitHandler=null);const e=await fetch(`${this._connection._gateway}/session/${this.id}`,{method:"DELETE",headers:this.header,body:JSON.stringify({finalise_write:t})});if(e.status===204){this._closed=!0;return}const n=await e.text();if(e.status===404&&n.includes("Session not found")){this._closed=!0;return}if(t)throw new Error(`Failed to finalise write: ${n}`);console.warn(`Failed to close session: ${n}`)}catch(e){if(t)throw new Error(`Error when closing datamesh session: ${e}`);console.warn(`Error when closing datamesh session: ${e}`)}finally{this._closePromise=null}})(),this._closePromise)}async enter(){return this}async exit(t){await this.close(t===void 0)}};dp([Ti],Ru,"acquire");let fp=Ru;var pp=Object.defineProperty,yp=Object.getOwnPropertyDescriptor,Pu=(r,t,e,n)=>{for(var s=yp(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&pp(t,e,s),s};const gp=typeof process<"u"&&process.env?.DATAMESH_SERVICE?process.env.DATAMESH_SERVICE:"https://datamesh.oceanum.io",Hs=class $u{static LAZY_LOAD_SIZE=1e8;_token;_host;_authHeaders;_gateway;_nocache=!1;_isV1=!0;_sessionParams={};_currentSession=null;service;gateway;constructor(t=typeof process<"u"&&process.env?.DATAMESH_TOKEN?process.env.DATAMESH_TOKEN:"$DATAMESH_TOKEN",e){if(!t&&!e?.jwtAuth)throw new Error("A valid datamesh token must be supplied as a connector constructor argument or defined in environment variables as DATAMESH_TOKEN");this._token=t,this._nocache=e?.nocache??!1;const n=new URL(e?.service||gp);this._host=`${n.protocol}//${n.hostname}`,this._authHeaders=e?.jwtAuth?{Authorization:`Bearer ${e.jwtAuth}`}:{Authorization:`Token ${this._token}`,"X-DATAMESH-TOKEN":this._token},this._gateway=e?.gateway||this._host,this._host.split(".").slice(-1)[0]!==this._gateway.split(".").slice(-1)[0]&&console.warn("Datamesh gateway and service domains do not match"),e?.sessionDuration&&typeof e.sessionDuration=="number"&&(this._sessionParams={duration:e.sessionDuration}),this._checkApiVersion()}async _checkApiVersion(){try{(await fetch(`${this._gateway}/session`,{headers:this._authHeaders})).status===200?(this._isV1=!0,console.info("Using datamesh API version 1")):(this._isV1=!1,console.info("Using datamesh API version 0"))}catch{this._isV1=!1,console.info("Using datamesh API version 0")}}get host(){return this._host}async status(){return(await fetch(this._host,{headers:this._authHeaders})).status===200}async validateResponse(t){if(t.status>=400){let e;try{e=(await t.json()).detail}catch{e=`Datamesh server error: ${await t.text()}`}throw new Error(e)}}async createSession(t={}){const e={duration:t.duration||this._sessionParams.duration||3600};return this._currentSession=await fp.acquire(this,e),this._currentSession}async getSession(){return this._currentSession?this._currentSession:this.createSession()}async getSessionHeaders(t={}){return this._isV1&&!this._currentSession&&await this.createSession(),this._currentSession?this._currentSession.addHeader({...this._authHeaders,...t}):{...this._authHeaders,...t}}async metadataRequest(t="",e={}){const n=new URL(`${this._host}/datasource/${t}`);Object.keys(e).forEach(c=>n.searchParams.append(c,e[c]));const s=await this.getSessionHeaders(),i=await fetch(n.toString(),{headers:s});if(i.status===403)throw new Error(`Datasource ${t} not authorized`);return await this.validateResponse(i),i}async dataRequest(t,e="application/vnd.apache.arrow.file"){const n=await this.getSessionHeaders({Accept:e}),s=await fetch(`${this._gateway}/oceanql/${t}?f=arrow`,{headers:n});return await this.validateResponse(s),Iu(await s.arrayBuffer())}async stageRequest(t){oa()&&console.debug("@oceanum/datamesh debug: stageRequest query",t);const e=JSON.stringify(t),n=await this.getSessionHeaders({"Content-Type":"application/json"}),s=await fetch(`${this._gateway}/oceanql/stage/`,{method:"POST",headers:n,body:e});if(s.status>=400){const i=await s.json();throw new Error(i.detail)}else return s.status===204?null:s.json()}async query(t,e={}){oa()&&console.debug("@oceanum/datamesh debug: query called",t);const n=await this.stageRequest(t);if(!n)return console.warn("No data found for query"),null;if(n.size<$u.LAZY_LOAD_SIZE&&n.container!="dataset"){const d=await this.dataRequest(n.qhash);return await Ye.fromArrow(d,n.coordkeys)}const s=`${this._gateway}/zarr/${this._isV1?"query/":""}${n.qhash}`,i=t.parameters,c=await this.getSessionHeaders(),a=await Ye.zarr(s,c,{parameters:i,timeout:e.timeout||6e4,nocache:this._nocache});if(t.variables)for(const d of Object.keys(a.variables))!t.variables.includes(d)&&!Object.values(a.coordkeys).includes(d)&&delete a.variables[d];return a}async getDatasource(t){const n=await(await this.metadataRequest(t)).json();return{id:t,geom:n.geometry,...n.properties}}async loadDatasource(t,e={}){const n={datasource:t,parameters:e};return await this.query(n)}async closeSession(t=!1){this._currentSession&&(await this._currentSession.close(t),this._currentSession=null)}};Pu([Ti],Hs.prototype,"stageRequest");Pu([Ti],Hs.prototype,"query");let mp=Hs;var Rn={exports:{}},wp=Rn.exports,ha;function bp(){return ha||(ha=1,(function(r,t){(function(e,n){r.exports=n()})(wp,(function(){var e=1e3,n=6e4,s=36e5,i="millisecond",c="second",a="minute",d="hour",f="day",y="week",B="month",R="quarter",x="year",E="date",L="Invalid Date",F=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,k=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(j){var P=["th","st","nd","rd"],D=j%100;return"["+j+(P[(D-20)%10]||P[D]||P[0])+"]"}},U=function(j,P,D){var Y=String(j);return!Y||Y.length>=P?j:""+Array(P+1-Y.length).join(D)+j},z={s:U,z:function(j){var P=-j.utcOffset(),D=Math.abs(P),Y=Math.floor(D/60),G=D%60;return(P<=0?"+":"-")+U(Y,2,"0")+":"+U(G,2,"0")},m:function j(P,D){if(P.date()<D.date())return-j(D,P);var Y=12*(D.year()-P.year())+(D.month()-P.month()),G=P.clone().add(Y,B),X=D-G<0,K=P.clone().add(Y+(X?-1:1),B);return+(-(Y+(D-G)/(X?G-K:K-G))||0)},a:function(j){return j<0?Math.ceil(j)||0:Math.floor(j)},p:function(j){return{M:B,y:x,w:y,d:f,D:E,h:d,m:a,s:c,ms:i,Q:R}[j]||String(j||"").toLowerCase().replace(/s$/,"")},u:function(j){return j===void 0}},W="en",A={};A[W]=C;var N="$isDayjsObject",m=function(j){return j instanceof O||!(!j||!j[N])},S=function j(P,D,Y){var G;if(!P)return W;if(typeof P=="string"){var X=P.toLowerCase();A[X]&&(G=X),D&&(A[X]=D,G=X);var K=P.split("-");if(!G&&K.length>1)return j(K[0])}else{var q=P.name;A[q]=P,G=q}return!Y&&G&&(W=G),G||!Y&&W},w=function(j,P){if(m(j))return j.clone();var D=typeof P=="object"?P:{};return D.date=j,D.args=arguments,new O(D)},v=z;v.l=S,v.i=m,v.w=function(j,P){return w(j,{locale:P.$L,utc:P.$u,x:P.$x,$offset:P.$offset})};var O=(function(){function j(D){this.$L=S(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[N]=!0}var P=j.prototype;return P.parse=function(D){this.$d=(function(Y){var G=Y.date,X=Y.utc;if(G===null)return new Date(NaN);if(v.u(G))return new Date;if(G instanceof Date)return new Date(G);if(typeof G=="string"&&!/Z$/i.test(G)){var K=G.match(F);if(K){var q=K[2]-1||0,rt=(K[7]||"0").substring(0,3);return X?new Date(Date.UTC(K[1],q,K[3]||1,K[4]||0,K[5]||0,K[6]||0,rt)):new Date(K[1],q,K[3]||1,K[4]||0,K[5]||0,K[6]||0,rt)}}return new Date(G)})(D),this.init()},P.init=function(){var D=this.$d;this.$y=D.getFullYear(),this.$M=D.getMonth(),this.$D=D.getDate(),this.$W=D.getDay(),this.$H=D.getHours(),this.$m=D.getMinutes(),this.$s=D.getSeconds(),this.$ms=D.getMilliseconds()},P.$utils=function(){return v},P.isValid=function(){return this.$d.toString()!==L},P.isSame=function(D,Y){var G=w(D);return this.startOf(Y)<=G&&G<=this.endOf(Y)},P.isAfter=function(D,Y){return w(D)<this.startOf(Y)},P.isBefore=function(D,Y){return this.endOf(Y)<w(D)},P.$g=function(D,Y,G){return v.u(D)?this[Y]:this.set(G,D)},P.unix=function(){return Math.floor(this.valueOf()/1e3)},P.valueOf=function(){return this.$d.getTime()},P.startOf=function(D,Y){var G=this,X=!!v.u(Y)||Y,K=v.p(D),q=function(g,_){var M=v.w(G.$u?Date.UTC(G.$y,_,g):new Date(G.$y,_,g),G);return X?M:M.endOf(f)},rt=function(g,_){return v.w(G.toDate()[g].apply(G.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(_)),G)},At=this.$W,Ut=this.$M,Pt=this.$D,Gt="set"+(this.$u?"UTC":"");switch(K){case x:return X?q(1,0):q(31,11);case B:return X?q(1,Ut):q(0,Ut+1);case y:var Yt=this.$locale().weekStart||0,Z=(At<Yt?At+7:At)-Yt;return q(X?Pt-Z:Pt+(6-Z),Ut);case f:case E:return rt(Gt+"Hours",0);case d:return rt(Gt+"Minutes",1);case a:return rt(Gt+"Seconds",2);case c:return rt(Gt+"Milliseconds",3);default:return this.clone()}},P.endOf=function(D){return this.startOf(D,!1)},P.$set=function(D,Y){var G,X=v.p(D),K="set"+(this.$u?"UTC":""),q=(G={},G[f]=K+"Date",G[E]=K+"Date",G[B]=K+"Month",G[x]=K+"FullYear",G[d]=K+"Hours",G[a]=K+"Minutes",G[c]=K+"Seconds",G[i]=K+"Milliseconds",G)[X],rt=X===f?this.$D+(Y-this.$W):Y;if(X===B||X===x){var At=this.clone().set(E,1);At.$d[q](rt),At.init(),this.$d=At.set(E,Math.min(this.$D,At.daysInMonth())).$d}else q&&this.$d[q](rt);return this.init(),this},P.set=function(D,Y){return this.clone().$set(D,Y)},P.get=function(D){return this[v.p(D)]()},P.add=function(D,Y){var G,X=this;D=Number(D);var K=v.p(Y),q=function(Ut){var Pt=w(X);return v.w(Pt.date(Pt.date()+Math.round(Ut*D)),X)};if(K===B)return this.set(B,this.$M+D);if(K===x)return this.set(x,this.$y+D);if(K===f)return q(1);if(K===y)return q(7);var rt=(G={},G[a]=n,G[d]=s,G[c]=e,G)[K]||1,At=this.$d.getTime()+D*rt;return v.w(At,this)},P.subtract=function(D,Y){return this.add(-1*D,Y)},P.format=function(D){var Y=this,G=this.$locale();if(!this.isValid())return G.invalidDate||L;var X=D||"YYYY-MM-DDTHH:mm:ssZ",K=v.z(this),q=this.$H,rt=this.$m,At=this.$M,Ut=G.weekdays,Pt=G.months,Gt=G.meridiem,Yt=function(_,M,V,$){return _&&(_[M]||_(Y,X))||V[M].slice(0,$)},Z=function(_){return v.s(q%12||12,_,"0")},g=Gt||function(_,M,V){var $=_<12?"AM":"PM";return V?$.toLowerCase():$};return X.replace(k,(function(_,M){return M||(function(V){switch(V){case"YY":return String(Y.$y).slice(-2);case"YYYY":return v.s(Y.$y,4,"0");case"M":return At+1;case"MM":return v.s(At+1,2,"0");case"MMM":return Yt(G.monthsShort,At,Pt,3);case"MMMM":return Yt(Pt,At);case"D":return Y.$D;case"DD":return v.s(Y.$D,2,"0");case"d":return String(Y.$W);case"dd":return Yt(G.weekdaysMin,Y.$W,Ut,2);case"ddd":return Yt(G.weekdaysShort,Y.$W,Ut,3);case"dddd":return Ut[Y.$W];case"H":return String(q);case"HH":return v.s(q,2,"0");case"h":return Z(1);case"hh":return Z(2);case"a":return g(q,rt,!0);case"A":return g(q,rt,!1);case"m":return String(rt);case"mm":return v.s(rt,2,"0");case"s":return String(Y.$s);case"ss":return v.s(Y.$s,2,"0");case"SSS":return v.s(Y.$ms,3,"0");case"Z":return K}return null})(_)||K.replace(":","")}))},P.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},P.diff=function(D,Y,G){var X,K=this,q=v.p(Y),rt=w(D),At=(rt.utcOffset()-this.utcOffset())*n,Ut=this-rt,Pt=function(){return v.m(K,rt)};switch(q){case x:X=Pt()/12;break;case B:X=Pt();break;case R:X=Pt()/3;break;case y:X=(Ut-At)/6048e5;break;case f:X=(Ut-At)/864e5;break;case d:X=Ut/s;break;case a:X=Ut/n;break;case c:X=Ut/e;break;default:X=Ut}return G?X:v.a(X)},P.daysInMonth=function(){return this.endOf(B).$D},P.$locale=function(){return A[this.$L]},P.locale=function(D,Y){if(!D)return this.$L;var G=this.clone(),X=S(D,Y,!0);return X&&(G.$L=X),G},P.clone=function(){return v.w(this.$d,this)},P.toDate=function(){return new Date(this.valueOf())},P.toJSON=function(){return this.isValid()?this.toISOString():null},P.toISOString=function(){return this.$d.toISOString()},P.toString=function(){return this.$d.toUTCString()},j})(),Q=O.prototype;return w.prototype=Q,[["$ms",i],["$s",c],["$m",a],["$H",d],["$W",f],["$M",B],["$y",x],["$D",E]].forEach((function(j){Q[j[1]]=function(P){return this.$g(P,j[0],j[1])}})),w.extend=function(j,P){return j.$i||(j(P,O,w),j.$i=!0),w},w.locale=S,w.isDayjs=m,w.unix=function(j){return w(1e3*j)},w.en=A[W],w.Ls=A,w.p={},w}))})(Rn)),Rn.exports}var _p=bp();const wr=js(_p);var Pn={exports:{}},Sp=Pn.exports,la;function Ip(){return la||(la=1,(function(r,t){(function(e,n){r.exports=n()})(Sp,(function(){var e,n,s=1e3,i=6e4,c=36e5,a=864e5,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f=31536e6,y=2628e6,B=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,R={years:f,months:y,days:a,hours:c,minutes:i,seconds:s,milliseconds:1,weeks:6048e5},x=function(A){return A instanceof z},E=function(A,N,m){return new z(A,m,N.$l)},L=function(A){return n.p(A)+"s"},F=function(A){return A<0},k=function(A){return F(A)?Math.ceil(A):Math.floor(A)},C=function(A){return Math.abs(A)},U=function(A,N){return A?F(A)?{negative:!0,format:""+C(A)+N}:{negative:!1,format:""+A+N}:{negative:!1,format:""}},z=(function(){function A(m,S,w){var v=this;if(this.$d={},this.$l=w,m===void 0&&(this.$ms=0,this.parseFromMilliseconds()),S)return E(m*R[L(S)],this);if(typeof m=="number")return this.$ms=m,this.parseFromMilliseconds(),this;if(typeof m=="object")return Object.keys(m).forEach((function(j){v.$d[L(j)]=m[j]})),this.calMilliseconds(),this;if(typeof m=="string"){var O=m.match(B);if(O){var Q=O.slice(2).map((function(j){return j!=null?Number(j):0}));return this.$d.years=Q[0],this.$d.months=Q[1],this.$d.weeks=Q[2],this.$d.days=Q[3],this.$d.hours=Q[4],this.$d.minutes=Q[5],this.$d.seconds=Q[6],this.calMilliseconds(),this}}return this}var N=A.prototype;return N.calMilliseconds=function(){var m=this;this.$ms=Object.keys(this.$d).reduce((function(S,w){return S+(m.$d[w]||0)*R[w]}),0)},N.parseFromMilliseconds=function(){var m=this.$ms;this.$d.years=k(m/f),m%=f,this.$d.months=k(m/y),m%=y,this.$d.days=k(m/a),m%=a,this.$d.hours=k(m/c),m%=c,this.$d.minutes=k(m/i),m%=i,this.$d.seconds=k(m/s),m%=s,this.$d.milliseconds=m},N.toISOString=function(){var m=U(this.$d.years,"Y"),S=U(this.$d.months,"M"),w=+this.$d.days||0;this.$d.weeks&&(w+=7*this.$d.weeks);var v=U(w,"D"),O=U(this.$d.hours,"H"),Q=U(this.$d.minutes,"M"),j=this.$d.seconds||0;this.$d.milliseconds&&(j+=this.$d.milliseconds/1e3,j=Math.round(1e3*j)/1e3);var P=U(j,"S"),D=m.negative||S.negative||v.negative||O.negative||Q.negative||P.negative,Y=O.format||Q.format||P.format?"T":"",G=(D?"-":"")+"P"+m.format+S.format+v.format+Y+O.format+Q.format+P.format;return G==="P"||G==="-P"?"P0D":G},N.toJSON=function(){return this.toISOString()},N.format=function(m){var S=m||"YYYY-MM-DDTHH:mm:ss",w={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return S.replace(d,(function(v,O){return O||String(w[v])}))},N.as=function(m){return this.$ms/R[L(m)]},N.get=function(m){var S=this.$ms,w=L(m);return w==="milliseconds"?S%=1e3:S=w==="weeks"?k(S/R[w]):this.$d[w],S||0},N.add=function(m,S,w){var v;return v=S?m*R[L(S)]:x(m)?m.$ms:E(m,this).$ms,E(this.$ms+v*(w?-1:1),this)},N.subtract=function(m,S){return this.add(m,S,!0)},N.locale=function(m){var S=this.clone();return S.$l=m,S},N.clone=function(){return E(this.$ms,this)},N.humanize=function(m){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!m)},N.valueOf=function(){return this.asMilliseconds()},N.milliseconds=function(){return this.get("milliseconds")},N.asMilliseconds=function(){return this.as("milliseconds")},N.seconds=function(){return this.get("seconds")},N.asSeconds=function(){return this.as("seconds")},N.minutes=function(){return this.get("minutes")},N.asMinutes=function(){return this.as("minutes")},N.hours=function(){return this.get("hours")},N.asHours=function(){return this.as("hours")},N.days=function(){return this.get("days")},N.asDays=function(){return this.as("days")},N.weeks=function(){return this.get("weeks")},N.asWeeks=function(){return this.as("weeks")},N.months=function(){return this.get("months")},N.asMonths=function(){return this.as("months")},N.years=function(){return this.get("years")},N.asYears=function(){return this.as("years")},A})(),W=function(A,N,m){return A.add(N.years()*m,"y").add(N.months()*m,"M").add(N.days()*m,"d").add(N.hours()*m,"h").add(N.minutes()*m,"m").add(N.seconds()*m,"s").add(N.milliseconds()*m,"ms")};return function(A,N,m){e=m,n=m().$utils(),m.duration=function(v,O){var Q=m.locale();return E(v,{$l:Q},O)},m.isDuration=x;var S=N.prototype.add,w=N.prototype.subtract;N.prototype.add=function(v,O){return x(v)?W(this,v,1):S.bind(this)(v,O)},N.prototype.subtract=function(v,O){return x(v)?W(this,v,-1):w.bind(this)(v,O)}}}))})(Pn)),Pn.exports}var Bp=Ip();const vp=js(Bp);wr.extend(vp);const xp=r=>{if(r instanceof Date)return wr(r).toISOString();if(r instanceof wr)return r.toISOString();if(r instanceof wr.duration)return r.toISOString();try{return wr.duration(r).toISOString()}catch{return wr(r).toISOString()}},Ap=r=>{const t=r.times.map(e=>xp(e));return{type:r.type||"range",times:t,resolution:r.resolution,resample:r.resample}};class Ep{datasource;parameters;description;variables;timefilter;geofilter;levelfilter;coordfilter;crs;aggregate;limit;id;constructor(t){this.datasource=t.datasource,this.parameters=t.parameters,this.description=t.description,this.variables=t.variables,this.timefilter=t.timefilter&&Ap(t.timefilter),this.geofilter=t.geofilter,this.levelfilter=t.levelfilter,this.coordfilter=t.coordfilter,this.crs=t.crs,this.aggregate=t.aggregate,this.limit=t.limit,this.id=t.id}toJSON(){return{datasource:this.datasource,parameters:this.parameters,description:this.description,variables:this.variables,timefilter:this.timefilter,geofilter:this.geofilter,levelfilter:this.levelfilter,coordfilter:this.coordfilter,crs:this.crs,aggregate:this.aggregate,limit:this.limit,id:this.id}}}exports.Connector=mp;exports.DataVar=wi;exports.Dataset=Ye;exports.Query=Ep;exports.cftimeToUnixSeconds=Uu;exports.date2num=Qf;exports.getSupportedCalendars=tp;exports.hasCFTimeUnits=Du;exports.isCalendarSupported=ku;exports.num2date=Xf;exports.parseCFUnits=Ni;exports.wkb_to_geojson=Lu;
9
+ `))}z.fill(0),s.createHash=function(w){return W(w)},s.createHmac=W,s.randomBytes=function(w,v){if(!v||!v.call)return new E(k(w));try{v.call(this,void 0,new E(k(w)))}catch(O){v(O)}};var N,m=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],S=function(w){s[w]=function(){A("sorry,",w,"is not implemented yet")}};for(N in m)S(m[N])}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){var E=e("./helpers");function L(A,N){A[N>>5]|=128<<N%32,A[14+(N+64>>>9<<4)]=N;for(var m=1732584193,S=-271733879,w=-1732584194,v=271733878,O=0;O<A.length;O+=16){var Q=m,j=S,P=w,D=v,m=k(m,S,w,v,A[O+0],7,-680876936),v=k(v,m,S,w,A[O+1],12,-389564586),w=k(w,v,m,S,A[O+2],17,606105819),S=k(S,w,v,m,A[O+3],22,-1044525330);m=k(m,S,w,v,A[O+4],7,-176418897),v=k(v,m,S,w,A[O+5],12,1200080426),w=k(w,v,m,S,A[O+6],17,-1473231341),S=k(S,w,v,m,A[O+7],22,-45705983),m=k(m,S,w,v,A[O+8],7,1770035416),v=k(v,m,S,w,A[O+9],12,-1958414417),w=k(w,v,m,S,A[O+10],17,-42063),S=k(S,w,v,m,A[O+11],22,-1990404162),m=k(m,S,w,v,A[O+12],7,1804603682),v=k(v,m,S,w,A[O+13],12,-40341101),w=k(w,v,m,S,A[O+14],17,-1502002290),m=C(m,S=k(S,w,v,m,A[O+15],22,1236535329),w,v,A[O+1],5,-165796510),v=C(v,m,S,w,A[O+6],9,-1069501632),w=C(w,v,m,S,A[O+11],14,643717713),S=C(S,w,v,m,A[O+0],20,-373897302),m=C(m,S,w,v,A[O+5],5,-701558691),v=C(v,m,S,w,A[O+10],9,38016083),w=C(w,v,m,S,A[O+15],14,-660478335),S=C(S,w,v,m,A[O+4],20,-405537848),m=C(m,S,w,v,A[O+9],5,568446438),v=C(v,m,S,w,A[O+14],9,-1019803690),w=C(w,v,m,S,A[O+3],14,-187363961),S=C(S,w,v,m,A[O+8],20,1163531501),m=C(m,S,w,v,A[O+13],5,-1444681467),v=C(v,m,S,w,A[O+2],9,-51403784),w=C(w,v,m,S,A[O+7],14,1735328473),m=U(m,S=C(S,w,v,m,A[O+12],20,-1926607734),w,v,A[O+5],4,-378558),v=U(v,m,S,w,A[O+8],11,-2022574463),w=U(w,v,m,S,A[O+11],16,1839030562),S=U(S,w,v,m,A[O+14],23,-35309556),m=U(m,S,w,v,A[O+1],4,-1530992060),v=U(v,m,S,w,A[O+4],11,1272893353),w=U(w,v,m,S,A[O+7],16,-155497632),S=U(S,w,v,m,A[O+10],23,-1094730640),m=U(m,S,w,v,A[O+13],4,681279174),v=U(v,m,S,w,A[O+0],11,-358537222),w=U(w,v,m,S,A[O+3],16,-722521979),S=U(S,w,v,m,A[O+6],23,76029189),m=U(m,S,w,v,A[O+9],4,-640364487),v=U(v,m,S,w,A[O+12],11,-421815835),w=U(w,v,m,S,A[O+15],16,530742520),m=z(m,S=U(S,w,v,m,A[O+2],23,-995338651),w,v,A[O+0],6,-198630844),v=z(v,m,S,w,A[O+7],10,1126891415),w=z(w,v,m,S,A[O+14],15,-1416354905),S=z(S,w,v,m,A[O+5],21,-57434055),m=z(m,S,w,v,A[O+12],6,1700485571),v=z(v,m,S,w,A[O+3],10,-1894986606),w=z(w,v,m,S,A[O+10],15,-1051523),S=z(S,w,v,m,A[O+1],21,-2054922799),m=z(m,S,w,v,A[O+8],6,1873313359),v=z(v,m,S,w,A[O+15],10,-30611744),w=z(w,v,m,S,A[O+6],15,-1560198380),S=z(S,w,v,m,A[O+13],21,1309151649),m=z(m,S,w,v,A[O+4],6,-145523070),v=z(v,m,S,w,A[O+11],10,-1120210379),w=z(w,v,m,S,A[O+2],15,718787259),S=z(S,w,v,m,A[O+9],21,-343485551),m=W(m,Q),S=W(S,j),w=W(w,P),v=W(v,D)}return Array(m,S,w,v)}function F(A,N,m,S,w,v){return W((N=W(W(N,A),W(S,v)))<<w|N>>>32-w,m)}function k(A,N,m,S,w,v,O){return F(N&m|~N&S,A,N,w,v,O)}function C(A,N,m,S,w,v,O){return F(N&S|m&~S,A,N,w,v,O)}function U(A,N,m,S,w,v,O){return F(N^m^S,A,N,w,v,O)}function z(A,N,m,S,w,v,O){return F(m^(N|~S),A,N,w,v,O)}function W(A,N){var m=(65535&A)+(65535&N);return(A>>16)+(N>>16)+(m>>16)<<16|65535&m}n.exports=function(A){return E.hash(A,L,16)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){n.exports=function(E){for(var L,F=new Array(E),k=0;k<E;k++)(3&k)==0&&(L=4294967296*Math.random()),F[k]=L>>>((3&k)<<3)&255;return F}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){var E=e("./helpers");function L(C,U){C[U>>5]|=128<<24-U%32,C[15+(U+64>>9<<4)]=U;for(var z,W,A,N=Array(80),m=1732584193,S=-271733879,w=-1732584194,v=271733878,O=-1009589776,Q=0;Q<C.length;Q+=16){for(var j=m,P=S,D=w,Y=v,G=O,X=0;X<80;X++){N[X]=X<16?C[Q+X]:k(N[X-3]^N[X-8]^N[X-14]^N[X-16],1);var K=F(F(k(m,5),(K=S,W=w,A=v,(z=X)<20?K&W|~K&A:!(z<40)&&z<60?K&W|K&A|W&A:K^W^A)),F(F(O,N[X]),(z=X)<20?1518500249:z<40?1859775393:z<60?-1894007588:-899497514)),O=v,v=w,w=k(S,30),S=m,m=K}m=F(m,j),S=F(S,P),w=F(w,D),v=F(v,Y),O=F(O,G)}return Array(m,S,w,v,O)}function F(C,U){var z=(65535&C)+(65535&U);return(C>>16)+(U>>16)+(z>>16)<<16|65535&z}function k(C,U){return C<<U|C>>>32-U}n.exports=function(C){return E.hash(C,L,20,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){function E(U,z){var W=(65535&U)+(65535&z);return(U>>16)+(z>>16)+(W>>16)<<16|65535&W}function L(U,z){var W,A=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),N=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),m=new Array(64);U[z>>5]|=128<<24-z%32,U[15+(z+64>>9<<4)]=z;for(var S,w,v=0;v<U.length;v+=16){for(var O=N[0],Q=N[1],j=N[2],P=N[3],D=N[4],Y=N[5],G=N[6],X=N[7],K=0;K<64;K++)m[K]=K<16?U[K+v]:E(E(E((w=m[K-2],k(w,17)^k(w,19)^C(w,10)),m[K-7]),(w=m[K-15],k(w,7)^k(w,18)^C(w,3))),m[K-16]),W=E(E(E(E(X,k(w=D,6)^k(w,11)^k(w,25)),D&Y^~D&G),A[K]),m[K]),S=E(k(S=O,2)^k(S,13)^k(S,22),O&Q^O&j^Q&j),X=G,G=Y,Y=D,D=E(P,W),P=j,j=Q,Q=O,O=E(W,S);N[0]=E(O,N[0]),N[1]=E(Q,N[1]),N[2]=E(j,N[2]),N[3]=E(P,N[3]),N[4]=E(D,N[4]),N[5]=E(Y,N[5]),N[6]=E(G,N[6]),N[7]=E(X,N[7])}return N}var F=e("./helpers"),k=function(U,z){return U>>>z|U<<32-z},C=function(U,z){return U>>>z};n.exports=function(U){return F.hash(U,L,32,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){s.read=function(E,L,F,k,v){var U,z,W=8*v-k-1,A=(1<<W)-1,N=A>>1,m=-7,S=F?v-1:0,w=F?-1:1,v=E[L+S];for(S+=w,U=v&(1<<-m)-1,v>>=-m,m+=W;0<m;U=256*U+E[L+S],S+=w,m-=8);for(z=U&(1<<-m)-1,U>>=-m,m+=k;0<m;z=256*z+E[L+S],S+=w,m-=8);if(U===0)U=1-N;else{if(U===A)return z?NaN:1/0*(v?-1:1);z+=Math.pow(2,k),U-=N}return(v?-1:1)*z*Math.pow(2,U-k)},s.write=function(E,L,F,k,C,O){var z,W,A=8*O-C-1,N=(1<<A)-1,m=N>>1,S=C===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=k?0:O-1,v=k?1:-1,O=L<0||L===0&&1/L<0?1:0;for(L=Math.abs(L),isNaN(L)||L===1/0?(W=isNaN(L)?1:0,z=N):(z=Math.floor(Math.log(L)/Math.LN2),L*(k=Math.pow(2,-z))<1&&(z--,k*=2),2<=(L+=1<=z+m?S/k:S*Math.pow(2,1-m))*k&&(z++,k/=2),N<=z+m?(W=0,z=N):1<=z+m?(W=(L*k-1)*Math.pow(2,C),z+=m):(W=L*Math.pow(2,m-1)*Math.pow(2,C),z=0));8<=C;E[F+w]=255&W,w+=v,W/=256,C-=8);for(z=z<<C|W,A+=C;0<A;E[F+w]=255&z,w+=v,z/=256,A-=8);E[F+w-v]|=128*O}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(e,n,s){(function(i,c,a,d,f,y,B,R,x){var E,L,F;function k(){}(i=n.exports={}).nextTick=(L=typeof window<"u"&&window.setImmediate,F=typeof window<"u"&&window.postMessage&&window.addEventListener,L?function(C){return window.setImmediate(C)}:F?(E=[],window.addEventListener("message",function(C){var U=C.source;U!==window&&U!==null||C.data!=="process-tick"||(C.stopPropagation(),0<E.length&&E.shift()())},!0),function(C){E.push(C),window.postMessage("process-tick","*")}):function(C){setTimeout(C,0)}),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=k,i.addListener=k,i.once=k,i.off=k,i.removeListener=k,i.removeAllListeners=k,i.emit=k,i.binding=function(C){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(C){throw new Error("process.chdir is not supported")}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})})(Wi)),Wi.exports}var _f=bf();const Sf=js(_f);new TextEncoder;const If=4096;function Mu(r,t,e){let n=t;const s=n+e,i=[];let c="";for(;n<s;){const a=r[n++];if((a&128)===0)i.push(a);else if((a&224)===192){const d=r[n++]&63;i.push((a&31)<<6|d)}else if((a&240)===224){const d=r[n++]&63,f=r[n++]&63;i.push((a&31)<<12|d<<6|f)}else if((a&248)===240){const d=r[n++]&63,f=r[n++]&63,y=r[n++]&63;let B=(a&7)<<18|d<<12|f<<6|y;B>65535&&(B-=65536,i.push(B>>>10&1023|55296),B=56320|B&1023),i.push(B)}else i.push(a);i.length>=If&&(c+=String.fromCharCode(...i),i.length=0)}return i.length>0&&(c+=String.fromCharCode(...i)),c}const Bf=new TextDecoder,vf=200;function xf(r,t,e){const n=r.subarray(t,t+e);return Bf.decode(n)}function Af(r,t,e){return e>vf?xf(r,t,e):Mu(r,t,e)}class En{type;data;constructor(t,e){this.type=t,this.data=e}}class se extends Error{constructor(t){super(t);const e=Object.create(se.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:se.name})}}const Hr=4294967295;function Ef(r,t,e){const n=Math.floor(e/4294967296),s=e;r.setUint32(t,n),r.setUint32(t+4,s)}function Nu(r,t){const e=r.getInt32(t),n=r.getUint32(t+4);return e*4294967296+n}function Tf(r,t){const e=r.getUint32(t),n=r.getUint32(t+4);return e*4294967296+n}const Mf=-1,Nf=4294967296-1,Ff=17179869184-1;function Of({sec:r,nsec:t}){if(r>=0&&t>=0&&r<=Ff)if(t===0&&r<=Nf){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,r),e}else{const e=r/4294967296,n=r&4294967295,s=new Uint8Array(8),i=new DataView(s.buffer);return i.setUint32(0,t<<2|e&3),i.setUint32(4,n),s}else{const e=new Uint8Array(12),n=new DataView(e.buffer);return n.setUint32(0,t),Ef(n,4,r),e}}function kf(r){const t=r.getTime(),e=Math.floor(t/1e3),n=(t-e*1e3)*1e6,s=Math.floor(n/1e9);return{sec:e+s,nsec:n-s*1e9}}function Df(r){if(r instanceof Date){const t=kf(r);return Of(t)}else return null}function Uf(r){const t=new DataView(r.buffer,r.byteOffset,r.byteLength);switch(r.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),n=t.getUint32(4),s=(e&3)*4294967296+n,i=e>>>2;return{sec:s,nsec:i}}case 12:{const e=Nu(t,4),n=t.getUint32(0);return{sec:e,nsec:n}}default:throw new se(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function Lf(r){const t=Uf(r);return new Date(t.sec*1e3+t.nsec/1e6)}const Cf={type:Mf,encode:Df,decode:Lf};class Zs{static defaultCodec=new Zs;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(Cf)}register({type:t,encode:e,decode:n}){if(t>=0)this.encoders[t]=e,this.decoders[t]=n;else{const s=-1-t;this.builtInEncoders[s]=e,this.builtInDecoders[s]=n}}tryToEncode(t,e){for(let n=0;n<this.builtInEncoders.length;n++){const s=this.builtInEncoders[n];if(s!=null){const i=s(t,e);if(i!=null){const c=-1-n;return new En(c,i)}}}for(let n=0;n<this.encoders.length;n++){const s=this.encoders[n];if(s!=null){const i=s(t,e);if(i!=null){const c=n;return new En(c,i)}}}return t instanceof En?t:null}decode(t,e,n){const s=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return s?s(t,e,n):new En(e,t)}}function Rf(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function na(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):Rf(r)?new Uint8Array(r):Uint8Array.from(r)}function Zi(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const Pf=16,$f=16;class zf{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(t=Pf,e=$f){this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,n){const s=this.caches[n-1];t:for(const i of s){const c=i.bytes;for(let a=0;a<n;a++)if(c[a]!==t[e+a])continue t;return i.str}return null}store(t,e){const n=this.caches[t.length-1],s={bytes:t,str:e};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=s:n.push(s)}decode(t,e,n){const s=this.find(t,e,n);if(s!=null)return this.hit++,s;this.miss++;const i=Mu(t,e,n),c=Uint8Array.prototype.slice.call(t,e,e+n);return this.store(c,i),i}}const us="array",cn="map_key",Fu="map_value",jf=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new se("The type of key must be string or number but "+typeof r)};class Vf{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=us,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=cn,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===us){const n=t;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(t.type===cn||t.type===Fu){const n=t;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const qr=-1,Gs=new DataView(new ArrayBuffer(0)),Wf=new Uint8Array(Gs.buffer);try{Gs.getInt8(0)}catch(r){if(!(r instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const ia=new RangeError("Insufficient data"),Zf=new zf;class Ys{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=Gs;bytes=Wf;headByte=qr;stack=new Vf;entered=!1;constructor(t){this.extensionCodec=t?.extensionCodec??Zs.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.rawStrings=t?.rawStrings??!1,this.maxStrLength=t?.maxStrLength??Hr,this.maxBinLength=t?.maxBinLength??Hr,this.maxArrayLength=t?.maxArrayLength??Hr,this.maxMapLength=t?.maxMapLength??Hr,this.maxExtLength=t?.maxExtLength??Hr,this.keyDecoder=t?.keyDecoder!==void 0?t.keyDecoder:Zf,this.mapKeyConverter=t?.mapKeyConverter??jf}clone(){return new Ys({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=qr,this.stack.reset()}setBuffer(t){const e=na(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===qr&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),n=na(t),s=new Uint8Array(e.length+n.length);s.set(e),s.set(n,e.length),this.setBuffer(s)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:n}=this;return new RangeError(`Extra ${e.byteLength-n} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,n;for await(const a of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{n=this.doDecodeSync(),e=!0}catch(d){if(!(d instanceof RangeError))throw d}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:s,pos:i,totalPos:c}=this;throw new RangeError(`Insufficient data in parsing ${Zi(s)} at ${c} (${i} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let n=e,s=-1;for await(const i of t){if(e&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),n&&(s=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--s!==0;);}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){t:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const s=t-128;if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t<160){const s=t-144;if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else{const s=t-160;e=this.decodeString(s,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const s=this.lookU8();e=this.decodeString(s,1)}else if(t===218){const s=this.lookU16();e=this.decodeString(s,2)}else if(t===219){const s=this.lookU32();e=this.decodeString(s,4)}else if(t===220){const s=this.readU16();if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else if(t===221){const s=this.readU32();if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else if(t===222){const s=this.readU16();if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t===223){const s=this.readU32();if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t===196){const s=this.lookU8();e=this.decodeBinary(s,1)}else if(t===197){const s=this.lookU16();e=this.decodeBinary(s,2)}else if(t===198){const s=this.lookU32();e=this.decodeBinary(s,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const s=this.lookU8();e=this.decodeExtension(s,1)}else if(t===200){const s=this.lookU16();e=this.decodeExtension(s,2)}else if(t===201){const s=this.lookU32();e=this.decodeExtension(s,4)}else throw new se(`Unrecognized type byte: ${Zi(t)}`);this.complete();const n=this.stack;for(;n.length>0;){const s=n.top();if(s.type===us)if(s.array[s.position]=e,s.position++,s.position===s.size)e=s.array,n.release(s);else continue t;else if(s.type===cn){if(e==="__proto__")throw new se("The key __proto__ is not allowed");s.key=this.mapKeyConverter(e),s.type=Fu;continue t}else if(s.map[s.key]=e,s.readCount++,s.readCount===s.size)e=s.map,n.release(s);else{s.key=null,s.type=cn;continue t}}return e}}readHeadByte(){return this.headByte===qr&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=qr}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new se(`Unrecognized array type byte: ${Zi(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new se(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new se(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){if(t>this.maxStrLength)throw new se(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw ia;const n=this.pos+e;let s;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(t)?s=this.keyDecoder.decode(this.bytes,n,t):s=Af(this.bytes,n,t),this.pos+=e+t,s}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===cn:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new se(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw ia;const n=this.pos+e,s=this.bytes.subarray(n,n+t);return this.pos+=e+t,s}decodeExtension(t,e){if(t>this.maxExtLength)throw new se(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+e),s=this.decodeBinary(t,e+1);return this.extensionCodec.decode(s,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=Tf(this.view,this.pos);return this.pos+=8,t}readI64(){const t=Nu(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function Gf(r,t){return new Ys(t).decode(r)}pa.set("msgpack2",async()=>({kind:"array_to_bytes",fromConfig:(r,t)=>({kind:"array_to_bytes",async encode(e){throw new Error("msgpack2 encode not implemented")},async decode(e){const n=Gf(e),{shape:s}=t,i=new Array(s.length);let c=1;for(let a=s.length-1;a>=0;a--)i[a]=c,c*=s[a];return{data:n,shape:s,stride:i}}})}));function Yf(r){return new Promise(t=>setTimeout(t,r))}const Gi="__cache_created_at";class Jf{cache;url;params;cache_prefix;fetchOptions;timeout;ttl;_pending={};_cacheValid;constructor(t,e,n={}){const s={...e};n.parameters&&(s["x-parameters"]=JSON.stringify(n.parameters)),n.chunks&&(s["x-chunks"]=n.chunks),n.downsample&&(s["x-downsample"]=JSON.stringify(n.downsample)),s["x-filtered"]="True",this.params={},e["x-datamesh-auth"]&&(this.params.auth=e["x-datamesh-auth"]),e["x-datamesh-sig"]&&(this.params.sig=e["x-datamesh-sig"]),this.fetchOptions={headers:s},this.url=t,n.nocache&&console.warn("CachedHTTPStore: 'nocache' option is deprecated, use 'ttl: 0' instead"),n.ttl===0||n.nocache||typeof window>"u"?this.cache=void 0:this.cache=Tu("zarr","cache"),this.cache_prefix=Sf({root:t,...n.parameters,chunks:n.chunks,downsample:n.downsample}),this.timeout=n.timeout||6e4,this.ttl=n.ttl}async checkCacheTTL(){if(!this.ttl||!this.cache)return!1;if(this._cacheValid!==void 0)return this._cacheValid;const t=`${this.cache_prefix}${Gi}`,e=await Vi(t,this.cache);return e?(Date.now()-e)/1e3>this.ttl?(this._cacheValid=!1,!1):(this._cacheValid=!0,!0):(this._cacheValid=!1,!1)}async setCacheTimestamp(){if(!this.cache||!this.ttl)return;const t=`${this.cache_prefix}${Gi}`;await Vi(t,this.cache)||await ea(t,Date.now(),this.cache)}async invalidateCache(){if(!this.cache)return;const t=`${this.cache_prefix}${Gi}`;await xn(t,this.cache),this._cacheValid=!1}async get(t,e,n=0){const s=`${this.cache_prefix}${t}`;let i=null;if(this.cache&&(await this.checkCacheTTL()?i=await Vi(s,this.cache):await this.invalidateCache(),i&&delete this._pending[s],this._pending[s]))if(await Yf(200),n>this.timeout){await xn(s,this.cache),delete this._pending[s],console.error("Zarr timeout");return}else return await this.get(t,e,n+200);if(!i){this._pending[s]=!0;try{const c={...this.fetchOptions,...e,headers:{...this.fetchOptions.headers||{},...e?.headers||{}},signal:AbortSignal.timeout(this.timeout)},a=new URLSearchParams(this.params).toString(),d=await fetch(`${this.url}${t}?${a}`,c);if(d.status===404){this.cache&&await xn(s,this.cache);return}if(d.status>=400)throw new Error(`HTTP error: ${d.status}`);i=new Uint8Array(await d.arrayBuffer()),this.cache&&(await ea(s,i,this.cache),await this.setCacheTimestamp())}catch(c){if(console.debug("Zarr retry:"+s),n<this.timeout/200)return delete this._pending[s],await this.get(t,e,n+200);this.cache&&await xn(s,this.cache),console.error(c);return}finally{delete this._pending[s]}}return i}}const Hf=r=>JSON.parse(r,(t,e)=>typeof e=="bigint"?Number(e):e),sa=async(r,t=".zarray")=>{const{path:e}=r.resolve(t),n=await r.store.get(e);return n?Hf(new TextDecoder().decode(n)):{}};async function qf(r){const t=await sa(r,".zattrs"),e=await sa(r);e.dtype.startsWith("<M8")&&(t._dtype=e.dtype),e.fill_value!==void 0&&(t._fill_value=e.fill_value);const n=[];e.order==="F"&&n.push({name:"transpose",configuration:{order:"F"}}),typeof e.dtype=="string"&&e.dtype.startsWith(">")&&n.push({name:"bytes",configuration:{endian:"big"}});for(const{id:i,...c}of e.filters??[])n.push({name:i,configuration:c});if(e.compressor){const{id:i,...c}=e.compressor;n.push({name:i,configuration:c})}const s={zarr_format:3,node_type:"array",shape:e.shape,data_type:"int64",chunk_grid:{name:"regular",configuration:{chunk_shape:e.chunks}},chunk_key_encoding:{name:"v2",configuration:{separator:e.dimension_separator??"."}},codecs:n,fill_value:e.fill_value,attributes:t};return new xr(r.store,r.path,s)}let Ou=typeof process<"u"&&!!process.env&&process.env.DATAMESH_DEBUG==="true";function oa(){return Ou}function Ti(r,t,e){if(!Ou)return e;const n=e.value;return e.value=function(...s){const i=s.map(a=>{if(!a||typeof a!="object")return a;try{return JSON.parse(JSON.stringify(a,(d,f)=>{if(typeof d=="string"){const y=d.toLowerCase();if(y.includes("token")||y.includes("authorization")||y.includes("jwt"))return"[redacted]"}return f}))}catch{return"[unserializable]"}}),c=Date.now();try{const a=n.apply(this,s);if(a&&typeof a.then=="function")return a.finally(()=>{const f=Date.now()-c;console.debug(`@oceanum/datamesh debug: ${t} took ${f}ms`,i)});const d=Date.now()-c;return console.debug(`@oceanum/datamesh debug: ${t} took ${d}ms`,i),a}catch(a){const d=Date.now()-c;throw console.debug(`@oceanum/datamesh debug: ${t} threw after ${d}ms`,i),a}},e}const Js={microseconds:.001,milliseconds:1,seconds:1e3,minutes:60*1e3,hours:3600*1e3,days:1440*60*1e3},Kf={day:"days",days:"days",d:"days",hour:"hours",hours:"hours",hr:"hours",hrs:"hours",h:"hours",minute:"minutes",minutes:"minutes",min:"minutes",mins:"minutes",second:"seconds",seconds:"seconds",sec:"seconds",secs:"seconds",s:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds",msec:"milliseconds",msecs:"milliseconds",ms:"milliseconds",microsecond:"microseconds",microseconds:"microseconds",usec:"microseconds",usecs:"microseconds",us:"microseconds"},Mi=new Set(["standard","gregorian","proleptic_gregorian"]);function Ni(r){const t=/^\s*(\w+)\s+since\s+(.+?)\s*$/i,e=r.match(t);if(!e)throw new Error(`Invalid CF time units: "${r}". Expected format: "<unit> since <reference_time>"`);const[,n,s]=e,i=n.toLowerCase(),c=Kf[i];if(!c)throw new Error(`Unsupported time unit: "${n}". Supported units: days, hours, minutes, seconds, milliseconds, microseconds`);const a=Xf(s),d=a.getTime();return{unit:c,referenceDate:a,referenceMs:d,original:r}}function Xf(r){const t=r.trim().replace("T"," ").replace(/Z$/i,""),e=/^(-?\d+)-(\d{1,2})-(\d{1,2})(?:\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?)?$/,n=t.match(e);if(!n){const C=new Date(r);if(isNaN(C.getTime()))throw new Error(`Cannot parse reference time: "${r}"`);return C}const[,s,i,c,a,d,f,y]=n,B=parseInt(s,10),R=parseInt(i,10)-1,x=parseInt(c,10),E=a?parseInt(a,10):0,L=d?parseInt(d,10):0,F=f?parseInt(f,10):0;let k=0;if(y){const C=y.padEnd(3,"0").slice(0,3);k=parseInt(C,10)}return new Date(Date.UTC(B,R,x,E,L,F,k))}function Qf(r,t,e="standard"){if(!Mi.has(e))throw new Error(`Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`);const n=Ni(t),s=Js[n.unit];if(typeof r=="number")return new Date(n.referenceMs+r*s);const i=[];for(let c=0;c<r.length;c++){const a=r[c];a==null||Number.isNaN(a)?i.push(new Date(NaN)):i.push(new Date(n.referenceMs+a*s))}return i}function tp(r,t,e="standard"){if(!Mi.has(e))throw new Error(`Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`);const n=Ni(t),s=Js[n.unit];return r instanceof Date?(r.getTime()-n.referenceMs)/s:r.map(i=>!i||isNaN(i.getTime())?NaN:(i.getTime()-n.referenceMs)/s)}function ku(r){return Mi.has(r.toLowerCase())}function ep(){return Array.from(Mi)}function Du(r){const t=r.units;return typeof t=="string"&&/^\s*\w+\s+since\s+.+$/i.test(t)}function Uu(r,t,e="standard"){if(!ku(e))return null;const n=Ni(t),s=Js[n.unit],i=n.referenceMs,c=new Float64Array(r.length);for(let a=0;a<r.length;a++){const d=Number(r[a]);Number.isNaN(d)?c[a]=NaN:c[a]=(i+d*s)/1e3}return c}var rp=Object.defineProperty,np=Object.getOwnPropertyDescriptor,ip=(r,t,e,n)=>{for(var s=np(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&rp(t,e,s),s};const aa=(r,t,e,n,s)=>n?.variables?.[r]?n.variables[r]:s||(n?.dimensions?t.map((i,c)=>n.dimensions?.[i]??e[c]):e),Lu=r=>{const t=new Eu.Buffer(r,"base64");return mf.Geometry.parse(t).toGeoJSON()},mi=r=>r&&(Array.isArray(r)||ArrayBuffer.isView(r)),Yi=r=>{const t=[];if(!mi(r))return t;for(;t.push(r.length),mi(r[0]);)r=r[0];return t},sp=r=>{for(;Array.isArray(r);)r=r[0];if(r==null)return"uint8";switch(r.constructor.name){case"Boolean":return"bool";case"Number":return"float32";case"Int8Array":return"int8";case"Int16Array":return"int16";case"Int32Array":return"int32";case"BigInt64Array":return"int64";case"Uint8Array":return"uint8";case"Uint16Array":return"uint16";case"Uint32Array":return"uint32";case"Float32Array":return"float32";case"Float64Array":return"float64";case"String":return"v2:object";case"Object":return"v2:object"}throw new Error("Unsupported data type: "+r.constructor.name)},op=r=>{let t=r.toString().toLowerCase();return r.typeId==5?t="v2:object":r.typeId==1&&(t="uint8"),t},ca=r=>{if(!Array.isArray(r))return r;const t=r.flat(1/0);if(mi(t[0])){const e=t[0].length,n=new t[0].constructor(t.length*e);for(let s=0;s<t.length;s++)n.set(t[s],s*e);return n}else return t},ua=r=>{const t=r.length,e=Array(t);for(let n=t-1,s=1;n>=0;n--)e[n]=s,s*=r[n];return e},pn=(r,t,e,n=0)=>{if(t.length===0)return r[0];if(t.length===1){const i=new r.constructor(t[0]);return i.set(r.slice(n,n+t[0])),i}const s=new Array(t[0]);for(let i=0;i<t[0];i++)s[i]=pn(r,t.slice(1),e.slice(1),n+i*e[0]);return s},ap=(r,t)=>{const[e,n]=t.split("<M8"),s=new Float64Array(r.data.length);let i=1n;switch(n){case"[ms]":i=1000n;break;case"[us]":i=1000000n;break;case"[ns]":i=1000000000n;break;default:i=1n;break}for(let c=0;c<r.data.length;c++){const a=r.data[c];s[c]=Number(a/i)}return pn(s,r.shape,r.stride)},cp=(r,t,e="standard")=>{const n=Uu(r.data,t,e);return n===null?(console.warn(`Unsupported calendar "${e}" for cftime conversion. Returning raw values. Supported: standard, gregorian, proleptic_gregorian`),pn(r.data,r.shape,r.stride)):pn(n,r.shape,r.stride)},up=r=>{if(r==null)return!0;if(typeof r=="string"){const t=r.toLowerCase();return t==="nan"||t==="-nan"||t==="+nan"}return typeof r=="number"?Number.isNaN(r):!1},hp=(r,t,e)=>{if(!e.startsWith("float")||up(t))return r;if(typeof t=="number"&&!Number.isNaN(t)){const n=e==="float64"?new Float64Array(r.length):new Float32Array(r.length);for(let s=0;s<r.length;s++){const i=r[s];n[s]=Math.abs(i-t)<Math.abs(t*1e-6)?NaN:i}return n}return r},Cu=(r,t,e)=>{const n=Object.keys(t),s={};for(const i in r)mi(r[i].data)&&(s[i]=!0);if(n.length==1)for(let i=0;i<t[n[0]];i++){const c={};for(const a in r)s[a]?r[a].data.length>1&&(c[a]=r[a].data[i]):c[a]=r[a].data;e.push(c)}else for(let i=0;i<t[n[0]];i++){const c={};for(const d in r)r[d].dimensions.includes(n[0])?c[d]={attributes:r[d].attributes,data:r[d].data[i],dimensions:r[d].dimensions.slice(1)}:c[d]=r[d];const a={...t};delete a[n[0]],Cu(c,a,e)}return e};class wi{id;dimensions;attributes;arr;constructor(t,e,n,s){this.id=t,this.dimensions=e,this.attributes=n,this.arr=s}async get(t){if(this.arr.shape.length==0||this.arr.shape[0]==0)return[];const e=t&&t.map(s=>{if(typeof s=="string"){const[i,c,a]=s.split(":");return Hi(parseInt(i),parseInt(c),parseInt(a))}else return s}),n=await Th(this.arr,e);if(this.arr.dtype=="v2:object"||!n.shape)return n.data;if(this.arr.dtype=="bool")return[...n.data];{const s=this.arr.attrs,i=this.arr.dtype,c=s._dtype;if(c?.startsWith("<M8"))return ap(n,c);if(Du(s)){const f=s.units,y=s.calendar||"standard";return cp(n,f,y)}const a=this.attributes._fill_value,d=a?hp(n.data,a,i):n.data;return pn(d,n.shape,n.stride)}}}ip([Ti],wi.prototype,"get");class Ye{dimensions;variables;attributes;coordkeys;root;constructor(t,e,n,s,i){this.dimensions=t,this.variables=e,this.attributes=n,this.coordkeys=s,this.root=i}static async zarr(t,e,n={}){const s=new Jf(t,e,{chunks:n.chunks,downsample:n.downsample,parameters:n.parameters,timeout:n.timeout,nocache:n.nocache,ttl:n.ttl}),i=await kh(s);if(!("contents"in i&&typeof i.contents=="function"))throw new Error("Zarr store does not have consolidated metadata (.zmetadata). Consolidated metadata is required for auto-discovery of variables. For zarr v2 stores, run `zarr.consolidate_metadata(store)` in Python.");const a=i,d=n.group?n.group.startsWith("/")?n.group:`/${n.group}`:void 0,f=await Ue(a,{kind:"group"}),y=d?await Ue(f.resolve(d),{kind:"group"}):f,B={},R={};for(const E of a.contents()){if(E.kind!="array"||d&&!E.path.startsWith(d+"/"))continue;let L;d?L=E.path.slice(d.length+1):L=E.path.replace(/^\//,"");let F;try{F=await Ue(f.resolve(E.path),{kind:"array"})}catch(U){const z=typeof U=="object"&&U&&"message"in U?String(U.message):void 0;if(z&&z.includes("<M8"))F=await qf(f.resolve(E.path));else throw U}const k={...F.attrs};if(k._fill_value===void 0){const U=`${E.path}/.zarray`.replace(/^\//,""),z=await a.get(`/${U}`);if(z){const W=JSON.parse(new TextDecoder().decode(z));W.fill_value!==void 0&&(k._fill_value=W.fill_value)}}let C=k._ARRAY_DIMENSIONS;(!C||!Array.isArray(C))&&(C=F.shape.map((U,z)=>`dim_${z}`)),B[L]=new wi(L,C,k,F),C.map((U,z)=>{const W=F.shape[z];if(R[U]&&R[U]!=W)throw new Error(`Inconsistent dimension size for ${U}: ${R[U]} != ${W}`);R[U]=W})}let x;try{const E=y.attrs._coordinates;typeof E=="string"?x=JSON.parse(E)||{}:E&&typeof E=="object"?x=E:x={}}catch{x={}}return new Ye(R,B,y.attrs,n.coordkeys||x,y)}static async fromArrow(t,e){const n={},s={record:t.numRows},i={};return t.schema.fields.forEach(c=>{const a=t.getChild(c.name);let d={},f=a?.toArray(),y=op(c.type);if(tt.isTimestamp(c.type)){const B=new Float64Array(f.length),R=BigInt(1e3**(c.type.unit-0));for(let x=0;x<f.length;x++)B[x]=Number(f[x]/R);f=B,y="float64",d={unit:"Unix timestamp (s)"}}else if(tt.isBinary(c.type)){const B=[];for(let R=0;R<f.length;R++)B.push(new Eu.Buffer(f[R]).toString("base64"));f=B,y="v2:object"}i[c.name]={dimensions:["record"],attributes:d,data:f,dtype:y}}),await Ye.init({dimensions:s,variables:i,attributes:n},e)}static async fromGeojson(t,e){if(!("features"in t&&Array.isArray(t.features))&&!("geometry"in t))throw new Error("Invalid GeoJSON");const n="features"in t&&t.features?t.features:[t];if(n.length===0)throw new Error("FeatureCollection contains no features");const s=new Set;n.forEach(d=>{d.properties&&Object.keys(d.properties).forEach(f=>s.add(f))});const i=n.map(d=>{const f={geometry:d.geometry};return d.properties&&Object.assign(f,d.properties),f}),c={dimensions:{index:i.length},variables:{},attributes:{}},a=await Ye.init(c,{...e,g:"geometry"});await a.assign("geometry",["index"],i.map(d=>d.geometry),{description:"GeoJSON geometry"});for(const d of s){const f=i.map(y=>y[d]);await a.assign(d,["index"],f,{description:`Property: ${d}`})}return a}static async init(t,e,n){const s=await _n(new Map,{attributes:{created:new Date}}),i=new Ye(t.dimensions,{},t.attributes||{},e||{},s);for(const c in t.variables){const{dimensions:a,attributes:d,data:f,dtype:y,chunks:B}=t.variables[c],R=Yi(f),x=aa(c,a,R,n,B);await i.assign(c,a,f,d,y&&y==="string"?"v2:object":y,x)}return i}async asDataframe(){const t={},e=[];for(const s in this.variables)t[s]={attributes:this.variables[s].attributes,dimensions:this.variables[s].dimensions},t[s].data=await this.variables[s].get(),this.variables[s].arr.dtype=="int64"&&s!=this.coordkeys.t&&e.push(s);const n=Cu(t,{...this.dimensions},[]);if(this.coordkeys.t)for(let s=0;s<n.length;s++)n[s][this.coordkeys.t]=new Date(1e3*n[s][this.coordkeys.t]).toISOString();if(e.length>0)for(const s of e)for(let i=0;i<n.length;i++)n[i][s]=Number(n[i][s]);return n}async asGeojson(t){if(!this.coordkeys.g&&!t)throw new Error("No geometry found");const e=[],n=await this.asDataframe();for(let s=0;s<n.length;s++){const{...i}=n[s];let c=t;if(!c&&this.coordkeys.g){delete i[this.coordkeys.g];const a=n[s][this.coordkeys.g];a.slice(0,7)=='{"type:'?c=JSON.parse(a):c=Lu(a)}e.push({type:"Feature",geometry:c,properties:i})}return{type:"FeatureCollection",features:e}}async assign(t,e,n,s,i,c){const a=Yi(n);if(a.length!=e.length)throw new Error("Data shape does not match dimensions");e.map((B,R)=>{if(this.dimensions[B]){if(this.dimensions[B]!=a[R])throw new Error(`Existing size of dimension ${B} does not match new data`)}else this.dimensions[B]=a[R]});const d=i||sp(n),f=await _n(this.root.resolve(t),{shape:a,data_type:d,chunk_shape:c||a,codecs:d=="v2:object"?[{name:"json2"}]:[]});let y=ca(n);y.length==0?y=null:d=="bool"?y=new $n(y):Array.isArray(y)&&d=="float32"?y=Float32Array.from(y,B=>B??NaN):Array.isArray(y)&&d=="float64"?y=Float64Array.from(y,B=>B??NaN):Array.isArray(y)&&d=="int8"?y=Int8Array.from(y):Array.isArray(y)&&d=="int16"?y=Int16Array.from(y):Array.isArray(y)&&d=="int32"?y=Int32Array.from(y):Array.isArray(y)&&d=="int64"?y=BigInt64Array.from(y.map(B=>BigInt(B))):Array.isArray(y)&&d=="uint8"?y=Uint8Array.from(y):Array.isArray(y)&&d=="uint16"?y=Uint16Array.from(y):Array.isArray(y)&&d=="uint32"?y=Uint32Array.from(y):Array.isArray(y)&&d=="uint64"&&(y=BigUint64Array.from(y.map(B=>BigInt(B)))),y&&await oo(f,a.map(()=>null),{data:y,shape:a,stride:ua(a)}),this.variables[t]=new wi(t,e,s||{},f)}async toZarr(t){const e=t?.chunks,n=new Map,s=await _n(n,{attributes:{...this.attributes,_coordinates:JSON.stringify(this.coordkeys)}});for(const i in this.variables){const c=this.variables[i],a=await c.get(),d=Yi(a),f=c.dimensions,y=aa(i,f,d,e,e?void 0:c.arr.chunks),B=c.arr.dtype,R=await _n(s.resolve(i),{shape:d,data_type:B,chunk_shape:y,codecs:B==="v2:object"?[{name:"json2"}]:void 0,attributes:{...c.attributes,_ARRAY_DIMENSIONS:f}});let x=ca(a);x&&x.length>0&&(B==="bool"?x=new $n(x):Array.isArray(x)&&B==="float32"?x=Float32Array.from(x,E=>E??NaN):Array.isArray(x)&&B==="float64"?x=Float64Array.from(x,E=>E??NaN):Array.isArray(x)&&B==="int8"?x=Int8Array.from(x):Array.isArray(x)&&B==="int16"?x=Int16Array.from(x):Array.isArray(x)&&B==="int32"?x=Int32Array.from(x):Array.isArray(x)&&B==="int64"?x=BigInt64Array.from(x.map(E=>BigInt(E))):Array.isArray(x)&&B==="uint8"?x=Uint8Array.from(x):Array.isArray(x)&&B==="uint16"?x=Uint16Array.from(x):Array.isArray(x)&&B==="uint32"?x=Uint32Array.from(x):Array.isArray(x)&&B==="uint64"&&(x=BigUint64Array.from(x.map(E=>BigInt(E)))),await oo(R,d.map(()=>null),{data:x,shape:d,stride:ua(d)}))}return n}}var lp=Object.defineProperty,dp=Object.getOwnPropertyDescriptor,fp=(r,t,e,n)=>{for(var s=dp(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&lp(t,e,s),s};const Ru=class hs{id;user;creationTime;endTime;write;verified=!1;_connection;_closePromise=null;_closed=!1;_beforeExitHandler=null;static async acquire(t,e={}){if(!t._isV1){const n=new hs;return n.id="dummy_session",n.user="dummy_user",n.creationTime=new Date,n.endTime=new Date(Date.now()+(e.duration||3600)*1e3),n.write=!1,n.verified=!1,n._connection=t,typeof process<"u"&&process.on&&(n._beforeExitHandler=()=>{n.close()},process.once("beforeExit",n._beforeExitHandler)),n}try{const n={...t._authHeaders};n["Cache-Control"]="no-store";const s=new URLSearchParams({duration:String(e.duration??3600)}),i=await fetch(`${t._gateway}/session/?${s.toString()}`,{headers:n});if(i.status!==200)throw new Error(`Failed to create session: ${await i.text()}`);const c=await i.json(),a=new hs;return a.id=c.id,a.user=c.user,a.creationTime=new Date(c.creation_time),a.endTime=new Date(c.end_time),a.write=c.write,a.verified=c.verified||!1,a._connection=t,typeof process<"u"&&process.on&&(a._beforeExitHandler=()=>{a.close()},process.once("beforeExit",a._beforeExitHandler)),a}catch(n){throw new Error(`Error when acquiring datamesh session: ${n}`)}}get header(){return{"X-DATAMESH-SESSIONID":this.id}}addHeader(t){return{...t,...this.header}}async close(t=!1){if(this._connection._isV1&&!this._closed)return this._closePromise?this._closePromise:(this._closePromise=(async()=>{try{this._beforeExitHandler&&typeof process<"u"&&process.off&&(process.off("beforeExit",this._beforeExitHandler),this._beforeExitHandler=null);const e=await fetch(`${this._connection._gateway}/session/${this.id}`,{method:"DELETE",headers:this.header,body:JSON.stringify({finalise_write:t})});if(e.status===204){this._closed=!0;return}const n=await e.text();if(e.status===404&&n.includes("Session not found")){this._closed=!0;return}if(t)throw new Error(`Failed to finalise write: ${n}`);console.warn(`Failed to close session: ${n}`)}catch(e){if(t)throw new Error(`Error when closing datamesh session: ${e}`);console.warn(`Error when closing datamesh session: ${e}`)}finally{this._closePromise=null}})(),this._closePromise)}async enter(){return this}async exit(t){await this.close(t===void 0)}};fp([Ti],Ru,"acquire");let pp=Ru;var yp=Object.defineProperty,gp=Object.getOwnPropertyDescriptor,Pu=(r,t,e,n)=>{for(var s=gp(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&yp(t,e,s),s};const mp=typeof process<"u"&&process.env?.DATAMESH_SERVICE?process.env.DATAMESH_SERVICE:"https://datamesh.oceanum.io",Hs=class $u{static LAZY_LOAD_SIZE=1e8;_token;_host;_authHeaders;_gateway;_nocache=!1;_isV1=!0;_sessionParams={};_currentSession=null;service;gateway;constructor(t=typeof process<"u"&&process.env?.DATAMESH_TOKEN?process.env.DATAMESH_TOKEN:"$DATAMESH_TOKEN",e){if(!t&&!e?.jwtAuth)throw new Error("A valid datamesh token must be supplied as a connector constructor argument or defined in environment variables as DATAMESH_TOKEN");this._token=t,this._nocache=e?.nocache??!1;const n=new URL(e?.service||mp);this._host=`${n.protocol}//${n.hostname}`,this._authHeaders=e?.jwtAuth?{Authorization:`Bearer ${e.jwtAuth}`}:{Authorization:`Token ${this._token}`,"X-DATAMESH-TOKEN":this._token},this._gateway=e?.gateway||this._host,this._host.split(".").slice(-1)[0]!==this._gateway.split(".").slice(-1)[0]&&console.warn("Datamesh gateway and service domains do not match"),e?.sessionDuration&&typeof e.sessionDuration=="number"&&(this._sessionParams={duration:e.sessionDuration}),this._checkApiVersion()}async _checkApiVersion(){try{(await fetch(`${this._gateway}/session`,{headers:this._authHeaders})).status===200?(this._isV1=!0,console.info("Using datamesh API version 1")):(this._isV1=!1,console.info("Using datamesh API version 0"))}catch{this._isV1=!1,console.info("Using datamesh API version 0")}}get host(){return this._host}async status(){return(await fetch(this._host,{headers:this._authHeaders})).status===200}async validateResponse(t){if(t.status>=400){let e;try{e=(await t.json()).detail}catch{e=`Datamesh server error: ${await t.text()}`}throw new Error(e)}}async createSession(t={}){const e={duration:t.duration||this._sessionParams.duration||3600};return this._currentSession=await pp.acquire(this,e),this._currentSession}async getSession(){return this._currentSession?this._currentSession:this.createSession()}async getSessionHeaders(t={}){return this._isV1&&!this._currentSession&&await this.createSession(),this._currentSession?this._currentSession.addHeader({...this._authHeaders,...t}):{...this._authHeaders,...t}}async metadataRequest(t="",e={}){const n=new URL(`${this._host}/datasource/${t}`);Object.keys(e).forEach(c=>n.searchParams.append(c,e[c]));const s=await this.getSessionHeaders(),i=await fetch(n.toString(),{headers:s});if(i.status===403)throw new Error(`Datasource ${t} not authorized`);return await this.validateResponse(i),i}async dataRequest(t,e="application/vnd.apache.arrow.file"){const n=await this.getSessionHeaders({Accept:e}),s=await fetch(`${this._gateway}/oceanql/${t}?f=arrow`,{headers:n});return await this.validateResponse(s),Iu(await s.arrayBuffer())}async stageRequest(t){oa()&&console.debug("@oceanum/datamesh debug: stageRequest query",t);const e=JSON.stringify(t),n=await this.getSessionHeaders({"Content-Type":"application/json"}),s=await fetch(`${this._gateway}/oceanql/stage/`,{method:"POST",headers:n,body:e});if(s.status>=400){const i=await s.json();throw new Error(i.detail)}else return s.status===204?null:s.json()}async query(t,e={}){oa()&&console.debug("@oceanum/datamesh debug: query called",t);const n=await this.stageRequest(t);if(!n)return console.warn("No data found for query"),null;if(n.size<$u.LAZY_LOAD_SIZE&&n.container!="dataset"){const d=await this.dataRequest(n.qhash);return await Ye.fromArrow(d,n.coordkeys)}const s=`${this._gateway}/zarr/${this._isV1?"query/":""}${n.qhash}`,i=t.parameters,c=await this.getSessionHeaders(),a=await Ye.zarr(s,c,{parameters:i,timeout:e.timeout||6e4,nocache:this._nocache});if(t.variables)for(const d of Object.keys(a.variables))!t.variables.includes(d)&&!Object.values(a.coordkeys).includes(d)&&delete a.variables[d];return a}async getDatasource(t){const n=await(await this.metadataRequest(t)).json();return{id:t,geom:n.geometry,...n.properties}}async loadDatasource(t,e={}){const n={datasource:t,parameters:e};return await this.query(n)}async closeSession(t=!1){this._currentSession&&(await this._currentSession.close(t),this._currentSession=null)}};Pu([Ti],Hs.prototype,"stageRequest");Pu([Ti],Hs.prototype,"query");let wp=Hs;var Rn={exports:{}},bp=Rn.exports,ha;function _p(){return ha||(ha=1,(function(r,t){(function(e,n){r.exports=n()})(bp,(function(){var e=1e3,n=6e4,s=36e5,i="millisecond",c="second",a="minute",d="hour",f="day",y="week",B="month",R="quarter",x="year",E="date",L="Invalid Date",F=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,k=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(j){var P=["th","st","nd","rd"],D=j%100;return"["+j+(P[(D-20)%10]||P[D]||P[0])+"]"}},U=function(j,P,D){var Y=String(j);return!Y||Y.length>=P?j:""+Array(P+1-Y.length).join(D)+j},z={s:U,z:function(j){var P=-j.utcOffset(),D=Math.abs(P),Y=Math.floor(D/60),G=D%60;return(P<=0?"+":"-")+U(Y,2,"0")+":"+U(G,2,"0")},m:function j(P,D){if(P.date()<D.date())return-j(D,P);var Y=12*(D.year()-P.year())+(D.month()-P.month()),G=P.clone().add(Y,B),X=D-G<0,K=P.clone().add(Y+(X?-1:1),B);return+(-(Y+(D-G)/(X?G-K:K-G))||0)},a:function(j){return j<0?Math.ceil(j)||0:Math.floor(j)},p:function(j){return{M:B,y:x,w:y,d:f,D:E,h:d,m:a,s:c,ms:i,Q:R}[j]||String(j||"").toLowerCase().replace(/s$/,"")},u:function(j){return j===void 0}},W="en",A={};A[W]=C;var N="$isDayjsObject",m=function(j){return j instanceof O||!(!j||!j[N])},S=function j(P,D,Y){var G;if(!P)return W;if(typeof P=="string"){var X=P.toLowerCase();A[X]&&(G=X),D&&(A[X]=D,G=X);var K=P.split("-");if(!G&&K.length>1)return j(K[0])}else{var q=P.name;A[q]=P,G=q}return!Y&&G&&(W=G),G||!Y&&W},w=function(j,P){if(m(j))return j.clone();var D=typeof P=="object"?P:{};return D.date=j,D.args=arguments,new O(D)},v=z;v.l=S,v.i=m,v.w=function(j,P){return w(j,{locale:P.$L,utc:P.$u,x:P.$x,$offset:P.$offset})};var O=(function(){function j(D){this.$L=S(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[N]=!0}var P=j.prototype;return P.parse=function(D){this.$d=(function(Y){var G=Y.date,X=Y.utc;if(G===null)return new Date(NaN);if(v.u(G))return new Date;if(G instanceof Date)return new Date(G);if(typeof G=="string"&&!/Z$/i.test(G)){var K=G.match(F);if(K){var q=K[2]-1||0,rt=(K[7]||"0").substring(0,3);return X?new Date(Date.UTC(K[1],q,K[3]||1,K[4]||0,K[5]||0,K[6]||0,rt)):new Date(K[1],q,K[3]||1,K[4]||0,K[5]||0,K[6]||0,rt)}}return new Date(G)})(D),this.init()},P.init=function(){var D=this.$d;this.$y=D.getFullYear(),this.$M=D.getMonth(),this.$D=D.getDate(),this.$W=D.getDay(),this.$H=D.getHours(),this.$m=D.getMinutes(),this.$s=D.getSeconds(),this.$ms=D.getMilliseconds()},P.$utils=function(){return v},P.isValid=function(){return this.$d.toString()!==L},P.isSame=function(D,Y){var G=w(D);return this.startOf(Y)<=G&&G<=this.endOf(Y)},P.isAfter=function(D,Y){return w(D)<this.startOf(Y)},P.isBefore=function(D,Y){return this.endOf(Y)<w(D)},P.$g=function(D,Y,G){return v.u(D)?this[Y]:this.set(G,D)},P.unix=function(){return Math.floor(this.valueOf()/1e3)},P.valueOf=function(){return this.$d.getTime()},P.startOf=function(D,Y){var G=this,X=!!v.u(Y)||Y,K=v.p(D),q=function(g,_){var M=v.w(G.$u?Date.UTC(G.$y,_,g):new Date(G.$y,_,g),G);return X?M:M.endOf(f)},rt=function(g,_){return v.w(G.toDate()[g].apply(G.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(_)),G)},At=this.$W,Ut=this.$M,Pt=this.$D,Gt="set"+(this.$u?"UTC":"");switch(K){case x:return X?q(1,0):q(31,11);case B:return X?q(1,Ut):q(0,Ut+1);case y:var Yt=this.$locale().weekStart||0,Z=(At<Yt?At+7:At)-Yt;return q(X?Pt-Z:Pt+(6-Z),Ut);case f:case E:return rt(Gt+"Hours",0);case d:return rt(Gt+"Minutes",1);case a:return rt(Gt+"Seconds",2);case c:return rt(Gt+"Milliseconds",3);default:return this.clone()}},P.endOf=function(D){return this.startOf(D,!1)},P.$set=function(D,Y){var G,X=v.p(D),K="set"+(this.$u?"UTC":""),q=(G={},G[f]=K+"Date",G[E]=K+"Date",G[B]=K+"Month",G[x]=K+"FullYear",G[d]=K+"Hours",G[a]=K+"Minutes",G[c]=K+"Seconds",G[i]=K+"Milliseconds",G)[X],rt=X===f?this.$D+(Y-this.$W):Y;if(X===B||X===x){var At=this.clone().set(E,1);At.$d[q](rt),At.init(),this.$d=At.set(E,Math.min(this.$D,At.daysInMonth())).$d}else q&&this.$d[q](rt);return this.init(),this},P.set=function(D,Y){return this.clone().$set(D,Y)},P.get=function(D){return this[v.p(D)]()},P.add=function(D,Y){var G,X=this;D=Number(D);var K=v.p(Y),q=function(Ut){var Pt=w(X);return v.w(Pt.date(Pt.date()+Math.round(Ut*D)),X)};if(K===B)return this.set(B,this.$M+D);if(K===x)return this.set(x,this.$y+D);if(K===f)return q(1);if(K===y)return q(7);var rt=(G={},G[a]=n,G[d]=s,G[c]=e,G)[K]||1,At=this.$d.getTime()+D*rt;return v.w(At,this)},P.subtract=function(D,Y){return this.add(-1*D,Y)},P.format=function(D){var Y=this,G=this.$locale();if(!this.isValid())return G.invalidDate||L;var X=D||"YYYY-MM-DDTHH:mm:ssZ",K=v.z(this),q=this.$H,rt=this.$m,At=this.$M,Ut=G.weekdays,Pt=G.months,Gt=G.meridiem,Yt=function(_,M,V,$){return _&&(_[M]||_(Y,X))||V[M].slice(0,$)},Z=function(_){return v.s(q%12||12,_,"0")},g=Gt||function(_,M,V){var $=_<12?"AM":"PM";return V?$.toLowerCase():$};return X.replace(k,(function(_,M){return M||(function(V){switch(V){case"YY":return String(Y.$y).slice(-2);case"YYYY":return v.s(Y.$y,4,"0");case"M":return At+1;case"MM":return v.s(At+1,2,"0");case"MMM":return Yt(G.monthsShort,At,Pt,3);case"MMMM":return Yt(Pt,At);case"D":return Y.$D;case"DD":return v.s(Y.$D,2,"0");case"d":return String(Y.$W);case"dd":return Yt(G.weekdaysMin,Y.$W,Ut,2);case"ddd":return Yt(G.weekdaysShort,Y.$W,Ut,3);case"dddd":return Ut[Y.$W];case"H":return String(q);case"HH":return v.s(q,2,"0");case"h":return Z(1);case"hh":return Z(2);case"a":return g(q,rt,!0);case"A":return g(q,rt,!1);case"m":return String(rt);case"mm":return v.s(rt,2,"0");case"s":return String(Y.$s);case"ss":return v.s(Y.$s,2,"0");case"SSS":return v.s(Y.$ms,3,"0");case"Z":return K}return null})(_)||K.replace(":","")}))},P.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},P.diff=function(D,Y,G){var X,K=this,q=v.p(Y),rt=w(D),At=(rt.utcOffset()-this.utcOffset())*n,Ut=this-rt,Pt=function(){return v.m(K,rt)};switch(q){case x:X=Pt()/12;break;case B:X=Pt();break;case R:X=Pt()/3;break;case y:X=(Ut-At)/6048e5;break;case f:X=(Ut-At)/864e5;break;case d:X=Ut/s;break;case a:X=Ut/n;break;case c:X=Ut/e;break;default:X=Ut}return G?X:v.a(X)},P.daysInMonth=function(){return this.endOf(B).$D},P.$locale=function(){return A[this.$L]},P.locale=function(D,Y){if(!D)return this.$L;var G=this.clone(),X=S(D,Y,!0);return X&&(G.$L=X),G},P.clone=function(){return v.w(this.$d,this)},P.toDate=function(){return new Date(this.valueOf())},P.toJSON=function(){return this.isValid()?this.toISOString():null},P.toISOString=function(){return this.$d.toISOString()},P.toString=function(){return this.$d.toUTCString()},j})(),Q=O.prototype;return w.prototype=Q,[["$ms",i],["$s",c],["$m",a],["$H",d],["$W",f],["$M",B],["$y",x],["$D",E]].forEach((function(j){Q[j[1]]=function(P){return this.$g(P,j[0],j[1])}})),w.extend=function(j,P){return j.$i||(j(P,O,w),j.$i=!0),w},w.locale=S,w.isDayjs=m,w.unix=function(j){return w(1e3*j)},w.en=A[W],w.Ls=A,w.p={},w}))})(Rn)),Rn.exports}var Sp=_p();const wr=js(Sp);var Pn={exports:{}},Ip=Pn.exports,la;function Bp(){return la||(la=1,(function(r,t){(function(e,n){r.exports=n()})(Ip,(function(){var e,n,s=1e3,i=6e4,c=36e5,a=864e5,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f=31536e6,y=2628e6,B=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,R={years:f,months:y,days:a,hours:c,minutes:i,seconds:s,milliseconds:1,weeks:6048e5},x=function(A){return A instanceof z},E=function(A,N,m){return new z(A,m,N.$l)},L=function(A){return n.p(A)+"s"},F=function(A){return A<0},k=function(A){return F(A)?Math.ceil(A):Math.floor(A)},C=function(A){return Math.abs(A)},U=function(A,N){return A?F(A)?{negative:!0,format:""+C(A)+N}:{negative:!1,format:""+A+N}:{negative:!1,format:""}},z=(function(){function A(m,S,w){var v=this;if(this.$d={},this.$l=w,m===void 0&&(this.$ms=0,this.parseFromMilliseconds()),S)return E(m*R[L(S)],this);if(typeof m=="number")return this.$ms=m,this.parseFromMilliseconds(),this;if(typeof m=="object")return Object.keys(m).forEach((function(j){v.$d[L(j)]=m[j]})),this.calMilliseconds(),this;if(typeof m=="string"){var O=m.match(B);if(O){var Q=O.slice(2).map((function(j){return j!=null?Number(j):0}));return this.$d.years=Q[0],this.$d.months=Q[1],this.$d.weeks=Q[2],this.$d.days=Q[3],this.$d.hours=Q[4],this.$d.minutes=Q[5],this.$d.seconds=Q[6],this.calMilliseconds(),this}}return this}var N=A.prototype;return N.calMilliseconds=function(){var m=this;this.$ms=Object.keys(this.$d).reduce((function(S,w){return S+(m.$d[w]||0)*R[w]}),0)},N.parseFromMilliseconds=function(){var m=this.$ms;this.$d.years=k(m/f),m%=f,this.$d.months=k(m/y),m%=y,this.$d.days=k(m/a),m%=a,this.$d.hours=k(m/c),m%=c,this.$d.minutes=k(m/i),m%=i,this.$d.seconds=k(m/s),m%=s,this.$d.milliseconds=m},N.toISOString=function(){var m=U(this.$d.years,"Y"),S=U(this.$d.months,"M"),w=+this.$d.days||0;this.$d.weeks&&(w+=7*this.$d.weeks);var v=U(w,"D"),O=U(this.$d.hours,"H"),Q=U(this.$d.minutes,"M"),j=this.$d.seconds||0;this.$d.milliseconds&&(j+=this.$d.milliseconds/1e3,j=Math.round(1e3*j)/1e3);var P=U(j,"S"),D=m.negative||S.negative||v.negative||O.negative||Q.negative||P.negative,Y=O.format||Q.format||P.format?"T":"",G=(D?"-":"")+"P"+m.format+S.format+v.format+Y+O.format+Q.format+P.format;return G==="P"||G==="-P"?"P0D":G},N.toJSON=function(){return this.toISOString()},N.format=function(m){var S=m||"YYYY-MM-DDTHH:mm:ss",w={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return S.replace(d,(function(v,O){return O||String(w[v])}))},N.as=function(m){return this.$ms/R[L(m)]},N.get=function(m){var S=this.$ms,w=L(m);return w==="milliseconds"?S%=1e3:S=w==="weeks"?k(S/R[w]):this.$d[w],S||0},N.add=function(m,S,w){var v;return v=S?m*R[L(S)]:x(m)?m.$ms:E(m,this).$ms,E(this.$ms+v*(w?-1:1),this)},N.subtract=function(m,S){return this.add(m,S,!0)},N.locale=function(m){var S=this.clone();return S.$l=m,S},N.clone=function(){return E(this.$ms,this)},N.humanize=function(m){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!m)},N.valueOf=function(){return this.asMilliseconds()},N.milliseconds=function(){return this.get("milliseconds")},N.asMilliseconds=function(){return this.as("milliseconds")},N.seconds=function(){return this.get("seconds")},N.asSeconds=function(){return this.as("seconds")},N.minutes=function(){return this.get("minutes")},N.asMinutes=function(){return this.as("minutes")},N.hours=function(){return this.get("hours")},N.asHours=function(){return this.as("hours")},N.days=function(){return this.get("days")},N.asDays=function(){return this.as("days")},N.weeks=function(){return this.get("weeks")},N.asWeeks=function(){return this.as("weeks")},N.months=function(){return this.get("months")},N.asMonths=function(){return this.as("months")},N.years=function(){return this.get("years")},N.asYears=function(){return this.as("years")},A})(),W=function(A,N,m){return A.add(N.years()*m,"y").add(N.months()*m,"M").add(N.days()*m,"d").add(N.hours()*m,"h").add(N.minutes()*m,"m").add(N.seconds()*m,"s").add(N.milliseconds()*m,"ms")};return function(A,N,m){e=m,n=m().$utils(),m.duration=function(v,O){var Q=m.locale();return E(v,{$l:Q},O)},m.isDuration=x;var S=N.prototype.add,w=N.prototype.subtract;N.prototype.add=function(v,O){return x(v)?W(this,v,1):S.bind(this)(v,O)},N.prototype.subtract=function(v,O){return x(v)?W(this,v,-1):w.bind(this)(v,O)}}}))})(Pn)),Pn.exports}var vp=Bp();const xp=js(vp);wr.extend(xp);const Ap=r=>{if(r instanceof Date)return wr(r).toISOString();if(r instanceof wr)return r.toISOString();if(r instanceof wr.duration)return r.toISOString();try{return wr.duration(r).toISOString()}catch{return wr(r).toISOString()}},Ep=r=>{const t=r.times.map(e=>Ap(e));return{type:r.type||"range",times:t,resolution:r.resolution,resample:r.resample}};class Tp{datasource;parameters;description;variables;timefilter;geofilter;levelfilter;coordfilter;crs;aggregate;limit;id;constructor(t){this.datasource=t.datasource,this.parameters=t.parameters,this.description=t.description,this.variables=t.variables,this.timefilter=t.timefilter&&Ep(t.timefilter),this.geofilter=t.geofilter,this.levelfilter=t.levelfilter,this.coordfilter=t.coordfilter,this.crs=t.crs,this.aggregate=t.aggregate,this.limit=t.limit,this.id=t.id}toJSON(){return{datasource:this.datasource,parameters:this.parameters,description:this.description,variables:this.variables,timefilter:this.timefilter,geofilter:this.geofilter,levelfilter:this.levelfilter,coordfilter:this.coordfilter,crs:this.crs,aggregate:this.aggregate,limit:this.limit,id:this.id}}}exports.Connector=wp;exports.DataVar=wi;exports.Dataset=Ye;exports.Query=Tp;exports.cftimeToUnixSeconds=Uu;exports.date2num=tp;exports.getSupportedCalendars=ep;exports.hasCFTimeUnits=Du;exports.isCalendarSupported=ku;exports.num2date=Qf;exports.parseCFUnits=Ni;exports.wkb_to_geojson=Lu;
package/dist/index.js CHANGED
@@ -13353,11 +13353,11 @@ class Wf {
13353
13353
  return i;
13354
13354
  }
13355
13355
  }
13356
- const sa = async (r, t = ".zarray") => {
13356
+ const Zf = (r) => JSON.parse(r, (t, e) => typeof e == "bigint" ? Number(e) : e), sa = async (r, t = ".zarray") => {
13357
13357
  const { path: e } = r.resolve(t), n = await r.store.get(e);
13358
- return n ? JSON.parse(new TextDecoder().decode(n)) : {};
13358
+ return n ? Zf(new TextDecoder().decode(n)) : {};
13359
13359
  };
13360
- async function Zf(r) {
13360
+ async function Gf(r) {
13361
13361
  const t = await sa(r, ".zattrs"), e = await sa(r);
13362
13362
  e.dtype.startsWith("<M8") && (t._dtype = e.dtype), e.fill_value !== void 0 && (t._fill_value = e.fill_value);
13363
13363
  const n = [];
@@ -13447,7 +13447,7 @@ const Ys = {
13447
13447
  minutes: 60 * 1e3,
13448
13448
  hours: 3600 * 1e3,
13449
13449
  days: 1440 * 60 * 1e3
13450
- }, Gf = {
13450
+ }, Yf = {
13451
13451
  day: "days",
13452
13452
  days: "days",
13453
13453
  d: "days",
@@ -13486,12 +13486,12 @@ function Js(r) {
13486
13486
  throw new Error(
13487
13487
  `Invalid CF time units: "${r}". Expected format: "<unit> since <reference_time>"`
13488
13488
  );
13489
- const [, n, s] = e, i = n.toLowerCase(), c = Gf[i];
13489
+ const [, n, s] = e, i = n.toLowerCase(), c = Yf[i];
13490
13490
  if (!c)
13491
13491
  throw new Error(
13492
13492
  `Unsupported time unit: "${n}". Supported units: days, hours, minutes, seconds, milliseconds, microseconds`
13493
13493
  );
13494
- const a = Yf(s), d = a.getTime();
13494
+ const a = Jf(s), d = a.getTime();
13495
13495
  return {
13496
13496
  unit: c,
13497
13497
  referenceDate: a,
@@ -13499,7 +13499,7 @@ function Js(r) {
13499
13499
  original: r
13500
13500
  };
13501
13501
  }
13502
- function Yf(r) {
13502
+ function Jf(r) {
13503
13503
  const t = r.trim().replace("T", " ").replace(/Z$/i, ""), e = /^(-?\d+)-(\d{1,2})-(\d{1,2})(?:\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?)?$/, n = t.match(e);
13504
13504
  if (!n) {
13505
13505
  const C = new Date(r);
@@ -13517,7 +13517,7 @@ function Yf(r) {
13517
13517
  Date.UTC(B, R, x, E, L, F, k)
13518
13518
  );
13519
13519
  }
13520
- function Ep(r, t, e = "standard") {
13520
+ function Tp(r, t, e = "standard") {
13521
13521
  if (!Ti.has(e))
13522
13522
  throw new Error(
13523
13523
  `Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`
@@ -13532,7 +13532,7 @@ function Ep(r, t, e = "standard") {
13532
13532
  }
13533
13533
  return i;
13534
13534
  }
13535
- function Tp(r, t, e = "standard") {
13535
+ function Mp(r, t, e = "standard") {
13536
13536
  if (!Ti.has(e))
13537
13537
  throw new Error(
13538
13538
  `Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`
@@ -13540,18 +13540,18 @@ function Tp(r, t, e = "standard") {
13540
13540
  const n = Js(t), s = Ys[n.unit];
13541
13541
  return r instanceof Date ? (r.getTime() - n.referenceMs) / s : r.map((i) => !i || isNaN(i.getTime()) ? NaN : (i.getTime() - n.referenceMs) / s);
13542
13542
  }
13543
- function Jf(r) {
13543
+ function Hf(r) {
13544
13544
  return Ti.has(r.toLowerCase());
13545
13545
  }
13546
- function Mp() {
13546
+ function Np() {
13547
13547
  return Array.from(Ti);
13548
13548
  }
13549
- function Hf(r) {
13549
+ function qf(r) {
13550
13550
  const t = r.units;
13551
13551
  return typeof t == "string" && /^\s*\w+\s+since\s+.+$/i.test(t);
13552
13552
  }
13553
- function qf(r, t, e = "standard") {
13554
- if (!Jf(e))
13553
+ function Kf(r, t, e = "standard") {
13554
+ if (!Hf(e))
13555
13555
  return null;
13556
13556
  const n = Js(t), s = Ys[n.unit], i = n.referenceMs, c = new Float64Array(r.length);
13557
13557
  for (let a = 0; a < r.length; a++) {
@@ -13560,12 +13560,12 @@ function qf(r, t, e = "standard") {
13560
13560
  }
13561
13561
  return c;
13562
13562
  }
13563
- var Kf = Object.defineProperty, Xf = Object.getOwnPropertyDescriptor, Qf = (r, t, e, n) => {
13564
- for (var s = Xf(t, e), i = r.length - 1, c; i >= 0; i--)
13563
+ var Xf = Object.defineProperty, Qf = Object.getOwnPropertyDescriptor, tp = (r, t, e, n) => {
13564
+ for (var s = Qf(t, e), i = r.length - 1, c; i >= 0; i--)
13565
13565
  (c = r[i]) && (s = c(t, e, s) || s);
13566
- return s && Kf(t, e, s), s;
13566
+ return s && Xf(t, e, s), s;
13567
13567
  };
13568
- const aa = (r, t, e, n, s) => n?.variables?.[r] ? n.variables[r] : s || (n?.dimensions ? t.map((i, c) => n.dimensions?.[i] ?? e[c]) : e), tp = (r) => {
13568
+ const aa = (r, t, e, n, s) => n?.variables?.[r] ? n.variables[r] : s || (n?.dimensions ? t.map((i, c) => n.dimensions?.[i] ?? e[c]) : e), ep = (r) => {
13569
13569
  const t = new Eu.Buffer(r, "base64");
13570
13570
  return ff.Geometry.parse(t).toGeoJSON();
13571
13571
  }, mi = (r) => r && (Array.isArray(r) || ArrayBuffer.isView(r)), Zi = (r) => {
@@ -13574,7 +13574,7 @@ const aa = (r, t, e, n, s) => n?.variables?.[r] ? n.variables[r] : s || (n?.dime
13574
13574
  for (; t.push(r.length), mi(r[0]); )
13575
13575
  r = r[0];
13576
13576
  return t;
13577
- }, ep = (r) => {
13577
+ }, rp = (r) => {
13578
13578
  for (; Array.isArray(r); )
13579
13579
  r = r[0];
13580
13580
  if (r == null)
@@ -13608,7 +13608,7 @@ const aa = (r, t, e, n, s) => n?.variables?.[r] ? n.variables[r] : s || (n?.dime
13608
13608
  return "v2:object";
13609
13609
  }
13610
13610
  throw new Error("Unsupported data type: " + r.constructor.name);
13611
- }, rp = (r) => {
13611
+ }, np = (r) => {
13612
13612
  let t = r.toString().toLowerCase();
13613
13613
  return r.typeId == 5 ? t = "v2:object" : r.typeId == 1 && (t = "uint8"), t;
13614
13614
  }, ca = (r) => {
@@ -13641,7 +13641,7 @@ const aa = (r, t, e, n, s) => n?.variables?.[r] ? n.variables[r] : s || (n?.dime
13641
13641
  n + i * e[0]
13642
13642
  );
13643
13643
  return s;
13644
- }, np = (r, t) => {
13644
+ }, ip = (r, t) => {
13645
13645
  const [e, n] = t.split("<M8"), s = new Float64Array(r.data.length);
13646
13646
  let i = 1n;
13647
13647
  switch (n) {
@@ -13663,8 +13663,8 @@ const aa = (r, t, e, n, s) => n?.variables?.[r] ? n.variables[r] : s || (n?.dime
13663
13663
  s[c] = Number(a / i);
13664
13664
  }
13665
13665
  return pn(s, r.shape, r.stride);
13666
- }, ip = (r, t, e = "standard") => {
13667
- const n = qf(
13666
+ }, sp = (r, t, e = "standard") => {
13667
+ const n = Kf(
13668
13668
  r.data,
13669
13669
  t,
13670
13670
  e
@@ -13672,15 +13672,15 @@ const aa = (r, t, e, n, s) => n?.variables?.[r] ? n.variables[r] : s || (n?.dime
13672
13672
  return n === null ? (console.warn(
13673
13673
  `Unsupported calendar "${e}" for cftime conversion. Returning raw values. Supported: standard, gregorian, proleptic_gregorian`
13674
13674
  ), pn(r.data, r.shape, r.stride)) : pn(n, r.shape, r.stride);
13675
- }, sp = (r) => {
13675
+ }, op = (r) => {
13676
13676
  if (r == null) return !0;
13677
13677
  if (typeof r == "string") {
13678
13678
  const t = r.toLowerCase();
13679
13679
  return t === "nan" || t === "-nan" || t === "+nan";
13680
13680
  }
13681
13681
  return typeof r == "number" ? Number.isNaN(r) : !1;
13682
- }, op = (r, t, e) => {
13683
- if (!e.startsWith("float") || sp(t))
13682
+ }, ap = (r, t, e) => {
13683
+ if (!e.startsWith("float") || op(t))
13684
13684
  return r;
13685
13685
  if (typeof t == "number" && !Number.isNaN(t)) {
13686
13686
  const n = e === "float64" ? new Float64Array(r.length) : new Float32Array(r.length);
@@ -13756,17 +13756,17 @@ class cs {
13756
13756
  {
13757
13757
  const s = this.arr.attrs, i = this.arr.dtype, c = s._dtype;
13758
13758
  if (c?.startsWith("<M8"))
13759
- return np(n, c);
13760
- if (Hf(s)) {
13759
+ return ip(n, c);
13760
+ if (qf(s)) {
13761
13761
  const f = s.units, y = s.calendar || "standard";
13762
- return ip(n, f, y);
13762
+ return sp(n, f, y);
13763
13763
  }
13764
- const a = this.attributes._fill_value, d = a ? op(n.data, a, i) : n.data;
13764
+ const a = this.attributes._fill_value, d = a ? ap(n.data, a, i) : n.data;
13765
13765
  return pn(d, n.shape, n.stride);
13766
13766
  }
13767
13767
  }
13768
13768
  }
13769
- Qf([
13769
+ tp([
13770
13770
  Ei
13771
13771
  ], cs.prototype, "get");
13772
13772
  class Qe {
@@ -13825,7 +13825,7 @@ class Qe {
13825
13825
  } catch (U) {
13826
13826
  const z = typeof U == "object" && U && "message" in U ? String(U.message) : void 0;
13827
13827
  if (z && z.includes("<M8"))
13828
- F = await Zf(f.resolve(E.path));
13828
+ F = await Gf(f.resolve(E.path));
13829
13829
  else
13830
13830
  throw U;
13831
13831
  }
@@ -13868,7 +13868,7 @@ class Qe {
13868
13868
  const n = {}, s = { record: t.numRows }, i = {};
13869
13869
  return t.schema.fields.forEach((c) => {
13870
13870
  const a = t.getChild(c.name);
13871
- let d = {}, f = a?.toArray(), y = rp(c.type);
13871
+ let d = {}, f = a?.toArray(), y = np(c.type);
13872
13872
  if (tt.isTimestamp(c.type)) {
13873
13873
  const B = new Float64Array(f.length), R = BigInt(1e3 ** (c.type.unit - 0));
13874
13874
  for (let x = 0; x < f.length; x++)
@@ -14026,7 +14026,7 @@ class Qe {
14026
14026
  if (!c && this.coordkeys.g) {
14027
14027
  delete i[this.coordkeys.g];
14028
14028
  const a = n[s][this.coordkeys.g];
14029
- a.slice(0, 7) == '{"type:' ? c = JSON.parse(a) : c = tp(a);
14029
+ a.slice(0, 7) == '{"type:' ? c = JSON.parse(a) : c = ep(a);
14030
14030
  }
14031
14031
  e.push({
14032
14032
  type: "Feature",
@@ -14066,7 +14066,7 @@ class Qe {
14066
14066
  } else
14067
14067
  this.dimensions[B] = a[R];
14068
14068
  });
14069
- const d = i || ep(n), f = await _n(
14069
+ const d = i || rp(n), f = await _n(
14070
14070
  this.root.resolve(t),
14071
14071
  {
14072
14072
  shape: a,
@@ -14137,10 +14137,10 @@ class Qe {
14137
14137
  return n;
14138
14138
  }
14139
14139
  }
14140
- var ap = Object.defineProperty, cp = Object.getOwnPropertyDescriptor, up = (r, t, e, n) => {
14141
- for (var s = cp(t, e), i = r.length - 1, c; i >= 0; i--)
14140
+ var cp = Object.defineProperty, up = Object.getOwnPropertyDescriptor, hp = (r, t, e, n) => {
14141
+ for (var s = up(t, e), i = r.length - 1, c; i >= 0; i--)
14142
14142
  (c = r[i]) && (s = c(t, e, s) || s);
14143
- return s && ap(t, e, s), s;
14143
+ return s && cp(t, e, s), s;
14144
14144
  };
14145
14145
  const Du = class us {
14146
14146
  id;
@@ -14256,16 +14256,16 @@ const Du = class us {
14256
14256
  await this.close(t === void 0);
14257
14257
  }
14258
14258
  };
14259
- up([
14259
+ hp([
14260
14260
  Ei
14261
14261
  ], Du, "acquire");
14262
- let hp = Du;
14263
- var lp = Object.defineProperty, dp = Object.getOwnPropertyDescriptor, Uu = (r, t, e, n) => {
14264
- for (var s = dp(t, e), i = r.length - 1, c; i >= 0; i--)
14262
+ let lp = Du;
14263
+ var dp = Object.defineProperty, fp = Object.getOwnPropertyDescriptor, Uu = (r, t, e, n) => {
14264
+ for (var s = fp(t, e), i = r.length - 1, c; i >= 0; i--)
14265
14265
  (c = r[i]) && (s = c(t, e, s) || s);
14266
- return s && lp(t, e, s), s;
14266
+ return s && dp(t, e, s), s;
14267
14267
  };
14268
- const fp = typeof process < "u" && process.env?.DATAMESH_SERVICE ? process.env.DATAMESH_SERVICE : "https://datamesh.oceanum.io", Hs = class Lu {
14268
+ const pp = typeof process < "u" && process.env?.DATAMESH_SERVICE ? process.env.DATAMESH_SERVICE : "https://datamesh.oceanum.io", Hs = class Lu {
14269
14269
  static LAZY_LOAD_SIZE = 1e8;
14270
14270
  _token;
14271
14271
  _host;
@@ -14296,7 +14296,7 @@ const fp = typeof process < "u" && process.env?.DATAMESH_SERVICE ? process.env.D
14296
14296
  "A valid datamesh token must be supplied as a connector constructor argument or defined in environment variables as DATAMESH_TOKEN"
14297
14297
  );
14298
14298
  this._token = t, this._nocache = e?.nocache ?? !1;
14299
- const n = new URL(e?.service || fp);
14299
+ const n = new URL(e?.service || pp);
14300
14300
  this._host = `${n.protocol}//${n.hostname}`, this._authHeaders = e?.jwtAuth ? {
14301
14301
  Authorization: `Bearer ${e.jwtAuth}`
14302
14302
  } : {
@@ -14364,7 +14364,7 @@ const fp = typeof process < "u" && process.env?.DATAMESH_SERVICE ? process.env.D
14364
14364
  const e = {
14365
14365
  duration: t.duration || this._sessionParams.duration || 3600
14366
14366
  };
14367
- return this._currentSession = await hp.acquire(this, e), this._currentSession;
14367
+ return this._currentSession = await lp.acquire(this, e), this._currentSession;
14368
14368
  }
14369
14369
  /**
14370
14370
  * Get the current session or create a new one if none exists.
@@ -14496,13 +14496,13 @@ Uu([
14496
14496
  Uu([
14497
14497
  Ei
14498
14498
  ], Hs.prototype, "query");
14499
- let Np = Hs;
14500
- var Rn = { exports: {} }, pp = Rn.exports, ha;
14501
- function yp() {
14499
+ let Fp = Hs;
14500
+ var Rn = { exports: {} }, yp = Rn.exports, ha;
14501
+ function gp() {
14502
14502
  return ha || (ha = 1, (function(r, t) {
14503
14503
  (function(e, n) {
14504
14504
  r.exports = n();
14505
- })(pp, (function() {
14505
+ })(yp, (function() {
14506
14506
  var e = 1e3, n = 6e4, s = 36e5, i = "millisecond", c = "second", a = "minute", d = "hour", f = "day", y = "week", B = "month", R = "quarter", x = "year", E = "date", L = "Invalid Date", F = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, k = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, C = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(j) {
14507
14507
  var P = ["th", "st", "nd", "rd"], D = j % 100;
14508
14508
  return "[" + j + (P[(D - 20) % 10] || P[D] || P[0]) + "]";
@@ -14775,14 +14775,14 @@ function yp() {
14775
14775
  }));
14776
14776
  })(Rn)), Rn.exports;
14777
14777
  }
14778
- var gp = yp();
14779
- const wr = /* @__PURE__ */ zs(gp);
14780
- var Pn = { exports: {} }, mp = Pn.exports, la;
14781
- function wp() {
14778
+ var mp = gp();
14779
+ const wr = /* @__PURE__ */ zs(mp);
14780
+ var Pn = { exports: {} }, wp = Pn.exports, la;
14781
+ function bp() {
14782
14782
  return la || (la = 1, (function(r, t) {
14783
14783
  (function(e, n) {
14784
14784
  r.exports = n();
14785
- })(mp, (function() {
14785
+ })(wp, (function() {
14786
14786
  var e, n, s = 1e3, i = 6e4, c = 36e5, a = 864e5, d = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, f = 31536e6, y = 2628e6, B = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, R = { years: f, months: y, days: a, hours: c, minutes: i, seconds: s, milliseconds: 1, weeks: 6048e5 }, x = function(A) {
14787
14787
  return A instanceof z;
14788
14788
  }, E = function(A, N, m) {
@@ -14909,10 +14909,10 @@ function wp() {
14909
14909
  }));
14910
14910
  })(Pn)), Pn.exports;
14911
14911
  }
14912
- var bp = wp();
14913
- const _p = /* @__PURE__ */ zs(bp);
14914
- wr.extend(_p);
14915
- const Sp = (r) => {
14912
+ var _p = bp();
14913
+ const Sp = /* @__PURE__ */ zs(_p);
14914
+ wr.extend(Sp);
14915
+ const Ip = (r) => {
14916
14916
  if (r instanceof Date)
14917
14917
  return wr(r).toISOString();
14918
14918
  if (r instanceof wr)
@@ -14924,8 +14924,8 @@ const Sp = (r) => {
14924
14924
  } catch {
14925
14925
  return wr(r).toISOString();
14926
14926
  }
14927
- }, Ip = (r) => {
14928
- const t = r.times.map((e) => Sp(e));
14927
+ }, Bp = (r) => {
14928
+ const t = r.times.map((e) => Ip(e));
14929
14929
  return {
14930
14930
  type: r.type || "range",
14931
14931
  times: t,
@@ -14933,7 +14933,7 @@ const Sp = (r) => {
14933
14933
  resample: r.resample
14934
14934
  };
14935
14935
  };
14936
- class Fp {
14936
+ class Op {
14937
14937
  datasource;
14938
14938
  parameters;
14939
14939
  description;
@@ -14947,7 +14947,7 @@ class Fp {
14947
14947
  limit;
14948
14948
  id;
14949
14949
  constructor(t) {
14950
- this.datasource = t.datasource, this.parameters = t.parameters, this.description = t.description, this.variables = t.variables, this.timefilter = t.timefilter && Ip(t.timefilter), this.geofilter = t.geofilter, this.levelfilter = t.levelfilter, this.coordfilter = t.coordfilter, this.crs = t.crs, this.aggregate = t.aggregate, this.limit = t.limit, this.id = t.id;
14950
+ this.datasource = t.datasource, this.parameters = t.parameters, this.description = t.description, this.variables = t.variables, this.timefilter = t.timefilter && Bp(t.timefilter), this.geofilter = t.geofilter, this.levelfilter = t.levelfilter, this.coordfilter = t.coordfilter, this.crs = t.crs, this.aggregate = t.aggregate, this.limit = t.limit, this.id = t.id;
14951
14951
  }
14952
14952
  /**
14953
14953
  * Returns the query as a JSON object.
@@ -14970,16 +14970,16 @@ class Fp {
14970
14970
  }
14971
14971
  }
14972
14972
  export {
14973
- Np as Connector,
14973
+ Fp as Connector,
14974
14974
  cs as DataVar,
14975
14975
  Qe as Dataset,
14976
- Fp as Query,
14977
- qf as cftimeToUnixSeconds,
14978
- Tp as date2num,
14979
- Mp as getSupportedCalendars,
14980
- Hf as hasCFTimeUnits,
14981
- Jf as isCalendarSupported,
14982
- Ep as num2date,
14976
+ Op as Query,
14977
+ Kf as cftimeToUnixSeconds,
14978
+ Mp as date2num,
14979
+ Np as getSupportedCalendars,
14980
+ qf as hasCFTimeUnits,
14981
+ Hf as isCalendarSupported,
14982
+ Tp as num2date,
14983
14983
  Js as parseCFUnits,
14984
- tp as wkb_to_geojson
14984
+ ep as wkb_to_geojson
14985
14985
  };
@@ -1 +1 @@
1
- {"version":3,"file":"zarr.d.ts","sourceRoot":"","sources":["../../src/lib/zarr.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,QAAQ,EACT,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,KAAK,IAAI,MAAM,EACf,QAAQ,EAER,QAAQ,EAET,MAAM,SAAS,CAAC;AA6BjB,UAAU,sBAAsB;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAKD,qBAAa,eAAgB,YAAW,aAAa;IACnD,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,WAAW,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IACvC,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;gBAG/B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,OAAO,GAAE,sBAA2B;IAqDtC;;;OAGG;YACW,aAAa;IA6B3B;;OAEG;YACW,iBAAiB;IAW/B;;;OAGG;YACW,eAAe;IAQvB,GAAG,CACP,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,WAAW,EACrB,KAAK,SAAI,GACR,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;CAyEnC;AAED,qBAAa,QAAS,YAAW,YAAY;IAExB,IAAI,EAAE,MAAM;IAD/B,KAAK,EAAE,QAAQ,CAAC;gBACG,IAAI,EAAE,MAAM;IAIzB,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAQvD,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxC,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD,MAAM,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C;AAeD,wBAAsB,qBAAqB,CAAC,KAAK,SAAS,QAAQ,EAChE,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,oCAiD1B"}
1
+ {"version":3,"file":"zarr.d.ts","sourceRoot":"","sources":["../../src/lib/zarr.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,QAAQ,EACT,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,KAAK,IAAI,MAAM,EACf,QAAQ,EAER,QAAQ,EAET,MAAM,SAAS,CAAC;AA6BjB,UAAU,sBAAsB;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAKD,qBAAa,eAAgB,YAAW,aAAa;IACnD,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,WAAW,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IACvC,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;gBAG/B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,OAAO,GAAE,sBAA2B;IAqDtC;;;OAGG;YACW,aAAa;IA6B3B;;OAEG;YACW,iBAAiB;IAW/B;;;OAGG;YACW,eAAe;IAQvB,GAAG,CACP,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,WAAW,EACrB,KAAK,SAAI,GACR,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;CAyEnC;AAED,qBAAa,QAAS,YAAW,YAAY;IAExB,IAAI,EAAE,MAAM;IAD/B,KAAK,EAAE,QAAQ,CAAC;gBACG,IAAI,EAAE,MAAM;IAIzB,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAQvD,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxC,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD,MAAM,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C;AA8BD,wBAAsB,qBAAqB,CAAC,KAAK,SAAS,QAAQ,EAChE,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,oCAiD1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oceanum/datamesh",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "scripts": {
5
5
  "build": "vite build",
6
6
  "build:docs": "typedoc"