@junobuild/analytics 0.0.21 → 0.0.22

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.
@@ -51,7 +51,7 @@ export interface Controller {
51
51
  }
52
52
  export type ControllerScope = {Write: null} | {Admin: null};
53
53
  export interface DelSatelliteConfig {
54
- updated_at: [] | [bigint];
54
+ version: [] | [bigint];
55
55
  }
56
56
  export interface DeleteControllersArgs {
57
57
  controllers: Array<Principal>;
@@ -72,6 +72,7 @@ export interface MemorySize {
72
72
  export interface OrbiterSatelliteConfig {
73
73
  updated_at: bigint;
74
74
  created_at: bigint;
75
+ version: [] | [bigint];
75
76
  enabled: boolean;
76
77
  }
77
78
  export interface PageView {
@@ -84,6 +85,7 @@ export interface PageView {
84
85
  created_at: bigint;
85
86
  satellite_id: Principal;
86
87
  device: PageViewDevice;
88
+ version: [] | [bigint];
87
89
  user_agent: [] | [string];
88
90
  }
89
91
  export interface PageViewDevice {
@@ -111,10 +113,11 @@ export interface SetPageView {
111
113
  href: string;
112
114
  satellite_id: Principal;
113
115
  device: PageViewDevice;
116
+ version: [] | [bigint];
114
117
  user_agent: [] | [string];
115
118
  }
116
119
  export interface SetSatelliteConfig {
117
- updated_at: [] | [bigint];
120
+ version: [] | [bigint];
118
121
  enabled: boolean;
119
122
  }
120
123
  export interface SetTrackEvent {
@@ -123,6 +126,7 @@ export interface SetTrackEvent {
123
126
  metadata: [] | [Array<[string, string]>];
124
127
  name: string;
125
128
  satellite_id: Principal;
129
+ version: [] | [bigint];
126
130
  user_agent: [] | [string];
127
131
  }
128
132
  export interface TrackEvent {
@@ -132,6 +136,7 @@ export interface TrackEvent {
132
136
  name: string;
133
137
  created_at: bigint;
134
138
  satellite_id: Principal;
139
+ version: [] | [bigint];
135
140
  }
136
141
  export interface _SERVICE {
137
142
  del_controllers: ActorMethod<[DeleteControllersArgs], Array<[Principal, Controller]>>;
@@ -14,7 +14,7 @@ export const idlFactory = ({IDL}) => {
14
14
  scope: ControllerScope,
15
15
  expires_at: IDL.Opt(IDL.Nat64)
16
16
  });
17
- const DelSatelliteConfig = IDL.Record({updated_at: IDL.Opt(IDL.Nat64)});
17
+ const DelSatelliteConfig = IDL.Record({version: IDL.Opt(IDL.Nat64)});
18
18
  const DepositCyclesArgs = IDL.Record({
19
19
  cycles: IDL.Nat,
20
20
  destination_id: IDL.Principal
@@ -42,6 +42,7 @@ export const idlFactory = ({IDL}) => {
42
42
  created_at: IDL.Nat64,
43
43
  satellite_id: IDL.Principal,
44
44
  device: PageViewDevice,
45
+ version: IDL.Opt(IDL.Nat64),
45
46
  user_agent: IDL.Opt(IDL.Text)
46
47
  });
47
48
  const AnalyticsBrowsersPageViews = IDL.Record({
@@ -83,7 +84,8 @@ export const idlFactory = ({IDL}) => {
83
84
  metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
84
85
  name: IDL.Text,
85
86
  created_at: IDL.Nat64,
86
- satellite_id: IDL.Principal
87
+ satellite_id: IDL.Principal,
88
+ version: IDL.Opt(IDL.Nat64)
87
89
  });
88
90
  const AnalyticsTrackEvents = IDL.Record({
89
91
  total: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32))
@@ -91,6 +93,7 @@ export const idlFactory = ({IDL}) => {
91
93
  const OrbiterSatelliteConfig = IDL.Record({
92
94
  updated_at: IDL.Nat64,
93
95
  created_at: IDL.Nat64,
96
+ version: IDL.Opt(IDL.Nat64),
94
97
  enabled: IDL.Bool
95
98
  });
96
99
  const MemorySize = IDL.Record({stable: IDL.Nat64, heap: IDL.Nat64});
@@ -112,6 +115,7 @@ export const idlFactory = ({IDL}) => {
112
115
  href: IDL.Text,
113
116
  satellite_id: IDL.Principal,
114
117
  device: PageViewDevice,
118
+ version: IDL.Opt(IDL.Nat64),
115
119
  user_agent: IDL.Opt(IDL.Text)
116
120
  });
117
121
  const Result = IDL.Variant({Ok: PageView, Err: IDL.Text});
@@ -120,7 +124,7 @@ export const idlFactory = ({IDL}) => {
120
124
  Err: IDL.Vec(IDL.Tuple(AnalyticKey, IDL.Text))
121
125
  });
122
126
  const SetSatelliteConfig = IDL.Record({
123
- updated_at: IDL.Opt(IDL.Nat64),
127
+ version: IDL.Opt(IDL.Nat64),
124
128
  enabled: IDL.Bool
125
129
  });
126
130
  const SetTrackEvent = IDL.Record({
@@ -129,6 +133,7 @@ export const idlFactory = ({IDL}) => {
129
133
  metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
130
134
  name: IDL.Text,
131
135
  satellite_id: IDL.Principal,
136
+ version: IDL.Opt(IDL.Nat64),
132
137
  user_agent: IDL.Opt(IDL.Text)
133
138
  });
134
139
  const Result_2 = IDL.Variant({Ok: TrackEvent, Err: IDL.Text});
@@ -14,7 +14,7 @@ export const idlFactory = ({IDL}) => {
14
14
  scope: ControllerScope,
15
15
  expires_at: IDL.Opt(IDL.Nat64)
16
16
  });
17
- const DelSatelliteConfig = IDL.Record({updated_at: IDL.Opt(IDL.Nat64)});
17
+ const DelSatelliteConfig = IDL.Record({version: IDL.Opt(IDL.Nat64)});
18
18
  const DepositCyclesArgs = IDL.Record({
19
19
  cycles: IDL.Nat,
20
20
  destination_id: IDL.Principal
@@ -42,6 +42,7 @@ export const idlFactory = ({IDL}) => {
42
42
  created_at: IDL.Nat64,
43
43
  satellite_id: IDL.Principal,
44
44
  device: PageViewDevice,
45
+ version: IDL.Opt(IDL.Nat64),
45
46
  user_agent: IDL.Opt(IDL.Text)
46
47
  });
47
48
  const AnalyticsBrowsersPageViews = IDL.Record({
@@ -83,7 +84,8 @@ export const idlFactory = ({IDL}) => {
83
84
  metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
84
85
  name: IDL.Text,
85
86
  created_at: IDL.Nat64,
86
- satellite_id: IDL.Principal
87
+ satellite_id: IDL.Principal,
88
+ version: IDL.Opt(IDL.Nat64)
87
89
  });
88
90
  const AnalyticsTrackEvents = IDL.Record({
89
91
  total: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32))
@@ -91,6 +93,7 @@ export const idlFactory = ({IDL}) => {
91
93
  const OrbiterSatelliteConfig = IDL.Record({
92
94
  updated_at: IDL.Nat64,
93
95
  created_at: IDL.Nat64,
96
+ version: IDL.Opt(IDL.Nat64),
94
97
  enabled: IDL.Bool
95
98
  });
96
99
  const MemorySize = IDL.Record({stable: IDL.Nat64, heap: IDL.Nat64});
@@ -112,6 +115,7 @@ export const idlFactory = ({IDL}) => {
112
115
  href: IDL.Text,
113
116
  satellite_id: IDL.Principal,
114
117
  device: PageViewDevice,
118
+ version: IDL.Opt(IDL.Nat64),
115
119
  user_agent: IDL.Opt(IDL.Text)
116
120
  });
117
121
  const Result = IDL.Variant({Ok: PageView, Err: IDL.Text});
@@ -120,7 +124,7 @@ export const idlFactory = ({IDL}) => {
120
124
  Err: IDL.Vec(IDL.Tuple(AnalyticKey, IDL.Text))
121
125
  });
122
126
  const SetSatelliteConfig = IDL.Record({
123
- updated_at: IDL.Opt(IDL.Nat64),
127
+ version: IDL.Opt(IDL.Nat64),
124
128
  enabled: IDL.Bool
125
129
  });
126
130
  const SetTrackEvent = IDL.Record({
@@ -129,6 +133,7 @@ export const idlFactory = ({IDL}) => {
129
133
  metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
130
134
  name: IDL.Text,
131
135
  satellite_id: IDL.Principal,
136
+ version: IDL.Opt(IDL.Nat64),
132
137
  user_agent: IDL.Opt(IDL.Text)
133
138
  });
134
139
  const Result_2 = IDL.Variant({Ok: TrackEvent, Err: IDL.Text});
@@ -1,2 +1,2 @@
1
- var g="abcdefghijklmnopqrstuvwxyz234567",i=Object.create(null);for(let e=0;e<g.length;e++)i[g[e]]=e;i[0]=i.o;i[1]=i.i;var M=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);var y=e=>e==null,b=e=>!y(e),I=class extends Error{},n=(e,t)=>{if(y(e))throw new I(t)};var c=e=>b(e)?[e]:[];var l=()=>typeof window<"u";var x=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,r)=>(r&=63,r<36?t+=r.toString(36):r<62?t+=(r-26).toString(36).toUpperCase():r>62?t+="-":t+="_",t),"");var w=()=>BigInt(Date.now())*BigInt(1e6);var p=()=>({collected_at:w(),updated_at:[]}),u=()=>{let{userAgent:e}=navigator;return{user_agent:c(e)}};var S=()=>{if(!(typeof crypto>"u"))return x()},d=S(),a,h=e=>{let{path:t}=e.worker??{},r=t===void 0?"./workers/analytics.worker.js":t;a=new Worker(r);let o=()=>console.warn("Unable to connect to the analytics web worker. Have you deployed it?");return a?.addEventListener("error",o,!1),P(e),{cleanup(){a?.removeEventListener("error",o,!1)}}},_=()=>{let e=async()=>await k(),t=new Proxy(history.pushState,{apply:async(r,o,f)=>{r.apply(o,f),await e()}});return history.pushState=t,addEventListener("popstate",e,{passive:!0}),{cleanup(){t=null,removeEventListener("popstate",e,!1)}}},s="Analytics worker not initialized. Did you call `initOrbiter`?",v="No session ID initialized.",m=async()=>{if(!l())return;n(d,v);let{title:e,location:{href:t},referrer:r}=document,{innerWidth:o,innerHeight:f}=window,{timeZone:N}=Intl.DateTimeFormat().resolvedOptions(),T={title:e,href:t,referrer:c(b(r)&&r!==""?r:void 0),device:{inner_width:o,inner_height:f},time_zone:N,session_id:d,...u(),...p()};await(await import("./idb.services-V6IDWAXJ.js")).setPageView({key:x(),view:T})},k=async()=>{n(a,s),await m(),a?.postMessage({msg:"junoTrackPageView"})},U=async e=>{if(!l())return;n(d,v),n(a,s),await(await import("./idb.services-V6IDWAXJ.js")).setTrackEvent({key:x(),track:{...e,session_id:d,...u(),...p()}}),a?.postMessage({msg:"junoTrackEvent"})},P=e=>{n(a,s),a?.postMessage({msg:"junoInitEnvironment",data:e})},A=()=>{n(a,s),a?.postMessage({msg:"junoStartTrackTimer"})},E=()=>{n(a,s),a?.postMessage({msg:"junoStopTracker"})};var oe=async e=>{await m();let{cleanup:t}=h(e),{cleanup:r}=_();return A(),()=>{E(),t(),r()}};export{oe as initOrbiter,U as trackEvent,k as trackPageView};
1
+ var y="abcdefghijklmnopqrstuvwxyz234567",i=Object.create(null);for(let e=0;e<y.length;e++)i[y[e]]=e;i[0]=i.o;i[1]=i.i;var D=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);var s=e=>e==null,f=e=>!s(e),U=class extends Error{},l=(e,t)=>{if(s(e))throw new U(t)};var c=e=>f(e)?[e]:[];var p=()=>typeof window<"u";var w="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var x=(e=21)=>{let t="",a=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=w[a[e]&63];return t};var h=()=>BigInt(Date.now())*BigInt(1e6);var u=()=>({collected_at:h(),updated_at:[],version:[]}),m=()=>{let{userAgent:e}=navigator;return{user_agent:c(e)}};var S="Analytics worker not initialized. Did you call `initOrbiter`?",o=e=>{s(e)&&console.warn(S)};var P=()=>{if(!(typeof crypto>"u"))return x()},d=P(),r,_=e=>{let{path:t}=e.worker??{},a=t===void 0?"./workers/analytics.worker.js":t;r=new Worker(a);let n=()=>console.warn("Unable to connect to the analytics web worker. Have you deployed it?");return r?.addEventListener("error",n,!1),O(e),{cleanup(){r?.removeEventListener("error",n,!1)}}},v=()=>{let e=async()=>await A(),t=new Proxy(history.pushState,{apply:async(a,n,b)=>{a.apply(n,b),await e()}});return history.pushState=t,addEventListener("popstate",e,{passive:!0}),{cleanup(){t=null,removeEventListener("popstate",e,!1)}}},k="No session ID initialized.",g=async()=>{if(!p())return;l(d,k);let{title:e,location:{href:t},referrer:a}=document,{innerWidth:n,innerHeight:b}=window,{timeZone:T}=Intl.DateTimeFormat().resolvedOptions(),I={title:e,href:t,referrer:c(f(a)&&a!==""?a:void 0),device:{inner_width:n,inner_height:b},time_zone:T,session_id:d,...m(),...u()};await(await import("./idb.services-V6IDWAXJ.js")).setPageView({key:x(),view:I})},A=async()=>{o(r),await g(),r?.postMessage({msg:"junoTrackPageView"})},j=async e=>{if(!p())return;l(d,k),o(r),await(await import("./idb.services-V6IDWAXJ.js")).setTrackEvent({key:x(),track:{...e,session_id:d,...m(),...u()}}),r?.postMessage({msg:"junoTrackEvent"})},O=e=>{o(r),r?.postMessage({msg:"junoInitEnvironment",data:e})},E=()=>{o(r),r?.postMessage({msg:"junoStartTrackTimer"})},N=()=>{o(r),r?.postMessage({msg:"junoStopTracker"})};var fe=async e=>{await g();let{cleanup:t}=_(e),{cleanup:a}=v();return E(),()=>{N(),t(),a()}};export{fe as initOrbiter,j as trackEvent,A as trackPageView};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../node_modules/@dfinity/principal/src/utils/base32.ts", "../../../../node_modules/@dfinity/principal/src/utils/getCrc.ts", "../../../utils/src/utils/debounce.utils.ts", "../../../utils/src/utils/json.utils.ts", "../../../utils/src/utils/null.utils.ts", "../../../utils/src/utils/did.utils.ts", "../../../utils/src/utils/env.utils.ts", "../../../../node_modules/nanoid/index.browser.js", "../../src/utils/date.utils.ts", "../../src/utils/analytics.utils.ts", "../../src/services/analytics.services.ts", "../../src/index.ts"],
4
- "sourcesContent": ["const alphabet = 'abcdefghijklmnopqrstuvwxyz234567';\n\n// Build a lookup table for decoding.\nconst lookupTable: Record<string, number> = Object.create(null);\nfor (let i = 0; i < alphabet.length; i++) {\n lookupTable[alphabet[i]] = i;\n}\n\n// Add aliases for rfc4648.\nlookupTable['0'] = lookupTable.o;\nlookupTable['1'] = lookupTable.i;\n\n/**\n * @param input The input array to encode.\n * @returns A Base32 string encoding the input.\n */\nexport function encode(input: Uint8Array): string {\n // How many bits will we skip from the first byte.\n let skip = 0;\n // 5 high bits, carry from one byte to the next.\n let bits = 0;\n\n // The output string in base32.\n let output = '';\n\n function encodeByte(byte: number) {\n if (skip < 0) {\n // we have a carry from the previous byte\n bits |= byte >> -skip;\n } else {\n // no carry\n bits = (byte << skip) & 248;\n }\n\n if (skip > 3) {\n // Not enough data to produce a character, get us another one\n skip -= 8;\n return 1;\n }\n\n if (skip < 4) {\n // produce a character\n output += alphabet[bits >> 3];\n skip += 5;\n }\n\n return 0;\n }\n\n for (let i = 0; i < input.length; ) {\n i += encodeByte(input[i]);\n }\n\n return output + (skip < 0 ? alphabet[bits >> 3] : '');\n}\n\n/**\n * @param input The base32 encoded string to decode.\n */\nexport function decode(input: string): Uint8Array {\n // how many bits we have from the previous character.\n let skip = 0;\n // current byte we're producing.\n let byte = 0;\n\n const output = new Uint8Array(((input.length * 4) / 3) | 0);\n let o = 0;\n\n function decodeChar(char: string) {\n // Consume a character from the stream, store\n // the output in this.output. As before, better\n // to use update().\n let val = lookupTable[char.toLowerCase()];\n if (val === undefined) {\n throw new Error(`Invalid character: ${JSON.stringify(char)}`);\n }\n\n // move to the high bits\n val <<= 3;\n byte |= val >>> skip;\n skip += 5;\n\n if (skip >= 8) {\n // We have enough bytes to produce an output\n output[o++] = byte;\n skip -= 8;\n\n if (skip > 0) {\n byte = (val << (5 - skip)) & 255;\n } else {\n byte = 0;\n }\n }\n }\n\n for (const c of input) {\n decodeChar(c);\n }\n\n return output.slice(0, o);\n}\n", "// This file is translated to JavaScript from\n// https://lxp32.github.io/docs/a-simple-example-crc32-calculation/\nconst lookUpTable: Uint32Array = new Uint32Array([\n 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,\n 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,\n 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,\n 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,\n 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,\n 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,\n 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,\n 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,\n 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,\n 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,\n 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,\n 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,\n 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,\n 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,\n 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,\n 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,\n 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,\n 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,\n 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,\n 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,\n 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,\n 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,\n 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,\n 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,\n 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,\n 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,\n 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,\n 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,\n 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,\n 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,\n 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,\n 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,\n]);\n\n/**\n * Calculate the CRC32 of an ArrayBufferLike.\n * @param buf The BufferLike to calculate the CRC32 of.\n */\nexport function getCrc32(buf: ArrayBufferLike): number {\n const b = new Uint8Array(buf);\n let crc = -1;\n\n for (let i = 0; i < b.length; i++) {\n const byte = b[i];\n const t = (byte ^ crc) & 0xff;\n crc = lookUpTable[t] ^ (crc >>> 8);\n }\n\n return (crc ^ -1) >>> 0;\n}\n", "/* eslint-disable-next-line @typescript-eslint/ban-types */\nexport const debounce = (func: Function, timeout?: number) => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n return (...args: unknown[]) => {\n const next = () => func(...args);\n\n if (timer) {\n clearTimeout(timer);\n }\n\n timer = setTimeout(next, timeout !== undefined && timeout > 0 ? timeout : 300);\n };\n};\n", "import {Principal} from '@dfinity/principal';\nimport {nonNullish} from './null.utils';\n\nconst JSON_KEY_BIGINT = '__bigint__';\nconst JSON_KEY_PRINCIPAL = '__principal__';\nconst JSON_KEY_UINT8ARRAY = '__uint8array__';\n\n/**\n * A parser that interprets revived BigInt, Principal, and Uint8Array when constructing JavaScript values or objects.\n */\nexport const jsonReplacer = (_key: string, value: unknown): unknown => {\n if (typeof value === 'bigint') {\n return {[JSON_KEY_BIGINT]: `${value}`};\n }\n\n if (nonNullish(value) && value instanceof Principal) {\n return {[JSON_KEY_PRINCIPAL]: value.toText()};\n }\n\n if (nonNullish(value) && value instanceof Uint8Array) {\n return {[JSON_KEY_UINT8ARRAY]: Array.from(value)};\n }\n\n return value;\n};\n\n/**\n * A function that alters the behavior of the stringification process for BigInt, Principal and Uint8Array.\n */\nexport const jsonReviver = (_key: string, value: unknown): unknown => {\n const mapValue = <T>(key: string): T => (value as Record<string, T>)[key];\n\n if (nonNullish(value) && typeof value === 'object' && JSON_KEY_BIGINT in value) {\n return BigInt(mapValue(JSON_KEY_BIGINT));\n }\n\n if (nonNullish(value) && typeof value === 'object' && JSON_KEY_PRINCIPAL in value) {\n return Principal.fromText(mapValue(JSON_KEY_PRINCIPAL));\n }\n\n if (nonNullish(value) && typeof value === 'object' && JSON_KEY_UINT8ARRAY in value) {\n return Uint8Array.from(mapValue(JSON_KEY_UINT8ARRAY));\n }\n\n return value;\n};\n", "/** Is null or undefined */\nexport const isNullish = <T>(argument: T | undefined | null): argument is undefined | null =>\n argument === null || argument === undefined;\n\n/** Not null and not undefined */\nexport const nonNullish = <T>(argument: T | undefined | null): argument is NonNullable<T> =>\n !isNullish(argument);\n\nexport class NullishError extends Error {}\n\nexport const assertNonNullish: <T>(\n value: T,\n message?: string\n) => asserts value is NonNullable<T> = <T>(value: T, message?: string): void => {\n if (isNullish(value)) {\n throw new NullishError(message);\n }\n};\n", "import {jsonReplacer, jsonReviver} from './json.utils';\nimport {nonNullish} from './null.utils';\n\nexport const toNullable = <T>(value?: T): [] | [T] => {\n return nonNullish(value) ? [value] : [];\n};\n\nexport const fromNullable = <T>(value: [] | [T]): T | undefined => {\n return value?.[0];\n};\n\nexport const toArray = async <T>(data: T): Promise<Uint8Array> => {\n const blob: Blob = new Blob([JSON.stringify(data, jsonReplacer)], {\n type: 'application/json; charset=utf-8'\n });\n return new Uint8Array(await blob.arrayBuffer());\n};\n\nexport const fromArray = async <T>(data: Uint8Array | number[]): Promise<T> => {\n const blob: Blob = new Blob([data instanceof Uint8Array ? data : new Uint8Array(data)], {\n type: 'application/json; charset=utf-8'\n });\n return JSON.parse(await blob.text(), jsonReviver);\n};\n", "export const isBrowser = () => typeof window !== `undefined`;\n", "export { urlAlphabet } from './url-alphabet/index.js'\nexport let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nexport let customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length === size) return id\n }\n }\n }\n}\nexport let customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size, random)\nexport let nanoid = (size = 21) =>\n crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {\n byte &= 63\n if (byte < 36) {\n id += byte.toString(36)\n } else if (byte < 62) {\n id += (byte - 26).toString(36).toUpperCase()\n } else if (byte > 62) {\n id += '-'\n } else {\n id += '_'\n }\n return id\n }, '')\n", "export const nowInBigIntNanoSeconds = (): bigint => BigInt(Date.now()) * BigInt(1e6);\n", "import {toNullable} from '@junobuild/utils';\nimport {nowInBigIntNanoSeconds} from './date.utils';\n\nexport const timestamp = (): {collected_at: bigint; updated_at: [] | [bigint]} => ({\n collected_at: nowInBigIntNanoSeconds(),\n updated_at: []\n});\n\nexport const userAgent = (): {user_agent: [] | [string]} => {\n const {userAgent} = navigator;\n return {user_agent: toNullable(userAgent)};\n};\n", "import {assertNonNullish, isBrowser, nonNullish, toNullable} from '@junobuild/utils';\nimport {nanoid} from 'nanoid';\nimport type {Environment, EnvironmentWorker} from '../types/env';\nimport type {IdbPageView} from '../types/idb';\nimport type {PostMessageInitEnvData} from '../types/post-message';\nimport type {TrackEvent} from '../types/track';\nimport {timestamp, userAgent} from '../utils/analytics.utils';\n\nconst initSessionId = (): string | undefined => {\n // I faced this issue when I used the library in Docusaurus which does not implement the crypto API when server-side rendering.\n // https://github.com/ai/nanoid/issues?q=crypto+not+defined\n if (typeof crypto === 'undefined') {\n return undefined;\n }\n\n return nanoid();\n};\n\nconst sessionId = initSessionId();\n\nlet worker: Worker | undefined;\n\nexport const initWorker = (env: Environment): {cleanup: () => void} => {\n const {path}: EnvironmentWorker = env.worker ?? {};\n const workerUrl = path === undefined ? './workers/analytics.worker.js' : path;\n\n worker = new Worker(workerUrl);\n\n const consoleWarn = () =>\n console.warn('Unable to connect to the analytics web worker. Have you deployed it?');\n\n worker?.addEventListener('error', consoleWarn, false);\n\n initWorkerEnvironment(env);\n\n return {\n cleanup() {\n worker?.removeEventListener('error', consoleWarn, false);\n }\n };\n};\n\nexport const initTrackPageViews = (): {cleanup: () => void} => {\n const trackPages = async () => await trackPageView();\n\n let pushStateProxy: typeof history.pushState | null = new Proxy(history.pushState, {\n apply: async (\n target,\n thisArg,\n argArray: [data: unknown, unused: string, url?: string | URL | null | undefined]\n ) => {\n target.apply(thisArg, argArray);\n await trackPages();\n }\n });\n\n history.pushState = pushStateProxy;\n\n addEventListener('popstate', trackPages, {passive: true});\n\n return {\n cleanup() {\n pushStateProxy = null;\n removeEventListener('popstate', trackPages, false);\n }\n };\n};\n\nconst WORKER_UNDEFINED_MSG =\n 'Analytics worker not initialized. Did you call `initOrbiter`?' as const;\nconst SESSION_ID_UNDEFINED_MSG = 'No session ID initialized.' as const;\n\nexport const setPageView = async () => {\n if (!isBrowser()) {\n return;\n }\n\n assertNonNullish(sessionId, SESSION_ID_UNDEFINED_MSG);\n\n const {\n title,\n location: {href},\n referrer\n } = document;\n const {innerWidth, innerHeight} = window;\n const {timeZone} = Intl.DateTimeFormat().resolvedOptions();\n\n const data: IdbPageView = {\n title,\n href,\n referrer: toNullable(nonNullish(referrer) && referrer !== '' ? referrer : undefined),\n device: {\n inner_width: innerWidth,\n inner_height: innerHeight\n },\n time_zone: timeZone,\n session_id: sessionId as string,\n ...userAgent(),\n ...timestamp()\n };\n\n const idb = await import('./idb.services');\n await idb.setPageView({\n key: nanoid(),\n view: data\n });\n};\n\nexport const trackPageView = async () => {\n assertNonNullish(worker, WORKER_UNDEFINED_MSG);\n\n await setPageView();\n\n worker?.postMessage({msg: 'junoTrackPageView'});\n};\n\nexport const trackEvent = async (data: TrackEvent) => {\n if (!isBrowser()) {\n return;\n }\n\n assertNonNullish(sessionId, SESSION_ID_UNDEFINED_MSG);\n assertNonNullish(worker, WORKER_UNDEFINED_MSG);\n\n const idb = await import('./idb.services');\n await idb.setTrackEvent({\n key: nanoid(),\n track: {...data, session_id: sessionId as string, ...userAgent(), ...timestamp()}\n });\n\n worker?.postMessage({msg: 'junoTrackEvent'});\n};\n\nexport const initWorkerEnvironment = (env: PostMessageInitEnvData) => {\n assertNonNullish(worker, WORKER_UNDEFINED_MSG);\n\n worker?.postMessage({msg: 'junoInitEnvironment', data: env});\n};\n\nexport const startTracking = () => {\n assertNonNullish(worker, WORKER_UNDEFINED_MSG);\n\n worker?.postMessage({msg: 'junoStartTrackTimer'});\n};\n\nexport const stopTracking = () => {\n assertNonNullish(worker, WORKER_UNDEFINED_MSG);\n\n worker?.postMessage({msg: 'junoStopTracker'});\n};\n", "import {\n initTrackPageViews,\n initWorker,\n setPageView,\n startTracking,\n stopTracking\n} from './services/analytics.services';\nimport type {Environment} from './types/env';\n\nexport {trackEvent, trackPageView} from './services/analytics.services';\nexport * from './types/env';\n\nexport const initOrbiter = async (env: Environment): Promise<() => void> => {\n // Save first page as soon as possible\n await setPageView();\n\n const {cleanup: workerCleanup} = initWorker(env);\n\n const {cleanup: pushHistoryCleanup} = initTrackPageViews();\n\n // Starting tracking will instantly sync the first page and the data from previous sessions that have not been synced yet\n startTracking();\n\n return () => {\n stopTracking();\n workerCle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MAAOC,GAA0C,CAE1E,MAAMC,EAAY,EAElB,GAAM,CAAC,QAASC,CAAa,EAAIC,EAAWH,CAAG,EAEzC,CAAC,QAASI,CAAkB,EAAIC,EAAmB,EAGzD,OAAAC,EAAc,EAEP,IAAM,CACXC,EAAa,EACbL,EAAc,EACdE,EAAmB,CACrB,CACF",
6
- "names": ["alphabet", "lookupTable", "i", "lookUpTable", "isNullish", "argument", "nonNullish", "NullishError", "assertNonNullish", "value", "message", "toNullable", "value", "nonNullish", "isBrowser", "nanoid", "size", "id", "byte", "nowInBigIntNanoSeconds", "timestamp", "nowInBigIntNanoSeconds", "userAgent", "g", "initSessionId", "nanoid", "sessionId", "worker", "initWorker", "env", "path", "workerUrl", "consoleWarn", "initWorkerEnvironment", "initTrackPageViews", "trackPages", "trackPageView", "pushStateProxy", "target", "thisArg", "argArray", "WORKER_UNDEFINED_MSG", "SESSION_ID_UNDEFINED_MSG", "setPageView", "h", "x", "title", "href", "referrer", "innerWidth", "innerHeight", "timeZone", "data", "g", "t", "userAgent", "timestamp", "trackEvent", "startTracking", "stopTracking", "initOrbiter", "env", "setPageView", "workerCleanup", "initWorker", "pushHistoryCleanup", "initTrackPageViews", "startTracking", "stopTracking"]
3
+ "sources": ["../../../../node_modules/@dfinity/principal/src/utils/base32.ts", "../../../../node_modules/@dfinity/principal/src/utils/getCrc.ts", "../../../utils/src/utils/debounce.utils.ts", "../../../utils/src/utils/json.utils.ts", "../../../utils/src/utils/null.utils.ts", "../../../utils/src/utils/did.utils.ts", "../../../utils/src/utils/env.utils.ts", "../../../../node_modules/nanoid/url-alphabet/index.js", "../../../../node_modules/nanoid/index.browser.js", "../../src/utils/date.utils.ts", "../../src/utils/analytics.utils.ts", "../../src/utils/log.utils.ts", "../../src/services/analytics.services.ts", "../../src/index.ts"],
4
+ "sourcesContent": ["const alphabet = 'abcdefghijklmnopqrstuvwxyz234567';\n\n// Build a lookup table for decoding.\nconst lookupTable: Record<string, number> = Object.create(null);\nfor (let i = 0; i < alphabet.length; i++) {\n lookupTable[alphabet[i]] = i;\n}\n\n// Add aliases for rfc4648.\nlookupTable['0'] = lookupTable.o;\nlookupTable['1'] = lookupTable.i;\n\n/**\n * @param input The input array to encode.\n * @returns A Base32 string encoding the input.\n */\nexport function encode(input: Uint8Array): string {\n // How many bits will we skip from the first byte.\n let skip = 0;\n // 5 high bits, carry from one byte to the next.\n let bits = 0;\n\n // The output string in base32.\n let output = '';\n\n function encodeByte(byte: number) {\n if (skip < 0) {\n // we have a carry from the previous byte\n bits |= byte >> -skip;\n } else {\n // no carry\n bits = (byte << skip) & 248;\n }\n\n if (skip > 3) {\n // Not enough data to produce a character, get us another one\n skip -= 8;\n return 1;\n }\n\n if (skip < 4) {\n // produce a character\n output += alphabet[bits >> 3];\n skip += 5;\n }\n\n return 0;\n }\n\n for (let i = 0; i < input.length; ) {\n i += encodeByte(input[i]);\n }\n\n return output + (skip < 0 ? alphabet[bits >> 3] : '');\n}\n\n/**\n * @param input The base32 encoded string to decode.\n */\nexport function decode(input: string): Uint8Array {\n // how many bits we have from the previous character.\n let skip = 0;\n // current byte we're producing.\n let byte = 0;\n\n const output = new Uint8Array(((input.length * 4) / 3) | 0);\n let o = 0;\n\n function decodeChar(char: string) {\n // Consume a character from the stream, store\n // the output in this.output. As before, better\n // to use update().\n let val = lookupTable[char.toLowerCase()];\n if (val === undefined) {\n throw new Error(`Invalid character: ${JSON.stringify(char)}`);\n }\n\n // move to the high bits\n val <<= 3;\n byte |= val >>> skip;\n skip += 5;\n\n if (skip >= 8) {\n // We have enough bytes to produce an output\n output[o++] = byte;\n skip -= 8;\n\n if (skip > 0) {\n byte = (val << (5 - skip)) & 255;\n } else {\n byte = 0;\n }\n }\n }\n\n for (const c of input) {\n decodeChar(c);\n }\n\n return output.slice(0, o);\n}\n", "// This file is translated to JavaScript from\n// https://lxp32.github.io/docs/a-simple-example-crc32-calculation/\nconst lookUpTable: Uint32Array = new Uint32Array([\n 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,\n 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,\n 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,\n 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,\n 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,\n 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,\n 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,\n 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,\n 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,\n 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,\n 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,\n 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,\n 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,\n 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,\n 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,\n 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,\n 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,\n 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,\n 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,\n 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,\n 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,\n 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,\n 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,\n 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,\n 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,\n 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,\n 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,\n 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,\n 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,\n 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,\n 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,\n 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,\n]);\n\n/**\n * Calculate the CRC32 of an ArrayBufferLike.\n * @param buf The BufferLike to calculate the CRC32 of.\n */\nexport function getCrc32(buf: ArrayBufferLike): number {\n const b = new Uint8Array(buf);\n let crc = -1;\n\n for (let i = 0; i < b.length; i++) {\n const byte = b[i];\n const t = (byte ^ crc) & 0xff;\n crc = lookUpTable[t] ^ (crc >>> 8);\n }\n\n return (crc ^ -1) >>> 0;\n}\n", "/* eslint-disable-next-line @typescript-eslint/ban-types */\nexport const debounce = (func: Function, timeout?: number) => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n return (...args: unknown[]) => {\n const next = () => func(...args);\n\n if (timer) {\n clearTimeout(timer);\n }\n\n timer = setTimeout(next, timeout !== undefined && timeout > 0 ? timeout : 300);\n };\n};\n", "import {Principal} from '@dfinity/principal';\nimport {nonNullish} from './null.utils';\n\nconst JSON_KEY_BIGINT = '__bigint__';\nconst JSON_KEY_PRINCIPAL = '__principal__';\nconst JSON_KEY_UINT8ARRAY = '__uint8array__';\n\n/**\n * A parser that interprets revived BigInt, Principal, and Uint8Array when constructing JavaScript values or objects.\n */\nexport const jsonReplacer = (_key: string, value: unknown): unknown => {\n if (typeof value === 'bigint') {\n return {[JSON_KEY_BIGINT]: `${value}`};\n }\n\n if (nonNullish(value) && value instanceof Principal) {\n return {[JSON_KEY_PRINCIPAL]: value.toText()};\n }\n\n if (nonNullish(value) && value instanceof Uint8Array) {\n return {[JSON_KEY_UINT8ARRAY]: Array.from(value)};\n }\n\n return value;\n};\n\n/**\n * A function that alters the behavior of the stringification process for BigInt, Principal and Uint8Array.\n */\nexport const jsonReviver = (_key: string, value: unknown): unknown => {\n const mapValue = <T>(key: string): T => (value as Record<string, T>)[key];\n\n if (nonNullish(value) && typeof value === 'object' && JSON_KEY_BIGINT in value) {\n return BigInt(mapValue(JSON_KEY_BIGINT));\n }\n\n if (nonNullish(value) && typeof value === 'object' && JSON_KEY_PRINCIPAL in value) {\n return Principal.fromText(mapValue(JSON_KEY_PRINCIPAL));\n }\n\n if (nonNullish(value) && typeof value === 'object' && JSON_KEY_UINT8ARRAY in value) {\n return Uint8Array.from(mapValue(JSON_KEY_UINT8ARRAY));\n }\n\n return value;\n};\n", "/** Is null or undefined */\nexport const isNullish = <T>(argument: T | undefined | null): argument is undefined | null =>\n argument === null || argument === undefined;\n\n/** Not null and not undefined */\nexport const nonNullish = <T>(argument: T | undefined | null): argument is NonNullable<T> =>\n !isNullish(argument);\n\nexport class NullishError extends Error {}\n\nexport const assertNonNullish: <T>(\n value: T,\n message?: string\n) => asserts value is NonNullable<T> = <T>(value: T, message?: string): void => {\n if (isNullish(value)) {\n throw new NullishError(message);\n }\n};\n", "import {jsonReplacer, jsonReviver} from './json.utils';\nimport {nonNullish} from './null.utils';\n\nexport const toNullable = <T>(value?: T): [] | [T] => {\n return nonNullish(value) ? [value] : [];\n};\n\nexport const fromNullable = <T>(value: [] | [T]): T | undefined => {\n return value?.[0];\n};\n\nexport const toArray = async <T>(data: T): Promise<Uint8Array> => {\n const blob: Blob = new Blob([JSON.stringify(data, jsonReplacer)], {\n type: 'application/json; charset=utf-8'\n });\n return new Uint8Array(await blob.arrayBuffer());\n};\n\nexport const fromArray = async <T>(data: Uint8Array | number[]): Promise<T> => {\n const blob: Blob = new Blob([data instanceof Uint8Array ? data : new Uint8Array(data)], {\n type: 'application/json; charset=utf-8'\n });\n return JSON.parse(await blob.text(), jsonReviver);\n};\n", "export const isBrowser = () => typeof window !== `undefined`;\n", "export const urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\n", "import { urlAlphabet as scopedUrlAlphabet } from './url-alphabet/index.js'\nexport { urlAlphabet } from './url-alphabet/index.js'\nexport let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nexport let customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length === size) return id\n }\n }\n }\n}\nexport let customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size, random)\nexport let nanoid = (size = 21) => {\n let id = ''\n let bytes = crypto.getRandomValues(new Uint8Array(size))\n while (size--) {\n id += scopedUrlAlphabet[bytes[size] & 63]\n }\n return id\n}\n", "export const nowInBigIntNanoSeconds = (): bigint => BigInt(Date.now()) * BigInt(1e6);\n", "import {toNullable} from '@junobuild/utils';\nimport {nowInBigIntNanoSeconds} from './date.utils';\n\nexport const timestamp = (): {\n collected_at: bigint;\n updated_at: [] | [bigint];\n version: [] | [bigint];\n} => ({\n collected_at: nowInBigIntNanoSeconds(),\n updated_at: [],\n version: []\n});\n\nexport const userAgent = (): {user_agent: [] | [string]} => {\n const {userAgent} = navigator;\n return {user_agent: toNullable(userAgent)};\n};\n", "import {isNullish} from '@junobuild/utils';\n\nconst WORKER_UNDEFINED_MSG =\n 'Analytics worker not initialized. Did you call `initOrbiter`?' as const;\n\nexport const warningWorkerNotInitialized = <T>(value: T) => {\n if (isNullish(value)) {\n console.warn(WORKER_UNDEFINED_MSG);\n }\n};\n", "import {assertNonNullish, isBrowser, nonNullish, toNullable} from '@junobuild/utils';\nimport {nanoid} from 'nanoid';\nimport type {Environment, EnvironmentWorker} from '../types/env';\nimport type {IdbPageView} from '../types/idb';\nimport type {PostMessageInitEnvData} from '../types/post-message';\nimport type {TrackEvent} from '../types/track';\nimport {timestamp, userAgent} from '../utils/analytics.utils';\nimport {warningWorkerNotInitialized} from '../utils/log.utils';\n\nconst initSessionId = (): string | undefined => {\n // I faced this issue when I used the library in Docusaurus which does not implement the crypto API when server-side rendering.\n // https://github.com/ai/nanoid/issues?q=crypto+not+defined\n if (typeof crypto === 'undefined') {\n return undefined;\n }\n\n return nanoid();\n};\n\nconst sessionId = initSessionId();\n\nlet worker: Worker | undefined;\n\nexport const initWorker = (env: Environment): {cleanup: () => void} => {\n const {path}: EnvironmentWorker = env.worker ?? {};\n const workerUrl = path === undefined ? './workers/analytics.worker.js' : path;\n\n worker = new Worker(workerUrl);\n\n const consoleWarn = () =>\n console.warn('Unable to connect to the analytics web worker. Have you deployed it?');\n\n worker?.addEventListener('error', consoleWarn, false);\n\n initWorkerEnvironment(env);\n\n return {\n cleanup() {\n worker?.removeEventListener('error', consoleWarn, false);\n }\n };\n};\n\nexport const initTrackPageViews = (): {cleanup: () => void} => {\n const trackPages = async () => await trackPageView();\n\n let pushStateProxy: typeof history.pushState | null = new Proxy(history.pushState, {\n apply: async (\n target,\n thisArg,\n argArray: [data: unknown, unused: string, url?: string | URL | null | undefined]\n ) => {\n target.apply(thisArg, argArray);\n await trackPages();\n }\n });\n\n history.pushState = pushStateProxy;\n\n addEventListener('popstate', trackPages, {passive: true});\n\n return {\n cleanup() {\n pushStateProxy = null;\n removeEventListener('popstate', trackPages, false);\n }\n };\n};\n\nconst SESSION_ID_UNDEFINED_MSG = 'No session ID initialized.' as const;\n\nexport const setPageView = async () => {\n if (!isBrowser()) {\n return;\n }\n\n assertNonNullish(sessionId, SESSION_ID_UNDEFINED_MSG);\n\n const {\n title,\n location: {href},\n referrer\n } = document;\n const {innerWidth, innerHeight} = window;\n const {timeZone} = Intl.DateTimeFormat().resolvedOptions();\n\n const data: IdbPageView = {\n title,\n href,\n referrer: toNullable(nonNullish(referrer) && referrer !== '' ? referrer : undefined),\n device: {\n inner_width: innerWidth,\n inner_height: innerHeight\n },\n time_zone: timeZone,\n session_id: sessionId as string,\n ...userAgent(),\n ...timestamp()\n };\n\n const idb = await import('./idb.services');\n await idb.setPageView({\n key: nanoid(),\n view: data\n });\n};\n\nexport const trackPageView = async () => {\n warningWorkerNotInitialized(worker);\n\n await setPageView();\n\n worker?.postMessage({msg: 'junoTrackPageView'});\n};\n\nexport const trackEvent = async (data: TrackEvent) => {\n if (!isBrowser()) {\n return;\n }\n\n assertNonNullish(sessionId, SESSION_ID_UNDEFINED_MSG);\n warningWorkerNotInitialized(worker);\n\n const idb = await import('./idb.services');\n await idb.setTrackEvent({\n key: nanoid(),\n track: {...data, session_id: sessionId as string, ...userAgent(), ...timestamp()}\n });\n\n worker?.postMessage({msg: 'junoTrackEvent'});\n};\n\nexport const initWorkerEnvironment = (env: PostMessageInitEnvData) => {\n warningWorkerNotInitialized(worker);\n\n worker?.postMessage({msg: 'junoInitEnvironment', data: env});\n};\n\nexport const startTracking = () => {\n warningWorkerNotInitialized(worker);\n\n worker?.postMessage({msg: 'junoStartTrackTimer'});\n};\n\nexport const stopTracking = () => {\n warningWorkerNotInitialized(worker);\n\n worker?.postMessage({msg: 'junoStopTracker'});\n};\n", "import {\n initTrackPageViews,\n initWorker,\n setPageView,\n startTracking,\n stopTracking\n} from './services/analytics.services';\nimport type {Environment} from './types/env';\n\nexport {trackEvent, trackPageView} from './services/analytics.services';\nexport * from './types/env';\n\nexport const initOrbiter = async (env: Environment): Promise<() => void> => {\n // Save first page as soon as possible\n await setPageView();\n\n const {cleanup: workerCleanup} = initWorker(env);\n\n const {cleanup: pushHistoryCleanup} = initTrackPageViews();\n\n // Starting tracking will instantly sync the first page and the data from previous sessions that have not been synced yet\n startTracking();\n\n return () => {\n stopTracking();\n workerCleanup();\n pushHistoryCleanup();\n };\n};\n"],
5
+ "mappings": "AAAA,IAAMA,EAAW,mCAGXC,EAAsC,OAAO,OAAO,IAAI,EAC9D,QAASC,EAAI,EAAGA,EAAIF,EAAS,OAAQE,IACnCD,EAAYD,EAASE,CAAC,CAAC,EAAIA,EAI7BD,EAAY,CAAG,EAAIA,EAAY,EAC/BA,EAAY,CAAG,EAAIA,EAAY,ECR/B,IAAME,EAA2B,IAAI,YAAY,CAC/C,EAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WAAY,WACpF,UAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WAAY,WACpF,UAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WAAY,WACpF,UAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WAAY,WACpF,UAAY,WAAY,WAAY,WAAY,WAAY,WAAY,WAAY,WACpF,UAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WAAY,WACpF,UAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WAAY,WACpF,UAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WAAY,WACpF,WAAY,SAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WACpF,WAAY,UAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WACpF,WAAY,UAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WACpF,WAAY,UAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WACpF,WAAY,UAAY,WAAY,WAAY,WAAY,WAAY,WAAY,WACpF,WAAY,UAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WACpF,WAAY,UAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WACpF,WAAY,UAAY,WAAY,WAAY,WAAY,UAAY,WAAY,WACpF,WAAY,WAAY,SAAY,WAAY,WAAY,WAAY,SAAY,WACpF,WAAY,WAAY,UAAY,WAAY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AElCA,GAAQ,YAAY,CAAC,IAAK,iBAAiB,CAAC,CAC9C,ECxIO,IAAMiC,GAAc,MAAOC,GAA0C,CAE1E,MAAMC,EAAY,EAElB,GAAM,CAAC,QAASC,CAAa,EAAIC,EAAWH,CAAG,EAEzC,CAAC,QAASI,CAAkB,EAAIC,EAAmB,EAGzD,OAAAC,EAAc,EAEP,IAAM,CACXC,EAAa,EACbL,EAAc,EACdE,EAAmB,CACrB,CACF",
6
+ "names": ["alphabet", "lookupTable", "i", "lookUpTable", "isNullish", "argument", "nonNullish", "NullishError", "assertNonNullish", "value", "message", "toNullable", "value", "nonNullish", "isBrowser", "urlAlphabet", "nanoid", "size", "id", "bytes", "urlAlphabet", "nowInBigIntNanoSeconds", "timestamp", "nowInBigIntNanoSeconds", "userAgent", "g", "WORKER_UNDEFINED_MSG", "warningWorkerNotInitialized", "value", "c", "initSessionId", "nanoid", "sessionId", "worker", "initWorker", "env", "path", "workerUrl", "consoleWarn", "initWorkerEnvironment", "initTrackPageViews", "trackPages", "trackPageView", "pushStateProxy", "target", "thisArg", "argArray", "SESSION_ID_UNDEFINED_MSG", "setPageView", "h", "x", "title", "href", "referrer", "innerWidth", "innerHeight", "timeZone", "data", "g", "t", "userAgent", "timestamp", "warningWorkerNotInitialized", "trackEvent", "startTracking", "stopTracking", "initOrbiter", "env", "setPageView", "workerCleanup", "initWorker", "pushHistoryCleanup", "initTrackPageViews", "startTracking", "stopTracking"]
7
7
  }
@@ -51,7 +51,7 @@ export interface Controller {
51
51
  }
52
52
  export type ControllerScope = {Write: null} | {Admin: null};
53
53
  export interface DelSatelliteConfig {
54
- updated_at: [] | [bigint];
54
+ version: [] | [bigint];
55
55
  }
56
56
  export interface DeleteControllersArgs {
57
57
  controllers: Array<Principal>;
@@ -72,6 +72,7 @@ export interface MemorySize {
72
72
  export interface OrbiterSatelliteConfig {
73
73
  updated_at: bigint;
74
74
  created_at: bigint;
75
+ version: [] | [bigint];
75
76
  enabled: boolean;
76
77
  }
77
78
  export interface PageView {
@@ -84,6 +85,7 @@ export interface PageView {
84
85
  created_at: bigint;
85
86
  satellite_id: Principal;
86
87
  device: PageViewDevice;
88
+ version: [] | [bigint];
87
89
  user_agent: [] | [string];
88
90
  }
89
91
  export interface PageViewDevice {
@@ -111,10 +113,11 @@ export interface SetPageView {
111
113
  href: string;
112
114
  satellite_id: Principal;
113
115
  device: PageViewDevice;
116
+ version: [] | [bigint];
114
117
  user_agent: [] | [string];
115
118
  }
116
119
  export interface SetSatelliteConfig {
117
- updated_at: [] | [bigint];
120
+ version: [] | [bigint];
118
121
  enabled: boolean;
119
122
  }
120
123
  export interface SetTrackEvent {
@@ -123,6 +126,7 @@ export interface SetTrackEvent {
123
126
  metadata: [] | [Array<[string, string]>];
124
127
  name: string;
125
128
  satellite_id: Principal;
129
+ version: [] | [bigint];
126
130
  user_agent: [] | [string];
127
131
  }
128
132
  export interface TrackEvent {
@@ -132,6 +136,7 @@ export interface TrackEvent {
132
136
  name: string;
133
137
  created_at: bigint;
134
138
  satellite_id: Principal;
139
+ version: [] | [bigint];
135
140
  }
136
141
  export interface _SERVICE {
137
142
  del_controllers: ActorMethod<[DeleteControllersArgs], Array<[Principal, Controller]>>;
@@ -14,7 +14,7 @@ export const idlFactory = ({IDL}) => {
14
14
  scope: ControllerScope,
15
15
  expires_at: IDL.Opt(IDL.Nat64)
16
16
  });
17
- const DelSatelliteConfig = IDL.Record({updated_at: IDL.Opt(IDL.Nat64)});
17
+ const DelSatelliteConfig = IDL.Record({version: IDL.Opt(IDL.Nat64)});
18
18
  const DepositCyclesArgs = IDL.Record({
19
19
  cycles: IDL.Nat,
20
20
  destination_id: IDL.Principal
@@ -42,6 +42,7 @@ export const idlFactory = ({IDL}) => {
42
42
  created_at: IDL.Nat64,
43
43
  satellite_id: IDL.Principal,
44
44
  device: PageViewDevice,
45
+ version: IDL.Opt(IDL.Nat64),
45
46
  user_agent: IDL.Opt(IDL.Text)
46
47
  });
47
48
  const AnalyticsBrowsersPageViews = IDL.Record({
@@ -83,7 +84,8 @@ export const idlFactory = ({IDL}) => {
83
84
  metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
84
85
  name: IDL.Text,
85
86
  created_at: IDL.Nat64,
86
- satellite_id: IDL.Principal
87
+ satellite_id: IDL.Principal,
88
+ version: IDL.Opt(IDL.Nat64)
87
89
  });
88
90
  const AnalyticsTrackEvents = IDL.Record({
89
91
  total: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32))
@@ -91,6 +93,7 @@ export const idlFactory = ({IDL}) => {
91
93
  const OrbiterSatelliteConfig = IDL.Record({
92
94
  updated_at: IDL.Nat64,
93
95
  created_at: IDL.Nat64,
96
+ version: IDL.Opt(IDL.Nat64),
94
97
  enabled: IDL.Bool
95
98
  });
96
99
  const MemorySize = IDL.Record({stable: IDL.Nat64, heap: IDL.Nat64});
@@ -112,6 +115,7 @@ export const idlFactory = ({IDL}) => {
112
115
  href: IDL.Text,
113
116
  satellite_id: IDL.Principal,
114
117
  device: PageViewDevice,
118
+ version: IDL.Opt(IDL.Nat64),
115
119
  user_agent: IDL.Opt(IDL.Text)
116
120
  });
117
121
  const Result = IDL.Variant({Ok: PageView, Err: IDL.Text});
@@ -120,7 +124,7 @@ export const idlFactory = ({IDL}) => {
120
124
  Err: IDL.Vec(IDL.Tuple(AnalyticKey, IDL.Text))
121
125
  });
122
126
  const SetSatelliteConfig = IDL.Record({
123
- updated_at: IDL.Opt(IDL.Nat64),
127
+ version: IDL.Opt(IDL.Nat64),
124
128
  enabled: IDL.Bool
125
129
  });
126
130
  const SetTrackEvent = IDL.Record({
@@ -129,6 +133,7 @@ export const idlFactory = ({IDL}) => {
129
133
  metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
130
134
  name: IDL.Text,
131
135
  satellite_id: IDL.Principal,
136
+ version: IDL.Opt(IDL.Nat64),
132
137
  user_agent: IDL.Opt(IDL.Text)
133
138
  });
134
139
  const Result_2 = IDL.Variant({Ok: TrackEvent, Err: IDL.Text});
@@ -14,7 +14,7 @@ export const idlFactory = ({IDL}) => {
14
14
  scope: ControllerScope,
15
15
  expires_at: IDL.Opt(IDL.Nat64)
16
16
  });
17
- const DelSatelliteConfig = IDL.Record({updated_at: IDL.Opt(IDL.Nat64)});
17
+ const DelSatelliteConfig = IDL.Record({version: IDL.Opt(IDL.Nat64)});
18
18
  const DepositCyclesArgs = IDL.Record({
19
19
  cycles: IDL.Nat,
20
20
  destination_id: IDL.Principal
@@ -42,6 +42,7 @@ export const idlFactory = ({IDL}) => {
42
42
  created_at: IDL.Nat64,
43
43
  satellite_id: IDL.Principal,
44
44
  device: PageViewDevice,
45
+ version: IDL.Opt(IDL.Nat64),
45
46
  user_agent: IDL.Opt(IDL.Text)
46
47
  });
47
48
  const AnalyticsBrowsersPageViews = IDL.Record({
@@ -83,7 +84,8 @@ export const idlFactory = ({IDL}) => {
83
84
  metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
84
85
  name: IDL.Text,
85
86
  created_at: IDL.Nat64,
86
- satellite_id: IDL.Principal
87
+ satellite_id: IDL.Principal,
88
+ version: IDL.Opt(IDL.Nat64)
87
89
  });
88
90
  const AnalyticsTrackEvents = IDL.Record({
89
91
  total: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32))
@@ -91,6 +93,7 @@ export const idlFactory = ({IDL}) => {
91
93
  const OrbiterSatelliteConfig = IDL.Record({
92
94
  updated_at: IDL.Nat64,
93
95
  created_at: IDL.Nat64,
96
+ version: IDL.Opt(IDL.Nat64),
94
97
  enabled: IDL.Bool
95
98
  });
96
99
  const MemorySize = IDL.Record({stable: IDL.Nat64, heap: IDL.Nat64});
@@ -112,6 +115,7 @@ export const idlFactory = ({IDL}) => {
112
115
  href: IDL.Text,
113
116
  satellite_id: IDL.Principal,
114
117
  device: PageViewDevice,
118
+ version: IDL.Opt(IDL.Nat64),
115
119
  user_agent: IDL.Opt(IDL.Text)
116
120
  });
117
121
  const Result = IDL.Variant({Ok: PageView, Err: IDL.Text});
@@ -120,7 +124,7 @@ export const idlFactory = ({IDL}) => {
120
124
  Err: IDL.Vec(IDL.Tuple(AnalyticKey, IDL.Text))
121
125
  });
122
126
  const SetSatelliteConfig = IDL.Record({
123
- updated_at: IDL.Opt(IDL.Nat64),
127
+ version: IDL.Opt(IDL.Nat64),
124
128
  enabled: IDL.Bool
125
129
  });
126
130
  const SetTrackEvent = IDL.Record({
@@ -129,6 +133,7 @@ export const idlFactory = ({IDL}) => {
129
133
  metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
130
134
  name: IDL.Text,
131
135
  satellite_id: IDL.Principal,
136
+ version: IDL.Opt(IDL.Nat64),
132
137
  user_agent: IDL.Opt(IDL.Text)
133
138
  });
134
139
  const Result_2 = IDL.Variant({Ok: TrackEvent, Err: IDL.Text});
@@ -1,6 +1,6 @@
1
1
  import { createRequire as topLevelCreateRequire } from 'module';
2
2
  const require = topLevelCreateRequire(import.meta.url);
3
- var Je=Object.create;var G=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var Ye=Object.getOwnPropertyNames;var Xe=Object.getPrototypeOf,ze=Object.prototype.hasOwnProperty;var Ze=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var we=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Qe=(e,t)=>{for(var r in t)G(e,r,{get:t[r],enumerable:!0})},et=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ye(t))!ze.call(e,o)&&o!==r&&G(e,o,{get:()=>t[o],enumerable:!(n=$e(t,o))||n.enumerable});return e};var tt=(e,t,r)=>(r=e!=null?Je(Xe(e)):{},et(t||!e||!e.__esModule?G(r,"default",{value:e,enumerable:!0}):r,e));var me=h(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.decode=I.encode=void 0;var L="abcdefghijklmnopqrstuvwxyz234567",k=Object.create(null);for(let e=0;e<L.length;e++)k[L[e]]=e;k[0]=k.o;k[1]=k.i;function rt(e){let t=0,r=0,n="";function o(s){return t<0?r|=s>>-t:r=s<<t&248,t>3?(t-=8,1):(t<4&&(n+=L[r>>3],t+=5),0)}for(let s=0;s<e.length;)s+=o(e[s]);return n+(t<0?L[r>>3]:"")}I.encode=rt;function nt(e){let t=0,r=0,n=new Uint8Array(e.length*4/3|0),o=0;function s(a){let c=k[a.toLowerCase()];if(c===void 0)throw new Error(`Invalid character: ${JSON.stringify(a)}`);c<<=3,r|=c>>>t,t+=5,t>=8&&(n[o++]=r,t-=8,t>0?r=c<<5-t&255:r=0)}for(let a of e)s(a);return n.slice(0,o)}I.decode=nt});var _e=h(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.getCrc32=void 0;var ot=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function st(e){let t=new Uint8Array(e),r=-1;for(let n=0;n<t.length;n++){let s=(t[n]^r)&255;r=ot[s]^r>>>8}return(r^-1)>>>0}j.getCrc32=st});var $=h(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.output=u.exists=u.hash=u.bytes=u.bool=u.number=u.isBytes=void 0;function N(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}u.number=N;function ve(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}u.bool=ve;function Ae(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}u.isBytes=Ae;function J(e,...t){if(!Ae(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}u.bytes=J;function Ee(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");N(e.outputLen),N(e.blockLen)}u.hash=Ee;function ke(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}u.exists=ke;function Ie(e,t){J(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}u.output=Ie;var it={number:N,bool:ve,bytes:J,hash:Ee,exists:ke,output:Ie};u.default=it});var Pe=h(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.crypto=void 0;var C=Ze("node:crypto");M.crypto=C&&typeof C=="object"&&"webcrypto"in C?C.webcrypto:void 0});var Z=h(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.randomBytes=i.wrapXOFConstructorWithOpts=i.wrapConstructorWithOpts=i.wrapConstructor=i.checkOpts=i.Hash=i.concatBytes=i.toBytes=i.utf8ToBytes=i.asyncLoop=i.nextTick=i.hexToBytes=i.bytesToHex=i.byteSwap32=i.byteSwapIfBE=i.byteSwap=i.isLE=i.rotl=i.rotr=i.createView=i.u32=i.u8=i.isBytes=void 0;var Y=Pe(),z=$();function at(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}i.isBytes=at;var ct=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);i.u8=ct;var ft=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));i.u32=ft;var dt=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);i.createView=dt;var ut=(e,t)=>e<<32-t|e>>>t;i.rotr=ut;var xt=(e,t)=>e<<t|e>>>32-t>>>0;i.rotl=xt;i.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;var lt=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;i.byteSwap=lt;i.byteSwapIfBE=i.isLE?e=>e:e=>(0,i.byteSwap)(e);function bt(e){for(let t=0;t<e.length;t++)e[t]=(0,i.byteSwap)(e[t])}i.byteSwap32=bt;var pt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ht(e){(0,z.bytes)(e);let t="";for(let r=0;r<e.length;r++)t+=pt[e[r]];return t}i.bytesToHex=ht;var y={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Te(e){if(e>=y._0&&e<=y._9)return e-y._0;if(e>=y._A&&e<=y._F)return e-(y._A-10);if(e>=y._a&&e<=y._f)return e-(y._a-10)}function yt(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let o=0,s=0;o<r;o++,s+=2){let a=Te(e.charCodeAt(s)),c=Te(e.charCodeAt(s+1));if(a===void 0||c===void 0){let d=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+d+'" at index '+s)}n[o]=a*16+c}return n}i.hexToBytes=yt;var gt=async()=>{};i.nextTick=gt;async function wt(e,t,r){let n=Date.now();for(let o=0;o<e;o++){r(o);let s=Date.now()-n;s>=0&&s<t||(await(0,i.nextTick)(),n+=s)}}i.asyncLoop=wt;function Se(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}i.utf8ToBytes=Se;function V(e){return typeof e=="string"&&(e=Se(e)),(0,z.bytes)(e),e}i.toBytes=V;function mt(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];(0,z.bytes)(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let s=e[n];r.set(s,o),o+=s.length}return r}i.concatBytes=mt;var X=class{clone(){return this._cloneInto()}};i.Hash=X;var _t={}.toString;function vt(e,t){if(t!==void 0&&_t.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(e,t)}i.checkOpts=vt;function At(e){let t=n=>e().update(V(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}i.wrapConstructor=At;function Et(e){let t=(n,o)=>e(o).update(V(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}i.wrapConstructorWithOpts=Et;function kt(e){let t=(n,o)=>e(o).update(V(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}i.wrapXOFConstructorWithOpts=kt;function It(e=32){if(Y.crypto&&typeof Y.crypto.getRandomValues=="function")return Y.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}i.randomBytes=It});var Be=h(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.HashMD=w.Maj=w.Chi=void 0;var Q=$(),U=Z();function Pt(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let o=BigInt(32),s=BigInt(4294967295),a=Number(r>>o&s),c=Number(r&s),d=n?4:0,b=n?0:4;e.setUint32(t+d,a,n),e.setUint32(t+b,c,n)}var Tt=(e,t,r)=>e&t^~e&r;w.Chi=Tt;var St=(e,t,r)=>e&t^e&r^t&r;w.Maj=St;var ee=class extends U.Hash{constructor(t,r,n,o){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,U.createView)(this.buffer)}update(t){(0,Q.exists)(this);let{view:r,buffer:n,blockLen:o}=this;t=(0,U.toBytes)(t);let s=t.length;for(let a=0;a<s;){let c=Math.min(o-this.pos,s-a);if(c===o){let d=(0,U.createView)(t);for(;o<=s-a;a+=o)this.process(d,a);continue}n.set(t.subarray(a,a+c),this.pos),this.pos+=c,a+=c,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,Q.exists)(this),(0,Q.output)(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:s}=this,{pos:a}=this;r[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let f=a;f<o;f++)r[f]=0;Pt(n,o-8,BigInt(this.length*8),s),this.process(n,0);let c=(0,U.createView)(t),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let b=d/4,g=this.get();if(b>g.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<b;f++)c.setUint32(4*f,g[f],s)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:n,length:o,finished:s,destroyed:a,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=a,o%r&&t.buffer.set(n),t}};w.HashMD=ee});var Ue=h(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.sha224=P.sha256=void 0;var te=Be(),l=Z(),Bt=new Uint32Array([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]),m=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),_=new Uint32Array(64),D=class extends te.HashMD{constructor(){super(64,32,8,!1),this.A=m[0]|0,this.B=m[1]|0,this.C=m[2]|0,this.D=m[3]|0,this.E=m[4]|0,this.F=m[5]|0,this.G=m[6]|0,this.H=m[7]|0}get(){let{A:t,B:r,C:n,D:o,E:s,F:a,G:c,H:d}=this;return[t,r,n,o,s,a,c,d]}set(t,r,n,o,s,a,c,d){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=a|0,this.G=c|0,this.H=d|0}process(t,r){for(let f=0;f<16;f++,r+=4)_[f]=t.getUint32(r,!1);for(let f=16;f<64;f++){let B=_[f-15],E=_[f-2],ge=(0,l.rotr)(B,7)^(0,l.rotr)(B,18)^B>>>3,q=(0,l.rotr)(E,17)^(0,l.rotr)(E,19)^E>>>10;_[f]=q+_[f-7]+ge+_[f-16]|0}let{A:n,B:o,C:s,D:a,E:c,F:d,G:b,H:g}=this;for(let f=0;f<64;f++){let B=(0,l.rotr)(c,6)^(0,l.rotr)(c,11)^(0,l.rotr)(c,25),E=g+B+(0,te.Chi)(c,d,b)+Bt[f]+_[f]|0,q=((0,l.rotr)(n,2)^(0,l.rotr)(n,13)^(0,l.rotr)(n,22))+(0,te.Maj)(n,o,s)|0;g=b,b=d,d=c,c=a+E|0,a=s,s=o,o=n,n=E+q|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,a=a+this.D|0,c=c+this.E|0,d=d+this.F|0,b=b+this.G|0,g=g+this.H|0,this.set(n,o,s,a,c,d,b,g)}roundClean(){_.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},re=class extends D{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};P.sha256=(0,l.wrapConstructor)(()=>new D);P.sha224=(0,l.wrapConstructor)(()=>new re)});var Oe=h(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.sha224=void 0;var Ut=Ue();function Ot(e){return Ut.sha224.create().update(new Uint8Array(e)).digest()}H.sha224=Ot});var Ne=h(p=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});p.Principal=p.JSON_KEY_PRINCIPAL=void 0;var Le=me(),Lt=_e(),jt=Oe();p.JSON_KEY_PRINCIPAL="__principal__";var Nt=2,je=4,Ct="aaaaa-aa",Mt=e=>{var t;return new Uint8Array(((t=e.match(/.{1,2}/g))!==null&&t!==void 0?t:[]).map(r=>parseInt(r,16)))},Vt=e=>e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),""),ne=class e{constructor(t){this._arr=t,this._isPrincipal=!0}static anonymous(){return new this(new Uint8Array([je]))}static managementCanister(){return this.fromHex(Ct)}static selfAuthenticating(t){let r=(0,jt.sha224)(t);return new this(new Uint8Array([...r,Nt]))}static from(t){if(typeof t=="string")return e.fromText(t);if(Object.getPrototypeOf(t)===Uint8Array.prototype)return new e(t);if(typeof t=="object"&&t!==null&&t._isPrincipal===!0)return new e(t._arr);throw new Error(`Impossible to convert ${JSON.stringify(t)} to Principal.`)}static fromHex(t){return new this(Mt(t))}static fromText(t){let r=t;if(t.includes(p.JSON_KEY_PRINCIPAL)){let a=JSON.parse(t);p.JSON_KEY_PRINCIPAL in a&&(r=a[p.JSON_KEY_PRINCIPAL])}let n=r.toLowerCase().replace(/-/g,""),o=(0,Le.decode)(n);o=o.slice(4,o.length);let s=new this(o);if(s.toText()!==r)throw new Error(`Principal "${s.toText()}" does not have a valid checksum (original value "${r}" may not be a valid Principal ID).`);return s}static fromUint8Array(t){return new this(t)}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===je}toUint8Array(){return this._arr}toHex(){return Vt(this._arr).toUpperCase()}toText(){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,(0,Lt.getCrc32)(this._arr));let n=new Uint8Array(t),o=Uint8Array.from(this._arr),s=new Uint8Array([...n,...o]),c=(0,Le.encode)(s).match(/.{1,5}/g);if(!c)throw new Error;return c.join("-")}toString(){return this.toText()}toJSON(){return{[p.JSON_KEY_PRINCIPAL]:this.toText()}}compareTo(t){for(let r=0;r<Math.min(this._arr.length,t._arr.length);r++){if(this._arr[r]<t._arr[r])return"lt";if(this._arr[r]>t._arr[r])return"gt"}return this._arr.length<t._arr.length?"lt":this._arr.length>t._arr.length?"gt":"eq"}ltEq(t){let r=this.compareTo(t);return r=="lt"||r=="eq"}gtEq(t){let r=this.compareTo(t);return r=="gt"||r=="eq"}};p.Principal=ne});function S(e){return new Promise((t,r)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>r(e.error)})}function K(e,t){let r=indexedDB.open(e);r.onupgradeneeded=()=>r.result.createObjectStore(t);let n=S(r);return(o,s)=>n.then(a=>s(a.transaction(t,o).objectStore(t)))}function fe(){return ce||(ce=K("keyval-store","keyval")),ce}function de(e,t,r=fe()){return r("readwrite",n=>(n.put(t,e),S(n.transaction)))}function ue(e,t=fe()){return t("readwrite",r=>(e.forEach(n=>r.delete(n)),S(r.transaction)))}function Kt(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},S(e.transaction)}function xe(e=fe()){return e("readonly",t=>{if(t.getAll&&t.getAllKeys)return Promise.all([S(t.getAllKeys()),S(t.getAll())]).then(([n,o])=>n.map((s,a)=>[s,o[a]]));let r=[];return e("readonly",n=>Kt(n,o=>r.push([o.key,o.value])).then(()=>r))})}var ce,He=we(()=>{});var pe={};Qe(pe,{delPageViews:()=>Gt,delTrackEvents:()=>Yt,getPageViews:()=>qt,getTrackEvents:()=>$t,setPageView:()=>Wt,setTrackEvent:()=>Jt});var le,be,Wt,qt,Gt,Jt,$t,Yt,he=we(()=>{"use strict";He();le=K("juno-views","views"),be=K("juno-events","events"),Wt=({key:e,view:t})=>de(e,t,le),qt=()=>xe(le),Gt=e=>ue(e,le),Jt=({key:e,track:t})=>de(e,t,be),$t=()=>xe(be),Yt=e=>ue(e,be)});var Dt=tt(Ne(),1);var Ce=e=>e==null,oe=e=>!Ce(e),Ht=class extends Error{},v=(e,t)=>{if(Ce(e))throw new Ht(t)};var F=e=>oe(e)?[e]:[];var se=()=>typeof window<"u";import{randomFillSync as Ve}from"crypto";var Me="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ft=128,A,T,Rt=e=>{!A||A.length<e?(A=Buffer.allocUnsafe(e*Ft),Ve(A),T=0):T+e>A.length&&(Ve(A),T=0),T+=e};var R=(e=21)=>{Rt(e-=0);let t="";for(let r=T-e;r<T;r++)t+=Me[A[r]&63];return t};var De=()=>BigInt(Date.now())*BigInt(1e6);var ie=()=>({collected_at:De(),updated_at:[]}),ae=()=>{let{userAgent:e}=navigator;return{user_agent:F(e)}};var Xt=()=>{if(!(typeof crypto>"u"))return R()},W=Xt(),x,Fe=e=>{let{path:t}=e.worker??{},r=t===void 0?"./workers/analytics.worker.js":t;x=new Worker(r);let n=()=>console.warn("Unable to connect to the analytics web worker. Have you deployed it?");return x?.addEventListener("error",n,!1),Zt(e),{cleanup(){x?.removeEventListener("error",n,!1)}}},Re=()=>{let e=async()=>await We(),t=new Proxy(history.pushState,{apply:async(r,n,o)=>{r.apply(n,o),await e()}});return history.pushState=t,addEventListener("popstate",e,{passive:!0}),{cleanup(){t=null,removeEventListener("popstate",e,!1)}}},O="Analytics worker not initialized. Did you call `initOrbiter`?",Ke="No session ID initialized.",ye=async()=>{if(!se())return;v(W,Ke);let{title:e,location:{href:t},referrer:r}=document,{innerWidth:n,innerHeight:o}=window,{timeZone:s}=Intl.DateTimeFormat().resolvedOptions(),a={title:e,href:t,referrer:F(oe(r)&&r!==""?r:void 0),device:{inner_width:n,inner_height:o},time_zone:s,session_id:W,...ae(),...ie()};await(await Promise.resolve().then(()=>(he(),pe))).setPageView({key:R(),view:a})},We=async()=>{v(x,O),await ye(),x?.postMessage({msg:"junoTrackPageView"})},zt=async e=>{if(!se())return;v(W,Ke),v(x,O),await(await Promise.resolve().then(()=>(he(),pe))).setTrackEvent({key:R(),track:{...e,session_id:W,...ae(),...ie()}}),x?.postMessage({msg:"junoTrackEvent"})},Zt=e=>{v(x,O),x?.postMessage({msg:"junoInitEnvironment",data:e})},qe=()=>{v(x,O),x?.postMessage({msg:"junoStartTrackTimer"})},Ge=()=>{v(x,O),x?.postMessage({msg:"junoStopTracker"})};var Ir=async e=>{await ye();let{cleanup:t}=Fe(e),{cleanup:r}=Re();return qe(),()=>{Ge(),t(),r()}};export{Ir as initOrbiter,zt as trackEvent,We as trackPageView};
3
+ var Je=Object.create;var G=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var Ye=Object.getOwnPropertyNames;var Xe=Object.getPrototypeOf,ze=Object.prototype.hasOwnProperty;var Ze=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var me=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Qe=(e,t)=>{for(var r in t)G(e,r,{get:t[r],enumerable:!0})},et=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ye(t))!ze.call(e,o)&&o!==r&&G(e,o,{get:()=>t[o],enumerable:!(n=$e(t,o))||n.enumerable});return e};var tt=(e,t,r)=>(r=e!=null?Je(Xe(e)):{},et(t||!e||!e.__esModule?G(r,"default",{value:e,enumerable:!0}):r,e));var _e=h(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.decode=k.encode=void 0;var O="abcdefghijklmnopqrstuvwxyz234567",E=Object.create(null);for(let e=0;e<O.length;e++)E[O[e]]=e;E[0]=E.o;E[1]=E.i;function rt(e){let t=0,r=0,n="";function o(s){return t<0?r|=s>>-t:r=s<<t&248,t>3?(t-=8,1):(t<4&&(n+=O[r>>3],t+=5),0)}for(let s=0;s<e.length;)s+=o(e[s]);return n+(t<0?O[r>>3]:"")}k.encode=rt;function nt(e){let t=0,r=0,n=new Uint8Array(e.length*4/3|0),o=0;function s(a){let c=E[a.toLowerCase()];if(c===void 0)throw new Error(`Invalid character: ${JSON.stringify(a)}`);c<<=3,r|=c>>>t,t+=5,t>=8&&(n[o++]=r,t-=8,t>0?r=c<<5-t&255:r=0)}for(let a of e)s(a);return n.slice(0,o)}k.decode=nt});var ve=h(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.getCrc32=void 0;var ot=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function st(e){let t=new Uint8Array(e),r=-1;for(let n=0;n<t.length;n++){let s=(t[n]^r)&255;r=ot[s]^r>>>8}return(r^-1)>>>0}L.getCrc32=st});var $=h(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.output=u.exists=u.hash=u.bytes=u.bool=u.number=u.isBytes=void 0;function N(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}u.number=N;function Ae(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}u.bool=Ae;function Ee(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}u.isBytes=Ee;function J(e,...t){if(!Ee(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}u.bytes=J;function ke(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");N(e.outputLen),N(e.blockLen)}u.hash=ke;function Ie(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}u.exists=Ie;function Pe(e,t){J(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}u.output=Pe;var it={number:N,bool:Ae,bytes:J,hash:ke,exists:Ie,output:Pe};u.default=it});var Te=h(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.crypto=void 0;var j=Ze("node:crypto");C.crypto=j&&typeof j=="object"&&"webcrypto"in j?j.webcrypto:void 0});var Z=h(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.randomBytes=i.wrapXOFConstructorWithOpts=i.wrapConstructorWithOpts=i.wrapConstructor=i.checkOpts=i.Hash=i.concatBytes=i.toBytes=i.utf8ToBytes=i.asyncLoop=i.nextTick=i.hexToBytes=i.bytesToHex=i.byteSwap32=i.byteSwapIfBE=i.byteSwap=i.isLE=i.rotl=i.rotr=i.createView=i.u32=i.u8=i.isBytes=void 0;var Y=Te(),z=$();function at(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}i.isBytes=at;var ct=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);i.u8=ct;var ft=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));i.u32=ft;var dt=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);i.createView=dt;var ut=(e,t)=>e<<32-t|e>>>t;i.rotr=ut;var xt=(e,t)=>e<<t|e>>>32-t>>>0;i.rotl=xt;i.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;var lt=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;i.byteSwap=lt;i.byteSwapIfBE=i.isLE?e=>e:e=>(0,i.byteSwap)(e);function bt(e){for(let t=0;t<e.length;t++)e[t]=(0,i.byteSwap)(e[t])}i.byteSwap32=bt;var pt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ht(e){(0,z.bytes)(e);let t="";for(let r=0;r<e.length;r++)t+=pt[e[r]];return t}i.bytesToHex=ht;var y={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Se(e){if(e>=y._0&&e<=y._9)return e-y._0;if(e>=y._A&&e<=y._F)return e-(y._A-10);if(e>=y._a&&e<=y._f)return e-(y._a-10)}function yt(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let o=0,s=0;o<r;o++,s+=2){let a=Se(e.charCodeAt(s)),c=Se(e.charCodeAt(s+1));if(a===void 0||c===void 0){let d=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+d+'" at index '+s)}n[o]=a*16+c}return n}i.hexToBytes=yt;var gt=async()=>{};i.nextTick=gt;async function wt(e,t,r){let n=Date.now();for(let o=0;o<e;o++){r(o);let s=Date.now()-n;s>=0&&s<t||(await(0,i.nextTick)(),n+=s)}}i.asyncLoop=wt;function Be(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}i.utf8ToBytes=Be;function M(e){return typeof e=="string"&&(e=Be(e)),(0,z.bytes)(e),e}i.toBytes=M;function mt(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];(0,z.bytes)(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let s=e[n];r.set(s,o),o+=s.length}return r}i.concatBytes=mt;var X=class{clone(){return this._cloneInto()}};i.Hash=X;var _t={}.toString;function vt(e,t){if(t!==void 0&&_t.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(e,t)}i.checkOpts=vt;function At(e){let t=n=>e().update(M(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}i.wrapConstructor=At;function Et(e){let t=(n,o)=>e(o).update(M(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}i.wrapConstructorWithOpts=Et;function kt(e){let t=(n,o)=>e(o).update(M(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}i.wrapXOFConstructorWithOpts=kt;function It(e=32){if(Y.crypto&&typeof Y.crypto.getRandomValues=="function")return Y.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}i.randomBytes=It});var Ue=h(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.HashMD=w.Maj=w.Chi=void 0;var Q=$(),U=Z();function Pt(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let o=BigInt(32),s=BigInt(4294967295),a=Number(r>>o&s),c=Number(r&s),d=n?4:0,b=n?0:4;e.setUint32(t+d,a,n),e.setUint32(t+b,c,n)}var Tt=(e,t,r)=>e&t^~e&r;w.Chi=Tt;var St=(e,t,r)=>e&t^e&r^t&r;w.Maj=St;var ee=class extends U.Hash{constructor(t,r,n,o){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,U.createView)(this.buffer)}update(t){(0,Q.exists)(this);let{view:r,buffer:n,blockLen:o}=this;t=(0,U.toBytes)(t);let s=t.length;for(let a=0;a<s;){let c=Math.min(o-this.pos,s-a);if(c===o){let d=(0,U.createView)(t);for(;o<=s-a;a+=o)this.process(d,a);continue}n.set(t.subarray(a,a+c),this.pos),this.pos+=c,a+=c,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,Q.exists)(this),(0,Q.output)(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:s}=this,{pos:a}=this;r[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let f=a;f<o;f++)r[f]=0;Pt(n,o-8,BigInt(this.length*8),s),this.process(n,0);let c=(0,U.createView)(t),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let b=d/4,g=this.get();if(b>g.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<b;f++)c.setUint32(4*f,g[f],s)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:n,length:o,finished:s,destroyed:a,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=a,o%r&&t.buffer.set(n),t}};w.HashMD=ee});var Oe=h(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.sha224=I.sha256=void 0;var te=Ue(),l=Z(),Bt=new Uint32Array([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]),m=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),_=new Uint32Array(64),V=class extends te.HashMD{constructor(){super(64,32,8,!1),this.A=m[0]|0,this.B=m[1]|0,this.C=m[2]|0,this.D=m[3]|0,this.E=m[4]|0,this.F=m[5]|0,this.G=m[6]|0,this.H=m[7]|0}get(){let{A:t,B:r,C:n,D:o,E:s,F:a,G:c,H:d}=this;return[t,r,n,o,s,a,c,d]}set(t,r,n,o,s,a,c,d){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=a|0,this.G=c|0,this.H=d|0}process(t,r){for(let f=0;f<16;f++,r+=4)_[f]=t.getUint32(r,!1);for(let f=16;f<64;f++){let B=_[f-15],A=_[f-2],we=(0,l.rotr)(B,7)^(0,l.rotr)(B,18)^B>>>3,q=(0,l.rotr)(A,17)^(0,l.rotr)(A,19)^A>>>10;_[f]=q+_[f-7]+we+_[f-16]|0}let{A:n,B:o,C:s,D:a,E:c,F:d,G:b,H:g}=this;for(let f=0;f<64;f++){let B=(0,l.rotr)(c,6)^(0,l.rotr)(c,11)^(0,l.rotr)(c,25),A=g+B+(0,te.Chi)(c,d,b)+Bt[f]+_[f]|0,q=((0,l.rotr)(n,2)^(0,l.rotr)(n,13)^(0,l.rotr)(n,22))+(0,te.Maj)(n,o,s)|0;g=b,b=d,d=c,c=a+A|0,a=s,s=o,o=n,n=A+q|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,a=a+this.D|0,c=c+this.E|0,d=d+this.F|0,b=b+this.G|0,g=g+this.H|0,this.set(n,o,s,a,c,d,b,g)}roundClean(){_.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},re=class extends V{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};I.sha256=(0,l.wrapConstructor)(()=>new V);I.sha224=(0,l.wrapConstructor)(()=>new re)});var Le=h(D=>{"use strict";Object.defineProperty(D,"__esModule",{value:!0});D.sha224=void 0;var Ut=Oe();function Ot(e){return Ut.sha224.create().update(new Uint8Array(e)).digest()}D.sha224=Ot});var Ce=h(p=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});p.Principal=p.JSON_KEY_PRINCIPAL=void 0;var Ne=_e(),Lt=ve(),Nt=Le();p.JSON_KEY_PRINCIPAL="__principal__";var jt=2,je=4,Ct="aaaaa-aa",Mt=e=>{var t;return new Uint8Array(((t=e.match(/.{1,2}/g))!==null&&t!==void 0?t:[]).map(r=>parseInt(r,16)))},Vt=e=>e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),""),ne=class e{constructor(t){this._arr=t,this._isPrincipal=!0}static anonymous(){return new this(new Uint8Array([je]))}static managementCanister(){return this.fromHex(Ct)}static selfAuthenticating(t){let r=(0,Nt.sha224)(t);return new this(new Uint8Array([...r,jt]))}static from(t){if(typeof t=="string")return e.fromText(t);if(Object.getPrototypeOf(t)===Uint8Array.prototype)return new e(t);if(typeof t=="object"&&t!==null&&t._isPrincipal===!0)return new e(t._arr);throw new Error(`Impossible to convert ${JSON.stringify(t)} to Principal.`)}static fromHex(t){return new this(Mt(t))}static fromText(t){let r=t;if(t.includes(p.JSON_KEY_PRINCIPAL)){let a=JSON.parse(t);p.JSON_KEY_PRINCIPAL in a&&(r=a[p.JSON_KEY_PRINCIPAL])}let n=r.toLowerCase().replace(/-/g,""),o=(0,Ne.decode)(n);o=o.slice(4,o.length);let s=new this(o);if(s.toText()!==r)throw new Error(`Principal "${s.toText()}" does not have a valid checksum (original value "${r}" may not be a valid Principal ID).`);return s}static fromUint8Array(t){return new this(t)}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===je}toUint8Array(){return this._arr}toHex(){return Vt(this._arr).toUpperCase()}toText(){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,(0,Lt.getCrc32)(this._arr));let n=new Uint8Array(t),o=Uint8Array.from(this._arr),s=new Uint8Array([...n,...o]),c=(0,Ne.encode)(s).match(/.{1,5}/g);if(!c)throw new Error;return c.join("-")}toString(){return this.toText()}toJSON(){return{[p.JSON_KEY_PRINCIPAL]:this.toText()}}compareTo(t){for(let r=0;r<Math.min(this._arr.length,t._arr.length);r++){if(this._arr[r]<t._arr[r])return"lt";if(this._arr[r]>t._arr[r])return"gt"}return this._arr.length<t._arr.length?"lt":this._arr.length>t._arr.length?"gt":"eq"}ltEq(t){let r=this.compareTo(t);return r=="lt"||r=="eq"}gtEq(t){let r=this.compareTo(t);return r=="gt"||r=="eq"}};p.Principal=ne});function S(e){return new Promise((t,r)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>r(e.error)})}function F(e,t){let r=indexedDB.open(e);r.onupgradeneeded=()=>r.result.createObjectStore(t);let n=S(r);return(o,s)=>n.then(a=>s(a.transaction(t,o).objectStore(t)))}function de(){return fe||(fe=F("keyval-store","keyval")),fe}function ue(e,t,r=de()){return r("readwrite",n=>(n.put(t,e),S(n.transaction)))}function xe(e,t=de()){return t("readwrite",r=>(e.forEach(n=>r.delete(n)),S(r.transaction)))}function Kt(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},S(e.transaction)}function le(e=de()){return e("readonly",t=>{if(t.getAll&&t.getAllKeys)return Promise.all([S(t.getAllKeys()),S(t.getAll())]).then(([n,o])=>n.map((s,a)=>[s,o[a]]));let r=[];return e("readonly",n=>Kt(n,o=>r.push([o.key,o.value])).then(()=>r))})}var fe,He=me(()=>{});var he={};Qe(he,{delPageViews:()=>Jt,delTrackEvents:()=>Xt,getPageViews:()=>Gt,getTrackEvents:()=>Yt,setPageView:()=>qt,setTrackEvent:()=>$t});var be,pe,qt,Gt,Jt,$t,Yt,Xt,ye=me(()=>{"use strict";He();be=F("juno-views","views"),pe=F("juno-events","events"),qt=({key:e,view:t})=>ue(e,t,be),Gt=()=>le(be),Jt=e=>xe(e,be),$t=({key:e,track:t})=>ue(e,t,pe),Yt=()=>le(pe),Xt=e=>xe(e,pe)});var Dt=tt(Ce(),1);var H=e=>e==null,oe=e=>!H(e),Ht=class extends Error{},se=(e,t)=>{if(H(e))throw new Ht(t)};var R=e=>oe(e)?[e]:[];var ie=()=>typeof window<"u";import{webcrypto as Ve}from"node:crypto";var Me="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Rt=128,v,P;function Wt(e){!v||v.length<e?(v=Buffer.allocUnsafe(e*Rt),Ve.getRandomValues(v),P=0):P+e>v.length&&(Ve.getRandomValues(v),P=0),P+=e}function W(e=21){Wt(e-=0);let t="";for(let r=P-e;r<P;r++)t+=Me[v[r]&63];return t}var De=()=>BigInt(Date.now())*BigInt(1e6);var ae=()=>({collected_at:De(),updated_at:[],version:[]}),ce=()=>{let{userAgent:e}=navigator;return{user_agent:R(e)}};var Ft="Analytics worker not initialized. Did you call `initOrbiter`?",T=e=>{H(e)&&console.warn(Ft)};var zt=()=>{if(!(typeof crypto>"u"))return W()},K=zt(),x,Re=e=>{let{path:t}=e.worker??{},r=t===void 0?"./workers/analytics.worker.js":t;x=new Worker(r);let n=()=>console.warn("Unable to connect to the analytics web worker. Have you deployed it?");return x?.addEventListener("error",n,!1),Qt(e),{cleanup(){x?.removeEventListener("error",n,!1)}}},We=()=>{let e=async()=>await Ke(),t=new Proxy(history.pushState,{apply:async(r,n,o)=>{r.apply(n,o),await e()}});return history.pushState=t,addEventListener("popstate",e,{passive:!0}),{cleanup(){t=null,removeEventListener("popstate",e,!1)}}},Fe="No session ID initialized.",ge=async()=>{if(!ie())return;se(K,Fe);let{title:e,location:{href:t},referrer:r}=document,{innerWidth:n,innerHeight:o}=window,{timeZone:s}=Intl.DateTimeFormat().resolvedOptions(),a={title:e,href:t,referrer:R(oe(r)&&r!==""?r:void 0),device:{inner_width:n,inner_height:o},time_zone:s,session_id:K,...ce(),...ae()};await(await Promise.resolve().then(()=>(ye(),he))).setPageView({key:W(),view:a})},Ke=async()=>{T(x),await ge(),x?.postMessage({msg:"junoTrackPageView"})},Zt=async e=>{if(!ie())return;se(K,Fe),T(x),await(await Promise.resolve().then(()=>(ye(),he))).setTrackEvent({key:W(),track:{...e,session_id:K,...ce(),...ae()}}),x?.postMessage({msg:"junoTrackEvent"})},Qt=e=>{T(x),x?.postMessage({msg:"junoInitEnvironment",data:e})},qe=()=>{T(x),x?.postMessage({msg:"junoStartTrackTimer"})},Ge=()=>{T(x),x?.postMessage({msg:"junoStopTracker"})};var Br=async e=>{await ge();let{cleanup:t}=Re(e),{cleanup:r}=We();return qe(),()=>{Ge(),t(),r()}};export{Br as initOrbiter,Zt as trackEvent,Ke as trackPageView};
4
4
  /*! Bundled license information:
5
5
 
6
6
  @noble/hashes/utils.js: