1import{r as R,d as b,C as y,c as N,E as z,o as W,F as X}from"./index.esm-CCdqxVCQ.js";const P="@firebase/installations",T="0.6.21";/** 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 q=1e4,_=`w:${T}`,v="FIS_v2",Y="https://firebaseinstallations.googleapis.com/v1",Q=60*60*1e3,Z="installations",tt="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 et={"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."},d=new z(Z,tt,et);function O(t){return t instanceof X&&t.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 F({projectId:t}){return`${Y}/projects/${t}/installations`}function D(t){return{token:t.token,requestStatus:2,expiresIn:rt(t.expires
46In),creationTime:Date.now()}}async function V(t,e){const r=(await e.json()).error;return d.create("request-failed",{requestName:t,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function j({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function nt(t,{refreshToken:e}){const n=j(t);return n.append("Authorization",ot(e)),n}async function $(t){const e=await t();return e.status>=500&&e.status<600?t():e}function rt(t){return Number(t.replace("s","000"))}function ot(t){return`${v} ${t}`}/** 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 at({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const r=F(t),a=j(t),o=e.getImmediate({optional:!0});if(o){const c=await o.getHeartbeatsHeader();c&&a.append("x-firebase-client",c)}const s={fid:n,authVersion:v,appId:t.appId,sdkVersion:_},i={method:"POST",headers:a,body:JSON.stringify(s)},u=await $(()=>fetch(r,i));if(u.ok){const c=await u.json();return{fid:c.fid||n,registrationStatus:2,refreshToken:c.refreshToken,authToken:D(c.authToken)}}else throw await V("Create Installation",u)}/** 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 x(t){return new Promise(e=>{setTimeout(e,t)})}/** 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 st(t){return btoa(String.fromCharCode(...t)).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 it=/^[cdef][\w-]{21}$/,m="";function ct(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const n=ut(t);return it.test(n)?n:m}catch{return m}}function ut(t){return st(t).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, softw
116are 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 g(t){return`${t.appName}!${t.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 L=new Map;function M(t,e){const n=g(t);B(n,e),ft(n,e)}function B(t,e){const n=L.get(t);if(n)for(const r of n)r(e)}function ft(t,e){const n=dt();n&&n.postMessage({key:t,fid:e}),lt()}let f=null;function dt(){return!f&&"BroadcastChannel"in self&&(f=new BroadcastChannel("[Firebase] FID Change"),f.onmessage=t=>{B(t.data.key,t.data.fid)}),f}function lt(){L.size===0&&f&&(f.close(),f=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 pt="firebase-installations-database",gt=1,l="firebase-installations-store";let w=null;function A(){return w||(w=W(pt,gt,{upgrade:(t,e)=>{switch(e){case 0:t.createObjectStore(l)}}})),w}async function p(t,e){const n=g(t),a=(await A()).transaction(l,"readwrite"),o=a.objectStore(l),s=await o.get(n);return await o.put(e,n),await a.done,(!s||s.fid!==e.fid)&&M(t,e.fid),e}async function H(t){const e=g(t),r=(await A()).transaction(l,"readwrite");await r.objectStore(l).delete(e),await r.done}async function h(t,e){const n=g(t),a=(await A()).transaction(l,"readwrite"),o=a.objectStore(l),s=await o.get(n),i=e(s);return i===void 0?await o.delete(n):await o.put(i,n),await a.done,i&&(!s||s.fid!==i.fid)&&M(t,i.fid),i}/** 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 S(t){let e;const n=await h(t.appConfig,r=>{const a=ht(r),o=wt(t,a);return e=o.registrationPromise,o.installationEntry});return n.fid===m?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}function ht(t){const e=t||{fid:ct(),registrationStatus:0};return U(e)}function wt(t,e){if(e.registrationStatus===0){if(!navigator.onLine){const a=Promise.reject(d.create("app-offline"));return{installationEntry:e,registrationPromise:a}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},r=It(t,n);return{installationEntry:n,registrationPromise:r}}else return e.registrationStatus===1?{installationEntry:e,registrationPromise:mt(t)}:{installationEntry:e}}async function It(t,e){try{const n=await at(t,e);return p(t.appConfig,n)}catch(n){throw O(n)&&n.customData.serverCode===409?await H(t.appConfig):await p(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}async function mt(t){let e=await C(t.appConfig);for(;e.registrationStatus===1;)await x(100),e=await C(t.appConfig);if(e.registrationStatus===0){const{installationEntry:n,registrationPromise:r}=await S(t);return r||n}return e}function C(t){return h(t,e=>{if(!e)throw d.create("installation-not-found");return U(e)})}function U(t){return Tt(t)?{fid:t.fid,registrationStatus:0}:t}function Tt(t){return t.registrationStatus===1&&t.registrationTime+q<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 At({appConfig:t,heartbeatServiceProvider:e},n){const r=St(t,n),a=nt(t,n),o=e.getImmediate({optional:!0});if(o){const c=await o.getHeartbeatsHeader();c&&a.append("x-firebase-client",c)}const s={installation:{sdkVersion:_,appId:t.appId}},i={method:"POST",headers:a,body:JSON.stringify(s)},u=await $(()=>fetch(r,i));if(u.ok){const c=await u.json();return D(c)}else throw await V("Generate Auth Token",u)}function St(t,{fid:e}){return`${F(t)}/${e}/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 k(t,e=!1){let n;const r=await h(t.appConfig,o=>{if(!K(o))throw d.create("not-registered");const s=o.authToken;if(!e&&yt(s))return o;if(s.requestStatus===1)return n=kt(t,e),o;{if(!navigator.onLine)throw d.create("app-offline");const i=Et(o);return n=bt(t,i),i}});return n?await n:r.authToken}async function kt(t,e){let n=await E(t.appConfig);for(;n.authToken.requestStatus===1;)await x(100),n=await E(t.appConfig);const r=n.authToken;return r.requestStatus===0?k(t,e):r}function E(t){return h(t,e=>{if(!K(e))throw d.create("not-registered");const n=e.authToken;return Rt(n)?{...e,authToken:{requestStatus:0}}:e})}async function bt(t,e){try{const n=await At(t,e),r={...e,authToken:n};return await p(t.appConfig,r),n}catch(n){if(O(n)&&(n.customData.serverCode===401||n.customData.serverCode===404))await H(t.appConfig);else{const r={...e,authToken:{requestStatus:0}};await p(t.appConfig,r)}throw n}}function K(t){return t!==void 0&&t.registrationStatus===2}function yt(t){return t.requestStatus===2&&!Ct(t)}function Ct(t){const e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+Q}function Et(t){const e={requestStatus:1,requestTime:Date.now()};return{...t,authToken:e}}function Rt(t){return t.requestStatus===1&&t.requestTime+q<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 Nt(t){const e=t,{installationEntry:n,registrationPromise:r}=await S(e);return r?r.catch(console.error):k(e).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 Pt(t,e=!1){const n=t;return await qt(n),(await k(n,e)).token}async function qt(t){const{registrationPromise:e}=await S(t);e&&await e}/** 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 _t(t){if(!t||!t.options)throw I("App Configuration");if(!t.name)throw I("App Name");const e=["projectId","apiKey","appId"];for(const n of e)if(!t.options[n])throw I(n);return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}function I(t){return d.create("missing-app-config-values",{valueName:t})}/** 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 J="installations",vt="installations-internal",Ot=t=>{const e=t.getProvider("app").getImmediate(),n=_t(e),r=N(e,"heartbeat");return{app:e,appConfig:n,heartbeatServiceProvider:r,_delete:()=>Promise.resolve()}},Ft=t=>{const e=t.getProvider("app").getImmediate(),n=N(e,J).getImmediate();return{getId:()=>Nt(n),getToken:a=>Pt(n,a)}};function Dt(){b(new y(J,Ot,"PUBLIC")),b(new y(vt,Ft,"PRIVATE"))}Dt();R(P,T);R(P,T,"esm2020");
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.