PageSourceSearch

https://app.forfeit.app/assets/vendor-firebase-D9HXyH8B.js

js forfeit.app collected 2026-09-24 21:16:21 UTC 805,753 bytes, 4,571 lines download raw bytes

1var $m=Object.defineProperty;var Qm=(n,e,t)=>e in n?$m(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var U=(n,e,t)=>Qm(n,typeof e!="symbol"?e+"":e,t);const Ym=()=>{};var nh={};/**
2 * @license
3 * Copyright 2017 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 wd=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},Xm=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=n[t++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=n[t++],o=n[t++],B=n[t++],c=((s&7)<<18|(i&63)<<12|(o&63)<<6|B&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{const i=n[t++],o=n[t++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},yd={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<n.length;s+=3){const i=n[s],o=s+1<n.length,B=o?n[s+1]:0,c=s+2<n.length,u=c?n[s+2]:0,h=i>>2,d=(i&3)<<4|B>>4;let p=(B&15)<<2|u>>6,_=u&63;c||(_=64,o||(p=64)),r.push(t[h],t[d],t[p],t[_])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(wd(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):Xm(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<n.length;){const i=t[n.charAt(s++)],B=s<n.length?t[n.charAt(s)]:0;++s;const u=s<n.length?t[n.charAt(s)]:64;++s;const d=s<n.length?t[n.charAt(s)]:64;if(++s,i==null||B==null||u==null||d==null)throw new Zm;const p=i<<2|B>>4;if(r.push(p),u!==64){const _=B<<4&240|u>>2;if(r.push(_),d!==64){const y=u<<6&192|d;r.push(y)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};class Zm extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const eE=function(n){const e=wd(n);return yd.encodeByteArray(e,!0)},Uo=function(n){return eE(n).replace(/\./g,"")},Id=function(n){try{return yd.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
17 * @license
18 * Copyright 2022 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, softw
26are
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 */function tE(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
32 * @license
33 * Copyright 2022 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 */const nE=()=>tE().__FIREBASE_DEFAULTS__,rE=()=>{if(typeof process>"u"||typeof nh>"u")return;const n=nh.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},sE=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&Id(n[1]);return e&&JSON.parse(e)},Ca=()=>{try{return Ym()||nE()||rE()||sE()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},iE=n=>{var e,t;return(t=(e=Ca())==null?void 0:e.emulatorHosts)==null?void 0:t[n]},Rc=n=>{const e=iE(n);if(!e)return;const t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),r]:[e.substring(0,t),r]},Td=()=>{var n;return(n=Ca())==null?void 0:n.config},oE=n=>{var e;return(e=Ca())==null?void 0:e[`_${n}`]};/**
47 * @license
48 * Copyright 2017 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 */class Ad{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}/**
62 * @license
63 * Copyright 2021 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 Rd(n,e){if(n.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const t={alg:"none",type:"JWT"},r=e||"demo-project",s=n.iat||0,i=n.sub||n.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o={iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...n};return[Uo(JSON.stringify(t)),Uo(JSON.stringify(o)),""].join(".")}/**
77 * @license
78 * Copyright 2017 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, softw
86are
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 et(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function aE(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(et())}function BE(){var e;const n=(e=Ca())==null?void 0:e.forceEnvironment;if(n==="node")return!0;if(n==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function cE(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function uE(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function lE(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function hE(){const n=et();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function fE(){return!BE()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function vd(){try{return typeof indexedDB=="object"}catch{return!1}}function bd(){return new Promise((n,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},s.onupgradeneeded=()=>{t=!1},s.onerror=()=>{var i;e(((i=s.error)==null?void 0:i.message)||"")}}catch(t){e(t)}})}function dE(){return!(typeof navigator>"u"||!navigator.cookieEnabled)}/**
92 * @license
93 * Copyright 2017 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 CE="FirebaseError";class kt extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=CE,Object.setPrototypeOf(this,kt.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Lr.prototype.create)}}class Lr{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?pE(i,r):"Error",B=`${this.serviceName}: ${o} (${s}).`;return new kt(s,B,r)}}function pE(n,e){try{let t=0,r="";for(;t<n.length;){const s=n.indexOf("{$",t);if(s===-1){r+=n.substring(t);break}const i=n.indexOf("}",s+2);if(i===-1){r+=n.substring(t);break}const o=n.substring(s+2,i),B=e[o];r+=n.substring(t,s)+(B!=null?String(B):`<${o}?>`),t=i+1}return r}catch{return n}}function gE(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Ar(n,e){if(n===e)return!0;const t=Object.keys(n),r=Object.keys(e);for(const s of t){if(!r.includes(s))return!1;const i=n[s],o=e[s];if(rh(i)&&rh(o)){if(!Ar(i,o))return!1}else if(i!==o)return!1}for(const s of r)if(!t.includes(s))return!1;return!0}function rh(n){return n!==null&&typeof n=="object"}/**
107 * @license
108 * Copyright 2017 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 Oi(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Ys(n){const e={};return n.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[s,i]=r.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function Xs(n){const e=n.indexOf("?");if(!e)return"";const t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function mE(n,e){const t=new EE(n,e);return t.subscribe.bind(t)}class EE{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Prom
vendor: 4,142 bytes, lines 121-170
121ise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let s;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");_E(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:r},s.next===void 0&&(s.next=IB),s.error===void 0&&(s.error=IB),s.complete===void 0&&(s.complete=IB);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function _E(n,e){if(typeof n!="object"||n===null)return!1;for(const t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function IB(){}/**
122 * @license
123 * Copyright 2021 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 */function fe(n){return n&&n._delegate?n._delegate:n}/**
137 * @license
138 * Copyright 2025 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 */function sr(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function vc(n){return(await fetch(n,{credentials:"include"})).ok}class Rt{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
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 */const fr="[DEFAULT]";/**
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 */class DE{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const r=new Ad;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){const t=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),r=(e==null?void 0:e.optional)??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(yE(e))try{this.getOrInitializeService({instanceIdentifier:fr})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(t);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=fr){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=fr){return this.instances.has(e)}getOptions(e=fr){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[i,o]of this.instancesDeferred.entries()){const B=this.normalizeInstanceIdentifier(i);r===B&&o.resolve(s)}return s}onInit(e,t){const r=this.normalizeInstanceIdentifier(t),s=this.onInitCallbacks.get(r)??new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const s of r)try{s(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:wE(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=fr){return this.component?this.component.multipleInstances?e:fr:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function wE(n){return n===fr?void 0:n}function yE(n){return n.instantiationMode==="EAGER"}/**
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, softw
191are
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 */class IE{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new DE(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
197 * @license
198 * Copyright 2017 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 */var ce;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(ce||(ce={}));const TE={debug:ce.DEBUG,verbose:ce.VERBOSE,info:ce.INFO,warn:ce.WARN,error:ce.ERROR,silent:ce.SILENT},AE=ce.INFO,RE={[ce.DEBUG]:"log",[ce.VERBOSE]:"log",[ce.INFO]:"info",[ce.WARN]:"warn",[ce.ERROR]:"error"},vE=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),s=RE[e];if(s)console[s](`[${r}]  ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class bc{constructor(e){this.name=e,this._logLevel=AE,this._logHandler=vE,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in ce))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?TE[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,ce.DEBUG,...e),this._logHandler(this,ce.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,ce.VERBOSE,...e),this._logHandler(this,ce.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,ce.INFO,...e),this._logHandler(this,ce.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,ce.WARN,...e),this._logHandler(this,ce.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,ce.ERROR,...e),this._logHandler(this,ce.ERROR,...e)}}const bE=(n,e)=>e.some(t=>n instanceof t);let sh,ih;function SE(){return sh||(sh=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function PE(){return ih||(ih=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Sd=new WeakMap,QB=new WeakMap,Pd=new WeakMap,TB=new WeakMap,Sc=new WeakMap;function OE(n){const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("success",i),n.removeEventListener("error",o)},i=()=>{t(ln(n.result)),s()},o=()=>{r(n.error),s()};n.addEventListener("success",i),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Sd.set(t,n)}).catch(()=>{}),Sc.set(e,n),e}function NE(n){if(QB.has(n))return;const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("complete",i),n.removeEventListener("error",o),n.removeEventListener("abort",o)},i=()=>{t(),s()},o=()=>{r(n.error||new DOMException("AbortError","AbortError")),s()};n.addEventListener("complete",i),n.addEventListener("error",o),n.addEventListener("abort",o)});QB.set(n,e)}let YB={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return QB.get(n);if(e==="objectStoreNames")return n.objectStoreNames||Pd.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return ln(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function FE(n){YB=n(YB)}
211function LE(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(AB(this),e,...t);return Pd.set(r,e.sort?e.sort():[e]),ln(r)}:PE().includes(n)?function(...e){return n.apply(AB(this),e),ln(Sd.get(this))}:function(...e){return ln(n.apply(AB(this),e))}}function kE(n){return typeof n=="function"?LE(n):(n instanceof IDBTransaction&&NE(n),bE(n,SE())?new Proxy(n,YB):n)}function ln(n){if(n instanceof IDBRequest)return OE(n);if(TB.has(n))return TB.get(n);const e=kE(n);return e!==n&&(TB.set(n,e),Sc.set(e,n)),e}const AB=n=>Sc.get(n);function pa(n,e,{blocked:t,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(n,e),B=ln(o);return r&&o.addEventListener("upgradeneeded",c=>{r(ln(o.result),c.oldVersion,c.newVersion,ln(o.transaction),c)}),t&&o.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),B.then(c=>{i&&c.addEventListener("close",()=>i()),s&&c.addEventListener("versionchange",u=>s(u.oldVersion,u.newVersion,u))}).catch(()=>{}),B}function Ro(n,{blocked:e}={}){const t=indexedDB.deleteDatabase(n);return e&&t.addEventListener("blocked",r=>e(r.oldVersion,r)),ln(t).then(()=>{})}const VE=["get","getKey","getAll","getAllKeys","count"],xE=["put","add","delete","clear"],RB=new Map;function oh(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(RB.get(e))return RB.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,s=xE.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(s||VE.includes(t)))return;const i=async function(o,...B){const c=this.transaction(o,s?"readwrite":"readonly");let u=c.store;return r&&(u=u.index(B.shift())),(await Promise.all([u[t](...B),s&&c.done]))[0]};return RB.set(e,i),i}FE(n=>({...n,get:(e,t,r)=>oh(e,t)||n.get(e,t,r),has:(e,t)=>!!oh(e,t)||n.has(e,t)}));/**
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 */class ME{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(GE(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function GE(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const XB="@firebase/app",ah="0.16.2";/**
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 */const pn=new bc("@firebase/app"),UE="@firebase/app-compat",HE="@firebase/analytics-compat",qE="@firebase/analytics",JE="@f
241irebase/app-check-compat",jE="@firebase/app-check",KE="@firebase/auth",zE="@firebase/auth-compat",WE="@firebase/database",$E="@firebase/data-connect",QE="@firebase/database-compat",YE="@firebase/functions",XE="@firebase/functions-compat",ZE="@firebase/installations",e_="@firebase/installations-compat",t_="@firebase/messaging",n_="@firebase/messaging-compat",r_="@firebase/performance",s_="@firebase/performance-compat",i_="@firebase/remote-config",o_="@firebase/remote-config-compat",a_="@firebase/storage",B_="@firebase/storage-compat",c_="@firebase/firestore",u_="@firebase/ai",l_="@firebase/firestore-compat",h_="firebase",f_="12.19.0";/**
242 * @license
243 * Copyright 2019 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 ZB="[DEFAULT]",d_={[XB]:"fire-core",[UE]:"fire-core-compat",[qE]:"fire-analytics",[HE]:"fire-analytics-compat",[jE]:"fire-app-check",[JE]:"fire-app-check-compat",[KE]:"fire-auth",[zE]:"fire-auth-compat",[WE]:"fire-rtdb",[$E]:"fire-data-connect",[QE]:"fire-rtdb-compat",[YE]:"fire-fn",[XE]:"fire-fn-compat",[ZE]:"fire-iid",[e_]:"fire-iid-compat",[t_]:"fire-fcm",[n_]:"fire-fcm-compat",[r_]:"fire-perf",[s_]:"fire-perf-compat",[i_]:"fire-rc",[o_]:"fire-rc-compat",[a_]:"fire-gcs",[B_]:"fire-gcs-compat",[c_]:"fire-fst",[l_]:"fire-fst-compat",[u_]:"fire-vertex","fire-js":"fire-js",[h_]:"fire-js-all"};/**
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 Ho=new Map,C_=new Map,ec=new Map;function Bh(n,e){try{n.container.addComponent(e)}catch(t){pn.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function Ot(n){const e=n.name;if(ec.has(e))return pn.debug(`There were multiple attempts to register component ${e}.`),!1;ec.set(e,n);for(const t of Ho.values())Bh(t,n);for(const t of C_.values())Bh(t,n);return!0}function kr(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function Xe(n){return n==null?!1:n.settings!==void 0}/**
272 * @license
273 * Copyright 2019 Google LLC
274 *
275 * Licensed under the Apache License, Version 2.0 (the "License");
276 * you may not use this file except in compliance with the License.
277 * You may obtain a copy of the License at
278 *
279 *   http://www.apache.org/licenses/LICENSE-2.0
280 *
281 * Unless required by applicable law or agreed to in writing, software
282 * distributed under the License is distributed on an "AS IS" BASIS,
283 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
284 * See the License for the specific language governing permissions and
285 * limitations under the License.
286 */const p_={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different {$mismatchedParam}. Existing: '{$oldValue}'. New: '{$newValue}'.","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invali
286d-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},on=new Lr("app","Firebase",p_);/**
287 * @license
288 * Copyright 2019 Google LLC
289 *
290 * Licensed under the Apache License, Version 2.0 (the "License");
291 * you may not use this file except in compliance with the License.
292 * You may obtain a copy of the License at
293 *
294 *   http://www.apache.org/licenses/LICENSE-2.0
295 *
296 * Unless required by applicable law or agreed to in writing, software
297 * distributed under the License is distributed on an "AS IS" BASIS,
298 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
299 * See the License for the specific language governing permissions and
300 * limitations under the License.
301 */class g_{constructor(e,t,r){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Rt("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw on.create("app-deleted",{appName:this._name})}}/**
302 * @license
303 * Copyright 2019 Google LLC
304 *
305 * Licensed under the Apache License, Version 2.0 (the "License");
306 * you may not use this file except in compliance with the License.
307 * You may obtain a copy of the License at
308 *
309 *   http://www.apache.org/licenses/LICENSE-2.0
310 *
311 * Unless required by applicable law or agreed to in writing, software
312 * distributed under the License is distributed on an "AS IS" BASIS,
313 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
314 * See the License for the specific language governing permissions and
315 * limitations under the License.
316 */const Vr=f_;function m_(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r={name:ZB,automaticDataCollectionEnabled:!0,...e},s=r.name;if(typeof s!="string"||!s)throw on.create("bad-app-name",{appName:String(s)});if(t||(t=Td()),!t)throw on.create("no-options");const i=Ho.get(s);if(i)if(Ar(t,i.options)){if(Ar(r,i.config))return i;throw on.create("duplicate-app",{appName:s,mismatchedParam:"config",oldValue:JSON.stringify(i.config),newValue:JSON.stringify(r)})}else throw on.create("duplicate-app",{appName:s,mismatchedParam:"options",oldValue:JSON.stringify(i.options),newValue:JSON.stringify(t)});const o=new IE(s);for(const c of ec.values())o.addComponent(c);const B=new g_(t,r,o);return Ho.set(s,B),B}function ga(n=ZB){const e=Ho.get(n);if(!e&&n===ZB&&Td())return m_();if(!e)throw on.create("no-app",{appName:n});return e}function Ze(n,e,t){let r=d_[n]??n;t&&(r+=`-${t}`);const s=r.match(/\s|\//),i=e.match(/\s|\//);if(s||i){const o=[`Unable to register library "${r}" with version "${e}":`];s&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&i&&o.push("and"),i&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),pn.warn(o.join(" "));return}Ot(new Rt(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/**
317 * @license
318 * Copyright 2021 Google LLC
319 *
320 * Licensed under the Apache License, Version 2.0 (the "License");
321 * you may not use this file except in compliance with the License.
322 * You may obtain a copy of the License at
323 *
324 *   http://www.apache.org/licenses/LICENSE-2.0
325 *
326 * Unless required by applicable law or agreed to in writing, software
327 * distributed under the License is distributed on an "AS IS" BASIS,
328 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
329 * See the License for the specific language governing permissions and
330 * limitations under the License.
331 */const E_="firebase-heartbeat-database",__=1,di="firebase-heartbeat-store";let vB=null;function Od(){return vB||(vB=pa(E_,__,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(di)}catch(t){console.warn(t)}}}}).catch(n=>{throw on.create("idb-open",{originalErrorMessage:n.message})})),vB}async function D_(n){try{const t=(await Od()).transaction(di),r=await t.objectStore(di).get(Nd(n));return await t.done,r}catch(e){if(e instanceof kt)pn.warn(e.message);else{const t=on.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});pn.warn(t.message)}}}async function ch(n,e){try{const r=(await Od()).transaction(di,"readwrite");await r.objectStore(di).put(e,Nd(n)),await r.done}catch(t){if(t instanceof kt)pn.warn(t.message);else{const r=on.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});pn.warn(r.message)}}}function Nd(n){return`${n.name}!${n.options.appId}`}/**
332 * @license
333 * Copyright 2021 Google LLC
334 *
335 * Licensed under the Apache License, Version 2.0 (the "License");
336 * you may not use this file except in compliance with the License.
337 * You may obtain a copy of the License at
338 *
339 *   http://www.apache.org/licenses/LICENSE-2.0
340 *
341 * Unless required by applicable law or agreed to in writing, software
342 * distributed under the License is distributed on an "AS IS" BASIS,
343 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
344 * See the License for the specific language governing permissions and
345 * limitations under the License.
346 */const w_=1024,y_=30;class I_{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new A_(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=uh();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(o=>o.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats.length>y_){const o=R_(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){pn.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const t=uh(),{heartbeatsToSend:r,unsentEntries:s}=T_(this._heartbeatsCache.heartbeats),i=Uo(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(t){return pn.warn(t),""}}}function uh(){return new Date().toISOString().substring(0,10)}function T_(n,e=w_){const t=[];let r=n.slice();for(const s of n){const i=t.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),lh(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),lh(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class A_{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return vd()?bd().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await D_(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return ch(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return ch(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function lh(n){return Uo(JSON.stringify({version:2,heartbeats:n})).length}function R_(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let r=1;r<n.length;r++)n[r].date<t&&(t=n[r].date,e=r);return e}/**
347 * @license
348 * Copyright 2019 Google LLC
349 *
350 * Licensed under the Apache License, Version 2.0 (the "License");
351 * you may not use this file except in compliance with the License.
352 * You may obtain a copy of the License at
353 *
354 *   http://www.apache.org/licenses/LICENSE-2.0
355 *
356 * Unless required by applicable law or agreed to in writing, software
357 * distributed under the License is distributed on an "AS IS" BASIS,
358 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
359 * See the License for the specific language governing permissions and
360 * limitations under the License.
361 */function v_(n){Ot(new Rt("platform-logger",e=>new ME(e),"PRIVATE")),Ot(new Rt("heartbeat",e=>new I_(e),"PRIVATE")),Ze(XB,ah,n),Ze(XB,ah,"esm2020"),Ze("fire-js","")}/**
362 * @license
363 * Copyright 2019 Google LLC
364 *
365 * Licensed under the Apache License, Version 2.0 (the "License");
366 * you may not use this file except in compliance with the License.
367 * You may obtain a copy of the License at
368 *
369 *   http://www.apache.org/licenses/LICENSE-2.0
370 *
371 * Unless required by applicable law or agreed to in writing, software
372 * distributed under the License is distributed on an "AS IS" BASIS,
373 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
374 * See the License for the specific language governing permissions and
375 * limitations under the License.
376 */v_("");var b_="firebase",S_="12.19.0";/**
377 * @license
378 * Copyright 2020 Google LLC
379 *
380 * Licensed under the Apache License, Version 2.0 (the "License");
381 * you may not use this file except in compliance with the License.
382 * You may obtain a copy of the License at
383 *
384 *   http://www.apache.org/licenses/LICENSE-2.0
385 *
386 * Unless required by applicable law or agreed to in writing, software
387 * distributed under the License is distributed on an "AS IS" BASIS,
388 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
389 * See the License for the specific language governing permissions and
390 * limitations under the License.
391 */Ze(b_,S_,"app");function Fd(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const P_=Fd,Ld=new Lr("auth","Firebase",Fd());/**
392 * @license
393 * Copyright 2020 Google LLC
394 *
395 * Licensed under the Apache License, Version 2.0 (the "License");
396 * you may not use this file except in compliance with the License.
397 * You may obtain a copy of the License at
398 *
399 *   http://www.apache.org/licenses/LICENSE-2.0
400 *
401 * Unless required by applicable law or agreed to in writing, software
402 * distributed under the License is distributed on an "AS IS" BASIS,
403 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
404 * See the License for the specific language governing permissions and
405 * limitations under the License.
406 */const qo=new bc("@firebase/auth");function vo(n,...e){qo.logLevel<=ce.WARN&&qo.warn(`Auth (${Vr}): ${n}`,...e)}function bo(n,...e){qo.logLevel<=ce.ERROR&&qo.error(`Auth (${Vr}): ${n}`,...e)}/**
407 * @license
408 * Copyright 2020 Google LLC
409 *
410 * Licensed under the Apache License, Version 2.0 (the "License");
411 * you may not use this file except in compliance with the License.
412 * You may obtain a copy of the License at
413 *
414 *   http://www.apache.org/licenses/LICENSE-2.0
415 *
416 * Unless required by applicable law or agreed to in writing, software
417 * distributed under the License is distributed on an "AS IS" BASIS,
418 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
419 * See the License for the specific language governing permissions and
420 * limitations under the License.
421 */function Nt(n,...e){throw Pc(n,...e)}function Pt(n,...e){return Pc(n,...e)}function ma(n,e,t){const r={...P_(),[e]:t};return new Lr("auth","Firebase",r).create(e,{appName:n.name})}function hn(n){return ma(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function kd(n,e,t){const r=t;if(!(e instanceof r))throw r.name!==e.constructor.name&&Nt(n,"argument-error"),ma(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}
421function Pc(n,...e){if(typeof n!="string"){const t=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=n.name),n._errorFactory.create(t,...r)}return Ld.create(n,...e)}function te(n,e,...t){if(!n)throw Pc(e,...t)}function an(n){const e="INTERNAL ASSERTION FAILED: "+n;throw bo(e),new Error(e)}function gn(n,e){n||an(e)}/**
422 * @license
423 * Copyright 2020 Google LLC
424 *
425 * Licensed under the Apache License, Version 2.0 (the "License");
426 * you may not use this file except in compliance with the License.
427 * You may obtain a copy of the License at
428 *
429 *   http://www.apache.org/licenses/LICENSE-2.0
430 *
431 * Unless required by applicable law or agreed to in writing, software
432 * distributed under the License is distributed on an "AS IS" BASIS,
433 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
434 * See the License for the specific language governing permissions and
435 * limitations under the License.
436 */function tc(){var n;return typeof self<"u"&&((n=self.location)==null?void 0:n.href)||""}function O_(){return hh()==="http:"||hh()==="https:"}function hh(){var n;return typeof self<"u"&&((n=self.location)==null?void 0:n.protocol)||null}/**
437 * @license
438 * Copyright 2020 Google LLC
439 *
440 * Licensed under the Apache License, Version 2.0 (the "License");
441 * you may not use this file except in compliance with the License.
442 * You may obtain a copy of the License at
443 *
444 *   http://www.apache.org/licenses/LICENSE-2.0
445 *
446 * Unless required by applicable law or agreed to in writing, software
447 * distributed under the License is distributed on an "AS IS" BASIS,
448 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
449 * See the License for the specific language governing permissions and
450 * limitations under the License.
451 */function N_(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(O_()||uE()||"connection"in navigator)?navigator.onLine:!0}function F_(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
452 * @license
453 * Copyright 2020 Google LLC
454 *
455 * Licensed under the Apache License, Version 2.0 (the "License");
456 * you may not use this file except in compliance with the License.
457 * You may obtain a copy of the License at
458 *
459 *   http://www.apache.org/licenses/LICENSE-2.0
460 *
461 * Unless required by applicable law or agreed to in writing, software
462 * distributed under the License is distributed on an "AS IS" BASIS,
463 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
464 * See the License for the specific language governing permissions and
465 * limitations under the License.
466 */class Ni{constructor(e,t){this.shortDelay=e,this.longDelay=t,gn(t>e,"Short delay should be less than long delay!"),this.isMobile=aE()||lE()}get(){return N_()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
467 * @license
468 * Copyright 2020 Google LLC
469 *
470 * Licensed under the Apache License, Version 2.0 (the "License");
471 * you may not use this file except in compliance with the License.
472 * You may obtain a copy of the License at
473 *
474 *   http://www.apache.org/licenses/LICENSE-2.0
475 *
476 * Unless required by applicable law or agreed to in writing, software
477 * distributed under the License is distributed on an "AS IS" BASIS,
478 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
479 * See the License for the specific language governing permissions and
480 * limitations under the License.
481 */function Oc(n,e){gn(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
482 * @license
483 * Copyright 2020 Google LLC
484 *
485 * Licensed under the Apache License, Version 2.0 (the "License");
486 * you may not use this file except in compliance with the License.
487 * You may obtain a copy of the License at
488 *
489 *   http://www.apache.org/licenses/LICENSE-2.0
490 *
491 * Unless required by applicable law or agreed to in writing, software
492 * distributed under the License is distributed on an "AS IS" BASIS,
493 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
494 * See the License for the specific language governing permissions and
495 * limitations under the License.
496 */class Vd{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;an("Could not find fetch implementation, make sure you call FetchProvi
496der.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;an("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;an("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
497 * @license
498 * Copyright 2020 Google LLC
499 *
500 * Licensed under the Apache License, Version 2.0 (the "License");
501 * you may not use this file except in compliance with the License.
502 * You may obtain a copy of the License at
503 *
504 *   http://www.apache.org/licenses/LICENSE-2.0
505 *
506 * Unless required by applicable law or agreed to in writing, software
507 * distributed under the License is distributed on an "AS IS" BASIS,
508 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
509 * See the License for the specific language governing permissions and
510 * limitations under the License.
511 */const L_={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
512 * @license
513 * Copyright 2020 Google LLC
514 *
515 * Licensed under the Apache License, Version 2.0 (the "License");
516 * you may not use this file except in compliance with the License.
517 * You may obtain a copy of the License at
518 *
519 *   http://www.apache.org/licenses/LICENSE-2.0
520 *
521 * Unless required by applicable law or agreed to in writing, software
522 * distributed under the License is distributed on an "AS IS" BASIS,
523 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
524 * See the License for the specific language governing permissions and
525 * limitations under the License.
526 */const k_=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],V_=new Ni(3e4,6e4);function Dn(n,e){return n.tenantId&&!e.tenantId?{...e,tenantId:n.tenantId}:e}async function wn(n,e,t,r,s={}){return xd(n,s,async()=>{let i={},o={};r&&(e==="GET"?o=r:i={body:JSON.stringify(r)});
526const B=Oi({...o,key:n.config.apiKey}).slice(1),c=await n._getAdditionalHeaders();c["Content-Type"]="application/json",n.languageCode&&(c["X-Firebase-Locale"]=n.languageCode);const u={method:e,headers:c,...i};return cE()||(u.referrerPolicy="strict-origin-when-cross-origin"),n.emulatorConfig&&sr(n.emulatorConfig.host)&&(u.credentials="include"),Vd.fetch()(await Md(n,n.config.apiHost,t,B),u)})}async function xd(n,e,t){n._canInitEmulator=!1;const r={...L_,...e};try{const s=new M_(n),i=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw ho(n,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const B=i.ok?o.errorMessage:o.error.message,[c,u]=B.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ho(n,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ho(n,"email-already-in-use",o);if(c==="USER_DISABLED")throw ho(n,"user-disabled",o);const h=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw ma(n,h,u);Nt(n,h)}}catch(s){if(s instanceof kt)throw s;Nt(n,"network-request-failed",{message:String(s)})}}async function Fi(n,e,t,r,s={}){const i=await wn(n,e,t,r,s);return"mfaPendingCredential"in i&&Nt(n,"multi-factor-auth-required",{_serverResponse:i}),i}async function Md(n,e,t,r){const s=`${e}${t}?${r}`,i=n,o=i.config.emulator?Oc(n.config,s):`${n.config.apiScheme}://${s}`;return k_.includes(t)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(o).toString():o}function x_(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class M_{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(Pt(this.auth,"network-request-failed")),V_.get())})}}function ho(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const s=Pt(n,e,r);return s.customData._tokenResponse=t,s}function fh(n){return n!==void 0&&n.enterprise!==void 0}class G_{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return x_(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function U_(n,e){return wn(n,"GET","/v2/recaptchaConfig",Dn(n,e))}/**
527 * @license
528 * Copyright 2020 Google LLC
529 *
530 * Licensed under the Apache License, Version 2.0 (the "License");
531 * you may not use this file except in compliance with the License.
532 * You may obtain a copy of the License at
533 *
534 *   http://www.apache.org/licenses/LICENSE-2.0
535 *
536 * Unless required by applicable law or agreed to in writing, software
537 * distributed under the License is distributed on an "AS IS" BASIS,
538 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
539 * See the License for the specific language governing permissions and
540 * limitations under the License.
541 */async function H_(n,e){return wn(n,"POST","/v1/accounts:delete",e)}async function Jo(n,e){return wn(n,"POST","/v1/accounts:lookup",e)}/**
542 * @license
543 * Copyright 2020 Google LLC
544 *
545 * Licensed under the Apache License, Version 2.0 (the "License");
546 * you may not use this file except in compliance with the License.
547 * You may obtain a copy of the License at
548 *
549 *   http://www.apache.org/licenses/LICENSE-2.0
550 *
551 * Unless required by applicable law or agreed to in writing, software
552 * distributed under the License is distributed on an "AS IS" BASIS,
553 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
554 * See the License for the specific language governing permissions and
555 * limitations under the License.
556 */function ri(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function q_(n,e=!1){const t=fe(n),r=await t.getIdToken(e),s=Ea(r);te(s&&s.exp&&s.auth_time&&s.iat,t.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,o=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:ri(bB(s.auth_time)),issuedAtTime:ri(bB(s.iat)),expirationTime:ri(bB(s.exp
556)),signInProvider:o||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function bB(n){return Number(n)*1e3}function Ea(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return bo("JWT malformed, contained fewer than 3 sections"),null;try{const s=Id(t);return s?JSON.parse(s):(bo("Failed to decode base64 JWT payload"),null)}catch(s){return bo("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function dh(n){const e=Ea(n);return te(e,"internal-error"),te(typeof e.exp<"u","internal-error"),te(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
557 * @license
558 * Copyright 2020 Google LLC
559 *
560 * Licensed under the Apache License, Version 2.0 (the "License");
561 * you may not use this file except in compliance with the License.
562 * You may obtain a copy of the License at
563 *
564 *   http://www.apache.org/licenses/LICENSE-2.0
565 *
566 * Unless required by applicable law or agreed to in writing, software
567 * distributed under the License is distributed on an "AS IS" BASIS,
568 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
569 * See the License for the specific language governing permissions and
570 * limitations under the License.
571 */async function Ci(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof kt&&J_(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function J_({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
572 * @license
573 * Copyright 2020 Google LLC
574 *
575 * Licensed under the Apache License, Version 2.0 (the "License");
576 * you may not use this file except in compliance with the License.
577 * You may obtain a copy of the License at
578 *
579 *   http://www.apache.org/licenses/LICENSE-2.0
580 *
581 * Unless required by applicable law or agreed to in writing, software
582 * distributed under the License is distributed on an "AS IS" BASIS,
583 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
584 * See the License for the specific language governing permissions and
585 * limitations under the License.
586 */class j_{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
587 * @license
588 * Copyright 2020 Google LLC
589 *
590 * Licensed under the Apache License, Version 2.0 (the "License");
591 * you may not use this file except in compliance with the License.
592 * You may obtain a copy of the License at
593 *
594 *   http://www.apache.org/licenses/LICENSE-2.0
595 *
596 * Unless required by applicable law or agreed to in writing, software
597 * distributed under the License is distributed on an "AS IS" BASIS,
598 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
599 * See the License for the specific language governing permissions and
600 * limitations under the License.
601 */class nc{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=ri(this.lastLoginAt),this.creationTime=ri(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
602 * @license
603 * Copyright 2019 Google LLC
604 *
605 * Licensed under the Apache License, Version 2.0 (the "License");
606 * you may not use this file except in compliance with the License.
607 * You may obtain a copy of the License at
608 *
609 *   http://www.apache.org/licenses/LICENSE-2.0
610 *
611 * Unless required by applicable law or agreed to in writing, softw
611are
612 * distributed under the License is distributed on an "AS IS" BASIS,
613 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
614 * See the License for the specific language governing permissions and
615 * limitations under the License.
616 */async function jo(n){var d;const e=n.auth,t=await n.getIdToken(),r=await Ci(n,Jo(e,{idToken:t}));te(r==null?void 0:r.users.length,e,"internal-error");const s=r.users[0];n._notifyReloadListener(s);const i=(d=s.providerUserInfo)!=null&&d.length?Gd(s.providerUserInfo):[],o=z_(n.providerData,i),B=n.isAnonymous,c=!(n.email&&s.passwordHash)&&!(o!=null&&o.length),u=B?c:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new nc(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(n,h)}async function K_(n){const e=fe(n);await jo(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function z_(n,e){return[...n.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function Gd(n){return n.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}/**
617 * @license
618 * Copyright 2020 Google LLC
619 *
620 * Licensed under the Apache License, Version 2.0 (the "License");
621 * you may not use this file except in compliance with the License.
622 * You may obtain a copy of the License at
623 *
624 *   http://www.apache.org/licenses/LICENSE-2.0
625 *
626 * Unless required by applicable law or agreed to in writing, software
627 * distributed under the License is distributed on an "AS IS" BASIS,
628 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
629 * See the License for the specific language governing permissions and
630 * limitations under the License.
631 */async function W_(n,e){const t=await xd(n,{},async()=>{const r=Oi({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=n.config,o=await Md(n,s,"/v1/token",`key=${i}`),B=await n._getAdditionalHeaders();B["Content-Type"]="application/x-www-form-urlencoded";const c={method:"POST",headers:B,body:r};return n.emulatorConfig&&sr(n.emulatorConfig.host)&&(c.credentials="include"),Vd.fetch()(o,c)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function $_(n,e){return wn(n,"POST","/v2/accounts:revokeToken",Dn(n,e))}/**
632 * @license
633 * Copyright 2020 Google LLC
634 *
635 * Licensed under the Apache License, Version 2.0 (the "License");
636 * you may not use this file except in compliance with the License.
637 * You may obtain a copy of the License at
638 *
639 *   http://www.apache.org/licenses/LICENSE-2.0
640 *
641 * Unless required by applicable law or agreed to in writing, software
642 * distributed under the License is distributed on an "AS IS" BASIS,
643 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
644 * See the License for the specific language governing permissions and
645 * limitations under the License.
646 */class ts{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){te(e.idToken,"internal-error"),te(typeof e.idToken<"u","internal-error"),te(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):dh(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){te(e.length!==0,"internal-error");const t=dh(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(te(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:s,expiresIn:i}=await W_(e,t);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,t){const{refreshToken:r,accessToken:s,expirationTime:i}=t,o=new ts;return r&&(te(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),s&&(te(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),i&&(te(typeof i=="number","internal-error",{appName:e}),o.expirationTime=i),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new ts,this.toJSON())}_performRefresh(){return an("not implemented")}}/**
647 * @license
648 * Copyright 2020 Google LLC
649 *
650 * Licensed under the Apache License, Version 2.0 (the "License");
651 * you may not use this file except in compliance with the License.
652 * You may obtain a copy of the License at
653 *
654 *   http://www.apache.org/licenses/LICENSE-2.0
655 *
656 * Unless required by applicable law or agreed to in writing, software
657 * distributed under the License is distributed on an "AS IS" BASIS,
658 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
659 * See the License for the specific language governing permissions and
660 * limitations under the License.
661 */function Sn(n,e){te(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class xt{constructor({uid:e,auth:t,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new j_(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new nc(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await Ci(this,this.stsTokenManager.getToken(this.auth,e));return te(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return q_(this,e)}reload(){return K_(this)}_assign(e){this!==e&&(te(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>({...t})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new xt({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){te(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await jo(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Xe(this.auth.app))return Promise.reject(hn(this.auth));const e=await this.getIdToken();return await Ci(this,H_(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){const r=t.displayName??void 0,s=t.email??void 0,i=t.phoneNumber??void 0,o=t.photoURL??void 0,B=t.tenantId??void 0,c=t._redirectEventId??void 0,u=t.createdAt??void 0,h=t.lastLoginAt??void 0,{uid:d,emailVerified:p,isAnonymous:_,providerData:y,stsTokenManager:O}=t;te(d&&O,e,"internal-error");const V=ts.fromJSON(this.name,O);te(typeof d=="string",e,"internal-error"),Sn(r,e.name),Sn(s,e.name),te(typeof p=="boolean",e,"internal-error"),te(typeof _=="boolean",e,"internal-error"),Sn(i,e.name),Sn(o,e.name),Sn(B,e.name),Sn(c,e.name),Sn(u,e.name),Sn(h,e.name);const j=new xt({uid:d,auth:e,email:s,emailVerified:p,displayName:r,isAnonymous:_,photoURL:o,phoneNumber:i,tenantId:B,stsTokenManager:V,createdAt:u,lastLoginAt:h});return y&&Array.isArray(y)&&(j.providerData=y.map(ee=>({...ee}))),c&&(j._redirectEventId=c),j}static async _fromIdTokenResponse(e,t,r=!1){const s=new ts;s.updateFromServerResponse(t);const i=new xt({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await jo(i),i}static async _fromGetAccountInfoResponse(e,t,r){const s=t.users[0];
661te(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?Gd(s.providerUserInfo):[],o=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),B=new ts;B.updateFromIdToken(r);const c=new xt({uid:s.localId,auth:e,stsTokenManager:B,isAnonymous:o}),u={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new nc(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(c,u),c}}/**
662 * @license
663 * Copyright 2020 Google LLC
664 *
665 * Licensed under the Apache License, Version 2.0 (the "License");
666 * you may not use this file except in compliance with the License.
667 * You may obtain a copy of the License at
668 *
669 *   http://www.apache.org/licenses/LICENSE-2.0
670 *
671 * Unless required by applicable law or agreed to in writing, software
672 * distributed under the License is distributed on an "AS IS" BASIS,
673 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
674 * See the License for the specific language governing permissions and
675 * limitations under the License.
676 */const Ch=new Map;function Bn(n){gn(n instanceof Function,"Expected a class definition");let e=Ch.get(n);return e?(gn(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,Ch.set(n,e),e)}/**
677 * @license
678 * Copyright 2019 Google LLC
679 *
680 * Licensed under the Apache License, Version 2.0 (the "License");
681 * you may not use this file except in compliance with the License.
682 * You may obtain a copy of the License at
683 *
684 *   http://www.apache.org/licenses/LICENSE-2.0
685 *
686 * Unless required by applicable law or agreed to in writing, software
687 * distributed under the License is distributed on an "AS IS" BASIS,
688 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
689 * See the License for the specific language governing permissions and
690 * limitations under the License.
691 */class Ud{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}Ud.type="NONE";const ph=Ud;/**
692 * @license
693 * Copyright 2019 Google LLC
694 *
695 * Licensed under the Apache License, Version 2.0 (the "License");
696 * you may not use this file except in compliance with the License.
697 * You may obtain a copy of the License at
698 *
699 *   http://www.apache.org/licenses/LICENSE-2.0
700 *
701 * Unless required by applicable law or agreed to in writing, software
702 * distributed under the License is distributed on an "AS IS" BASIS,
703 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
704 * See the License for the specific language governing permissions and
705 * limitations under the License.
706 */function So(n,e,t){return`firebase:${n}:${e}:${t}`}class Dr{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=So(this.userKey,s.apiKey,i),this.fullPersistenceKey=So("persistence",s.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t);try{this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}catch{}}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const t=await Jo(this.auth,{idToken:e}).catch(()=>{});return t?xt._fromGetAccountInfoResponse(this.auth,t,e):null}return xt._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){try{this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}catch{}}static async create(e,t,r="authUser"){if(!t.length)return new Dr(Bn(ph),e,r);const s=(await Promise.all(t.map(async u=>{try{if(await u._isAvailable())return u}catch{return}}))).filter(u=>u);let i=s[0]||Bn(ph);const o=So(r,e.config.apiKey,e.name);let B=null;for(const u of t)try{const h=await u._get(o);if(h){let d;if(typeof h=="string"){const p=await Jo(e,{idToken:h}).catch(()=>{});if(!p)break;d=await xt._fromGetAccountInfoResponse(e,p,h)}else d=xt._fromJSON(e,h);u!==i&&(B=d),i=u;break}}catch{}const c=s.filter(u=>u._shouldAllowMigration);return!i._shouldAllowMigration||!c.length?new Dr(i,e,r):(i=c[0],B&&await i._set(o,B.toJSON()),await Promise.all(t.map(async u=>
706{if(u!==i)try{await u._remove(o)}catch{}})),new Dr(i,e,r))}}/**
707 * @license
708 * Copyright 2020 Google LLC
709 *
710 * Licensed under the Apache License, Version 2.0 (the "License");
711 * you may not use this file except in compliance with the License.
712 * You may obtain a copy of the License at
713 *
714 *   http://www.apache.org/licenses/LICENSE-2.0
715 *
716 * Unless required by applicable law or agreed to in writing, software
717 * distributed under the License is distributed on an "AS IS" BASIS,
718 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
719 * See the License for the specific language governing permissions and
720 * limitations under the License.
721 */function gh(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(jd(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Hd(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(zd(e))return"Blackberry";if(Wd(e))return"Webos";if(qd(e))return"Safari";if((e.includes("chrome/")||Jd(e))&&!e.includes("edge/"))return"Chrome";if(Kd(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=n.match(t);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function Hd(n=et()){return/firefox\//i.test(n)}function qd(n=et()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Jd(n=et()){return/crios\//i.test(n)}function jd(n=et()){return/iemobile/i.test(n)}function Kd(n=et()){return/android/i.test(n)}function zd(n=et()){return/blackberry/i.test(n)}function Wd(n=et()){return/webos/i.test(n)}function Nc(n=et()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Q_(n=et()){var e;return Nc(n)&&!!((e=window.navigator)!=null&&e.standalone)}function Y_(){return hE()&&document.documentMode===10}function $d(n=et()){return Nc(n)||Kd(n)||Wd(n)||zd(n)||/windows phone/i.test(n)||jd(n)}/**
722 * @license
723 * Copyright 2020 Google LLC
724 *
725 * Licensed under the Apache License, Version 2.0 (the "License");
726 * you may not use this file except in compliance with the License.
727 * You may obtain a copy of the License at
728 *
729 *   http://www.apache.org/licenses/LICENSE-2.0
730 *
731 * Unless required by applicable law or agreed to in writing, software
732 * distributed under the License is distributed on an "AS IS" BASIS,
733 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
734 * See the License for the specific language governing permissions and
735 * limitations under the License.
736 */function Qd(n,e=[]){let t;switch(n){case"Browser":t=gh(et());break;case"Worker":t=`${gh(et())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${Vr}/${r}`}/**
737 * @license
738 * Copyright 2022 Google LLC
739 *
740 * Licensed under the Apache License, Version 2.0 (the "License");
741 * you may not use this file except in compliance with the License.
742 * You may obtain a copy of the License at
743 *
744 *   http://www.apache.org/licenses/LICENSE-2.0
745 *
746 * Unless required by applicable law or agreed to in writing, software
747 * distributed under the License is distributed on an "AS IS" BASIS,
748 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
749 * See the License for the specific language governing permissions and
750 * limitations under the License.
751 */class X_{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=i=>new Promise((o,B)=>{try{const c=e(i);o(c)}catch(c){B(c)}});r.onAbort=t,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(r){t.reverse();for(const s of t)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
752 * @license
753 * Copyright 2023 Google LLC
754 *
755 * Licensed under the Apache License, Version 2.0 (the "License");
756 * you may not use this file except in compliance with the License.
757 * You may obtain a copy of the License at
758 *
759 *   http://www.apache.org/licenses/LICENSE-2.0
760 *
761 * Unless required by applicable law or agreed to in writing, softw
761are
762 * distributed under the License is distributed on an "AS IS" BASIS,
763 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
764 * See the License for the specific language governing permissions and
765 * limitations under the License.
766 */async function Z_(n,e={}){return wn(n,"GET","/v2/passwordPolicy",Dn(n,e))}/**
767 * @license
768 * Copyright 2023 Google LLC
769 *
770 * Licensed under the Apache License, Version 2.0 (the "License");
771 * you may not use this file except in compliance with the License.
772 * You may obtain a copy of the License at
773 *
774 *   http://www.apache.org/licenses/LICENSE-2.0
775 *
776 * Unless required by applicable law or agreed to in writing, software
777 * distributed under the License is distributed on an "AS IS" BASIS,
778 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
779 * See the License for the specific language governing permissions and
780 * limitations under the License.
781 */const eD=6;class tD{constructor(e){var r;const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??eD,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=e.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),s&&(t.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let r;for(let s=0;s<e.length;s++)r=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/**
782 * @license
783 * Copyright 2020 Google LLC
784 *
785 * Licensed under the Apache License, Version 2.0 (the "License");
786 * you may not use this file except in compliance with the License.
787 * You may obtain a copy of the License at
788 *
789 *   http://www.apache.org/licenses/LICENSE-2.0
790 *
791 * Unless required by applicable law or agreed to in writing, software
792 * distributed under the License is distributed on an "AS IS" BASIS,
793 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
794 * See the License for the specific language governing permissions and
795 * limitations under the License.
796 */class nD{constructor(e,t,r,s){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new mh(this),this.idTokenSubscription=new mh(this),this.beforeStateQueue=new X_(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Ld,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=Bn(t)),this._initializationPromise=this.queue(async()=>{var r,s,i;if(!this._deleted){try{this.persistenceManager=await Dr.create(this,e)}catch(o){vo(`Failed to initialize persistence: ${o}`),this.persistenceManager=await Dr.create(this,[])}finally{(r=this._resolvePersistenceManagerAvailable)==null||r.call(this)}if(!this._deleted){if((s=this._popupRedirectResolver)!=null&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}try{await this.initializeCurrentUser(t)}catch(o){vo(`Failed to initialize current user: ${o}
796`),await this.directlySetCurrentUser(null).catch(()=>{})}this.lastNotifiedUid=((i=this.currentUser)==null?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const t=await Jo(this,{idToken:e}),r=await xt._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var i;if(Xe(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(B=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(B,B))}):this.directlySetCurrentUser(null)}const t=await this.assertedPersistence.getCurrentUser();let r=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(i=this.redirectUser)==null?void 0:i._redirectEventId,B=r==null?void 0:r._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===B)&&(c!=null&&c.user)&&(r=c.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return te(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await jo(e)}catch(t){if((t==null?void 0:t.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=F_()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Xe(this.app))return Promise.reject(hn(this));const t=e?fe(e):null;return t&&te(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&te(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Xe(this.app)?Promise.reject(hn(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Xe(this.app)?Promise.reject(hn(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Bn(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await Z_(this),t=new tD(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Lr("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>
796{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(r.tenantId=this.tenantId),await $_(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?void 0:e.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&Bn(e)||this._popupRedirectResolver;te(t,this,"argument-error"),this.redirectPersistenceManager=await Dr.create(this,[Bn(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,r;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)==null?void 0:t._redirectEventId)===e?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((t=this.currentUser)==null?void 0:t.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,s){if(this._deleted)return()=>{};const i=typeof t=="function"?t:t.next.bind(t);let o=!1;const B=this._isInitialized?Promise.resolve():this._initializationPromise;if(te(B,this,"internal-error"),B.then(()=>{o||i(this.currentUser)}).catch(c=>{if(!o)if(typeof t!="function"&&t.error)t.error(c);else if(r)r(c);else throw c}),typeof t=="function"){const c=e.addObserver(t,r,s);return()=>{o=!0,c()}}else{const c=e.addObserver(t);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){if(this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,this.persistenceManager)try{e?await this.persistenceManager.setCurrentUser(e):await this.persistenceManager.removeCurrentUser()}catch(t){const r=(t==null?void 0:t.message)||String(t),s=ma(this,"internal-error",`An internal AuthError has occurred: ${r}`);throw s.customData={originalError:t},s}}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return te(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Qd(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var s;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const t=await((s=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:s.getHeartbeatsHeader());t&&(e["X-Firebase-Client"]=t);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;if(Xe(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((t=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:t.getToken());return e!=null&&e.error&&vo(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function yn(n){return fe(n)}class mh{constructor(e){this.auth=e,this.observer=null,this.addObserver=mE(t=>this.observer=t)}get next(){return te(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
797 * @license
798 * Copyright 2020 Google LLC
799 *
800 * Licensed under the Apache License, Version 2.0 (the "License");
801 * you may not use this file except in compliance with the License.
802 * You may obtain a copy of the License at
803 *
804 *   http://www.apache.org/licenses/LICENSE-2.0
805 *
806 * Unless required by applicable law or agreed to in writing, software
807 * distributed under the License is distributed on an "AS IS" BASIS,
808 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
809 * See the License for the specific language governing permissions and
810 * limitations under the License.
811 */let _a={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function rD(n){_a=n}function Yd(n){return _a.loadJS(n)}function sD(){return _a.recaptchaEnterpriseScript}function iD(){return _a.gapiScript}function oD(n){return`__${n}${Math.floor(Math.random()*1e6)}`}class aD{constructor(){this.enterprise=new BD}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class BD{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}/**
812 * @license
813 * Copyright 2022 Google LLC
814 *
815 * Licensed under the Apache License, Version 2.0 (the "License");
816 * you may not use this file except in compliance with the License.
817 * You may obtain a copy of the License at
818 *
819 *   http://www.apache.org/licenses/LICENSE-2.0
820 *
821 * Unless required by applicable law or agreed to in writing, software
822 * distributed under the License is distributed on an "AS IS" BASIS,
823 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
824 * See the License for the specific language governing permissions and
825 * limitations under the License.
826 */const cD="recaptcha-enterprise",Xd="NO_RECAPTCHA",Eh="onFirebaseAuthREInstanceReady";class Fn{constructor(e){this.type=cD,this.auth=yn(e)}async verify(e="verify",t=!1){async function r(i){if(!t){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(o,B)=>{U_(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)B(new Error("recaptcha Enterprise site key undefined"));else{const u=new G_(c);return i.tenantId==null?i._agentRecaptchaConfig=u:i._tenantRecaptchaConfigs[i.tenantId]=u,o(u.siteKey)}}).catch(c=>{B(c)})})}function s(i,o,B){const c=window.grecaptcha;fh(c)?c.enterprise.ready(()=>{c.enterprise.execute(i,{action:e}).then(u=>{o(u)}).catch(()=>{o(Xd)})}):B(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new aD().execute("siteKey",{action:"verify"}):new Promise((i,o)=>{r(this.auth).then(async B=>{if(!t&&fh(window.grecaptcha)&&Fn.scriptInjectionDeferred)await Fn.scriptInjectionDeferred.promise,s(B,i,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=sD();c.length!==0&&(c+=B+`&onload=${Eh}`),Fn.scriptInjectionDeferred=new Ad,window[Eh]=()=>{var u;(u=Fn.scriptInjectionDeferred)==null||u.resolve()},Yd(c).then(()=>{var u;return(u=Fn.scriptInjectionDeferred)==null?void 0:u.promise}).then(()=>{s(B,i,o)}).catch(u=>{o(u)})}}).catch(B=>{o(B)})})}}Fn.scriptInjectionDeferred=null;async function _h(n,e,t,r=!1,s=!1){const i=new Fn(n);let o;if(s)o=Xd;else try{o=await i.verify(t)}catch{o=await i.verify(t,!0)}const B={...e};if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in B){const c=B.phoneEnrollmentInfo.phoneNumber,u=B.phoneEnrollmentInfo.recaptchaToken;Object.assign(B,{phoneEnrollmentInfo:{phoneNumber:c,recaptchaToken:u,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in B){const c=B.phoneSignInInfo.recaptchaToken;Object.assign(B,{phoneSignInInfo:{recaptchaToken:c,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return B}return r?Object.assign(B,{captchaResp:o}):Object.assign(B,{captchaResponse:o}),Object.assign(B,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(B,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),B}async function Ko(n,e,t,r,s){var i;if((i=n._getRecaptchaConfig())!=null&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const o=await _h(n,e,t,t==="getOobCode");return r(n,o)}
826else return r(n,e).catch(async o=>{if(o.code==="auth/missing-recaptcha-token"){console.log(`${t} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const B=await _h(n,e,t,t==="getOobCode");return r(n,B)}else return Promise.reject(o)})}/**
827 * @license
828 * Copyright 2020 Google LLC
829 *
830 * Licensed under the Apache License, Version 2.0 (the "License");
831 * you may not use this file except in compliance with the License.
832 * You may obtain a copy of the License at
833 *
834 *   http://www.apache.org/licenses/LICENSE-2.0
835 *
836 * Unless required by applicable law or agreed to in writing, software
837 * distributed under the License is distributed on an "AS IS" BASIS,
838 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
839 * See the License for the specific language governing permissions and
840 * limitations under the License.
841 */function hP(n,e){const t=kr(n,"auth");if(t.isInitialized()){const s=t.getImmediate(),i=t.getOptions();if(Ar(i,e??{}))return s;Nt(s,"already-initialized")}return t.initialize({options:e})}function uD(n,e){const t=(e==null?void 0:e.persistence)||[],r=(Array.isArray(t)?t:[t]).map(Bn);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}/**
842 * @license
843 * Copyright 2020 Google LLC
844 *
845 * Licensed under the Apache License, Version 2.0 (the "License");
846 * you may not use this file except in compliance with the License.
847 * You may obtain a copy of the License at
848 *
849 *   http://www.apache.org/licenses/LICENSE-2.0
850 *
851 * Unless required by applicable law or agreed to in writing, software
852 * distributed under the License is distributed on an "AS IS" BASIS,
853 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
854 * See the License for the specific language governing permissions and
855 * limitations under the License.
856 */class Fc{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return an("not implemented")}_getIdTokenResponse(e){return an("not implemented")}_linkToIdToken(e,t){return an("not implemented")}_getReauthenticationResolver(e){return an("not implemented")}}async function lD(n,e){return wn(n,"POST","/v1/accounts:signUp",e)}/**
857 * @license
858 * Copyright 2020 Google LLC
859 *
860 * Licensed under the Apache License, Version 2.0 (the "License");
861 * you may not use this file except in compliance with the License.
862 * You may obtain a copy of the License at
863 *
864 *   http://www.apache.org/licenses/LICENSE-2.0
865 *
866 * Unless required by applicable law or agreed to in writing, software
867 * distributed under the License is distributed on an "AS IS" BASIS,
868 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
869 * See the License for the specific language governing permissions and
870 * limitations under the License.
871 */async function hD(n,e){return Fi(n,"POST","/v1/accounts:signInWithPassword",Dn(n,e))}async function fD(n,e){return wn(n,"POST","/v1/accounts:sendOobCode",Dn(n,e))}async function dD(n,e){return fD(n,e)}/**
872 * @license
873 * Copyright 2020 Google LLC
874 *
875 * Licensed under the Apache License, Version 2.0 (the "License");
876 * you may not use this file except in compliance with the License.
877 * You may obtain a copy of the License at
878 *
879 *   http://www.apache.org/licenses/LICENSE-2.0
880 *
881 * Unless required by applicable law or agreed to in writing, software
882 * distributed under the License is distributed on an "AS IS" BASIS,
883 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
884 * See the License for the specific language governing permissions and
885 * limitations under the License.
886 */async function CD(n,e){return Fi(n,"POST","/v1/accounts:signInWithEmailLink",Dn(n,e))}async function pD(n,e){return Fi(n,"POST","/v1/accounts:signInWithEmailLink",Dn(n,e))}/**
887 * @license
888 * Copyright 2020 Google LLC
889 *
890 * Licensed under the Apache License, Version 2.0 (the "License");
891 * you may not use this file except in compliance with the License.
892 * You may obtain a copy of the License at
893 *
894 *   http://www.apache.org/licenses/LICENSE-2.0
895 *
896 * Unless required by applicable law or agreed to in writing, softw
896are
897 * distributed under the License is distributed on an "AS IS" BASIS,
898 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
899 * See the License for the specific language governing permissions and
900 * limitations under the License.
901 */class pi extends Fc{constructor(e,t,r,s=null){super("password",r),this._email=e,this._password=t,this._tenantId=s}static _fromEmailAndPassword(e,t){return new pi(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new pi(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;if(t!=null&&t.email&&(t!=null&&t.password)){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const t={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Ko(e,t,"signInWithPassword",hD);case"emailLink":return CD(e,{email:this._email,oobCode:this._password});default:Nt(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":const r={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Ko(e,r,"signUpPassword",lD);case"emailLink":return pD(e,{idToken:t,email:this._email,oobCode:this._password});default:Nt(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
902 * @license
903 * Copyright 2020 Google LLC
904 *
905 * Licensed under the Apache License, Version 2.0 (the "License");
906 * you may not use this file except in compliance with the License.
907 * You may obtain a copy of the License at
908 *
909 *   http://www.apache.org/licenses/LICENSE-2.0
910 *
911 * Unless required by applicable law or agreed to in writing, software
912 * distributed under the License is distributed on an "AS IS" BASIS,
913 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
914 * See the License for the specific language governing permissions and
915 * limitations under the License.
916 */async function ns(n,e){return Fi(n,"POST","/v1/accounts:signInWithIdp",Dn(n,e))}/**
917 * @license
918 * Copyright 2020 Google LLC
919 *
920 * Licensed under the Apache License, Version 2.0 (the "License");
921 * you may not use this file except in compliance with the License.
922 * You may obtain a copy of the License at
923 *
924 *   http://www.apache.org/licenses/LICENSE-2.0
925 *
926 * Unless required by applicable law or agreed to in writing, software
927 * distributed under the License is distributed on an "AS IS" BASIS,
928 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
929 * See the License for the specific language governing permissions and
930 * limitations under the License.
931 */const gD="http://localhost";class mn extends Fc{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new mn(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):Nt("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
931once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s,...i}=t;if(!r||!s)return null;const o=new mn(r,s);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return ns(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,ns(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,ns(e,t)}buildRequest(){const e={requestUri:gD,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=Oi(t)}return e}}/**
932 * @license
933 * Copyright 2020 Google LLC
934 *
935 * Licensed under the Apache License, Version 2.0 (the "License");
936 * you may not use this file except in compliance with the License.
937 * You may obtain a copy of the License at
938 *
939 *   http://www.apache.org/licenses/LICENSE-2.0
940 *
941 * Unless required by applicable law or agreed to in writing, software
942 * distributed under the License is distributed on an "AS IS" BASIS,
943 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
944 * See the License for the specific language governing permissions and
945 * limitations under the License.
946 */function mD(n){switch(n){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function ED(n){const e=Ys(Xs(n)).link,t=e?Ys(Xs(e)).deep_link_id:null,r=Ys(Xs(n)).deep_link_id;return(r?Ys(Xs(r)).link:null)||r||t||e||n}class Lc{constructor(e){const t=Ys(Xs(e)),r=t.apiKey??null,s=t.oobCode??null,i=mD(t.mode??null);te(r&&s&&i,"argument-error"),this.apiKey=r,this.operation=i,this.code=s,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){const t=ED(e);try{return new Lc(t)}catch{return null}}}/**
947 * @license
948 * Copyright 2020 Google LLC
949 *
950 * Licensed under the Apache License, Version 2.0 (the "License");
951 * you may not use this file except in compliance with the License.
952 * You may obtain a copy of the License at
953 *
954 *   http://www.apache.org/licenses/LICENSE-2.0
955 *
956 * Unless required by applicable law or agreed to in writing, software
957 * distributed under the License is distributed on an "AS IS" BASIS,
958 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
959 * See the License for the specific language governing permissions and
960 * limitations under the License.
961 */class ms{constructor(){this.providerId=ms.PROVIDER_ID}static credential(e,t){return pi._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const r=Lc.parseLink(t);return te(r,"argument-error"),pi._fromEmailAndCode(e,r.code,r.tenantId)}}ms.PROVIDER_ID="password";ms.EMAIL_PASSWORD_SIGN_IN_METHOD="password";ms.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
962 * @license
963 * Copyright 2020 Google LLC
964 *
965 * Licensed under the Apache License, Version 2.0 (the "License");
966 * you may not use this file except in compliance with the License.
967 * You may obtain a copy of the License at
968 *
969 *   http://www.apache.org/licenses/LICENSE-2.0
970 *
971 * Unless required by applicable law or agreed to in writing, software
972 * distributed under the License is distributed on an "AS IS" BASIS,
973 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
974 * See the License for the specific language governing permissions and
975 * limitations under the License.
976 */class Da{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/**
977 * @license
978 * Copyright 2019 Google LLC
979 *
980 * Licensed under the Apache License, Version 2.0 (the "License");
981 * you may not use this file except in compliance with the License.
982 * You may obtain a copy of the License at
983 *
984 *   http://www.apache.org/licenses/LICENSE-2.0
985 *
986 * Unless required by applicable law or agreed to in writing, software
987 * distributed under the License is distributed on an "AS IS" BASIS,
988 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
989 * See the License for the specific language governing permissions and
990 * limitations under the License.
991 */class Es extends Da{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class Po extends Es{static credentialFromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;return te("providerId"in t&&"signInMethod"in t,"argument-error"),mn._fromParams(t)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return te(e.idToken||e.accessToken,"argument-error"),mn._fromParams({...e,providerId:this.providerId,signInMethod:this.providerId})}static credentialFromResult(e){return Po.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return Po.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r,oauthTokenSecret:s,pendingToken:i,nonce:o,providerId:B}=e;if(!r&&!s&&!t&&!i||!B)return null;try{return new Po(B)._credential({idToken:t,accessToken:r,nonce:o,pendingToken:i})}catch{return null}}}/**
992 * @license
993 * Copyright 2020 Google LLC
994 *
995 * Licensed under the Apache License, Version 2.0 (the "License");
996 * you may not use this file except in compliance with the License.
997 * You may obtain a copy of the License at
998 *
999 *   http://www.apache.org/licenses/LICENSE-2.0
1000 *
1001 * Unless required by applicable law or agreed to in writing, software
1002 * distributed under the License is distributed on an "AS IS" BASIS,
1003 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1004 * See the License for the specific language governing permissions and
1005 * limitations under the License.
1006 */class Ln extends Es{constructor(){super("facebook.com")}static credential(e){return mn._fromParams({providerId:Ln.PROVIDER_ID,signInMethod:Ln.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Ln.credentialFromTaggedObject(e)}static credentialFromError(e){return Ln.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Ln.credential(e.oauthAccessToken)}catch{return null}}}Ln.FACEBOOK_SIGN_IN_METHOD="facebook.com";Ln.PROVIDER_ID="facebook.com";/**
1007 * @license
1008 * Copyright 2020 Google LLC
1009 *
1010 * Licensed under the Apache License, Version 2.0 (the "License");
1011 * you may not use this file except in compliance with the License.
1012 * You may obtain a copy of the License at
1013 *
1014 *   http://www.apache.org/licenses/LICENSE-2.0
1015 *
1016 * Unless required by applicable law or agreed to in writing, software
1017 * distributed under the License is distributed on an "AS IS" BASIS,
1018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1019 * See the License for the specific language governing permissions and
1020 * limitations under the License.
1021 */class kn extends Es{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return mn._fromParams({providerId:kn.PROVIDER_ID,signInMethod:kn.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return kn.credentialFromTaggedObject(e)}static credentialFromError(e){return kn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return kn.credential(t,r)}catch{return null}}}kn.GOOGLE_SIGN_IN_METHOD="google.com";kn.PROVIDER_ID="google.com";/**
1022 * @license
1023 * Copyright 2020 Google LLC
1024 *
1025 * Licensed under the Apache License, Version 2.0 (the "License");
1026 * you may not use this file except in compliance with the License.
1027 * You may obtain a copy of the License at
1028 *
1029 *   http://www.apache.org/licenses/LICENSE-2.0
1030 *
1031 * Unless required by applicable law or agreed to in writing, software
1032 * distributed under the License is distributed on an "AS IS" BASIS,
1033 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1034 * See the License for the specific language governing permissions and
1035 * limitations under the License.
1036 */class Vn extends Es{constructor(){super("github.com")}static credential(e){return mn._fromParams({providerId:Vn.PROVIDER_ID,signInMethod:Vn.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Vn.credentialFromTaggedObject(e)}static credentialFromError(e){return Vn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Vn.credential(e.oauthAccessToken)}catch{return null}}}Vn.GITHUB_SIGN_IN_METHOD="github.com";Vn.PROVIDER_ID="github.com";/**
1037 * @license
1038 * Copyright 2020 Google LLC
1039 *
1040 * Licensed under the Apache License, Version 2.0 (the "License");
1041 * you may not use this file except in compliance with the License.
1042 * You may obtain a copy of the License at
1043 *
1044 *   http://www.apache.org/licenses/LICENSE-2.0
1045 *
1046 * Unless required by applicable law or agreed to in writing, software
1047 * distributed under the License is distributed on an "AS IS" BASIS,
1048 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1049 * See the License for the specific language governing permissions and
1050 * limitations under the License.
1051 */class xn extends Es{constructor(){super("twitter.com")}static credential(e,t){return mn._fromParams({providerId:xn.PROVIDER_ID,signInMethod:xn.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return xn.credentialFromTaggedObject(e)}static credentialFromError(e){return xn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return xn.credential(t,r)}catch{return null}}}xn.TWITTER_SIGN_IN_METHOD="twitter.com";xn.PROVIDER_ID="twitter.com";/**
1052 * @license
1053 * Copyright 2020 Google LLC
1054 *
1055 * Licensed under the Apache License, Version 2.0 (the "License");
1056 * you may not use this file except in compliance with the License.
1057 * You may obtain a copy of the License at
1058 *
1059 *   http://www.apache.org/licenses/LICENSE-2.0
1060 *
1061 * Unless required by applicable law or agreed to in writing, software
1062 * distributed under the License is distributed on an "AS IS" BASIS,
1063 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1064 * See the License for the specific language governing permissions and
1065 * limitations under the License.
1066 */async function _D(n,e){return Fi(n,"POST","/v1/accounts:signUp",Dn(n,e))}/**
1067 * @license
1068 * Copyright 2020 Google LLC
1069 *
1070 * Licensed under the Apache License, Version 2.0 (the "License");
1071 * you may not use this file except in compliance with the License.
1072 * You may obtain a copy of the License at
1073 *
1074 *   http://www.apache.org/licenses/LICENSE-2.0
1075 *
1076 * Unless required by applicable law or agreed to in writing, software
1077 * distributed under the License is distributed on an "AS IS" BASIS,
1078 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1079 * See the License for the specific language governing permissions and
1080 * limitations under the License.
1081 */class Rr{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,s=!1){const i=await xt._fromIdTokenResponse(e,r,s),o=Dh(r);return new Rr({user:i,providerId:o,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const s=Dh(r);return new Rr({user:e,providerId:s,_tokenResponse:r,operationType:t})}}function Dh(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
1082 * @license
1083 * Copyright 2020 Google LLC
1084 *
1085 * Licensed under the Apache License, Version 2.0 (the "License");
1086 * you may not use this file except in compliance with the License.
1087 * You may obtain a copy of the License at
1088 *
1089 *   http://www.apache.org/licenses/LICENSE-2.0
1090 *
1091 * Unless required by applicable law or agreed to in writing, software
1092 * distributed under the License is distributed on an "AS IS" BASIS,
1093 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1094 * See the License for the specific language governing permissions and
1095 * limitations under the License.
1096 */class zo extends kt{constructor(e,t,r,s){super(t.code,t.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,zo.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,s){return new zo(e,t,r,s)}}function Zd(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?zo._fromErrorAndOperation(n,i,e,r):i})}async function DD(n,e,t=!1){const r=await Ci(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return Rr._forOperation(n,"link",r)}/**
1097 * @license
1098 * Copyright 2019 Google LLC
1099 *
1100 * Licensed under the Apache License, Version 2.0 (the "License");
1101 * you may not use this file except in compliance with the License.
1102 * You may obtain a copy of the License at
1103 *
1104 *   http://www.apache.org/licenses/LICENSE-2.0
1105 *
1106 * Unless required by applicable law or agreed to in writing, software
1107 * distributed under the License is distributed on an "AS IS" BASIS,
1108 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1109 * See the License for the specific language governing permissions and
1110 * limitations under the License.
1111 */async function eC(n,e,t=!1){const{auth:r}=n;if(Xe(r.app))return Promise.reject(hn(r));const s="reauthenticate";try{const i=await Ci(n,Zd(r,s,e,n),t);te(i.idToken,r,"internal-error");const o=Ea(i.idToken);te(o,r,"internal-error");const{sub:B}=o;return te(n.uid===B,r,"user-mismatch"),Rr._forOperation(n,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&Nt(r,"user-mismatch"),i}}/**
1112 * @license
1113 * Copyright 2020 Google LLC
1114 *
1115 * Licensed under the Apache License, Version 2.0 (the "License");
1116 * you may not use this file except in compliance with the License.
1117 * You may obtain a copy of the License at
1118 *
1119 *   http://www.apache.org/licenses/LICENSE-2.0
1120 *
1121 * Unless required by applicable law or agreed to in writing, software
1122 * distributed under the License is distributed on an "AS IS" BASIS,
1123 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1124 * See the License for the specific language governing permissions and
1125 * limitations under the License.
1126 */async function tC(n,e,t=!1){if(Xe(n.app))return Promise.reject(hn(n));const r="signIn",s=await Zd(n,r,e),i=await Rr._fromIdTokenResponse(n,r,s);return t||await n._updateCurrentUser(i.user),i}async function wD(n,e){return tC(yn(n),e)}async function fP(n,e){return eC(fe(n),e)}/**
1127 * @license
1128 * Copyright 2020 Google LLC
1129 *
1130 * Licensed under the Apache License, Version 2.0 (the "License");
1131 * you may not use this file except in compliance with the License.
1132 * You may obtain a copy of the License at
1133 *
1134 *   http://www.apache.org/licenses/LICENSE-2.0
1135 *
1136 * Unless required by applicable law or agreed to in writing, software
1137 * distributed under the License is distributed on an "AS IS" BASIS,
1138 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1139 * See the License for the specific language governing permissions and
1140 * limitations under the License.
1141 */async function nC(n){const e=yn(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function dP(n,e,t){const r=yn(n);await Ko(r,{requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"},"getOobCode",dD)}async function CP(n,e,t){if(Xe(n.app))return Promise.reject(hn(n));const r=yn(n),o=await Ko(r,{returnSecureToken:!0,email:e,password:t,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",_D).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&nC(n),c}),B=await Rr._fromIdTokenResponse(r,"signIn",o);return await r._updateCurrentUser(B.user),B}function pP(n,e,t){return Xe(n.app)?Promise.reject(hn(n)):wD(fe(n),ms.credential(e,t)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&nC(n),r})}/**
1142 * @license
1143 * Copyright 2019 Google LLC
1144 *
1145 * Licensed under the Apache License, Version 2.0 (the "License");
1146 * you may not use this file except in compliance with the License.
1147 * You may obtain a copy of the License at
1148 *
1149 *   http://www.apache.org/licenses/LICENSE-2.0
1150 *
1151 * Unless required by applicable law or agreed to in writing, software
1152 * distributed under the License is distributed on an "AS IS" BASIS,
1153 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1154 * See the License for the specific language governing permissions and
1155 * limitations under the License.
1156 */function yD(n){var s,i;if(!n)return null;const{providerId:e}=n,t=n.rawUserInfo?JSON.parse(n.rawUserInfo):{},r=n.isNewUser||n.kind==="identitytoolkit#SignupNewUserResponse";if(!e&&(n!=null&&n.idToken)){const o=(i=(s=Ea(n.idToken))==null?void 0:s.firebase)==null?void 0:i.sign_in_provider;if(o){const B=o!=="anonymous"&&o!=="custom"?o:null;return new rs(r,B)}}if(!e)return null;switch(e){case"facebook.com":return new ID(r,t);case"github.com":return new TD(r,t);case"google.com":return new AD(r,t);case"twitter.com":return new RD(r,t,n.screenName||null);case"custom":case"anonymous":return new rs(r,null);default:return new rs(r,e,t)}}class rs{constructor(e,t,r={}){this.isNewUser=e,this.providerId=t,this.profile=r}}class rC extends rs{constructor(e,t,r,s){super(e,t,r),this.username=s}}class ID extends rs{constructor(e,t){super(e,"facebook.com",t)}}class TD extends rC{constructor(e,t){super(e,"github.com",t,typeof(t==null?void 0:t.login)=="string"?t==null?void 0:t.login:null)}}class AD extends rs{constructor(e,t){super(e,"google.com",t)}}class RD extends rC{constructor(e,t,r){super(e,"twitter.com",t,r)}}function gP(n){const{user:e,_tokenResponse:t}=n;return e.isAnonymous&&!t?{providerId:null,isNewUser:!1,profile:null}:yD(t)}function mP(n,e,t,r){return fe(n).onAuthStateChanged(e,t,r)}function EP(n){return fe(n).signOut()}const Wo="__sak";/**
1157 * @license
1158 * Copyright 2019 Google LLC
1159 *
1160 * Licensed under the Apache License, Version 2.0 (the "License");
1161 * you may not use this file except in compliance with the License.
1162 * You may obtain a copy of the License at
1163 *
1164 *   http://www.apache.org/licenses/LICENSE-2.0
1165 *
1166 * Unless required by applicable law or agreed to in writing, software
1167 * distributed under the License is distributed on an "AS IS" BASIS,
1168 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1169 * See the License for the specific language governing permissions and
1170 * limitations under the License.
1171 */class sC{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Wo,"1"),this.storage.removeItem(Wo),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
1172 * @license
1173 * Copyright 2020 Google LLC
1174 *
1175 * Licensed under the Apache License, Version 2.0 (the "License");
1176 * you may not use this file except in compliance with the License.
1177 * You may obtain a copy of the License at
1178 *
1179 *   http://www.apache.org/licenses/LICENSE-2.0
1180 *
1181 * Unless required by applicable law or agreed to in writing, software
1182 * distributed under the License is distributed on an "AS IS" BASIS,
1183 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1184 * See the License for the specific language governing permissions and
1185 * limitations under the License.
1186 */const vD=1e3,bD=10;class iC extends sC{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=$d(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),s=this.localCache[t];r!==s&&e(t,s,r)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,B,c)=>{this.notifyListeners(o,c)});return}const r=e.key;t?this.detachListener():this.stopPolling();const s=()=>{const o=this.storage.getItem(r);!t&&this.localCache[r]===o||this.notifyListeners(r,o)},i=this.storage.getItem(r);Y_()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,bD):s()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},vD)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Ob
1186ject.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}iC.type="LOCAL";const _P=iC;/**
1187 * @license
1188 * Copyright 2020 Google LLC
1189 *
1190 * Licensed under the Apache License, Version 2.0 (the "License");
1191 * you may not use this file except in compliance with the License.
1192 * You may obtain a copy of the License at
1193 *
1194 *   http://www.apache.org/licenses/LICENSE-2.0
1195 *
1196 * Unless required by applicable law or agreed to in writing, software
1197 * distributed under the License is distributed on an "AS IS" BASIS,
1198 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1199 * See the License for the specific language governing permissions and
1200 * limitations under the License.
1201 */class oC extends sC{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}oC.type="SESSION";const SD=oC;/**
1202 * @license
1203 * Copyright 2019 Google LLC
1204 *
1205 * Licensed under the Apache License, Version 2.0 (the "License");
1206 * you may not use this file except in compliance with the License.
1207 * You may obtain a copy of the License at
1208 *
1209 *   http://www.apache.org/licenses/LICENSE-2.0
1210 *
1211 * Unless required by applicable law or agreed to in writing, software
1212 * distributed under the License is distributed on an "AS IS" BASIS,
1213 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1214 * See the License for the specific language governing permissions and
1215 * limitations under the License.
1216 */function PD(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
1217 * @license
1218 * Copyright 2019 Google LLC
1219 *
1220 * Licensed under the Apache License, Version 2.0 (the "License");
1221 * you may not use this file except in compliance with the License.
1222 * You may obtain a copy of the License at
1223 *
1224 *   http://www.apache.org/licenses/LICENSE-2.0
1225 *
1226 * Unless required by applicable law or agreed to in writing, software
1227 * distributed under the License is distributed on an "AS IS" BASIS,
1228 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1229 * See the License for the specific language governing permissions and
1230 * limitations under the License.
1231 */class wa{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(s=>s.isListeningto(e));if(t)return t;const r=new wa(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:s,data:i}=t.data,o=this.handlersMap[s];if(!(o!=null&&o.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const B=Array.from(o).map(async u=>u(t.origin,i)),c=await PD(B);t.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:c})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}wa.receivers=[];/**
1232 * @license
1233 * Copyright 2020 Google LLC
1234 *
1235 * Licensed under the Apache License, Version 2.0 (the "License");
1236 * you may not use this file except in compliance with the License.
1237 * You may obtain a copy of the License at
1238 *
1239 *   http://www.apache.org/licenses/LICENSE-2.0
1240 *
1241 * Unless required by applicable law or agreed to in writing, software
1242 * distributed under the License is distributed on an "AS IS" BASIS,
1243 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1244 * See the License for the specific language governing permissions and
1245 * limitations under the License.
1246 */function kc(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
1247 * @license
1248 * Copyright 2019 Google LLC
1249 *
1250 * Licensed under the Apache License, Version 2.0 (the "License");
1251 * you may not use this file except in compliance with the License.
1252 * You may obtain a copy of the License at
1253 *
1254 *   http://www.apache.org/licenses/LICENSE-2.0
1255 *
1256 * Unless required by applicable law or agreed to in writing, software
1257 * distributed under the License is distributed on an "AS IS" BASIS,
1258 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1259 * See the License for the specific language governing permissions and
1260 * limitations under the License.
1261 */class OD{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,o;return new Promise((B,c)=>{const u=kc("",20);s.port1.start();const h=setTimeout(()=>{c(new Error("unsupported_event"))},r);o={messageChannel:s,onMessage(d){const p=d;if(p.data.eventId===u)switch(p.data.status){case"ack":clearTimeout(h),i=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),B(p.data.response);break;default:clearTimeout(h),clearTimeout(i),c(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:u,data:t},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
1262 * @license
1263 * Copyright 2020 Google LLC
1264 *
1265 * Licensed under the Apache License, Version 2.0 (the "License");
1266 * you may not use this file except in compliance with the License.
1267 * You may obtain a copy of the License at
1268 *
1269 *   http://www.apache.org/licenses/LICENSE-2.0
1270 *
1271 * Unless required by applicable law or agreed to in writing, software
1272 * distributed under the License is distributed on an "AS IS" BASIS,
1273 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1274 * See the License for the specific language governing permissions and
1275 * limitations under the License.
1276 */function $t(){return window}function ND(n){$t().location.href=n}/**
1277 * @license
1278 * Copyright 2020 Google LLC.
1279 *
1280 * Licensed under the Apache License, Version 2.0 (the "License");
1281 * you may not use this file except in compliance with the License.
1282 * You may obtain a copy of the License at
1283 *
1284 *   http://www.apache.org/licenses/LICENSE-2.0
1285 *
1286 * Unless required by applicable law or agreed to in writing, software
1287 * distributed under the License is distributed on an "AS IS" BASIS,
1288 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1289 * See the License for the specific language governing permissions and
1290 * limitations under the License.
1291 */function aC(){return typeof $t().WorkerGlobalScope<"u"&&typeof $t().importScripts=="function"}async function FD(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function LD(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)==null?void 0:n.controller)||null}function kD(){return aC()?self:null}/**
1292 * @license
1293 * Copyright 2019 Google LLC
1294 *
1295 * Licensed under the Apache License, Version 2.0 (the "License");
1296 * you may not use this file except in compliance with the License.
1297 * You may obtain a copy of the License at
1298 *
1299 *   http://www.apache.org/licenses/LICENSE-2.0
1300 *
1301 * Unless required by applicable law or agreed to in writing, software
1302 * distributed under the License is distributed on an "AS IS" BASIS,
1303 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1304 * See the License for the specific language governing permissions and
1305 * limitations under the License.
1306 */const BC="firebaseLocalStorageDb",VD=1,$o="firebaseLocalStorage",cC="fbase_key";class Li{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function ya(n,e){return n.transaction([$o],e?"readwrite":"readonly").objectStore($o)}function xD(){const n=indexedDB.deleteDatabase(BC);return new Li(n).toPromise()}function uC(){const n=indexedDB.open(BC,VD);return new Promise((e,t)=>
1306{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore($o,{keyPath:cC})}catch(s){t(s)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains($o)?e(r):(r.close(),await xD(),e(await uC()))})})}async function wh(n,e,t){const r=ya(n,!0).put({[cC]:e,value:t});return new Li(r).toPromise()}async function MD(n,e){const t=ya(n,!1).get(e),r=await new Li(t).toPromise();return r===void 0?null:r.value}function yh(n,e){const t=ya(n,!0).delete(e);return new Li(t).toPromise()}const GD=800,UD=3;class lC{registerLifecycleListeners(){typeof window<"u"&&typeof window.addEventListener=="function"&&(window.addEventListener("pagehide",this.onPageHide),window.addEventListener("pageshow",this.onPageShow))}unregisterLifecycleListeners(){typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("pagehide",this.onPageHide),window.removeEventListener("pageshow",this.onPageShow))}constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.isClosing=!1,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this.onPageHide=()=>{this.isClosing=!0,this.stopPolling(),this.dbPromise&&(this.dbPromise.then(e=>e.close()).catch(()=>{}),this.dbPromise=null)},this.onPageShow=()=>{this.isClosing&&(this.isClosing=!1,Object.keys(this.listeners).length>0&&this.startPolling())},this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise?this.dbPromise:(this.dbPromise=uC(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>UD)throw r;if(this.dbPromise){const s=this.dbPromise;this.dbPromise=null;try{(await s).close()}catch{}}}}async initializeServiceWorkerMessaging(){return aC()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=wa._getInstance(kD()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var t,r;if(this.activeServiceWorker=await FD(),!this.activeServiceWorker)return;this.sender=new OD(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(t=e[0])!=null&&t.fulfilled&&(r=e[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||LD()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await wh(e,Wo,"1"),await yh(e,Wo)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>wh(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>MD(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>yh(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){if(this.isClosing)return[];try{const e=await this._withRetries(s=>{const i=ya(s,!1).getAll();return new Li(i).toPromise()});if(this.isClosing)return[];if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),t.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),t.push(s));return t}catch(e){return this.isClosing||vo(`Firebase Auth cross-tab polling failed with error: ${e}`),[]}}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),GD)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.startPolling(),this.registerLifecycleListeners()),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Ob
vendor: 4,356 bytes, lines 1306-1355
1306ject.keys(this.listeners).length===0&&(this.stopPolling(),this.unregisterLifecycleListeners())}}lC.type="LOCAL";const DP=lC;new Ni(3e4,6e4);/**
1307 * @license
1308 * Copyright 2021 Google LLC
1309 *
1310 * Licensed under the Apache License, Version 2.0 (the "License");
1311 * you may not use this file except in compliance with the License.
1312 * You may obtain a copy of the License at
1313 *
1314 *   http://www.apache.org/licenses/LICENSE-2.0
1315 *
1316 * Unless required by applicable law or agreed to in writing, software
1317 * distributed under the License is distributed on an "AS IS" BASIS,
1318 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1319 * See the License for the specific language governing permissions and
1320 * limitations under the License.
1321 */function Vc(n,e){return e?Bn(e):(te(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
1322 * @license
1323 * Copyright 2019 Google LLC
1324 *
1325 * Licensed under the Apache License, Version 2.0 (the "License");
1326 * you may not use this file except in compliance with the License.
1327 * You may obtain a copy of the License at
1328 *
1329 *   http://www.apache.org/licenses/LICENSE-2.0
1330 *
1331 * Unless required by applicable law or agreed to in writing, software
1332 * distributed under the License is distributed on an "AS IS" BASIS,
1333 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1334 * See the License for the specific language governing permissions and
1335 * limitations under the License.
1336 */class xc extends Fc{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ns(e,this._buildIdpRequest())}_linkToIdToken(e,t){return ns(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return ns(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function HD(n){return tC(n.auth,new xc(n),n.bypassAuthState)}function qD(n){const{auth:e,user:t}=n;return te(t,e,"internal-error"),eC(t,new xc(n),n.bypassAuthState)}async function JD(n){const{auth:e,user:t}=n;return te(t,e,"internal-error"),DD(t,new xc(n),n.bypassAuthState)}/**
1337 * @license
1338 * Copyright 2020 Google LLC
1339 *
1340 * Licensed under the Apache License, Version 2.0 (the "License");
1341 * you may not use this file except in compliance with the License.
1342 * You may obtain a copy of the License at
1343 *
1344 *   http://www.apache.org/licenses/LICENSE-2.0
1345 *
1346 * Unless required by applicable law or agreed to in writing, software
1347 * distributed under the License is distributed on an "AS IS" BASIS,
1348 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1349 * See the License for the specific language governing permissions and
1350 * limitations under the License.
1351 */class hC{constructor(e,t,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:s,tenantId:i,error:o,type:B}=e;if(o){this.reject(o);return}const c={auth:this.auth,requestUri:t,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(B)(c))}catch(u){this.reject(u)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return HD;case"linkViaPopup":case"linkViaRedirect":return JD;case"reauthViaPopup":case"reauthViaRedirect":return qD;default:Nt(this.auth,"internal-error")}}resolve(e){gn(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){gn(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
1352 * @license
1353 * Copyright 2020 Google LLC
1354 *
1355 * Licensed under the Apache License, Version 2.0 (the "License");
1356 * you may not use this file except in compliance with the License.
1357 * You may obtain a copy of the License at
1358 *
1359 *   http://www.apache.org/licenses/LICENSE-2.0
1360 *
1361 * Unless required by applicable law or agreed to in writing, software
1362 * distributed under the License is distributed on an "AS IS" BASIS,
1363 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1364 * See the License for the specific language governing permissions and
1365 * limitations under the License.
1366 */const jD=new Ni(2e3,1e4);async function wP(n,e,t){if(Xe(n.app))return Promise.reject(Pt(n,"operation-not-supported-in-this-environment"));const r=yn(n);kd(n,e,Da);const s=Vc(r,t);return new Gn(r,"signInViaPopup",e,s).executeNotNull()}async function yP(n,e,t){const r=fe(n);if(Xe(r.auth.app))return Promise.reject(Pt(r.auth,"operation-not-supported-in-this-environment"));kd(r.auth,e,Da);const s=Vc(r.auth,t);return new Gn(r.auth,"reauthViaPopup",e,s,r).executeNotNull()}class Gn extends hC{constructor(e,t,r,s,i){super(e,t,s,i),this.provider=r,this.authWindow=null,this.pollId=null,Gn.currentPopupAction&&Gn.currentPopupAction.cancel(),Gn.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return te(e,this.auth,"internal-error"),e}async onExecution(){gn(this.filter.length===1,"Popup operations only handle one event");const e=kc();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(Pt(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(Pt(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Gn.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,r;if((r=(t=this.authWindow)==null?void 0:t.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Pt(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,jD.get())};e()}}Gn.currentPopupAction=null;/**
1367 * @license
1368 * Copyright 2020 Google LLC
1369 *
1370 * Licensed under the Apache License, Version 2.0 (the "License");
1371 * you may not use this file except in compliance with the License.
1372 * You may obtain a copy of the License at
1373 *
1374 *   http://www.apache.org/licenses/LICENSE-2.0
1375 *
1376 * Unless required by applicable law or agreed to in writing, software
1377 * distributed under the License is distributed on an "AS IS" BASIS,
1378 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1379 * See the License for the specific language governing permissions and
1380 * limitations under the License.
1381 */const KD="pendingRedirect",Oo=new Map;class zD extends hC{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=Oo.get(this.auth._key());if(!e){try{const r=await WD(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}Oo.set(this.auth._key(),e)}return this.bypassAuthState||Oo.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function WD(n,e){const t=YD(e),r=QD(n);if(!await r._isAvailable())return!1;const s=await r._get(t)==="true";return await r._remove(t),s}function $D(n,e){Oo.set(n._key(),e)}function QD(n){return Bn(n._redirectPersistence)}function YD(n){return So(KD,n.config.apiKey,n.name)}async function IP(n,e){return await yn(n)._initializationPromise,fC(n,e,!1)}async function fC(n,e,t=!1){if(Xe(n.app))return Promise.reject(hn(n));const r=yn(n),s=Vc(r,e),o=await new zD(r,s,t).execute();return o&&!t&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/**
1382 * @license
1383 * Copyright 2020 Google LLC
1384 *
1385 * Licensed under the Apache License, Version 2.0 (the "License");
1386 * you may not use this file except in compliance with the License.
1387 * You may obtain a copy of the License at
1388 *
1389 *   http://www.apache.org/licenses/LICENSE-2.0
1390 *
1391 * Unless required by applicable law or agreed to in writing, software
1392 * distributed under the License is distributed on an "AS IS" BASIS,
1393 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1394 * See the License for the specific language governing permissions and
1395 * limitations under the License.
1396 */const XD=10*60*1e3;class ZD{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!ew(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!dC(e)){const s=((r=e.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";t.onError(Pt(this.auth,s))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=XD&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ih(e))}saveEventToCache(e){this.cachedEventUids.add(Ih(e)),this.lastProcessedEventTime=Date.now()}}function Ih(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function dC({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function ew(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return dC(n);default:return!1}}/**
1397 * @license
1398 * Copyright 2020 Google LLC
1399 *
1400 * Licensed under the Apache License, Version 2.0 (the "License");
1401 * you may not use this file except in compliance with the License.
1402 * You may obtain a copy of the License at
1403 *
1404 *   http://www.apache.org/licenses/LICENSE-2.0
1405 *
1406 * Unless required by applicable law or agreed to in writing, software
1407 * distributed under the License is distributed on an "AS IS" BASIS,
1408 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1409 * See the License for the specific language governing permissions and
1410 * limitations under the License.
1411 */async function tw(n,e={}){return wn(n,"GET","/v1/projects",e)}/**
1412 * @license
1413 * Copyright 2020 Google LLC
1414 *
1415 * Licensed under the Apache License, Version 2.0 (the "License");
1416 * you may not use this file except in compliance with the License.
1417 * You may obtain a copy of the License at
1418 *
1419 *   http://www.apache.org/licenses/LICENSE-2.0
1420 *
1421 * Unless required by applicable law or agreed to in writing, software
1422 * distributed under the License is distributed on an "AS IS" BASIS,
1423 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1424 * See the License for the specific language governing permissions and
1425 * limitations under the License.
1426 */const nw=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,rw=/^https?/;async function sw(n){if(n.config.emulator)return;const{authorizedDomains:e}=await tw(n);for(const t of e)try{if(iw(t))return}catch{}Nt(n,"unauthorized-domain")}function iw(n){const e=tc(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===r}if(!rw.test(t))return!1;if(nw.test(n))return r===n;const s=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
1427 * @license
1428 * Copyright 2020 Google LLC.
1429 *
1430 * Licensed under the Apache License, Version 2.0 (the "License");
1431 * you may not use this file except in compliance with the License.
1432 * You may obtain a copy of the License at
1433 *
1434 *   http://www.apache.org/licenses/LICENSE-2.0
1435 *
1436 * Unless required by applicable law or agreed to in writing, software
1437 * distributed under the License is distributed on an "AS IS" BASIS,
1438 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1439 * See the License for the specific language governing permissions and
1440 * limitations under the License.
1441 */const ow=new Ni(3e4,6e4);function Th(){const n=$t().___jsl;if(n!=null&&n.H){for(const e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function aw(n){return new Promise((e,t)=>{var s,i,o;function r(){Th(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Th(),t(Pt(n,"network-request-failed"))},timeout:ow.get()})}if((i=(s=$t().gapi)==null?void 0:s.iframes)!=null&&i.Iframe)e(gapi.iframes.getContext());else if((o=$t().gapi)!=null&&o.load)r();else{const B=oD("iframefcb");return $t()[B]=()=>{gapi.load?r():t(Pt(n,"network-request-failed"))},Yd(`${iD()}?onload=${B}`).catch(c=>t(c))}}).catch(e=>{throw No=null,e})}let No=null;function Bw(n){return No=No||aw(n),No}/**
1442 * @license
1443 * Copyright 2020 Google LLC.
1444 *
1445 * Licensed under the Apache License, Version 2.0 (the "License");
1446 * you may not use this file except in compliance with the License.
1447 * You may obtain a copy of the License at
1448 *
1449 *   http://www.apache.org/licenses/LICENSE-2.0
1450 *
1451 * Unless required by applicable law or agreed to in writing, software
1452 * distributed under the License is distributed on an "AS IS" BASIS,
1453 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1454 * See the License for the specific language governing permissions and
1455 * limitations under the License.
1456 */const cw=new Ni(5e3,15e3),uw="__/auth/iframe",lw="emulator/auth/iframe",hw={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},fw=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function dw(n){const e=n.config;te(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?Oc(e,lw):`https://${n.config.authDomain}/${uw}`,r={apiKey:e.apiKey,appName:n.name,v:Vr},s=fw.get(n.config.apiHost);s&&(r.eid=s);const i=n._getFrameworks();return i.length&&(r.fw=i.join(",")),`${t}?${Oi(r).slice(1)}`}async function Cw(n){const e=await Bw(n),t=$t().gapi;return te(t,n,"internal-error"),e.open({where:document.body,url:dw(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:hw,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const o=Pt(n,"network-request-failed"),B=$t().setTimeout(()=>{i(o)},cw.get());function c(){$t().clearTimeout(B),s(r)}r.ping(c).then(c,()=>{i(o)})}))}/**
1457 * @license
1458 * Copyright 2020 Google LLC.
1459 *
1460 * Licensed under the Apache License, Version 2.0 (the "License");
1461 * you may not use this file except in compliance with the License.
1462 * You may obtain a copy of the License at
1463 *
1464 *   http://www.apache.org/licenses/LICENSE-2.0
1465 *
1466 * Unless required by applicable law or agreed to in writing, software
1467 * distributed under the License is distributed on an "AS IS" BASIS,
1468 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1469 * See the License for the specific language governing permissions and
1470 * limitations under the License.
1471 */const pw={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},gw=500,mw=600,Ew="_blank",_w="http://localhost";class Ah{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function Dw(n,e,t,r=gw,s=mw){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let B="";const c={...pw,width:r.toString(),height:s.toString(),top:i,left:o},u=et().toLowerCase();t&&(B=Jd(u)?Ew:t),Hd(u)&&(e=e||_w,c.scrollbars="yes");const h=Object.entries(c).reduce((p,[_,y])=>`${p}${_}=${y},`,"");if(Q_(u)&&B!=="_self")return ww(e||"",B),new Ah(null);const d=window.open(e||"",B,h);te(d,n,"popup-blocked");try{d.focus()}catch{}return new Ah(d)}function ww(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");
1471r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/**
1472 * @license
1473 * Copyright 2021 Google LLC
1474 *
1475 * Licensed under the Apache License, Version 2.0 (the "License");
1476 * you may not use this file except in compliance with the License.
1477 * You may obtain a copy of the License at
1478 *
1479 *   http://www.apache.org/licenses/LICENSE-2.0
1480 *
1481 * Unless required by applicable law or agreed to in writing, software
1482 * distributed under the License is distributed on an "AS IS" BASIS,
1483 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1484 * See the License for the specific language governing permissions and
1485 * limitations under the License.
1486 */const yw="__/auth/handler",Iw="emulator/auth/handler",Tw=encodeURIComponent("fac");async function Rh(n,e,t,r,s,i){te(n.config.authDomain,n,"auth-domain-config-required"),te(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:Vr,eventId:s};if(e instanceof Da){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",gE(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[h,d]of Object.entries({}))o[h]=d}if(e instanceof Es){const h=e.getScopes().filter(d=>d!=="");h.length>0&&(o.scopes=h.join(","))}n.tenantId&&(o.tid=n.tenantId);const B=o;for(const h of Object.keys(B))B[h]===void 0&&delete B[h];const c=await n._getAppCheckToken(),u=c?`#${Tw}=${encodeURIComponent(c)}`:"";return`${Aw(n)}?${Oi(B).slice(1)}${u}`}function Aw({config:n}){return n.emulator?Oc(n,Iw):`https://${n.authDomain}/${yw}`}/**
1487 * @license
1488 * Copyright 2020 Google LLC
1489 *
1490 * Licensed under the Apache License, Version 2.0 (the "License");
1491 * you may not use this file except in compliance with the License.
1492 * You may obtain a copy of the License at
1493 *
1494 *   http://www.apache.org/licenses/LICENSE-2.0
1495 *
1496 * Unless required by applicable law or agreed to in writing, software
1497 * distributed under the License is distributed on an "AS IS" BASIS,
1498 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1499 * See the License for the specific language governing permissions and
1500 * limitations under the License.
1501 */const SB="webStorageSupport";class Rw{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=SD,this._completeRedirectFn=fC,this._overrideRedirectResult=$D}async _openPopup(e,t,r,s){var o;gn((o=this.eventManagers[e._key()])==null?void 0:o.manager,"_initialize() not called before _openPopup()");const i=await Rh(e,t,r,tc(),s);return Dw(e,i,kc())}async _openRedirect(e,t,r,s){await this._originValidation(e);const i=await Rh(e,t,r,tc(),s);return ND(i),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:s,promise:i}=this.eventManagers[t];return s?Promise.resolve(s):(gn(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await Cw(e),r=new ZD(e);return t.register("authEvent",s=>(te(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(SB,{type:SB},s=>{var o;const i=(o=s==null?void 0:s[0])==null?void 0:o[SB];i!==void 0&&t(!!i),Nt(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=sw(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return $d()||qd()||Nc()}}const TP=Rw;var vh="@firebase/auth",bh="1.13.6";/**
1502 * @license
1503 * Copyright 2020 Google LLC
1504 *
1505 * Licensed under the Apache License, Version 2.0 (the "License");
1506 * you may not use this file except in compliance with the License.
1507 * You may obtain a copy of the License at
1508 *
1509 *   http://www.apache.org/licenses/LICENSE-2.0
1510 *
1511 * Unless required by applicable law or agreed to in writing, softw
1511are
1512 * distributed under the License is distributed on an "AS IS" BASIS,
1513 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1514 * See the License for the specific language governing permissions and
1515 * limitations under the License.
1516 */class vw{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){te(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1517 * @license
1518 * Copyright 2020 Google LLC
1519 *
1520 * Licensed under the Apache License, Version 2.0 (the "License");
1521 * you may not use this file except in compliance with the License.
1522 * You may obtain a copy of the License at
1523 *
1524 *   http://www.apache.org/licenses/LICENSE-2.0
1525 *
1526 * Unless required by applicable law or agreed to in writing, software
1527 * distributed under the License is distributed on an "AS IS" BASIS,
1528 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1529 * See the License for the specific language governing permissions and
1530 * limitations under the License.
1531 */function bw(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Sw(n){Ot(new Rt("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:B}=r.options;te(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const c={apiKey:o,authDomain:B,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Qd(n)},u=new nD(r,s,i,c);return uD(u,t),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),Ot(new Rt("auth-internal",e=>{const t=yn(e.getProvider("auth").getImmediate());return(r=>new vw(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),Ze(vh,bh,bw(n)),Ze(vh,bh,"esm2020")}/**
1532 * @license
1533 * Copyright 2021 Google LLC
1534 *
1535 * Licensed under the Apache License, Version 2.0 (the "License");
1536 * you may not use this file except in compliance with the License.
1537 * You may obtain a copy of the License at
1538 *
1539 *   http://www.apache.org/licenses/LICENSE-2.0
1540 *
1541 * Unless required by applicable law or agreed to in writing, software
1542 * distributed under the License is distributed on an "AS IS" BASIS,
1543 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1544 * See the License for the specific language governing permissions and
1545 * limitations under the License.
1546 */const Pw=5*60;oE("authIdTokenMaxAge");function Ow(){var n;return((n=document.getElementsByTagName("head"))==null?void 0:n[0])??document}rD({loadJS(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=s=>{const i=Pt("internal-error");i.customData=s,t(i)},r.type="text/javascript",r.charset="UTF-8",Ow().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Sw("Browser");var Sh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1547Copyright The Closure Library Authors.
1548SPDX-License-Identifier: Apache-2.0
1549*/var Hn,CC;(function(){var n;/** @license
1550
1551 Copyright The Closure Library Authors.
1552 SPDX-License-Identifier: Apache-2.0
1553*/function e(R,E){function w(){}w.prototype=E.prototype,R.F=E.prototype,R.prototype=new w,R.prototype.constructor=R,R.D=function(v,A,S){for(var D=Array(arguments.length-2),ct=2;ct<arguments.length;ct++)D[ct-2]=arguments[ct];return E.prototype[A].apply(v,D)}}function t(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}e(r,t),r.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function s(R,E,w){w||(w=0);const v=Array(16);if(typeof E=="string")for(var A=0;A<16;
vendor: 5,052 bytes, line 1553
1553++A)v[A]=E.charCodeAt(w++)|E.charCodeAt(w++)<<8|E.charCodeAt(w++)<<16|E.charCodeAt(w++)<<24;else for(A=0;A<16;++A)v[A]=E[w++]|E[w++]<<8|E[w++]<<16|E[w++]<<24;E=R.g[0],w=R.g[1],A=R.g[2];let S=R.g[3],D;D=E+(S^w&(A^S))+v[0]+3614090360&4294967295,E=w+(D<<7&4294967295|D>>>25),D=S+(A^E&(w^A))+v[1]+3905402710&4294967295,S=E+(D<<12&4294967295|D>>>20),D=A+(w^S&(E^w))+v[2]+606105819&4294967295,A=S+(D<<17&4294967295|D>>>15),D=w+(E^A&(S^E))+v[3]+3250441966&4294967295,w=A+(D<<22&4294967295|D>>>10),D=E+(S^w&(A^S))+v[4]+4118548399&4294967295,E=w+(D<<7&4294967295|D>>>25),D=S+(A^E&(w^A))+v[5]+1200080426&4294967295,S=E+(D<<12&4294967295|D>>>20),D=A+(w^S&(E^w))+v[6]+2821735955&4294967295,A=S+(D<<17&4294967295|D>>>15),D=w+(E^A&(S^E))+v[7]+4249261313&4294967295,w=A+(D<<22&4294967295|D>>>10),D=E+(S^w&(A^S))+v[8]+1770035416&4294967295,E=w+(D<<7&4294967295|D>>>25),D=S+(A^E&(w^A))+v[9]+2336552879&4294967295,S=E+(D<<12&4294967295|D>>>20),D=A+(w^S&(E^w))+v[10]+4294925233&4294967295,A=S+(D<<17&4294967295|D>>>15),D=w+(E^A&(S^E))+v[11]+2304563134&4294967295,w=A+(D<<22&4294967295|D>>>10),D=E+(S^w&(A^S))+v[12]+1804603682&4294967295,E=w+(D<<7&4294967295|D>>>25),D=S+(A^E&(w^A))+v[13]+4254626195&4294967295,S=E+(D<<12&4294967295|D>>>20),D=A+(w^S&(E^w))+v[14]+2792965006&4294967295,A=S+(D<<17&4294967295|D>>>15),D=w+(E^A&(S^E))+v[15]+1236535329&4294967295,w=A+(D<<22&4294967295|D>>>10),D=E+(A^S&(w^A))+v[1]+4129170786&4294967295,E=w+(D<<5&4294967295|D>>>27),D=S+(w^A&(E^w))+v[6]+3225465664&4294967295,S=E+(D<<9&4294967295|D>>>23),D=A+(E^w&(S^E))+v[11]+643717713&4294967295,A=S+(D<<14&4294967295|D>>>18),D=w+(S^E&(A^S))+v[0]+3921069994&4294967295,w=A+(D<<20&4294967295|D>>>12),D=E+(A^S&(w^A))+v[5]+3593408605&4294967295,E=w+(D<<5&4294967295|D>>>27),D=S+(w^A&(E^w))+v[10]+38016083&4294967295,S=E+(D<<9&4294967295|D>>>23),D=A+(E^w&(S^E))+v[15]+3634488961&4294967295,A=S+(D<<14&4294967295|D>>>18),D=w+(S^E&(A^S))+v[4]+3889429448&4294967295,w=A+(D<<20&4294967295|D>>>12),D=E+(A^S&(w^A))+v[9]+568446438&4294967295,E=w+(D<<5&4294967295|D>>>27),D=S+(w^A&(E^w))+v[14]+3275163606&4294967295,S=E+(D<<9&4294967295|D>>>23),D=A+(E^w&(S^E))+v[3]+4107603335&4294967295,A=S+(D<<14&4294967295|D>>>18),D=w+(S^E&(A^S))+v[8]+1163531501&4294967295,w=A+(D<<20&4294967295|D>>>12),D=E+(A^S&(w^A))+v[13]+2850285829&4294967295,E=w+(D<<5&4294967295|D>>>27),D=S+(w^A&(E^w))+v[2]+4243563512&4294967295,S=E+(D<<9&4294967295|D>>>23),D=A+(E^w&(S^E))+v[7]+1735328473&4294967295,A=S+(D<<14&4294967295|D>>>18),D=w+(S^E&(A^S))+v[12]+2368359562&4294967295,w=A+(D<<20&4294967295|D>>>12),D=E+(w^A^S)+v[5]+4294588738&4294967295,E=w+(D<<4&4294967295|D>>>28),D=S+(E^w^A)+v[8]+2272392833&4294967295,S=E+(D<<11&4294967295|D>>>21),D=A+(S^E^w)+v[11]+1839030562&4294967295,A=S+(D<<16&4294967295|D>>>16),D=w+(A^S^E)+v[14]+4259657740&4294967295,w=A+(D<<23&4294967295|D>>>9),D=E+(w^A^S)+v[1]+2763975236&4294967295,E=w+(D<<4&4294967295|D>>>28),D=S+(E^w^A)+v[4]+1272893353&4294967295,S=E+(D<<11&4294967295|D>>>21),D=A+(S^E^w)+v[7]+4139469664&4294967295,A=S+(D<<16&4294967295|D>>>16),D=w+(A^S^E)+v[10]+3200236656&4294967295,w=A+(D<<23&4294967295|D>>>9),D=E+(w^A^S)+v[13]+681279174&4294967295,E=w+(D<<4&4294967295|D>>>28),D=S+(E^w^A)+v[0]+3936430074&4294967295,S=E+(D<<11&4294967295|D>>>21),D=A+(S^E^w)+v[3]+3572445317&4294967295,A=S+(D<<16&4294967295|D>>>16),D=w+(A^S^E)+v[6]+76029189&4294967295,w=A+(D<<23&4294967295|D>>>9),D=E+(w^A^S)+v[9]+3654602809&4294967295,E=w+(D<<4&4294967295|D>>>28),D=S+(E^w^A)+v[12]+3873151461&4294967295,S=E+(D<<11&4294967295|D>>>21),D=A+(S^E^w)+v[15]+530742520&4294967295,A=S+(D<<16&4294967295|D>>>16),D=w+(A^S^E)+v[2]+3299628645&4294967295,w=A+(D<<23&4294967295|D>>>9),D=E+(A^(w|~S))+v[0]+4096336452&4294967295,E=w+(D<<6&4294967295|D>>>26),D=S+(w^(E|~A))+v[7]+1126891415&4294967295,S=E+(D<<10&4294967295|D>>>22),D=A+(E^(S|~w))+v[14]+2878612391&4294967295,A=S+(D<<15&4294967295|D>>>17),D=w+(S^(A|~E))+v[5]+4237533241&4294967295,w=A+(D<<21&4294967295|D>>>11),D=E+(A^(w|~S))+v[12]+1700485571&4294967295,E=w+(D<<6&4294967295|D>>>26),D=S+(w^(E|~A))+v[3]+2399980690&4294967295,S=E+(D<<10&4294967295|D>>>22),D=A+(E^(S|~w))+v[10]+4293915773&4294967295,A=S+(D<<15&4294967295|D>>>17),D=w+(S^(A|~E))+v[1]+2240044497&4294967295,w=A+(D<<21&4294967295|D>>>11),D=E+(A^(w|~S))+v[8]+1873313359&4294967295,E=w+(D<<6&4294967295|D>>>26),D=S+(w^(E|~A))+v[15]+4264355552&4294967295,S=E+(D<<10&4294967295|D>>>22),D=A+(E^(S|~w))+v[6]+2734768916&4294967295,A=S+(D<<15&4294967295|D>>>17),D=w+(S^(A|~E))+v[13]+1309151649&4294967295,w=A+(D<<21&4294967295|D>>>11),D=E+(A^(w|~S))+v[4]+4149444226&4294967295,E=w+(D<<6&4294967295|D>>>26),D=S+(w^(E|~A))+v[11]+3174756917&4294967295,S=E+(D<<10&4294967295|D>>>22),D=A+(E^(S|~w))+v[2]+718787259&4294967295,A=S+(D<<15&4294967295|D>>>17),D=w+(S^(A|~E))+v[9]+3951481745&4294967295,R.g[0]=R.g[0]+E&4294967295,R.g[1]=R.g[1]+(A+(D<<21&4294967295|D>>>11))&4294967295,R.g[2]=R.g[2]+A&4294967295,R.g[3]=R.g[3]+S&4294967295}r.prototype.v=function(R,E){E===void 0&&(E=R.length);const w=E-this.blockSize,v=this.C;let A=this.h,S=0;for(;S<E;){if(A==0)for(;S<=w;)s(this,R,S),S+=this.blockSize;
1553if(typeof R=="string"){for(;S<E;)if(v[A++]=R.charCodeAt(S++),A==this.blockSize){s(this,v),A=0;break}}else for(;S<E;)if(v[A++]=R[S++],A==this.blockSize){s(this,v),A=0;break}}this.h=A,this.o+=E},r.prototype.A=function(){var R=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);R[0]=128;for(var E=1;E<R.length-8;++E)R[E]=0;E=this.o*8;for(var w=R.length-8;w<R.length;++w)R[w]=E&255,E/=256;for(this.v(R),R=Array(16),E=0,w=0;w<4;++w)for(let v=0;v<32;v+=8)R[E++]=this.g[w]>>>v&255;return R};function i(R,E){var w=B;return Object.prototype.hasOwnProperty.call(w,R)?w[R]:w[R]=E(R)}function o(R,E){this.h=E;const w=[];let v=!0;for(let A=R.length-1;A>=0;A--){const S=R[A]|0;v&&S==E||(w[A]=S,v=!1)}this.g=w}var B={};function c(R){return-128<=R&&R<128?i(R,function(E){return new o([E|0],E<0?-1:0)}):new o([R|0],R<0?-1:0)}function u(R){if(isNaN(R)||!isFinite(R))return d;if(R<0)return V(u(-R));const E=[];let w=1;for(let v=0;R>=w;v++)E[v]=R/w|0,w*=4294967296;return new o(E,0)}function h(R,E){if(R.length==0)throw Error("number format error: empty string");if(E=E||10,E<2||36<E)throw Error("radix out of range: "+E);if(R.charAt(0)=="-")return V(h(R.substring(1),E));if(R.indexOf("-")>=0)throw Error('number format error: interior "-" character');const w=u(Math.pow(E,8));let v=d;for(let S=0;S<R.length;S+=8){var A=Math.min(8,R.length-S);const D=parseInt(R.substring(S,S+A),E);A<8?(A=u(Math.pow(E,A)),v=v.j(A).add(u(D))):(v=v.j(w),v=v.add(u(D)))}return v}var d=c(0),p=c(1),_=c(16777216);n=o.prototype,n.m=function(){if(O(this))return-V(this).m();let R=0,E=1;for(let w=0;w<this.g.length;w++){const v=this.i(w);R+=(v>=0?v:4294967296+v)*E,E*=4294967296}return R},n.toString=function(R){if(R=R||10,R<2||36<R)throw Error("radix out of range: "+R);if(y(this))return"0";if(O(this))return"-"+V(this).toString(R);const E=u(Math.pow(R,6));var w=this;let v="";for(;;){const A=Be(w,E).g;w=j(w,A.j(E));let S=((w.g.length>0?w.g[0]:w.h)>>>0).toString(R);if(w=A,y(w))return S+v;for(;S.length<6;)S="0"+S;v=S+v}},n.i=function(R){return R<0?0:R<this.g.length?this.g[R]:this.h};function y(R){if(R.h!=0)return!1;for(let E=0;E<R.g.length;E++)if(R.g[E]!=0)return!1;return!0}function O(R){return R.h==-1}n.l=function(R){return R=j(this,R),O(R)?-1:y(R)?0:1};function V(R){const E=R.g.length,w=[];for(let v=0;v<E;v++)w[v]=~R.g[v];return new o(w,~R.h).add(p)}n.abs=function(){return O(this)?V(this):this},n.add=function(R){const E=Math.max(this.g.length,R.g.length),w=[];let v=0;for(let A=0;A<=E;A++){let S=v+(this.i(A)&65535)+(R.i(A)&65535),D=(S>>>16)+(this.i(A)>>>16)+(R.i(A)>>>16);v=D>>>16,S&=65535,D&=65535,w[A]=D<<16|S}return new o(w,w[w.length-1]&-2147483648?-1:0)};function j(R,E){return R.add(V(E))}n.j=function(R){if(y(this)||y(R))return d;if(O(this))return O(R)?V(this).j(V(R)):V(V(this).j(R));if(O(R))return V(this.j(V(R)));if(this.l(_)<0&&R.l(_)<0)return u(this.m()*R.m());const E=this.g.length+R.g.length,w=[];for(var v=0;v<2*E;v++)w[v]=0;for(v=0;v<this.g.length;v++)for(let A=0;A<R.g.length;A++){const S=this.i(v)>>>16,D=this.i(v)&65535,ct=R.i(A)>>>16,ar=R.i(A)&65535;w[2*v+2*A]+=D*ar,ee(w,2*v+2*A),w[2*v+2*A+1]+=S*ar,ee(w,2*v+2*A+1),w[2*v+2*A+1]+=D*ct,ee(w,2*v+2*A+1),w[2*v+2*A+2]+=S*ct,ee(w,2*v+2*A+2)}for(R=0;R<E;R++)w[R]=w[2*R+1]<<16|w[2*R];for(R=E;R<2*E;R++)w[R]=0;return new o(w,0)};function ee(R,E){for(;(R[E]&65535)!=R[E];)R[E+1]+=R[E]>>>16,R[E]&=65535,E++}function se(R,E){this.g=R,this.h=E}function Be(R,E){if(y(E))throw Error("division by zero");if(y(R))return new se(d,d);if(O(R))return E=Be(V(R),E),new se(V(E.g),V(E.h));if(O(E))return E=Be(R,V(E)),new se(V(E.g),E.h);if(R.g.length>30){if(O(R)||O(E))throw Error("slowDivide_ only works with positive integers.");for(var w=p,v=E;v.l(R)<=0;)w=ye(w),v=ye(v);var A=pe(w,1),S=pe(v,1);for(v=pe(v,2),w=pe(w,2);!y(v);){var D=S.add(v);D.l(R)<=0&&(A=A.add(w),S=D),v=pe(v,1),w=pe(w,1)}return E=j(R,A.j(E)),new se(A,E)}for(A=d;R.l(E)>=0;){for(w=Math.max(1,Math.floor(R.m()/E.m())),v=Math.ceil(Math.log(w)/Math.LN2),v=v<=48?1:Math.pow(2,v-48),S=u(w),D=S.j(E);O(D)||D.l(R)>0;)w-=v,S=u(w),D=S.j(E);y(S)&&(S=p),A=A.add(S),R=j(R,D)}return new se(A,R)}n.B=function(R){return Be(this,R).h},n.and=function(R){const E=Math.max(this.g.length,R.g.length),w=[];for(let v=0;v<E;v++)w[v]=this.i(v)&R.i(v);return new o(w,this.h&R.h)},n.or=function(R){const E=Math.max(this.g.length,R.g.length),w=[];for(let v=0;v<E;v++)w[v]=this.i(v)|R.i(v);return new o(w,this.h|R.h)},n.xor=function(R){const E=Math.max(this.g.length,R.g.length),w=[];for(let v=0;v<E;v++)w[v]=this.i(v)^R.i(v);return new o(w,this.h^R.h)};function ye(R){const E=R.g.length+1,w=[];for(let v=0;v<E;v++)w[v]=R.i(v)<<1|R.i(v-1)>>>31;return new o(w,R.h)}function pe(R,E){const w=E>>5;E%=32;const v=R.g.length-w,A=[];for(let S=0;S<v;S++)A[S]=E>0?R.i(S+w)>>>E|R.i(S+w+1)<<32-E:R.i(S+w);return new o(A,R.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,CC=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=u,o.fromString=h,Hn=o}).apply(typeof Sh<"u"?Sh:typeof self<"u"?self:typeof window<"u"?window:{});var fo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1554Copyright The Closure Library Authors.
1555SPDX-License-Identifier: Apache-2.0
1556*/var pC,Zs,gC,Fo,rc,mC,EC,_C;(function(){var n,e=Object.defineProperty;
1556function t(a){a=[typeof globalThis=="object"&&globalThis,a,typeof window=="object"&&window,typeof self=="object"&&self,typeof fo=="object"&&fo];for(var l=0;l<a.length;++l){var f=a[l];if(f&&f.Math==Math)return f}throw Error("Cannot find global object")}var r=t(this);function s(a,l){if(l)e:{var f=r;a=a.split(".");for(var C=0;C<a.length-1;C++){var b=a[C];if(!(b in f))break e;f=f[b]}a=a[a.length-1],C=f[a],l=l(C),l!=C&&l!=null&&e(f,a,{configurable:!0,writable:!0,value:l})}}s("Symbol.dispose",function(a){return a||Symbol("Symbol.dispose")}),s("Array.prototype.values",function(a){return a||function(){return this[Symbol.iterator]()}}),s("Object.entries",function(a){return a||function(l){var f=[],C;for(C in l)Object.prototype.hasOwnProperty.call(l,C)&&f.push([C,l[C]]);return f}});/** @license
1557
1558 Copyright The Closure Library Authors.
1559 SPDX-License-Identifier: Apache-2.0
1560*/var i=i||{},o=this||self;function B(a){var l=typeof a;return l=="object"&&a!=null||l=="function"}function c(a,l,f){return a.call.apply(a.bind,arguments)}function u(a,l,f){return u=c,u.apply(null,arguments)}function h(a,l){var f=Array.prototype.slice.call(arguments,1);return function(){var C=f.slice();return C.push.apply(C,arguments),a.apply(this,C)}}function d(a,l){function f(){}f.prototype=l.prototype,a.Z=l.prototype,a.prototype=new f,a.prototype.constructor=a,a.Ob=function(C,b,P){for(var J=Array(arguments.length-2),ie=2;ie<arguments.length;ie++)J[ie-2]=arguments[ie];return l.prototype[b].apply(C,J)}}var p=typeof AsyncContext<"u"&&typeof AsyncContext.Snapshot=="function"?a=>a&&AsyncContext.Snapshot.wrap(a):a=>a;function _(a){const l=a.length;if(l>0){const f=Array(l);for(let C=0;C<l;C++)f[C]=a[C];return f}return[]}function y(a,l){for(let C=1;C<arguments.length;C++){const b=arguments[C];var f=typeof b;if(f=f!="object"?f:b?Array.isArray(b)?"array":f:"null",f=="array"||f=="object"&&typeof b.length=="number"){f=a.length||0;const P=b.length||0;a.length=f+P;for(let J=0;J<P;J++)a[f+J]=b[J]}else a.push(b)}}class O{constructor(l,f){this.i=l,this.j=f,this.h=0,this.g=null}get(){let l;return this.h>0?(this.h--,l=this.g,this.g=l.next,l.next=null):l=this.i(),l}}function V(a){o.setTimeout(()=>{throw a},0)}function j(){var a=R;let l=null;return a.g&&(l=a.g,a.g=a.g.next,a.g||(a.h=null),l.next=null),l}class ee{constructor(){this.h=this.g=null}add(l,f){const C=se.get();C.set(l,f),this.h?this.h.next=C:this.g=C,this.h=C}}var se=new O(()=>new Be,a=>a.reset());class Be{constructor(){this.next=this.g=this.h=null}set(l,f){this.h=l,this.g=f,this.next=null}reset(){this.next=this.g=this.h=null}}let ye,pe=!1,R=new ee,E=()=>{const a=Promise.resolve(void 0);ye=()=>{a.then(w)}};function w(){for(var a;a=j();){try{a.h.call(a.g)}catch(f){V(f)}var l=se;l.j(a),l.h<100&&(l.h++,a.next=l.g,l.g=a)}pe=!1}function v(){this.u=this.u,this.C=this.C}v.prototype.u=!1,v.prototype.dispose=function(){this.u||(this.u=!0,this.N())},v.prototype[Symbol.dispose]=function(){this.dispose()},v.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function A(a,l){this.type=a,this.g=this.target=l,this.defaultPrevented=!1}A.prototype.h=function(){this.defaultPrevented=!0};var S=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var a=!1,l=Object.defineProperty({},"passive",{get:function(){a=!0}});try{const f=()=>{};o.addEventListener("test",f,l),o.removeEventListener("test",f,l)}catch{}return a}();function D(a){return/^[\s\xa0]*$/.test(a)}function ct(a,l){A.call(this,a?a.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,a&&this.init(a,l)}d(ct,A),ct.prototype.init=function(a,l){const f=this.type=a.type,C=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:null;this.target=a.target||a.srcElement,this.g=l,l=a.relatedTarget,l||(f=="mouseover"?l=a.fromElement:f=="mouseout"&&(l=a.toElement)),this.relatedTarget=l,C?(this.clientX=C.clientX!==void 0?C.clientX:C.pageX,this.clientY=C.clientY!==void 0?C.clientY:C.pageY,this.screenX=C.screenX||0,this.screenY=C.screenY||0):(this.clientX=a.clientX!==void 0?a.clientX:a.pageX,this.clientY=a.clientY!==void 0?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0),this.button=a.button,this.key=a.key||"",this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.pointerId=a.pointerId||0,this.pointerType=a.pointerType,this.state=a.state,this.i=a,a.defaultPrevented&&ct.Z.h.
vendor: 13,034 bytes, lines 1560-1565
1560call(this)},ct.prototype.h=function(){ct.Z.h.call(this);const a=this.i;a.preventDefault?a.preventDefault():a.returnValue=!1};var ar="closure_listenable_"+(Math.random()*1e6|0),gm=0;function mm(a,l,f,C,b){this.listener=a,this.proxy=null,this.src=l,this.type=f,this.capture=!!C,this.ha=b,this.key=++gm,this.da=this.fa=!1}function Yi(a){a.da=!0,a.listener=null,a.proxy=null,a.src=null,a.ha=null}function Xi(a,l,f){for(const C in a)l.call(f,a[C],C,a)}function Em(a,l){for(const f in a)l.call(void 0,a[f],f,a)}function tl(a){const l={};for(const f in a)l[f]=a[f];return l}const nl="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function rl(a,l){let f,C;for(let b=1;b<arguments.length;b++){C=arguments[b];for(f in C)a[f]=C[f];for(let P=0;P<nl.length;P++)f=nl[P],Object.prototype.hasOwnProperty.call(C,f)&&(a[f]=C[f])}}function Zi(a){this.src=a,this.g={},this.h=0}Zi.prototype.add=function(a,l,f,C,b){const P=a.toString();a=this.g[P],a||(a=this.g[P]=[],this.h++);const J=tB(a,l,C,b);return J>-1?(l=a[J],f||(l.fa=!1)):(l=new mm(l,this.src,P,!!C,b),l.fa=f,a.push(l)),l};function eB(a,l){const f=l.type;if(f in a.g){var C=a.g[f],b=Array.prototype.indexOf.call(C,l,void 0),P;(P=b>=0)&&Array.prototype.splice.call(C,b,1),P&&(Yi(l),a.g[f].length==0&&(delete a.g[f],a.h--))}}function tB(a,l,f,C){for(let b=0;b<a.length;++b){const P=a[b];if(!P.da&&P.listener==l&&P.capture==!!f&&P.ha==C)return b}return-1}var nB="closure_lm_"+(Math.random()*1e6|0),rB={};function sl(a,l,f,C,b){if(Array.isArray(l)){for(let P=0;P<l.length;P++)sl(a,l[P],f,C,b);return null}return f=al(f),a&&a[ar]?a.J(l,f,B(C)?!!C.capture:!1,b):_m(a,l,f,!1,C,b)}function _m(a,l,f,C,b,P){if(!l)throw Error("Invalid event type");const J=B(b)?!!b.capture:!!b;let ie=iB(a);if(ie||(a[nB]=ie=new Zi(a)),f=ie.add(l,f,C,J,P),f.proxy)return f;if(C=Dm(),f.proxy=C,C.src=a,C.listener=f,a.addEventListener)S||(b=J),b===void 0&&(b=!1),a.addEventListener(l.toString(),C,b);else if(a.attachEvent)a.attachEvent(ol(l.toString()),C);else if(a.addListener&&a.removeListener)a.addListener(C);else throw Error("addEventListener and attachEvent are unavailable.");return f}function Dm(){function a(f){return l.call(a.src,a.listener,f)}const l=wm;return a}function il(a,l,f,C,b){if(Array.isArray(l))for(var P=0;P<l.length;P++)il(a,l[P],f,C,b);else C=B(C)?!!C.capture:!!C,f=al(f),a&&a[ar]?(a=a.i,P=String(l).toString(),P in a.g&&(l=a.g[P],f=tB(l,f,C,b),f>-1&&(Yi(l[f]),Array.prototype.splice.call(l,f,1),l.length==0&&(delete a.g[P],a.h--)))):a&&(a=iB(a))&&(l=a.g[l.toString()],a=-1,l&&(a=tB(l,f,C,b)),(f=a>-1?l[a]:null)&&sB(f))}function sB(a){if(typeof a!="number"&&a&&!a.da){var l=a.src;if(l&&l[ar])eB(l.i,a);else{var f=a.type,C=a.proxy;l.removeEventListener?l.removeEventListener(f,C,a.capture):l.detachEvent?l.detachEvent(ol(f),C):l.addListener&&l.removeListener&&l.removeListener(C),(f=iB(l))?(eB(f,a),f.h==0&&(f.src=null,l[nB]=null)):Yi(a)}}}function ol(a){return a in rB?rB[a]:rB[a]="on"+a}function wm(a,l){if(a.da)a=!0;else{l=new ct(l,this);const f=a.listener,C=a.ha||a.src;a.fa&&sB(a),a=f.call(C,l)}return a}function iB(a){return a=a[nB],a instanceof Zi?a:null}var oB="__closure_events_fn_"+(Math.random()*1e9>>>0);function al(a){return typeof a=="function"?a:(a[oB]||(a[oB]=function(l){return a.handleEvent(l)}),a[oB])}function We(){v.call(this),this.i=new Zi(this),this.M=this,this.G=null}d(We,v),We.prototype[ar]=!0,We.prototype.removeEventListener=function(a,l,f,C){il(this,a,l,f,C)};function nt(a,l){var f,C=a.G;if(C)for(f=[];C;C=C.G)f.push(C);if(a=a.M,C=l.type||l,typeof l=="string")l=new A(l,a);else if(l instanceof A)l.target=l.target||a;else{var b=l;l=new A(C,a),rl(l,b)}b=!0;let P,J;if(f)for(J=f.length-1;J>=0;J--)P=l.g=f[J],b=eo(P,C,!0,l)&&b;if(P=l.g=a,b=eo(P,C,!0,l)&&b,b=eo(P,C,!1,l)&&b,f)for(J=0;J<f.length;J++)P=l.g=f[J],b=eo(P,C,!1,l)&&b}We.prototype.N=function(){if(We.Z.N.call(this),this.i){var a=this.i;for(const l in a.g){const f=a.g[l];for(let C=0;C<f.length;C++)Yi(f[C]);delete a.g[l],a.h--}}this.G=null},We.prototype.J=function(a,l,f,C){return this.i.add(String(a),l,!1,f,C)},We.prototype.K=function(a,l,f,C){return this.i.add(String(a),l,!0,f,C)};function eo(a,l,f,C){if(l=a.i.g[String(l)],!l)return!0;l=l.concat();let b=!0;for(let P=0;P<l.length;++P){const J=l[P];if(J&&!J.da&&J.capture==f){const ie=J.listener,Ge=J.ha||J.src;J.fa&&eB(a.i,J),b=ie.call(Ge,C)!==!1&&b}}return b&&!C.defaultPrevented}function ym(a,l){if(typeof a!="function")if(a&&typeof a.handleEvent=="function")a=u(a.handleEvent,a);else throw Error("Invalid listener argument");return Number(l)>2147483647?-1:o.setTimeout(a,l||0)}function Bl(a){a.g=ym(()=>{a.g=null,a.i&&(a.i=!1,Bl(a))},a.l);const l=a.h;a.h=null,a.m.apply(null,l)}class Im extends v{constructor(l,f){super(),this.m=l,this.l=f,this.h=null,this.i=!1,this.g=null}j(l){this.h=arguments,this.g?this.i=!0:Bl(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Os(a){v.call(this),this.h=a,this.g={}}d(Os,v);var cl=[];function ul(a){Xi(a.g,function(l,f){this.g.hasOwnProperty(f)&&sB(l)},a),a.g={}}Os.prototype.N=function(){Os.Z.N.call(this),ul(this)},Os.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var aB=o.JSON.stringify,Tm=o.JSON.parse,Am=class{stringify(a){return o.JSON.stringify(a,void 0)}parse(a){return o.JSON.parse(a,void 0)}};function ll(){}function hl(){}var Ns={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function BB(){A.call(this,"d")}d(BB,A);function cB(){A.call(this,"c")}d(cB,A);var Br={},fl=null;function to(){return fl=fl||new We}Br.Ia="serverreachability";function dl(a){A.call(this,Br.Ia,a)}d(dl,A);function Fs(a){const l=to();nt(l,new dl(l))}Br.STAT_EVENT="statevent";function Cl(a,l){A.call(this,Br.STAT_EVENT,a),this.stat=l}d(Cl,A);function rt(a){const l=to();nt(l,new Cl(l,a))}Br.Ja="timingevent";function pl(a,l){A.call(this,Br.Ja,a),this.size=l}d(pl,A);function Ls(a,l){if(typeof a!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){a()},l)}function ks(){this.g=!0}ks.prototype.ua=function(){this.g=!1};function Rm(a,l,f,C,b,P){a.info(function(){if(a.g)if(P){var J="",ie=P.split("&");for(let Ee=0;Ee<ie.length;Ee++){var Ge=ie[Ee].split("=");if(Ge.length>1){const qe=Ge[0];Ge=Ge[1];const Jt=qe.split("_");J=Jt.length>=2&&Jt[1]=="type"?J+(qe+"="+Ge+"&"):J+(qe+"=redacted&")}}}else J=null;else J=P;return"XMLHTTP REQ ("+C+") [attempt "+b+"]: "+l+`
1561`+f+`
1562`+J})}function vm(a,l,f,C,b,P,J){a.info(function(){return"XMLHTTP RESP ("+C+") [ attempt "+b+"]: "+l+`
1563`+f+`
1564`+P+" "+J})}function qr(a,l,f,C){a.info(function(){return"XMLHTTP TEXT ("+l+"): "+Sm(a,f)+(C?" "+C:"")})}function bm(a,l){a.info(function(){return"TIMEOUT: "+l})}ks.prototype.info=function(){};function Sm(a,l){if(!a.g)return l;if(!l)return null;try{const P=JSON.parse(l);if(P){for(a=0;a<P.length;a++)if(Array.isArray(P[a])){var f=P[a];if(!(f.length<2)){var C=f[1];if(Array.isArray(C)&&!(C.length<1)){var b=C[0];if(b!="noop"&&b!="stop"&&b!="close")for(let J=1;J<C.length;J++)C[J]=""}}}}return aB(P)}catch{return l}}var no={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},gl={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"},ml;function uB(){}d(uB,ll),uB.prototype.g=function(){return new XMLHttpRequest},ml=new uB;function Vs(a){return encodeURIComponent(String(a))}function Pm(a){var l=1;a=a.split(":");const f=[];for(;l>0&&a.length;)f.push(a.shift()),l--;return a.length&&f.push(a.join(":")),f}function In(a,l,f,C){this.j=a,this.i=l,this.l=f,this.S=C||1,this.V=new Os(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new El}function El(){this.i=null,this.g="",this.h=!1}var _l={},lB={};function hB(a,l,f){a.M=1,a.A=so(qt(l)),a.u=f,a.R=!0,Dl(a,null)}function Dl(a,l){a.F=Date.now(),ro(a),a.B=qt(a.A);var f=a.B,C=a.S;Array.isArray(C)||(C=[String(C)]),Fl(f.i,"t",C),a.C=0,f=a.j.L,a.h=new El,a.g=Xl(a.j,f?l:null,!a.u),a.P>0&&(a.O=new Im(u(a.Y,a,a.g),a.P)),l=a.V,f=a.g,C=a.ba;var b="readystatechange";Array.isArray(b)||(b&&(cl[0]=b.toString()),b=cl);for(let P=0;P<b.length;P++){const J=sl(f,b[P],C||l.handleEvent,!1,l.h||l);if(!J)break;l.g[J.key]=J}l=a.J?tl(a.J):{},a.u?(a.v||(a.v="POST"),l["Content-Type"]="application/x-www-form-urlencoded",a.g.ea(a.B,a.v,a.u,l)):(a.v="GET",a.g.ea(a.B,a.v,null,l)),Fs(),Rm(a.i,a.v,a.B,a.l,a.S,a.u)}In.prototype.ba=function(a){a=a.target;const l=this.O;l&&Rn(a)==3?l.j():this.Y(a)},In.prototype.Y=function(a){try{if(a==this.g)e:{const ie=Rn(this.g),Ge=this.g.ya(),Ee=this.g.ca();if(!(ie<3)&&(ie!=3||this.g&&(this.h.h||this.g.la()||Ul(this.g)))){this.K||ie!=4||Ge==7||(Ge==8||Ee<=0?Fs(3):Fs(2)),fB(this);var l=this.g.ca();this.X=l;var f=Om(this);if(this.o=l==200,vm(this.i,this.v,this.B,this.l,this.S,ie,l),this.o){if(this.U&&!this.L){t:{if(this.g){var C,b=this.g;if((C=b.g?b.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!D(C)){var P=C;break t}}P=null}if(a=P)qr(this.i,this.l,a,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,dB(this,a);else{this.o=!1,this.m=3,rt(12),cr(this),xs(this);break e}}if(this.R){a=!0;let qe;for(;!this.K&&this.C<f.length;)if(qe=Nm(this,f),qe==lB){ie==4&&(this.m=4,rt(14),a=!1),qr(this.i,this.l,null,"[Incomplete Response]");break}else if(qe==_l){this.m=4,rt(15),qr(this.i,this.l,f,"[Invalid Chunk]"),a=!1;break}else qr(this.i,this.l,qe,null),dB(this,qe);if(wl(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),ie!=4||f.length!=0||this.h.h||(this.m=1,rt(16),a=!1),this.o=this.o&&a,!a)qr(this.i,this.l,f,"[Invalid Chunked Response]"),cr(this),xs(this);else if(f.length>0&&!this.W){this.W=!0;var J=this.j;J.g==this&&J.aa&&!J.P&&(J.j.info("Great, no buffering proxy detected. Bytes received: "+f.length),wB(J),J.P=!0,rt(11))}}else qr(this.i,this.l,f,null),dB(this,f);ie==4&&cr(this),this.o&&!this.K&&(ie==4?Wl(this.j,this):(this.o=!1,ro(this)))}else zm(this.g),l==400&&f.indexOf("Unknown SID")>0?(this.m=3,rt(12)):(this.m=0,rt(13)),cr(this),xs(this)}}}catch{}finally{}};function Om(a){if(!wl(a))return a.g.la();const l=Ul(a.g);if(l==="")return"";let f="";const C=l.length,b=Rn(a.g)==4;if(!a.h.i){if(typeof TextDecoder>"u")return cr(a),xs(a),"";a.h.i=new o.TextDecoder}for(let P=0;P<C;P++)a.h.h=!0,f+=a.h.i.decode(l[P],{stream:!(b&&P==C-1)});return l.length=0,a.h.g+=f,a.C=0,a.h.g}function wl(a){return a.g?a.v=="GET"&&a.M!=2&&a.j.Aa:!1}function Nm(a,l){var f=a.C,C=l.indexOf(`
1565`,f);return C==-1?lB:(f=Number(l.substring(f,C)),isNaN(f)?_l:(C+=1,C+f>l.length?lB:(l=l.slice(C,C+f),a.C=C+f,l)))}In.prototype.cancel=function(){this.K=!0,cr(this)};function ro(a){a.T=Date.now()+a.H,yl(a,a.H)}function yl(a,l){if(a.D!=null)throw Error("WatchDog timer not null");a.D=Ls(u(a.aa,a),l)}function fB(a){a.D&&(o.clearTimeout(a.D),a.D=null)}In.prototype.aa=function(){this.D=null;const a=Date.now();a-this.T>=0?(bm(this.i,this.B),this.M!=2&&(Fs(),rt(17)),cr(this),this.m=2,xs(this)):yl(this,this.T-a)};function xs(a){a.j.I==0||a.K||Wl(a.j,a)}function cr(a){fB(a);var l=a.O;l&&typeof l.dispose=="function"&&l.dispose(),a.O=null,ul(a.V),a.g&&(l=a.g,a.g=null,l.abort(),l.dispose())}function dB(a,l){try{var f=a.j;if(f.I!=0&&(f.g==a||CB(f.h,a))){if(!a.L&&CB(f.h,a)&&f.I==3){try{var C=f.Ba.g.parse(l)}catch{C=null}if(Array.isArray(C)&&C.length==3){var b=C;if(b[0]==0){e:if(!f.v){if(f.g)if(f.g.F+3e3<a.F)co(f),ao(f);else break e;DB(f),rt(18)}}else f.xa=b[1],0<f.xa-f.K&&b[2]<37500&&f.F&&f.A==0&&!f.C&&(f.C=Ls(u(f.Va,f),6e3));Al(f.h)<=1&&f.ta&&(f.ta=void 0)}else lr(f,11)}else if((a.L||f.g==a)&&co(f),!D(l))for(b=f.Ba.g.parse(l),l=0;l<b.length;l++){let Ee=b[l];const qe=Ee[0];if(!(qe<=f.K))if(f.K=qe,Ee=Ee[1],f.I==2)if(Ee[0]=="c"){f.M=Ee[1],f.ba=Ee[2];const Jt=Ee[3];Jt!=null&&(f.ka=Jt,f.j.info("VER="+f.ka));const hr=Ee[4];hr!=null&&(f.za=hr,f.j.info("SVER="+f.za));const vn=Ee[5];vn!=null&&typeof vn=="number"&&vn>0&&(C=1.5*vn,f.O=C,f.j.info("backChannelRequestTimeoutMs_="+C)),C=f;const bn=a.g;if(bn){const lo=bn.g?bn.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(lo){var P=C.h;P.g||lo.indexOf("spdy")==-1&&lo.indexOf("quic")==-1&&lo.indexOf("h2")==-1||(P.j=P.l,P.g=new Set,P.h&&(pB(P,P.h),P.h=null))}if(C.G){const yB=bn.g?bn.g.getResponseHeader("X-HTTP-Session-Id"):null;yB&&(C.wa=yB,Ie(C.J,C.G,yB))}}f.I=3,f.l&&f.l.ra(),f.aa&&(f.T=Date.now()-a.F,f.j.info("Handshake RTT: "+f.T+"ms")),C=f;var J=a;if(C.na=Yl(C,C.L?C.ba:null,C.W),J.L){Rl(C.h,J);var ie=J,Ge=C.O;Ge&&(ie.H=Ge),ie.D&&(fB(ie),ro(ie)),C.g=J}else Kl(C);f.i.length>0&&Bo(f)}else Ee[0]!="stop"&&Ee[0]!="close"||lr(f,7);else f.I==3&&(Ee[0]=="stop"||Ee[0]=="close"?Ee[0]=="stop"?lr(f,7):_B(f):Ee[0]!="noop"&&f.l&&f.l.qa(Ee),f.A=0)}}Fs(4)}catch{}}var Fm=class{constructor(a,l){this.g=a,this.map=l}};function Il(a){this.l=a||10,o.PerformanceNavigationTiming?(a=o.performance.getEntriesByType("navigation"),a=a.length>
15650&&(a[0].nextHopProtocol=="hq"||a[0].nextHopProtocol=="h2")):a=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=a?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function Tl(a){return a.h?!0:a.g?a.g.size>=a.j:!1}function Al(a){return a.h?1:a.g?a.g.size:0}function CB(a,l){return a.h?a.h==l:a.g?a.g.has(l):!1}function pB(a,l){a.g?a.g.add(l):a.h=l}function Rl(a,l){a.h&&a.h==l?a.h=null:a.g&&a.g.has(l)&&a.g.delete(l)}Il.prototype.cancel=function(){if(this.i=vl(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const a of this.g.values())a.cancel();this.g.clear()}};function vl(a){if(a.h!=null)return a.i.concat(a.h.G);if(a.g!=null&&a.g.size!==0){let l=a.i;for(const f of a.g.values())l=l.concat(f.G);return l}return _(a.i)}var bl=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Lm(a,l){if(a){a=a.split("&");for(let f=0;f<a.length;f++){const C=a[f].indexOf("=");let b,P=null;C>=0?(b=a[f].substring(0,C),P=a[f].substring(C+1)):b=a[f],l(b,P?decodeURIComponent(P.replace(/\+/g," ")):"")}}}function Tn(a){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let l;a instanceof Tn?(this.l=a.l,Ms(this,a.j),this.o=a.o,this.g=a.g,Gs(this,a.u),this.h=a.h,gB(this,Ll(a.i)),this.m=a.m):a&&(l=String(a).match(bl))?(this.l=!1,Ms(this,l[1]||"",!0),this.o=Us(l[2]||""),this.g=Us(l[3]||"",!0),Gs(this,l[4]),this.h=Us(l[5]||"",!0),gB(this,l[6]||"",!0),this.m=Us(l[7]||"")):(this.l=!1,this.i=new qs(null,this.l))}Tn.prototype.toString=function(){const a=[];var l=this.j;l&&a.push(Hs(l,Sl,!0),":");var f=this.g;return(f||l=="file")&&(a.push("//"),(l=this.o)&&a.push(Hs(l,Sl,!0),"@"),a.push(Vs(f).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),f=this.u,f!=null&&a.push(":",String(f))),(f=this.h)&&(this.g&&f.charAt(0)!="/"&&a.push("/"),a.push(Hs(f,f.charAt(0)=="/"?xm:Vm,!0))),(f=this.i.toString())&&a.push("?",f),(f=this.m)&&a.push("#",Hs(f,Gm)),a.join("")},Tn.prototype.resolve=function(a){const l=qt(this);let f=!!a.j;f?Ms(l,a.j):f=!!a.o,f?l.o=a.o:f=!!a.g,f?l.g=a.g:f=a.u!=null;var C=a.h;if(f)Gs(l,a.u);else if(f=!!a.h){if(C.charAt(0)!="/")if(this.g&&!this.h)C="/"+C;else{var b=l.h.lastIndexOf("/");b!=-1&&(C=l.h.slice(0,b+1)+C)}if(b=C,b==".."||b==".")C="";else if(b.indexOf("./")!=-1||b.indexOf("/.")!=-1){C=b.lastIndexOf("/",0)==0,b=b.split("/");const P=[];for(let J=0;J<b.length;){const ie=b[J++];ie=="."?C&&J==b.length&&P.push(""):ie==".."?((P.length>1||P.length==1&&P[0]!="")&&P.pop(),C&&J==b.length&&P.push("")):(P.push(ie),C=!0)}C=P.join("/")}else C=b}return f?l.h=C:f=a.i.toString()!=="",f?gB(l,Ll(a.i)):f=!!a.m,f&&(l.m=a.m),l};function qt(a){return new Tn(a)}function Ms(a,l,f){a.j=f?Us(l,!0):l,a.j&&(a.j=a.j.replace(/:$/,""))}function Gs(a,l){if(l){if(l=Number(l),isNaN(l)||l<0)throw Error("Bad port number "+l);a.u=l}else a.u=null}function gB(a,l,f){l instanceof qs?(a.i=l,Um(a.i,a.l)):(f||(l=Hs(l,Mm)),a.i=new qs(l,a.l))}function Ie(a,l,f){a.i.set(l,f)}function so(a){return Ie(a,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),a}function Us(a,l){return a?l?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""}function Hs(a,l,f){return typeof a=="string"?(a=encodeURI(a).replace(l,km),f&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}function km(a){return a=a.charCodeAt(0),"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var Sl=/[#\/\?@]/g,Vm=/[#\?:]/g,xm=/[#\?]/g,Mm=/[#\?@]/g,Gm=/#/g;function qs(a,l){this.h=this.g=null,this.i=a||null,this.j=!!l}function ur(a){a.g||(a.g=new Map,a.h=0,a.i&&Lm(a.i,function(l,f){a.add(decodeURIComponent(l.replace(/\+/g," ")),f)}))}n=qs.prototype,n.add=function(a,l){ur(this),this.i=null,a=Jr(this,a);let f=this.g.get(a);return f||this.g.set(a,f=[]),f.push(l),this.h+=1,this};function Pl(a,l){ur(a),l=Jr(a,l),a.g.has(l)&&(a.i=null,a.h-=a.g.get(l).length,a.g.delete(l))}function Ol(a,l){return ur(a),l=Jr(a,l),a.g.has(l)}n.forEach=function(a,l){ur(this),this.g.forEach(function(f,C){f.forEach(function(b){a.call(l,b,C,this)},this)},this)};function Nl(a,l){ur(a);let f=[];if(typeof l=="string")Ol(a,l)&&(f=f.concat(a.g.get(Jr(a,l))));else for(a=Array.from(a.g.values()),l=0;l<a.length;l++)f=f.concat(a[l]);return f}n.set=function(a,l){return ur(this),this.i=null,a=Jr(this,a),Ol(this,a)&&(this.h-=this.g.get(a).length),this.g.set(a,[l]),this.h+=1,this},n.get=function(a,l){return a?(a=Nl(this,a),a.length>0?String(a[0]):l):l};
vendor: 16,948 bytes, lines 1565-1568
1565function Fl(a,l,f){Pl(a,l),f.length>0&&(a.i=null,a.g.set(Jr(a,l),_(f)),a.h+=f.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";const a=[],l=Array.from(this.g.keys());for(let C=0;C<l.length;C++){var f=l[C];const b=Vs(f);f=Nl(this,f);for(let P=0;P<f.length;P++){let J=b;f[P]!==""&&(J+="="+Vs(f[P])),a.push(J)}}return this.i=a.join("&")};function Ll(a){const l=new qs;return l.i=a.i,a.g&&(l.g=new Map(a.g),l.h=a.h),l}function Jr(a,l){return l=String(l),a.j&&(l=l.toLowerCase()),l}function Um(a,l){l&&!a.j&&(ur(a),a.i=null,a.g.forEach(function(f,C){const b=C.toLowerCase();C!=b&&(Pl(this,C),Fl(this,b,f))},a)),a.j=l}function Hm(a,l){const f=new ks;if(o.Image){const C=new Image;C.onload=h(An,f,"TestLoadImage: loaded",!0,l,C),C.onerror=h(An,f,"TestLoadImage: error",!1,l,C),C.onabort=h(An,f,"TestLoadImage: abort",!1,l,C),C.ontimeout=h(An,f,"TestLoadImage: timeout",!1,l,C),o.setTimeout(function(){C.ontimeout&&C.ontimeout()},1e4),C.src=a}else l(!1)}function qm(a,l){const f=new ks,C=new AbortController,b=setTimeout(()=>{C.abort(),An(f,"TestPingServer: timeout",!1,l)},1e4);fetch(a,{signal:C.signal}).then(P=>{clearTimeout(b),P.ok?An(f,"TestPingServer: ok",!0,l):An(f,"TestPingServer: server error",!1,l)}).catch(()=>{clearTimeout(b),An(f,"TestPingServer: error",!1,l)})}function An(a,l,f,C,b){try{b&&(b.onload=null,b.onerror=null,b.onabort=null,b.ontimeout=null),C(f)}catch{}}function Jm(){this.g=new Am}function mB(a){this.i=a.Sb||null,this.h=a.ab||!1}d(mB,ll),mB.prototype.g=function(){return new io(this.i,this.h)};function io(a,l){We.call(this),this.H=a,this.o=l,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}d(io,We),n=io.prototype,n.open=function(a,l){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=a,this.D=l,this.readyState=1,js(this)},n.send=function(a){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const l={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};a&&(l.body=a),(this.H||o).fetch(new Request(this.D,l)).then(this.Pa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,Js(this)),this.readyState=0},n.Pa=function(a){if(this.g&&(this.l=a,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=a.headers,this.readyState=2,js(this)),this.g&&(this.readyState=3,js(this),this.g)))if(this.responseType==="arraybuffer")a.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream<"u"&&"body"in a){if(this.j=a.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;kl(this)}else a.text().then(this.Oa.bind(this),this.ga.bind(this))};function kl(a){a.j.read().then(a.Ma.bind(a)).catch(a.ga.bind(a))}n.Ma=function(a){if(this.g){if(this.o&&a.value)this.response.push(a.value);else if(!this.o){var l=a.value?a.value:new Uint8Array(0);(l=this.B.decode(l,{stream:!a.done}))&&(this.response=this.responseText+=l)}a.done?Js(this):js(this),this.readyState==3&&kl(this)}},n.Oa=function(a){this.g&&(this.response=this.responseText=a,Js(this))},n.Na=function(a){this.g&&(this.response=a,Js(this))},n.ga=function(){this.g&&Js(this)};function Js(a){a.readyState=4,a.l=null,a.j=null,a.B=null,js(a)}n.setRequestHeader=function(a,l){this.A.append(a,l)},n.getResponseHeader=function(a){return this.h&&this.h.get(a.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";const a=[],l=this.h.entries();for(var f=l.next();!f.done;)f=f.value,a.push(f[0]+": "+f[1]),f=l.next();return a.join(`\r
1566`)};function js(a){a.onreadystatechange&&a.onreadystatechange.call(a)}Object.defineProperty(io.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(a){this.m=a?"include":"same-origin"}});function Vl(a){let l="";return Xi(a,function(f,C){l+=C,l+=":",l+=f,l+=`\r
1567`}),l}function EB(a,l,f){e:{for(C in f){var C=!1;break e}C=!0}C||(f=Vl(f),typeof a=="string"?f!=null&&Vs(f):Ie(a,l,f))}function Pe(a){We.call(this),this.headers=new Map,this.L=a||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}d(Pe,We);var jm=/^https?$/i,Km=["POST","PUT"];n=Pe.prototype,n.Fa=function(a){this.H=a},n.ea=function(a,l,f,C){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+a);l=l?l.toUpperCase():"GET",this.D=a,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():ml.g(),this.g.onreadystatechange=p(u(this.Ca,this));try{this.B=!0,this.g.open(l,String(a),!0),this.B=!1}catch(P){xl(this,P);return}if(a=f||"",f=new Map(this.headers),C)if(Object.getPrototypeOf(C)===Object.prototype)for(var b in C)f.set(b,C[b]);else if(typeof C.keys=="function"&&typeof C.get=="function")for(const P of C.keys())f.set(P,C.get(P));else throw Error("Unknown input type for opt_headers: "+String(C));C=Array.from(f.keys()).find(P=>P.toLowerCase()=="content-type"),b=o.FormData&&a instanceof o.FormData,!(Array.prototype.indexOf.call(Km,l,void 0)>=0)||C||b||f.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[P,J]of f)this.g.setRequestHeader(P,J);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(a),this.v=!1}catch(P){xl(this,P)}};function xl(a,l){a.h=!1,a.g&&(a.j=!0,a.g.abort(),a.j=!1),a.l=l,a.o=5,Ml(a),oo(a)}function Ml(a){a.A||(a.A=!0,nt(a,"complete"),nt(a,"error"))}n.abort=function(a){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=a||7,nt(this,"complete"),nt(this,"abort"),oo(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),oo(this,!0)),Pe.Z.N.call(this)},n.Ca=function(){this.u||(this.B||this.v||this.j?Gl(this):this.Xa())},n.Xa=function(){Gl(this)};function Gl(a){if(a.h&&typeof i<"u"){if(a.v&&Rn(a)==4)setTimeout(a.Ca.bind(a),0);else if(nt(a,"readystatechange"),Rn(a)==4){a.h=!1;try{const P=a.ca();e:switch(P){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var l=!0;break e;default:l=!1}var f;if(!(f=l)){var C;if(C=P===0){let J=String(a.D).match(bl)[1]||null;!J&&o.self&&o.self.location&&(J=o.self.location.protocol.slice(0,-1)),C=!jm.test(J?J.toLowerCase():"")}f=C}if(f)nt(a,"complete"),nt(a,"success");else{a.o=6;try{var b=Rn(a)>2?a.g.statusText:""}catch{b=""}a.l=b+" ["+a.ca()+"]",Ml(a)}}finally{oo(a)}}}}function oo(a,l){if(a.g){a.m&&(clearTimeout(a.m),a.m=null);const f=a.g;a.g=null,l||nt(a,"ready");try{f.onreadystatechange=null}catch{}}}n.isActive=function(){return!!this.g};function Rn(a){return a.g?a.g.readyState:0}n.ca=function(){try{return Rn(this)>2?this.g.status:-1}catch{return-1}},n.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},n.La=function(a){if(this.g){var l=this.g.responseText;return a&&l.indexOf(a)==0&&(l=l.substring(a.length)),Tm(l)}};function Ul(a){try{if(!a.g)return null;if("response"in a.g)return a.g.response;switch(a.F){case"":case"text":return a.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in a.g)return a.g.mozResponseArrayBuffer}return null}catch{return null}}function zm(a){const l={};a=(a.g&&Rn(a)>=2&&a.g.getAllResponseHeaders()||"").split(`\r
1568`);for(let C=0;C<a.length;C++){if(D(a[C]))continue;var f=Pm(a[C]);const b=f[0];if(f=f[1],typeof f!="string")continue;f=f.trim();const P=l[b]||[];l[b]=P,P.push(f)}Em(l,function(C){return C.join(", ")})}n.ya=function(){return this.o},n.Ha=function(){return typeof this.l=="string"?this.l:String(this.l)};function Ks(a,l,f){return f&&f.internalChannelParams&&f.internalChannelParams[a]||l}function Hl(a){this.za=0,this.i=[],this.j=new ks,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=Ks("failFast",!1,a),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=Ks("baseRetryDelayMs",5e3,a),this.Za=Ks("retryDelaySeedMs",1e4,a),this.Ta=Ks("forwardChannelMaxRetries",2,a),this.va=Ks("forwardChannelRequestTimeoutMs",2e4,a),this.ma=a&&a.xmlHttpFactory||void 0,this.Ua=a&&a.Rb||void 0,this.Aa=a&&a.useFetchStreams||!1,this.O=void 0,this.L=a&&a.supportsCrossDomainXhr||!1,this.M="",this.h=new Il(a&&a.concurrentRequestLimit),this.Ba=new Jm,this.S=a&&a.fastHandshake||!1,this.R=a&&a.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=a&&a.Pb||!1,a&&a.ua&&this.j.ua(),a&&a.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&a&&a.detectBufferingProxy||!1,this.ia=void 0,a&&a.longPollingTimeout&&a.longPollingTimeout>0&&(this.ia=a.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}n=Hl.prototype,n.ka=8,n.I=1,n.connect=function(a,l,f,C){rt(0),this.W=a,this.H=l||{},f&&C!==void 0&&(this.H.OSID=f,this.H.OAID=C),this.F=this.X,this.J=Yl(this,null,this.W),Bo(this)};function _B(a){if(ql(a),a.I==3){var l=a.V++,f=qt(a.J);if(Ie(f,"SID",a.M),Ie(f,"RID",l),Ie(f,"TYPE","terminate"),zs(a,f),l=new In(a,a.j,l),l.M=2,l.A=so(qt(f)),f=!1,o.navigator&&o.navigator.sendBeacon)try{f=o.navigator.sendBeacon(l.A.toString(),"")}catch{}!f&&o.Image&&(new Image().src=l.A,f=!0),f||(l.g=Xl(l.j,null),l.g.ea(l.A)),l.F=Date.now(),ro(l)}Ql(a)}function ao(a){a.g&&(wB(a),a.g.cancel(),a.g=null)}function ql(a){ao(a),a.v&&(o.clearTimeout(a.v),a.v=null),co(a),a.h.cancel(),a.m&&(typeof a.m=="number"&&o.clearTimeout(a.m),a.m=null)}function Bo(a){if(!Tl(a.h)&&!a.m){a.m=!0;var l=a.Ea;ye||E(),pe||(ye(),pe=!0),R.add(l,a),a.D=0}}function Wm(a,l){return Al(a.h)>=a.h.j-(a.m?1:0)?!1:a.m?(a.i=l.G.concat(a.i),!0):a.I==1||a.I==2||a.D>=(a.Sa?0:a.Ta)?!1:(a.m=Ls(u(a.Ea,a,l),$l(a,a.D)),a.D++,!0)}n.Ea=function(a){if(this.m)if(this.m=null,this.I==1){if(!a){this.V=Math.floor(Math.random()*1e5),a=this.V++;const b=new In(this,this.j,a);let P=this.o;if(this.U&&(P?(P=tl(P),rl(P,this.U)):P=this.U),this.u!==null||this.R||(b.J=P,P=null),this.S)e:{for(var l=0,f=0;f<this.i.length;f++){t:{var C=this.i[f];if("__data__"in C.map&&(C=C.map.__data__,typeof C=="string")){C=C.length;break t}C=void 0}if(C===void 0)break;if(l+=C,l>4096){l=f;break e}if(l===4096||f===this.i.length-1){l=f+1;break e}}l=1e3}else l=1e3;l=jl(this,b,l),f=qt(this.J),Ie(f,"RID",a),Ie(f,"CVER",22),this.G&&Ie(f,"X-HTTP-Session-Id",this.G),zs(this,f),P&&(this.R?l="headers="+Vs(Vl(P))+"&"+l:this.u&&EB(f,this.u,P)),pB(this.h,b),this.Ra&&Ie(f,"TYPE","init"),this.S?(Ie(f,"$req",l),Ie(f,"SID","null"),b.U=!0,hB(b,f,null)):hB(b,f,l),this.I=2}}else this.I==3&&(a?Jl(this,a):this.i.length==0||Tl(this.h)||Jl(this))};function Jl(a,l){var f;l?f=l.l:f=a.V++;const C=qt(a.J);Ie(C,"SID",a.M),Ie(C,"RID",f),Ie(C,"AID",a.K),zs(a,C),a.u&&a.o&&EB(C,a.u,a.o),f=new In(a,a.j,f,a.D+1),a.u===null&&(f.J=a.o),l&&(a.i=l.G.concat(a.i)),l=jl(a,f,1e3),f.H=Math.round(a.va*.5)+Math.round(a.va*.5*Math.random()),pB(a.h,f),hB(f,C,l)}function zs(a,l){a.H&&Xi(a.H,function(f,C){Ie(l,C,f)}),a.l&&Xi({},function(f,C){Ie(l,C,f)})}function jl(a,l,f){f=Math.min(a.i.length,f);const C=a.l?u(a.l.Ka,a.l,a):null;e:{var b=a.i;let ie=-1;for(;;){const Ge=["count="+f];ie==-1?f>0?(ie=b[0].g,Ge.push("ofs="+ie)):ie=0:Ge.push("ofs="+ie);let Ee=!0;for(let qe=0;qe<f;qe++){var P=b[qe].g;const Jt=b[qe].map;if(P-=ie,P<0)ie=Math.max(0,b[qe].g-100),Ee=!1;else try{P="req"+P+"_"||"";try{var J=Jt instanceof Map?Jt:Object.entries(Jt);for(const[hr,vn]of J){let bn=vn;B(vn)&&(bn=aB(vn)),Ge.push(P+hr+"="+encodeURIComponent(bn))}}catch(hr){throw Ge.push(P+"type="+encodeURIComponent("_badmap")),hr}}catch{C&&C(Jt)}}if(Ee){J=Ge.join("&");break e}}J=void 0}return a=a.i.splice(0,f),l.G=a,J}function Kl(a){if(!a.g&&!a.v){a.Y=1;var l=a.Da;ye||E(),pe||(ye(),pe=!0),R.add(l,a),a.A=0}}function DB(a){return a.g||a.v||a.A>=3?!1:(a.Y++,a.v=Ls(u(a.Da,a),$l(a,a.A)),a.A++,!0)}n.Da=function(){if(this.v=null,zl(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var a=4*this.T;this.j.info("BP detection timer enabled: "+a),this.B=Ls(u(this.Wa,this),a)}},n.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,rt(10),ao(this),zl(this))};function wB(a){a.B!=null&&(o.clearTimeout(a.B),a.B=null)}function zl(a){a.g=new In(a,a.j,"rpc",a.Y),a.u===null&&(a.g.J=a.o),a.g.P=0;var l=qt(a.na);Ie(l,"RID","rpc"),Ie(l,"SID",a.M),Ie(l,"AID",a.K),Ie(l,"CI",a.F?"0":"1"),!a.F&&a.ia&&Ie(l,"TO",a.ia),Ie(l,"TYPE","xmlhttp"),zs(a,l),a.u&&a.o&&EB(l,a.u,a.o),a.O&&(a.g.H=a.O);var f=a.g;a=a.ba,f.M=1,f.A=so(qt(l)),f.u=null,f.R=!0,Dl(f,a)}n.Va=function(){this.C!=null&&(this.C=null,ao(this),DB(this),rt(19))};function co(a){a.C!=null&&(o.clearTimeout(a.C),a.C=null)}function Wl(a,l){var f=null;if(a.g==l){co(a),wB(a),a.g=null;var C=2}else if(CB(a.h,l))f=l.G,Rl(a.h,l),C=1;else return;if(a.I!=0){if(l.o)if(C==1){f=l.u?l.u.length:0,l=Date.now()-l.F;var b=a.D;C=to(),nt(C,new pl(C,f)),Bo(a)}else Kl(a);else if(b=l.m,b==3||b==0&&l.X>0||!(C==1&&Wm(a,l)||C==2&&DB(a)))switch(f&&f.length>0&&(l=a.h,l.i=l.i.concat(f)),b){case 1:lr(a,5);break;case 4:lr(a,10);break;case 3:lr(a,6);break;default:lr(a,2)}}}function $l(a,l){let f=a.Qa+Math.floor(Math.random()*a.Za);return a.isActive()||(f*=2),f*l}function lr(a,l){if(a.j.info("Error code "+l),l==2){var f=u(a.bb,a),C=a.Ua;const b=!C;C=new Tn(C||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||Ms(C,"https"),so(C),b?Hm(C.toString(),f):qm(C.toString(),f)}else rt(2);a.I=0,a.l&&a.l.pa(l),Ql(a),ql(a)}n.bb=function(a){a?(this.j.info("Successfully pinged google.com"),rt(2)):(this.j.info("Failed to ping google.com"),rt(1))};function Ql(a){if(a.I=0,a.ja=[],a.l){const l=vl(a.h);(l.length!=0||a.i.length!=0)&&(y(a.ja,l),y(a.ja,a.i),a.h.i.length=0,_(a.i),a.i.length=0),a.l.oa()}}function Yl(a,l,f){var C=f instanceof Tn?qt(f):new Tn(f);if(C.g!="")l&&(C.g=l+"."+C.g),Gs(C,C.u);else{var b=o.location;C=b.protocol,l=l?l+"."+b.hostname:b.hostname,b=+b.port;const P=new Tn(null);C&&Ms(P,C),l&&(P.g=l),b&&Gs(P,b),f&&(P.h=f),C=P}return f=a.G,l=a.wa,f&&l&&Ie(C,f,l),Ie(C,"VER",a.ka),zs(a,C),C}function Xl(a,l,f){if(l&&!a.L)throw Error("Can't create secondary domain capable XhrIo object.");return l=a.Aa&&!a.ma?new Pe(new mB({ab:f})):new Pe(a.ma),l.Fa(a.L),l}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function Zl(){}n=Zl.prototype,n.ra=function(){},n.qa=function(){},n.pa=function(){},n.oa=function(){},n.isActive=function(){return!0},n.Ka=function(){};function uo(){}uo.prototype.g=function(a,l){return new _t(a,l)};function _t(a,l){We.call(this),this.g=new Hl(l),this.l=a,this.h=l&&l.messageUrlParams||null,a=l&&l.messageHeaders||null,l&&l.clientProtocolHeaderRequired&&(a?a["X-Client-Protocol"]="webchannel":a={"X-Client-Protocol":"webchannel"}),this.g.o=a,a=l&&l.initMessageHeaders||null,l&&l.messageContentType&&(a?a["X-WebChannel-Content-Type"]=l.messageContentType:a={"X-WebChannel-Content-Type":l.messageContentType}),l&&l.sa&&(a?a["X-WebChannel-Client-Profile"]=l.sa:a={"X-WebChannel-Client-Profile":l.sa}),this.g.U=a,(a=l&&l.Qb)&&!D(a)&&(this.g.u=a),this.A=l&&l.supportsCrossDomainXhr||!1,this.v=l&&l.sendRawJson||!1,(l=l&&l.httpSessionIdParam)&&!D(l)&&(this.g.G=l,a=this.h,a!==null&&l in a&&(a=this.h,l in a&&delete a[l])),this.j=new jr(this)}d(_t,We),_t.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},_t.prototype.close=function(){_B(this.g)},_t.prototype.o=function(a){var l=this.g;if(typeof a=="string"){var f={};f.__data__=a,a=f}else this.v&&(f={},f.__data__=aB(a),a=f);l.i.push(new Fm(l.Ya++,a)),l.I==3&&Bo(l)},_t.prototype.N=function(){this.g.l=null,delete this.j,_B(this.g),delete this.g,_t.Z.N.call(this)};function eh(a){BB.call(this),a.__headers__&&(this.headers=a.__headers__,this.statusCode=a.__status__,delete a.__headers__,delete a.__status__);var l=a.__sm__;if(l){e:{for(const f in l){a=f;break e}a=void 0}(this.i=a)&&(a=this.i,l=l!==null&&a in l?l[a]:void 0),this.data=l}else this.data=a}d(eh,BB);function th(){cB.call(this),this.status=1}d(th,cB);function jr(a){this.g=a}d(jr,Zl),jr.prototype.ra=function(){nt(this.g,"a")},jr.prototype.qa=function(a){nt(this.g,new eh(a))},jr.prototype.pa=function(a){nt(this.g,new th)},jr.prototype.oa=function(){nt(this.g,"b")},uo.prototype.createWebChannel=uo.prototype.g,_t.prototype.send=_t.prototype.o,_t.prototype.open=_t.prototype.m,_t.prototype.close=_t.prototype.close,_C=function(){return new uo},EC=function(){return to()}
1568,mC=Br,rc={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},no.NO_ERROR=0,no.TIMEOUT=8,no.HTTP_ERROR=6,Fo=no,gl.COMPLETE="complete",gC=gl,hl.EventType=Ns,Ns.OPEN="a",Ns.CLOSE="b",Ns.ERROR="c",Ns.MESSAGE="d",We.prototype.listen=We.prototype.J,Zs=hl,Pe.prototype.listenOnce=Pe.prototype.K,Pe.prototype.getLastError=Pe.prototype.Ha,Pe.prototype.getLastErrorCode=Pe.prototype.ya,Pe.prototype.getStatus=Pe.prototype.ca,Pe.prototype.getResponseJson=Pe.prototype.La,Pe.prototype.getResponseText=Pe.prototype.la,Pe.prototype.send=Pe.prototype.ea,Pe.prototype.setWithCredentials=Pe.prototype.Fa,pC=Pe}).apply(typeof fo<"u"?fo:typeof self<"u"?self:typeof window<"u"?window:{});/*!
1569* re2js
1570* RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
1571*
1572* @version v2.8.6
1573* @author Oleksii Vasyliev
1574* @homepage https://github.com/le0pard/re2js#readme
1575* @repository github:le0pard/re2js
1576* @license MIT
1577*/var _e,M=(_e=class{},U(_e,"FOLD_CASE",1),U(_e,"LITERAL",2),U(_e,"CLASS_NL",4),U(_e,"DOT_NL",8),U(_e,"ONE_LINE",16),U(_e,"NON_GREEDY",32),U(_e,"PERL_X",64),U(_e,"UNICODE_GROUPS",128),U(_e,"WAS_DOLLAR",256),U(_e,"LOOKBEHIND",512),U(_e,"MATCH_NL",_e.CLASS_NL|_e.DOT_NL),U(_e,"PERL",_e.CLASS_NL|_e.ONE_LINE|_e.PERL_X|_e.UNICODE_GROUPS),U(_e,"POSIX",0),U(_e,"UNANCHORED",0),U(_e,"ANCHOR_START",1),U(_e,"ANCHOR_BOTH",2),_e);const Kr={CASE_INSENSITIVE:1,DOTALL:2,MULTILINE:4,DISABLE_UNICODE_GROUPS:8,LONGEST_MATCH:16,LOOKBEHINDS:512},gi=128,sc=new Int32Array(gi),ic=new Int32Array(gi),Co=65535;for(let n=0;n<gi;n++)n>=97&&n<=122?sc[n]=n-32:sc[n]=n,n>=65&&n<=90?ic[n]=n+32:ic[n]=n;var $B,N=($B=class{static toUpperCase(n){if(n<gi)return sc[n];const e=String.fromCodePoint(n).toUpperCase(),t=e.codePointAt(0)>Co?2:1;if(e.length>t)return n;const r=String.fromCodePoint(e.codePointAt(0)).toLowerCase(),s=r.codePointAt(0)>Co?2:1;return r.length>s||r.codePointAt(0)!==n?n:e.codePointAt(0)}static toLowerCase(n){if(n<gi)return ic[n];const e=String.fromCodePoint(n).toLowerCase(),t=e.codePointAt(0)>Co?2:1;if(e.length>t)return n;const r=String.fromCodePoint(e.codePointAt(0)).toUpperCase(),s=r.codePointAt(0)>Co?2:1;return r.length>s||r.codePointAt(0)!==n?n:e.codePointAt(0)}},U($B,"CODES",new Map([["\x07",7],["\b",8],["	",9],[`
1578`,10],["\v",11],["\f",12],["\r",13],[" ",32],['"',34],["$",36],["&",38],["'",39],["(",40],[")",41],["*",42],["+",43],["-",45],[".",46],["0",48],["1",49],["2",50],["3",51],["4",52],["5",53],["6",54],["7",55],["8",56],["9",57],[":",58],["<",60],[">",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["`",96],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]])),$B),g=class{constructor(n,e=!1){this.data=n,this.isStride1=e,this.SIZE=e?2:3}getLo(n){return this.data[n*this.SIZE]}getHi(n){return this.data[n*this.SIZE+1]}getStride(n){return this.isStride1?1:this.data[n*this.SIZE+2]}get length(){return this.data.length/this.SIZE}};const DC=new Uint8Array(256);for(let n=0,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-";n<64;n++)DC[e.charCodeAt(n)]=n;const wC=n=>{const e=[];let t=0,r=0;for(let s=0;s<n.length;s++){let i=DC[n.charCodeAt(s)];t|=(i&31)<<r,i&32?r+=5:(e.push(t),t=0,r=0)}return e},m=(n,e)=>{const t=wC(n),r=e?t.length/2:t.length/3,s=new Uint32Array(r*3);let i=0,o=0;for(let B=0;B<r;B++)i+=t[o++],s[B*3]=i,i+=t[o++],s[B*3+1]=i,s[B*3+2]=e?1:t[o++];return s},Nw=n=>{const e=wC(n),t=new Map;let r=0;for(let s=0;s<e.length;s+=2){r+=e[s];const i=e[s+1],o=i>>>1^-(i&1);t.set(r,r+o)}return t};var po=class{constructor(n){this.initializer=n,this.cache=new Map}has(n){return n in this.initializer}get(n){if(this.cache.has(n))return this.cache.get(n);const e=this.initializer[n],t=e?e():null;return this.cache.set(n,t),t}},On,lt=(On=class{static get CASE_ORBIT(){return this._CASE_ORBIT||(this._CASE_ORBIT=Nw("rCgCIgCY+rQI4QiCuuBLgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCCgCBgCBgCBgCBgCBgCBgCB+7OB-BB-BB-BB-BB-BBskQB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BC-BB-BB-BB-BB-BB-BB-BByHBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBDCBBBCBBBCBBCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBxHBCBBBCBBBCBBB3SBmMBkNBCBBBCBBB8MBCBBB6MB6MBCBBC+EB0MB2MBCBBB6MB+MBiGBmNBiNBCBBBmKBikzCBmNBqNBkIBsNBCBBBCBBBCBBB0NBCBBB0NDCBBB0NBCBBByNByNBCBBBCBBB2NBCBBDCBBCwDFCBCBDBCBCBDBCBCBDBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBB9EBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCCBCBDBCBBBhGBvDBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBjICCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBH2iVBCBBBlKBwiVB+jVB+jVBCBBBlMBqEBuEBCBBBCBBBCBBBCBBBCBBB+hVB4hVB8hVBjNB7MC5MB5MCzMC1MB+0yCE5MB20yCC9MBu2yCBwyyCBo0yCChNBlNBo0yCBu-UBi0yCDlNC6-UBpNDrNIu+UDzNCm0yCBzNE0yyCBzNBpEBxNBxNBtEG1NLqxyCBkxyCnFoFrBCBBBCBBDCBBEkIBkIBkICoHHsCCqCBqCBqCCgEC+DB+DBmkOBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCC+BBgCBgCBgCBgCBgCBgCBgCBgCBrCBpCBpCBpCBmjOB-BB8BB-B
1578B-BBgEB-BB-BByBBqgOBsDB-BBtwBB-BB-BB-BBsBBgDBCB-BB-BB-BBeB-BB-BB61OB-BB-BB-DB9DB9DBQB7DBmCE9CBrDBPBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBrFB-EBOBnHB3FB-FCCBBBNBCBBCjIBjIBjIBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCB-BB-BB8kMB-BB6kMB-BB-BB-BB-BB-BB-BB-BB-BB-BBokMB-BB-BBkkMBkkMB-BB-BB-BB-BB-BB-BB-BB4jMB-BB-BB-BB-BB-BB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EBCBBBCBoiMBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBJCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBeBCBBBCBBBCBBBCBBBCBBBCBBBCBBBdBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDL-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-C64CgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOCgmOGgmODg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FDg8FBg8FBg8FhVg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBQBQBQBQBQBQDPBPBPBPBPBPjkC7mMB5mMBnmMBjmMBCBlmMB3lMBpiMBk8kCBCBBG-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FD-7FB-7FB-7F6FoglCEsuHRwjlCyDCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCB0DBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBG1DD97OCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQDPBPBPBPBPBPDQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQDPBPBPBPBPBPEQCQCQCQCPCPCPCPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPB0EB0EBsFBsFBsFBsFBoGBoGBgIBgIBgHBgHB8HB8HDQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQCSFPBPBzEBzEBRCxnOFSFrFBrFBrFBrFBREQBQClkOFPBPBnGBnGFQBQCljOCODPBPB-GB-GBNHSF-HB-HB7HB7HBRqJ53OE9tQBrmQH4Bc3BSgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBfBfBfBfBfBfBfBfBfBfBfBfBfBfBfBfECBByZ0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzB34BgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CBCBBBt-UBruHBt+UB1iVBviVBCBBBCBBBCBBB3hVB5-UB9hVB7hVCCBBCCBBI9jVB9jVBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBICBBBCBBECBBN-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOC-lOG-lOzoeCBBBCBBBCBBBCBBBCBBBCBl8kCBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBTC
1578BBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBnECBBBCBBBCBBBCBBBCBBBCBBBCBBDCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBKCBBBCBBBnglCBCBBBCBBBCBBBCBBBCBBECBBBvyyCDCBBBCBBBgDCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBn0yCB90yCB10yCBh0yCBn0yCCjxyCBzyyCBpxyCBg6BBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBB-CBl0yCBvjlCBCBBBCBBBt2yCBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBhkzCZCBB9a-5Bd-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCm6TCBB7gBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCH-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BmlBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvChDwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCFvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvC1DuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCCuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCCuCBuCBuCBuCBuCBuCBuCCuCBuCCtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCCtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCCtCBtCBtCBtCBtCBtCBtCCtCBtCk2BgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEO-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-D+CgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCL-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-B74CgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BhrVgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BhB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BD1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BtxekCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjC")),this._CASE_ORBIT}static get Print(){return this._Print||(this._Print=new g(m("hB9CBjBLBCpWBDFBFGBCCCBSBCsMBClBBDxBBDCBC2BBJaBFFBSVBC-FBCvBBD6BBDkDBP6BBDwBBDOBCbBDCCBJBGfBIqCBCgFBCHBDBBDVBCGBCEEBCBDIBDBBDDBJFFBCCBDBDYBDCBCFBFBBDVBCGBCBBCBBCBBDCCBDBFBBDCBEIIBCBCIIBPBLCBCIBCCBCVBCGBCBBCEBDJBCCBCCBDQQBCBDLBIGBCCBCHBDBBDVBCGBCBBCEBDIBDBBDCBICBFBBCEBDRBLBBCFBECBCDBEBBCCCBEEBEEBBBELBFEBECBCDBDHHPUBGMBCCBCWBCPBDIBCCBCDBIBBCCBCBBDDBDJBIVBCCBCWBCJBCEBDIBCCBCDBIBBGCBCDBDJBCCBNMBCCBCyBBCCBCFBFPBDZBCCBCRBEXBCIBCDDBFBEFFBEBCCCBGBHJBDCBN5BBFcBmBBBCCCBDBCXBCCCBVBDEBCCCBFBCJBDDBhBnCBCjBBFmBBCjBBCOBCMBmBlGBCGGD4LBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBDfBEZBH1CBDFBD-TBCbBE4CBIVBKXBKTBNMBCCBCBBN9CBDJBHJBHNBCKBH4CBIqBBGlCBLeBCLBFLBFEEBoBBDEBMrBBFZBHKBE9BBDgCBCcBDKBHJBHNBDtBBDLBVsCBClFBJ7BBEOBE9BBGqBBDKBJqBBG1QBDFBDlBBDFBDHBCGCBdBD0BBCOBCNBDFBCSBDCBCIBSXBJuBBSBBDaBCMBEhBBPgBBQrEBF5UBXKBWz4BBD9LBGsBBCGGD3BBIBBPXBKGBCGBCGBCGBCGBCGBCGBCGBC9DBjBZBC4CBN1GBbPBC+BBC1CBDmDBGqBBC9CBC1CBKvBBCszcBE2BBK7KBV3FBJ8GBV7BBEJBH3BBJlCBJLBHzDBMdBEtCBCKBFgBBC2BBKNBDJBDmDBZbBLFBDFBDFBKGBCGBC7BBF9DBDJBHj9KBNWBFwBBloItLBDpDBnBGBNEBGZBCEBCCCBCCBCCBoUBhBpBBHyBBCSBCDBFEBCmEBF9FBEFBDFBDFBDCBEGBCGBOBBDLBCZBCSBCBBCOBDNBjB6DBGCBFsBBE3CBCMBEwBwBBsBBjEcBEwBBQbBFjBBKdBGqBBGdBCkBBFNBrB9EBDJBHjB
1578BFjBBFnBBJzBBMLBCOBCGBCBBCKBCOBCGBCBBEzBBN2JBKVBLHBZFBCpBBCIBmCFBDCCBqBBCBBEDDBVBCnCBJIBxBSBCBBGgBBEaBGaBnB3BBFTBDxBBCBBGHBCCBCcBDCBFJBIIBI-BBhBmBBFLBK1BBEcBDaBGZBIDBNGBxCoCB4ByBBOyBBItBBJJBHlBBEcBJBBxGeBCpBBCCBDBBRFBJIBiBtBBJpBBXZBnBbBVWBKtCBFjBBK9BBCEBOYBIJBH0BBCRBJmBBK-CBCTBMRBCuBB-BGBCCCBCBCOBCKBH6BBGJBHDBCHBDBBDVBCGBCBBCEBCJBDBBDCBDHHGGBDGBEEBMJBCDDClBBCJBCDDCDBCJBCBBJBBe7CBCEBfnCBJJBnF1BBDlBBjBkCBMJBHMBU5BBHJBHTBdaBDOBFWB6F7BBlDyCBNHBDDDBGBCBBCdBCBBDLBKJBnCHBDtBBDKBcnCBJyCBOoCBIJB3CHB5ChBBPJBHIBCsBBCNBLcBEfBDVBCNBqCGBCBBCrBBECCBCCBHBJJBHFBCBBCkBBCBBCFBIJBHrBBFJB3HYBIQBCoBBEcB2CQQBwBBO6cBnDuDBCEBMjGBtyCiDBOvhBBRVBL68DBGmSB61G5BBn2B4RBIeBCJBFwCBCJBHdBDFBLlCBLJBCGBCUBGSBxN5BBnG6CBGYBDYBtBqCBF4BBIQBhCEBMGBK1mHBqBfBiDyDB+vIDBCGBCBBCiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBDDBh7D8HBEzNBHWBQQBQtBBDWBKzDB9B1HBLmBBDpCBJvDBWlCB7DTBNTBN2CBKYBoE0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBD9VBQEBCOBxiBeBHFB2GGBCQBDGBCBBCEBG9BBiBxDxDBrBBENBDJBFBBhKeBS5BBGxOxOBoBB3GqBBFhGhGBdBCVBJBBhHGBCDBCBBCOBCkGBDPBqBrCBFJBFBByYjCBtC8BBjGDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBBvIrBBFjDBNOBDOBCOBCkBBLtFB5BcBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBCmDBmgB-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIBnkzVvHB",!1))),this._Print}static get Upper(){return this.CATEGORIES.get("Lu")}},U(On,"_CASE_ORBIT",null),U(On,"_Print",null),U(On,"CATEGORIES",new po({C:()=>new g(m("AfBgDgBBOrWrWBHHBCBICCVuMuMnBBBzBBBE4B4BBGBcDBHQBXhGhGxBBB8BBBmDNB8BBByBBBQddBCCMEBhBGBsCiFiFJBBDBBXIICCBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ6BFFBkCkCBhBhBBBBbFB3CBBHBB+UCB6CGBXIBZIBVLBOEEDLB-CBBLFBLFBPMMBEB6CGBsBEBnCJBgBNNBCBNDBCCBrBBBGKBtBDBbFBMCB-BBBiCeeBMMBEBLFBPBBvBBBNTBuCnFnFBGB9BCBQCB-BEBsBBBMHBsBEB3QBBHBBnBBBHBBJGCgBBB2BQQPBBHUUBEEKMMBDBbEByBPBDBBcOOBBBjBNBiBOBtEDB7UVBMUB14BBB-LEBuBCCBDBCBB5BGBDNBZIBI4BI-DhBBb6C6CBKB3GZBxC3C3CBoDoDBDBsB-C-C3CIBxBuzcuzcBBB4BIB9KTB5FHB+GTB9BCBLFB5BHBnCHBNFB1DKBfCBvCMMBCBiB4B4BBHBPBBLBBoDXBdJBHBBHBBHIBIII9BDB-DBBLFBl9KLBYDByBjoIBvLBBrDlBBILBGEBbGGCGDrUfBrBFB0BUUFDBGoEoEBCB-FCBHBBHBBHBBECBIIIBLBDBBNbbUDDQBBPhBB8DEBEDBuBCB5COOBBBCuBBvBhEBeCByBOBdDBlBIBfEBsBEBfmBmBBCBPpBB-EBBLFBlBDBlBDBpBHB1BKBNQQIDDMQQIDDBBB1BLB4JIBXJBJXBHrBrBKkCBHBBCtBtBDCBCBBYpCpCBGBKvBBUDDBDBiBCBcEBclBB5BDBVBBzBDDBDBJEEeBBEDBLGBKGBhCfBoBDBNIB3BCBeBBcEBbGBFLBIvCBqC2BB0BMB0BGBvBHBLFBnBCBeHBDvGBgBrBrBEBBDPBHHBKgBBvBHBrBVBblBBdTBYIBvCDBlBIB-BGGBLBaGBLFB2BTTBGBoBIBhDVVBJBTwBwBB8BBICCFQQMFB8BEBLFBFJJBDDBXXIDDGLLBDDBEEBCCBEBCEBIBBICBGKBLCCBCCnBLLCBBCFFLDDBGBDcB9CGGBcBpCHBLlFB3BBBnBhBBmCKBLFBOSB7BFBLFBVbBcBBQDBY4FB9BjDB0CLBJBBCBBJDDfDDBNNBHBLlCBJBBvBBBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMBxhBPBXJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBF-6DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBrCHBxDUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBND
1578BLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIlkzVBxHvw-FB",!1)),Cc:()=>new g(m("AfgDgB",!0)),Cf:()=>new g(m("tFzqBzqBBEBXhGhGyBhMhMBxCxCs5D9-B9-BBDBbEByBEBCJBw03B6H6HBBBimEQQj7IPBhjiBDBwmFHBn0rYffB+CB",!1)),Cn:()=>new g(m("4bBBHDBICCVuMuMnBBBzBBBE4B4BBGBcDBHKBvI9B9BBmDmDBMB8BBByBBBQddBCCMEBjBEBuHJJBDDBXXICCBBBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ6BFFBkCkCBhBhBBBBbFB3CBBHBB+UCB6CGBXIBZIBVLBOEEDLB-CBBLFBLFBbFB6CGBsBEBnCJBgBNNBCBNDBCCBrBBBGKBtBDBbFBMCB-BBBiCeeBMMBEBLFBPBBvBBBNTBuCnFnFBGB9BCBQCB-BEBsBBBMHBsBEB3QBBHBBnBBBHBBJGCgBBB2BQQPBBHUUBEEKmDmDNBBcOOBBBjBNBiBOBtEDB7UVBMUB14BBB-LEBuBCCBDBCBB5BGBDNBZIBI4BI-DhBBb6C6CBKB3GZBxC3C3CBoDoDBDBsB-C-C3CIBxBuzcuzcBBB4BIB9KTB5FHB+GTB9BCBLFB5BHBnCHBNFB1DKBfCBvCMMBCBiB4B4BBHBPBBLBBoDXBdJBHBBHBBHIBIII9BDB-DBBLFBl9KLBYDByBDBvzIBBrDlBBILBGEBbGGCGDrUfBrBFB0BUUFDBGoEoEBCC-FCBHBBHBBHBBECBIIIBIBGBBNbbUDDQBBPhBB8DEBEDBuBCB5COOBBBCuBBvBhEBeCByBOBdDBlBIBfEBsBEBfmBmBBCBPpBB-EBBLFBlBDBlBDBpBHB1BKBNQQIDDMQQIDDBBB1BLB4JIBXJBJXBHrBrBKkCBHBBCtBtBDCBCBBYpCpCBGBKvBBUDDBDBiBCBcEBclBB5BDBVBBzBDDBDBJEEeBBEDBLGBKGBhCfBoBDBNIB3BCBeBBcEBbGBFLBIvCBqC2BB0BMB0BGBvBHBLFBnBCBeHBDvGBgBrBrBEBBDPBHHBKgBBvBHBrBVBblBBdTBYIBvCDBlBIBlCJBCBBaGBLFB2BTTBGBoBIBhDVVBJBTwBwBB8BBICCFQQMFB8BEBLFBFJJBDDBXXIDDGLLBDDBEEBCCBEBCEBIBBICBGKBLCCBCCnBLLCBBCFFLDDBGBDcB9CGGBcBpCHBLlFB3BBBnBhBBmCKBLFBOSB7BFBLFBVbBcBBQDBY4FB9BjDB0CLBJBBCBBJDDfDDBNNBHBLlCBJBBvBBBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMB3iBJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBJ76DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBjGUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBND
1578BLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIm8yVBCdBhD-DBxHvw-BB---BBB---BBB",!1)),Co:()=>new g(m("gg4B-nGh4hc9--BD9--B",!0)),Cs:()=>new g(m("gg2B--B",!0)),L:()=>new g(m("hCZBHZBwBLLFGGBVBCeBCpOBFLBPEBICCiEEBCBBDDBCHHCCBCCCBSBCyCBCqEBJlFBClBBDHHBnBBoCaBFDBuBqBBkBBBCiDBCQQBIIBLLBBBDRRCdBe4CBMZZBfBKBBFGGBUBFKKEYYBXBIKBGXBCGBRpBB7B1BBETTIJBQPBFHBDBBDVBCGBCEEBCBERROBBCCBPBBLJJBEBFBBDVBCGBCBBCBBCBBgBDBCUUBBBRIBCCBCVBCGBCBBCEBETTQBBYMMBGBDBBDVBCGBCBBCEBEffBCCBBBQSSCFBECBCDBEBBCCCBEEBEEBBBELBX1B1BBGBCCBCWBCPBEbbBBBCBBDBBfFFBGBCCBCWBCJBCEBEffBBBCBBQBBSIBCCBCoBBDRRGCBJCBZFBGRBEXBCIBCDDBFB7BvBBCBBNGB7BBBCCCBDBCXBCCCBIBCBBKDDBDBCWWBCBhBgCgCBGBCjBBcEB0DqBBVRRBEBFDBEEEBIIBBBFMBNSSBkBBCGGDqBBCsKBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBmBPBR1CBDFBErTBDQBCZBGqCBHHBIRBOSBPRBPMBCCBQzBBkBFFkC4CBIEBDhBBCGGBkCBLeByBdBDEBMrBBFZB3BWBK0BBzC+C+CBtBBSHB3BdBOBBLrBBbjBBqBCBLjBBDKBGqBBDCBqBDBCFBCBBEGGB+FBhC1IBDFBDlBBDFBDHBCGCBdBD0BBCGBCEEBBBCGBEDBDFBFMBGCBCGB1DOORMBmDFFDJBCEEBDBHGCBCBCKBDDBGEBF1B1BB8zC8zCBjHBHDBEBBNlBBCGGD3BBIRRBVBKGBCGBCGBCGBCGBCGBCGBCGBxC2O2OBrBrBBDBGBBF1CBHCBC5CBCDBGqBBC9CBSfBxBPBhQ-tGBhCs0VBkCtBBDsIBEPBLBBVuBBReBDlCByBIBDmDBDxCBVQBCCBCDBCWBezBBPxBB-BFBECCBMMBaBLWBacBIuBBdRRBDBCJBLEBCoBBYCBCHBVWBEEEBwBBCEEBDDBDBDCCZCBDKBICBNFBDFBDFBKGBCGBCqBBCNBHyDBej9KBNWBFwBBloItLBDpDBnBGBNEBGCCBIBCMBCEBCCCBCCBCCBqDBiBqLBT-BBD1BBpBLB1DEBCmEBlBZBHZBM4CBEFBDFBDFBDCBkBLBCZBCSBCBBCOBDNBjB6DBmMcBEwBBwBfBOTBCHBHlBBLdBDjBBFHBxB9EBTjBBFjBBFnBBJzBBNKBCOBCGBCBBCKBCOBCGBCBBEzBBN2JBKVBLHBZFBCpBBCIBmCFBDCCBqBBCBBEDDBVBLWBKeBiCSBCBBLVBLZBHZBnB3BBHBBhCQQBCBCCBCcBrBcBEcBkBHBCbBc1BBLVBLSBORBvDoCB4ByBBOyBBOjBBnBbBKWB7HpBBHBBRFB5BcBLJJBUBrBRBvBUBcWBN0BB6BBBDOOBrBBhBYBbjBBeDDJiBBENNBuBBPDBWCCkBRBCYBUBBgCGBCCCBCBCOBCJBIuBBnBHBDBBDVBCGBCBBCEBETTNEBfJBCDDClBBCaaCtBtBBzBBTDBVCBfvBBVBBC5F5FBtBBqBDBlBvBBV8B8BBpBBOoCoCBZBmBGB6FrBB1D-BBgBHBDDDBGBCBBCXBQCC-CHBDmBBRCCdLLBmBBIWWMtBBUTTBnCBoGgBBgBIBCkBBSyByBBcBxDGBCBBClBBWaaBEBCBBCfBPYYBqBBlISBQCCBLBChBB9DwCwCB4cBnHjGBtyCgDBQvhBBSFBa68DBGmSB61GdBj3B4RBIeBSuCBSdBTvBBRDBgBUBGSBxNsBB0G-BBhBYBDYBtBqCBGjCjCBLBhCBBCPPBNNB0mHBqBfBiDyDB+vIDBCGBCBBCiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBn7F0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDYBCYBCeBCYBCeBCYBCeBCYBCeBCYBCHB15BeBHFBmI9BBzEsBBLGBRiKiKBcBTrBBlPbBlHdBDwGwGBdBCCBCBBCGBDEBKBBhHGBCDBCBBCOBCkGB8BjCBI1lB1lBBCBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQBlqE-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),LC:()=>new g(m("hCZBHZB7BLLBVBCeBCiGBCDBFvGBDZBhGDBDBBECBCHHCCBCCCBSBCyCBCqEBJlFBClBBKoBB44ClBBCGGDqBBDCBhV1CBDFBjkCKBGqBBDCBhCrBBgCMBChBBmD1IBDFBDlBBDFBDHBCGCBdBD0BBCGBCEEBBBCGBEDBDFBFMBGCBCGBmIFFDJBCEEBDBHGCBCBCFBFDDBCBGEBF1B1BB8zC8zCB6DBDmDBHDBEBBNlBBCGGzoetBBTbBnEtCBCWBEDBCsCBZBBE2Z2ZBpBBGIBIvCBh6TGBNEBqgBZBHZBmlBvCBhDjBBFjBB1DKBCOBCGBCBBCKBCOBCGBCBBk2ByBBOyBB+CVBLVB74C-BBhrV-BBhBYBDYBtpZ0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDYBCYBCeBCYBCeBCYBCeBCYBCeBCYBCHB15BJBCTBHFB2uCjCB",!1)),Ll:()=>new g(m("hDZB7BqBqBBWBCHBC2BCBQCBuBCDECBBBDCCDEEBFFDEEBBBDDDCCCDCCBCCDEECDDBDDBBBHGDCOCBSCBDDCEEC4BCBFBDDDBCCFICBjCBDZBiGCCEEEBBBTccBhBBCBBECBCWCBDBCGDB0B0BBuBBCgBCK0BCDMCBgDCxBoBBo6CqBBDCB5XFBjkCIBC2D2DBqBBgCMBChBBnD0ECBHBCgDCBHBJFBLHBJHBJFBLHBJHBJNBDHBJHBJHBJEBCBBHEEBBBCBBJDBDBBJHBLCBCBBzIEEBEEcKFDBBJDBF2B2Bs1CvBBCEEBGCFCCBCCBEBGiDCBIICFFNlBBCGG0oesBCUaCoEMCBBBC+BCBGBCCCDICFCCDCCBBBCSCGGGCMCFCCDOCbEE2ZqBBGIBIvCBh6TGBNEBqhBZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBnqZZBbGBCRBbZBbDBCCCBFBCKBbZBbZBbZBbZBbZBbZBbZBbZBbbBdYBCFBbYBCFBbYBCFBbYBCFBbYBCFBC15B15BBIBCTBHFB4vChBB",!1)),Lm:()=>new g(m("wVRBFLBPEBICCmEGG-OnHnHlFBBuIBBFgBgBKEEhFoFoF1mBgEgE2R72B72BsDkTkTxOFBvF+BBOjBjBBjBByVOORMBg-CBByHgGgG2OsBsBBDBGiDiDB+C+CBBB34bjnBjnBBEBvIzDzDdBB6DIBxCYYpDDBEBB2OXXqEtDtDWBBoDDBKngVngVuBBBh-BFBCpBBCIB0sBhBhB2K04D04DnrTDB9PCBpBBBnRMBhCBBCPPB9-P9-PBCBCGBCBByhM9BBqGGBud0Q0QsSAB",!1)),Lo:()=>new g(m("qFQQhIFFBCBxGBB7ZaBFDBuBfBCJBkBBBCiDBCZZBLLBBBDRRCdBe4CBMZZBfBWVBrBYBIKBGXBCGBRoBB8B1BBETTIJBROBFHBDBBDVBCGBCEEBCBERROBBCCBPBBLJJBEBFBBDVBCGBCBBCBBCBBgBDBCUUBBBRIBCCBCVBCGBCBBCEBETTQBBYMMBGBDBBDVBCGBCBBCEBEffBCCBBBQSSCFBECBCDBEBBCCCBEEBEEBBBELBX1B1BBGBCCBCWBCPBEbbBBBCBBDBBfFFBGBCCBCWBCJBCEBEffBBBCBBQBBSIBCCBCoBBDRRGCBJCBZFBGRBEXBCIBCDDBFB7BvBBCBBNFB8BBBCCCBDBCXBCCCBIBCBBKDDBDBYDBhBgCgCBGBCjBBcEB0DqBBVRRBEBFDBEEEBIIBBBFMBNyDyDBnKBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBmBPByDrTBDQBCZBGqCBHHBIRBOSBPRBPMBCCBQzBBpBkCkCBhBBC0BBIEBDhBBCGGBkCBLeByBdBDEBMrBBFZB3BWBK0BBxFuBBSHB3BdBOBBLrBBbjBBqBCBLdByDDBCFBCBBE7hB7hBBCB4-C3BBZWBKGBCGBCGBCGBCGBCGBCGBCGBoR2B2BF1CBJCCB4CBFGGB
1578pBBC9CBSfBxBPBhQ-tGBhC0wUBC2jBBkCnBBJrIBFPBLBBjCyByBBkCBqFoDoDEGBCCBCDBCWBezBBPxBB-BFBECCBMMBaBLWBacBIuBBuBEBDIBLEBCoBBYCBCHBVPBCFBEEEBwBBCEEBDDBDBDCCZBBEKBIPPBEBDFBDFBKGBCGByEiBBej9KBNWBFwBBloItLBDpDBkCCCBIBCMBCEBCCCBCCBCCBqDBiBqLBT-BBD1BBpBLB1DEBCmEBqDJBCsBBDeBEFBDFBDFBDCBkBLBCZBCSBCBBCOBDNBjB6DBmMcBEwBBwBfBOTBCHBHlBBLdBDjBBFHBhEtCBjDnBBJzBB9CzBBN2JBKVBLHB5EFBDCCBqBBCBBEDDBVBLWBKeBiCSBCBBLVBLZBHZBnB3BBHBBhCQQBCBCCBCcBrBcBEcBkBHBCbBc1BBLVBLSBORBvDoCB4FjBBnBDBCxJxJBoBBHBBRCBCBB5BcBLJJBUBrBRBvBUBcWBN0BB6BBBDOOBrBBhBYBbjBBeDDJiBBENNBuBBPDBWCCkBRBCYBUBBgCGBCCCBCBCOBCJBIuBBnBHBDBBDVBCGBCBBCEBETTNEBfJBCDDClBBCaaCtBtBBzBBTDBVCBfvBBVBBC5F5FBtBBqBDBlBvBBV8B8BBpBBOoCoCBZBmBGB6FrBB0GHBDDDBGBCBBCXBQCC-CHBDmBBRCCdLLBmBBIWWMtBBUTTBnCBoGgBBgBIBCkBBSyByBBcBxDGBCBBClBBWaaBEBCBBCfBPYYBnBBCBBlISBQCCBLBChBB9DwCwCB4cBnHjGBtyCgDBQvhBBSFBa68DBGmSB61GdBj3B4RBIeBSuCBSdBTvBB0BUBGSB0NnBB2MqCBGwFwFB0mHBqBfBiDyDBuwIiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBxzI2P2PBrBBiBiKiKBcBTrBBlPaBmHdBDwGwGBdBCCBCBBCGBDEBKiHiHBFBCDBCBBCOBCkGB8pBDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQBlqE-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Lt:()=>new g(m("lOGDnB2sH2sHBGBJHBJHBNQQwBAB",!1)),Lu:()=>new g(m("hCZBmDWBCGBiB2BCDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIJDCMCDQCDDDCCBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBDDBBBEWCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBpCDBNDBNDBNEBMDBnIFFECBDCBDEEBDBHGCBCBDDBLBBG+B+B9zCvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoqZZBbZBbZBbCCBGDBDDBCBCHBbZBbBBCDBDHBCGBcBBCDBCEBCEEBFBcZBbZBbZBbZBbZBbZBfYBiBYBiBYBiBYBiBYBiB2pE2pEBgBB",!1)),M:()=>new g(m("gYvDB0IGBoIsBBCCCBCCBCCpCKBxBUBRmDmDBFBDFBDBBCDBkBffBZB8CKB7BIBKZZBCBCIBCCBCEBsBCB8BIBrBXBCgBB3BCBCRBCGBLBBeCB5BCCBFBDBBDCBKLLBbbDCB5BCCBDBFBBDCBEffBEEMCB5BCCBGBCCBCCBVBBXFBCCB5BCCBFBDBBDCBICBLBBf8B8BBDBECBCDBKpBpBBDB4BCCBFBCCBCDBIBBMBBeCB5BCCBFBCCBCDBIBBMBBQNNBCB4BBBCGBCCBCDBKLLBeeBBBnCFFBEBCCCBGBTBB+BDDBFBNHBjDDDBHBMGBqCBBcECFBByBTBCBBGKBCjBBKlDlDBSBYDBFCBCCBDGBEDBOLBCLLBCBgWCBzdDBdCBeBBfBBhCfBKuBuBBBBC2D2DBjBjB3DLBFLB8GEB6BJBCcBDxBxBBsBBDLBVEBwBQBnB
1578IBNCBfMB5BNBxBTB5ECBCUBFHHDCBnG-BBxWgBB--CCBuEhDhDBeBrRFBqDBB1udDBCJBhBBBxCBBxIEEFYYBDBF0C0CBzBzBBQBbRBOnBnBBGBaMBtBDBwBNBlBkCkCBMBNJJBuBuBBBBzBCCBBBDBBGBBCqBqBBDBGBBtHHBCBBx5TiXiXBOBRPBuejHjH2EEBn0BCBCBBGDBpBCBFmFmFB+R+RBCBiCEB+JBBuCFBnCKByBDB7DCB2BOBqBDDBLLBCBuBKBI+B+BBBBlBNBRBBtBNNBBBxBNBJDBCBB9CLBHDD+ELBWDB4BBBCGBDBBDCBKLLBDDBFBEEBkCIBCDDCDBCEBCPPBzCzCBQBYyCyCBSBsHGBDIBcBBzCQBrDMBmDOBhIOB2HFBCBBDDBCCCBuEuEBFBDGBEddBIBpBGBCDBJKKBJBvBPBnGHBoGHBCHBzCVBCNB7DFBECCBCCBFBCjCjCBDBCBBCEB8KDBKBBCxBxBBFBEEBYmnFmnFHOBpmLRBhuCEB8BGB5gBCCB1BBIDByCMMBslTslTBizEizEBsBBDWB-QEBEFBJHBDGBfDB1ECB89B2BBFxBBJPPXEBCOBxqBGBCQBDGBCBBCEBlDhFhFBFB4L+B+BBCB9PDB-HBB0HDDIBBG7O7OBFBuDGB29lYvHB",!1)),Mc:()=>new g(m("joC4B4BDCBJDBCBBzBBB7BCBHBBDBBLsBsB7BCBjC7B7BBBBJCCB2B2BB7B7BCHHBDDBLLnDBBCBBECBCCBLqBqBBBB+BDB+BBB7BCCBDBDBBCBBKBBdPPB7B7BBBBGCBCCBLrBrBBsCsCBBBHHBTBBrKBBgCsFsFBFFHDDBaaBLLBBBDGBWBBDFBDLLBBB5zBffiEIIBGBCBB7KDBDCBFBBCFBhHBB7BCCKCCBJJBEByExBxBGCCBDBCBB+BffFBBD9B9BDCBCEEBxBxBBGBJBBsFWW35EBB0-dBBD5C5CBzBzBBOBvEBBwBxBxBBFFBDDBBBvDBBDBBZuBuBCuDuDDBBGuHuHBCCBCCBCC0gZCCgEuBuBBBBFBB0DZZB8B8BxBCBKBBO+C+CBBBEBBCrFrFBBBgBBB7BBBCDBDBBDCBKLLB1C1CBBBIDDCDBCBBCmDmDBBBJBBErDrDBBBHCCBCBDuHuHBBBHDBDyDyDBBBJBBCuDuDCBBHoDoDCBBFmImIBBBK4H4HBEBCBBFDDCvEvEBBBJDBF1C1CeBB-BqGqGECCoGPPrDIID2G2GBDBFBBC-K-KBNNxBBBJBBCpvQpvQBBBlxD2BBpDBB0rYBBHFB",!1)),Me:()=>new g(m("okBBB1xF-wB-wBBCBCCBsshBCB",!1)),Mn:()=>new g(m("gYvDB0IEBqIsBBCCCBCCBCCpCKBxBUBRmDmDBFBDFBDBBCDBkBffBZB8CKB7BIBKZZBCBCIBCCBCEBsBCB8BIBrBXBCfB4BCCFHBFEEBFBLBBe7B7BFDBJVVBbbDBB6BFFBFFBDDBBBEffBEEMBB6BFFBDBCBBFVVBXXBEBC7B7BDCCBCBJIIBMMBff+BNNzBEE4BCCBBBGCBCDBIBBMBBe7B7BDHHGBBVBBdBB6BBBFDBJVVBeepCIIBBBC7C7CDGBNHBjDDDBHBMGBqCBBcEC4BNBCEBCBBGKBCjBBKnDnDBCBCFBCBBDBBaBBFCBRDBODDBHHQgWgWBBBzdCBeBBfBBfBBhCBBCGBJDDBJBKuBuBBBBC2D2DBjBjB3DCBFBBKHHBBB8GBBD7B7BCGBCCCDHBHJBDxBxBBMBCeBDLBVDBxBCCBDBCGGpBIBNBBhBDBDBBCCB5BCCBEECCB7BHBDBB5ECBCMBCGBFHHEBBnG-BBxWMBFEEBKB--CCBuEhDhDBeBrRDBsDBB1udFFBIBhBBBxCBBxIEEFaaBGG4EBBbRBOnBnBBGBaKBvBCBxBDDBCBDBBoBkCkCBEBDBBDBBNJJwB0B0BCCBDBBGBBCrBrBBJJvHDDFx5Tx5TiXPBRPBuejHjH2EEBn0BCBCBBGDBpBCBFmFmFB+R+RBCBiCEB+JBBuCFBnCKByBDB8D3B3BBNBqBDDBLLBBByBDBDBBI+B+BBBBlBEBCHB-BNNB1B1BBHBLDBDgDgDBBBDCCBHHD+E+EEHBWBB6BBBEmBmBBFBEEBnCFBOECPBB2CHBDCBCYY1CFBCFFBCCBvHvHBCBHBBCBBcBB2CHBDCCBrDrDCDDBEBCmDmDCDDBCBCEBkIIBCBBhIBBCFFxEDBDBBFhBhBBIBpBFBDDBJKKBEBDCBvBMBCBBnGCCBBBCqGqGBFBCFBCzCzCBUBDGBCBBCBB7DFBECCBCCBFBCpCpCBEEC8K8KBMMB1B1BBDBGCCYmnFmnFHOBpmLLBECBhuCEB8BGB5gBgCgCBCByC5lT5lTBizEizEBsBBDWBhRCBSHBDGBfDB1ECB89B2BBFxBBJPPXEBCOBxqBGBCQBDGBCBBCEBlDhFhFBFB4L+B+BBCB9PDB-HBB0HDDIBBG7O7OBFBuDGB29lYvHB",!1)),N:()=>new g(m("wBJB5DBBGDDBBBitBJBnEJBnGJB9MJB3DJBFFBtDJB3DJB3DJBDFBvDMB0DJBJGBoDJBpDGBISBuDJBhDJB3DJBnCTBtIJBnCJBwWTBybCBwHJBHJBXJBtJJBhEKBmFJBHJB3FJB3CJBnEJBHJB3gBEEBEBHJBnGyBBDEB3W7BBvCVB3TdBqrBqYqYaIBPCB4KDBrEJBfHBCOBhBJBoBOBh7cJB9FJBhKFB7EJBnBJBnGJBXJB3CJB3MJB34UJBuPsBBN4BBSBB2KaBlBDBeJJnEEBrGJBvdHBaGBoBIBsCEBXFBhFBBDPBDtBBhCIB1BBBfCBsCEBpDHBZHBqBGBrKFBxBJBHJB3IeB-EJBrBDBxDGBnEdBhEJB9BJBxEJBITB8HJB3KJB3DJB3LJBnDJBHTBtCLBlNSB+CJB3UJB3CcBkHJBnCJB3BJBnLJBnDUBshBuDBimPJBnpCJB3CJBnEJBCGBvQJBnIWB+KCB6nXJBnuBTBNTBtDYB2iBxBBhqCJBnNJB3PJB4HJBtWIBhEJB4Y6BBCCBCDBtCsBBCOBjeMBk3CJB",!1)),Nd:()=>new g(m("wBJnxBJnEJnGJ9MJ3DJ3DJ3DJ3DJ3DJ3DJ3DJ3DJ3DJhDJ3DJnCJ3IJnCJn6BJnBJtJJhEJnFJHJ3FJ3CJnEJHJnuiBJnVJnBJnGJXJ3CJ3MJ34UJnsBJnkCJHJ9YJhEJ9BJxEJ3IJ3KJ3DJ3LJnDJHTtCJnNJnDJ3UJ3CJ3HJnCJ3BJnLJ3uQJnpCJ3CJnEJ3QJ37XJ12CxBhqCJnNJ3PJ4HJ2aJ30EJ",!0)),Nl:()=>new g(m("u3FCBwzCiBBDDB-zDaaBHBPCBs1dJBxyW0BBtOJJnEEBrhIuDBm8SCB",!1)),No:()=>new g(m("yFBBGDDBBB2pCFB5LFB5DCBmEGB6GGBSIByNJB2hBTB0jBJBhP20B20BEFBHJBnGPBqB3W3WB6BBvCVB3TdBqrB1kB1kBBCBrEJBfHBCOBhBJBoBOBxrdFBymWsBBiCDBSBB2KaBlBDB1pBHBaGBoBIBsCEBXFBhFBBDPBDtBBhCIB1BBBfCBsCEBpDHBZHBqBGBrKFBhLeB-EJBrBDBxDGBnETB8LTBmqBBBvNIBobSB0aUBn8SGB-YWBqhZTBNTBtDYBvqFIBid6BBCCBCDBtCsBBCOBjeMB",!1)),P:()=>new g(m("hBCBCFBCDBLBBEBBbCBCccCkBkBGEELBBEEE-VJJzOFBqBBB0BCCDDDtBBBVBBCBBOCCBBBrCDBnDsBsBBMBqHCB3BOBgBmImIBLLtE5D5D6DnMnMNwLwL7CLLBpFpFBNBCmBmBBCBoCrCrCBDBFBBwDFBsFlTlTBHB4EuTuTtBBBvCCBoCBB+ECBCCBmBKB6JBB5GBBhEGBCFBhFBBLGBdCB9DDB8BEB-BBBhCHBM9Z9ZBWBJTBCMBCLBfBBPBB6TDBeBB+hBNBwCBBgBJB0MVBgCDBhBBB8XDBCBBxDwEwEBtBBCfBDLBkNCBFJBDLBRNNjD7C7CjgdBBuICBkDLL0DFB9LDB3CBBpBCBCyByBBwBwBiDMBRBB9DDB-DBBRBB6HzqUzqUBxGxGBI
1578BXiBBCNBCFFCBB2ECBCFBCDBLBBEBBbCBCccCCCBFB7MCB9UxBxB-MoXoXoGgBgBxIIBnBxDxDBFBjCGB6CDByO-J-JjBlElEBDBtBDB+FGBuDBBCDB-DDBxBBBwCDBFOOCCB5CFBsDrJrJBCCBzDzDBDBLBBCpDpD7HWBqDCBdMBtCjEjEBBB9HpIpIBBB8E9C9CBGB0CCBCEB+CJB4GgDgDBDBrBBBmUBBrCMBwFxjBxjBBDB97CBB8zOBBmEiCiCBDBJpRpRBBBoJDBoK9lT9lTovHEB07C-a-aBAB",!1)),Pc:()=>new g(m("-Cg-Hg-HBUU-u3BBBZCBwHAB",!1)),Pd:()=>new g(m("tB9qB9qB0BiyDiyDmgBqgCqgCBEBiwDDDgBBBFdd-NUUwDxszBxszBBmBmBLqFqFhzD-J-J",!1)),Pe:()=>new g(m("pB0B0BgB+1D+1DC-6B-6BqtC4B4BQ7T7TCff-hBMCxChBhBCGC1MUChCCCiBmhBmhBCECtBGCtNICEGCDBB-ozB6G6GeOCESSCCCrF0B0BgBGD",!1)),Pf:()=>new g(m("7F+6H+6HEddpuDCCFDDQEE",!1)),Pi:()=>new g(m("rFt7Ht7HDBBDaapuDCCFDDQEE",!1)),Po:()=>new g(m("hBCBCCBDECBLLBEEBcclCGGPBBI-V-VJzOzOBEBqB3B3BDDDtBBBVBBCBBOCCBBBrCDBnDsBsBBMBqHCB3BOBgBmImIBLLtE5D5D6DnMnMNwLwL7CLLBpFpFBNBCxDxDrCEBFBBwDFBsFlTlTBHBmY9D9DBBBoCBB+ECBCCBmBFBCDB6JBB5GBBhEGBCFBhFBBLGBdCB9DDB8BEB-BBBhCHBMjajaBJJBGBJIBDDBDCBEKBCCCBIB7kDDBCBBxDwEwEBFFBBBDDDBHBCBBCDDBLLBDBCJBDDBCCCBLBDCBtNCB6B+F+FjgdBBuICBkDLL0DFB9LDB3CBBpBCBCyByBBwBwBiDMBRBB9DDB-DBBRBB6HlxUlxUBFBDXXVBBDDBECBCDBICBHCCB2E2EBBBCCBDECBLLBEEBcclBDDB7M7MBBB9UxBxB-MoXoXoGgBgBxIIBnBxDxDBFBjCGB6CDB0ZlElEBDBtBDB+FGBuDBBCDB-DDBxBBBwCDBFOOCCB5CFBsDrJrJBCCBzDzDBDBLBBCpDpD7HWBqDCBdMBtCjEjEBBB9HpIpIBBB8E9C9CBGB0CCBCEB+CJB4GgDgDBDBrBBBmUBBrCMBwFxjBxjBBDB97CBB8zOBBmEiCiCBDBJpRpRBBBoJDBoK9lT9lTovHEB07C-a-aBAB",!1)),Ps:()=>new g(m("oBzBzBgB-1D-1DC-6B-6B-rCEEnB4B4BQ7T7TCff-hBMCxChBhBCGC1MUChCCCiBmhBmhBCECaTTCECtNICEGCDipzBipzB4GeeCMCESSCCCrFzBzBgBEEDAB",!1)),S:()=>new g(m("kBHHRCBgBCCcCCkBEBCBBDCCBCBDEEfgBgBrODBNNBGGBCCCBPB2DPPBxDxDsErIrIBBB3DCBDDDBvGvGLUUB4H4HIBBpEqLqLBHHB2H2H-DjEjEBGBlEwGwGqBmGmGiGCBQCCBBBDFBVECmEHBCFBCBBGDBmGBBxXJB0WuLuLlL+E+EBgBBiLJBKIBhiBCCBBBMCBOCBOCBOBBmCOOoBCBOCBUhBB-BBBCDBCBBLCCBBBGFBCECFMMBFFBDBGDBC7B7BBFFB2LBFcBD+HBXKByCtCBXnTBtBwBBDeBLyMBX+BBFfBD1LBDpEBmHFBmLBBvBZBC4CBN1GBbPBFOOBNNWBBHBB8CBB0HBBFJBhBlBBKRRBdBMdBJQQBeBLmBBQ-JBhuG-BBx0V2BB6RWBKBBoDBB+EDBLDB+RCBiHPPB+9T+9TpEgBBuLPBhCBB3BHBtBDBjDCCBBBD7E7EHRRBBBgBCCcCCiEGBCGBOBB6JIB6BQBDCBCMBEwBwBBrBB7zBBBwSmWmWBiKiKBGBnjC2kC2kCBbBr6SDBG3qU3qUk7DvHBLCBEzNBHWBQQBgDzDB9B1HBLmBBD7BBGCBXBBIdBF8BBWhCBE7F7FB1CBrbaagBaagBaagBaagBaa9B-PB4BDBzBHBCNBCBBp2BwNwNttCEE+DiOiOBvIvIBqBBFjDBNOBDOBCOBCkBBYgFB5BcBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBC7CBLAB",!1)),Sc:()=>new g(m("kB+D+DBCBqnB8D8DzPBBzPBBI2H2HoImSmS8sClmClmCBgBB37hBkuVkuVtD7E7E8GBBEBB3-HDB-4wBxtCxtC",!1)),Sk:()=>new g(m("+CCCoCHHFEEqQDBNNBGGBCCCBPB2DPPBjoBjoB15FCCBBBMCBOCBOCBOBB9kEBBkzdWBKBBoDBBxePPBniUniUBPB8bCCjF4g9B4g9BBDB",!1)),Sm:()=>new g(m("rBRRBBB+BCCuBFFmBgBgB-XwQwQBBB8xGOOoBCBOCBsEoBoBBDBHlClCBDBGBBFGDIgBgBBDDCgBgBBqIBhBBB7CffBXBpBFB2OKK3BHBwDxKxKBDBDeBLPBhIiEBX+BBFfBDhIBxBUBDFB9+zB5Z5ZCCBlFRRBBB+BCCkEHHBCBitDBBhrwBx+Bx+BagBgBagBgBagBgBagBgBat5Ft5FB-uC-uCBHB",!1)),So:()=>new g(m("mFDDFCCyerIrIBgEgEBvGvGLUUB4H4HkQ2L2LjEFBClElEwGqBqBoMCBQCCBBBDFBVECmEHBCFBCBBGDBmGBBxXJB0WzWzW+EhBBiLJBKIBksBBBCDBCBBLCCBHHBEBCECFMMBPPCBBC7B7BBKKBDBDDBCBBCBBCGBCeBDBBCCCBdBtIHBFTBDGBDwCBCdBanBBHnCBXKByCtCBX2FBCIBC1BBJuDBC3HBtBrBBhC-HBhQvBBWBBHmBBDpEBmHFBmLBBvBZBC4CBN1GBbPBFOOBNNWBBHBBxKBBFJBhBlBBKRRBdBMdBJQQBeBLmBBQ-JBhuG-BBx0V2BBibDBLBBC+R+RBBBqqUPBuLPBhCBB3BHBuBCBlPEEFBBOBB6JIB6BQBDCBCMBEwBwBBrBB7zBBBwSpgBpgBBGBnjC2kC2kCBGBFQBr6SDBG3qU3qUk7DvHBLCBEzNBHWBQPBhDzDB9B1HBLmBBD7BBGCBXBBIdBF8BBWhCBE7F7FB1CBqlB-PB4BDBzBHBCNBCBBp2B96C96CiEyWyWBqBBFjDBNOBDOBCOBCkBBYgFB5BcBOrBBFIBIBBPFB7E6HBG4WBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBB-B3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBC7CBLAB",!1)),Z:()=>new g(m("gBgEgEgvFgsCgsCBJBeBBGwBwBh9DAB",!1)),Zl:()=>new g(m("ohIA",!0)),Zp:()=>new g(m("phIA",!0)),Zs:()=>new g(m("gBgEgEgvFgsCgsCBJBlBwBwBh9DAB",!1)),ASCII_Hex_Digit:()=>new g(m("wBJIFbF",!0)),Alphabetic:()=>new g(m("hCZBHZBwBLLFGGBVBCeBCpOBFLBPEBICC3CeeBQBCBBDDBCHHCCBCCCBSBCyCBCqEBJlFBClBBDHHBnBBoBNBCCCBCCBCCJaBFDBeKBG3BBCGBPlDBCHBFHBFCBLCBDRRBuBBOkDBZgBBKBBFGGBWBDSBUYBIKBGXBCGBIJJBoBBLLBEGBHrCBCPBCCBFOBOSBCHBDBBDVBCGBCEEBCBEHBDBBDBBCJJFBBCEBNBBLFFBBBCFBFBBDVBCGBCBBCBBCBBFEBFBBDBBFIIBCBCSSBEBMCBCIBCCBCVBCGBCBBCEBEIBCCBCBBEQQBCBWDBFCBCHBDBBDVBCGBCBBCEBEHBDBBDBBKBBFBBCEBORRBCCBEBECBCDBEBBCCCBEEBEEBBBELBFEBECBCCBEHHpBMBCCBCWBCPBEHBCCBCCBJBBCCBCBBDDBdDBCHBCCBCWBCJBCEBEHBCCBCCBJBBGCBCDBOCBNMBCCBCoBBDHBCCBCCBCGGBCBIEBXFBCCBCRBEXBCIBCDDBFBJFBCCCBGBTBBO5BBGGBH0B0BBECBDBCXBCCCBRBCCBDEBCHHPDBhBgCgCBGBCjBBFSBFPBCjBBkC2BBCDDBDBR-BBLDBDlBBCGGDqBBCsKBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBmBPBR1CBDFBErTBDQBCZBGqCBEKBITBMUBNTBNMBCCBCBBNzBBDSBPFFkC4CBIqBBGlCBLeBCLBFIBYdBDEBMrBBFZB3BbBF+BBDTBzBYYBMMBBByBzBBCOBCHB0BpBBDDBLrBBCKBP2BBXCBLjBBDKBGqBBDCBqBDBCFBCBBEGGB+FBUhBBM1IBDFBDlBBDFBDHBCGCBdBD0BBCGBCEEBBBCGBEDBDFBFMBGCBCGB1DOORMBmDFFDJBCEEBDBHGCBCBCKBDDBGEBFSSBnBBuZzBB34BkHBHDBEBBNlBBCGGD3BBI
1578RRBVBKGBCGBCGBCGBCGBCGBCGBCGBCfBwB2O2OBBBaIBIEBDEBF1CBHCBC5CBCDBGqBBC9CBSfBxBPBhQ-tGBhCs0VBkCtBBDsIBEPBLBBVuBBGHBEwDBoBIBDmDBDxCBVUBCgBBZzBBNjCBCtBtBBEBECCBBBLgBBGiBBOcBEyBBCLBQRRBOBLEBC2BBKNBTWBEkCBCCCZCBDPBDDBMFBDFBDFBKGBCGBCqBBCNBH6DBWj9KBNWBFwBBloItLBDpDBnBGBNEBGLBCMBCEBCCCBCCBCCBqDBiBqLBT-BBD1BBpBLB1DEBCmEBlBZBHZBM4CBEFBDFBDFBDCBkBLBCZBCSBCBBCOBDNBjB6DBmC0BBsIcBEwBBwBfBOdBGqBBGdBDjBBFHBCEBrB9EBTjBBFjBBFnBBJzBBNKBCOBCGBCBBCKBCOBCGBCBBEzBBN2JBKVBLHBZFBCpBBCIBmCFBDCCBqBBCBBEDDBVBLWBKeBiCSBCBBLVBLZBHZBnB3BBHBBhCDBCBBGHBCCBCcBrBcBEcBkBHBCbBc1BBLVBLSBORBvDoCB4ByBBOyBBOnBBjBbBEGGBVB7HpBBCBBEBBRFBzBCBEcBLJJBUBrBRBvBUBcWBKlCBsBEBL4BBKOOBXBYyBBSDBJiBBEKKB+BBCDBKBBLCCkBRBChBBDHHBCB-BGBCCCBCBCOBCJBI4BBYDBCHBDBBDVBCGBCBBCEBEHBDBBDBBEHHGGBdJBCDDClBBCJBCDDCDBCBBECCtBhCBCCBCDBVCBfhCBDBBC5F5FB0BBDGBaFBjB+BBCEE8B1BBDoCoCBZBDNBWGB6F4BBoD-BBgBHBDDDBGBCBBCdBCBBDBBDDB+CHBDtBBDFBCCCBccBxBBDJBSnCBGTTBnCBoDHB5CgBBgBIBCsBBCGBCyByBBcBDVBCNBqCGBCBBCrBBECCBCCBBBCDDBZZBEBCBBCkBBCBBCDBCYYBqBBlIWBKQBCoBBECBwDwCwCB4cBnDuDBSjGBtyCgDBQvhBBSFBa68DBGmSB61GuBBy2B4RBIeBSuCBSdBTvBBRDBgBUBGSBxNsBB0G-BBhBYBDYBtBqCBF4BBIQBhCBBCNNBFBK1mHBqBfBiDyDB+vIDBCGBCBBCiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBFi7Fi7FBzCBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDYBCYBCeBCYBCeBCYBCeBCYBCeBCYBCHB15BeBHFB2GGBCQBDGBCBBCEBG9BBiBxDxDBrBBLGBRiKiKBcBTrBBlPbBlHdBDwGwGBdBCVBJBBhHGBCDBCBBCOBCkGB8BjCBEEE1lBDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1TZBHZBHZB3zD-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Dash:()=>new g(m("tB9qB9qB0BiyDiyDmgBqgCqgCBEB+BoBoBQnMnMlgDDDgBBBFdd-NUUwDxszBxszBBmBmBLqFqFhzD-J-J",!1)),Emoji:()=>new g(m("jBHHGJBwDFFu8HNN5GXX7CFBQBBwLBBNnFnFaKBFCBoGoHoHBLLK7B7BBCBCEBKGDBDDFDDCBBDIEBJJBBBGCCGLBMBBDCCBCCTDDBTTBEBCCCBEEBGGDBBFBBMBBGBBDGGBECBVVBGGBEBCDBDFFDDDBEBCDDCCCHEEHLLBQQDFFCFFBBBCMMBxBxBBBBKeP1LBBwOCBUBB0BFF7mBNN6SCCrrvDrGrGhFBBNBBPDDBIBsCZBCBBYVVDIBWBBvFhBBDvDBDBBCCBDyCBDCBCmIBC+BBMFBCXBIBBDHBNDDBCBDFFBOOBDDJBBKGGBBBNCBJCBDCCFHHEHHB0CBxBlCBGHBDDBEJBECCBEEDJBkHLBF8I8IBtBBCJBC4FBxDMBEKBE4BBCFFBOBDLBFJB",!1)),Emoji_Component:()=>new g(m("jBHHGJB0+H2G2Gsp3B3+8B3+8BBYB8PEBxtBDBtzhY-CB",!1)),Emoji_Modifier:()=>new g(m("7-8DE",!0)),Emoji_Modifier_Base:()=>new g(m("9wJ8G8GRDB4jzD9B9BBBBDDDBBB2DBBDKBWSBEFFBBBCCBICCZqGqGBFFWFFBvFvFBBBEEB0CRRBBBKMMgSDDJHBHKKBIBDCB5B+B+BBCCBCCSCBCMBmHCBrBIB",!1)),Emoji_Presentation:()=>new g(m("64IBBuGDBEDDqQBBWBBzBLBsBUUOJJBSSBGGBJJGWWIBBCFFDIIFBBdkBkBCFFBBBC+B+BBBBZPP8aBB0BFFvlxDrGrG-FDDBIBsCZBCZZVDDBDBCCBWBBvFgBBNIBClCBCVBNqBBFEBNQBEEEBlCBCCCB5FBD+BBODBCXBTbbBOO3C0CBxBlCBHEEBBBDDBEDBMBBIIBkHLBF8I8IBtBBCJBC4FBxDMBEKBE4BBCFFBOBDLBFJB",!1)),Extended_Pictographic:()=>new g(m("pFFFu8HNN5GXX7CFBQBBwLBBNnFnFaKBFCBoGoHoHBLLK7B7BBCBCEBKGDBDDFDDCBBDIEBJJBBBGCCGLBMBBDCCBCCTDDBTTBEBCCCBEEBGGDBBFBBMBBGBBDGGBECBVVBGGBEBCDBDFFDDDBEBCDDCCCHEEHLLBQQDFFCFFBBBCMMBxBxBBBBKeP1LBBwOCBUBB0BFF7mBNN6SCCrrvDoBoBBCBlDLBQBBQPPBmBmBBIBxDBBNBBPDDBIBU3BBcOBLVVDIBCDBKWBH7FBDvDBDBBCCBDyCBDCBCDBG9HBC+BBMFBCXBIBBDHBNDDBCBDFFBOOBDDJBBKGGBBBNCBJCBDCCFHHEHHB0CBxBlCBGHBDQBECCBEBDMB7GlBBNDB5BHBLFBpBHBfBBNDBDNBKmBBNuBBCJBC4FB5CHBPxEBhI9fB",!1)),Hex_Digit:()=>new g(m("wBJIFbFq1-BJIFbF",!0)),Lowercase:()=>new g(m("hDZBwBLLFlBlBBWBCHBC2BCBQCBuBCDECBBBDCCDEEBFFDEEBBBDDDCCCDCCBCCDEECDDBDDBBBHGDCOCBSCBDDCEEC4BCBFBDDDBCCFICBjCBDiBBIBBfEBhDsBsBCEEDDBTccBhBBCBBECBCWCBDBCGDB0B0BBuBBCgBCK0BCDMCBgDCxBoBBo6CqBBCDB5XFBjkCIBC2D2DB+FBiC0ECBHBCgDCBHBJFBLHBJHBJFBLHBJHBJNBDHBJHBJHBJEBCBBHEEBBBCBBJDBDBBJHBLCBCBB6DOORMBuDEEBEEcKFDBBJDBFiBiBBOBFsasaBYBn6BvBBCEEBGCFCCBCCBGBEiDCBIICFFNlBBCGG0oesBCUaCBBBmEMCBBBC8BCBIBCCCDICFCCDCCBBBCSCGGGCMCFCCDOCWDBCCCBBB2ZqBBCNBHvCBh6TGBNEBqhBZBumBnBBpEjBB8EKBCOBCGBCBBkODDBBBCpBBCIBmoByBB+DVB75CfBhsVfB8BYBnqZZBbGBCRBbZBbDBCCCBFBCKBbZBbZBbZBbZBbZBbZBbZBbZBbbBdYBCFBbYBCFBbYBCFBbYBCFBbYBCFBC15B15BBIBCTBHFBmI9BB1lChBB",!1)),Math:()=>new g(m("rBRRBBBgBeeCuBuBFmBmBgB5W5WBBBDbbBDDBBBwQCBuwGccBBBMEEOPPBCBWEBMEBiCMBFEEBFFBDBTFFDJBCDDBEBHEEBDDBCCBBBCFBENBClClCBWBCFBCBBFBBFfBCHHBPPBqIBJDBVBB7CffBZBCZZMGB+NBBNJBFFBFBBDBBEEBPCCDFBMHBGBB6BCCeDBKCBxK-BBhI-PBxBUBDFB9+zB4Z4ZBEBCjFjFRCBeCCeCCkEHHBCBitDBBhrwBwoBwoBBzCBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBDxBBhwFDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBB-uCIB",!1)),Quotation_Mark:()=>new g(m("iBFFkEQQ96HHBaBBowDqOqOBCBOCBixzBDB+FFF7CBB",!1)),Terminal_Punctuation:()=>new g(m("hBLLCMMBEE-ZJJiQ6B6BpCPPCCB1FsBsBBJBCsHsHB3B3BBEBCHBgBmImIB1nB1nBBtFtFFFB4JBB2YHBmY9D9DBBBoCBB+ECBEoBoBBCBDBB7JBBjLDBjFBBLBBCCBeCB8FEB-BBBldYYBKKBBBwlDCBzJOOFLLCBBEBBtNBB8ndBBuICBkHEB-LBB3CBBgD4E4EBBB0ECBgERRB6H6HnxUDDB6B6BBBBCDBqFLLCMMBEEiCDD7hBxBxBnkBoGoG3JBB5EFBlCFB6CDB5dEBtBDB+FGBxDDBgECBiEBBHRRB5C5CBDBtDrJrJB2D2DBBBNBBnLDBEOBqDBB6HCBmQCC8HBB4CBBFBB-MCBuBmUmUBrCrCBspBspBBDB6vRBBmEiCiCBBBLqRqRBoJoJBnwTnwTovHDB",!1)),Uppercase:()=>new g(m("hCZBmDWBCGBiB2BCDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIJDCMCDQCDDDCCBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBDDBBBEWCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBpCDBNDBNDBNEBMDBnIFFECBDCBDEEBDBHGCBCBDDBLBBGbbBOBUzZzZBYBx5BvBBxBCCB
1578BBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoqZZBbZBbZBbCCBGDBDDBCBCHBbZBbBBCDBDHBCGBcBBCDBCEBCEEBFBcZBbZBbZBbZBbZBbZBfYBiBYBiBYBiBYBiBYBiB2pE2pEBgBBvgCZBHZBHZB",!1)),White_Space:()=>new g(m("JEBTlDlDbgvFgvFgsCKBeBBGwBwBh9DAB",!1))})),U(On,"SCRIPTS",new po({Adlam:()=>new g(m("go6DrCFJFB",!0)),Ahom:()=>new g(m("g4lCaDOFW",!0)),Anatolian_Hieroglyphs:()=>new g(m("ggxCmS",!0)),Arabic:()=>new g(m("gwBEBCFBCNBCCBCfBCJBMZBCrDBChBBxCvBBxHhBBGqCBCcBxy8BtPBDvEBhBPBxDEBCmEBk7DeBkCFBJIBiBFBh43BDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBB",!1)),Armenian:()=>new g(m("xpBlBDxBDCks9BE",!0)),Avestan:()=>new g(m("g4iC1BEG",!0)),Balinese:()=>new g(m("g4GsCCxB",!0)),Bamum:()=>new g(m("g1pB3CpowB4R",!0)),Bassa_Vah:()=>new g(m("w26CdDF",!0)),Batak:()=>new g(m("g+GzBJD",!0)),Bengali:()=>new g(m("gsCDBCHBDBBDVBCGBCEEBCBDIBDBBDDBJFFBCCBDBDYB",!1)),Beria_Erfe:()=>new g(m("g17CYDY",!0)),Bhaiksuki:()=>new g(m("ggnCICsBCNLc",!0)),Bopomofo:()=>new g(m("qXB6wLqBxDf",!0)),Brahmi:()=>new g(m("ggkCtCFjBKA",!0)),Braille:()=>new g(m("ggK-H",!0)),Buginese:()=>new g(m("gwGbDB",!0)),Buhid:()=>new g(m("g6FT",!0)),Canadian_Aboriginal:()=>new g(m("ggF-TxRlC7tgCP",!0)),Carian:()=>new g(m("g1gCwB",!0)),Caucasian_Albanian:()=>new g(m("wphCzBMA",!0)),Chakma:()=>new g(m("gokC0BCR",!0)),Cham:()=>new g(m("gwqB2BKNDJDD",!0)),Cherokee:()=>new g(m("g9E1CDFz7lBvC",!0)),Chorasmian:()=>new g(m("w9jCb",!0)),Common:()=>new g(m("AgCBbFBbuBBCOBCEBYgBgBiOmBBGEBDTB1DKKHCC+THHPEEhB9E9ElQiEiEB6mB6mB2MDBjJwvBwvBBBBoCBBsGBBCumBumBOIIBCBCFBCCBDmYmYBKBD2CBCKBEKBCOBShBB-BlBBCCBDFBCaBCQBqBCBF5UBXKBW-cBhIzTBDpEBhQ9CBzMUBCCCBXBQHBFDB8CBBE7C7CB0E0EBOBhBlBBKxBxBB+BBgBwCBwB5C5CBmFBhuG-BBhoWhBBnDCBmFJB1HhFhFsMPPBzuUzuUBxGxGBIBXiBBCSBCDB0ECCBeBbFBbKBLuBuBBhChCBFBCGBLEBjICBFsBBEIBxCMB0BsBBlHaBltuBDB96D8HBEzNBHWBQQBgDzDB9B1HBLmBBD9BBEQBJBBIdBF8BB2GTBNTBN2CBKYBoE0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBDxBByjFjCBtC8BBjWrBBFjDBNOBDOBCOBCkBBLtFB5BZBCBBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBCmDBnghYffB+CB",!1)),Coptic:()=>new g(m("ifNxkKzDGG",!0)),Cuneiform:()=>new g(m("ggoC5cnDuDCEMjG",!0)),Cypriot:()=>new g(m("ggiCFBDCCBqBBCBBEDD",!1)),Cypro_Minoan:()=>new g(m("w8rCiD",!0)),Cyrillic:()=>new g(m("ggBkEBDoFBx6FKBhFtCtCojEfBhie-CBv8VBBhw4B9BBiBAB",!1)),Deseret:()=>new g(m("gghCvC",!0)),Devanagari:()=>new g(m("goCwCFODZh7nBfhwcJ",!0)),Dives_Akuru:()=>new g(m("gomCGBDDDBGBCBBCdBCBBDLBKJB",!1)),Dogra:()=>new g(m("ggmC7B",!0)),Duployan:()=>new g(m("ggvDqDGMEIIJDD",!0)),Egyptian_Hieroglyphs:()=>new g(m("ggsC1iBL68D",!0)),Elbasan:()=>new g(m("gohCnB",!0)),Elymaic:()=>new g(m("g-jCW",!0)),Ethiopic:()=>new g(m("gwEoCBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBDfBEZBnvGWBKGBCGBCGBCGBCGBCGBCGBCGBjpfFBDFBDFBKGBCGBylvCGBCD
1578BCBBCOB",!1)),Garay:()=>new g(m("gqjClBEcJB",!0)),Georgian:()=>new g(m("glElBBCGGDqBBCDBx8CqBBDCBhiElBBCGG",!1)),Glagolitic:()=>new g(m("ggL-Ch9sDGCQDGCBCE",!0)),Gothic:()=>new g(m("w5gCa",!0)),Grantha:()=>new g(m("g4kCDBCHBDBBDVBCGBCBBCEBDIBDBBDCBDHHGGBDGBEEB",!1)),Greek:()=>new g(m("wbDBCCBDDBCFFCCCBBBCCCBSBC+BBPPBnpGEBzBEBFEB1ChKhKBUBDFBDlBBDFBDHBCGCBdBD0BBCOBCNBDFBCSBDCBCIBoJ-xiB-xiB7uVuCBSgj0Bgj0BBkCB",!1)),Gujarati:()=>new g(m("h0CCBCIBCCBCVBCGBCBBCEBDJBCCBCCBDQQBCBDLBIGB",!1)),Gunjala_Gondi:()=>new g(m("grnCFCBCkBCBCFIJ",!0)),Gurmukhi:()=>new g(m("hwCCBCFBFBBDVBCGBCBBCBBCBBDCCBDBFBBDCBEIIBCBCIIBPB",!1)),Gurung_Khema:()=>new g(m("go4C5B",!0)),Han:()=>new g(m("g0LZBC4CBN1GBwBCCaIBPDBle-tGBhC-vUBhoWtLBDpDBpodBBNGBqgkB-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Hangul:()=>new g(m("goE-HvxHBiI9CyDeiCei3dckUj9KNWFwBl9JeEFDFDFDC",!0)),Hanifi_Rohingya:()=>new g(m("gojCnBJJ",!0)),Hanunoo:()=>new g(m("g5FU",!0)),Hatran:()=>new g(m("gniCSCBGE",!0)),Hebrew:()=>new g(m("xsB2BBJaBFFBpp9BZBCEBCCCBCCBCCBIB",!1)),Hiragana:()=>new g(m("hiM1CBHCBi7-C+IBTeeBBBulQAB",!1)),Imperial_Aramaic:()=>new g(m("giiCVCI",!0)),Inherited:()=>new g(m("gYvDB2IBBlOKBbhXhXBCB8qEtBBDLBlPCBCMBCGBFHHEBBnG-BBtQBBjGgBB65DDBsDBBmrzBPBRNBwejHjH7iEl+uBl+uBBsBBDWBhRCBSHBDGBfDBz6rYvHB",!1)),Inscriptional_Pahlavi:()=>new g(m("g7iCSGH",!0)),Inscriptional_Parthian:()=>new g(m("g6iCVDH",!0)),Javanese:()=>new g(m("gsqBtCDJFB",!0)),Kaithi:()=>new g(m("gkkCiCLA",!0)),Kannada:()=>new g(m("gkDMCCCWCJCEDICCCDIBGCCDDJCC",!0)),Katakana:()=>new g(m("hlM5CBDCBxHPBxGuBBC3CBvgzBJBCsBBzisBDBCGBCBBCgJgJBBBzBPPBCB",!1)),Kawi:()=>new g(m("g4nCQCoBEc",!0)),Kayah_Li:()=>new g(m("goqBtBCA",!0)),Kharoshthi:()=>new g(m("gwiCDCBGHCCCcDCFJII",!0)),Khitan_Small_Script:()=>new g(m("k-7C84G84GB0OBqBAB",!1)),Khmer:()=>new g(m("g8F9CDJHJnPf",!0)),Khojki:()=>new g(m("gwkCRCuB",!0)),Khudawadi:()=>new g(m("w1kC6BGJ",!0)),Kirat_Rai:()=>new g(m("gq7C5B",!0)),Lao:()=>new g(m("h0DBBCCCBDBCXBCCCBVBDEBCCCBFBCJBDDB",!1)),Latin:()=>new g(m("hCZBHZBwBQQGWBCeBCgOBoBEB8wGlBBHwBBGDBGMBClCBiC-HByLOORMBuEBBHccSoBB42CfBj1elDBExCBVOBxZqBBCIBCDB38TGB7gBZBHZBmhCFBCpBBCIBm61BeBHFB",!1)),Lepcha:()=>new g(m("ggH3BEOEC",!0)),Limbu:()=>new g(m("goGeBCLBFLBFEEBKB",!1)),Linear_A:()=>new g(m("gwhC2JKVLH",!0)),Linear_B:()=>new g(m("gggCLCZCSCBCODNjB6D",!0)),Lisu:()=>new g(m("wmpBvBx1eA",!0)),Lycian:()=>new g(m("g0gCc",!0)),Lydian:()=>new g(m("gpiCZGA",!0)),Mahajani:()=>new g(m("wqkCmB",!0)),Makasar:()=>new g(m("g3nCY",!0)),Malayalam:()=>new g(m("goDMCCCyBCCCFFPDZ",!0)),Mandaic:()=>new g(m("giCbDA",!0)),Manichaean:()=>new g(m("g2iCmBFL",!0)),Marchen:()=>new g(m("wjnCfDVCN",!0)),Masaram_Gondi:()=>new g(m("gonCGBCBBCrBBECCBCCBHBJJB",!1)),Medefaidrin:()=>new g(m("gy7C6C",!0)),Meetei_Mayek:()=>new g(m("g3qBWqGtBDJ",!0)),Mende_Kikakui:()=>new g(m("gg6DkGDP",!0)),Meroitic_Cursive:()=>new g(m("gtiCXFTDtB",!0)),Meroitic_Hieroglyphs:()=>new g(m("gsiCf",!0)),Miao:()=>new g(m("g47CqCF4BIQ",!0)),Modi:()=>new g(m("gwlCkCMJ",!0)),Mongolian:()=>new g(m("ggGBBDCCBSBH4CBIqBB2t-BMB",!1)),Mro:()=>new g(m("gy6CeCJFB",!0)),Multani:()=>new g(m("g0kCGBCCCBCBCOBCKB",!1)),Myanmar:()=>
1578new g(m("ggE-EhqmBeiDfxibT",!0)),Nabataean:()=>new g(m("gkiCeJI",!0)),Nag_Mundari:()=>new g(m("wm5DpB",!0)),Nandinagari:()=>new g(m("gtmCHDtBDK",!0)),New_Tai_Lue:()=>new g(m("gsGrBFZHKEB",!0)),Newa:()=>new g(m("gglC7CCE",!0)),Nko:()=>new g(m("g+B6BDC",!0)),Nushu:()=>new g(m("h-7CvsQvsQBqMB",!1)),Nyiakeng_Puachue_Hmong:()=>new g(m("go4DsBENDJFB",!0)),Ogham:()=>new g(m("g0Fc",!0)),Ol_Chiki:()=>new g(m("wiHvB",!0)),Ol_Onal:()=>new g(m("wu5DqBFA",!0)),Old_Hungarian:()=>new g(m("gkjCyBOyBIF",!0)),Old_Italic:()=>new g(m("g4gCjBKC",!0)),Old_North_Arabian:()=>new g(m("g0iCf",!0)),Old_Permic:()=>new g(m("w6gCqB",!0)),Old_Persian:()=>new g(m("g9gCjBFN",!0)),Old_Sogdian:()=>new g(m("g4jCnB",!0)),Old_South_Arabian:()=>new g(m("gziCf",!0)),Old_Turkic:()=>new g(m("ggjCoC",!0)),Old_Uyghur:()=>new g(m("w7jCZ",!0)),Oriya:()=>new g(m("h4CCCHDBDVCGCBCEDIDBDCICFBCEDR",!0)),Osage:()=>new g(m("wlhCjBFjB",!0)),Osmanya:()=>new g(m("gkhCdDJ",!0)),Pahawh_Hmong:()=>new g(m("g46ClCLJCGCUGS",!0)),Palmyrene:()=>new g(m("gjiCf",!0)),Pau_Cin_Hau:()=>new g(m("g2mC4B",!0)),Phags_Pa:()=>new g(m("giqB3B",!0)),Phoenician:()=>new g(m("goiCbEA",!0)),Psalter_Pahlavi:()=>new g(m("g8iCRIDNG",!0)),Rejang:()=>new g(m("wpqBjBMA",!0)),Runic:()=>new g(m("g1FqCEK",!0)),Samaritan:()=>new g(m("ggCtBDO",!0)),Saurashtra:()=>new g(m("gkqBlCJL",!0)),Sharada:()=>new g(m("gskC-ChsCH",!0)),Shavian:()=>new g(m("wihCvB",!0)),Siddham:()=>new g(m("gslC1BDlB",!0)),Sidetic:()=>new g(m("gqiCZ",!0)),SignWriting:()=>new g(m("gg2DrUQECO",!0)),Sinhala:()=>new g(m("hsDCBCRBEXBCIBCDDBFBEFFBEBCCCBGBHJBDCBt-gCTB",!1)),Sogdian:()=>new g(m("w5jCpB",!0)),Sora_Sompeng:()=>new g(m("wmkCYIJ",!0)),Soyombo:()=>new g(m("wymCyC",!0)),Sundanese:()=>new g(m("g8G-BhIH",!0)),Sunuwar:()=>new g(m("g+mChBPJ",!0)),Syloti_Nagri:()=>new g(m("ggqBsB",!0)),Syriac:()=>new g(m("g4BNC7BDCxIK",!0)),Tagalog:()=>new g(m("g4FVKA",!0)),Tagbanwa:()=>new g(m("g7FMCCCB",!0)),Tai_Le:()=>new g(m("wqGdDE",!0)),Tai_Tham:()=>new g(m("gxG+BCcDKHJHN",!0)),Tai_Viet:()=>new g(m("g0qBiCZE",!0)),Tai_Yo:()=>new g(m("g25DeCVJB",!0)),Takri:()=>new g(m("g0lC5BHJ",!0)),Tamil:()=>new g(m("i8CBBCFBECBCDBEBBCCCBEEBEEBBBELBFEBECBCDBDHHPUBm+kCxBBOAB",!1)),Tangsa:()=>new g(m("wz6CuCCJ",!0)),Tangut:()=>new g(m("g-7CgBgBB+3GBhQeBiDyDB",!1)),Telugu:()=>new g(m("ggDMCCCWCPDICCCDIBCCCBDDDJII",!0)),Thaana:()=>new g(m("g8BxB",!0)),Thai:()=>new g(m("hwD5BGb",!0)),Tibetan:()=>new g(m("g4DnCCjBFmBCjBCOCGFB",!0)),Tifinagh:()=>new g(m("wpL3BIBPA",!0)),Tirhuta:()=>new g(m("gklCnCJJ",!0)),Todhri:()=>new g(m("guhCzB",!0)),Tolong_Siki:()=>new g(m("wtnCrBFJ",!0)),Toto:()=>new g(m("w04De",!0)),Tulu_Tigalari:()=>new g(m("g8kCJBCDDClBBCJBCDDCDBCJBCBBJBB",!1)),Ugaritic:()=>new g(m("g8gCdCA",!0)),Unknown:()=>new g(m("4bBBHDBICCVuMuMnBBBzBBBE4B4BBGBcDBHKBvI9B9BBmDmDBMB8BBByBBBQddBCCMEBjBEBuHJJBDDBXXICCBBBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ6BFFBkCkCBhBhBBBBbFB3CBBHBB+UCB6CGBXIBZIBVLBOEEDLB-CBBLFBLFBbFB6CGBsBEBnCJBgBNNBCBNDBCCBrBBBGKBtBDBbFBMCB-BBBiCeeBMMBEBLFBPBBvBBBNTBuCnFnFBGB9BCBQCB-BEBsBBBMHBsBEB3QBBHBBnBBBHBBJGCgBBB2BQQPBBHUUBEEKmDmDNBBcOOBBBjBNBiBOBtEDB7UVBMUB14BBB-LEBuBCCBDBCBB5BGBDNBZIBI4BI-DhBBb6C6CBKB3GZBxC3C3CBoDoDBDBsB-C-C3CIBxBuzcuzcBBB4BIB9KTB5FHB+GTB9BCBLFB5BHBnCHBNFB1DKBfCBvCMMBCBiB4B4BBHBPBBLBBoDXBdJBHBBHBBHIBIII9BDB-DBBLFBl9KLBYDByBjoIBvLBBrDlBBILBGEBbGGCGDrUfBrBFB0BUUFDBGoEoEBCC-FCBHBBHBBHBBECBIIIBIBGBBNbbUDDQBBPhBB8DEBEDBuBCB5COOBBBCuBBvBhEBeCByBOBdDBlBIBfEBsBEBfmBmBBCBPpBB-EBBLFBlBDBlBDBpBHB1BKBNQQIDDMQQIDDBBB1BLB4JIBXJBJXBHrBrBKkCBHBBCtBtBDCBCBBYpCpCBGBKvBBUDDBDBiBCBcEBclBB5BDBVBBzBDDBDBJEEeBBEDBLGBKGBhCfBoBDBNIB3BCBeBBcEBbGBFLBIvCBqC2BB0BMB0BGBvBHBLFBnBCBeHBDvGBgBrBrBEBBDPBHHBKgBBvBHBrBVBblBBdTBYIBvCDBlBIBlCJBCBBaGBLFB2BTTBGBoBIBhDVVBJBTwBwBB8BBICCFQQMFB8BEBLFBFJJBDDBXXIDDGLLBDDBEEBCCBEBCEBIBBICBGKBLCCBCCnBLLCBBCFFLDDBGBDcB9CGGBcBpCHBLlFB3BBBnBhBBmCKBLFBOSB7BFBLFBVbBcBBQDBY4FB9BjDB0CLBJBBCBBJDDfDDBNNBHBLlCBJBBvBBBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBD
1578DHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMB3iBJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBJ76DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBjGUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBNDBLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIm8yVBCdBhD-DBxHvw-FB",!1)),Vai:()=>new g(m("gopBrJ",!0)),Vithkuqi:()=>new g(m("wrhCKCOCGCBCKCOCGCB",!0)),Wancho:()=>new g(m("g24D5BGA",!0)),Warang_Citi:()=>new g(m("glmCyCNA",!0)),Yezidi:()=>new g(m("g0jCpBCCDB",!0)),Yi:()=>new g(m("ggoBskBE2B",!0)),Zanabazar_Square:()=>new g(m("gwmCnC",!0))})),U(On,"FOLD_CATEGORIES",new po({L:()=>new g(m("laA",!0)),LC:()=>new g(m("laA",!0)),Ll:()=>new g(m("hCZBmDWBCGBiBuBCEECDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIBBCBBCBBCOCDQCDBBCCCBBBC4BCIBBCBBDCCBCBCGC3HrBrBCEEJHHCCBCCCBCCBPBCIBkBJJCUCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBZHBJHBJHBJEBMEBMDBNEBMEBqJEEBHHxC9zC9zCBuBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoyehBB",!1)),Lt:()=>new g(m("kOCCBCCBCClBCCtsHHBJHBJHBMQQwBAB",!1)),Lu:()=>new g(m("hDZB7BqBqBBWBCHBCuBCEECDOCDsBCDECBBBDCCDEEGDDECBDDDCCCDFFDEECDDECCGBBCBBCBBCOCBSCDBBCEECkBCEQCJDDBCCFICBEBCBBCCCBEEBCCBCBCEBDCCBDDIDDCBBEFBGLLBnFnFsBCCEEEBBBvBDBCdBCBBECBCWCBDBCGD1BvBBCgBCK0BCDMCBgDCyBlBBq6CqBBDCB5XFBjkCIBCvHvHERRzD0ECGGGC8CCBHBJFBLHBJHBJFBMGCJHBJNBzBBBNSSBPPBEEpL2B2Bs1CvBBCEEBGCHDDLiDCJCCFNNBkBBCGG0oesBCUaCoEMCE8BCLCCDICFFFCBBDSCMOCFCCDOCb9a9advCBi8UZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBvyehBB",!1)),M:()=>new g(m("5cgBgBlgHAB",!1)),Mn:()=>new g(m("5cgBgBlgHAB",!1)),Emoji:()=>new g(m("8mJA",!0)),Extended_Pictographic:()=>new g(m("8mJA",!0)),Lowercase:()=>new g(m("hCZBmDWBCGBiBuBCEECDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIBBCBBCBBCOCDQCDBBCCCBBBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBJJCUCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBZHBJHBJHBJEBMEBMDBNEBMEBqJEEBHHuBPBUzZzZBYBx5BvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoyehBB",!1)),Math:()=>new g(m("ycGDCHHFMMDDDCHHFAB",!1)),Uppercase:()=>new g(m("hDZB7BqBqBBWBCHBCuBCEECDOCDsBCDECBBBDCCDEEGDDECBDDDCCCDFFDEECDDECCGBBCBBCBBCOCBSCDBBCEECkBCEQCJDDBCCFICBEBCBBCCCBEEBCCBCBCEBDCCBDDIDDCBBEFBGLLBnFnFsBCCEEEBBBvBDBCdBCBBECBCWCBDBCGD1BvBBCgBCK0BCDMCBgDCyBlBBq6CqBBDCB5XFBjkCIBCvHvHERRzD0ECGGGC8CCBHBJFBLHBJHBJFBMGCJHBJNBzBBBNSSBPPBEEpLiBiBBOBFsasaBYBn6BvBBCEEBGCHDDLiDCJCCFNNBkBBCGG0oesBCUaCoEMCE8BCLCCDICFFFCBBDSCMOCFCCDOCb9a9advCBi8UZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBvyehBB",!1))})),U(On,"FOLD_SCRIPT",new po({Common:()=>new g(m("8cgBgB",!1)),Greek:()=>new g(m("1FwUwU",!1)),Inherited:()=>new g(m("5cgBgBlgHAB",!1))})),On),De,z=(De=class{static is32(e,t){let r=0,s=e.length;for(;r<s;){const i=r+Math.floor((s-r)/2),o=e.getLo(i),B=e.getHi(i);if(o<=t&&t<=B){const c=e.getStride(i);return(t-o)%c===0}t<o?s=i:r=i+1}return!1}static is(e,t){if(t<=De.MAX_LATIN1){for(let r=0;r<e.length;r++){if(t>e.getHi(r))continue;const s=e.getLo(r);if(t<s)return!1;const i=e.getStride(r);return(t-s)%i===0}return!1}return e.length>0&&t>=e.getLo(0)&&De.is32(e,t)}static isUpper(e){if(e<=De.MAX_LATIN1){const t=String.fromCodePoint(e);return t.toUpperCase()===t&&t.toLowerCase()!==t}return De.is(lt.Upper,e)}static isPrint(e){return e<=De.MAX_LATIN1?e>=32&&e<De.MAX_ASCII||e>=161&&e!==173:De.is(lt.Print,e)}static simpleFold(e){if(lt.CASE_ORBIT.has(e))return lt.CASE_ORBIT.get(e);const t=N.toLowerCase(e);return t!==e?t:N.toUpperCase(e)}static equalsIgnoreCase(e,t){if(e===t)return!0;
1578if(e<0||t<0)return!1;if(e<=De.MAX_ASCII&&t<=De.MAX_ASCII)return 65<=e&&e<=90&&(e|=32),65<=t&&t<=90&&(t|=32),e===t;for(let r=De.simpleFold(e);r!==e;r=De.simpleFold(r))if(r===t)return!0;return!1}},U(De,"MAX_RUNE",1114111),U(De,"MAX_ASCII",127),U(De,"MAX_LATIN1",255),U(De,"MAX_BMP",65535),U(De,"MIN_FOLD",65),U(De,"MAX_FOLD",125251),U(De,"MIN_HIGH_SURROGATE",55296),U(De,"MAX_HIGH_SURROGATE",56319),U(De,"MIN_LOW_SURROGATE",56320),U(De,"MAX_LOW_SURROGATE",57343),U(De,"MIN_SUPPLEMENTARY_CODE_POINT",65536),De);const Mc=256,yC=new Uint8Array(Mc);for(let n=0;n<Mc;n++)yC[n]=97<=n&&n<=122||65<=n&&n<=90||48<=n&&n<=57||n===95?1:0;let PB=null,OB=null;var Ae,$=(Ae=class{static emptyInts(){return[]}static isByteArray(e){return Array.isArray(e)||e instanceof Uint8Array}static isalnum(e){return N.CODES.get("0")<=e&&e<=N.CODES.get("9")||N.CODES.get("a")<=e&&e<=N.CODES.get("z")||N.CODES.get("A")<=e&&e<=N.CODES.get("Z")}static unhex(e){return N.CODES.get("0")<=e&&e<=N.CODES.get("9")?e-N.CODES.get("0"):N.CODES.get("a")<=e&&e<=N.CODES.get("f")?e-N.CODES.get("a")+10:N.CODES.get("A")<=e&&e<=N.CODES.get("F")?e-N.CODES.get("A")+10:-1}static escapeRune(e){let t="";if(z.isPrint(e))Ae.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(t+="\\"),t+=String.fromCodePoint(e);else switch(e){case N.CODES.get('"'):t+='\\"';break;case N.CODES.get("\\"):t+="\\\\";break;case N.CODES.get("	"):t+="\\t";break;case N.CODES.get(`
1579`):t+="\\n";break;case N.CODES.get("\r"):t+="\\r";break;case N.CODES.get("\b"):t+="\\b";break;case N.CODES.get("\f"):t+="\\f";break;default:{let r=e.toString(16);e<256?(t+="\\x",r.length===1&&(t+="0"),t+=r):t+=`\\x{${r}}`;break}}return t}static stringToRunes(e){const t=String(e),r=[];let s=0;for(;s<t.length;){const i=t.codePointAt(s);r.push(i),s+=i>z.MAX_BMP?2:1}return r}static runeToString(e){return String.fromCodePoint(e)}static isWordRune(e){return e<Mc?yC[e]===1:!1}static emptyOpContext(e,t){let r=0;return e<0&&(r|=Ae.EMPTY_BEGIN_TEXT|Ae.EMPTY_BEGIN_LINE),e===10&&(r|=Ae.EMPTY_BEGIN_LINE),t<0&&(r|=Ae.EMPTY_END_TEXT|Ae.EMPTY_END_LINE),t===10&&(r|=Ae.EMPTY_END_LINE),Ae.isWordRune(e)!==Ae.isWordRune(t)?r|=Ae.EMPTY_WORD_BOUNDARY:r|=Ae.EMPTY_NO_WORD_BOUNDARY,r}static quoteMeta(e){return e.split("").map(t=>Ae.METACHARACTERS.indexOf(t)>=0?`\\${t}`:t).join("")}static charCount(e){return e>z.MAX_BMP?2:1}static toArray(e){const t=e.length,r=new Array(t);for(let s=0;s<t;s++)r[s]=e[s];return r}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return PB||(PB=new TextEncoder),PB.encode(e);{let t=[],r=0;for(let s=0;s<e.length;s++){let i=e.charCodeAt(s);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===z.MIN_HIGH_SURROGATE&&s+1<e.length&&(e.charCodeAt(s+1)&64512)===z.MIN_LOW_SURROGATE?(i=z.MIN_SUPPLEMENTARY_CODE_POINT+((i&1023)<<10)+(e.charCodeAt(++s)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder){OB||(OB=new TextDecoder("utf-8"));const t=e instanceof Uint8Array?e:new Uint8Array(e);return OB.decode(t)}else{let t=[],r=0,s=0;for(;r<e.length;){let i=e[r++];if(i<128)t[s++]=String.fromCharCode(i);else if(i>191&&i<224){let o=e[r++];t[s++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){let o=e[r++],B=e[r++],c=e[r++],u=((i&7)<<18|(o&63)<<12|(B&63)<<6|c&63)-z.MIN_SUPPLEMENTARY_CODE_POINT;t[s++]=String.fromCharCode(z.MIN_HIGH_SURROGATE+(u>>10)),t[s++]=String.fromCharCode(z.MIN_LOW_SURROGATE+(u&1023))}else{let o=e[r++],B=e[r++];t[s++]=String.fromCharCode((i&15)<<12|(o&63)<<6|B&63)}}return t.join("")}}},U(Ae,"METACHARACTERS","\\.+*?()|[]{}^$"),U(Ae,"EMPTY_BEGIN_LINE",1),U(Ae,"EMPTY_END_LINE",2),U(Ae,"EMPTY_BEGIN_TEXT",4),U(Ae,"EMPTY_END_TEXT",8),U(Ae,"EMPTY_WORD_BOUNDARY",16),U(Ae,"EMPTY_NO_WORD_BOUNDARY",32),U(Ae,"EMPTY_ALL",-1),Ae);const IC=(n=[],e=0)=>{const t=Object.create(null);for(let r=0;r<n.length;r++){const s=n[r],i=e+r;t[s]=i,t[i]=s}return Object.freeze(t)};var Un,vr=(Un=class{getEncoding(){throw Error("not implemented")}asCharSequence(){throw Error("not implemented")}asBytes(){throw Error("not implemented")}length(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===Un.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===Un.Encoding.UTF_16}},U(Un,"Encoding",IC(["UTF_16","UTF_8"])),Un),Ph=class extends vr{constructor(n=null){super(),this.bytes=n}getEncoding(){return vr.Encoding.UTF_8}asCharSequence(){return $.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},Fw=class extends vr{constructor(n=null){super(),this.charSequence=n}getEncoding(){return vr.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return $.stringToUtf8ByteArray(this.charSequence.toString())}length(){return this.charSequence.length}},gr=class{static utf16(n){return new Fw(n)}static utf8(n){return $.isByteArray(n)?new Ph(n):new Ph($.stringToUtf8ByteArray(n))}},at=class{static EOF(){return-8}constructor(){this.end=0}canCheckPrefix(){return!0}endPos(){return this.end}hasString(){return!1}hasAnyString(){return!1}prefixLength(){return 0}},Lw=class extends at{constructor(n,e=0,t=n.length){super(),this.bytes=n,this.start=e,this.end=t}hasString(n,e){const t=n.bytes;if(t.length===0)return!0;const r=this.indexOf(this.bytes,t,this.start+e);return r!==-1&&r<=this.end-t.length}hasAnyString(n,e){return n.ac8?n.ac8.searchUTF8(this.bytes,this.start+e,this.end):!1}step(n){if(n+=this.start,n>=this.end)return at.EOF();const e=this.bytes[n]&255;if(e<128)return e<<3|1;if(e>=194&&e<=223&&n+1<this.end){const t=this.bytes[n+1]&255;return(t&192)!==128?e<<3|1:((e&31)<<6|t&63)<<3|2}else if(e>=224&&e<=239&&n+2<this.end){const t=this.bytes[n+1]&255;if((t&192)!==128)return e<<3|1;const r=this.bytes[n+2]&255;return(r&192)!==128?e<<3|1:((e&15)<<12|(t&63)<<6|r&63)<<3|3}else if(e>=240&&e<=244&&n+3<this.end){const t=this.bytes[n+1]&255;if((t&192)!==128)return e<<3|1;const r=this.bytes[n+2]&255;if((r&192)!==128)return e<<3|1;const s=this.bytes[n+3]&255;return(s&192)!==128?e<<3|1:((e&7)<<18|(t&63)<<12|(r&63)<<6|s&63)<<3|4}else return e<<3|1}index(n,e){e+=this.start;const t=this.indexOf(this.bytes,n.prefixUTF8,e);return t<0?t:t-e}context(n){n+=this.start;let e=-1;if(n>this.start&&n<=this.end){let r=n-1;if(e=this.bytes[r--],e>=128){let s=n-4;for(s<this.start&&(s=this.start);r>=s&&(this.bytes[r]&192)===128;)r--;r<this.start&&(r=this.start),e=this.step(r-this.start)>>3}}const t=n<this.end?this.step(n-this.start)>>3:-1;return $.emptyOpContext(e,t)}indexOf(n,e,t=0){let r=e.length;if(r===0)return t<=this.end?t:-1;const s=e[0];let i=this.end-r;const o=typeof n.indexOf=="function";let B=t;for(;B<=i;){if(o){if(B=n.indexOf(s,B),B===-1||B>i)return-1}else{for(;B<=i&&n[B]!==s;)B++;if(B>i)return-1}let c=!0;for(let u=1;u<r;u++)if(n[B+u]!==e[u]){c=!1;break}if(c)return B;B++}return-1}prefixLength(n){return n.prefixUTF8.length}},kw=class extends at{constructor(n,e=0,t=n.length){super(),this.charSequence=n,this.start=e,this.end=t}hasString(n,e){const t=this.charSequence.indexOf(n.str,this.start+e);return t!==-1&&t<=this.end-n.str.length}hasAnyString(n,e){return n.ac16?n.ac16.searchUTF16(this.charSequence,this.start+e,this.end):!1}step(n){if(n+=this.start,n>=this.end)return at.EOF();const e=this.charSequence.charCodeAt(n);if(e<z.MIN_HIGH_SURROGATE||e>z.MAX_HIGH_SURROGATE||n+1>=this.end)return e<<3|1;const t=this.charSequence.charCodeAt(n+1);return t>=z.MIN_LOW_SURROGATE&&t<=z.MAX_LOW_SURROGATE?(e-z.MIN_HIGH_SURROGATE)*1024+(t-z.MIN_LOW_SURROGATE)+z.MIN_SUPPLEMENTARY_CODE_POINT<<3|2:e<<3|1}index(n,e){e+=this.start;const t=this.charSequence.indexOf(n.prefix,e);return t<0||t>this.end-n.prefix.length?-1:t-e}context(n){n+=this.start;const e=n>this.start&&n<=this.end?this.charSequence.charCodeAt(n-1):-1,t=n<this.end?this.charSequence.charCodeAt(n):-1;return $.emptyOpContext(e,t)}prefixLength(n){return n.prefix.length}},Te=class{static fromUTF8(n,e=0,t=n.length){return new Lw(n,e,t)}static fromUTF16(n,e=0,t=n.length){return new kw(n,e,t)}}
1579,ki=class extends Error{constructor(n){super(n),this.name="RE2JSException"}},we=class extends ki{constructor(n,e=null){let t=`error parsing regexp: ${n}`;e&&(t+=`: \`${e}\``),super(t),this.name="RE2JSSyntaxException",this.message=t,this.error=n,this.input=e}getDescription(){return this.error}getPattern(){return this.input}},Vw=class extends ki{constructor(n){super(n),this.name="RE2JSCompileException"}},ut=class extends ki{constructor(n){super(n),this.name="RE2JSGroupException"}},xw=class extends ki{constructor(n){super(n),this.name="RE2JSFlagsException"}},si=class extends ki{constructor(n){super(n),this.name="RE2JSInternalException"}},_r,Oh=(_r=class{static quoteReplacement(e,t=!1){return t?e.indexOf("\\")<0&&e.indexOf("$")<0?e:e.split("").map(r=>{const s=r.codePointAt(0);return s===N.CODES.get("\\")||s===N.CODES.get("$")?`\\${r}`:r}).join(""):e.indexOf("$")<0?e:e.split("").map(r=>r.codePointAt(0)===N.CODES.get("$")?"$$":r).join("")}constructor(e,t){if(e===null)throw new Error("pattern is null");this.patternInput=e;const r=this.patternInput.re2();this.patternGroupCount=r.numberOfCapturingGroups(),this.groups=[],this.namedGroups=r.namedGroups,this.numberOfInstructions=r.numberOfInstructions(),t instanceof vr?this.resetMatcherInput(t):$.isByteArray(t)?this.resetMatcherInput(gr.utf8(t)):this.resetMatcherInput(gr.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(e===null)throw new Error("input is null");return e instanceof vr||($.isByteArray(e)?e=gr.utf8(e):e=gr.utf16(e)),this.matcherInput=e,this.reset(),this}start(e=0){if(typeof e=="string"){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new ut(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if(typeof e=="string"){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new ut(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}programSize(){return this.numberOfInstructions}group(e=0){if(typeof e=="string"){const s=this.namedGroups[e];if(!Number.isFinite(s))throw new ut(`group '${e}' not found`);e=s}const t=this.start(e),r=this.end(e);return t<0&&r<0?null:this.substring(t,r)}getNamedGroups(){if(!this.hasMatch)throw new ut("perhaps no match attempted");const e=Object.create(null);for(const t of Object.keys(this.namedGroups))e[t]=this.group(t);return e}groupCount(){return this.patternGroupCount}loadGroup(e){if(e<0||e>this.patternGroupCount)throw new ut(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new ut("perhaps no match attempted");if(e===0||this.hasGroups)return;const t=this.matcherInputLength,r=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount);if(!r[0])throw new ut("inconsistency in matching group data");this.groups=r[1],this.hasGroups=!0}matches(){return this.genMatch(0,M.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,M.ANCHOR_START)}find(e=null){if(e!==null){if(e<0||e>this.matcherInputLength)throw new ut(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}if(e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1])){const t=(this.matcherInput.isUTF16Encoding()?Te.fromUTF16(this.matcherInput.asCharSequence(),0,this.matcherInputLength):Te.fromUTF8(this.matcherInput.asBytes(),0,this.matcherInputLength)).step(e);t<0?e++:e+=t&7}return this.genMatch(e,M.UNANCHORED)}genMatch(e,t){const r=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1);return r[0]?(this.groups=r[1],this.hasMatch=!0,this.hasGroups=this.patternGroupCount===0,this.anchorFlag=t,!0):(this.hasMatch=!1,!1)}substring(e,t){return this.matcherInput.isUTF8Encoding()?$.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let r="";const s=this.start(),i=this.end();return this.appendPos<s&&(r+=this.substring(this.appendPos,s)),this.appendPos=i,r+=t?this.appendReplacementInternalJava(e):this.appendReplacementInternalJs(e),r}appendReplacementInternalJava(e){let t="",r=0;const s=e.length;let i=0;for(;i<s;){const o=e.codePointAt(i);if(o===N.CODES.get("\\")){if(r<i&&(t+=e.substring(r,i)),i++,i>=s)throw new ut("character to be escaped is missing");r=i,i++;continue}if(o===N.CODES.get("$")){if(r<i&&(t+=e.substring(r,i)),i+1>=s)throw new ut("Illegal group reference: group index is missing");const B=e.codePointAt(i+1);if(N.CODES.get("0")<=B&&B<=N.CODES.get("9")){let c=B-N.CODES.get("0"),u=i+2;
1579for(;u<s;u++){const d=e.codePointAt(u);if(d<N.CODES.get("0")||d>N.CODES.get("9")||c*10+d-N.CODES.get("0")>this.patternGroupCount)break;c=c*10+d-N.CODES.get("0")}if(c>this.patternGroupCount)throw new ut(`n > number of groups: ${c}`);const h=this.group(c);h!==null&&(t+=h),i=u,r=i}else if(B===N.CODES.get("{")){let c=i+2;for(;c<s&&e.codePointAt(c)!==N.CODES.get("}");)c++;if(c>=s)throw new ut("named capture group is missing trailing '}'");const u=e.substring(i+2,c),h=this.group(u);h!==null&&(t+=h),i=c+1,r=i}else throw new ut("Illegal group reference");continue}i++}return r<s&&(t+=e.substring(r,s)),t}appendReplacementInternalJs(e){let t="",r=0;const s=e.length;for(let i=0;i<s-1;i++)if(e.codePointAt(i)===N.CODES.get("$")){let o=e.codePointAt(i+1);if(N.CODES.get("$")===o){r<i&&(t+=e.substring(r,i)),t+="$",i++,r=i+1;continue}else if(N.CODES.get("&")===o){r<i&&(t+=e.substring(r,i));const B=this.group(0);B!==null?t+=B:t+="$&",i++,r=i+1;continue}else if(N.CODES.get("`")===o){r<i&&(t+=e.substring(r,i)),t+=this.substring(0,this.start(0)),i++,r=i+1;continue}else if(N.CODES.get("'")===o){r<i&&(t+=e.substring(r,i)),t+=this.substring(this.end(0),this.matcherInputLength),i++,r=i+1;continue}else if(N.CODES.get("1")<=o&&o<=N.CODES.get("9")){let B=o-N.CODES.get("0");for(r<i&&(t+=e.substring(r,i)),i+=2;i<s&&(o=e.codePointAt(i),!(o<N.CODES.get("0")||o>N.CODES.get("9")||B*10+o-N.CODES.get("0")>this.patternGroupCount));i++)B=B*10+o-N.CODES.get("0");if(B>this.patternGroupCount){t+=`$${B}`,r=i,i--;continue}const c=this.group(B);c!==null&&(t+=c),r=i,i--;continue}else if(o===N.CODES.get("<")){r<i&&(t+=e.substring(r,i)),i++;let B=i+1;for(;B<e.length&&e.codePointAt(B)!==N.CODES.get(">")&&e.codePointAt(B)!==N.CODES.get(" ");)B++;if(B===e.length||e.codePointAt(B)!==N.CODES.get(">")){t+=e.substring(i-1,B+1),r=B+1,i=B;continue}const c=e.substring(i+1,B);if(Object.prototype.hasOwnProperty.call(this.namedGroups,c)){const u=this.group(c);u!==null&&(t+=u)}else t+=`$<${c}>`;r=B+1,i=B;continue}}return r<s&&(t+=e.substring(r,s)),t}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(e,t=!1){return this.replace(e,!0,t)}replaceFirst(e,t=!1){return this.replace(e,!1,t)}replace(e,t=!0,r=!1){let s="";this.reset();const i=typeof e=="function",o=Object.keys(this.namedGroups).length>0;let B=null;if(i){if(this.groupCount()>=_r.MAX_REPLACER_ARGS)throw new ut("Too many capture groups to safely invoke replacer function");B=this.matcherInput.isUTF8Encoding()?this.matcherInput.asBytes():this.matcherInput.asCharSequence()}for(;this.find()&&(s+=i?this.appendReplacementFunc(e,o,B):this.appendReplacement(e,r),!!t););return s+=this.appendTail(),s}appendReplacementFunc(e,t,r){let s="";const i=this.start(),o=this.end();this.appendPos<i&&(s+=this.substring(this.appendPos,i)),this.appendPos=o;const B=this.buildReplacerArgs(i,t,r);return s+=String(e(...B)),s}buildReplacerArgs(e,t,r){const s=[this.group(0)],i=this.groupCount();for(let o=1;o<=i;o++){const B=this.start(o);B<0?s.push(void 0):s.push(this.substring(B,this.end(o)))}if(s.push(e),s.push(r),t){const o=this.getNamedGroups();for(const B in o)o[B]===null&&(o[B]=void 0);s.push(o)}return s}},U(_r,"MAX_REPLACER_ARGS",65535),_r),ue,F=(ue=class{static isRuneOp(e){return ue.RUNE<=e&&e<=ue.RUNE_ANY_NOT_NL}static escapeRunes(e){let t='"';for(let r of e)t+=$.escapeRune(r);return t+='"',t}constructor(e){this.op=e,this.out=0,this.arg=0,this.runes=[],this.next=null}matchRune(e){if(this.runes.length===1){const o=this.runes[0];return this.arg&M.FOLD_CASE?z.equalsIgnoreCase(o,e):e===o}const t=this.runes.length;if(t===0)return!1;if(t===2||t===4||t===6||t===8){for(let o=0;o<t;o+=2){if(e<this.runes[o])return!1;if(e<=this.runes[o+1])return!0}return!1}let r=0,s=t>>1;for(;s>1;){const o=s>>1;r+=this.runes[r+o<<1]<=e?o:0,s-=o}r+=this.runes[r<<1]<=e?1:0;const i=r-1;return i>=0&&e<=this.runes[i<<1|1]}matchRunePos(e){if(this.runes.length===1){const o=this.runes[0];return this.arg&M.FOLD_CASE?z.equalsIgnoreCase(o,e)?0:-1:e===o?0:-1}const t=this.runes.length;if(t===0)return-1;if(t===2||t===4||t===6||t===8){for(let o=0;o<t;o+=2){if(e<this.runes[o])return-1;if(e<=this.runes[o+1])return Math.floor(o/2)}return-1}let r=0,s=t>>1;for(;s>1;){const o=s>>1;r+=this.runes[r+o<<1]<=e?o:0,s-=o}r+=this.runes[r<<1]<=e?1:0;const i=r-1;return i>=0&&e<=this.runes[i<<1|1]?i:-1}toString(){switch(this.op){case ue.ALT:return`alt -> ${this.out}, ${this.arg}`;case ue.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case ue.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case ue.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case ue.MATCH:return`match${this.arg!==0?` ${this.arg}`:""}`;case ue.FAIL:return"fail";case ue.NOP:return`nop -> ${this.out}`;case ue.LB_WRITE:return`lbwrite ${this.arg} -> ${this.out}`;case ue.LB_CHECK:return`lbcheck ${this.arg} -> ${this.out}`;case ue.RUNE:return this.runes===null?"rune <null>":["rune ",ue.escapeRunes(this.runes),this.arg&M.FOLD_CASE?"/i":""," -> ",this.out].join("");case ue.RUNE1:return`rune1 ${ue.escapeRunes(this.runes)} -> ${this.out}`;case ue.RUNE_ANY:return`any -> ${this.out}`;case ue.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},U(ue,"ALT",1),U(ue,"ALT_MATCH",2),U(ue,"CAPTURE",3),U(ue,"EMPTY_WIDTH",4),U(ue,"FAIL",5),U(ue,"MATCH",6),U(ue,"NOP",7),U(ue,"RUNE",8),U(ue,"RUNE1",9),U(ue,"RUNE_ANY",10),U(ue,"RUNE_ANY_NOT_NL",11),U(ue,"LB_WRITE",12),U(ue,"LB_CHECK",13),ue),Nh=class{constructor(n){this.sparse=new Int32Array(n),this.densePcs=new Int32Array(n),this.denseCaps=null,this.size=0,this.ncap=0}init(n){this.ncap=n;const e=this.densePcs.length*n;(!this.denseCaps||this.denseCaps.length<e)&&(this.denseCaps=new Int32Array(e))}contains(n){const e=this.sparse[n];return e<this.size&&this.densePcs[e]===n}isEmpty(){return this.size===0}add(n){const e=this.size++;return this.sparse[n]=e,this.densePcs[e]=n,e}clear(){this.size=0}toString(){let n="{";for(let e=0;e<this.size;e++)e!==0&&(n+=", "),n+=this.densePcs[e];return n+="}",n}},Mw=class oc{static fromRE2(e){const t=new oc;return t.prog=e.prog,t.re2=e,t.q0=new Nh(t.prog.numInst()),t.q1=new Nh(t.prog.numInst()),t.matched=!1,t.matchcap=new Int32Array(t.prog.numCap<2?2:t.prog.numCap),t.ncap=0,t}static fromMachine(e){return oc.fromRE2(e.re2)}constructor(){this.prog=null,this.re2=null,this.q0=null,this.q1=null,this.matched=!1,this.matchcap=null,this.ncap=0,this.lbTable=null}init(e){this.ncap=e,e>this.matchcap.length?this.matchcap=new Int32Array(e).fill(-1):this.matchcap.fill(-1),this.q0.init(e),this.q1.init(e),this.prog.numLb>0&&((!this.lbTable||this.lbTable.length<this.prog.numLb+1)&&(this.lbTable=new Int32Array(this.prog.numLb+1)),this.lbTable.fill(-1))}submatches(){return this.ncap===0?$.emptyInts():$.toArray(this.matchcap.subarray(0,this.ncap))}match(e,t,r){const s=this.re2.cond;if(s===$.EMPTY_ALL||(r===M.ANCHOR_START||r===M.ANCHOR_BOTH)&&t!==0)return!1;this.matched=!1,this.matchcap.fill(-1);let i=this.prog.numLb>0?0:t,o=t,B=this.q0,c=this.q1,u=e.step(i),h=u>>3,d=u&7,p=-1,_=0;u!==at.EOF()&&(u=e.step(i+d),p=u>>3,_=u&7);let y;for(i===0?y=$.emptyOpContext(-1,h):y=e.context(i);;){if(B.isEmpty()){if(s&$.EMPTY_BEGIN_TEXT&&i!==0||(r===M.ANCHOR_START||r===M.ANCHOR_BOTH)&&i!==0||this.matched)break;if(this.prog.numLb===0&&this.re2.prefix.length!==0&&p!==this.re2.prefixRune&&e.canCheckPrefix()){const j=e.index(this.re2,i);if(j<0)break;i+=j,u=e.step(i),h=u>>3,d=u&7,u=e.step(i+d),p=u>>3,_=u&7,y=e.context(i)}}if(i===0&&this.prog.numLb>0)for(let j=0;j<this.prog.lbStarts.length;j++)this.add(B,this.prog.lbStarts[j],i,this.matchcap,0,y);!this.matched&&(i===0||r===M.UNANCHORED)&&i>=o&&(this.ncap>0&&(this.matchcap[0]=i),this.add(B,this.prog.start,i,this.matchcap,0,y));const O=i+d;if(y=e.context(O),this.step(B,c,i,O,h,y,r,i===e.endPos()),d===0||this.ncap===0&&this.matched)break;i+=d,h=p,d=_,h!==-1&&(u=e.step(i+d),p=u>>3,_=u&7);const V=B;B=c,c=V}return c.clear(),this.matched}matchSet(e,t,r){const s=this.re2.cond;if(s===$.EMPTY_ALL)return[];if((r===M.ANCHOR_START||r===M.ANCHOR_BOTH)&&t!==0)return[];let i=this.prog.numLb>0?0:t,o=t,B=this.q0,c=this.q1,u=e.step(i),h=u>>3,d=u&7,p=-1,_=0;u!==at.EOF()&&(u=e.step(i+d),p=u>>3,_=u&7);let y=i===0?$.emptyOpContext(-1,h):e.context(i);const O=new Set;for(;!(B.isEmpty()&&(s&$.EMPTY_BEGIN_TEXT&&i!==0||(r===M.ANCHOR_START||r===M.ANCHOR_BOTH)&&i!==0));){if(i===0&&this.prog.numLb>0)for(let ee=0;ee<this.prog.lbStarts.length;ee++)this.add(B,this.prog.lbStarts[ee],i,this.matchcap,0,y);(i===0||r===M.UNANCHORED)&&i>=o&&this.add(B,this.prog.start,i,this.matchcap,0,y);const V=i+d;y=e.context(V);for(let ee=0;ee<B.size;ee++){const se=B.densePcs[ee],Be=this.prog.inst[se],ye=ee*this.ncap;let pe=!1;switch(Be.op){case F.MATCH:if(r===M.ANCHOR_BOTH&&i!==e.endPos())break;O.add(Be.arg);break;case F.RUNE:pe=Be.matchRune(h);break;case F.RUNE1:pe=h===Be.runes[0];break;case F.RUNE_ANY:pe=!0;break;case F.RUNE_ANY_NOT_NL:pe=h!==10;break;default:continue}pe&&this.add(c,Be.out,V,B.denseCaps,ye,y)}if(B.clear(),d===0)break;i+=d,h=p,d=_,h!==-1&&(u=e.step(i+d),p=u>>3,_=u&7);const j=B;B=c,c=j}return c.clear(),Array.from(O).sort((V,j)=>V-j)}step(e,t,r,s,i,o,B,c){const u=this.re2.longest;for(let h=0;h<e.size;h++){const d=e.densePcs[h],p=h*this.ncap;if(u&&this.matched&&this.ncap>0&&this.matchcap[0]<e.denseCaps[p])continue;const _=this.prog.inst[d];let y=!1;switch(_.op){case F.MATCH:if(B===M.ANCHOR_BOTH&&!c)break;if(this.ncap>0&&(!u||!this.matched||this.matchcap[1]<r)){e.denseCaps[p+1]=r;for(let O=0;O<this.ncap;O++)this.matchcap[O]=e.denseCaps[p+O]}u||(e.size=0),this.matched=!0;break;case F.RUNE:y=_.matchRune(i);break;case F.RUNE1:y=i===_.runes[0];break;case F.RUNE_ANY:y=!0;break;case F.RUNE_ANY_NOT_NL:y=i!==10;break;default:continue}y&&this.add(t,_.out,s,e.denseCaps,p,o)}e.clear()}add(e,t,r,s,i,o){for(;;){if(t===0||e.contains(t))return;const B=e.add(t),c=this.prog.inst[t];
1579switch(c.op){case F.FAIL:return;case F.ALT:case F.ALT_MATCH:this.add(e,c.out,r,s,i,o),t=c.arg;continue;case F.EMPTY_WIDTH:if(!(c.arg&~o)){t=c.out;continue}return;case F.NOP:t=c.out;continue;case F.CAPTURE:if(c.arg<this.ncap){const u=s[i+c.arg];s[i+c.arg]=r,this.add(e,c.out,r,s,i,o),s[i+c.arg]=u;return}else{t=c.out;continue}case F.LB_WRITE:this.lbTable[Math.abs(c.arg)]=r,t=c.out;continue;case F.LB_CHECK:if(c.arg>0){if(this.lbTable[c.arg]===r){t=c.out;continue}}else if(this.lbTable[-c.arg]!==r){t=c.out;continue}return;case F.MATCH:case F.RUNE:case F.RUNE1:case F.RUNE_ANY:case F.RUNE_ANY_NOT_NL:if(this.ncap>0){const u=B*this.ncap;for(let h=0;h<this.ncap;h++)e.denseCaps[u+h]=s[i+h]}return;default:throw new si("unhandled")}}}};const Fh=n=>{let e=-2128831035;for(let t=0;t<n.length;t++)e^=n[t],e=Math.imul(e,16777619);return e},Gw=(n,e)=>{if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0};var Uw=class{constructor(n,e,t=[]){this.nfaStates=n,this.isMatch=e,this.matchIDs=t,this.nextLatin1=new Array(z.MAX_LATIN1+1).fill(null),this.nextLatin1Anchored=new Array(z.MAX_LATIN1+1).fill(null),this.transKeys=[],this.transVals=[],this.lastSeen=0}},sn,Hw=(sn=class{constructor(e,t=8388608){this.prog=e,this.stateCache=new Map,this.stateCount=0,this.startState=null,this.stateLimit=Math.max(1,Math.floor(t/sn.STATE_MEMORY_ESTIMATE)),this.cacheClears=0,this.failed=!1,this.clock=0}computeClosure(e){const t=new Set,r=[...e];let s=!1;const i=[];for(;r.length>0;){const B=r.pop();if(t.has(B))continue;t.add(B);const c=this.prog.getInst(B);switch(c.op){case F.MATCH:s=!0,i.includes(c.arg)||i.push(c.arg);break;case F.ALT:case F.ALT_MATCH:r.push(c.out),r.push(c.arg);break;case F.NOP:case F.CAPTURE:r.push(c.out);break;case F.EMPTY_WIDTH:case F.LB_WRITE:case F.LB_CHECK:return null}}const o=Int32Array.from(t).sort();return i.sort((B,c)=>B-c),{pcs:o,isMatch:s,matchIDs:i}}getState(e){const t=this.computeClosure(e);if(!t)return null;const r=t.pcs,s=Fh(r);let i=this.stateCache.get(s);if(i)for(let B=0;B<i.length;B++){const c=i[B];if(Gw(c.nfaStates,r))return c.lastSeen=++this.clock,c}else i=[],this.stateCache.set(s,i);if(this.failed)return null;if(this.stateCount>=this.stateLimit){if(this.cacheClears++,this.cacheClears>=sn.MAX_CACHE_CLEARS)return this.failed=!0,this.stateCache.clear(),this.stateCount=0,this.startState=null,null;this.evictCache(),i=this.stateCache.get(s),i||(i=[],this.stateCache.set(s,i))}const o=new Uw(r,t.isMatch,t.matchIDs);return o.lastSeen=++this.clock,i.push(o),this.stateCount++,o}evictCache(){const e=[];for(const o of this.stateCache.values())for(let B=0;B<o.length;B++)e.push(o[B]);e.sort((o,B)=>o.lastSeen-B.lastSeen);const t=Math.max(1,Math.floor(this.stateLimit/2)),r=e.length-t,s=e.slice(r),i=new Set(s);this.stateCache.clear(),this.stateCount=0;for(let o=0;o<s.length;o++){const B=s[o];B.nextLatin1.fill(null),B.nextLatin1Anchored.fill(null),B.transKeys.length=0,B.transVals.length=0;const c=Fh(B.nfaStates);let u=this.stateCache.get(c);u||(u=[],this.stateCache.set(c,u)),u.push(B),this.stateCount++}this.startState&&!i.has(this.startState)&&(this.startState=null)}step(e,t,r){if(t<=z.MAX_LATIN1)if(r===M.UNANCHORED){const o=e.nextLatin1[t];if(o!==null)return o}else{const o=e.nextLatin1Anchored[t];if(o!==null)return o}else{const o=t+(r===M.UNANCHORED?0:z.MAX_RUNE+1),B=e.transKeys,c=B.length;for(let u=0;u<c;u++)if(B[u]===o)return e.transVals[u]}const s=[];for(let o=0;o<e.nfaStates.length;o++){const B=e.nfaStates[o],c=this.prog.getInst(B);F.isRuneOp(c.op)&&c.matchRune(t)&&s.push(c.out)}r===M.UNANCHORED&&s.push(this.prog.start);const i=this.getState(s);if(t<=z.MAX_LATIN1)r===M.UNANCHORED?e.nextLatin1[t]=i:e.nextLatin1Anchored[t]=i;else{const o=t+(r===M.UNANCHORED?0:z.MAX_RUNE+1);e.transKeys.push(o),e.transVals.push(i)}return i}match(e,t,r){if((r===M.ANCHOR_START||r===M.ANCHOR_BOTH)&&t!==0)return!1;if(!this.startState&&(this.startState=this.getState([this.prog.start]),!this.startState))return null;let s=e.endPos(),i=this.startState;if(i.isMatch)if(r===M.ANCHOR_BOTH){if(t===s)return!0}else return!0;let o=t;for(;o<s;){const B=e.step(o),c=B>>3,u=B&7;if(u===0)break;if(i=r===M.UNANCHORED&&c<=z.MAX_LATIN1&&i.nextLatin1[c]||this.step(i,c,r),i===null)return null;if(i.lastSeen=++this.clock,i.isMatch)if(r===M.ANCHOR_BOTH){if(o+u===s)return!0}else return!0;
1579if(i.nfaStates.length===0&&r!==M.UNANCHORED)return!1;o+=u}return!1}matchSet(e,t,r){if((r===M.ANCHOR_START||r===M.ANCHOR_BOTH)&&t!==0)return[];if(!this.startState&&(this.startState=this.getState([this.prog.start]),!this.startState))return null;let s=e.endPos(),i=this.startState;const o=new Set,B=(u,h)=>{u.isMatch&&(r===M.ANCHOR_BOTH?h===s&&u.matchIDs.forEach(d=>o.add(d)):u.matchIDs.forEach(d=>o.add(d)))};B(i,t);let c=t;for(;c<s;){const u=e.step(c),h=u>>3,d=u&7;if(d===0)break;if(i=r===M.UNANCHORED&&h<=z.MAX_LATIN1&&i.nextLatin1[h]||this.step(i,h,r),i===null)return null;if(i.lastSeen=++this.clock,c+=d,B(i,c),i.nfaStates.length===0&&r!==M.UNANCHORED)break}return Array.from(o).sort((u,h)=>u-h)}},U(sn,"MAX_CACHE_CLEARS",5),U(sn,"STATE_MEMORY_ESTIMATE",838),sn);const qw=32,Jw=500,NB=256,jw=256*1024;var Kw=class{constructor(){this.end=0,this.cap=new Int32Array(0),this.matchcap=new Int32Array(0),this.ncap=0,this.jobPc=new Int32Array(NB),this.jobArg=new Uint8Array(NB),this.jobPos=new Int32Array(NB),this.jobLen=0,this.visited=new Uint32Array(0)}reset(n,e,t){this.end=e,this.jobLen=0,this.ncap=t;const r=n.numInst()*(e+1)+qw-1>>>5;this.visited.length<r?this.visited=new Uint32Array(r):this.visited.fill(0,0,r),this.cap.length<t?this.cap=new Int32Array(t).fill(-1):this.cap.fill(-1,0,t),this.matchcap.length<t?this.matchcap=new Int32Array(t).fill(-1):this.matchcap.fill(-1,0,t)}shouldVisit(n,e){const t=n*(this.end+1)+e,r=t>>>5,s=1<<(t&31);return this.visited[r]&s?!1:(this.visited[r]|=s,!0)}push(n,e,t,r){if(n.prog.getInst(e).op!==F.FAIL&&(r||this.shouldVisit(e,t))){if(this.jobLen>=this.jobPc.length){const s=this.jobPc.length*2,i=new Int32Array(s);i.set(this.jobPc),this.jobPc=i;const o=new Uint8Array(s);o.set(this.jobArg),this.jobArg=o;const B=new Int32Array(s);B.set(this.jobPos),this.jobPos=B}this.jobPc[this.jobLen]=e,this.jobArg[this.jobLen]=r?1:0,this.jobPos[this.jobLen]=t,this.jobLen++}}tryBacktrack(n,e,t,r,s){const i=n.longest;for(this.push(n,t,r,!1);this.jobLen>0;){this.jobLen--;let o=this.jobPc[this.jobLen],B=this.jobArg[this.jobLen]===1,c=this.jobPos[this.jobLen],u=!0;for(;!(!u&&!this.shouldVisit(o,c));){u=!1;const h=n.prog.getInst(o);switch(h.op){case F.FAIL:throw new si("unexpected InstFail");case F.ALT:if(B){B=!1,o=h.arg;continue}else{this.push(n,o,c,!0),o=h.out;continue}case F.ALT_MATCH:{const d=n.prog.getInst(h.out);if(F.isRuneOp(d.op)){this.push(n,h.arg,c,!1),o=h.arg,c=this.end;continue}this.push(n,h.out,this.end,!1),o=h.out;continue}case F.RUNE:{const d=e.step(c);if(d===at.EOF()||!h.matchRune(d>>3))break;c+=d&7,o=h.out;continue}case F.RUNE1:{const d=e.step(c);if(d===at.EOF()||d>>3!==h.runes[0])break;c+=d&7,o=h.out;continue}case F.RUNE_ANY_NOT_NL:{const d=e.step(c);if(d===at.EOF()||d>>3===10)break;c+=d&7,o=h.out;continue}case F.RUNE_ANY:{const d=e.step(c);if(d===at.EOF())break;c+=d&7,o=h.out;continue}case F.CAPTURE:if(B){this.cap[h.arg]=c;break}else{h.arg<this.ncap&&(this.push(n,o,this.cap[h.arg],!0),this.cap[h.arg]=c),o=h.out;continue}case F.EMPTY_WIDTH:{const d=e.context(c);if(h.arg&~d)break;o=h.out;continue}case F.NOP:o=h.out;continue;case F.MATCH:{if(s===M.ANCHOR_BOTH&&c!==this.end)break;if(this.ncap===0)return!0;this.ncap>1&&(this.cap[1]=c);const d=this.matchcap[1];if((d===-1||i&&c>0&&c>d)&&this.matchcap.set(this.cap),!i||c===this.end)return!0;break}case F.LB_WRITE:case F.LB_CHECK:throw new si("Backtracker cannot evaluate Lookbehind instructions");default:throw new si("bad inst")}break}}return i&&this.matchcap.length>1&&this.matchcap[1]>=0}};const go=[];var mo=class TC{static shouldBacktrack(e){return e.numInst()<=Jw}static maxBitStateLen(e){return TC.shouldBacktrack(e)?Math.floor(jw/e.numInst()):0}static execute(e,t,r,s,i){const o=e.cond;if(o===$.EMPTY_ALL||(s===M.ANCHOR_START||s===M.ANCHOR_BOTH)&&r!==0||o&$.EMPTY_BEGIN_TEXT&&r!==0)return null;const B=go.length>0?go.pop():new Kw,c=t.endPos();B.reset(e.prog,c,i);let u=!1;if(o&$.EMPTY_BEGIN_TEXT||s===M.ANCHOR_START||s===M.ANCHOR_BOTH)B.ncap>0&&(B.cap[0]=r),B.tryBacktrack(e,t,e.prog.start,r,s)&&(u=!0);else{let d=-1;for(;r<=c&&d!==0;r+=d){if(e.prefix.length>0){const _=t.index(e,r);if(_<0)break;r+=_}if(B.ncap>0&&(B.cap[0]=r),B.tryBacktrack(e,t,e.prog.start,r,s)){u=!0;break}const p=t.step(r);d=p===at.EOF()?0:p&7}}if(!u)return go.push(B),null;const h=i===0?[]:$.toArray(B.matchcap.subarray(0,i));return go.push(B),h}},Lh=class{constructor(n){this.sparse=new Uint32Array(n),this.dense=new Uint32Array(n),this.size=0,this.nextIndex=0}empty(){return this.nextIndex>=this.size}next(){return this.dense[this.nextIndex++]}clear(){this.size=0,this.nextIndex=0}contains(n){return n<this.sparse.length&&this.sparse[n]<this.size&&this.dense[this.sparse[n]]===n}insert(n){this.contains(n)||this.insertNew(n)}insertNew(n){n>=this.sparse.length||(this.sparse[n]=this.size,this.dense[this.size]=n,this.size++)}};const zw=(n,e,t,r)=>{const s=n.length,i=e.length;let o=0,B=0;const c=[],u=[];let h=!0,d=-1;const p=_=>{const y=_?n:e,O=_?o:B,V=_?t:r;return d>0&&y[O]<=c[d]?!1:(c.push(y[O],y[O+1]),_?o+=2:B+=2,d+=2,u.push(V),!0)};for(;o<s||B<i;)if(B>=i?h=p(!0):o>=s||e[B]<n[o]?h=p(!1):h=p(!0),!h)return null;return{merged:c,next:u}};var Ww=class{constructor(n){this.start=n.start,this.numCap=n.numCap,this.inst=new Array(n.inst.length);for(let e=0;e<n.inst.length;e++){const t=n.inst[e],r=new F(t.op);r.out=t.out,r.arg=t.arg,r.runes=t.runes?t.runes.slice():[],r.next=null,this.inst[e]=r}}};const $w=n=>{const e=new Ww(n);for(let t=0;t<e.inst.length;t++){const r=e.inst[t];if(r.op!==F.ALT&&r.op!==F.ALT_MATCH)continue;let s="out",i="arg",o=e.inst[r[i]];if(o.op!==F.ALT&&o.op!==F.ALT_MATCH&&(s="arg",i="out",o=e.inst[r[i]],o.op!==F.ALT&&o.op!==F.ALT_MATCH))continue;const B=e.inst[r[s]];if(B.op===F.ALT||B.op===F.ALT_MATCH)continue;let c="out",u="arg",h=!1;o.out===t?h=!0:o.arg===t&&(h=!0,c="arg",u="out"),h&&(o[c]=r[s]),r[s]===o[c]&&(r[i]=o[u])}return e},Qw=n=>{if(n.inst.length>=1e3)return null;const e=new Lh(n.inst.length),t=new Lh(n.inst.length),r=new Array(n.inst.length),s=new Array(n.inst.length).fill(!1),i=o=>{let B=!0;const c=n.inst[o];if(t.contains(o))return!0;switch(t.insert(o),c.op){case F.ALT:case F.ALT_MATCH:{B=i(c.out)&&i(c.arg);let u=s[c.out],h=s[c.arg];if(u&&h)return!1;if(h){const y=c.out;c.out=c.arg,c.arg=y;const O=u;u=h,h=O}u&&(s[o]=!0,c.op=F.ALT_MATCH);const d=r[c.out]||[],p=r[c.arg]||[],_=zw(d,p,c.out,c.arg);if(!_)return!1;r[o]=_.merged,c.next=new Uint32Array(_.next);break}case F.CAPTURE:case F.EMPTY_WIDTH:case F.NOP:B=i(c.out),s[o]=s[c.out],r[o]=r[c.out]?r[c.out].slice():[],c.next=new Uint32Array(Math.floor(r[o].length/2)+1).fill(c.out);break;case F.MATCH:case F.FAIL:s[o]=c.op===F.MATCH;break;case F.RUNE:{if(s[o]=!1,c.next&&c.next.length>0)break;if(e.insert(c.out),!c.runes||c.runes.length===0){r[o]=[],c.next=new Uint32Array([c.out]);break}let u=[];
vendor: 4,835 bytes, line 1579
1579if(c.runes.length===1&&c.arg&M.FOLD_CASE){const h=c.runes[0];u.push(h,h);for(let d=z.simpleFold(h);d!==h;d=z.simpleFold(d))u.push(d,d);u.sort((d,p)=>d-p)}else for(let h=0;h<c.runes.length;h++)u.push(c.runes[h]);r[o]=u,c.next=new Uint32Array(Math.floor(u.length/2)+1).fill(c.out),c.op=F.RUNE;break}case F.RUNE1:{if(s[o]=!1,c.next&&c.next.length>0)break;e.insert(c.out);let u=[];if(c.arg&M.FOLD_CASE){const h=c.runes[0];u.push(h,h);for(let d=z.simpleFold(h);d!==h;d=z.simpleFold(d))u.push(d,d);u.sort((d,p)=>d-p)}else u.push(c.runes[0],c.runes[0]);r[o]=u,c.next=new Uint32Array(Math.floor(u.length/2)+1).fill(c.out),c.op=F.RUNE;break}case F.RUNE_ANY:if(s[o]=!1,c.next&&c.next.length>0)break;e.insert(c.out),r[o]=[0,z.MAX_RUNE],c.next=new Uint32Array([c.out]);break;case F.RUNE_ANY_NOT_NL:if(s[o]=!1,c.next&&c.next.length>0)break;e.insert(c.out),r[o]=[0,9,11,z.MAX_RUNE],c.next=new Uint32Array(Math.floor(r[o].length/2)+1).fill(c.out);break}return B};for(e.clear(),e.insert(n.start);!e.empty();)if(t.clear(),!i(e.next()))return null;for(let o=0;o<n.inst.length;o++)r[o]&&(n.inst[o].runes=r[o]);return n},Yw=(n,e)=>{for(let t=0;t<e.inst.length;t++){const r=e.inst[t];switch(r.op){case F.ALT:case F.ALT_MATCH:case F.RUNE:break;case F.CAPTURE:case F.EMPTY_WIDTH:case F.NOP:case F.MATCH:case F.FAIL:n.inst[t].next=null;break;case F.RUNE1:case F.RUNE_ANY:case F.RUNE_ANY_NOT_NL:n.inst[t].next=null,n.inst[t].op=r.op,n.inst[t].runes=r.runes?r.runes.slice():[];break}}};var kh=class AC{static compile(e){if(e.start===0||e.numLb>0)return null;const t=e.inst[e.start];if(t.op!==F.EMPTY_WIDTH||!(t.arg&$.EMPTY_BEGIN_TEXT))return null;let r=!1;for(let i=0;i<e.inst.length;i++)if(e.inst[i].op===F.ALT||e.inst[i].op===F.ALT_MATCH){r=!0;break}for(let i=0;i<e.inst.length;i++){const o=e.inst[i],B=e.inst[o.out].op;switch(o.op){case F.ALT:case F.ALT_MATCH:if(B===F.MATCH||e.inst[o.arg].op===F.MATCH)return null;break;case F.EMPTY_WIDTH:if(B===F.MATCH){if((o.arg&$.EMPTY_END_TEXT)===$.EMPTY_END_TEXT)continue;return null}break;default:if(B===F.MATCH&&r)return null;break}}let s=$w(e);return s=Qw(s),s!==null&&Yw(s,e),s}static next(e,t){const r=e.matchRunePos(t);return r>=0?e.next[r]:e.op===F.ALT_MATCH?e.out:0}static execute(e,t,r,s,i){const o=e.onepass;if(!o)return null;const B=new Int32Array(i).fill(-1);let c=!1,u=t.step(r),h=u>>3,d=u&7,p=at.EOF(),_=-1,y=0;u!==at.EOF()&&(p=t.step(r+d),p!==at.EOF()&&(_=p>>3,y=p&7));let O=r===0?$.emptyOpContext(-1,h):t.context(r),V=o.start,j;for(;;){switch(j=o.inst[V],V=j.out,j.op){case F.MATCH:return s===M.ANCHOR_BOTH&&r!==t.endPos()?null:(c=!0,B.length>0&&(B[0]=0,B[1]=r),i===0?[]:$.toArray(B));case F.RUNE:if(!j.matchRune(h))return null;break;case F.RUNE1:if(h!==j.runes[0])return null;break;case F.RUNE_ANY:break;case F.RUNE_ANY_NOT_NL:if(h===10)return null;break;case F.ALT:case F.ALT_MATCH:V=AC.next(j,h);continue;case F.FAIL:return null;case F.NOP:continue;case F.EMPTY_WIDTH:if(j.arg&~O)return null;continue;case F.CAPTURE:j.arg<B.length&&(B[j.arg]=r);continue;default:throw new si("bad inst")}if(d===0)break;O=$.emptyOpContext(h,_),r+=d,h=_,d=y,h!==-1&&(p=t.step(r+d),p!==at.EOF()?(_=p>>3,y=p&7):(_=-1,y=0))}return c?i===0?[]:$.toArray(B):null}},Y,T=(Y=class{static isPseudoOp(e){return e>=Y.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(e){return e===N.CODES.get("-")?"\\":""}static fromRegexp(e){const t=new Y(e.op);return t.flags=e.flags,t.subs=e.subs,t.runes=e.runes,t.cap=e.cap,t.min=e.min,t.max=e.max,t.name=e.name,t.namedGroups=e.namedGroups,t.lb=e.lb,t}constructor(e){this.op=e,this.flags=0,this.subs=Y.emptySubs(),this.runes=[],this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups=Object.create(null),this.lb=0}reinit(){this.flags=0,this.subs=Y.emptySubs(),this.runes=[],this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups=Object.create(null),this.lb=0}toString(){return this.appendTo()}appendTo(){let e="";switch(this.op){case Y.Op.NO_MATCH:e+="[^\\x00-\\x{10FFFF}]";break;case Y.Op.EMPTY_MATCH:e+="(?:)";break;case Y.Op.STAR:case Y.Op.PLUS:case Y.Op.QUEST:case Y.Op.REPEAT:{const t=this.subs[0];switch(t.op>Y.Op.CAPTURE||t.op===Y.Op.LITERAL&&t.runes.length>1?e+=`(?:${t.appendTo()})`:e+=t.appendTo(),this.op){case Y.Op.STAR:e+="*";break;case Y.Op.PLUS:e+="+";break;case Y.Op.QUEST:e+="?";break;case Y.Op.REPEAT:e+=`{${this.min}`,this.min!==this.max&&(e+=",",this.max>=0&&(e+=this.max)),e+="}";break}this.flags&M.NON_GREEDY&&(e+="?");break}case Y.Op.CONCAT:for(let t of this.subs)t.op===Y.Op.ALTERNATE?e+=`(?:${t.appendTo()})`:e+=t.appendTo();break;case Y.Op.ALTERNATE:{let t="";for(let r of this.subs)e+=t,t="|",e+=r.appendTo();break}case Y.Op.LITERAL:this.flags&M.FOLD_CASE&&(e+="(?i:");for(let t of this.runes)e+=$.escapeRune(t);this.flags&M.FOLD_CASE&&(e+=")");break;case Y.Op.ANY_CHAR_NOT_NL:e+="(?-s:.)";break;case Y.Op.ANY_CHAR:e+="(?s:.)";break;
1579case Y.Op.PLB:e+=`(?<=${this.subs[0].appendTo()})`;break;case Y.Op.NLB:e+=`(?<!${this.subs[0].appendTo()})`;break;case Y.Op.CAPTURE:this.name===null||this.name.length===0?e+="(":e+=`(?P<${this.name}>`,this.subs[0].op!==Y.Op.EMPTY_MATCH&&(e+=this.subs[0].appendTo()),e+=")";break;case Y.Op.BEGIN_TEXT:e+="\\A";break;case Y.Op.END_TEXT:this.flags&M.WAS_DOLLAR?e+="(?-m:$)":e+="\\z";break;case Y.Op.BEGIN_LINE:e+="^";break;case Y.Op.END_LINE:e+="$";break;case Y.Op.WORD_BOUNDARY:e+="\\b";break;case Y.Op.NO_WORD_BOUNDARY:e+="\\B";break;case Y.Op.CHAR_CLASS:if(this.runes.length%2!==0){e+="[invalid char class]";break}if(e+="[",this.runes.length===0)e+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===z.MAX_RUNE){e+="^";for(let t=1;t<this.runes.length-1;t+=2){const r=this.runes[t]+1,s=this.runes[t+1]-1;e+=Y.quoteIfHyphen(r),e+=$.escapeRune(r),r!==s&&(e+="-",e+=Y.quoteIfHyphen(s),e+=$.escapeRune(s))}}else for(let t=0;t<this.runes.length;t+=2){const r=this.runes[t],s=this.runes[t+1];e+=Y.quoteIfHyphen(r),e+=$.escapeRune(r),r!==s&&(e+="-",e+=Y.quoteIfHyphen(s),e+=$.escapeRune(s))}e+="]";break;default:e+=this.op;break}return e}maxCap(){let e=0;if(this.op===Y.Op.CAPTURE&&(e=this.cap),this.subs!==null)for(let t of this.subs){const r=t.maxCap();e<r&&(e=r)}return e}equals(e){if(!(e!==null&&e instanceof Y)||this.op!==e.op)return!1;switch(this.op){case Y.Op.END_TEXT:if((this.flags&M.WAS_DOLLAR)!==(e.flags&M.WAS_DOLLAR))return!1;break;case Y.Op.LITERAL:case Y.Op.CHAR_CLASS:if(this.runes===null&&e.runes===null)break;if(this.runes===null||e.runes===null||this.runes.length!==e.runes.length)return!1;for(let t=0;t<this.runes.length;t++)if(this.runes[t]!==e.runes[t])return!1;break;case Y.Op.ALTERNATE:case Y.Op.CONCAT:if(this.subs.length!==e.subs.length)return!1;for(let t=0;t<this.subs.length;++t)if(!this.subs[t].equals(e.subs[t]))return!1;break;case Y.Op.STAR:case Y.Op.PLUS:case Y.Op.QUEST:if((this.flags&M.NON_GREEDY)!==(e.flags&M.NON_GREEDY)||!this.subs[0].equals(e.subs[0]))return!1;break;case Y.Op.REPEAT:if((this.flags&M.NON_GREEDY)!==(e.flags&M.NON_GREEDY)||this.min!==e.min||this.max!==e.max||!this.subs[0].equals(e.subs[0]))return!1;break;case Y.Op.CAPTURE:if(this.cap!==e.cap||(this.name===null?e.name!==null:this.name!==e.name)||!this.subs[0].equals(e.subs[0]))return!1;break;case Y.Op.PLB:case Y.Op.NLB:if(this.lb!==e.lb||!this.subs[0].equals(e.subs[0]))return!1;break}return!0}},U(Y,"Op",IC(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","PLB","NLB","LEFT_PAREN","VERTICAL_BAR"])),Y),Vh=class{constructor(n){this.next=[Object.create(null)],this.fail=[0],this.match=[!1];for(const t of n){let r=0;for(let s=0;s<t.length;s++){const i=t[s];i in this.next[r]||(this.next.push(Object.create(null)),this.fail.push(0),this.match.push(!1),this.next[r][i]=this.next.length-1),r=this.next[r][i]}this.match[r]=!0}const e=[];for(const t in this.next[0])if(Object.prototype.hasOwnProperty.call(this.next[0],t)){const r=this.next[0][t];this.fail[r]=0,e.push(r)}for(;e.length>0;){const t=e.shift();for(const r in this.next[t])if(Object.prototype.hasOwnProperty.call(this.next[t],r)){const s=this.next[t][r];let i=this.fail[t];for(;i!==0&&!(r in this.next[i]);)i=this.fail[i];r in this.next[i]?this.fail[s]=this.next[i][r]:this.fail[s]=0,this.match[s]=this.match[s]||this.match[this.fail[s]],e.push(s)}}}searchUTF16(n,e,t){let r=0;for(let s=e;s<t;s++){const i=n.charCodeAt(s);for(;r!==0&&!(i in this.next[r]);)r=this.fail[r];if(i in this.next[r]&&(r=this.next[r][i]),this.match[r])return!0}return!1}searchUTF8(n,e,t){let r=0;for(let s=e;s<t;s++){const i=n[s];for(;r!==0&&!(i in this.next[r]);)r=this.fail[r];if(i in this.next[r]&&(r=this.next[r][i]),this.match[r])return!0}return!1}},Wt,de=(Wt=class{constructor(e){this.type=e,this.subs=[],this.str="",this.bytes=null,this.ac16=null,this.ac8=null}eval(e,t){switch(this.type){case Wt.Type.NONE:return!0;case Wt.Type.EXACT:return e.hasString(this,t);case Wt.Type.AND:for(let r=0;r<this.subs.length;r++)if(!this.subs[r].eval(e,t))return!1;return!0;case Wt.Type.OR:if(this.ac16&&this.ac8)return e.hasAnyString(this,t);for(let r=0;r<this.subs.length;r++)if(this.subs[r].eval(e,t))return!0;return!1;default:return!0}}},U(Wt,"Type",{NONE:0,EXACT:1,AND:2,OR:3}),Wt),Xw=class nn{static build(e){const t=nn.fromRegexp(e);return nn.simplify(t)}
vendor: 5,730 bytes, lines 1579-1584
1579static fromRegexp(e){if(!e)return new de(de.Type.NONE);switch(e.op){case T.Op.PLB:case T.Op.NLB:case T.Op.NO_MATCH:case T.Op.EMPTY_MATCH:case T.Op.BEGIN_LINE:case T.Op.END_LINE:case T.Op.BEGIN_TEXT:case T.Op.END_TEXT:case T.Op.WORD_BOUNDARY:case T.Op.NO_WORD_BOUNDARY:case T.Op.CHAR_CLASS:case T.Op.ANY_CHAR_NOT_NL:case T.Op.ANY_CHAR:return new de(de.Type.NONE);case T.Op.LITERAL:{if(e.runes.length===0||e.flags&M.FOLD_CASE)return new de(de.Type.NONE);const t=new de(de.Type.EXACT);let r="";for(let s=0;s<e.runes.length;s++)r+=String.fromCodePoint(e.runes[s]);return t.str=r,t.bytes=$.stringToUtf8ByteArray(t.str),t}case T.Op.CAPTURE:case T.Op.PLUS:return nn.fromRegexp(e.subs[0]);case T.Op.REPEAT:return e.min>=1?nn.fromRegexp(e.subs[0]):new de(de.Type.NONE);case T.Op.CONCAT:{const t=new de(de.Type.AND);for(const r of e.subs)t.subs.push(nn.fromRegexp(r));return t}case T.Op.ALTERNATE:{const t=new de(de.Type.OR);for(const r of e.subs)t.subs.push(nn.fromRegexp(r));return t}default:return new de(de.Type.NONE)}}static simplify(e){if(e.type===de.Type.EXACT||e.type===de.Type.NONE)return e;if(e.type===de.Type.AND){const t=[];for(const r of e.subs){const s=nn.simplify(r);if(s.type!==de.Type.NONE)if(s.type===de.Type.AND)for(let i=0;i<s.subs.length;i++)t.push(s.subs[i]);else t.push(s)}return t.length===0?new de(de.Type.NONE):t.length===1?t[0]:(e.subs=t,e)}if(e.type===de.Type.OR){const t=[];for(const o of e.subs){const B=nn.simplify(o);if(B.type===de.Type.NONE)return new de(de.Type.NONE);if(B.type===de.Type.OR)for(let c=0;c<B.subs.length;c++)t.push(B.subs[c]);else t.push(B)}if(t.length===0)return new de(de.Type.NONE);if(t.length===1)return t[0];const r=new Set,s=[];for(const o of t)o.type===de.Type.EXACT?r.has(o.str)||(r.add(o.str),s.push(o)):s.push(o);e.subs=s;let i=!0;for(const o of s)if(o.type!==de.Type.EXACT){i=!1;break}return i&&s.length>1&&(e.ac16=new Vh(s.map(o=>{const B=[];for(let c=0;c<o.str.length;c++)B.push(o.str.charCodeAt(c));return B})),e.ac8=new Vh(s.map(o=>o.bytes))),e}return e}},bt=class{constructor(n=0,e=0){this.head=n,this.tail=e}},Zw=class{constructor(){this.inst=[],this.start=0,this.numCap=2,this.lbStarts=[],this.numLb=0}getInst(n){return this.inst[n]}numInst(){return this.inst.length}addInst(n){this.inst.push(new F(n))}skipNop(n){let e=this.inst[n];for(;e.op===F.NOP||e.op===F.CAPTURE;)e=this.inst[n],n=e.out;return e}prefix(){let n="",e=this.skipNop(this.start);if(!F.isRuneOp(e.op)||e.runes.length!==1)return[e.op===F.MATCH,n];for(;F.isRuneOp(e.op)&&e.runes.length===1&&!(e.arg&M.FOLD_CASE);)n+=String.fromCodePoint(e.runes[0]),e=this.skipNop(e.out);return[e.op===F.MATCH,n]}startCond(){let n=0,e=this.start;e:for(;;){const t=this.inst[e];switch(t.op){case F.EMPTY_WIDTH:n|=t.arg;break;case F.FAIL:return-1;case F.CAPTURE:case F.NOP:break;default:break e}e=t.out}return n}patch(n,e){let t=n.head;for(;t!==0;){const r=this.inst[t>>1];t&1?(t=r.arg,r.arg=e):(t=r.out,r.out=e)}}append(n,e){if(n.head===0)return e;if(e.head===0)return n;const t=this.inst[n.tail>>1];return n.tail&1?t.arg=e.head:t.out=e.head,new bt(n.head,e.tail)}toString(){let n="";for(let e=0;e<this.inst.length;e++){const t=n.length;n+=e,e===this.start&&(n+="*"),n+="        ".substring(n.length-t),n+=this.inst[e],n+=`
1580`}return n}},Eo=class{constructor(n=0,e=new bt,t=!1){this.i=n,this.out=e,this.nullable=t}},ey=class Wr{static ANY_RUNE_NOT_NL(){return[0,N.CODES.get(`
1581`)-1,N.CODES.get(`
1582`)+1,z.MAX_RUNE]}static ANY_RUNE(){return[0,z.MAX_RUNE]}static compileRegexp(e){const t=new Wr,r=t.compile(e);return t.prog.patch(r.out,t.newInst(F.MATCH).i),t.prog.start=r.i,t.prog}static compileSet(e){const t=new Wr;if(e.length===0)return t.prog.start=t.newInst(F.FAIL).i,t.prog;let r=[];for(let i=0;i<e.length;i++){const o=t.compile(e[i]),B=t.newInst(F.MATCH);t.prog.getInst(B.i).arg=i,t.prog.patch(o.out,B.i),r.push(o.i)}let s=r[0];for(let i=1;i<r.length;i++){const o=t.newInst(F.ALT),B=t.prog.getInst(o.i);B.out=s,B.arg=r[i],s=o.i}return t.prog.start=s,t.prog}constructor(){this.prog=new Zw,this.newInst(F.FAIL)}newInst(e){return this.prog.addInst(e),new Eo(this.prog.numInst()-1,new bt,!0)}nop(){const e=this.newInst(F.NOP);return e.out=new bt(e.i<<1,e.i<<1),e}fail(){return new Eo}cap(e){const t=this.newInst(F.CAPTURE);return t.out=new bt(t.i<<1,t.i<<1),this.prog.getInst(t.i).arg=e,this.prog.numCap<e+1&&(this.prog.numCap=e+1),t}cat(e,t){return e.i===0||t.i===0?this.fail():(this.prog.patch(e.out,t.i),new Eo(e.i,t.out,e.nullable&&t.nullable))}alt(e,t){if(e.i===0)return t;if(t.i===0)return e;const r=this.newInst(F.ALT),s=this.prog.getInst(r.i);return s.out=e.i,s.arg=t.i,r.out=this.prog.append(e.out,t.out),r.nullable=e.nullable||t.nullable,r}loop(e,t){const r=this.newInst(F.ALT),s=this.prog.getInst(r.i);return t?(s.arg=e.i,r.out=new bt(r.i<<1,r.i<<1)):(s.out=e.i,r.out=new bt(r.i<<1|1,r.i<<1|1)),this.prog.patch(e.out,r.i),r}quest(e,t){const r=this.newInst(F.ALT),s=this.prog.getInst(r.i);return t?(s.arg=e.i,r.out=new bt(r.i<<1,r.i<<1)):(s.out=e.i,r.out=new bt(r.i<<1|1,r.i<<1|1)),r.out=this.prog.append(r.out,e.out),r}star(e,t){return e.nullable?this.quest(this.plus(e,t),t):this.loop(e,t)}plus(e,t){return new Eo(e.i,this.loop(e,t).out,e.nullable)}empty(e){const t=this.newInst(F.EMPTY_WIDTH);return this.prog.getInst(t.i).arg=e,t.out=new bt(t.i<<1,t.i<<1),t}rune(e,t){const r=this.newInst(F.RUNE);r.nullable=!1;const s=this.prog.getInst(r.i);return s.runes=e,t&=M.FOLD_CASE,(e.length!==1||z.simpleFold(e[0])===e[0])&&(t&=-2),s.arg=t,r.out=new bt(r.i<<1,r.i<<1),!(t&M.FOLD_CASE)&&e.length===1||e.length===2&&e[0]===e[1]?s.op=F.RUNE1:e.length===2&&e[0]===0&&e[1]===z.MAX_RUNE?s.op=F.RUNE_ANY:e.length===4&&e[0]===0&&e[1]===N.CODES.get(`
1583`)-1&&e[2]===N.CODES.get(`
1584`)+1&&e[3]===z.MAX_RUNE&&(s.op=F.RUNE_ANY_NOT_NL),r}
1584lookBehind(e,t){const r=this.newInst(F.LB_WRITE);this.prog.getInst(r.i).arg=t;const s=this.rune(Wr.ANY_RUNE(),0),i=this.star(s,!0),o=this.cat(i,e);this.prog.patch(o.out,r.i);const B=this.newInst(F.LB_CHECK);return this.prog.getInst(B.i).arg=t,this.prog.lbStarts.push(o.i),Math.abs(t)>this.prog.numLb&&(this.prog.numLb=Math.abs(t)),B.out=new bt(B.i<<1,B.i<<1),B}compile(e){switch(e.op){case T.Op.NO_MATCH:return this.fail();case T.Op.EMPTY_MATCH:return this.nop();case T.Op.LITERAL:if(e.runes.length===0)return this.nop();{let t=null;for(let r of e.runes){const s=this.rune([r],e.flags);t=t===null?s:this.cat(t,s)}return t}case T.Op.CHAR_CLASS:return this.rune(e.runes,e.flags);case T.Op.ANY_CHAR_NOT_NL:return this.rune(Wr.ANY_RUNE_NOT_NL(),0);case T.Op.ANY_CHAR:return this.rune(Wr.ANY_RUNE(),0);case T.Op.BEGIN_LINE:return this.empty($.EMPTY_BEGIN_LINE);case T.Op.END_LINE:return this.empty($.EMPTY_END_LINE);case T.Op.BEGIN_TEXT:return this.empty($.EMPTY_BEGIN_TEXT);case T.Op.END_TEXT:return this.empty($.EMPTY_END_TEXT);case T.Op.WORD_BOUNDARY:return this.empty($.EMPTY_WORD_BOUNDARY);case T.Op.NO_WORD_BOUNDARY:return this.empty($.EMPTY_NO_WORD_BOUNDARY);case T.Op.PLB:case T.Op.NLB:return this.lookBehind(this.compile(e.subs[0]),e.lb);case T.Op.CAPTURE:{const t=this.cap(e.cap<<1),r=this.compile(e.subs[0]),s=this.cap(e.cap<<1|1);return this.cat(this.cat(t,r),s)}case T.Op.STAR:return this.star(this.compile(e.subs[0]),(e.flags&M.NON_GREEDY)!==0);case T.Op.PLUS:return this.plus(this.compile(e.subs[0]),(e.flags&M.NON_GREEDY)!==0);case T.Op.QUEST:return this.quest(this.compile(e.subs[0]),(e.flags&M.NON_GREEDY)!==0);case T.Op.CONCAT:if(e.subs.length===0)return this.nop();{let t=null;for(let r of e.subs){const s=this.compile(r);t=t===null?s:this.cat(t,s)}return t}case T.Op.ALTERNATE:if(e.subs.length===0)return this.nop();{let t=null;for(let r of e.subs){const s=this.compile(r);t=t===null?s:this.alt(t,s)}return t}default:throw new Vw("regexp: unhandled case in compile")}}},ty=class Dt{static simplify(e){if(e===null)return null;switch(e.op){case T.Op.PLB:case T.Op.NLB:case T.Op.CAPTURE:{const t=Dt.simplify(e.subs[0]);if(t!==e.subs[0]){const r=T.fromRegexp(e);return r.runes=[],r.subs=[t],r}return e}case T.Op.CONCAT:case T.Op.ALTERNATE:{const t=[];let r=!1;for(let s=0;s<e.subs.length;s++){const i=e.subs[s],o=Dt.simplify(i);if(o!==i&&(r=!0),e.op===T.Op.CONCAT){if(o.op===T.Op.NO_MATCH)return new T(T.Op.NO_MATCH);if(o.op===T.Op.EMPTY_MATCH){r=!0;continue}if(o.op===T.Op.CONCAT){r=!0;for(let B=0;B<o.subs.length;B++)t.push(o.subs[B]);continue}}else if(e.op===T.Op.ALTERNATE){if(o.op===T.Op.NO_MATCH){r=!0;continue}if(o.op===T.Op.ALTERNATE){r=!0;for(let B=0;B<o.subs.length;B++)t.push(o.subs[B]);continue}}t.push(o)}if(r){if(t.length===0)return new T(e.op===T.Op.CONCAT?T.Op.EMPTY_MATCH:T.Op.NO_MATCH);if(t.length===1)return t[0];const s=T.fromRegexp(e);return s.runes=[],s.subs=t,s}return e}case T.Op.CHAR_CLASS:return e.runes===null?e:e.runes.length===0?new T(T.Op.NO_MATCH):e.runes.length===2&&e.runes[0]===0&&e.runes[1]===z.MAX_RUNE?new T(T.Op.ANY_CHAR):e.runes.length===4&&e.runes[0]===0&&e.runes[1]===N.CODES.get(`
1585`)-1&&e.runes[2]===N.CODES.get(`
1586`)+1&&e.runes[3]===z.MAX_RUNE?new T(T.Op.ANY_CHAR_NOT_NL):e;case T.Op.STAR:case T.Op.PLUS:case T.Op.QUEST:{const t=Dt.simplify(e.subs[0]);return Dt.simplify1(e.op,e.flags,t,e)}case T.Op.REPEAT:{if(e.min===0&&e.max===0)return new T(T.Op.EMPTY_MATCH);const t=Dt.simplify(e.subs[0]);if(e.max===-1){if(e.min===0)return Dt.simplify1(T.Op.STAR,e.flags,t,null);if(e.min===1)return Dt.simplify1(T.Op.PLUS,e.flags,t,null);const s=new T(T.Op.CONCAT),i=[];for(let o=0;o<e.min-1;o++)i.push(t);return i.push(Dt.simplify1(T.Op.PLUS,e.flags,t,null)),s.subs=i.slice(0),Dt.simplify(s)}if(e.min===1&&e.max===1)return t;let r=null;if(e.min>0){r=[];for(let s=0;s<e.min;s++)r.push(t)}if(e.max>e.min){let s=Dt.simplify1(T.Op.QUEST,e.flags,t,null);for(let i=e.min+1;i<e.max;i++){const o=new T(T.Op.CONCAT);o.subs=[t,s],s=Dt.simplify1(T.Op.QUEST,e.flags,o,null)}if(r===null)return s;r.push(s)}if(r!==null){const s=new T(T.Op.CONCAT);return s.subs=r.slice(0),Dt.simplify(s)}return new T(T.Op.NO_MATCH)}}return e}static simplify1(e,t,r,s){if(r.op===T.Op.EMPTY_MATCH)return r;if(r.op===T.Op.NO_MATCH)return e===T.Op.PLUS?r:new T(T.Op.EMPTY_MATCH);if(e===r.op&&(t&M.NON_GREEDY)===(r.flags&M.NON_GREEDY))return r;if(s!==null&&s.op===e&&(s.flags&M.NON_GREEDY)===(t&M.NON_GREEDY)&&r===s.subs[
vendor: 5,121 bytes, line 1586
15860])return s;const i=new T(e);return i.flags=t,i.subs=[r],i}},he=class{constructor(n,e){this.sign=n,this.cls=e}};const xh=[48,57],Mh=[9,10,12,13,32,32],Gh=[48,57,65,90,95,95,97,122],Uh=new Map([["\\d",new he(1,xh)],["\\D",new he(-1,xh)],["\\s",new he(1,Mh)],["\\S",new he(-1,Mh)],["\\w",new he(1,Gh)],["\\W",new he(-1,Gh)]]),Hh=[48,57,65,90,97,122],qh=[65,90,97,122],Jh=[0,127],jh=[9,9,32,32],Kh=[0,31,127,127],zh=[48,57],Wh=[33,126],$h=[97,122],Qh=[32,126],Yh=[33,47,58,64,91,96,123,126],Xh=[9,13,32,32],Zh=[65,90],ef=[48,57,65,90,95,95,97,122],tf=[48,57,65,70,97,102],nf=new Map([["[:alnum:]",new he(1,Hh)],["[:^alnum:]",new he(-1,Hh)],["[:alpha:]",new he(1,qh)],["[:^alpha:]",new he(-1,qh)],["[:ascii:]",new he(1,Jh)],["[:^ascii:]",new he(-1,Jh)],["[:blank:]",new he(1,jh)],["[:^blank:]",new he(-1,jh)],["[:cntrl:]",new he(1,Kh)],["[:^cntrl:]",new he(-1,Kh)],["[:digit:]",new he(1,zh)],["[:^digit:]",new he(-1,zh)],["[:graph:]",new he(1,Wh)],["[:^graph:]",new he(-1,Wh)],["[:lower:]",new he(1,$h)],["[:^lower:]",new he(-1,$h)],["[:print:]",new he(1,Qh)],["[:^print:]",new he(-1,Qh)],["[:punct:]",new he(1,Yh)],["[:^punct:]",new he(-1,Yh)],["[:space:]",new he(1,Xh)],["[:^space:]",new he(-1,Xh)],["[:upper:]",new he(1,Zh)],["[:^upper:]",new he(-1,Zh)],["[:word:]",new he(1,ef)],["[:^word:]",new he(-1,ef)],["[:xdigit:]",new he(1,tf)],["[:^xdigit:]",new he(-1,tf)]]);var Pn=class Nn{static charClassToString(e,t){let r="[";for(let s=0;s<t;s+=2){s>0&&(r+=" ");const i=e[s],o=e[s+1];i===o?r+=`0x${i.toString(16)}`:r+=`0x${i.toString(16)}-0x${o.toString(16)}`}return r+="]",r}static cmp(e,t,r,s){const i=e[t]-r;return i!==0?i:s-e[t+1]}static qsortIntPair(e,t,r){const s=((t+r)/2|0)&-2,i=e[s],o=e[s+1];let B=t,c=r;for(;B<=c;){for(;B<r&&Nn.cmp(e,B,i,o)<0;)B+=2;for(;c>t&&Nn.cmp(e,c,i,o)>0;)c-=2;if(B<=c){if(B!==c){let u=e[B];e[B]=e[c],e[c]=u,u=e[B+1],e[B+1]=e[c+1],e[c+1]=u}B+=2,c-=2}}t<c&&Nn.qsortIntPair(e,t,c),B<r&&Nn.qsortIntPair(e,B,r)}constructor(e=$.emptyInts()){this.r=e,this.len=e.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;Nn.qsortIntPair(this.r,0,this.len-2);let e=2;for(let t=2;t<this.len;t+=2){const r=this.r[t],s=this.r[t+1];if(r<=this.r[e-1]+1){s>this.r[e-1]&&(this.r[e-1]=s);continue}this.r[e]=r,this.r[e+1]=s,e+=2}return this.len=e,this}appendLiteral(e,t){return t&M.FOLD_CASE?this.appendFoldedRange(e,e):this.appendRange(e,e)}appendRange(e,t){if(this.len>0){for(let r=2;r<=4;r+=2)if(this.len>=r){const s=this.r[this.len-r],i=this.r[this.len-r+1];if(e<=i+1&&s<=t+1)return e<s&&(this.r[this.len-r]=e),t>i&&(this.r[this.len-r+1]=t),this}}return this.r[this.len++]=e,this.r[this.len++]=t,this}appendFoldedRange(e,t){if(e<=z.MIN_FOLD&&t>=z.MAX_FOLD)return this.appendRange(e,t);if(t<z.MIN_FOLD||e>z.MAX_FOLD)return this.appendRange(e,t);e<z.MIN_FOLD&&(this.appendRange(e,z.MIN_FOLD-1),e=z.MIN_FOLD),t>z.MAX_FOLD&&(this.appendRange(z.MAX_FOLD+1,t),t=z.MAX_FOLD);for(let r=e;r<=t;r++){this.appendRange(r,r);for(let s=z.simpleFold(r);s!==r;s=z.simpleFold(s))this.appendRange(s,s)}return this}appendClass(e){for(let t=0;t<e.length;t+=2)this.appendRange(e[t],e[t+1]);return this}appendFoldedClass(e){for(let t=0;t<e.length;t+=2)this.appendFoldedRange(e[t],e[t+1]);return this}appendNegatedClass(e){let t=0;for(let r=0;r<e.length;r+=2){const s=e[r],i=e[r+1];t<=s-1&&this.appendRange(t,s-1),t=i+1}return t<=z.MAX_RUNE&&this.appendRange(t,z.MAX_RUNE),this}appendTable(e){for(let t=0;t<e.length;++t){const r=e.getLo(t),s=e.getHi(t),i=e.getStride(t);if(i===1){this.appendRange(r,s);continue}for(let o=r;o<=s;o+=i)this.appendRange(o,o)}return this}appendNegatedTable(e){let t=0;for(let r=0;r<e.length;++r){const s=e.getLo(r),i=e.getHi(r),o=e.getStride(r);if(o===1){t<=s-1&&this.appendRange(t,s-1),t=i+1;continue}for(let B=s;B<=i;B+=o)t<=B-1&&this.appendRange(t,B-1),t=B+1}return t<=z.MAX_RUNE&&this.appendRange(t,z.MAX_RUNE),this}appendTableWithSign(e,t){return t<0?this.appendNegatedTable(e):this.appendTable(e)}negateClass(){let e=0,t=0;for(let r=0;r<this.len;r+=2){const s=this.r[r],i=this.r[r+1];e<=s-1&&(this.r[t]=e,this.r[t+1]=s-1,t+=2),e=i+1}return this.len=t,e<=z.MAX_RUNE&&(this.r[this.len++]=e,this.r[this.len++]=z.MAX_RUNE),this}appendClassWithSign(e,t){return t<0?this.appendNegatedClass(e):this.appendClass(e)}appendGroup(e,t){let r=e.cls;return t&&(r=new Nn().appendFoldedClass(r).cleanClass().toArray()),this.appendClassWithSign(r,e.sign)}toString(){return Nn.charClassToString(this.r,this.len)}},ny=class{constructor(n){this.str=n,this.position=0}pos(){return this.position}rewindTo(n){this.position=n}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(n){this.position+=n}skipString(n){this.position+=n.length}pop(){const n=this.str.codePointAt(this.position);return this.position+=$.charCount(n),n}lookingAt(n){return this.str.startsWith(n,this.position)}rest(){return this.str.substring(this.position)}from(n){return this.str.substring(n,this.position)}toString(){return this.rest()}},H,ry=(H=class{static unicodeTable(e){return e==="Any"?{tab:H.ANY_TABLE,fold:H.ANY_TABLE,sign:1}
1586:e==="Ascii"?{tab:H.ASCII_TABLE,fold:H.ASCII_FOLD_TABLE,sign:1}:e==="Assigned"?{tab:lt.CATEGORIES.get("Cn"),fold:lt.CATEGORIES.get("Cn"),sign:-1}:e==="Lc"?{tab:lt.CATEGORIES.get("LC"),fold:lt.FOLD_CATEGORIES.get("LC"),sign:1}:lt.CATEGORIES.has(e)?{tab:lt.CATEGORIES.get(e),fold:lt.FOLD_CATEGORIES.get(e),sign:1}:lt.SCRIPTS.has(e)?{tab:lt.SCRIPTS.get(e),fold:lt.FOLD_SCRIPT.get(e),sign:1}:null}static minFoldRune(e){if(e<z.MIN_FOLD||e>z.MAX_FOLD)return e;let t=e;const r=e;for(e=z.simpleFold(e);e!==r;e=z.simpleFold(e))t>e&&(t=e);return t}static leadingRegexp(e){if(e.op===T.Op.EMPTY_MATCH)return null;if(e.op===T.Op.CONCAT&&e.subs.length>0){const t=e.subs[0];return t.op===T.Op.EMPTY_MATCH?null:t}return e}static literalRegexp(e,t){const r=new T(T.Op.LITERAL);return r.flags=t,r.runes=$.stringToRunes(e),r}static parse(e,t){return new H(e,t).parseInternal()}static parseRepeat(e){const t=e.pos();if(!e.more()||!e.lookingAt("{"))return-1;e.skip(1);const r=H.parseInt(e);if(r===-1||!e.more())return-1;let s;if(!e.lookingAt(","))s=r;else{if(e.skip(1),!e.more())return-1;if(e.lookingAt("}"))s=-1;else if((s=H.parseInt(e))===-1)return-1}if(!e.more()||!e.lookingAt("}"))return-1;if(e.skip(1),r<0||r>1e3||s===-2||s>1e3||s>=0&&r>s)throw new we(H.ERR_INVALID_REPEAT_SIZE,e.from(t));return r<<16|s&z.MAX_BMP}static isValidCaptureName(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){const r=e.codePointAt(t);if(r!==N.CODES.get("_")&&!$.isalnum(r))return!1}return!0}static parseInt(e){const t=e.pos();for(;e.more()&&e.peek()>=N.CODES.get("0")&&e.peek()<=N.CODES.get("9");)e.skip(1);const r=e.from(t);return r.length===0||r.length>1&&r.codePointAt(0)===N.CODES.get("0")?-1:r.length>8?-2:parseInt(r,10)}static isCharClass(e){return e.op===T.Op.LITERAL&&e.runes.length===1||e.op===T.Op.CHAR_CLASS||e.op===T.Op.ANY_CHAR_NOT_NL||e.op===T.Op.ANY_CHAR}static matchRune(e,t){switch(e.op){case T.Op.LITERAL:return e.runes.length===1&&e.runes[0]===t;case T.Op.CHAR_CLASS:for(let r=0;r<e.runes.length;r+=2)if(e.runes[r]<=t&&t<=e.runes[r+1])return!0;return!1;case T.Op.ANY_CHAR_NOT_NL:return t!==N.CODES.get(`
1587`);case T.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(e,t){switch(e.op){case T.Op.ANY_CHAR:break;case T.Op.ANY_CHAR_NOT_NL:H.matchRune(t,N.CODES.get(`
1588`))&&(e.op=T.Op.ANY_CHAR);break;case T.Op.CHAR_CLASS:t.op===T.Op.LITERAL?e.runes=new Pn(e.runes).appendLiteral(t.runes[0],t.flags).toArray():e.runes=new Pn(e.runes).appendClass(t.runes).toArray();break;case T.Op.LITERAL:if(t.runes[0]===e.runes[0]&&t.flags===e.flags)break;e.op=T.Op.CHAR_CLASS,e.runes=new Pn().appendLiteral(e.runes[0],e.flags).appendLiteral(t.runes[0],t.flags).toArray();break}}static parseEscape(e){const t=e.pos();if(e.skip(1),!e.more())throw new we(H.ERR_TRAILING_BACKSLASH);let r=e.pop();e:switch(r){case N.CODES.get("1"):case N.CODES.get("2"):case N.CODES.get("3"):case N.CODES.get("4"):case N.CODES.get("5"):case N.CODES.get("6"):case N.CODES.get("7"):if(!e.more(
1588)||e.peek()<N.CODES.get("0")||e.peek()>N.CODES.get("7"))break;case N.CODES.get("0"):{let s=r-N.CODES.get("0");for(let i=1;i<3&&!(!e.more()||e.peek()<N.CODES.get("0")||e.peek()>N.CODES.get("7"));i++)s=s*8+e.peek()-N.CODES.get("0"),e.skip(1);return s}case N.CODES.get("x"):{if(!e.more())break;if(r=e.pop(),r===N.CODES.get("{")){let o=0,B=0;for(;;){if(!e.more())break e;if(r=e.pop(),r===N.CODES.get("}"))break;const c=$.unhex(r);if(c<0||(B=B*16+c,B>z.MAX_RUNE))break e;o++}if(o===0)break e;return B}const s=$.unhex(r);if(!e.more())break;r=e.pop();const i=$.unhex(r);if(s<0||i<0)break;return s*16+i}case N.CODES.get("a"):return N.CODES.get("\x07");case N.CODES.get("f"):return N.CODES.get("\f");case N.CODES.get("n"):return N.CODES.get(`
1589`);case N.CODES.get("r"):return N.CODES.get("\r");case N.CODES.get("t"):return N.CODES.get("	");case N.CODES.get("v"):return N.CODES.get("\v");default:if(r<=z.MAX_ASCII&&!$.isalnum(r))return r;break}throw new we(H.ERR_INVALID_ESCAPE,e.from(t))}static parseClassChar(e,t){if(!e.more())throw new we(H.ERR_MISSING_BRACKET,e.from(t));return e.lookingAt("\\")?H.parseEscape(e):e.pop()}static concatRunes(e,t){for(let r=0;r<t.length;r++)e.push(t[r]);return e}static hasCapture(e){if(e===null)return!1;if(e.op===T.Op.CAPTURE)return!0;if(e.subs){for(let t of e.subs)if(H.hasCapture(t))return!0}return!1}constructor(e,t=0){this.wholeRegexp=e,this.flags=t,this.numCap=0,this.namedGroups=Object.create(null),this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null,this.nlb=0}newRegexp(e){let t=this.free;return t!==null&&t.subs!==null&&t.subs.length>0?(this.free=t.subs[0],t.reinit(),t.op=e):(t=new T(e),this.numRegexp+=1),t}reuse(e){this.height!==null&&this.height.has(e)&&this.height.delete(e),e.subs!==null&&e.subs.length>0&&(e.subs[0]=this.free),this.free=e}checkLimits(e){if(this.numRunes>H.MAX_RUNES)throw new we(H.ERR_LARGE);this.checkSize(e),this.checkHeight(e)}checkSize(e){if(this.size===null){if(this.repeats===0&&(this.repeats=1),e.op===T.Op.REPEAT){let t=e.max;t===-1&&(t=e.min),t<=0&&(t=1),t>Math.floor(H.MAX_SIZE/this.repeats)?this.repeats=H.MAX_SIZE:this.repeats*=t}if(this.numRegexp<Math.floor(H.MAX_SIZE/this.repeats))return;this.size=new Map;for(let t of this.stack)this.checkSize(t)}if(this.calcSize(e,!0)>H.MAX_SIZE)throw new we(H.ERR_LARGE)}calcSize(e,t=!1){if(!t&&this.size!==null&&this.size.has(e))return this.size.get(e);let r=0;switch(e.op){case T.Op.LITERAL:r=e.runes.length;break;case T.Op.PLB:case T.Op.NLB:case T.Op.CAPTURE:case T.Op.STAR:r=2+this.calcSize(e.subs[0]);break;case T.Op.PLUS:case T.Op.QUEST:r=1+this.calcSize(e.subs[0]);break;case T.Op.CONCAT:for(let s of e.subs)r=r+this.calcSize(s);break;case T.Op.ALTERNATE:for(let s of e.subs)r=r+this.calcSize(s);e.subs.length>1&&(r=r+e.subs.length-1);break;case T.Op.REPEAT:{let s=this.calcSize(e.subs[0]);if(e.max===-1){e.min===0?r=2+s:r=1+e.min*s;break}r=e.max*s+(e.max-e.min);break}}return r=Math.max(1,r),this.size===null&&(this.size=new Map),this.size.set(e,r),r}checkHeight(e){if(!(this.numRegexp<H.MAX_HEIGHT)){if(this.height===null){this.height=new Map;for(let t of this.stack)this.checkHeight(t)}if(this.calcHeight(e,!0)>H.MAX_HEIGHT)throw new we(H.ERR_NESTING_DEPTH)}}calcHeight(e,t=!1){if(!t&&this.height!==null&&this.height.has(e))return this.height.get(e);let r=1;for(let s of e.subs){const i=this.calcHeight(s);r<1+i&&(r=1+i)}return this.height===null&&(this.height=new Map),this.height.set(e,r),r}pop(){return this.stack.pop()}popToPseudo(){const e=this.stack.length;let t=e;for(;t>0&&!T.isPseudoOp(this.stack[t-1].op);)t--;const r=this.stack.slice(t,e);return this.stack=this.stack.slice(0,t),r}push(e){if(this.numRunes+=e.runes.length,e.op===T.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]===e.runes[1]){if(this.maybeConcat(e.runes[0],this.flags&-2))return null;e.op=T.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags&-2}else if(e.op===T.Op.CHAR_CLASS&&e.runes.length===4&&e.runes[0]===e.runes[1]&&e.runes[2]===e.runes[3]&&z.simpleFold(e.runes[0])===e.runes[2]&&z.simpleFold(e.runes[2])===e.runes[0]||e.op===T.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]+1===e.runes[1]&&z.simpleFold(e.runes[0])===e.runes[1]&&z.simpleFold(e.runes[1])===e.runes[0]){if
vendor: 8,633 bytes, lines 1589-1591
1589(this.maybeConcat(e.runes[0],this.flags|M.FOLD_CASE))return null;e.op=T.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags|M.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(e),this.checkLimits(e),e}maybeConcat(e,t){const r=this.stack.length;if(r<2)return!1;const s=this.stack[r-1],i=this.stack[r-2];return s.op!==T.Op.LITERAL||i.op!==T.Op.LITERAL||(s.flags&M.FOLD_CASE)!==(i.flags&M.FOLD_CASE)?!1:(i.runes=H.concatRunes(i.runes,s.runes),e>=0?(s.runes=[e],s.flags=t,!0):(this.pop(),this.reuse(s),!1))}newLiteral(e,t){const r=this.newRegexp(T.Op.LITERAL);return r.flags=t,t&M.FOLD_CASE&&(e=H.minFoldRune(e)),r.runes=[e],r}literal(e){this.push(this.newLiteral(e,this.flags))}op(e){const t=this.newRegexp(e);return t.flags=this.flags,this.push(t)}repeat(e,t,r,s,i,o){let B=this.flags;if(B&M.PERL_X&&(i.more()&&i.lookingAt("?")&&(i.skip(1),B^=M.NON_GREEDY),o!==-1))throw new we(H.ERR_INVALID_REPEAT_OP,i.from(o));const c=this.stack.length;if(c===0)throw new we(H.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));const u=this.stack[c-1];if(T.isPseudoOp(u.op))throw new we(H.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));const h=this.newRegexp(e);if(h.min=t,h.max=r,h.flags=B,h.subs=[u],this.stack[c-1]=h,this.checkLimits(h),e===T.Op.REPEAT&&(t>=2||r>=2)&&!this.repeatIsValid(h,1e3))throw new we(H.ERR_INVALID_REPEAT_SIZE,i.from(s))}repeatIsValid(e,t){if(e.op===T.Op.REPEAT){let r=e.max;if(r===0)return!0;if(r<0&&(r=e.min),r>t)return!1;r>0&&(t=Math.trunc(t/r))}for(let r of e.subs)if(!this.repeatIsValid(r,t))return!1;return!0}concat(){this.maybeConcat(-1,0);const e=this.popToPseudo();return e.length===0?this.push(this.newRegexp(T.Op.EMPTY_MATCH)):this.push(this.collapse(e,T.Op.CONCAT))}alternate(){const e=this.popToPseudo();return e.length>0&&this.cleanAlt(e[e.length-1]),e.length===0?this.push(this.newRegexp(T.Op.NO_MATCH)):this.push(this.collapse(e,T.Op.ALTERNATE))}cleanAlt(e){e.op===T.Op.CHAR_CLASS&&(e.runes=new Pn(e.runes).cleanClass().toArray(),e.runes.length===2&&e.runes[0]===0&&e.runes[1]===z.MAX_RUNE?(e.runes=[],e.op=T.Op.ANY_CHAR):e.runes.length===4&&e.runes[0]===0&&e.runes[1]===N.CODES.get(`
1590`)-1&&e.runes[2]===N.CODES.get(`
1591`)+1&&e.runes[3]===z.MAX_RUNE&&(e.runes=[],e.op=T.Op.ANY_CHAR_NOT_NL))}collapse(e,t){if(e.length===1)return e[0];let r=0;for(let B of e)r+=B.op===t?B.subs.length:1;let s=new Array(r).fill(null),i=0;for(let B of e)if(B.op===t){for(let c=0;c<B.subs.length;c++)s[i++]=B.subs[c];this.reuse(B)}else s[i++]=B;let o=this.newRegexp(t);if(o.subs=s,t===T.Op.ALTERNATE&&(o.subs=this.factor(o.subs),o.subs.length===1)){const B=o;o=o.subs[0],this.reuse(B)}return o}factor(e){if(e.length<2)return e;let t=0,r=e.length,s=0,i=null,o=0,B=0,c=0;for(let h=0;h<=r;h++){let d=null,p=0,_=0;if(h<r){let y=e[t+h];if(y.op===T.Op.CONCAT&&y.subs.length>0&&(y=y.subs[0]),y.op===T.Op.LITERAL&&(d=y.runes,p=y.runes.length,_=y.flags&M.FOLD_CASE),_===B){let O=0;for(;O<o&&O<p&&i[O]===d[O];)O++;if(O>0){o=O;continue}}}if(h!==c)if(h===c+1)e[s++]=e[t+c];else{const y=this.newRegexp(T.Op.LITERAL);y.flags=B,y.runes=i.slice(0,o);for(let j=c;j<h;j++)e[t+j]=this.removeLeadingString(e[t+j],o),this.checkLimits(e[t+j]);const O=this.collapse(e.slice(t+c,t+h),T.Op.ALTERNATE),V=this.newRegexp(T.Op.CONCAT);V.subs=[y,O],e[s++]=V}c=h,i=d,o=p,B=_}r=s,t=0,c=0,s=0;let u=null;for(let h=0;h<=r;h++){let d=null;if(!(h<r&&(d=H.leadingRegexp(e[t+h]),u!==null&&u.equals(d)&&(H.isCharClass(u)||u.op===T.Op.REPEAT&&u.min===u.max&&H.isCharClass(u.subs[0]))))){if(h!==c)if(h===c+1)e[s++]=e[t+c];else{const p=u;for(let O=c;O<h;O++){const V=O!==c;e[t+O]=this.removeLeadingRegexp(e[t+O],V),this.checkLimits(e[t+O])}const _=this.collapse(e.slice(t+c,t+h),T.Op.ALTERNATE),y=this.newRegexp(T.Op.CONCAT);y.subs=[p,_],e[s++]=y}c=h,u=d}}r=s,t=0,c=0,s=0;for(let h=0;h<=r;h++)if(!(h<r&&H.isCharClass(e[t+h]))){if(h!==c)if(h===c+1)e[s++]=e[t+c];else{let d=c;for(let _=c+1;_<h;_++){const y=e[t+d],O=e[t+_];(y.op<O.op||y.op===O.op&&(y.runes!==null?y.runes.length:0)<(O.runes!==null?O.runes.length:0))&&(d=_)}const p=e[t+c];e[t+c]=e[t+d],e[t+d]=p;for(let _=c+1;_<h;_++)H.mergeCharClass(e[t+c],e[t+_]),this.reuse(e[t+_]);this.cleanAlt(e[t+c]),e[s++]=e[t+c]}h<r&&(e[s++]=e[t+h]),c=h+1}r=s,t=0,c=0,s=0;for(let h=0;h<r;++h)h+1<r&&e[t+h].op===T.Op.EMPTY_MATCH&&e[t+h+1].op===T.Op.EMPTY_MATCH||(e[s++]=e[t+h]);return r=s,t=0,e.slice(t,r)}removeLeadingString(e,t){if(e.op===T.Op.CONCAT&&e.subs.length>0){const r=this.removeLeadingString(e.subs[0],t);if(e.subs[0]=r,r.op===T.Op.EMPTY_MATCH)switch(this.reuse(r),e.subs.length){case 0:case 1:e.op=T.Op.EMPTY_MATCH,e.subs=T.emptySubs();break;case 2:{const s=e;e=e.subs[1],this.reuse(s);break}default:e.subs=e.subs.slice(1,e.subs.length);break}return e}return e.op===T.Op.LITERAL&&(e.runes=e.runes.slice(t,e.runes.length),e.runes.length===0&&(e.op=T.Op.EMPTY_MATCH)),e}removeLeadingRegexp(e,t){if(e.op===T.Op.CONCAT&&e.subs.length>0){switch(t&&this.reuse(e.subs[0]),e.subs=e.subs.slice(1,e.subs.length),e.subs.length){case 0:e.op=T.Op.EMPTY_MATCH,e.subs=T.emptySubs();break;case 1:{const r=e;e=e.subs[0],this.reuse(r);break}}return e}return t&&this.reuse(e),this.newRegexp(T.Op.EMPTY_MATCH)}parseInternal(){if(this.flags&M.LITERAL)return H.literalRegexp(this.wholeRegexp,this.flags);let e=-1,t=-1,r=-1;const s=new ny(this.wholeRegexp);for(;s.more();){let i=-1;e:switch(s.peek()){case N.CODES.get("("):if(this.flags&M.LOOKBEHIND){if(s.lookingAt("(?<=")){this.parsePosLookBehind(),s.skip(4);break}if(s.lookingAt("(?<!")){this.parseNegLookBehind(),s.skip(4);break}}if(this.flags&M.PERL_X&&s.lookingAt("(?")){this.parsePerlFlags(s);break}this.op(T.Op.LEFT_PAREN).cap=++this.numCap,s.skip(1);break;case N.CODES.get("|"):this.parseVerticalBar(),s.skip(1);break;case N.CODES.get(")"):this.parseRightParen(),s.skip(1);break;case N.CODES.get("^"):this.flags&M.ONE_LINE?this.op(T.Op.BEGIN_TEXT):this.op(T.Op.BEGIN_LINE),s.skip(1);break;case N.CODES.get("$"):this.flags&M.ONE_LINE?this.op(T.Op.END_TEXT).flags|=M.WAS_DOLLAR:this.op(T.Op.END_LINE),s.skip(1);break;case N.CODES.get("."):this.flags&M.DOT_NL?this.op(T.Op.ANY_CHAR):this.op(T.Op.ANY_CHAR_NOT_NL),s.skip(1);break;case N.CODES.get("["):this.parseClass(s);break;case N.CODES.get("*"):case N.CODES.get("+"):case N.CODES.get("?"):{i=s.pos();let o=null;switch(s.pop()){case N.CODES.get("*"):o=T.Op.STAR;break;case N.CODES.get("+"):o=T.Op.PLUS;break;case N.CODES.get("?"):o=T.Op.QUEST;break}this.repeat(o,t,r,i,s,e);break}case N.CODES.get("{"):{i=s.pos();const o=H.parseRepeat(s);if(o<0){s.rewindTo(i),this.literal(s.pop());break}t=o>>16,r=(o&z.MAX_BMP)<<16>>16,this.repeat(T.Op.REPEAT,t,r,i,s,e);break}case N.CODES.get("\\"):{const o=s.pos();if(s.skip(1),this.flags&M.PERL_X&&s.more())switch(s.pop()){case N.CODES.get("A"):this.op(T.Op.BEGIN_TEXT);break e;case N.CODES.get("b"):this.op(T.Op.WORD_BOUNDARY);break e;case N.CODES.get("B"):this.op(T.Op.NO_WORD_BOUNDARY);break e;case N.CODES.get("C"):throw new we(H.ERR_INVALID_ESCAPE,"\\C");case N.CODES.get("Q"):{let u=s.rest();const h=u.indexOf("\\E");h>=0?(u=u.substring(0,h),s.skipString(u),s.skipString("\\E")):s.skipString(u);let d=0;for(;d<u.length;){const p=u.codePointAt(d);this.literal(p),d+=$.charCount(p)}break e}case N.CODES.get("z"):this.op(T.Op.END_TEXT);break e;default:s.rewindTo(o);break}else s.rewindTo(o);const B=this.newRegexp(T.Op.CHAR_CLASS);if(B.flags=this.flags,s.lookingAt("\\p")||s.lookingAt("\\P")){const u=new Pn;if(this.parseUnicodeClass(s,u)){B.runes=u.toArray(),this.push(B);break e}}const c=new Pn;if(this.parsePerlClassEscape(s,c)){B.runes=c.toArray(),this.push(B);break e}s.rewindTo(o),this.reuse(B),this.literal(H.parseEscape(s));break}default:this.literal(s.pop());break}e=i}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new we(H.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(e){const t=e.pos(),r=e.rest();if(r.startsWith("(?P<")||r.startsWith("(?<")){const B=r.charAt(2)==="P"?4:3,c=r.indexOf(">");if(c<0)throw new we(H.ERR_INVALID_NAMED_CAPTURE,r);const u=r.substring(B,c);if(e.skipString(u),e.skip(B+1),!H.isValidCaptureName(u))throw new we(H.ERR_INVALID_NAMED_CAPTURE,r.substring(0,c+1));const h=this.op(T.Op.LEFT_PAREN);if(h.cap=++this.numCap,this.namedGroups[u])throw new we(H.ERR_DUPLICATE_NAMED_CAPTURE,u);this.namedGroups[u]=this.numCap,h.name=u;return}e.skip(2);let s=this.flags,i=1,o=!1;e:for(;e.more();){const B=e.pop();switch(B){case N.CODES.get("i"):s|=M.FOLD_CASE,o=!0;break;case N.CODES.get("m"):s&=-17,o=!0;break;case N.CODES.get("s"):s|=M.DOT_NL,o=!0;break;case N.CODES.get("U"):s|=M.NON_GREEDY,o=!0;break;case N.CODES.get("-"):if(i<0)break e;i=-1,s=~s,o=!1;break;
1591case N.CODES.get(":"):case N.CODES.get(")"):if(i<0){if(!o)break e;s=~s}B===N.CODES.get(":")&&this.op(T.Op.LEFT_PAREN),this.flags=s;return;default:break e}}throw new we(H.ERR_INVALID_PERL_OP,e.from(t))}parsePosLookBehind(){const e=this.newRegexp(T.Op.LEFT_PAREN);return e.flags=this.flags,e.lb=++this.nlb,this.push(e)}parseNegLookBehind(){const e=this.newRegexp(T.Op.LEFT_PAREN);return e.flags=this.flags,e.lb=-++this.nlb,this.push(e)}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(T.Op.VERTICAL_BAR)}swapVerticalBar(){const e=this.stack.length;if(e>=3&&this.stack[e-2].op===T.Op.VERTICAL_BAR&&H.isCharClass(this.stack[e-1])&&H.isCharClass(this.stack[e-3])){let t=this.stack[e-1],r=this.stack[e-3];if(t.op>r.op){const s=r;r=t,t=s,this.stack[e-3]=r}return H.mergeCharClass(r,t),this.reuse(t),this.pop(),!0}if(e>=2){const t=this.stack[e-1],r=this.stack[e-2];if(r.op===T.Op.VERTICAL_BAR)return e>=3&&this.cleanAlt(this.stack[e-3]),this.stack[e-2]=t,this.stack[e-1]=r,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new we(H.ERR_UNEXPECTED_PAREN,this.wholeRegexp);const e=this.pop(),t=this.pop();if(t.op!==T.Op.LEFT_PAREN)throw new we(H.ERR_UNEXPECTED_PAREN,this.wholeRegexp);if(this.flags=t.flags,t.lb!==0){if(H.hasCapture(e))throw new we(H.ERR_INVALID_CAPTURE_IN_LOOKBEHIND,this.wholeRegexp);t.lb>0?t.op=T.Op.PLB:t.op=T.Op.NLB,t.subs=[e],this.push(t);return}t.cap===0?this.push(e):(t.op=T.Op.CAPTURE,t.subs=[e],this.push(t))}parsePerlClassEscape(e,t){const r=e.pos();if(!(this.flags&M.PERL_X)||!e.more()||e.pop()!==N.CODES.get("\\")||!e.more())return!1;e.pop();const s=e.from(r),i=Uh.has(s)?Uh.get(s):null;return i===null?!1:(t.appendGroup(i,(this.flags&M.FOLD_CASE)!==0),!0)}parseNamedClass(e,t){const r=e.rest(),s=r.indexOf(":]");if(s<0)return!1;const i=r.substring(0,s+2);e.skipString(i);const o=nf.has(i)?nf.get(i):null;if(o===null)throw new we(H.ERR_INVALID_CHAR_RANGE,i);return t.appendGroup(o,(this.flags&M.FOLD_CASE)!==0),!0}parseUnicodeClass(e,t){const r=e.pos();if(!(this.flags&M.UNICODE_GROUPS)||!e.lookingAt("\\p")&&!e.lookingAt("\\P"))return!1;e.skip(1);let s=1,i=e.pop();if(i===N.CODES.get("P")&&(s=-1),!e.more())throw e.rewindTo(r),new we(H.ERR_INVALID_CHAR_RANGE,e.rest());i=e.pop();let o;if(i!==N.CODES.get("{"))o=$.runeToString(i);else{const h=e.rest(),d=h.indexOf("}");if(d<0)throw e.rewindTo(r),new we(H.ERR_INVALID_CHAR_RANGE,e.rest());o=h.substring(0,d),e.skipString(o),e.skip(1)}o.length!==0&&o.codePointAt(0)===N.CODES.get("^")&&(s=0-s,o=o.substring(1));const B=H.unicodeTable(o);if(B===null)throw new we(H.ERR_INVALID_CHAR_RANGE,e.from(r));B.sign<0&&(s=0-s);const c=B.tab,u=B.fold;if(!(this.flags&M.FOLD_CASE)||u===null)t.appendTableWithSign(c,s);else{const h=new Pn().appendTable(c).appendTable(u).cleanClass().toArray();t.appendClassWithSign(h,s)}return!0}parseClass(e){const t=e.pos();e.skip(1);const r=this.newRegexp(T.Op.CHAR_CLASS);r.flags=this.flags;const s=new Pn;let i=1;e.more()&&e.lookingAt("^")&&(i=-1,e.skip(1),this.flags&M.CLASS_NL||s.appendRange(N.CODES.get(`
1592`),N.CODES.get(`
1593`)));let o=!0;for(;!e.more()||e.peek()!==N.CODES.get("]")||o;){if(e.more()&&e.lookingAt("-")&&!(this.flags&M.PERL_X)&&!o){const h=e.rest();if(h==="-"||!h.startsWith("-]"))throw e.rewindTo(t),new we(H.ERR_INVALID_CHAR_RANGE,e.rest())}o=!1;const B=e.pos();if(e.lookingAt("[:")){if(this.parseNamedClass(e,s))continue;e.rewindTo(B)}if(this.parseUnicodeClass(e,s)||this.parsePerlClassEscape(e,s))continue;e.rewindTo(B);const c=H.parseClassChar(e,t);let u=c;if(e.more()&&e.lookingAt("-")){if(e.skip(1),e.more()&&e.lookingAt("]"))e.skip(-1);else if(u=H.parseClassChar(e,t),u<c)throw new we(H.ERR_INVALID_CHAR_RANGE,e.from(B))}this.flags&M.FOLD_CASE?s.appendFoldedRange(c,u):s.appendRange(c,u)}e.skip(1),s.cleanClass(),i<0&&s.negateClass(),r.runes=s.toArray(),this.push(r)}},U(H,"ERR_INTERNAL_ERROR","regexp/syntax: internal error"),U(H,"ERR_INVALID_CHAR_RANGE","invalid character class range"),U(H,"ERR_INVALID_ESCAPE","invalid escape sequence"),U(H,"ERR_INVALID_NAMED_CAPTURE","invalid named capture"),U(H,"ERR_INVALID_PERL_OP","invali
1593d or unsupported Perl syntax"),U(H,"ERR_INVALID_REPEAT_OP","invalid nested repetition operator"),U(H,"ERR_INVALID_REPEAT_SIZE","invalid repeat count"),U(H,"ERR_MISSING_BRACKET","missing closing ]"),U(H,"ERR_MISSING_PAREN","missing closing )"),U(H,"ERR_MISSING_REPEAT_ARGUMENT","missing argument to repetition operator"),U(H,"ERR_TRAILING_BACKSLASH","trailing backslash at end of expression"),U(H,"ERR_DUPLICATE_NAMED_CAPTURE","duplicate capture group name"),U(H,"ERR_UNEXPECTED_PAREN","unexpected )"),U(H,"ERR_NESTING_DEPTH","expression nests too deeply"),U(H,"ERR_LARGE","expression too large"),U(H,"ERR_INVALID_CAPTURE_IN_LOOKBEHIND","invalid capture in lookbehind"),U(H,"MAX_HEIGHT",1e3),U(H,"MAX_SIZE",3355443),U(H,"MAX_RUNES",33554432),U(H,"ANY_TABLE",new g(new Uint32Array([0,z.MAX_RUNE,1]))),U(H,"ASCII_TABLE",new g(new Uint32Array([0,127,1]))),U(H,"ASCII_FOLD_TABLE",new g(new Uint32Array([0,127,1,383,383,1,8490,8490,1]))),H),sy=class dr{static initTest(e){const t=dr.compile(e),r=new dr(t.expr,t.prog,t.numSubexp,t.longest);return r.cond=t.cond,r.prefix=t.prefix,r.prefixUTF8=t.prefixUTF8,r.prefixComplete=t.prefixComplete,r.prefixRune=t.prefixRune,r.prefilter=t.prefilter,r}static compile(e){return dr.compileImpl(e,M.PERL,!1)}static compilePOSIX(e){return dr.compileImpl(e,M.POSIX,!0)}static compileImpl(e,t,r){let s=ry.parse(e,t);const i=s.maxCap();s=ty.simplify(s);const o=Xw.build(s),B=ey.compileRegexp(s),c=new dr(e,B,i,r);c.prefilter=o.type===de.Type.NONE?null:o;const[u,h]=B.prefix();return c.prefixComplete=u,c.prefix=h,c.prefixUTF8=$.stringToUtf8ByteArray(c.prefix),c.prefix.length>0&&(c.prefixRune=c.prefix.codePointAt(0)),c.namedGroups=s.namedGroups,c}static match(e,t){return dr.compile(e).match(t)}constructor(e,t,r=0,s=0){this.expr=e,this.prog=t,this.numSubexp=r,this.longest=s,this.cond=t.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.machinePool=[],this.dfa=new Hw(this.prog),this.onepass=kh.compile(this.prog),this.prefilter=null}matchPrefixComplete(e,t,r,s){if((r===M.ANCHOR_START||r===M.ANCHOR_BOTH)&&t!==0)return null;let i=-1,o=-1;const B=e.prefixLength(this);if(r===M.UNANCHORED){const c=e.index(this,t);if(c<0)return null;i=t+c,o=i+B}else if(r===M.ANCHOR_BOTH){if(e.endPos()!==B||e.index(this,0)!==0)return null;i=0,o=B}else if(r===M.ANCHOR_START){if(e.index(this,0)!==0)return null;i=0,o=B}if(i<0)return null;if(s>0){const c=new Int32Array(s).fill(-1);return c[0]=i,c[1]=o,Array.from(c)}return[]}executeEngine(e,t,r,s){if(this.prefixComplete&&(s===0||this.numSubexp===0))return this.matchPrefixComplete(e,t,r,s);if(this.prefilter!==null&&r===M.UNANCHORED&&!this.prefilter.eval(e,t))return null;if(this.onepass!==null)return kh.execute(this,e,t,r,s);if(s>0)return this.prog.numLb===0&&e.endPos()<=mo.maxBitStateLen(this.prog)?mo.execute(this,e,t,r,s):this.doExecuteNFA(e,t,r,s);if(this.prog.numLb===0){const i=this.dfa.match(e,t,r);if(i!==null)return i?[]:null;if(e.endPos()<=mo.maxBitStateLen(this.prog))return mo.execute(this,e,t,r,s)}return this.doExecuteNFA(e,t,r,s)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){return this.machinePool.length>0?this.machinePool.pop():null}reset(){this.machinePool.length=0}put(e){this.machinePool.push(e)}toString(){return this.expr}doExecuteNFA(e,t,r,s){let i=this.get();i||(i=Mw.fromRE2(this)),i.init(s);const o=i.match(e,t,r)?i.submatches():null;return this.put(i),o}match(e){return this.executeEngine(Te.fromUTF16(e),0,M.UNANCHORED,0)!==null}matchWithGroup(e,t,r,s,i){return e instanceof vr||($.isByteArray(e)?e=gr.utf8(e):e=gr.utf16(e)),this.matchMachineInput(e,t,r,s,i)}matchMachineInput(e,t,r,s,i){if(t>r)return[!1,null];const o=e.isUTF16Encoding()?Te.fromUTF16(e.asCharSequence(),0,r):Te.fromUTF8(e.asBytes(),0,r),B=this.executeEngine(o,t,s,2*i);return B===null?[!1,null]:[!0,B]}matchUTF8(e){return this.executeEngine(Te.fromUTF8(e),0,M.UNANCHORED,0)!==null}replaceAll(e,t){return this.replaceAllFunc(e,()=>t,2*e.length+1)}replaceFirst(e,t){return this.replaceAllFunc(e,()=>t,1)}replaceAllFunc(e,t,r){let s=0,i=0,o="";const B=Te.fromUTF16(e);let c=0;for(;i<=e.length;
1593){const u=this.executeEngine(B,i,M.UNANCHORED,2);if(u===null||u.length===0)break;o+=e.substring(s,u[0]),(u[1]>s||u[0]===0)&&(o+=t(e.substring(u[0],u[1])),c++),s=u[1];const h=B.step(i)&7;if(i+h>u[1]?i+=h:i+1>u[1]?i++:i=u[1],c>=r)break}return o+=e.substring(s),o}pad(e){if(e===null)return null;let t=(1+this.numSubexp)*2;if(e.length<t){let r=new Array(t).fill(-1);for(let s=0;s<e.length;s++)r[s]=e[s];e=r}return e}allMatches(e,t,r=s=>s){let s=[];const i=e.endPos();t<0&&(t=i+1);let o=0,B=0,c=-1;for(;B<t&&o<=i;){const u=this.executeEngine(e,o,M.UNANCHORED,this.prog.numCap);if(u===null||u.length===0)break;let h=!0;if(u[1]===o){u[0]===c&&(h=!1);const d=e.step(o);d<0?o=i+1:o+=d&7}else o=u[1];c=u[1],h&&(s.push(r(this.pad(u))),B++)}return s}findUTF8(e){const t=this.executeEngine(Te.fromUTF8(e),0,M.UNANCHORED,2);return t===null?null:e.slice(t[0],t[1])}findUTF8Index(e){const t=this.executeEngine(Te.fromUTF8(e),0,M.UNANCHORED,2);return t===null?null:t.slice(0,2)}find(e){const t=this.executeEngine(Te.fromUTF16(e),0,M.UNANCHORED,2);return t===null?"":e.substring(t[0],t[1])}findIndex(e){return this.executeEngine(Te.fromUTF16(e),0,M.UNANCHORED,2)}findUTF8Submatch(e){const t=this.executeEngine(Te.fromUTF8(e),0,M.UNANCHORED,this.prog.numCap);if(t===null)return null;const r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<t.length&&t[2*s]>=0&&(r[s]=e.slice(t[2*s],t[2*s+1]));return r}findUTF8SubmatchIndex(e){return this.pad(this.executeEngine(Te.fromUTF8(e),0,M.UNANCHORED,this.prog.numCap))}findSubmatch(e){const t=this.executeEngine(Te.fromUTF16(e),0,M.UNANCHORED,this.prog.numCap);if(t===null)return null;const r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<t.length&&t[2*s]>=0&&(r[s]=e.substring(t[2*s],t[2*s+1]));return r}findSubmatchIndex(e){return this.pad(this.executeEngine(Te.fromUTF16(e),0,M.UNANCHORED,this.prog.numCap))}findAllUTF8(e,t){const r=this.allMatches(Te.fromUTF8(e),t,s=>e.slice(s[0],s[1]));return r.length===0?null:r}findAllUTF8Index(e,t){const r=this.allMatches(Te.fromUTF8(e),t,s=>s.slice(0,2));return r.length===0?null:r}findAll(e,t){const r=this.allMatches(Te.fromUTF16(e),t,s=>e.substring(s[0],s[1]));return r.length===0?null:r}findAllIndex(e,t){const r=this.allMatches(Te.fromUTF16(e),t,s=>s.slice(0,2));return r.length===0?null:r}findAllUTF8Submatch(e,t){const r=this.allMatches(Te.fromUTF8(e),t,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=e.slice(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllUTF8SubmatchIndex(e,t){const r=this.allMatches(Te.fromUTF8(e),t);return r.length===0?null:r}findAllSubmatch(e,t){const r=this.allMatches(Te.fromUTF16(e),t,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=e.substring(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllSubmatchIndex(e,t){const r=this.allMatches(Te.fromUTF16(e),t);return r.length===0?null:r}},iy=class $r{static isHexadecimal(e){return"0"<=e&&e<="9"||"A"<=e&&e<="F"||"a"<=e&&e<="f"}static translate(e){let t="";if(e instanceof RegExp&&(e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e=e.source),typeof e!="string")return e;let r="",s=!1,i=e.length;i===0&&(r="(?:)",s=!0);let o=!1,B=0;for(;B<i;){let u=e[B];if(u==="\\"){if(B+1<i)switch(u=e[B+1],u){case"\\":r+="\\\\",B+=2;continue;case"c":if(B+2<i){let p=e[B+2].charCodeAt(0);if(p>=65&&p<=90||p>=97&&p<=122){let _=p%32;r+="\\x",r+=(_>>4).toString(16).toUpperCase(),r+=(_&15).toString(16).toUpperCase(),B+=3,s=!0;continue}}r+="c",B+=2,s=!0;continue;case"u":if(B+2<i){if(e[B+2]==="{"){let p=B+3,_=!1,y=!1;for(;p<i;){const O=e[p];if(O==="}"){y=!0;break}if(!$r.isHexadecimal(O))break;_=!0,p++}if(y&&_){r+="\\x",B+=2,s=!0;continue}}else if(B+5<i){let p=!0;for(let _=0;_<4;_++)if(!$r.isHexadecimal(e[B+2+_])){p=!1;break}if(p){r+="\\x{"+e.substring(B+2,B+6)+"}",B+=6,s=!0;continue}}}r+="u",B+=2,s=!0;continue;case"x":{let p=!1;if(B+2<i&&e[B+2]==="{"){let _=B+3,y=!1,O=!1;for(;_<i;){const V=e[_];if(V==="}"){O=!0;break}if(!$r.isHexadecimal(V))break;y=!0,_++}O&&y&&(p=!0)}else B+3<i&&$r.isHexadecimal(e[B+2])&&$r.isHexadecimal(e[B+3])&&(p=!0);p?(r+="\\x",B+=2):(r+="x",B+=2,s=!0);continue}case"n":case"r":case"t":case"a":case"f":case"v":case"d":case"D":case"s":case"S":case"w":case"W":case"b":case"B":case"p":case"P":case"A":case"z":case"Q":case"E":case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":r+="\\"+u,B+=2;continue;default:{let p=e.codePointAt(B+1);if(p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122){let _=$.charCount(p);r+=e.substring(B+1,B+1+_),B+=_+1,s=!0}else{r+="\\";let _=$.charCount(p);r+=e.substring(B+1,B+1+_),B+=_+1}continue}}}else if(u==="/"){r+="\\/",B+=1,s=!0;continue}else if(u==="[")o=!0;else if(u==="]")o=!1;else if(!o&&u==="("&&B+2<i&&e[B+1]==="?"&&e[B+2]==="<"&&B+3<i&&!"=!>)".includes(e[B+3])){r+="(?P<",B+=3,s=!0;continue}let h=e.codePointAt(B),d=$.charCount(h);r+=e.substring(B,B+d),B+=d}const c=s?r:e;return t.length>0?`(?${t})${c}`:c}},Fe,Gc=(Fe=class{static quote(e){return $.quoteMeta(e)}
1593static quoteReplacement(e,t=!1){return Oh.quoteReplacement(e,t)}static translateRegExp(e){return iy.translate(e)}static compile(e,t=0){let r=e;if(t&Fe.CASE_INSENSITIVE&&(r=`(?i)${r}`),t&Fe.DOTALL&&(r=`(?s)${r}`),t&Fe.MULTILINE&&(r=`(?m)${r}`),t&-544)throw new xw("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH, LOOKBEHINDS");let s=M.PERL;t&Fe.DISABLE_UNICODE_GROUPS&&(s&=-129),t&Fe.LOOKBEHINDS&&(s|=M.LOOKBEHIND);const i=new Fe(e,t);return i.re2Input=sy.compileImpl(r,s,(t&Fe.LONGEST_MATCH)!==0),i}static matches(e,t){return Fe.compile(e).testExact(t)}static initTest(e,t,r){if(e==null)throw new Error("pattern is null");if(r==null)throw new Error("re2 is null");const s=new Fe(e,t);return s.re2Input=r,s}constructor(e,t){this.patternInput=e,this.flagsInput=t,this.re2Input=null}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(e){return this.testExact(e)}matcher(e){return $.isByteArray(e)&&(e=gr.utf8(e)),new Oh(this,e)}test(e){return $.isByteArray(e)?this.re2Input.matchUTF8(e):this.re2Input.match(e)}testExact(e){const t=$.isByteArray(e)?Te.fromUTF8(e):Te.fromUTF16(e);return this.re2Input.executeEngine(t,0,M.ANCHOR_BOTH,0)!==null}exec(e){const t=this.matcher(e);if(!t.find())return null;const r=[t.group(0)];for(let i=1;i<=t.groupCount();i++){const o=t.group(i);r.push(o===null?void 0:o)}r.index=t.start(0),r.input=e;const s=this.namedGroups();if(Object.keys(s).length>0){const i=t.getNamedGroups();for(const o in i)i[o]===null&&(i[o]=void 0);r.groups=i}else r.groups=void 0;return r}split(e,t=0){const r=this.matcher(e),s=[];let i=0,o=0;for(;r.find();){if(o===0&&r.end()===0){o=r.end();continue}if(t>0&&s.length===t-1)break;if(o===r.start()){if(t===0){i+=1,o=r.end();continue}}else for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.start())),o=r.end()}if(t===0&&o!==r.inputLength()){for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.inputLength()))}return(t!==0||s.length===0&&!(o===r.inputLength()&&o>0))&&s.push(r.substring(o,r.inputLength())),s}*matchAll(e){const t=this.matcher(e);for(;t.find();){const r=[t.group(0)];for(let i=1;i<=t.groupCount();i++){const o=t.group(i);r.push(o===null?void 0:o)}r.index=t.start(0),r.input=e;const s=this.namedGroups();if(Object.keys(s).length>0){const i=t.getNamedGroups();for(const o in i)i[o]===null&&(i[o]=void 0);r.groups=i}else r.groups=void 0;yield r}}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(e){return this===e?!0:e===null||this.constructor!==e.constructor?!1:this.flagsInput===e.flagsInput&&this.patternInput===e.patternInput}},U(Fe,"CASE_INSENSITIVE",Kr.CASE_INSENSITIVE),U(Fe,"DOTALL",Kr.DOTALL),U(Fe,"MULTILINE",Kr.MULTILINE),U(Fe,"DISABLE_UNICODE_GROUPS",Kr.DISABLE_UNICODE_GROUPS),U(Fe,"LONGEST_MATCH",Kr.LONGEST_MATCH),U(Fe,"LOOKBEHINDS",Kr.LOOKBEHINDS),Fe);/**
1594 * @license
1595 * Copyright 2017 Google LLC
1596 *
1597 * Licensed under the Apache License, Version 2.0 (the "License");
1598 * you may not use this file except in compliance with the License.
1599 * You may obtain a copy of the License at
1600 *
1601 *   http://www.apache.org/licenses/LICENSE-2.0
1602 *
1603 * Unless required by applicable law or agreed to in writing, software
1604 * distributed under the License is distributed on an "AS IS" BASIS,
1605 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1606 * See the License for the specific language governing permissions and
1607 * limitations under the License.
1608 */let _s="12.19.0";function oy(n){_s=n}/**
1609 * @license
1610 * Copyright 2020 Google LLC
1611 *
1612 * Licensed under the Apache License, Version 2.0 (the "License");
1613 * you may not use this file except in compliance with the License.
1614 * You may obtain a copy of the License at
1615 *
1616 *   http://www.apache.org/licenses/LICENSE-2.0
1617 *
1618 * Unless required by applicable law or agreed to in writing, software
1619 * distributed under the License is distributed on an "AS IS" BASIS,
1620 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1621 * See the License for the specific language governing permissions and
1622 * limitations under the License.
1623 *//**
1624 * @license
1625 * Copyright 2017 Google LLC
1626 *
1627 * Licensed under the Apache License, Version 2.0 (the "License");
1628 * you may not use this file except in compliance with the License.
1629 * You may obtain a copy of the License at
1630 *
1631 *   http://www.apache.org/licenses/LICENSE-2.0
1632 *
1633 * Unless required by applicable law or agreed to in writing, software
1634 * distributed under the License is distributed on an "AS IS" BASIS,
1635 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1636 * See the License for the specific language governing permissions and
1637 * limitations under the License.
1638 */const br=new bc("@firebase/firestore");function Qr(){return br.logLevel}function K(n,...e){if(br.logLevel<=ce.DEBUG){const t=e.map(Uc);br.debug(`Firestore (${_s}): ${n}`,...t)}}function En(n,...e){if(br.logLevel<=ce.ERROR){const t=e.map(Uc);br.error(`Firestore (${_s}): ${n}`,...t)}}function Gt(n,...e){if(br.logLevel<=ce.WARN){const t=e.map(Uc);br.warn(`Firestore (${_s}): ${n}`,...t)}}function Uc(n){if(typeof n=="string")return n;try{return function(t){return JSON.stringify(t)}(n)}catch{return n}}/**
1639 * @license
1640 * Copyright 2017 Google LLC
1641 *
1642 * Licensed under the Apache License, Version 2.0 (the "License");
1643 * you may not use this file except in compliance with the License.
1644 * You may obtain a copy of the License at
1645 *
1646 *   http://www.apache.org/licenses/LICENSE-2.0
1647 *
1648 * Unless required by applicable law or agreed to in writing, software
1649 * distributed under the License is distributed on an "AS IS" BASIS,
1650 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1651 * See the License for the specific language governing permissions and
1652 * limitations under the License.
1653 */function X(n,e,t){let r="Unexpected state";typeof e=="string"?r=e:t=e,RC(n,r,t)}function RC(n,e,t){let r=`FIRESTORE (${_s}) INTERNAL ASSERTION FAILED: ${e} (ID: ${n.toString(16)})`;if(t!==void 0)try{r+=" CONTEXT: "+JSON.stringify(t)}catch{r+=" CONTEXT: "+t}throw En(r),new Error(r)}function W(n,e,t,r){let s="Unexpected state";typeof t=="string"?s=t:r=t,n||RC(e,s,r)}function re(n,e){return n}/**
1654 * @license
1655 * Copyright 2020 Google LLC
1656 *
1657 * Licensed under the Apache License, Version 2.0 (the "License");
1658 * you may not use this file except in compliance with the License.
1659 * You may obtain a copy of the License at
1660 *
1661 *   http://www.apache.org/licenses/LICENSE-2.0
1662 *
1663 * Unless required by applicable law or agreed to in writing, software
1664 * distributed under the License is distributed on an "AS IS" BASIS,
1665 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1666 * See the License for the specific language governing permissions and
1667 * limitations under the License.
1668 */function ay(n){const e=typeof self<"u"&&(self.crypto||self.msCrypto),t=new Uint8Array(n);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<n;r++)t[r]=Math.floor(256*Math.random());return t}/**
1669 * @license
1670 * Copyright 2017 Google LLC
1671 *
1672 * Licensed under the Apache License, Version 2.0 (the "License");
1673 * you may not use this file except in compliance with the License.
1674 * You may obtain a copy of the License at
1675 *
1676 *   http://www.apache.org/licenses/LICENSE-2.0
1677 *
1678 * Unless required by applicable law or agreed to in writing, software
1679 * distributed under the License is distributed on an "AS IS" BASIS,
1680 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1681 * See the License for the specific language governing permissions and
1682 * limitations under the License.
1683 */class Hc{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(4.129032258064516);let r="";for(;r.length<20;){const s=ay(40);for(let i=0;i<s.length;++i)r.length<20&&s[i]<t&&(r+=e.charAt(s[i]%62))}return r}}function ae(n,e){return n<e?-1:n>e?1:0}function ac(n,e){const t=Math.min(n.length,e.length);for(let r=0;r<t;r++){const s=n.charAt(r),i=e.charAt(r);if(s!==i)return FB(s)===FB(i)?ae(s,i):FB(s)?1:-1}return ae(n.length,e.length)}const By=55296,cy=57343;function FB(n){const e=n.charCodeAt(0);return e>=By&&e<=cy}function os(n,e,t){return n.length===e.length&&n.every((r,s)=>t(r,e[s]))}/**
1684 * @license
1685 * Copyright 2017 Google LLC
1686 *
1687 * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 9,433 bytes, lines 1688-1738
1688 * you may not use this file except in compliance with the License.
1689 * You may obtain a copy of the License at
1690 *
1691 *   http://www.apache.org/licenses/LICENSE-2.0
1692 *
1693 * Unless required by applicable law or agreed to in writing, software
1694 * distributed under the License is distributed on an "AS IS" BASIS,
1695 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1696 * See the License for the specific language governing permissions and
1697 * limitations under the License.
1698 */class ve{constructor(e,t){this.comparator=e,this.root=t||Ke.EMPTY}insert(e,t){return new ve(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,Ke.BLACK,null,null))}remove(e){return new ve(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Ke.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const r=this.comparator(e,t.key);if(r===0)return t.value;r<0?t=t.left:r>0&&(t=t.right)}return null}indexOf(e){let t=0,r=this.root;for(;!r.isEmpty();){const s=this.comparator(e,r.key);if(s===0)return t+r.left.size;s<0?r=r.left:(t+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,r)=>(e(t,r),!1))}toString(){const e=[];return this.inorderTraversal((t,r)=>(e.push(`${t}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new _o(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new _o(this.root,e,this.comparator,!1)}getReverseIterator(){return new _o(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new _o(this.root,e,this.comparator,!0)}}class _o{constructor(e,t,r,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?r(e.key,t):1,t&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class Ke{constructor(e,t,r,s,i){this.key=e,this.value=t,this.color=r??Ke.RED,this.left=s??Ke.EMPTY,this.right=i??Ke.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,s,i){return new Ke(e??this.key,t??this.value,r??this.color,s??this.left,i??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,r){let s=this;const i=r(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,t,r),null):i===0?s.copy(null,t,null,null,null):s.copy(null,null,null,null,s.right.insert(e,t,r)),s.fixUp()}removeMin(){if(this.left.isEmpty())return Ke.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let r,s=this;if(t(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,t),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),t(e,s.key)===0){if(s.right.isEmpty())return Ke.EMPTY;r=s.right.min(),s=s.copy(r.key,r.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,t))}return s.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,Ke.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,Ke.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw X(43730,{key:this.key,value:this.value});if(this.right.isRed())throw X(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw X(27949);return e+(this.isRed()?0:1)}}Ke.EMPTY=null,Ke.RED=!0,Ke.BLACK=!1;Ke.EMPTY=new class{constructor(){this.size=0}get key(){throw X(57766)}get value(){throw X(16141)}get color(){throw X(16727)}get left(){throw X(29726)}get right(){throw X(36894)}copy(e,t,r,s,i){return this}insert(e,t,r){return new Ke(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/**
1699 * @license
1700 * Copyright 2017 Google LLC
1701 *
1702 * Licensed under the Apache License, Version 2.0 (the "License");
1703 * you may not use this file except in compliance with the License.
1704 * You may obtain a copy of the License at
1705 *
1706 *   http://www.apache.org/licenses/LICENSE-2.0
1707 *
1708 * Unless required by applicable law or agreed to in writing, software
1709 * distributed under the License is distributed on an "AS IS" BASIS,
1710 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1711 * See the License for the specific language governing permissions and
1712 * limitations under the License.
1713 */class Ve{constructor(e){this.comparator=e,this.data=new ve(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,r)=>(e(t),!1))}forEachInRange(e,t){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const s=r.getNext();if(this.comparator(s.key,e[1])>=0)return;t(s.key)}}forEachWhile(e,t){let r;for(r=t!==void 0?this.data.getIteratorFrom(t):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new rf(this.data.getIterator())}getIteratorFrom(e){return new rf(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(r=>{t=t.add(r)}),t}isEqual(e){if(!(e instanceof Ve)||this.size!==e.size)return!1;const t=this.data.getIterator(),r=e.data.getIterator();for(;t.hasNext();){const s=t.getNext().key,i=r.getNext().key;if(this.comparator(s,i)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(t=>{e.push(t)}),e}toString(){const e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){const t=new Ve(this.comparator);return t.data=e,t}}class rf{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
1714 * @license
1715 * Copyright 2017 Google LLC
1716 *
1717 * Licensed under the Apache License, Version 2.0 (the "License");
1718 * you may not use this file except in compliance with the License.
1719 * You may obtain a copy of the License at
1720 *
1721 *   http://www.apache.org/licenses/LICENSE-2.0
1722 *
1723 * Unless required by applicable law or agreed to in writing, software
1724 * distributed under the License is distributed on an "AS IS" BASIS,
1725 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1726 * See the License for the specific language governing permissions and
1727 * limitations under the License.
1728 */const L={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class G extends kt{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
1729 * @license
1730 * Copyright 2017 Google LLC
1731 *
1732 * Licensed under the Apache License, Version 2.0 (the "License");
1733 * you may not use this file except in compliance with the License.
1734 * You may obtain a copy of the License at
1735 *
1736 *   http://www.apache.org/licenses/LICENSE-2.0
1737 *
1738 * Unless required by applicable law or agreed to in writing, softw
1738are
1739 * distributed under the License is distributed on an "AS IS" BASIS,
1740 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1741 * See the License for the specific language governing permissions and
1742 * limitations under the License.
1743 */const Kt="__name__";class jt{constructor(e,t,r){t===void 0?t=0:t>e.length&&X(637,{offset:t,range:e.length}),r===void 0?r=e.length-t:r>e.length-t&&X(1746,{length:r,range:e.length-t}),this.segments=e,this.offset=t,this.len=r}get length(){return this.len}isEqual(e){return jt.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof jt?e.forEach(r=>{t.push(r)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,r=this.limit();t<r;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const r=Math.min(e.length,t.length);for(let s=0;s<r;s++){const i=jt.compareSegments(e.get(s),t.get(s));if(i!==0)return i}return ae(e.length,t.length)}static compareSegments(e,t){const r=jt.isNumericId(e),s=jt.isNumericId(t);return r&&!s?-1:!r&&s?1:r&&s?jt.extractNumericId(e).compare(jt.extractNumericId(t)):ac(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Hn.fromString(e.substring(4,e.length-2))}}class Ce extends jt{construct(e,t,r){return new Ce(e,t,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toStringWithLeadingSlash(){return`/${this.canonicalString()}`}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const r of e){if(r.indexOf("//")>=0)throw new G(L.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);t.push(...r.split("/").filter(s=>s.length>0))}return new Ce(t)}static emptyPath(){return new Ce([])}}const uy=/^[_a-zA-Z][_a-zA-Z0-9]*$/;let At=class Yr extends jt{construct(e,t,r){return new Yr(e,t,r)}static isValidIdentifier(e){return uy.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Yr.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===Kt}static keyField(){return new Yr([Kt])}static fromServerFormat(e){const t=[];let r="",s=0;const i=()=>{if(r.length===0)throw new G(L.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(r),r=""};let o=!1;for(;s<e.length;){const B=e[s];if(B==="\\"){if(s+1===e.length)throw new G(L.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const c=e[s+1];if(c!=="\\"&&c!=="."&&c!=="`")throw new G(L.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=c,s+=2}else B==="`"?(o=!o,s++):B!=="."||o?(r+=B,s++):(i(),s++)}if(i(),o)throw new G(L.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new Yr(t)}static emptyPath(){return new Yr([])}};/**
1744 * @license
1745 * Copyright 2020 Google LLC
1746 *
1747 * Licensed under the Apache License, Version 2.0 (the "License");
1748 * you may not use this file except in compliance with the License.
1749 * You may obtain a copy of the License at
1750 *
1751 *   http://www.apache.org/licenses/LICENSE-2.0
1752 *
1753 * Unless required by applicable law or agreed to in writing, software
1754 * distributed under the License is distributed on an "AS IS" BASIS,
1755 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1756 * See the License for the specific language governing permissions and
1757 * limitations under the License.
1758 */class yt{constructor(e){this.fields=e,e.sort(At.comparator)}static empty(){return new yt([])}unionWith(e){let t=new Ve(At.comparator);for(const r of this.fields)t=t.add(r);for(const r of e)t=t.add(r);return new yt(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return os(this.fields,e.fields,(t,r)=>t.isEqual(r))}}/**
1759 * @license
1760 * Copyright 2017 Google LLC
1761 *
1762 * Licensed under the Apache License, Version 2.0 (the "License");
1763 * you may not use this file except in compliance with the License.
1764 * You may obtain a copy of the License at
1765 *
1766 *   http://www.apache.org/licenses/LICENSE-2.0
1767 *
1768 * Unless required by applicable law or agreed to in writing, software
1769 * distributed under the License is distributed on an "AS IS" BASIS,
1770 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1771 * See the License for the specific language governing permissions and
1772 * limitations under the License.
1773 */function Qo(n){let e=0;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e++;return e}function ir(n,e){for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])}function ly(n,e){const t=[];for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.push(e(n[r],r,n));return t}function vC(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}/**
1774 * @license
1775 * Copyright 2017 Google LLC
1776 *
1777 * Licensed under the Apache License, Version 2.0 (the "License");
1778 * you may not use this file except in compliance with the License.
1779 * You may obtain a copy of the License at
1780 *
1781 *   http://www.apache.org/licenses/LICENSE-2.0
1782 *
1783 * Unless required by applicable law or agreed to in writing, software
1784 * distributed under the License is distributed on an "AS IS" BASIS,
1785 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1786 * See the License for the specific language governing permissions and
1787 * limitations under the License.
1788 */class Q{constructor(e){this.path=e}static fromPath(e){return new Q(Ce.fromString(e))}static fromName(e){return new Q(Ce.fromString(e).popFirst(5))}static empty(){return new Q(Ce.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&Ce.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return Ce.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new Q(new Ce(e.slice()))}}/**
1789 * @license
1790 * Copyright 2017 Google LLC
1791 *
1792 * Licensed under the Apache License, Version 2.0 (the "License");
1793 * you may not use this file except in compliance with the License.
1794 * You may obtain a copy of the License at
1795 *
1796 *   http://www.apache.org/licenses/LICENSE-2.0
1797 *
1798 * Unless required by applicable law or agreed to in writing, software
1799 * distributed under the License is distributed on an "AS IS" BASIS,
1800 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1801 * See the License for the specific language governing permissions and
1802 * limitations under the License.
1803 */function bC(n,e,t){if(!t)throw new G(L.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function hy(n,e,t,r){if(e===!0&&r===!0)throw new G(L.INVALID_ARGUMENT,`${n} and ${t} cannot be used together.`)}function sf(n){if(!Q.isDocumentKey(n))throw new G(L.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function of(n){if(Q.isDocumentKey(n))throw new G(L.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function Vi(n){return typeof n=="object"&&n!==null&&(Object.getPrototypeOf(n)===Object.prototype||Object.getPrototypeOf(n)===null)}function Ia(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return n.length>20&&(n=`${n.substring(0,20)}...`),JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return""+n;if(typeof n=="object"){if(n instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(n);return e?`a custom ${e} object`:"an object"}}return typeof n=="function"?"a function":X(12329,{type:typeof n})}function He(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new G(L.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=Ia(n);throw new G(L.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return n}function fy(n,e){if(e<=0)throw new G(L.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}/**
1804 * @license
1805 * Copyright 2025 Google LLC
1806 *
1807 * Licensed under the Apache License, Version 2.0 (the "License");
1808 * you may not use this file except in compliance with the License.
1809 * You may obtain a copy of the License at
1810 *
1811 *   http://www.apache.org/licenses/LICENSE-2.0
1812 *
1813 * Unless required by applicable law or agreed to in writing, software
1814 * distributed under the License is distributed on an "AS IS" BASIS,
1815 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1816 * See the License for the specific language governing permissions and
1817 * limitations under the License.
1818 */function ke(n,e){const t={typeString:n};return e&&(t.value=e),t}function xi(n,e){if(!Vi(n))throw new G(L.INVALID_ARGUMENT,"JSON must be an object");let t;for(const r in e)if(e[r]){const s=e[r].typeString,i="value"in e[r]?{value:e[r].value}:void 0;if(!(r in n)){t=`JSON missing required field: '${r}'`;break}const o=n[r];if(s&&typeof o!==s){t=`JSON field '${r}' must be a ${s}.`;break}if(i!==void 0&&o!==i.value){t=`Expected '${r}' field to equal '${i.value}'`;break}}if(t)throw new G(L.INVALID_ARGUMENT,t);return!0}/**
1819 * @license
1820 * Copyright 2017 Google LLC
1821 *
1822 * Licensed under the Apache License, Version 2.0 (the "License");
1823 * you may not use this file except in compliance with the License.
1824 * You may obtain a copy of the License at
1825 *
1826 *   http://www.apache.org/licenses/LICENSE-2.0
1827 *
1828 * Unless required by applicable law or agreed to in writing, software
1829 * distributed under the License is distributed on an "AS IS" BASIS,
1830 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1831 * See the License for the specific language governing permissions and
1832 * limitations under the License.
1833 */const af=-62135596800,Bf=1e6;class ge{static now(){return ge.fromMillis(Date.now())}static fromDate(e){return ge.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),r=Math.floor((e-1e3*t)*Bf);return new ge(t,r)}static fromInstant(e){if(!e||typeof e.t!="bigint")throw new G(L.INVALID_ARGUMENT,"Invalid Temporal.Instant object provided.");
vendor: 4,596 bytes, lines 1833-1867
1833return ge._fromEpochNanoseconds(e.t)}static _fromEpochNanoseconds(e){let t,r;if(e>=0n)t=Number(e/1000000000n),r=Number(e%1000000000n);else{const s=e%1000000000n;s===0n?(t=Number(e/1000000000n),r=0):(t=Number(e/1000000000n-1n),r=Number(s+1000000000n))}return new ge(t,r)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new G(L.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new G(L.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<af)throw new G(L.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new G(L.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/Bf}toInstant(){if(typeof Temporal>"u"||!Temporal.Instant)throw new G(L.FAILED_PRECONDITION,"The Temporal object is not available in the current environment.");const e=1000000000n*BigInt(this.seconds)+BigInt(this.nanoseconds);return Temporal.Instant.__PRIVATE_fromEpochNanoseconds(e)}_compareTo(e){return this.seconds===e.seconds?ae(this.nanoseconds,e.nanoseconds):ae(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:ge._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(xi(e,ge._jsonSchema))return new ge(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-af;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}ge._jsonSchemaVersion="firestore/timestamp/1.0",ge._jsonSchema={type:ke("string",ge._jsonSchemaVersion),seconds:ke("number"),nanoseconds:ke("number")};/**
1834 * @license
1835 * Copyright 2023 Google LLC
1836 *
1837 * Licensed under the Apache License, Version 2.0 (the "License");
1838 * you may not use this file except in compliance with the License.
1839 * You may obtain a copy of the License at
1840 *
1841 *   http://www.apache.org/licenses/LICENSE-2.0
1842 *
1843 * Unless required by applicable law or agreed to in writing, software
1844 * distributed under the License is distributed on an "AS IS" BASIS,
1845 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1846 * See the License for the specific language governing permissions and
1847 * limitations under the License.
1848 */class SC extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
1849 * @license
1850 * Copyright 2020 Google LLC
1851 *
1852 * Licensed under the Apache License, Version 2.0 (the "License");
1853 * you may not use this file except in compliance with the License.
1854 * You may obtain a copy of the License at
1855 *
1856 *   http://www.apache.org/licenses/LICENSE-2.0
1857 *
1858 * Unless required by applicable law or agreed to in writing, software
1859 * distributed under the License is distributed on an "AS IS" BASIS,
1860 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1861 * See the License for the specific language governing permissions and
1862 * limitations under the License.
1863 */class xe{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new SC("Invalid base64 string: "+i):i}}(e);return new xe(t)}static fromUint8Array(e){const t=function(s){let i="";for(let o=0;o<s.length;++o)i+=String.fromCharCode(s[o]);return i}(e);return new xe(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(t){return btoa(t)}(this.binaryString)}toUint8Array(){return function(t){const r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return ae(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}xe.EMPTY_BYTE_STRING=new xe("");const dy=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Wn(n){if(W(!!n,39018),typeof n=="string"){let e=0;const t=dy.exec(n);if(W(!!t,46558,{timestamp:n}),t[1]){let s=t[1];s=(s+"000000000").substr(0,9),e=Number(s)}const r=new Date(n);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:Se(n.seconds),nanos:Se(n.nanos)}}function Se(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function $n(n){return typeof n=="string"?xe.fromBase64String(n):xe.fromUint8Array(n)}/**
1864 * @license
1865 * Copyright 2020 Google LLC
1866 *
1867 * Licensed under the Apache License, Version 2.0 (the "License");
1868 * you may not use this file except in compliance with the License.
1869 * You may obtain a copy of the License at
1870 *
1871 *   http://www.apache.org/licenses/LICENSE-2.0
1872 *
1873 * Unless required by applicable law or agreed to in writing, software
1874 * distributed under the License is distributed on an "AS IS" BASIS,
1875 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1876 * See the License for the specific language governing permissions and
1877 * limitations under the License.
1878 */const PC="server_timestamp",OC="__type__",NC="__previous_value__",FC="__local_write_time__";function Mi(n){var t,r;return((r=(((t=n==null?void 0:n.mapValue)==null?void 0:t.fields)||{})[OC])==null?void 0:r.stringValue)===PC}function Gi(n){const e=n.mapValue.fields[NC];return Mi(e)?Gi(e):e}function as(n){const e=Wn(n.mapValue.fields[FC].timestampValue);return new ge(e.seconds,e.nanos)}/**
1879 * @license
1880 * Copyright 2017 Google LLC
1881 *
1882 * Licensed under the Apache License, Version 2.0 (the "License");
1883 * you may not use this file except in compliance with the License.
1884 * You may obtain a copy of the License at
1885 *
1886 *   http://www.apache.org/licenses/LICENSE-2.0
1887 *
1888 * Unless required by applicable law or agreed to in writing, software
1889 * distributed under the License is distributed on an "AS IS" BASIS,
1890 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1891 * See the License for the specific language governing permissions and
1892 * limitations under the License.
1893 */class Cy{constructor(e,t,r,s,i,o,B,c,u,h,d,p,_){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=s,this.ssl=i,this.forceLongPolling=o,this.autoDetectLongPolling=B,this.longPollingOptions=c,this.useFetchStreams=u,this.isUsingEmulator=h,this.apiKey=d,this._customHeaders=p,this.grpcFlowControlWindow=_}}const Yo="(default)";class mi{constructor(e,t){this.projectId=e,this.database=t||Yo}static empty(){return new mi("","")}get isDefaultDatabase(){return this.database===Yo}isEqual(e){return e instanceof mi&&e.projectId===this.projectId&&e.database===this.database}}function py(n,e){if(!Object.prototype.hasOwnProperty.apply(n.options,["projectId"]))throw new G(L.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new mi(n.options.projectId,e)}/**
1894 * @license
1895 * Copyright 2017 Google LLC
1896 *
1897 * Licensed under the Apache License, Version 2.0 (the "License");
1898 * you may not use this file except in compliance with the License.
1899 * You may obtain a copy of the License at
1900 *
1901 *   http://www.apache.org/licenses/LICENSE-2.0
1902 *
1903 * Unless required by applicable law or agreed to in writing, software
1904 * distributed under the License is distributed on an "AS IS" BASIS,
1905 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1906 * See the License for the specific language governing permissions and
1907 * limitations under the License.
1908 */const qc=-1;function Ta(n){return n==null}function Ei(n){return n===0&&1/n==-1/0}function gy(n){return typeof n=="number"&&Number.isInteger(n)&&!Ei(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}function my(n){return typeof n=="string"}/**
1909 * @license
1910 * Copyright 2020 Google LLC
1911 *
1912 * Licensed under the Apache License, Version 2.0 (the "License");
1913 * you may not use this file except in compliance with the License.
1914 * You may obtain a copy of the License at
1915 *
1916 *   http://www.apache.org/licenses/LICENSE-2.0
1917 *
1918 * Unless required by applicable law or agreed to in writing, software
1919 * distributed under the License is distributed on an "AS IS" BASIS,
1920 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1921 * See the License for the specific language governing permissions and
1922 * limitations under the License.
1923 */const LC="__type__",Ey="__max__",Do={mapValue:{}},kC="__vector__",_i="value",Bs={nullValue:"NULL_VALUE"},gt={booleanValue:!0},je={booleanValue:!1};function Me(n){return"nullValue"in n?0:"booleanValue"in n?1:"integerValue"in n||"doubleValue"in n?2:"timestampValue"in n?3:"stringValue"in n?5:"bytesValue"in n?6:"referenceValue"in n?7:"geoPointValue"in n?8:"arrayValue"in n?9:"mapValue"in n?Mi(n)?4:_y(n)?9007199254740991:Zo(n)?10:11:X(28295,{value:n})}function Ft(n,e,t){if(n===e)return!0;const r=Me(n);if(r!==Me(e))return!1;switch(r){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return as(n).isEqual(as(e));case 3:return function(i,o){if(typeof i.timestampValue=="string"&&typeof o.timestampValue=="string"&&i.timestampValue.length===o.timestampValue.length)return i.timestampValue===o.timestampValue;const B=Wn(i.timestampValue),c=Wn(o.timestampValue);return B.seconds===c.seconds&&B.nanos===c.nanos}(n,e);case 5:return n.stringValue===e.stringValue;case 6:return function(i,o){return $n(i.bytesValue).isEqual($n(o.bytesValue))}(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return function(i,o){return Se(i.geoPointValue.latitude)===Se(o.geoPointValue.latitude)&&Se(i.geoPointValue.longitude)===Se(o.geoPointValue.longitude)}(n,e);case 2:return function(i,o,B){if("integerValue"in i&&"integerValue"in o)return Se(i.integerValue)===Se(o.integerValue);let c,u;if("doubleValue"in i&&"doubleValue"in o)c=Se(i.doubleValue),u=Se(o.doubleValue);else{if(!(B!=null&&B.i))return!1;c=Se(i.integerValue??i.doubleValue),u=Se(o.integerValue??o.doubleValue)}return c===u?!!(B!=null&&B.o)||Ei(c)===Ei(u):!!(B===void 0||B.u)&&isNaN(c)&&isNaN(u)}(n,e,t);case 9:return os(n.arrayValue.values||[],e.arrayValue.values||[],(s,i)=>Ft(s,i,t));case 10:case 11:return function(i,o,B){const c=i.mapValue.fields||{},u=o.mapValue.fields||{};if(Qo(c)!==Qo(u))return!1;for(const h in c)if(c.hasOwnProperty(h)&&(u[h]===void 0||!Ft(c[h],u[h],B)))return!1;return!0}(n,e,t);default:return X(52216,{left:n})}}function Di(n,e){return(n.values||[]).find(t=>Ft(t,e))!==void 0}function mt(n,e){if(n===e)return 0;const t=Me(n),r=Me(e);if(t!==r)return ae(t,r);switch(t){case 0:case 9007199254740991:return 0;case 1:return ae(n.booleanValue,e.booleanValue);case 2:return function(i,o){const B=Se(i.integerValue||i.doubleValue),c=Se(o.integerValue||o.doubleValue);return B<c?-1:B>c?1:B===c?0:isNaN(B)?isNaN(c)?0:-1:1}(n,e);case 3:return cf(n.timestampValue,e.timestampValue);case 4:return cf(as(n),as(e));case 5:return ac(n.stringValue,e.stringValue);case 6:return function(i,o){const B=$n(i),c=$n(o);return B.compareTo(c)}(n.bytesValue,e.bytesValue);case 7:return function(i,o){const B=i.split("/"),c=o.split("/");for(let u=0;u<B.length&&u<c.length;u++){const h=ae(B[u],c[u]);if(h!==0)return h}return ae(B.length,c.length)}(n.referenceValue,e.referenceValue);case 8:return function(i,o){const B=ae(Se(i.latitude),Se(o.latitude));return B!==0?B:ae(Se(i.longitude),Se(o.longitude))}(n.geoPointValue,e.geoPointValue);case 9:return uf(n.arrayValue,e.arrayValue);case 10:return function(i,o){var p,_,y,O;const B=i.fields||{},c=o.fields||{},u=(p=B[_i])==null?void 0:p.arrayValue,h=(_=c[_i])==null?void 0:_.arrayValue,d=ae(((y=u==null?void 0:u.values)==null?void 0:y.length)||0,((O=h==null?void 0:h.values)==null?void 0:O.length)||0);return d!==0?d:uf(u,h)}(n.mapValue,e.mapValue);case 11:return function(i,o){if(i===Do.mapValue&&o===Do.mapValue)return 0;if(i===Do.mapValue)return 1;if(o===Do.mapValue)return-1;const B=i.fields||{},c=Object.keys(B),u=o.fields||{},h=Object.keys(u);c.sort(),h.sort();for(let d=0;d<c.length&&d<h.length;++d){const p=ac(c[d],h[d]);if(p!==0)return p;const _=mt(B[c[d]],u[h[d]]);if(_!==0)return _}return ae(c.length,h.length)}(n.mapValue,e.mapValue);default:throw X(23264,{l:t})}}function cf(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return ae(n,e);const t=Wn(n),r=Wn(e),s=ae(t.seconds,r.seconds);return s!==0?s:ae(t.nanos,r.nanos)}function uf(n,e){const t=n.values||[],r=e.values||[];for(let s=0;s<t.length&&s<r.length;++s){const i=mt(t[s],r[s]);if(i!==void 0&&i!==0)return i}return ae(t.length,r.length)}function cs(n){return Bc(n)}function Bc(n){return"nullValue"in n?"null":"booleanValue"in n?""+n.booleanValue:"integerValue"in n?""+n.integerValue:"doubleValue"in n?""+n.doubleValue:"timestampValue"in n?function(t){const r=Wn(t);return`time(${r.seconds},${r.nanos})`}(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?function(t){return $n(t).toBase64()}(n.bytesValue):"referenceValue"in n?function(t){return Q.fromName(t).toString()}(n.referenceValue):"geoPointValue"in n?function(t){return`geo(${t.latitude},${t.longitude})`}(n.geoPointValue):"arrayValue"in n?function(t){let r="[",s=!0;for(const i of t.values||[])s?s=!1:r+=",",r+=Bc(i);return r+"]"}(n.arrayValue):"mapValue"in n?function(t){const r=Object.keys(t.fields||{}).sort();let s="{",i=!0;for(const o of r)i?i=!1:s+=",",s+=`${o}:${Bc(t.fields[o])}`;return s+"}"}(n.mapValue):X(61005,{value:n})}function Lo(n){switch(Me(n)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=Gi(n);return e?16+Lo(e):16;case 5:return 2*n.stringValue.length;case 6:return $n(n.bytesValue).approximateByteSize();case 7:return n.referenceValue.length;case 9:return function(r){return(r.values||[]).reduce((s,i)=>
1923s+Lo(i),0)}(n.arrayValue);case 10:case 11:return function(r){let s=0;return ir(r.fields,(i,o)=>{s+=i.length+Lo(o)}),s}(n.mapValue);default:throw X(13486,{value:n})}}function Xo(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function zt(n){return!!n&&"integerValue"in n}function mr(n){return!!n&&"doubleValue"in n}function Qn(n){return zt(n)||mr(n)}function us(n){return!!n&&"arrayValue"in n}function It(n){return!!n&&"nullValue"in n}function Et(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function wr(n){return!!n&&"mapValue"in n}function Zo(n){var t,r;return((r=(((t=n==null?void 0:n.mapValue)==null?void 0:t.fields)||{})[LC])==null?void 0:r.stringValue)===kC}function cc(n){var e,t;return(t=(((e=n==null?void 0:n.mapValue)==null?void 0:e.fields)||{})[_i])==null?void 0:t.arrayValue}function ii(n){if(n.geoPointValue)return{geoPointValue:{...n.geoPointValue}};if(n.timestampValue&&typeof n.timestampValue=="object")return{timestampValue:{...n.timestampValue}};if(n.mapValue){const e={mapValue:{fields:{}}};return ir(n.mapValue.fields,(t,r)=>e.mapValue.fields[t]=ii(r)),e}if(n.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(n.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=ii(n.arrayValue.values[t]);return e}return{...n}}function _y(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue===Ey}/**
1924 * @license
1925 * Copyright 2017 Google LLC
1926 *
1927 * Licensed under the Apache License, Version 2.0 (the "License");
1928 * you may not use this file except in compliance with the License.
1929 * You may obtain a copy of the License at
1930 *
1931 *   http://www.apache.org/licenses/LICENSE-2.0
1932 *
1933 * Unless required by applicable law or agreed to in writing, software
1934 * distributed under the License is distributed on an "AS IS" BASIS,
1935 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1936 * See the License for the specific language governing permissions and
1937 * limitations under the License.
1938 */class ot{constructor(e){this.value=e}static empty(){return new ot({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let r=0;r<e.length-1;++r)if(t=(t.mapValue.fields||{})[e.get(r)],!wr(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=ii(t)}setAll(e){let t=At.emptyPath(),r={},s=[];e.forEach((o,B)=>{if(!t.isImmediateParentOf(B)){const c=this.getFieldsMap(t);this.applyChanges(c,r,s),r={},s=[],t=B.popLast()}o?r[B.lastSegment()]=ii(o):s.push(B.lastSegment())});const i=this.getFieldsMap(t);this.applyChanges(i,r,s)}delete(e){const t=this.field(e.popLast());wr(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Ft(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let r=0;r<e.length;++r){let s=t.mapValue.fields[e.get(r)];wr(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,r){ir(t,(s,i)=>e[s]=i);for(const s of r)delete e[s]}clone(){return new ot(ii(this.value))}}function VC(n){const e=[];return ir(n.fields,(t,r)=>{const s=new At([t]);if(wr(r)){const i=VC(r.mapValue).fields;
vendor: 5,242 bytes, lines 1938-1983
1938if(i.length===0)e.push(s);else for(const o of i)e.push(s.child(o))}else e.push(s)}),new yt(e)}/**
1939 * @license
1940 * Copyright 2020 Google LLC
1941 *
1942 * Licensed under the Apache License, Version 2.0 (the "License");
1943 * you may not use this file except in compliance with the License.
1944 * You may obtain a copy of the License at
1945 *
1946 *   http://www.apache.org/licenses/LICENSE-2.0
1947 *
1948 * Unless required by applicable law or agreed to in writing, software
1949 * distributed under the License is distributed on an "AS IS" BASIS,
1950 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1951 * See the License for the specific language governing permissions and
1952 * limitations under the License.
1953 */function Aa(n,e){if(n.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Ei(e)?"-0":e}}function Jc(n){return{integerValue:""+n}}function jc(n,e,t){return gy(e)?Jc(e):Aa(n,e)}/**
1954 * @license
1955 * Copyright 2018 Google LLC
1956 *
1957 * Licensed under the Apache License, Version 2.0 (the "License");
1958 * you may not use this file except in compliance with the License.
1959 * You may obtain a copy of the License at
1960 *
1961 *   http://www.apache.org/licenses/LICENSE-2.0
1962 *
1963 * Unless required by applicable law or agreed to in writing, software
1964 * distributed under the License is distributed on an "AS IS" BASIS,
1965 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1966 * See the License for the specific language governing permissions and
1967 * limitations under the License.
1968 */class Ra{constructor(){this._=void 0}}function Dy(n,e,t){return n instanceof wi?function(s,i){const o={fields:{[OC]:{stringValue:PC},[FC]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&Mi(i)&&(i=Gi(i)),i&&(o.fields[NC]=i),{mapValue:o}}(t,e):n instanceof ls?MC(n,e):n instanceof hs?GC(n,e):n instanceof yi?function(s,i){const o=xC(s,i),B=na(o)+na(s.h);return zt(o)&&zt(s.h)?Jc(B):Aa(s.serializer,B)}(n,e):n instanceof ea?function(s,i){return lf(s,i,Math.min)}(n,e):n instanceof ta?function(s,i){return lf(s,i,Math.max)}(n,e):void 0}function wy(n,e,t){return n instanceof ls?MC(n,e):n instanceof hs?GC(n,e):t}function xC(n,e){return n instanceof yi?Qn(e)?e:{integerValue:0}:null}class wi extends Ra{}class ls extends Ra{constructor(e){super(),this.elements=e}}function MC(n,e){const t=UC(e);for(const r of n.elements)t.some(s=>Ft(s,r))||t.push(r);return{arrayValue:{values:t}}}class hs extends Ra{constructor(e){super(),this.elements=e}}function GC(n,e){let t=UC(e);for(const r of n.elements)t=t.filter(s=>!Ft(s,r));return{arrayValue:{values:t}}}class Kc extends Ra{constructor(e,t){super(),this.serializer=e,this.h=t}}class yi extends Kc{}class ea extends Kc{}class ta extends Kc{}function lf(n,e,t){if(!Qn(e))return n.h;const r=t(na(e),na(n.h));return zt(e)&&zt(n.h)?Jc(r):Aa(n.serializer,r)}function na(n){return Se(n.integerValue||n.doubleValue)}function UC(n){return us(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}/**
1969 * @license
1970 * Copyright 2017 Google LLC
1971 *
1972 * Licensed under the Apache License, Version 2.0 (the "License");
1973 * you may not use this file except in compliance with the License.
1974 * You may obtain a copy of the License at
1975 *
1976 *   http://www.apache.org/licenses/LICENSE-2.0
1977 *
1978 * Unless required by applicable law or agreed to in writing, software
1979 * distributed under the License is distributed on an "AS IS" BASIS,
1980 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1981 * See the License for the specific language governing permissions and
1982 * limitations under the License.
1983 */class zc{constructor(e,t){this.field=e,this.transform=t}}function yy(n,e){return n.field.isEqual(e.field)&&function(r,s){return r instanceof ls&&s instanceof ls||r instanceof hs&&s instanceof hs?os(r.elements,s.elements,Ft):r instanceof yi&&s instanceof yi||r instanceof ea&&s instanceof ea||r instanceof ta&&s instanceof ta?Ft(r.h,s.h):r instanceof wi&&s instanceof wi}(n.transform,e.transform)}class Iy{constructor(e,t){this.version=e,this.transformResults=t}}class Bt{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Bt}static exists(e){return new Bt(void 0,e)}static updateTime(e){return new Bt(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function ko(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}class va{}function HC(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new ba(n.key,Bt.none()):new Ui(n.key,n.data,Bt.none());{const t=n.data,r=ot.empty();let s=new Ve(At.comparator);for(let i of e.fields)if(!s.has(i)){let o=t.field(i);o===null&&i.length>1&&(i=i.popLast(),o=t.field(i)),o===null?r.delete(i):r.set(i,o),s=s.add(i)}return new or(n.key,r,new yt(s.toArray()),Bt.none())}}function Ty(n,e,t){n instanceof Ui?function(s,i,o){const B=s.value.clone(),c=ff(s.fieldTransforms,i,o.transformResults);B.setAll(c),i.convertToFoundDocument(o.version,B).setHasCommittedMutations()}
1983(n,e,t):n instanceof or?function(s,i,o){if(!ko(s.precondition,i))return void i.convertToUnknownDocument(o.version);const B=ff(s.fieldTransforms,i,o.transformResults),c=i.data;c.setAll(qC(s)),c.setAll(B),i.convertToFoundDocument(o.version,c).setHasCommittedMutations()}(n,e,t):function(s,i,o){i.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,t)}function oi(n,e,t,r){return n instanceof Ui?function(i,o,B,c){if(!ko(i.precondition,o))return B;const u=i.value.clone(),h=df(i.fieldTransforms,c,o);return u.setAll(h),o.convertToFoundDocument(o.version,u).setHasLocalMutations(),null}(n,e,t,r):n instanceof or?function(i,o,B,c){if(!ko(i.precondition,o))return B;const u=df(i.fieldTransforms,c,o),h=o.data;return h.setAll(qC(i)),h.setAll(u),o.convertToFoundDocument(o.version,h).setHasLocalMutations(),B===null?null:B.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(d=>d.field))}(n,e,t,r):function(i,o,B){return ko(i.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):B}(n,e,t)}function Ay(n,e){let t=null;for(const r of n.fieldTransforms){const s=e.data.field(r.field),i=xC(r.transform,s||null);i!=null&&(t===null&&(t=ot.empty()),t.set(r.field,i))}return t||null}function hf(n,e){return n.type===e.type&&!!n.key.isEqual(e.key)&&!!n.precondition.isEqual(e.precondition)&&!!function(r,s){return r===void 0&&s===void 0||!(!r||!s)&&os(r,s,(i,o)=>yy(i,o))}(n.fieldTransforms,e.fieldTransforms)&&(n.type===0?n.value.isEqual(e.value):n.type!==1||n.data.isEqual(e.data)&&n.fieldMask.isEqual(e.fieldMask))}class Ui extends va{constructor(e,t,r,s=[]){super(),this.key=e,this.value=t,this.precondition=r,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class or extends va{constructor(e,t,r,s,i=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function qC(n){const e=new Map;return n.fieldMask.fields.forEach(t=>{if(!t.isEmpty()){const r=n.data.field(t);e.set(t,r)}}),e}function ff(n,e,t){const r=new Map;W(n.length===t.length,32656,{T:t.length,P:n.length});for(let s=0;s<t.length;s++){const i=n[s],o=i.transform,B=e.data.field(i.field);r.set(i.field,wy(o,B,t[s]))}return r}function df(n,e,t){const r=new Map;for(const s of n){const i=s.transform,o=t.data.field(s.field);r.set(s.field,Dy(i,o,e))}return r}class ba extends va{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Ry extends va{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
1984 * @license
1985 * Copyright 2022 Google LLC
1986 *
1987 * Licensed under the Apache License, Version 2.0 (the "License");
1988 * you may not use this file except in compliance with the License.
1989 * You may obtain a copy of the License at
1990 *
1991 *   http://www.apache.org/licenses/LICENSE-2.0
1992 *
1993 * Unless required by applicable law or agreed to in writing, software
1994 * distributed under the License is distributed on an "AS IS" BASIS,
1995 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1996 * See the License for the specific language governing permissions and
1997 * limitations under the License.
1998 */class fs{constructor(e,t){this.position=e,this.inclusive=t}}function Cf(n,e,t){let r=0;for(let s=0;s<n.position.length;s++){const i=e[s],o=n.position[s];if(i.field.isKeyField()?r=Q.comparator(Q.fromName(o.referenceValue),t.key):r=mt(o,t.data.field(i.field)),i.dir==="desc"&&(r*=-1),r!==0)break}return r}function pf(n,e){if(n===null)return e===null;if(e===null||n.inclusive!==e.inclusive||n.position.length!==e.position.length)return!1;for(let t=0;t<n.position.length;t++)if(!Ft(n.position[t],e.position[t]))return!1;return!0}/**
1999 * @license
2000 * Copyright 2022 Google LLC
2001 *
2002 * Licensed under the Apache License, Version 2.0 (the "License");
2003 * you may not use this file except in compliance with the License.
2004 * You may obtain a copy of the License at
2005 *
2006 *   http://www.apache.org/licenses/LICENSE-2.0
2007 *
2008 * Unless required by applicable law or agreed to in writing, softw
2008are
2009 * distributed under the License is distributed on an "AS IS" BASIS,
2010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2011 * See the License for the specific language governing permissions and
2012 * limitations under the License.
2013 */class JC{}class Le extends JC{constructor(e,t,r){super(),this.field=e,this.op=t,this.value=r}static create(e,t,r){return e.isKeyField()?t==="in"||t==="not-in"?this.createKeyFieldInFilter(e,t,r):new by(e,t,r):t==="array-contains"?new Oy(e,r):t==="in"?new Ny(e,r):t==="not-in"?new Fy(e,r):t==="array-contains-any"?new Ly(e,r):new Le(e,t,r)}static createKeyFieldInFilter(e,t,r){return t==="in"?new Sy(e,r):new Py(e,r)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&t.nullValue===void 0&&this.matchesComparison(mt(t,this.value)):t!==null&&Me(this.value)===Me(t)&&this.matchesComparison(mt(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return X(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Ut extends JC{constructor(e,t){super(),this.filters=e,this.op=t,this.I=null}static create(e,t){return new Ut(e,t)}matches(e){return jC(this)?this.filters.find(t=>!t.matches(e))===void 0:this.filters.find(t=>t.matches(e))!==void 0}getFlattenedFilters(){return this.I!==null||(this.I=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.I}getFilters(){return Object.assign([],this.filters)}}function jC(n){return n.op==="and"}function KC(n){return vy(n)&&jC(n)}function vy(n){for(const e of n.filters)if(e instanceof Ut)return!1;return!0}function uc(n){if(n instanceof Le)return n.field.canonicalString()+n.op.toString()+cs(n.value);if(KC(n))return n.filters.map(e=>uc(e)).join(",");{const e=n.filters.map(t=>uc(t)).join(",");return`${n.op}(${e})`}}function zC(n,e){return n instanceof Le?function(r,s){return s instanceof Le&&r.op===s.op&&r.field.isEqual(s.field)&&Ft(r.value,s.value)}(n,e):n instanceof Ut?function(r,s){return s instanceof Ut&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,o,B)=>i&&zC(o,s.filters[B]),!0):!1}(n,e):void X(19439)}function WC(n){return n instanceof Le?function(t){return`${t.field.canonicalString()} ${t.op} ${cs(t.value)}`}(n):n instanceof Ut?function(t){return t.op.toString()+" {"+t.getFilters().map(WC).join(" ,")+"}"}(n):"Filter"}class by extends Le{constructor(e,t,r){super(e,t,r),this.key=Q.fromName(r.referenceValue)}matches(e){const t=Q.comparator(e.key,this.key);return this.matchesComparison(t)}}class Sy extends Le{constructor(e,t){super(e,"in",t),this.keys=$C("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class Py extends Le{constructor(e,t){super(e,"not-in",t),this.keys=$C("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function $C(n,e){var t;return(((t=e.arrayValue)==null?void 0:t.values)||[]).map(r=>Q.fromName(r.referenceValue))}class Oy extends Le{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return us(t)&&Di(t.arrayValue,this.value)}}class Ny extends Le{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&Di(this.value.arrayValue,t)}}class Fy extends Le{constructor(e,t){super(e,"not-in",t)}matches(e){if(Di(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&t.nullValue===void 0&&!Di(this.value.arrayValue,t)}}class Ly extends Le{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!us(t)||!t.arrayValue.values)&&t.arrayValue.values.some(r=>Di(this.value.arrayValue,r))}}/**
2014 * @license
2015 * Copyright 2022 Google LLC
2016 *
2017 * Licensed under the Apache License, Version 2.0 (the "License");
2018 * you may not use this file except in compliance with the License.
2019 * You may obtain a copy of the License at
2020 *
2021 *   http://www.apache.org/licenses/LICENSE-2.0
2022 *
2023 * Unless required by applicable law or agreed to in writing, softw
2023are
2024 * distributed under the License is distributed on an "AS IS" BASIS,
2025 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2026 * See the License for the specific language governing permissions and
2027 * limitations under the License.
2028 */class Ii{constructor(e,t="asc"){this.field=e,this.dir=t}}function ky(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}/**
2029 * @license
2030 * Copyright 2017 Google LLC
2031 *
2032 * Licensed under the Apache License, Version 2.0 (the "License");
2033 * you may not use this file except in compliance with the License.
2034 * You may obtain a copy of the License at
2035 *
2036 *   http://www.apache.org/licenses/LICENSE-2.0
2037 *
2038 * Unless required by applicable law or agreed to in writing, software
2039 * distributed under the License is distributed on an "AS IS" BASIS,
2040 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2041 * See the License for the specific language governing permissions and
2042 * limitations under the License.
2043 */class ne{static fromTimestamp(e){return new ne(e)}static min(){return new ne(new ge(0,0))}static max(){return new ne(new ge(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
2044 * @license
2045 * Copyright 2017 Google LLC
2046 *
2047 * Licensed under the Apache License, Version 2.0 (the "License");
2048 * you may not use this file except in compliance with the License.
2049 * You may obtain a copy of the License at
2050 *
2051 *   http://www.apache.org/licenses/LICENSE-2.0
2052 *
2053 * Unless required by applicable law or agreed to in writing, software
2054 * distributed under the License is distributed on an "AS IS" BASIS,
2055 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2056 * See the License for the specific language governing permissions and
2057 * limitations under the License.
2058 */class Ye{constructor(e,t,r,s,i,o,B){this.key=e,this.documentType=t,this.version=r,this.readTime=s,this.createTime=i,this.data=o,this.documentState=B}static newInvalidDocument(e){return new Ye(e,0,ne.min(),ne.min(),ne.min(),ot.empty(),0)}static newFoundDocument(e,t,r,s){return new Ye(e,1,t,ne.min(),r,s,0)}static newNoDocument(e,t){return new Ye(e,2,t,ne.min(),ne.min(),ot.empty(),0)}static newUnknownDocument(e,t){return new Ye(e,3,t,ne.min(),ne.min(),ot.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(ne.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=ot.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=ot.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ne.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof Ye&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new Ye(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/**
2059 * @license
2060 * Copyright 2021 Google LLC
2061 *
2062 * Licensed under the Apache License, Version 2.0 (the "License");
2063 * you may not use this file except in compliance with the License.
2064 * You may obtain a copy of the License at
2065 *
2066 *   http://www.apache.org/licenses/LICENSE-2.0
2067 *
2068 * Unless required by applicable law or agreed to in writing, software
2069 * distributed under the License is distributed on an "AS IS" BASIS,
2070 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2071 * See the License for the specific language governing permissions and
2072 * limitations under the License.
2073 */const Ti=-1;function Vy(n,e){const t=n.toTimestamp().seconds,r=n.toTimestamp().nanoseconds+1,s=ne.fromTimestamp(r===1e9?new ge(t+1,0):new ge(t,r));return new Yn(s,Q.empty(),e)}function xy(n){return new Yn(n.readTime,n.key,Ti)}class Yn{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new Yn(ne.min(),Q.empty(),Ti)}static max(){return new Yn(ne.max(),Q.empty(),Ti)}}function My(n,e){let t=n.readTime.compareTo(e.readTime);return t!==0?t:(t=Q.comparator(n.documentKey,e.documentKey),t!==0?t:ae(n.largestBatchId,e.largestBatchId))}/**
2074 * @license
2075 * Copyright 2019 Google LLC
2076 *
2077 * Licensed under the Apache License, Version 2.0 (the "License");
2078 * you may not use this file except in compliance with the License.
2079 * You may obtain a copy of the License at
2080 *
2081 *   http://www.apache.org/licenses/LICENSE-2.0
2082 *
2083 * Unless required by applicable law or agreed to in writing, software
2084 * distributed under the License is distributed on an "AS IS" BASIS,
2085 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2086 * See the License for the specific language governing permissions and
2087 * limitations under the License.
2088 */class Gy{constructor(e,t=null,r=[],s=[],i=null,o=null,B=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=o,this.endAt=B,this.R=null}}function gf(n,e=null,t=[],r=[],s=null,i=null,o=null){return new Gy(n,e,t,r,s,i,o)}function QC(n){const e=re(n);if(e.R===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(r=>uc(r)).join(","),t+="|ob:",t+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),Ta(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(r=>cs(r)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(r=>cs(r)).join(",")),e.R=t}return e.R}function YC(n,e){if(n.limit!==e.limit||n.orderBy.length!==e.orderBy.length)return!1;for(let t=0;t<n.orderBy.length;t++)if(!ky(n.orderBy[t],e.orderBy[t]))return!1;if(n.filters.length!==e.filters.length)return!1;for(let t=0;t<n.filters.length;t++)if(!zC(n.filters[t],e.filters[t]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!pf(n.startAt,e.startAt)&&pf(n.endAt,e.endAt)}function Cr(n){return!!n.isCorePipeline}function XC(n){return!!n.path&&Q.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}/**
2089 * @license
2090 * Copyright 2017 Google LLC
2091 *
2092 * Licensed under the Apache License, Version 2.0 (the "License");
2093 * you may not use this file except in compliance with the License.
2094 * You may obtain a copy of the License at
2095 *
2096 *   http://www.apache.org/licenses/LICENSE-2.0
2097 *
2098 * Unless required by applicable law or agreed to in writing, software
2099 * distributed under the License is distributed on an "AS IS" BASIS,
2100 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2101 * See the License for the specific language governing permissions and
2102 * limitations under the License.
2103 */class xr{constructor(e,t=null,r=[],s=[],i=null,o="F",B=null,c=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=s,this.limit=i,this.limitType=o,this.startAt=B,this.endAt=c,this.A=null,this.V=null,this.m=null,this.startAt,this.endAt}}function Uy(n,e,t,r,s,i,o,B){return new xr(n,e,t,r,s,i,o,B)}function Sa(n){return new xr(n)}function mf(n){return n.filters.length===0&&n.limit===null&&n.startAt==null&&n.endAt==null&&(n.explicitOrderBy.length===0||n.explicitOrderBy.length===1&&n.explicitOrderBy[0].field.isKeyField())}function Hy(n){return Q.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}function Wc(n){return n.collectionGroup!==null}function ss(n){const e=re(n);if(e.A===null){e.A=[];const t=new Set;for(const i of e.explicitOrderBy)e.A.push(i),t.add(i.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let B=new Ve(At.comparator);
2103return o.filters.forEach(c=>{c.getFlattenedFilters().forEach(u=>{u.isInequality()&&(B=B.add(u.field))})}),B})(e).forEach(i=>{t.has(i.canonicalString())||i.isKeyField()||e.A.push(new Ii(i,r))}),t.has(At.keyField().canonicalString())||e.A.push(new Ii(At.keyField(),r))}return e.A}function Qt(n){const e=re(n);return e.V||(e.V=qy(e,ss(n))),e.V}function qy(n,e){if(n.limitType==="F")return gf(n.path,n.collectionGroup,e,n.filters,n.limit,n.startAt,n.endAt);{e=e.map(s=>{const i=s.dir==="desc"?"asc":"desc";return new Ii(s.field,i)});const t=n.endAt?new fs(n.endAt.position,n.endAt.inclusive):null,r=n.startAt?new fs(n.startAt.position,n.startAt.inclusive):null;return gf(n.path,n.collectionGroup,e,n.filters,n.limit,t,r)}}function lc(n,e){const t=n.filters.concat([e]);return new xr(n.path,n.collectionGroup,n.explicitOrderBy.slice(),t,n.limit,n.limitType,n.startAt,n.endAt)}function Jy(n,e){const t=n.explicitOrderBy.concat([e]);return new xr(n.path,n.collectionGroup,t,n.filters.slice(),n.limit,n.limitType,n.startAt,n.endAt)}function ra(n,e,t){return new xr(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,t,n.startAt,n.endAt)}function jy(n,e){return new xr(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),n.limit,n.limitType,e,n.endAt)}function Ky(n,e){return YC(Qt(n),Qt(e))&&n.limitType===e.limitType}function ai(n){return`Query(target=${function(t){let r=t.path.canonicalString();return t.collectionGroup!==null&&(r+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(r+=`, filters: [${t.filters.map(s=>WC(s)).join(", ")}]`),Ta(t.limit)||(r+=", limit: "+t.limit),t.orderBy.length>0&&(r+=`, orderBy: [${t.orderBy.map(s=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(s)).join(", ")}]`),t.startAt&&(r+=", startAt: ",r+=t.startAt.inclusive?"b:":"a:",r+=t.startAt.position.map(s=>cs(s)).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map(s=>cs(s)).join(",")),`Target(${r})`}(Qt(n))}; limitType=${n.limitType})`}function Pa(n,e){return e.isFoundDocument()&&function(r,s){const i=s.key.path;return r.collectionGroup!==null?s.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(i):Q.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)}(n,e)&&function(r,s){for(const i of ss(r))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0}(n,e)&&function(r,s){for(const i of r.filters)if(!i.matches(s))return!1;return!0}(n,e)&&function(r,s){return!(r.startAt&&!function(o,B,c){const u=Cf(o,B,c);return o.inclusive?u<=0:u<0}(r.startAt,ss(r),s)||r.endAt&&!function(o,B,c){const u=Cf(o,B,c);return o.inclusive?u>=0:u>0}(r.endAt,ss(r),s))}(n,e)}function $c(n){return(e,t)=>{let r=!1;for(const s of ss(n)){const i=zy(s,e,t);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function zy(n,e,t){const r=n.field.isKeyField()?Q.comparator(e.key,t.key):function(i,o,B){const c=o.data.field(i),u=B.data.field(i);return c!==null&&u!==null?mt(c,u):X(42886)}(n.field,e,t);switch(n.dir){case"asc":return r;case"desc":return-1*r;default:return X(19790,{direction:n.dir})}}/**
2104 * @license
2105 * Copyright 2017 Google LLC
2106 *
2107 * Licensed under the Apache License, Version 2.0 (the "License");
2108 * you may not use this file except in compliance with the License.
2109 * You may obtain a copy of the License at
2110 *
2111 *   http://www.apache.org/licenses/LICENSE-2.0
2112 *
2113 * Unless required by applicable law or agreed to in writing, software
2114 * distributed under the License is distributed on an "AS IS" BASIS,
2115 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2116 * See the License for the specific language governing permissions and
2117 * limitations under the License.
2118 */class Wy{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
2119 * @license
2120 * Copyright 2017 Google LLC
2121 *
2122 * Licensed under the Apache License, Version 2.0 (the "License");
2123 * you may not use this file except in compliance with the License.
2124 * You may obtain a copy of the License at
2125 *
2126 *   http://www.apache.org/licenses/LICENSE-2.0
2127 *
2128 * Unless required by applicable law or agreed to in writing, softw
2128are
2129 * distributed under the License is distributed on an "AS IS" BASIS,
2130 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2131 * See the License for the specific language governing permissions and
2132 * limitations under the License.
2133 */var Ne,le;function $y(n){switch(n){case L.OK:return X(64938);case L.CANCELLED:case L.UNKNOWN:case L.DEADLINE_EXCEEDED:case L.RESOURCE_EXHAUSTED:case L.INTERNAL:case L.UNAVAILABLE:case L.UNAUTHENTICATED:return!1;case L.INVALID_ARGUMENT:case L.NOT_FOUND:case L.ALREADY_EXISTS:case L.PERMISSION_DENIED:case L.FAILED_PRECONDITION:case L.ABORTED:case L.OUT_OF_RANGE:case L.UNIMPLEMENTED:case L.DATA_LOSS:return!0;default:return X(15467,{code:n})}}function ZC(n){if(n===void 0)return En("GRPC error has no .code"),L.UNKNOWN;switch(n){case Ne.OK:return L.OK;case Ne.CANCELLED:return L.CANCELLED;case Ne.UNKNOWN:return L.UNKNOWN;case Ne.DEADLINE_EXCEEDED:return L.DEADLINE_EXCEEDED;case Ne.RESOURCE_EXHAUSTED:return L.RESOURCE_EXHAUSTED;case Ne.INTERNAL:return L.INTERNAL;case Ne.UNAVAILABLE:return L.UNAVAILABLE;case Ne.UNAUTHENTICATED:return L.UNAUTHENTICATED;case Ne.INVALID_ARGUMENT:return L.INVALID_ARGUMENT;case Ne.NOT_FOUND:return L.NOT_FOUND;case Ne.ALREADY_EXISTS:return L.ALREADY_EXISTS;case Ne.PERMISSION_DENIED:return L.PERMISSION_DENIED;case Ne.FAILED_PRECONDITION:return L.FAILED_PRECONDITION;case Ne.ABORTED:return L.ABORTED;case Ne.OUT_OF_RANGE:return L.OUT_OF_RANGE;case Ne.UNIMPLEMENTED:return L.UNIMPLEMENTED;case Ne.DATA_LOSS:return L.DATA_LOSS;default:return X(39323,{code:n})}}(le=Ne||(Ne={}))[le.OK=0]="OK",le[le.CANCELLED=1]="CANCELLED",le[le.UNKNOWN=2]="UNKNOWN",le[le.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",le[le.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",le[le.NOT_FOUND=5]="NOT_FOUND",le[le.ALREADY_EXISTS=6]="ALREADY_EXISTS",le[le.PERMISSION_DENIED=7]="PERMISSION_DENIED",le[le.UNAUTHENTICATED=16]="UNAUTHENTICATED",le[le.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",le[le.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",le[le.ABORTED=10]="ABORTED",le[le.OUT_OF_RANGE=11]="OUT_OF_RANGE",le[le.UNIMPLEMENTED=12]="UNIMPLEMENTED",le[le.INTERNAL=13]="INTERNAL",le[le.UNAVAILABLE=14]="UNAVAILABLE",le[le.DATA_LOSS=15]="DATA_LOSS";/**
2134 * @license
2135 * Copyright 2017 Google LLC
2136 *
2137 * Licensed under the Apache License, Version 2.0 (the "License");
2138 * you may not use this file except in compliance with the License.
2139 * You may obtain a copy of the License at
2140 *
2141 *   http://www.apache.org/licenses/LICENSE-2.0
2142 *
2143 * Unless required by applicable law or agreed to in writing, software
2144 * distributed under the License is distributed on an "AS IS" BASIS,
2145 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2146 * See the License for the specific language governing permissions and
2147 * limitations under the License.
2148 */class Mr{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r!==void 0){for(const[s,i]of r)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,t){const r=this.mapKeyFn(e),s=this.inner[r];if(s===void 0)return this.inner[r]=[[e,t]],void this.innerSize++;for(let i=0;i<s.length;i++)if(this.equalsFn(s[i][0],e))return void(s[i]=[e,t]);s.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r===void 0)return!1;for(let s=0;s<r.length;s++)if(this.equalsFn(r[s][0],e))return r.length===1?delete this.inner[t]:r.splice(s,1),this.innerSize--,!0;return!1}forEach(e){ir(this.inner,(t,r)=>{for(const[s,i]of r)e(s,i)})}isEmpty(){return vC(this.inner)}size(){return this.innerSize}}/**
2149 * @license
2150 * Copyright 2017 Google LLC
2151 *
2152 * Licensed under the Apache License, Version 2.0 (the "License");
2153 * you may not use this file except in compliance with the License.
2154 * You may obtain a copy of the License at
2155 *
2156 *   http://www.apache.org/licenses/LICENSE-2.0
2157 *
2158 * Unless required by applicable law or agreed to in writing, software
2159 * distributed under the License is distributed on an "AS IS" BASIS,
2160 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2161 * See the License for the specific language governing permissions and
2162 * limitations under the License.
2163 */const Qy=new ve(Q.comparator);function dt(){return Qy}const ep=new ve(Q.comparator);function Xr(...n){let e=ep;for(const t of n)e=e.insert(t.key,t);return e}function tp(n){let e=ep;
vendor: 4,348 bytes, lines 2163-2212
2163return n.forEach((t,r)=>e=e.insert(t,r.overlayedDocument)),e}function Mn(){return Bi()}function np(){return Bi()}function Bi(){return new Mr(n=>n.toString(),(n,e)=>n.isEqual(e))}const Yy=new ve(Q.comparator),Xy=new Ve(Q.comparator);function oe(...n){let e=Xy;for(const t of n)e=e.add(t);return e}const Zy=new Ve(ae);function eI(){return Zy}/**
2164 * @license
2165 * Copyright 2023 Google LLC
2166 *
2167 * Licensed under the Apache License, Version 2.0 (the "License");
2168 * you may not use this file except in compliance with the License.
2169 * You may obtain a copy of the License at
2170 *
2171 *   http://www.apache.org/licenses/LICENSE-2.0
2172 *
2173 * Unless required by applicable law or agreed to in writing, software
2174 * distributed under the License is distributed on an "AS IS" BASIS,
2175 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2176 * See the License for the specific language governing permissions and
2177 * limitations under the License.
2178 */function tI(){return new TextEncoder}/**
2179 * @license
2180 * Copyright 2022 Google LLC
2181 *
2182 * Licensed under the Apache License, Version 2.0 (the "License");
2183 * you may not use this file except in compliance with the License.
2184 * You may obtain a copy of the License at
2185 *
2186 *   http://www.apache.org/licenses/LICENSE-2.0
2187 *
2188 * Unless required by applicable law or agreed to in writing, software
2189 * distributed under the License is distributed on an "AS IS" BASIS,
2190 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2191 * See the License for the specific language governing permissions and
2192 * limitations under the License.
2193 */const nI=new Hn([4294967295,4294967295],0);function Ef(n){const e=tI().encode(n),t=new CC;return t.update(e),new Uint8Array(t.digest())}function _f(n){const e=new DataView(n.buffer),t=e.getUint32(0,!0),r=e.getUint32(4,!0),s=e.getUint32(8,!0),i=e.getUint32(12,!0);return[new Hn([t,r],0),new Hn([s,i],0)]}class Qc{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new ei(`Invalid padding: ${t}`);if(r<0)throw new ei(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new ei(`Invalid hash count: ${r}`);if(e.length===0&&t!==0)throw new ei(`Invalid padding when bitmap length is 0: ${t}`);this.p=8*e.length-t,this.S=Hn.fromNumber(this.p)}v(e,t,r){let s=e.add(t.multiply(Hn.fromNumber(r)));return s.compare(nI)===1&&(s=new Hn([s.getBits(0),s.getBits(1)],0)),s.modulo(this.S).toNumber()}D(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.p===0)return!1;const t=Ef(e),[r,s]=_f(t);for(let i=0;i<this.hashCount;i++){const o=this.v(r,s,i);if(!this.D(o))return!1}return!0}static create(e,t,r){const s=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),o=new Qc(i,s,t);return r.forEach(B=>o.insert(B)),o}insert(e){if(this.p===0)return;const t=Ef(e),[r,s]=_f(t);for(let i=0;i<this.hashCount;i++){const o=this.v(r,s,i);this.C(o)}}C(e){const t=Math.floor(e/8),r=e%8;this.bitmap[t]|=1<<r}}class ei extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
2194 * @license
2195 * Copyright 2017 Google LLC
2196 *
2197 * Licensed under the Apache License, Version 2.0 (the "License");
2198 * you may not use this file except in compliance with the License.
2199 * You may obtain a copy of the License at
2200 *
2201 *   http://www.apache.org/licenses/LICENSE-2.0
2202 *
2203 * Unless required by applicable law or agreed to in writing, software
2204 * distributed under the License is distributed on an "AS IS" BASIS,
2205 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2206 * See the License for the specific language governing permissions and
2207 * limitations under the License.
2208 */class Hi{constructor(e,t,r,s,i,o){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=r,this.documentUpdates=s,this.augmentedDocumentUpdates=i,this.resolvedLimboDocuments=o}static createSynthesizedRemoteEventForCurrentChange(e,t,r){const s=new Map;return s.set(e,qi.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new Hi(ne.min(),s,new ve(ae),dt(),dt(),oe())}}class qi{constructor(e,t,r,s,i){this.resumeToken=e,this.current=t,this.addedDocuments=r,this.modifiedDocuments=s,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,t,r){return new qi(r,t,oe(),oe(),oe())}}/**
2209 * @license
2210 * Copyright 2017 Google LLC
2211 *
2212 * Licensed under the Apache License, Version 2.0 (the "License");
2213 * you may not use this file except in compliance with the License.
2214 * You may obtain a copy of the License at
2215 *
2216 *   http://www.apache.org/licenses/LICENSE-2.0
2217 *
2218 * Unless required by applicable law or agreed to in writing, software
2219 * distributed under the License is distributed on an "AS IS" BASIS,
2220 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2221 * See the License for the specific language governing permissions and
2222 * limitations under the License.
2223 */class Vo{constructor(e,t,r,s){this.F=e,this.removedTargetIds=t,this.key=r,this.O=s}}class rp{constructor(e,t){this.targetId=e,this.M=t}}class sp{constructor(e,t,r=xe.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=s}}class Df{constructor(e){this.targetId=e,this.N=0,this.L=wf(),this.B=xe.EMPTY_BYTE_STRING,this.U=!1,this.k=!0}get current(){return this.U}get resumeToken(){return this.B}get q(){return this.N!==0}get $(){return this.k}K(e){e.approximateByteSize()>0&&(this.k=!0,this.B=e)}W(){let e=oe(),t=oe(),r=oe();return this.L.forEach((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:t=t.add(s);break;case 1:r=r.add(s);break;default:X(38017,{changeType:i})}}),new qi(this.B,this.U,e,t,r)}G(){this.k=!1,this.L=wf()}j(e,t){this.k=!0,this.L=this.L.insert(e,t)}H(e){this.k=!0,this.L=this.L.remove(e)}J(){this.N+=1}Y(){this.N-=1,W(this.N>=0,3241,{N:this.N,targetId:this.targetId})}Z(){this.k=!0,this.U=!0}}const Ws="WatchChangeAggregator";class rI{constructor(e){this.X=e,this.ee=new Map,this.te=dt(),this.ne=wo(),this.re=dt(),this.ie=wo(),this.se=new ve(ae)}_e(e){for(const t of e.F)e.O&&e.O.isFoundDocument()?this.oe(t,e.O):this.ae(t,e.key,e.O);for(const t of e.removedTargetIds)this.ae(t,e.key,e.O)}ue(e){this.forEachTarget(e,t=>{const r=this.ee.get(t);if(r)switch(e.state){case 0:this.ce(t)&&r.K(e.resumeToken);break;case 1:r.Y(),r.q||r.G(),r.K(e.resumeToken);break;case 2:r.Y(),r.q||this.removeTarget(t);break;case 3:this.ce(t)&&(r.Z(),r.K(e.resumeToken));break;case 4:this.ce(t)&&(this.le(t),r.K(e.resumeToken));break;default:X(56790,{state:e.state})}else K(Ws,`handleTargetChange received targetChange for untracked target ID (${t}) with state (${e.state})`)})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.ee.forEach((r,s)=>{this.ce(s)&&t(s)})}Ee(e){var t;return Cr(e)?e.getPipelineSourceType()==="documents"&&((t=e.getPipelineDocuments())==null?void 0:t.length)===1:XC(e)}he(e){const t=e.targetId,r=e.M.count,s=this.Te(t);if(s){const i=s.target;if(this.Ee(i))if(r===0){const o=new Q(Cr(i)?Ce.fromString(i.getPipelineDocuments()[0]):i.path);this.ae(t,o,Ye.newNoDocument(o,ne.min()))}else W(r===1,20013,"Single document existence filter with count: "+r);else{const o=this.Pe(t);if(o!==r){const B=this.Ie(e),c=B?this.Re(B,e,o):1;if(c!==0){this.le(t);const u=c===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.se=this.se.insert(t,u)}}}}}Ie(e){const t=e.M.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=t;let o,B;try{o=$n(r).toUint8Array()}catch(c){if(c instanceof SC)return Gt("Decoding the base64 bloom filter in existence filter failed ("+c.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw c}try{B=new Qc(o,s,i)}catch(c){return Gt(c instanceof ei?"BloomFilter error: ":"Applying bloom filter failed: ",c),null}return B.p===0?null:B}Re(e,t,r){return t.M.count===r-this.de(e,t.targetId)?0:2}de(e,t){const r=this.X.getRemoteKeysForTarget(t);let s=0;return r.forEach(i=>{const o=this.X.Ve(),B=`projects/${o.projectId}/databases/${o.database}/documents/${i.path.canonicalString()}`;e.mightContain(B)||(this.ae(t,i,null),s++)}),s}fe(e){const t=new Map;this.ee.forEach((i,o)=>{const B=this.Te(o);if(B){if(i.current&&this.Ee(B.target)){const c=Cr(B.target)?Ce.fromString(B.target.getPipelineDocuments()[0]):B.target.path,u=new Q(c);this.me(u).has(o)||this.pe(o,u)||this.ae(o,u,Ye.newNoDocument(u,e))}i.$&&(t.set(o,i.W()),i.G())}});let r=oe();this.ie.forEach((i,o)=>{let B=!0;o.forEachWhile(c=>{const u=this.Te(c);return!u||u.purpose==="TargetPurposeLimboResolution"||(B=!1,!1)}),B&&(r=r.add(i))}),this.te.forEach((i,o)=>o.setReadTime(e)),this.re.forEach((i,o)=>o.setReadTime(e));const s=new Hi(e,t,this.se,this.te,this.re,r);return this.te=dt(),this.ne=wo(),this.re=dt(),this.ie=wo(),this.se=new ve(ae),s}oe(e,t){const r=this.ee.get(e);if(!r||!this.ce(e))return void K(Ws,`addDocumentToTarget received document for unknown inactive target (${e})`);const s=this.pe(e,t.key)?2:0;r.j(t.key,s),Cr(this.Te(e).target)&&this.Te(e).target.getPipelineFlavor()!=="exact"?this.re=this.re.insert(t.key,t):this.te=this.te.insert(t.key,t),this.ne=this.ne.insert(t.key,this.me(t.key).add(e)),this.ie=this.ie.insert(t.key,this.ge(t.key).add(e))}ae(e,t,r){const s=this.ee.get(e);s&&this.ce(e)?(this.pe(e,t)?s.j(t,1):s.H(t),this.ie=this.ie.insert(t,this.ge(t).delete(e)),this.ie=this.ie.insert(t,this.ge(t).add(e)),r&&(Cr(this.Te(e).target)&&this.Te(e).target.getPipelineFlavor()!=="exact"?this.re=this.re.insert(t,r):this.te=this.te.insert(t,r))):K(Ws,`removeDocumentFromTarget received document for unknown or inactive target (${e})`)}removeTarget(e){this.ee.delete(e)}Pe(e){const t=this.ee.get(e);if(!t)return 0;const r=t.W();return this.X.getRemoteKeysForTarget(e).size+r.addedDocuments.size-r.removedDocuments.size}J(e){let t=this.ee.get(e);t||(K(Ws,`recordPendingTargetRequest set up tracking for target ID ${e}`),t=new Df(e),this.ee.set(e,t)),t.J()}ge(e){let t=this.ie.get(e);return t||(t=new Ve(ae),this.ie=this.ie.insert(e,t)),t}
2223me(e){let t=this.ne.get(e);return t||(t=new Ve(ae),this.ne=this.ne.insert(e,t)),t}ce(e){const t=this.Te(e)!==null;return t||K(Ws,"Detected inactive target",e),t}Te(e){const t=this.ee.get(e);return t===void 0||t.q?null:this.X.ye(e)}le(e){this.ee.set(e,new Df(e)),this.X.getRemoteKeysForTarget(e).forEach(t=>{this.ae(e,t,null)})}pe(e,t){return this.X.getRemoteKeysForTarget(e).has(t)}}function wo(){return new ve(Q.comparator)}function wf(){return new ve(Q.comparator)}const sI={asc:"ASCENDING",desc:"DESCENDING"},iI={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},oI={and:"AND",or:"OR"};class aI{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function hc(n,e){return n.useProto3Json||Ta(e)?e:{value:e}}function ci(n,e){return n.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Yc(n){const e=Wn(n);return new ge(e.seconds,e.nanos)}function ip(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function xo(n,e){return ci(n,e.toTimestamp())}function Yt(n){return W(!!n,49232),ne.fromTimestamp(Yc(n))}function Xc(n,e){return fc(n,e).canonicalString()}function fc(n,e){const t=function(s){return new Ce(["projects",s.projectId,"databases",s.database])}(n).child("documents");return e===void 0?t:t.child(e)}function op(n){const e=Ce.fromString(n);return W(lp(e),10190,{key:e.toString()}),e}function sa(n,e){return Xc(n.databaseId,e.path)}function LB(n,e){const t=op(e);if(t.get(1)!==n.databaseId.projectId)throw new G(L.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+t.get(1)+" vs "+n.databaseId.projectId);if(t.get(3)!==n.databaseId.database)throw new G(L.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+n.databaseId.database);return new Q(Bp(t))}function ap(n,e){return Xc(n.databaseId,e)}function BI(n){const e=op(n);return e.length===4?Ce.emptyPath():Bp(e)}function dc(n){return new Ce(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function Bp(n){return W(n.length>4&&n.get(4)==="documents",29091,{key:n.toString()}),n.popFirst(5)}function yf(n,e,t){return{name:sa(n,e),fields:t.value.mapValue.fields}}function cI(n,e){let t;if("targetChange"in e){e.targetChange;const r=function(u){return u==="NO_CHANGE"?0:u==="ADD"?1:u==="REMOVE"?2:u==="CURRENT"?3:u==="RESET"?4:X(39313,{state:u})}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(u,h){return u.useProto3Json?(W(h===void 0||typeof h=="string",58123),xe.fromBase64String(h||"")):(W(h===void 0||h instanceof Buffer||h instanceof Uint8Array,16193),xe.fromUint8Array(h||new Uint8Array))}(n,e.targetChange.resumeToken),o=e.targetChange.cause,B=o&&function(u){const h=u.code===void 0?L.UNKNOWN:ZC(u.code);return new G(h,u.message||"")}(o);t=new sp(r,s,i,B||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=LB(n,r.document.name),i=Yt(r.document.updateTime),o=r.document.createTime?Yt(r.document.createTime):ne.min(),B=new ot({mapValue:{fields:r.document.fields}}),c=Ye.newFoundDocument(s,i,o,B),u=r.targetIds||[],h=r.removedTargetIds||[];t=new Vo(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=LB(n,r.document),i=r.readTime?Yt(r.readTime):ne.min(),o=Ye.newNoDocument(s,i),B=r.removedTargetIds||[];t=new Vo([],B,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=LB(n,r.document),i=r.removedTargetIds||[];t=new Vo([],i,s,null)}else{if(!("filter"in e))return X(11601,{we:e});{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,o=new Wy(s,i),B=r.targetId;t=new rp(B,o)}}return t}function uI(n,e){let t;if(e instanceof Ui)t={update:yf(n,e.key,e.value)};else if(e instanceof ba)t={delete:sa(n,e.key)};else if(e instanceof or)t={update:yf(n,e.key,e.data),updateMask:_I(e.fieldMask)};else{if(!(e instanceof Ry))return X(16599,{be:e.type});t={verify:sa(n,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(r=>function(i,o){const B=o.transform;if(B instanceof wi)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(B instanceof ls)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:B.elements}};if(B instanceof hs)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:B.elements}};if(B instanceof yi)return{fieldPath:o.field.canonicalString(),increment:B.h};if(B instanceof ea)return{fieldPath:o.field.canonicalString(),minimum:B.h};if(B instanceof ta)return{fieldPath:o.field.canonicalString(),maximum:B.h};throw X(20930,{transform:o.transform})}(0,r))),e.precondition.isNone||(t.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:xo(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:X(27497)}(n,e.precondition)),t}function lI(n,e){return n&&n.length>0?(W(e!==void 0,14353),n.map(t=>function(s,i){let o=s.updateTime?Yt(s.updateTime):Yt(i);return o.isEqual(ne.min())&&(o=Yt(i)),new Iy(o,s.transformResults||[])}(t,e))):[]}function hI(n,e){return{documents:[ap(n,e.path)]}}function fI(n,e){const t={structuredQuery:{}},r=e.path;let s;e.collectionGroup!==null?(s=r,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),t.structuredQuery.from=[{collectionId:r.lastSegment()}]),t.parent=ap(n,s);const i=function(u){if(u.length!==0)return up(Ut.create(u,"and"))}(e.filters);i&&(t.structuredQuery.where=i);const o=function(u){if(u.length!==0)return u.map(h=>function(p){return{field:Zr(p.field),direction:gI(p.dir)}}(h))}(e.orderBy);o&&(t.structuredQuery.orderBy=o);const B=hc(n,e.limit);return B!==null&&(t.structuredQuery.limit=B),e.startAt&&(t.structuredQuery.startAt=function(u){return{before:u.inclusive,values:u.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(u){return{before:!u.inclusive,values:u.position}}(e.endAt)),{Se:t,parent:s}}function dI(n){let e=BI(n.parent);
2223const t=n.structuredQuery,r=t.from?t.from.length:0;let s=null;if(r>0){W(r===1,65062);const h=t.from[0];h.allDescendants?s=h.collectionId:e=e.child(h.collectionId)}let i=[];t.where&&(i=function(d){const p=cp(d);return p instanceof Ut&&KC(p)?p.getFilters():[p]}(t.where));let o=[];t.orderBy&&(o=function(d){return d.map(p=>function(y){return new Ii(es(y.field),function(V){switch(V){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(y.direction))}(p))}(t.orderBy));let B=null;t.limit&&(B=function(d){let p;return p=typeof d=="object"?d.value:d,Ta(p)?null:p}(t.limit));let c=null;t.startAt&&(c=function(d){const p=!!d.before,_=d.values||[];return new fs(_,p)}(t.startAt));let u=null;return t.endAt&&(u=function(d){const p=!d.before,_=d.values||[];return new fs(_,p)}(t.endAt)),Uy(e,s,o,i,B,"F",c,u)}function CI(n,e){const t=function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return X(28987,{purpose:s})}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function pI(n,e){return{structuredPipeline:{pipeline:{stages:e.stages.map(t=>t._toProto(n))}}}}function cp(n){return n.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":const r=es(t.unaryFilter.field);return Le.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=es(t.unaryFilter.field);return Le.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=es(t.unaryFilter.field);return Le.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=es(t.unaryFilter.field);return Le.create(o,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return X(61313);default:return X(60726)}}(n):n.fieldFilter!==void 0?function(t){return Le.create(es(t.fieldFilter.field),function(s){switch(s){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return X(58110);default:return X(50506)}}(t.fieldFilter.op),t.fieldFilter.value)}(n):n.compositeFilter!==void 0?function(t){return Ut.create(t.compositeFilter.filters.map(r=>cp(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return X(1026)}}(t.compositeFilter.op))}(n):X(30097,{filter:n})}function gI(n){return sI[n]}function mI(n){return iI[n]}function EI(n){return oI[n]}function Zr(n){return{fieldPath:n.canonicalString()}}function es(n){return At.fromServerFormat(n.fieldPath)}function up(n){return n instanceof Le?function(t){if(t.op==="=="){if(Et(t.value))return{unaryFilter:{field:Zr(t.field),op:"IS_NAN"}};if(It(t.value))return{unaryFilter:{field:Zr(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(Et(t.value))return{unaryFilter:{field:Zr(t.field),op:"IS_NOT_NAN"}};if(It(t.value))return{unaryFilter:{field:Zr(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Zr(t.field),op:mI(t.op),value:t.value}}}(n):n instanceof Ut?function(t){const r=t.getFilters().map(s=>up(s));return r.length===1?r[0]:{compositeFilter:{op:EI(t.op),filters:r}}}(n):X(54877,{filter:n})}function _I(n){const e=[];return n.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function lp(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}function hp(n){return!!n&&typeof n._toProto=="function"&&n._protoValueType==="ProtoValue"}function Ai(n,e){const t={fields:{}};return e.forEach((r,s)=>{if(typeof s!="string")throw new Error(`Cannot encode map with non-string key: ${s}`);t.fields[s]=r._toProto(n)}),{mapValue:t}}function fp(n){return{stringValue:n}}/**
2224 * @license
2225 * Copyright 2020 Google LLC
2226 *
2227 * Licensed under the Apache License, Version 2.0 (the "License");
2228 * you may not use this file except in compliance with the License.
2229 * You may obtain a copy of the License at
2230 *
2231 *   http://www.apache.org/licenses/LICENSE-2.0
2232 *
2233 * Unless required by applicable law or agreed to in writing, softw
2233are
2234 * distributed under the License is distributed on an "AS IS" BASIS,
2235 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2236 * See the License for the specific language governing permissions and
2237 * limitations under the License.
2238 */function Oa(n){return new aI(n,!0)}/**
2239 * @license
2240 * Copyright 2020 Google LLC
2241 *
2242 * Licensed under the Apache License, Version 2.0 (the "License");
2243 * you may not use this file except in compliance with the License.
2244 * You may obtain a copy of the License at
2245 *
2246 *   http://www.apache.org/licenses/LICENSE-2.0
2247 *
2248 * Unless required by applicable law or agreed to in writing, software
2249 * distributed under the License is distributed on an "AS IS" BASIS,
2250 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2251 * See the License for the specific language governing permissions and
2252 * limitations under the License.
2253 */class St{constructor(e){this._byteString=e}static fromBase64String(e){try{return new St(xe.fromBase64String(e))}catch(t){throw new G(L.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new St(xe.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:St._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(xi(e,St._jsonSchema))return St.fromBase64String(e.bytes)}}St._jsonSchemaVersion="firestore/bytes/1.0",St._jsonSchema={type:ke("string",St._jsonSchemaVersion),bytes:ke("string")};/**
2254 * @license
2255 * Copyright 2020 Google LLC
2256 *
2257 * Licensed under the Apache License, Version 2.0 (the "License");
2258 * you may not use this file except in compliance with the License.
2259 * You may obtain a copy of the License at
2260 *
2261 *   http://www.apache.org/licenses/LICENSE-2.0
2262 *
2263 * Unless required by applicable law or agreed to in writing, software
2264 * distributed under the License is distributed on an "AS IS" BASIS,
2265 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2266 * See the License for the specific language governing permissions and
2267 * limitations under the License.
2268 */class Ji{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new G(L.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new At(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}function DI(){return new Ji(Kt)}/**
2269 * @license
2270 * Copyright 2020 Google LLC
2271 *
2272 * Licensed under the Apache License, Version 2.0 (the "License");
2273 * you may not use this file except in compliance with the License.
2274 * You may obtain a copy of the License at
2275 *
2276 *   http://www.apache.org/licenses/LICENSE-2.0
2277 *
2278 * Unless required by applicable law or agreed to in writing, software
2279 * distributed under the License is distributed on an "AS IS" BASIS,
2280 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2281 * See the License for the specific language governing permissions and
2282 * limitations under the License.
2283 */class Ds{constructor(e){this._methodName=e}}/**
2284 * @license
2285 * Copyright 2017 Google LLC
2286 *
2287 * Licensed under the Apache License, Version 2.0 (the "License");
2288 * you may not use this file except in compliance with the License.
2289 * You may obtain a copy of the License at
2290 *
2291 *   http://www.apache.org/licenses/LICENSE-2.0
2292 *
2293 * Unless required by applicable law or agreed to in writing, software
2294 * distributed under the License is distributed on an "AS IS" BASIS,
2295 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2296 * See the License for the specific language governing permissions and
2297 * limitations under the License.
2298 */class Xt{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new G(L.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new G(L.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return ae(this._lat,e._lat)||ae(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:Xt._jsonSchemaVersion}}static fromJSON(e){if(xi(e,Xt._jsonSchema))return new Xt(e.latitude,e.longitude)}}Xt._jsonSchemaVersion="firestore/geoPoint/1.0",Xt._jsonSchema={type:ke("string",Xt._jsonSchemaVersion),latitude:ke("number"),longitude:ke("number")};/**
2299 * @license
2300 * Copyright 2017 Google LLC
2301 *
2302 * Licensed under the Apache License, Version 2.0 (the "License");
2303 * you may not use this file except in compliance with the License.
2304 * You may obtain a copy of the License at
2305 *
2306 *   http://www.apache.org/licenses/LICENSE-2.0
2307 *
2308 * Unless required by applicable law or agreed to in writing, software
2309 * distributed under the License is distributed on an "AS IS" BASIS,
2310 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2311 * See the License for the specific language governing permissions and
2312 * limitations under the License.
2313 */class Qe{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Qe.UNAUTHENTICATED=new Qe(null),Qe.GOOGLE_CREDENTIALS=new Qe("google-credentials-uid"),Qe.FIRST_PARTY=new Qe("first-party-uid"),Qe.MOCK_USER=new Qe("mock-user");/**
2314 * @license
2315 * Copyright 2017 Google LLC
2316 *
2317 * Licensed under the Apache License, Version 2.0 (the "License");
2318 * you may not use this file except in compliance with the License.
2319 * You may obtain a copy of the License at
2320 *
2321 *   http://www.apache.org/licenses/LICENSE-2.0
2322 *
2323 * Unless required by applicable law or agreed to in writing, software
2324 * distributed under the License is distributed on an "AS IS" BASIS,
2325 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2326 * See the License for the specific language governing permissions and
2327 * limitations under the License.
2328 */class fn{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}/**
2329 * @license
2330 * Copyright 2017 Google LLC
2331 *
2332 * Licensed under the Apache License, Version 2.0 (the "License");
2333 * you may not use this file except in compliance with the License.
2334 * You may obtain a copy of the License at
2335 *
2336 *   http://www.apache.org/licenses/LICENSE-2.0
2337 *
2338 * Unless required by applicable law or agreed to in writing, software
2339 * distributed under the License is distributed on an "AS IS" BASIS,
2340 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2341 * See the License for the specific language governing permissions and
2342 * limitations under the License.
2343 */class dp{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class wI{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(Qe.UNAUTHENTICATED))}shutdown(){}}class yI{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class II{constructor(e){this.De=e,this.currentUser=Qe.UNAUTHENTICATED,this.xe=0,this.forceRefresh=!1,this.auth=null}start(e,t){W(this.Ce===void 0,42304);let r=this.xe;const s=c=>this.xe!==r?(r=this.xe,t(c)):Promise.resolve();let i=new fn;this.Ce=()=>{this.xe++,this.currentUser=this.Fe(),i.resolve(),i=new fn,e.enqueueRetryable(()=>s(this.currentUser))};const o=()=>{const c=i;e.enqueueRetryable(async()=>{await c.promise,await s(this.currentUser)})},B=c=>{K("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=c,this.Ce&&(this.auth.addAuthTokenListener(this.Ce),o())};this.De.onInit(c=>B(c)),setTimeout(()=>{if(!this.auth){const c=this.De.getImmediate({optional:!0});c?B(c):(K("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new fn)}},0),o()}getToken(){const e=this.xe,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(r=>this.xe!==e?(K("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(W(typeof r.accessToken=="string",31837,{Oe:r}),new dp(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.Ce&&this.auth.removeAuthTokenListener(this.Ce),this.Ce=void 0}Fe(){const e=this.auth&&this.auth.getUid();return W(e===null||typeof e=="string",2055,{Me:e}),new Qe(e)}}class TI{constructor(e,t,r){this.Ne=e,this.Le=t,this.Be=r,this.type="FirstParty",this.user=Qe.FIRST_PARTY,this.Ue=new Map}ke(){return this.Be?this.Be():null}get headers(){this.Ue.set("X-Goog-AuthUser",this.Ne);const e=this.ke();return e&&this.Ue.set("Authorization",e),this.Le&&this.Ue.set("X-Goog-Iam-Authorization-Token",this.Le),this.Ue}}class AI{constructor(e,t,r){this.Ne=e,this.Le=t,this.Be=r}getToken(){return Promise.resolve(new TI(this.Ne,this.Le,this.Be))}start(e,t){e.enqueueRetryable(()=>t(Qe.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class If{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class RI{constructor(e,t){this.qe=t,this.forceRefresh=!1,this.appCheck=null,this.$e=null,this.Ke=null,Xe(e)&&e.settings.appCheckToken&&(this.Ke=e.settings.appCheckToken)}start(e,t){W(this.Ce===void 0,3512);const r=i=>{i.error!=null&&K("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const o=i.token!==this.$e;return this.$e=i.token,K("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?t(i.token):Promise.resolve()};this.Ce=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{K("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.Ce&&this.appCheck.addTokenListener(this.Ce)};this.qe.onInit(i=>s(i)),setTimeout(()=>{if(!this.appCheck){const i=this.qe.getImmediate({optional:!0});i?s(i):K("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.Ke)return Promise.resolve(new If(this.Ke));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(W(typeof t.token=="string",44558,{tokenResult:t}),this.$e=t.token,new If(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.Ce&&this.appCheck.removeTokenListener(this.Ce),this.Ce=void 0}}function Cp(n){const e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}/**
2344 * @license
2345 * Copyright 2019 Google LLC
2346 *
2347 * Licensed under the Apache License, Version 2.0 (the "License");
2348 * you may not use this file except in compliance with the License.
2349 * You may obtain a copy of the License at
2350 *
2351 *   http://www.apache.org/licenses/LICENSE-2.0
2352 *
2353 * Unless required by applicable law or agreed to in writing, software
2354 * distributed under the License is distributed on an "AS IS" BASIS,
2355 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2356 * See the License for the specific language governing permissions and
2357 * limitations under the License.
2358 */class vI{Qe(e){}shutdown(){}}/**
2359 * @license
2360 * Copyright 2019 Google LLC
2361 *
2362 * Licensed under the Apache License, Version 2.0 (the "License");
2363 * you may not use this file except in compliance with the License.
2364 * You may obtain a copy of the License at
2365 *
2366 *   http://www.apache.org/licenses/LICENSE-2.0
2367 *
2368 * Unless required by applicable law or agreed to in writing, software
2369 * distributed under the License is distributed on an "AS IS" BASIS,
2370 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2371 * See the License for the specific language governing permissions and
2372 * limitations under the License.
2373 */const Tf="ConnectivityMonitor";class Af{constructor(){this.We=()=>this.Ge(),this.ze=()=>this.je(),this.He=[],this.Je()}Qe(e){this.He.push(e)}shutdown(){window.removeEventListener("online",this.We),window.removeEventListener("offline",this.ze)}Je(){window.addEventListener("online",this.We),window.addEventListener("offline",this.ze)}Ge(){K(Tf,"Network connectivity changed: AVAILABLE");for(const e of this.He)e(0)}je(){K(Tf,"Network connectivity changed: UNAVAILABLE");for(const e of this.He)e(1)}static Ye(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
2374 * @license
2375 * Copyright 2023 Google LLC
2376 *
2377 * Licensed under the Apache License, Version 2.0 (the "License");
2378 * you may not use this file except in compliance with the License.
2379 * You may obtain a copy of the License at
2380 *
2381 *   http://www.apache.org/licenses/LICENSE-2.0
2382 *
2383 * Unless required by applicable law or agreed to in writing, software
2384 * distributed under the License is distributed on an "AS IS" BASIS,
2385 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2386 * See the License for the specific language governing permissions and
2387 * limitations under the License.
2388 */let yo=null;function Cc(){return yo===null?yo=function(){return 268435456+Math.round(2147483648*Math.random())}():yo++,"0x"+yo.toString(16)}/**
2389 * @license
2390 * Copyright 2020 Google LLC
2391 *
2392 * Licensed under the Apache License, Version 2.0 (the "License");
2393 * you may not use this file except in compliance with the License.
2394 * You may obtain a copy of the License at
2395 *
2396 *   http://www.apache.org/licenses/LICENSE-2.0
2397 *
2398 * Unless required by applicable law or agreed to in writing, software
2399 * distributed under the License is distributed on an "AS IS" BASIS,
2400 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2401 * See the License for the specific language governing permissions and
2402 * limitations under the License.
2403 */const kB="RestConnection",bI={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class SI{get Ze(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Xe=t+"://"+e.host,this.et=`projects/${r}/databases/${s}`,this.tt=this.databaseId.database===Yo?`project_id=${r}`:`project_id=${r}&database_id=${s}`}nt(e,t,r,s,i){const o=Cc(),B=this.rt(e,t.toUriEncodedString());K(kB,`Sending RPC '${e}' ${o}:`,B,r);const c={"google-cloud-resource-prefix":this.et,"x-goog-request-params":this.tt};this.it(c,s,i);const{host:u}=new URL(B),h=sr(u);return this.st(e,B,c,r,h).then(d=>(K(kB,`Received RPC '${e}' ${o}: `,d),d),d=>{throw Gt(kB,`RPC '${e}' ${o} failed with error: `,d,"url: ",B,"request:",r),d})}_t(e,t,r,s,i,o){return this.nt(e,t,r,s,i)}it(e,t,r){if(e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+_s}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEac
vendor: 4,681 bytes, lines 2403-2433
2403h((s,i)=>e[i]=s),r&&r.headers.forEach((s,i)=>e[i]=s),this.databaseInfo._customHeaders)for(const s of Object.keys(this.databaseInfo._customHeaders))e[s]=this.databaseInfo._customHeaders[s]}rt(e,t){const r=bI[e];let s=`${this.Xe}/v1/${t}:${r}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}}/**
2404 * @license
2405 * Copyright 2017 Google LLC
2406 *
2407 * Licensed under the Apache License, Version 2.0 (the "License");
2408 * you may not use this file except in compliance with the License.
2409 * You may obtain a copy of the License at
2410 *
2411 *   http://www.apache.org/licenses/LICENSE-2.0
2412 *
2413 * Unless required by applicable law or agreed to in writing, software
2414 * distributed under the License is distributed on an "AS IS" BASIS,
2415 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2416 * See the License for the specific language governing permissions and
2417 * limitations under the License.
2418 */class PI{constructor(e){this.ot=e.ot,this.ut=e.ut}ct(e){this.lt=e}Et(e){this.ht=e}Tt(e){this.Pt=e}onMessage(e){this.It=e}close(){this.ut()}send(e){this.ot(e)}Rt(){this.lt()}At(){this.ht()}Vt(e){this.Pt(e)}dt(e){this.It(e)}}/**
2419 * @license
2420 * Copyright 2017 Google LLC
2421 *
2422 * Licensed under the Apache License, Version 2.0 (the "License");
2423 * you may not use this file except in compliance with the License.
2424 * You may obtain a copy of the License at
2425 *
2426 *   http://www.apache.org/licenses/LICENSE-2.0
2427 *
2428 * Unless required by applicable law or agreed to in writing, software
2429 * distributed under the License is distributed on an "AS IS" BASIS,
2430 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2431 * See the License for the specific language governing permissions and
2432 * limitations under the License.
2433 */const $e="WebChannelConnection",$s=(n,e,t)=>{n.listen(e,r=>{try{t(r)}catch(s){setTimeout(()=>{throw s},0)}})};class is extends SI{constructor(e){super(e),this.ft=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static gt(){if(!is.yt){const e=EC();$s(e,mC.STAT_EVENT,t=>{t.stat===rc.PROXY?K($e,"STAT_EVENT: detected buffering proxy"):t.stat===rc.NOPROXY&&K($e,"STAT_EVENT: detected no buffering proxy")}),is.yt=!0}}st(e,t,r,s,i){const o=Cc();return new Promise((B,c)=>{const u=new pC;u.setWithCredentials(!0),u.listenOnce(gC.COMPLETE,()=>{try{switch(u.getLastErrorCode()){case Fo.NO_ERROR:const d=u.getResponseJson();K($e,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(d)),B(d);break;case Fo.TIMEOUT:K($e,`RPC '${e}' ${o} timed out`),c(new G(L.DEADLINE_EXCEEDED,"Request time out"));break;case Fo.HTTP_ERROR:const p=u.getStatus();if(K($e,`RPC '${e}' ${o} failed with status:`,p,"response text:",u.getResponseText()),p>0){let _=u.getResponseJson();Array.isArray(_)&&(_=_[0]);const y=_==null?void 0:_.error;if(y&&y.status&&y.message){const O=function(j){const ee=j.toLowerCase().replace(/_/g,"-");return Object.values(L).indexOf(ee)>=0?ee:L.UNKNOWN}(y.status);c(new G(O,y.message))}else c(new G(L.UNKNOWN,"Server responded with status "+u.getStatus()))}else c(new G(L.UNAVAILABLE,"Connection failed."));break;default:X(9055,{wt:e,streamId:o,bt:u.getLastErrorCode(),St:u.getLastError()})}}finally{K($e,`RPC '${e}' ${o} completed.`)}});const h=JSON.stringify(s);K($e,`RPC '${e}' ${o} sending request:`,s),u.send(t,"POST",h,r,15)})}vt(e,t,r){const s=Cc(),i=[this.Xe,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=this.createWebChannelTransport(),B={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(B.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(B.useFetchStreams=!0),this.it(B.initMessageHeaders,t,r),B.encodeInitMessageHeaders=!0;const u=i.join("");K($e,`Creating RPC '${e}' stream ${s}: ${u}`,B);const h=o.createWebChannel(u,B);this.Dt(h);let d=!1,p=!1;const _=new PI({ot:y=>{p?K($e,`Not sending because RPC '${e}' stream ${s} is closed:`,y):(d||(K($e,`Opening RPC '${e}' stream ${s} transport.`),h.open(),d=!0),K($e,`RPC '${e}' stream ${s} sending:`,y),h.send(y))},ut:()=>h.close()});return $s(h,Zs.EventType.OPEN,()=>{p||(K($e,`RPC '${e}' stream ${s} transport opened.`),_.Rt())}),$s(h,Zs.EventType.CLOSE,()=>{p||(p=!0,K($e,`RPC '${e}' stream ${s} transport closed`),_.Vt(),this.xt(h))}
2433),$s(h,Zs.EventType.ERROR,y=>{p||(p=!0,Gt($e,`RPC '${e}' stream ${s} transport errored. Name:`,y.name,"Message:",y.message),_.Vt(new G(L.UNAVAILABLE,"The operation could not be completed")))}),$s(h,Zs.EventType.MESSAGE,y=>{var O;if(!p){const V=y.data[0];W(!!V,16349);const j=V,ee=(j==null?void 0:j.error)||((O=j[0])==null?void 0:O.error);if(ee){K($e,`RPC '${e}' stream ${s} received error:`,ee);const se=ee.status;let Be=function(R){const E=Ne[R];if(E!==void 0)return ZC(E)}(se),ye=ee.message;se==="NOT_FOUND"&&ye.includes("database")&&ye.includes("does not exist")&&ye.includes(this.databaseId.database)&&Gt(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),Be===void 0&&(Be=L.INTERNAL,ye="Unknown error status: "+se+" with message "+ee.message),p=!0,_.Vt(new G(Be,ye)),h.close()}else K($e,`RPC '${e}' stream ${s} received:`,V),_.dt(V)}}),is.gt(),setTimeout(()=>{_.At()},0),_}terminate(){this.ft.forEach(e=>e.close()),this.ft=[]}Dt(e){this.ft.push(e)}xt(e){this.ft=this.ft.filter(t=>t===e)}it(e,t,r){super.it(e,t,r),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return _C()}}/**
2434 * @license
2435 * Copyright 2020 Google LLC
2436 *
2437 * Licensed under the Apache License, Version 2.0 (the "License");
2438 * you may not use this file except in compliance with the License.
2439 * You may obtain a copy of the License at
2440 *
2441 *   http://www.apache.org/licenses/LICENSE-2.0
2442 *
2443 * Unless required by applicable law or agreed to in writing, software
2444 * distributed under the License is distributed on an "AS IS" BASIS,
2445 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2446 * See the License for the specific language governing permissions and
2447 * limitations under the License.
2448 */function OI(n){return new is(n)}is.yt=!1;class pp{constructor(e,t,r=1e3,s=1.5,i=6e4){this.Ct=e,this.timerId=t,this.Ft=r,this.Ot=s,this.Mt=i,this.Nt=0,this.Lt=null,this.Bt=Date.now(),this.reset()}reset(){this.Nt=0}Ut(){this.Nt=this.Mt}kt(e){this.cancel();const t=Math.floor(this.Nt+this.qt()),r=Math.max(0,Date.now()-this.Bt),s=Math.max(0,t-r);s>0&&K("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Nt} ms, delay with jitter: ${t} ms, last attempt: ${r} ms ago)`),this.Lt=this.Ct.enqueueAfterDelay(this.timerId,s,()=>(this.Bt=Date.now(),e())),this.Nt*=this.Ot,this.Nt<this.Ft&&(this.Nt=this.Ft),this.Nt>this.Mt&&(this.Nt=this.Mt)}$t(){this.Lt!==null&&(this.Lt.skipDelay(),this.Lt=null)}cancel(){this.Lt!==null&&(this.Lt.cancel(),this.Lt=null)}qt(){return(Math.random()-.5)*this.Nt}}/**
2449 * @license
2450 * Copyright 2017 Google LLC
2451 *
2452 * Licensed under the Apache License, Version 2.0 (the "License");
2453 * you may not use this file except in compliance with the License.
2454 * You may obtain a copy of the License at
2455 *
2456 *   http://www.apache.org/licenses/LICENSE-2.0
2457 *
2458 * Unless required by applicable law or agreed to in writing, software
2459 * distributed under the License is distributed on an "AS IS" BASIS,
2460 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2461 * See the License for the specific language governing permissions and
2462 * limitations under the License.
2463 */const Rf="PersistentStream";class gp{constructor(e,t,r,s,i,o,B,c){this.Ct=e,this.Kt=r,this.Qt=s,this.connection=i,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=B,this.listener=c,this.state=0,this.Wt=0,this.Gt=null,this.zt=null,this.stream=null,this.jt=0,this.Ht=new pp(e,t)}Jt(){return this.state===1||this.state===5||this.Yt()}Yt(){return this.state===2||this.state===3}start(){this.jt=0,this.state!==4?this.auth():this.Zt()}async stop(){this.Jt()&&await this.close(0)}Xt(){this.state=0,this.Ht.reset()}en(){this.Yt()&&this.Gt===null&&(this.Gt=this.Ct.enqueueAfterDelay(this.Kt,6e4,()=>this.tn()))}nn(e){this.rn(),this.stream.send(e)}async tn(){if(this.Yt())return this.close(0)}rn(){this.Gt&&(this.Gt.cancel(),this.Gt=null)}sn(){this.zt&&(this.zt.cancel(),this.zt=null)}async close(e,t){this.rn(),this.sn(),this.Ht.cancel(),this.Wt++,e!==4?this.Ht.reset():t&&t.code===L.RESOURCE_EXHAUSTED?(En(t.toString()),En("Using maximum backoff delay to prevent overloading the backend."),this.Ht.Ut()):t&&t.code===L.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this._n(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Tt(t)}_n(){}auth(){this.state=1;const e=this.an(this.Wt),t=this.Wt;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.Wt===t&&this.un(r,s)},r=>{e(()=>{const s=new G(L.UNKNOWN,"Fetching auth token failed: "+r.message);return this.cn(s)})})}un(e,t){const r=this.an(this.Wt);this.stream=this.En(e,t),this.stream.ct(()=>{r(()=>this.listener.ct())}),this.stream.Et(()=>{r(()=>(this.state=2,this.zt=this.Ct.enqueueAfterDelay(this.Qt,1e4,()=>(this.Yt()&&(this.state=3),Promise.resolve())),this.listener.Et()))}),this.stream.Tt(s=>{r(()=>this.cn(s))}),this.stream.onMessage(s=>{r(()=>++this.jt==1?this.hn(s):this.onNext(s))})}Zt(){this.state=5,this.Ht.kt(async()=>{this.state=0,this.start()})}cn(e){return K(Rf,`close with error: ${e}`),this.stream=null,this.close(4,e)}an(e){return t=>{this.Ct.enqueueAndForget(()=>this.Wt===e?t():(K(Rf,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class NI extends gp{constructor(e,t,r,s,i,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,r,s,o),this.serializer
vendor: 4,420 bytes, lines 2463-2497
2463=i}En(e,t){return this.connection.vt("Listen",e,t)}hn(e){return this.onNext(e)}onNext(e){this.Ht.reset();const t=cI(this.serializer,e),r=function(i){if(!("targetChange"in i))return ne.min();const o=i.targetChange;return o.targetIds&&o.targetIds.length?ne.min():o.readTime?Yt(o.readTime):ne.min()}(e);return this.listener.Tn(t,r)}Pn(e){const t={};t.database=dc(this.serializer),t.addTarget=function(i,o){let B;const c=o.target;if(B=Cr(c)?{pipelineQuery:pI(i,c)}:XC(c)?{documents:hI(i,c)}:{query:fI(i,c).Se},B.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){B.resumeToken=ip(i,o.resumeToken);const u=hc(i,o.expectedCount);u!==null&&(B.expectedCount=u)}else if(o.snapshotVersion.compareTo(ne.min())>0){B.readTime=ci(i,o.snapshotVersion.toTimestamp());const u=hc(i,o.expectedCount);u!==null&&(B.expectedCount=u)}return B}(this.serializer,e);const r=CI(this.serializer,e);r&&(t.labels=r),this.nn(t)}In(e){const t={};t.database=dc(this.serializer),t.removeTarget=e,this.nn(t)}}class FI extends gp{constructor(e,t,r,s,i,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,r,s,o),this.serializer=i}get Rn(){return this.jt>0}start(){this.lastStreamToken=void 0,super.start()}_n(){this.Rn&&this.An([])}En(e,t){return this.connection.vt("Write",e,t)}hn(e){return W(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,W(!e.writeResults||e.writeResults.length===0,55816),this.listener.Vn()}onNext(e){W(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.Ht.reset();const t=lI(e.writeResults,e.commitTime),r=Yt(e.commitTime);return this.listener.dn(r,t)}fn(){const e={};e.database=dc(this.serializer),this.nn(e)}An(e){const t={streamToken:this.lastStreamToken,writes:e.map(r=>uI(this.serializer,r))};this.nn(t)}}/**
2464 * @license
2465 * Copyright 2017 Google LLC
2466 *
2467 * Licensed under the Apache License, Version 2.0 (the "License");
2468 * you may not use this file except in compliance with the License.
2469 * You may obtain a copy of the License at
2470 *
2471 *   http://www.apache.org/licenses/LICENSE-2.0
2472 *
2473 * Unless required by applicable law or agreed to in writing, software
2474 * distributed under the License is distributed on an "AS IS" BASIS,
2475 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2476 * See the License for the specific language governing permissions and
2477 * limitations under the License.
2478 */class LI{}class kI extends LI{constructor(e,t,r,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=r,this.serializer=s,this.mn=!1}pn(){if(this.mn)throw new G(L.FAILED_PRECONDITION,"The client has already been terminated.")}nt(e,t,r,s){return this.pn(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection.nt(e,fc(t,r),s,i,o)).catch(i=>{throw i.name==="FirebaseError"?(i.code===L.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new G(L.UNKNOWN,i.toString())})}_t(e,t,r,s,i){return this.pn(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,B])=>this.connection._t(e,fc(t,r),s,o,B,i)).catch(o=>{throw o.name==="FirebaseError"?(o.code===L.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new G(L.UNKNOWN,o.toString())})}terminate(){this.mn=!0,this.connection.terminate()}}function VI(n,e,t,r){return new kI(n,e,t,r)}/**
2479 * @license
2480 * Copyright 2020 Google LLC
2481 *
2482 * Licensed under the Apache License, Version 2.0 (the "License");
2483 * you may not use this file except in compliance with the License.
2484 * You may obtain a copy of the License at
2485 *
2486 *   http://www.apache.org/licenses/LICENSE-2.0
2487 *
2488 * Unless required by applicable law or agreed to in writing, software
2489 * distributed under the License is distributed on an "AS IS" BASIS,
2490 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2491 * See the License for the specific language governing permissions and
2492 * limitations under the License.
2493 */const xI="ComponentProvider",vf=new Map;function MI(n,e,t,r,s){return new Cy(n,e,t,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,Cp(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator,r,s._customHeaders,s.grpcFlowControlWindow)}/**
2494 * @license
2495 * Copyright 2018 Google LLC
2496 *
2497 * Licensed under the Apache License, Version 2.0 (the "License");
2498 * you may not use this file except in compliance with the License.
2499 * You may obtain a copy of the License at
2500 *
2501 *   http://www.apache.org/licenses/LICENSE-2.0
2502 *
2503 * Unless required by applicable law or agreed to in writing, software
2504 * distributed under the License is distributed on an "AS IS" BASIS,
2505 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2506 * See the License for the specific language governing permissions and
2507 * limitations under the License.
2508 */const bf={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},mp=41943040;class ht{static withCacheSize(e){return new ht(e,ht.DEFAULT_COLLECTION_PERCENTILE,ht.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=r}}ht.DEFAULT_COLLECTION_PERCENTILE=10,ht.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,ht.DEFAULT=new ht(mp,ht.DEFAULT_COLLECTION_PERCENTILE,ht.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),ht.DISABLED=new ht(-1,0,0);/**
2509 * @license
2510 * Copyright 2018 Google LLC
2511 *
2512 * Licensed under the Apache License, Version 2.0 (the "License");
2513 * you may not use this file except in compliance with the License.
2514 * You may obtain a copy of the License at
2515 *
2516 *   http://www.apache.org/licenses/LICENSE-2.0
2517 *
2518 * Unless required by applicable law or agreed to in writing, software
2519 * distributed under the License is distributed on an "AS IS" BASIS,
2520 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2521 * See the License for the specific language governing permissions and
2522 * limitations under the License.
2523 */class Na{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=r=>this.gn(r),this.yn=r=>t.writeSequenceNumber(r))}gn(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.yn&&this.yn(e),e}}Na.wn=-1;/**
2524 * @license
2525 * Copyright 2020 Google LLC
2526 *
2527 * Licensed under the Apache License, Version 2.0 (the "License");
2528 * you may not use this file except in compliance with the License.
2529 * You may obtain a copy of the License at
2530 *
2531 *   http://www.apache.org/licenses/LICENSE-2.0
2532 *
2533 * Unless required by applicable law or agreed to in writing, software
2534 * distributed under the License is distributed on an "AS IS" BASIS,
2535 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2536 * See the License for the specific language governing permissions and
2537 * limitations under the License.
2538 */const GI="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class UI{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
2539 * @license
2540 * Copyright 2017 Google LLC
2541 *
2542 * Licensed under the Apache License, Version 2.0 (the "License");
2543 * you may not use this file except in compliance with the License.
2544 * You may obtain a copy of the License at
2545 *
2546 *   http://www.apache.org/licenses/LICENSE-2.0
2547 *
2548 * Unless required by applicable law or agreed to in writing, software
2549 * distributed under the License is distributed on an "AS IS" BASIS,
2550 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2551 * See the License for the specific language governing permissions and
2552 * limitations under the License.
2553 */async function ws(n){if(n.code!==L.FAILED_PRECONDITION||n.message!==GI)throw n;K("LocalStore","Unexpectedly lost primary lease")}/**
2554 * @license
2555 * Copyright 2017 Google LLC
2556 *
2557 * Licensed under the Apache License, Version 2.0 (the "License");
2558 * you may not use this file except in compliance with the License.
2559 * You may obtain a copy of the License at
2560 *
2561 *   http://www.apache.org/licenses/LICENSE-2.0
2562 *
2563 * Unless required by applicable law or agreed to in writing, software
2564 * distributed under the License is distributed on an "AS IS" BASIS,
2565 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2566 * See the License for the specific language governing permissions and
2567 * limitations under the License.
2568 */class x{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)},t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&X(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new x((r,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(r,s)},this.catchCallback=i=>{this.wrapFailure(t,i).next(r,s)}})}toPromise(){return new Promise((e,t)=>
2568{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof x?t:x.resolve(t)}catch(t){return x.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):x.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):x.reject(t)}static resolve(e){return new x((t,r)=>{t(e)})}static reject(e){return new x((t,r)=>{r(e)})}static waitFor(e){return new x((t,r)=>{let s=0,i=0,o=!1;e.forEach(B=>{++s,B.next(()=>{++i,o&&i===s&&t()},c=>r(c))}),o=!0,i===s&&t()})}static or(e){let t=x.resolve(!1);for(const r of e)t=t.next(s=>s?x.resolve(s):r());return t}static forEach(e,t){const r=[];return e.forEach((s,i)=>{r.push(t.call(this,s,i))}),this.waitFor(r)}static mapArray(e,t){return new x((r,s)=>{const i=e.length,o=new Array(i);let B=0;for(let c=0;c<i;c++){const u=c;t(e[u]).next(h=>{o[u]=h,++B,B===i&&r(o)},h=>s(h))}})}static doWhile(e,t){return new x((r,s)=>{const i=()=>{e()===!0?t().next(()=>{i()},s):r()};i()})}}function HI(n){const e=n.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function ys(n){return n.name==="IndexedDbTransactionError"}/**
2569 * @license
2570 * Copyright 2020 Google LLC
2571 *
2572 * Licensed under the Apache License, Version 2.0 (the "License");
2573 * you may not use this file except in compliance with the License.
2574 * You may obtain a copy of the License at
2575 *
2576 *   http://www.apache.org/licenses/LICENSE-2.0
2577 *
2578 * Unless required by applicable law or agreed to in writing, software
2579 * distributed under the License is distributed on an "AS IS" BASIS,
2580 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2581 * See the License for the specific language governing permissions and
2582 * limitations under the License.
2583 */const Sf="LruGarbageCollector",qI=1048576;function Pf([n,e],[t,r]){const s=ae(n,t);return s===0?ae(e,r):s}class JI{constructor(e){this.Yn=e,this.buffer=new Ve(Pf),this.Zn=0}Xn(){return++this.Zn}er(e){const t=[e,this.Xn()];if(this.buffer.size<this.Yn)this.buffer=this.buffer.add(t);else{const r=this.buffer.last();Pf(t,r)<0&&(this.buffer=this.buffer.delete(r).add(t))}}get maxValue(){return this.buffer.last()[0]}}class jI{constructor(e,t,r){this.garbageCollector=e,this.asyncQueue=t,this.localStore=r,this.tr=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.nr(6e4)}stop(){this.tr&&(this.tr.cancel(),this.tr=null)}get started(){return this.tr!==null}nr(e){K(Sf,`Garbage collection scheduled in ${e}ms`),this.tr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.tr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){ys(t)?K(Sf,"Ignoring IndexedDB error during garbage collection: ",t):await ws(t)}await this.nr(3e5)})}}class KI{constructor(e,t){this.rr=e,this.params=t}calculateTargetCount(e,t){return this.rr.ir(e).next(r=>Math.floor(t/100*r))}nthSequenceNumber(e,t){if(t===0)return x.resolve(Na.wn);const r=new JI(t);return this.rr.forEachTarget(e,s=>r.er(s.sequenceNumber)).next(()=>this.rr.sr(e,s=>r.er(s))).next(()=>r.maxValue)}removeTargets(e,t,r){return this.rr.removeTargets(e,t,r)}removeOrphanedDocuments(e,t){return this.rr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(K("LruGarbageCollector","Garbage collection skipped; disabled"),x.resolve(bf)):this.getCacheSize(e).next(r=>r<this.params.cacheSizeCollectionThreshold?(K("LruGarbageCollector",`Garbage collection skipped; Cache size ${r} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),bf):this._r(e,t))}getCacheSize(e){return this.rr.getCacheSize(e)}_r(e,t){let r,s,i,o,B,c,u;const h=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(d=>(d>this.params.maximumSequenceNumbersToCollect?(K("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${d}`),s=this.params.maximumSequenceNumbersToCollect):s=d,o=Date.now(),this.nthSequenceNumber(e,s))).next(d=>(r=d,B=Date.now(),this.removeTargets(e,r,t))).next(d=>(i=d,c=Date.now(),this.removeOrphanedDocuments(e,r))).next(d=>(u=Date.now(),Qr()<=ce.DEBUG&&K("LruGarbageCollector",`LRU Garbage Collection
2584	Counted targets in ${o-h}ms
2585	Determined least recently used ${s} in `+(B-o)+`ms
2586	Removed ${i} targets in `+(c-B)+`ms
2587	Removed ${d} documents in `+(u-c)+`ms
2588Total Duration: ${u-h}ms`),x.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:d})))}}function zI(n,e){return new KI(n,e)}/**
2589 * @license
2590 * Copyright 2020 Google LLC
2591 *
2592 * Licensed under the Apache License, Version 2.0 (the "License");
2593 * you may not use this file except in compliance with the License.
2594 * You may obtain a copy of the License at
2595 *
2596 *   http://www.apache.org/licenses/LICENSE-2.0
2597 *
2598 * Unless required by applicable law or agreed to in writing, software
2599 * distributed under the License is distributed on an "AS IS" BASIS,
2600 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2601 * See the License for the specific language governing permissions and
2602 * limitations under the License.
2603 */const Ep="firestore.googleapis.com",Of=!0;class Nf{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new G(L.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Ep,this.ssl=Of}else this.host=e.host,this.ssl=e.ssl??Of;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e._customHeaders&&(this._customHeaders={...e._customHeaders}),e.cacheSizeBytes===void 0)this.cacheSizeBytes=mp;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<qI)throw new G(L.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}if(hy("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Cp(e.experimentalLongPollingOptions??{}),function(r){if(r.timeoutSeconds!==void 0){if(isNaN(r.timeoutSeconds))throw new G(L.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (must not be NaN)`);if(r.timeoutSeconds<5)throw new G(L.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (minimum allowed value is 5)`);if(r.timeoutSeconds>30)throw new G(L.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams,e.grpcFlowControlWindow!==void 0){if(typeof e.grpcFlowControlWindow!="number"||e.grpcFlowControlWindow<=0||e.grpcFlowControlWindow>2147483647||!Number.isInteger(e.grpcFlowControlWindow))throw new G(L.INVALID_ARGUMENT,"grpcFlowControlWindow must be a positive integer and cannot exceed 2147483647");this.grpcFlowControlWindow=e.grpcFlowControlWindow}}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,s){return r.timeoutSeconds===s.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams&&this.grpcFlowControlWindow===e.grpcFlowControlWindow&&function(r,s){if(r===s)return!0;if(!r||!s)return!1;const i=Object.keys(r),o=Object.keys(s);if(i.length!==o.length)return!1;for(const B of i)if(r[B]!==s[B])return!1;return!0}(this._customHeaders,e._customHeaders)}}let Fa=class{constructor(e,t,r,s){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Nf({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new G(L.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new G(L.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Nf(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new wI;switch(r.type){case"firstParty":return new AI(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new G(L.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invali
2603d credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const r=vf.get(t);r&&(K(xI,"Removing Datastore"),vf.delete(t),r.terminate())}(this),Promise.resolve()}};function WI(n,e,t,r={}){var u;n=He(n,Fa);const s=sr(e),i=n._getSettings(),o={...i,emulatorOptions:n._getEmulatorOptions()},B=`${e}:${t}`;s&&vc(`https://${B}`),i.host!==Ep&&i.host!==B&&Gt("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const c={...i,host:B,ssl:s,emulatorOptions:r};if(!Ar(c,o)&&(n._setSettings(c),r.mockUserToken)){let h,d;if(typeof r.mockUserToken=="string")h=r.mockUserToken,d=Qe.MOCK_USER;else{h=Rd(r.mockUserToken,(u=n._app)==null?void 0:u.options.projectId);const p=r.mockUserToken.sub||r.mockUserToken.user_id;if(!p)throw new G(L.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");d=new Qe(p)}n._authCredentials=new yI(new dp(h,d))}}/**
2604 * @license
2605 * Copyright 2020 Google LLC
2606 *
2607 * Licensed under the Apache License, Version 2.0 (the "License");
2608 * you may not use this file except in compliance with the License.
2609 * You may obtain a copy of the License at
2610 *
2611 *   http://www.apache.org/licenses/LICENSE-2.0
2612 *
2613 * Unless required by applicable law or agreed to in writing, software
2614 * distributed under the License is distributed on an "AS IS" BASIS,
2615 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2616 * See the License for the specific language governing permissions and
2617 * limitations under the License.
2618 */class Ht{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new Ht(this.firestore,e,this._query)}}class Re{constructor(e,t,r){this.converter=t,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new qn(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Re(this.firestore,e,this._key)}toJSON(){return{type:Re._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,r){if(xi(t,Re._jsonSchema))return new Re(e,r||null,new Q(Ce.fromString(t.referencePath)))}}Re._jsonSchemaVersion="firestore/documentReference/1.0",Re._jsonSchema={type:ke("string",Re._jsonSchemaVersion),referencePath:ke("string")};class qn extends Ht{constructor(e,t,r){super(e,t,Sa(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Re(this.firestore,null,new Q(e))}withConverter(e){return new qn(this.firestore,e,this._path)}}function vP(n,e,...t){if(n=fe(n),bC("collection","path",e),n instanceof Fa){const r=Ce.fromString(e,...t);return of(r),new qn(n,null,r)}{if(!(n instanceof Re||n instanceof qn))throw new G(L.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(Ce.fromString(e,...t));return of(r),new qn(n.firestore,null,r)}}function $I(n,e,...t){if(n=fe(n),arguments.length===1&&(e=Hc.newId()),bC("doc","path",e),n instanceof Fa){const r=Ce.fromString(e,...t);return sf(r),new Re(n,null,new Q(r))}{if(!(n instanceof Re||n instanceof qn))throw new G(L.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(Ce.fromString(e,...t));return sf(r),new Re(n.firestore,n instanceof qn?n.converter:null,new Q(r))}}/**
2619 * @license
2620 * Copyright 2017 Google LLC
2621 *
2622 * Licensed under the Apache License, Version 2.0 (the "License");
2623 * you may not use this file except in compliance with the License.
2624 * You may obtain a copy of the License at
2625 *
2626 *   http://www.apache.org/licenses/LICENSE-2.0
2627 *
2628 * Unless required by applicable law or agreed to in writing, software
2629 * distributed under the License is distributed on an "AS IS" BASIS,
2630 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2631 * See the License for the specific language governing permissions and
2632 * limitations under the License.
2633 *//**
2634 * @license
2635 * Copyright 2024 Google LLC
2636 *
2637 * Licensed under the Apache License, Version 2.0 (the "License");
2638 * you may not use this file except in compliance with the License.
2639 * You may obtain a copy of the License at
2640 *
2641 *   http://www.apache.org/licenses/LICENSE-2.0
2642 *
2643 * Unless required by applicable law or agreed to in writing, software
2644 * distributed under the License is distributed on an "AS IS" BASIS,
2645 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2646 * See the License for the specific language governing permissions and
2647 * limitations under the License.
2648 */class pt{constructor(e){this._values=(e||[]).map(t=>t)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,s){if(r.length!==s.length)return!1;for(let i=0;i<r.length;++i)if(r[i]!==s[i])return!1;return!0}(this._values,e._values)}toJSON(){return{type:pt._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(xi(e,pt._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(t=>typeof t=="number"))return new pt(e.vectorValues);throw new G(L.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}pt._jsonSchemaVersion="firestore/vectorValue/1.0",pt._jsonSchema={type:ke("string",pt._jsonSchemaVersion),vectorValues:ke("object")};/**
2649 * @license
2650 * Copyright 2017 Google LLC
2651 *
2652 * Licensed under the Apache License, Version 2.0 (the "License");
2653 * you may not use this file except in compliance with the License.
2654 * You may obtain a copy of the License at
2655 *
2656 *   http://www.apache.org/licenses/LICENSE-2.0
2657 *
2658 * Unless required by applicable law or agreed to in writing, software
2659 * distributed under the License is distributed on an "AS IS" BASIS,
2660 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2661 * See the License for the specific language governing permissions and
2662 * limitations under the License.
2663 */const QI=/^__.*__$/;class YI{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return this.fieldMask!==null?new or(e,this.data,this.fieldMask,t,this.fieldTransforms):new Ui(e,this.data,t,this.fieldTransforms)}}class _p{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return new or(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function Dp(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw X(40011,{dataSource:n})}}class La{constructor(e,t,r,s,i,o){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.validatePath(),this.fieldTransforms=i||[],this.fieldMask=o||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(e){return new La({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){var s;const t=(s=this.path)==null?void 0:s.child(e),r=this.contextWith({path:t,arrayElement:!1});return r.validatePathSegment(e),r}childContextForFieldPath(e){var s;const t=(s=this.path)==null?void 0:s.child(e),r=this.contextWith({path:t,arrayElement:!1});return r.validatePath(),r}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return ia(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}validatePath(){if(this.path)for(let e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))}validatePathSegment(e){if(e.length===0)throw this.createError("Document fields must not be empty");if(Dp(this.dataSource)&&QI.test(e))throw this.createError('Document fields cannot begin and end with "__"')}}class XI{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer
2663=r||Oa(e)}createContext(e,t,r,s=!1){return new La({dataSource:e,methodName:t,targetDoc:r,path:At.emptyPath(),arrayElement:!1,hasConverter:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function Is(n){const e=n._freezeSettings(),t=Oa(n._databaseId);return new XI(n._databaseId,!!e.ignoreUndefinedProperties,t)}function Zc(n,e,t,r,s,i={}){const o=n.createContext(i.merge||i.mergeFields?2:0,e,t,s);ru("Data must be an object, but it was:",o,r);const B=Ap(r,o);let c,u;if(i.merge)c=new yt(o.fieldMask),u=o.fieldTransforms;else if(i.mergeFields){const h=[];for(const d of i.mergeFields){const p=Xn(e,d,t);if(!o.contains(p))throw new G(L.INVALID_ARGUMENT,`Field '${p}' is specified in your field mask but missing from your input data.`);Sp(h,p)||h.push(p)}c=new yt(h),u=o.fieldTransforms.filter(d=>c.covers(d.field))}else c=null,u=o.fieldTransforms;return new YI(new ot(B),c,u)}class ji extends Ds{_toFieldTransform(e){if(e.dataSource!==2)throw e.dataSource===1?e.createError(`${this._methodName}() can only appear at the top level of your update data`):e.createError(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof ji}}function wp(n,e,t){return new La({dataSource:3,targetDoc:e.settings.targetDoc,methodName:n._methodName,arrayElement:t},e.databaseId,e.serializer,e.ignoreUndefinedProperties)}class eu extends Ds{_toFieldTransform(e){return new zc(e.path,new wi)}isEqual(e){return e instanceof eu}}class tu extends Ds{constructor(e,t){super(e),this.ar=t}_toFieldTransform(e){const t=wp(this,e,!0),r=this.ar.map(i=>Zt(i,t)),s=new ls(r);return new zc(e.path,s)}isEqual(e){return e instanceof tu&&Ar(this.ar,e.ar)}}class nu extends Ds{constructor(e,t){super(e),this.ar=t}_toFieldTransform(e){const t=wp(this,e,!0),r=this.ar.map(i=>Zt(i,t)),s=new hs(r);return new zc(e.path,s)}isEqual(e){return e instanceof nu&&Ar(this.ar,e.ar)}}function yp(n,e,t,r){const s=n.createContext(1,e,t);ru("Data must be an object, but it was:",s,r);const i=[],o=ot.empty();ir(r,(c,u)=>{const h=bp(e,c,t);u=fe(u);const d=s.childContextForFieldPath(h);if(u instanceof ji)i.push(h);else{const p=Zt(u,d);p!=null&&(i.push(h),o.set(h,p))}});const B=new yt(i);return new _p(o,B,s.fieldTransforms)}function Ip(n,e,t,r,s,i){const o=n.createContext(1,e,t),B=[Xn(e,r,t)],c=[s];if(i.length%2!=0)throw new G(L.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let p=0;p<i.length;p+=2)B.push(Xn(e,i[p])),c.push(i[p+1]);const u=[],h=ot.empty();for(let p=B.length-1;p>=0;--p)if(!Sp(u,B[p])){const _=B[p];let y=c[p];y=fe(y);const O=o.childContextForFieldPath(_);if(y instanceof ji)u.push(_);else{const V=Zt(y,O);V!=null&&(u.push(_),h.set(_,V))}}const d=new yt(u);return new _p(h,d,o.fieldTransforms)}function Tp(n,e,t,r=!1){return Zt(t,n.createContext(r?4:3,e))}function Zt(n,e,t){if(vp(n=fe(n)))return ru("Unsupported field value:",e,n),Ap(n,e);if(n instanceof Ds)return function(s,i){if(!Dp(i.dataSource))throw i.createError(`${s._methodName}() can only be used with update() and set()`);if(!i.path)throw i.createError(`${s._methodName}() is not currently supported inside arrays`);const o=s._toFieldTransform(i);o&&i.fieldTransforms.push(o)}(n,e),null;if(n===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),n instanceof Array){if(e.settings.arrayElement&&e.dataSource!==4)throw e.createError("Nested arrays are not supported");return function(s,i){const o=[];let B=0;for(const c of s){let u=Zt(c,i.childContextForArray(B));u==null&&(u={nullValue:"NULL_VALUE"}),o.push(u),B++}return{arrayValue:{values:o}}}(n,e)}return function(s,i,o){if((s=fe(s))===null)return{nullValue:"NULL_VALUE"};if(typeof s=="number")return jc(i.serializer,s);if(typeof s=="boolean")return{booleanValue:s};if(typeof s=="string")return{stringValue:s};if(s instanceof Date){const B=ge.fromDate(s);return{timestampValue:ci(i.serializer,B)}}if(s instanceof ge){const B=new ge(s.seconds,1e3*Math.floor(s.nanoseconds/1e3));return{timestampValue:ci(i.serializer,B)}}if(Rp(s)){const B=ge.fromInstant(s),c=new ge(B.seconds,1e3*Math.floor(B.nanoseconds/1e3));return{timestampValue:ci(i.serializer,c)}}if(s instanceof Xt)return{geoPointValue:{latitude:s.latitude,longitude:s.longitude}};if(s instanceof St)return{bytesValue:ip(i.serializer,s._byteString)};if(s instanceof Re){const B=i.databaseId,c=s.firestore._databaseId;if(!c.isEqual(B))throw i.createError(`Document reference is for database ${c.projectId}/${c.database} but should be for database ${B.projectId}/${B.database}`);return{referenceValue:Xc(s.firestore._databaseId||i.databaseId,s._key.path)}}if(s instanceof pt)return function(c,u){const h=c instanceof pt?c.toArray():c;return{mapValue:{fields:{[LC]:{stringValue:kC},[_i]:{arrayValue:{values:h.map(p=>{if(typeof p!="number")throw u.createError("VectorValues must only contain numeric values.");return Aa(u.serializer,p)})}}}}}}(s,i);if(hp(s))return s._toProto(i.serializer);throw i.createError(`Unsupported field value: ${Ia(s)}`)}(n,e)}function Ap(n,e){const t={};return vC(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):ir(n,(r,s)=>{const i=Zt(s,e.childContextForField(r));i!=null&&(t[r]=i)}),{mapValue:{fields:t}}}function Rp(n){if(typeof n!="object"||n===null)return!1;if(typeof Temporal<"u"&&typeof Temporal.Instant=="function"&&n instanceof Temporal.Instant)return!0;const e=n;return e[Symbol.toStringTag]==="Temporal.Instant"&&typeof e.t=="bigint"}function vp(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof ge||n instanceof Xt||n instanceof St||n instanceof Re||n instanceof Ds||n instanceof pt||Rp(n)||hp(n))}function ru(n,e,t){if(!vp(t)||!Vi(t)){const r=Ia(t);throw r==="an object"?e.createError(n+" a custom object"):e.createError(n+" "+r)}}function Xn(n,e,t){if((e=fe(e))instanceof Ji)return e._internalPath;if(typeof e=="string")return bp(n,e);throw ia("Field path arguments must be of type string or ",n,!1,void 0,t)}const ZI=new RegExp("[~\\*/\\[\\]]");function bp(n,e,t){if(e.search(ZI)>=0)throw ia(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,t);try{return new Ji(...e.split("."))._internalPath}catch{throw ia(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,t)}}function ia(n,e,t,r,s){const i=r&&!r.isEmpty(),o=s!==void 0;let B=`Function ${e}
2663() called with invalid data`;t&&(B+=" (via `toFirestore()`)"),B+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new G(L.INVALID_ARGUMENT,B+n+c)}function Sp(n,e){return n.some(t=>t.isEqual(e))}function Pp(n){return typeof n._readUserData=="function"}/**
2664 * @license
2665 * Copyright 2025 Google LLC
2666 *
2667 * Licensed under the Apache License, Version 2.0 (the "License");
2668 * you may not use this file except in compliance with the License.
2669 * You may obtain a copy of the License at
2670 *
2671 *   http://www.apache.org/licenses/LICENSE-2.0
2672 *
2673 * Unless required by applicable law or agreed to in writing, software
2674 * distributed under the License is distributed on an "AS IS" BASIS,
2675 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2676 * See the License for the specific language governing permissions and
2677 * limitations under the License.
2678 */class tt{constructor(e){this.optionDefinitions=e}_getKnownOptions(e,t){const r=ot.empty();for(const s in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(s)){const i=this.optionDefinitions[s];if(s in e){const o=e[s];let B;i.nestedOptions&&Vi(o)?B={mapValue:{fields:new tt(i.nestedOptions).getOptionsProto(t,o)}}:o&&(B=Zt(o,t)??void 0),B&&r.set(At.fromServerFormat(i.serverName),B)}}return r}getOptionsProto(e,t,r){const s=this._getKnownOptions(t,e);if(r){const i=new Map(ly(r,(o,B)=>[At.fromServerFormat(B),o!==void 0?Zt(o,e):null]));s.setAll(i)}return s.value.mapValue.fields??{}}}/**
2679 * @license
2680 * Copyright 2024 Google LLC
2681 *
2682 * Licensed under the Apache License, Version 2.0 (the "License");
2683 * you may not use this file except in compliance with the License.
2684 * You may obtain a copy of the License at
2685 *
2686 *   http://www.apache.org/licenses/LICENSE-2.0
2687 *
2688 * Unless required by applicable law or agreed to in writing, software
2689 * distributed under the License is distributed on an "AS IS" BASIS,
2690 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2691 * See the License for the specific language governing permissions and
2692 * limitations under the License.
2693 */function eT(n){return typeof n=="object"&&n!==null&&!!("nullValue"in n&&(n.nullValue===null||n.nullValue==="NULL_VALUE")||"booleanValue"in n&&(n.booleanValue===null||typeof n.booleanValue=="boolean")||"integerValue"in n&&(n.integerValue===null||typeof n.integerValue=="number"||typeof n.integerValue=="string")||"doubleValue"in n&&(n.doubleValue===null||typeof n.doubleValue=="number")||"timestampValue"in n&&(n.timestampValue===null||function(t){return typeof t=="object"&&t!==null&&"seconds"in t&&(t.seconds===null||typeof t.seconds=="number"||typeof t.seconds=="string")&&"nanos"in t&&(t.nanos===null||typeof t.nanos=="number")}(n.timestampValue))||"stringValue"in n&&(n.stringValue===null||typeof n.stringValue=="string")||"bytesValue"in n&&(n.bytesValue===null||n.bytesValue instanceof Uint8Array)||"referenceValue"in n&&(n.referenceValue===null||typeof n.referenceValue=="string")||"geoPointValue"in n&&(n.geoPointValue===null||function(t){return typeof t=="object"&&t!==null&&"latitude"in t&&(t.latitude===null||typeof t.latitude=="number")&&"longitude"in t&&(t.longitude===null||typeof t.longitude=="number")}(n.geoPointValue))||"arrayValue"in n&&(n.arrayValue===null||function(t){return typeof t=="object"&&t!==null&&!(!("values"in t)||t.values!==null&&!Array.isArray(t.values))}(n.arrayValue))||"mapValue"in n&&(n.mapValue===null||function(t){return typeof t=="object"&&t!==null&&!(!("fields"in t)||t.fields!==null&&!Vi(t.fields))}(n.mapValue))||"fieldReferenceValue"in n&&(n.fieldReferenceValue===null||typeof n.fieldReferenceValue=="string")||"functionValue"in n&&(n.functionValue===null||function(t){return typeof t=="object"&&t!==null&&!(!("name"in t)||t.name!==null&&typeof t.name!="string"||!("args"in t)||t.args!==null&&!Array.isArray(t.args))}(n.functionValue))||"pipelineValue"in n&&(n.pipelineValue===null||function(t){return typeof t=="object"&&t!==null&&!(!("stages"in t)||t.stages!==null&&!Array.isArray(t.stages))}(n.pipelineValue)))}/**
2694 * @license
2695 * Copyright 2020 Google LLC
2696 *
2697 * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 10,087 bytes, lines 2698-2723
2698 * you may not use this file except in compliance with the License.
2699 * You may obtain a copy of the License at
2700 *
2701 *   http://www.apache.org/licenses/LICENSE-2.0
2702 *
2703 * Unless required by applicable law or agreed to in writing, software
2704 * distributed under the License is distributed on an "AS IS" BASIS,
2705 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2706 * See the License for the specific language governing permissions and
2707 * limitations under the License.
2708 */function bP(){return new ji("deleteField")}function SP(){return new eu("serverTimestamp")}function PP(...n){return new tu("arrayUnion",n)}function OP(...n){return new nu("arrayRemove",n)}function tT(n){return new pt(n)}/**
2709 * @license
2710 * Copyright 2024 Google LLC
2711 *
2712 * Licensed under the Apache License, Version 2.0 (the "License");
2713 * you may not use this file except in compliance with the License.
2714 * You may obtain a copy of the License at
2715 *
2716 *   http://www.apache.org/licenses/LICENSE-2.0
2717 *
2718 * Unless required by applicable law or agreed to in writing, software
2719 * distributed under the License is distributed on an "AS IS" BASIS,
2720 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2721 * See the License for the specific language governing permissions and
2722 * limitations under the License.
2723 */function q(n){let e;return n instanceof Gr?n:(e=Vi(n)?oT(n):n instanceof Array?aT(n):Op(n,void 0),e)}function VB(n){if(n instanceof Gr)return n;if(n instanceof pt)return Ri(n);if(Array.isArray(n))return Ri(tT(n));throw new Error("Unsupported value: "+typeof n)}function su(n){return my(n)?Mo(n):q(n)}class Gr{constructor(){this._protoValueType="ProtoValue"}add(e){return new k("add",[this,q(e)],"add")}asBoolean(){if(this instanceof Zn)return this;if(this instanceof As)return new Fp(this);if(this instanceof Ts)return new iT(this);if(this instanceof k)return new Np(this);throw new G("invalid-argument",`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(e){return new k("subtract",[this,q(e)],"subtract")}multiply(e){return new k("multiply",[this,q(e)],"multiply")}divide(e){return new k("divide",[this,q(e)],"divide")}mod(e){return new k("mod",[this,q(e)],"mod")}equal(e){return new k("equal",[this,q(e)],"equal").asBoolean()}notEqual(e){return new k("not_equal",[this,q(e)],"notEqual").asBoolean()}lessThan(e){return new k("less_than",[this,q(e)],"lessThan").asBoolean()}lessThanOrEqual(e){return new k("less_than_or_equal",[this,q(e)],"lessThanOrEqual").asBoolean()}greaterThan(e){return new k("greater_than",[this,q(e)],"greaterThan").asBoolean()}greaterThanOrEqual(e){return new k("greater_than_or_equal",[this,q(e)],"greaterThanOrEqual").asBoolean()}arrayConcat(e,...t){const r=[e,...t].map(s=>q(s));return new k("array_concat",[this,...r],"arrayConcat")}arrayContains(e){return new k("array_contains",[this,q(e)],"arrayContains").asBoolean()}arrayContainsAll(e){const t=Array.isArray(e)?new ti(e.map(q),"arrayContainsAll"):e;return new k("array_contains_all",[this,t],"arrayContainsAll").asBoolean()}arrayContainsAny(e){const t=Array.isArray(e)?new ti(e.map(q),"arrayContainsAny"):e;return new k("array_contains_any",[this,t],"arrayContainsAny").asBoolean()}arrayReverse(){return new k("array_reverse",[this])}arrayLength(){return new k("array_length",[this],"arrayLength")}equalAny(e){const t=Array.isArray(e)?new ti(e.map(q),"equalAny"):e;return new k("equal_any",[this,t],"equalAny").asBoolean()}notEqualAny(e){const t=Array.isArray(e)?new ti(e.map(q),"notEqualAny"):e;return new k("not_equal_any",[this,t],"notEqualAny").asBoolean()}exists(){return new k("exists",[this],"exists").asBoolean()}charLength(){return new k("char_length",[this],"charLength")}like(e){return new k("like",[this,q(e)],"like").asBoolean()}regexContains(e){return new k("regex_contains",[this,q(e)],"regexContains").asBoolean()}regexFind(e){return new k("regex_find",[this,q(e)],"regexFind")}regexFindAll(e){return new k("regex_find_all",[this,q(e)],"regexFindAll")}regexMatch(e){return new k("regex_match",[this,q(e)],"regexMatch").asBoolean()}stringContains(e){return new k("string_contains",[this,q(e)],"stringContains").asBoolean()}startsWith(e){return new k("starts_with",[this,q(e)],"startsWith").asBoolean()}endsWith(e){return new k("ends_with",[this,q(e)],"endsWith").asBoolean()}toLower(){return new k("to_lower",[this],"toLower")}toUpper(){return new k("to_upper",[this],"toUpper")}trim(e){const t=[this];return e&&t.push(q(e)),new k("trim",t,"trim")}ltrim(e){const t=[this];return e&&t.push(q(e)),new k("ltrim",t,"ltrim")}rtrim(e){const t=[this];return e&&t.push(q(e)),new k("rtrim",t,"rtrim")}type(){return new k("type",[this])}isType(e){return new k("is_type",[this,Ri(e)],"isType").asBoolean()}stringConcat(e,...t){const r=[e,...t].map(q);return new k("string_concat",[this,...r],"stringConcat")}stringIndexOf(e){return new k("string_index_of",[this,q(e)],"stringIndexOf")}stringRepeat(e){return new k("string_repeat",[this,q(e)],"stringRepeat")}stringReplaceAll(e,t){return new k("string_replace_all",[this,q(e),q(t)],"stringReplaceAll")}stringReplaceOne(e,t){return new k("string_replace_one",[this,q(e),q(t)],"stringReplaceOne")}concat(e,...t){const r=[e,...t].map(q);return new k("concat",[this,...r],"concat")}reverse(){return new k("reverse",[this],"reverse")}arrayFilter(e,t){return new k("array_filter",[this,q(e),t],"arrayFilter")}arrayTransform(e,t){return new k("array_transform",[this,q(e),t],"arrayTransform")}arrayTransformWithIndex(e,t,r){return new k("array_transform",[this,q(e),q(t),r],"arrayTransformWithIndex")}arraySlice(e,t){const r=[this,q(e)];return t!==void 0&&r.push(q(t)),new k("array_slice",r,"arraySlice")}arrayFirst(){return new k("array_first",[this],"arrayFirst")}arrayFirstN(e){return new k("array_first_n",[this,q(e)],"arrayFirstN")}arrayLast(){return new k("array_last",[this],"arrayLast")}arrayLastN(e){return new k("array_last_n",[this,q(e)],"arrayLastN")}arrayMaximum(){return new k("maximum",[this],"arrayMaximum")}arrayMaximumN(e){return new k("maximum_n",[this,q(e)],"arrayMaximumN")}arrayMinimum(){return new k("minimum",[this],"arrayMinimum")}arrayMinimumN(e){return new k("minimum_n",[this,q(e)],"arrayMinimumN")}arrayIndexOf(e){return new k("array_index_of",[this,q(e),q("first")],"arrayIndexOf")}arrayLastIndexOf(e){return new k("array_index_of",[this,q(e),q("last")],"arrayLastIndexOf")}arrayIndexOfAll(e){return new k("array_index_of_all",[this,q(e)],"arrayIndexOfAll")}byteLength(){return new k("byte_length",[this],"byteLength")}ceil(){return new k("ceil",[this])}floor(){return new k("floor",[this])}abs(){return new k("abs",[this])}exp(){return new k("exp",[this])}mapGet(e){return new k("map_get",[this,Ri(e)],"mapGet")}mapSet(e,t,...r){const s=[this,q(e),q(t),...r.map(q)];return new k("map_set",s,"mapSet")}mapKeys(){return new k("map_keys",[this],"mapKeys")}mapValues(){return new k("map_values",[this],"mapValues")}mapEntries(){return new k("map_entries",[this],"mapEntries")}getField(e){return new k("get_field",[this,q(e)],"get_field")}count(){return wt._create("count",[this],"count")}sum(){return wt._create("sum",[this],"sum")}average(){return wt._create("average",[this],"average")}minimum(){return wt._create("minimum",[this],"minimum")}maximum(){return wt._create("maximum",[this],"maximum")}first(){return wt._create("first",[this],"first")}last(){return wt._create("last",[this],"last")}arrayAgg(){return wt._create("array_agg",[this],"arrayAgg")}arrayAggDistinct(){return wt._create("array_agg_distinct",[this],"arrayAggDistinct")}countDistinct(){return wt._create("count_distinct",[this],"countDistinct")}logicalMaximum(e,...t){const r=[e,...t];return new k("maximum",[this,...r.map(q)],"logicalMaximum")}logicalMinimum(e,...t){const r=[e,...t];return new k("minimum",[this,...r.map(q)],"minimum")}vectorLength(){return new k("vector_length",[this],"vectorLength")}cosineDistance(e){return new k("cosine_distance",[this,VB(e)],"cosineDistance")}dotProduct(e){return new k("dot_product",[this,VB(e)],"dotProduct")}euclideanDistance(e){return new k("euclidean_distance",[this,VB(e)],"euclideanDistance")}unixMicrosToTimestamp(){return new k("unix_micros_to_timestamp",[this],"unixMicrosToTimestamp")}timestampToUnixMicros(){return new k("timestamp_to_unix_micros",[this],"timestampToUnixMicros")}unixMillisToTimestamp(){return new k("unix_millis_to_timestamp",[this],"unixMillisToTimestamp")}timestampToUnixMillis(){return new k("timestamp_to_unix_millis",[this],"timestampToUnixMillis")}unixSecondsToTimestamp(){return new k("unix_seconds_to_timestamp",[this],"unixSecondsToTimestamp")}timestampToUnixSeconds(){return new k("timestamp_to_unix_seconds",[this],"timestampToUnixSeconds")}timestampAdd(e,t){return new k("timestamp_add",[this,q(e),q(t)],"timestampAdd")}timestampSubtract(e,t){return new k("timestamp_subtract",[this,q(e),q(t)],"timestampSubtract")}timestampDiff(e,t){return new k("timestamp_diff",[this,su(e),q(t)],"timestampDiff")}timestampExtract(e,t){const r=[this,q(e)];return t&&r.push(q(t)),new k("timestamp_extract",r,"timestampExtract")}documentId(){return new k("document_id",[this],"documentId")}parent(){return new k("parent",[this],"parent")}substring(e,t){const r=q(e);return new k("substring",t===void 0?[this,r]:[this,r,q(t)],"substring")}arrayGet(e){return new k("array_get",[this,q(e)],"arrayGet")}isError(){return new k("is_error",[this],"isError").asBoolean()}ifError(e){const t=new k("if_error",[this,q(e)],"ifError");return e instanceof Zn?t.asBoolean():t}isAbsent(){return new k("is_absent",[this],"isAbsent").asBoolean()}mapRemove(e){return new k("map_remove",[this,q(e)],"mapRemove")}mapMerge(e,...t){const r=q(e),s=t.map(q);return new k("map_merge",[this,r,...s],"mapMerge")}pow(e){return new k("pow",[this,q(e)])}trunc(e){return e===void 0?new k("trunc",[this]):new k("trunc",[this,q(e)],"trunc")}round(e){return e===void 0?new k("round",[this]):new k("round",[this,q(e)],"round")}collectionId(){return new k("collection_id",[this])}length(){return new k("length",[this])}ln(){return new k("ln",[this])}sqrt(){return new k("sqrt",[this])}
vendor: 4,358 bytes, line 2723
2723stringReverse(){return new k("string_reverse",[this])}ifAbsent(e){return new k("if_absent",[this,q(e)],"ifAbsent")}ifNull(e){return new k("if_null",[this,q(e)],"ifNull")}coalesce(e,...t){return new k("coalesce",[this,q(e),...t.map(q)],"coalesce")}join(e){return new k("join",[this,q(e)],"join")}log10(){return new k("log10",[this])}arraySum(){return new k("sum",[this])}split(e){return new k("split",[this,q(e)])}timestampTruncate(e,t){const r=[this,q(e)];return t&&r.push(q(t)),new k("timestamp_trunc",r)}ascending(){return BT(this)}descending(){return cT(this)}as(e){return new rT(this,e,"as")}}class wt{constructor(e,t){this.name=e,this.params=t,this.exprType="AggregateFunction",this._protoValueType="ProtoValue"}static _create(e,t,r){const s=new wt(e,t);return s._methodName=r,s}as(e){return new nT(this,e,"as")}_toProto(e){return{functionValue:{name:this.name,args:this.params.map(t=>t._toProto(e))}}}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach(t=>t._readUserData(e))}}class nT{constructor(e,t,r){this.aggregate=e,this.alias=t,this._methodName=r}_readUserData(e){this.aggregate._readUserData(e)}}class rT{constructor(e,t,r){this.expr=e,this.alias=t,this._methodName=r,this.exprType="AliasedExpression",this.selectable=!0}_readUserData(e){this.expr._readUserData(e)}}class ti extends Gr{constructor(e,t){super(),this.cr=e,this._methodName=t,this.expressionType="ListOfExpressions"}_toProto(e){return{arrayValue:{values:this.cr.map(t=>t._toProto(e))}}}_readUserData(e){this.cr.forEach(t=>t._readUserData(e))}}class Ts extends Gr{constructor(e,t){super(),this.fieldPath=e,this._methodName=t,this.expressionType="Field",this.selectable=!0}get _fieldPath(){return this.fieldPath}get fieldName(){return this.fieldPath.canonicalString()}get alias(){return this.fieldName}get expr(){return this}geoDistance(e){return new k("geo_distance",[this,q(e)],"geoDistance")}_toProto(e){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(e){}}function Mo(n){return sT(n,"field")}function sT(n,e){return new Ts(typeof n=="string"?Kt===n?DI()._internalPath:Xn("field",n):n._internalPath,e)}class As extends Gr{constructor(e,t){super(),this.value=e,this._methodName=t,this.expressionType="Constant"}static _fromProto(e){const t=new As(e,void 0);return t._protoValue=e,t}_toProto(e){return W(this._protoValue!==void 0,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,eT(this._protoValue)||(this._protoValue=Zt(this.value,e))}}function Ri(n,e){return Op(n,"constant")}function Op(n,e){const t=new As(n,e);return typeof n=="boolean"?new Fp(t):t}class k extends Gr{constructor(e,t,r,s){super(),this.name=e,this.params=t,this.expressionType="Function",this._optionsProto=void 0,r!==void 0&&(this._methodName=r),s!==void 0&&(this._options=s)}get _optionsUtil(){return new tt({})}_toProto(e){const t={functionValue:{name:this.name,args:this.params.map(r=>r._toProto(e))}};return this._optionsProto&&(t.functionValue.options=this._optionsProto),t}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach(t=>t._readUserData(e)),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(e,this._options))}}class Zn extends Gr{get _methodName(){return this._expr._methodName}countIf(){return wt._create("count_if",[this],"countIf")}not(){return new k("not",[this],"not").asBoolean()}conditional(e,t){return new k("conditional",[this,e,t],"conditional")}ifError(e){const t=q(e),r=new k("if_error",[this,t],"ifError");return t instanceof Zn?r.asBoolean():r}_toProto(e){return this._expr._toProto(e)}_readUserData(e){this._expr._readUserData(e)}}class Np extends Zn{constructor(e){super(),this._expr=e,this.expressionType="Function"}}class Fp extends Zn{constructor(e){super(),this._expr=e,this.expressionType="Constant"}_getValue(){return this._expr._getValue()}}class iT extends Zn{constructor(e){super(),this._expr=e,this.expressionType="Field"}}function oT(n,e){const t=[];for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const s=n[r];t.push(Ri(r)),t.push(q(s))}return new k("map",t,"map")}function aT(n){return function(t,r){return new k("array",t.map(s=>q(s)),r)}(n,"array")}function BT(n){return new Lp(su(n),"ascending","ascending")}
vendor: 4,911 bytes, lines 2723-2738
2723function cT(n){return new Lp(su(n),"descending","descending")}class Lp{constructor(e,t,r){this.expr=e,this.direction=t,this._methodName=r,this._protoValueType="ProtoValue"}_toProto(e){return{mapValue:{fields:{direction:fp(this.direction),expression:this.expr._toProto(e)}}}}_readUserData(e){this.expr._readUserData(e)}}/**
2724 * @license
2725 * Copyright 2024 Google LLC
2726 *
2727 * Licensed under the Apache License, Version 2.0 (the "License");
2728 * you may not use this file except in compliance with the License.
2729 * You may obtain a copy of the License at
2730 *
2731 *   http://www.apache.org/licenses/LICENSE-2.0
2732 *
2733 * Unless required by applicable law or agreed to in writing, software
2734 * distributed under the License is distributed on an "AS IS" BASIS,
2735 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2736 * See the License for the specific language governing permissions and
2737 * limitations under the License.
2738 */class vt{constructor(e){this.optionsProto=void 0,{rawOptions:this.rawOptions,...this.knownOptions}=e}_readUserData(e){this.optionsProto=this._optionsUtil.getOptionsProto(e,this.knownOptions,this.rawOptions)}_toProto(e){return{name:this._name,options:this.optionsProto}}}class kp extends vt{get _name(){return"add_fields"}get _optionsUtil(){return new tt({})}constructor(e,t){super(t),this.fields=e}_toProto(e){return{...super._toProto(e),args:[Ai(e,this.fields)]}}_readUserData(e){super._readUserData(e),er(this.fields,e)}}class Vp extends vt{get _name(){return"aggregate"}get _optionsUtil(){return new tt({})}constructor(e,t,r){super(r),this.groups=e,this.accumulators=t}_toProto(e){return{...super._toProto(e),args:[Ai(e,this.accumulators),Ai(e,this.groups)]}}_readUserData(e){super._readUserData(e),er(this.groups,e),er(this.accumulators,e)}}class xp extends vt{get _name(){return"distinct"}get _optionsUtil(){return new tt({})}constructor(e,t){super(t),this.groups=e}_toProto(e){return{...super._toProto(e),args:[Ai(e,this.groups)]}}_readUserData(e){super._readUserData(e),er(this.groups,e)}}class ka extends vt{get _name(){return"collection"}get _optionsUtil(){return new tt({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.hr=e.startsWith("/")?e:"/"+e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:this.hr}]}}_readUserData(e){super._readUserData(e)}}class Va extends vt{get _name(){return"collection_group"}get _optionsUtil(){return new tt({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.collectionId=e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:""},{stringValue:this.collectionId}]}}_readUserData(e){super._readUserData(e)}}class iu extends vt{get _name(){return"database"}get _optionsUtil(){return new tt({})}_toProto(e){return{...super._toProto(e)}}_readUserData(e){super._readUserData(e)}}class ou extends vt{get _name(){return"documents"}get _optionsUtil(){return new tt({})}constructor(e,t){if(super(t),!e||e.length===0)throw new G(L.INVALID_ARGUMENT,"Empty document paths are not allowed in DocumentsSource");const r=e.map(i=>i.startsWith("/")?i:"/"+i),s=new Set(r);if(s.size!==r.length)throw new G(L.INVALID_ARGUMENT,"Duplicate document paths are not allowed in DocumentsSource");this.Tr=r,this.Pr=s}_toProto(e){return{...super._toProto(e),args:this.Tr.map(t=>({referenceValue:t}))}}_readUserData(e){super._readUserData(e)}}class xa extends vt{get _name(){return"where"}get _optionsUtil(){return new tt({})}constructor(e,t){super(t),this.condition=e}_toProto(e){return{...super._toProto(e),args:[this.condition._toProto(e)]}}_readUserData(e){super._readUserData(e),er(this.condition,e)}}class Sr extends vt{get _name(){return"limit"}get _optionsUtil(){return new tt({})}constructor(e,t){W(!isNaN(e)&&e!==1/0&&e!==-1/0,34860),super(t),this.limit=e}_toProto(e){return{...super._toProto(e),args:[jc(e,this.limit)]}}}class Ff extends vt{get _name(){return"offset"}get _optionsUtil(){return new tt({})}constructor(e,t){super(t),this.offset=e}_toProto(e){return{...super._toProto(e),args:[jc(e,this.offset)]}}}class uT extends vt{get _name(){return"select"}get _optionsUtil(){return new tt({})}constructor(e,t){super(t),this.selections=e}_toProto(e){return{...super._toProto(e),args:[Ai(e,this.selections)]}}_readUserData(e){super._readUserData(e),er(this.selections,e)}}class cn extends vt{get _name(){return"sort"}get _optionsUtil(){return new tt({})}constructor(e,t){super(t),this.orderings=e}_toProto(e){return{...super._toProto(e),args:this.orderings.map(t=>t._toProto(e))}}_readUserData(e){super._readUserData(e),er(this.orderings,e)}}class au extends vt{get _name(){return"replace_with"}get _optionsUtil(){return new tt({})}constructor(e,t){super(t),this.map=e}_toProto(e){return{...super._toProto(e),args:[this.map._toProto(e),fp(au.Ir)]}}_readUserData(e){super._readUserData(e),er(this.map,e)}}au.Ir="full_replace";function er(n,e){return Pp(n)?n._readUserData(e):Array.isArray(n)?n.forEac
2738h(t=>t._readUserData(e)):n instanceof Map?n.forEach(t=>t._readUserData(e)):Object.values(n).forEach(t=>t._readUserData(e)),n}/**
2739 * @license
2740 * Copyright 2026 Google LLC
2741 *
2742 * Licensed under the Apache License, Version 2.0 (the "License");
2743 * you may not use this file except in compliance with the License.
2744 * You may obtain a copy of the License at
2745 *
2746 *   http://www.apache.org/licenses/LICENSE-2.0
2747 *
2748 * Unless required by applicable law or agreed to in writing, software
2749 * distributed under the License is distributed on an "AS IS" BASIS,
2750 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2751 * See the License for the specific language governing permissions and
2752 * limitations under the License.
2753 */class ui{constructor(e,t,r,s){this._db=e,this.userDataReader=t,this._userDataWriter=r,this.stages=s}Vr(e,t){const r=this.userDataReader.createContext(3,e);return Pp(t)?t._readUserData(r):Array.isArray(t)?t.forEach(s=>s._readUserData(r)):t.forEach(s=>s._readUserData(r)),t}where(e){const t=this.stages.map(r=>r);return this.Vr("where",e),t.push(new xa(e,{})),new ui(this._db,this.userDataReader,this._userDataWriter,t)}limit(e){const t=this.stages.map(r=>r);return t.push(new Sr(e,{})),new ui(this._db,this.userDataReader,this._userDataWriter,t)}sort(e,...t){const r=this.stages.map(s=>s);return"orderings"in e?r.push(new cn(this.Vr("sort",e.orderings),{})):r.push(new cn(this.Vr("sort",[e,...t]),{})),new ui(this._db,this.userDataReader,this._userDataWriter,r)}dr(e){return{pipeline:{stages:this.stages.map(t=>t._toProto(e))}}}}// Copyright 2024 Google LLC* @license
2754class it{constructor(e,t,r){this.serializer=e,this.stages=t,this.listenOptions=r,this.isCorePipeline=!0}getPipelineCollection(){return Ma(this)}getPipelineCollectionGroup(){return Bu(this)}getPipelineCollectionId(){return lT(this)}getPipelineDocuments(){return pc(this)}getPipelineFlavor(){return function(t){let r="exact";
2754return t.stages.forEach((s,i)=>{s._name!==xp.name&&s._name!==Vp.name||(r="keyless"),s._name===uT.name&&r==="exact"&&(r="augmented"),s._name===kp.name&&i<t.stages.length-1&&r==="exact"&&(r="augmented")}),r}(this)}getPipelineSourceType(){return Jn(this)}}function Jn(n){const e=n.stages[0];return e instanceof ka||e instanceof Va||e instanceof iu||e instanceof ou?e._name:"unknown"}function Ma(n){if(Jn(n)==="collection")return n.stages[0].hr}function Bu(n){if(Jn(n)==="collection_group")return n.stages[0].collectionId}function lT(n){switch(Jn(n)){case"collection":return Ce.fromString(Ma(n)).lastSegment();case"collection_group":return Bu(n);default:return}}function pc(n){if(Jn(n)==="documents")return n.stages[0].Tr}class I{constructor(e,t){this.type=e,this.value=t}static mr(){return new I("ERROR",void 0)}static pr(){return new I("UNSET",void 0)}static gr(){return new I("NULL",Bs)}static newValue(e){return It(e)?new I("NULL",Bs):function(r){return!!r&&"booleanValue"in r}(e)?new I("BOOLEAN",e):zt(e)?new I("INT",e):mr(e)?new I("DOUBLE",e):function(r){return!!r&&"timestampValue"in r&&!!r.timestampValue}(e)?new I("TIMESTAMP",e):function(r){return!!r&&"stringValue"in r}(e)?new I("STRING",e):function(r){return!!r&&"bytesValue"in r}(e)?new I("BYTES",e):e.referenceValue?new I("REFERENCE",e):e.geoPointValue?new I("GEO_POINT",e):us(e)?new I("ARRAY",e):Zo(e)?new I("VECTOR",e):wr(e)?new I("MAP",e):new I("ERROR",void 0)}yr(){return this.type==="ERROR"||this.type==="UNSET"}wr(){return this.type==="NULL"}}function li(n){if(!n.yr())return n.value}function Mp(n){return n instanceof Zn?n._expr:n}function Z(n){if((n=Mp(n))instanceof Ts)return new hT(n);if(n instanceof As)return new fT(n);if(n instanceof ti)return new dT(n);if(n instanceof k){if(n.name==="add")return new gT(n);if(n.name==="subtract")return new mT(n);if(n.name==="multiply")return new ET(n);if(n.name==="divide")return new _T(n);if(n.name==="mod")return new DT(n);if(n.name==="and")return new wT(n);if(n.name==="equal")return new FT(n);if(n.name==="not_equal")return new LT(n);if(n.name==="less_than")return new kT(n);if(n.name==="less_than_or_equal")return new VT(n);if(n.name==="greater_than")return new xT(n);if(n.name==="greater_than_or_equal")return new MT(n);if(n.name==="array_concat")return new GT(n);if(n.name==="array_reverse")return new UT(n);if(n.name==="array_contains")return new HT(n);if(n.name==="array_contains_all")return new qT(n);if(n.name==="array_contains_any")return new JT(n);if(n.name==="array_length")return new jT(n);if(n.name==="array_element")return new KT(n);if(n.name==="equal_any")return new Gp(n);if(n.name==="not_equal_any")return new IT(n);if(n.name==="is_nan")return new TT(n);if(n.name==="is_not_nan")return new AT(n);if(n.name==="is_null")return new RT(n);if(n.name==="is_not_null")return new vT(n);if(n.name==="is_error")return new bT(n);if(n.name==="exists")return new ST(n);if(n.name==="not")return new Ga(n);if(n.name==="or")return new yT(n);if(n.name==="xor")return new cu(n);if(n.name==="conditional")return new PT(n);if(n.name==="maximum")return new OT(n);if(n.name==="minimum")return new NT(n);if(n.name==="reverse")return new zT(n);if(n.name==="replace_first")return new WT(n);if(n.name==="replace_all")return new $T(n);if(n.name==="char_length")return new QT(n);if(n.name==="byte_length")return new YT(n);if(n.name==="like")return new XT(n);if(n.name==="regex_contains")return new ZT(n);if(n.name==="regex_match")return new eA(n);if(n.name==="string_contains")return new tA(n);if(n.name==="starts_with")return new nA(n);if(n.name==="ends_with")return new rA(n);if(n.name==="to_lower")return new sA(n);if(n.name==="to_upper")return new iA(n);if(n.name==="trim")return new oA(n);if(n.name==="string_concat")return new aA(n);if(n.name==="map_get")return new BA(n);if(n.name==="cosine_distance")return new cA(n);if(n.name==="dot_product")return new uA(n);if(n.name==="euclidean_distance")return new lA(n);if(n.name==="vector_length")return new hA(n);if(n.name==="unix_micros_to_timestamp")return new gA(n);if(n.name==="timestamp_to_unix_micros")return new _A(n);if(n.name==="unix_millis_to_timestamp")return new mA(n);if(n.name==="timestamp_to_unix_millis")return new DA(n);if(n.name==="unix_seconds_to_timestamp")return new EA(n);if(n.name==="timestamp_to_unix_seconds")return new wA(n);if(n.name==="timestamp_add")return new yA(n);if(n.name==="timestamp_subtract")return new IA(n)}throw new Error(`Unknown Expr : ${n}`)}class hT{constructor(e){this.expr=e}evaluate(e,t){if(this.expr.fieldName===Kt)return I.newValue({referenceValue:sa(e.serializer,t.key)});if(this.expr.fieldName==="__update_time__")return I.newValue({timestampValue:xo(e.serializer,t.version)});if(this.expr.fieldName==="__create_time__")return I.newValue({timestampValue:xo(e.serializer,t.createTime)});const r=t.data.field(this.expr._fieldPath);return r?Mi(r)?I.newValue(function(i,o){if(i.serverTimestampBehavior==="estimate")return{timestampValue:xo(i.serializer,ne.fromTimestamp(as(o)))};if(i.serverTimestampBehavior==="previous"){const B=Gi(o);if(B)return B}return{nullValue:"NULL_VALUE"}}(e,r)):I.newValue(r):I.pr()}}class fT{constructor(e){this.expr=e}evaluate(e,t){return I.newValue(this.expr._getValue())}}class dT{constructor(e){this.expr=e}evaluate(e,t){const r=this.expr.cr.map(s=>Z(s).evaluate(e,t));return r.some(s=>s.yr())?I.mr():I.newValue({arrayValue:{values:r.map(s=>s.value)}})}}function ze(n){return mr(n)?Number(n.doubleValue):Number(n.integerValue)}function en(n){return BigInt(n.integerValue)}const CT=BigInt("0x7fffffffffffffff"),pT=-BigInt("0x8000000000000000");class Ki{constructor(e){this.expr=e}evaluate(e,t){W(this.expr.params.length>=2,24778);const r=Z(this.expr.params[0]).evaluate(e,t),s=Z(this.expr.params[1]).evaluate(e,t);let i=this.br(r,s);for(const o of this.expr.params.slice(2)){const B=Z(o).evaluate(e,t);i=this.br(i,B)}return i}br(e,t){if(e.yr()||t.yr())return I.mr();if(e.wr()||t.wr())return I.gr();const r=e.value,s=t.value;if(!mr(r)&&!zt(r)||!mr(s)&&!zt(s))return I.mr();if(mr(r)||mr(s)){const i=this.Sr(r,s);return i?I.newValue(i):I.mr()}if(zt(r)&&zt(s)){const i=this.vr(r,s);return i===void 0?I.mr():typeof i=="number"?I.newValue({doubleValue:i}):i<pT||i>CT?I.mr():I.newValue({integerValue:`${i}`})}return I.mr()}}function _n(n,e){return Me(n)!==Me(e)?"TYPE_MISMATCH":Et(n)||Et(e)?"NOT_EQ":It(n)&&It(e)?"EQ":It(n)||It(e)?"NULL":us(n)&&us(e)?function(r,s){var o,B,c;if(((o=r.values)==null?void 0:o.length)!==((B=s.values)==null?void 0:B.length))return"NOT_EQ";let i=!1;for(let u=0;u<(((c=r.values)==null?void 0:c.length)??0);u++){const h=r.values[u],d=s.values[u];switch(_n(h,d)){case"EQ":break;case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":i=!0;break;default:X(44609,{Dr:h,Cr:d})}}return i?"NULL":"EQ"}(n.arrayValue,e.arrayValue):Zo(n)&&Zo(e)||wr(n)&&wr(e)?function(r,s){const i=r.fields||{},o=s.fields||{};if(Qo(i)!==Qo(o))return"NOT_EQ";let B=!1;for(const c in i)if(i.hasOwnProperty(c)){if(o[c]===void 0)return"NOT_EQ";switch(_n(i[c],o[c])){case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":B=!0}}return B?"NULL":"EQ"}(n.mapValue,e.mapValue):function(r,s){return Ft(r,s,{u:!1,i:!0,o:!0})}(n,e)?"EQ":"NOT_EQ"}class gT extends Ki{vr(e,t){return en(e)+en(t)}Sr(e,t){return{doubleValue:ze(e)+ze(t)}
2754}}class mT extends Ki{constructor(e){super(e),this.expr=e}vr(e,t){return en(e)-en(t)}Sr(e,t){return{doubleValue:ze(e)-ze(t)}}}class ET extends Ki{constructor(e){super(e),this.expr=e}vr(e,t){return en(e)*en(t)}Sr(e,t){return{doubleValue:ze(e)*ze(t)}}}class _T extends Ki{constructor(e){super(e),this.expr=e}vr(e,t){const r=en(t);if(r!==BigInt(0))return en(e)/r}Sr(e,t){const r=ze(t);return r===0?{doubleValue:Ei(r)?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}:{doubleValue:ze(e)/r}}}class DT extends Ki{constructor(e){super(e),this.expr=e}vr(e,t){const r=en(t);if(r!==BigInt(0))return en(e)%r}Sr(e,t){const r=ze(t);if(r!==0)return{doubleValue:ze(e)%r}}}class wT{constructor(e){this.expr=e}evaluate(e,t){var i;let r=!1,s=!1;for(const o of this.expr.params){const B=Z(o).evaluate(e,t);switch(B.type){case"BOOLEAN":if(!((i=B.value)!=null&&i.booleanValue))return I.newValue(je);break;case"NULL":s=!0;break;default:r=!0}}return r?I.mr():s?I.gr():I.newValue(gt)}}class Ga{constructor(e){this.expr=e}evaluate(e,t){var s;W(this.expr.params.length===1,9634);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"BOOLEAN":return I.newValue({booleanValue:!((s=r.value)!=null&&s.booleanValue)});case"NULL":return I.gr();default:return I.mr()}}}class yT{constructor(e){this.expr=e}evaluate(e,t){var i;let r=!1,s=!1;for(const o of this.expr.params){const B=Z(o).evaluate(e,t);switch(B.type){case"BOOLEAN":if((i=B.value)!=null&&i.booleanValue)return I.newValue(gt);break;case"NULL":s=!0;break;default:r=!0}}return r?I.mr():s?I.gr():I.newValue(je)}}class cu{constructor(e){this.expr=e}evaluate(e,t){var i;let r=!1,s=!1;for(const o of this.expr.params){const B=Z(o).evaluate(e,t);switch(B.type){case"BOOLEAN":r=cu.xor(r,!!((i=B.value)!=null&&i.booleanValue));break;case"NULL":s=!0;break;default:return I.mr()}}return s?I.gr():I.newValue({booleanValue:r})}static xor(e,t){return(e||t)&&!(e&&t)}}class Gp{constructor(e){this.expr=e}evaluate(e,t){var o,B;W(this.expr.params.length===2,55094);let r=!1;const s=Z(this.expr.params[0]).evaluate(e,t);switch(s.type){case"NULL":r=!0;break;case"ERROR":case"UNSET":return I.mr()}const i=Z(this.expr.params[1]).evaluate(e,t);switch(i.type){case"ARRAY":break;case"NULL":r=!0;break;default:return I.mr()}if(r)return I.gr();for(const c of((B=(o=i.value)==null?void 0:o.arrayValue)==null?void 0:B.values)??[])switch(It(s.value)&&It(c)?"EQ":_n(s.value,c)){case"EQ":return I.newValue(gt);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":r=!0;break;default:X(44608,{value:s.value,candidate:c})}return r?I.gr():I.newValue(je)}}class IT{constructor(e){this.expr=e}evaluate(e,t){return new Ga(new k("not",[new k("equal_any",this.expr.params)])).evaluate(e,t)}}class TT{constructor(e){this.expr=e}evaluate(e,t){W(this.expr.params.length===1,23322);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"INT":return I.newValue(je);case"DOUBLE":return I.newValue({booleanValue:isNaN(ze(r.value))});case"NULL":return I.gr();default:return I.mr()}}}class AT{constructor(e){this.expr=e}evaluate(e,t){return W(this.expr.params.length===1,50406),new Ga(new k("not",[new k("is_nan",this.expr.params)])).evaluate(e,t)}}class RT{constructor(e){this.expr=e}evaluate(e,t){switch(W(this.expr.params.length===1,23123),Z(this.expr.params[0]).evaluate(e,t).type){case"NULL":return I.newValue(gt);case"UNSET":case"ERROR":return I.mr();default:return I.newValue(je)}}}class vT{constructor(e){this.expr=e}evaluate(e,t){return W(this.expr.params.length===1,23167),new Ga(new k("not",[new k("is_null",this.expr.params)])).evaluate(e,t)}}class bT{constructor(e){this.expr=e}evaluate(e,t){return W(this.expr.params.length===1,5228),Z(this.expr.params[0]).evaluate(e,t).type==="ERROR"?I.newValue(gt):I.newValue(je)}}class ST{constructor(e){this.expr=e}evaluate(e,t){switch(W(this.expr.params.length===1,6877),Z(this.expr.params[0]).evaluate(e,t).type){case"ERROR":return I.mr();case"UNSET":return I.newValue(je);default:return I.newValue(gt)}}}class PT{constructor(e){this.expr=e}evaluate(e,t){var s;W(this.expr.params.length===3,11706);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"BOOLEAN":return(s=r.value)!=null&&s.booleanValue?Z(this.expr.params[1]).evaluate(e,t):Z(this.expr.params[2]).evaluate(e,t);case"NULL":return Z(this.expr.params[2]).evaluate(e,t);default:return I.mr()}}}class OT{constructor(e){this.expr=e}evaluate(e,t){const r=this.expr.params.map(i=>Z(i).evaluate(e,t));let s;for(const i of r)switch(i.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=s===void 0||mt(i.value,s.value)>0?i:s}return s===void 0?I.gr():s}}class NT{constructor(e){this.expr=e}evaluate(e,t){const r=this.expr.params.map(i=>Z(i).evaluate(e,t));let s;for(const i of r)switch(i.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=s===void 0||mt(i.value,s.value)<0?i:s}return s===void 0?I.gr():s}}class Rs{constructor(e){this.expr=e}evaluate(e,t){W(this.expr.params.length===2,31033,`${this.expr.name}() function should have exactly 2 params`);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"ERROR":case"UNSET":return I.mr()}const s=Z(this.expr.params[1]).evaluate(e,t);switch(s.type){case"ERROR":case"UNSET":return I.mr()}return this.Fr(r,s)}}class FT extends Rs{constructor(e){super(e),this.expr=e}Fr(e,t){if(e.wr()&&t.wr())return I.newValue(gt);if(e.wr()||t.wr()||Et(e.value)||Et(t.value)||Me(e.value)!==Me(t.value))return I.newValue(je);switch(_n(e.value,t.value)){case"EQ":return I.newValue(gt);case"NOT_EQ":return I.newValue(je);case"NULL":return I.gr();default:X(44615,{left:e,right:t})}}}class LT extends Rs{constructor(e){super(e),this.expr=e}Fr(e,t){switch(_n(e.value,t.value)){case"EQ":return I.newValue(je);case"NOT_EQ":case"TYPE_MISMATCH":return I.newValue(gt);case"NULL":return I.gr();default:X(44614,{left:e,right:t})}}}class kT extends Rs{constructor(e){super(e),this.expr=e}Fr(e,t){return Me(e.value)!==Me(t.value)||Et(e.value)||Et(t.value)?I.newValue(je):I.newValue({booleanValue:mt(e.value,t.value)<0})}}class VT extends Rs{constructor(e){super(e),this.expr=e}Fr(e,t){return Me(e.value)!==Me(t.value)||Et(e.value)||Et(t.value)?I.newValue(je):_n(e.value,t.value)==="EQ"?I.newValue(gt):I.newValue({booleanValue:mt(e.value,t.value)<0})}}class xT extends Rs{constructor(e){super(e),this.expr=e}Fr(e,t){return Me(e.value)!==Me(t.value)||Et(e.value)||Et(t.value)?I.newValue(je):I.newValue({booleanValue:mt(e.value,t.value)>0})}}class MT extends Rs{constructor(e){super(e),this.expr=e}Fr(e,t){return Me(e.value)!==Me(t.value)||Et(e.value)||Et(t.value)?I.newValue(je):_n(e.value,t.value)==="EQ"?I.newValue(gt):I.newValue({booleanValue:mt(e.value,t.value)>0})}}class GT{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class UT{constructor(e){this.expr=e}evaluate(e,t){var s;W(this.expr.params.length===1,216);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"NULL":return I.gr();case"ARRAY":{const i=((s=r.value.arrayValue)==null?void 0:s.values)??[];return I.newValue({arrayValue:{values:[...i].reverse()}})}default:return I.mr()}}}class HT{constructor(e){this.expr=e}evaluate(e,t){return W(this.expr.params.length===2,52884),new Gp(new k("eq_any",[this.expr.params[1],this.expr.params[0]])).evaluate(e,t)}}class qT{constructor(e){this.expr=e}evaluate(e,t){var c,u,h,d;W(this.expr.params.length===2,1392);let r=!1;const s=Z(this.expr.params[0]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":r=!0;break;default:return I.mr()}const i=Z(this.expr.params[1]).evaluate(e,t);switch(i.type){case"ARRAY":break;case"NULL":r=!0;break;default:return I.mr()}if(r)return I.gr();const o=((u=(c=i.value)==null?void 0:c.arrayValue)==null?void 0:u.values)??[],B=((d=(h=s.value)==null?void 0:h.arrayValue)==null?void 0:d.values)??[];for(const p of o){let _=!1;r=!1;for(const y of B){switch(It(p)&&It(y)?"EQ":_n(p,y)){case"EQ":_=!0;break;case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":r=!0;break;default:X(44613,{value:y,search:p})}if(_)break}if(!_)return I.newValue(je)}return I.newValue(gt)}}class JT{constructor(e){this.expr=e}evaluate(e,t){var c,u,h,d;W(this.expr.params.length===2,2680);let r=!1;const s=Z(this.expr.params[0]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":r=!0;break;default:return I.mr()}const i=Z(this.expr.params[1]).evaluate(e,t);switch(i.type){case"ARRAY":break;case"NULL":r=!0;break;default:return I.mr()}if(r)return I.gr();const o=((u=(c=i.value)==null?void 0:c.arrayValue)==null?void 0:u.values)??[],B=((d=(h=s.value)==null?void 0:h.arrayValue)==null?void 0:d.values)??[];for(const p of B)for(const _ of o)switch(It(p)&&It(_)?"EQ":_n(p,_)){case"EQ":return I.newValue(gt);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":r=!0;break;default:X(60403,{value:p,search:_})}return r?I.gr():I.newValue(je)}}class jT{constructor(e){this.expr=e}evaluate(e,t){var s,i,o;W(this.expr.params.length===1,38605);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"NULL":return I.gr();case"ARRAY":return I.newValue({integerValue:`${((o=(i=(s=r.value)==null?void 0:s.arrayValue)==null?void 0:i.values)==null?void 0:o.length)??0}`});default:return I.mr()}}}class KT{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class zT{constructor(e){this.expr=e}evaluate(e,t){var s,i;W(this.expr.params.length===1,1508);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"NULL":return I.gr();case"BYTES":{const o=(s=r.value)==null?void 0:s.bytesValue;
2754if(typeof o=="string"){const B=xe.fromBase64String(o).toUint8Array();return B.reverse(),I.newValue({bytesValue:xe.fromUint8Array(B).toBase64()})}return I.newValue({bytesValue:new Uint8Array(o).reverse()})}case"STRING":{const o=(i=r.value)==null?void 0:i.stringValue,B=new Intl.__PRIVATE_Segmenter(void 0,{granularity:"grapheme"}).segment(o),c=Array.from(B,u=>u.segment).reverse();return I.newValue({stringValue:c.join("")})}default:return I.mr()}}}class WT{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class $T{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class QT{constructor(e){this.expr=e}evaluate(e,t){W(this.expr.params.length===1,19400);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"NULL":return I.gr();case"STRING":{const s=function(o){let B=0;for(let c=0;c<o.length;c++){const u=o.codePointAt(c);if(u===void 0)return;if(u<=65535)if(u>=55296&&u<=57343)if(u<=56319){const h=o.codePointAt(c+1);h!==void 0&&h>=56320&&h<=57343?(B+=1,c++):B+=1}else B+=1;else B+=1;else{if(!(u<=1114111))return;B+=1,c++}}return B}(r.value.stringValue);return s===void 0?I.mr():I.newValue({integerValue:s})}default:return I.mr()}}}class YT{constructor(e){this.expr=e}evaluate(e,t){var s,i;W(this.expr.params.length===1,8486);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"BYTES":{const o=(s=r.value)==null?void 0:s.bytesValue;return typeof o=="string"?I.newValue({integerValue:xe.fromBase64String(o).toUint8Array().length}):I.newValue({integerValue:new Uint8Array(o).length})}case"STRING":{const o=function(c){let u=0;for(let h=0;h<c.length;h++){const d=c.codePointAt(h);if(d===void 0)return;if(d>=55296&&d<=57343){if(!(d<=56319))return;{const p=c.codePointAt(h+1);if(p===void 0||!(p>=56320&&p<=57343))return;u+=4,h++}}else if(d<=127)u+=1;else if(d<=2047)u+=2;else if(d<=65535)u+=3;else{if(!(d<=1114111))return;u+=4,h++}}return u}((i=r.value)==null?void 0:i.stringValue);return o===void 0?I.mr():I.newValue({integerValue:o})}case"NULL":return I.gr();default:return I.mr()}}}class vs{constructor(e){this.expr=e}evaluate(e,t){var o,B;W(this.expr.params.length===2,39773,`${this.expr.name}() function should have exactly two parameters`);let r=!1;const s=Z(this.expr.params[0]).evaluate(e,t);switch(s.type){case"STRING":break;case"NULL":r=!0;break;default:return I.mr()}const i=Z(this.expr.params[1]).evaluate(e,t);switch(i.type){case"STRING":break;case"NULL":r=!0;break;default:return I.mr()}return r?I.gr():this.Or((o=s.value)==null?void 0:o.stringValue,(B=i.value)==null?void 0:B.stringValue)}}class XT extends vs{Or(e,t){try{const r=function(o){let B="";for(let c=0;c<o.length;c++){const u=o.charAt(c);switch(u){case"_":B+=".";break;case"%":B+=".*";break;case"\\":case".":case"*":case"?":case"+":case"^":case"$":case"|":case"(":case")":case"[":case"]":case"{":case"}":B+="\\"+u;break;default:B+=u}}return"^"+B+"$"}(t),s=Gc.compile(r);return I.newValue({booleanValue:s.matches(e)})}catch(r){return Gt(`Invalid LIKE pattern converted to regex: ${t}, returning error. Error: ${r}`),I.mr()}}}class ZT extends vs{Or(e,t){try{const r=Gc.compile(t);return I.newValue({booleanValue:r.test(e)})}catch{return Gt(`Invalid regex pattern found in regex_contains: ${t}, returning error`),I.mr()}}}class eA extends vs{Or(e,t){try{return I.newValue({booleanValue:Gc.compile(t).matches(e)})}catch{return Gt(`Invalid regex pattern found in regex_match: ${t}, returning error`),I.mr()}}}class tA extends vs{Or(e,t){return I.newValue({booleanValue:e.includes(t)})}}class nA extends vs{Or(e,t){return I.newValue({booleanValue:e.startsWith(t)})}}class rA extends vs{Or(e,t){return I.newValue({booleanValue:e.endsWith(t)})}}class sA{constructor(e){this.expr=e}evaluate(e,t){var s,i;W(this.expr.params.length===1,29079);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"STRING":return I.newValue({stringValue:(i=(s=r.value)==null?void 0:s.stringValue)==null?void 0:i.toLowerCase()});case"NULL":return I.gr();default:return I.mr()}}}class iA{constructor(e){this.expr=e}evaluate(e,t){var s,i;W(this.expr.params.length===1,60487);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"STRING":return I.newValue({stringValue:(i=(s=r.value)==null?void 0:s.stringValue)==null?void 0:i.toUpperCase()});case"NULL":return I.gr();default:return I.mr()}}}class oA{constructor(e){this.expr=e}evaluate(e,t){var s,i;W(this.expr.params.length===1,28544);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"STRING":return I.newValue({stringValue:(i=(s=r.value)==null?void 0:s.stringValue)==null?void 0:i.trim()});case"NULL":return I.gr();default:return I.mr()}}}class aA{constructor(e){this.expr=e}evaluate(e,t){const r=this.expr.params.map(o=>Z(o).evaluate(e,t));let s="",i=!1;for(const o of r)switch(o.type){case"STRING":s+=o.value.stringValue;break;case"NULL":i=!0;break;default:return I.mr()}return i?I.gr():I.newValue({stringValue:s})}}class BA{constructor(e){this.expr=e}evaluate(e,t){var o,B,c,u;W(this.expr.params.length===2,4483);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"UNSET":return I.pr();case"MAP":break;default:return I.mr()}const s=Z(this.expr.params[1]).evaluate(e,t);if(s.type!=="STRING")return I.mr();const i=(u=(B=(o=r.value)==null?void 0:o.mapValue)==null?void 0:B.fields)==null?void 0:u[(c=s.value)==null?void 0:c.stringValue];return i===void 0?I.pr():I.newValue(i)}}class uu{constructor(e){this.expr=e}evaluate(e,t){var u,h;W(this.expr.params.length===2,25231,`${this.expr.name}() function should have exactly 2 params`);let r=!1;const s=Z(this.expr.params[0]).evaluate(e,t);switch(s.type){case"VECTOR":break;case"NULL":r=!0;break;default:return I.mr()}const i=Z(this.expr.params[1]).evaluate(e,t);switch(i.type){case"VECTOR":break;case"NULL":r=!0;break;default:return I.mr()}if(r)return I.gr();const o=cc(s.value),B=cc(i.value);if(o===void 0||B===void 0||((u=o.values)==null?void 0:u.length)!==((h=B.values)==null?void 0:h.length))return I.mr();const c=this.Mr(o,B);return c===void 0||isNaN(c)?I.mr():I.newValue({doubleValue:c})}}class cA extends uu{Mr(e,t){const r=(e==null?void 0:e.values)??[],s=(t==null?void 0:t.values)??[];if(r.length===0)return;let i=0,o=0,B=0;for(let u=0;u<r.length;
vendor: 7,561 bytes, lines 2754-2758
2754u++){if(!Qn(r[u])||!Qn(s[u]))return;const h=ze(r[u]),d=ze(s[u]);i+=h*d,o+=h*h,B+=d*d}const c=Math.sqrt(o)*Math.sqrt(B);if(c!==0)return 1-Math.max(-1,Math.min(1,i/c))}}class uA extends uu{Mr(e,t){const r=(e==null?void 0:e.values)??[],s=(t==null?void 0:t.values)??[];if(r.length===0)return 0;let i=0;for(let o=0;o<r.length;o++){if(!Qn(r[o])||!Qn(s[o]))return;i+=ze(r[o])*ze(s[o])}return i}}class lA extends uu{Mr(e,t){const r=(e==null?void 0:e.values)??[],s=(t==null?void 0:t.values)??[];if(r.length===0)return 0;let i=0;for(let o=0;o<r.length;o++){if(!Qn(r[o])||!Qn(s[o]))return;const B=ze(r[o]),c=ze(s[o]);i+=Math.pow(B-c,2)}return Math.sqrt(i)}}class hA{constructor(e){this.expr=e}evaluate(e,t){var s;W(this.expr.params.length===1,39044);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"VECTOR":{const i=cc(r.value);return I.newValue({integerValue:((s=i==null?void 0:i.values)==null?void 0:s.length)??0})}case"NULL":return I.gr();default:return I.mr()}}}const vi=BigInt(-62135596800),bi=BigInt(253402300799),oa=BigInt(1e3),jn=BigInt(1e6),fA=vi*oa,dA=bi*oa+BigInt(999),CA=vi*jn,pA=bi*jn+BigInt(999999);function lu(n){return n>=CA&&n<=pA}function Up(n){return n>=vi&&n<=bi}function Si(n,e){const t=BigInt(n);return!(t<vi||t>bi)&&!(e<0||e>=1e9)&&(t!==vi||e===0)&&!(t===bi&&e>999999999)}function Hp(n,e){return e<0?{seconds:n-1,nanos:e+1e9}:{seconds:n,nanos:e}}function hu(n){return BigInt(n.seconds)*jn+BigInt(Math.trunc(n.nanoseconds/1e3))}class fu{constructor(e){this.expr=e}evaluate(e,t){W(this.expr.params.length===1,49262,`${this.expr.name}() function should have exactly one parameter`);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"INT":return this.toTimestamp(BigInt(r.value.integerValue));case"NULL":return I.gr();default:return I.mr()}}}class gA extends fu{toTimestamp(e){if(!lu(e))return I.mr();let t=Number(e/jn),r=Number(e%jn*BigInt(1e3));const s=Hp(t,r);return t=s.seconds,r=s.nanos,Si(t,r)?I.newValue({timestampValue:{seconds:t,nanos:r}}):I.mr()}}class mA extends fu{toTimestamp(e){if(!function(o){return o>=fA&&o<=dA}(e))return I.mr();let t=Number(e/oa),r=Number(e%oa*BigInt(1e6));const s=Hp(t,r);return t=s.seconds,r=s.nanos,Si(t,r)?I.newValue({timestampValue:{seconds:t,nanos:r}}):I.mr()}}class EA extends fu{toTimestamp(e){if(!Up(e))return I.mr();const t=Number(e);return I.newValue({timestampValue:{seconds:t,nanos:0}})}}class du{constructor(e){this.expr=e}evaluate(e,t){W(this.expr.params.length===1,1265,`${this.expr.name}() function should have exactly one parameter`);const r=Z(this.expr.params[0]).evaluate(e,t);switch(r.type){case"TIMESTAMP":break;case"NULL":return I.gr();default:return I.mr()}const s=Yc(r.value.timestampValue);return Si(s.seconds,s.nanoseconds)?this.Nr(s):I.mr()}}class _A extends du{Nr(e){const t=hu(e);return lu(t)?I.newValue({integerValue:`${t.toString()}`}):I.mr()}}class DA extends du{Nr(e){const t=hu(e),r=t/BigInt(1e3),s=t%BigInt(1e3);return r>BigInt(0)||s===BigInt(0)?I.newValue({integerValue:r.toString()}):I.newValue({integerValue:(r-BigInt(1)).toString()})}}class wA extends du{Nr(e){const t=BigInt(e.seconds);return Up(t)?I.newValue({integerValue:t.toString()}):I.mr()}}class qp{constructor(e){this.expr=e}evaluate(e,t){W(this.expr.params.length===3,2775,`${this.expr.name}() function should have exactly 3 parameters`);let r=!1;const s=Z(this.expr.params[0]).evaluate(e,t);switch(s.type){case"TIMESTAMP":break;case"NULL":r=!0;break;default:return I.mr()}const i=Z(this.expr.params[1]).evaluate(e,t);let o;switch(i.type){case"STRING":if(o=function(ee){switch(ee){case"microsecond":return"microsecond";case"millisecond":return"millisecond";case"second":return"second";case"minute":return"minute";case"hour":return"hour";case"day":return"day";default:return}}(i.value.stringValue),o===void 0)return I.mr();break;case"NULL":r=!0;break;default:return I.mr()}const B=Z(this.expr.params[2]).evaluate(e,t);switch(B.type){case"INT":break;case"NULL":r=!0;break;default:return I.mr()}if(r)return I.gr();const c=BigInt(B.value.integerValue);let u;try{switch(o){case"microsecond":u=c;break;case"millisecond":u=c*BigInt(1e3);break;case"second":u=c*BigInt(1e6);break;case"minute":u=c*BigInt(6e7);break;case"hour":u=c*BigInt(36e8);break;case"day":u=c*BigInt(864e8);break;default:return I.mr()}if(o!=="microsecond"&&c!==BigInt(0)&&u/c!==BigInt(this.Lr(o)))return I.mr()}catch(j){return Gt(`Error during timestamp arithmetic: ${j}`),I.mr()}const h=Yc(s.value.timestampValue);if(!Si(h.seconds,h.nanoseconds))return I.mr();const d=hu(h),p=this.Br(d,u);if(!lu(p))return I.mr();const _=Number(p/jn),y=p%jn,O=Number((y<0?y+jn:y)*BigInt(1e3)),V=y<0?_-1:_;return Si(V,O)?I.newValue({timestampValue:{seconds:V,nanos:O}}):I.mr()}Lr(e){switch(e){case"millisecond":return 1e3;case"second":return 1e6;case"minute":return 6e7;case"hour":return 36e8;case"day":return 864e8;default:return 1}}}class yA extends qp{Br(e,t){return e+t}}class IA extends qp{Br(e,t){return e-t}}function Pi(n){if((n=Mp(n))instanceof Ts)return`fld(${n.fieldName})`;if(n instanceof As)return`cst(${function(t){return t===null?"null":typeof t=="number"?t.toString():typeof t=="string"?`"${t}"`:t instanceof Re?`ref(${t.path})`:t instanceof pt?`vec(${JSON.stringify(t)})`:JSON.stringify(t)}(n.value)})`;if(n instanceof k)return`fn(${n.name},[${n.params.map(Pi).join(",")}])`;if(n.expressionType==="ListOfExpressions")return`list([${n.cr.map(Pi).join(",")}])`;throw new Error(`Unrecognized expr ${JSON.stringify(n,null,2)}`)}function TA(n){if(n instanceof kp)return`${n._name}(${Io(n.fields)})`;if(n instanceof Vp){let e=`${n._name}(${Io(n.accumulators)})`;return n.groups.size>0&&(e+=`grouping(${Io(n.groups)})`),e}if(n instanceof xp)return`${n._name}(${Io(n.groups)})`;if(n instanceof ka)return`${n._name}(${n.hr})`;if(n instanceof Va)return`${n._name}(${n.collectionId})`;if(n instanceof iu)return`${n._name}()`;if(n instanceof ou)return`${n._name}(${n.Tr.sort()})`;if(n instanceof xa)return`${n._name}(${Pi(n.condition)})`;if(n instanceof Sr)return`${n._name}(${n.limit})`;if(n instanceof cn)return`${n._name}(${function(t){return t.map(r=>`${Pi(r.expr)}${r.direction}`).join(",")}(n.orderings)})`;throw new Error(`Unrecognized stage ${n._name}`)}function Io(n){return`${Array.from(n.entries()).sort().map(([e,t])=>`${e}=${Pi(t)}`).join(",")}`}function dn(n){return n.stages.map(e=>TA(e)).join("|")}function Jp(n,e){return dn(n)===dn(e)}function Ue(n){return n instanceof it}function Lf(n){return Ue(n)?dn(n):ai(n)}function jp(n){return Ue(n)?dn(n):function(t){return`${QC(Qt(t))}|lt:${t.limitType}`}(n)}function Ua(n,e){return n instanceof it&&e instanceof it?Jp(n,e):!(n instanceof it&&!(e instanceof it)||!(n instanceof it)&&e instanceof it)&&Ky(n,e)}function Kp(n){return Cr(n)?dn(n):QC(n)}function zp(n,e){return n instanceof it&&e instanceof it?Jp(n,e):!(n instanceof it&&!(e instanceof it)||!(n instanceof it)&&e instanceof it)&&YC(n,e)}function AA(n,e){const t=function(s){let i=!1;const o=[];for(const B of s)if(B instanceof cn)if(i=!0,B.orderings.some(c=>c.expr instanceof Ts&&c.expr.fieldName===Kt))o.push(B);else{const c=B.orderings.map(u=>u);c.push(Mo(Kt).ascending()),o.push(new cn(c,{}))}else B instanceof Sr&&(i||(o.push(new cn([Mo(Kt).ascending()],{})),i=!0)),o.push(B);return i||o.push(new cn([Mo(Kt).ascending()],{})),o}(n.stages);if(n.userDataReader){const r=n.userDataReader.createContext(3,"toCorePipeline");t.forEach(s=>s._readUserData(r))}return new it(n.userDataReader.serializer,t,e)}/**
2755 * @license
2756 * Copyright 2017 Google LLC
2757 *
2758 * Licensed under the Apache License, Version 2.0 (the "License");
2759 * you may not use this file except in compliance with the License.
2760 * You may obtain a copy of the License at
2761 *
2762 *   http://www.apache.org/licenses/LICENSE-2.0
2763 *
2764 * Unless required by applicable law or agreed to in writing, software
2765 * distributed under the License is distributed on an "AS IS" BASIS,
2766 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2767 * See the License for the specific language governing permissions and
2768 * limitations under the License.
2769 */class RA{constructor(e,t,r,s){this.batchId=e,this.localWriteTime=t,this.baseMutations=r,this.mutations=s}applyToRemoteDocument(e,t){const r=t.mutationResults;for(let s=0;s<this.mutations.length;s++){const i=this.mutations[s];i.key.isEqual(e.key)&&Ty(i,e,r[s])}}applyToLocalView(e,t){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(t=oi(r,e,t,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(t=oi(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const r=np();return this.mutations.forEach(s=>{const i=e.get(s.key),o=i.overlayedDocument;let B=this.applyToLocalView(o,i.mutatedFields);B=t.has(s.key)?null:B;const c=HC(o,B);c!==null&&r.set(s.key,c),o.isValidDocument()||o.convertToNoDocument(ne.min())}),r}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),oe())}isEqual(e){return this.batchId===e.batchId&&os(this.mutations,e.mutations,(t,r)=>hf(t,r))&&os(this.baseMutations,e.baseMutations,(t,r)=>hf(t,r))}}class Cu{constructor(e,t,r,s){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=s}static from(e,t,r){W(e.mutations.length===r.length,58842,{Ur:e.mutations.length,kr:r.length});let s=function(){return Yy}();const i=e.mutations;for(let o=0;o<i.length;o++)s=s.insert(i[o].key,r[o].version);return new Cu(e,t,r,s)}}/**
2770 * @license
2771 * Copyright 2017 Google LLC
2772 *
2773 * Licensed under the Apache License, Version 2.0 (the "License");
2774 * you may not use this file except in compliance with the License.
2775 * You may obtain a copy of the License at
2776 *
2777 *   http://www.apache.org/licenses/LICENSE-2.0
2778 *
2779 * Unless required by applicable law or agreed to in writing, software
2780 * distributed under the License is distributed on an "AS IS" BASIS,
2781 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2782 * See the License for the specific language governing permissions and
2783 * limitations under the License.
2784 */const Wp="�";function vA(n){let e="";for(let t=0;t<n.length;t++)e.length>0&&(e=kf(e)),e=bA(n.get(t),e);return kf(e)}function bA(n,e){let t=e;const r=n.length;for(let s=0;s<r;s++){const i=n.charAt(s);switch(i){case"\0":t+="��";break;case Wp:t+="��";break;default:t+=i}}return t}function kf(n){return n+Wp+"�"}/**
2785 * @license
2786 * Copyright 2022 Google LLC
2787 *
2788 * Licensed under the Apache License, Version 2.0 (the "License");
2789 * you may not use this file except in compliance with the License.
2790 * You may obtain a copy of the License at
2791 *
2792 *   http://www.apache.org/licenses/LICENSE-2.0
2793 *
2794 * Unless required by applicable law or agreed to in writing, software
2795 * distributed under the License is distributed on an "AS IS" BASIS,
2796 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2797 * See the License for the specific language governing permissions and
2798 * limitations under the License.
2799 */class SA{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
2800      largestBatchId: ${this.largestBatchId},
2801      mutation: ${this.mutation.toString()}
2802    }`}}/**
2803 * @license
2804 * Copyright 2017 Google LLC
2805 *
2806 * Licensed under the Apache License, Version 2.0 (the "License");
2807 * you may not use this file except in compliance with the License.
2808 * You may obtain a copy of the License at
2809 *
2810 *   http://www.apache.org/licenses/LICENSE-2.0
2811 *
2812 * Unless required by applicable law or agreed to in writing, software
2813 * distributed under the License is distributed on an "AS IS" BASIS,
2814 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2815 * See the License for the specific language governing permissions and
2816 * limitations under the License.
2817 */class un{constructor(e,t,r,s,i=ne.min(),o=ne.min(),B=xe.EMPTY_BYTE_STRING,c=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=B,this.expectedCount=c}withSequenceNumber(e){return new un(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new un(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new un(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new un(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
2818 * @license
2819 * Copyright 2017 Google LLC
2820 *
2821 * Licensed under the Apache License, Version 2.0 (the "License");
2822 * you may not use this file except in compliance with the License.
2823 * You may obtain a copy of the License at
2824 *
2825 *   http://www.apache.org/licenses/LICENSE-2.0
2826 *
2827 * Unless required by applicable law or agreed to in writing, software
2828 * distributed under the License is distributed on an "AS IS" BASIS,
2829 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2830 * See the License for the specific language governing permissions and
2831 * limitations under the License.
2832 */class PA{constructor(e){this.$r=e}}function OA(n){const e=dI({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?ra(e,e.limit,"L"):e}/**
2833 * @license
2834 * Copyright 2019 Google LLC
2835 *
2836 * Licensed under the Apache License, Version 2.0 (the "License");
2837 * you may not use this file except in compliance with the License.
2838 * You may obtain a copy of the License at
2839 *
2840 *   http://www.apache.org/licenses/LICENSE-2.0
2841 *
2842 * Unless required by applicable law or agreed to in writing, software
2843 * distributed under the License is distributed on an "AS IS" BASIS,
2844 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2845 * See the License for the specific language governing permissions and
2846 * limitations under the License.
2847 */class NA{constructor(){this.Zi=new FA}addToCollectionParentIndex(e,t){return this.Zi.add(t),x.resolve()}getCollectionParents(e,t){return x.resolve(this.Zi.getEntries(t))}addFieldIndex(e,t){return x.resolve()}deleteFieldIndex(e,t){return x.resolve()}deleteAllFieldIndexes(e){return x.resolve()}createTargetIndexes(e,t){return x.resolve()}getDocumentsMatchingTarget(e,t){return x.resolve(null)}getIndexType(e,t){return x.resolve(0)}getFieldIndexes(e,t){return x.resolve([])}getNextCollectionGroupToUpdate(e){return x.resolve(null)}getMinOffset(e,t){return x.resolve(Yn.min())}getMinOffsetFromCollectionGroup(e,t){return x.resolve(Yn.min())}updateCollectionGroup(e,t,r){return x.resolve()}updateIndexEntries(e,t){return x.resolve()}}class FA{constructor(){this.index={}}add(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t]||new Ve(Ce.comparator),i=!s.has(r);return this.index[t]=s.add(r),i}has(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t];return s&&s.has(r)}getEntries(e){return(this.index[e]||new Ve(Ce.comparator)).toArray()}}/**
2848 * @license
2849 * Copyright 2017 Google LLC
2850 *
2851 * Licensed under the Apache License, Version 2.0 (the "License");
2852 * you may not use this file except in compliance with the License.
2853 * You may obtain a copy of the License at
2854 *
2855 *   http://www.apache.org/licenses/LICENSE-2.0
2856 *
2857 * Unless required by applicable law or agreed to in writing, software
2858 * distributed under the License is distributed on an "AS IS" BASIS,
2859 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2860 * See the License for the specific language governing permissions and
2861 * limitations under the License.
2862 */class tr{constructor(e){this.ys=e}next(){return this.ys+=2,this.ys}static ws(){return new tr(0)}static bs(){return new tr(-1)}}// Copyright 2024 Google LLC* @license
2863function $p(n,e){var r;let t=e;for(const s of n.stages)t=kA({serializer:n.serializer,serverTimestampBehavior:(r=n.listenOptions)==null?void 0:r.serverTimestampBehavior},s,t);return t}function Ha(n,e){return $p(n,[e]).length>0}function LA(n,e){return Ue(n)?Ha(n,e):Pa(n,e)}function kA(n,e,t){if(e instanceof ka)return function(s,i,o){return o.filter(
2863B=>B.isFoundDocument()&&`/${B.key.getCollectionPath().canonicalString()}`===i.hr)}(0,e,t);if(e instanceof xa)return function(s,i,o){return o.filter(B=>{const c=li(Z(i.condition).evaluate(s,B));return c!==void 0&&Ft(c,gt)})}(n,e,t);if(e instanceof Va)return function(s,i,o){return o.filter(B=>B.isFoundDocument()&&B.key.getCollectionPath().lastSegment()===i.collectionId)}(0,e,t);if(e instanceof iu)return function(s,i,o){return o.filter(B=>B.isFoundDocument())}(0,0,t);if(e instanceof ou)return function(s,i,o){return o.filter(B=>B.isFoundDocument()&&i.Pr.has(B.key.path.toStringWithLeadingSlash()))}(0,e,t);if(e instanceof Sr)return function(s,i,o){return o.slice(0,i.limit)}(0,e,t);if(e instanceof cn)return function(s,i,o){const B=i.orderings.map(c=>({Ms:Z(c.expr),direction:c.direction}));return[...o].sort((c,u)=>{for(const{Ms:h,direction:d}of B){const p=li(h.evaluate(s,c)),_=li(h.evaluate(s,u)),y=mt(p??Bs,_??Bs);if(y!==0)return d==="ascending"?y:-y}return 0})}(n,e,t);throw new Error(`Unknown stage: ${e._name}`)}function gc(n){const e=function(r){for(let s=r.stages.length-1;s>=0;s--){const i=r.stages[s];if(i instanceof cn)return i.orderings}throw new Error("Pipeline must contain at least one Sort stage")}(n);return(t,r)=>{for(const s of e){const i=li(Z(s.expr).evaluate({serializer:n.serializer},t)),o=li(Z(s.expr).evaluate({serializer:n.serializer},r)),B=mt(i||Bs,o||Bs);if(B!==0)return s.direction==="ascending"?B:-B}return 0}}function xB(n){for(let e=n.stages.length-1;e>=0;e--){const t=n.stages[e];if(t instanceof Sr)return{limit:t.limit}}}/**
2864 * @license
2865 * Copyright 2017 Google LLC
2866 *
2867 * Licensed under the Apache License, Version 2.0 (the "License");
2868 * you may not use this file except in compliance with the License.
2869 * You may obtain a copy of the License at
2870 *
2871 *   http://www.apache.org/licenses/LICENSE-2.0
2872 *
2873 * Unless required by applicable law or agreed to in writing, software
2874 * distributed under the License is distributed on an "AS IS" BASIS,
2875 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2876 * See the License for the specific language governing permissions and
2877 * limitations under the License.
2878 */class VA{constructor(){this.changes=new Mr(e=>e.toString(),(e,t)=>e.isEqual(t)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,Ye.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const r=this.changes.get(t);return r!==void 0?x.resolve(r):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
2879 * @license
2880 * Copyright 2017 Google LLC
2881 *
2882 * Licensed under the Apache License, Version 2.0 (the "License");
2883 * you may not use this file except in compliance with the License.
2884 * You may obtain a copy of the License at
2885 *
2886 *   http://www.apache.org/licenses/LICENSE-2.0
2887 *
2888 * Unless required by applicable law or agreed to in writing, software
2889 * distributed under the License is distributed on an "AS IS" BASIS,
2890 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2891 * See the License for the specific language governing permissions and
2892 * limitations under the License.
2893 *//**
2894 * @license
2895 * Copyright 2022 Google LLC
2896 *
2897 * Licensed under the Apache License, Version 2.0 (the "License");
2898 * you may not use this file except in compliance with the License.
2899 * You may obtain a copy of the License at
2900 *
2901 *   http://www.apache.org/licenses/LICENSE-2.0
2902 *
2903 * Unless required by applicable law or agreed to in writing, software
2904 * distributed under the License is distributed on an "AS IS" BASIS,
2905 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2906 * See the License for the specific language governing permissions and
2907 * limitations under the License.
2908 */class xA{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
2909 * @license
2910 * Copyright 2017 Google LLC
2911 *
2912 * Licensed under the Apache License, Version 2.0 (the "License");
2913 * you may not use this file except in compliance with the License.
2914 * You may obtain a copy of the License at
2915 *
2916 *   http://www.apache.org/licenses/LICENSE-2.0
2917 *
2918 * Unless required by applicable law or agreed to in writing, software
2919 * distributed under the License is distributed on an "AS IS" BASIS,
2920 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2921 * See the License for the specific language governing permissions and
2922 * limitations under the License.
2923 */class MA{constructor(e,t,r,s){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=r,this.indexManager=s}getDocument(e,t){let r=null;return this.documentOverlayCache.getOverlay(e,t).next(s=>(r=s,this.remoteDocumentCache.getEntry(e,t))).next(s=>(r!==null&&oi(r.mutation,s,yt.empty(),ge.now()),s))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.getLocalViewOfDocuments(e,r,oe()).next(()=>r))}getLocalViewOfDocuments(e,t,r=oe()){const s=Mn();return this.populateOverlays(e,s,t).next(()=>this.computeViews(e,t,s,r).next(i=>{let o=Xr();return i.forEach((B,c)=>{o=o.insert(B,c.overlayedDocument)}),o}))}getOverlayedDocuments(e,t){const r=Mn();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,oe()))}populateOverlays(e,t,r){const s=[];return r.forEach(i=>{t.has(i)||s.push(i)}),this.documentOverlayCache.getOverlays(e,s).next(i=>{i.forEach((o,B)=>{t.set(o,B)})})}computeViews(e,t,r,s){let i=dt();const o=Bi(),B=function(){return Bi()}();return t.forEach((c,u)=>{const h=r.get(u.key);s.has(u.key)&&(h===void 0||h.mutation instanceof or)?i=i.insert(u.key,u):h!==void 0?(o.set(u.key,h.mutation.getFieldMask()),oi(h.mutation,u,h.mutation.getFieldMask(),ge.now())):o.set(u.key,yt.empty())}),this.recalculateAndSaveOverlays(e,i).next(c=>(c.forEach((u,h)=>o.set(u,h)),t.forEach((u,h)=>B.set(u,new xA(h,o.get(u)??null))),B))}recalculateAndSaveOverlays(e,t){const r=Bi();let s=new ve((o,B)=>o-B),i=oe();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(o=>{for(const B of o)B.keys().forEach(c=>{const u=t.get(c);if(u===null)return;let h=r.get(c)||yt.empty();h=B.applyToLocalView(u,h),r.set(c,h);const d=(s.get(B.batchId)||oe()).add(c);s=s.insert(B.batchId,d)})}).next(()=>{const o=[],B=s.getReverseIterator();for(;B.hasNext();){const c=B.getNext(),u=c.key,h=c.value,d=np();h.forEach(p=>{if(!i.has(p)){const _=HC(t.get(p),r.get(p));_!==null&&d.set(p,_),i=i.add(p)}}),o.push(this.documentOverlayCache.saveOverlays(e,u,d))}return x.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,t,r,s){return Ue(t)?this.getDocumentsMatchingPipeline(e,t,r,s):Hy(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Wc(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,r,s):this.getDocumentsMatchingCollectionQuery(e,t,r,s)}getNextDocuments(e,t,r,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,r,s).next(i=>{const o=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,r.largestBatchId,s-i.size):x.resolve(Mn());let B=Ti,c=i;return o.next(u=>x.forEach(u,(h,d)=>(B<d.largestBatchId&&(B=d.largestBatchId),i.get(h)?x.resolve():this.remoteDocumentCache.getEntry(e,h).next(p=>{c=c.insert(h,p)}))).next(()=>this.populateOverlays(e,u,i)).next(()=>this.computeViews(e,c,u,oe())).next(h=>({batchId:B,changes:tp(h)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new Q(t)).next(r=>{let s=Xr();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,t,r,s){const i=t.collectionGroup;let o=Xr();return this.indexManager.getCollectionParents(e,i).next(B=>x.forEach(B,c=>{const u=function(d,p){return new xr(p,null,d.explicitOrderBy.slice(),d.filters.slice(),d.limit,d.limitType,d.startAt,d.endAt)}(t,c.child(i));return this.getDocumentsMatchingCollectionQuery(e,u,r,s).next(h=>{h.forEach((d,p)=>{o=o.insert(d,p)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,t,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,r.largestBatchId).next(o=>(i=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,i,s))).next(o=>this.retrieveMatchingLocalDocuments(i,o,B=>Pa(t,B)))}getDocumentsMatchingPipeline(e,t,r,s){if(Jn(t)==="collection_group"){const i=Bu(t);let o=Xr();return this.indexManager.getCollectionParents(e,i).next(B=>
2923x.forEach(B,c=>{const u=function(d,p){const _=d.stages.map(y=>y instanceof Va?new ka(p.canonicalString(),{}):y);return new it(d.serializer,_)}(t,c.child(i));return this.getDocumentsMatchingPipeline(e,u,r,s).next(h=>{h.forEach((d,p)=>{o=o.insert(d,p)})})}).next(()=>o))}{let i;return this.getOverlaysForPipeline(e,t,r.largestBatchId).next(o=>{switch(i=o,Jn(t)){case"collection":return this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,i,s);case"documents":let B=oe();for(const c of pc(t))B=B.add(Q.fromPath(c));return this.remoteDocumentCache.getEntries(e,B);case"database":return this.remoteDocumentCache.getAllEntries(e);default:throw new G("invalid-argument",`Invalid pipeline source to execute offline: ${dn(t)}`)}}).next(o=>this.retrieveMatchingLocalDocuments(i,o,B=>Ha(t,B)))}}retrieveMatchingLocalDocuments(e,t,r){e.forEach((i,o)=>{const B=o.getKey();t.get(B)===null&&(t=t.insert(B,Ye.newInvalidDocument(B)))});let s=Xr();return t.forEach((i,o)=>{const B=e.get(i);B!==void 0&&oi(B.mutation,o,yt.empty(),ge.now()),r(o)&&(s=s.insert(i,o))}),s}getOverlaysForPipeline(e,t,r){switch(Jn(t)){case"collection":return this.documentOverlayCache.getOverlaysForCollection(e,Ce.fromString(Ma(t)),r);case"collection_group":throw new G("invalid-argument",`Unexpected collection group pipeline: ${dn(t)}`);case"documents":return this.documentOverlayCache.getOverlays(e,pc(t).map(s=>Q.fromPath(s)));case"database":return this.documentOverlayCache.getAllOverlays(e,r);default:throw new G("invalid-argument",`Failed to get overlays for pipeline: ${dn(t)}`)}}}/**
2924 * @license
2925 * Copyright 2020 Google LLC
2926 *
2927 * Licensed under the Apache License, Version 2.0 (the "License");
2928 * you may not use this file except in compliance with the License.
2929 * You may obtain a copy of the License at
2930 *
2931 *   http://www.apache.org/licenses/LICENSE-2.0
2932 *
2933 * Unless required by applicable law or agreed to in writing, software
2934 * distributed under the License is distributed on an "AS IS" BASIS,
2935 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2936 * See the License for the specific language governing permissions and
2937 * limitations under the License.
2938 */class GA{constructor(e){this.serializer=e,this.Qs=new Map,this.Ws=new Map}getBundleMetadata(e,t){return x.resolve(this.Qs.get(t))}saveBundleMetadata(e,t){return this.Qs.set(t.id,function(s){return{id:s.id,version:s.version,createTime:Yt(s.createTime)}}(t)),x.resolve()}getNamedQuery(e,t){return x.resolve(this.Ws.get(t))}saveNamedQuery(e,t){return this.Ws.set(t.name,function(s){return{name:s.name,query:OA(s.bundledQuery),readTime:Yt(s.readTime)}}(t)),x.resolve()}}/**
2939 * @license
2940 * Copyright 2022 Google LLC
2941 *
2942 * Licensed under the Apache License, Version 2.0 (the "License");
2943 * you may not use this file except in compliance with the License.
2944 * You may obtain a copy of the License at
2945 *
2946 *   http://www.apache.org/licenses/LICENSE-2.0
2947 *
2948 * Unless required by applicable law or agreed to in writing, software
2949 * distributed under the License is distributed on an "AS IS" BASIS,
2950 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2951 * See the License for the specific language governing permissions and
2952 * limitations under the License.
2953 */class UA{constructor(){this.overlays=new ve(Q.comparator),this.Gs=new Map}getOverlay(e,t){return x.resolve(this.overlays.get(t))}getOverlays(e,t){const r=Mn();return x.forEach(t,s=>this.getOverlay(e,s).next(i=>{i!==null&&r.set(s,i)})).next(()=>r)}getAllOverlays(e,t){const r=Mn();return this.overlays.forEach((s,i)=>{i.largestBatchId>t&&r.set(s,i)}),x.resolve(r)}saveOverlays(e,t,r){return r.forEach((s,i)=>{this.Zr(e,t,i)}),x.resolve()}removeOverlaysForBatchId(e,t,r){const s=this.Gs.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.Gs.delete(r)),x.resolve()}getOverlaysForCollection(e,t,r){const s=Mn(),i=t.length+1,o=new Q(t.child("")),B=this.overlays.getIteratorFrom(o);for(;B.hasNext();){const c=B.getNext().value,u=c.getKey();if(!t.isPrefixOf(u.path))break;u.path.length===i&&c.largestBatchId>r&&s.set(c.getKey(),c)}return x.resolve(s)}getOverlaysForCollectionGroup(e,t,r,s){let i=new ve((u,h)=>u-h);const o=this.overlays.getIterator();for(;o.hasNext();){const u=o.getNext().value;if(u.getKey().getCollectionGroup()===t&&u.largestBatchId>r){let h=i.get(u.largestBatchId);h===null&&(h=Mn(),i=i.insert(u.largestBatchId,h)),h.set(u.getKey(),u)}}const B=Mn(),c=i.getIterator();for(;c.hasNext()&&(c.getNext().value.forEach((u,h)=>B.set(u,h)),!(B.size()>=s)););return x.resolve(B)}Zr(e,t,r){const s=this.overlays.get(r.key);if(s!==null){const o=this.Gs.get(s.largestBatchId).delete(r.key);this.Gs.set(s.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new SA(t,r));let i=this.Gs.get(t);i===void 0&&(i=oe(),this.Gs.set(t,i)),this.Gs.set(t,i.add(r.key))}}/**
2954 * @license
2955 * Copyright 2024 Google LLC
2956 *
2957 * Licensed under the Apache License, Version 2.0 (the "License");
2958 * you may not use this file except in compliance with the License.
2959 * You may obtain a copy of the License at
2960 *
2961 *   http://www.apache.org/licenses/LICENSE-2.0
2962 *
2963 * Unless required by applicable law or agreed to in writing, software
2964 * distributed under the License is distributed on an "AS IS" BASIS,
2965 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2966 * See the License for the specific language governing permissions and
2967 * limitations under the License.
2968 */class HA{constructor(){this.sessionToken=xe.EMPTY_BYTE_STRING}getSessionToken(e){return x.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,x.resolve()}}/**
2969 * @license
2970 * Copyright 2017 Google LLC
2971 *
2972 * Licensed under the Apache License, Version 2.0 (the "License");
2973 * you may not use this file except in compliance with the License.
2974 * You may obtain a copy of the License at
2975 *
2976 *   http://www.apache.org/licenses/LICENSE-2.0
2977 *
2978 * Unless required by applicable law or agreed to in writing, software
2979 * distributed under the License is distributed on an "AS IS" BASIS,
2980 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2981 * See the License for the specific language governing permissions and
2982 * limitations under the License.
2983 */class pu{constructor(){this.zs=new Ve(Je.js),this.Hs=new Ve(Je.Js)}isEmpty(){return this.zs.isEmpty()}addReference(e,t){const r=new Je(e,t);this.zs=this.zs.add(r),this.Hs=this.Hs.add(r)}Ys(e,t){e.forEach(r=>this.addReference(r,t))}removeReference(e,t){this.Zs(new Je(e,t))}Xs(e,t){e.forEach(r=>this.removeReference(r,t))}e_(e){const t=new Q(new Ce([])),r=new Je(t,e),s=new Je(t,e+1),i=[];return this.Hs.forEachInRange([r,s],o=>{this.Zs(o),i.push(o.key)}),i}t_(){this.zs.forEach(e=>this.Zs(e))}Zs(e){this.zs=this.zs.delete(e),this.Hs=this.Hs.delete(e)}n_(e){const t=new Q(new Ce([])),r=new Je(t,e),s=new Je(t,e+1);let i=oe();return this.Hs.forEachInRange([r,s],o=>{i=i.add(o.key)}),i}containsKey(e){const t=new Je(e,0),r=this.zs.firstAfterOrEqual(t);return r!==null&&e.isEqual(r.key)}}class Je{constructor(e,t){this.key=e,this.r_=t}static js(e,t){return Q.comparator(e.key,t.key)||ae(e.r_,t.r_)}static Js(e,t){return ae(e.r_,t.r_)||Q.comparator(e.key,t.key)}}/**
2984 * @license
2985 * Copyright 2017 Google LLC
2986 *
2987 * Licensed under the Apache License, Version 2.0 (the "License");
2988 * you may not use this file except in compliance with the License.
2989 * You may obtain a copy of the License at
2990 *
2991 *   http://www.apache.org/licenses/LICENSE-2.0
2992 *
2993 * Unless required by applicable law or agreed to in writing, software
2994 * distributed under the License is distributed on an "AS IS" BASIS,
2995 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2996 * See the License for the specific language governing permissions and
2997 * limitations under the License.
2998 */class qA{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Gr=1,this.i_=new Ve(Je.js)}checkEmpty(e){return x.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,r,s){const i=this.Gr;this.Gr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new RA(i,t,r,s);this.mutationQueue.push(o);for(const B of s)this.i_=this.i_.add(new Je(B.key,i)),this.indexManager.addToCollectionParentIndex(e,B.key.path.popLast());return x.resolve(o)}lookupMutationBatch(e,t){return x.resolve(this.s_(t))}getNextMutationBatchAfterBatchId(e,t){const r=t+1,s=this.__(r),i=s<0?0:s;return x.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return x.resolve(this.mutationQueue.length===0?qc:this.Gr-1)}getAllMutationBatches(e){return x.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const r=new Je(t,0),s=new Je(t,Number.POSITIVE_INFINITY),i=[];return this.i_.forEachInRange([r,s],o=>{const B=this.s_(o.r_);i.push(B)}),x.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new Ve(ae);return t.forEach(s=>{const i=new Je(s,0),o=new Je(s,Number.POSITIVE_INFINITY);this.i_.forEachInRange([i,o],B=>{r=r.add(B.r_)})}),x.resolve(this.o_(r))}getAllMutationBatchesAffectingQuery(e,t){const r=t.path,s=r.length+1;let i=r;Q.isDocumentKey(i)||(i=i.child(""));const o=new Je(new Q(i),0);let B=new Ve(ae);return this.i_.forEachWhile(c=>{const u=c.key.path;return!!r.isPrefixOf(u)&&(u.length===s&&(B=B.add(c.r_)),!0)},o),x.resolve(this.o_(B))}o_(e){const t=[];return e.forEach(r=>{const s=this.s_(r);s!==null&&t.push(s)}),t}removeMutationBatch(e,t){W(this.a_(t.batchId,"removed")===0,55003),this.mutation
vendor: 2,664 bytes, lines 2998-3013
2998Queue.shift();let r=this.i_;return x.forEach(t.mutations,s=>{const i=new Je(s.key,t.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.i_=r})}Hr(e){}containsKey(e,t){const r=new Je(t,0),s=this.i_.firstAfterOrEqual(r);return x.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,x.resolve()}a_(e,t){return this.__(e)}__(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}s_(e){const t=this.__(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}/**
2999 * @license
3000 * Copyright 2017 Google LLC
3001 *
3002 * Licensed under the Apache License, Version 2.0 (the "License");
3003 * you may not use this file except in compliance with the License.
3004 * You may obtain a copy of the License at
3005 *
3006 *   http://www.apache.org/licenses/LICENSE-2.0
3007 *
3008 * Unless required by applicable law or agreed to in writing, software
3009 * distributed under the License is distributed on an "AS IS" BASIS,
3010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3011 * See the License for the specific language governing permissions and
3012 * limitations under the License.
3013 */class JA{constructor(e){this.u_=e,this.docs=function(){return new ve(Q.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const r=t.key,s=this.docs.get(r),i=s?s.size:0,o=this.u_(t);return this.docs=this.docs.insert(r,{document:t.mutableCopy(),size:o}),this.size+=o-i,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const r=this.docs.get(t);return x.resolve(r?r.document.mutableCopy():Ye.newInvalidDocument(t))}getEntries(e,t){let r=dt();return t.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():Ye.newInvalidDocument(s))}),x.resolve(r)}getAllEntries(e){let t=dt();return this.docs.forEach((r,s)=>{t=t.insert(r,s.document)}),x.resolve(t)}getDocumentsMatchingQuery(e,t,r,s){let i,o;Ue(t)?(i=Ce.fromString(Ma(t)),o=h=>Ha(t,h)):(i=t.path,o=h=>Pa(t,h));let B=dt();const c=new Q(i.child("__id-9223372036854775808__")),u=this.docs.getIteratorFrom(c);for(;u.hasNext();){const{key:h,value:{document:d}}=u.getNext();if(!i.isPrefixOf(h.path))break;h.path.length>i.length+1||My(xy(d),r)<=0||(s.has(d.key)||o(d))&&(B=B.insert(d.key,d.mutableCopy()))}return x.resolve(B)}getAllFromCollectionGroup(e,t,r,s){X(9500)}c_(e,t){return x.forEach(this.docs,r=>t(r))}newChangeBuffer(e){return new jA(this)}getSize(e){return x.resolve(this.size)}}class jA extends VA{constructor(e){super(),this.$s=e}applyChanges(e){const t=[];
vendor: 8,945 bytes, lines 3013-3077
3013return this.changes.forEach((r,s)=>{s.isValidDocument()?t.push(this.$s.addEntry(e,s)):this.$s.removeEntry(r)}),x.waitFor(t)}getFromCache(e,t){return this.$s.getEntry(e,t)}getAllFromCache(e,t){return this.$s.getEntries(e,t)}}/**
3014 * @license
3015 * Copyright 2017 Google LLC
3016 *
3017 * Licensed under the Apache License, Version 2.0 (the "License");
3018 * you may not use this file except in compliance with the License.
3019 * You may obtain a copy of the License at
3020 *
3021 *   http://www.apache.org/licenses/LICENSE-2.0
3022 *
3023 * Unless required by applicable law or agreed to in writing, software
3024 * distributed under the License is distributed on an "AS IS" BASIS,
3025 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3026 * See the License for the specific language governing permissions and
3027 * limitations under the License.
3028 */class KA{constructor(e){this.persistence=e,this.l_=new Mr(t=>Kp(t),zp),this.lastRemoteSnapshotVersion=ne.min(),this.highestTargetId=0,this.E_=0,this.h_=new pu,this.targetCount=0,this.T_=tr.ws()}forEachTarget(e,t){return this.l_.forEach((r,s)=>t(s)),x.resolve()}getLastRemoteSnapshotVersion(e){return x.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return x.resolve(this.E_)}allocateTargetId(e){return this.highestTargetId=this.T_.next(),x.resolve(this.highestTargetId)}setTargetsMetadata(e,t,r){return r&&(this.lastRemoteSnapshotVersion=r),t>this.E_&&(this.E_=t),x.resolve()}Ds(e){this.l_.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.T_=new tr(t),this.highestTargetId=t),e.sequenceNumber>this.E_&&(this.E_=e.sequenceNumber)}addTargetData(e,t){return this.Ds(t),this.targetCount+=1,x.resolve()}updateTargetData(e,t){return this.Ds(t),x.resolve()}removeTargetData(e,t){return this.l_.delete(t.target),this.h_.e_(t.targetId),this.targetCount-=1,x.resolve()}removeTargets(e,t,r){let s=0;const i=[];return this.l_.forEach((o,B)=>{B.sequenceNumber<=t&&r.get(B.targetId)===null&&(this.l_.delete(o),i.push(this.removeMatchingKeysForTargetId(e,B.targetId)),s++)}),x.waitFor(i).next(()=>s)}getTargetCount(e){return x.resolve(this.targetCount)}getTargetData(e,t){const r=this.l_.get(t)||null;return x.resolve(r)}addMatchingKeys(e,t,r){return this.h_.Ys(t,r),x.resolve()}removeMatchingKeys(e,t,r){this.h_.Xs(t,r);const s=this.persistence.referenceDelegate,i=[];return s&&t.forEach(o=>{i.push(s.markPotentiallyOrphaned(e,o))}),x.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.h_.e_(t),x.resolve()}getMatchingKeysForTargetId(e,t){const r=this.h_.n_(t);return x.resolve(r)}containsKey(e,t){return x.resolve(this.h_.containsKey(t))}}/**
3029 * @license
3030 * Copyright 2017 Google LLC
3031 *
3032 * Licensed under the Apache License, Version 2.0 (the "License");
3033 * you may not use this file except in compliance with the License.
3034 * You may obtain a copy of the License at
3035 *
3036 *   http://www.apache.org/licenses/LICENSE-2.0
3037 *
3038 * Unless required by applicable law or agreed to in writing, software
3039 * distributed under the License is distributed on an "AS IS" BASIS,
3040 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3041 * See the License for the specific language governing permissions and
3042 * limitations under the License.
3043 */class Qp{constructor(e,t){this.P_={},this.overlays={},this.I_=new Na(0),this.R_=!1,this.R_=!0,this.A_=new HA,this.referenceDelegate=e(this),this.V_=new KA(this),this.indexManager=new NA,this.remoteDocumentCache=function(s){return new JA(s)}(r=>this.referenceDelegate.d_(r)),this.serializer=new PA(t),this.f_=new GA(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.R_=!1,Promise.resolve()}get started(){return this.R_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new UA,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.P_[e.toKey()];return r||(r=new qA(t,this.referenceDelegate),this.P_[e.toKey()]=r),r}getGlobalsCache(){return this.A_}getTargetCache(){return this.V_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.f_}runTransaction(e,t,r){K("MemoryPersistence","Starting transaction:",e);const s=new zA(this.I_.next());return this.referenceDelegate.m_(),r(s).next(i=>this.referenceDelegate.p_(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}g_(e,t){return x.or(Object.values(this.P_).map(r=>()=>r.containsKey(e,t)))}}class zA extends UI{constructor(e){super(),this.currentSequenceNumber=e}}class gu{constructor(e){this.persistence=e,this.y_=new pu,this.w_=null}static b_(e){return new gu(e)}get S_(){if(this.w_)return this.w_;throw X(60996)}addReference(e,t,r){return this.y_.addReference(r,t),this.S_.delete(r.toString()),x.resolve()}removeReference(e,t,r){return this.y_.removeReference(r,t),this.S_.add(r.toString()),x.resolve()}markPotentiallyOrphaned(e,t){return this.S_.add(t.toString()),x.resolve()}removeTarget(e,t){this.y_.e_(t.targetId).forEach(s=>this.S_.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(s=>{s.forEach(i=>this.S_.add(i.toString()))}).next(()=>r.removeTargetData(e,t))}m_(){this.w_=new Set}p_(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return x.forEach(this.S_,r=>{const s=Q.fromPath(r);return this.v_(e,s).next(i=>{i||t.removeEntry(s,ne.min())})}).next(()=>(this.w_=null,t.apply(e)))}updateLimboDocument(e,t){return this.v_(e,t).next(r=>{r?this.S_.delete(t.toString()):this.S_.add(t.toString())})}d_(e){return 0}v_(e,t){return x.or([()=>x.resolve(this.y_.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.g_(e,t)])}}class aa{constructor(e,t){this.persistence=e,this.D_=new Mr(r=>vA(r.path),(r,s)=>r.isEqual(s)),this.garbageCollector=zI(this,t)}static b_(e,t){return new aa(e,t)}m_(){}p_(e){return x.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}ir(e){const t=this.Cs(e);return this.persistence.getTargetCache().getTargetCount(e).next(r=>t.next(s=>r+s))}Cs(e){let t=0;return this.sr(e,r=>{t++}).next(()=>t)}sr(e,t){return x.forEach(this.D_,(r,s)=>this.Os(e,r,s).next(i=>i?x.resolve():t(s)))}removeTargets(e,t,r){return this.persistence.getTargetCache().removeTargets(e,t,r)}removeOrphanedDocuments(e,t){let r=0;const s=this.persistence.getRemoteDocumentCache(),i=s.newChangeBuffer();return s.c_(e,o=>this.Os(e,o,t).next(B=>{B||(r++,i.removeEntry(o,ne.min()))})).next(()=>i.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,t){return this.D_.set(t,e.currentSequenceNumber),x.resolve()}removeTarget(e,t){const r=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,t,r){return this.D_.set(r,e.currentSequenceNumber),x.resolve()}removeReference(e,t,r){return this.D_.set(r,e.currentSequenceNumber),x.resolve()}updateLimboDocument(e,t){return this.D_.set(t,e.currentSequenceNumber),x.resolve()}d_(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=Lo(e.data.value)),t}Os(e,t,r){return x.or([()=>this.persistence.g_(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const s=this.D_.get(t);return x.resolve(s!==void 0&&s>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/**
3044 * @license
3045 * Copyright 2017 Google LLC
3046 *
3047 * Licensed under the Apache License, Version 2.0 (the "License");
3048 * you may not use this file except in compliance with the License.
3049 * You may obtain a copy of the License at
3050 *
3051 *   http://www.apache.org/licenses/LICENSE-2.0
3052 *
3053 * Unless required by applicable law or agreed to in writing, software
3054 * distributed under the License is distributed on an "AS IS" BASIS,
3055 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3056 * See the License for the specific language governing permissions and
3057 * limitations under the License.
3058 */class mu{constructor(e,t,r,s){this.targetId=e,this.fromCache=t,this.Vo=r,this.fo=s}static mo(e,t){let r=oe(),s=oe();for(const i of t.docChanges)switch(i.type){case 0:r=r.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new mu(e,t.fromCache,r,s)}}/**
3059 * @license
3060 * Copyright 2017 Google LLC
3061 *
3062 * Licensed under the Apache License, Version 2.0 (the "License");
3063 * you may not use this file except in compliance with the License.
3064 * You may obtain a copy of the License at
3065 *
3066 *   http://www.apache.org/licenses/LICENSE-2.0
3067 *
3068 * Unless required by applicable law or agreed to in writing, software
3069 * distributed under the License is distributed on an "AS IS" BASIS,
3070 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3071 * See the License for the specific language governing permissions and
3072 * limitations under the License.
3073 */function WA(n,e){return Q.comparator(n.key,e.key)}/**
3074 * @license
3075 * Copyright 2023 Google LLC
3076 *
3077 * Licensed under the Apache License, Version 2.0 (the "License");
3078 * you may not use this file except in compliance with the License.
3079 * You may obtain a copy of the License at
3080 *
3081 *   http://www.apache.org/licenses/LICENSE-2.0
3082 *
3083 * Unless required by applicable law or agreed to in writing, software
3084 * distributed under the License is distributed on an "AS IS" BASIS,
3085 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3086 * See the License for the specific language governing permissions and
3087 * limitations under the License.
3088 */class $A{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
3089 * @license
3090 * Copyright 2019 Google LLC
3091 *
3092 * Licensed under the Apache License, Version 2.0 (the "License");
3093 * you may not use this file except in compliance with the License.
3094 * You may obtain a copy of the License at
3095 *
3096 *   http://www.apache.org/licenses/LICENSE-2.0
3097 *
3098 * Unless required by applicable law or agreed to in writing, software
3099 * distributed under the License is distributed on an "AS IS" BASIS,
3100 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3101 * See the License for the specific language governing permissions and
3102 * limitations under the License.
3103 */class QA{constructor(){this.po=!1,this.yo=!1,this.wo=100,this.bo=function(){return fE()?8:HI(et())>0?6:4}()}initialize(e,t){this.So=e,this.indexManager=t,this.po=!0}getDocumentsMatchingQuery(e,t,r,s){const i={result:null};return this.vo(e,t).next(o=>{i.result=o}).next(()=>{if(!i.result)return this.Do(e,t,s,r).next(o=>{i.result=o})}).next(()=>{if(i.result)return;const o=new $A;return this.xo(e,t,o).next(B=>{if(i.result=B,this.yo)return this.Co(e,t,o,B.size)})}).next(()=>i.result)}Co(e,t,r,s){return Ue(t)?x.resolve():r.documentReadCount<this.wo?(Qr()<=ce.DEBUG&&K("QueryEngine","SDK will not create cache indexes for query:",ai(t),"since it only creates cache indexes for collection contains","more than or equal to",this.wo,"documents"),x.resolve()):(Qr()<=ce.DEBUG&&K("QueryEngine","Query:",ai(t),"scans",r.documentReadCount,"local documents and returns",s,"documents as results."),r.documentReadCount>this.bo*s?(Qr()<=ce.DEBUG&&K("QueryEngine","The SDK decides to create cache indexes for query:",ai(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Qt(t))):x.resolve())}vo(e,t){if(Ue(t))return x.resolve(null);let r=t;if(mf(r))return x.resolve(null);let s=Qt(r);return this.indexManager.getIndexType(e,s).next(i=>i===0?null:(r.limit!==null&&i===1&&(r=ra(r,null,"F"),s=Qt(r)),this.indexManager.getDocumentsMatchingTarget(e,s).next(o=>{const B=oe(...o);return this.So.getDocuments(e,B).next(c=>this.indexManager.getMinOffset(e,s).next(u=>{const h=this.Fo(r,c);return this.Oo(r,h,B,u.readTime)?this.vo(e,ra(r,null,"F")):this.Mo(e,h,r,u)}))}
3103)))}Do(e,t,r,s){return(Ue(t)?function(o){for(const B of o.stages){if(B instanceof Sr||B instanceof Ff)return!1;if(B instanceof xa){if(B.condition instanceof Np&&B.condition._expr.name==="exists"&&B.condition._expr.params[0]instanceof Ts&&B.condition._expr.params[0].fieldName===Kt)continue;return!1}}return!0}(t):mf(t))||s.isEqual(ne.min())?x.resolve(null):this.So.getDocuments(e,r).next(i=>{const o=this.Fo(t,i);return this.Oo(t,o,r,s)?x.resolve(null):(Qr()<=ce.DEBUG&&K("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),Lf(t)),this.Mo(e,o,t,Vy(s,Ti)).next(B=>B))})}Fo(e,t){let r,s;return Ue(e)?(r=new Ve(WA),s=i=>Ha(e,i)):(r=new Ve($c(e)),s=i=>Pa(e,i)),t.forEach((i,o)=>{s(o)&&(r=r.add(o))}),r}Oo(e,t,r,s){if(Ue(e))return function(B){return B.stages.some(c=>c instanceof Sr||c instanceof Ff)}(e);if(e.limit===null)return!1;if(r.size!==t.size)return!0;const i=e.limitType==="F"?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}xo(e,t,r){return Qr()<=ce.DEBUG&&K("QueryEngine","Using full collection scan to execute query:",Lf(t)),this.So.getDocumentsMatchingQuery(e,t,Yn.min(),r)}Mo(e,t,r,s){return this.So.getDocumentsMatchingQuery(e,r,s).next(i=>(t.forEach(o=>{i=i.insert(o.key,o)}),i))}}/**
3104 * @license
3105 * Copyright 2020 Google LLC
3106 *
3107 * Licensed under the Apache License, Version 2.0 (the "License");
3108 * you may not use this file except in compliance with the License.
3109 * You may obtain a copy of the License at
3110 *
3111 *   http://www.apache.org/licenses/LICENSE-2.0
3112 *
3113 * Unless required by applicable law or agreed to in writing, software
3114 * distributed under the License is distributed on an "AS IS" BASIS,
3115 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3116 * See the License for the specific language governing permissions and
3117 * limitations under the License.
3118 */const Eu="LocalStore",YA=3e8;class XA{constructor(e,t,r,s){this.persistence=e,this.No=t,this.serializer=s,this.Lo=new ve(ae),this.Bo=new Mr(i=>Kp(i),zp),this.Uo=new Map,this.ko=e.getRemoteDocumentCache(),this.V_=e.getTargetCache(),this.f_=e.getBundleCache(),this.qo(r)}qo(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new MA(this.ko,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ko.setIndexManager(this.indexManager),this.No.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Lo))}}function ZA(n,e,t,r){return new XA(n,e,t,r)}async function Yp(n,e){const t=re(n);return await t.persistence.runTransaction("Handle user change","readonly",r=>{let s;return t.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,t.qo(e),t.mutationQueue.getAllMutationBatches(r))).next(i=>{const o=[],B=[];let c=oe();for(const u of s){o.push(u.batchId);for(const h of u.mutations)c=c.add(h.key)}for(const u of i){B.push(u.batchId);for(const h of u.mutations)c=c.add(h.key)}return t.localDocuments.getDocuments(r,c).next(u=>({$o:u,removedBatchIds:o,addedBatchIds:B}))})})}function eR(n,e){const t=re(n);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=t.ko.newChangeBuffer({trackRemovals:!0});return function(B,c,u,h){const d=u.batch,p=d.keys();let _=x.resolve();return p.forEach(y=>{_=_.next(()=>h.getEntry(c,y)).next(O=>{const V=u.docVersions.get(y);W(V!==null,48541),O.version.compareTo(V)<0&&(d.applyToRemoteDocument(O,u),O.isValidDocument()&&(O.setReadTime(u.commitVersion),h.addEntry(O)))})}),_.next(()=>
vendor: 4,320 bytes, lines 3118-3122
3118B.mutationQueue.removeMutationBatch(c,d))}(t,r,e,i).next(()=>i.apply(r)).next(()=>t.mutationQueue.performConsistencyCheck(r)).next(()=>t.documentOverlayCache.removeOverlaysForBatchId(r,s,e.batch.batchId)).next(()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(B){let c=oe();for(let u=0;u<B.mutationResults.length;++u)B.mutationResults[u].transformResults.length>0&&(c=c.add(B.batch.mutations[u].key));return c}(e))).next(()=>t.localDocuments.getDocuments(r,s))})}function Xp(n){const e=re(n);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.V_.getLastRemoteSnapshotVersion(t))}function tR(n,e){const t=re(n),r=e.snapshotVersion;let s=t.Lo;return t.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const o=t.ko.newChangeBuffer({trackRemovals:!0});s=t.Lo;const B=[];e.targetChanges.forEach((h,d)=>{const p=s.get(d);if(!p)return;B.push(t.V_.removeMatchingKeys(i,h.removedDocuments,d).next(()=>t.V_.addMatchingKeys(i,h.addedDocuments,d)));let _=p.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(d)!==null?_=_.withResumeToken(xe.EMPTY_BYTE_STRING,ne.min()).withLastLimboFreeSnapshotVersion(ne.min()):h.resumeToken.approximateByteSize()>0&&(_=_.withResumeToken(h.resumeToken,r)),s=s.insert(d,_),function(O,V,j){return O.resumeToken.approximateByteSize()===0||V.snapshotVersion.toMicroseconds()-O.snapshotVersion.toMicroseconds()>=YA?!0:j.addedDocuments.size+j.modifiedDocuments.size+j.removedDocuments.size>0}(p,_,h)&&B.push(t.V_.updateTargetData(i,_))});let c=dt(),u=oe();if(e.documentUpdates.forEach(h=>{e.resolvedLimboDocuments.has(h)&&B.push(t.persistence.referenceDelegate.updateLimboDocument(i,h))}),B.push(nR(i,o,e.documentUpdates).next(h=>{c=h.Ko,u=h.Qo})),!r.isEqual(ne.min())){const h=t.V_.getLastRemoteSnapshotVersion(i).next(d=>t.V_.setTargetsMetadata(i,i.currentSequenceNumber,r));B.push(h)}return x.waitFor(B).next(()=>o.apply(i)).next(()=>t.localDocuments.getLocalViewOfDocuments(i,c,u)).next(()=>c)}).then(i=>(t.Lo=s,i))}function nR(n,e,t){let r=oe(),s=oe();return t.forEach(i=>r=r.add(i)),e.getEntries(n,r).next(i=>{let o=dt();return t.forEach((B,c)=>{const u=i.get(B);c.isFoundDocument()!==u.isFoundDocument()&&(s=s.add(B)),c.isNoDocument()&&c.version.isEqual(ne.min())?(e.removeEntry(B,c.readTime),o=o.insert(B,c)):!u.isValidDocument()||c.version.compareTo(u.version)>0||c.version.compareTo(u.version)===0&&u.hasPendingWrites?(e.addEntry(c),o=o.insert(B,c)):K(Eu,"Ignoring outdated watch update for ",B,". Current version:",u.version," Watch version:",c.version)}),{Ko:o,Qo:s}})}function rR(n,e){const t=re(n);return t.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=qc),t.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function sR(n,e){const t=re(n);return t.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return t.V_.getTargetData(r,e).next(i=>i?(s=i,x.resolve(s)):t.V_.allocateTargetId(r).next(o=>(s=new un(e,o,"TargetPurposeListen",r.currentSequenceNumber),t.V_.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=t.Lo.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(t.Lo=t.Lo.insert(r.targetId,r),t.Bo.set(e,r.targetId)),r})}async function mc(n,e,t){const r=re(n),s=r.Lo.get(e),i=t?"readwrite":"readwrite-primary";try{t||await r.persistence.runTransaction("Release target",i,o=>r.persistence.referenceDelegate.removeTarget(o,s))}catch(o){if(!ys(o))throw o;K(Eu,`Failed to update sequence numbers for target ${e}: ${o}`)}r.Lo=r.Lo.remove(e),r.Bo.delete(s.target)}function Vf(n,e,t){const r=re(n);let s=ne.min(),i=oe();return r.persistence.runTransaction("Execute query","readwrite",o=>function(c,u,h){const d=re(c),p=d.Bo.get(h);return p!==void 0?x.resolve(d.Lo.get(p)):d.V_.getTargetData(u,h)}(r,o,Ue(e)?e:Qt(e)).next(B=>{if(B)return s=B.lastLimboFreeSnapshotVersion,r.V_.getMatchingKeysForTargetId(o,B.targetId).next(c=>{i=c})}).next(()=>r.No.getDocumentsMatchingQuery(o,e,t?s:ne.min(),t?i:oe())).next(B=>(iR(r,B),{documents:B,Wo:i})))}function iR(n,e){e.forEach((t,r)=>{const s=r.key.getCollectionGroup(),i=n.Uo.get(s)||ne.min();r.readTime.compareTo(i)>0&&n.Uo.set(s,r.readTime)})}/**
3119 * @license
3120 * Copyright 2020 Google LLC
3121 *
3122 * Licensed under the Apache License, Version 2.0 (the "License");
3123 * you may not use this file except in compliance with the License.
3124 * You may obtain a copy of the License at
3125 *
3126 *   http://www.apache.org/licenses/LICENSE-2.0
3127 *
3128 * Unless required by applicable law or agreed to in writing, software
3129 * distributed under the License is distributed on an "AS IS" BASIS,
3130 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3131 * See the License for the specific language governing permissions and
3132 * limitations under the License.
3133 */class oR{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.Yo=0,this.Zo=null,this.Xo=!0}ea(){this.Yo===0&&(this.ta("Unknown"),this.Zo=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.Zo=null,this.na("Backend didn't respond within 10 seconds."),this.ta("Offline"),Promise.resolve())))}ra(e){this.state==="Online"?this.ta("Unknown"):(this.Yo++,this.Yo>=1&&(this.ia(),this.na(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ta("Offline")))}set(e){this.ia(),this.Yo=0,e==="Online"&&(this.Xo=!1),this.ta(e)}ta(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}na(e){const t=`Could not reach Cloud Firestore backend. ${e}
3134This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.Xo?(En(t),this.Xo=!1):K("OnlineStateTracker",t)}ia(){this.Zo!==null&&(this.Zo.cancel(),this.Zo=null)}}/**
3135 * @license
3136 * Copyright 2017 Google LLC
3137 *
3138 * Licensed under the Apache License, Version 2.0 (the "License");
3139 * you may not use this file except in compliance with the License.
3140 * You may obtain a copy of the License at
3141 *
3142 *   http://www.apache.org/licenses/LICENSE-2.0
3143 *
3144 * Unless required by applicable law or agreed to in writing, software
3145 * distributed under the License is distributed on an "AS IS" BASIS,
3146 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3147 * See the License for the specific language governing permissions and
3148 * limitations under the License.
3149 */const tn="RemoteStore";class aR{constructor(e,t,r,s,i){this.localStore=e,this.datastore=t,this.asyncQueue=r,this.remoteSyncer={},this.sa=[],this._a=new Map,this.oa=new Map,this.aa=new Map,this.ua=new tr(1e3),this.ca=new tr(1001),this.la=new Set,this.Ea=[],this.ha=i,this.ha.Qe(o=>{r.enqueueAndForget(async()=>{Ur(this)&&(K(tn,"Restarting streams for network reachability change."),await async function(c){const u=re(c);u.la.add(4),await zi(u),u.Ta.set("Unknown"),u.la.delete(4),await qa(u)}(this))})}),this.Ta=new oR(r,s)}}async function qa(n){if(Ur(n))for(const e of n.Ea)await e(!0)}async function zi(n){for(const e of n.Ea)await e(!1)}function Ec(n,e){return n.oa.get(e)||void 0}function Zp(n,e){const t=re(n),r=Ec(t,e.targetId);if(r!==void 0&&t._a.has(r))return;const s=function(B,c){const u=Ec(B,c);u!==void 0&&B.aa.delete(u);const h=function(p,_){return _%2!=0?p.ca.next():p.ua.next()}(B,c);return B.oa.set(c,h),B.aa.set(h,c),h}(t,e.targetId);K(tn,"remoteStoreListen mapping SDK target ID to remote",e.targetId,s);const i=new un(e.target,s,e.purpose,e.sequenceNumber,e.snapshotVersion,e.lastLimboFreeSnapshotVersion,e.resumeToken);t._a.set(s,i),yu(t)?wu(t):bs(t).Yt()&&Du(t,i)}function _u(n,e){const t=re(n),r=bs(t),s=Ec(t,e);K(tn,"remoteStoreUnlisten removing mapping of SDK target ID to remote",e,s),t._a.delete(s),t.oa.delete(e),t.aa.delete(s),r.Yt()&&eg(t,s),t._a.size===0&&(r.Yt()?r.en():Ur(t)&&t.Ta.set("Unknown"))}function Du(n,e){if(n.Pa.J(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(ne.min())>0){const t=n.aa.get(e.targetId);if(t===void 0)return void K(tn,"SDK target ID not found for remote ID: "+e.targetId);const r=n.remoteSyncer.getRemoteKeysForTarget(t).size;e=e.withExpectedCount(r)}bs(n).Pn(e)}function eg(n,e){n.Pa.J(e),bs(n).In(e)}function wu(n){n.Pa=new rI({getRemoteKeysForTarget:e=>{const t=n.aa.get(e);return t!==void 0?n.remoteSyncer.getRemoteKeysForTarget(t):oe()},ye:e=>n._a.get(e)||null,Ve:()=>n.datastore.serializer.databaseId}),bs(n).start(),n.Ta.ea()}function yu(n){return Ur(n)&&!bs(n).Jt()&&n._a.size>0}function Ur(n){return re(n).la.size===0}function tg(n){n.Pa=void 0}async function BR(n){n.Ta.set("Online")}async function cR(n){n._a.forEach((e,t)=>{Du(n,e)})}async function uR(n,e){tg(n),yu(n)?(n.Ta.ra(e),wu(n)):n.Ta.set("Unknown")}async function lR(n,e,t){if(n.Ta.set("Online"),e instanceof sp&&e.state===2&&e.cause)try{await async function(s,i){const o=i.cause;for(const B of i.targetIds){if(s._a.has(B)){const c=s.aa.get(B);c!==void 0&&(await s.remoteSyncer.rejectListen(c,o),s.oa.delete(c),s.aa.delete(B)),s._a.delete(B)}s.Pa.removeTarget(B)}}(n,e)}catch(r){K(tn,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Ba(n,r)}else if(e instanceof Vo?n.Pa._e(e):e instanceof rp?n.Pa.he(e):n.Pa.ue(e),!t.isEqual(ne.min()))try{const r=await Xp(n.localStore);t.compareTo(r)>=0&&await function(i,o){const B=i.Pa.fe(o);
3149B.targetChanges.forEach((u,h)=>{if(u.resumeToken.approximateByteSize()>0){const d=i._a.get(h);d&&i._a.set(h,d.withResumeToken(u.resumeToken,o))}}),B.targetMismatches.forEach((u,h)=>{const d=i._a.get(u);if(!d)return;i._a.set(u,d.withResumeToken(xe.EMPTY_BYTE_STRING,d.snapshotVersion)),eg(i,u);const p=new un(d.target,u,h,d.sequenceNumber);Du(i,p)});const c=function(h,d){const p=new Map;d.targetChanges.forEach((y,O)=>{const V=h.aa.get(O);V!==void 0&&p.set(V,y)});let _=new ve(ae);return d.targetMismatches.forEach((y,O)=>{const V=h.aa.get(y);V!==void 0&&(_=_.insert(V,O))}),new Hi(d.snapshotVersion,p,_,d.documentUpdates,d.augmentedDocumentUpdates,d.resolvedLimboDocuments)}(i,B);return i.remoteSyncer.applyRemoteEvent(c)}(n,t)}catch(r){K(tn,"Failed to raise snapshot:",r),await Ba(n,r)}}async function Ba(n,e,t){if(!ys(e))throw e;n.la.add(1),await zi(n),n.Ta.set("Offline"),t||(t=()=>Xp(n.localStore)),n.asyncQueue.enqueueRetryable(async()=>{K(tn,"Retrying IndexedDB access"),await t(),n.la.delete(1),await qa(n)})}function ng(n,e){return e().catch(t=>Ba(n,t,e))}async function Ja(n){const e=re(n),t=nr(e);let r=e.sa.length>0?e.sa[e.sa.length-1].batchId:qc;for(;hR(e);)try{const s=await rR(e.localStore,r);if(s===null){e.sa.length===0&&t.en();break}r=s.batchId,fR(e,s)}catch(s){await Ba(e,s)}rg(e)&&sg(e)}function hR(n){return Ur(n)&&n.sa.length<10}function fR(n,e){n.sa.push(e);const t=nr(n);t.Yt()&&t.Rn&&t.An(e.mutations)}function rg(n){return Ur(n)&&!nr(n).Jt()&&n.sa.length>0}function sg(n){nr(n).start()}async function dR(n){nr(n).fn()}async function CR(n){const e=nr(n);for(const t of n.sa)e.An(t.mutations)}async function pR(n,e,t){const r=n.sa.shift(),s=Cu.from(r,e,t);await ng(n,()=>n.remoteSyncer.applySuccessfulWrite(s)),await Ja(n)}async function gR(n,e){e&&nr(n).Rn&&await async function(r,s){if(function(o){return $y(o)&&o!==L.ABORTED}(s.code)){const i=r.sa.shift();nr(r).Xt(),await ng(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await Ja(r)}}(n,e),rg(n)&&sg(n)}async function xf(n,e){const t=re(n);t.asyncQueue.verifyOperationInProgress(),K(tn,"RemoteStore received new credentials");const r=Ur(t);t.la.add(3),await zi(t),r&&t.Ta.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.la.delete(3),await qa(t)}async function mR(n,e){const t=re(n);e?(t.la.delete(2),await qa(t)):e||(t.la.add(2),await zi(t),t.Ta.set("Unknown"))}function bs(n){return n.Ia||(n.Ia=function(t,r,s){const i=re(t);return i.pn(),new NI(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{ct:BR.bind(null,n),Et:cR.bind(null,n),Tt:uR.bind(null,n),Tn:lR.bind(null,n)}),n.Ea.push(async e=>{e?(n.Ia.Xt(),yu(n)?wu(n):n.Ta.set("Unknown")):(await n.Ia.stop(),tg(n))})),n.Ia}function nr(n){return n.Ra||(n.Ra=function(t,r,s){const i=re(t);return i.pn(),new FI(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{ct:()=>Promise.resolve(),Et:dR.bind(null,n),Tt:gR.bind(null,n),Vn:CR.bind(null,n),dn:pR.bind(null,n)}),n.Ea.push(async e=>{e?(n.Ra.Xt(),await Ja(n)):(await n.Ra.stop(),n.sa.length>0&&(K(tn,`Stopping write stream with ${n.sa.length} pending writes`),n.sa=[]))})),n.Ra}/**
3150 * @license
3151 * Copyright 2017 Google LLC
3152 *
3153 * Licensed under the Apache License, Version 2.0 (the "License");
3154 * you may not use this file except in compliance with the License.
3155 * You may obtain a copy of the License at
3156 *
3157 *   http://www.apache.org/licenses/LICENSE-2.0
3158 *
3159 * Unless required by applicable law or agreed to in writing, software
3160 * distributed under the License is distributed on an "AS IS" BASIS,
3161 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3162 * See the License for the specific language governing permissions and
3163 * limitations under the License.
3164 */class Iu{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Aa(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Aa(this.observer.error,e):En("Uncaught Error in snapshot listener:",e.toString()))}Va(){this.muted=!0}Aa(e,t){setTimeout(()=>{this.muted||e(t)},0)}}/**
3165 * @license
3166 * Copyright 2017 Google LLC
3167 *
3168 * Licensed under the Apache License, Version 2.0 (the "License");
3169 * you may not use this file except in compliance with the License.
3170 * You may obtain a copy of the License at
3171 *
3172 *   http://www.apache.org/licenses/LICENSE-2.0
3173 *
3174 * Unless required by applicable law or agreed to in writing, software
3175 * distributed under the License is distributed on an "AS IS" BASIS,
3176 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3177 * See the License for the specific language governing permissions and
3178 * limitations under the License.
3179 */class Tu{constructor(e,t,r,s,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new fn,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,r,s,i){const o=Date.now()+r,B=new Tu(e,t,o,s,i);return B.start(r),B}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new G(L.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Au(n,e){if(En("AsyncQueue",`${e}: ${n}`),ys(n))return new G(L.UNAVAILABLE,`${e}: ${n}`);throw n}class Mf{constructor(){this.activeTargetIds=eI()}Ba(e){this.activeTargetIds=this.activeTargetIds.add(e)}Ua(e){this.activeTargetIds=this.activeTargetIds.delete(e)}La(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class ER{constructor(){this.fu=new Mf,this.mu={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,r){}addLocalQueryTarget(e,t=!0){return t&&this.fu.Ba(e),this.mu[e]||"not-current"}updateQueryState(e,t,r){this.mu[e]=t}removeLocalQueryTarget(e){this.fu.Ua(e)}isLocalQueryTarget(e){return this.fu.activeTargetIds.has(e)}clearQueryState(e){delete this.mu[e]}getAllActiveQueryTargets(){return this.fu.activeTargetIds}isActiveQueryTarget(e){return this.fu.activeTargetIds.has(e)}start(){return this.fu=new Mf,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}function MB(){return typeof document<"u"?document:null}/**
3180 * @license
3181 * Copyright 2017 Google LLC
3182 *
3183 * Licensed under the Apache License, Version 2.0 (the "License");
3184 * you may not use this file except in compliance with the License.
3185 * You may obtain a copy of the License at
3186 *
3187 *   http://www.apache.org/licenses/LICENSE-2.0
3188 *
3189 * Unless required by applicable law or agreed to in writing, software
3190 * distributed under the License is distributed on an "AS IS" BASIS,
3191 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3192 * See the License for the specific language governing permissions and
3193 * limitations under the License.
3194 */class yr{static emptySet(e){return new yr(e.comparator)}constructor(e){this.comparator=e?(t,r)=>e(t,r)||Q.comparator(t.key,r.key):(t,r)=>Q.comparator(t.key,r.key),this.keyedMap=Xr(),this.sortedSet=new ve(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,r)=>(e(t),!1))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof yr)||this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;t.hasNext();){const s=t.getNext().key,i=r.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
3195  `+e.join(`  
3196`)+`
3197)`}copy(e,t){const r=new yr;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}/**
3198 * @license
3199 * Copyright 2017 Google LLC
3200 *
3201 * Licensed under the Apache License, Version 2.0 (the "License");
3202 * you may not use this file except in compliance with the License.
3203 * You may obtain a copy of the License at
3204 *
3205 *   http://www.apache.org/licenses/LICENSE-2.0
3206 *
3207 * Unless required by applicable law or agreed to in writing, software
3208 * distributed under the License is distributed on an "AS IS" BASIS,
3209 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3210 * See the License for the specific language governing permissions and
3211 * limitations under the License.
3212 */class Gf{constructor(){this.pu=new ve(Q.comparator)}track(e){const t=e.doc.key,r=this.pu.get(t);r?e.type!==0&&r.type===3?this.pu=this.pu.insert(t,e):e.type===3&&r.type!==1?this.pu=this.pu.insert(t,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.pu=this.pu.insert(t,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.pu=this.pu.insert(t,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.pu=this.pu.remove(t):e.type===1&&r.type===2?this.pu=this.pu.insert(t,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.pu=this.pu.insert(t,{type:2,doc:e.doc}):X(63341,{we:e,gu:r}):this.pu=this.pu.insert(t,e)}yu(){const e=[];return this.pu.inorderTraversal((t,r)=>{e.push(r)}),e}}class ds{constructor(e,t,r,s,i,o,B,c,u){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=B,this.excludesMetadataChanges=c,this.hasCachedResults=u}static fromInitialDocuments(e,t,r,s,i){const o=[];return t.forEach(B=>{o.push({type:0,doc:B})}),new ds(e,t,yr.emptySet(t),o,r,s,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Ua(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,r=e.docChanges;if(t.length!==r.length)return!1;for(let s=0;s<t.length;s++)if(t[s].type!==r[s].type||!t[s].doc.isEqual(r[s].doc))return!1;return!0}}/**
3213 * @license
3214 * Copyright 2017 Google LLC
3215 *
3216 * Licensed under the Apache License, Version 2.0 (the "License");
3217 * you may not use this file except in compliance with the License.
3218 * You may obtain a copy of the License at
3219 *
3220 *   http://www.apache.org/licenses/LICENSE-2.0
3221 *
3222 * Unless required by applicable law or agreed to in writing, software
3223 * distributed under the License is distributed on an "AS IS" BASIS,
3224 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3225 * See the License for the specific language governing permissions and
3226 * limitations under the License.
3227 */class _R{constructor(){this.wu=void 0,this.bu=[]}Su(){return this.bu.some(e=>e.vu())}}class DR{constructor(){this.queries=Uf(),this.onlineState="Unknown",this.Du=new Set}terminate(){(function(t,r){const s=re(t),i=s.queries;s.queries=Uf(),i.forEach((o,B)=>{for(const c of B.bu)c.onError(r)})})(this,new G(L.ABORTED,"Firestore shutting down"))}}function Uf(){return new Mr(n=>jp(n),Ua)}async function Ru(n,e){const t=re(n);let r=3;const s=e.query;let i=t.queries.get(s);i?!i.Su()&&e.vu()&&(r=2):(i=new _R,r=e.vu()?0:1);try{switch(r){case 0:i.wu=await t.onListen(s,!0);break;case 1:i.wu=await t.onListen(s,!1);break;case 2:await t.onFirstRemoteStoreListen(s)}}catch(o){const B=Au(o,`Initialization of query '${Ue(e.query)?dn(e.query):ai(e.query)}' failed`);return void e.onError(B)}t.queries.set(s,i),i.bu.push(e),e.xu(t.onlineState),i.wu&&e.Cu(i.wu)&&bu(t)}async function vu(n,e){const t=re(n),r=e.query;let s=3;const i=t.queries.get(r);if(i){const o=i.bu.indexOf(e);o>=0&&(i.bu.splice(o,1),i.bu.length===0?s=e.vu()?0:1:!i.Su()&&e.vu()&&(s=2))}switch(s){case 0:return t.queries.delete(r),t.onUnlisten(r,!0);case 1:return t.queries.delete(r),t.onUnlisten(r,!1);case 2:return t.onLastRemoteStoreUnlisten(r);default:return}}function wR(n,e){const t=re(n);let r=!1;for(const s of e){const i=s.query,o=t.queries.get(i);if(o){for(const B of o.bu)B.Cu(s)&&(r=!0);o.wu=s}}r&&bu(t)}function yR(n,e,t){const r=re(n),s=r.queries.get(e);if(s)for(const i of s.bu)i.onError(t);r.queries.delete(e)}
3227function bu(n){n.Du.forEach(e=>{e.next()})}var _c;(function(n){n.Default="default",n.Cache="cache"})(_c||(_c={}));class Su{constructor(e,t,r){this.query=e,this.Fu=t,this.Ou=!1,this.Mu=null,this.onlineState="Unknown",this.options=r||{}}Cu(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new ds(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Ou?this.Nu(e)&&(this.Fu.next(e),t=!0):this.Lu(e,this.onlineState)&&(this.Bu(e),t=!0),this.Mu=e,t}onError(e){this.Fu.error(e)}xu(e){this.onlineState=e;let t=!1;return this.Mu&&!this.Ou&&this.Lu(this.Mu,e)&&(this.Bu(this.Mu),t=!0),t}Lu(e,t){if(!e.fromCache||!this.vu())return!0;const r=t!=="Offline";return(!this.options.waitForSyncWhenOnline||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}Nu(e){if(e.docChanges.length>0)return!0;const t=this.Mu&&this.Mu.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}Bu(e){e=ds.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Ou=!0,this.Fu.next(e)}vu(){return this.options.source!==_c.Cache}}/**
3228 * @license
3229 * Copyright 2017 Google LLC
3230 *
3231 * Licensed under the Apache License, Version 2.0 (the "License");
3232 * you may not use this file except in compliance with the License.
3233 * You may obtain a copy of the License at
3234 *
3235 *   http://www.apache.org/licenses/LICENSE-2.0
3236 *
3237 * Unless required by applicable law or agreed to in writing, software
3238 * distributed under the License is distributed on an "AS IS" BASIS,
3239 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3240 * See the License for the specific language governing permissions and
3241 * limitations under the License.
3242 */class ig{constructor(e){this.key=e}}class og{constructor(e){this.key=e}}class IR{constructor(e,t){this.query=e,this.zu=t,this.ju=null,this.hasCachedResults=!1,this.current=!1,this.Hu=oe(),this.mutatedKeys=oe(),this.Ju=Ue(e)?gc(e):$c(e),this.Yu=new yr(this.Ju)}get Zu(){return this.zu}Xu(e,t){const r=t?t.ec:new Gf,s=t?t.Yu:this.Yu;let i=t?t.mutatedKeys:this.mutatedKeys,o=s,B=!1;const[c,u]=this.tc(this.query,s);e.inorderTraversal((d,p)=>{const _=s.get(d),y=LA(this.query,p)?p:null,O=!!_&&this.mutatedKeys.has(_.key),V=!!y&&(y.hasLocalMutations||this.mutatedKeys.has(y.key)&&y.hasCommittedMutations);let j=!1;_&&y?_.data.isEqual(y.data)?O!==V&&(r.track({type:3,doc:y}),j=!0):this.nc(_,y)||(r.track({type:2,doc:y}),j=!0,(c&&this.Ju(y,c)>0||u&&this.Ju(y,u)<0)&&(B=!0)):!_&&y?(r.track({type:0,doc:y}),j=!0):_&&!y&&(r.track({type:1,doc:_}),j=!0,(c||u)&&(B=!0)),j&&(y?(o=o.add(y),i=V?i.add(d):i.delete(d)):(o=o.delete(d),i=i.delete(d)))});const h=this.rc(this.query);if(h)if(Ue(this.query)){const d=[];o.forEach(y=>d.push(y));const p=$p(this.query,d);let _=new yr(gc(this.query));for(const y of p)_=_.add(y);o.forEach(y=>{_.has(y.key)||(i=i.delete(y.key),r.track({type:1,doc:y}))}),o=_}else{const d=this.sc(this.query);for(;o.size>h;){const p=d==="F"?o.last():o.first();o=o.delete(p.key),i=i.delete(p.key),r.track({type:1,doc:p})}}return{Yu:o,ec:r,Oo:B,mutatedKeys:i}}rc(e){var t;return Ue(e)?(t=xB(e))==null?void 0:t.limit:e.limit||void 0}sc(e){if(Ue(e)){const t=xB(e);return t&&t.limit<0?"L":"F"}return e.limitType}tc(e,t){var r;if(Ue(e)){const s=(r=xB(e))==null?void 0:r.limit;return[t.size===s?t.last():null,null]}return[e.limitType==="F"&&t.size===this.rc(this.query)?t.last():null,e.limitType==="L"&&t.size===this.rc(this.query)?t.first():null]}nc(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,r,s){const i=this.Yu;this.Yu=e.Yu,this.mutatedKeys=e.mutatedKeys;const o=e.ec.yu();o.sort((h,d)=>function(_,y){const O=V=>{switch(V){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return X(20277,{we:V})}};return O(_)-O(y)}(h.type,d.type)||this.Ju(h.doc,d.doc)),this._c(r),s=s??!1;const B=t&&!s?this.oc():[],c=this.Hu.size===0&&this.current&&!s?1:0,u=c!==this.ju;return this.ju=c,o.length!==0||u?{snapshot:new ds(this.query,e.Yu,i,o,e.mutatedKeys,c===0,u,!1,!!r&&r.resumeToken.approximateByteSize()>0),ac:B}:{ac:B}}xu(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Yu:this.Yu,ec:new Gf,mutatedKeys:this.mutatedKeys,Oo:!1},!1)):{ac:[]}}uc(e){return!this.zu.has(e)&&!!this.Yu.has(e)&&!this.Yu.get(e).hasLocalMutations}
3242_c(e){e&&(e.addedDocuments.forEach(t=>this.zu=this.zu.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.zu=this.zu.delete(t)),this.current=e.current)}oc(){if(!this.current)return[];const e=this.Hu;this.Hu=oe(),this.Yu.forEach(r=>{this.uc(r.key)&&(this.Hu=this.Hu.add(r.key))});const t=[];return e.forEach(r=>{this.Hu.has(r)||t.push(new og(r))}),this.Hu.forEach(r=>{e.has(r)||t.push(new ig(r))}),t}cc(e){this.zu=e.Wo,this.Hu=oe();const t=this.Xu(e.documents);return this.applyChanges(t,!0)}lc(){return ds.fromInitialDocuments(this.query,this.Yu,this.mutatedKeys,this.ju===0,this.hasCachedResults)}}const Pu="SyncEngine";class TR{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class AR{constructor(e){this.key=e,this.Ec=!1}}class RR{constructor(e,t,r,s,i,o){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.hc={},this.Tc=new Mr(B=>jp(B),Ua),this.Pc=new Map,this.Ic=new Set,this.Rc=new ve(Q.comparator),this.Ac=new Map,this.Vc=new pu,this.dc={},this.fc=new Map,this.mc=tr.bs(),this.onlineState="Unknown",this.gc=void 0}get isPrimaryClient(){return this.gc===!0}}async function vR(n,e,t=!0){const r=hg(n);let s;const i=r.Tc.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.lc()):s=await ag(r,e,t,!0),s}async function bR(n,e){const t=hg(n);await ag(t,e,!0,!1)}async function ag(n,e,t,r){const s=await sR(n.localStore,Ue(e)?e:Qt(e)),i=s.targetId,o=n.sharedClientState.addLocalQueryTarget(i,t);let B;return r&&(B=await SR(n,e,i,o==="current",s.resumeToken)),n.isPrimaryClient&&t&&Zp(n.remoteStore,s),B}async function SR(n,e,t,r,s){n.yc=(d,p,_)=>async function(O,V,j,ee){let se=V.view.Xu(j);se.Oo&&(se=await Vf(O.localStore,V.query,!1).then(({documents:R})=>V.view.Xu(R,se)));const Be=ee&&ee.targetChanges.get(V.targetId),ye=ee&&ee.targetMismatches.get(V.targetId)!=null,pe=V.view.applyChanges(se,O.isPrimaryClient,Be,ye);return qf(O,V.targetId,pe.ac),pe.snapshot}(n,d,p,_);const i=await Vf(n.localStore,e,!0),o=new IR(e,i.Wo),B=o.Xu(i.documents),c=qi.createSynthesizedTargetChangeForCurrentChange(t,r&&n.onlineState!=="Offline",s),u=o.applyChanges(B,n.isPrimaryClient,c);qf(n,t,u.ac);const h=new TR(e,t,o);return n.Tc.set(e,h),n.Pc.has(t)?n.Pc.get(t).push(e):n.Pc.set(t,[e]),u.snapshot}async function PR(n,e,t){const r=re(n),s=r.Tc.get(e),i=r.Pc.get(s.targetId);if(i.length>1)return r.Pc.set(s.targetId,i.filter(o=>!Ua(o,e))),void r.Tc.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedCl
3242ientState.isActiveQueryTarget(s.targetId)||await mc(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),t&&_u(r.remoteStore,s.targetId),Dc(r,s.targetId)}).catch(ws)):(Dc(r,s.targetId),await mc(r.localStore,s.targetId,!0))}async function OR(n,e){const t=re(n),r=t.Tc.get(e),s=t.Pc.get(r.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),_u(t.remoteStore,r.targetId))}async function NR(n,e,t){const r=GR(n);try{const s=await function(o,B){const c=re(o),u=ge.now(),h=B.reduce((_,y)=>_.add(y.key),oe());let d,p;return c.persistence.runTransaction("Locally write mutations","readwrite",_=>{let y=dt(),O=oe();return c.ko.getEntries(_,h).next(V=>{y=V,y.forEach((j,ee)=>{ee.isValidDocument()||(O=O.add(j))})}).next(()=>c.localDocuments.getOverlayedDocuments(_,y)).next(V=>{d=V;const j=[];for(const ee of B){const se=Ay(ee,d.get(ee.key).overlayedDocument);se!=null&&j.push(new or(ee.key,se,VC(se.value.mapValue),Bt.exists(!0)))}return c.mutationQueue.addMutationBatch(_,u,j,B)}).next(V=>{p=V;const j=V.applyToLocalDocumentSet(d,O);return c.documentOverlayCache.saveOverlays(_,V.batchId,j)})}).then(()=>({batchId:p.batchId,changes:tp(d)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(o,B,c){let u=o.dc[o.currentUser.toKey()];u||(u=new ve(ae)),u=u.insert(B,c),o.dc[o.currentUser.toKey()]=u}(r,s.batchId,t),await Wi(r,s.changes),await Ja(r.remoteStore)}catch(s){const i=Au(s,"Failed to persist write");t.reject(i)}}async function Bg(n,e){const t=re(n);try{const r=await tR(t.localStore,e);
3242e.targetChanges.forEach((s,i)=>{const o=t.Ac.get(i);o&&(W(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1,22616),s.addedDocuments.size>0?o.Ec=!0:s.modifiedDocuments.size>0?W(o.Ec,14607):s.removedDocuments.size>0&&(W(o.Ec,42227),o.Ec=!1))}),await Wi(t,r,e)}catch(r){await ws(r)}}function Hf(n,e,t){const r=re(n);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const s=[];r.Tc.forEach((i,o)=>{const B=o.view.xu(e);B.snapshot&&s.push(B.snapshot)}),function(o,B){const c=re(o);c.onlineState=B;let u=!1;c.queries.forEach((h,d)=>{for(const p of d.bu)p.xu(B)&&(u=!0)}),u&&bu(c)}(r.eventManager,e),s.length&&r.hc.Tn(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function FR(n,e,t){const r=re(n);r.sharedClientState.updateQueryState(e,"rejected",t);const s=r.Ac.get(e),i=s&&s.key;if(i){let o=new ve(Q.comparator);o=o.insert(i,Ye.newNoDocument(i,ne.min()));const B=oe().add(i),c=new Hi(ne.min(),new Map,new ve(ae),o,dt(),B);await Bg(r,c),r.Rc=r.Rc.remove(i),r.Ac.delete(e),Ou(r)}else await mc(r.localStore,e,!1).then(()=>Dc(r,e,t)).catch(ws)}async function LR(n,e){const t=re(n),r=e.batch.batchId;try{const s=await eR(t.localStore,e);ug(t,r,null),cg(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await Wi(t,s)}catch(s){await ws(s)}}async function kR(n,e,t){const r=re(n);try{const s=await function(o,B){const c=re(o);return c.persistence.runTransaction("Reject batch","readwrite-primary",u=>{let h;return c.mutationQueue.lookupMutationBatch(u,B).next(d=>
3242(W(d!==null,37113),h=d.keys(),c.mutationQueue.removeMutationBatch(u,d))).next(()=>c.mutationQueue.performConsistencyCheck(u)).next(()=>c.documentOverlayCache.removeOverlaysForBatchId(u,h,B)).next(()=>c.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(u,h)).next(()=>c.localDocuments.getDocuments(u,h))})}(r.localStore,e);ug(r,e,t),cg(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await Wi(r,s)}catch(s){await ws(s)}}function cg(n,e){(n.fc.get(e)||[]).forEach(t=>{t.resolve()}),n.fc.delete(e)}function ug(n,e,t){const r=re(n);let s=r.dc[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),r.dc[r.currentUser.toKey()]=s}}function Dc(n,e,t=null){n.sharedClientState.removeLocalQueryTarget(e);for(const r of n.Pc.get(e))n.Tc.delete(r),t&&n.hc.wc(r,t);n.Pc.delete(e),n.isPrimaryClient&&n.Vc.e_(e).forEach(r=>{n.Vc.containsKey(r)||lg(n,r)})}function lg(n,e){n.Ic.delete(e.path.canonicalString());const t=n.Rc.get(e);t!==null&&(_u(n.remoteStore,t),n.Rc=n.Rc.remove(e),n.Ac.delete(t),Ou(n))}function qf(n,e,t){for(const r of t)r instanceof ig?(n.Vc.addReference(r.key,e),VR(n,r)):r instanceof og?(K(Pu,"Document no longer in limbo: "+r.key),n.Vc.removeReference(r.key,e),n.Vc.containsKey(r.key)||lg(n,r.key)):X(19791,{bc:r})}function VR(n,e){const t=e.key,r=t.path.canonicalString();n.Rc.get(t)||n.Ic.has(r)||(K(Pu,"New document in limbo: "+t),n.Ic.add(r),Ou(n))}function Ou(n){for(;n.Ic.size>0&&n.Rc.size<n.maxConcurrentLimboResolutions;){const e=n.Ic.values().next().value;n.Ic.delete(e);const t=new Q(Ce.fromString(e)),r=n.mc.next();n.Ac.set(r,new AR(t)),n.Rc=n.Rc.insert(t,r),Zp(n.remoteStore,new un(Qt(Sa(t.path)),r,"TargetPurposeLimboResolution",Na.wn))}}async function Wi(n,e,t){const r=re(n),s=[],i=[],o=[];r.Tc.isEmpty()||(r.Tc.forEach((B,c)=>{o.push(r.yc(c,e,t).then(u=>{var h;if((u||t)&&r.isPrimaryClient){const d=u?!u.fromCache:(h=t==null?void 0:t.targetChanges.get(c.targetId))==null?void 0:h.current;
3242r.sharedClientState.updateQueryState(c.targetId,d?"current":"not-current")}if(u){s.push(u);const d=mu.mo(c.targetId,u);i.push(d)}}))}),await Promise.all(o),r.hc.Tn(s),await async function(c,u){const h=re(c);try{await h.persistence.runTransaction("notifyLocalViewChanges","readwrite",d=>x.forEach(u,p=>x.forEach(p.Vo,_=>h.persistence.referenceDelegate.addReference(d,p.targetId,_)).next(()=>x.forEach(p.fo,_=>h.persistence.referenceDelegate.removeReference(d,p.targetId,_)))))}catch(d){if(!ys(d))throw d;K(Eu,"Failed to update sequence numbers: "+d)}for(const d of u){const p=d.targetId;if(!d.fromCache){const _=h.Lo.get(p),y=_.snapshotVersion,O=_.withLastLimboFreeSnapshotVersion(y);h.Lo=h.Lo.insert(p,O)}}}(r.localStore,i))}async function xR(n,e){const t=re(n);if(!t.currentUser.isEqual(e)){K(Pu,"User change. New user:",e.toKey());const r=await Yp(t.localStore,e);t.currentUser=e,function(i,o){i.fc.forEach(B=>{B.forEach(c=>{c.reject(new G(L.CANCELLED,o))})}),i.fc.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await Wi(t,r.$o)}}function MR(n,e){const t=re(n),r=t.Ac.get(e);if(r&&r.Ec)return oe().add(r.key);{let s=oe();const i=t.Pc.get(e);if(!i)return s;for(const o of i??[]){const B=t.Tc.get(o);s=s.unionWith(B.view.Zu)}return s}}function hg(n){const e=re(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=Bg.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=MR.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=FR.bind(null,e),e.hc.Tn=wR.bind(null,e.eventManager),e.hc.wc=yR.bind(null,e.eventManager),e}function GR(n){const e=re(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=LR.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=kR.bind(null,e),e}class ca{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Oa(e.databaseInfo.databaseId),this.sharedClientState=this.vc(e),this.persistence=this.Dc(e),await this.persistence.start(),this.localStore=this.xc(e),this.gcScheduler=this.Cc(e,this.localStore),this.indexBackfillerScheduler=this.Fc(e,this.localStore)}Cc(e,t){return null}Fc(e,t){return null}xc(e){return ZA(this.persistence,new QA,e.initialUser,this.serializer)}Dc(e){return new Qp(gu.b_,this.serializer)}vc(e){return new ER}async terminate(){var e,t;(e=this.gcScheduler)==null||e.stop(),(t=this.indexBackfillerScheduler)==null||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}ca.provider={build:()=>new ca};class UR extends ca{constructor(e){super(),this.cacheSizeBytes=e}Cc(e,t){W(this.persistence.referenceDelegate instanceof aa,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new jI(r,e.asyncQueue,t)}Dc(e){const t=this.cacheSizeBytes!==void 0?ht.withCacheSize(this.cacheSizeBytes):ht.DEFAULT;return new Qp(r=>aa.b_(r,t),this.serializer)}}class wc{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>Hf(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=xR.bind(null,this.syncEngine),await mR(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new DR}()}createDatastore(e){const t=Oa(e.databaseInfo.databaseId),r=OI(e.databaseInfo);return VI(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return function(r,s,i,o,B){return new aR(r,s,i,o,B)}(this.localStore,this.datastore,e.asyncQueue,t=>Hf(this.syncEngine,t,0),function(){return Af.Ye()?new Af:new vI}())}createSyncEngine(e,t){return function(s,i,o,B,c,u,h){const d=new RR(s,i,o,B,c,u);return h&&(d.gc=!0),d}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(s){const i=re(s);K(tn,"RemoteStore shutting down."),i.la.add(5),await zi(i),i.ha.shutdown(),i.Ta.set("Unknown")}(this.remoteStore),(e=this.datastore)==null||e.terminate(),(t=this.eventManager)==null||t.terminate()}}wc.provider={build:()=>new wc};/**
3243 * @license
3244 * Copyright 2017 Google LLC
3245 *
3246 * Licensed under the Apache License, Version 2.0 (the "License");
3247 * you may not use this file except in compliance with the License.
3248 * You may obtain a copy of the License at
3249 *
3250 *   http://www.apache.org/licenses/LICENSE-2.0
3251 *
3252 * Unless required by applicable law or agreed to in writing, software
3253 * distributed under the License is distributed on an "AS IS" BASIS,
3254 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3255 * See the License for the specific language governing permissions and
3256 * limitations under the License.
3257 */const rr="FirestoreClient";class HR{constructor(e,t,r,s,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this._databaseInfo=s,this.user=Qe.UNAUTHENTICATED,this.clientId=Hc.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,async o=>{K(rr,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(r,o=>(K(rr,"Received new app check token=",o),this.appCheckCredentialListener(o,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new fn;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const r=Au(t,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function GB(n,e){n.asyncQueue.verifyOperationInProgress(),K(rr,"Initializing OfflineComponentProvider");const t=n.configuration;await e.initialize(t);let r=t.initialUser;n.setCredentialChangeListener(async s=>{r.isEqual(s)||(await Yp(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>n.terminate()),n._offlineComponents=e}async function Jf(n,e){n.asyncQueue.verifyOperationInProgress();const t=await qR(n);K(rr,"Initializing OnlineComponentProvider"),await e.initialize(t,n.configuration),n.setCredentialChangeListener(r=>xf(e.remoteStore,r)),n.setAppCheckTokenChangeListener((r,s)=>xf(e.remoteStore,s)),n._onlineComponents=e}async function qR(n){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){K(rr,"Using user provided OfflineComponentProvider");try{await GB(n,n._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!function(s){return s.name==="FirebaseError"?s.code===L.FAILED_PRECONDITION||s.code===L.UNIMPLEMENTED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11}(t))throw t;Gt("Error using user provided cache. Falling back to memory cache: "+t),await GB(n,new ca)}}else K(rr,"Using default OfflineComponentProvider"),await GB(n,new UR(void 0));return n._offlineComponents}async function fg(n){return n._onlineComponents||(n._uninitializedComponentsProvider?(K(rr,"Using user provided OnlineComponentProvider"),await Jf(n,n._uninitializedComponentsProvider._online)):(K(rr,"Using default OnlineComponentProvider"),await Jf(n,new wc))),n._onlineComponents}function JR(n){return fg(n).then(e=>e.syncEngine)}async function ua(n){const e=await fg(n),t=e.eventManager;return t.onListen=vR.bind(null,e.syncEngine),t.onUnlisten=PR.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=bR.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=OR.bind(null,e.syncEngine),t}function jR(n,e,t,r){const s=new Iu(r),i=new Su(e,s,t);return n.asyncQueue.enqueueAndForget(async()=>Ru(await ua(n),i)),()=>{s.Va(),n.asyncQueue.enqueueAndForget(async()=>vu(await ua(n),i))}}function dg(n,e,t={}){const r=new fn;return n.asyncQueue.enqueueAndForget(async()=>function(i,o,B,c,u){const h=new Iu({next:p=>{h.Va(),o.enqueueAndForget(()=>vu(i,d));const _=p.docs.has(B);!_&&p.fromCache?u.reject(new G(L.UNAVAILABLE,"Failed to get document because the client is offline.")):_&&p.fromCache&&c&&c.source==="server"?u.reject(new G(L.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):u.resolve(p)},error:p=>u.reject(p)}),d=new Su(Sa(B.path),h,{includeMetadataChanges:!0,waitForSyncWhe
3257nOnline:!0});return Ru(i,d)}(await ua(n),n.asyncQueue,e,t,r)),r.promise}function Cg(n,e,t={}){const r=new fn;return n.asyncQueue.enqueueAndForget(async()=>function(i,o,B,c,u){const h=new Iu({next:p=>{h.Va(),o.enqueueAndForget(()=>vu(i,d)),p.fromCache&&c.source==="server"?u.reject(new G(L.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):u.resolve(p)},error:p=>u.reject(p)}),d=new Su(B instanceof ui?AA(B):B,h,{includeMetadataChanges:!0,waitForSyncWhenOnline:!0});return Ru(i,d)}(await ua(n),n.asyncQueue,e,t,r)),r.promise}function KR(n,e){const t=new fn;return n.asyncQueue.enqueueAndForget(async()=>NR(await JR(n),e,t)),t.promise}/**
3258 * @license
3259 * Copyright 2020 Google LLC
3260 *
3261 * Licensed under the Apache License, Version 2.0 (the "License");
3262 * you may not use this file except in compliance with the License.
3263 * You may obtain a copy of the License at
3264 *
3265 *   http://www.apache.org/licenses/LICENSE-2.0
3266 *
3267 * Unless required by applicable law or agreed to in writing, software
3268 * distributed under the License is distributed on an "AS IS" BASIS,
3269 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3270 * See the License for the specific language governing permissions and
3271 * limitations under the License.
3272 */let Nu=class{constructor(e,t,r,s,i){this._firestore=e,this._userDataWriter=t,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Re(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new zR(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){var e;return((e=this._document)==null?void 0:e.data.clone().value.mapValue.fields)??void 0}get(e){if(this._document){const t=this._document.data.field(Xn("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}},zR=class extends Nu{data(){return super.data()}};/**
3273 * @license
3274 * Copyright 2020 Google LLC
3275 *
3276 * Licensed under the Apache License, Version 2.0 (the "License");
3277 * you may not use this file except in compliance with the License.
3278 * You may obtain a copy of the License at
3279 *
3280 *   http://www.apache.org/licenses/LICENSE-2.0
3281 *
3282 * Unless required by applicable law or agreed to in writing, software
3283 * distributed under the License is distributed on an "AS IS" BASIS,
3284 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3285 * See the License for the specific language governing permissions and
3286 * limitations under the License.
3287 */class WR{convertValue(e,t="none"){switch(Me(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Se(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes($n(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw X(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const r={};return ir(e,(s,i)=>{r[s]=this.convertValue(i,t)}),r}convertVectorValue(e){var r,s,i;const t=(i=(s=(r=e.fields)==null?void 0:r[_i].arrayValue)==null?void 0:s.values)==null?void 0:i.map(o=>Se(o.doubleValue));return new pt(t)}convertGeoPoint(e){return new Xt(Se(e.latitude),Se(e.longitude))}convertArray(e,t){return(e.values||[]).map(r=>this.convertValue(r,t))}convertServerTimestamp(e,t){switch(t){case"previous":const r=Gi(e);return r==null?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(as(e));default:return null}}convertTimestamp(e){const t=Wn(e);return new ge(t.seconds,t.nanos)}convertDocumentKey(e,t){const r=Ce.fromString(e);W(lp(r),9688,{name:e});const s=new mi(r.get(1),r.get(3)),i=new Q(r.popFirst(5));return s.isEqual(t)||En(`A document reference to ${i} refers to a different database (${s.projectId}/${s.database}), which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),i}}/**
3288 * @license
3289 * Copyright 2020 Google LLC
3290 *
3291 * Licensed under the Apache License, Version 2.0 (the "License");
3292 * you may not use this file except in compliance with the License.
3293 * You may obtain a copy of the License at
3294 *
3295 *   http://www.apache.org/licenses/LICENSE-2.0
3296 *
3297 * Unless required by applicable law or agreed to in writing, software
3298 * distributed under the License is distributed on an "AS IS" BASIS,
3299 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3300 * See the License for the specific language governing permissions and
3301 * limitations under the License.
3302 */function Fu(n,e,t){let r;return r=n?t&&(t.merge||t.mergeFields)?n.toFirestore(e,t):n.toFirestore(e):e,r}/**
3303 * @license
3304 * Copyright 2020 Google LLC
3305 *
3306 * Licensed under the Apache License, Version 2.0 (the "License");
3307 * you may not use this file except in compliance with the License.
3308 * You may obtain a copy of the License at
3309 *
3310 *   http://www.apache.org/licenses/LICENSE-2.0
3311 *
3312 * Unless required by applicable law or agreed to in writing, software
3313 * distributed under the License is distributed on an "AS IS" BASIS,
3314 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3315 * See the License for the specific language governing permissions and
3316 * limitations under the License.
3317 */const jf="AsyncQueue";class Kf{constructor(e=Promise.resolve()){this.$c=[],this.Kc=!1,this.Qc=[],this.Wc=null,this.Gc=!1,this.zc=!1,this.jc=[],this.Ht=new pp(this,"async_queue_retry"),this.Hc=()=>{const r=MB();r&&K(jf,"Visibility state changed to "+r.visibilityState),this.Ht.$t()},this.Jc=e;const t=MB();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.Hc)}get isShuttingDown(){return this.Kc}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Yc(),this.Zc(e)}enterRestrictedMode(e){if(!this.Kc){this.Kc=!0,this.zc=e||!1;const t=MB();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.Hc)}}enqueue(e){if(this.Yc(),this.Kc)return new Promise(()=>{});const t=new fn;return this.Zc(()=>this.Kc&&this.zc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.$c.push(e),this.Xc()))}async Xc(){if(this.$c.length!==0){try{await this.$c[0](),this.$c.shift(),this.Ht.reset()}catch(e){if(!ys(e))throw e;K(jf,"Operation failed with retryable error: "+e)}this.$c.length>0&&this.Ht.kt(()=>this.Xc())}}Zc(e){const t=this.Jc.then(()=>(this.Gc=!0,e().catch(r=>{throw this.Wc=r,this.Gc=!1,En("INTERNAL UNHANDLED ERROR: ",zf(r)),r}).then(r=>(this.Gc=!1,r))));return this.Jc=t,t}enqueueAfterDelay(e,t,r){this.Yc(),this.jc.indexOf(e)>-1&&(t=0);const s=Tu.createAndSchedule(this,e,t,r,i=>this.el(i));return this.Qc.push(s),s}Yc(){this.Wc&&X(47125,{tl:zf(this.Wc)})}verifyOperationInProgress(){}async nl(){let e;do e=this.Jc,await e;while(e!==this.Jc)}rl(e){for(const t of this.Qc)if(t.timerId===e)return!0;return!1}il(e){return this.nl().then(()=>{this.Qc.sort((t,r)=>t.targetTimeMs-r.targetTimeMs);for(const t of this.Qc)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.nl()})}sl(e){this.jc.push(e)}el(e){const t=this.Qc.indexOf(e);this.Qc.splice(t,1)}}function zf(n){let e=n.message||"";return n.stack&&(e=n.stack.includes(n.message)?n.stack:n.message+`
3318`+n.stack),e}class Lt extends Fa{constructor(e,t,r,s){super(e,t,r,s),this.type="firestore",this._queue=new Kf,this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Kf(e),this._firestoreClient=void 0,await e}}}function LP(n,e){const t=typeof n=="object"?n:ga(),r=typeof n=="string"?n:Yo,s=kr(t,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=Rc("firestore");i&&WI(s,...i)}return s}function Hr(n){if(n._terminated)throw new G(L.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||$R(n),n._firestoreClient}function $R(n){var r,s,i,o;const e=n._freezeSettings(),t=MI(n._databaseId,((r=n._app)==null?void 0:r.options.appId)||"",n._persistenceKey,(s=n._app)==null?void 0:s.options.apiKey,e);n._componentsProvider||(i=e.localCache)!=null&&i._offlineComponentProvider&&((o=e.localCache)!=null&&o._onlineComponentProvider)&&(n._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),n._firestoreClient=new HR(n._authCredentials,n._appCheckCredentials,n._queue,t,n._componentsProvider&&function(c){const u=c==null?void 0:c._online.build();return{_offline:c==null?void 0:c._offline.build(u),_online:u}}(n._componentsProvider))}/**
3319 * @license
3320 * Copyright 2024 Google LLC
3321 *
3322 * Licensed under the Apache License, Version 2.0 (the "License");
3323 * you may not use this file except in compliance with the License.
3324 * You may obtain a copy of the License at
3325 *
3326 *   http://www.apache.org/licenses/LICENSE-2.0
3327 *
3328 * Unless required by applicable law or agreed to in writing, software
3329 * distributed under the License is distributed on an "AS IS" BASIS,
3330 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3331 * See the License for the specific language governing permissions and
3332 * limitations under the License.
3333 */class ja extends WR{constructor(e){super(),this.firestore=e}convertBytes(e){return new St(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new Re(this.firestore,null,t)}}class ni{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Ir extends Nu{constructor(e,t,r,s,i,o){super(e,t,r,s,o),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Go(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const r=this._document.data.field(Xn("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new G(L.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=Ir._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?t:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t)}}Ir._jsonSchemaVersion="firestore/documentSnapshot/1.0",Ir._jsonSchema={type:ke("string",Ir._jsonSchemaVersion),bundleSource:ke("string","DocumentSnapshot"),bundleName:ke("string"),bundle:ke("string")};class Go extends Ir{data(e={}){return super.data(e)}}class Kn{constructor(e,t,r,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new ni(s.hasPendingWrites,s.fromCache),this.query=r}get docs(){const e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach(r=>{e.call(t,new Go(this._firestore,this._userDataWriter,r.key,r,new ni(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new G(L.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(s,i){if(s._snapshot.oldDocs.isEmpty()){let o=0;return s._snapshot.docChanges.map(B=>{Ue(s._snapshot.query)?gc(s._snapshot.query):$c(s.query._query);const c=new Go(s._firestore,s._userDataWriter,B.doc.key,B.doc,new ni(s._snapshot.mutatedKeys.has(B.doc.key),s._snapshot.fromCache),s.query.converter);return B.doc,{type:"added",doc:c,oldIndex:-1,newIndex:o++}})}{let o=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(B=>i||B.type!==3).map(B=>{const c=new Go(s._firestore,s._userDataWriter,B.doc.key,B.doc,new ni(s._snapshot.mutatedKeys.has(B.doc.key),s._snapshot.fromCache),s.query.converter);let u=-1,h=-1;return B.type!==0&&(u=o.indexOf(B.doc.key),o=o.delete(B.doc.key)),B.type!==1&&(o=o.add(B.doc),h=o.indexOf(B.doc.key)),{type:QR(B.type),doc:c,oldIndex:u,newIndex:h}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new G(L.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};
3333e.type=Kn._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Hc.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],r=[],s=[];return this.docs.forEach(i=>{i._document!==null&&(t.push(i._document),r.push(this._userDataWriter.convertObjectMap(i._document.data.value.mapValue.fields,"previous")),s.push(i.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function QR(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return X(61501,{type:n})}}/**
3334 * @license
3335 * Copyright 2025 Google LLC
3336 *
3337 * Licensed under the Apache License, Version 2.0 (the "License");
3338 * you may not use this file except in compliance with the License.
3339 * You may obtain a copy of the License at
3340 *
3341 *   http://www.apache.org/licenses/LICENSE-2.0
3342 *
3343 * Unless required by applicable law or agreed to in writing, software
3344 * distributed under the License is distributed on an "AS IS" BASIS,
3345 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3346 * See the License for the specific language governing permissions and
3347 * limitations under the License.
3348 */Kn._jsonSchemaVersion="firestore/querySnapshot/1.0",Kn._jsonSchema={type:ke("string",Kn._jsonSchemaVersion),bundleSource:ke("string","QuerySnapshot"),bundleName:ke("string"),bundle:ke("string")};/**
3349 * @license
3350 * Copyright 2020 Google LLC
3351 *
3352 * Licensed under the Apache License, Version 2.0 (the "License");
3353 * you may not use this file except in compliance with the License.
3354 * You may obtain a copy of the License at
3355 *
3356 *   http://www.apache.org/licenses/LICENSE-2.0
3357 *
3358 * Unless required by applicable law or agreed to in writing, software
3359 * distributed under the License is distributed on an "AS IS" BASIS,
3360 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3361 * See the License for the specific language governing permissions and
3362 * limitations under the License.
3363 */function pg(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new G(L.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Lu{}class Ka extends Lu{}function kP(n,e,...t){let r=[];e instanceof Lu&&r.push(e),r=r.concat(t),function(i){const o=i.filter(c=>c instanceof ku).length,B=i.filter(c=>c instanceof za).length;if(o>1||o>0&&B>0)throw new G(L.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const s of r)n=s._apply(n);return n}
3363class za extends Ka{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new za(e,t,r)}_apply(e){const t=this._parse(e);return gg(e._query,t),new Ht(e.firestore,e.converter,lc(e._query,t))}_parse(e){const t=Is(e.firestore);return function(i,o,B,c,u,h,d){let p;if(u.isKeyField()){if(h==="array-contains"||h==="array-contains-any")throw new G(L.INVALID_ARGUMENT,`Invalid Query. You can't perform '${h}' queries on documentId().`);if(h==="in"||h==="not-in"){$f(d,h);const y=[];for(const O of d)y.push(Wf(c,i,O));p={arrayValue:{values:y}}}else p=Wf(c,i,d)}else h!=="in"&&h!=="not-in"&&h!=="array-contains-any"||$f(d,h),p=Tp(B,o,d,h==="in"||h==="not-in");return Le.create(u,h,p)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function VP(n,e,t){const r=e,s=Xn("where",n);return za._create(s,r,t)}class ku extends Lu{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new ku(e,t)}_parse(e){const t=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return t.length===1?t[0]:Ut.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:(function(s,i){let o=s;const B=i.getFlattenedFilters();for(const c of B)gg(o,c),o=lc(o,c)}(e._query,t),new Ht(e.firestore,e.converter,lc(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class Vu extends Ka{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new Vu(e,t)}_apply(e){const t=function(s,i,o){if(s.startAt!==null)throw new G(L.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new G(L.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Ii(i,o)}(e._query,this._field,this._direction);return new Ht(e.firestore,e.converter,Jy(e._query,t))}}function xP(n,e="asc"){const t=e,r=Xn("orderBy",n);return Vu._create(r,t)}class xu extends Ka{constructor(e,t,r){super(),this.type=e,this._limit=t,this._limitType=r}static _create(e,t,r){return new xu(e,t,r)}_apply(e){return new Ht(e.firestore,e.converter,ra(e._query,this._limit,this._limitType))}}function MP(n){return fy("limit",n),xu._create("limit",n,"F")}class Mu extends Ka{constructor(e,t,r){super(),this.type=e,this._docOrFields=t,this._inclusive=r}static _create(e,t,r){return new Mu(e,t,r)}_apply(e){const t=YR(e,this.type,this._docOrFields,this._inclusive);return new Ht(e.firestore,e.converter,jy(e._query,t))}}function GP(...n){return Mu._create("startAfter",n,!1)}function YR(n,e,t,r){if(t[0]=fe(t[0]),t[0]instanceof Nu)return function(i,o,B,c,u){if(!c)throw new G(L.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${B}().`);const h=[];for(const d of ss(i))if(d.field.isKeyField())h.push(Xo(o,c.key));else{const p=c.data.field(d.field);if(Mi(p))throw new G(L.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+d.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(p===null){const _=d.field.canonicalString();throw new G(L.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${_}' (used as the orderBy) does not exist.`)}h.push(p)}return new fs(h,u)}(n._query,n.firestore._databaseId,e,t[0]._document,r);{const s=Is(n.firestore);return function(o,B,c,u,h,d){const p=o.explicitOrderBy;if(h.length>p.length)throw new G(L.INVALID_ARGUMENT,`Too many arguments provided to ${u}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const _=[];for(let y=0;y<h.length;y++){const O=h[y];if(p[y].field.isKeyField()){if(typeof O!="string")throw new G(L.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${u}(), but got a ${typeof O}`);if(!Wc(o)&&O.indexOf("/")!==-1)throw new G(L.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${u}() must be a plain document ID, but '${O}' contains a slash.`);const V=o.path.child(Ce.fromString(O));if(!Q.isDocumentKey(V))throw new G(L.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${u}() must result in a valid document path, but '${V}
3363' is not because it contains an odd number of segments.`);const j=new Q(V);_.push(Xo(B,j))}else{const V=Tp(c,u,O);_.push(V)}}return new fs(_,d)}(n._query,n.firestore._databaseId,s,e,t,r)}}function Wf(n,e,t){if(typeof(t=fe(t))=="string"){if(t==="")throw new G(L.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Wc(e)&&t.indexOf("/")!==-1)throw new G(L.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${t}' contains a '/' character.`);const r=e.path.child(Ce.fromString(t));if(!Q.isDocumentKey(r))throw new G(L.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Xo(n,new Q(r))}if(t instanceof Re)return Xo(n,t._key);throw new G(L.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ia(t)}.`)}function $f(n,e){if(!Array.isArray(n)||n.length===0)throw new G(L.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function gg(n,e){const t=function(s,i){for(const o of s)for(const B of o.getFlattenedFilters())if(i.indexOf(B.op)>=0)return B.op;return null}(n.filters,function(s){switch(s){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(t!==null)throw t===e.op?new G(L.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new G(L.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}/**
3364 * @license
3365 * Copyright 2017 Google LLC
3366 *
3367 * Licensed under the Apache License, Version 2.0 (the "License");
3368 * you may not use this file except in compliance with the License.
3369 * You may obtain a copy of the License at
3370 *
3371 *   http://www.apache.org/licenses/LICENSE-2.0
3372 *
3373 * Unless required by applicable law or agreed to in writing, software
3374 * distributed under the License is distributed on an "AS IS" BASIS,
3375 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3376 * See the License for the specific language governing permissions and
3377 * limitations under the License.
3378 */function Qf(n){return function(t,r){if(typeof t!="object"||t===null)return!1;const s=t;for(const i of r)if(i in s&&typeof s[i]=="function")return!0;return!1}(n,["next","error","complete"])}/**
3379 * @license
3380 * Copyright 2020 Google LLC
3381 *
3382 * Licensed under the Apache License, Version 2.0 (the "License");
3383 * you may not use this file except in compliance with the License.
3384 * You may obtain a copy of the License at
3385 *
3386 *   http://www.apache.org/licenses/LICENSE-2.0
3387 *
3388 * Unless required by applicable law or agreed to in writing, software
3389 * distributed under the License is distributed on an "AS IS" BASIS,
3390 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3391 * See the License for the specific language governing permissions and
3392 * limitations under the License.
3393 */class XR{constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=Is(e)}set(e,t,r){this._verifyNotCommitted();const s=UB(e,this._firestore),i=Fu(s.converter,t,r),o=Zc(this._dataReader,"WriteBatch.set",s._key,i,s.converter!==null,r);return this._mutations.push(o.toMutation(s._key,Bt.none())),this}update(e,t,r,...s){this._verifyNotCommitted();const i=UB(e,this._firestore);let o;return o=typeof(t=fe(t))=="string"||t instanceof Ji?Ip(this._dataReader,"WriteBatch.update",i._key,t,r,s):yp(this._dataReader,"WriteBatch.update",i._key,t),this._mutations.push(o.toMutation(i._key,Bt.exists(!0))),this}delete(e){this._verifyNotCommitted();const t=UB(e,this._firestore);return this._mutations=this._mutations.concat(new ba(t._key,Bt.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new G(L.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function UB(n,e){if((n=fe(n)).firestore!==e)throw new G(L.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return n}/**
3394 * @license
3395 * Copyright 2020 Google LLC
3396 *
3397 * Licensed under the Apache License, Version 2.0 (the "License");
3398 * you may not use this file except in compliance with the License.
3399 * You may obtain a copy of the License at
3400 *
3401 *   http://www.apache.org/licenses/LICENSE-2.0
3402 *
3403 * Unless required by applicable law or agreed to in writing, software
3404 * distributed under the License is distributed on an "AS IS" BASIS,
3405 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3406 * See the License for the specific language governing permissions and
3407 * limitations under the License.
3408 */function UP(n){n=He(n,Re);const e=He(n.firestore,Lt),t=Hr(e);return dg(t,n._key).then(r=>Gu(e,n,r))}function HP(n){n=He(n,Re);const e=He(n.firestore,Lt),t=Hr(e);return dg(t,n._key,{source:"server"}).then(r=>Gu(e,n,r))}function qP(n){n=He(n,Ht);const e=He(n.firestore,Lt),t=Hr(e),r=new ja(e);return pg(n._query),Cg(t,n._query).then(s=>new Kn(e,r,n,s))}function JP(n){n=He(n,Ht);const e=He(n.firestore,Lt),t=Hr(e),r=new ja(e);return Cg(t,n._query,{source:"server"}).then(s=>new Kn(e,r,n,s))}function jP(n,e,t){n=He(n,Re);const r=He(n.firestore,Lt),s=Fu(n.converter,e,t),i=Is(r);return $i(r,[Zc(i,"setDoc",n._key,s,n.converter!==null,t).toMutation(n._key,Bt.none())])}function KP(n,e,t,...r){n=He(n,Re);const s=He(n.firestore,Lt),i=Is(s);let o;return o=typeof(e=fe(e))=="string"||e instanceof Ji?Ip(i,"updateDoc",n._key,e,t,r):yp(i,"updateDoc",n._key,e),$i(s,[o.toMutation(n._key,Bt.exists(!0))])}function zP(n){return $i(He(n.firestore,Lt),[new ba(n._key,Bt.none())])}function WP(n,e){const t=He(n.firestore,Lt),r=$I(n),s=Fu(n.converter,e),i=Is(n.firestore);return $i(t,[Zc(i,"addDoc",r._key,s,n.converter!==null,{}).toMutation(r._key,Bt.exists(!1))]).then(()=>r)}function $P(n,...e){var u,h,d;n=fe(n);let t={includeMetadataChanges:!1,source:"default"},r=0;typeof e[r]!="object"||Qf(e[r])||(t=e[r++]);const s={includeMetadataChanges:t.includeMetadataChanges,source:t.source};if(Qf(e[r])){const p=e[r];e[r]=(u=p.next)==null?void 0:u.bind(p),e[r+1]=(h=p.error)==null?void 0:h.bind(p),e[r+2]=(d=p.complete)==null?void 0:d.bind(p)}let i,o,B;if(n instanceof Re)o=He(n.firestore,Lt),B=Sa(n._key.path),i={next:p=>{e[r]&&e[r](Gu(o,n,p))},error:e[r+1],complete:e[r+2]};else{const p=He(n,Ht);o=He(p.firestore,Lt),B=p._query;const _=new ja(o);i={next:y=>{e[r]&&e[r](new Kn(o,_,p,y))},error:e[r+1],complete:e[r+2]},pg(n._query)}const c=Hr(o);return jR(c,B,s,i)}function $i(n,e){const t=Hr(n);return KR(t,e)}function Gu(n,e,t){const r=t.docs.get(e._key),s=new ja(n);return new Ir(n,s,e._key,r,new ni(t.hasPendingWrites,t.fromCache),e.converter)}function QP(n){return n=He(n,Lt),Hr(n),new XR(n,e=>$i(n,e))}const Yf="@firebase/firestore",Xf="4.17.2";(function(e,t=!0){oy(Vr),Ot(new Rt("firestore",(r,{instanceIdentifier:s,options:i})=>{const o=r.getProvider("app").getImmediate(),B=new Lt(new II(r.getProvider("auth-internal")),new RI(o,r.getProvider("app-check-internal")),py(o,s),o);return i={useFetchStreams:t,...i},B._setSettings(i),B},"PUBLIC").setMultipleInstances(!0)),Ze(Yf,Xf,e),Ze(Yf,Xf,"esm2020")})();/**
3409 * @license
3410 * Copyright 2017 Google LLC
3411 *
3412 * Licensed under the Apache License, Version 2.0 (the "License");
3413 * you may not use this file except in compliance with the License.
3414 * You may obtain a copy of the License at
3415 *
3416 *   http://www.apache.org/licenses/LICENSE-2.0
3417 *
3418 * Unless required by applicable law or agreed to in writing, software
3419 * distributed under the License is distributed on an "AS IS" BASIS,
3420 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3421 * See the License for the specific language governing permissions and
3422 * limitations under the License.
3423 */const mg="firebasestorage.googleapis.com",Eg="storageBucket",ZR=2*60*1e3,ev=10*60*1e3,tv=1e3;/**
3424 * @license
3425 * Copyright 2017 Google LLC
3426 *
3427 * Licensed under the Apache License, Version 2.0 (the "License");
3428 * you may not use this file except in compliance with the License.
3429 * You may obtain a copy of the License at
3430 *
3431 *   http://www.apache.org/licenses/LICENSE-2.0
3432 *
3433 * Unless required by applicable law or agreed to in writing, software
3434 * distributed under the License is distributed on an "AS IS" BASIS,
3435 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3436 * See the License for the specific language governing permissions and
3437 * limitations under the License.
3438 */class Oe extends kt{constructor(e,t,r=0){super(HB(e),`Firebase Storage: ${t} (${HB(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,Oe.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return HB(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
3439${this.customData.serverResponse}`:this.message=this._baseMessage}}var be;(function(n){n.UNKNOWN="unknown",n.OBJECT_NOT_FOUND="object-not-found",n.BUCKET_NOT_FOUND="bucket-not-found",n.PROJECT_NOT_FOUND="project-not-found",n.QUOTA_EXCEEDED="quota-exceeded",n.UNAUTHENTICATED="unauthenticated",n.UNAUTHORIZED="unauthorized",n.UNAUTHORIZED_APP="unauthorized-app",n.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",n.INVALID_CHECKSUM="invalid-checksum",n.CANCELED="canceled",n.INVALID_EVENT_NAME="invalid-event-name",n.INVALID_URL="invalid-url",n.INVALID_DEFAULT_BUCKET="invalid-default-bucket",n.NO_DEFAULT_BUCKET="no-default-bucket",n.CANNOT_SLICE_BLOB="cannot-slice-blob",n.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",n.NO_DOWNLOAD_URL="no-download-url",n.INVALID_ARGUMENT="invalid-argument",n.INVALID_ARGUMENT_COUNT="invalid-argument-count",n.APP_DELETED="app-deleted",n.INVALID_ROOT_OPERATION="invalid-root-operation",n.INVALID_FORMAT="invalid-format",n.INTERNAL_ERROR="internal-error",n.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(be||(be={}));function HB(n){return"storage/"+n}function Uu(){const n="An unknown error occurred, please check the error payload for server response.";return new Oe(be.UNKNOWN,n)}function nv(n){return new Oe(be.OBJECT_NOT_FOUND,"Object '"+n+"' does not exist.")}function rv(n){return new Oe(be.QUOTA_EXCEEDED,"Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function sv(){const n="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new Oe(be.UNAUTHENTICATED,n)}function iv(){return new Oe(be.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function ov(n){return new Oe(be.UNAUTHORIZED,"User does not have permission to access '"+n+"'.")}function _g(){return new Oe(be.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function Dg(){return new Oe(be.CANCELED,"User canceled the upload/download.")}function av(n){return new Oe(be.INVALID_URL,"Invalid URL '"+n+"'.")}function Bv(n){return new Oe(be.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")}function cv(){return new Oe(be.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+Eg+"' property when initializing the app?")}function wg(){return new Oe(be.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function uv(){return new Oe(be.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function lv(n){return new Oe(be.UNSUPPORTED_ENVIRONMENT,`${n} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function yc(n){return new Oe(be.INVALID_ARGUMENT,n)}function yg(){return new Oe(be.APP_DELETED,"The Firebase app was deleted.")}function hv(n){return new Oe(be.INVALID_ROOT_OPERATION,"The operation '"+n+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function hi(n,e){return new Oe(be.INVALID_FORMAT,"String does not match format '"+n+"': "+e)}function Qs(n){throw new Oe(be.INTERNAL_ERROR,"Internal error: "+n)}/**
3440 * @license
3441 * Copyright 2017 Google LLC
3442 *
3443 * Licensed under the Apache License, Version 2.0 (the "License");
3444 * you may not use this file except in compliance with the License.
3445 * You may obtain a copy of the License at
3446 *
3447 *   http://www.apache.org/licenses/LICENSE-2.0
3448 *
3449 * Unless required by applicable law or agreed to in writing, software
3450 * distributed under the License is distributed on an "AS IS" BASIS,
3451 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3452 * See the License for the specific language governing permissions and
3453 * limitations under the License.
3454 */class Tt{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let r;try{r=Tt.makeFromUrl(e,t)}catch{return new Tt(e,"")}if(r.path==="")return r;throw Bv(e)}static makeFromUrl(e,t){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(Be){Be.path.charAt(Be.path.length-1)==="/"&&(Be.path_=Be.path_.slice(0,-1))}const o="(/(.*))?$",B=new RegExp("^gs://"+s+o,"i"),c={bucket:1,path:3};function u(Be){Be.path_=decodeURIComponent(Be.path)}const h="v[A-Za-z0-9_]+",d=t.replace(/[.]/g,"\\."),p="(/([^?#]*).*)?$",_=new RegExp(`^https?://${d}/${h}/b/${s}/o${p}`,"i"),y={bucket:1,path:3},O=t===mg?"(?:storage.googleapis.com|storage.cloud.google.com)":t,V="([^?#]*)",j=new RegExp(`^https?://${O}/${s}/${V}`,"i"),se=[{regex:B,indices:c,postModify:i},{regex:_,indices:y,postModify:u},{regex:j,indices:{bucket:1,path:2},postModify:u}];for(let Be=0;Be<se.length;Be++){const ye=se[Be],pe=ye.regex.exec(e);if(pe){const R=pe[ye.indices.bucket];let E=pe[ye.indices.path];E||(E=""),r=new Tt(R,E),ye.postModify(r);break}}if(r==null)throw av(e);return r}}class fv{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
3455 * @license
3456 * Copyright 2017 Google LLC
3457 *
3458 * Licensed under the Apache License, Version 2.0 (the "License");
3459 * you may not use this file except in compliance with the License.
3460 * You may obtain a copy of the License at
3461 *
3462 *   http://www.apache.org/licenses/LICENSE-2.0
3463 *
3464 * Unless required by applicable law or agreed to in writing, software
3465 * distributed under the License is distributed on an "AS IS" BASIS,
3466 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3467 * See the License for the specific language governing permissions and
3468 * limitations under the License.
3469 */function dv(n,e,t){let r=1,s=null,i=null,o=!1,B=0;function c(){return B===2}let u=!1;function h(...V){u||(u=!0,e.apply(null,V))}function d(V){s=setTimeout(()=>{s=null,n(_,c())},V)}function p(){i&&clearTimeout(i)}function _(V,...j){if(u){p();return}if(V){p(),h.call(null,V,...j);return}if(c()||o){p(),h.call(null,V,...j);return}r<64&&(r*=2);let se;B===1?(B=2,se=0):se=(r+Math.random())*1e3,d(se)}let y=!1;function O(V){y||(y=!0,p(),!u&&(s!==null?(V||(B=2),clearTimeout(s),d(0)):V||(B=1)))}return d(0),i=setTimeout(()=>{o=!0,O(!0)},t),O}function Cv(n){n(!1)}/**
3470 * @license
3471 * Copyright 2017 Google LLC
3472 *
3473 * Licensed under the Apache License, Version 2.0 (the "License");
3474 * you may not use this file except in compliance with the License.
3475 * You may obtain a copy of the License at
3476 *
3477 *   http://www.apache.org/licenses/LICENSE-2.0
3478 *
3479 * Unless required by applicable law or agreed to in writing, software
3480 * distributed under the License is distributed on an "AS IS" BASIS,
3481 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3482 * See the License for the specific language governing permissions and
3483 * limitations under the License.
3484 */function pv(n){return n!==void 0}function gv(n){return typeof n=="function"}function mv(n){return typeof n=="object"&&!Array.isArray(n)}function Hu(n){return typeof n=="string"||n instanceof String}function Zf(n){return qu()&&n instanceof Blob}function qu(){return typeof Blob<"u"}function ed(n,e,t,r){if(r<e)throw yc(`Invalid value for '${n}'. Expected ${e} or greater.`);if(r>t)throw yc(`Invalid value for '${n}'. Expected ${t} or less.`)}/**
3485 * @license
3486 * Copyright 2017 Google LLC
3487 *
3488 * Licensed under the Apache License, Version 2.0 (the "License");
3489 * you may not use this file except in compliance with the License.
3490 * You may obtain a copy of the License at
3491 *
3492 *   http://www.apache.org/licenses/LICENSE-2.0
3493 *
3494 * Unless required by applicable law or agreed to in writing, software
3495 * distributed under the License is distributed on an "AS IS" BASIS,
3496 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3497 * See the License for the specific language governing permissions and
3498 * limitations under the License.
3499 */function Wa(n,e,t){let r=e;return t==null&&(r=`https://${e}`),`${t}://${r}/v0${n}`}function Ev(n){const e=encodeURIComponent;let t="?";for(const r in n)if(n.hasOwnProperty(r)){const s=e(r)+"="+e(n[r]);t=t+s+"&"}return t=t.slice(0,-1),t}var Tr;(function(n){n[n.NO_ERROR=0]="NO_ERROR",n[n.NETWORK_ERROR=1]="NETWORK_ERROR",n[n.ABORT=2]="ABORT"})(Tr||(Tr={}));/**
3500 * @license
3501 * Copyright 2022 Google LLC
3502 *
3503 * Licensed under the Apache License, Version 2.0 (the "License");
3504 * you may not use this file except in compliance with the License.
3505 * You may obtain a copy of the License at
3506 *
3507 *   http://www.apache.org/licenses/LICENSE-2.0
3508 *
3509 * Unless required by applicable law or agreed to in writing, software
3510 * distributed under the License is distributed on an "AS IS" BASIS,
3511 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3512 * See the License for the specific language governing permissions and
3513 * limitations under the License.
3514 */function Ig(n,e){const t=n>=500&&n<600,s=[408,429].indexOf(n)!==-1,i=e.indexOf(n)!==-1;return t||s||i}/**
3515 * @license
3516 * Copyright 2017 Google LLC
3517 *
3518 * Licensed under the Apache License, Version 2.0 (the "License");
3519 * you may not use this file except in compliance with the License.
3520 * You may obtain a copy of the License at
3521 *
3522 *   http://www.apache.org/licenses/LICENSE-2.0
3523 *
3524 * Unless required by applicable law or agreed to in writing, software
3525 * distributed under the License is distributed on an "AS IS" BASIS,
3526 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3527 * See the License for the specific language governing permissions and
3528 * limitations under the License.
3529 */class _v{constructor(e,t,r,s,i,o,B,c,u,h,d,p=!0,_=!1){this.url_=e,this.method_=t,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=o,this.callback_=B,this.errorCallback_=c,this.timeout_=u,this.progressCallback_=h,this.connectionFactory_=d,this.retry=p,this.isUsingEmulator=_,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((y,O)=>{this.resolve_=y,this.reject_=O,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new To(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const o=B=>{const c=B.loaded,u=B.lengthComputable?B.total:-1;this.progressCallback_!==null&&this.progressCallback_(c,u)};this.progressCallback_!==null&&i.addUploadProgressListener(o),i.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(o),this.pendingConnection_=null;const B=i.getErrorCode()===Tr.NO_ERROR,c=i.getStatus();if(!B||Ig(c,this.additionalRetryCodes_)&&this.retry){const h=i.getErrorCode()===Tr.ABORT;r(!1,new To(!1,null,h));return}const u=this.successCodes_.indexOf(c)!==-1;r(!0,new To(u,i))})},t=(r,s)=>{const i=this.resolve_,o=this.reject_,B=s.connection;if(s.wasSuccessCode)try{const c=this.callback_(B,B.getResponse());pv(c)?i(c):i()}catch(c){o(c)}else if(B!==null){const c=Uu();c.serverResponse=B.getErrorText(),this.errorCallback_?o(this.errorCallback_(B,c)):o(c)}else if(s.canceled){const c=this.appDelete_?yg():Dg();o(c)}else{const c=_g();o(c)}};this.canceled_?t(!1,new To(!1,null,!0)):this.backoffId_=dv(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&Cv(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class To{constructor(e,t,r){this.wasSuccessCode=e,this.connection=t,this.canceled=!!r}}function Dv(n,e){e!==null&&e.length>0&&(n.Authorization="Firebase "+e)}function wv(n,e){n["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function yv(n,e){e&&(n["X-Firebase-GMPID"]=e)}function Iv(n,e){e!==null&&(n["X-Firebase-AppCheck"]=e)}
vendor: 4,744 bytes, lines 3529-3578
3529function Tv(n,e,t,r,s,i,o=!0,B=!1){const c=Ev(n.urlParams),u=n.url+c,h=Object.assign({},n.headers);return yv(h,e),Dv(h,t),wv(h,i),Iv(h,r),new _v(u,n.method,h,n.body,n.successCodes,n.additionalRetryCodes,n.handler,n.errorHandler,n.timeout,n.progressCallback,s,o,B)}/**
3530 * @license
3531 * Copyright 2017 Google LLC
3532 *
3533 * Licensed under the Apache License, Version 2.0 (the "License");
3534 * you may not use this file except in compliance with the License.
3535 * You may obtain a copy of the License at
3536 *
3537 *   http://www.apache.org/licenses/LICENSE-2.0
3538 *
3539 * Unless required by applicable law or agreed to in writing, software
3540 * distributed under the License is distributed on an "AS IS" BASIS,
3541 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3542 * See the License for the specific language governing permissions and
3543 * limitations under the License.
3544 */function Av(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function Rv(...n){const e=Av();if(e!==void 0){const t=new e;for(let r=0;r<n.length;r++)t.append(n[r]);return t.getBlob()}else{if(qu())return new Blob(n);throw new Oe(be.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function vv(n,e,t){return n.webkitSlice?n.webkitSlice(e,t):n.mozSlice?n.mozSlice(e,t):n.slice?n.slice(e,t):null}/**
3545 * @license
3546 * Copyright 2021 Google LLC
3547 *
3548 * Licensed under the Apache License, Version 2.0 (the "License");
3549 * you may not use this file except in compliance with the License.
3550 * You may obtain a copy of the License at
3551 *
3552 *   http://www.apache.org/licenses/LICENSE-2.0
3553 *
3554 * Unless required by applicable law or agreed to in writing, software
3555 * distributed under the License is distributed on an "AS IS" BASIS,
3556 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3557 * See the License for the specific language governing permissions and
3558 * limitations under the License.
3559 */function bv(n){if(typeof atob>"u")throw lv("base-64");return atob(n)}/**
3560 * @license
3561 * Copyright 2017 Google LLC
3562 *
3563 * Licensed under the Apache License, Version 2.0 (the "License");
3564 * you may not use this file except in compliance with the License.
3565 * You may obtain a copy of the License at
3566 *
3567 *   http://www.apache.org/licenses/LICENSE-2.0
3568 *
3569 * Unless required by applicable law or agreed to in writing, software
3570 * distributed under the License is distributed on an "AS IS" BASIS,
3571 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3572 * See the License for the specific language governing permissions and
3573 * limitations under the License.
3574 */const Mt={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class qB{constructor(e,t){this.data=e,this.contentType=t||null}}function Tg(n,e){switch(n){case Mt.RAW:return new qB(Ag(e));case Mt.BASE64:case Mt.BASE64URL:return new qB(Rg(n,e));case Mt.DATA_URL:return new qB(Pv(e),Ov(e))}throw Uu()}function Ag(n){const e=[];for(let t=0;t<n.length;t++){let r=n.charCodeAt(t);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|r&63);else if((r&64512)===55296)if(!(t<n.length-1&&(n.charCodeAt(t+1)&64512)===56320))e.push(239,191,189);else{const i=r,o=n.charCodeAt(++t);r=65536|(i&1023)<<10|o&1023,e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}else(r&64512)===56320?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(e)}function Sv(n){let e;try{e=decodeURIComponent(n)}catch{throw hi(Mt.DATA_URL,"Malformed data URL.")}return Ag(e)}function Rg(n,e){switch(n){case Mt.BASE64:{const s=e.indexOf("-")!==-1,i=e.indexOf("_")!==-1;if(s||i)throw hi(n,"Invalid character '"+(s?"-":"_")+"' found: is it base64url encoded?");break}case Mt.BASE64URL:{const s=e.indexOf("+")!==-1,i=e.indexOf("/")!==-1;if(s||i)throw hi(n,"Invalid character '"+(s?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let t;try{t=bv(e)}catch(s){throw s.message.includes("polyfill")?s:hi(n,"Invalid character found")}const r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}class vg{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(t===null)throw hi(Mt.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=t[1]||null;r!=null&&(this.base64=Nv(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function Pv(n){const e=new vg(n);return e.base64?Rg(Mt.BASE64,e.rest):Sv(e.rest)}function Ov(n){return new vg(n).contentType}function Nv(n,e){return n.length>=e.length?n.substring(n.length-e.length)===e:!1}/**
3575 * @license
3576 * Copyright 2017 Google LLC
3577 *
3578 * Licensed under the Apache License, Version 2.0 (the "License");
3579 * you may not use this file except in compliance with the License.
3580 * You may obtain a copy of the License at
3581 *
3582 *   http://www.apache.org/licenses/LICENSE-2.0
3583 *
3584 * Unless required by applicable law or agreed to in writing, software
3585 * distributed under the License is distributed on an "AS IS" BASIS,
3586 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3587 * See the License for the specific language governing permissions and
3588 * limitations under the License.
3589 */class rn{constructor(e,t){let r=0,s="";Zf(e)?(this.data_=e,r=e.size,s=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),r=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),r=e.length),this.size_=r,this.type_=s}size(){return this.size_}type(){return this.type_}slice(e,t){if(Zf(this.data_)){const r=this.data_,s=vv(r,e,t);return s===null?null:new rn(s)}else{const r=new Uint8Array(this.data_.buffer,e,t-e);return new rn(r,!0)}}static getBlob(...e){if(qu()){const t=e.map(r=>r instanceof rn?r.data_:r);return new rn(Rv.apply(null,t))}else{const t=e.map(o=>Hu(o)?Tg(Mt.RAW,o).data:o.data_);let r=0;t.forEach(o=>{r+=o.byteLength});const s=new Uint8Array(r);let i=0;return t.forEach(o=>{for(let B=0;B<o.length;B++)s[i++]=o[B]}),new rn(s,!0)}}uploadData(){return this.data_}}/**
3590 * @license
3591 * Copyright 2017 Google LLC
3592 *
3593 * Licensed under the Apache License, Version 2.0 (the "License");
3594 * you may not use this file except in compliance with the License.
3595 * You may obtain a copy of the License at
3596 *
3597 *   http://www.apache.org/licenses/LICENSE-2.0
3598 *
3599 * Unless required by applicable law or agreed to in writing, software
3600 * distributed under the License is distributed on an "AS IS" BASIS,
3601 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3602 * See the License for the specific language governing permissions and
3603 * limitations under the License.
3604 */function Fv(n){let e;try{e=JSON.parse(n)}catch{return null}return mv(e)?e:null}/**
3605 * @license
3606 * Copyright 2017 Google LLC
3607 *
3608 * Licensed under the Apache License, Version 2.0 (the "License");
3609 * you may not use this file except in compliance with the License.
3610 * You may obtain a copy of the License at
3611 *
3612 *   http://www.apache.org/licenses/LICENSE-2.0
3613 *
3614 * Unless required by applicable law or agreed to in writing, software
3615 * distributed under the License is distributed on an "AS IS" BASIS,
3616 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3617 * See the License for the specific language governing permissions and
3618 * limitations under the License.
3619 */function Lv(n){if(n.length===0)return null;const e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function kv(n,e){const t=e.split("/").filter(r=>r.length>0).join("/");return n.length===0?t:n+"/"+t}function bg(n){const e=n.lastIndexOf("/",n.length-2);return e===-1?n:n.slice(e+1)}/**
3620 * @license
3621 * Copyright 2017 Google LLC
3622 *
3623 * Licensed under the Apache License, Version 2.0 (the "License");
3624 * you may not use this file except in compliance with the License.
3625 * You may obtain a copy of the License at
3626 *
3627 *   http://www.apache.org/licenses/LICENSE-2.0
3628 *
3629 * Unless required by applicable law or agreed to in writing, software
3630 * distributed under the License is distributed on an "AS IS" BASIS,
3631 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3632 * See the License for the specific language governing permissions and
3633 * limitations under the License.
3634 */function Vv(n,e){return e}class st{constructor(e,t,r,s){this.server=e,this.local=t||e,this.writable=!!r,this.xform=s||Vv}}let Ao=null;function xv(n){return!Hu(n)||n.length<2?n:bg(n)}function Ju(){if(Ao)return Ao;const n=[];n.push(new st("bucket")),n.push(new st("generation")),n.push(new st("metageneration")),n.push(new st("name","fullPath",!0));function e(i,o){return xv(o)}const t=new st("name");t.xform=e,n.push(t);function r(i,o){return o!==void 0?Number(o):o}const s=new st("size");return s.xform=r,n.push(s),n.push(new st("timeCreated")),n.push(new st("updated")),n.push(new st("md5Hash",null,!0)),n.push(new st("cacheControl",null,!0)),n.push(new st("contentDisposition",null,!0)),n.push(new st("contentEncoding",null,!0)),n.push(new st("contentLanguage",null,!0)),n.push(new st("contentType",null,!0)),n.push(new st("metadata","customMetadata",!0)),Ao=n,Ao}function Mv(n,e){function t(){const r=n.bucket,s=n.fullPath,i=new Tt(r,s);return e._makeStorageReference(i)}Object.defineProperty(n,"ref",{get:t})}function Gv(n,e,t){const r={};r.type="file";const s=t.length;for(let i=0;i<s;i++){const o=t[i];r[o.local]=o.xform(r,e[o.server])}return Mv(r,n),r}function Uv(n,e,t){const r=Fv(e);return r===null?null:Gv(n,r,t)}function Sg(n,e){const t={},r=e.length;for(let s=0;s<r;s++){const i=e[s];i.writable&&(t[i.server]=n[i.local])}return JSON.stringify(t)}class Ss{constructor(e,t,r,s){this.url=e,this.method=t,this.handler=r,this.timeout=s,this.urlParam
3634s={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}/**
3635 * @license
3636 * Copyright 2017 Google LLC
3637 *
3638 * Licensed under the Apache License, Version 2.0 (the "License");
3639 * you may not use this file except in compliance with the License.
3640 * You may obtain a copy of the License at
3641 *
3642 *   http://www.apache.org/licenses/LICENSE-2.0
3643 *
3644 * Unless required by applicable law or agreed to in writing, software
3645 * distributed under the License is distributed on an "AS IS" BASIS,
3646 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3647 * See the License for the specific language governing permissions and
3648 * limitations under the License.
3649 */function zn(n){if(!n)throw Uu()}function ju(n,e){function t(r,s){const i=Uv(n,s,e);return zn(i!==null),i}return t}function Qi(n){function e(t,r){let s;return t.getStatus()===401?t.getErrorText().includes("Firebase App Check token is invalid")?s=iv():s=sv():t.getStatus()===402?s=rv(n.bucket):t.getStatus()===403?s=ov(n.path):s=r,s.status=t.getStatus(),s.serverResponse=r.serverResponse,s}return e}function Pg(n){const e=Qi(n);function t(r,s){let i=e(r,s);return r.getStatus()===404&&(i=nv(n.path)),i.serverResponse=s.serverResponse,i}return t}function Og(n,e,t){const r=e.fullServerUrl(),s=Wa(r,n.host,n._protocol),i="GET",o=n.maxOperationRetryTime,B=new Ss(s,i,ju(n,t),o);return B.errorHandler=Pg(e),B}function Hv(n,e,t){const r=e.fullServerUrl(),s=Wa(r,n.host,n._protocol)+"?alt=media",i="GET",o=n.maxOperationRetryTime,B=new Ss(s,i,(c,u)=>u,o);return B.errorHandler=Pg(e),B}function qv(n,e){return n&&n.contentType||e&&e.type()||"application/octet-stream"}function Ng(n,e,t){const r=Object.assign({},t);return r.fullPath=n.path,r.size=e.size(),r.contentType||(r.contentType=qv(null,e)),r}function Fg(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"};function B(){let se="";for(let Be=0;Be<2;Be++)se=se+Math.random().toString().slice(2);return se}const c=B();o["Content-Type"]="multipart/related; boundary="+c;const u=Ng(e,r,s),h=Sg(u,t),d="--"+c+`\r
3650Content-Type: application/json; charset=utf-8\r
3651\r
3652`+h+`\r
3653--`+c+`\r
3654Content-Type: `+u.contentType+`\r
3655\r
3656`,p=`\r
3657--`+c+"--",_=rn.getBlob(d,r,p);if(_===null)throw wg();const y={name:u.fullPath},O=Wa(i,n.host,n._protocol),V="POST",j=n.maxUploadRetryTime,ee=new Ss(O,V,ju(n,t),j);return ee.urlParams=y,ee.headers=o,ee.body=_.uploadData(),ee.errorHandler=Qi(e),ee}class la{constructor(e,t,r,s){this.current=e,this.total=t,this.finalized=!!r,this.metadata=s||null}}function Ku(n,e){let t=null;try{t=n.getResponseHeader("X-Goog-Upload-Status")}catch{zn(!1)}return zn(!!t&&(e||["active"]).indexOf(t)!==-1),t}function Jv(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),o=Ng(e,r,s),B={name:o.fullPath}
3657,c=Wa(i,n.host,n._protocol),u="POST",h={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${r.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},d=Sg(o,t),p=n.maxUploadRetryTime;function _(O){Ku(O);let V;try{V=O.getResponseHeader("X-Goog-Upload-URL")}catch{zn(!1)}return zn(Hu(V)),V}const y=new Ss(c,u,_,p);return y.urlParams=B,y.headers=h,y.body=d,y.errorHandler=Qi(e),y}function jv(n,e,t,r){const s={"X-Goog-Upload-Command":"query"};function i(u){const h=Ku(u,["active","final"]);let d=null;try{d=u.getResponseHeader("X-Goog-Upload-Size-Received")}catch{zn(!1)}d||zn(!1);const p=Number(d);return zn(!isNaN(p)),new la(p,r.size(),h==="final")}const o="POST",B=n.maxUploadRetryTime,c=new Ss(t,o,i,B);return c.headers=s,c.errorHandler=Qi(e),c}const td=256*1024;function Kv(n,e,t,r,s,i,o,B){const c=new la(0,0);if(o?(c.current=o.current,c.total=o.total):(c.current=0,c.total=r.size()),r.size()!==c.total)throw uv();const u=c.total-c.current;let h=u;s>0&&(h=Math.min(h,s));const d=c.current,p=d+h;let _="";h===0?_="finalize":u===h?_="upload, finalize":_="upload";const y={"X-Goog-Upload-Command":_,"X-Goog-Upload-Offset":`${c.current}`},O=r.slice(d,p);if(O===null)throw wg();function V(Be,ye){const pe=Ku(Be,["active","final"]),R=c.current+h,E=r.size();let w;return pe==="final"?w=ju(e,i)(Be,ye):w=null,new la(R,E,pe==="final",w)}const j="POST",ee=e.maxUploadRetryTime,se=new Ss(t,j,V,ee);return se.headers=y,se.body=O.uploadData(),se.progressCallback=B||null,se.errorHandler=Qi(n),se}const ft={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function JB(n){switch(n){case"running":case"pausing":case"canceling":return ft.RUNNING;case"paused":return ft.PAUSED;case"success":return ft.SUCCESS;case"canceled":return ft.CANCELED;case"error":return ft.ERROR;default:return ft.ERROR}}/**
3658 * @license
3659 * Copyright 2017 Google LLC
3660 *
3661 * Licensed under the Apache License, Version 2.0 (the "License");
3662 * you may not use this file except in compliance with the License.
3663 * You may obtain a copy of the License at
3664 *
3665 *   http://www.apache.org/licenses/LICENSE-2.0
3666 *
3667 * Unless required by applicable law or agreed to in writing, software
3668 * distributed under the License is distributed on an "AS IS" BASIS,
3669 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3670 * See the License for the specific language governing permissions and
3671 * limitations under the License.
3672 */class zv{constructor(e,t,r){if(gv(e)||t!=null||r!=null)this.next=e,this.error=t??void 0,this.complete=r??void 0;else{const i=e;this.next=i.next,this.error=i.error,this.complete=i.complete}}}/**
3673 * @license
3674 * Copyright 2017 Google LLC
3675 *
3676 * Licensed under the Apache License, Version 2.0 (the "License");
3677 * you may not use this file except in compliance with the License.
3678 * You may obtain a copy of the License at
3679 *
3680 *   http://www.apache.org/licenses/LICENSE-2.0
3681 *
3682 * Unless required by applicable law or agreed to in writing, software
3683 * distributed under the License is distributed on an "AS IS" BASIS,
3684 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3685 * See the License for the specific language governing permissions and
3686 * limitations under the License.
3687 */function zr(n){return(...e)=>{Promise.resolve().then(()=>n(...e))}}/**
3688 * @license
3689 * Copyright 2017 Google LLC
3690 *
3691 * Licensed under the Apache License, Version 2.0 (the "License");
3692 * you may not use this file except in compliance with the License.
3693 * You may obtain a copy of the License at
3694 *
3695 *   http://www.apache.org/licenses/LICENSE-2.0
3696 *
3697 * Unless required by applicable law or agreed to in writing, software
3698 * distributed under the License is distributed on an "AS IS" BASIS,
3699 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3700 * See the License for the specific language governing permissions and
3701 * limitations under the License.
3702 */class Lg{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=Tr.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=Tr.ABORT,e()}),this.xhr_.addEventListener("error",()=>
vendor: 8,431 bytes, lines 3702-3721
3702{this.errorCode_=Tr.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,r,s,i){if(this.sent_)throw Qs("cannot .send() more than once");if(sr(e)&&r&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(t,e,!0),i!==void 0)for(const o in i)i.hasOwnProperty(o)&&this.xhr_.setRequestHeader(o,i[o].toString());return s!==void 0?this.xhr_.send(s):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw Qs("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw Qs("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw Qs("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw Qs("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener("progress",e)}}class Wv extends Lg{initXhr(){this.xhr_.responseType="text"}}function pr(){return new Wv}class $v extends Lg{initXhr(){this.xhr_.responseType="blob"}}function Qv(){return new $v}/**
3703 * @license
3704 * Copyright 2017 Google LLC
3705 *
3706 * Licensed under the Apache License, Version 2.0 (the "License");
3707 * you may not use this file except in compliance with the License.
3708 * You may obtain a copy of the License at
3709 *
3710 *   http://www.apache.org/licenses/LICENSE-2.0
3711 *
3712 * Unless required by applicable law or agreed to in writing, software
3713 * distributed under the License is distributed on an "AS IS" BASIS,
3714 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3715 * See the License for the specific language governing permissions and
3716 * limitations under the License.
3717 */class Yv{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(e,t,r=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=t,this._metadata=r,this._mappings=Ju(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=s=>{if(this._request=void 0,this._chunkMultiplier=1,s._codeEquals(be.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const i=this.isExponentialBackoffExpired();if(Ig(s.status,[]))if(i)s=_g();else{this.sleepTime=Math.max(this.sleepTime*2,tv),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=s,this._transition("error")}},this._metadataErrorHandler=s=>{this._request=void 0,s._codeEquals(be.CANCELED)?this.completeTransitions_():(this._error=s,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((s,i)=>{this._resolve=s,this._reject=i,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){const e=this._transferred;return t=>this._updateProgress(e+t)}_shouldDoResumable(e){return e.size()>256*1024}_start(){this._state==="running"&&this._request===void 0&&(this._resumable?this._uploadUrl===void 0?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([t,r])=>{switch(this._state){case"running":e(t,r);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused");break}})}_createResumable(){this._resolveToken((e,t)=>{const r=Jv(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,pr,e,t);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._uploadUrl=i,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const e=this._uploadUrl;this._resolveToken((t,r)=>{const s=jv(this._ref.storage,this._ref._location,e,this._blob),i=this._ref.storage._makeRequest(s,pr,t,r);this._request=i,i.getPromise().then(o=>{o=o,this._request=void 0,this._updateProgress(o.current),this._needToFetchStatus=!1,o.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const e=td*this._chunkMultiplier,t=new la(this._transferred,this._blob.size()),r=this._uploadUrl;this._resolveToken((s,i)=>{let o;try{o=Kv(this._ref._location,this._ref.storage,r,this._blob,e,this._mappings,t,this._makeProgressCallback())}catch(c){this._error=c,this._transition("error");return}const B=this._ref.storage._makeRequest(o,pr,s,i,!1);this._request=B,B.getPromise().then(c=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(c.current),c.finalized?(this._metadata=c.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){td*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{const r=Og(this._ref.storage,this._ref._location,this._mappings),s=this._ref.storage._makeRequest(r,pr,e,t);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._metadata=i,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,t)=>{const r=Fg(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,pr,e,t);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._metadata=i,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){const t=this._transferred;this._transferred=e,this._transferred!==t&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,this._request!==void 0?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const t=this._state==="paused";this._state=e,t&&(this._notifyObservers(),this._start());break;case"paused":this._state=e,this._notifyObservers();break;case"canceled":this._error=Dg(),this._state=e,this._notifyObservers();break;case"error":this._state=e,this._notifyObservers();break;case"success":this._state=e,this._notifyObservers();break}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start();break}}get snapshot(){const e=JB(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,r,s){const i=new zv(t||void 0,r||void 0,s||void 0);return this._addObserver(i),()=>{this._removeObserver(i)}}then(e,t){return this._promise.then(e,t)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){const t=this._observers.indexOf(e);t!==-1&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise(),this._observers.slice().forEach(t=>{this._notifyObserver(t)})}_finishPromise(){if(this._resolve!==void 0){let e=!0;switch(JB(this._state)){case ft.SUCCESS:zr(this._resolve.bind(null,this.snapshot))();break;case ft.CANCELED:case ft.ERROR:const t=this._reject;zr(t.bind(null,this._error))();break;default:e=!1;break}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(JB(this._state)){case ft.RUNNING:case ft.PAUSED:e.next&&zr(e.next.bind(e,this.snapshot))();break;case ft.SUCCESS:e.complete&&zr(e.complete.bind(e))();break;case ft.CANCELED:case ft.ERROR:e.error&&zr(e.error.bind(e,this._error))();break;default:e.error&&zr(e.error.bind(e,this._error))()}}resume(){const e=this._state==="paused"||this._state==="pausing";return e&&this._transition("running"),e}pause(){const e=this._state==="running";return e&&this._transition("pausing"),e}cancel(){const e=this._state==="running"||this._state==="pausing";return e&&this._transition("canceling"),e}}/**
3718 * @license
3719 * Copyright 2019 Google LLC
3720 *
3721 * Licensed under the Apache License, Version 2.0 (the "License");
3722 * you may not use this file except in compliance with the License.
3723 * You may obtain a copy of the License at
3724 *
3725 *   http://www.apache.org/licenses/LICENSE-2.0
3726 *
3727 * Unless required by applicable law or agreed to in writing, software
3728 * distributed under the License is distributed on an "AS IS" BASIS,
3729 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3730 * See the License for the specific language governing permissions and
3731 * limitations under the License.
3732 */class Pr{constructor(e,t){this._service=e,t instanceof Tt?this._location=t:this._location=Tt.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new Pr(e,t)}get root(){const e=new Tt(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return bg(this._location.path)}get storage(){return this._service}get parent(){const e=Lv(this._location.path);if(e===null)return null;const t=new Tt(this._location.bucket,e);return new Pr(this._service,t)}_throwIfRoot(e){if(this._location.path==="")throw hv(e)}}function Xv(n,e){n._throwIfRoot("getBlob");const t=Hv(n.storage,n._location);return n.storage.makeRequestWithTokens(t,Qv).then(r=>r)}function kg(n,e,t){n._throwIfRoot("uploadBytes");const r=Fg(n.storage,n._location,Ju(),new rn(e,!0),t);return n.storage.makeRequestWithTokens(r,pr).then(s=>({metadata:s,ref:n}))}function Zv(n,e,t){return n._throwIfRoot("uploadBytesResumable"),new Yv(n,new rn(e),t)}function eb(n,e,t=Mt.RAW,r){n._throwIfRoot("uploadString");const s=Tg(t,e),i={...r};return i.contentType==null&&s.contentType!=null&&(i.contentType=s.contentType),kg(n,s.data,i)}function tb(n){n._throwIfRoot("getMetadata");const e=Og(n.storage,n._location,Ju());return n.storage.makeRequestWithTokens(e,pr)}function nb(n,e){const t=kv(n._location.path,e),r=new Tt(n._location.bucket,t);return new Pr(n.storage,r)}/**
3733 * @license
3734 * Copyright 2017 Google LLC
3735 *
3736 * Licensed under the Apache License, Version 2.0 (the "License");
3737 * you may not use this file except in compliance with the License.
3738 * You may obtain a copy of the License at
3739 *
3740 *   http://www.apache.org/licenses/LICENSE-2.0
3741 *
3742 * Unless required by applicable law or agreed to in writing, software
3743 * distributed under the License is distributed on an "AS IS" BASIS,
3744 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3745 * See the License for the specific language governing permissions and
3746 * limitations under the License.
3747 */function rb(n){return/^[A-Za-z]+:\/\//.test(n)}function sb(n,e){return new Pr(n,e)}function Vg(n,e){if(n instanceof zu){const t=n;if(t._bucket==null)throw cv();const r=new Pr(t,t._bucket);return e!=null?Vg(r,e):r}else return e!==void 0?nb(n,e):n}function ib(n,e){if(e&&rb(e)){if(n instanceof zu)return sb(n,e);throw yc("To use ref(service, url), the first argument must be a Storage instance.")}else return Vg(n,e)}function nd(n,e){const t=e==null?void 0:e[Eg];return t==null?null:Tt.makeFromBucketSpec(t,n)}function ob(n,e,t,r={}){n.host=`${e}:${t}`;const s=sr(e);s&&vc(`https://${n.host}/b`),n._isUsingEmulator=!0,n._protocol=s?"https":"http";const{mockUserToken:i}=r;i&&(n._overrideAuthToken=typeof i=="string"?i:Rd(i,n.app.options.projectId))}class zu{constructor(e,t,r,s,i,o=!1){this.app=e,this._authProvider=t,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._isUsingEmulator=o,this._bucket=null,this._host=mg,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=ZR,this._maxUploadRetryTime=ev,this._requests=new Set,s!=null?this._bucket=Tt.makeFromBucketSpec(s,this._host):this._bucket=nd(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Tt.makeFromBucketSpec(this._url,e):this._bucket=nd(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){ed("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){ed("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const t=await e.getToken();if(t!==null)return t.accessToken}return null}async _getAppCheckToken(){if(Xe(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});
3747return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Pr(this,e)}_makeRequest(e,t,r,s,i=!0){if(this._deleted)return new fv(yg());{const o=Tv(e,this._appId,r,s,t,this._firebaseVersion,i,this._isUsingEmulator);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,t){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,r,s).getPromise()}}const rd="@firebase/storage",sd="0.14.5";/**
3748 * @license
3749 * Copyright 2020 Google LLC
3750 *
3751 * Licensed under the Apache License, Version 2.0 (the "License");
3752 * you may not use this file except in compliance with the License.
3753 * You may obtain a copy of the License at
3754 *
3755 *   http://www.apache.org/licenses/LICENSE-2.0
3756 *
3757 * Unless required by applicable law or agreed to in writing, software
3758 * distributed under the License is distributed on an "AS IS" BASIS,
3759 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3760 * See the License for the specific language governing permissions and
3761 * limitations under the License.
3762 */const xg="storage";function YP(n,e,t){return n=fe(n),kg(n,e,t)}function XP(n,e,t,r){return n=fe(n),eb(n,e,t,r)}function ZP(n,e,t){return n=fe(n),Zv(n,e,t)}function e0(n){return n=fe(n),tb(n)}function t0(n,e){return n=fe(n),ib(n,e)}function n0(n=ga(),e){n=fe(n);const r=kr(n,xg).getImmediate({identifier:e}),s=Rc("storage");return s&&ab(r,...s),r}function ab(n,e,t,r={}){ob(n,e,t,r)}/**
3763 * @license
3764 * Copyright 2021 Google LLC
3765 *
3766 * Licensed under the Apache License, Version 2.0 (the "License");
3767 * you may not use this file except in compliance with the License.
3768 * You may obtain a copy of the License at
3769 *
3770 *   http://www.apache.org/licenses/LICENSE-2.0
3771 *
3772 * Unless required by applicable law or agreed to in writing, software
3773 * distributed under the License is distributed on an "AS IS" BASIS,
3774 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3775 * See the License for the specific language governing permissions and
3776 * limitations under the License.
3777 */function r0(n,e){return n=fe(n),Xv(n)}/**
3778 * @license
3779 * Copyright 2020 Google LLC
3780 *
3781 * Licensed under the Apache License, Version 2.0 (the "License");
3782 * you may not use this file except in compliance with the License.
3783 * You may obtain a copy of the License at
3784 *
3785 *   http://www.apache.org/licenses/LICENSE-2.0
3786 *
3787 * Unless required by applicable law or agreed to in writing, software
3788 * distributed under the License is distributed on an "AS IS" BASIS,
3789 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3790 * See the License for the specific language governing permissions and
3791 * limitations under the License.
3792 */function Bb(n,{instanceIdentifier:e}){const t=n.getProvider("app").getImmediate(),r=n.getProvider("auth-internal"),s=n.getProvider("app-check-internal");return new zu(t,r,s,e,Vr)}function cb(){Ot(new Rt(xg,Bb,"PUBLIC").setMultipleInstances(!0)),Ze(rd,sd,""),Ze(rd,sd,"esm2020")}cb();/**
3793 * @license
3794 * Copyright 2017 Google LLC
3795 *
3796 * Licensed under the Apache License, Version 2.0 (the "License");
3797 * you may not use this file except in compliance with the License.
3798 * You may obtain a copy of the License at
3799 *
3800 *   http://www.apache.org/licenses/LICENSE-2.0
3801 *
3802 * Unless required by applicable law or agreed to in writing, software
3803 * distributed under the License is distributed on an "AS IS" BASIS,
3804 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3805 * See the License for the specific language governing permissions and
3806 * limitations under the License.
3807 */const ub="type.googleapis.com/google.protobuf.Int64Value",lb="type.googleapis.com/google.protobuf.UInt64Value";function Mg(n,e){const t={};for(const r in n)n.hasOwnProperty(r)&&(t[r]=e(n[r]));return t}function ha(n){if(n==null)return null;if(n instanceof Number&&(n=n.valueOf()),typeof n=="number"&&isFinite(n)||n===!0||n===!1||Object.prototype.toString.call(n)==="[object String]")return n;if(n instanceof Date)return n.toISOString();if(Array.isArray(n))return n.map(e=>ha(e));if(typeof n=="function"||typeof n=="object")return Mg(n,e=>ha(e));throw new Error("Data cannot be encoded in JSON: "+n)}function Cs(n){if(n==null)return n;if(n["@type"])switch(n["@type"]){case ub:case lb:{const e=Number(n.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+n);return e}default:throw new Error("Data cannot be decoded from JSON: "+n)}return Array.isArray(n)?n.map(e=>Cs(e)):typeof n=="function"||typeof n=="object"?Mg(n,e=>Cs(e)):n}/**
3808 * @license
3809 * Copyright 2020 Google LLC
3810 *
3811 * Licensed under the Apache License, Version 2.0 (the "License");
3812 * you may not use this file except in compliance with the License.
3813 * You may obtain a copy of the License at
3814 *
3815 *   http://www.apache.org/licenses/LICENSE-2.0
3816 *
3817 * Unless required by applicable law or agreed to in writing, software
3818 * distributed under the License is distributed on an "AS IS" BASIS,
3819 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3820 * See the License for the specific language governing permissions and
3821 * limitations under the License.
3822 */const Wu="functions";/**
3823 * @license
3824 * Copyright 2017 Google LLC
3825 *
3826 * Licensed under the Apache License, Version 2.0 (the "License");
3827 * you may not use this file except in compliance with the License.
3828 * You may obtain a copy of the License at
3829 *
3830 *   http://www.apache.org/licenses/LICENSE-2.0
3831 *
3832 * Unless required by applicable law or agreed to in writing, software
3833 * distributed under the License is distributed on an "AS IS" BASIS,
3834 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3835 * See the License for the specific language governing permissions and
3836 * limitations under the License.
3837 */const id={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Ct extends kt{constructor(e,t,r,s){super(`${Wu}/${e}`,t||"",s!=null?{url:s}:void 0),this.details=r,Object.setPrototypeOf(this,Ct.prototype)}}function hb(n){if(n>=200&&n<300)return"ok";switch(n){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function fa(n,e,t){let r=hb(n),s=r,i;try{const o=e&&e.error;if(o){const B=o.status;if(typeof B=="string"){if(!id[B])return new Ct("internal",`Unknown backend error status: ${B} [${n}]`,void 0,t);r=id[B],s=`Backend error status: ${B}`}const c=o.message;typeof c=="string"&&(s=c),i=o.details,i!==void 0&&(i=Cs(i))}}catch{}return r==="ok"?null:new Ct(r,`${s} [${n}]`,i,t)}/**
3838 * @license
3839 * Copyright 2017 Google LLC
3840 *
3841 * Licensed under the Apache License, Version 2.0 (the "License");
3842 * you may not use this file except in compliance with the License.
3843 * You may obtain a copy of the License at
3844 *
3845 *   http://www.apache.org/licenses/LICENSE-2.0
3846 *
3847 * Unless required by applicable law or agreed to in writing, software
3848 * distributed under the License is distributed on an "AS IS" BASIS,
3849 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3850 * See the License for the specific language governing permissions and
3851 * limitations under the License.
3852 */class fb{constructor(e,t,r,s){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,Xe(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=t.getImmediate({optional:!0}),this.messaging=r.getImmediate({optional:!0}),this.auth||t.get().then(i=>this.auth=i,()=>{}),this.messaging||r.get().then(i=>this.messaging=i,()=>{}),this.appCheck||s==null||s.get().then(i=>this.appCheck=i,()=>{})}async getAuthToken(){if(this.auth)try{const e=await this.auth.getToken();return e==null?void 0:e.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.serverAppAppCheckToken)return this.serverAppAppCheckToken;if(this.appCheck){const t=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return t.error?null:t.token}return null}async getContext(e){const t=await this.getAuthToken(),r=await this.getMessagingToken(),s=await this.getAppCheckToken(e);
3852return{authToken:t,messagingToken:r,appCheckToken:s}}}/**
3853 * @license
3854 * Copyright 2017 Google LLC
3855 *
3856 * Licensed under the Apache License, Version 2.0 (the "License");
3857 * you may not use this file except in compliance with the License.
3858 * You may obtain a copy of the License at
3859 *
3860 *   http://www.apache.org/licenses/LICENSE-2.0
3861 *
3862 * Unless required by applicable law or agreed to in writing, software
3863 * distributed under the License is distributed on an "AS IS" BASIS,
3864 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3865 * See the License for the specific language governing permissions and
3866 * limitations under the License.
3867 */const Ic="us-central1",db=/^data: (.*?)(?:\n|$)/;function Cb(n){let e=null;return{promise:new Promise((t,r)=>{e=setTimeout(()=>{r(new Ct("deadline-exceeded","deadline-exceeded"))},n)}),cancel:()=>{e&&clearTimeout(e)}}}class pb{constructor(e,t,r,s,i=Ic,o=(...B)=>fetch(...B)){this.app=e,this.fetchImpl=o,this.emulatorOrigin=null,this.contextProvider=new fb(e,t,r,s),this.cancelAllRequests=new Promise(B=>{this.deleteService=()=>Promise.resolve(B())});try{const B=new URL(i);this.customDomain=B.origin+(B.pathname==="/"?"":B.pathname),this.region=Ic}catch{this.customDomain=null,this.region=i}}_delete(){return this.deleteService()}_url(e){const t=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${t}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${t}.cloudfunctions.net/${e}`}}function gb(n,e,t){const r=sr(e);n.emulatorOrigin=`http${r?"s":""}://${e}:${t}`,r&&vc(n.emulatorOrigin+"/backends")}function mb(n,e,t){const r=s=>_b(n,e,s,t||{});return r.stream=(s,i)=>wb(n,e,s,i),r}function Gg(n){return n.emulatorOrigin&&sr(n.emulatorOrigin)?"include":void 0}async function Eb(n,e,t,r,s){t["Content-Type"]="application/json";let i;try{i=await r(n,{method:"POST",body:JSON.stringify(e),headers:t,credentials:Gg(s)})}catch{return{status:0,json:null}}let o=null;try{o=await i.json()}catch{}return{status:i.status,json:o}}async function Ug(n,e){const t={},r=await n.contextProvider.getContext(e.limitedUseAppCheckTokens);return r.authToken&&(t.Authorization="Bearer "+r.authToken),r.messagingToken&&(t["Firebase-Instance-ID-Token"]=r.messagingToken),r.appCheckToken!==null&&(t["X-Firebase-AppCheck"]=r.appCheckToken),t}function _b(n,e,t,r){const s=n._url(e);return Db(n,s,t,r)}async function Db(n,e,t,r){t=ha(t);const s={data:t},i=await Ug(n,r),o=r.timeout||7e4,B=Cb(o),c=await Promise.race([Eb(e,s,i,n.fetchImpl,n),B.promise,n.cancelAllRequests]);if(B.cancel(),!c)throw new Ct("cancelled","Firebase Functions instance was deleted.");const u=fa(c.status,c.json,e);if(u)throw u;if(!c.json)throw new Ct("internal","Response is not valid JSON object.",void 0,e);let h=c.json.data;if(typeof h>"u"&&(h=c.json.result),typeof h>"u")throw new Ct("internal","Response is missing data field.",void 0,e);return{data:Cs(h)}}function wb(n,e,t,r){const s=n._url(e);return yb(n,s,t,r||{})}async function yb(n,e,t,r){var p;t=ha(t);const s={data:t},i=await Ug(n,r);i["Content-Type"]="application/json",i.Accept="text/event-stream";let o;try{o=await n.fetchImpl(e,{method:"POST",body:JSON.stringify(s),headers:i,signal:r==null?void 0:r.signal,credentials:Gg(n)})}catch(_){if(_ instanceof Error&&_.name==="AbortError"){const O=new Ct("cancelled","Request was cancelled.");return{data:Promise.reject(O),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(O)}}}}}}const y=fa(0,null,e);return{data:Promise.reject(y),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(y)}}}}}}let B,c;const u=new Promise((_,y)=>{B=_,c=y});(p=r==null?void 0:r.signal)==null||p.addEventListener("abort",()=>{const _=new Ct("cancelled","Request was cancelled.");c(_)});const h=o.body.getReader(),d=Ib(h,B,c,r==null?void 0:r.signal,e);return{stream:{[Symbol.asyncIterator](){const _=d.getReader();return{async next(){const{value:y,done:O}=await _.read();return{value:y,done:O}},async return(){return await _.cancel(),{done:!0,value:void 0}}}}},data:u}}function Ib(n,e,t,r,s){const i=(B,c)=>{const u=B.match(db);if(!u)return;const h=u[1];try{const d=JSON.parse(h);if("result"in d){e(Cs(d.result));return}if("message"in d){c.enqueue(Cs(d.message));return}if("error"in d){const p=fa(0,d,s);c.error(p),t(p);return}}catch(d){if(d instanceof Ct){c.error(d),t(d);return}}},o=new TextDecoder;return new ReadableStream({start(B){let c="";return u();async function u(){if(r!=null&&r.aborted){const h=new Ct("cancelled","Request was cancelled");return B.error(h),t(h),Promise.resolve()}try{const{value:h,done:d}=await n.read();if(d){c.trim()&&i(c.trim(),B),B.close();return}if(r!=null&&r.aborted){const _=new Ct("cancelled","Request was cancelled");B.error(_),t(_),await n.cancel();return}c+=o.decode(h,{stream:!0});const p=c.split(`
3868`);c=p.pop()||"";for(const _ of p)_.trim()&&i(_.trim(),B);return u()}catch(h){const d=h instanceof Ct?h:fa(0,null,s);B.error(d),t(d)}}}
3868,cancel(){return n.cancel()}})}const od="@firebase/functions",ad="0.14.0";/**
3869 * @license
3870 * Copyright 2019 Google LLC
3871 *
3872 * Licensed under the Apache License, Version 2.0 (the "License");
3873 * you may not use this file except in compliance with the License.
3874 * You may obtain a copy of the License at
3875 *
3876 *   http://www.apache.org/licenses/LICENSE-2.0
3877 *
3878 * Unless required by applicable law or agreed to in writing, software
3879 * distributed under the License is distributed on an "AS IS" BASIS,
3880 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3881 * See the License for the specific language governing permissions and
3882 * limitations under the License.
3883 */const Tb="auth-internal",Ab="app-check-internal",Rb="messaging-internal";function vb(n){const e=(t,{instanceIdentifier:r})=>{const s=t.getProvider("app").getImmediate(),i=t.getProvider(Tb),o=t.getProvider(Rb),B=t.getProvider(Ab);return new pb(s,i,o,B,r)};Ot(new Rt(Wu,e,"PUBLIC").setMultipleInstances(!0)),Ze(od,ad,n),Ze(od,ad,"esm2020")}/**
3884 * @license
3885 * Copyright 2020 Google LLC
3886 *
3887 * Licensed under the Apache License, Version 2.0 (the "License");
3888 * you may not use this file except in compliance with the License.
3889 * You may obtain a copy of the License at
3890 *
3891 *   http://www.apache.org/licenses/LICENSE-2.0
3892 *
3893 * Unless required by applicable law or agreed to in writing, software
3894 * distributed under the License is distributed on an "AS IS" BASIS,
3895 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3896 * See the License for the specific language governing permissions and
3897 * limitations under the License.
3898 */function s0(n=ga(),e=Ic){const r=kr(fe(n),Wu).getImmediate({identifier:e}),s=Rc("functions");return s&&bb(r,...s),r}function bb(n,e,t){gb(fe(n),e,t)}function i0(n,e,t){return mb(fe(n),e,t)}/**
3899 * @license
3900 * Copyright 2017 Google LLC
3901 *
3902 * Licensed under the Apache License, Version 2.0 (the "License");
3903 * you may not use this file except in compliance with the License.
3904 * You may obtain a copy of the License at
3905 *
3906 *   http://www.apache.org/licenses/LICENSE-2.0
3907 *
3908 * Unless required by applicable law or agreed to in writing, software
3909 * distributed under the License is distributed on an "AS IS" BASIS,
3910 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3911 * See the License for the specific language governing permissions and
3912 * limitations under the License.
3913 */vb();const Hg="@firebase/installations",$u="0.6.24";/**
3914 * @license
3915 * Copyright 2019 Google LLC
3916 *
3917 * Licensed under the Apache License, Version 2.0 (the "License");
3918 * you may not use this file except in compliance with the License.
3919 * You may obtain a copy of the License at
3920 *
3921 *   http://www.apache.org/licenses/LICENSE-2.0
3922 *
3923 * Unless required by applicable law or agreed to in writing, software
3924 * distributed under the License is distributed on an "AS IS" BASIS,
3925 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3926 * See the License for the specific language governing permissions and
3927 * limitations under the License.
3928 */const qg=1e4,Jg=`w:${$u}`,jg="FIS_v2",Sb="https://firebaseinstallations.googleapis.com/v1",Pb=60*60*1e3,Ob="installations",Nb="Installations";/**
3929 * @license
3930 * Copyright 2019 Google LLC
3931 *
3932 * Licensed under the Apache License, Version 2.0 (the "License");
3933 * you may not use this file except in compliance with the License.
3934 * You may obtain a copy of the License at
3935 *
3936 *   http://www.apache.org/licenses/LICENSE-2.0
3937 *
3938 * Unless required by applicable law or agreed to in writing, software
3939 * distributed under the License is distributed on an "AS IS" BASIS,
3940 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3941 * See the License for the specific language governing permissions and
3942 * limitations under the License.
3943 */const Fb={"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."},Or=new Lr(Ob,Nb,Fb);function Kg(n){return n instanceof kt&&n.code.includes("request-failed")}/**
3944 * @license
3945 * Copyright 2019 Google LLC
3946 *
3947 * Licensed under the Apache License, Version 2.0 (the "License");
3948 * you may not use this file except in compliance with the License.
3949 * You may obtain a copy of the License at
3950 *
3951 *   http://www.apache.org/licenses/LICENSE-2.0
3952 *
3953 * Unless required by applicable law or agreed to in writing, software
3954 * distributed under the License is distributed on an "AS IS" BASIS,
3955 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3956 * See the License for the specific language governing permissions and
3957 * limitations under the License.
3958 */function zg({projectId:n}){return`${Sb}/projects/${n}/installations`}function Wg(n){return{token:n.token,requestStatus:2,expiresIn:kb(n.expiresIn),creationTime:Date.now()}}async function $g(n,e){const r=(await e.json()).error;return Or.create("request-failed",{requestName:n,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function Qg({apiKey:n}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":n})}function Lb(n,{refreshToken:e}){const t=Qg(n);return t.append("Authorization",Vb(e)),t}async function Yg(n){const e=await n();return e.status>=500&&e.status<600?n():e}function kb(n){return Number(n.replace("s","000"))}function Vb(n){return`${jg} ${n}`}/**
3959 * @license
3960 * Copyright 2019 Google LLC
3961 *
3962 * Licensed under the Apache License, Version 2.0 (the "License");
3963 * you may not use this file except in compliance with the License.
3964 * You may obtain a copy of the License at
3965 *
3966 *   http://www.apache.org/licenses/LICENSE-2.0
3967 *
3968 * Unless required by applicable law or agreed to in writing, software
3969 * distributed under the License is distributed on an "AS IS" BASIS,
3970 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3971 * See the License for the specific language governing permissions and
3972 * limitations under the License.
3973 */async function xb({appConfig:n,heartbeatServiceProvider:e},{fid:t}){const r=zg(n),s=Qg(n),i=e.getImmediate({optional:!0});if(i){const u=await i.getHeartbeatsHeader();u&&s.append("x-firebase-client",u)}const o={fid:t,authVersion:jg,appId:n.appId,sdkVersion:Jg},B={method:"POST",headers:s,body:JSON.stringify(o)},c=await Yg(()=>fetch(r,B));if(c.ok){const u=await c.json();return{fid:u.fid||t,registrationStatus:2,refreshToken:u.refreshToken,authToken:Wg(u.authToken)}}else throw await $g("Create Installation",c)}/**
3974 * @license
3975 * Copyright 2019 Google LLC
3976 *
3977 * Licensed under the Apache License, Version 2.0 (the "License");
3978 * you may not use this file except in compliance with the License.
3979 * You may obtain a copy of the License at
3980 *
3981 *   http://www.apache.org/licenses/LICENSE-2.0
3982 *
3983 * Unless required by applicable law or agreed to in writing, software
3984 * distributed under the License is distributed on an "AS IS" BASIS,
3985 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3986 * See the License for the specific language governing permissions and
3987 * limitations under the License.
3988 */function Xg(n){return new Promise(e=>{setTimeout(e,n)})}/**
3989 * @license
3990 * Copyright 2019 Google LLC
3991 *
3992 * Licensed under the Apache License, Version 2.0 (the "License");
3993 * you may not use this file except in compliance with the License.
3994 * You may obtain a copy of the License at
3995 *
3996 *   http://www.apache.org/licenses/LICENSE-2.0
3997 *
3998 * Unless required by applicable law or agreed to in writing, software
3999 * distributed under the License is distributed on an "AS IS" BASIS,
4000 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4001 * See the License for the specific language governing permissions and
4002 * limitations under the License.
4003 */function Mb(n){return btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_")}/**
4004 * @license
4005 * Copyright 2019 Google LLC
4006 *
4007 * Licensed under the Apache License, Version 2.0 (the "License");
4008 * you may not use this file except in compliance with the License.
4009 * You may obtain a copy of the License at
4010 *
4011 *   http://www.apache.org/licenses/LICENSE-2.0
4012 *
4013 * Unless required by applicable law or agreed to in writing, software
4014 * distributed under the License is distributed on an "AS IS" BASIS,
4015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4016 * See the License for the specific language governing permissions and
4017 * limitations under the License.
4018 */const Gb=/^[cdef][\w-]{21}$/,Tc="";function Ub(){try{const n=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(n),n[0]=112+n[0]%16;const t=Hb(n);return Gb.test(t)?t:Tc}catch{return Tc}}function Hb(n){return Mb(n).substr(0,22)}/**
4019 * @license
4020 * Copyright 2019 Google LLC
4021 *
4022 * Licensed under the Apache License, Version 2.0 (the "License");
4023 * you may not use this file except in compliance with the License.
4024 * You may obtain a copy of the License at
4025 *
4026 *   http://www.apache.org/licenses/LICENSE-2.0
4027 *
4028 * Unless required by applicable law or agreed to in writing, software
4029 * distributed under the License is distributed on an "AS IS" BASIS,
4030 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4031 * See the License for the specific language governing permissions and
4032 * limitations under the License.
4033 */function Ps(n){return`${n.appName}!${n.appId}`}/**
4034 * @license
4035 * Copyright 2019 Google LLC
4036 *
4037 * Licensed under the Apache License, Version 2.0 (the "License");
4038 * you may not use this file except in compliance with the License.
4039 * You may obtain a copy of the License at
4040 *
4041 *   http://www.apache.org/licenses/LICENSE-2.0
4042 *
4043 * Unless required by applicable law or agreed to in writing, software
4044 * distributed under the License is distributed on an "AS IS" BASIS,
4045 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4046 * See the License for the specific language governing permissions and
4047 * limitations under the License.
4048 */const ps=new Map;function Zg(n,e){const t=Ps(n);em(t,e),jb(t,e)}function qb(n,e){tm();const t=Ps(n);let r=ps.get(t);r||(r=new Set,ps.set(t,r)),r.add(e)}function Jb(n,e){const t=Ps(n),r=ps.get(t);r&&(r.delete(e),r.size===0&&ps.delete(t),nm())}function em(n,e){const t=ps.get(n);if(t)for(const r of t)r(e)}function jb(n,e){const t=tm();t&&t.postMessage({key:n,fid:e}),nm()}let Er=null;function tm(){return!Er&&"BroadcastChannel"in self&&(Er=new BroadcastChannel("[Firebase] FID Change"),Er.onmessage=n=>{em(n.data.key,n.data.fid)}),Er}function nm(){ps.size===0&&Er&&(Er.close(),Er=null)}/**
4049 * @license
4050 * Copyright 2019 Google LLC
4051 *
4052 * Licensed under the Apache License, Version 2.0 (the "License");
4053 * you may not use this file except in compliance with the License.
4054 * You may obtain a copy of the License at
4055 *
4056 *   http://www.apache.org/licenses/LICENSE-2.0
4057 *
4058 * Unless required by applicable law or agreed to in writing, software
4059 * distributed under the License is distributed on an "AS IS" BASIS,
4060 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4061 * See the License for the specific language governing permissions and
4062 * limitations under the License.
4063 */const Kb="firebase-installations-database",zb=1,Nr="firebase-installations-store";let jB=null;function Qu(){return jB||(jB=pa(Kb,zb,{upgrade:(n,e)=>{switch(e){case 0:n.createObjectStore(Nr)}}})),jB}async function da(n,e){const t=Ps(n),s=(await Qu()).transaction(Nr,"readwrite"),i=s.objectStore(Nr),o=await i.get(t);return await i.put(e,t),await s.done,(!o||o.fid!==e.fid)&&Zg(n,e.fid),e}async function rm(n){const e=Ps(n),r=(await Qu()).transaction(Nr,"readwrite");await r.objectStore(Nr).delete(e),await r.done}async function $a(n,e){const t=Ps(n),s=(await Qu()).transaction(Nr,"readwrite"),i=s.objectStore(Nr),o=await i.get(t),B=e(o);return B===void 0?await i.delete(t):await i.put(B,t),await s.done,B&&(!o||o.fid!==B.fid)&&Zg(n,B.fid),B}/**
4064 * @license
4065 * Copyright 2019 Google LLC
4066 *
4067 * Licensed under the Apache License, Version 2.0 (the "License");
4068 * you may not use this file except in compliance with the License.
4069 * You may obtain a copy of the License at
4070 *
4071 *   http://www.apache.org/licenses/LICENSE-2.0
4072 *
4073 * Unless required by applicable law or agreed to in writing, software
4074 * distributed under the License is distributed on an "AS IS" BASIS,
4075 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4076 * See the License for the specific language governing permissions and
4077 * limitations under the License.
4078 */async function Yu(n){let e;const t=await $a(n.appConfig,r=>{const s=Wb(r),i=$b(n,s);return e=i.registrationPromise,i.installationEntry});return t.fid===Tc?{installationEntry:await e}:{installationEntry:t,registrationPromise:e}}function Wb(n){const e=n||{fid:Ub(),registrationStatus:0};return sm(e)}function $b(n,e){if(e.registrationStatus===0){if(!navigator.onLine){const s=Promise.reject(Or.create("app-offline"));return{installationEntry:e,registrationPromise:s}}const t={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},r=Qb(n,t);return{installationEntry:t,registrationPromise:r}}else return e.registrationStatus===1?{installationEntry:e,registrationPromise:Yb(n)}:{installationEntry:e}}async function Qb(n,e){try{const t=await xb(n,e);return da(n.appConfig,t)}catch(t){throw Kg(t)&&t.customData.serverCode===409?await rm(n.appConfig):await da(n.appConfig,{fid:e.fid,registrationStatus:0}),t}}async function Yb(n){let e=await Bd(n.appConfig);for(;e.registrationStatus===1;)await Xg(100),e=await Bd(n.appConfig);if(e.registrationStatus===0){const{installationEntry:t,registrationPromise:r}=await Yu(n);return r||t}return e}function Bd(n){return $a(n,e=>{if(!e)throw Or.create("installation-not-found");return sm(e)})}function sm(n){return Xb(n)?{fid:n.fid,registrationStatus:0}:n}function Xb(n){return n.registrationStatus===1&&n.registrationTime+qg<Date.now()}/**
4079 * @license
4080 * Copyright 2019 Google LLC
4081 *
4082 * Licensed under the Apache License, Version 2.0 (the "License");
4083 * you may not use this file except in compliance with the License.
4084 * You may obtain a copy of the License at
4085 *
4086 *   http://www.apache.org/licenses/LICENSE-2.0
4087 *
4088 * Unless required by applicable law or agreed to in writing, software
4089 * distributed under the License is distributed on an "AS IS" BASIS,
4090 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4091 * See the License for the specific language governing permissions and
4092 * limitations under the License.
4093 */async function Zb({appConfig:n,heartbeatServiceProvider:e},t){const r=eS(n,t),s=Lb(n,t),i=e.getImmediate({optional:!0});if(i){const u=await i.getHeartbeatsHeader();u&&s.append("x-firebase-client",u)}const o={installation:{sdkVersion:Jg,appId:n.appId}},B={method:"POST",headers:s,body:JSON.stringify(o)},c=await Yg(()=>fetch(r,B));if(c.ok){const u=await c.json();return Wg(u)}else throw await $g("Generate Auth Token",c)}function eS(n,{fid:e}){return`${zg(n)}/${e}/authTokens:generate`}/**
4094 * @license
4095 * Copyright 2019 Google LLC
4096 *
4097 * Licensed under the Apache License, Version 2.0 (the "License");
4098 * you may not use this file except in compliance with the License.
4099 * You may obtain a copy of the License at
4100 *
4101 *   http://www.apache.org/licenses/LICENSE-2.0
4102 *
4103 * Unless required by applicable law or agreed to in writing, software
4104 * distributed under the License is distributed on an "AS IS" BASIS,
4105 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4106 * See the License for the specific language governing permissions and
4107 * limitations under the License.
4108 */async function Xu(n,e=!1){let t;const r=await $a(n.appConfig,i=>{if(!im(i))throw Or.create("not-registered");const o=i.authToken;if(!e&&rS(o))return i;if(o.requestStatus===1)return t=tS(n,e),i;{if(!navigator.onLine)throw Or.create("app-offline");const B=iS(i);return t=nS(n,B),B}});return t?await t:r.authToken}async function tS(n,e){let t=await cd(n.appConfig);for(;t.authToken.requestStatus===1;)await Xg(100),t=await cd(n.appConfig);const r=t.authToken;return r.requestStatus===0?Xu(n,e):r}function cd(n){return $a(n,e=>{if(!im(e))throw Or.create("not-registered");const t=e.authToken;return oS(t)?{...e,authToken:{requestStatus:0}}:e})}async function nS(n,e){try{const t=await Zb(n,e),r={...e,authToken:t};return await da(n.appConfig,r),t}catch(t){if(Kg(t)&&(t.customData.serverCode===401||t.customData.serverCode===404))await rm(n.appConfig);else{const r={...e,authToken:{requestStatus:0}};await da(n.appConfig,r)}throw t}}function im(n){return n!==void 0&&n.registrationStatus===2}function rS(n){return n.requestStatus===2&&!sS(n)}function sS(n){const e=Date.now();return e<n.creationTime||n.creationTime+n.expiresIn<e+Pb}function iS(n){const e={requestStatus:1,requestTime:Date.now()};return{...n,authToken:e}}function oS(n){return n.requestStatus===1&&n.requestTime+qg<Date.now()}/**
4109 * @license
4110 * Copyright 2019 Google LLC
4111 *
4112 * Licensed under the Apache License, Version 2.0 (the "License");
4113 * you may not use this file except in compliance with the License.
4114 * You may obtain a copy of the License at
4115 *
4116 *   http://www.apache.org/licenses/LICENSE-2.0
4117 *
4118 * Unless required by applicable law or agreed to in writing, software
4119 * distributed under the License is distributed on an "AS IS" BASIS,
4120 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4121 * See the License for the specific language governing permissions and
4122 * limitations under the License.
4123 */async function aS(n){const e=n,{installationEntry:t,registrationPromise:r}=await Yu(e);return r?r.catch(console.error):Xu(e).catch(console.error),t.fid}/**
4124 * @license
4125 * Copyright 2019 Google LLC
4126 *
4127 * Licensed under the Apache License, Version 2.0 (the "License");
4128 * you may not use this file except in compliance with the License.
4129 * You may obtain a copy of the License at
4130 *
4131 *   http://www.apache.org/licenses/LICENSE-2.0
4132 *
4133 * Unless required by applicable law or agreed to in writing, software
4134 * distributed under the License is distributed on an "AS IS" BASIS,
4135 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4136 * See the License for the specific language governing permissions and
4137 * limitations under the License.
4138 */async function BS(n,e=!1){const t=n;return await cS(t),(await Xu(t,e)).token}async function cS(n){const{registrationPromise:e}=await Yu(n);e&&await e}/**
4139 * @license
4140 * Copyright 2019 Google LLC
4141 *
4142 * Licensed under the Apache License, Version 2.0 (the "License");
4143 * you may not use this file except in compliance with the License.
4144 * You may obtain a copy of the License at
4145 *
4146 *   http://www.apache.org/licenses/LICENSE-2.0
4147 *
4148 * Unless required by applicable law or agreed to in writing, software
4149 * distributed under the License is distributed on an "AS IS" BASIS,
4150 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4151 * See the License for the specific language governing permissions and
4152 * limitations under the License.
4153 */function uS(n,e){const{appConfig:t}=n;return qb(t,e),()=>{Jb(t,e)}}/**
4154 * @license
4155 * Copyright 2019 Google LLC
4156 *
4157 * Licensed under the Apache License, Version 2.0 (the "License");
4158 * you may not use this file except in compliance with the License.
4159 * You may obtain a copy of the License at
4160 *
4161 *   http://www.apache.org/licenses/LICENSE-2.0
4162 *
4163 * Unless required by applicable law or agreed to in writing, software
4164 * distributed under the License is distributed on an "AS IS" BASIS,
4165 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4166 * See the License for the specific language governing permissions and
4167 * limitations under the License.
4168 */function lS(n){if(!n||!n.options)throw KB("App Configuration");if(!n.name)throw KB("App Name");const e=["projectId","apiKey","appId"];for(const t of e)if(!n.options[t])throw KB(t);return{appName:n.name,projectId:n.options.projectId,apiKey:n.options.apiKey,appId:n.options.appId}}function KB(n){return Or.create("missing-app-config-values",{valueName:n})}/**
4169 * @license
4170 * Copyright 2020 Google LLC
4171 *
4172 * Licensed under the Apache License, Version 2.0 (the "License");
4173 * you may not use this file except in compliance with the License.
4174 * You may obtain a copy of the License at
4175 *
4176 *   http://www.apache.org/licenses/LICENSE-2.0
4177 *
4178 * Unless required by applicable law or agreed to in writing, software
4179 * distributed under the License is distributed on an "AS IS" BASIS,
4180 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4181 * See the License for the specific language governing permissions and
4182 * limitations under the License.
4183 */const om="installations",hS="installations-internal",fS=n=>{const e=n.getProvider("app").getImmediate(),t=lS(e),r=kr(e,"heartbeat");return{app:e,appConfig:t,heartbeatServiceProvider:r,_delete:()=>Promise.resolve()}},dS=n=>{const e=n.getProvider("app").getImmediate(),t=kr(e,om).getImmediate();return{getId:()=>aS(t),getToken:s=>BS(t,s)}};function CS(){Ot(new Rt(om,fS,"PUBLIC")),Ot(new Rt(hS,dS,"PRIVATE"))}/**
4184 * @license
4185 * Copyright 2019 Google LLC
4186 *
4187 * Licensed under the Apache License, Version 2.0 (the "License");
4188 * you may not use this file except in compliance with the License.
4189 * You may obtain a copy of the License at
4190 *
4191 *   http://www.apache.org/licenses/LICENSE-2.0
4192 *
4193 * Unless required by applicable law or agreed to in writing, software
4194 * distributed under the License is distributed on an "AS IS" BASIS,
4195 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4196 * See the License for the specific language governing permissions and
4197 * limitations under the License.
4198 */CS();Ze(Hg,$u);Ze(Hg,$u,"esm2020");/**
4199 * @license
4200 * Copyright 2019 Google LLC
4201 *
4202 * Licensed under the Apache License, Version 2.0 (the "License");
4203 * you may not use this file except in compliance with the License.
4204 * You may obtain a copy of the License at
4205 *
4206 *   http://www.apache.org/licenses/LICENSE-2.0
4207 *
4208 * Unless required by applicable law or agreed to in writing, software
4209 * distributed under the License is distributed on an "AS IS" BASIS,
4210 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4211 * See the License for the specific language governing permissions and
4212 * limitations under the License.
4213 */const pS="/firebase-messaging-sw.js",gS="/firebase-cloud-messaging-push-scope",am="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",mS="https://fcmregistrations.googleapis.com/v1",Bm="google.c.a.c_id",ES="google.c.a.c_l",_S="google.c.a.ts",DS="google.c.a.e",ud=1e4;var ld;(function(n){n[n.DATA_MESSAGE=1]="DATA_MESSAGE",n[n.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"})(ld||(ld={}));/**
4214 * @license
4215 * Copyright 2018 Google LLC
4216 *
4217 * Licensed under the Apache License, Version 2.0 (the "License");
4217 you may not use this file except
4218 * in compliance with the License. You may obtain a copy of the License at
4219 *
4220 * http://www.apache.org/licenses/LICENSE-2.0
4221 *
4222 * Unless required by applicable law or agreed to in writing, software distributed under the License
4223 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
4224 * or implied. See the License for the specific language governing permissions and limitations under
4225 * the License.
4226 */var gs;(function(n){n.PUSH_RECEIVED="push-received",n.NOTIFICATION_CLICKED="notification-clicked",n.FID_REGISTERED="fid-registered"})(gs||(gs={}));/**
4227 * @license
4228 * Copyright 2017 Google LLC
4229 *
4230 * Licensed under the Apache License, Version 2.0 (the "License");
4231 * you may not use this file except in compliance with the License.
4232 * You may obtain a copy of the License at
4233 *
4234 *   http://www.apache.org/licenses/LICENSE-2.0
4235 *
4236 * Unless required by applicable law or agreed to in writing, software
4237 * distributed under the License is distributed on an "AS IS" BASIS,
4238 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4239 * See the License for the specific language governing permissions and
4240 * limitations under the License.
4241 */function Vt(n){const e=new Uint8Array(n);return btoa(String.fromCharCode(...e)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function cm(n){const e="=".repeat((4-n.length%4)%4),t=(n+e).replace(/\-/g,"+").replace(/_/g,"/"),r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;++i)s[i]=r.charCodeAt(i);return s}/**
4242 * @license
4243 * Copyright 2019 Google LLC
4244 *
4245 * Licensed under the Apache License, Version 2.0 (the "License");
4246 * you may not use this file except in compliance with the License.
4247 * You may obtain a copy of the License at
4248 *
4249 *   http://www.apache.org/licenses/LICENSE-2.0
4250 *
4251 * Unless required by applicable law or agreed to in writing, software
4252 * distributed under the License is distributed on an "AS IS" BASIS,
4253 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4254 * See the License for the specific language governing permissions and
4255 * limitations under the License.
4256 */const zB="fcm_token_details_db",wS=5,hd="fcm_token_object_Store";async function yS(n){if("databases"in indexedDB&&!(await indexedDB.databases()).map(i=>i.name).includes(zB))return null;let e=null;return(await pa(zB,wS,{upgrade:async(r,s,i,o)=>{if(s<2||!r.objectStoreNames.contains(hd))return;const B=o.objectStore(hd),c=await B.index("fcmSenderId").get(n);if(await B.clear(),!!c){if(s===2){const u=c;if(!u.auth||!u.p256dh||!u.endpoint)return;e={token:u.fcmToken,createTime:u.createTime??Date.now(),subscriptionOptions:{auth:u.auth,p256dh:u.p256dh,endpoint:u.endpoint,swScope:u.swScope,vapidKey:typeof u.vapidKey=="string"?u.vapidKey:Vt(u.vapidKey)}}}else if(s===3){const u=c;e={token:u.fcmToken,createTime:u.createTime,subscriptionOptions:{auth:Vt(u.auth),p256dh:Vt(u.p256dh),endpoint:u.endpoint,swScope:u.swScope,vapidKey:Vt(u.vapidKey)}}}else if(s===4){const u=c;e={token:u.fcmToken,createTime:u.createTime,subscriptionOptions:{auth:Vt(u.auth),p256dh:Vt(u.p256dh),endpoint:u.endpoint,swScope:u.swScope,vapidKey:Vt(u.vapidKey)}}}}}})).close(),await Ro(zB),await Ro("fcm_vapid_details_db"),await Ro("undefined"),IS(e)?e:null}function IS(n){if(!n||!n.subscriptionOptions)return!1;const{subscriptionOptions:e}=n;return typeof n.createTime=="number"&&n.createTime>0&&typeof n.token=="string"&&n.token.length>0&&typeof e.auth=="string"&&e.auth.length>0&&typeof e.p256dh=="string"&&e.p256dh.length>0&&typeof e.endpoint=="string"&&e.endpoint.length>0&&typeof e.swScope=="string"&&e.swScope.length>0&&typeof e.vapidKey=="string"&&e.vapidKey.length>0}/**
4257 * @license
4258 * Copyright 2017 Google LLC
4259 *
4260 * Licensed under the Apache License, Version 2.0 (the "License");
4261 * you may not use this file except in compliance with the License.
4262 * You may obtain a copy of the License at
4263 *
4264 *   http://www.apache.org/licenses/LICENSE-2.0
4265 *
4266 * Unless required by applicable law or agreed to in writing, software
4267 * distributed under the License is distributed on an "AS IS" BASIS,
4268 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4269 * See the License for the specific language governing permissions and
4270 * limitations under the License.
4271 */const TS={"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.","fid-registration-failed":"A problem occurred while creating an FCM registration via FID: {$errorInfo}","fid-unregister-failed":"A problem occurred while unregistering the FCM registration via FID: {$errorInfo}","fid-registration-idb-schema-unavailable":"Unable to read or persist FID registration metadata because the messaging IndexedDB schema is unavailable (for example, the database could not be upgraded to the latest version).","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.","invali
4271d-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.","invalid-on-registered-handler":"No onRegistered callback handler was provided or registered. Implement onRegistered() before register()."},me=new Lr("messaging","Messaging",TS);/**
4272 * @license
4273 * Copyright 2019 Google LLC
4274 *
4275 * Licensed under the Apache License, Version 2.0 (the "License");
4276 * you may not use this file except in compliance with the License.
4277 * You may obtain a copy of the License at
4278 *
4279 *   http://www.apache.org/licenses/LICENSE-2.0
4280 *
4281 * Unless required by applicable law or agreed to in writing, software
4282 * distributed under the License is distributed on an "AS IS" BASIS,
4283 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4284 * See the License for the specific language governing permissions and
4285 * limitations under the License.
4286 */const fd="firebase-messaging-database",dd=2,Fr="firebase-messaging-store",Cn="firebase-messaging-fid-registration-store",AS={openDB:pa,deleteDB:Ro};let Cd=AS,fi=null;function RS(n,e,t){switch(e){case 0:if(n.createObjectStore(Fr),t===1)break;case 1:t===2&&n.createObjectStore(Cn)}}function pd(n){return{upgrade:(e,t)=>{RS(e,t,n)},blocked:()=>{},blocking:(e,t,r)=>{var s;fi=null,(s=r.target)==null||s.close()},terminated:()=>{fi=null}}}function Qa(){return fi||(fi=Cd.openDB(fd,dd,pd(2)).catch(()=>Cd.openDB(fd,dd-1,pd(1)))),fi}function um(n,e){return n.objectStoreNames.contains(e)}function lm(n){if(!um(n,Cn))throw me.create("fid-registration-idb-schema-unavailable")}async function vS(n){const e=Ya(n),r=await(await Qa()).transaction(Fr).objectStore(Fr).get(e);if(r)return r;{const s=await yS(n.appConfig.senderId);if(s)return await Zu(n,s),s}}async function Zu(n,e){const t=Ya(n),r=await Qa(),s=[Fr],i=um(r,Cn);i&&s.push(Cn);const o=r.transaction(s,"readwrite");return await o.objectStore(Fr).put(e,t),i&&await o.objectStore(Cn).delete(t),await o.done,e}async function hm(n){const e=Ya(n),t=await Qa();return lm(t),await t.transaction(Cn).objectStore(Cn).get(e)}async function bS(n,e){const t=Ya(n),r=await Qa();lm(r);const s=r.transaction([Fr,Cn],"readwrite");return await s.objectStore(Cn).put(e,t),await s.objectStore(Fr).delete(t),await s.done,e}function Ya({appConfig:n}){return n.appId}const gd="@firebase/messaging",Ac="0.13.3";/**
4287 * @license
4288 * Copyright 2019 Google LLC
4289 *
4290 * Licensed under the Apache License, Version 2.0 (the "License");
4291 * you may not use this file except in compliance with the License.
4292 * You may obtain a copy of the License at
4293 *
4294 *   http://www.apache.org/licenses/LICENSE-2.0
4295 *
4296 * Unless required by applicable law or agreed to in writing, software
4297 * distributed under the License is distributed on an "AS IS" BASIS,
4298 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4299 * See the License for the specific language governing permissions and
4300 * limitations under the License.
4301 */const SS=3,PS=1e3;async function OS(n,e){const t=await Za(n),r=el(e,n.appConfig.appName,!1),s={method:"POST",headers:t,body:JSON.stringify(r)};let i;try{i=await(await fetch(Xa(n.appConfig),s)).json()}catch(o){throw me.create("token-subscribe-failed",{errorInfo:o==null?void 0:o.toString()})}if(i.error){const o=i.error.message;throw me.create("token-subscribe-failed",{errorInfo:o})}if(!i.token)throw me.create("token-subscribe-no-token");return i.token}async function NS(n,e){var c;const t=await Za(n),r=el(e,n.appConfig.appName,!0),s={method:"POST",headers:t,body:JSON.stringify(r)};let i;try{i=await xS(()=>fetch(Xa(n.appConfig),s),SS,PS)}catch(u){throw me.create("fid-registration-failed",{errorInfo:u==null?void 0:u.toString()})}if(i.ok)return{responseFid:await FS(i)};let o;try{o=await i.json()}catch{throw me.create("fid-registration-failed",{errorInfo:i.statusText})}const B=((c=o.error)==null?void 0:c.message)??i.statusText;throw me.create("fid-registration-failed",{errorInfo:B})}async function FS(n){const e=await n.text();if(!e.trim())throw me.create("fid-registration-failed",{errorInfo:"CreateRegistration succeeded but response body is empty"});let t;try{t=JSON.parse(e)}catch{throw me.create("fid-registration-failed",{errorInfo:"CreateRegistration succeeded but response body is not val
4301id JSON"})}const r=t.name;if(typeof r!="string"||r.length===0)throw me.create("fid-registration-failed",{errorInfo:"CreateRegistration succeeded but response did not include a non-empty name"});return LS(r)}const md="/registrations/";function LS(n){const e=n.indexOf(md);if(e!==-1){const t=n.slice(e+md.length);if(t.length>0)return t}throw me.create("fid-registration-failed",{errorInfo:"CreateRegistration succeeded but response name is not a valid registration resource name"})}async function kS(n,e){const t=await Za(n),r=el(e.subscriptionOptions,n.appConfig.appName,!1),s={method:"PATCH",headers:t,body:JSON.stringify(r)};let i;try{i=await(await fetch(`${Xa(n.appConfig)}/${e.token}`,s)).json()}catch(o){throw me.create("token-update-failed",{errorInfo:o==null?void 0:o.toString()})}if(i.error){const o=i.error.message;throw me.create("token-update-failed",{errorInfo:o})}if(!i.token)throw me.create("token-update-no-token");return i.token}async function VS(n,e){const r={method:"DELETE",headers:await Za(n)};try{const i=await(await fetch(`${Xa(n.appConfig)}/${e}`,r)).json();if(i.error){const o=i.error.message;throw me.create("token-unsubscribe-failed",{errorInfo:o})}}catch(s){throw me.create("token-unsubscribe-failed",{errorInfo:s==null?void 0:s.toString()})}}async function xS(n,e,t){let r;for(let s=0;s<e;s++)try{return await n()}catch(i){if(r=i,s<e-1){const o=t*Math.pow(2,s);await new Promise(B=>setTimeout(B,o))}}throw r}function Xa({projectId:n}){return`${mS}/projects/${n}/registrations`}async function Za({appConfig:n,installations:e}){const t=await e.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":n.apiKey,"x-goog-firebase-installations-auth":`FIS ${t}`})}function MS(n,e){var t,r;try{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n))return new URL(n).host}catch{}try{if(typeof self<"u"&&((t=self.location)!=null&&t.href))return new URL(n,self.location.origin).host}catch{}return typeof self<"u"&&((r=self.location)!=null&&r.host)?self.location.host:e}function el({p256dh:n,auth:e,endpoint:t,vapidKey:r,swScope:s},i,o){const B={web:{origin:MS(s,i),endpoint:t,auth:e,p256dh:n}};return o&&(B.fcm_sdk_version=Ac),r!==am&&(B.web.applicationPubKey=r),B}/**
4302 * @license
4303 * Copyright 2019 Google LLC
4304 *
4305 * Licensed under the Apache License, Version 2.0 (the "License");
4306 * you may not use this file except in compliance with the License.
4307 * You may obtain a copy of the License at
4308 *
4309 *   http://www.apache.org/licenses/LICENSE-2.0
4310 *
4311 * Unless required by applicable law or agreed to in writing, software
4312 * distributed under the License is distributed on an "AS IS" BASIS,
4313 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4314 * See the License for the specific language governing permissions and
4315 * limitations under the License.
4316 */const GS=7*24*60*60*1e3;async function US(n){const e=await qS(n.swRegistration,n.vapidKey),t={vapidKey:n.vapidKey,swScope:n.swRegistration.scope,endpoint:e.endpoint,auth:Vt(e.getKey("auth")),p256dh:Vt(e.getKey("p256dh"))},r=await vS(n.firebaseDependencies);if(r){if(JS(r.subscriptionOptions,t))return Date.now()>=r.createTime+GS?HS(n,{token:r.token,createTime:Date.now(),subscriptionOptions:t}):r.token;try{await VS(n.firebaseDependencies,r.token)}catch(s){console.warn(s)}return Ed(n.firebaseDependencies,t)}else return Ed(n.firebaseDependencies,t)}async function HS(n,e){try{const t=await kS(n.firebaseDependencies,e),r={...e,token:t,createTime:Date.now()};return await Zu(n.firebaseDependencies,r),t}catch(t){throw t}}async function Ed(n,e){const r={token:await OS(n,e),createTime:Date.now(),subscriptionOptions:e};return await Zu(n,r),r.token}async function qS(n,e){const t=await n.pushManager.getSubscription();return t||n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:cm(e)})}function JS(n,e){const t=e.vapidKey===n.vapidKey,r=e.endpoint===n.endpoint,s=e.auth===n.auth,i=e.p256dh===n.p256dh;return t&&r&&s&&i}function jS(n,e){const t=n.onRegisteredHandler;t&&(typeof t=="function"?t(e):t.next(e))}/**
4317 * @license
4318 * Copyright 2020 Google LLC
4319 *
4320 * Licensed under the Apache License, Version 2.0 (the "License");
4321 * you may not use this file except in compliance with the License.
4322 * You may obtain a copy of the License at
4323 *
4324 *   http://www.apache.org/licenses/LICENSE-2.0
4325 *
4326 * Unless required by applicable law or agreed to in writing, software
4327 * distributed under the License is distributed on an "AS IS" BASIS,
4328 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4329 * See the License for the specific language governing permissions and
4330 * limitations under the License.
4331 */async function KS(n){try{n.swRegistration=await navigator.serviceWorker.register(pS,{scope:gS}),n.swRegistration.update().catch(()=>{}),await zS(n.swRegistration)}catch(e){throw me.create("failed-service-worker-registration",{browserErrorMessage:e==null?void 0:e.message})}}async function zS(n){return new Promise((e,t)=>{const r=setTimeout(()=>t(new Error(`Service worker not registered after ${ud} ms`)),ud),s=n.installing||n.waiting;n.active?(clearTimeout(r),e()):s?s.onstatechange=i=>{var o;((o=i.target)==null?void 0:o.state)==="activated"&&(s.onstatechange=null,clearTimeout(r),e())}:(clearTimeout(r),t(new Error("No incoming service worker found.")))})}/**
4332 * @license
4333 * Copyright 2020 Google LLC
4334 *
4335 * Licensed under the Apache License, Version 2.0 (the "License");
4336 * you may not use this file except in compliance with the License.
4337 * You may obtain a copy of the License at
4338 *
4339 *   http://www.apache.org/licenses/LICENSE-2.0
4340 *
4341 * Unless required by applicable law or agreed to in writing, software
4342 * distributed under the License is distributed on an "AS IS" BASIS,
4343 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4344 * See the License for the specific language governing permissions and
4345 * limitations under the License.
4346 */async function fm(n,e){if(!e&&!n.swRegistration&&await KS(n),!(!e&&n.swRegistration)){if(!(e instanceof ServiceWorkerRegistration))throw me.create("invalid-sw-registration");n.swRegistration=e}}/**
4347 * @license
4348 * Copyright 2020 Google LLC
4349 *
4350 * Licensed under the Apache License, Version 2.0 (the "License");
4351 * you may not use this file except in compliance with the License.
4352 * You may obtain a copy of the License at
4353 *
4354 *   http://www.apache.org/licenses/LICENSE-2.0
4355 *
4356 * Unless required by applicable law or agreed to in writing, software
4357 * distributed under the License is distributed on an "AS IS" BASIS,
4358 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4359 * See the License for the specific language governing permissions and
4360 * limitations under the License.
4361 */async function dm(n,e){e?n.vapidKey=e:n.vapidKey||(n.vapidKey=am)}/**
4362 * @license
4363 * Copyright 2020 Google LLC
4364 *
4365 * Licensed under the Apache License, Version 2.0 (the "License");
4366 * you may not use this file except in compliance with the License.
4367 * You may obtain a copy of the License at
4368 *
4369 *   http://www.apache.org/licenses/LICENSE-2.0
4370 *
4371 * Unless required by applicable law or agreed to in writing, software
4372 * distributed under the License is distributed on an "AS IS" BASIS,
4373 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4374 * See the License for the specific language governing permissions and
4375 * limitations under the License.
4376 */const _d=3;async function WS(n,e){const t=await $S(n.swRegistration,n.vapidKey),r={vapidKey:n.vapidKey,swScope:n.swRegistration.scope,endpoint:t.endpoint,auth:Vt(t.getKey("auth")),p256dh:Vt(t.getKey("p256dh"))},s=n.firebaseDependencies.installations;for(let i=0;i<_d;i++){const{responseFid:o}=await NS(n.firebaseDependencies,r);if(o===e)return;i<_d-1&&await s.getToken(!0)}throw me.create("fid-registration-failed",{errorInfo:"CreateRegistration response FID does not match Firebase Installation ID"})}async function $S(n,e){const t=await n.pushManager.getSubscription();return t||n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:cm(e)})}/**
4377 * @license
4378 * Copyright 2020 Google LLC
4379 *
4380 * Licensed under the Apache License, Version 2.0 (the "License");
4381 * you may not use this file except in compliance with the License.
4382 * You may obtain a copy of the License at
4383 *
4384 *   http://www.apache.org/licenses/LICENSE-2.0
4385 *
4386 * Unless required by applicable law or agreed to in writing, softw
4386are
4387 * distributed under the License is distributed on an "AS IS" BASIS,
4388 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4389 * See the License for the specific language governing permissions and
4390 * limitations under the License.
4391 */const QS=7*24*60*60*1e3;async function Cm(n,e){if(!navigator)throw me.create("only-available-in-window");if(Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission!=="granted")throw me.create("permission-blocked");if(!n.onRegisteredHandler)throw me.create("invalid-on-registered-handler");await dm(n,e==null?void 0:e.vapidKey),await fm(n,e==null?void 0:e.serviceWorkerRegistration);const t=n._registerNotifyChain.catch(()=>{});return n._registerNotifyChain=t.then(async()=>{const r=await n.firebaseDependencies.installations.getId(),s=await hm(n.firebaseDependencies),i=Date.now();if((!s||s.fid!==r||i>=s.lastRegisterTime+QS)&&(await WS(n,r),await bS(n.firebaseDependencies,{fid:r,lastRegisterTime:i,vapidKey:n.vapidKey})),!n.onRegisteredHandler)throw me.create("invalid-on-registered-handler");jS(n,r)}),n._registerNotifyChain}/**
4392 * @license
4393 * Copyright 2026 Google LLC
4394 *
4395 * Licensed under the Apache License, Version 2.0 (the "License");
4396 * you may not use this file except in compliance with the License.
4397 * You may obtain a copy of the License at
4398 *
4399 *   http://www.apache.org/licenses/LICENSE-2.0
4400 *
4401 * Unless required by applicable law or agreed to in writing, software
4402 * distributed under the License is distributed on an "AS IS" BASIS,
4403 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4404 * See the License for the specific language governing permissions and
4405 * limitations under the License.
4406 */function YS(n,e){return uS(e,()=>{(async()=>!n.onRegisteredHandler||!await hm(n.firebaseDependencies)||await Cm(n).catch(()=>{}))()})}/**
4407 * @license
4408 * Copyright 2020 Google LLC
4409 *
4410 * Licensed under the Apache License, Version 2.0 (the "License");
4411 * you may not use this file except in compliance with the License.
4412 * You may obtain a copy of the License at
4413 *
4414 *   http://www.apache.org/licenses/LICENSE-2.0
4415 *
4416 * Unless required by applicable law or agreed to in writing, software
4417 * distributed under the License is distributed on an "AS IS" BASIS,
4418 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4419 * See the License for the specific language governing permissions and
4420 * limitations under the License.
4421 */function Dd(n){const e={from:n.from,collapseKey:n.collapse_key,messageId:n.fcmMessageId};return XS(e,n),ZS(e,n),eP(e,n),e}function XS(n,e){if(!e.notification)return;n.notification={};const t=e.notification.title;t&&(n.notification.title=t);const r=e.notification.body;r&&(n.notification.body=r);const s=e.notification.image;s&&(n.notification.image=s);const i=e.notification.icon;i&&(n.notification.icon=i)}function ZS(n,e){e.data&&(n.data=e.data)}function eP(n,e){var s,i,o,B;if(!e.fcmOptions&&!((s=e.notification)!=null&&s.click_action))return;n.fcmOptions={};const t=((i=e.fcmOptions)==null?void 0:i.link)??((o=e.notification)==null?void 0:o.click_action);t&&(n.fcmOptions.link=t);const r=(B=e.fcmOptions)==null?void 0:B.analytics_label;r&&(n.fcmOptions.analyticsLabel=r)}/**
4422 * @license
4423 * Copyright 2019 Google LLC
4424 *
4425 * Licensed under the Apache License, Version 2.0 (the "License");
4426 * you may not use this file except in compliance with the License.
4427 * You may obtain a copy of the License at
4428 *
4429 *   http://www.apache.org/licenses/LICENSE-2.0
4430 *
4431 * Unless required by applicable law or agreed to in writing, software
4432 * distributed under the License is distributed on an "AS IS" BASIS,
4433 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4434 * See the License for the specific language governing permissions and
4435 * limitations under the License.
4436 */function tP(n){return typeof n=="object"&&!!n&&Bm in n}/**
4437 * @license
4438 * Copyright 2019 Google LLC
4439 *
4440 * Licensed under the Apache License, Version 2.0 (the "License");
4441 * you may not use this file except in compliance with the License.
4442 * You may obtain a copy of the License at
4443 *
4444 *   http://www.apache.org/licenses/LICENSE-2.0
4445 *
4446 * Unless required by applicable law or agreed to in writing, softw
4446are
4447 * distributed under the License is distributed on an "AS IS" BASIS,
4448 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4449 * See the License for the specific language governing permissions and
4450 * limitations under the License.
4451 */function nP(n){if(!n||!n.options)throw WB("App Configuration Object");if(!n.name)throw WB("App Name");const e=["projectId","apiKey","appId","messagingSenderId"],{options:t}=n;for(const r of e)if(!t[r])throw WB(r);return{appName:n.name,projectId:t.projectId,apiKey:t.apiKey,appId:t.appId,senderId:t.messagingSenderId}}function WB(n){return me.create("missing-app-config-values",{valueName:n})}/**
4452 * @license
4453 * Copyright 2020 Google LLC
4454 *
4455 * Licensed under the Apache License, Version 2.0 (the "License");
4456 * you may not use this file except in compliance with the License.
4457 * You may obtain a copy of the License at
4458 *
4459 *   http://www.apache.org/licenses/LICENSE-2.0
4460 *
4461 * Unless required by applicable law or agreed to in writing, software
4462 * distributed under the License is distributed on an "AS IS" BASIS,
4463 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4464 * See the License for the specific language governing permissions and
4465 * limitations under the License.
4466 */class rP{constructor(e,t,r){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.onRegisteredHandler=null,this.onUnregisteredHandler=null,this._registerNotifyChain=Promise.resolve(),this._fidChangeUnsubscribe=null,this.logEvents=[],this.logQueue={state:"stopped"};const s=nP(e);this.firebaseDependencies={app:e,appConfig:s,installations:t,analyticsProvider:r}}_delete(){return this._fidChangeUnsubscribe&&(this._fidChangeUnsubscribe(),this._fidChangeUnsubscribe=null),this.logQueue.state==="scheduled"&&clearTimeout(this.logQueue.timerId),this.logQueue={state:"stopped"},Promise.resolve()}}/**
4467 * @license
4468 * Copyright 2020 Google LLC
4469 *
4470 * Licensed under the Apache License, Version 2.0 (the "License");
4471 * you may not use this file except in compliance with the License.
4472 * You may obtain a copy of the License at
4473 *
4474 *   http://www.apache.org/licenses/LICENSE-2.0
4475 *
4476 * Unless required by applicable law or agreed to in writing, software
4477 * distributed under the License is distributed on an "AS IS" BASIS,
4478 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4479 * See the License for the specific language governing permissions and
4480 * limitations under the License.
4481 */async function pm(n,e){if(!navigator)throw me.create("only-available-in-window");if(Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission!=="granted")throw me.create("permission-blocked");return await dm(n,e==null?void 0:e.vapidKey),await fm(n,e==null?void 0:e.serviceWorkerRegistration),US(n)}/**
4482 * @license
4483 * Copyright 2019 Google LLC
4484 *
4485 * Licensed under the Apache License, Version 2.0 (the "License");
4486 * you may not use this file except in compliance with the License.
4487 * You may obtain a copy of the License at
4488 *
4489 *   http://www.apache.org/licenses/LICENSE-2.0
4490 *
4491 * Unless required by applicable law or agreed to in writing, software
4492 * distributed under the License is distributed on an "AS IS" BASIS,
4493 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4494 * See the License for the specific language governing permissions and
4495 * limitations under the License.
4496 */async function sP(n,e,t){const r=iP(e);(await n.firebaseDependencies.analyticsProvider.get()).logEvent(r,{message_id:t[Bm],message_name:t[ES],message_time:t[_S],message_device_time:Math.floor(Date.now()/1e3)})}function iP(n){switch(n){case gs.NOTIFICATION_CLICKED:return"notification_open";case gs.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}/**
4497 * @license
4498 * Copyright 2017 Google LLC
4499 *
4500 * Licensed under the Apache License, Version 2.0 (the "License");
4501 * you may not use this file except in compliance with the License.
4502 * You may obtain a copy of the License at
4503 *
4504 *   http://www.apache.org/licenses/LICENSE-2.0
4505 *
4506 * Unless required by applicable law or agreed to in writing, softw
4506are
4507 * distributed under the License is distributed on an "AS IS" BASIS,
4508 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4509 * See the License for the specific language governing permissions and
4510 * limitations under the License.
4511 */async function oP(n,e){const t=e.data;if(!t.isFirebaseMessaging)return;if(n.onMessageHandler&&t.messageType===gs.PUSH_RECEIVED&&(typeof n.onMessageHandler=="function"?n.onMessageHandler(Dd(t)):n.onMessageHandler.next(Dd(t))),n.onRegisteredHandler&&t.messageType===gs.FID_REGISTERED){const s=t.fid;typeof n.onRegisteredHandler=="function"?n.onRegisteredHandler(s):n.onRegisteredHandler.next(s)}const r=t.data;tP(r)&&r[DS]==="1"&&await sP(n,t.messageType,r)}/**
4512 * @license
4513 * Copyright 2020 Google LLC
4514 *
4515 * Licensed under the Apache License, Version 2.0 (the "License");
4516 * you may not use this file except in compliance with the License.
4517 * You may obtain a copy of the License at
4518 *
4519 *   http://www.apache.org/licenses/LICENSE-2.0
4520 *
4521 * Unless required by applicable law or agreed to in writing, software
4522 * distributed under the License is distributed on an "AS IS" BASIS,
4523 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4524 * See the License for the specific language governing permissions and
4525 * limitations under the License.
4526 */const aP=n=>{const e=new rP(n.getProvider("app").getImmediate(),n.getProvider("installations-internal").getImmediate(),n.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",t=>oP(e,t)),e._fidChangeUnsubscribe=YS(e,n.getProvider("installations").getImmediate()),e},BP=n=>{const e=n.getProvider("messaging").getImmediate();return{getToken:r=>pm(e,r),register:r=>Cm(e,r)}};function cP(){Ot(new Rt("messaging",aP,"PUBLIC")),Ot(new Rt("messaging-internal",BP,"PRIVATE")),Ze(gd,Ac),Ze(gd,Ac,"esm2020")}/**
4527 * @license
4528 * Copyright 2020 Google LLC
4529 *
4530 * Licensed under the Apache License, Version 2.0 (the "License");
4531 * you may not use this file except in compliance with the License.
4532 * You may obtain a copy of the License at
4533 *
4534 *   http://www.apache.org/licenses/LICENSE-2.0
4535 *
4536 * Unless required by applicable law or agreed to in writing, software
4537 * distributed under the License is distributed on an "AS IS" BASIS,
4538 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4539 * See the License for the specific language governing permissions and
4540 * limitations under the License.
4541 */async function uP(){try{await bd()}catch{return!1}return typeof window<"u"&&vd()&&dE()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}/**
4542 * @license
4543 * Copyright 2017 Google LLC
4544 *
4545 * Licensed under the Apache License, Version 2.0 (the "License");
4546 * you may not use this file except in compliance with the License.
4547 * You may obtain a copy of the License at
4548 *
4549 *   http://www.apache.org/licenses/LICENSE-2.0
4550 *
4551 * Unless required by applicable law or agreed to in writing, software
4552 * distributed under the License is distributed on an "AS IS" BASIS,
4553 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4554 * See the License for the specific language governing permissions and
4555 * limitations under the License.
4556 */function o0(n=ga()){return uP().then(e=>{if(!e)throw me.create("unsupported-browser")},e=>{throw me.create("indexed-db-unsupported")}),kr(fe(n),"messaging").getImmediate()}async function a0(n,e){return n=fe(n),pm(n,e)}/**
4557 * @license
4558 * Copyright 2017 Google LLC
4559 *
4560 * Licensed under the Apache License, Version 2.0 (the "License");
4561 * you may not use this file except in compliance with the License.
4562 * You may obtain a copy of the License at
4563 *
4564 *   http://www.apache.org/licenses/LICENSE-2.0
4565 *
4566 * Unless required by applicable law or agreed to in writing, software
4567 * distributed under the License is distributed on an "AS IS" BASIS,
4568 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4569 * See the License for the specific language governing permissions and
4570 * limitations under the License.
4571 */cP();export{SP as A,kP as B,MP as C,xP as D,$P as E,qP as F,kn as G,VP as H,QP as I,GP as J,KP as K,zP as L,UP as M,uP as N,Po as O,a0 as P,o0 as Q,PP as R,OP as S,WP as T,ge as U,fP as V,ms as W,yP as X,HP as Y,bP as Z,JP as _,hP as a,n0 as b,s0 as c,TP as d,DP as e,_P as f,LP as g,dP as h,m_ as i,wP as j,gP as k,jP as l,$I as m,CP as n,pP as o,IP as p,mP as q,vP as r,EP as s,r0 as t,t0 as u,XP as v,ZP as w,e0 as x,YP as y,i0 as z};

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.