var Ok=Object.defineProperty;var Dk=(jn,mt,Ht)=>mt in jn?Ok(jn,mt,{enumerable:!0,configurable:!0,writable:!0,value:Ht}):jn[mt]=Ht;var ai=(jn,mt,Ht)=>(Dk(jn,typeof mt!="symbol"?mt+"":mt,Ht),Ht);(function(){"use strict";function jn(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var mt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ht(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Hv(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){if(this instanceof r){var i=[null];i.push.apply(i,arguments);var s=Function.bind.apply(e,i);return new s}return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var Nf={exports:{}},X={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ui=Symbol.for("react.element"),Vv=Symbol.for("react.portal"),Wv=Symbol.for("react.fragment"),qv=Symbol.for("react.strict_mode"),Kv=Symbol.for("react.profiler"),Gv=Symbol.for("react.provider"),Yv=Symbol.for("react.context"),Qv=Symbol.for("react.forward_ref"),Xv=Symbol.for("react.suspense"),Jv=Symbol.for("react.memo"),Zv=Symbol.for("react.lazy"),bf=Symbol.iterator;function e0(t){return t===null||typeof t!="object"?null:(t=bf&&t[bf]||t["@@iterator"],typeof t=="function"?t:null)}var Rf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Of=Object.assign,Df={};function pr(t,e,n){this.props=t,this.context=e,this.refs=Df,this.updater=n||Rf}pr.prototype.isReactComponent={},pr.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")},pr.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Lf(){}Lf.prototype=pr.prototype;function zl(t,e,n){this.props=t,this.context=e,this.refs=Df,this.updater=n||Rf}var jl=zl.prototype=new Lf;jl.constructor=zl,Of(jl,pr.prototype),jl.isPureReactComponent=!0;var Af=Array.isArray,Mf=Object.prototype.hasOwnProperty,Ul={current:null},Ff={key:!0,ref:!0,__self:!0,__source:!0};function zf(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Mf.call(e,r)&&!Ff.hasOwnProperty(r)&&(i[r]=e[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1{e.text().then(i=>{const s=i&&JSON.parse(i);if(!e.ok){const l={...s||e.statusText,status:e.status};r(l)}n(s)})})}setToken(e,n=!1){this.token=e,this.internalToken=n}setCustomer(e){this._customerId=e}withHeaders(e){return this._headers={...this._headers,...e},this}_getHeaders(){const e={Accept:"application/json","Content-Type":"text/plain",...this._headers};return this.token&&(e[this.internalToken?"mimo-auth":"Authorization"]=this.internalToken?this.token:`Bearer ${this.token}`),this._customerId&&(e["mls-sci"]=`${this._customerId}`),e}}function o0(){return F.useContext(Uf)}const Uf=F.createContext({});function l0({token:t,children:e}){const[n,r]=F.useState(null),i=new s0(t);return F.useState(()=>{r({setCustomer:s=>i.setCustomer(s),withHeaders:s=>i.withHeaders(s),get:s=>i.get(s),put:(s,o)=>i.put(s,o),post:(s,o)=>i.post(s,o),patch:(s,o)=>i.patch(s,o),delete:s=>i.delete(s),custom:(s,o,l)=>i.custom(s,o,l)})}),L.createElement(Uf.Provider,{value:n},n&&e)}const a0={debug:!1,liveId:"live-id-not-set",customerId:"customer-id-not-set",useShadowDom:!0,configEndpoint:"https://api.mimolivesales.com.br/api/(MIMO_API_VERSION)/live/pip/config"},u0={appId:"1:368197137365:web:6b2816f0fd8b3d73c1835c".trim(),apiKey:"AIzaSyChxX_0Sirr6HwFIc8ggyFy5M8aAmVI4QU".trim(),projectId:"mimo-live---prod-3-1601a".trim(),authDomain:"mimo-live---prod-3-1601a.firebaseapp.com".trim(),databaseURL:"https://mimo-live---prod-3-1601a-default-rtdb.firebaseio.com".trim(),storageBucket:"mimo-live---prod-3-1601a.firebasestorage.app".trim(),messagingSenderId:"368197137365".trim()},c0={MIMO_API_VERSION:"v2"},Un={"tag-dark":{bg:"#18191A",txt:"#FFFFFF",icon:"#FF3354",cta_icon:"#FFFFFF"},"tag-light":{bg:"#FFFFFF",txt:"#000000",icon:"#FF3354",cta_icon:"#FF3354"},"tag-red":{bg:"#FF3354",txt:"#FFFFFF",icon:"#FFFFFF",cta_icon:"#FFFFFF"}};function f0(t,e){return Object.keys(e).reduce((n,r)=>n.split("("+r+")").join(e[r].toString()),t)}function d0(t,e){let n=f0(t,c0),r=!0;for(const i in e)if(e[i]){const s=e[i].toString();s.includes("not-set")||(r?(n+="?",r=!1):n+="&",n+=encodeURIComponent(i)+"="+encodeURIComponent(s))}return n}const $f=F.createContext({configEndpoint:"configEndpoint-not-set",debug:!1,liveId:"live-id-not-set",customerId:"customer-id-not-set",useShadowDom:!0});function h0(t){return L.createElement($f.Provider,{value:t.options},t.children)}const Bf=function(){return F.useContext($f)};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Hf={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const M=function(t,e){if(!t)throw mr(e)},mr=function(t){return new Error("Firebase Database ("+Hf.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Vf=function(t){const e=[];let n=0;for(let r=0;r>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},p0=function(t){const e=[];let n=0,r=0;for(;n191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=t[n++],o=t[n++],l=t[n++],a=((i&7)<<18|(s&63)<<12|(o&63)<<6|l&63)-65536;e[r++]=String.fromCharCode(55296+(a>>10)),e[r++]=String.fromCharCode(56320+(a&1023))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},Hl={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(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i>2,c=(s&3)<<4|l>>4;let f=(l&15)<<2|u>>6,p=u&63;a||(p=64,o||(f=64)),r.push(n[d],n[c],n[f],n[p])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Vf(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):p0(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i>4;if(r.push(f),u!==64){const p=l<<4&240|u>>2;if(r.push(p),c!==64){const y=u<<6&192|c;r.push(y)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class m0 extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Wf=function(t){const e=Vf(t);return Hl.encodeByteArray(e,!0)},Ds=function(t){return Wf(t).replace(/\./g,"")},Vl=function(t){try{return Hl.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function g0(t){return qf(void 0,t)}function qf(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:const n=e;return new Date(n.getTime());case Object:t===void 0&&(t={});break;case Array:t=[];break;default:return e}for(const n in e)!e.hasOwnProperty(n)||!y0(n)||(t[n]=qf(t[n],e[n]));return t}function y0(t){return t!=="__proto__"}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function v0(){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.")}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const _0=()=>v0().__FIREBASE_DEFAULTS__,w0=()=>{if(typeof process>"u"||typeof process.env>"u")return;const t={}.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},S0=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&Vl(t[1]);return e&&JSON.parse(e)},Kf=()=>{try{return _0()||w0()||S0()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},E0=t=>{var e,n;return(n=(e=Kf())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[t]},C0=t=>{const e=E0(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),r]:[e.substring(0,n),r]},Gf=()=>{var t;return(t=Kf())===null||t===void 0?void 0:t.config};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Wl{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function x0(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},r=e||"demo-project",i=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},t),l="";return[Ds(JSON.stringify(n)),Ds(JSON.stringify(o)),l].join(".")}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function k0(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Yf(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(k0())}function T0(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Qf(){return Hf.NODE_ADMIN===!0}function I0(){try{return typeof indexedDB=="object"}catch{return!1}}function P0(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const N0="FirebaseError";class ci extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=N0,Object.setPrototypeOf(this,ci.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Xf.prototype.create)}}class Xf{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?b0(s,r):"Error",l=`${this.serviceName}: ${o} (${i}).`;return new ci(i,l,r)}}function b0(t,e){return t.replace(R0,(n,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const R0=/\{\$([^}]+)}/g;/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function fi(t){return JSON.parse(t)}function Te(t){return JSON.stringify(t)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Jf=function(t){let e={},n={},r={},i="";try{const s=t.split(".");e=fi(Vl(s[0])||""),n=fi(Vl(s[1])||""),i=s[2],r=n.d||{},delete n.d}catch{}return{header:e,claims:n,data:r,signature:i}},O0=function(t){const e=Jf(t),n=e.claims;return!!n&&typeof n=="object"&&n.hasOwnProperty("iat")},D0=function(t){const e=Jf(t).claims;return typeof e=="object"&&e.admin===!0};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Vt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function gr(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]}function Zf(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Ls(t,e,n){const r={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=e.call(n,t[i],i,t));return r}function ql(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const s=t[i],o=e[i];if(ed(s)&&ed(o)){if(!ql(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function ed(t){return t!==null&&typeof t=="object"}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function L0(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class A0{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let e=1;e>>31)&4294967295}let i=this.chain_[0],s=this.chain_[1],o=this.chain_[2],l=this.chain_[3],a=this.chain_[4],u,d;for(let c=0;c<80;c++){c<40?c<20?(u=l^s&(o^l),d=1518500249):(u=s^o^l,d=1859775393):c<60?(u=s&o|l&(s|o),d=2400959708):(u=s^o^l,d=3395469782);const f=(i<<5|i>>>27)+u+a+d+r[c]&4294967295;a=l,l=o,o=(s<<30|s>>>2)&4294967295,s=i,i=f}this.chain_[0]=this.chain_[0]+i&4294967295,this.chain_[1]=this.chain_[1]+s&4294967295,this.chain_[2]=this.chain_[2]+o&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+a&4294967295}update(e,n){if(e==null)return;n===void 0&&(n=e.length);const r=n-this.blockSize;let i=0;const s=this.buf_;let o=this.inbuf_;for(;i=56;i--)this.buf_[i]=n&255,n/=256;this.compress_(this.buf_);let r=0;for(let i=0;i<5;i++)for(let s=24;s>=0;s-=8)e[r]=this.chain_[i]>>s&255,++r;return e}}function td(t,e){return`${t} failed: ${e} argument `}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const M0=function(t){const e=[];let n=0;for(let r=0;r=55296&&i<=56319){const s=i-55296;r++,M(r>6|192,e[n++]=i&63|128):i<65536?(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},As=function(t){let e=0;for(let n=0;n=55296&&r<=56319?(e+=4,n++):e+=3}return e};/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Ms(t){return t&&t._delegate?t._delegate:t}class di{constructor(e,n,r){this.name=e,this.instanceFactory=n,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}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const $n="[DEFAULT]";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class F0{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new Wl;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),i=(n=e==null?void 0:e.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(s){if(i)return null;throw s}else{if(i)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(j0(e))try{this.getOrInitializeService({instanceIdentifier:$n})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(n);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=$n){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(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=$n){return this.instances.has(e)}getOptions(e=$n){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=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 i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[s,o]of this.instancesDeferred.entries()){const l=this.normalizeInstanceIdentifier(s);r===l&&o.resolve(i)}return i}onInit(e,n){var r;const i=this.normalizeInstanceIdentifier(n),s=(r=this.onInitCallbacks.get(i))!==null&&r!==void 0?r:new Set;s.add(e),this.onInitCallbacks.set(i,s);const o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:z0(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=$n){return this.component?this.component.multipleInstances?e:$n:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function z0(t){return t===$n?void 0:t}function j0(t){return t.instantiationMode==="EAGER"}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class U0{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.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 n=new F0(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */var le;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(le||(le={}));const $0={debug:le.DEBUG,verbose:le.VERBOSE,info:le.INFO,warn:le.WARN,error:le.ERROR,silent:le.SILENT},B0=le.INFO,H0={[le.DEBUG]:"log",[le.VERBOSE]:"log",[le.INFO]:"info",[le.WARN]:"warn",[le.ERROR]:"error"},V0=(t,e,...n)=>{if(ee.some(n=>t instanceof n);let rd,id;function q0(){return rd||(rd=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function K0(){return id||(id=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const sd=new WeakMap,Kl=new WeakMap,od=new WeakMap,Gl=new WeakMap,Yl=new WeakMap;function G0(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(un(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&sd.set(n,t)}).catch(()=>{}),Yl.set(e,t),e}function Y0(t){if(Kl.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});Kl.set(t,e)}let Ql={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Kl.get(t);if(e==="objectStoreNames")return t.objectStoreNames||od.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return un(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function Q0(t){Ql=t(Ql)}function X0(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(Xl(this),e,...n);return od.set(r,e.sort?e.sort():[e]),un(r)}:K0().includes(t)?function(...e){return t.apply(Xl(this),e),un(sd.get(this))}:function(...e){return un(t.apply(Xl(this),e))}}function J0(t){return typeof t=="function"?X0(t):(t instanceof IDBTransaction&&Y0(t),W0(t,q0())?new Proxy(t,Ql):t)}function un(t){if(t instanceof IDBRequest)return G0(t);if(Gl.has(t))return Gl.get(t);const e=J0(t);return e!==t&&(Gl.set(t,e),Yl.set(e,t)),e}const Xl=t=>Yl.get(t);function Z0(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),l=un(o);return r&&o.addEventListener("upgradeneeded",a=>{r(un(o.result),a.oldVersion,a.newVersion,un(o.transaction),a)}),n&&o.addEventListener("blocked",a=>n(a.oldVersion,a.newVersion,a)),l.then(a=>{s&&a.addEventListener("close",()=>s()),i&&a.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),l}const e_=["get","getKey","getAll","getAllKeys","count"],t_=["put","add","delete","clear"],Jl=new Map;function ld(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Jl.get(e))return Jl.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=t_.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||e_.includes(n)))return;const s=async function(o,...l){const a=this.transaction(o,i?"readwrite":"readonly");let u=a.store;return r&&(u=u.index(l.shift())),(await Promise.all([u[n](...l),i&&a.done]))[0]};return Jl.set(e,s),s}Q0(t=>({...t,get:(e,n,r)=>ld(e,n)||t.get(e,n,r),has:(e,n)=>!!ld(e,n)||t.has(e,n)}));/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class n_{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(r_(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function r_(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Zl="@firebase/app",ad="0.9.12";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Bn=new nd("@firebase/app"),i_="@firebase/app-compat",s_="@firebase/analytics-compat",o_="@firebase/analytics",l_="@firebase/app-check-compat",a_="@firebase/app-check",u_="@firebase/auth",c_="@firebase/auth-compat",f_="@firebase/database",d_="@firebase/database-compat",h_="@firebase/functions",p_="@firebase/functions-compat",m_="@firebase/installations",g_="@firebase/installations-compat",y_="@firebase/messaging",v_="@firebase/messaging-compat",__="@firebase/performance",w_="@firebase/performance-compat",S_="@firebase/remote-config",E_="@firebase/remote-config-compat",C_="@firebase/storage",x_="@firebase/storage-compat",k_="@firebase/firestore",T_="@firebase/firestore-compat",I_="firebase",P_="9.22.2";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ea="[DEFAULT]",N_={[Zl]:"fire-core",[i_]:"fire-core-compat",[o_]:"fire-analytics",[s_]:"fire-analytics-compat",[a_]:"fire-app-check",[l_]:"fire-app-check-compat",[u_]:"fire-auth",[c_]:"fire-auth-compat",[f_]:"fire-rtdb",[d_]:"fire-rtdb-compat",[h_]:"fire-fn",[p_]:"fire-fn-compat",[m_]:"fire-iid",[g_]:"fire-iid-compat",[y_]:"fire-fcm",[v_]:"fire-fcm-compat",[__]:"fire-perf",[w_]:"fire-perf-compat",[S_]:"fire-rc",[E_]:"fire-rc-compat",[C_]:"fire-gcs",[x_]:"fire-gcs-compat",[k_]:"fire-fst",[T_]:"fire-fst-compat","fire-js":"fire-js",[I_]:"fire-js-all"};/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Fs=new Map,ta=new Map;function b_(t,e){try{t.container.addComponent(e)}catch(n){Bn.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function zs(t){const e=t.name;if(ta.has(e))return Bn.debug(`There were multiple attempts to register component ${e}.`),!1;ta.set(e,t);for(const n of Fs.values())b_(n,t);return!0}function R_(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const O_={["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 options or config",["app-deleted"]:"Firebase App named '{$appName}' already deleted",["no-options"]:"Need to provide options, when not being deployed to hosting via source.",["invalid-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}."},cn=new Xf("app","Firebase",O_);/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class D_{constructor(e,n,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new di("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 cn.create("app-deleted",{appName:this._name})}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const L_=P_;function na(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r=Object.assign({name:ea,automaticDataCollectionEnabled:!1},e),i=r.name;if(typeof i!="string"||!i)throw cn.create("bad-app-name",{appName:String(i)});if(n||(n=Gf()),!n)throw cn.create("no-options");const s=Fs.get(i);if(s){if(ql(n,s.options)&&ql(r,s.config))return s;throw cn.create("duplicate-app",{appName:i})}const o=new U0(i);for(const a of ta.values())o.addComponent(a);const l=new D_(n,r,o);return Fs.set(i,l),l}function ud(t=ea){const e=Fs.get(t);if(!e&&t===ea&&Gf())return na();if(!e)throw cn.create("no-app",{appName:t});return e}function yr(t,e,n){var r;let i=(r=N_[t])!==null&&r!==void 0?r:t;n&&(i+=`-${n}`);const s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const l=[`Unable to register library "${i}" with version "${e}":`];s&&l.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&l.push("and"),o&&l.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Bn.warn(l.join(" "));return}zs(new di(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const A_="firebase-heartbeat-database",M_=1,hi="firebase-heartbeat-store";let ra=null;function cd(){return ra||(ra=Z0(A_,M_,{upgrade:(t,e)=>{switch(e){case 0:t.createObjectStore(hi)}}}).catch(t=>{throw cn.create("idb-open",{originalErrorMessage:t.message})})),ra}async function F_(t){try{return await(await cd()).transaction(hi).objectStore(hi).get(dd(t))}catch(e){if(e instanceof ci)Bn.warn(e.message);else{const n=cn.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Bn.warn(n.message)}}}async function fd(t,e){try{const r=(await cd()).transaction(hi,"readwrite");await r.objectStore(hi).put(e,dd(t)),await r.done}catch(n){if(n instanceof ci)Bn.warn(n.message);else{const r=cn.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Bn.warn(r.message)}}}function dd(t){return`${t.name}!${t.options.appId}`}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const z_=1024,j_=30*24*60*60*1e3;class U_{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new B_(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=hd();if(this._heartbeatsCache===null&&(this._heartbeatsCache=await this._heartbeatsCachePromise),!(this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r)))return this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(i=>{const s=new Date(i.date).valueOf();return Date.now()-s<=j_}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache===null||this._heartbeatsCache.heartbeats.length===0)return"";const e=hd(),{heartbeatsToSend:n,unsentEntries:r}=$_(this._heartbeatsCache.heartbeats),i=Ds(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function hd(){return new Date().toISOString().substring(0,10)}function $_(t,e=z_){const n=[];let r=t.slice();for(const i of t){const s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),pd(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),pd(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class B_{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return I0()?P0().then(()=>!0).catch(()=>!1):!1}async read(){return await this._canUseIndexedDBPromise?await F_(this.app)||{heartbeats:[]}:{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){const i=await this.read();return fd(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){const i=await this.read();return fd(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}}function pd(t){return Ds(JSON.stringify({version:2,heartbeats:t})).length}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function H_(t){zs(new di("platform-logger",e=>new n_(e),"PRIVATE")),zs(new di("heartbeat",e=>new U_(e),"PRIVATE")),yr(Zl,ad,t),yr(Zl,ad,"esm2017"),yr("fire-js","")}H_("");var V_="firebase",W_="9.22.2";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */yr(V_,W_,"app");const md="@firebase/database",gd="0.14.4";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let yd="";function q_(t){yd=t}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class K_{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,n){n==null?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),Te(n))}get(e){const n=this.domStorage_.getItem(this.prefixedName_(e));return n==null?null:fi(n)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class G_{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,n){n==null?delete this.cache_[e]:this.cache_[e]=n}get(e){return Vt(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const vd=function(t){try{if(typeof window<"u"&&typeof window[t]<"u"){const e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new K_(e)}}catch{}return new G_},Hn=vd("localStorage"),ia=vd("sessionStorage");/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const vr=new nd("@firebase/database"),Y_=function(){let t=1;return function(){return t++}}(),_d=function(t){const e=M0(t),n=new A0;n.update(e);const r=n.digest();return Hl.encodeByteArray(r)},pi=function(...t){let e="";for(let n=0;n{document.readyState==="complete"&&n()}),window.attachEvent("onload",n))}},_r="[MIN_NAME]",Wn="[MAX_NAME]",wr=function(t,e){if(t===e)return 0;if(t===_r||e===Wn)return-1;if(e===_r||t===Wn)return 1;{const n=xd(t),r=xd(e);return n!==null?r!==null?n-r===0?t.length-e.length:n-r:-1:r!==null?1:tn?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r};function Qe(t,e){for(const n in t)t.hasOwnProperty(n)&&e(n,t[n])}const Cd=function(t){M(!Sd(t),"Invalid JSON number");const e=11,n=52,r=(1<=Math.pow(2,1-r)?(l=Math.min(Math.floor(Math.log(t)/Math.LN2),r),s=l+r,o=Math.round(t*Math.pow(2,n-l)-Math.pow(2,n))):(s=0,o=Math.round(t/Math.pow(2,1-r-n))));const u=[];for(a=n;a;a-=1)u.push(o%2?1:0),o=Math.floor(o/2);for(a=e;a;a-=1)u.push(s%2?1:0),s=Math.floor(s/2);u.push(i?1:0),u.reverse();const d=u.join("");let c="";for(a=0;a<64;a+=8){let f=parseInt(d.substr(a,8),2).toString(16);f.length===1&&(f="0"+f),c=c+f}return c.toLowerCase()},e1=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},t1=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function n1(t,e){let n="Unknown Error";t==="too_big"?n="The data requested exceeds the maximum size that can be accessed with a single request.":t==="permission_denied"?n="Client doesn't have permission to access the desired data.":t==="unavailable"&&(n="The service is unavailable");const r=new Error(t+" at "+e._path.toString()+": "+n);return r.code=t.toUpperCase(),r}const r1=new RegExp("^-?(0*)\\d{1,10}$"),i1=-2147483648,s1=2147483647,xd=function(t){if(r1.test(t)){const e=Number(t);if(e>=i1&&e<=s1)return e}return null},yi=function(t){try{t()}catch(e){setTimeout(()=>{const n=e.stack||"";throw st("Exception was thrown by user callback.",n),e},Math.floor(0))}},o1=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},vi=function(t,e){const n=setTimeout(t,e);return typeof n=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(n):typeof n=="object"&&n.unref&&n.unref(),n};/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class l1{constructor(e,n){this.appName_=e,this.appCheckProvider=n,this.appCheck=n==null?void 0:n.getImmediate({optional:!0}),this.appCheck||n==null||n.get().then(r=>this.appCheck=r)}getToken(e){return this.appCheck?this.appCheck.getToken(e):new Promise((n,r)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(n,r):n(null)},0)})}addTokenChangeListener(e){var n;(n=this.appCheckProvider)===null||n===void 0||n.get().then(r=>r.addTokenListener(e))}notifyForInvalidToken(){st(`Provided AppCheck credentials for the app named "${this.appName_}" are invalid. This usually indicates your app was not initialized correctly.`)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class a1{constructor(e,n,r){this.appName_=e,this.firebaseOptions_=n,this.authProvider_=r,this.auth_=null,this.auth_=r.getImmediate({optional:!0}),this.auth_||r.onInit(i=>this.auth_=i)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(n=>n&&n.code==="auth/token-not-initialized"?(Me("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(n)):new Promise((n,r)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(n,r):n(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(n=>n.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(n=>n.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',st(e)}}class Sr{constructor(e){this.accessToken=e}getToken(e){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(e){e(this.accessToken)}removeTokenChangeListener(e){}notifyForInvalidToken(){}}Sr.OWNER="owner";/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const la="5",kd="v",Td="s",Id="r",Pd="f",Nd=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,bd="ls",Rd="p",aa="ac",Od="websocket",Dd="long_polling";/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ld{constructor(e,n,r,i,s=!1,o="",l=!1,a=!1){this.secure=n,this.namespace=r,this.webSocketOnly=i,this.nodeAdmin=s,this.persistenceKey=o,this.includeNamespaceInQueryParams=l,this.isUsingEmulator=a,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=Hn.get("host:"+e)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&Hn.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){const e=this.secure?"https://":"http://",n=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${n}`}}function u1(t){return t.host!==t.internalHost||t.isCustomHost()||t.includeNamespaceInQueryParams}function Ad(t,e,n){M(typeof e=="string","typeof type must == string"),M(typeof n=="object","typeof params must == object");let r;if(e===Od)r=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else if(e===Dd)r=(t.secure?"https://":"http://")+t.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+e);u1(t)&&(n.ns=t.namespace);const i=[];return Qe(n,(s,o)=>{i.push(s+"="+o)}),r+i.join("&")}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class c1{constructor(){this.counters_={}}incrementCounter(e,n=1){Vt(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=n}get(){return g0(this.counters_)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ua={},ca={};function fa(t){const e=t.toString();return ua[e]||(ua[e]=new c1),ua[e]}function f1(t,e){const n=t.toString();return ca[n]||(ca[n]=e()),ca[n]}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class d1{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,n){this.closeAfterResponse=e,this.onClose=n,this.closeAfterResponse{this.onMessage_(r[i])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Md="start",h1="close",p1="pLPCommand",m1="pRTLPCB",Fd="id",zd="pw",jd="ser",g1="cb",y1="seg",v1="ts",_1="d",w1="dframe",Ud=1870,$d=30,S1=Ud-$d,E1=25e3,C1=3e4;class Er{constructor(e,n,r,i,s,o,l){this.connId=e,this.repoInfo=n,this.applicationId=r,this.appCheckToken=i,this.authToken=s,this.transportSessionId=o,this.lastSessionId=l,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=mi(e),this.stats_=fa(n),this.urlFn=a=>(this.appCheckToken&&(a[aa]=this.appCheckToken),Ad(n,Dd,a))}open(e,n){this.curSegmentNum=0,this.onDisconnect_=n,this.myPacketOrderer=new d1(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(C1)),J_(()=>{if(this.isClosed_)return;this.scriptTagHolder=new da((...s)=>{const[o,l,a,u,d]=s;if(this.incrementIncomingBytes_(s),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,o===Md)this.id=l,this.password=a;else if(o===h1)l?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(l,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+o)},(...s)=>{const[o,l]=s;this.incrementIncomingBytes_(s),this.myPacketOrderer.handleResponse(o,l)},()=>{this.onClosed_()},this.urlFn);const r={};r[Md]="t",r[jd]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(r[g1]=this.scriptTagHolder.uniqueCallbackIdentifier),r[kd]=la,this.transportSessionId&&(r[Td]=this.transportSessionId),this.lastSessionId&&(r[bd]=this.lastSessionId),this.applicationId&&(r[Rd]=this.applicationId),this.appCheckToken&&(r[aa]=this.appCheckToken),typeof location<"u"&&location.hostname&&Nd.test(location.hostname)&&(r[Id]=Pd);const i=this.urlFn(r);this.log_("Connecting via long-poll to "+i),this.scriptTagHolder.addTag(i,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){Er.forceAllow_=!0}static forceDisallow(){Er.forceDisallow_=!0}static isAvailable(){return Er.forceAllow_?!0:!Er.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!e1()&&!t1()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){const n=Te(e);this.bytesSent+=n.length,this.stats_.incrementCounter("bytes_sent",n.length);const r=Wf(n),i=Ed(r,S1);for(let s=0;sdocument.domain="'+document.domain+'";<\/script>');const o=""+s+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(o),this.myIFrame.doc.close()}catch(l){Me("frame writing exception"),l.stack&&Me(l.stack),Me(l)}}}static createIFrame_(){const e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||Me("No IE domain setting required")}catch{const r=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+r+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));const e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,n){for(this.myID=e,this.myPW=n,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const e={};e[Fd]=this.myID,e[zd]=this.myPW,e[jd]=this.currentSerial;let n=this.urlFn(e),r="",i=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+$d+r.length<=Ud;){const o=this.pendingSegs.shift();r=r+"&"+y1+i+"="+o.seg+"&"+v1+i+"="+o.ts+"&"+_1+i+"="+o.d,i++}return n=n+r,this.addLongPollTag_(n,this.currentSerial),!0}else return!1}enqueueSegment(e,n,r){this.pendingSegs.push({seg:e,ts:n,d:r}),this.alive&&this.newRequest_()}addLongPollTag_(e,n){this.outstandingRequests.add(n);const r=()=>{this.outstandingRequests.delete(n),this.newRequest_()},i=setTimeout(r,Math.floor(E1)),s=()=>{clearTimeout(i),r()};this.addTag(e,s)}addTag(e,n){setTimeout(()=>{try{if(!this.sendNewPolls)return;const r=this.myIFrame.doc.createElement("script");r.type="text/javascript",r.async=!0,r.src=e,r.onload=r.onreadystatechange=function(){const i=r.readyState;(!i||i==="loaded"||i==="complete")&&(r.onload=r.onreadystatechange=null,r.parentNode&&r.parentNode.removeChild(r),n())},r.onerror=()=>{Me("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(r)}catch{}},Math.floor(1))}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const x1=16384,k1=45e3;let js=null;typeof MozWebSocket<"u"?js=MozWebSocket:typeof WebSocket<"u"&&(js=WebSocket);class Ct{constructor(e,n,r,i,s,o,l){this.connId=e,this.applicationId=r,this.appCheckToken=i,this.authToken=s,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=mi(this.connId),this.stats_=fa(n),this.connURL=Ct.connectionURL_(n,o,l,i,r),this.nodeAdmin=n.nodeAdmin}static connectionURL_(e,n,r,i,s){const o={};return o[kd]=la,typeof location<"u"&&location.hostname&&Nd.test(location.hostname)&&(o[Id]=Pd),n&&(o[Td]=n),r&&(o[bd]=r),i&&(o[aa]=i),s&&(o[Rd]=s),Ad(e,Od,o)}open(e,n){this.onDisconnect=n,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,Hn.set("previous_websocket_failure",!0);try{let r;Qf(),this.mySock=new js(this.connURL,[],r)}catch(r){this.log_("Error instantiating WebSocket.");const i=r.message||r.data;i&&this.log_(i),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=r=>{this.handleIncomingFrame(r)},this.mySock.onerror=r=>{this.log_("WebSocket error. Closing connection.");const i=r.message||r.data;i&&this.log_(i),this.onClosed_()}}start(){}static forceDisallow(){Ct.forceDisallow_=!0}static isAvailable(){let e=!1;if(typeof navigator<"u"&&navigator.userAgent){const n=/Android ([0-9]{0,}\.[0-9]{0,})/,r=navigator.userAgent.match(n);r&&r.length>1&&parseFloat(r[1])<4.4&&(e=!0)}return!e&&js!==null&&!Ct.forceDisallow_}static previouslyFailed(){return Hn.isInMemoryStorage||Hn.get("previous_websocket_failure")===!0}markConnectionHealthy(){Hn.remove("previous_websocket_failure")}appendFrame_(e){if(this.frames.push(e),this.frames.length===this.totalFrames){const n=this.frames.join("");this.frames=null;const r=fi(n);this.onMessage(r)}}handleNewFrameCount_(e){this.totalFrames=e,this.frames=[]}extractFrameCount_(e){if(M(this.frames===null,"We already have a frame buffer"),e.length<=6){const n=Number(e);if(!isNaN(n))return this.handleNewFrameCount_(n),null}return this.handleNewFrameCount_(1),e}handleIncomingFrame(e){if(this.mySock===null)return;const n=e.data;if(this.bytesReceived+=n.length,this.stats_.incrementCounter("bytes_received",n.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(n);else{const r=this.extractFrameCount_(n);r!==null&&this.appendFrame_(r)}}send(e){this.resetKeepAlive();const n=Te(e);this.bytesSent+=n.length,this.stats_.incrementCounter("bytes_sent",n.length);const r=Ed(n,x1);r.length>1&&this.sendString_(String(r.length));for(let i=0;i{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(k1))}sendString_(e){try{this.mySock.send(e)}catch(n){this.log_("Exception thrown from WebSocket.send():",n.message||n.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}Ct.responsesRequiredToBeHealthy=2,Ct.healthyTimeout=3e4;/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class _i{constructor(e){this.initTransports_(e)}static get ALL_TRANSPORTS(){return[Er,Ct]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}initTransports_(e){const n=Ct&&Ct.isAvailable();let r=n&&!Ct.previouslyFailed();if(e.webSocketOnly&&(n||st("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),r=!0),r)this.transports_=[Ct];else{const i=this.transports_=[];for(const s of _i.ALL_TRANSPORTS)s&&s.isAvailable()&&i.push(s);_i.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}_i.globalTransportInitialized_=!1;/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const T1=6e4,I1=5e3,P1=10*1024,N1=100*1024,ha="t",Bd="d",b1="s",Hd="r",R1="e",Vd="o",Wd="a",qd="n",Kd="p",O1="h";class D1{constructor(e,n,r,i,s,o,l,a,u,d){this.id=e,this.repoInfo_=n,this.applicationId_=r,this.appCheckToken_=i,this.authToken_=s,this.onMessage_=o,this.onReady_=l,this.onDisconnect_=a,this.onKill_=u,this.lastSessionId=d,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=mi("c:"+this.id+":"),this.transportManager_=new _i(n),this.log_("Connection created"),this.start_()}start_(){const e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;const n=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(n,r)},Math.floor(0));const i=e.healthyTimeout||0;i>0&&(this.healthyTimeout_=vi(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>N1?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>P1?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(i)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return n=>{e===this.conn_?this.onConnectionLost_(n):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return n=>{this.state_!==2&&(e===this.rx_?this.onPrimaryMessageReceived_(n):e===this.secondaryConn_?this.onSecondaryMessageReceived_(n):this.log_("message on old connection"))}}sendRequest(e){const n={t:"d",d:e};this.sendData_(n)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if(ha in e){const n=e[ha];n===Wd?this.upgradeIfSecondaryHealthy_():n===Hd?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):n===Vd&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){const n=gi("t",e),r=gi("d",e);if(n==="c")this.onSecondaryControl_(r);else if(n==="d")this.pendingDataMessages.push(r);else throw new Error("Unknown protocol layer: "+n)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:Kd,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:Wd,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:qd,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){const n=gi("t",e),r=gi("d",e);n==="c"?this.onControl_(r):n==="d"&&this.onDataMessage_(r)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){const n=gi(ha,e);if(Bd in e){const r=e[Bd];if(n===O1){const i=Object.assign({},r);this.repoInfo_.isUsingEmulator&&(i.h=this.repoInfo_.host),this.onHandshake_(i)}else if(n===qd){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let i=0;i{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(T1))}onReset_(e){this.log_("Reset packet received. New host: "+e),this.repoInfo_.host=e,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,n){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(n,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):vi(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(I1))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:Kd,d:{}}}))}onSecondaryConnectionLost_(){const e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,!e&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(Hn.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(e)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Gd{put(e,n,r,i){}merge(e,n,r,i){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,n,r){}onDisconnectMerge(e,n,r){}onDisconnectCancel(e,n){}reportStats(e){}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let Yd=class{constructor(e){this.allowedEvents_=e,this.listeners_={},M(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...n){if(Array.isArray(this.listeners_[e])){const r=[...this.listeners_[e]];for(let i=0;in===e),"Unknown event: "+e)}};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Us extends Yd{constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!Yf()&&(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}static getInstance(){return new Us}getInitialEvent(e){return M(e==="online","Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Qd=32,Xd=768;class oe{constructor(e,n){if(n===void 0){this.pieces_=e.split("/");let r=0;for(let i=0;i0&&(this.pieces_[r]=this.pieces_[i],r++);this.pieces_.length=r,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=n}toString(){let e="";for(let n=this.pieceNum_;n=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function fn(t){return t.pieces_.length-t.pieceNum_}function ae(t){let e=t.pieceNum_;return e=t.pieces_.length)return null;const e=[];for(let n=t.pieceNum_;n0&&n.push(r[i])}return new oe(n,0)}function Y(t){return t.pieceNum_>=t.pieces_.length}function Xe(t,e){const n=G(t),r=G(e);if(n===null)return e;if(n===r)return Xe(ae(t),ae(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")}function pa(t,e){if(fn(t)!==fn(e))return!1;for(let n=t.pieceNum_,r=e.pieceNum_;n<=t.pieces_.length;n++,r++)if(t.pieces_[n]!==e.pieces_[r])return!1;return!0}function xt(t,e){let n=t.pieceNum_,r=e.pieceNum_;if(fn(t)>fn(e))return!1;for(;n0&&(t.byteLength_+=1),t.parts_.push(e),t.byteLength_+=As(e),th(t)}function F1(t){const e=t.parts_.pop();t.byteLength_-=As(e),t.parts_.length>0&&(t.byteLength_-=1)}function th(t){if(t.byteLength_>Xd)throw new Error(t.errorPrefix_+"has a key path longer than "+Xd+" bytes ("+t.byteLength_+").");if(t.parts_.length>Qd)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Qd+") or object contains a cycle "+qn(t))}function qn(t){return t.parts_.length===0?"":"in property '"+t.parts_.join(".")+"'"}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ma extends Yd{constructor(){super(["visible"]);let e,n;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(n="visibilitychange",e="hidden"):typeof document.mozHidden<"u"?(n="mozvisibilitychange",e="mozHidden"):typeof document.msHidden<"u"?(n="msvisibilitychange",e="msHidden"):typeof document.webkitHidden<"u"&&(n="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,n&&document.addEventListener(n,()=>{const r=!document[e];r!==this.visible_&&(this.visible_=r,this.trigger("visible",r))},!1)}static getInstance(){return new ma}getInitialEvent(e){return M(e==="visible","Unknown event type: "+e),[this.visible_]}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const wi=1e3,z1=60*5*1e3,nh=30*1e3,j1=1.3,U1=3e4,$1="server_kill",rh=3;class qt extends Gd{constructor(e,n,r,i,s,o,l,a){if(super(),this.repoInfo_=e,this.applicationId_=n,this.onDataUpdate_=r,this.onConnectStatus_=i,this.onServerInfoUpdate_=s,this.authTokenProvider_=o,this.appCheckTokenProvider_=l,this.authOverride_=a,this.id=qt.nextPersistentConnectionId_++,this.log_=mi("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=wi,this.maxReconnectDelay_=z1,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,a&&!Qf())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");ma.getInstance().on("visible",this.onVisible_,this),e.host.indexOf("fblocal")===-1&&Us.getInstance().on("online",this.onOnline_,this)}sendRequest(e,n,r){const i=++this.requestNumber_,s={r:i,a:e,b:n};this.log_(Te(s)),M(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(s),r&&(this.requestCBHash_[i]=r)}get(e){this.initConnection_();const n=new Wl,i={action:"g",request:{p:e._path.toString(),q:e._queryObject},onComplete:o=>{const l=o.d;o.s==="ok"?n.resolve(l):n.reject(l)}};this.outstandingGets_.push(i),this.outstandingGetCount_++;const s=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(s),n.promise}listen(e,n,r,i){this.initConnection_();const s=e._queryIdentifier,o=e._path.toString();this.log_("Listen called for "+o+" "+s),this.listens.has(o)||this.listens.set(o,new Map),M(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"listen() called for non-default but complete query"),M(!this.listens.get(o).has(s),"listen() called twice for same path/queryId.");const l={onComplete:i,hashFn:n,query:e,tag:r};this.listens.get(o).set(s,l),this.connected_&&this.sendListen_(l)}sendGet_(e){const n=this.outstandingGets_[e];this.sendRequest("g",n.request,r=>{delete this.outstandingGets_[e],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),n.onComplete&&n.onComplete(r)})}sendListen_(e){const n=e.query,r=n._path.toString(),i=n._queryIdentifier;this.log_("Listen on "+r+" for "+i);const s={p:r},o="q";e.tag&&(s.q=n._queryObject,s.t=e.tag),s.h=e.hashFn(),this.sendRequest(o,s,l=>{const a=l.d,u=l.s;qt.warnOnListenWarnings_(a,n),(this.listens.get(r)&&this.listens.get(r).get(i))===e&&(this.log_("listen response",l),u!=="ok"&&this.removeListen_(r,i),e.onComplete&&e.onComplete(u,a))})}static warnOnListenWarnings_(e,n){if(e&&typeof e=="object"&&Vt(e,"w")){const r=gr(e,"w");if(Array.isArray(r)&&~r.indexOf("no_index")){const i='".indexOn": "'+n._queryParams.getIndex().toString()+'"',s=n._path.toString();st(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${i} at ${s} to your security rules for better performance.`)}}}refreshAuthToken(e){this.authToken_=e,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(e)}reduceReconnectDelayIfAdminCredential_(e){(e&&e.length===40||D0(e))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=nh)}refreshAppCheckToken(e){this.appCheckToken_=e,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){const e=this.authToken_,n=O0(e)?"auth":"gauth",r={cred:e};this.authOverride_===null?r.noauth=!0:typeof this.authOverride_=="object"&&(r.authvar=this.authOverride_),this.sendRequest(n,r,i=>{const s=i.s,o=i.d||"error";this.authToken_===e&&(s==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(s,o))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},e=>{const n=e.s,r=e.d||"error";n==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(n,r)})}unlisten(e,n){const r=e._path.toString(),i=e._queryIdentifier;this.log_("Unlisten called for "+r+" "+i),M(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(r,i)&&this.connected_&&this.sendUnlisten_(r,i,e._queryObject,n)}sendUnlisten_(e,n,r,i){this.log_("Unlisten on "+e+" for "+n);const s={p:e},o="n";i&&(s.q=r,s.t=i),this.sendRequest(o,s)}onDisconnectPut(e,n,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",e,n,r):this.onDisconnectRequestQueue_.push({pathString:e,action:"o",data:n,onComplete:r})}onDisconnectMerge(e,n,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",e,n,r):this.onDisconnectRequestQueue_.push({pathString:e,action:"om",data:n,onComplete:r})}onDisconnectCancel(e,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",e,null,n):this.onDisconnectRequestQueue_.push({pathString:e,action:"oc",data:null,onComplete:n})}sendOnDisconnect_(e,n,r,i){const s={p:n,d:r};this.log_("onDisconnect "+e,s),this.sendRequest(e,s,o=>{i&&setTimeout(()=>{i(o.s,o.d)},Math.floor(0))})}put(e,n,r,i){this.putInternal("p",e,n,r,i)}merge(e,n,r,i){this.putInternal("m",e,n,r,i)}putInternal(e,n,r,i,s){this.initConnection_();const o={p:n,d:r};s!==void 0&&(o.h=s),this.outstandingPuts_.push({action:e,request:o,onComplete:i}),this.outstandingPutCount_++;const l=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(l):this.log_("Buffering put: "+n)}sendPut_(e){const n=this.outstandingPuts_[e].action,r=this.outstandingPuts_[e].request,i=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(n,r,s=>{this.log_(n+" response",s),delete this.outstandingPuts_[e],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),i&&i(s.s,s.d)})}reportStats(e){if(this.connected_){const n={c:e};this.log_("reportStats",n),this.sendRequest("s",n,r=>{if(r.s!=="ok"){const s=r.d;this.log_("reportStats","Error sending stats: "+s)}})}}onDataMessage_(e){if("r"in e){this.log_("from server: "+Te(e));const n=e.r,r=this.requestCBHash_[n];r&&(delete this.requestCBHash_[n],r(e.b))}else{if("error"in e)throw"A server-side error has occurred: "+e.error;"a"in e&&this.onDataPush_(e.a,e.b)}}onDataPush_(e,n){this.log_("handleServerMessage",e,n),e==="d"?this.onDataUpdate_(n.p,n.d,!1,n.t):e==="m"?this.onDataUpdate_(n.p,n.d,!0,n.t):e==="c"?this.onListenRevoked_(n.p,n.q):e==="ac"?this.onAuthRevoked_(n.s,n.d):e==="apc"?this.onAppCheckRevoked_(n.s,n.d):e==="sd"?this.onSecurityDebugPacket_(n):sa("Unrecognized action received from server: "+Te(e)+` Are you using the latest client?`)}onReady_(e,n){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(e),this.lastSessionId=n,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(e){M(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(e))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(e){e&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=wi,this.realtime_||this.scheduleConnect_(0)),this.visible_=e}onOnline_(e){e?(this.log_("Browser went online."),this.reconnectDelay_=wi,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>U1&&(this.reconnectDelay_=wi),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());const e=new Date().getTime()-this.lastConnectionAttemptTime_;let n=Math.max(0,this.reconnectDelay_-e);n=Math.random()*n,this.log_("Trying to reconnect in "+n+"ms"),this.scheduleConnect_(n),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*j1)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;const e=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+qt.nextConnectionId_++,s=this.lastSessionId;let o=!1,l=null;const a=function(){l?l.close():(o=!0,r())},u=function(c){M(l,"sendRequest call when we're not connected not allowed."),l.sendRequest(c)};this.realtime_={close:a,sendRequest:u};const d=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[c,f]=await Promise.all([this.authTokenProvider_.getToken(d),this.appCheckTokenProvider_.getToken(d)]);o?Me("getToken() completed but was canceled"):(Me("getToken() completed. Creating connection."),this.authToken_=c&&c.accessToken,this.appCheckToken_=f&&f.token,l=new D1(i,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,e,n,r,p=>{st(p+" ("+this.repoInfo_.toString()+")"),this.interrupt($1)},s))}catch(c){this.log_("Failed to get token: "+c),o||(this.repoInfo_.nodeAdmin&&st(c),a())}}}interrupt(e){Me("Interrupting connection for reason: "+e),this.interruptReasons_[e]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(e){Me("Resuming connection for reason: "+e),delete this.interruptReasons_[e],Zf(this.interruptReasons_)&&(this.reconnectDelay_=wi,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(e){const n=e-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:n})}cancelSentTransactions_(){for(let e=0;eoa(s)).join("$"):r="default";const i=this.removeListen_(e,r);i&&i.onComplete&&i.onComplete("permission_denied")}removeListen_(e,n){const r=new oe(e).toString();let i;if(this.listens.has(r)){const s=this.listens.get(r);i=s.get(n),s.delete(n),s.size===0&&this.listens.delete(r)}else i=void 0;return i}onAuthRevoked_(e,n){Me("Auth token revoked: "+e+"/"+n),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(e==="invalid_token"||e==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=rh&&(this.reconnectDelay_=nh,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(e,n){Me("App check token revoked: "+e+"/"+n),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(e==="invalid_token"||e==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=rh&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(e){this.securityDebugCallback_?this.securityDebugCallback_(e):"msg"in e&&console.log("FIREBASE: "+e.msg.replace(` `,` FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of this.listens.values())for(const n of e.values())this.sendListen_(n);for(let e=0;e0}peek(){if(this.nodeStack_.length===0)return null;const e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}}class Ie{constructor(e,n,r,i,s){this.key=e,this.value=n,this.color=r??Ie.RED,this.left=i??Je.EMPTY_NODE,this.right=s??Je.EMPTY_NODE}copy(e,n,r,i,s){return new Ie(e??this.key,n??this.value,r??this.color,i??this.left,s??this.right)}count(){return this.left.count()+1+this.right.count()}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,n,r){let i=this;const s=r(e,i.key);return s<0?i=i.copy(null,null,null,i.left.insert(e,n,r),null):s===0?i=i.copy(null,n,null,null,null):i=i.copy(null,null,null,null,i.right.insert(e,n,r)),i.fixUp_()}removeMin_(){if(this.left.isEmpty())return Je.EMPTY_NODE;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,n){let r,i;if(r=this,n(e,r.key)<0)!r.left.isEmpty()&&!r.left.isRed_()&&!r.left.left.isRed_()&&(r=r.moveRedLeft_()),r=r.copy(null,null,null,r.left.remove(e,n),null);else{if(r.left.isRed_()&&(r=r.rotateRight_()),!r.right.isEmpty()&&!r.right.isRed_()&&!r.right.left.isRed_()&&(r=r.moveRedRight_()),n(e,r.key)===0){if(r.right.isEmpty())return Je.EMPTY_NODE;i=r.right.min_(),r=r.copy(i.key,i.value,null,null,r.right.removeMin_())}r=r.copy(null,null,null,null,r.right.remove(e,n))}return r.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,Ie.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight_(){const e=this.copy(null,null,Ie.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),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth_(){const e=this.check_();return Math.pow(2,e)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const e=this.left.check_();if(e!==this.right.check_())throw new Error("Black depths differ");return e+(this.isRed_()?0:1)}}Ie.RED=!0,Ie.BLACK=!1;class B1{copy(e,n,r,i,s){return this}insert(e,n,r){return new Ie(e,n,null)}remove(e,n){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}}class Je{constructor(e,n=Je.EMPTY_NODE){this.comparator_=e,this.root_=n}insert(e,n){return new Je(this.comparator_,this.root_.insert(e,n,this.comparator_).copy(null,null,Ie.BLACK,null,null))}remove(e){return new Je(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,Ie.BLACK,null,null))}get(e){let n,r=this.root_;for(;!r.isEmpty();){if(n=this.comparator_(e,r.key),n===0)return r.value;n<0?r=r.left:n>0&&(r=r.right)}return null}getPredecessorKey(e){let n,r=this.root_,i=null;for(;!r.isEmpty();)if(n=this.comparator_(e,r.key),n===0){if(r.left.isEmpty())return i?i.key:null;for(r=r.left;!r.right.isEmpty();)r=r.right;return r.key}else n<0?r=r.left:n>0&&(i=r,r=r.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new Hs(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,n){return new Hs(this.root_,e,this.comparator_,!1,n)}getReverseIteratorFrom(e,n){return new Hs(this.root_,e,this.comparator_,!0,n)}getReverseIterator(e){return new Hs(this.root_,null,this.comparator_,!0,e)}}Je.EMPTY_NODE=new B1;/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function H1(t,e){return wr(t.name,e.name)}function ga(t,e){return wr(t,e)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let ya;function V1(t){ya=t}const sh=function(t){return typeof t=="number"?"number:"+Cd(t):"string:"+t},oh=function(t){if(t.isLeafNode()){const e=t.val();M(typeof e=="string"||typeof e=="number"||typeof e=="object"&&Vt(e,".sv"),"Priority must be a string or number.")}else M(t===ya||t.isEmpty(),"priority of unexpected type.");M(t===ya||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let lh;class Pe{constructor(e,n=Pe.__childrenNodeConstructor.EMPTY_NODE){this.value_=e,this.priorityNode_=n,this.lazyHash_=null,M(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),oh(this.priorityNode_)}static set __childrenNodeConstructor(e){lh=e}static get __childrenNodeConstructor(){return lh}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(e){return new Pe(this.value_,e)}getImmediateChild(e){return e===".priority"?this.priorityNode_:Pe.__childrenNodeConstructor.EMPTY_NODE}getChild(e){return Y(e)?this:G(e)===".priority"?this.priorityNode_:Pe.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(e,n){return null}updateImmediateChild(e,n){return e===".priority"?this.updatePriority(n):n.isEmpty()&&e!==".priority"?this:Pe.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,n).updatePriority(this.priorityNode_)}updateChild(e,n){const r=G(e);return r===null?n:n.isEmpty()&&r!==".priority"?this:(M(r!==".priority"||fn(e)===1,".priority must be the last token in a path"),this.updateImmediateChild(r,Pe.__childrenNodeConstructor.EMPTY_NODE.updateChild(ae(e),n)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(e,n){return!1}val(e){return e&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let e="";this.priorityNode_.isEmpty()||(e+="priority:"+sh(this.priorityNode_.val())+":");const n=typeof this.value_;e+=n+":",n==="number"?e+=Cd(this.value_):e+=this.value_,this.lazyHash_=_d(e)}return this.lazyHash_}getValue(){return this.value_}compareTo(e){return e===Pe.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof Pe.__childrenNodeConstructor?-1:(M(e.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(e))}compareToLeafNode_(e){const n=typeof e.value_,r=typeof this.value_,i=Pe.VALUE_TYPE_ORDER.indexOf(n),s=Pe.VALUE_TYPE_ORDER.indexOf(r);return M(i>=0,"Unknown leaf type: "+n),M(s>=0,"Unknown leaf type: "+r),i===s?r==="object"?0:this.value_parseInt(Math.log(s)/G1,10),r=s=>parseInt(Array(s+1).join("1"),2);this.count=n(e+1),this.current_=this.count-1;const i=r(this.count);this.bits_=e+1&i}nextBitIsOne(){const e=!(this.bits_&1<{const o=gr(this.indexSet_,s);if(M(o,"Missing index implementation for "+s),i===xr)if(o.isDefinedOn(e.node)){const l=[],a=n.getIterator(K.Wrap);let u=a.getNext();for(;u;)u.name!==e.name&&l.push(u),u=a.getNext();return l.push(e),Vs(l,o.getCompare())}else return xr;else{const l=n.get(e.name);let a=i;return l&&(a=a.remove(new K(e.name,l))),a.insert(e,e.node)}});return new Kt(r,this.indexSet_)}removeFromIndexes(e,n){const r=Ls(this.indexes_,i=>{if(i===xr)return i;{const s=n.get(e.name);return s?i.remove(new K(e.name,s)):i}});return new Kt(r,this.indexSet_)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let Si;class q{constructor(e,n,r){this.children_=e,this.priorityNode_=n,this.indexMap_=r,this.lazyHash_=null,this.priorityNode_&&oh(this.priorityNode_),this.children_.isEmpty()&&M(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}static get EMPTY_NODE(){return Si||(Si=new q(new Je(ga),null,Kt.Default))}isLeafNode(){return!1}getPriority(){return this.priorityNode_||Si}updatePriority(e){return this.children_.isEmpty()?this:new q(this.children_,e,this.indexMap_)}getImmediateChild(e){if(e===".priority")return this.getPriority();{const n=this.children_.get(e);return n===null?Si:n}}getChild(e){const n=G(e);return n===null?this:this.getImmediateChild(n).getChild(ae(e))}hasChild(e){return this.children_.get(e)!==null}updateImmediateChild(e,n){if(M(n,"We should always be passing snapshot nodes"),e===".priority")return this.updatePriority(n);{const r=new K(e,n);let i,s;n.isEmpty()?(i=this.children_.remove(e),s=this.indexMap_.removeFromIndexes(r,this.children_)):(i=this.children_.insert(e,n),s=this.indexMap_.addToIndexes(r,this.children_));const o=i.isEmpty()?Si:this.priorityNode_;return new q(i,o,s)}}updateChild(e,n){const r=G(e);if(r===null)return n;{M(G(e)!==".priority"||fn(e)===1,".priority must be the last token in a path");const i=this.getImmediateChild(r).updateChild(ae(e),n);return this.updateImmediateChild(r,i)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(e){if(this.isEmpty())return null;const n={};let r=0,i=0,s=!0;if(this.forEachChild(ve,(o,l)=>{n[o]=l.val(e),r++,s&&q.INTEGER_REGEXP_.test(o)?i=Math.max(i,Number(o)):s=!1}),!e&&s&&i<2*r){const o=[];for(const l in n)o[l]=n[l];return o}else return e&&!this.getPriority().isEmpty()&&(n[".priority"]=this.getPriority().val()),n}hash(){if(this.lazyHash_===null){let e="";this.getPriority().isEmpty()||(e+="priority:"+sh(this.getPriority().val())+":"),this.forEachChild(ve,(n,r)=>{const i=r.hash();i!==""&&(e+=":"+n+":"+i)}),this.lazyHash_=e===""?"":_d(e)}return this.lazyHash_}getPredecessorChildName(e,n,r){const i=this.resolveIndex_(r);if(i){const s=i.getPredecessorKey(new K(e,n));return s?s.name:null}else return this.children_.getPredecessorKey(e)}getFirstChildName(e){const n=this.resolveIndex_(e);if(n){const r=n.minKey();return r&&r.name}else return this.children_.minKey()}getFirstChild(e){const n=this.getFirstChildName(e);return n?new K(n,this.children_.get(n)):null}getLastChildName(e){const n=this.resolveIndex_(e);if(n){const r=n.maxKey();return r&&r.name}else return this.children_.maxKey()}getLastChild(e){const n=this.getLastChildName(e);return n?new K(n,this.children_.get(n)):null}forEachChild(e,n){const r=this.resolveIndex_(e);return r?r.inorderTraversal(i=>n(i.name,i.node)):this.children_.inorderTraversal(n)}getIterator(e){return this.getIteratorFrom(e.minPost(),e)}getIteratorFrom(e,n){const r=this.resolveIndex_(n);if(r)return r.getIteratorFrom(e,i=>i);{const i=this.children_.getIteratorFrom(e.name,K.Wrap);let s=i.peek();for(;s!=null&&n.compare(s,e)<0;)i.getNext(),s=i.peek();return i}}getReverseIterator(e){return this.getReverseIteratorFrom(e.maxPost(),e)}getReverseIteratorFrom(e,n){const r=this.resolveIndex_(n);if(r)return r.getReverseIteratorFrom(e,i=>i);{const i=this.children_.getReverseIteratorFrom(e.name,K.Wrap);let s=i.peek();for(;s!=null&&n.compare(s,e)>0;)i.getNext(),s=i.peek();return i}}compareTo(e){return this.isEmpty()?e.isEmpty()?0:-1:e.isLeafNode()||e.isEmpty()?1:e===Ei?-1:0}withIndex(e){if(e===Cr||this.indexMap_.hasIndex(e))return this;{const n=this.indexMap_.addIndex(e,this.children_);return new q(this.children_,this.priorityNode_,n)}}isIndexed(e){return e===Cr||this.indexMap_.hasIndex(e)}equals(e){if(e===this)return!0;if(e.isLeafNode())return!1;{const n=e;if(this.getPriority().equals(n.getPriority()))if(this.children_.count()===n.children_.count()){const r=this.getIterator(ve),i=n.getIterator(ve);let s=r.getNext(),o=i.getNext();for(;s&&o;){if(s.name!==o.name||!s.node.equals(o.node))return!1;s=r.getNext(),o=i.getNext()}return s===null&&o===null}else return!1;else return!1}}resolveIndex_(e){return e===Cr?null:this.indexMap_.get(e.toString())}}q.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class Q1 extends q{constructor(){super(new Je(ga),q.EMPTY_NODE,Kt.Default)}compareTo(e){return e===this?0:1}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return q.EMPTY_NODE}isEmpty(){return!1}}const Ei=new Q1;Object.defineProperties(K,{MIN:{value:new K(_r,q.EMPTY_NODE)},MAX:{value:new K(Wn,Ei)}}),ih.__EMPTY_NODE=q.EMPTY_NODE,Pe.__childrenNodeConstructor=q,V1(Ei),q1(Ei);/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const X1=!0;function Fe(t,e=null){if(t===null)return q.EMPTY_NODE;if(typeof t=="object"&&".priority"in t&&(e=t[".priority"]),M(e===null||typeof e=="string"||typeof e=="number"||typeof e=="object"&&".sv"in e,"Invalid priority type found: "+typeof e),typeof t=="object"&&".value"in t&&t[".value"]!==null&&(t=t[".value"]),typeof t!="object"||".sv"in t){const n=t;return new Pe(n,Fe(e))}if(!(t instanceof Array)&&X1){const n=[];let r=!1;if(Qe(t,(o,l)=>{if(o.substring(0,1)!=="."){const a=Fe(l);a.isEmpty()||(r=r||!a.getPriority().isEmpty(),n.push(new K(o,a)))}}),n.length===0)return q.EMPTY_NODE;const s=Vs(n,H1,o=>o.name,ga);if(r){const o=Vs(n,ve.getCompare());return new q(s,Fe(e),new Kt({".priority":o},{".priority":ve}))}else return new q(s,Fe(e),Kt.Default)}else{let n=q.EMPTY_NODE;return Qe(t,(r,i)=>{if(Vt(t,r)&&r.substring(0,1)!=="."){const s=Fe(i);(s.isLeafNode()||!s.isEmpty())&&(n=n.updateImmediateChild(r,s))}}),n.updatePriority(Fe(e))}}W1(Fe);/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class J1 extends $s{constructor(e){super(),this.indexPath_=e,M(!Y(e)&&G(e)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,n){const r=this.extractChild(e.node),i=this.extractChild(n.node),s=r.compareTo(i);return s===0?wr(e.name,n.name):s}makePost(e,n){const r=Fe(e),i=q.EMPTY_NODE.updateChild(this.indexPath_,r);return new K(n,i)}maxPost(){const e=q.EMPTY_NODE.updateChild(this.indexPath_,Ei);return new K(Wn,e)}toString(){return Zd(this.indexPath_,0).join("/")}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Z1 extends $s{compare(e,n){const r=e.node.compareTo(n.node);return r===0?wr(e.name,n.name):r}isDefinedOn(e){return!0}indexedValueChanged(e,n){return!e.equals(n)}minPost(){return K.MIN}maxPost(){return K.MAX}makePost(e,n){const r=Fe(e);return new K(n,r)}toString(){return".value"}}const ew=new Z1;/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function ch(t){return{type:"value",snapshotNode:t}}function kr(t,e){return{type:"child_added",snapshotNode:e,childName:t}}function Ci(t,e){return{type:"child_removed",snapshotNode:e,childName:t}}function xi(t,e,n){return{type:"child_changed",snapshotNode:e,childName:t,oldSnap:n}}function tw(t,e){return{type:"child_moved",snapshotNode:e,childName:t}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class _a{constructor(e){this.index_=e}updateChild(e,n,r,i,s,o){M(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");const l=e.getImmediateChild(n);return l.getChild(i).equals(r.getChild(i))&&l.isEmpty()===r.isEmpty()||(o!=null&&(r.isEmpty()?e.hasChild(n)?o.trackChildChange(Ci(n,l)):M(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):l.isEmpty()?o.trackChildChange(kr(n,r)):o.trackChildChange(xi(n,r,l))),e.isLeafNode()&&r.isEmpty())?e:e.updateImmediateChild(n,r).withIndex(this.index_)}updateFullNode(e,n,r){return r!=null&&(e.isLeafNode()||e.forEachChild(ve,(i,s)=>{n.hasChild(i)||r.trackChildChange(Ci(i,s))}),n.isLeafNode()||n.forEachChild(ve,(i,s)=>{if(e.hasChild(i)){const o=e.getImmediateChild(i);o.equals(s)||r.trackChildChange(xi(i,s,o))}else r.trackChildChange(kr(i,s))})),n.withIndex(this.index_)}updatePriority(e,n){return e.isEmpty()?q.EMPTY_NODE:e.updatePriority(n)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ki{constructor(e){this.indexedFilter_=new _a(e.getIndex()),this.index_=e.getIndex(),this.startPost_=ki.getStartPost_(e),this.endPost_=ki.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){const n=this.startIsInclusive_?this.index_.compare(this.getStartPost(),e)<=0:this.index_.compare(this.getStartPost(),e)<0,r=this.endIsInclusive_?this.index_.compare(e,this.getEndPost())<=0:this.index_.compare(e,this.getEndPost())<0;return n&&r}updateChild(e,n,r,i,s,o){return this.matches(new K(n,r))||(r=q.EMPTY_NODE),this.indexedFilter_.updateChild(e,n,r,i,s,o)}updateFullNode(e,n,r){n.isLeafNode()&&(n=q.EMPTY_NODE);let i=n.withIndex(this.index_);i=i.updatePriority(q.EMPTY_NODE);const s=this;return n.forEachChild(ve,(o,l)=>{s.matches(new K(o,l))||(i=i.updateImmediateChild(o,q.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(e,i,r)}updatePriority(e,n){return e}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(e){if(e.hasStart()){const n=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),n)}else return e.getIndex().minPost()}static getEndPost_(e){if(e.hasEnd()){const n=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),n)}else return e.getIndex().maxPost()}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class nw{constructor(e){this.withinDirectionalStart=n=>this.reverse_?this.withinEndPost(n):this.withinStartPost(n),this.withinDirectionalEnd=n=>this.reverse_?this.withinStartPost(n):this.withinEndPost(n),this.withinStartPost=n=>{const r=this.index_.compare(this.rangedFilter_.getStartPost(),n);return this.startIsInclusive_?r<=0:r<0},this.withinEndPost=n=>{const r=this.index_.compare(n,this.rangedFilter_.getEndPost());return this.endIsInclusive_?r<=0:r<0},this.rangedFilter_=new ki(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft(),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}updateChild(e,n,r,i,s,o){return this.rangedFilter_.matches(new K(n,r))||(r=q.EMPTY_NODE),e.getImmediateChild(n).equals(r)?e:e.numChildren()c(p,f)}else o=this.index_.getCompare();const l=e;M(l.numChildren()===this.limit_,"");const a=new K(n,r),u=this.reverse_?l.getFirstChild(this.index_):l.getLastChild(this.index_),d=this.rangedFilter_.matches(a);if(l.hasChild(n)){const c=l.getImmediateChild(n);let f=i.getChildAfterChild(this.index_,u,this.reverse_);for(;f!=null&&(f.name===n||l.hasChild(f.name));)f=i.getChildAfterChild(this.index_,f,this.reverse_);const p=f==null?1:o(f,a);if(d&&!r.isEmpty()&&p>=0)return s!=null&&s.trackChildChange(xi(n,r,c)),l.updateImmediateChild(n,r);{s!=null&&s.trackChildChange(Ci(n,c));const S=l.updateImmediateChild(n,q.EMPTY_NODE);return f!=null&&this.rangedFilter_.matches(f)?(s!=null&&s.trackChildChange(kr(f.name,f.node)),S.updateImmediateChild(f.name,f.node)):S}}else return r.isEmpty()?e:d&&o(u,a)>=0?(s!=null&&(s.trackChildChange(Ci(u.name,u.node)),s.trackChildChange(kr(n,r))),l.updateImmediateChild(n,r).updateImmediateChild(u.name,q.EMPTY_NODE)):e}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class wa{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=ve}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return M(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return M(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:_r}hasEnd(){return this.endSet_}getIndexEndValue(){return M(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return M(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Wn}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return M(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===ve}copy(){const e=new wa;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}}function rw(t){return t.loadsAllData()?new _a(t.getIndex()):t.hasLimit()?new nw(t):new ki(t)}function fh(t){const e={};if(t.isDefault())return e;let n;if(t.index_===ve?n="$priority":t.index_===ew?n="$value":t.index_===Cr?n="$key":(M(t.index_ instanceof J1,"Unrecognized index type!"),n=t.index_.toString()),e.orderBy=Te(n),t.startSet_){const r=t.startAfterSet_?"startAfter":"startAt";e[r]=Te(t.indexStartValue_),t.startNameSet_&&(e[r]+=","+Te(t.indexStartName_))}if(t.endSet_){const r=t.endBeforeSet_?"endBefore":"endAt";e[r]=Te(t.indexEndValue_),t.endNameSet_&&(e[r]+=","+Te(t.indexEndName_))}return t.limitSet_&&(t.isViewFromLeft()?e.limitToFirst=t.limit_:e.limitToLast=t.limit_),e}function dh(t){const e={};if(t.startSet_&&(e.sp=t.indexStartValue_,t.startNameSet_&&(e.sn=t.indexStartName_),e.sin=!t.startAfterSet_),t.endSet_&&(e.ep=t.indexEndValue_,t.endNameSet_&&(e.en=t.indexEndName_),e.ein=!t.endBeforeSet_),t.limitSet_){e.l=t.limit_;let n=t.viewFrom_;n===""&&(t.isViewFromLeft()?n="l":n="r"),e.vf=n}return t.index_!==ve&&(e.i=t.index_.toString()),e}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ws extends Gd{constructor(e,n,r,i){super(),this.repoInfo_=e,this.onDataUpdate_=n,this.authTokenProvider_=r,this.appCheckTokenProvider_=i,this.log_=mi("p:rest:"),this.listens_={}}reportStats(e){throw new Error("Method not implemented.")}static getListenId_(e,n){return n!==void 0?"tag$"+n:(M(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}listen(e,n,r,i){const s=e._path.toString();this.log_("Listen called for "+s+" "+e._queryIdentifier);const o=Ws.getListenId_(e,r),l={};this.listens_[o]=l;const a=fh(e._queryParams);this.restRequest_(s+".json",a,(u,d)=>{let c=d;if(u===404&&(c=null,u=null),u===null&&this.onDataUpdate_(s,c,!1,r),gr(this.listens_,o)===l){let f;u?u===401?f="permission_denied":f="rest_error:"+u:f="ok",i(f,null)}})}unlisten(e,n){const r=Ws.getListenId_(e,n);delete this.listens_[r]}get(e){const n=fh(e._queryParams),r=e._path.toString(),i=new Wl;return this.restRequest_(r+".json",n,(s,o)=>{let l=o;s===404&&(l=null,s=null),s===null?(this.onDataUpdate_(r,l,!1,null),i.resolve(l)):i.reject(new Error(l))}),i.promise}refreshAuthToken(e){}restRequest_(e,n={},r){return n.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([i,s])=>{i&&i.accessToken&&(n.auth=i.accessToken),s&&s.token&&(n.ac=s.token);const o=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+L0(n);this.log_("Sending REST request for "+o);const l=new XMLHttpRequest;l.onreadystatechange=()=>{if(r&&l.readyState===4){this.log_("REST Response for "+o+" received. status:",l.status,"response:",l.responseText);let a=null;if(l.status>=200&&l.status<300){try{a=fi(l.responseText)}catch{st("Failed to parse JSON response for "+o+": "+l.responseText)}r(null,a)}else l.status!==401&&l.status!==404&&st("Got unsuccessful REST response for "+o+" Status: "+l.status),r(l.status);r=null}},l.open("GET",o,!0),l.send()})}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class iw{constructor(){this.rootNode_=q.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,n){this.rootNode_=this.rootNode_.updateChild(e,n)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function qs(){return{value:null,children:new Map}}function hh(t,e,n){if(Y(e))t.value=n,t.children.clear();else if(t.value!==null)t.value=t.value.updateChild(e,n);else{const r=G(e);t.children.has(r)||t.children.set(r,qs());const i=t.children.get(r);e=ae(e),hh(i,e,n)}}function Sa(t,e,n){t.value!==null?n(e,t.value):sw(t,(r,i)=>{const s=new oe(e.toString()+"/"+r);Sa(i,s,n)})}function sw(t,e){t.children.forEach((n,r)=>{e(r,n)})}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ow{constructor(e){this.collection_=e,this.last_=null}get(){const e=this.collection_.get(),n=Object.assign({},e);return this.last_&&Qe(this.last_,(r,i)=>{n[r]=n[r]-i}),this.last_=e,n}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ph=10*1e3,lw=30*1e3,aw=5*60*1e3;class uw{constructor(e,n){this.server_=n,this.statsToReport_={},this.statsListener_=new ow(e);const r=ph+(lw-ph)*Math.random();vi(this.reportStats_.bind(this),Math.floor(r))}reportStats_(){const e=this.statsListener_.get(),n={};let r=!1;Qe(e,(i,s)=>{s>0&&Vt(this.statsToReport_,i)&&(n[i]=s,r=!0)}),r&&this.server_.reportStats(n),vi(this.reportStats_.bind(this),Math.floor(Math.random()*2*aw))}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */var kt;(function(t){t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"})(kt||(kt={}));function mh(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function Ea(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function Ca(t){return{fromUser:!1,fromServer:!0,queryId:t,tagged:!0}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ks{constructor(e,n,r){this.path=e,this.affectedTree=n,this.revert=r,this.type=kt.ACK_USER_WRITE,this.source=mh()}operationForChild(e){if(Y(this.path)){if(this.affectedTree.value!=null)return M(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{const n=this.affectedTree.subtree(new oe(e));return new Ks(te(),n,this.revert)}}else return M(G(this.path)===e,"operationForChild called for unrelated child."),new Ks(ae(this.path),this.affectedTree,this.revert)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ti{constructor(e,n){this.source=e,this.path=n,this.type=kt.LISTEN_COMPLETE}operationForChild(e){return Y(this.path)?new Ti(this.source,te()):new Ti(this.source,ae(this.path))}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Kn{constructor(e,n,r){this.source=e,this.path=n,this.snap=r,this.type=kt.OVERWRITE}operationForChild(e){return Y(this.path)?new Kn(this.source,te(),this.snap.getImmediateChild(e)):new Kn(this.source,ae(this.path),this.snap)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ii{constructor(e,n,r){this.source=e,this.path=n,this.children=r,this.type=kt.MERGE}operationForChild(e){if(Y(this.path)){const n=this.children.subtree(new oe(e));return n.isEmpty()?null:n.value?new Kn(this.source,te(),n.value):new Ii(this.source,te(),n)}else return M(G(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new Ii(this.source,ae(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Gn{constructor(e,n,r){this.node_=e,this.fullyInitialized_=n,this.filtered_=r}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(e){if(Y(e))return this.isFullyInitialized()&&!this.filtered_;const n=G(e);return this.isCompleteForChild(n)}isCompleteForChild(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)}getNode(){return this.node_}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class cw{constructor(e){this.query_=e,this.index_=this.query_._queryParams.getIndex()}}function fw(t,e,n,r){const i=[],s=[];return e.forEach(o=>{o.type==="child_changed"&&t.index_.indexedValueChanged(o.oldSnap,o.snapshotNode)&&s.push(tw(o.childName,o.snapshotNode))}),Pi(t,i,"child_removed",e,r,n),Pi(t,i,"child_added",e,r,n),Pi(t,i,"child_moved",s,r,n),Pi(t,i,"child_changed",e,r,n),Pi(t,i,"value",e,r,n),i}function Pi(t,e,n,r,i,s){const o=r.filter(l=>l.type===n);o.sort((l,a)=>hw(t,l,a)),o.forEach(l=>{const a=dw(t,l,s);i.forEach(u=>{u.respondsTo(l.type)&&e.push(u.createEvent(a,t.query_))})})}function dw(t,e,n){return e.type==="value"||e.type==="child_removed"||(e.prevName=n.getPredecessorChildName(e.childName,e.snapshotNode,t.index_)),e}function hw(t,e,n){if(e.childName==null||n.childName==null)throw mr("Should only compare child_ events.");const r=new K(e.childName,e.snapshotNode),i=new K(n.childName,n.snapshotNode);return t.index_.compare(r,i)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Gs(t,e){return{eventCache:t,serverCache:e}}function Ni(t,e,n,r){return Gs(new Gn(e,n,r),t.serverCache)}function gh(t,e,n,r){return Gs(t.eventCache,new Gn(e,n,r))}function xa(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function Yn(t){return t.serverCache.isFullyInitialized()?t.serverCache.getNode():null}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let ka;const pw=()=>(ka||(ka=new Je(Z_)),ka);class ce{constructor(e,n=pw()){this.value=e,this.children=n}static fromObject(e){let n=new ce(null);return Qe(e,(r,i)=>{n=n.set(new oe(r),i)}),n}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,n){if(this.value!=null&&n(this.value))return{path:te(),value:this.value};if(Y(e))return null;{const r=G(e),i=this.children.get(r);if(i!==null){const s=i.findRootMostMatchingPathAndValue(ae(e),n);return s!=null?{path:Ce(new oe(r),s.path),value:s.value}:null}else return null}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(Y(e))return this;{const n=G(e),r=this.children.get(n);return r!==null?r.subtree(ae(e)):new ce(null)}}set(e,n){if(Y(e))return new ce(n,this.children);{const r=G(e),s=(this.children.get(r)||new ce(null)).set(ae(e),n),o=this.children.insert(r,s);return new ce(this.value,o)}}remove(e){if(Y(e))return this.children.isEmpty()?new ce(null):new ce(null,this.children);{const n=G(e),r=this.children.get(n);if(r){const i=r.remove(ae(e));let s;return i.isEmpty()?s=this.children.remove(n):s=this.children.insert(n,i),this.value===null&&s.isEmpty()?new ce(null):new ce(this.value,s)}else return this}}get(e){if(Y(e))return this.value;{const n=G(e),r=this.children.get(n);return r?r.get(ae(e)):null}}setTree(e,n){if(Y(e))return n;{const r=G(e),s=(this.children.get(r)||new ce(null)).setTree(ae(e),n);let o;return s.isEmpty()?o=this.children.remove(r):o=this.children.insert(r,s),new ce(this.value,o)}}fold(e){return this.fold_(te(),e)}fold_(e,n){const r={};return this.children.inorderTraversal((i,s)=>{r[i]=s.fold_(Ce(e,i),n)}),n(e,this.value,r)}findOnPath(e,n){return this.findOnPath_(e,te(),n)}findOnPath_(e,n,r){const i=this.value?r(n,this.value):!1;if(i)return i;if(Y(e))return null;{const s=G(e),o=this.children.get(s);return o?o.findOnPath_(ae(e),Ce(n,s),r):null}}foreachOnPath(e,n){return this.foreachOnPath_(e,te(),n)}foreachOnPath_(e,n,r){if(Y(e))return this;{this.value&&r(n,this.value);const i=G(e),s=this.children.get(i);return s?s.foreachOnPath_(ae(e),Ce(n,i),r):new ce(null)}}foreach(e){this.foreach_(te(),e)}foreach_(e,n){this.children.inorderTraversal((r,i)=>{i.foreach_(Ce(e,r),n)}),this.value&&n(e,this.value)}foreachChild(e){this.children.inorderTraversal((n,r)=>{r.value&&e(n,r.value)})}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Tt{constructor(e){this.writeTree_=e}static empty(){return new Tt(new ce(null))}}function bi(t,e,n){if(Y(e))return new Tt(new ce(n));{const r=t.writeTree_.findRootMostValueAndPath(e);if(r!=null){const i=r.path;let s=r.value;const o=Xe(i,e);return s=s.updateChild(o,n),new Tt(t.writeTree_.set(i,s))}else{const i=new ce(n),s=t.writeTree_.setTree(e,i);return new Tt(s)}}}function yh(t,e,n){let r=t;return Qe(n,(i,s)=>{r=bi(r,Ce(e,i),s)}),r}function vh(t,e){if(Y(e))return Tt.empty();{const n=t.writeTree_.setTree(e,new ce(null));return new Tt(n)}}function Ta(t,e){return Qn(t,e)!=null}function Qn(t,e){const n=t.writeTree_.findRootMostValueAndPath(e);return n!=null?t.writeTree_.get(n.path).getChild(Xe(n.path,e)):null}function _h(t){const e=[],n=t.writeTree_.value;return n!=null?n.isLeafNode()||n.forEachChild(ve,(r,i)=>{e.push(new K(r,i))}):t.writeTree_.children.inorderTraversal((r,i)=>{i.value!=null&&e.push(new K(r,i.value))}),e}function dn(t,e){if(Y(e))return t;{const n=Qn(t,e);return n!=null?new Tt(new ce(n)):new Tt(t.writeTree_.subtree(e))}}function Ia(t){return t.writeTree_.isEmpty()}function Tr(t,e){return wh(te(),t.writeTree_,e)}function wh(t,e,n){if(e.value!=null)return n.updateChild(t,e.value);{let r=null;return e.children.inorderTraversal((i,s)=>{i===".priority"?(M(s.value!==null,"Priority writes must always be leaf nodes"),r=s.value):n=wh(Ce(t,i),s,n)}),!n.getChild(t).isEmpty()&&r!==null&&(n=n.updateChild(Ce(t,".priority"),r)),n}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Pa(t,e){return kh(e,t)}function mw(t,e,n,r,i){M(r>t.lastWriteId,"Stacking an older write on top of newer ones"),i===void 0&&(i=!0),t.allWrites.push({path:e,snap:n,writeId:r,visible:i}),i&&(t.visibleWrites=bi(t.visibleWrites,e,n)),t.lastWriteId=r}function gw(t,e){for(let n=0;nl.writeId===e);M(n>=0,"removeWrite called with nonexistent writeId.");const r=t.allWrites[n];t.allWrites.splice(n,1);let i=r.visible,s=!1,o=t.allWrites.length-1;for(;i&&o>=0;){const l=t.allWrites[o];l.visible&&(o>=n&&vw(l,r.path)?i=!1:xt(r.path,l.path)&&(s=!0)),o--}if(i){if(s)return _w(t),!0;if(r.snap)t.visibleWrites=vh(t.visibleWrites,r.path);else{const l=r.children;Qe(l,a=>{t.visibleWrites=vh(t.visibleWrites,Ce(r.path,a))})}return!0}else return!1}function vw(t,e){if(t.snap)return xt(t.path,e);for(const n in t.children)if(t.children.hasOwnProperty(n)&&xt(Ce(t.path,n),e))return!0;return!1}function _w(t){t.visibleWrites=Sh(t.allWrites,ww,te()),t.allWrites.length>0?t.lastWriteId=t.allWrites[t.allWrites.length-1].writeId:t.lastWriteId=-1}function ww(t){return t.visible}function Sh(t,e,n){let r=Tt.empty();for(let i=0;i{r=r.updateImmediateChild(s,o)}),r;if(n){const s=dn(t.visibleWrites,e);return n.forEachChild(ve,(o,l)=>{const a=Tr(dn(s,new oe(o)),l);r=r.updateImmediateChild(o,a)}),_h(s).forEach(o=>{r=r.updateImmediateChild(o.name,o.node)}),r}else{const s=dn(t.visibleWrites,e);return _h(s).forEach(o=>{r=r.updateImmediateChild(o.name,o.node)}),r}}function Ew(t,e,n,r,i){M(r||i,"Either existingEventSnap or existingServerSnap must exist");const s=Ce(e,n);if(Ta(t.visibleWrites,s))return null;{const o=dn(t.visibleWrites,s);return Ia(o)?i.getChild(n):Tr(o,i.getChild(n))}}function Cw(t,e,n,r){const i=Ce(e,n),s=Qn(t.visibleWrites,i);if(s!=null)return s;if(r.isCompleteForChild(n)){const o=dn(t.visibleWrites,i);return Tr(o,r.getNode().getImmediateChild(n))}else return null}function xw(t,e){return Qn(t.visibleWrites,e)}function kw(t,e,n,r,i,s,o){let l;const a=dn(t.visibleWrites,e),u=Qn(a,te());if(u!=null)l=u;else if(n!=null)l=Tr(a,n);else return[];if(l=l.withIndex(o),!l.isEmpty()&&!l.isLeafNode()){const d=[],c=o.getCompare(),f=s?l.getReverseIteratorFrom(r,o):l.getIteratorFrom(r,o);let p=f.getNext();for(;p&&d.length0||!t.eventCache.isFullyInitialized()||i&&!r.getNode().equals(s)||!r.getNode().getPriority().equals(s.getPriority()))&&n.push(ch(xa(e)))}}function Ih(t,e,n,r,i,s){const o=e.eventCache;if(Qs(r,n)!=null)return e;{let l,a;if(Y(n))if(M(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){const u=Yn(e),d=u instanceof q?u:q.EMPTY_NODE,c=Na(r,d);l=t.filter.updateFullNode(e.eventCache.getNode(),c,s)}else{const u=Ys(r,Yn(e));l=t.filter.updateFullNode(e.eventCache.getNode(),u,s)}else{const u=G(n);if(u===".priority"){M(fn(n)===1,"Can't have a priority with additional path components");const d=o.getNode();a=e.serverCache.getNode();const c=Ch(r,n,d,a);c!=null?l=t.filter.updatePriority(d,c):l=o.getNode()}else{const d=ae(n);let c;if(o.isCompleteForChild(u)){a=e.serverCache.getNode();const f=Ch(r,n,o.getNode(),a);f!=null?c=o.getNode().getImmediateChild(u).updateChild(d,f):c=o.getNode().getImmediateChild(u)}else c=ba(r,u,e.serverCache);c!=null?l=t.filter.updateChild(o.getNode(),u,c,d,i,s):l=o.getNode()}}return Ni(e,l,o.isFullyInitialized()||Y(n),t.filter.filtersNodes())}}function Xs(t,e,n,r,i,s,o,l){const a=e.serverCache;let u;const d=o?t.filter:t.filter.getIndexedFilter();if(Y(n))u=d.updateFullNode(a.getNode(),r,null);else if(d.filtersNodes()&&!a.isFiltered()){const p=a.getNode().updateChild(n,r);u=d.updateFullNode(a.getNode(),p,null)}else{const p=G(n);if(!a.isCompleteForPath(n)&&fn(n)>1)return e;const y=ae(n),P=a.getNode().getImmediateChild(p).updateChild(y,r);p===".priority"?u=d.updatePriority(a.getNode(),P):u=d.updateChild(a.getNode(),p,P,y,Th,null)}const c=gh(e,u,a.isFullyInitialized()||Y(n),d.filtersNodes()),f=new Ra(i,c,s);return Ih(t,c,n,i,f,l)}function Oa(t,e,n,r,i,s,o){const l=e.eventCache;let a,u;const d=new Ra(i,e,s);if(Y(n))u=t.filter.updateFullNode(e.eventCache.getNode(),r,o),a=Ni(e,u,!0,t.filter.filtersNodes());else{const c=G(n);if(c===".priority")u=t.filter.updatePriority(e.eventCache.getNode(),r),a=Ni(e,u,l.isFullyInitialized(),l.isFiltered());else{const f=ae(n),p=l.getNode().getImmediateChild(c);let y;if(Y(f))y=r;else{const S=d.getCompleteChild(c);S!=null?Jd(f)===".priority"&&S.getChild(eh(f)).isEmpty()?y=S:y=S.updateChild(f,r):y=q.EMPTY_NODE}if(p.equals(y))a=e;else{const S=t.filter.updateChild(l.getNode(),c,y,f,d,o);a=Ni(e,S,l.isFullyInitialized(),t.filter.filtersNodes())}}}return a}function Ph(t,e){return t.eventCache.isCompleteForChild(e)}function Lw(t,e,n,r,i,s,o){let l=e;return r.foreach((a,u)=>{const d=Ce(n,a);Ph(e,G(d))&&(l=Oa(t,l,d,u,i,s,o))}),r.foreach((a,u)=>{const d=Ce(n,a);Ph(e,G(d))||(l=Oa(t,l,d,u,i,s,o))}),l}function Nh(t,e,n){return n.foreach((r,i)=>{e=e.updateChild(r,i)}),e}function Da(t,e,n,r,i,s,o,l){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let a=e,u;Y(n)?u=r:u=new ce(null).setTree(n,r);const d=e.serverCache.getNode();return u.children.inorderTraversal((c,f)=>{if(d.hasChild(c)){const p=e.serverCache.getNode().getImmediateChild(c),y=Nh(t,p,f);a=Xs(t,a,new oe(c),y,i,s,o,l)}}),u.children.inorderTraversal((c,f)=>{const p=!e.serverCache.isCompleteForChild(c)&&f.value===null;if(!d.hasChild(c)&&!p){const y=e.serverCache.getNode().getImmediateChild(c),S=Nh(t,y,f);a=Xs(t,a,new oe(c),S,i,s,o,l)}}),a}function Aw(t,e,n,r,i,s,o){if(Qs(i,n)!=null)return e;const l=e.serverCache.isFiltered(),a=e.serverCache;if(r.value!=null){if(Y(n)&&a.isFullyInitialized()||a.isCompleteForPath(n))return Xs(t,e,n,a.getNode().getChild(n),i,s,l,o);if(Y(n)){let u=new ce(null);return a.getNode().forEachChild(Cr,(d,c)=>{u=u.set(new oe(d),c)}),Da(t,e,n,u,i,s,l,o)}else return e}else{let u=new ce(null);return r.foreach((d,c)=>{const f=Ce(n,d);a.isCompleteForPath(f)&&(u=u.set(d,a.getNode().getChild(f)))}),Da(t,e,n,u,i,s,l,o)}}function Mw(t,e,n,r,i){const s=e.serverCache,o=gh(e,s.getNode(),s.isFullyInitialized()||Y(n),s.isFiltered());return Ih(t,o,n,r,Th,i)}function Fw(t,e,n,r,i,s){let o;if(Qs(r,n)!=null)return e;{const l=new Ra(r,e,i),a=e.eventCache.getNode();let u;if(Y(n)||G(n)===".priority"){let d;if(e.serverCache.isFullyInitialized())d=Ys(r,Yn(e));else{const c=e.serverCache.getNode();M(c instanceof q,"serverChildren would be complete if leaf node"),d=Na(r,c)}d=d,u=t.filter.updateFullNode(a,d,s)}else{const d=G(n);let c=ba(r,d,e.serverCache);c==null&&e.serverCache.isCompleteForChild(d)&&(c=a.getImmediateChild(d)),c!=null?u=t.filter.updateChild(a,d,c,ae(n),l,s):e.eventCache.getNode().hasChild(d)?u=t.filter.updateChild(a,d,q.EMPTY_NODE,ae(n),l,s):u=a,u.isEmpty()&&e.serverCache.isFullyInitialized()&&(o=Ys(r,Yn(e)),o.isLeafNode()&&(u=t.filter.updateFullNode(u,o,s)))}return o=e.serverCache.isFullyInitialized()||Qs(r,te())!=null,Ni(e,u,o,t.filter.filtersNodes())}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class zw{constructor(e,n){this.query_=e,this.eventRegistrations_=[];const r=this.query_._queryParams,i=new _a(r.getIndex()),s=rw(r);this.processor_=bw(s);const o=n.serverCache,l=n.eventCache,a=i.updateFullNode(q.EMPTY_NODE,o.getNode(),null),u=s.updateFullNode(q.EMPTY_NODE,l.getNode(),null),d=new Gn(a,o.isFullyInitialized(),i.filtersNodes()),c=new Gn(u,l.isFullyInitialized(),s.filtersNodes());this.viewCache_=Gs(c,d),this.eventGenerator_=new cw(this.query_)}get query(){return this.query_}}function jw(t){return t.viewCache_.serverCache.getNode()}function Uw(t,e){const n=Yn(t.viewCache_);return n&&(t.query._queryParams.loadsAllData()||!Y(e)&&!n.getImmediateChild(G(e)).isEmpty())?n.getChild(e):null}function bh(t){return t.eventRegistrations_.length===0}function $w(t,e){t.eventRegistrations_.push(e)}function Rh(t,e,n){const r=[];if(n){M(e==null,"A cancel should cancel all event registrations.");const i=t.query._path;t.eventRegistrations_.forEach(s=>{const o=s.createCancelEvent(n,i);o&&r.push(o)})}if(e){let i=[];for(let s=0;s{r.push(kr(s,o))}),n.isFullyInitialized()&&r.push(ch(n.getNode())),Dh(t,r,n.getNode(),e)}function Dh(t,e,n,r){const i=r?[r]:t.eventRegistrations_;return fw(t.eventGenerator_,e,n,i)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let Js;class Hw{constructor(){this.views=new Map}}function Vw(t){M(!Js,"__referenceConstructor has already been defined"),Js=t}function Ww(){return M(Js,"Reference.ts has not been loaded"),Js}function qw(t){return t.views.size===0}function La(t,e,n,r){const i=e.source.queryId;if(i!==null){const s=t.views.get(i);return M(s!=null,"SyncTree gave us an op for an invalid query."),Oh(s,e,n,r)}else{let s=[];for(const o of t.views.values())s=s.concat(Oh(o,e,n,r));return s}}function Kw(t,e,n,r,i){const s=e._queryIdentifier,o=t.views.get(s);if(!o){let l=Ys(n,i?r:null),a=!1;l?a=!0:r instanceof q?(l=Na(n,r),a=!1):(l=q.EMPTY_NODE,a=!1);const u=Gs(new Gn(l,a,!1),new Gn(r,i,!1));return new zw(e,u)}return o}function Gw(t,e,n,r,i,s){const o=Kw(t,e,r,i,s);return t.views.has(e._queryIdentifier)||t.views.set(e._queryIdentifier,o),$w(o,n),Bw(o,n)}function Yw(t,e,n,r){const i=e._queryIdentifier,s=[];let o=[];const l=hn(t);if(i==="default")for(const[a,u]of t.views.entries())o=o.concat(Rh(u,n,r)),bh(u)&&(t.views.delete(a),u.query._queryParams.loadsAllData()||s.push(u.query));else{const a=t.views.get(i);a&&(o=o.concat(Rh(a,n,r)),bh(a)&&(t.views.delete(i),a.query._queryParams.loadsAllData()||s.push(a.query)))}return l&&!hn(t)&&s.push(new(Ww())(e._repo,e._path)),{removed:s,events:o}}function Lh(t){const e=[];for(const n of t.views.values())n.query._queryParams.loadsAllData()||e.push(n);return e}function Ir(t,e){let n=null;for(const r of t.views.values())n=n||Uw(r,e);return n}function Ah(t,e){if(e._queryParams.loadsAllData())return Zs(t);{const r=e._queryIdentifier;return t.views.get(r)}}function Mh(t,e){return Ah(t,e)!=null}function hn(t){return Zs(t)!=null}function Zs(t){for(const e of t.views.values())if(e.query._queryParams.loadsAllData())return e;return null}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let eo;function Qw(t){M(!eo,"__referenceConstructor has already been defined"),eo=t}function Xw(){return M(eo,"Reference.ts has not been loaded"),eo}let Jw=1;class Fh{constructor(e){this.listenProvider_=e,this.syncPointTree_=new ce(null),this.pendingWriteTree_=Tw(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function Zw(t,e,n,r,i){return mw(t.pendingWriteTree_,e,n,r,i),i?Ri(t,new Kn(mh(),e,n)):[]}function Pr(t,e,n=!1){const r=gw(t.pendingWriteTree_,e);if(yw(t.pendingWriteTree_,e)){let s=new ce(null);return r.snap!=null?s=s.set(te(),!0):Qe(r.children,o=>{s=s.set(new oe(o),!0)}),Ri(t,new Ks(r.path,s,n))}else return[]}function to(t,e,n){return Ri(t,new Kn(Ea(),e,n))}function eS(t,e,n){const r=ce.fromObject(n);return Ri(t,new Ii(Ea(),e,r))}function tS(t,e){return Ri(t,new Ti(Ea(),e))}function nS(t,e,n){const r=Ma(t,n);if(r){const i=Fa(r),s=i.path,o=i.queryId,l=Xe(s,e),a=new Ti(Ca(o),l);return za(t,s,a)}else return[]}function Aa(t,e,n,r,i=!1){const s=e._path,o=t.syncPointTree_.get(s);let l=[];if(o&&(e._queryIdentifier==="default"||Mh(o,e))){const a=Yw(o,e,n,r);qw(o)&&(t.syncPointTree_=t.syncPointTree_.remove(s));const u=a.removed;if(l=a.events,!i){const d=u.findIndex(f=>f._queryParams.loadsAllData())!==-1,c=t.syncPointTree_.findOnPath(s,(f,p)=>hn(p));if(d&&!c){const f=t.syncPointTree_.subtree(s);if(!f.isEmpty()){const p=sS(f);for(let y=0;y0&&!r&&(d?t.listenProvider_.stopListening(Oi(e),null):u.forEach(f=>{const p=t.queryToTagMap.get(ro(f));t.listenProvider_.stopListening(Oi(f),p)}))}oS(t,u)}return l}function rS(t,e,n,r){const i=Ma(t,r);if(i!=null){const s=Fa(i),o=s.path,l=s.queryId,a=Xe(o,e),u=new Kn(Ca(l),a,n);return za(t,o,u)}else return[]}function iS(t,e,n,r){const i=Ma(t,r);if(i){const s=Fa(i),o=s.path,l=s.queryId,a=Xe(o,e),u=ce.fromObject(n),d=new Ii(Ca(l),a,u);return za(t,o,d)}else return[]}function zh(t,e,n,r=!1){const i=e._path;let s=null,o=!1;t.syncPointTree_.foreachOnPath(i,(f,p)=>{const y=Xe(f,i);s=s||Ir(p,y),o=o||hn(p)});let l=t.syncPointTree_.get(i);l?(o=o||hn(l),s=s||Ir(l,te())):(l=new Hw,t.syncPointTree_=t.syncPointTree_.set(i,l));let a;s!=null?a=!0:(a=!1,s=q.EMPTY_NODE,t.syncPointTree_.subtree(i).foreachChild((p,y)=>{const S=Ir(y,te());S&&(s=s.updateImmediateChild(p,S))}));const u=Mh(l,e);if(!u&&!e._queryParams.loadsAllData()){const f=ro(e);M(!t.queryToTagMap.has(f),"View does not exist, but we have a tag");const p=lS();t.queryToTagMap.set(f,p),t.tagToQueryMap.set(p,f)}const d=Pa(t.pendingWriteTree_,i);let c=Gw(l,e,n,d,s,a);if(!u&&!o&&!r){const f=Ah(l,e);c=c.concat(aS(t,e,f))}return c}function jh(t,e,n){const i=t.pendingWriteTree_,s=t.syncPointTree_.findOnPath(e,(o,l)=>{const a=Xe(o,e),u=Ir(l,a);if(u)return u});return Eh(i,e,s,n,!0)}function Ri(t,e){return Uh(e,t.syncPointTree_,null,Pa(t.pendingWriteTree_,te()))}function Uh(t,e,n,r){if(Y(t.path))return $h(t,e,n,r);{const i=e.get(te());n==null&&i!=null&&(n=Ir(i,te()));let s=[];const o=G(t.path),l=t.operationForChild(o),a=e.children.get(o);if(a&&l){const u=n?n.getImmediateChild(o):null,d=xh(r,o);s=s.concat(Uh(l,a,u,d))}return i&&(s=s.concat(La(i,t,r,n))),s}}function $h(t,e,n,r){const i=e.get(te());n==null&&i!=null&&(n=Ir(i,te()));let s=[];return e.children.inorderTraversal((o,l)=>{const a=n?n.getImmediateChild(o):null,u=xh(r,o),d=t.operationForChild(o);d&&(s=s.concat($h(d,l,a,u)))}),i&&(s=s.concat(La(i,t,r,n))),s}function Bh(t,e){const n=e.query,r=no(t,n);return{hashFn:()=>(jw(e)||q.EMPTY_NODE).hash(),onComplete:i=>{if(i==="ok")return r?nS(t,n._path,r):tS(t,n._path);{const s=n1(i,n);return Aa(t,n,null,s)}}}}function no(t,e){const n=ro(e);return t.queryToTagMap.get(n)}function ro(t){return t._path.toString()+"$"+t._queryIdentifier}function Ma(t,e){return t.tagToQueryMap.get(e)}function Fa(t){const e=t.indexOf("$");return M(e!==-1&&e{if(n&&hn(n))return[Zs(n)];{let i=[];return n&&(i=Lh(n)),Qe(r,(s,o)=>{i=i.concat(o)}),i}})}function Oi(t){return t._queryParams.loadsAllData()&&!t._queryParams.isDefault()?new(Xw())(t._repo,t._path):t}function oS(t,e){for(let n=0;n{if(!Y(u)&&d&&hn(d))return[Zs(d).query];{let f=[];return d&&(f=f.concat(Lh(d).map(p=>p.query))),Qe(c,(p,y)=>{f=f.concat(y)}),f}});for(let u=0;u{const u=$a(a,e.getImmediateChild(l),n);u!==a&&(s=s.updateImmediateChild(l,u))}),s}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ba{constructor(e="",n=null,r={children:{},childCount:0}){this.name=e,this.parent=n,this.node=r}}function Ha(t,e){let n=e instanceof oe?e:new oe(e),r=t,i=G(n);for(;i!==null;){const s=gr(r.node.children,i)||{children:{},childCount:0};r=new Ba(i,r,s),n=ae(n),i=G(n)}return r}function Nr(t){return t.node.value}function Vh(t,e){t.node.value=e,Va(t)}function Wh(t){return t.node.childCount>0}function pS(t){return Nr(t)===void 0&&!Wh(t)}function io(t,e){Qe(t.node.children,(n,r)=>{e(new Ba(n,t,r))})}function qh(t,e,n,r){n&&!r&&e(t),io(t,i=>{qh(i,e,!0,r)}),n&&r&&e(t)}function mS(t,e,n){let r=n?t:t.parent;for(;r!==null;){if(e(r))return!0;r=r.parent}return!1}function Di(t){return new oe(t.parent===null?t.name:Di(t.parent)+"/"+t.name)}function Va(t){t.parent!==null&&gS(t.parent,t.name,t)}function gS(t,e,n){const r=pS(n),i=Vt(t.node.children,e);r&&i?(delete t.node.children[e],t.node.childCount--,Va(t)):!r&&!i&&(t.node.children[e]=n.node,t.node.childCount++,Va(t))}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const yS=/[\[\].#$\/\u0000-\u001F\u007F]/,vS=/[\[\].#$\u0000-\u001F\u007F]/,Wa=10*1024*1024,Kh=function(t){return typeof t=="string"&&t.length!==0&&!yS.test(t)},Gh=function(t){return typeof t=="string"&&t.length!==0&&!vS.test(t)},_S=function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),Gh(t)},Yh=function(t,e,n){const r=n instanceof oe?new A1(n,t):n;if(e===void 0)throw new Error(t+"contains undefined "+qn(r));if(typeof e=="function")throw new Error(t+"contains a function "+qn(r)+" with contents = "+e.toString());if(Sd(e))throw new Error(t+"contains "+e.toString()+" "+qn(r));if(typeof e=="string"&&e.length>Wa/3&&As(e)>Wa)throw new Error(t+"contains a string greater than "+Wa+" utf8 bytes "+qn(r)+" ('"+e.substring(0,50)+"...')");if(e&&typeof e=="object"){let i=!1,s=!1;if(Qe(e,(o,l)=>{if(o===".value")i=!0;else if(o!==".priority"&&o!==".sv"&&(s=!0,!Kh(o)))throw new Error(t+" contains an invalid key ("+o+") "+qn(r)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);M1(r,o),Yh(t,l,r),F1(r)}),i&&s)throw new Error(t+' contains ".value" child '+qn(r)+" in addition to actual children.")}},Qh=function(t,e,n,r){if(!(r&&n===void 0)&&!Gh(n))throw new Error(td(t,e)+'was an invalid path = "'+n+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},wS=function(t,e,n,r){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),Qh(t,e,n,r)},SS=function(t,e){const n=e.path.toString();if(typeof e.repoInfo.host!="string"||e.repoInfo.host.length===0||!Kh(e.repoInfo.namespace)&&e.repoInfo.host.split(":")[0]!=="localhost"||n.length!==0&&!_S(n))throw new Error(td(t,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ES{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function Xh(t,e){let n=null;for(let r=0;rpa(r,e))}function Xn(t,e,n){Xh(t,n),Zh(t,r=>xt(r,e)||xt(e,r))}function Zh(t,e){t.recursionDepth_++;let n=!0;for(let r=0;r{tp(t,r,i,s,o)},t.authTokenProvider_,t.appCheckProvider_),setTimeout(()=>np(t,!0),0);else{if(typeof n<"u"&&n!==null){if(typeof n!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{Te(n)}catch(r){throw new Error("Invalid authOverride provided: "+r)}}t.persistentConnection_=new qt(t.repoInfo_,e,(r,i,s,o)=>{tp(t,r,i,s,o)},r=>{np(t,r)},r=>{NS(t,r)},t.authTokenProvider_,t.appCheckProvider_,n),t.server_=t.persistentConnection_}t.authTokenProvider_.addTokenChangeListener(r=>{t.server_.refreshAuthToken(r)}),t.appCheckProvider_.addTokenChangeListener(r=>{t.server_.refreshAppCheckToken(r.token)}),t.statsReporter_=f1(t.repoInfo_,()=>new uw(t.stats_,t.server_)),t.infoData_=new iw,t.infoSyncTree_=new Fh({startListening:(r,i,s,o)=>{let l=[];const a=t.infoData_.getNode(r._path);return a.isEmpty()||(l=to(t.infoSyncTree_,r._path,a),setTimeout(()=>{o("ok")},0)),l},stopListening:()=>{}}),qa(t,"connected",!1),t.serverSyncTree_=new Fh({startListening:(r,i,s,o)=>(t.server_.listen(r,s,i,(l,a)=>{const u=o(l,a);Xn(t.eventQueue_,r._path,u)}),[]),stopListening:(r,i)=>{t.server_.unlisten(r,i)}})}function PS(t){const n=t.infoData_.getNode(new oe(".info/serverTimeOffset")).val()||0;return new Date().getTime()+n}function ep(t){return uS({timestamp:PS(t)})}function tp(t,e,n,r,i){t.dataUpdateCount++;const s=new oe(e);n=t.interceptServerDataCallback_?t.interceptServerDataCallback_(e,n):n;let o=[];if(i)if(r){const a=Ls(n,u=>Fe(u));o=iS(t.serverSyncTree_,s,a,i)}else{const a=Fe(n);o=rS(t.serverSyncTree_,s,a,i)}else if(r){const a=Ls(n,u=>Fe(u));o=eS(t.serverSyncTree_,s,a)}else{const a=Fe(n);o=to(t.serverSyncTree_,s,a)}let l=s;o.length>0&&(l=Ya(t,s)),Xn(t.eventQueue_,l,o)}function np(t,e){qa(t,"connected",e),e===!1&&RS(t)}function NS(t,e){Qe(e,(n,r)=>{qa(t,n,r)})}function qa(t,e,n){const r=new oe("/.info/"+e),i=Fe(n);t.infoData_.updateSnapshot(r,i);const s=to(t.infoSyncTree_,r,i);Xn(t.eventQueue_,r,s)}function bS(t){return t.nextWriteId_++}function RS(t){rp(t,"onDisconnectEvents");const e=ep(t),n=qs();Sa(t.onDisconnect_,te(),(i,s)=>{const o=dS(i,s,t.serverSyncTree_,e);hh(n,i,o)});let r=[];Sa(n,te(),(i,s)=>{r=r.concat(to(t.serverSyncTree_,i,s));const o=MS(t,i);Ya(t,o)}),t.onDisconnect_=qs(),Xn(t.eventQueue_,te(),r)}function OS(t,e,n){let r;G(e._path)===".info"?r=zh(t.infoSyncTree_,e,n):r=zh(t.serverSyncTree_,e,n),Jh(t.eventQueue_,e._path,r)}function Ka(t,e,n){let r;G(e._path)===".info"?r=Aa(t.infoSyncTree_,e,n):r=Aa(t.serverSyncTree_,e,n),Jh(t.eventQueue_,e._path,r)}function DS(t){t.persistentConnection_&&t.persistentConnection_.interrupt(xS)}function rp(t,...e){let n="";t.persistentConnection_&&(n=t.persistentConnection_.id+":"),Me(n,...e)}function ip(t,e,n){return jh(t.serverSyncTree_,e,n)||q.EMPTY_NODE}function Ga(t,e=t.transactionQueueTree_){if(e||so(t,e),Nr(e)){const n=op(t,e);M(n.length>0,"Sending zero length transaction queue"),n.every(i=>i.status===0)&&LS(t,Di(e),n)}else Wh(e)&&io(e,n=>{Ga(t,n)})}function LS(t,e,n){const r=n.map(u=>u.currentWriteId),i=ip(t,e,r);let s=i;const o=i.hash();for(let u=0;u{rp(t,"transaction put response",{path:a.toString(),status:u});let d=[];if(u==="ok"){const c=[];for(let f=0;fn[f].onComplete(null,!0,n[f].currentOutputSnapshotResolved)),n[f].unwatcher();so(t,Ha(t.transactionQueueTree_,e)),Ga(t,t.transactionQueueTree_),Xn(t.eventQueue_,e,d);for(let f=0;fl.status===0).map(l=>l.currentWriteId);for(let l=0;l=kS)d=!0,c="maxretry",i=i.concat(Pr(t.serverSyncTree_,a.currentWriteId,!0));else{const f=ip(t,a.path,o);a.currentInputSnapshot=f;const p=e[l].update(f.val());if(p!==void 0){Yh("transaction failed: Data returned ",p,a.path);let y=Fe(p);typeof p=="object"&&p!=null&&Vt(p,".priority")||(y=y.updatePriority(f.getPriority()));const P=a.currentWriteId,g=ep(t),h=hS(y,f,g);a.currentOutputSnapshotRaw=y,a.currentOutputSnapshotResolved=h,a.currentWriteId=bS(t),o.splice(o.indexOf(P),1),i=i.concat(Zw(t.serverSyncTree_,a.path,h,a.currentWriteId,a.applyLocally)),i=i.concat(Pr(t.serverSyncTree_,P,!0))}else d=!0,c="nodata",i=i.concat(Pr(t.serverSyncTree_,a.currentWriteId,!0))}Xn(t.eventQueue_,n,i),i=[],d&&(e[l].status=2,function(f){setTimeout(f,Math.floor(0))}(e[l].unwatcher),e[l].onComplete&&(c==="nodata"?r.push(()=>e[l].onComplete(null,!1,e[l].currentInputSnapshot)):r.push(()=>e[l].onComplete(new Error(c),!1,null))))}so(t,t.transactionQueueTree_);for(let l=0;lr.order-i.order),n}function lp(t,e,n){const r=Nr(e);if(r)for(let i=0;i{lp(t,i,n)})}function so(t,e){const n=Nr(e);if(n){let r=0;for(let i=0;i0?n:void 0)}io(e,r=>{so(t,r)})}function MS(t,e){const n=Di(sp(t,e)),r=Ha(t.transactionQueueTree_,e);return mS(r,i=>{Qa(t,i)}),Qa(t,r),qh(r,i=>{Qa(t,i)}),n}function Qa(t,e){const n=Nr(e);if(n){const r=[];let i=[],s=-1;for(let o=0;o0){let i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch{}e+="/"+i}return e}function zS(t){const e={};t.charAt(0)==="?"&&(t=t.substring(1));for(const n of t.split("&")){if(n.length===0)continue;const r=n.split("=");r.length===2?e[decodeURIComponent(r[0])]=decodeURIComponent(r[1]):st(`Invalid query segment '${n}' in query '${t}'`)}return e}const ap=function(t,e){const n=jS(t),r=n.namespace;n.domain==="firebase.com"&&Wt(n.host+" is no longer supported. Please use .firebaseio.com instead"),(!r||r==="undefined")&&n.domain!=="localhost"&&Wt("Cannot parse Firebase url. Please use https://.firebaseio.com"),n.secure||X_();const i=n.scheme==="ws"||n.scheme==="wss";return{repoInfo:new Ld(n.host,n.secure,r,i,e,"",r!==n.subdomain),path:new oe(n.pathString)}},jS=function(t){let e="",n="",r="",i="",s="",o=!0,l="https",a=443;if(typeof t=="string"){let u=t.indexOf("//");u>=0&&(l=t.substring(0,u-1),t=t.substring(u+2));let d=t.indexOf("/");d===-1&&(d=t.length);let c=t.indexOf("?");c===-1&&(c=t.length),e=t.substring(0,Math.min(d,c)),d=0?(o=l==="https"||l==="wss",a=parseInt(e.substring(u+1),10)):u=e.length;const p=e.slice(0,u);if(p.toLowerCase()==="localhost")n="localhost";else if(p.split(".").length<=2)n=p;else{const y=e.indexOf(".");r=e.substring(0,y).toLowerCase(),n=e.substring(y+1),s=r}"ns"in f&&(s=f.ns)}return{host:e,port:a,domain:n,subdomain:r,secure:o,scheme:l,pathString:i,namespace:s}};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class up{constructor(e,n,r,i){this.eventType=e,this.eventRegistration=n,this.snapshot=r,this.prevName=i}getPath(){const e=this.snapshot.ref;return this.eventType==="value"?e._path:e.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+Te(this.snapshot.exportVal())}}class cp{constructor(e,n,r){this.eventRegistration=e,this.error=n,this.path=r}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class fp{constructor(e,n){this.snapshotCallback=e,this.cancelCallback=n}onValue(e,n){this.snapshotCallback.call(null,e,n)}onCancel(e){return M(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,e)}get hasCancelCallback(){return!!this.cancelCallback}matches(e){return this.snapshotCallback===e.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===e.snapshotCallback.userCallback&&this.snapshotCallback.context===e.snapshotCallback.context}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Xa{constructor(e,n,r,i){this._repo=e,this._path=n,this._queryParams=r,this._orderByCalled=i}get key(){return Y(this._path)?null:Jd(this._path)}get ref(){return new Gt(this._repo,this._path)}get _queryIdentifier(){const e=dh(this._queryParams),n=oa(e);return n==="{}"?"default":n}get _queryObject(){return dh(this._queryParams)}isEqual(e){if(e=Ms(e),!(e instanceof Xa))return!1;const n=this._repo===e._repo,r=pa(this._path,e._path),i=this._queryIdentifier===e._queryIdentifier;return n&&r&&i}toJSON(){return this.toString()}toString(){return this._repo.toString()+L1(this._path)}}class Gt extends Xa{constructor(e,n){super(e,n,new wa,!1)}get parent(){const e=eh(this._path);return e===null?null:new Gt(this._repo,e)}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}}class Li{constructor(e,n,r){this._node=e,this.ref=n,this._index=r}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(e){const n=new oe(e),r=oo(this.ref,e);return new Li(this._node.getChild(n),r,ve)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(e){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(r,i)=>e(new Li(i,oo(this.ref,r),ve)))}hasChild(e){const n=new oe(e);return!this._node.getChild(n).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function dp(t,e){return t=Ms(t),t._checkNotDeleted("ref"),e!==void 0?oo(t._root,e):t._root}function oo(t,e){return t=Ms(t),G(t._path)===null?wS("child","path",e,!1):Qh("child","path",e,!1),new Gt(t._repo,Ce(t._path,e))}class lo{constructor(e){this.callbackContext=e}respondsTo(e){return e==="value"}createEvent(e,n){const r=n._queryParams.getIndex();return new up("value",this,new Li(e.snapshotNode,new Gt(n._repo,n._path),r))}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,null)}createCancelEvent(e,n){return this.callbackContext.hasCancelCallback?new cp(this,e,n):null}matches(e){return e instanceof lo?!e.callbackContext||!this.callbackContext?!0:e.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}}class ao{constructor(e,n){this.eventType=e,this.callbackContext=n}respondsTo(e){let n=e==="children_added"?"child_added":e;return n=n==="children_removed"?"child_removed":n,this.eventType===n}createCancelEvent(e,n){return this.callbackContext.hasCancelCallback?new cp(this,e,n):null}createEvent(e,n){M(e.childName!=null,"Child events should have a childName.");const r=oo(new Gt(n._repo,n._path),e.childName),i=n._queryParams.getIndex();return new up(e.type,this,new Li(e.snapshotNode,r,i),e.prevName)}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,e.prevName)}matches(e){return e instanceof ao?this.eventType===e.eventType&&(!this.callbackContext||!e.callbackContext||this.callbackContext.matches(e.callbackContext)):!1}hasAnyCallback(){return!!this.callbackContext}}function US(t,e,n,r,i){let s;if(typeof r=="object"&&(s=void 0,i=r),typeof r=="function"&&(s=r),i&&i.onlyOnce){const a=n,u=(d,c)=>{Ka(t._repo,t,l),a(d,c)};u.userCallback=n.userCallback,u.context=n.context,n=u}const o=new fp(n,s||void 0),l=e==="value"?new lo(o):new ao(e,o);return OS(t._repo,t,l),()=>Ka(t._repo,t,l)}function $S(t,e,n,r){return US(t,"value",e,n,r)}function BS(t,e,n){let r=null;const i=n?new fp(n):null;e==="value"?r=new lo(i):e&&(r=new ao(e,i)),Ka(t._repo,t,r)}Vw(Gt),Qw(Gt);/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const HS="FIREBASE_DATABASE_EMULATOR_HOST",Ja={};let VS=!1;function WS(t,e,n,r){t.repoInfo_=new Ld(`${e}:${n}`,!1,t.repoInfo_.namespace,t.repoInfo_.webSocketOnly,t.repoInfo_.nodeAdmin,t.repoInfo_.persistenceKey,t.repoInfo_.includeNamespaceInQueryParams,!0),r&&(t.authTokenProvider_=r)}function qS(t,e,n,r,i){let s=r||t.options.databaseURL;s===void 0&&(t.options.projectId||Wt("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),Me("Using default host for project ",t.options.projectId),s=`${t.options.projectId}-default-rtdb.firebaseio.com`);let o=ap(s,i),l=o.repoInfo,a,u;typeof process<"u"&&process.env&&(u=process.env[HS]),u?(a=!0,s=`http://${u}?ns=${l.namespace}`,o=ap(s,i),l=o.repoInfo):a=!o.repoInfo.secure;const d=i&&a?new Sr(Sr.OWNER):new a1(t.name,t.options,e);SS("Invalid Firebase Database URL",o),Y(o.path)||Wt("Database URL must point to the root of a Firebase Database (not including a child path).");const c=GS(l,t,d,new l1(t.name,n));return new YS(c,t)}function KS(t,e){const n=Ja[e];(!n||n[t.key]!==t)&&Wt(`Database ${e}(${t.repoInfo_}) has already been deleted.`),DS(t),delete n[t.key]}function GS(t,e,n,r){let i=Ja[e.name];i||(i={},Ja[e.name]=i);let s=i[t.toURLString()];return s&&Wt("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),s=new TS(t,VS,n,r),i[t.toURLString()]=s,s}class YS{constructor(e,n){this._repoInternal=e,this.app=n,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(IS(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new Gt(this._repo,te())),this._rootInternal}_delete(){return this._rootInternal!==null&&(KS(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){this._rootInternal===null&&Wt("Cannot call "+e+" on a deleted database.")}}function hp(t=ud(),e){const n=R_(t,"database").getImmediate({identifier:e});if(!n._instanceStarted){const r=C0("database");r&&QS(n,...r)}return n}function QS(t,e,n,r={}){t=Ms(t),t._checkNotDeleted("useEmulator"),t._instanceStarted&&Wt("Cannot call useEmulator() after instance has already been initialized.");const i=t._repoInternal;let s;if(i.repoInfo_.nodeAdmin)r.mockUserToken&&Wt('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),s=new Sr(Sr.OWNER);else if(r.mockUserToken){const o=typeof r.mockUserToken=="string"?r.mockUserToken:x0(r.mockUserToken,t.app.options.projectId);s=new Sr(o)}WS(i,e,n,s)}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function XS(t){q_(L_),zs(new di("database",(e,{instanceIdentifier:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("auth-internal"),s=e.getProvider("app-check-internal");return qS(r,i,s,n)},"PUBLIC").setMultipleInstances(!0)),yr(md,gd,t),yr(md,gd,"esm2017")}qt.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},qt.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)},XS();/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var br=function(){return br=Object.assign||function(e){for(var n,r=1,i=arguments.length;r{try{n.current=ud(t)}catch{n.current=na(e,t)}return()=>{}},[e,t]),n==null?void 0:n.current}function sE(t){return(...n)=>{const r=t(...n),i=r[2],s=Bf();if(i&&(console.error(i),s.debug))throw i;return r}}const mp=sE(rE),gp=F.createContext({});function oE({config:t,children:e}){var u;const[n,r]=F.useState(null),[i,s]=F.useState(null),o=iE("settings",{databaseURL:(u=t==null?void 0:t.settings_meta)==null?void 0:u.databaseUrl}),[l]=mp(dp(hp(o),"/live/status")),[a]=mp(dp(hp(o),"/showPip"));return F.useEffect(()=>{r(l==null?void 0:l.val())},[o,l]),F.useEffect(()=>{s(a==null?void 0:a.val())},[o,a]),L.createElement(gp.Provider,{value:{status:n,showPip:i}},e)}function lE(){return F.useContext(gp)}const yp=F.createContext({});function aE({children:t}){const e=o0(),[n,r]=F.useState({}),{liveId:i,customerId:s,configEndpoint:o}=Bf(),l={liveId:i,customerId:s};F.useEffect(()=>{Object.values(l).length>0&&d()},[]);function a(){const c=new Date().getTime(),f=new Date(n.live_starts_at).getTime();return f>c-108e5&&f0&&((c=n.player_settings)!=null&&c.active)?n.live_status==="live"||n.live_status==="awaiting"&&a():!1}function d(){e.custom(d0(o,l)).then(c=>{c&&(c!=null&&c.id)&&r(c)}).catch(c=>{})}return L.createElement(yp.Provider,{value:{config:n}},u()&&L.createElement(oE,{config:n},t))}function Jn(){return F.useContext(yp)}function uE(t){return L.createElement("svg",{width:"15",height:"11",viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},L.createElement("path",{d:"M3.24295 0.491293C3.45042 0.698759 3.45042 1.03513 3.24295 1.24259C0.891672 3.59388 0.891672 7.40606 3.24295 9.75734C3.45042 9.9648 3.45042 10.3012 3.24295 10.5086C3.03549 10.7161 2.69912 10.7161 2.49165 10.5086C-0.274561 7.74243 -0.274561 3.25751 2.49165 0.491293C2.69912 0.283827 3.03549 0.283827 3.24295 0.491293ZM12.509 0.491293C15.2752 3.25751 15.2752 7.74243 12.509 10.5086C12.3015 10.7161 11.9652 10.7161 11.7577 10.5086C11.5502 10.3012 11.5502 9.9648 11.7577 9.75734C14.109 7.40606 14.109 3.59388 11.7577 1.24259C11.5502 1.03513 11.5502 0.698759 11.7577 0.491293C11.9652 0.283827 12.3015 0.283827 12.509 0.491293ZM5.24642 2.49476C5.45389 2.70223 5.45389 3.0386 5.24642 3.24606C4.00163 4.49086 4.00163 6.50907 5.24642 7.75387C5.45389 7.96133 5.45389 8.2977 5.24642 8.50517C5.03896 8.71264 4.70259 8.71264 4.49512 8.50517C2.83539 6.84544 2.83539 4.15449 4.49512 2.49476C4.70259 2.2873 5.03896 2.2873 5.24642 2.49476ZM10.5055 2.49476C12.1653 4.15449 12.1653 6.84544 10.5055 8.50517C10.2981 8.71264 9.96169 8.71264 9.75423 8.50517C9.54676 8.2977 9.54676 7.96133 9.75423 7.75387C10.999 6.50907 10.999 4.49086 9.75423 3.24606C9.54676 3.0386 9.54676 2.70223 9.75423 2.49476C9.96169 2.2873 10.2981 2.2873 10.5055 2.49476ZM7.50032 4.43747C8.08713 4.43747 8.56282 4.91316 8.56282 5.49997C8.56282 6.08677 8.08713 6.56247 7.50032 6.56247C6.91352 6.56247 6.43782 6.08677 6.43782 5.49997C6.43782 4.91316 6.91352 4.43747 7.50032 4.43747Z",fill:`${t.color}`}))}function cE(t){const e={right:"mimo-pip--rounded-l-lg",left:"mimo-pip--rounded-r-lg"};return L.createElement("div",{className:`mimo-pip--h-14 mimo-pip--inline-flex mimo-pip--justify-center mimo-pip--items-start mimo-pip--pl-[18px] mimo-pip--pr-7 mimo-pip--pt-2 mimo-pip--pb-3 ${e[t.position]} mimo-pip--space-x-[10px] mimo-pip--cursor-pointer mimo-pip--shadow-[0px_2px_16px_rgba(0,0,0,0.25)]`,style:{backgroundColor:Un[t.theme].bg},onClick:t.onClick},L.createElement("div",{className:"mimo-pip--pt-1"},L.createElement(uE,{color:Un[t.theme].cta_icon})),L.createElement("div",{className:"mimo-pip--flex mimo-pip--flex-col mimo-pip--justify-start"},L.createElement("span",{className:"mimo-pip--text-12 mimo-pip--font-semiBold mimo-pip--uppercase mimo-pip--leading-[18px]",style:{color:Un[t.theme].txt}},t.title),L.createElement("span",{className:"mimo-pip--text-12 mimo-pip--text-white mimo-pip--font-regular mimo-pip--leading-[18px]",style:{color:Un[t.theme].txt}},t.text)))}function vp(){return{envIframe:'iframe[src^="https://sdk.mimo.com.br/"]',envTag:"mimo-player"}}const _p=F.createContext({});function fE(t){const[e,n]=F.useState(!1);return L.createElement(_p.Provider,{value:{isDragging:e,setIsDragging:n}},t.children)}function wp(){return F.useContext(_p)}const Sp=L.createContext({track:t=>{}});function uo(){return F.useContext(Sp)}function dE(t){const{children:e}=t,n=F.useRef(null),r=Jn(),i=F.useCallback(o=>{var l,a;(a=(l=n.current)==null?void 0:l.contentWindow)==null||a.postMessage(o,"*")},[]),s=F.useMemo(()=>({track:i}),[i]);return L.createElement(L.Fragment,null,L.createElement("iframe",{title:"tracking",ref:n,src:"https://pip.mimolivesales.com.br/v1/tracking/index.html?utm_campaign="+r.config.id+"&utm_id="+r.config.id,style:{position:"absolute",width:0,height:0,border:0}}),L.createElement(Sp.Provider,{value:s},e))}const Ep=F.createContext({});function hE({children:t}){const[e,n]=F.useState(!1),[r,i]=F.useState(!1),s=uo(),{config:o}=Jn(),{envIframe:l,envTag:a}=vp(),u=()=>{s.track({event:"pip_scrollTo_button",event_label:"Scroll To Live"});let c;document.querySelector(l)?c=document.querySelector(l):document.querySelector(a)&&(c=document.querySelector(a)),c==null||c.scrollIntoView()};function d(c){c.stopPropagation(),o.live_url&&(s.track({event:"pip_redirect_button",event_label:"Redirect To Live"}),history.pushState({},"",window.location.href),window.location.href=o.live_url)}return L.createElement(Ep.Provider,{value:{isLivePage:r,isLiveAlreadyClosed:e,onRedirect:d,onScrollToLive:u,setIsLivePage:i,setLiveAlreadyClosed:n}},t)}function Cp(){return F.useContext(Ep)}const xp=F.createContext({});function pE({children:t}){const e=uo(),n=F.useRef(null),[r,i]=F.useState(!0),[s,o]=F.useState(!1),[l,a]=F.useState(null);function u(p){r?e.track({event:"pip_unmuted_button",event_label:"Unmuted To Live"}):e.track({event:"pip_muted_button",event_label:"muted Live"}),p.stopPropagation(),i(!r)}function d(){var p;(p=n==null?void 0:n.current)==null||p.play(),o(!0)}function c(){o(!1)}function f(p){a(p)}return L.createElement(xp.Provider,{value:{play:s,pause:s,mute:r,progress:l,playerRef:n,onPlay:d,onPause:c,onMute:u,onProgress:f}},t)}function Za(){return F.useContext(xp)}var co={exports:{}},kp={},Tp={exports:{}},mE="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",gE=mE,yE=gE;function Ip(){}function Pp(){}Pp.resetWarningCache=Ip;var vE=function(){function t(r,i,s,o,l,a){if(a!==yE){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Pp,resetWarningCache:Ip};return n.PropTypes=n,n};Tp.exports=vE();var Np=Tp.exports,bp={exports:{}},ot={},Rp={exports:{}},Op={};/** * @license React * scheduler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */(function(t){function e(I,z){var v=I.length;I.push(z);e:for(;0>>1,_=I[C];if(0>>1;Ci(b,v))R<_&&0>i(U,b)?(I[C]=U,I[R]=v,C=R):(I[C]=b,I[k]=v,C=k);else if(R<_&&0>i(U,v))I[C]=U,I[R]=v,C=R;else break e}}return z}function i(I,z){var v=I.sortIndex-z.sortIndex;return v!==0?v:I.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var a=[],u=[],d=1,c=null,f=3,p=!1,y=!1,S=!1,P=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(I){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=I)r(u),z.sortIndex=z.expirationTime,e(a,z);else break;z=n(u)}}function E(I){if(S=!1,m(I),!y)if(n(a)!==null)y=!0,V(T);else{var z=n(u);z!==null&&B(E,z.startTime-I)}}function T(I,z){y=!1,S&&(S=!1,g(j),j=-1),p=!0;var v=f;try{for(m(z),c=n(a);c!==null&&(!(c.expirationTime>z)||I&&!ie());){var C=c.callback;if(typeof C=="function"){c.callback=null,f=c.priorityLevel;var _=C(c.expirationTime<=z);z=t.unstable_now(),typeof _=="function"?c.callback=_:c===n(a)&&r(a),m(z)}else r(a);c=n(a)}if(c!==null)var x=!0;else{var k=n(u);k!==null&&B(E,k.startTime-z),x=!1}return x}finally{c=null,f=v,p=!1}}var D=!1,A=null,j=-1,ne=5,W=-1;function ie(){return!(t.unstable_now()-WI||125C?(I.sortIndex=v,e(u,I),n(a)===null&&I===n(u)&&(S?(g(j),j=-1):S=!0,B(E,v-C))):(I.sortIndex=_,e(a,I),y||p||(y=!0,V(T))),I},t.unstable_shouldYield=ie,t.unstable_wrapCallback=function(I){var z=f;return function(){var v=f;f=z;try{return I.apply(this,arguments)}finally{f=v}}}})(Op),Rp.exports=Op;var _E=Rp.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Dp=F,lt=_E;function O(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),eu=Object.prototype.hasOwnProperty,wE=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Ap={},Mp={};function SE(t){return eu.call(Mp,t)?!0:eu.call(Ap,t)?!1:wE.test(t)?Mp[t]=!0:(Ap[t]=!0,!1)}function EE(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function CE(t,e,n,r){if(e===null||typeof e>"u"||EE(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ke(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Oe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Oe[t]=new Ke(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Oe[e]=new Ke(e,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){Oe[t]=new Ke(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Oe[t]=new Ke(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Oe[t]=new Ke(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){Oe[t]=new Ke(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){Oe[t]=new Ke(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){Oe[t]=new Ke(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){Oe[t]=new Ke(t,5,!1,t.toLowerCase(),null,!1,!1)});var tu=/[\-:]([a-z])/g;function nu(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(tu,nu);Oe[e]=new Ke(e,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(tu,nu);Oe[e]=new Ke(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(tu,nu);Oe[e]=new Ke(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){Oe[t]=new Ke(t,1,!1,t.toLowerCase(),null,!1,!1)}),Oe.xlinkHref=new Ke("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){Oe[t]=new Ke(t,1,!1,t.toLowerCase(),null,!0,!0)});function ru(t,e,n,r){var i=Oe.hasOwnProperty(e)?Oe[e]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==s[l]){var a=` `+i[o].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=o&&0<=l);break}}}finally{fu=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Fi(t):""}function xE(t){switch(t.tag){case 5:return Fi(t.type);case 16:return Fi("Lazy");case 13:return Fi("Suspense");case 19:return Fi("SuspenseList");case 0:case 2:case 15:return t=du(t.type,!1),t;case 11:return t=du(t.type.render,!1),t;case 1:return t=du(t.type,!0),t;default:return""}}function hu(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Dr:return"Fragment";case Or:return"Portal";case su:return"Profiler";case iu:return"StrictMode";case lu:return"Suspense";case au:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case zp:return(t.displayName||"Context")+".Consumer";case Fp:return(t._context.displayName||"Context")+".Provider";case ou:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case uu:return e=t.displayName||null,e!==null?e:hu(t.type)||"Memo";case pn:e=t._payload,t=t._init;try{return hu(t(e))}catch{}}return null}function kE(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return hu(e);case 8:return e===iu?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function mn(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function $p(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function TE(t){var e=$p(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function ho(t){t._valueTracker||(t._valueTracker=TE(t))}function Bp(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=$p(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function po(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function pu(t,e){var n=e.checked;return me({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Hp(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=mn(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Vp(t,e){e=e.checked,e!=null&&ru(t,"checked",e,!1)}function mu(t,e){Vp(t,e);var n=mn(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?gu(t,e.type,n):e.hasOwnProperty("defaultValue")&&gu(t,e.type,mn(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Wp(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function gu(t,e,n){(e!=="number"||po(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var zi=Array.isArray;function Lr(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=mo.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function ji(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Ui={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},IE=["Webkit","ms","Moz","O"];Object.keys(Ui).forEach(function(t){IE.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ui[e]=Ui[t]})});function Xp(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Ui.hasOwnProperty(t)&&Ui[t]?(""+e).trim():e+"px"}function Jp(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Xp(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var PE=me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function _u(t,e){if(e){if(PE[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(O(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(O(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(O(61))}if(e.style!=null&&typeof e.style!="object")throw Error(O(62))}}function wu(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Su=null;function Eu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Cu=null,Ar=null,Mr=null;function Zp(t){if(t=as(t)){if(typeof Cu!="function")throw Error(O(280));var e=t.stateNode;e&&(e=zo(e),Cu(t.stateNode,t.type,e))}}function em(t){Ar?Mr?Mr.push(t):Mr=[t]:Ar=t}function tm(){if(Ar){var t=Ar,e=Mr;if(Mr=Ar=null,Zp(t),e)for(t=0;t>>=0,t===0?32:31-(jE(t)/UE|0)|0}var wo=64,So=4194304;function Vi(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Eo(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Vi(l):(s&=o,s!==0&&(r=Vi(s)))}else o=n&~i,o!==0?r=Vi(o):s!==0&&(r=Vi(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Wi(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-It(e),t[e]=n}function VE(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=Zi),Nm=String.fromCharCode(32),bm=!1;function Rm(t,e){switch(t){case"keyup":return vC.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Om(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var jr=!1;function wC(t,e){switch(t){case"compositionend":return Om(e);case"keypress":return e.which!==32?null:(bm=!0,Nm);case"textInput":return t=e.data,t===Nm&&bm?null:t;default:return null}}function SC(t,e){if(jr)return t==="compositionend"||!$u&&Rm(t,e)?(t=Cm(),Io=Au=wn=null,jr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=jm(n)}}function $m(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?$m(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Bm(){for(var t=window,e=po();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=po(t.document)}return e}function Vu(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function bC(t){var e=Bm(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&$m(n.ownerDocument.documentElement,n)){if(r!==null&&Vu(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=Um(n,s);var o=Um(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ur=null,Wu=null,rs=null,qu=!1;function Hm(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;qu||Ur==null||Ur!==po(r)||(r=Ur,"selectionStart"in r&&Vu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),rs&&ns(rs,r)||(rs=r,r=Ao(Wu,"onSelect"),0Wr||(t.current=ic[Wr],ic[Wr]=null,Wr--)}function ue(t,e){Wr++,ic[Wr]=t.current,t.current=e}var xn={},ze=Cn(xn),Ze=Cn(!1),nr=xn;function qr(t,e){var n=t.type.contextTypes;if(!n)return xn;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function et(t){return t=t.childContextTypes,t!=null}function jo(){de(Ze),de(ze)}function ig(t,e,n){if(ze.current!==xn)throw Error(O(168));ue(ze,e),ue(Ze,n)}function sg(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(O(108,kE(t)||"Unknown",i));return me({},n,r)}function Uo(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||xn,nr=ze.current,ue(ze,t),ue(Ze,Ze.current),!0}function og(t,e,n){var r=t.stateNode;if(!r)throw Error(O(169));n?(t=sg(t,e,nr),r.__reactInternalMemoizedMergedChildContext=t,de(Ze),de(ze),ue(ze,t)):de(Ze),ue(Ze,n)}var Jt=null,$o=!1,sc=!1;function lg(t){Jt===null?Jt=[t]:Jt.push(t)}function BC(t){$o=!0,lg(t)}function kn(){if(!sc&&Jt!==null){sc=!0;var t=0,e=re;try{var n=Jt;for(re=1;t>=o,i-=o,Zt=1<<32-It(e)+i|n<j?(ne=A,A=null):ne=A.sibling;var W=f(g,A,m[j],E);if(W===null){A===null&&(A=ne);break}t&&A&&W.alternate===null&&e(g,A),h=s(W,h,j),D===null?T=W:D.sibling=W,D=W,A=ne}if(j===m.length)return n(g,A),he&&ir(g,j),T;if(A===null){for(;jj?(ne=A,A=null):ne=A.sibling;var ie=f(g,A,W.value,E);if(ie===null){A===null&&(A=ne);break}t&&A&&ie.alternate===null&&e(g,A),h=s(ie,h,j),D===null?T=ie:D.sibling=ie,D=ie,A=ne}if(W.done)return n(g,A),he&&ir(g,j),T;if(A===null){for(;!W.done;j++,W=m.next())W=c(g,W.value,E),W!==null&&(h=s(W,h,j),D===null?T=W:D.sibling=W,D=W);return he&&ir(g,j),T}for(A=r(g,A);!W.done;j++,W=m.next())W=p(A,g,j,W.value,E),W!==null&&(t&&W.alternate!==null&&A.delete(W.key===null?j:W.key),h=s(W,h,j),D===null?T=W:D.sibling=W,D=W);return t&&A.forEach(function(Ae){return e(g,Ae)}),he&&ir(g,j),T}function P(g,h,m,E){if(typeof m=="object"&&m!==null&&m.type===Dr&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case fo:e:{for(var T=m.key,D=h;D!==null;){if(D.key===T){if(T=m.type,T===Dr){if(D.tag===7){n(g,D.sibling),h=i(D,m.props.children),h.return=g,g=h;break e}}else if(D.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===pn&&Sg(T)===D.type){n(g,D.sibling),h=i(D,m.props),h.ref=us(g,D,m),h.return=g,g=h;break e}n(g,D);break}else e(g,D);D=D.sibling}m.type===Dr?(h=dr(m.props.children,g.mode,E,m.key),h.return=g,g=h):(E=ml(m.type,m.key,m.props,null,g.mode,E),E.ref=us(g,h,m),E.return=g,g=E)}return o(g);case Or:e:{for(D=m.key;h!==null;){if(h.key===D)if(h.tag===4&&h.stateNode.containerInfo===m.containerInfo&&h.stateNode.implementation===m.implementation){n(g,h.sibling),h=i(h,m.children||[]),h.return=g,g=h;break e}else{n(g,h);break}else e(g,h);h=h.sibling}h=nf(m,g.mode,E),h.return=g,g=h}return o(g);case pn:return D=m._init,P(g,h,D(m._payload),E)}if(zi(m))return y(g,h,m,E);if(Mi(m))return S(g,h,m,E);Qo(g,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,h!==null&&h.tag===6?(n(g,h.sibling),h=i(h,m),h.return=g,g=h):(n(g,h),h=tf(m,g.mode,E),h.return=g,g=h),o(g)):n(g,h)}return P}var Jr=Eg(!0),Cg=Eg(!1),cs={},Ft=Cn(cs),fs=Cn(cs),ds=Cn(cs);function or(t){if(t===cs)throw Error(O(174));return t}function _c(t,e){switch(ue(ds,e),ue(fs,t),ue(Ft,cs),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:vu(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=vu(e,t)}de(Ft),ue(Ft,e)}function Zr(){de(Ft),de(fs),de(ds)}function xg(t){or(ds.current);var e=or(Ft.current),n=vu(e,t.type);e!==n&&(ue(fs,t),ue(Ft,n))}function wc(t){fs.current===t&&(de(Ft),de(fs))}var ge=Cn(0);function Xo(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Sc=[];function Ec(){for(var t=0;tn?n:4,t(!0);var r=Cc.transition;Cc.transition={};try{t(!1),e()}finally{re=n,Cc.transition=r}}function Bg(){return _t().memoizedState}function qC(t,e,n){var r=Rn(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Hg(t))Vg(e,n);else if(n=hg(t,e,n,r),n!==null){var i=Ye();Dt(n,t,r,i),Wg(n,e,r)}}function KC(t,e,n){var r=Rn(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Hg(t))Vg(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,Pt(l,o)){var a=e.interleaved;a===null?(i.next=i,mc(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}n=hg(t,e,i,r),n!==null&&(i=Ye(),Dt(n,t,r,i),Wg(n,e,r))}}function Hg(t){var e=t.alternate;return t===ye||e!==null&&e===ye}function Vg(t,e){hs=Zo=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Wg(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,bu(t,n)}}var nl={readContext:vt,useCallback:je,useContext:je,useEffect:je,useImperativeHandle:je,useInsertionEffect:je,useLayoutEffect:je,useMemo:je,useReducer:je,useRef:je,useState:je,useDebugValue:je,useDeferredValue:je,useTransition:je,useMutableSource:je,useSyncExternalStore:je,useId:je,unstable_isNewReconciler:!1},GC={readContext:vt,useCallback:function(t,e){return zt().memoizedState=[t,e===void 0?null:e],t},useContext:vt,useEffect:Lg,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,el(4194308,4,Fg.bind(null,e,t),n)},useLayoutEffect:function(t,e){return el(4194308,4,t,e)},useInsertionEffect:function(t,e){return el(4,2,t,e)},useMemo:function(t,e){var n=zt();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=zt();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=qC.bind(null,ye,t),[r.memoizedState,t]},useRef:function(t){var e=zt();return t={current:t},e.memoizedState=t},useState:Og,useDebugValue:bc,useDeferredValue:function(t){return zt().memoizedState=t},useTransition:function(){var t=Og(!1),e=t[0];return t=WC.bind(null,t[1]),zt().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ye,i=zt();if(he){if(n===void 0)throw Error(O(407));n=n()}else{if(n=e(),be===null)throw Error(O(349));lr&30||Ig(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,Lg(Ng.bind(null,r,s,t),[t]),r.flags|=2048,gs(9,Pg.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=zt(),e=be.identifierPrefix;if(he){var n=en,r=Zt;n=(r&~(1<<32-It(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=ps++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Mt]=e,t[ls]=r,ay(t,e,!1,!1),e.stateNode=t;e:{switch(o=wu(n,r),n){case"dialog":fe("cancel",t),fe("close",t),i=r;break;case"iframe":case"object":case"embed":fe("load",t),i=r;break;case"video":case"audio":for(i=0;iri&&(e.flags|=128,r=!0,ys(s,!1),e.lanes=4194304)}else{if(!r)if(t=Xo(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),ys(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!he)return Ue(e),null}else 2*Se()-s.renderingStartTime>ri&&n!==1073741824&&(e.flags|=128,r=!0,ys(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Se(),e.sibling=null,n=ge.current,ue(ge,r?n&1|2:n&1),e):(Ue(e),null);case 22:case 23:return Jc(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?ft&1073741824&&(Ue(e),e.subtreeFlags&6&&(e.flags|=8192)):Ue(e),null;case 24:return null;case 25:return null}throw Error(O(156,e.tag))}function nx(t,e){switch(lc(e),e.tag){case 1:return et(e.type)&&jo(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Zr(),de(Ze),de(ze),Ec(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return wc(e),null;case 13:if(de(ge),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(O(340));Yr()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return de(ge),null;case 4:return Zr(),null;case 10:return hc(e.type._context),null;case 22:case 23:return Jc(),null;case 24:return null;default:return null}}var sl=!1,$e=!1,rx=typeof WeakSet=="function"?WeakSet:Set,$=null;function ti(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){_e(t,e,r)}else n.current=null}function Uc(t,e,n){try{n()}catch(r){_e(t,e,r)}}var fy=!1;function ix(t,e){if(Ju=ko,t=Bm(),Vu(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,u=0,d=0,c=t,f=null;t:for(;;){for(var p;c!==n||i!==0&&c.nodeType!==3||(l=o+i),c!==s||r!==0&&c.nodeType!==3||(a=o+r),c.nodeType===3&&(o+=c.nodeValue.length),(p=c.firstChild)!==null;)f=c,c=p;for(;;){if(c===t)break t;if(f===n&&++u===i&&(l=o),f===s&&++d===r&&(a=o),(p=c.nextSibling)!==null)break;c=f,f=c.parentNode}c=p}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Zu={focusedElem:t,selectionRange:n},ko=!1,$=e;$!==null;)if(e=$,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,$=t;else for(;$!==null;){e=$;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var S=y.memoizedProps,P=y.memoizedState,g=e.stateNode,h=g.getSnapshotBeforeUpdate(e.elementType===e.type?S:bt(e.type,S),P);g.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var m=e.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(O(163))}}catch(E){_e(e,e.return,E)}if(t=e.sibling,t!==null){t.return=e.return,$=t;break}$=e.return}return y=fy,fy=!1,y}function vs(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&Uc(e,n,s)}i=i.next}while(i!==r)}}function ol(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function $c(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function dy(t){var e=t.alternate;e!==null&&(t.alternate=null,dy(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Mt],delete e[ls],delete e[rc],delete e[UC],delete e[$C])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function hy(t){return t.tag===5||t.tag===3||t.tag===4}function py(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||hy(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Bc(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Fo));else if(r!==4&&(t=t.child,t!==null))for(Bc(t,e,n),t=t.sibling;t!==null;)Bc(t,e,n),t=t.sibling}function Hc(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Hc(t,e,n),t=t.sibling;t!==null;)Hc(t,e,n),t=t.sibling}var De=null,Rt=!1;function Pn(t,e,n){for(n=n.child;n!==null;)my(t,e,n),n=n.sibling}function my(t,e,n){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.onCommitFiberUnmount(_o,n)}catch{}switch(n.tag){case 5:$e||ti(n,e);case 6:var r=De,i=Rt;De=null,Pn(t,e,n),De=r,Rt=i,De!==null&&(Rt?(t=De,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):De.removeChild(n.stateNode));break;case 18:De!==null&&(Rt?(t=De,n=n.stateNode,t.nodeType===8?nc(t.parentNode,n):t.nodeType===1&&nc(t,n),Qi(t)):nc(De,n.stateNode));break;case 4:r=De,i=Rt,De=n.stateNode.containerInfo,Rt=!0,Pn(t,e,n),De=r,Rt=i;break;case 0:case 11:case 14:case 15:if(!$e&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Uc(n,e,o),i=i.next}while(i!==r)}Pn(t,e,n);break;case 1:if(!$e&&(ti(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){_e(n,e,l)}Pn(t,e,n);break;case 21:Pn(t,e,n);break;case 22:n.mode&1?($e=(r=$e)||n.memoizedState!==null,Pn(t,e,n),$e=r):Pn(t,e,n);break;default:Pn(t,e,n)}}function gy(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new rx),e.forEach(function(r){var i=hx.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Ot(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Se()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ox(r/1960))-r,10t?16:t,bn===null)var r=!1;else{if(t=bn,bn=null,fl=0,Z&6)throw Error(O(331));var i=Z;for(Z|=4,$=t.current;$!==null;){var s=$,o=s.child;if($.flags&16){var l=s.deletions;if(l!==null){for(var a=0;aSe()-qc?cr(t,0):Wc|=n),rt(t,e)}function Ny(t,e){e===0&&(t.mode&1?(e=So,So<<=1,!(So&130023424)&&(So=4194304)):e=1);var n=Ye();t=tn(t,e),t!==null&&(Wi(t,e,n),rt(t,n))}function dx(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Ny(t,n)}function hx(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(O(314))}r!==null&&r.delete(e),Ny(t,n)}var by;by=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ze.current)tt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return tt=!1,ex(t,e,n);tt=!!(t.flags&131072)}else tt=!1,he&&e.flags&1048576&&ag(e,Ho,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;il(t,e),t=e.pendingProps;var i=qr(e,ze.current);Xr(e,n),i=kc(null,e,r,t,i,n);var s=Tc();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,et(r)?(s=!0,Uo(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,gc(e),i.updater=Yo,e.stateNode=i,i._reactInternals=e,vc(e,r,t,n),e=Lc(null,e,r,!0,s,n)):(e.tag=0,he&&s&&oc(e),Ge(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(il(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=mx(r),t=bt(r,t),i){case 0:e=Dc(null,e,r,t,n);break e;case 1:e=ny(null,e,r,t,n);break e;case 11:e=Xg(null,e,r,t,n);break e;case 14:e=Jg(null,e,r,bt(r.type,t),n);break e}throw Error(O(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:bt(r,i),Dc(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:bt(r,i),ny(t,e,r,i,n);case 3:e:{if(ry(e),t===null)throw Error(O(387));r=e.pendingProps,s=e.memoizedState,i=s.element,pg(t,e),Go(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=ei(Error(O(423)),e),e=iy(t,e,r,n,i);break e}else if(r!==i){i=ei(Error(O(424)),e),e=iy(t,e,r,n,i);break e}else for(ct=En(e.stateNode.containerInfo.firstChild),ut=e,he=!0,Nt=null,n=Cg(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Yr(),r===i){e=rn(t,e,n);break e}Ge(t,e,r,n)}e=e.child}return e;case 5:return xg(e),t===null&&uc(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,ec(r,i)?o=null:s!==null&&ec(r,s)&&(e.flags|=32),ty(t,e),Ge(t,e,o,n),e.child;case 6:return t===null&&uc(e),null;case 13:return sy(t,e,n);case 4:return _c(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Jr(e,null,r,n):Ge(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:bt(r,i),Xg(t,e,r,i,n);case 7:return Ge(t,e,e.pendingProps,n),e.child;case 8:return Ge(t,e,e.pendingProps.children,n),e.child;case 12:return Ge(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,ue(Wo,r._currentValue),r._currentValue=o,s!==null)if(Pt(s.value,o)){if(s.children===i.children&&!Ze.current){e=rn(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(s.tag===1){a=nn(-1,n&-n),a.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?a.next=a:(a.next=d.next,d.next=a),u.pending=a}}s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),pc(s.return,n,e),l.lanes|=n;break}a=a.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(O(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),pc(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Ge(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Xr(e,n),i=vt(i),r=r(i),e.flags|=1,Ge(t,e,r,n),e.child;case 14:return r=e.type,i=bt(r,e.pendingProps),i=bt(r.type,i),Jg(t,e,r,i,n);case 15:return Zg(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:bt(r,i),il(t,e),e.tag=1,et(r)?(t=!0,Uo(e)):t=!1,Xr(e,n),_g(e,r,i),vc(e,r,i,n),Lc(null,e,r,!0,t,n);case 19:return ly(t,e,n);case 22:return ey(t,e,n)}throw Error(O(156,e.tag))};function Ry(t,e){return um(t,e)}function px(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function St(t,e,n,r){return new px(t,e,n,r)}function ef(t){return t=t.prototype,!(!t||!t.isReactComponent)}function mx(t){if(typeof t=="function")return ef(t)?1:0;if(t!=null){if(t=t.$$typeof,t===ou)return 11;if(t===uu)return 14}return 2}function Dn(t,e){var n=t.alternate;return n===null?(n=St(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function ml(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")ef(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Dr:return dr(n.children,i,s,e);case iu:o=8,i|=8;break;case su:return t=St(12,n,e,i|2),t.elementType=su,t.lanes=s,t;case lu:return t=St(13,n,e,i),t.elementType=lu,t.lanes=s,t;case au:return t=St(19,n,e,i),t.elementType=au,t.lanes=s,t;case jp:return gl(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Fp:o=10;break e;case zp:o=9;break e;case ou:o=11;break e;case uu:o=14;break e;case pn:o=16,r=null;break e}throw Error(O(130,t==null?t:typeof t,""))}return e=St(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function dr(t,e,n,r){return t=St(7,t,r,e),t.lanes=n,t}function gl(t,e,n,r){return t=St(22,t,r,e),t.elementType=jp,t.lanes=n,t.stateNode={isHidden:!1},t}function tf(t,e,n){return t=St(6,t,null,e),t.lanes=n,t}function nf(t,e,n){return e=St(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function gx(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Nu(0),this.expirationTimes=Nu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nu(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function rf(t,e,n,r,i,s,o,l,a){return t=new gx(t,e,n,l,a),e===1?(e=1,s===!0&&(e|=8)):e=0,s=St(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},gc(s),t}function yx(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Fy)}catch(t){console.error(t)}}Fy(),bp.exports=ot;var af=bp.exports;function zy(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";var r=(t=window.document)===null||t===void 0||(e=t.documentElement)===null||e===void 0?void 0:e.style;if(!r||n in r)return"";for(var i=0;i: Unmounted during event!");return e}var xl={},kl={};Object.defineProperty(kl,"__esModule",{value:!0}),kl.default=e2;function e2(){}function Tl(t){"@babel/helpers - typeof";return Tl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tl(t)}Object.defineProperty(xl,"__esModule",{value:!0}),xl.default=void 0;var hf=n2(F),pt=mf(Np),t2=mf(af),Be=we,Ln=$t,pf=Ut,Cs=mf(kl);function mf(t){return t&&t.__esModule?t:{default:t}}function Qy(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(Qy=function(i){return i?n:e})(t)}function n2(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||Tl(t)!=="object"&&typeof t!="function")return{default:t};var n=Qy(e);if(n&&n.has(t))return n.get(t);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&Object.prototype.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(r,s,o):r[s]=t[s]}return r.default=t,n&&n.set(t,r),r}function Xy(t,e){return o2(t)||s2(t,e)||i2(t,e)||r2()}function r2(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i2(t,e){if(t){if(typeof t=="string")return Jy(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jy(t,e)}}function Jy(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Il(t){return Il=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Il(t)}function Et(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Lt={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},An=Lt.mouse,Pl=function(t){u2(n,t);var e=c2(n);function n(){var r;l2(this,n);for(var i=arguments.length,s=new Array(i),o=0;o not mounted on DragStart!");var u=a.ownerDocument;if(!(r.props.disabled||!(l.target instanceof u.defaultView.Node)||r.props.handle&&!(0,Be.matchesSelectorAndParentsTo)(l.target,r.props.handle,a)||r.props.cancel&&(0,Be.matchesSelectorAndParentsTo)(l.target,r.props.cancel,a))){l.type==="touchstart"&&l.preventDefault();var d=(0,Be.getTouchIdentifier)(l);r.setState({touchIdentifier:d});var c=(0,Ln.getControlPosition)(l,d,He(r));if(c!=null){var f=c.x,p=c.y,y=(0,Ln.createCoreData)(He(r),f,p);(0,Cs.default)("DraggableCore: handleDragStart: %j",y),(0,Cs.default)("calling",r.props.onStart);var S=r.props.onStart(l,y);S===!1||r.mounted===!1||(r.props.enableUserSelectHack&&(0,Be.addUserSelectStyles)(u),r.setState({dragging:!0,lastX:f,lastY:p}),(0,Be.addEvent)(u,An.move,r.handleDrag),(0,Be.addEvent)(u,An.stop,r.handleDragStop))}}}),Et(He(r),"handleDrag",function(l){var a=(0,Ln.getControlPosition)(l,r.state.touchIdentifier,He(r));if(a!=null){var u=a.x,d=a.y;if(Array.isArray(r.props.grid)){var c=u-r.state.lastX,f=d-r.state.lastY,p=(0,Ln.snapToGrid)(r.props.grid,c,f),y=Xy(p,2);if(c=y[0],f=y[1],!c&&!f)return;u=r.state.lastX+c,d=r.state.lastY+f}var S=(0,Ln.createCoreData)(He(r),u,d);(0,Cs.default)("DraggableCore: handleDrag: %j",S);var P=r.props.onDrag(l,S);if(P===!1||r.mounted===!1){try{r.handleDragStop(new MouseEvent("mouseup"))}catch{var g=document.createEvent("MouseEvents");g.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),r.handleDragStop(g)}return}r.setState({lastX:u,lastY:d})}}),Et(He(r),"handleDragStop",function(l){if(r.state.dragging){var a=(0,Ln.getControlPosition)(l,r.state.touchIdentifier,He(r));if(a!=null){var u=a.x,d=a.y;if(Array.isArray(r.props.grid)){var c=u-r.state.lastX||0,f=d-r.state.lastY||0,p=(0,Ln.snapToGrid)(r.props.grid,c,f),y=Xy(p,2);c=y[0],f=y[1],u=r.state.lastX+c,d=r.state.lastY+f}var S=(0,Ln.createCoreData)(He(r),u,d),P=r.props.onStop(l,S);if(P===!1||r.mounted===!1)return!1;var g=r.findDOMNode();g&&r.props.enableUserSelectHack&&(0,Be.removeUserSelectStyles)(g.ownerDocument),(0,Cs.default)("DraggableCore: handleDragStop: %j",S),r.setState({dragging:!1,lastX:NaN,lastY:NaN}),g&&((0,Cs.default)("DraggableCore: Removing handlers"),(0,Be.removeEvent)(g.ownerDocument,An.move,r.handleDrag),(0,Be.removeEvent)(g.ownerDocument,An.stop,r.handleDragStop))}}}),Et(He(r),"onMouseDown",function(l){return An=Lt.mouse,r.handleDragStart(l)}),Et(He(r),"onMouseUp",function(l){return An=Lt.mouse,r.handleDragStop(l)}),Et(He(r),"onTouchStart",function(l){return An=Lt.touch,r.handleDragStart(l)}),Et(He(r),"onTouchEnd",function(l){return An=Lt.touch,r.handleDragStop(l)}),r}return a2(n,[{key:"componentDidMount",value:function(){this.mounted=!0;var i=this.findDOMNode();i&&(0,Be.addEvent)(i,Lt.touch.start,this.onTouchStart,{passive:!1})}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.findDOMNode();if(i){var s=i.ownerDocument;(0,Be.removeEvent)(s,Lt.mouse.move,this.handleDrag),(0,Be.removeEvent)(s,Lt.touch.move,this.handleDrag),(0,Be.removeEvent)(s,Lt.mouse.stop,this.handleDragStop),(0,Be.removeEvent)(s,Lt.touch.stop,this.handleDragStop),(0,Be.removeEvent)(i,Lt.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Be.removeUserSelectStyles)(s)}}},{key:"findDOMNode",value:function(){var i,s,o;return(i=this.props)!==null&&i!==void 0&&i.nodeRef?(s=this.props)===null||s===void 0||(o=s.nodeRef)===null||o===void 0?void 0:o.current:t2.default.findDOMNode(this)}},{key:"render",value:function(){return hf.cloneElement(hf.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}]),n}(hf.Component);xl.default=Pl,Et(Pl,"displayName","DraggableCore"),Et(Pl,"propTypes",{allowAnyClick:pt.default.bool,disabled:pt.default.bool,enableUserSelectHack:pt.default.bool,offsetParent:function(e,n){if(e[n]&&e[n].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:pt.default.arrayOf(pt.default.number),handle:pt.default.string,cancel:pt.default.string,nodeRef:pt.default.object,onStart:pt.default.func,onDrag:pt.default.func,onStop:pt.default.func,onMouseDown:pt.default.func,scale:pt.default.number,className:pf.dontSetMe,style:pf.dontSetMe,transform:pf.dontSetMe}),Et(Pl,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),function(t){function e(_){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(x){return typeof x}:function(x){return x&&typeof Symbol=="function"&&x.constructor===Symbol&&x!==Symbol.prototype?"symbol":typeof x},e(_)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return u.default}}),t.default=void 0;var n=y(F),r=f(Np),i=f(af),s=f(Ex),o=we,l=$t,a=Ut,u=f(xl),d=f(kl),c=["axis","bounds","children","defaultPosition","defaultClassName","defaultClassNameDragging","defaultClassNameDragged","position","positionOffset","scale"];function f(_){return _&&_.__esModule?_:{default:_}}function p(_){if(typeof WeakMap!="function")return null;var x=new WeakMap,k=new WeakMap;return(p=function(R){return R?k:x})(_)}function y(_,x){if(!x&&_&&_.__esModule)return _;if(_===null||e(_)!=="object"&&typeof _!="function")return{default:_};var k=p(x);if(k&&k.has(_))return k.get(_);var b={},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var U in _)if(U!=="default"&&Object.prototype.hasOwnProperty.call(_,U)){var H=R?Object.getOwnPropertyDescriptor(_,U):null;H&&(H.get||H.set)?Object.defineProperty(b,U,H):b[U]=_[U]}return b.default=_,k&&k.set(_,b),b}function S(){return S=Object.assign||function(_){for(var x=1;x=0)&&Object.prototype.propertyIsEnumerable.call(_,b)&&(k[b]=_[b])}return k}function g(_,x){if(_==null)return{};var k={},b=Object.keys(_),R,U;for(U=0;U=0)&&(k[R]=_[R]);return k}function h(_,x){var k=Object.keys(_);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(_);x&&(b=b.filter(function(R){return Object.getOwnPropertyDescriptor(_,R).enumerable})),k.push.apply(k,b)}return k}function m(_){for(var x=1;x_.length)&&(x=_.length);for(var k=0,b=new Array(x);k"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function z(_){return z=Object.setPrototypeOf?Object.getPrototypeOf:function(k){return k.__proto__||Object.getPrototypeOf(k)},z(_)}function v(_,x,k){return x in _?Object.defineProperty(_,x,{value:k,enumerable:!0,configurable:!0,writable:!0}):_[x]=k,_}var C=function(_){pe(k,_);var x=N(k);function k(b){var R;return W(this,k),R=x.call(this,b),v(B(R),"onDragStart",function(U,H){(0,d.default)("Draggable: onDragStart: %j",H);var J=R.props.onStart(U,(0,l.createDraggableData)(B(R),H));if(J===!1)return!1;R.setState({dragging:!0,dragged:!0})}),v(B(R),"onDrag",function(U,H){if(!R.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",H);var J=(0,l.createDraggableData)(B(R),H),se={x:J.x,y:J.y};if(R.props.bounds){var Fn=se.x,ln=se.y;se.x+=R.state.slackX,se.y+=R.state.slackY;var an=(0,l.getBoundPosition)(B(R),se.x,se.y),ee=E(an,2),it=ee[0],Ve=ee[1];se.x=it,se.y=Ve,se.slackX=R.state.slackX+(Fn-se.x),se.slackY=R.state.slackY+(ln-se.y),J.x=se.x,J.y=se.y,J.deltaX=se.x-R.state.x,J.deltaY=se.y-R.state.y}var We=R.props.onDrag(U,J);if(We===!1)return!1;R.setState(se)}),v(B(R),"onDragStop",function(U,H){if(!R.state.dragging)return!1;var J=R.props.onStop(U,(0,l.createDraggableData)(B(R),H));if(J===!1)return!1;(0,d.default)("Draggable: onDragStop: %j",H);var se={dragging:!1,slackX:0,slackY:0},Fn=!!R.props.position;if(Fn){var ln=R.props.position,an=ln.x,ee=ln.y;se.x=an,se.y=ee}R.setState(se)}),R.state={dragging:!1,dragged:!1,x:b.position?b.position.x:b.defaultPosition.x,y:b.position?b.position.y:b.defaultPosition.y,prevPropsPosition:m({},b.position),slackX:0,slackY:0,isElementSVG:!1},b.position&&!(b.onDrag||b.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element."),R}return Ae(k,[{key:"componentDidMount",value:function(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}},{key:"componentWillUnmount",value:function(){this.setState({dragging:!1})}},{key:"findDOMNode",value:function(){var R,U,H;return(R=(U=this.props)===null||U===void 0||(H=U.nodeRef)===null||H===void 0?void 0:H.current)!==null&&R!==void 0?R:i.default.findDOMNode(this)}},{key:"render",value:function(){var R,U=this.props;U.axis,U.bounds;var H=U.children,J=U.defaultPosition,se=U.defaultClassName,Fn=U.defaultClassNameDragging,ln=U.defaultClassNameDragged,an=U.position,ee=U.positionOffset;U.scale;var it=P(U,c),Ve={},We=null,Ns=!!an,zn=!Ns||this.state.dragging,$v=an||J,Bv={x:(0,l.canDragX)(this)&&zn?this.state.x:$v.x,y:(0,l.canDragY)(this)&&zn?this.state.y:$v.y};this.state.isElementSVG?We=(0,o.createSVGTransform)(Bv,ee):Ve=(0,o.createCSSTransform)(Bv,ee);var Rk=(0,s.default)(H.props.className||"",se,(R={},v(R,Fn,this.state.dragging),v(R,ln,this.state.dragged),R));return n.createElement(u.default,S({},it,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),n.cloneElement(n.Children.only(H),{className:Rk,style:m(m({},H.props.style),Ve),transform:We}))}}],[{key:"getDerivedStateFromProps",value:function(R,U){var H=R.position,J=U.prevPropsPosition;return H&&(!J||H.x!==J.x||H.y!==J.y)?((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:H,prevPropsPosition:J}),{x:H.x,y:H.y,prevPropsPosition:m({},H)}):null}}]),k}(n.Component);t.default=C,v(C,"displayName","Draggable"),v(C,"propTypes",m(m({},u.default.propTypes),{},{axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe})),v(C,"defaultProps",m(m({},u.default.defaultProps),{},{axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1}))}(kp);var ev=kp,tv=ev.default,h2=ev.DraggableCore;co.exports=tv,co.exports.default=tv,co.exports.DraggableCore=h2;var p2=co.exports;const m2=Ht(p2),g2={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console&&console[t]&&console[t].apply(console,e)}};class Nl{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,n)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=e||g2,this.options=n,this.debug=n.debug}log(){for(var e=arguments.length,n=new Array(e),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e]=this.observers[e].filter(r=>r!==n)}}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{o(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(o=>{o.apply(o,[e,...r])})}}function xs(){let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n}function nv(t){return t==null?"":""+t}function y2(t,e,n){t.forEach(r=>{e[r]&&(n[r]=e[r])})}function yf(t,e,n){function r(o){return o&&o.indexOf("###")>-1?o.replace(/###/g,"."):o}function i(){return!t||typeof t=="string"}const s=typeof e!="string"?[].concat(e):e.split(".");for(;s.length>1;){if(i())return{};const o=r(s.shift());!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={}}return i()?{}:{obj:t,k:r(s.shift())}}function rv(t,e,n){const{obj:r,k:i}=yf(t,e,Object);r[i]=n}function v2(t,e,n,r){const{obj:i,k:s}=yf(t,e,Object);i[s]=i[s]||[],r&&(i[s]=i[s].concat(n)),r||i[s].push(n)}function Rl(t,e){const{obj:n,k:r}=yf(t,e);if(n)return n[r]}function _2(t,e,n){const r=Rl(t,n);return r!==void 0?r:Rl(e,n)}function iv(t,e,n){for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?typeof t[r]=="string"||t[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?n&&(t[r]=e[r]):iv(t[r],e[r],n):t[r]=e[r]);return t}function oi(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var w2={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function S2(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,e=>w2[e]):t}const E2=[" ",",","?","!",";"];function C2(t,e,n){e=e||"",n=n||"";const r=E2.filter(o=>e.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!i.test(t);if(!s){const o=t.indexOf(n);o>0&&!i.test(t.substring(0,o))&&(s=!0)}return s}function Ol(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return t[e];const r=e.split(n);let i=t;for(let s=0;ss+o;)o++,l=r.slice(s,s+o).join(n),a=i[l];if(a===void 0)return;if(a===null)return null;if(e.endsWith(l)){if(typeof a=="string")return a;if(l&&typeof a[l]=="string")return a[l]}const u=r.slice(s+o).join(n);return u?Ol(a,u,n):void 0}i=i[r[s]]}return i}function vf(t){return t&&t.indexOf("_")>0?t.replace("_","-"):t}class sv extends bl{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let l=[e,n];r&&typeof r!="string"&&(l=l.concat(r)),r&&typeof r=="string"&&(l=l.concat(s?r.split(s):r)),e.indexOf(".")>-1&&(l=e.split("."));const a=Rl(this.data,l);return a||!o||typeof r!="string"?a:Ol(this.data&&this.data[e]&&this.data[e][n],r,s)}addResource(e,n,r,i){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let l=[e,n];r&&(l=l.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(l=e.split("."),i=n,n=l[1]),this.addNamespaces(n),rv(this.data,l,i),s.silent||this.emit("added",e,n,r,i)}addResources(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(typeof r[s]=="string"||Object.prototype.toString.apply(r[s])==="[object Array]")&&this.addResource(e,n,s,r[s],{silent:!0});i.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},l=[e,n];e.indexOf(".")>-1&&(l=e.split("."),i=r,r=n,n=l[1]),this.addNamespaces(n);let a=Rl(this.data,l)||{};i?iv(a,r,s):a={...a,...r},rv(this.data,l,a),o.silent||this.emit("added",e,n,r)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,n)}:this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var ov={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(s=>{this.processors[s]&&(e=this.processors[s].process(e,n,r,i))}),e}};const lv={};class Dl extends bl{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),y2(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Bt.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const r=this.resolve(e,n);return r&&r.res!==void 0}extractFromKey(e,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const o=r&&e.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!C2(e,r,i);if(o&&!l){const a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:s};const u=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),e=u.join(i)}return typeof s=="string"&&(s=[s]),{key:e,namespaces:s}}translate(e,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(e[e.length-1],n),a=l[l.length-1],u=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(d){const E=n.nsSeparator||this.options.nsSeparator;return i?{res:`${a}${E}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:a}:`${a}${E}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:a}:o}const c=this.resolve(e,n);let f=c&&c.res;const p=c&&c.usedKey||o,y=c&&c.exactUsedKey||o,S=Object.prototype.toString.apply(f),P=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,h=!this.i18nFormat||this.i18nFormat.handleAsObject;if(h&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&P.indexOf(S)<0&&!(typeof g=="string"&&S==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const E=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,f,{...n,ns:l}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(c.res=E,c):E}if(s){const E=S==="[object Array]",T=E?[]:{},D=E?y:p;for(const A in f)if(Object.prototype.hasOwnProperty.call(f,A)){const j=`${D}${s}${A}`;T[A]=this.translate(j,{...n,joinArrays:!1,ns:l}),T[A]===j&&(T[A]=f[A])}f=T}}else if(h&&typeof g=="string"&&S==="[object Array]")f=f.join(g),f&&(f=this.extendTranslation(f,e,n,r));else{let E=!1,T=!1;const D=n.count!==void 0&&typeof n.count!="string",A=Dl.hasDefaultValue(n),j=D?this.pluralResolver.getSuffix(u,n.count,n):"",ne=n.ordinal&&D?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",W=n[`defaultValue${j}`]||n[`defaultValue${ne}`]||n.defaultValue;!this.isValidLookup(f)&&A&&(E=!0,f=W),this.isValidLookup(f)||(T=!0,f=o);const Ae=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&T?void 0:f,pe=A&&W!==f&&this.options.updateMissing;if(T||E||pe){if(this.logger.log(pe?"updateKey":"missingKey",u,a,o,pe?W:f),s){const B=this.resolve(o,{...n,keySeparator:!1});B&&B.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let w=[];const N=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&N&&N[0])for(let B=0;B{const v=A&&z!==f?z:Ae;this.options.missingKeyHandler?this.options.missingKeyHandler(B,a,I,v,pe,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(B,a,I,v,pe,n),this.emit("missingKey",B,a,I,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&D?w.forEach(B=>{this.pluralResolver.getSuffixes(B,n).forEach(I=>{V([B],o+I,n[`defaultValue${I}`]||W)})}):V(w,o,W))}f=this.extendTranslation(f,e,n,c,r),T&&f===o&&this.options.appendNamespaceToMissingKey&&(f=`${a}:${o}`),(T||E)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${a}:${o}`:o,E?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(c.res=f,c):f}extendTranslation(e,n,r,i,s){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof e=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const f=e.match(this.interpolator.nestingRegexp);d=f&&f.length}let c=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),e=this.interpolator.interpolate(e,c,r.lng||this.language,r),u){const f=e.match(this.interpolator.nestingRegexp),p=f&&f.length;d1&&arguments[1]!==void 0?arguments[1]:{},r,i,s,o,l;return typeof e=="string"&&(e=[e]),e.forEach(a=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(a,n),d=u.key;i=d;let c=u.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",p=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),y=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",S=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);c.forEach(P=>{this.isValidLookup(r)||(l=P,!lv[`${S[0]}-${P}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(lv[`${S[0]}-${P}`]=!0,this.logger.warn(`key "${i}" for languages "${S.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),S.forEach(g=>{if(this.isValidLookup(r))return;o=g;const h=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(h,d,g,P,n);else{let E;f&&(E=this.pluralResolver.getSuffix(g,n.count,n));const T=`${this.options.pluralSeparator}zero`,D=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(h.push(d+E),n.ordinal&&E.indexOf(D)===0&&h.push(d+E.replace(D,this.options.pluralSeparator)),p&&h.push(d+T)),y){const A=`${d}${this.options.contextSeparator}${n.context}`;h.push(A),f&&(h.push(A+E),n.ordinal&&E.indexOf(D)===0&&h.push(A+E.replace(D,this.options.pluralSeparator)),p&&h.push(A+T))}}let m;for(;m=h.pop();)this.isValidLookup(r)||(s=m,r=this.getResource(g,P,m,n))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:l}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,n,r,i):this.resourceStore.getResource(e,n,r,i)}static hasDefaultValue(e){const n="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n===r.substring(0,n.length)&&e[r]!==void 0)return!0;return!1}}function _f(t){return t.charAt(0).toUpperCase()+t.slice(1)}class av{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Bt.create("languageUtils")}getScriptPartFromCode(e){if(e=vf(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=vf(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(typeof e=="string"&&e.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=e.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=_f(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=_f(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=_f(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(s=>{if(s===i)return s;if(!(s.indexOf("-")<0&&i.indexOf("-")<0)&&s.indexOf(i)===0)return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),typeof e=="string"&&(e=[e]),Object.prototype.toString.apply(e)==="[object Array]")return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],e),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return typeof e=="string"&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):typeof e=="string"&&s(this.formatLanguageCode(e)),r.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}}let x2=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],k2={1:function(t){return+(t>1)},2:function(t){return+(t!=1)},3:function(t){return 0},4:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},5:function(t){return t==0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},6:function(t){return t==1?0:t>=2&&t<=4?1:2},7:function(t){return t==1?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},8:function(t){return t==1?0:t==2?1:t!=8&&t!=11?2:3},9:function(t){return+(t>=2)},10:function(t){return t==1?0:t==2?1:t<7?2:t<11?3:4},11:function(t){return t==1||t==11?0:t==2||t==12?1:t>2&&t<20?2:3},12:function(t){return+(t%10!=1||t%100==11)},13:function(t){return+(t!==0)},14:function(t){return t==1?0:t==2?1:t==3?2:3},15:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2},16:function(t){return t%10==1&&t%100!=11?0:t!==0?1:2},17:function(t){return t==1||t%10==1&&t%100!=11?0:1},18:function(t){return t==0?0:t==1?1:2},19:function(t){return t==1?0:t==0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3},20:function(t){return t==1?0:t==0||t%100>0&&t%100<20?1:2},21:function(t){return t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0},22:function(t){return t==1?0:t==2?1:(t<0||t>10)&&t%10==0?2:3}};const T2=["v1","v2","v3"],I2=["v4"],uv={zero:0,one:1,two:2,few:3,many:4,other:5};function P2(){const t={};return x2.forEach(e=>{e.lngs.forEach(n=>{t[n]={numbers:e.nr,plurals:k2[e.fc]}})}),t}class N2{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=Bt.create("pluralResolver"),(!this.options.compatibilityJSON||I2.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=P2()}addRule(e,n){this.rules[e]=n}getRule(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(vf(e),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,r).map(i=>`${n}${i}`)}getSuffixes(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,s)=>uv[i]-uv[s]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(e,i,n)):[]}getSuffix(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(e,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,n){const r=e.noAbs?e.plurals(n):e.plurals(Math.abs(n));let i=e.numbers[r];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const s=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!T2.includes(this.options.compatibilityJSON)}}function cv(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=_2(t,e,n);return!s&&i&&typeof n=="string"&&(s=Ol(t,n,r),s===void 0&&(s=Ol(e,n,r))),s}class b2{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Bt.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(n=>n),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const n=e.interpolation;this.escape=n.escape!==void 0?n.escape:S2,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?oi(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?oi(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?oi(n.nestingPrefix):n.nestingPrefixEscaped||oi("$t("),this.nestingSuffix=n.nestingSuffix?oi(n.nestingSuffix):n.nestingSuffixEscaped||oi(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(e,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(e,n,r,i){let s,o,l;const a=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(y){return y.replace(/\$/g,"$$$$")}const d=y=>{if(y.indexOf(this.formatSeparator)<0){const h=cv(n,a,y,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(h,void 0,r,{...i,...n,interpolationkey:y}):h}const S=y.split(this.formatSeparator),P=S.shift().trim(),g=S.join(this.formatSeparator).trim();return this.format(cv(n,a,P,this.options.keySeparator,this.options.ignoreJSONStructure),g,r,{...i,...n,interpolationkey:P})};this.resetRegExp();const c=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:y=>u(y)},{regex:this.regexp,safeValue:y=>this.escapeValue?u(this.escape(y)):u(y)}].forEach(y=>{for(l=0;s=y.regex.exec(e);){const S=s[1].trim();if(o=d(S),o===void 0)if(typeof c=="function"){const g=c(e,s,i);o=typeof g=="string"?g:""}else if(i&&Object.prototype.hasOwnProperty.call(i,S))o="";else if(f){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${S} for interpolating ${e}`),o="";else typeof o!="string"&&!this.useRawValueToEscape&&(o=nv(o));const P=y.safeValue(o);if(e=e.replace(s[0],P),f?(y.regex.lastIndex+=o.length,y.regex.lastIndex-=s[0].length):y.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,s,o;function l(a,u){const d=this.nestingOptionsSeparator;if(a.indexOf(d)<0)return a;const c=a.split(new RegExp(`${d}[ ]*{`));let f=`{${c[1]}`;a=c[0],f=this.interpolate(f,o);const p=f.match(/'/g),y=f.match(/"/g);(p&&p.length%2===0&&!y||y.length%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),u&&(o={...u,...o})}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${a}`,S),`${a}${d}${f}`}return delete o.defaultValue,a}for(;i=this.nestingRegexp.exec(e);){let a=[];o={...r},o=o.replace&&typeof o.replace!="string"?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const d=i[1].split(this.formatSeparator).map(c=>c.trim());i[1]=d.shift(),a=d,u=!0}if(s=n(l.call(this,i[1].trim(),o),o),s&&i[0]===e&&typeof s!="string")return s;typeof s!="string"&&(s=nv(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),s=""),u&&(s=a.reduce((d,c)=>this.format(d,c,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),e=e.replace(i[0],s),this.regexp.lastIndex=0}return e}}function R2(t){let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const r=t.split("(");e=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);e==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(!o)return;const[l,...a]=o.split(":"),u=a.join(":").trim().replace(/^'+|'+$/g,"");n[l.trim()]||(n[l.trim()]=u),u==="false"&&(n[l.trim()]=!1),u==="true"&&(n[l.trim()]=!0),isNaN(u)||(n[l.trim()]=parseInt(u,10))})}return{formatName:e,formatOptions:n}}function li(t){const e={};return function(r,i,s){const o=i+JSON.stringify(s);let l=e[o];return l||(l=t(i,s),e[o]=l),l(r)}}class O2{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Bt.create("formatter"),this.options=e,this.formats={number:li((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return s=>i.format(s)}),currency:li((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>i.format(s)}),datetime:li((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return s=>i.format(s)}),relativetime:li((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return s=>i.format(s,r.range||"day")}),list:li((n,r)=>{const i=new Intl.ListFormat(n,{...r});return s=>i.format(s)})},this.init(e)}init(e){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=li(n)}format(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((l,a)=>{const{formatName:u,formatOptions:d}=R2(a);if(this.formats[u]){let c=l;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},p=f.locale||f.lng||i.locale||i.lng||r;c=this.formats[u](l,p,{...d,...i,...f})}catch(f){this.logger.warn(f)}return c}else this.logger.warn(`there was no format function for ${u}`);return l},e)}}function D2(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}class L2 extends bl{constructor(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Bt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(e,n,r,i){const s={},o={},l={},a={};return e.forEach(u=>{let d=!0;n.forEach(c=>{const f=`${u}|${c}`;!r.reload&&this.store.hasResourceBundle(u,c)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,d=!1,o[f]===void 0&&(o[f]=!0),s[f]===void 0&&(s[f]=!0),a[c]===void 0&&(a[c]=!0)))}),d||(l[u]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(a)}}loaded(e,n,r){const i=e.split("|"),s=i[0],o=i[1];n&&this.emit("failedLoading",s,o,n),r&&this.store.addResourceBundle(s,o,r),this.state[e]=n?-1:2;const l={};this.queue.forEach(a=>{v2(a.loaded,[s],o),D2(a,e),n&&a.errors.push(n),a.pendingCount===0&&!a.done&&(Object.keys(a.loaded).forEach(u=>{l[u]||(l[u]={});const d=a.loaded[u];d.length&&d.forEach(c=>{l[u][c]===void 0&&(l[u][c]=!0)})}),a.done=!0,a.errors.length?a.callback(a.errors):a.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(a=>!a.done)}read(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:i,wait:s,callback:o});return}this.readingCalls++;const l=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const c=this.waitingReads.shift();this.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}if(u&&d&&i{this.read.call(this,e,n,r,i+1,s*2,o)},s);return}o(u,d)},a=this.backend[r].bind(this.backend);if(a.length===2){try{const u=a(e,n);u&&typeof u.then=="function"?u.then(d=>l(null,d)).catch(l):l(null,u)}catch(u){l(u)}return}return a(e,n,l)}prepareLoading(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof n=="string"&&(n=[n]);const s=this.queueLoad(e,n,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,n,r){this.prepareLoading(e,n,{},r)}reload(e,n,r){this.prepareLoading(e,n,{reload:!0},r)}loadOne(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=e.split("|"),i=r[0],s=r[1];this.read(i,s,"read",void 0,void 0,(o,l)=>{o&&this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`,o),!o&&l&&this.logger.log(`${n}loaded namespace ${s} for language ${i}`,l),this.loaded(e,o,l)})}saveMissing(e,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const a={...o,isUpdate:s},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(e,n,r,i,a):d=u(e,n,r,i),d&&typeof d.then=="function"?d.then(c=>l(null,c)).catch(l):l(null,d)}catch(d){l(d)}else u(e,n,r,i,l,a)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}function fv(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){let n={};if(typeof e[1]=="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const r=e[3]||e[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(t,e,n,r)=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function dv(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function Ll(){}function A2(t){Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}class ks extends bl{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=dv(e),this.services={},this.logger=Bt,this.modules={external:[]},A2(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=fv();this.options={...i,...this.options,...dv(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function s(d){return d?typeof d=="function"?new d:d:null}if(!this.options.isClone){this.modules.logger?Bt.init(s(this.modules.logger),this.options):Bt.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=O2);const c=new av(this.options);this.store=new sv(this.options.resources,this.options);const f=this.services;f.logger=Bt,f.resourceStore=this.store,f.languageUtils=c,f.pluralResolver=new N2(c,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=s(d),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new b2(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new L2(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(p){for(var y=arguments.length,S=new Array(y>1?y-1:0),P=1;P1?y-1:0),P=1;P{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Ll),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=function(){return e.store[d](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=function(){return e.store[d](...arguments),e}});const a=xs(),u=()=>{const d=(c,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(f),r(c,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),a}loadResources(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ll;const i=typeof e=="string"?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode")return r();const s=[],o=l=>{if(!l)return;this.services.languageUtils.toResolveHierarchy(l).forEach(u=>{s.indexOf(u)<0&&s.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(a=>o(a)),this.options.preload&&this.options.preload.forEach(l=>o(l)),this.services.backendConnector.load(s,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(e,n,r){const i=xs();return e||(e=this.languages),n||(n=this.options.ns),r||(r=Ll),this.services.backendConnector.reload(e,n,s=>{i.resolve(),r(s)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&ov.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(e,n){var r=this;this.isLanguageChangingTo=e;const i=xs();this.emit("languageChanging",e);const s=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},o=(a,u)=>{u?(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(a,function(){return r.t(...arguments)})},l=a=>{!e&&!a&&this.services.languageDetector&&(a=[]);const u=typeof a=="string"?a:this.services.languageUtils.getBestMatchFromCodes(a);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,d=>{o(d,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(e),i}getFixedT(e,n,r){var i=this;const s=function(o,l){let a;if(typeof l!="object"){for(var u=arguments.length,d=new Array(u>2?u-2:0),c=2;c`${a.keyPrefix}${f}${y}`):p=a.keyPrefix?`${a.keyPrefix}${f}${o}`:o,i.t(p,a)};return typeof e=="string"?s.lng=e:s.lngs=e,s.ns=n,s.keyPrefix=r,s}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(l,a)=>{const u=this.services.backendConnector.state[`${l}|${a}`];return u===-1||u===2};if(n.precheck){const l=n.precheck(this,o);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!i||o(s,e)))}loadNamespaces(e,n){const r=xs();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(e,n){const r=xs();typeof e=="string"&&(e=[e]);const i=this.options.preload||[],s=e.filter(o=>i.indexOf(o)<0);return s.length?(this.options.preload=i.concat(s),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new av(fv());return n.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new ks(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ll;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},s=new ks(i);return(e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(l=>{s[l]=this[l]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(s.store=new sv(this.store.data,i),s.services.resourceStore=s.store),s.translator=new Dl(s.services,i),s.translator.on("*",function(l){for(var a=arguments.length,u=new Array(a>1?a-1:0),d=1;d{B!=window.location.href&&I(window.location.href)},500),F.useEffect(()=>{if(E==="live"&&T){const ee=document.querySelector(D)??document.querySelector(A);m.live_url!==window.location.href&&m.live_url!==B&&document.querySelector(D)===null?(a(!0),W(!1)):(W(!0),ee&&window.scrollY+60>=ee.offsetHeight?a(!0):(a(!1),V(!1)))}},[E,T,B,h.progress]),F.useEffect(()=>{i(window.innerHeight*.33),o(window.innerHeight*.33*.6)},[]),F.useEffect(()=>{var it,Ve;const ee=(Ve=(it=m==null?void 0:m.player_settings)==null?void 0:it.player_position)==null?void 0:Ve.replace("-"," ");(ee==null?void 0:ee.split(" ")[0])=="bottom"?d(We=>({...We,bottom:0,top:""})):d(We=>({...We,top:0,bottom:""})),(ee==null?void 0:ee.split(" ")[1])=="right"?d(We=>({...We,right:0,left:""})):d(We=>({...We,left:0,right:""}))},[]),F.useEffect(()=>{if(E){let ee;const it=()=>{w(!0),clearTimeout(ee),ee=setTimeout(()=>{w(!1)},1e3)};return window.addEventListener("scroll",it),()=>{window.removeEventListener("scroll",it),clearTimeout(ee)}}},[l,E]),F.useEffect(()=>{if(!pe){let ee;document.querySelector(D)?ee=document.querySelector(D):document.querySelector(A)&&(ee=document.querySelector(A)),ee!==null&&ee instanceof HTMLElement&&(window.scrollY+100>=ee.offsetHeight?a(!0):(a(!1),V(!1)))}},[D,A,pe]),F.useEffect(()=>{!N&&l&&h.progress&&(Ae.track({event:"pip_view",event_label:"pip_view"}),V(!0))},[N,l,h.progress]),F.useEffect(()=>{Re.isInitialized?v(!0):Re.on("initialized",()=>{v(!0)})},[]);function R(){const ee=c.current;if(ee){const it=ee.getBoundingClientRect();p({posX:it.left+window.scrollX,posY:it.top+window.scrollY});const Ve={posX:it.left+window.scrollX,posY:it.top+window.scrollY,largura:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,altura:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight};b({posX:_.posX,posY:_.posY,quadrant:_.quadrant});const We=window.innerWidth,Ns=window.innerHeight;let zn="";Ve.posX=We/2&&Ve.posY=Ns/2?zn="bottom-left":zn="bottom-right",x({posX:Ve.posX,posY:Ve.posY,quadrant:zn}),setTimeout(()=>{P(!1)},250)}}F.useEffect(()=>{g||Ae.track({event:"drag_drop",event_label:"drag&drop",position_start:k,position_end:_})},[g,k,_]);const U=F.useCallback(()=>{P(!0)},[]),H=F.useCallback(()=>{P(!1)},[]);return z?L.createElement(L.Fragment,null,l&&(j?L.createElement("div",{className:`block ${C[0]==="top"?"mt-[5%]":"mb-[5%]"}`,style:{...u,left:0,position:"fixed",zIndex:"999999999"}},L.createElement(cE,{title:`${n("wearelive_pip")}`,text:n("clickWatch_pip"),theme:(an=m==null?void 0:m.player_settings)==null?void 0:an.color_tag,position:"left",onClick:ee=>ne(ee)})):L.createElement("div",null,L.createElement(m2,{onStart:H,onDrag:U,onStop:R,bounds:"html",disabled:!m.player_settings.position_can_change},L.createElement("div",{className:y,ref:c,style:{display:h.progress&&h.play?"initial":"none",height:r,position:"fixed",zIndex:"2147483645",margin:"20px",...u}},t,L.createElement("div",{style:{backgroundImage:'url("https://assets.mimo.com.br/live_thumb/noise.gif")',backgroundSize:"cover",borderRadius:"8px",overflow:"hidden",height:r,width:s,border:"1px inset rgba(0, 0, 0, 0.12)",position:"relative",...u}},e)))))):null}function F2(){return L.createElement("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},L.createElement("path",{d:"M11.0468 0.578946C11.3679 0.257795 11.8886 0.257786 12.2098 0.578946C12.5309 0.900097 12.5309 1.4208 12.2098 1.74195L7.55771 6.39401L12.2098 11.046C12.5309 11.3671 12.5309 11.8878 12.2098 12.209C11.8886 12.5301 11.3679 12.5301 11.0468 12.209L6.39471 7.557L1.74275 12.209C1.73772 12.214 1.73266 12.2189 1.72754 12.2238C1.40536 12.53 0.895872 12.5251 0.579737 12.209C0.338873 11.9681 0.278651 11.615 0.399087 11.318C0.439227 11.219 0.499449 11.1262 0.579737 11.046L5.23172 6.39401L0.579737 1.74199C0.258577 1.42084 0.258577 0.900138 0.579737 0.578987C0.900888 0.257827 1.42159 0.257827 1.74274 0.578987L6.39471 5.23094L11.0468 0.578946Z",fill:"white"}))}function hv(t){return L.createElement("button",{className:"mimo-pip--w-[30px] mimo-pip--h-[30px] mimo-pip--min-w-[30px] mimo-pip--min-h-[30px] mimo-pip--bg-black mimo-pip--rounded-full mimo-pip--flex mimo-pip--justify-center mimo-pip--items-center",onClick:t.onClick,onTouchStart:t.onClick},L.createElement(F2,null))}function pv(){return L.createElement("svg",{width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",xmlns:"http://www.w3.org/2000/svg"},L.createElement("path",{d:"M2.4142 0.999921C2.02367 0.609401 1.39051 0.609401 0.99998 0.999921C0.60946 1.39045 0.60946 2.02361 0.99998 2.41414L4.58577 5.99992H2C0.89543 5.99992 0 6.89535 0 7.99992V11.9999C0 13.1045 0.89543 13.9999 2 13.9999H6L11.3492 18.585C11.9979 19.141 13 18.6801 13 17.8257V14.4142L18.5858 19.9999C18.9763 20.3905 19.6095 20.3905 20 19.9999C20.3905 19.6094 20.3905 18.9762 20 18.5857L2.4142 0.999921ZM6.51763 7.93178L11 12.4142V15.6515L7.30158 12.4814C6.9391 12.1707 6.47742 11.9999 6 11.9999H2V7.99992H6C6.17608 7.99992 6.35002 7.97669 6.51763 7.93178Z",fill:"white"}),L.createElement("path",{d:"M11 4.34839V6.75713L13 8.75713V2.17417C13 1.31982 11.9979 0.858909 11.3492 1.41492L8.28461 4.04173L9.70301 5.46012L11 4.34839Z",fill:"white"}),L.createElement("path",{d:"M15.7632 11.5203L17.2981 13.0552C17.358 12.9315 17.4144 12.806 17.4672 12.6787C17.8189 11.8294 18 10.9192 18 9.99989C18 9.08069 17.8189 8.17039 17.4672 7.32113C17.2433 6.78063 16.953 6.27157 16.604 5.8053C16.2731 5.36315 15.6332 5.36675 15.2426 5.75727C14.8521 6.1478 14.8623 6.77694 15.1675 7.23726C15.3446 7.50452 15.4961 7.78883 15.6194 8.08649C15.8707 8.69309 16 9.34329 16 9.99989C16 10.5167 15.9199 11.0296 15.7632 11.5203Z",fill:"white"}),L.createElement("path",{d:"M18.7387 14.4958L20.2287 15.9858C20.5926 15.4247 20.9055 14.8303 21.1627 14.2094C21.7155 12.8749 22 11.4445 22 9.99992C22 8.55542 21.7155 7.12501 21.1627 5.79043C20.7409 4.77213 20.1692 3.82483 19.4682 2.97929C19.1069 2.54347 18.4537 2.54628 18.0534 2.94658C17.6531 3.34688 17.6584 3.99266 18.0103 4.43609C18.526 5.08586 18.9499 5.8055 19.2686 6.57496C19.7184 7.66081 19.9499 8.82462 19.9499 9.99992C19.9499 11.1752 19.7184 12.3391 19.2686 13.4249C19.1157 13.7941 18.9386 14.1518 18.7387 14.4958Z",fill:"white"}))}function z2(){return L.createElement("svg",{width:"27",height:"30",viewBox:"0 0 27 30",fill:"none",xmlns:"http://www.w3.org/2000/svg"},L.createElement("path",{d:"M5.66788 28.7218C3.55676 29.9416 0.916992 28.4181 0.916992 25.9799V4.02029C0.916992 1.58213 3.55676 0.0586111 5.66786 1.27836L24.6714 12.2583C26.7814 13.4773 26.7814 16.523 24.6714 17.742L5.66788 28.7218Z",fill:"white"}))}function mv(){return L.createElement("svg",{width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",xmlns:"http://www.w3.org/2000/svg"},L.createElement("path",{d:"M11.3492 17.5851L6 13H2C0.89543 13 0 12.1046 0 11V7.00007C0 5.8955 0.89543 5.00007 2 5.00007H6L11.3492 0.415041C11.9979 -0.140969 13 0.319941 13 1.17429V16.8258C13 17.6802 11.9979 18.1411 11.3492 17.5851ZM6 11C6.47742 11 6.9391 11.1708 7.30158 11.4815L11 14.6516V3.34851L7.30158 6.51858C6.9391 6.82928 6.47742 7.00007 6 7.00007H2V11H6Z",fill:"white"}),L.createElement("path",{d:"M16.604 4.80548C16.2731 4.36334 15.6332 4.36693 15.2426 4.75746C14.8521 5.14798 14.8623 5.77712 15.1675 6.23745C15.3446 6.5047 15.4961 6.78902 15.6194 7.08665C15.8707 7.69335 16 8.34345 16 9.00005C16 9.65675 15.8707 10.3068 15.6194 10.9135C15.4961 11.2111 15.3446 11.4954 15.1675 11.7627C14.8623 12.223 14.8521 12.8522 15.2426 13.2427C15.6332 13.6332 16.2731 13.6368 16.604 13.1947C16.953 12.7284 17.2433 12.2193 17.4672 11.6788C17.8189 10.8295 18 9.91935 18 9.00005C18 8.08085 17.8189 7.17055 17.4672 6.32131C17.4532 6.28753 17.4389 6.25387 17.4244 6.22034C17.2068 5.71735 16.9312 5.24261 16.604 4.80548Z",fill:"white"}),L.createElement("path",{d:"M18.0534 1.9467C18.4537 1.5464 19.1069 1.54359 19.4682 1.97941C19.5558 2.0851 19.6414 2.19238 19.725 2.30119C20.3098 3.06288 20.7936 3.89953 21.1627 4.79054C21.2318 4.95736 21.2967 5.12568 21.3574 5.29534C21.7822 6.48294 22 7.73611 22 9.00001C22 10.4446 21.7155 11.875 21.1627 13.2096C20.7409 14.2279 20.1692 15.1751 19.4682 16.0207C19.1069 16.4565 18.4537 16.4537 18.0534 16.0534C17.6531 15.6531 17.6584 15.0073 18.0103 14.5639C18.526 13.9141 18.9499 13.1945 19.2686 12.425C19.7184 11.3392 19.9499 10.1754 19.9499 9.00001C19.9499 7.82471 19.7184 6.66092 19.2686 5.57507C18.9499 4.80561 18.526 4.08598 18.0103 3.43621C17.9663 3.38078 17.9278 3.32219 17.8947 3.26131C17.6634 2.83517 17.7031 2.29696 18.0534 1.9467Z",fill:"white"}))}function j2(t){return L.createElement("div",{className:"mimo-pip--rounded-full mimo-pip--animate-pulse mimo-pip--w-1 mimo-pip--h-1 sm:mimo-pip--w-2 sm:mimo-pip--h-2",style:{backgroundColor:t.color}})}function U2(t){return L.createElement("div",{className:`mimo-pip--inline-flex mimo-pip--items-center mimo-pip--justify-center mimo-pip--shadow-[0px_2px_16px_rgba(0,0,0,0.25)] mimo-pip--h-[17px] mimo-pip--p-1 mimo-pip--space-x-1 mimo-pip--sm:h-[33px] mimo-pip--rounded mimo-pip--sm:px-3 mimo-pip--sm:py-2 mimo-pip--sm:space-x-2`,style:{backgroundColor:Un[t.theme].bg}},L.createElement(j2,{color:Un[t.theme].icon}),L.createElement("span",{className:"mimo-pip--uppercase mimo-pip--font-semiBold mimo-pip--text-[7px] mimo-pip--sm:text-12",style:{color:Un[t.theme].txt}},t.text))}function $2(){if(console&&console.warn){for(var t=arguments.length,e=new Array(t),n=0;n()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}};function vv(t,e,n){t.loadNamespaces(e,yv(t,n))}function _v(t,e,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,yv(t,r))}function B2(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=e.languages[0],i=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(l,a)=>{const u=e.services.backendConnector.state[`${l}|${a}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!o(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||o(r,t)&&(!i||o(s,t)))}function H2(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(wf("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:n.lng,precheck:(i,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!s(i.isLanguageChangingTo,t))return!1}}):B2(t,e,n)}const V2=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,W2={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},q2=t=>W2[t];let Sf={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:t=>t.replace(V2,q2)};function K2(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Sf={...Sf,...t}}function G2(){return Sf}let wv;function Y2(t){wv=t}function Q2(){return wv}const X2={type:"3rdParty",init(t){K2(t.options.react),Y2(t)}},J2=F.createContext();class Z2{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const ek=(t,e)=>{const n=F.useRef();return F.useEffect(()=>{n.current=e?n.current:t},[t,e]),n.current};function Sv(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=e,{i18n:r,defaultNS:i}=F.useContext(J2)||{},s=n||r||Q2();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new Z2),!s){wf("You will need to pass in an i18next instance by using initReactI18next");const m=(T,D)=>typeof D=="string"?D:D&&typeof D=="object"&&typeof D.defaultValue=="string"?D.defaultValue:Array.isArray(T)?T[T.length-1]:T,E=[m,{},!1];return E.t=m,E.i18n={},E.ready=!1,E}s.options.react&&s.options.react.wait!==void 0&&wf("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...G2(),...s.options.react,...e},{useSuspense:l,keyPrefix:a}=o;let u=t||i||s.options&&s.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(u);const d=(s.isInitialized||s.initializedStoreOnce)&&u.every(m=>H2(m,s,o));function c(){return s.getFixedT(e.lng||null,o.nsMode==="fallback"?u:u[0],a)}const[f,p]=F.useState(c);let y=u.join();e.lng&&(y=`${e.lng}${y}`);const S=ek(y),P=F.useRef(!0);F.useEffect(()=>{const{bindI18n:m,bindI18nStore:E}=o;P.current=!0,!d&&!l&&(e.lng?_v(s,e.lng,u,()=>{P.current&&p(c)}):vv(s,u,()=>{P.current&&p(c)})),d&&S&&S!==y&&P.current&&p(c);function T(){P.current&&p(c)}return m&&s&&s.on(m,T),E&&s&&s.store.on(E,T),()=>{P.current=!1,m&&s&&m.split(" ").forEach(D=>s.off(D,T)),E&&s&&E.split(" ").forEach(D=>s.store.off(D,T))}},[s,y]);const g=F.useRef(!0);F.useEffect(()=>{P.current&&!g.current&&p(c),g.current=!1},[s,a]);const h=[f,s,d];if(h.t=f,h.i18n=s,h.ready=d,d||!d&&!l)return h;throw new Promise(m=>{e.lng?_v(s,e.lng,u,()=>m()):vv(s,u,()=>m())})}function tk(t){var d;const[e,n]=F.useState(!1),[r,i]=F.useState(null),{config:s}=Jn(),{t:o}=Sv(),{isDragging:l}=wp(),a=()=>{i(new Date)},u=c=>{c.stopPropagation(),c.preventDefault(),r!==null&&(new Date().getTime()-r.getTime()<150&&t.handleGoLive(c),i(null))};return L.createElement(L.Fragment,null,!t.isPlaying&&L.createElement("div",{className:"mimo-pip--absolute mimo-pip--flex mimo-pip--items-center mimo-pip--justify-center mimo-pip--w-full mimo-pip--h-full mimo-pip--z-[20]"},L.createElement("div",{className:"mimo-pip--cursor-pointer",onClick:t.onPlay,onTouchEnd:t.onPlay},L.createElement(z2,null))),window.innerWidth<768&&L.createElement("div",{className:"mimo-pip--absolute",style:{top:"-6px",right:"-12px",zIndex:"2147483647"}},L.createElement("div",{className:"mimo-pip--cursor-pointer mimo-pip--flex mimo-pip--justify-center mimo-pip--items-center"},L.createElement(hv,{onClick:()=>t.handleLiveClose()}))),e&&L.createElement("div",{className:"mimo-pip--absolute",style:{top:"-6px",right:"-12px",zIndex:"2147483647"},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1)},L.createElement("div",{className:"mimo-pip--cursor-pointer mimo-pip--flex mimo-pip--justify-center mimo-pip--items-center"},L.createElement(hv,{onClick:()=>t.handleLiveClose()}))),e&&L.createElement("div",{style:{zIndex:"2147483647"},className:"mimo-pip--cursor-pointer mimo-pip--absolute mimo-pip--bottom-[10px] mimo-pip--right-[10px]",onTouchStart:c=>t.handleMute(c),onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onClick:c=>{c.stopPropagation(),t.handleMute(c)}},!t.isLivePage&&L.createElement(L.Fragment,null,t.isMuted?L.createElement(pv,null):L.createElement(mv,null))),window.innerWidth<768&&L.createElement("div",{style:{zIndex:"2147483647"},className:"mimo-pip--cursor-pointer mimo-pip--absolute mimo-pip--bottom-[10px] mimo-pip--right-[10px]",onTouchStart:c=>t.handleMute(c),onClick:c=>{c.stopPropagation(),t.handleMute(c)}},!t.isLivePage&&L.createElement(L.Fragment,null,t.isMuted?L.createElement(pv,null):L.createElement(mv,null))),L.createElement("div",{onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!e),onTouchStart:()=>a(),onTouchEnd:c=>u(c),onClick:c=>{l||t.handleGoLive(c)},className:`${t.cantMove?"mimo-pip--cursor-grab":"mimo-pip--cursor-default"} mimo-pip--w-full mimo-pip--h-full mimo-pip--absolute mimo-pip--left-0 mimo-pip--top-0 mimo-pip--flex mimo-pip--flex-1 mimo-pip--flex-col mimo-pip--justify-between`,style:{backgroundColor:e?"#0000004d":"rgba(0, 0, 0, 0)",borderRadius:"8px",zIndex:"2147483646"}},L.createElement("div",{className:"mimo-pip--flex mimo-pip--flex-col mimo-pip--w-full mimo-pip--h-full mimo-pip--justify-between"},L.createElement("div",{className:"mimo-pip--flex mimo-pip--relative mimo-pip--w-full",style:{position:"relative",width:"100%"}},L.createElement("div",{className:"mimo-pip--p-2 mimo-pip--w-full"},L.createElement(U2,{text:o("live"),theme:(d=s==null?void 0:s.player_settings)==null?void 0:d.color_tag}))))))}function nk(){var a;const t=Za(),{config:e}=Jn(),n=uo(),{onScrollToLive:r,isLivePage:i,setLiveAlreadyClosed:s,onRedirect:o}=Cp();function l(){n.track({event:"pip_close_button",event_label:"Close Live"}),s(!0)}return L.createElement(tk,{handleScrollToLive:()=>r(),isLivePage:i,handleGoLive:u=>o(u),handleLiveClose:()=>l(),handleMute:u=>t.onMute(u),isMuted:t.mute,isPlaying:t.play,onPlay:t.onPlay,cantMove:!!((a=e==null?void 0:e.player_settings)!=null&&a.position_can_change)})}var rk=Object.defineProperty,ik=(t,e,n)=>e in t?rk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Mn=(t,e,n)=>(ik(t,typeof e!="symbol"?e+"":e,n),n),Ev={exports:{}},Q={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Cv;function sk(){if(Cv)return Q;Cv=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),c=Symbol.iterator;function f(v){return v===null||typeof v!="object"?null:(v=c&&v[c]||v["@@iterator"],typeof v=="function"?v:null)}var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,S={};function P(v,C,_){this.props=v,this.context=C,this.refs=S,this.updater=_||p}P.prototype.isReactComponent={},P.prototype.setState=function(v,C){if(typeof v!="object"&&typeof v!="function"&&v!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,v,C,"setState")},P.prototype.forceUpdate=function(v){this.updater.enqueueForceUpdate(this,v,"forceUpdate")};function g(){}g.prototype=P.prototype;function h(v,C,_){this.props=v,this.context=C,this.refs=S,this.updater=_||p}var m=h.prototype=new g;m.constructor=h,y(m,P.prototype),m.isPureReactComponent=!0;var E=Array.isArray,T=Object.prototype.hasOwnProperty,D={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function j(v,C,_){var x,k={},b=null,R=null;if(C!=null)for(x in C.ref!==void 0&&(R=C.ref),C.key!==void 0&&(b=""+C.key),C)T.call(C,x)&&!A.hasOwnProperty(x)&&(k[x]=C[x]);var U=arguments.length-2;if(U===1)k.children=_;else if(1{if(this.videoInstance){const n=this.currentTime()||0,r=this.getSecondsLoaded(),i=this.getDuration();if(i){const s={playedSeconds:n,played:n/i};r!==null&&(s.loadedSeconds=r,s.loaded=r/i),(s.playedSeconds!==this.prevPlayed||s.loadedSeconds!==this.prevLoaded)&&this.props.onProgress&&this.props.onProgress(s),this.prevPlayed=s.playedSeconds,this.prevLoaded=s.loadedSeconds}}this.progressTimeout=setTimeout(this.progress,1e3)})}componentDidMount(){const{tech:e}=this.props;this.videoInstance||(e==="mimo"?this.registerIVSTech():this.registerGenericTech())}componentWillUnmount(){var e;clearTimeout(this.progressTimeout),(e=this.resizeObserver)==null||e.disconnect();const n=document.getElementById("mimo-player-ivs");n&&document.body.removeChild(n)}registerGenericTech(){const e=this.videoRef;e.addEventListener("play",()=>{this.props.debug&&console.log("Generic Tech: Play event"),this.progress(),this.props.onPlay&&this.props.onPlay()}),e.addEventListener("pause",()=>{this.props.debug&&console.log("Generic Tech: Pause event"),this.props.onPause&&this.props.onPause()}),e.addEventListener("error",()=>{this.props.onError&&this.props.onError("Error, failed to load the video")}),this.setStyle(),this.videoInstance=this.registerTechInstance({play:()=>e.play(),pause:()=>e.pause(),mute:n=>e.muted=n,isMuted:()=>e.muted,duration:()=>e.duration,currentTime:()=>e.currentTime,seekTo:n=>e.currentTime=n,buffered:()=>e.buffered,seekable:()=>e.seekable})}loadIvs(){return new Promise(e=>{const n=globalThis;if(!document.getElementById("mimo-player-ivs")){const s=document.createElement("script");s.src="https://player.live-video.net/1.23.0/amazon-ivs-player.min.js",s.async=!0,s.setAttribute("id","mimo-player-ivs"),document.body.appendChild(s)}function r(){n.IVSPlayer&&(clearInterval(i),e(n.IVSPlayer))}const i=setInterval(r,1e3)})}registerIVSTech(){this.loadIvs().then(e=>{const n=e==null?void 0:e.create(),{PlayerEventType:r,PlayerState:i}=e,s=async()=>{this.loadStreaming=setTimeout(()=>{n==null||n.load(this.props.src)},3e3)},o=this.videoRef;o&&(n==null||n.attachHTMLVideoElement(o)),n==null||n.load(this.props.src),n==null||n.setMuted(this.props.muted),n==null||n.addEventListener(i.PLAYING,()=>{this.props.debug&&console.log("Mimo Tech: Play event"),this.props.onError&&this.props.onError("no error"),this.progress(),this.props.onPlay&&this.props.onPlay()}),n==null||n.addEventListener(i.IDLE,()=>{this.props.debug&&console.log("Mimo Tech: Pause event"),this.props.onPause&&this.props.onPause()}),n==null||n.addEventListener(i.ENDED,()=>{this.props.debug&&console.log("Mimo Tech: Ended event"),s(),this.props.onError&&this.props.onError("ended")}),n==null||n.addEventListener(r.SEEK_COMPLETED,l=>{this.props.debug&&console.log("Mimo Tech: Seek event"),this.props.onSeek&&this.props.onSeek(l)}),n==null||n.addEventListener(r.TEXT_METADATA_CUE,l=>{this.props.onTimedMetadata&&this.props.onTimedMetadata(l.text)}),n==null||n.addEventListener(r.QUALITY_CHANGED,l=>{this.props.debug&&console.log("Mimo Tech: Quality change 1"),this.props.lowQuality&&l.width>360&&(n==null||n.setQuality({name:"360p",group:"360p30",codecs:"avc1.4D401F,mp4a.40.2",bitrate:63e4,width:360,height:640,framerate:30,isDefault:!1},!0)),this.props.debug&&console.log("Mimo Tech: Quality change 2")}),n==null||n.addEventListener(r.ERROR,l=>{s(),this.props.onError&&this.props.onError(l.message)}),this.setStyle(),this.videoInstance=this.registerTechInstance({play:()=>n==null?void 0:n.play(),pause:()=>n==null?void 0:n.pause(),mute:l=>n==null?void 0:n.setMuted(l),isMuted:()=>n==null?void 0:n.isMuted(),duration:()=>n==null?void 0:n.getDuration(),currentTime:()=>n==null?void 0:n.getPosition(),seekTo:l=>n==null?void 0:n.seekTo(l),buffered:()=>n.getBuffered(),seekable:()=>n.getBuffered()})})}registerTechInstance(e){return e}play(){this.videoInstance&&this.videoInstance.play()}pause(){this.videoInstance&&this.videoInstance.pause()}mute(e){if(e!==void 0)this.videoInstance.mute(e);else{const n=this.isMuted();n instanceof Promise?n.then(r=>this.videoInstance.mute(!r)):this.videoInstance.mute(!n)}}isMuted(){return this.videoInstance?this.videoInstance.isMuted():!1}duration(){if(this.videoInstance)return this.props.onDuration?this.props.onDuration(this.getDuration()):this.videoInstance.duration()}currentTime(){if(this.videoInstance)return this.videoInstance.currentTime()}getSecondsLoaded(){if(!this.videoRef)return null;const{buffered:e}=this.videoRef;if(e.length===0)return 0;const n=e.end(e.length-1),r=this.duration();return n>r?r:n}getDuration(){if(!this.videoRef)return null;const{duration:e,seekable:n}=this.videoRef;return e===1/0&&n.length>0?n.end(n.length-1):e}seekTo(e){if(e>0&&e<1){const n=this.duration();if(!n){console.warn("MimoPlayer: duration not yet available");return}this.videoInstance.seekTo(n*e);return}this.videoInstance.seekTo(e)}getCoverWScale(e,n,r,i){const s=e/n,o=r/i;return s{var p;let y=1,S=1;o&&(y=this.getCoverWScale(c,f,r,i)),l&&a>0&&u>0&&(S=this.getCoverWScale(a,u,c,f));const P=c*y*S,g=P/s;this.videoRef&&Object.assign((p=this.videoRef)==null?void 0:p.style,{width:`${P}px`,height:`${g}px`,marginLeft:`${h(this.props.tech)}px`,marginTop:`${(g-f)/-2}px`,pointerEvents:"none",position:"absolute",top:0,left:0,zIndex:0,objectFit:"cover"});function h(m){return 0}};this.resizeObserver=new ResizeObserver(c=>{const f=c[0].contentRect;d(f.width,f.height)}),this.resizeObserver.observe(n)}fallbackSource(){if(this.videoRef&&this.props.poster){const e=this.videoRef.querySelector("img");e&&this.videoRef.replaceChild(e,this.videoRef)}}renderVideoElement(){const{tech:e,src:n,videoId:r,autoplay:i,muted:s,loop:o,poster:l,preload:a}=this.props;return Iv("video",{ref:u=>this.videoRef=u,id:r,src:n,autoPlay:i,muted:s,loop:o,poster:l,preload:a??"auto",tabIndex:-1,playsInline:!0,className:"h-full w-full"})}render(){return Iv(ak,{children:this.renderVideoElement()})}}function ck(){const t=Za(),{config:e}=Jn();return L.createElement(uk,{forceCover:!0,ref:t.playerRef,loop:!0,muted:t.mute,autoplay:!0,fluid:!1,tech:e.stream_type,src:e.stream_meta.url,lowQuality:!0,debug:!0,onPlay:()=>t.onPlay(),onPause:()=>t.onPause(),onProgress:n=>t.onProgress(n)})}function fk(){const{t}=Sv();return L.createElement(hE,null,L.createElement(fE,null,L.createElement(M2,{child1:L.createElement(nk,null),child2:L.createElement(ck,null),t})))}function Cf(t){"@babel/helpers - typeof";return Cf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cf(t)}var Pv=[],dk=Pv.forEach,hk=Pv.slice;function xf(t){return dk.call(hk.call(arguments,1),function(e){if(e)for(var n in e)t[n]===void 0&&(t[n]=e[n])}),t}function Nv(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Cf(XMLHttpRequest))==="object"}function pk(t){return!!t&&typeof t.then=="function"}function mk(t){return pk(t)?t:Promise.resolve(t)}function gk(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var kf={exports:{}},Al={exports:{}},bv;function yk(){return bv||(bv=1,function(t,e){var n=typeof self<"u"?self:mt,r=function(){function s(){this.fetch=!1,this.DOMException=n.DOMException}return s.prototype=n,new s}();(function(s){(function(o){var l={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function a(w){return w&&DataView.prototype.isPrototypeOf(w)}if(l.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(w){return w&&u.indexOf(Object.prototype.toString.call(w))>-1};function c(w){if(typeof w!="string"&&(w=String(w)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(w))throw new TypeError("Invalid character in header field name");return w.toLowerCase()}function f(w){return typeof w!="string"&&(w=String(w)),w}function p(w){var N={next:function(){var V=w.shift();return{done:V===void 0,value:V}}};return l.iterable&&(N[Symbol.iterator]=function(){return N}),N}function y(w){this.map={},w instanceof y?w.forEach(function(N,V){this.append(V,N)},this):Array.isArray(w)?w.forEach(function(N){this.append(N[0],N[1])},this):w&&Object.getOwnPropertyNames(w).forEach(function(N){this.append(N,w[N])},this)}y.prototype.append=function(w,N){w=c(w),N=f(N);var V=this.map[w];this.map[w]=V?V+", "+N:N},y.prototype.delete=function(w){delete this.map[c(w)]},y.prototype.get=function(w){return w=c(w),this.has(w)?this.map[w]:null},y.prototype.has=function(w){return this.map.hasOwnProperty(c(w))},y.prototype.set=function(w,N){this.map[c(w)]=f(N)},y.prototype.forEach=function(w,N){for(var V in this.map)this.map.hasOwnProperty(V)&&w.call(N,this.map[V],V,this)},y.prototype.keys=function(){var w=[];return this.forEach(function(N,V){w.push(V)}),p(w)},y.prototype.values=function(){var w=[];return this.forEach(function(N){w.push(N)}),p(w)},y.prototype.entries=function(){var w=[];return this.forEach(function(N,V){w.push([V,N])}),p(w)},l.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function S(w){if(w.bodyUsed)return Promise.reject(new TypeError("Already read"));w.bodyUsed=!0}function P(w){return new Promise(function(N,V){w.onload=function(){N(w.result)},w.onerror=function(){V(w.error)}})}function g(w){var N=new FileReader,V=P(N);return N.readAsArrayBuffer(w),V}function h(w){var N=new FileReader,V=P(N);return N.readAsText(w),V}function m(w){for(var N=new Uint8Array(w),V=new Array(N.length),B=0;B-1?N:w}function j(w,N){N=N||{};var V=N.body;if(w instanceof j){if(w.bodyUsed)throw new TypeError("Already read");this.url=w.url,this.credentials=w.credentials,N.headers||(this.headers=new y(w.headers)),this.method=w.method,this.mode=w.mode,this.signal=w.signal,!V&&w._bodyInit!=null&&(V=w._bodyInit,w.bodyUsed=!0)}else this.url=String(w);if(this.credentials=N.credentials||this.credentials||"same-origin",(N.headers||!this.headers)&&(this.headers=new y(N.headers)),this.method=A(N.method||this.method||"GET"),this.mode=N.mode||this.mode||null,this.signal=N.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&V)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(V)}j.prototype.clone=function(){return new j(this,{body:this._bodyInit})};function ne(w){var N=new FormData;return w.trim().split("&").forEach(function(V){if(V){var B=V.split("="),I=B.shift().replace(/\+/g," "),z=B.join("=").replace(/\+/g," ");N.append(decodeURIComponent(I),decodeURIComponent(z))}}),N}function W(w){var N=new y,V=w.replace(/\r?\n[\t ]+/g," ");return V.split(/\r?\n/).forEach(function(B){var I=B.split(":"),z=I.shift().trim();if(z){var v=I.join(":").trim();N.append(z,v)}}),N}T.call(j.prototype);function ie(w,N){N||(N={}),this.type="default",this.status=N.status===void 0?200:N.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in N?N.statusText:"OK",this.headers=new y(N.headers),this.url=N.url||"",this._initBody(w)}T.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},ie.error=function(){var w=new ie(null,{status:0,statusText:""});return w.type="error",w};var Ae=[301,302,303,307,308];ie.redirect=function(w,N){if(Ae.indexOf(N)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:N,headers:{location:w}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(N,V){this.message=N,this.name=V;var B=Error(N);this.stack=B.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function pe(w,N){return new Promise(function(V,B){var I=new j(w,N);if(I.signal&&I.signal.aborted)return B(new o.DOMException("Aborted","AbortError"));var z=new XMLHttpRequest;function v(){z.abort()}z.onload=function(){var C={status:z.status,statusText:z.statusText,headers:W(z.getAllResponseHeaders()||"")};C.url="responseURL"in z?z.responseURL:C.headers.get("X-Request-URL");var _="response"in z?z.response:z.responseText;V(new ie(_,C))},z.onerror=function(){B(new TypeError("Network request failed"))},z.ontimeout=function(){B(new TypeError("Network request failed"))},z.onabort=function(){B(new o.DOMException("Aborted","AbortError"))},z.open(I.method,I.url,!0),I.credentials==="include"?z.withCredentials=!0:I.credentials==="omit"&&(z.withCredentials=!1),"responseType"in z&&l.blob&&(z.responseType="blob"),I.headers.forEach(function(C,_){z.setRequestHeader(_,C)}),I.signal&&(I.signal.addEventListener("abort",v),z.onreadystatechange=function(){z.readyState===4&&I.signal.removeEventListener("abort",v)}),z.send(typeof I._bodyInit>"u"?null:I._bodyInit)})}return pe.polyfill=!0,s.fetch||(s.fetch=pe,s.Headers=y,s.Request=j,s.Response=ie),o.Headers=y,o.Request=j,o.Response=ie,o.fetch=pe,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}(Al,Al.exports)),Al.exports}(function(t,e){var n;if(typeof fetch=="function"&&(typeof mt<"u"&&mt.fetch?n=mt.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof gk<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||yk();r.default&&(r=r.default),e.default=r,t.exports=e.default}})(kf,kf.exports);var Rv=kf.exports;const Ov=Ht(Rv),Dv=jn({__proto__:null,default:Ov},[Rv]);function Ml(t){"@babel/helpers - typeof";return Ml=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ml(t)}var on;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?on=global.fetch:typeof window<"u"&&window.fetch?on=window.fetch:on=fetch);var Is;Nv()&&(typeof global<"u"&&global.XMLHttpRequest?Is=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Is=window.XMLHttpRequest));var Fl;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?Fl=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(Fl=window.ActiveXObject)),!on&&Dv&&!Is&&!Fl&&(on=Ov||Dv),typeof on!="function"&&(on=void 0);var Tf=function(e,n){if(n&&Ml(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+r.slice(1)}return e},Lv=function(e,n,r){on(e,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(s){r(null,{status:i.status,data:s})}).catch(r)}).catch(r)},Av=!1,vk=function(e,n,r,i){e.queryStringParams&&(n=Tf(n,e.queryStringParams));var s=xf({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);r&&(s["Content-Type"]="application/json");var o=typeof e.requestOptions=="function"?e.requestOptions(r):e.requestOptions,l=xf({method:r?"POST":"GET",body:r?e.stringify(r):void 0,headers:s},Av?{}:o);try{Lv(n,l,i)}catch(a){if(!o||Object.keys(o).length===0||!a.message||a.message.indexOf("not implemented")<0)return i(a);try{Object.keys(o).forEach(function(u){delete l[u]}),Lv(n,l,i),Av=!0}catch(u){i(u)}}},_k=function(e,n,r,i){r&&Ml(r)==="object"&&(r=Tf("",r).slice(1)),e.queryStringParams&&(n=Tf(n,e.queryStringParams));try{var s;Is?s=new Is:s=new Fl("MSXML2.XMLHTTP.3.0"),s.open(r?"POST":"GET",n,1),e.crossDomain||s.setRequestHeader("X-Requested-With","XMLHttpRequest"),s.withCredentials=!!e.withCredentials,r&&s.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s.overrideMimeType&&s.overrideMimeType("application/json");var o=e.customHeaders;if(o=typeof o=="function"?o():o,o)for(var l in o)s.setRequestHeader(l,o[l]);s.onreadystatechange=function(){s.readyState>3&&i(s.status>=400?s.statusText:null,{status:s.status,data:s.responseText})},s.send(r)}catch(a){console&&console.log(a)}},wk=function(e,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},on&&n.indexOf("file:")!==0)return vk(e,n,r,i);if(Nv()||typeof ActiveXObject=="function")return _k(e,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function Ps(t){"@babel/helpers - typeof";return Ps=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ps(t)}function Sk(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Mv(t,e){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Sk(this,t),this.services=e,this.options=n,this.allOptions=r,this.type="backend",this.init(e,n,r)}return Ek(t,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=xf(i,this.options||{},kk()),this.allOptions=s,this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,s,o){var l=this,a=this.options.loadPath;typeof this.options.loadPath=="function"&&(a=this.options.loadPath(n,i)),a=mk(a),a.then(function(u){if(!u)return o(null,{});var d=l.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});l.loadUrl(d,o,r,s)})}},{key:"loadUrl",value:function(n,r,i,s){var o=this,l=typeof i=="string"?[i]:i,a=typeof s=="string"?[s]:s,u=this.options.parseLoadPayload(l,a);this.options.request(this.options,n,u,function(d,c){if(c&&(c.status>=500&&c.status<600||!c.status))return r("failed loading "+n+"; status code: "+c.status,!0);if(c&&c.status>=400&&c.status<500)return r("failed loading "+n+"; status code: "+c.status,!1);if(!c&&d&&d.message&&d.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+d.message,!0);if(d)return r(d,!1);var f,p;try{typeof c.data=="string"?f=o.options.parse(c.data,i,s):f=c.data}catch{p="failed parsing "+n+" to json"}if(p)return r(p,!1);r(null,f)})}},{key:"create",value:function(n,r,i,s,o){var l=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var a=this.options.parsePayload(r,i,s),u=0,d=[],c=[];n.forEach(function(f){var p=l.options.addPath;typeof l.options.addPath=="function"&&(p=l.options.addPath(f,r));var y=l.services.interpolator.interpolate(p,{lng:f,ns:r});l.options.request(l.options,y,a,function(S,P){u+=1,d.push(S),c.push(P),u===n.length&&typeof o=="function"&&o(d,c)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,s=r.languageUtils,o=r.logger,l=i.language;if(!(l&&l.toLowerCase()==="cimode")){var a=[],u=function(c){var f=s.toResolveHierarchy(c);f.forEach(function(p){a.indexOf(p)<0&&a.push(p)})};u(l),this.allOptions.preload&&this.allOptions.preload.forEach(function(d){return u(d)}),a.forEach(function(d){n.allOptions.ns.forEach(function(c){i.read(d,c,"read",null,null,function(f,p){f&&o.warn("loading namespace ".concat(c," for language ").concat(d," failed"),f),!f&&p&&o.log("loaded namespace ".concat(c," for language ").concat(d),p),i.loaded("".concat(d,"|").concat(c),f,p)})})})}}}]),t}();zv.type="backend";function Tk({children:t}){const{config:e}=Jn(),[n,r]=F.useState(!1);return F.useEffect(()=>{e.language_slug&&Re.use(X2).use(zv).init({backend:{loadPath:"https://assets.mimo.com.br/languages/{{lng}}.json"},load:"currentOnly",lng:e.language_slug||"pt-BR",fallbackLng:"pt-BR"}).then(()=>r(!0))},[e.language_slug]),L.createElement(L.Fragment,null,n&&t)}function Ik(t){return L.createElement(h0,{options:t.options},L.createElement(l0,null,L.createElement(aE,null,L.createElement(Tk,null,L.createElement(dE,null,L.createElement(pE,null,L.createElement(fk,null)))))))}function Pk(t,e){return{...a0,...jv(t),...jv(e)}}function jv(t){return Object.keys(t).reduce((e,n)=>{const r=n;return t[r]!==void 0&&(e[r]=t[r]),e},{})}const Nk=`*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:currentColor}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*{font-family:Poppins,sans-serif,system-ui}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.mimo-pip--absolute{position:absolute}.mimo-pip--relative{position:relative}.mimo-pip--bottom-\\[10px\\]{bottom:10px}.mimo-pip--left-0{left:0px}.mimo-pip--right-\\[10px\\]{right:10px}.mimo-pip--top-0{top:0px}.mimo-pip--z-\\[20\\]{z-index:20}.mimo-pip--flex{display:flex}.mimo-pip--inline-flex{display:inline-flex}.mimo-pip--h-1{height:.25rem}.mimo-pip--h-14{height:3.5rem}.mimo-pip--h-\\[17px\\]{height:17px}.mimo-pip--h-\\[30px\\]{height:30px}.mimo-pip--h-full{height:100%}.mimo-pip--min-h-\\[30px\\]{min-height:30px}.mimo-pip--w-1{width:.25rem}.mimo-pip--w-\\[17px\\]{width:17px}.mimo-pip--w-\\[30px\\]{width:30px}.mimo-pip--w-full{width:100%}.mimo-pip--min-w-\\[30px\\]{min-width:30px}.mimo-pip--flex-1{flex:0 1 100%}@keyframes mimo-pip--pulse{50%{opacity:.5}}.mimo-pip--animate-pulse{animation:mimo-pip--pulse 2s cubic-bezier(.4,0,.6,1) infinite}.mimo-pip--cursor-default{cursor:default}.mimo-pip--cursor-grab{cursor:grab}.mimo-pip--cursor-pointer{cursor:pointer}.mimo-pip--flex-col{flex-direction:column}.mimo-pip--items-start{align-items:flex-start}.mimo-pip--items-center{align-items:center}.mimo-pip--justify-start{justify-content:flex-start}.mimo-pip--justify-center{justify-content:center}.mimo-pip--justify-between{justify-content:space-between}.mimo-pip--space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.mimo-pip--space-x-\\[10px\\]>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(10px * var(--tw-space-x-reverse));margin-left:calc(10px * calc(1 - var(--tw-space-x-reverse)))}.mimo-pip--rounded{border-radius:.25rem}.mimo-pip--rounded-full{border-radius:9999px}.mimo-pip--rounded-l-lg{border-top-left-radius:.5rem;border-bottom-left-radius:.5rem}.mimo-pip--rounded-r-lg{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.mimo-pip--bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.mimo-pip--p-1{padding:.25rem}.mimo-pip--p-2{padding:.5rem}.mimo-pip--px-1{padding-left:.25rem;padding-right:.25rem}.mimo-pip--py-2{padding-top:.5rem;padding-bottom:.5rem}.mimo-pip--pb-3{padding-bottom:.75rem}.mimo-pip--pl-\\[18px\\]{padding-left:18px}.mimo-pip--pr-7{padding-right:1.75rem}.mimo-pip--pt-1{padding-top:.25rem}.mimo-pip--pt-2{padding-top:.5rem}.mimo-pip--text-12{font-size:12px}.mimo-pip--text-\\[7px\\]{font-size:7px}.mimo-pip--font-regular{font-weight:400}.mimo-pip--font-semiBold{font-weight:600}.mimo-pip--uppercase{text-transform:uppercase}.mimo-pip--leading-\\[18px\\]{line-height:18px}.mimo-pip--text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.mimo-pip--shadow-\\[0px_2px_16px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow: 0px 2px 16px rgba(0,0,0,.25);--tw-shadow-colored: 0px 2px 16px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.mimo-pip--top{top:0}.mimo-pip--bottom{bottom:0}.mimo-pip--right{right:0}.mimo-pip--left{left:0}@media (min-width: 640px){.sm\\:mimo-pip--h-2{height:.5rem}.sm\\:mimo-pip--h-\\[30px\\]{height:30px}.sm\\:mimo-pip--w-2{width:.5rem}.sm\\:mimo-pip--w-\\[30px\\]{width:30px}.sm\\:mimo-pip--space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}} `;var If={},Uv=af;If.createRoot=Uv.createRoot,If.hydrateRoot=Uv.hydrateRoot;const bk='https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap"';class Pf extends HTMLElement{constructor(e={}){super();const n=Pk({},e),r=n.useShadowDom?this.attachShadow({mode:"open"}):this;If.createRoot(r).render(L.createElement(Ik,{options:n})),this.initStyles(r)}getAttributeValue(e,n){const r=this.getAttribute(e);if(r!=null)return n(r)}initStyles(e){const n=document.createElement("style");n.innerHTML=Nk,e.appendChild(n),this.includeFontScript()}includeFontScript(){const e="mimofrontscript";if(document.getElementById(e))return;const n=document.createElement("link");n.id=e,n.type="text/css",n.rel="stylesheet",n.href=bk,document.head.appendChild(n)}}customElements.define("mimo-pip",Pf),window.MimoPip=Pf,function(){var e;const t=document.currentScript||function(){return document.getElementById("mimo-pip-sdk")}();(e=document.querySelector("body"))==null||e.appendChild(new Pf({customerId:t==null?void 0:t.getAttribute("data-customerid"),liveId:t==null?void 0:t.getAttribute("data-liveid")}))}()})(); //# sourceMappingURL=index.js.map