@imtbl/metrics 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # About
2
+
3
+ This internal package is used by the Typescript Immutable SDK package `@imtbl/sdk` and its children SDK packages.
@@ -0,0 +1,4 @@
1
+ import je from'axios';import {memorise}from'lru-memorise';import {getGlobalisedValue}from'global-const';var Ut=Object.defineProperty;var St=(u,c)=>{for(var p in c)Ut(u,p,{get:c[p],enumerable:!0});};function Br(u){throw new Error("Node.js process "+u+" is not supported by JSPM core outside of Node.js")}var G=[],tr=!1,W,cr=-1;function kt(){!tr||!W||(tr=!1,W.length?G=W.concat(G):cr=-1,G.length&&Vr());}function Vr(){if(!tr){var u=setTimeout(kt,0);tr=!0;for(var c=G.length;c;){for(W=G,G=[];++cr<c;)W&&W[cr].run();cr=-1,c=G.length;}W=null,tr=!1,clearTimeout(u);}}function _t(u){var c=new Array(arguments.length-1);if(arguments.length>1)for(var p=1;p<arguments.length;p++)c[p-1]=arguments[p];G.push(new Gr(u,c)),G.length===1&&!tr&&setTimeout(Vr,0);}function Gr(u,c){this.fun=u,this.array=c;}Gr.prototype.run=function(){this.fun.apply(null,this.array);};var Pt="browser",Rt="x64",bt="browser",Nt={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},vt=["/usr/bin/node"],Mt=[],Ct="v16.8.0",Lt={},Dt=function(u,c){console.warn((c?c+": ":"")+u);},$t=function(u){Br("binding");},Ft=function(u){return 0},Ot=function(){return "/"},Vt=function(u){},Gt={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function N(){}var Yt=N,Kt=[];function Ht(u){Br("_linkedBinding");}var Wt={},jt=!1,Xt={};function qt(u){Br("dlopen");}function Jt(){return []}function zt(){return []}var Qt=N,Zt=N,Tr=function(){return {}},re=Tr,te=Tr,ee=N,ne=N,ie=N,oe={};function se(u,c){if(!u)throw new Error(c||"assertion error")}var ue={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},ae=N,ce=N;function pe(){return !1}var le=N,fe=N,he=N,de=N,me=N,we=void 0,ge=void 0,ye=void 0,Ee=N,Ie=2,Be=1,Te="/bin/usr/node",Ae=9229,xe="node",Ue=[],Se=N,K={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};K.now===void 0&&(yr=Date.now(),K.timing&&K.timing.navigationStart&&(yr=K.timing.navigationStart),K.now=()=>Date.now()-yr);var yr;function ke(){return K.now()/1e3}var Er=1e9;function Ir(u){var c=Math.floor((Date.now()-K.now())*.001),p=K.now()*.001,l=Math.floor(p)+c,w=Math.floor(p%1*1e9);return u&&(l=l-u[0],w=w-u[1],w<0&&(l--,w+=Er)),[l,w]}Ir.bigint=function(u){var c=Ir(u);return typeof BigInt>"u"?c[0]*Er+c[1]:BigInt(c[0]*Er)+BigInt(c[1])};var _e=10,Pe={},Re=0;function H(){return A}var be=H,Ne=H,ve=H,Me=H,Ce=H,Le=N,De=H,$e=H;function Fe(u){return []}var A={version:Ct,versions:Lt,arch:Rt,platform:bt,release:Gt,_rawDebug:Yt,moduleLoadList:Kt,binding:$t,_linkedBinding:Ht,_events:Pe,_eventsCount:Re,_maxListeners:_e,on:H,addListener:be,once:Ne,off:ve,removeListener:Me,removeAllListeners:Ce,emit:Le,prependListener:De,prependOnceListener:$e,listeners:Fe,domain:Wt,_exiting:jt,config:Xt,dlopen:qt,uptime:ke,_getActiveRequests:Jt,_getActiveHandles:zt,reallyExit:Qt,_kill:Zt,cpuUsage:Tr,resourceUsage:re,memoryUsage:te,kill:ee,exit:ne,openStdin:ie,allowedNodeEnvironmentFlags:oe,assert:se,features:ue,_fatalExceptions:ae,setUncaughtExceptionCaptureCallback:ce,hasUncaughtExceptionCaptureCallback:pe,emitWarning:Dt,nextTick:_t,_tickCallback:le,_debugProcess:fe,_debugEnd:he,_startProfilerIdleNotifier:de,_stopProfilerIdleNotifier:me,stdout:we,stdin:ye,stderr:ge,abort:Ee,umask:Ft,chdir:Vt,cwd:Ot,env:Nt,title:Pt,argv:vt,execArgv:Mt,pid:Ie,ppid:Be,execPath:Te,debugPort:Ae,hrtime:Ir,argv0:xe,_preload_modules:Ue,setSourceMapsEnabled:Se};var nr={},Yr=!1;function Oe(){if(Yr)return nr;Yr=!0,nr.byteLength=y,nr.toByteArray=$,nr.fromByteArray=M;for(var u=[],c=[],p=typeof Uint8Array<"u"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=0,m=l.length;w<m;++w)u[w]=l[w],c[l.charCodeAt(w)]=w;c[45]=62,c[95]=63;function o(f){var h=f.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var g=f.indexOf("=");g===-1&&(g=h);var S=g===h?0:4-g%4;return [g,S]}function y(f){var h=o(f),g=h[0],S=h[1];return (g+S)*3/4-S}function R(f,h,g){return (h+g)*3/4-g}function $(f){var h,g=o(f),S=g[0],C=g[1],_=new p(R(f,S,C)),L=0,F=C>0?S-4:S,v;for(v=0;v<F;v+=4)h=c[f.charCodeAt(v)]<<18|c[f.charCodeAt(v+1)]<<12|c[f.charCodeAt(v+2)]<<6|c[f.charCodeAt(v+3)],_[L++]=h>>16&255,_[L++]=h>>8&255,_[L++]=h&255;return C===2&&(h=c[f.charCodeAt(v)]<<2|c[f.charCodeAt(v+1)]>>4,_[L++]=h&255),C===1&&(h=c[f.charCodeAt(v)]<<10|c[f.charCodeAt(v+1)]<<4|c[f.charCodeAt(v+2)]>>2,_[L++]=h>>8&255,_[L++]=h&255),_}function B(f){return u[f>>18&63]+u[f>>12&63]+u[f>>6&63]+u[f&63]}function I(f,h,g){for(var S,C=[],_=h;_<g;_+=3)S=(f[_]<<16&16711680)+(f[_+1]<<8&65280)+(f[_+2]&255),C.push(B(S));return C.join("")}function M(f){for(var h,g=f.length,S=g%3,C=[],_=16383,L=0,F=g-S;L<F;L+=_)C.push(I(f,L,L+_>F?F:L+_));return S===1?(h=f[g-1],C.push(u[h>>2]+u[h<<4&63]+"==")):S===2&&(h=(f[g-2]<<8)+f[g-1],C.push(u[h>>10]+u[h>>4&63]+u[h<<2&63]+"=")),C.join("")}return nr}var pr={},Kr=!1;function Ve(){if(Kr)return pr;Kr=!0;return pr.read=function(u,c,p,l,w){var m,o,y=w*8-l-1,R=(1<<y)-1,$=R>>1,B=-7,I=p?w-1:0,M=p?-1:1,f=u[c+I];for(I+=M,m=f&(1<<-B)-1,f>>=-B,B+=y;B>0;m=m*256+u[c+I],I+=M,B-=8);for(o=m&(1<<-B)-1,m>>=-B,B+=l;B>0;o=o*256+u[c+I],I+=M,B-=8);if(m===0)m=1-$;else {if(m===R)return o?NaN:(f?-1:1)*(1/0);o=o+Math.pow(2,l),m=m-$;}return (f?-1:1)*o*Math.pow(2,m-l)},pr.write=function(u,c,p,l,w,m){var o,y,R,$=m*8-w-1,B=(1<<$)-1,I=B>>1,M=w===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=l?0:m-1,h=l?1:-1,g=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(y=isNaN(c)?1:0,o=B):(o=Math.floor(Math.log(c)/Math.LN2),c*(R=Math.pow(2,-o))<1&&(o--,R*=2),o+I>=1?c+=M/R:c+=M*Math.pow(2,1-I),c*R>=2&&(o++,R/=2),o+I>=B?(y=0,o=B):o+I>=1?(y=(c*R-1)*Math.pow(2,w),o=o+I):(y=c*Math.pow(2,I-1)*Math.pow(2,w),o=0));w>=8;u[p+f]=y&255,f+=h,y/=256,w-=8);for(o=o<<w|y,$+=w;$>0;u[p+f]=o&255,f+=h,o/=256,$-=8);u[p+f-h]|=g*128;},pr}var j={},Hr=!1;function Ge(){if(Hr)return j;Hr=!0;let u=Oe(),c=Ve(),p=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;j.Buffer=o,j.SlowBuffer=C,j.INSPECT_MAX_BYTES=50;let l=2147483647;j.kMaxLength=l,o.TYPED_ARRAY_SUPPORT=w(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function w(){try{let e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch{return !1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function m(e){if(e>l)throw new RangeError('The value "'+e+'" is invalid for option "size"');let r=new Uint8Array(e);return Object.setPrototypeOf(r,o.prototype),r}function o(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return B(e)}return y(e,r,t)}o.poolSize=8192;function y(e,r,t){if(typeof e=="string")return I(e,r);if(ArrayBuffer.isView(e))return f(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(O(e,ArrayBuffer)||e&&O(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(O(e,SharedArrayBuffer)||e&&O(e.buffer,SharedArrayBuffer)))return h(e,r,t);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return o.from(n,r,t);let i=g(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return o.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}o.from=function(e,r,t){return y(e,r,t)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function R(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function $(e,r,t){return R(e),e<=0?m(e):r!==void 0?typeof t=="string"?m(e).fill(r,t):m(e).fill(r):m(e)}o.alloc=function(e,r,t){return $(e,r,t)};function B(e){return R(e),m(e<0?0:S(e)|0)}o.allocUnsafe=function(e){return B(e)},o.allocUnsafeSlow=function(e){return B(e)};function I(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=_(e,r)|0,n=m(t),i=n.write(e,r);return i!==t&&(n=n.slice(0,i)),n}function M(e){let r=e.length<0?0:S(e.length)|0,t=m(r);for(let n=0;n<r;n+=1)t[n]=e[n]&255;return t}function f(e){if(O(e,Uint8Array)){let r=new Uint8Array(e);return h(r.buffer,r.byteOffset,r.byteLength)}return M(e)}function h(e,r,t){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return r===void 0&&t===void 0?n=new Uint8Array(e):t===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,t),Object.setPrototypeOf(n,o.prototype),n}function g(e){if(o.isBuffer(e)){let r=S(e.length)|0,t=m(r);return t.length===0||e.copy(t,0,0,r),t}if(e.length!==void 0)return typeof e.length!="number"||gr(e.length)?m(0):M(e);if(e.type==="Buffer"&&Array.isArray(e.data))return M(e.data)}function S(e){if(e>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return e|0}function C(e){return +e!=e&&(e=0),o.alloc(+e)}o.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==o.prototype},o.compare=function(r,t){if(O(r,Uint8Array)&&(r=o.from(r,r.offset,r.byteLength)),O(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(r)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;let n=r.length,i=t.length;for(let s=0,a=Math.min(n,i);s<a;++s)if(r[s]!==t[s]){n=r[s],i=t[s];break}return n<i?-1:i<n?1:0},o.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},o.concat=function(r,t){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return o.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<r.length;++n)t+=r[n].length;let i=o.allocUnsafe(t),s=0;for(n=0;n<r.length;++n){let a=r[n];if(O(a,Uint8Array))s+a.length>i.length?(o.isBuffer(a)||(a=o.from(a)),a.copy(i,s)):Uint8Array.prototype.set.call(i,a,s);else if(o.isBuffer(a))a.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length;}return i};function _(e,r){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||O(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let t=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return wr(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Or(e).length;default:if(i)return n?-1:wr(e).length;r=(""+r).toLowerCase(),i=!0;}}o.byteLength=_;function L(e,r,t){let n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return "";for(e||(e="utf8");;)switch(e){case"hex":return wt(this,r,t);case"utf8":case"utf-8":return br(this,r,t);case"ascii":return dt(this,r,t);case"latin1":case"binary":return mt(this,r,t);case"base64":return ft(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gt(this,r,t);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0;}}o.prototype._isBuffer=!0;function F(e,r,t){let n=e[r];e[r]=e[t],e[t]=n;}o.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<r;t+=2)F(this,t,t+1);return this},o.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<r;t+=4)F(this,t,t+3),F(this,t+1,t+2);return this},o.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<r;t+=8)F(this,t,t+7),F(this,t+1,t+6),F(this,t+2,t+5),F(this,t+3,t+4);return this},o.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?br(this,0,r):L.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(r){if(!o.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:o.compare(this,r)===0},o.prototype.inspect=function(){let r="",t=j.INSPECT_MAX_BYTES;return r=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(r+=" ... "),"<Buffer "+r+">"},p&&(o.prototype[p]=o.prototype.inspect),o.prototype.compare=function(r,t,n,i,s){if(O(r,Uint8Array)&&(r=o.from(r,r.offset,r.byteLength)),!o.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0&&(t=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>r.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0;if(i>=s)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===r)return 0;let a=s-i,d=n-t,x=Math.min(a,d),T=this.slice(i,s),U=r.slice(t,n);for(let E=0;E<x;++E)if(T[E]!==U[E]){a=T[E],d=U[E];break}return a<d?-1:d<a?1:0};function v(e,r,t,n,i){if(e.length===0)return -1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,gr(t)&&(t=i?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(i)return -1;t=e.length-1;}else if(t<0)if(i)t=0;else return -1;if(typeof r=="string"&&(r=o.from(r,n)),o.isBuffer(r))return r.length===0?-1:Rr(e,r,t,n,i);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):Rr(e,[r],t,n,i);throw new TypeError("val must be string, number or Buffer")}function Rr(e,r,t,n,i){let s=1,a=e.length,d=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||r.length<2)return -1;s=2,a/=2,d/=2,t/=2;}function x(U,E){return s===1?U[E]:U.readUInt16BE(E*s)}let T;if(i){let U=-1;for(T=t;T<a;T++)if(x(e,T)===x(r,U===-1?0:T-U)){if(U===-1&&(U=T),T-U+1===d)return U*s}else U!==-1&&(T-=T-U),U=-1;}else for(t+d>a&&(t=a-d),T=t;T>=0;T--){let U=!0;for(let E=0;E<d;E++)if(x(e,T+E)!==x(r,E)){U=!1;break}if(U)return T}return -1}o.prototype.includes=function(r,t,n){return this.indexOf(r,t,n)!==-1},o.prototype.indexOf=function(r,t,n){return v(this,r,t,n,!0)},o.prototype.lastIndexOf=function(r,t,n){return v(this,r,t,n,!1)};function ut(e,r,t,n){t=Number(t)||0;let i=e.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let s=r.length;n>s/2&&(n=s/2);let a;for(a=0;a<n;++a){let d=parseInt(r.substr(a*2,2),16);if(gr(d))return a;e[t+a]=d;}return a}function at(e,r,t,n){return ar(wr(r,e.length-t),e,t,n)}function ct(e,r,t,n){return ar(Bt(r),e,t,n)}function pt(e,r,t,n){return ar(Or(r),e,t,n)}function lt(e,r,t,n){return ar(Tt(r,e.length-t),e,t,n)}o.prototype.write=function(r,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((n===void 0||n>s)&&(n=s),r.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let a=!1;for(;;)switch(i){case"hex":return ut(this,r,t,n);case"utf8":case"utf-8":return at(this,r,t,n);case"ascii":case"latin1":case"binary":return ct(this,r,t,n);case"base64":return pt(this,r,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lt(this,r,t,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0;}},o.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ft(e,r,t){return r===0&&t===e.length?u.fromByteArray(e):u.fromByteArray(e.slice(r,t))}function br(e,r,t){t=Math.min(e.length,t);let n=[],i=r;for(;i<t;){let s=e[i],a=null,d=s>239?4:s>223?3:s>191?2:1;if(i+d<=t){let x,T,U,E;switch(d){case 1:s<128&&(a=s);break;case 2:x=e[i+1],(x&192)===128&&(E=(s&31)<<6|x&63,E>127&&(a=E));break;case 3:x=e[i+1],T=e[i+2],(x&192)===128&&(T&192)===128&&(E=(s&15)<<12|(x&63)<<6|T&63,E>2047&&(E<55296||E>57343)&&(a=E));break;case 4:x=e[i+1],T=e[i+2],U=e[i+3],(x&192)===128&&(T&192)===128&&(U&192)===128&&(E=(s&15)<<18|(x&63)<<12|(T&63)<<6|U&63,E>65535&&E<1114112&&(a=E));}}a===null?(a=65533,d=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=d;}return ht(n)}let Nr=4096;function ht(e){let r=e.length;if(r<=Nr)return String.fromCharCode.apply(String,e);let t="",n=0;for(;n<r;)t+=String.fromCharCode.apply(String,e.slice(n,n+=Nr));return t}function dt(e,r,t){let n="";t=Math.min(e.length,t);for(let i=r;i<t;++i)n+=String.fromCharCode(e[i]&127);return n}function mt(e,r,t){let n="";t=Math.min(e.length,t);for(let i=r;i<t;++i)n+=String.fromCharCode(e[i]);return n}function wt(e,r,t){let n=e.length;(!r||r<0)&&(r=0),(!t||t<0||t>n)&&(t=n);let i="";for(let s=r;s<t;++s)i+=At[e[s]];return i}function gt(e,r,t){let n=e.slice(r,t),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}o.prototype.slice=function(r,t){let n=this.length;r=~~r,t=t===void 0?n:~~t,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<r&&(t=r);let i=this.subarray(r,t);return Object.setPrototypeOf(i,o.prototype),i};function b(e,r,t){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+r>t)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||b(r,t,this.length);let i=this[r],s=1,a=0;for(;++a<t&&(s*=256);)i+=this[r+a]*s;return i},o.prototype.readUintBE=o.prototype.readUIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||b(r,t,this.length);let i=this[r+--t],s=1;for(;t>0&&(s*=256);)i+=this[r+--t]*s;return i},o.prototype.readUint8=o.prototype.readUInt8=function(r,t){return r=r>>>0,t||b(r,1,this.length),this[r]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||b(r,2,this.length),this[r]|this[r+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||b(r,2,this.length),this[r]<<8|this[r+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||b(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||b(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},o.prototype.readBigUInt64LE=Y(function(r){r=r>>>0,rr(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&er(r,this.length-8);let i=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,s=this[++r]+this[++r]*2**8+this[++r]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))}),o.prototype.readBigUInt64BE=Y(function(r){r=r>>>0,rr(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&er(r,this.length-8);let i=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],s=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n;return (BigInt(i)<<BigInt(32))+BigInt(s)}),o.prototype.readIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||b(r,t,this.length);let i=this[r],s=1,a=0;for(;++a<t&&(s*=256);)i+=this[r+a]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i},o.prototype.readIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||b(r,t,this.length);let i=t,s=1,a=this[r+--i];for(;i>0&&(s*=256);)a+=this[r+--i]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(r,t){return r=r>>>0,t||b(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},o.prototype.readInt16LE=function(r,t){r=r>>>0,t||b(r,2,this.length);let n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n},o.prototype.readInt16BE=function(r,t){r=r>>>0,t||b(r,2,this.length);let n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n},o.prototype.readInt32LE=function(r,t){return r=r>>>0,t||b(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},o.prototype.readInt32BE=function(r,t){return r=r>>>0,t||b(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},o.prototype.readBigInt64LE=Y(function(r){r=r>>>0,rr(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&er(r,this.length-8);let i=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(n<<24);return (BigInt(i)<<BigInt(32))+BigInt(t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)}),o.prototype.readBigInt64BE=Y(function(r){r=r>>>0,rr(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&er(r,this.length-8);let i=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return (BigInt(i)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n)}),o.prototype.readFloatLE=function(r,t){return r=r>>>0,t||b(r,4,this.length),c.read(this,r,!0,23,4)},o.prototype.readFloatBE=function(r,t){return r=r>>>0,t||b(r,4,this.length),c.read(this,r,!1,23,4)},o.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||b(r,8,this.length),c.read(this,r,!0,52,8)},o.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||b(r,8,this.length),c.read(this,r,!1,52,8)};function D(e,r,t,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<s)throw new RangeError('"value" argument is out of bounds');if(t+n>e.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){let d=Math.pow(2,8*n)-1;D(this,r,t,n,d,0);}let s=1,a=0;for(this[t]=r&255;++a<n&&(s*=256);)this[t+a]=r/s&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){let d=Math.pow(2,8*n)-1;D(this,r,t,n,d,0);}let s=n-1,a=1;for(this[t+s]=r&255;--s>=0&&(a*=256);)this[t+s]=r/a&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(r,t,n){return r=+r,t=t>>>0,n||D(this,r,t,1,255,0),this[t]=r&255,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||D(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||D(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||D(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||D(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function vr(e,r,t,n,i){Fr(r,n,i,e,t,7);let s=Number(r&BigInt(4294967295));e[t++]=s,s=s>>8,e[t++]=s,s=s>>8,e[t++]=s,s=s>>8,e[t++]=s;let a=Number(r>>BigInt(32)&BigInt(4294967295));return e[t++]=a,a=a>>8,e[t++]=a,a=a>>8,e[t++]=a,a=a>>8,e[t++]=a,t}function Mr(e,r,t,n,i){Fr(r,n,i,e,t,7);let s=Number(r&BigInt(4294967295));e[t+7]=s,s=s>>8,e[t+6]=s,s=s>>8,e[t+5]=s,s=s>>8,e[t+4]=s;let a=Number(r>>BigInt(32)&BigInt(4294967295));return e[t+3]=a,a=a>>8,e[t+2]=a,a=a>>8,e[t+1]=a,a=a>>8,e[t]=a,t+8}o.prototype.writeBigUInt64LE=Y(function(r,t=0){return vr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Y(function(r,t=0){return Mr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let x=Math.pow(2,8*n-1);D(this,r,t,n,x-1,-x);}let s=0,a=1,d=0;for(this[t]=r&255;++s<n&&(a*=256);)r<0&&d===0&&this[t+s-1]!==0&&(d=1),this[t+s]=(r/a>>0)-d&255;return t+n},o.prototype.writeIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let x=Math.pow(2,8*n-1);D(this,r,t,n,x-1,-x);}let s=n-1,a=1,d=0;for(this[t+s]=r&255;--s>=0&&(a*=256);)r<0&&d===0&&this[t+s+1]!==0&&(d=1),this[t+s]=(r/a>>0)-d&255;return t+n},o.prototype.writeInt8=function(r,t,n){return r=+r,t=t>>>0,n||D(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1},o.prototype.writeInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||D(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2},o.prototype.writeInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||D(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2},o.prototype.writeInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||D(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4},o.prototype.writeInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||D(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4},o.prototype.writeBigInt64LE=Y(function(r,t=0){return vr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Y(function(r,t=0){return Mr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Cr(e,r,t,n,i,s){if(t+n>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Lr(e,r,t,n,i){return r=+r,t=t>>>0,i||Cr(e,r,t,4),c.write(e,r,t,n,23,4),t+4}o.prototype.writeFloatLE=function(r,t,n){return Lr(this,r,t,!0,n)},o.prototype.writeFloatBE=function(r,t,n){return Lr(this,r,t,!1,n)};function Dr(e,r,t,n,i){return r=+r,t=t>>>0,i||Cr(e,r,t,8),c.write(e,r,t,n,52,8),t+8}o.prototype.writeDoubleLE=function(r,t,n){return Dr(this,r,t,!0,n)},o.prototype.writeDoubleBE=function(r,t,n){return Dr(this,r,t,!1,n)},o.prototype.copy=function(r,t,n,i){if(!o.isBuffer(r))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=r.length&&(t=r.length),t||(t=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-t<i-n&&(i=r.length-t+n);let s=i-n;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(r,this.subarray(n,i),t),s},o.prototype.fill=function(r,t,n,i){if(typeof r=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!o.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(r.length===1){let a=r.charCodeAt(0);(i==="utf8"&&a<128||i==="latin1")&&(r=a);}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);let s;if(typeof r=="number")for(s=t;s<n;++s)this[s]=r;else {let a=o.isBuffer(r)?r:o.from(r,i),d=a.length;if(d===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(s=0;s<n-t;++s)this[s+t]=a[s%d];}return this};let Z={};function mr(e,r,t){Z[e]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name;}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0});}toString(){return `${this.name} [${e}]: ${this.message}`}};}mr("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),mr("ERR_INVALID_ARG_TYPE",function(e,r){return `The "${e}" argument must be of type number. Received type ${typeof r}`},TypeError),mr("ERR_OUT_OF_RANGE",function(e,r,t){let n=`The value of "${e}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=$r(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=$r(i)),i+="n"),n+=` It must be ${r}. Received ${i}`,n},RangeError);function $r(e){let r="",t=e.length,n=e[0]==="-"?1:0;for(;t>=n+4;t-=3)r=`_${e.slice(t-3,t)}${r}`;return `${e.slice(0,t)}${r}`}function yt(e,r,t){rr(r,"offset"),(e[r]===void 0||e[r+t]===void 0)&&er(r,e.length-(t+1));}function Fr(e,r,t,n,i,s){if(e>t||e<r){let a=typeof r=="bigint"?"n":"",d;throw r===0||r===BigInt(0)?d=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:d=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`,new Z.ERR_OUT_OF_RANGE("value",d,e)}yt(n,i,s);}function rr(e,r){if(typeof e!="number")throw new Z.ERR_INVALID_ARG_TYPE(r,"number",e)}function er(e,r,t){throw Math.floor(e)!==e?(rr(e,t),new Z.ERR_OUT_OF_RANGE("offset","an integer",e)):r<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE("offset",`>= ${0} and <= ${r}`,e)}let Et=/[^+/0-9A-Za-z-_]/g;function It(e){if(e=e.split("=")[0],e=e.trim().replace(Et,""),e.length<2)return "";for(;e.length%4!==0;)e=e+"=";return e}function wr(e,r){r=r||1/0;let t,n=e.length,i=null,s=[];for(let a=0;a<n;++a){if(t=e.charCodeAt(a),t>55295&&t<57344){if(!i){if(t>56319){(r-=3)>-1&&s.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(r-=3)>-1&&s.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536;}else i&&(r-=3)>-1&&s.push(239,191,189);if(i=null,t<128){if((r-=1)<0)break;s.push(t);}else if(t<2048){if((r-=2)<0)break;s.push(t>>6|192,t&63|128);}else if(t<65536){if((r-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128);}else if(t<1114112){if((r-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128);}else throw new Error("Invalid code point")}return s}function Bt(e){let r=[];for(let t=0;t<e.length;++t)r.push(e.charCodeAt(t)&255);return r}function Tt(e,r){let t,n,i,s=[];for(let a=0;a<e.length&&!((r-=2)<0);++a)t=e.charCodeAt(a),n=t>>8,i=t%256,s.push(i),s.push(n);return s}function Or(e){return u.toByteArray(It(e))}function ar(e,r,t,n){let i;for(i=0;i<n&&!(i+t>=r.length||i>=e.length);++i)r[i+t]=e[i];return i}function O(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function gr(e){return e!==e}let At=function(){let e="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)r[n+i]=e[t]+e[i];}return r}();function Y(e){return typeof BigInt>"u"?xt:e}function xt(){throw new Error("BigInt not supported")}return j}var X=Ge();X.Buffer;X.SlowBuffer;X.INSPECT_MAX_BYTES;X.kMaxLength;var k=X.Buffer;X.INSPECT_MAX_BYTES;X.kMaxLength;var Ur={};St(Ur,{deleteItem:()=>We,getItem:()=>fr,setItem:()=>or});var ir=()=>typeof window>"u",lr=()=>!ir();var Ye="__IMX-",Ar=()=>lr()&&window.localStorage,Ke=u=>{if(u!==null)try{return JSON.parse(u)}catch{return u}},He=u=>typeof u=="string"?u:JSON.stringify(u),xr=u=>`${Ye}${u}`;function fr(u){if(Ar())return Ke(window.localStorage.getItem(xr(u)))}var or=(u,c)=>Ar()?(window.localStorage.setItem(xr(u),He(c)),!0):!1,We=u=>Ar()?(window.localStorage.removeItem(xr(u)),!0):!1;var Sr=0,Wr=u=>{let c=parseInt(u,10)*1e3,p=new Date(c),l=new Date;return Sr=p.getTime()-l.getTime(),Sr},jr=()=>{let u=new Date().getTime()+Sr;return new Date(u).toISOString()};var sr=(y=>(y.RUNTIME_ID="rid",y.PASSPORT_CLIENT_ID="passportClientId",y.ENVIRONMENT="env",y.PUBLISHABLE_API_KEY="pak",y.IDENTITY="uid",y.DOMAIN="domain",y.SDK_VERSION="sdkVersion",y))(sr||{});var Xe="https://api.immutable.com";async function hr(u,c){let p=je.create({baseURL:Xe}),l=JSON.stringify(c),w={payload:k.from(l).toString("base64")};return (await p.post(u,w)).data}var q,J,qe=()=>{q=fr("metrics-events")||[],J=fr("metrics-runtime")||{};};qe();var V=(u,c)=>{J={...J,[u]:c},or("metrics-runtime",J);},ur=u=>{if(J[u]!==void 0)return J[u]},Xr=()=>J,qr=()=>q,Jr=u=>{q.push(u),or("metrics-events",q);},zr=u=>{q=q.slice(u),or("metrics-events",q);},dr=u=>{let c=[];return Object.entries(u).forEach(([p,l])=>{(typeof p=="string"||typeof l=="string"||typeof l=="number"||typeof l=="boolean")&&c.push([p,l.toString()]);}),c};var kr="2.0.0-alpha.0",Je=()=>ir()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",ze=()=>{if(ir())return "";let u;try{window.self!==window.top&&(u=Je());}catch{}return u||(u=window.location.hostname),u},Qe=()=>{if(V("sdkVersion",kr),ir())return {browser:"nodejs",sdkVersion:kr};let u=ze();return u&&V("domain",u),{sdkVersion:kr,browser:window.navigator.userAgent,domain:u,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},_r=!1,Qr=()=>_r,Zr=async()=>{_r=!0;try{let u=dr(Qe()),c=ur("rid"),p=ur("uid"),w=await hr("/v1/sdk/initialise",{version:1,data:{runtimeDetails:u,runtimeId:c,uId:p}}),{runtimeId:m,sTime:o}=w;V("rid",m),Wr(o);}catch{_r=!1;}};function P(u,c){return (...p)=>{try{let l=u(...p);return l instanceof Promise?l.catch(()=>c):l}catch{return c}}}function Ze(){return lr()||typeof A>"u"?!1:A.env.JEST_WORKER_ID!==void 0}var rt=P(Ze,!1);var et="imtbl__metrics",tn=5e3,en=1e3,z=(u,c)=>getGlobalisedValue(et,u,c),nt=(u,c)=>{let p=memorise(c,{lruOptions:{ttl:tn,max:en}});return getGlobalisedValue(et,u,p)};var nn=5e3,on=(u,c,p)=>{let l={event:`${u}.${c}`,time:jr(),...p&&{properties:dr(p)}};Jr(l);},Q=P(nt("track",on)),sn=async()=>{if(Qr()===!1){await Zr();return}let u=qr();if(u.length===0)return;let c=u.length,p=Xr();await hr("/v1/sdk/metrics",{version:1,data:{events:u,details:p}})instanceof Error||zr(c);},un=P(sn),ot=async()=>{await un(),setTimeout(ot,nn);},it=!1,an=()=>{it||(it=!0,ot());};rt()||P(z("startFlushing",an))();var Pr=(u,c,p,l)=>Q(u,c,{...l||{},duration:Math.round(p)});var st=()=>{let u=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return `${u()}${u()}-${u()}-${u()}-${u()}-${u()}${u()}${u()}`};var cn=(...u)=>{if(!u.some(l=>!!l))return {};let p={};return u.forEach(l=>{l&&(p={...p,...l});}),p},pn=u=>u.replace(/[^a-zA-Z0-9\s\-_]/g,""),ln=(u,c)=>`${u}_${pn(c)}`,fn=(u,c,p)=>{let l=st(),w=Date.now(),m=0,o=0,y={},R=(...I)=>cn(y,...I,{flowId:l,flowName:c});y=R(p);let $=I=>{I&&(y=R(I));},B=(I,M)=>{let f=ln(c,I),h=0,g=performance.now();m>0&&(h=g-o);let S=R(M,{flowEventName:I,flowStep:m});Pr(u,f,h,S),m++,o=g;};return B("Start"),{details:{moduleName:u,flowName:c,flowId:l,flowStartTime:w},addEvent:P(B),addFlowProperties:P($)}},hn=P(fn);var dn=(u,c,p,l)=>{let{message:w}=p,m=p.stack||"",{cause:o}=p;o instanceof Error&&(m=`${m}
2
+ Cause: ${o.message}
3
+ ${o.stack}`),Q(u,`trackError_${c}`,{...l||{},errorMessage:w,errorStack:m,isTrackError:!0});},mn=P(dn);var wn=u=>{if(u.passportId)return `passport:${u.passportId.toLowerCase()}`;if(u.ethAddress)return `ethAddress:${u.ethAddress.toLowerCase()}`;throw new Error("invalid_identity")},gn=u=>{let c=wn(u);c&&(V("uid",c),Q("metrics","identify",u.traits));},yn=P(gn);var En=u=>{V("env",u);},In=P(z("setEnvironment",En)),Bn=u=>{V("passportClientId",u);},Tn=P(z("setPassportClientId",Bn)),An=u=>{V("pak",u);},xn=P(z("setPublishableApiKey",An)),Un=P(z("getDetail",ur));var yo={localStorage:Ur};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
4
+ export{sr as Detail,Un as getDetail,yn as identify,In as setEnvironment,Tn as setPassportClientId,xn as setPublishableApiKey,Q as track,Pr as trackDuration,mn as trackError,hn as trackFlow,yo as utils};
@@ -0,0 +1,3 @@
1
+ 'use strict';var st=require('axios'),lruMemorise=require('lru-memorise'),globalConst=require('global-const');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var st__default=/*#__PURE__*/_interopDefault(st);var q=Object.defineProperty;var tt=(t,e)=>{for(var r in e)q(t,r,{get:e[r],enumerable:!0});};var D={};tt(D,{deleteItem:()=>nt,getItem:()=>y,setItem:()=>T});var g=()=>typeof window>"u",I=()=>!g();var et="__IMX-",S=()=>I()&&window.localStorage,rt=t=>{if(t!==null)try{return JSON.parse(t)}catch{return t}},ot=t=>typeof t=="string"?t:JSON.stringify(t),v=t=>`${et}${t}`;function y(t){if(S())return rt(window.localStorage.getItem(v(t)))}var T=(t,e)=>S()?(window.localStorage.setItem(v(t),ot(e)),!0):!1,nt=t=>S()?(window.localStorage.removeItem(v(t)),!0):!1;var h=0,M=t=>{let e=parseInt(t,10)*1e3,r=new Date(e),o=new Date;return h=r.getTime()-o.getTime(),h},O=()=>{let t=new Date().getTime()+h;return new Date(t).toISOString()};var w=(s=>(s.RUNTIME_ID="rid",s.PASSPORT_CLIENT_ID="passportClientId",s.ENVIRONMENT="env",s.PUBLISHABLE_API_KEY="pak",s.IDENTITY="uid",s.DOMAIN="domain",s.SDK_VERSION="sdkVersion",s))(w||{});var it="https://api.immutable.com";async function k(t,e){let r=st__default.default.create({baseURL:it}),o=JSON.stringify(e),c={payload:Buffer.from(o).toString("base64")};return (await r.post(t,c)).data}var m,d,at=()=>{m=y("metrics-events")||[],d=y("metrics-runtime")||{};};at();var a=(t,e)=>{d={...d,[t]:e},T("metrics-runtime",d);},E=t=>{if(d[t]!==void 0)return d[t]},$=()=>d,C=()=>m,L=t=>{m.push(t),T("metrics-events",m);},V=t=>{m=m.slice(t),T("metrics-events",m);},P=t=>{let e=[];return Object.entries(t).forEach(([r,o])=>{(typeof r=="string"||typeof o=="string"||typeof o=="number"||typeof o=="boolean")&&e.push([r,o.toString()]);}),e};var b="2.0.0-alpha.0",ct=()=>g()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",pt=()=>{if(g())return "";let t;try{window.self!==window.top&&(t=ct());}catch{}return t||(t=window.location.hostname),t},lt=()=>{if(a("sdkVersion",b),g())return {browser:"nodejs",sdkVersion:b};let t=pt();return t&&a("domain",t),{sdkVersion:b,browser:window.navigator.userAgent,domain:t,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},N=!1,B=()=>N,U=async()=>{N=!0;try{let t=P(lt()),e=E("rid"),r=E("uid"),c=await k("/v1/sdk/initialise",{version:1,data:{runtimeDetails:t,runtimeId:e,uId:r}}),{runtimeId:i,sTime:p}=c;a("rid",i),M(p);}catch{N=!1;}};function n(t,e){return (...r)=>{try{let o=t(...r);return o instanceof Promise?o.catch(()=>e):o}catch{return e}}}function mt(){return I()||typeof process>"u"?!1:process.env.JEST_WORKER_ID!==void 0}var K=n(mt,!1);var Y="imtbl__metrics",ft=5e3,ut=1e3,f=(t,e)=>globalConst.getGlobalisedValue(Y,t,e),J=(t,e)=>{let r=lruMemorise.memorise(e,{lruOptions:{ttl:ft,max:ut}});return globalConst.getGlobalisedValue(Y,t,r)};var gt=5e3,Tt=(t,e,r)=>{let o={event:`${t}.${e}`,time:O(),...r&&{properties:P(r)}};L(o);},u=n(J("track",Tt)),wt=async()=>{if(B()===!1){await U();return}let t=C();if(t.length===0)return;let e=t.length,r=$();await k("/v1/sdk/metrics",{version:1,data:{events:t,details:r}})instanceof Error||V(e);},Et=n(wt),H=async()=>{await Et(),setTimeout(H,gt);},z=!1,It=()=>{z||(z=!0,H());};K()||n(f("startFlushing",It))();var R=(t,e,r,o)=>u(t,e,{...o||{},duration:Math.round(r)});var j=()=>{let t=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return `${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`};var yt=(...t)=>{if(!t.some(o=>!!o))return {};let r={};return t.forEach(o=>{o&&(r={...r,...o});}),r},kt=t=>t.replace(/[^a-zA-Z0-9\s\-_]/g,""),Pt=(t,e)=>`${t}_${kt(e)}`,xt=(t,e,r)=>{let o=j(),c=Date.now(),i=0,p=0,s={},x=(...l)=>yt(s,...l,{flowId:o,flowName:e});s=x(r);let X=l=>{l&&(s=x(l));},A=(l,Z)=>{let Q=Pt(e,l),F=0,_=performance.now();i>0&&(F=_-p);let W=x(Z,{flowEventName:l,flowStep:i});R(t,Q,F,W),i++,p=_;};return A("Start"),{details:{moduleName:t,flowName:e,flowId:o,flowStartTime:c},addEvent:n(A),addFlowProperties:n(X)}},St=n(xt);var vt=(t,e,r,o)=>{let{message:c}=r,i=r.stack||"",{cause:p}=r;p instanceof Error&&(i=`${i}
2
+ Cause: ${p.message}
3
+ ${p.stack}`),u(t,`trackError_${e}`,{...o||{},errorMessage:c,errorStack:i,isTrackError:!0});},Dt=n(vt);var ht=t=>{if(t.passportId)return `passport:${t.passportId.toLowerCase()}`;if(t.ethAddress)return `ethAddress:${t.ethAddress.toLowerCase()}`;throw new Error("invalid_identity")},bt=t=>{let e=ht(t);e&&(a("uid",e),u("metrics","identify",t.traits));},Nt=n(bt);var Rt=t=>{a("env",t);},At=n(f("setEnvironment",Rt)),Ft=t=>{a("passportClientId",t);},_t=n(f("setPassportClientId",Ft)),Mt=t=>{a("pak",t);},Ot=n(f("setPublishableApiKey",Mt)),$t=n(f("getDetail",E));var Oe={localStorage:D};exports.Detail=w;exports.getDetail=$t;exports.identify=Nt;exports.setEnvironment=At;exports.setPassportClientId=_t;exports.setPublishableApiKey=Ot;exports.track=u;exports.trackDuration=R;exports.trackError=Dt;exports.trackFlow=St;exports.utils=Oe;
@@ -0,0 +1,3 @@
1
+ import st from'axios';import {memorise}from'lru-memorise';import {getGlobalisedValue}from'global-const';var q=Object.defineProperty;var tt=(t,e)=>{for(var r in e)q(t,r,{get:e[r],enumerable:!0});};var D={};tt(D,{deleteItem:()=>nt,getItem:()=>y,setItem:()=>T});var g=()=>typeof window>"u",I=()=>!g();var et="__IMX-",S=()=>I()&&window.localStorage,rt=t=>{if(t!==null)try{return JSON.parse(t)}catch{return t}},ot=t=>typeof t=="string"?t:JSON.stringify(t),v=t=>`${et}${t}`;function y(t){if(S())return rt(window.localStorage.getItem(v(t)))}var T=(t,e)=>S()?(window.localStorage.setItem(v(t),ot(e)),!0):!1,nt=t=>S()?(window.localStorage.removeItem(v(t)),!0):!1;var h=0,M=t=>{let e=parseInt(t,10)*1e3,r=new Date(e),o=new Date;return h=r.getTime()-o.getTime(),h},O=()=>{let t=new Date().getTime()+h;return new Date(t).toISOString()};var w=(s=>(s.RUNTIME_ID="rid",s.PASSPORT_CLIENT_ID="passportClientId",s.ENVIRONMENT="env",s.PUBLISHABLE_API_KEY="pak",s.IDENTITY="uid",s.DOMAIN="domain",s.SDK_VERSION="sdkVersion",s))(w||{});var it="https://api.immutable.com";async function k(t,e){let r=st.create({baseURL:it}),o=JSON.stringify(e),c={payload:Buffer.from(o).toString("base64")};return (await r.post(t,c)).data}var m,d,at=()=>{m=y("metrics-events")||[],d=y("metrics-runtime")||{};};at();var a=(t,e)=>{d={...d,[t]:e},T("metrics-runtime",d);},E=t=>{if(d[t]!==void 0)return d[t]},$=()=>d,C=()=>m,L=t=>{m.push(t),T("metrics-events",m);},V=t=>{m=m.slice(t),T("metrics-events",m);},P=t=>{let e=[];return Object.entries(t).forEach(([r,o])=>{(typeof r=="string"||typeof o=="string"||typeof o=="number"||typeof o=="boolean")&&e.push([r,o.toString()]);}),e};var b="2.0.0-alpha.0",ct=()=>g()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",pt=()=>{if(g())return "";let t;try{window.self!==window.top&&(t=ct());}catch{}return t||(t=window.location.hostname),t},lt=()=>{if(a("sdkVersion",b),g())return {browser:"nodejs",sdkVersion:b};let t=pt();return t&&a("domain",t),{sdkVersion:b,browser:window.navigator.userAgent,domain:t,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},N=!1,B=()=>N,U=async()=>{N=!0;try{let t=P(lt()),e=E("rid"),r=E("uid"),c=await k("/v1/sdk/initialise",{version:1,data:{runtimeDetails:t,runtimeId:e,uId:r}}),{runtimeId:i,sTime:p}=c;a("rid",i),M(p);}catch{N=!1;}};function n(t,e){return (...r)=>{try{let o=t(...r);return o instanceof Promise?o.catch(()=>e):o}catch{return e}}}function mt(){return I()||typeof process>"u"?!1:process.env.JEST_WORKER_ID!==void 0}var K=n(mt,!1);var Y="imtbl__metrics",ft=5e3,ut=1e3,f=(t,e)=>getGlobalisedValue(Y,t,e),J=(t,e)=>{let r=memorise(e,{lruOptions:{ttl:ft,max:ut}});return getGlobalisedValue(Y,t,r)};var gt=5e3,Tt=(t,e,r)=>{let o={event:`${t}.${e}`,time:O(),...r&&{properties:P(r)}};L(o);},u=n(J("track",Tt)),wt=async()=>{if(B()===!1){await U();return}let t=C();if(t.length===0)return;let e=t.length,r=$();await k("/v1/sdk/metrics",{version:1,data:{events:t,details:r}})instanceof Error||V(e);},Et=n(wt),H=async()=>{await Et(),setTimeout(H,gt);},z=!1,It=()=>{z||(z=!0,H());};K()||n(f("startFlushing",It))();var R=(t,e,r,o)=>u(t,e,{...o||{},duration:Math.round(r)});var j=()=>{let t=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return `${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`};var yt=(...t)=>{if(!t.some(o=>!!o))return {};let r={};return t.forEach(o=>{o&&(r={...r,...o});}),r},kt=t=>t.replace(/[^a-zA-Z0-9\s\-_]/g,""),Pt=(t,e)=>`${t}_${kt(e)}`,xt=(t,e,r)=>{let o=j(),c=Date.now(),i=0,p=0,s={},x=(...l)=>yt(s,...l,{flowId:o,flowName:e});s=x(r);let X=l=>{l&&(s=x(l));},A=(l,Z)=>{let Q=Pt(e,l),F=0,_=performance.now();i>0&&(F=_-p);let W=x(Z,{flowEventName:l,flowStep:i});R(t,Q,F,W),i++,p=_;};return A("Start"),{details:{moduleName:t,flowName:e,flowId:o,flowStartTime:c},addEvent:n(A),addFlowProperties:n(X)}},St=n(xt);var vt=(t,e,r,o)=>{let{message:c}=r,i=r.stack||"",{cause:p}=r;p instanceof Error&&(i=`${i}
2
+ Cause: ${p.message}
3
+ ${p.stack}`),u(t,`trackError_${e}`,{...o||{},errorMessage:c,errorStack:i,isTrackError:!0});},Dt=n(vt);var ht=t=>{if(t.passportId)return `passport:${t.passportId.toLowerCase()}`;if(t.ethAddress)return `ethAddress:${t.ethAddress.toLowerCase()}`;throw new Error("invalid_identity")},bt=t=>{let e=ht(t);e&&(a("uid",e),u("metrics","identify",t.traits));},Nt=n(bt);var Rt=t=>{a("env",t);},At=n(f("setEnvironment",Rt)),Ft=t=>{a("passportClientId",t);},_t=n(f("setPassportClientId",Ft)),Mt=t=>{a("pak",t);},Ot=n(f("setPublishableApiKey",Mt)),$t=n(f("getDetail",E));var Oe={localStorage:D};export{w as Detail,$t as getDetail,Nt as identify,At as setEnvironment,_t as setPassportClientId,Ot as setPublishableApiKey,u as track,R as trackDuration,Dt as trackError,St as trackFlow,Oe as utils};
@@ -0,0 +1,6 @@
1
+ import { Detail } from './utils/constants';
2
+ export declare const setEnvironment: (env: "sandbox" | "production") => void;
3
+ export declare const setPassportClientId: (passportClientId: string) => void;
4
+ export declare const setPublishableApiKey: (publishableApiKey: string) => void;
5
+ export declare const getDetail: (key: Detail) => string | undefined;
6
+ export { Detail };
@@ -0,0 +1,19 @@
1
+ import { TrackProperties } from './track';
2
+ /**
3
+ * Track an event and it's performance. Works similarly to `track`, but also includes a duration.
4
+ * @param moduleName Name of the module being tracked (for namespacing purposes), e.g. `passport`
5
+ * @param eventName Name of the event, e.g. `clickItem`
6
+ * @param error Error object to be tracked
7
+ * @param properties Other properties to be sent with the event, other than duration
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * trackError("passport", "sendTransactionFailed", error);
12
+ * trackError("passport", "getItemFailed", error, { otherProperty: "value" });
13
+ * ```
14
+ */
15
+ export declare const trackError: (moduleName: string, eventName: string, error: Error, properties?: (TrackProperties & {
16
+ isTrackError?: never;
17
+ errorMessage?: never;
18
+ errorStack?: never;
19
+ }) | undefined) => void;
@@ -0,0 +1,41 @@
1
+ import { AllowedTrackProperties } from './track';
2
+ export type Flow = {
3
+ details: {
4
+ moduleName: string;
5
+ flowName: string;
6
+ flowId: string;
7
+ flowStartTime: number;
8
+ };
9
+ /**
10
+ * Track an event in the flow
11
+ * @param eventName Name of the event
12
+ * @param properties Object containing event properties
13
+ */
14
+ addEvent: (eventName: string, properties?: AllowedTrackProperties) => void;
15
+ /**
16
+ * Function to add new flow properties
17
+ * @param newProperties Object new properties
18
+ */
19
+ addFlowProperties: (properties: AllowedTrackProperties) => void;
20
+ };
21
+ /**
22
+ * Track a flow of events, including the start and end of the flow.
23
+ * Works similarly to `track`
24
+ * @param moduleName Name of the module being tracked (for namespacing purposes), e.g. `passport`
25
+ * @param flowName Name of the flow, e.g. `performTransaction`
26
+ * @param properties Other properties to be sent with the event, other than duration
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const flow = trackFlow("passport", "performTransaction", { transationType: "transfer" });
31
+ * // Do something...
32
+ * flow.addEvent("clickItem");
33
+ * // Do something...
34
+ * flow.addFlowProperties({ item: "item1" });
35
+ * flow.addEvent("guardianCheck", {"invisible": "true"});
36
+ * // Do something...
37
+ * flow.addEvent("guardianCheckComplete");
38
+ * flow.end();
39
+ * ```
40
+ */
41
+ export declare const trackFlow: (moduleName: string, flowName: string, properties?: AllowedTrackProperties | undefined) => Flow;
@@ -0,0 +1,7 @@
1
+ type Identity = {
2
+ passportId?: string;
3
+ ethAddress?: string;
4
+ traits?: Record<string, string | number>;
5
+ };
6
+ export declare const identify: (params: Identity) => void;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ import * as localStorage from './utils/localStorage';
2
+ export { track } from './track';
3
+ export { trackDuration } from './performance';
4
+ export { trackFlow } from './flow';
5
+ export type { Flow } from './flow';
6
+ export { trackError } from './error';
7
+ export { identify } from './identify';
8
+ export { setEnvironment, setPassportClientId, setPublishableApiKey, getDetail, Detail, } from './details';
9
+ export declare const utils: {
10
+ localStorage: typeof localStorage;
11
+ };
@@ -0,0 +1,2 @@
1
+ export declare const isInitialised: () => boolean;
2
+ export declare const initialise: () => Promise<void>;
@@ -0,0 +1,15 @@
1
+ import { AllowedTrackProperties } from './track';
2
+ /**
3
+ * Track an event and it's performance. Works similarly to `track`, but also includes a duration.
4
+ * @param moduleName Name of the module being tracked (for namespacing purposes), e.g. `passport`
5
+ * @param eventName Name of the event, e.g. `clickItem`
6
+ * @param duration Duration of the event in milliseconds, e.g. `1000`
7
+ * @param properties Other properties to be sent with the event, other than duration
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * trackDuration("passport", "performTransaction", 1000);
12
+ * trackDuration("passport", "performTransaction", 1000, { transationType: "transfer" });
13
+ * ```
14
+ */
15
+ export declare const trackDuration: (moduleName: string, eventName: string, duration: number, properties?: AllowedTrackProperties) => void;
@@ -0,0 +1,26 @@
1
+ export declare const POLLING_FREQUENCY = 5000;
2
+ export type TrackProperties = Record<string, string | number | boolean | undefined>;
3
+ export type AllowedTrackProperties = TrackProperties & {
4
+ duration?: never;
5
+ flowId?: never;
6
+ flowName?: never;
7
+ flowEventName?: never;
8
+ flowStep?: never;
9
+ isTrackError?: never;
10
+ errorMessage?: never;
11
+ errorStack?: never;
12
+ };
13
+ /**
14
+ * Track an event completion.
15
+ * @param moduleName Name of the module being tracked (for namespacing purposes), e.g. `passport`
16
+ * @param eventName Name of the event, use camelCase e.g. `clickItem`
17
+ * @param properties Other properties to be sent with the event
18
+ *
19
+ * e.g.
20
+ *
21
+ * ```ts
22
+ * track("passport", "performTransaction");
23
+ * track("passport", "performTransaction", { transationType: "transfer" });
24
+ * ```
25
+ */
26
+ export declare const track: (moduleName: string, eventName: string, properties?: TrackProperties | undefined) => void;
@@ -0,0 +1,2 @@
1
+ export declare const isNode: () => boolean;
2
+ export declare const isBrowser: () => boolean;
@@ -0,0 +1 @@
1
+ export declare const isTestEnvironment: () => boolean;
@@ -0,0 +1,2 @@
1
+ export declare const setClockSkew: (serverUnixTime: string) => number;
2
+ export declare const getCorrectedTime: () => string;
@@ -0,0 +1,9 @@
1
+ export declare enum Detail {
2
+ RUNTIME_ID = "rid",
3
+ PASSPORT_CLIENT_ID = "passportClientId",
4
+ ENVIRONMENT = "env",
5
+ PUBLISHABLE_API_KEY = "pak",
6
+ IDENTITY = "uid",
7
+ DOMAIN = "domain",
8
+ SDK_VERSION = "sdkVersion"
9
+ }
@@ -0,0 +1 @@
1
+ export declare function errorBoundary<T extends (...args: any[]) => any>(fn: T, fallbackResult?: ReturnType<T>): (...args: Parameters<T>) => ReturnType<T>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const getGlobalisedValue: <T>(key: string, value: T) => T;
2
+ export declare const getGlobalisedCachedFunction: <T extends (...args: any[]) => any>(key: string, fn: T) => T;
@@ -0,0 +1 @@
1
+ export declare const generateFlowId: () => string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Abstraction on localstorage
3
+ */
4
+ export declare function getItem<T = any>(key: string): T | undefined;
5
+ export declare const setItem: (key: string, payload: any) => boolean;
6
+ export declare const deleteItem: (key: string) => boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function post<T = any>(path: string, data: any): Promise<T>;
@@ -0,0 +1,14 @@
1
+ import { Detail } from './constants';
2
+ export declare enum Store {
3
+ EVENTS = "metrics-events",
4
+ RUNTIME = "metrics-runtime"
5
+ }
6
+ export declare const storeDetail: (key: Detail, value: string) => void;
7
+ export declare const getDetail: (key: Detail) => string | undefined;
8
+ export declare const getAllDetails: () => Record<string, string>;
9
+ export declare const getEvents: () => any[];
10
+ export declare const addEvent: (event: any) => void;
11
+ export declare const removeSentEvents: (numberOfEvents: number) => void;
12
+ type TrackProperties = Record<string, string | number | boolean | undefined>;
13
+ export declare const flattenProperties: (properties: TrackProperties) => [string, string][];
14
+ export {};
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@imtbl/metrics",
3
+ "description": "Metrics module for Immutable SDK",
4
+ "version": "2.0.0-alpha.0",
5
+ "author": "Immutable",
6
+ "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
7
+ "dependencies": {
8
+ "axios": "^1.6.5",
9
+ "global-const": "^0.1.2",
10
+ "lru-memorise": "0.3.0"
11
+ },
12
+ "devDependencies": {
13
+ "@swc/core": "^1.3.36",
14
+ "@swc/jest": "^0.2.24",
15
+ "@types/jest": "^29.4.3",
16
+ "@types/node": "^18.14.2",
17
+ "eslint": "^8.40.0",
18
+ "jest": "^29.4.3",
19
+ "jest-environment-jsdom": "^29.4.3",
20
+ "ts-jest": "^29.1.0",
21
+ "tsup": "^8.3.5",
22
+ "typescript": "^5.6.2"
23
+ },
24
+ "engines": {
25
+ "node": ">=20.11.0"
26
+ },
27
+ "exports": {
28
+ "development": {
29
+ "types": "./src/index.ts",
30
+ "browser": "./dist/browser/index.js",
31
+ "require": "./dist/node/index.cjs",
32
+ "default": "./dist/node/index.js"
33
+ },
34
+ "default": {
35
+ "types": "./dist/types/index.d.ts",
36
+ "browser": "./dist/browser/index.js",
37
+ "require": "./dist/node/index.cjs",
38
+ "default": "./dist/node/index.js"
39
+ }
40
+ },
41
+ "files": [
42
+ "dist"
43
+ ],
44
+ "homepage": "https://github.com/immutable/ts-immutable-sdk#readme",
45
+ "main": "dist/node/index.cjs",
46
+ "module": "dist/node/index.js",
47
+ "browser": "dist/browser/index.js",
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "repository": "immutable/ts-immutable-sdk.git",
52
+ "type": "module",
53
+ "types": "./dist/types/index.d.ts",
54
+ "scripts": {
55
+ "build": "pnpm transpile && pnpm typegen",
56
+ "transpile": "tsup src/index.ts --config ../../../tsup.config.js",
57
+ "typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
58
+ "lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
59
+ "test": "jest",
60
+ "test:watch": "jest --watch",
61
+ "typecheck": "tsc --customConditions default --noEmit --jsx preserve"
62
+ }
63
+ }