botschat 0.1.12 → 0.1.13

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.
Files changed (37) hide show
  1. package/README.md +11 -15
  2. package/migrations/0012_push_tokens.sql +11 -0
  3. package/package.json +7 -1
  4. package/packages/api/src/do/connection-do.ts +90 -1
  5. package/packages/api/src/env.ts +2 -0
  6. package/packages/api/src/index.ts +4 -1
  7. package/packages/api/src/routes/auth.ts +39 -6
  8. package/packages/api/src/routes/push.ts +52 -0
  9. package/packages/api/src/utils/fcm.ts +167 -0
  10. package/packages/api/src/utils/firebase.ts +89 -1
  11. package/packages/plugin/package.json +1 -1
  12. package/packages/web/dist/assets/index-B9qN5gs6.js +1 -0
  13. package/packages/web/dist/assets/index-BQNMGVyU.js +2 -0
  14. package/packages/web/dist/assets/{index-CCBhODDo.css → index-Bd_RDcgO.css} +1 -1
  15. package/packages/web/dist/assets/{index-CCFgKLX_.js → index-Civeg2lm.js} +1 -1
  16. package/packages/web/dist/assets/index-Dk33VSnY.js +2 -0
  17. package/packages/web/dist/assets/index-Kr85Nj_-.js +1516 -0
  18. package/packages/web/dist/assets/{index-Dx64BDkP.js → index-lVB82JKU.js} +1 -1
  19. package/packages/web/dist/assets/index.esm-CtMkqqqb.js +599 -0
  20. package/packages/web/dist/assets/{web-DJQW-VLX.js → web-CUXjh_UA.js} +1 -1
  21. package/packages/web/dist/assets/web-vKLTVUul.js +1 -0
  22. package/packages/web/dist/index.html +6 -4
  23. package/packages/web/dist/sw.js +158 -1
  24. package/packages/web/index.html +4 -2
  25. package/packages/web/src/App.tsx +42 -2
  26. package/packages/web/src/api.ts +10 -0
  27. package/packages/web/src/components/AccountSettings.tsx +131 -0
  28. package/packages/web/src/components/DataConsentModal.tsx +249 -0
  29. package/packages/web/src/components/LoginPage.tsx +49 -9
  30. package/packages/web/src/firebase.ts +89 -2
  31. package/packages/web/src/foreground.ts +51 -0
  32. package/packages/web/src/main.tsx +2 -1
  33. package/packages/web/src/push.ts +205 -0
  34. package/scripts/dev.sh +139 -13
  35. package/scripts/mock-openclaw.mjs +382 -0
  36. package/packages/web/dist/assets/index-D8mBAwjS.js +0 -1516
  37. package/packages/web/dist/assets/index-E-nzPZl8.js +0 -2
@@ -1 +1 @@
1
- import{r as e}from"./index-D8mBAwjS.js";var t;(function(r){r.Dark="DARK",r.Light="LIGHT",r.Default="DEFAULT"})(t||(t={}));var a;(function(r){r.None="NONE",r.Slide="SLIDE",r.Fade="FADE"})(a||(a={}));const u=e("StatusBar");export{a as Animation,u as StatusBar,t as Style};
1
+ import{r as e}from"./index-Kr85Nj_-.js";var t;(function(r){r.Dark="DARK",r.Light="LIGHT",r.Default="DEFAULT"})(t||(t={}));var a;(function(r){r.None="NONE",r.Slide="SLIDE",r.Fade="FADE"})(a||(a={}));const u=e("StatusBar");export{a as Animation,u as StatusBar,t as Style};
@@ -0,0 +1,599 @@
1
+ import{a as b,_ as m,C as y,b as D,E as X,o as R,F as Ae,g as k,c as ve,v as Ee,i as _e,d as Ce,e as A}from"./index-Kr85Nj_-.js";const Q="@firebase/installations",M="0.6.19";/**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */const Z=1e4,ee=`w:${M}`,te="FIS_v2",Ne="https://firebaseinstallations.googleapis.com/v1",Oe=3600*1e3,De="installations",Re="Installations";/**
17
+ * @license
18
+ * Copyright 2019 Google LLC
19
+ *
20
+ * Licensed under the Apache License, Version 2.0 (the "License");
21
+ * you may not use this file except in compliance with the License.
22
+ * You may obtain a copy of the License at
23
+ *
24
+ * http://www.apache.org/licenses/LICENSE-2.0
25
+ *
26
+ * Unless required by applicable law or agreed to in writing, software
27
+ * distributed under the License is distributed on an "AS IS" BASIS,
28
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
+ * See the License for the specific language governing permissions and
30
+ * limitations under the License.
31
+ */const Me={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."},l=new X(De,Re,Me);function ne(e){return e instanceof Ae&&e.code.includes("request-failed")}/**
32
+ * @license
33
+ * Copyright 2019 Google LLC
34
+ *
35
+ * Licensed under the Apache License, Version 2.0 (the "License");
36
+ * you may not use this file except in compliance with the License.
37
+ * You may obtain a copy of the License at
38
+ *
39
+ * http://www.apache.org/licenses/LICENSE-2.0
40
+ *
41
+ * Unless required by applicable law or agreed to in writing, software
42
+ * distributed under the License is distributed on an "AS IS" BASIS,
43
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44
+ * See the License for the specific language governing permissions and
45
+ * limitations under the License.
46
+ */function oe({projectId:e}){return`${Ne}/projects/${e}/installations`}function ie(e){return{token:e.token,requestStatus:2,expiresIn:Fe(e.expiresIn),creationTime:Date.now()}}async function re(e,t){const o=(await t.json()).error;return l.create("request-failed",{requestName:e,serverCode:o.code,serverMessage:o.message,serverStatus:o.status})}function ae({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function Pe(e,{refreshToken:t}){const n=ae(e);return n.append("Authorization",$e(t)),n}async function se(e){const t=await e();return t.status>=500&&t.status<600?e():t}function Fe(e){return Number(e.replace("s","000"))}function $e(e){return`${te} ${e}`}/**
47
+ * @license
48
+ * Copyright 2019 Google LLC
49
+ *
50
+ * Licensed under the Apache License, Version 2.0 (the "License");
51
+ * you may not use this file except in compliance with the License.
52
+ * You may obtain a copy of the License at
53
+ *
54
+ * http://www.apache.org/licenses/LICENSE-2.0
55
+ *
56
+ * Unless required by applicable law or agreed to in writing, software
57
+ * distributed under the License is distributed on an "AS IS" BASIS,
58
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59
+ * See the License for the specific language governing permissions and
60
+ * limitations under the License.
61
+ */async function Ke({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const o=oe(e),i=ae(e),r=t.getImmediate({optional:!0});if(r){const a=await r.getHeartbeatsHeader();a&&i.append("x-firebase-client",a)}const s={fid:n,authVersion:te,appId:e.appId,sdkVersion:ee},c={method:"POST",headers:i,body:JSON.stringify(s)},d=await se(()=>fetch(o,c));if(d.ok){const a=await d.json();return{fid:a.fid||n,registrationStatus:2,refreshToken:a.refreshToken,authToken:ie(a.authToken)}}else throw await re("Create Installation",d)}/**
62
+ * @license
63
+ * Copyright 2019 Google LLC
64
+ *
65
+ * Licensed under the Apache License, Version 2.0 (the "License");
66
+ * you may not use this file except in compliance with the License.
67
+ * You may obtain a copy of the License at
68
+ *
69
+ * http://www.apache.org/licenses/LICENSE-2.0
70
+ *
71
+ * Unless required by applicable law or agreed to in writing, software
72
+ * distributed under the License is distributed on an "AS IS" BASIS,
73
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
74
+ * See the License for the specific language governing permissions and
75
+ * limitations under the License.
76
+ */function ce(e){return new Promise(t=>{setTimeout(t,e)})}/**
77
+ * @license
78
+ * Copyright 2019 Google LLC
79
+ *
80
+ * Licensed under the Apache License, Version 2.0 (the "License");
81
+ * you may not use this file except in compliance with the License.
82
+ * You may obtain a copy of the License at
83
+ *
84
+ * http://www.apache.org/licenses/LICENSE-2.0
85
+ *
86
+ * Unless required by applicable law or agreed to in writing, software
87
+ * distributed under the License is distributed on an "AS IS" BASIS,
88
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89
+ * See the License for the specific language governing permissions and
90
+ * limitations under the License.
91
+ */function qe(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_")}/**
92
+ * @license
93
+ * Copyright 2019 Google LLC
94
+ *
95
+ * Licensed under the Apache License, Version 2.0 (the "License");
96
+ * you may not use this file except in compliance with the License.
97
+ * You may obtain a copy of the License at
98
+ *
99
+ * http://www.apache.org/licenses/LICENSE-2.0
100
+ *
101
+ * Unless required by applicable law or agreed to in writing, software
102
+ * distributed under the License is distributed on an "AS IS" BASIS,
103
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
104
+ * See the License for the specific language governing permissions and
105
+ * limitations under the License.
106
+ */const Le=/^[cdef][\w-]{21}$/,O="";function je(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const n=xe(e);return Le.test(n)?n:O}catch{return O}}function xe(e){return qe(e).substr(0,22)}/**
107
+ * @license
108
+ * Copyright 2019 Google LLC
109
+ *
110
+ * Licensed under the Apache License, Version 2.0 (the "License");
111
+ * you may not use this file except in compliance with the License.
112
+ * You may obtain a copy of the License at
113
+ *
114
+ * http://www.apache.org/licenses/LICENSE-2.0
115
+ *
116
+ * Unless required by applicable law or agreed to in writing, software
117
+ * distributed under the License is distributed on an "AS IS" BASIS,
118
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119
+ * See the License for the specific language governing permissions and
120
+ * limitations under the License.
121
+ */function I(e){return`${e.appName}!${e.appId}`}/**
122
+ * @license
123
+ * Copyright 2019 Google LLC
124
+ *
125
+ * Licensed under the Apache License, Version 2.0 (the "License");
126
+ * you may not use this file except in compliance with the License.
127
+ * You may obtain a copy of the License at
128
+ *
129
+ * http://www.apache.org/licenses/LICENSE-2.0
130
+ *
131
+ * Unless required by applicable law or agreed to in writing, software
132
+ * distributed under the License is distributed on an "AS IS" BASIS,
133
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134
+ * See the License for the specific language governing permissions and
135
+ * limitations under the License.
136
+ */const ue=new Map;function de(e,t){const n=I(e);fe(n,t),Ve(n,t)}function fe(e,t){const n=ue.get(e);if(n)for(const o of n)o(t)}function Ve(e,t){const n=Be();n&&n.postMessage({key:e,fid:t}),He()}let p=null;function Be(){return!p&&"BroadcastChannel"in self&&(p=new BroadcastChannel("[Firebase] FID Change"),p.onmessage=e=>{fe(e.data.key,e.data.fid)}),p}function He(){ue.size===0&&p&&(p.close(),p=null)}/**
137
+ * @license
138
+ * Copyright 2019 Google LLC
139
+ *
140
+ * Licensed under the Apache License, Version 2.0 (the "License");
141
+ * you may not use this file except in compliance with the License.
142
+ * You may obtain a copy of the License at
143
+ *
144
+ * http://www.apache.org/licenses/LICENSE-2.0
145
+ *
146
+ * Unless required by applicable law or agreed to in writing, software
147
+ * distributed under the License is distributed on an "AS IS" BASIS,
148
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149
+ * See the License for the specific language governing permissions and
150
+ * limitations under the License.
151
+ */const We="firebase-installations-database",Ue=1,g="firebase-installations-store";let v=null;function P(){return v||(v=R(We,Ue,{upgrade:(e,t)=>{switch(t){case 0:e.createObjectStore(g)}}})),v}async function T(e,t){const n=I(e),i=(await P()).transaction(g,"readwrite"),r=i.objectStore(g),s=await r.get(n);return await r.put(t,n),await i.done,(!s||s.fid!==t.fid)&&de(e,t.fid),t}async function pe(e){const t=I(e),o=(await P()).transaction(g,"readwrite");await o.objectStore(g).delete(t),await o.done}async function S(e,t){const n=I(e),i=(await P()).transaction(g,"readwrite"),r=i.objectStore(g),s=await r.get(n),c=t(s);return c===void 0?await r.delete(n):await r.put(c,n),await i.done,c&&(!s||s.fid!==c.fid)&&de(e,c.fid),c}/**
152
+ * @license
153
+ * Copyright 2019 Google LLC
154
+ *
155
+ * Licensed under the Apache License, Version 2.0 (the "License");
156
+ * you may not use this file except in compliance with the License.
157
+ * You may obtain a copy of the License at
158
+ *
159
+ * http://www.apache.org/licenses/LICENSE-2.0
160
+ *
161
+ * Unless required by applicable law or agreed to in writing, software
162
+ * distributed under the License is distributed on an "AS IS" BASIS,
163
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164
+ * See the License for the specific language governing permissions and
165
+ * limitations under the License.
166
+ */async function F(e){let t;const n=await S(e.appConfig,o=>{const i=Ge(o),r=Je(e,i);return t=r.registrationPromise,r.installationEntry});return n.fid===O?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}function Ge(e){const t=e||{fid:je(),registrationStatus:0};return le(t)}function Je(e,t){if(t.registrationStatus===0){if(!navigator.onLine){const i=Promise.reject(l.create("app-offline"));return{installationEntry:t,registrationPromise:i}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},o=Ye(e,n);return{installationEntry:n,registrationPromise:o}}else return t.registrationStatus===1?{installationEntry:t,registrationPromise:ze(e)}:{installationEntry:t}}async function Ye(e,t){try{const n=await Ke(e,t);return T(e.appConfig,n)}catch(n){throw ne(n)&&n.customData.serverCode===409?await pe(e.appConfig):await T(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}async function ze(e){let t=await V(e.appConfig);for(;t.registrationStatus===1;)await ce(100),t=await V(e.appConfig);if(t.registrationStatus===0){const{installationEntry:n,registrationPromise:o}=await F(e);return o||n}return t}function V(e){return S(e,t=>{if(!t)throw l.create("installation-not-found");return le(t)})}function le(e){return Xe(e)?{fid:e.fid,registrationStatus:0}:e}function Xe(e){return e.registrationStatus===1&&e.registrationTime+Z<Date.now()}/**
167
+ * @license
168
+ * Copyright 2019 Google LLC
169
+ *
170
+ * Licensed under the Apache License, Version 2.0 (the "License");
171
+ * you may not use this file except in compliance with the License.
172
+ * You may obtain a copy of the License at
173
+ *
174
+ * http://www.apache.org/licenses/LICENSE-2.0
175
+ *
176
+ * Unless required by applicable law or agreed to in writing, software
177
+ * distributed under the License is distributed on an "AS IS" BASIS,
178
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179
+ * See the License for the specific language governing permissions and
180
+ * limitations under the License.
181
+ */async function Qe({appConfig:e,heartbeatServiceProvider:t},n){const o=Ze(e,n),i=Pe(e,n),r=t.getImmediate({optional:!0});if(r){const a=await r.getHeartbeatsHeader();a&&i.append("x-firebase-client",a)}const s={installation:{sdkVersion:ee,appId:e.appId}},c={method:"POST",headers:i,body:JSON.stringify(s)},d=await se(()=>fetch(o,c));if(d.ok){const a=await d.json();return ie(a)}else throw await re("Generate Auth Token",d)}function Ze(e,{fid:t}){return`${oe(e)}/${t}/authTokens:generate`}/**
182
+ * @license
183
+ * Copyright 2019 Google LLC
184
+ *
185
+ * Licensed under the Apache License, Version 2.0 (the "License");
186
+ * you may not use this file except in compliance with the License.
187
+ * You may obtain a copy of the License at
188
+ *
189
+ * http://www.apache.org/licenses/LICENSE-2.0
190
+ *
191
+ * Unless required by applicable law or agreed to in writing, software
192
+ * distributed under the License is distributed on an "AS IS" BASIS,
193
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
194
+ * See the License for the specific language governing permissions and
195
+ * limitations under the License.
196
+ */async function $(e,t=!1){let n;const o=await S(e.appConfig,r=>{if(!ge(r))throw l.create("not-registered");const s=r.authToken;if(!t&&nt(s))return r;if(s.requestStatus===1)return n=et(e,t),r;{if(!navigator.onLine)throw l.create("app-offline");const c=it(r);return n=tt(e,c),c}});return n?await n:o.authToken}async function et(e,t){let n=await B(e.appConfig);for(;n.authToken.requestStatus===1;)await ce(100),n=await B(e.appConfig);const o=n.authToken;return o.requestStatus===0?$(e,t):o}function B(e){return S(e,t=>{if(!ge(t))throw l.create("not-registered");const n=t.authToken;return rt(n)?{...t,authToken:{requestStatus:0}}:t})}async function tt(e,t){try{const n=await Qe(e,t),o={...t,authToken:n};return await T(e.appConfig,o),n}catch(n){if(ne(n)&&(n.customData.serverCode===401||n.customData.serverCode===404))await pe(e.appConfig);else{const o={...t,authToken:{requestStatus:0}};await T(e.appConfig,o)}throw n}}function ge(e){return e!==void 0&&e.registrationStatus===2}function nt(e){return e.requestStatus===2&&!ot(e)}function ot(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+Oe}function it(e){const t={requestStatus:1,requestTime:Date.now()};return{...e,authToken:t}}function rt(e){return e.requestStatus===1&&e.requestTime+Z<Date.now()}/**
197
+ * @license
198
+ * Copyright 2019 Google LLC
199
+ *
200
+ * Licensed under the Apache License, Version 2.0 (the "License");
201
+ * you may not use this file except in compliance with the License.
202
+ * You may obtain a copy of the License at
203
+ *
204
+ * http://www.apache.org/licenses/LICENSE-2.0
205
+ *
206
+ * Unless required by applicable law or agreed to in writing, software
207
+ * distributed under the License is distributed on an "AS IS" BASIS,
208
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
209
+ * See the License for the specific language governing permissions and
210
+ * limitations under the License.
211
+ */async function at(e){const t=e,{installationEntry:n,registrationPromise:o}=await F(t);return o?o.catch(console.error):$(t).catch(console.error),n.fid}/**
212
+ * @license
213
+ * Copyright 2019 Google LLC
214
+ *
215
+ * Licensed under the Apache License, Version 2.0 (the "License");
216
+ * you may not use this file except in compliance with the License.
217
+ * You may obtain a copy of the License at
218
+ *
219
+ * http://www.apache.org/licenses/LICENSE-2.0
220
+ *
221
+ * Unless required by applicable law or agreed to in writing, software
222
+ * distributed under the License is distributed on an "AS IS" BASIS,
223
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
224
+ * See the License for the specific language governing permissions and
225
+ * limitations under the License.
226
+ */async function st(e,t=!1){const n=e;return await ct(n),(await $(n,t)).token}async function ct(e){const{registrationPromise:t}=await F(e);t&&await t}/**
227
+ * @license
228
+ * Copyright 2019 Google LLC
229
+ *
230
+ * Licensed under the Apache License, Version 2.0 (the "License");
231
+ * you may not use this file except in compliance with the License.
232
+ * You may obtain a copy of the License at
233
+ *
234
+ * http://www.apache.org/licenses/LICENSE-2.0
235
+ *
236
+ * Unless required by applicable law or agreed to in writing, software
237
+ * distributed under the License is distributed on an "AS IS" BASIS,
238
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
239
+ * See the License for the specific language governing permissions and
240
+ * limitations under the License.
241
+ */function ut(e){if(!e||!e.options)throw E("App Configuration");if(!e.name)throw E("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw E(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}function E(e){return l.create("missing-app-config-values",{valueName:e})}/**
242
+ * @license
243
+ * Copyright 2020 Google LLC
244
+ *
245
+ * Licensed under the Apache License, Version 2.0 (the "License");
246
+ * you may not use this file except in compliance with the License.
247
+ * You may obtain a copy of the License at
248
+ *
249
+ * http://www.apache.org/licenses/LICENSE-2.0
250
+ *
251
+ * Unless required by applicable law or agreed to in writing, software
252
+ * distributed under the License is distributed on an "AS IS" BASIS,
253
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
254
+ * See the License for the specific language governing permissions and
255
+ * limitations under the License.
256
+ */const we="installations",dt="installations-internal",ft=e=>{const t=e.getProvider("app").getImmediate(),n=ut(t),o=D(t,"heartbeat");return{app:t,appConfig:n,heartbeatServiceProvider:o,_delete:()=>Promise.resolve()}},pt=e=>{const t=e.getProvider("app").getImmediate(),n=D(t,we).getImmediate();return{getId:()=>at(n),getToken:i=>st(n,i)}};function lt(){m(new y(we,ft,"PUBLIC")),m(new y(dt,pt,"PRIVATE"))}lt();b(Q,M);b(Q,M,"esm2020");/**
257
+ * @license
258
+ * Copyright 2019 Google LLC
259
+ *
260
+ * Licensed under the Apache License, Version 2.0 (the "License");
261
+ * you may not use this file except in compliance with the License.
262
+ * You may obtain a copy of the License at
263
+ *
264
+ * http://www.apache.org/licenses/LICENSE-2.0
265
+ *
266
+ * Unless required by applicable law or agreed to in writing, software
267
+ * distributed under the License is distributed on an "AS IS" BASIS,
268
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
269
+ * See the License for the specific language governing permissions and
270
+ * limitations under the License.
271
+ */const gt="/firebase-messaging-sw.js",wt="/firebase-cloud-messaging-push-scope",he="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",ht="https://fcmregistrations.googleapis.com/v1",be="google.c.a.c_id",bt="google.c.a.c_l",mt="google.c.a.ts",yt="google.c.a.e",H=1e4;var W;(function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"})(W||(W={}));/**
272
+ * @license
273
+ * Copyright 2018 Google LLC
274
+ *
275
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
276
+ * in compliance with the License. You may obtain a copy of the License at
277
+ *
278
+ * http://www.apache.org/licenses/LICENSE-2.0
279
+ *
280
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
281
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
282
+ * or implied. See the License for the specific language governing permissions and limitations under
283
+ * the License.
284
+ */var h;(function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"})(h||(h={}));/**
285
+ * @license
286
+ * Copyright 2017 Google LLC
287
+ *
288
+ * Licensed under the Apache License, Version 2.0 (the "License");
289
+ * you may not use this file except in compliance with the License.
290
+ * You may obtain a copy of the License at
291
+ *
292
+ * http://www.apache.org/licenses/LICENSE-2.0
293
+ *
294
+ * Unless required by applicable law or agreed to in writing, software
295
+ * distributed under the License is distributed on an "AS IS" BASIS,
296
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
297
+ * See the License for the specific language governing permissions and
298
+ * limitations under the License.
299
+ */function f(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Tt(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/\-/g,"+").replace(/_/g,"/"),o=atob(n),i=new Uint8Array(o.length);for(let r=0;r<o.length;++r)i[r]=o.charCodeAt(r);return i}/**
300
+ * @license
301
+ * Copyright 2019 Google LLC
302
+ *
303
+ * Licensed under the Apache License, Version 2.0 (the "License");
304
+ * you may not use this file except in compliance with the License.
305
+ * You may obtain a copy of the License at
306
+ *
307
+ * http://www.apache.org/licenses/LICENSE-2.0
308
+ *
309
+ * Unless required by applicable law or agreed to in writing, software
310
+ * distributed under the License is distributed on an "AS IS" BASIS,
311
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
312
+ * See the License for the specific language governing permissions and
313
+ * limitations under the License.
314
+ */const _="fcm_token_details_db",kt=5,U="fcm_token_object_Store";async function It(e){if("databases"in indexedDB&&!(await indexedDB.databases()).map(r=>r.name).includes(_))return null;let t=null;return(await R(_,kt,{upgrade:async(o,i,r,s)=>{if(i<2||!o.objectStoreNames.contains(U))return;const c=s.objectStore(U),d=await c.index("fcmSenderId").get(e);if(await c.clear(),!!d){if(i===2){const a=d;if(!a.auth||!a.p256dh||!a.endpoint)return;t={token:a.fcmToken,createTime:a.createTime??Date.now(),subscriptionOptions:{auth:a.auth,p256dh:a.p256dh,endpoint:a.endpoint,swScope:a.swScope,vapidKey:typeof a.vapidKey=="string"?a.vapidKey:f(a.vapidKey)}}}else if(i===3){const a=d;t={token:a.fcmToken,createTime:a.createTime,subscriptionOptions:{auth:f(a.auth),p256dh:f(a.p256dh),endpoint:a.endpoint,swScope:a.swScope,vapidKey:f(a.vapidKey)}}}else if(i===4){const a=d;t={token:a.fcmToken,createTime:a.createTime,subscriptionOptions:{auth:f(a.auth),p256dh:f(a.p256dh),endpoint:a.endpoint,swScope:a.swScope,vapidKey:f(a.vapidKey)}}}}}})).close(),await A(_),await A("fcm_vapid_details_db"),await A("undefined"),St(t)?t:null}function St(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return typeof e.createTime=="number"&&e.createTime>0&&typeof e.token=="string"&&e.token.length>0&&typeof t.auth=="string"&&t.auth.length>0&&typeof t.p256dh=="string"&&t.p256dh.length>0&&typeof t.endpoint=="string"&&t.endpoint.length>0&&typeof t.swScope=="string"&&t.swScope.length>0&&typeof t.vapidKey=="string"&&t.vapidKey.length>0}/**
315
+ * @license
316
+ * Copyright 2019 Google LLC
317
+ *
318
+ * Licensed under the Apache License, Version 2.0 (the "License");
319
+ * you may not use this file except in compliance with the License.
320
+ * You may obtain a copy of the License at
321
+ *
322
+ * http://www.apache.org/licenses/LICENSE-2.0
323
+ *
324
+ * Unless required by applicable law or agreed to in writing, software
325
+ * distributed under the License is distributed on an "AS IS" BASIS,
326
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
327
+ * See the License for the specific language governing permissions and
328
+ * limitations under the License.
329
+ */const At="firebase-messaging-database",vt=1,w="firebase-messaging-store";let C=null;function K(){return C||(C=R(At,vt,{upgrade:(e,t)=>{switch(t){case 0:e.createObjectStore(w)}}})),C}async function me(e){const t=L(e),o=await(await K()).transaction(w).objectStore(w).get(t);if(o)return o;{const i=await It(e.appConfig.senderId);if(i)return await q(e,i),i}}async function q(e,t){const n=L(e),i=(await K()).transaction(w,"readwrite");return await i.objectStore(w).put(t,n),await i.done,t}async function Et(e){const t=L(e),o=(await K()).transaction(w,"readwrite");await o.objectStore(w).delete(t),await o.done}function L({appConfig:e}){return e.appId}/**
330
+ * @license
331
+ * Copyright 2017 Google LLC
332
+ *
333
+ * Licensed under the Apache License, Version 2.0 (the "License");
334
+ * you may not use this file except in compliance with the License.
335
+ * You may obtain a copy of the License at
336
+ *
337
+ * http://www.apache.org/licenses/LICENSE-2.0
338
+ *
339
+ * Unless required by applicable law or agreed to in writing, software
340
+ * distributed under the License is distributed on an "AS IS" BASIS,
341
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
342
+ * See the License for the specific language governing permissions and
343
+ * limitations under the License.
344
+ */const _t={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},u=new X("messaging","Messaging",_t);/**
345
+ * @license
346
+ * Copyright 2019 Google LLC
347
+ *
348
+ * Licensed under the Apache License, Version 2.0 (the "License");
349
+ * you may not use this file except in compliance with the License.
350
+ * You may obtain a copy of the License at
351
+ *
352
+ * http://www.apache.org/licenses/LICENSE-2.0
353
+ *
354
+ * Unless required by applicable law or agreed to in writing, software
355
+ * distributed under the License is distributed on an "AS IS" BASIS,
356
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
357
+ * See the License for the specific language governing permissions and
358
+ * limitations under the License.
359
+ */async function Ct(e,t){const n=await x(e),o=Te(t),i={method:"POST",headers:n,body:JSON.stringify(o)};let r;try{r=await(await fetch(j(e.appConfig),i)).json()}catch(s){throw u.create("token-subscribe-failed",{errorInfo:s==null?void 0:s.toString()})}if(r.error){const s=r.error.message;throw u.create("token-subscribe-failed",{errorInfo:s})}if(!r.token)throw u.create("token-subscribe-no-token");return r.token}async function Nt(e,t){const n=await x(e),o=Te(t.subscriptionOptions),i={method:"PATCH",headers:n,body:JSON.stringify(o)};let r;try{r=await(await fetch(`${j(e.appConfig)}/${t.token}`,i)).json()}catch(s){throw u.create("token-update-failed",{errorInfo:s==null?void 0:s.toString()})}if(r.error){const s=r.error.message;throw u.create("token-update-failed",{errorInfo:s})}if(!r.token)throw u.create("token-update-no-token");return r.token}async function ye(e,t){const o={method:"DELETE",headers:await x(e)};try{const r=await(await fetch(`${j(e.appConfig)}/${t}`,o)).json();if(r.error){const s=r.error.message;throw u.create("token-unsubscribe-failed",{errorInfo:s})}}catch(i){throw u.create("token-unsubscribe-failed",{errorInfo:i==null?void 0:i.toString()})}}function j({projectId:e}){return`${ht}/projects/${e}/registrations`}async function x({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function Te({p256dh:e,auth:t,endpoint:n,vapidKey:o}){const i={web:{endpoint:n,auth:t,p256dh:e}};return o!==he&&(i.web.applicationPubKey=o),i}/**
360
+ * @license
361
+ * Copyright 2019 Google LLC
362
+ *
363
+ * Licensed under the Apache License, Version 2.0 (the "License");
364
+ * you may not use this file except in compliance with the License.
365
+ * You may obtain a copy of the License at
366
+ *
367
+ * http://www.apache.org/licenses/LICENSE-2.0
368
+ *
369
+ * Unless required by applicable law or agreed to in writing, software
370
+ * distributed under the License is distributed on an "AS IS" BASIS,
371
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
372
+ * See the License for the specific language governing permissions and
373
+ * limitations under the License.
374
+ */const Ot=10080*60*1e3;async function Dt(e){const t=await Pt(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:f(t.getKey("auth")),p256dh:f(t.getKey("p256dh"))},o=await me(e.firebaseDependencies);if(o){if(Ft(o.subscriptionOptions,n))return Date.now()>=o.createTime+Ot?Mt(e,{token:o.token,createTime:Date.now(),subscriptionOptions:n}):o.token;try{await ye(e.firebaseDependencies,o.token)}catch(i){console.warn(i)}return G(e.firebaseDependencies,n)}else return G(e.firebaseDependencies,n)}async function Rt(e){const t=await me(e.firebaseDependencies);t&&(await ye(e.firebaseDependencies,t.token),await Et(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();return n?n.unsubscribe():!0}async function Mt(e,t){try{const n=await Nt(e.firebaseDependencies,t),o={...t,token:n,createTime:Date.now()};return await q(e.firebaseDependencies,o),n}catch(n){throw n}}async function G(e,t){const o={token:await Ct(e,t),createTime:Date.now(),subscriptionOptions:t};return await q(e,o),o.token}async function Pt(e,t){const n=await e.pushManager.getSubscription();return n||e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Tt(t)})}function Ft(e,t){const n=t.vapidKey===e.vapidKey,o=t.endpoint===e.endpoint,i=t.auth===e.auth,r=t.p256dh===e.p256dh;return n&&o&&i&&r}/**
375
+ * @license
376
+ * Copyright 2020 Google LLC
377
+ *
378
+ * Licensed under the Apache License, Version 2.0 (the "License");
379
+ * you may not use this file except in compliance with the License.
380
+ * You may obtain a copy of the License at
381
+ *
382
+ * http://www.apache.org/licenses/LICENSE-2.0
383
+ *
384
+ * Unless required by applicable law or agreed to in writing, software
385
+ * distributed under the License is distributed on an "AS IS" BASIS,
386
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
387
+ * See the License for the specific language governing permissions and
388
+ * limitations under the License.
389
+ */function J(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return $t(t,e),Kt(t,e),qt(t,e),t}function $t(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const o=t.notification.body;o&&(e.notification.body=o);const i=t.notification.image;i&&(e.notification.image=i);const r=t.notification.icon;r&&(e.notification.icon=r)}function Kt(e,t){t.data&&(e.data=t.data)}function qt(e,t){var i,r,s,c;if(!t.fcmOptions&&!((i=t.notification)!=null&&i.click_action))return;e.fcmOptions={};const n=((r=t.fcmOptions)==null?void 0:r.link)??((s=t.notification)==null?void 0:s.click_action);n&&(e.fcmOptions.link=n);const o=(c=t.fcmOptions)==null?void 0:c.analytics_label;o&&(e.fcmOptions.analyticsLabel=o)}/**
390
+ * @license
391
+ * Copyright 2019 Google LLC
392
+ *
393
+ * Licensed under the Apache License, Version 2.0 (the "License");
394
+ * you may not use this file except in compliance with the License.
395
+ * You may obtain a copy of the License at
396
+ *
397
+ * http://www.apache.org/licenses/LICENSE-2.0
398
+ *
399
+ * Unless required by applicable law or agreed to in writing, software
400
+ * distributed under the License is distributed on an "AS IS" BASIS,
401
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
402
+ * See the License for the specific language governing permissions and
403
+ * limitations under the License.
404
+ */function Lt(e){return typeof e=="object"&&!!e&&be in e}/**
405
+ * @license
406
+ * Copyright 2019 Google LLC
407
+ *
408
+ * Licensed under the Apache License, Version 2.0 (the "License");
409
+ * you may not use this file except in compliance with the License.
410
+ * You may obtain a copy of the License at
411
+ *
412
+ * http://www.apache.org/licenses/LICENSE-2.0
413
+ *
414
+ * Unless required by applicable law or agreed to in writing, software
415
+ * distributed under the License is distributed on an "AS IS" BASIS,
416
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
417
+ * See the License for the specific language governing permissions and
418
+ * limitations under the License.
419
+ */function jt(e){if(!e||!e.options)throw N("App Configuration Object");if(!e.name)throw N("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const o of t)if(!n[o])throw N(o);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}function N(e){return u.create("missing-app-config-values",{valueName:e})}/**
420
+ * @license
421
+ * Copyright 2020 Google LLC
422
+ *
423
+ * Licensed under the Apache License, Version 2.0 (the "License");
424
+ * you may not use this file except in compliance with the License.
425
+ * You may obtain a copy of the License at
426
+ *
427
+ * http://www.apache.org/licenses/LICENSE-2.0
428
+ *
429
+ * Unless required by applicable law or agreed to in writing, software
430
+ * distributed under the License is distributed on an "AS IS" BASIS,
431
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
432
+ * See the License for the specific language governing permissions and
433
+ * limitations under the License.
434
+ */class xt{constructor(t,n,o){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const i=jt(t);this.firebaseDependencies={app:t,appConfig:i,installations:n,analyticsProvider:o}}_delete(){return Promise.resolve()}}/**
435
+ * @license
436
+ * Copyright 2020 Google LLC
437
+ *
438
+ * Licensed under the Apache License, Version 2.0 (the "License");
439
+ * you may not use this file except in compliance with the License.
440
+ * You may obtain a copy of the License at
441
+ *
442
+ * http://www.apache.org/licenses/LICENSE-2.0
443
+ *
444
+ * Unless required by applicable law or agreed to in writing, software
445
+ * distributed under the License is distributed on an "AS IS" BASIS,
446
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
447
+ * See the License for the specific language governing permissions and
448
+ * limitations under the License.
449
+ */async function ke(e){try{e.swRegistration=await navigator.serviceWorker.register(gt,{scope:wt}),e.swRegistration.update().catch(()=>{}),await Vt(e.swRegistration)}catch(t){throw u.create("failed-service-worker-registration",{browserErrorMessage:t==null?void 0:t.message})}}async function Vt(e){return new Promise((t,n)=>{const o=setTimeout(()=>n(new Error(`Service worker not registered after ${H} ms`)),H),i=e.installing||e.waiting;e.active?(clearTimeout(o),t()):i?i.onstatechange=r=>{var s;((s=r.target)==null?void 0:s.state)==="activated"&&(i.onstatechange=null,clearTimeout(o),t())}:(clearTimeout(o),n(new Error("No incoming service worker found.")))})}/**
450
+ * @license
451
+ * Copyright 2020 Google LLC
452
+ *
453
+ * Licensed under the Apache License, Version 2.0 (the "License");
454
+ * you may not use this file except in compliance with the License.
455
+ * You may obtain a copy of the License at
456
+ *
457
+ * http://www.apache.org/licenses/LICENSE-2.0
458
+ *
459
+ * Unless required by applicable law or agreed to in writing, software
460
+ * distributed under the License is distributed on an "AS IS" BASIS,
461
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
462
+ * See the License for the specific language governing permissions and
463
+ * limitations under the License.
464
+ */async function Bt(e,t){if(!t&&!e.swRegistration&&await ke(e),!(!t&&e.swRegistration)){if(!(t instanceof ServiceWorkerRegistration))throw u.create("invalid-sw-registration");e.swRegistration=t}}/**
465
+ * @license
466
+ * Copyright 2020 Google LLC
467
+ *
468
+ * Licensed under the Apache License, Version 2.0 (the "License");
469
+ * you may not use this file except in compliance with the License.
470
+ * You may obtain a copy of the License at
471
+ *
472
+ * http://www.apache.org/licenses/LICENSE-2.0
473
+ *
474
+ * Unless required by applicable law or agreed to in writing, software
475
+ * distributed under the License is distributed on an "AS IS" BASIS,
476
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
477
+ * See the License for the specific language governing permissions and
478
+ * limitations under the License.
479
+ */async function Ht(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=he)}/**
480
+ * @license
481
+ * Copyright 2020 Google LLC
482
+ *
483
+ * Licensed under the Apache License, Version 2.0 (the "License");
484
+ * you may not use this file except in compliance with the License.
485
+ * You may obtain a copy of the License at
486
+ *
487
+ * http://www.apache.org/licenses/LICENSE-2.0
488
+ *
489
+ * Unless required by applicable law or agreed to in writing, software
490
+ * distributed under the License is distributed on an "AS IS" BASIS,
491
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
492
+ * See the License for the specific language governing permissions and
493
+ * limitations under the License.
494
+ */async function Ie(e,t){if(!navigator)throw u.create("only-available-in-window");if(Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission!=="granted")throw u.create("permission-blocked");return await Ht(e,t==null?void 0:t.vapidKey),await Bt(e,t==null?void 0:t.serviceWorkerRegistration),Dt(e)}/**
495
+ * @license
496
+ * Copyright 2019 Google LLC
497
+ *
498
+ * Licensed under the Apache License, Version 2.0 (the "License");
499
+ * you may not use this file except in compliance with the License.
500
+ * You may obtain a copy of the License at
501
+ *
502
+ * http://www.apache.org/licenses/LICENSE-2.0
503
+ *
504
+ * Unless required by applicable law or agreed to in writing, software
505
+ * distributed under the License is distributed on an "AS IS" BASIS,
506
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
507
+ * See the License for the specific language governing permissions and
508
+ * limitations under the License.
509
+ */async function Wt(e,t,n){const o=Ut(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(o,{message_id:n[be],message_name:n[bt],message_time:n[mt],message_device_time:Math.floor(Date.now()/1e3)})}function Ut(e){switch(e){case h.NOTIFICATION_CLICKED:return"notification_open";case h.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}/**
510
+ * @license
511
+ * Copyright 2017 Google LLC
512
+ *
513
+ * Licensed under the Apache License, Version 2.0 (the "License");
514
+ * you may not use this file except in compliance with the License.
515
+ * You may obtain a copy of the License at
516
+ *
517
+ * http://www.apache.org/licenses/LICENSE-2.0
518
+ *
519
+ * Unless required by applicable law or agreed to in writing, software
520
+ * distributed under the License is distributed on an "AS IS" BASIS,
521
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
522
+ * See the License for the specific language governing permissions and
523
+ * limitations under the License.
524
+ */async function Gt(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;e.onMessageHandler&&n.messageType===h.PUSH_RECEIVED&&(typeof e.onMessageHandler=="function"?e.onMessageHandler(J(n)):e.onMessageHandler.next(J(n)));const o=n.data;Lt(o)&&o[yt]==="1"&&await Wt(e,n.messageType,o)}const Y="@firebase/messaging",z="0.12.23";/**
525
+ * @license
526
+ * Copyright 2020 Google LLC
527
+ *
528
+ * Licensed under the Apache License, Version 2.0 (the "License");
529
+ * you may not use this file except in compliance with the License.
530
+ * You may obtain a copy of the License at
531
+ *
532
+ * http://www.apache.org/licenses/LICENSE-2.0
533
+ *
534
+ * Unless required by applicable law or agreed to in writing, software
535
+ * distributed under the License is distributed on an "AS IS" BASIS,
536
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
537
+ * See the License for the specific language governing permissions and
538
+ * limitations under the License.
539
+ */const Jt=e=>{const t=new xt(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",n=>Gt(t,n)),t},Yt=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:o=>Ie(t,o)}};function zt(){m(new y("messaging",Jt,"PUBLIC")),m(new y("messaging-internal",Yt,"PRIVATE")),b(Y,z),b(Y,z,"esm2020")}/**
540
+ * @license
541
+ * Copyright 2020 Google LLC
542
+ *
543
+ * Licensed under the Apache License, Version 2.0 (the "License");
544
+ * you may not use this file except in compliance with the License.
545
+ * You may obtain a copy of the License at
546
+ *
547
+ * http://www.apache.org/licenses/LICENSE-2.0
548
+ *
549
+ * Unless required by applicable law or agreed to in writing, software
550
+ * distributed under the License is distributed on an "AS IS" BASIS,
551
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
552
+ * See the License for the specific language governing permissions and
553
+ * limitations under the License.
554
+ */async function Xt(){try{await Ee()}catch{return!1}return typeof window<"u"&&_e()&&Ce()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}/**
555
+ * @license
556
+ * Copyright 2020 Google LLC
557
+ *
558
+ * Licensed under the Apache License, Version 2.0 (the "License");
559
+ * you may not use this file except in compliance with the License.
560
+ * You may obtain a copy of the License at
561
+ *
562
+ * http://www.apache.org/licenses/LICENSE-2.0
563
+ *
564
+ * Unless required by applicable law or agreed to in writing, software
565
+ * distributed under the License is distributed on an "AS IS" BASIS,
566
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
567
+ * See the License for the specific language governing permissions and
568
+ * limitations under the License.
569
+ */async function Qt(e){if(!navigator)throw u.create("only-available-in-window");return e.swRegistration||await ke(e),Rt(e)}/**
570
+ * @license
571
+ * Copyright 2020 Google LLC
572
+ *
573
+ * Licensed under the Apache License, Version 2.0 (the "License");
574
+ * you may not use this file except in compliance with the License.
575
+ * You may obtain a copy of the License at
576
+ *
577
+ * http://www.apache.org/licenses/LICENSE-2.0
578
+ *
579
+ * Unless required by applicable law or agreed to in writing, software
580
+ * distributed under the License is distributed on an "AS IS" BASIS,
581
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
582
+ * See the License for the specific language governing permissions and
583
+ * limitations under the License.
584
+ */function Zt(e,t){if(!navigator)throw u.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}/**
585
+ * @license
586
+ * Copyright 2017 Google LLC
587
+ *
588
+ * Licensed under the Apache License, Version 2.0 (the "License");
589
+ * you may not use this file except in compliance with the License.
590
+ * You may obtain a copy of the License at
591
+ *
592
+ * http://www.apache.org/licenses/LICENSE-2.0
593
+ *
594
+ * Unless required by applicable law or agreed to in writing, software
595
+ * distributed under the License is distributed on an "AS IS" BASIS,
596
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
597
+ * See the License for the specific language governing permissions and
598
+ * limitations under the License.
599
+ */function tn(e=ve()){return Xt().then(t=>{if(!t)throw u.create("unsupported-browser")},t=>{throw u.create("indexed-db-unsupported")}),D(k(e),"messaging").getImmediate()}async function nn(e,t){return e=k(e),Ie(e,t)}function on(e){return e=k(e),Qt(e)}function rn(e,t){return e=k(e),Zt(e,t)}zt();export{on as deleteToken,tn as getMessaging,nn as getToken,Xt as isSupported,rn as onMessage};