PageSourceSearch

https://www.vaidepromo.com.br/_next/static/chunks/d96faa40-3bd696ad7136da20.js

js vaidepromo.com.br collected 2026-09-25 20:48:00 UTC 387,521 bytes, 4 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2892],{51405:function(e,t,n){let r,i,s,a,o,l,c,u,d,h,p,f,m,g;n.d(t,{f:function(){return uH},i:function(){return W},s:function(){return d5}}),n(55120);var _,v,y,w,C,b,k,x,I,E,T,S,N,P,R,O,L,A,j,D,M,F,U,$,V,q=n(57437),z=n(2265),B=n(40257);let W=({size:e=24,color:t})=>(0,q.jsxs)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:t,xmlns:"http://www.w3.org/2000/svg",children:[(0,q.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.54975 3.00659H1.05029V2.00659H3.22128L5.83087 8.39025C5.85294 8.44424 5.90547 8.47951 5.9638 8.47951H11.1762C11.228 8.47951 11.2758 8.45162 11.3013 8.40653L13.4564 4.59086H6.34637V3.59086H15.1697L12.172 8.89832C11.9691 9.25744 11.5887 9.47951 11.1762 9.47951H5.9638C5.49932 9.47951 5.08098 9.19858 4.90523 8.76864L2.54975 3.00659Z"}),(0,q.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.81178 11.0042L4.94639 8.6702L5.84575 9.10739L4.71114 11.4414C4.66478 11.5368 4.73424 11.6478 4.84029 11.6478H13.2722V12.6478H4.84029C3.99573 12.6478 3.44254 11.7638 3.81178 11.0042Z"}),(0,q.jsx)("path",{d:"M6.61235 14.0981C6.61235 14.6606 6.15636 15.1166 5.59387 15.1166C5.03139 15.1166 4.5754 14.6606 4.5754 14.0981C4.5754 13.5356 5.03139 13.0796 5.59387 13.0796C6.15636 13.0796 6.61235 13.5356 6.61235 14.0981Z",fill:"#005AA3"}),(0,q.jsx)("path",{d:"M12.5116 14.0981C12.5116 14.6606 12.0556 15.1166 11.4931 15.1166C10.9306 15.1166 10.4746 14.6606 10.4746 14.0981C10.4746 13.5356 10.9306 13.0796 11.4931 13.0796C12.0556 13.0796 12.5116 13.5356 12.5116 14.0981Z",fill:"#005AA3"})]});function H(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z={exports:{}};!function(){var e={}.hasOwnProperty;function t(){for(var r="",i=0;i<arguments.length;i++){var s=arguments[i];s&&(r=n(r,function(r){if("string"==typeof r||"number"==typeof r)return r;if("object"!=typeof r)return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var i="";for(var s in r)e.call(r,s)&&r[s]&&(i=n(i,s));return i}(s)))}return r}function n(e,t){return t?e?e+" "+t:e+t:e}Z.exports?(t.default=t,Z.exports=t):window.classNames=t}();let K=H(Z.exports);function G(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self&&self;var Y={exports:{}};!function(){var e={}.hasOwnProperty;function t(){for(var r="",i=0;i<arguments.length;i++){var s=arguments[i];s&&(r=n(r,function(r){if("string"==typeof r||"number"==typeof r)return r;if("object"!=typeof r)return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var i="";for(var s in r)e.call(r,s)&&r[s]&&(i=n(i,s));return i}(s)))}return r}function n(e,t){return t?e?e+" "+t:e+t:e}Y.exports?(t.default=t,Y.exports=t):window.classNames=t}();let J=G(Y.exports),Q=({children:e,value:t})=>t?"function"==typeof e?e():e:(0,q.jsx)(q.Fragment,{}),X={container:"_container_dgrys_1","vdp-palette":"_vdp-palette_dgrys_9","seguro-chip-pallete":"_seguro-chip-pallete_dgrys_98",solid:"_solid_dgrys_205",primary:"_primary_dgrys_208",secondary:"_secondary_dgrys_217",ghost:"_ghost_dgrys_237",outlined:"_outlined_dgrys_263"};function ee({leftIcon:e,rightIcon:t,label:n,theme:r="primary",variant:i="solid",className:s,palette:a="vdp-palette",...o}){return(0,q.jsxs)("button",{type:"button",className:J(X.container,X[r],X[i],s,X[a]),...o,children:[(0,q.jsx)(Q,{value:e,children:e}),n,(0,q.jsx)(Q,{value:t,children:t})]})}let et=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"M10.409 18.621L4.12307 12.6208C3.95342 12.459 3.85742 12.2346 3.85742 12.0003C3.85742 11.7659 3.95342 11.5415 4.12307 11.3797L10.409 5.3795C10.7516 5.0536 11.2941 5.06588 11.6211 5.4085C11.9481 5.7478 11.9359 6.29246 11.5921 6.62062L6.85378 11.1431L19.0002 11.1431C19.4735 11.1431 19.8574 11.527 19.8574 12.0003C19.8574 12.4735 19.4735 12.8574 19.0002 12.85
174L6.85378 12.8574L11.5921 17.3799C11.9358 17.7069 11.9481 18.2516 11.6211 18.592C11.2941 18.9347 10.7516 18.9469 10.409 18.621Z"})}),en=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"M19.5644 17.957C20.0316 18.4242 20.0316 19.1823 19.5644 19.6496C19.0972 20.1168 18.3391 20.1168 17.8718 19.6496L11.9792 13.713L6.04466 19.6476C5.57743 20.1148 4.81935 20.1148 4.35207 19.6476C3.88479 19.1803 3.88484 18.4223 4.35207 17.955L10.2886 12.0224L4.35042 6.04303C3.88319 5.5758 3.88319 4.81772 4.35042 4.35044C4.81766 3.88316 5.57573 3.88321 6.04301 4.35044L11.9792 10.3318L17.9137 4.39732C18.3809 3.93009 19.139 3.93009 19.6063 4.39732C20.0736 4.86455 20.0735 5.62263 19.6063 6.08991L13.6698 12.0224L19.5644 17.957Z"})});var er=e=>"checkbox"===e.type,ei=e=>e instanceof Date,es=e=>null==e;let ea=e=>"object"==typeof e;var eo=e=>!es(e)&&!Array.isArray(e)&&ea(e)&&!ei(e),el=e=>eo(e)&&e.target?er(e.target)?e.target.checked:e.target.value:e,ec=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,eu=(e,t)=>e.has(ec(t)),ed=e=>{let t=e.constructor&&e.constructor.prototype;return eo(t)&&t.hasOwnProperty("isPrototypeOf")},eh="u">typeof window&&"u">typeof window.HTMLElement&&"u">typeof document,ep=e=>Array.isArray(e)?e.filter(Boolean):[],ef=e=>void 0===e,em=(e,t,n)=>{if(!t||!eo(e))return n;let r=ep(t.split(/[,[\].]+?/)).reduce((e,t)=>es(e)?e:e[t],e);return ef(r)||r===e?ef(e[t])?n:e[t]:r},eg=e=>"boolean"==typeof e,e_=e=>/^\w*$/.test(e),ev=e=>ep(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ey=(e,t,n)=>{let r=-1,i=e_(t)?[t]:ev(t),s=i.length,a=s-1;for(;++r<s;){let t=i[r],s=n;if(r!==a){let n=e[t];s=eo(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}};let ew={all:"all"},eC=z.createContext(null),eb=()=>z.useContext(eC);var ek=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let s in e)Object.defineProperty(i,s,{get:()=>(t._proxyFormState[s]!==ew.all&&(t._proxyFormState[s]=!r||ew.all),n&&(n[s]=!0),e[s])});return i};let ex="u">typeof window?z.useLayoutEffect:z.useEffect;var eI=e=>"string"==typeof e,eE=(e,t,n,r,i)=>eI(e)?em(n,e,i):Array.isArray(e)?e.map(e=>em(n,e)):n;let eT=e=>e.render(function(e){let t=eb(),{name:n,disabled:r,control:i=t.control,shouldUnregister:s}=e,a=eu(i._names.array,n),o=function(e){let t=eb(),{control:n=t.control,name:r,defaultValue:i,disabled:s,exact:a}=e||{},o=z.useRef(i),[l,c]=z.useState(n._getWatch(r,o.current));return ex(()=>n._subscribe({name:r,formState:{values:!0},exact:a,callback:e=>!s&&c(eE(r,n._names,e.values||n._formValues,!1,o.current))}),[r,n,s,a]),z.useEffect(()=>n._removeUnmounted()),l}({control:i,name:n,defaultValue:em(i._formValues,n,em(i._defaultValues,n,e.defaultValue)),exact:!0}),l=function(e){let t=eb(),{control:n=t.control,disabled:r,name:i,exact:s}=e||{},[a,o]=z.useState(n._formState),l=z.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ex(()=>n._subscribe({name:i,formState:l.current,exact:s,callback:e=>{r||o({...n._formState,...e})}}),[i,r,s]),z.useEffect(()=>{l.current.isValid&&n._setValid(!0)},[n]),z.useMemo(()=>ek(a,n,l.current,!1),[a,n])}({control:i,name:n,exact:!0}),c=z.useRef(e),u=z.useRef(i.register(n,{...e.rules,value:o,...eg(e.disabled)?{disabled:e.disabled}:{}})),d=z.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!em(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!em(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!em(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!em(l.validatingFields,n)},error:{enumerable:!0,get:()=>em(l.errors,n)}}),[l,n]),h=z.useCallback(e=>u.current.onChange({target:{value:el(e),name:n},type:"change"}),[n]),p=z.useCallback(()=>u.current.onBlur({target:{value:em(i._formValues,n),name:n},type:"blur"}),[n,i._formValues]),f=z.useCallback(e=>{let t=em(i._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[i._fields,n]),m=z.useMemo(()=>({name:n,value:o,...eg(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:h,onBlur:p,ref:f}),[n,r,l.disabled,h,p,f,o]);return z.useEffect(()=>{let e=i._options.shouldUnregister||s;i.register(n,{...c.current.rules,...eg(c.current.disabled)?{disabled:c.current.disabled}:{}});let t=(e,t)=>{let n=em(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=function e(t){let n;let r=Array.isArray(t),i="u">typeof FileList&&t instanceof FileList;if(t instanceof Date)n=new Date(t);else if(t instanceof Set)n=new Set(t);else if(!(!(eh&&(t instanceof Blob||i))&&(r||eo(t))))return t;else if(n=r?[]:{},r||ed(t))for(let r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));else n=t;return n}(em(i._options.defaultValues,n));ey(i._defaultValues,n,e),ef(em(i._formValues,n))&&ey(i._formValues,n,e)}return a||i.register(n),()=>{(a?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,a,s]),z.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),z.useMemo(()=>({field:m,formState:l,fieldState:d}),[m,l,d])}(e)),eS=e=>{let t=e.indexOf("(")+1,n=e.indexOf(")");return e.substring(t,n)},eN=e=>{if(!eP(e))return;let[t,n,r]=e.split("/").map(Number);return new Date(r,n-1,t)},eP=e=>/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/\d{4}$/.test(e),eR=({children:e,value:t})=>t?"function"==typeof e?e():e:(0,q.jsx)(q.Fragment,{}),eO=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"M21.0954 17.75L13.4776 4.75C13.1847 4.25 12.6705 4 12.1562 4C11.6419 4 11.1276 4.25 10.8026 4.75L3.18831 17.75C2.63509 18.7464 3.36513 20 4.53974 20H19.7754C20.9454 20 21.6776 18.75 21.0954 17.75ZM4.89116 18.2857L12.124 5.88571L19.4205 18.2857H4.89116ZM12.1562 14.8964C11.5362 14.8964 11.0333 15.3993 11.0333 16.0193C11.0333 16.6393 11.5372 17.1421 12.1576 17.1421C12.778 17.1421 13.279 16.6393 13.279 16.
10193C13.2776 15.4 12.7776 14.8964 12.1562 14.8964ZM11.299 9.42857V12.8571C11.299 13.3321 11.6847 13.7143 12.1562 13.7143C12.6276 13.7143 13.0133 13.3304 13.0133 12.8571V9.42857C13.0133 8.95714 12.6312 8.57143 12.1562 8.57143C11.6812 8.57143 11.299 8.95714 11.299 9.42857Z"})}),eL=(e,t)=>{switch(t){case"phone":return eV(e);case"cpf":return eq(e);case"date":return ez(e);case"expire":return eB(e);case"expire-short":return eW(e);case"cep":return eH(e);case"card":return eZ(e);case"name":return eM(e);case"full-name":return eF(e);case"name-alt":return eU(e);case"email":return e$(e);case"cvv":return eA(e);case"agency":return ej(e);case"account":return eD(e);default:return e}},eA=e=>e.slice(0,4).replace(/\D/g,""),ej=e=>e.slice(0,4).replace(/\D/g,""),eD=e=>e.slice(0,13).replace(/\D/g,""),eM=e=>e.replace(/[^a-zA-ZÀ-ÿs]/g,""),eF=e=>e.replace(/[^a-zA-ZÀ-ÿs ]/g,""),eU=e=>e.replace(/[0-9!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/g,""),e$=e=>e.replace(/[^[email protected]]/gi,"").toLowerCase(),eV=e=>{let t=e.replace(/\D/g,"").slice(0,11).replace(/^(\d{2})(\d)/g,"($1) $2");return t.replace(14===t.length?/(\d{5})(\d)/:/(\d{4})(\d)/,"$1-$2")},eq=e=>e.toString().replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1-$2"),ez=e=>e.replace(/\D/g,"").slice(0,8).replace(/(\d{2})(\d)/,"$1/$2").replace(/(\d{2})(\d)/,"$1/$2"),eB=e=>e.replace(/\D/g,"").slice(0,6).replace(/(\d{2})(\d)/,"$1/$2"),eW=e=>e.replace(/\D/g,"").slice(0,4).replace(/(\d{2})(\d{2})/,"$1/$2"),eH=e=>e.replace(/\D/g,"").slice(0,8).replace(/(\d{5})(\d)/,"$1-$2"),eZ=e=>{let t=e.replace(/\D/g,""),n=eK(t);return 3===n?t.slice(0,15).replace(/(\d{4})(\d)/,"$1 $2").replace(/(\d{6})(\d)/,"$1 $2"):4===n?t.slice(0,14).replace(/(\d{4})(\d)/,"$1 $2").replace(/(\d{6})(\d)/,"$1 $2"):t.slice(0,16).replace(/(\d{4})(\d)/,"$1 $2").replace(/(\d{4})(\d)/,"$1 $2").replace(/(\d{4})(\d)/,"$1 $2").replace(/(\d{4})(\d)/,"$1 $2")},eK=e=>{if(!e)return null;let t=e.replace(/\s/g,"");return t.match(/^((5(([1-2]|[4-5])[0-9]{8}|0((1|6)([0-9]{7}))|3(0(4((0|[2-9])[0-9]{5})|([0-3]|[5-9])[0-9]{6})|[1-9][0-9]{7})))|((508116)\\d{4,10})|((502121)\\d{4,10})|((589916)\\d{4,10})|(2[0-9]{15})|(67[0-9]{14})|(506387)\\d{4,10})/g)?1:t.match(/^3[47][0-9]{13}$/)?3:t.match(/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/)?4:t.match(/^(38[0-9]{17}|60[0-9]{14})$/)?5:t.match(/^4011(78|79)|^43(1274|8935)|^45(1416|7393|763(1|2))|^504175|^627780|^63(6297|6368|6369)|(65003[5-9]|65004[0-9]|65005[01])|(65040[5-9]|6504[1-3][0-9])|(65048[5-9]|65049[0-9]|6505[0-2][0-9]|65053[0-8])|(65054[1-9]|6505[5-8][0-9]|65059[0-8])|(65070[0-9]|65071[0-8])|(65072[0-7])|(65090[1-9]|6509[1-6][0-9]|65097[0-8])|(65165[2-9]|6516[67][0-9])|(65500[0-9]|65501[0-9])|(65502[1-9]|6550[34][0-9]|65505[0-8])|^(506699|5067[0-6][0-9]|50677[0-8])|^(509[0-8][0-9]{2}|5099[0-8][0-9]|50999[0-9])|^65003[1-3]|^(65003[5-9]|65004\d|65005[0-1])|^(65040[5-9]|6504[1-3]\d)|^(65048[5-9]|65049\d|6505[0-2]\d|65053[0-8])|^(65054[1-9]|6505[5-8]\d|65059[0-8])|^(65070\d|65071[0-8])|^65072[0-7]|^(65090[1-9]|65091\d|650920)|^(65165[2-9]|6516[6-7]\d)|^(65500\d|65501\d)|^(65502[1-9]|6550[3-4]\d|65505[0-8])/g)?6:t.match(/^4[0-9]{12}(?:[0-9]{3})?$/)?2:null},eG=(0,z.forwardRef)(({leftIcon:e,rightIcon:t,hasError:n,errorMessage:r,disabled:i,placeholder:s,className:a,label:o,downLabel:l,placeholderAnimated:c=!0,containerClassname:u,mask:d,palette:h="vdp-palette",iconOnClick:p,...f},m)=>{let g=(0,z.createRef)();return(0,q.jsxs)("div",{className:J("vdp-ui-container-label",u,h),onClick:()=>{null!=g&&g.current&&g.current.focus()},children:[(0,q.jsx)(Q,{value:o,children:(0,q.jsx)("div",{className:"vdp-ui-label",children:o})}),(0,q.jsxs)("div",{className:"vdp-ui-input-external",children:[(0,q.jsxs)("div",{className:J("vdp-ui-input-container",{disabled:i,error:n},a),children:[(0,q.jsx)(Q,{value:e,children:(0,q.jsx)("div",{className:"vdp-ui-input-icon",children:e})}),(0,q.jsxs)("div",{className:"vdp-ui-input-group",children:[(0,q.jsx)("input",{...f,"data-testid":"vdp-ui-input",className:J("vdp-ui-input",{"place-holder-animated":!c}),disabled:i,placeholder:s,onChange:e=>{d&&(e.target.value=eL(e.target.value,d),e.persist()),null!=f&&f.onChange&&f.onChange(e)},ref:m??g}),(0,q.jsx)("label",{htmlFor:f.id,className:J("vdp-ui-input-label",{error:n}),children:(0,q.jsx)(Q,{value:c,children:s})})]}),(0,q.jsx)(Q,{value:t,children:(0,q.jsx)("div",{onClick:p,children:t})}),(0,q.jsx)(Q,{value:n&&!t,children:(0,q.jsx)("div",{className:"vdp-ui-input-icon",children:(0,q.jsx)(eO,{})})})]}),(0,q.jsx)(Q,{value:n,children:(0,q.jsx)("span",{className:"vdp-ui-input-error-label",children:r})}),(0,q.jsx)(Q,{value:l,children:(0,q.jsx)("span",{className:"vdp-ui-input-down-label",children:l})})]})]})});function eY({onClickOutside:e}){let t=(0,z.useRef)(null),n=(0,z.useCallback)(n=>
1{t.current&&!t.current.contains(n.target)&&e()},[e]);return(0,z.useEffect)(()=>(document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}),[n]),{containerRef:t}}async function eJ(e){try{let t=await fetch(`https://geo.vaidepromo.com.br/autosuggest?term=${e}`);if(!t.ok)throw Error("Error fetching airports");let{result:n}=await t.json();return n}catch(e){return console.error(e),[]}}var eQ={exports:{}};_=function(){var e="millisecond",t="second",n="minute",r="hour",i="week",s="month",a="quarter",o="year",l="date",c="Invalid Date",u=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,h=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},p="en",f={};f[p]={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||"th")+"]"}};var m="$isDayjsObject",g=function(e){return e instanceof w||!(!e||!e[m])},_=function e(t,n,r){var i;if(!t)return p;if("string"==typeof t){var s=t.toLowerCase();f[s]&&(i=s),n&&(f[s]=n,i=s);var a=t.split("-");if(!i&&a.length>1)return e(a[0])}else{var o=t.name;f[o]=t,i=o}return!r&&i&&(p=i),i||!r&&p},v=function(e,t){if(g(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new w(n)},y={s:h,z:function(e){var t=-e.utcOffset(),n=Math.abs(t);return(t<=0?"+":"-")+h(Math.floor(n/60),2,"0")+":"+h(n%60,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,s),a=n-i<0,o=t.clone().add(r+(a?-1:1),s);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(c){return({M:s,y:o,w:i,d:"day",D:l,h:r,m:n,s:t,ms:e,Q:a})[c]||String(c||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}};y.l=_,y.i=g,y.w=function(e,t){return v(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var w=function(){function h(e){this.$L=_(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[m]=!0}var p=h.prototype;return p.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(y.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(u);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(t)}(e),this.init()},p.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},p.$utils=function(){return y},p.isValid=function(){return this.$d.toString()!==c},p.isSame=function(e,t){var n=v(e);return this.startOf(t)<=n&&n<=this.endOf(t)},p.isAfter=function(e,t){return v(e)<this.startOf(t)},p.isBefore=function(e,t){return this.endOf(t)<v(e)},p.$g=function(e,t,n){return y.u(e)?this[t]:this.set(n,e)},p.unix=function(){return Math.floor(this.valueOf()/1e3)},p.valueOf=function(){return this.$d.getTime()},p.startOf=function(e,a){var c=this,u=!!y.u(a)||a,d=y.p(e),h=function(e,t){var n=y.w(c.$u?Date.UTC(c.$y,t,e):new Date(c.$y,t,e),c);return u?n:n.endOf("day")},p=function(e,t){return y.w(c.toDate()[e].apply(c.toDate("s"),(u?[0,0,0,0]:[23,59,59,999]).slice(t)),c)},f=this.$W,m=this.$M,g=this.$D,_="set"+(this.$u?"UTC":"");switch(d){case o:return u?h(1,0):h(31,11);case s:return u?h(1,m):h(0,m+1);case i:var v=this.$locale().weekStart||0,w=(f<v?f+7:f)-v;return h(u?g-w:g+(6-w),m);case"day":case l:return p(_+"Hours",0);case r:return p(_+"Minutes",1);case n:return p(_+"Seconds",2);case t:return p(_+"Milliseconds",3);default:return this.clone()}},p.endOf=function(e){return this.startOf(e,!1)},p.$set=function(i,a){var c,u=y.p(i),d="set"+(this.$u?"UTC":""),h=((c={}).day=d+"Date",c[l]=d+"Date",c[s]=d+"Month",c[o]=d+"FullYear",c[r]=d+"Hours",c[n]=d+"Minutes",c[t]=d+"Seconds",c[e]=d+"Milliseconds",c)[u],p="day"===u?this.$D+(a-this.$W):a;if(u===s||u===o){var f=this.clone().set(l,1);f.$d[h](p),f.init(),this.$d=f.set(l,Math.min(this.$D,f.daysInMonth())).$d}else h&&this.$d[h](p);return this.init(),this},p.set=function(e,t){return this.clone().$set(e,t)},p.get=function(e){return this[y.p(e)]()},p.add=function(e,a){var l,c=this;e=Number(e);var u=y.p(a),d=function(t){var n=v(c);return y.w(n.date(n.date()+Math.round(t*e)),c)};if(u===s)return this.set(s,this.$M+e);if(u===o)return this.set(o,this.$y+e);if("day"===u)return d(1);if(u===i)return d(7);var h=((l={})[n]=6e4,l[r]=36e5,l[t]=1e3,l)[u]||1,p=this.$d.getTime()+e*h;return y.w(p,this)},p.subtract=function(e,t){return this.add(-1*e,t)},p.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||c;var r=e||"YYYY-MM-DDTHH:mm:ssZ",i=y.z(this),s=this.$H,a=this.$m,o=this.$M,l=n.weekdays,u=n.months,h=n.meridiem,p=function(e,n,i,s){return e&&(e[
1n]||e(t,r))||i[n].slice(0,s)},f=function(e){return y.s(s%12||12,e,"0")},m=h||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(d,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return y.s(t.$y,4,"0");case"M":return o+1;case"MM":return y.s(o+1,2,"0");case"MMM":return p(n.monthsShort,o,u,3);case"MMMM":return p(u,o);case"D":return t.$D;case"DD":return y.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return p(n.weekdaysMin,t.$W,l,2);case"ddd":return p(n.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(s);case"HH":return y.s(s,2,"0");case"h":return f(1);case"hh":return f(2);case"a":return m(s,a,!0);case"A":return m(s,a,!1);case"m":return String(a);case"mm":return y.s(a,2,"0");case"s":return String(t.$s);case"ss":return y.s(t.$s,2,"0");case"SSS":return y.s(t.$ms,3,"0");case"Z":return i}return null}(e)||i.replace(":","")})},p.utcOffset=function(){return-(15*Math.round(this.$d.getTimezoneOffset()/15))},p.diff=function(e,l,c){var u,d=this,h=y.p(l),p=v(e),f=(p.utcOffset()-this.utcOffset())*6e4,m=this-p,g=function(){return y.m(d,p)};switch(h){case o:u=g()/12;break;case s:u=g();break;case a:u=g()/3;break;case i:u=(m-f)/6048e5;break;case"day":u=(m-f)/864e5;break;case r:u=m/36e5;break;case n:u=m/6e4;break;case t:u=m/1e3;break;default:u=m}return c?u:y.a(u)},p.daysInMonth=function(){return this.endOf(s).$D},p.$locale=function(){return f[this.$L]},p.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=_(e,t,!0);return r&&(n.$L=r),n},p.clone=function(){return y.w(this.$d,this)},p.toDate=function(){return new Date(this.valueOf())},p.toJSON=function(){return this.isValid()?this.toISOString():null},p.toISOString=function(){return this.$d.toISOString()},p.toString=function(){return this.$d.toUTCString()},h}(),C=w.prototype;return v.prototype=C,[["$ms",e],["$s",t],["$m",n],["$H",r],["$W","day"],["$M",s],["$y",o],["$D",l]].forEach(function(e){C[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),v.extend=function(e,t){return e.$i||(e(t,w,v),e.$i=!0),v},v.locale=_,v.isDayjs=g,v.unix=function(e){return v(1e3*e)},v.en=f[p],v.Ls=f,v.p={},v},eQ.exports=_();let eX=G(eQ.exports);(v=T||(T={})).assertEqual=e=>{},v.assertIs=function(e){},v.assertNever=function(e){throw Error()},v.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},v.getValidEnumValues=e=>{let t=v.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(let r of t)n[r]=e[r];return v.objectValues(n)},v.objectValues=e=>v.objectKeys(e).map(function(t){return e[t]}),v.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},v.find=(e,t)=>{for(let n of e)if(t(n))return n},v.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,v.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},v.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(S||(S={})).mergeShapes=(e,t)=>({...e,...t});let e0=T.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),e1=e=>{switch(typeof e){case"undefined":return e0.undefined;case"string":return e0.string;case"number":return Number.isNaN(e)?e0.nan:e0.number;case"boolean":return e0.boolean;case"function":return e0.function;case"bigint":return e0.bigint;case"symbol":return e0.symbol;case"object":return Array.isArray(e)?e0.array:null===e?e0.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?e0.promise:"u">typeof Map&&e instanceof Map?e0.map:"u">typeof Set&&e instanceof Set?e0.set:"u">typeof Date&&e instanceof Date?e0.date:e0.object;default:return e0.unknown}}
vendor: 4,480 bytes, line 1
1,e2=T.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),e4=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,T.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};e4.create=e=>new e4(e);let e3=(e,t)=>{let n;switch(e.code){case e2.invalid_type:n=e.received===e0.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case e2.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,T.jsonStringifyReplacer)}`;break;case e2.unrecognized_keys:n=`Unrecognized key(s) in object: ${T.joinValues(e.keys,", ")}`;break;case e2.invalid_union:n="Invalid input";break;case e2.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${T.joinValues(e.options)}`;break;case e2.invalid_enum_value:n=`Invalid enum value. Expected ${T.joinValues(e.options)}, received '${e.received}'`;break;case e2.invalid_arguments:n="Invalid function arguments";break;case e2.invalid_return_type:n="Invalid function return type";break;case e2.invalid_date:n="Invalid date";break;case e2.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:T.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case e2.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case e2.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case e2.custom:n="Invalid input";break;case e2.invalid_intersection_types:n="Intersection results could not be merged";break;case e2.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case e2.not_finite:n="Number must be finite";break;default:n=t.defaultError,T.assertNever(e)}return{message:n}},e9=e=>
1{let{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],a={...i,path:s};if(void 0!==i.message)return{...i,path:s,message:i.message};let o="";for(let e of r.filter(e=>!!e).slice().reverse())o=e(a,{data:t,defaultError:o}).message;return{...i,path:s,message:o}};function e5(e,t){let n=e9({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,e3,e3==e3?void 0:e3].filter(e=>!!e)});e.common.issues.push(n)}let e6=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let r of t){if("aborted"===r.status)return e7;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if("aborted"===t.status||"aborted"===i.status)return e7;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&("u">typeof i.value||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},e7=Object.freeze({status:"aborted"}),e8=e=>({status:"dirty",value:e}),te=e=>({status:"valid",value:e}),tt=e=>"aborted"===e.status,tn=e=>"dirty"===e.status,tr=e=>"valid"===e.status,ti=e=>"u">typeof Promise&&e instanceof Promise;(y=N||(N={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},y.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;let ts=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ta=(e,t)=>{if(tr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new e4(e.common.issues);return this._error=t,this._error}}};function to(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:s}=e;return"invalid_enum_value"===t.code?{message:s??i.defaultError}:typeof i.data>"u"?{message:s??r??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:s??n??i.defaultError}},description:i}}let tl=class{get description(){return this._def.description}_getType(e){return e1(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:e1(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new e6,ctx:{common:e.parent.common,data:e.data,parsedType:e1(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ti(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:(null==t?void 0:t.async)??!1,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e1(e)},r=this._parseSync({data:e,path:n.path,parent:n});return ta(n,r)}"~validate"(e){var t,n;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e1(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:r});return tr(t)?{value:t.value}:{issues:r.common.issues}}catch(e){null!=(n=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())&&n.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(e=>tr(e)?{value:e.value}:{issues:r.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e1(e)}
vendor: 9,463 bytes, line 1
1,r=this._parse({data:e,path:n.path,parent:n});return ta(n,await (ti(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{let i=e(t),s=()=>r.addIssue({code:e2.custom,...n(t)});return"u">typeof Promise&&i instanceof Promise?i.then(e=>!!e||(s(),!1)):!!i||(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new tJ({schema:this,typeName:P.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return tQ.create(this,this._def)}nullable(){return tX.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return tF.create(this)}promise(){return tY.create(this,this._def)}or(e){return t$.create([this,e],this._def)}and(e){return tV.create(this,e,this._def)}transform(e){return new tJ({...to(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new t0({...to(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:P.ZodDefault})}brand(){return new t4({typeName:P.ZodBranded,type:this,...to(this._def)})}catch(e){return new t1({...to(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:P.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return t3.create(this,e)}readonly(){return t9.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},tc=/^c[^\s-]{8,}$/i,tu=/^[0-9a-z]+$/,td=/^[0-9A-HJKMNP-TV-Z]{26}$/i,th=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tp=/^[a-z0-9_-]{21}$/i,tf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tm=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,tg=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,t_=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ty=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,tw=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tC=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tb=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tk="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",tx=RegExp(`^${tk}$`);function tI(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}let tE=class e extends tl{_parse(e){let t;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==e0.string){let t=this._getOrReturnCtx(e);return e5(t,{code:e2.invalid_type,expected:e0.string,received:t.parsedType}),e7}let n=new e6;for(let l of this._def.checks)if("min"===l.kind)e.data.length<l.value&&(e5(t=this._getOrReturnCtx(e,t),{code:e2.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),n.dirty());else if("max"===l.kind)e.data.length>l.value&&(e5(t=this._getOrReturnCtx(e,t),{code:e2.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),n.dirty());else if("length"===l.kind){let r=e.data.length>l.value,i=e.data.length<l.value;(r||i)&&(t=this._getOrReturnCtx(e,t),r?e5(t,{code:e2.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):i&&e5(t,{code:e2.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),n.dirty())}else if("email"===l.kind)tg.test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{validation:"email",code:e2.invalid_string,message:l.message}),n.dirty());else if("emoji"===l.kind)r||(r=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),r.test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{validation:"emoji",code:e2.invalid_string,message:l.message}),n.dirty());else if("uuid"===l.kind)th.test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{validation:"uuid",code:e2.invalid_string,message:l.message}),n.dirty());else if("nanoid"===l.kind)tp.test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{validation:"nanoid",code:e2.invalid_string,message:l.message}),n.dirty());else if("cuid"===l.kind)tc.test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{validation:"cuid",code:e2.invalid_string,message:l.message}),n.dirty());else if("cuid2"===l.kind)tu.test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{validation:"cuid2",code:e2.invalid_string,message:l.message}),n.dirty());else if("ulid"===l.kind)td.test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{validation:"ulid",code:e2.invalid_string,message:l.message}),n.dirty());else if("url"===l.kind)try{new URL(e.data)}catch{e5(t=this._getOrReturnCtx(e,t),{validation:"url",code:e2.invalid_string,message:l.message}),n.dirty()}else{var i,s,a,o;"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{validation:"regex",code:e2.invalid_string,message:l.message}),n.dirty())):"trim"===l.kind?e.data=e.data.trim():"includes"===l.kind?e.data.includes(l.value,l.position)||(e5(t=this._getOrReturnCtx(e,t),{code:e2.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),n.dirty()):"toLowerCase"===l.kind?e.data=e.data.toLowerCase():"toUpperCase"===l.kind?e.data=e.data.toUpperCase():"startsWith"===l.kind?e.data.startsWith(l.value)||(e5(t=this._getOrReturnCtx(e,t),{code:e2.invalid_string,validation:{startsWith:l.value},message:l.message}),n.dirty()):"endsWith"===l.kind?e.data.endsWith(l.value)||(e5(t=this._getOrReturnCtx(e,t),{code:e2.invalid_string,validation:{endsWith:l.value},message:l.message}),n.dirty()):"datetime"===l.kind?(function(e){let t=`${tk}T${tI(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,RegExp(`^${t}$`)})(l).test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{code:e2.invalid_string,validation:"datetime",message:l.message}),n.dirty()):"date"===l.kind?tx.test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{code:e2.invalid_string,validation:"date",message:l.message}),n.dirty()):"time"===l.kind?RegExp(`^${tI(l)}$`).test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{code:e2.invalid_string,validation:"time",message:l.message}),n.dirty()):"duration"===l.kind?tm.test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{validation:"duration",code:e2.invalid_string,message:l.message}),n.dirty()):"ip"===l.kind?(i=e.data,("v4"===(s=l.version)||!s)&&t_.test(i)||("v6"===s||!s)&&ty.test(i)||(e5(t=this._getOrReturnCtx(e,t),{validation:"ip",code:e2.invalid_string,message:l.message}),n.dirty())):"jwt"===l.kind?function(e,t){if(!tf.test(e))return!1;
1try{let[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!("object"!=typeof i||null===i||"typ"in i&&(null==i?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}(e.data,l.alg)||(e5(t=this._getOrReturnCtx(e,t),{validation:"jwt",code:e2.invalid_string,message:l.message}),n.dirty()):"cidr"===l.kind?(a=e.data,("v4"===(o=l.version)||!o)&&tv.test(a)||("v6"===o||!o)&&tw.test(a)||(e5(t=this._getOrReturnCtx(e,t),{validation:"cidr",code:e2.invalid_string,message:l.message}),n.dirty())):"base64"===l.kind?tC.test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{validation:"base64",code:e2.invalid_string,message:l.message}),n.dirty()):"base64url"===l.kind?tb.test(e.data)||(e5(t=this._getOrReturnCtx(e,t),{validation:"base64url",code:e2.invalid_string,message:l.message}),n.dirty()):T.assertNever(l)}return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:e2.invalid_string,...N.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(null==e?void 0:e.precision)>"u"?null:null==e?void 0:e.precision,offset:(null==e?void 0:e.offset)??!1,local:(null==e?void 0:e.local)??!1,...N.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(null==e?void 0:e.precision)>"u"?null:null==e?void 0:e.precision,...N.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...N.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};tE.create=e=>new tE({checks:[],typeName:P.ZodString,coerce:(null==e?void 0:e.coerce)??!1,...to(e)});let tT=class e extends tl{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==e0.number){let t=this._getOrReturnCtx(e);return e5(t,{code:e2.invalid_type,expected:e0.number,received:t.parsedType}),e7}let n=new e6;for(let r of this._def.checks)"int"===r.kind?T.isInteger(e.data)||(e5(t=this._getOrReturnCtx(e,t),{code:e2.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(e5(t=this._getOrReturnCtx(e,t),{code:e2.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(e5(t=this._getOrReturnCtx(e,t),{code:e2.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"multipleOf"===r.kind?0!==function(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,r.value)&&(e5(t=this._getOrReturnCtx(e,t),{code:e2.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(e5(t=this._getOrReturnCtx(e,t),{code:e2.not_finite,message:r.message}),n.dirty()):T.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:N.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&T.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};tT.create=e=>new tT({checks:[],typeName:P.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...to(e)});let tS=class e extends tl{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==e0.bigint)return this._getInvalidInput(e);let n=new e6;for(let r of this._def.checks)"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(e5(t=this._getOrReturnCtx(e,t),{code:e2.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(e5(t=this._getOrReturnCtx(e,t),{code:e2.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(e5(t=this._getOrReturnCtx(e,t),{code:e2.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):T.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return e5(t,{code:e2.invalid_type,expected:e0.bigint,received:t.parsedType}),e7}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:N.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}
vendor: 19,198 bytes, line 1
1positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};tS.create=e=>new tS({checks:[],typeName:P.ZodBigInt,coerce:(null==e?void 0:e.coerce)??!1,...to(e)});let tN=class extends tl{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==e0.boolean){let t=this._getOrReturnCtx(e);return e5(t,{code:e2.invalid_type,expected:e0.boolean,received:t.parsedType}),e7}return te(e.data)}};tN.create=e=>new tN({typeName:P.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...to(e)});let tP=class e extends tl{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==e0.date){let t=this._getOrReturnCtx(e);return e5(t,{code:e2.invalid_type,expected:e0.date,received:t.parsedType}),e7}if(Number.isNaN(e.data.getTime()))return e5(this._getOrReturnCtx(e),{code:e2.invalid_date}),e7;let n=new e6;for(let r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(e5(t=this._getOrReturnCtx(e,t),{code:e2.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(e5(t=this._getOrReturnCtx(e,t),{code:e2.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):T.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:N.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}};tP.create=e=>new tP({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:P.ZodDate,...to(e)});let tR=class extends tl{_parse(e){if(this._getType(e)!==e0.symbol){let t=this._getOrReturnCtx(e);return e5(t,{code:e2.invalid_type,expected:e0.symbol,received:t.parsedType}),e7}return te(e.data)}};tR.create=e=>new tR({typeName:P.ZodSymbol,...to(e)});let tO=class extends tl{_parse(e){if(this._getType(e)!==e0.undefined){let t=this._getOrReturnCtx(e);return e5(t,{code:e2.invalid_type,expected:e0.undefined,received:t.parsedType}),e7}return te(e.data)}};tO.create=e=>new tO({typeName:P.ZodUndefined,...to(e)});let tL=class extends tl{_parse(e){if(this._getType(e)!==e0.null){let t=this._getOrReturnCtx(e);return e5(t,{code:e2.invalid_type,expected:e0.null,received:t.parsedType}),e7}return te(e.data)}};tL.create=e=>new tL({typeName:P.ZodNull,...to(e)});let tA=class extends tl{constructor(){super(...arguments),this._any=!0}_parse(e){return te(e.data)}};tA.create=e=>new tA({typeName:P.ZodAny,...to(e)});let tj=class extends tl{constructor(){super(...arguments),this._unknown=!0}_parse(e){return te(e.data)}};tj.create=e=>new tj({typeName:P.ZodUnknown,...to(e)});let tD=class extends tl{_parse(e){let t=this._getOrReturnCtx(e);return e5(t,{code:e2.invalid_type,expected:e0.never,received:t.parsedType}),e7}};tD.create=e=>new tD({typeName:P.ZodNever,...to(e)});let tM=class extends tl{_parse(e){if(this._getType(e)!==e0.undefined){let t=this._getOrReturnCtx(e);return e5(t,{code:e2.invalid_type,expected:e0.void,received:t.parsedType}),e7}return te(e.data)}};tM.create=e=>new tM({typeName:P.ZodVoid,...to(e)});let tF=class e extends tl{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==e0.array)return e5(t,{code:e2.invalid_type,expected:e0.array,received:t.parsedType}),e7;if(null!==r.exactLength){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(e5(t,{code:e?e2.too_big:e2.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(e5(t,{code:e2.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(e5(t,{code:e2.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new ts(t,e,t.path,n)))).then(e=>e6.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new ts(t,e,t.path,n)));return e6.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:N.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:N.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:N.toString(n)}})}nonempty(e){return this.min(1,e)}};tF.create=(e,t)=>new tF({type:e,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...to(t)});let tU=class e extends tl{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=T.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==e0.object){let t=this._getOrReturnCtx(e);return e5(t,{code:e2.invalid_type,expected:e0.object,received:t.parsedType}),e7}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof tD&&"strip"===this._def.unknownKeys))for(let e in n.data)i.includes(e)||s.push(e);let a=[];for(let e of i){let t=r[e],i=n.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new ts(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof tD){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of s)a.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(e5(n,{code:e2.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of s){let r=n.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new ts(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of a){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>e6.mergeObjectSync(t,e)):e6.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(t){return N.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,n)=>{var r,i;let s=(null==(i=(r=this._def).errorMap)?void 0:i.call(r,e,n).message)??n.defaultError;return"unrecognized_keys"===e.code?{message:N.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:P.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of T.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of T.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return function e(t){if(!(t instanceof tU))return t instanceof tF?new tF({...t._def,type:e(t.element)}):t instanceof tQ?tQ.create(e(t.unwrap())):t instanceof tX?tX.create(e(t.unwrap())):t instanceof tq?tq.create(t.items.map(t=>e(t))):t;{let n={};for(let r in t.shape){let i=t.shape[r];n[r]=tQ.create(e(i))}return new tU({...t._def,shape:()=>n})}}(this)}partial(t){let n={};for(let e of T.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of T.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof tQ;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return tZ(T.objectKeys(this.shape))}};tU.create=(e,t)=>new tU({shape:()=>e,unknownKeys:"strip",catchall:tD.create(),typeName:P.ZodObject,...to(t)}),tU.strictCreate=(e,t)=>new tU({shape:()=>e,unknownKeys:"strict",catchall:tD.create(),typeName:P.ZodObject,...to(t)}),tU.lazycreate=(e,t)=>new tU({shape:e,unknownKeys:"strip",catchall:tD.create(),typeName:P.ZodObject,...to(t)});let t$=class extends tl{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new e4(e.ctx.common.issues));return e5(t,{code:e2.invalid_union,unionErrors:n}),e7});{let e;let r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},s=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new e4(e));return e5(t,{code:e2.invalid_union,unionErrors:i}),e7}}get options(){return this._def.options}};t$.create=(e,t)=>new t$({options:e,typeName:P.ZodUnion,...to(t)});let tV=class extends tl{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(tt(e)||tt(r))return e7;let i=function e(t,n){let r=e1(t),i=e1(n);if(t===n)return{valid:!0,data:t};if(r===e0.object&&i===e0.object){let r=T.objectKeys(n),i=T.objectKeys(t).filter(e=>-1!==r.indexOf(e)),s={...t,...n};for(let r of i){let i=e(t[r],n[r]);if(!i.valid)return{valid:!1};s[r]=i.data}return{valid:!0,data:s}}if(r!==e0.array||i!==e0.array)return r===e0.date&&i===e0.date&&+t==+n?{valid:!0,data:t}:{valid:!1};{if(t.length!==n.length)return{valid:!1};let r=[];for(let i=0;i<t.length;i++){let s=e(t[i],n[i]);if(!s.valid)return{valid:!1};r.push(s.data)}return{valid:!0,data:r}}}(e.value,r.value);return i.valid?((tn(e)||tn(r))&&t.dirty(),{status:t.value,value:i.data}):(e5(n,{code:e2.invalid_intersection_types}),e7)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};tV.create=(e,t,n)=>new tV({left:e,right:t,typeName:P.ZodIntersection,...to(n)});let tq=class e extends tl{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==e0.array)return e5(n,{code:e2.invalid_type,expected:e0.array,received:n.parsedType}),e7;if(n.data.length<this._def.items.length)return e5(n,{code:e2.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),e7;!this._def.rest&&n.data.length>this._def.items.length&&(e5(n,{code:e2.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new ts(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>e6.mergeArray(t,e)):e6.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};tq.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new tq({items:e,typeName:P.ZodTuple,rest:null,...to(t)})};let tz=class extends tl{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==e0.map)return e5(n,{code:e2.invalid_type,expected:e0.map,received:n.parsedType}),e7;let r=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([e,t],s)=>({key:r._parse(new ts(n,e,n.path,[s,"key"])),value:i._parse(new ts(n,t,n.path,[s,"value"]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of s){let r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return e7;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of s){let r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return e7;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};tz.create=(e,t,n)=>new tz({valueType:t,keyType:e,typeName:P.ZodMap,...to(n)});let tB=class e extends tl{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==e0.set)return e5(n,{code:e2.invalid_type,expected:e0.set,received:n.parsedType}),e7;let r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(e5(n,{code:e2.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(e5(n,{code:e2.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function s(e){let n=new Set;for(let r of e){if("aborted"===r.status)return e7;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let a=[...n.data.values()].map((e,t)=>i._parse(new ts(n,e,n.path,t)));return n.common.async?Promise.all(a).then(e=>s(e)):s(a)}min(t,n){return new e({...this._def,minSize:{value:t,message:N.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:N.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};tB.create=(e,t)=>new tB({valueType:e,minSize:null,maxSize:null,typeName:P.ZodSet,...to(t)});let tW=class extends tl{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};tW.create=(e,t)=>new tW({getter:e,typeName:P.ZodLazy,...to(t)});let tH=class extends tl{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return e5(t,{received:t.data,code:e2.invalid_literal,expected:this._def.value}),e7}return{status:"valid",value:e.data}}get value(){return this._def.value}};function tZ(e,t){return new tK({values:e,typeName:P.ZodEnum,...to(t)})}tH.create=(e,t)=>new tH({value:e,typeName:P.ZodLiteral,...to(t)});let tK=class e extends tl{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),n=this._def.values;return e5(t,{expected:T.joinValues(n),received:t.parsedType,code:e2.invalid_type}),e7}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return e5(t,{received:t.data,code:e2.invalid_enum_value,options:n}),e7}return te(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};tK.create=tZ;let tG=class extends tl{_parse(e){let t=T.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==e0.string&&n.parsedType!==e0.number){let e=T.objectValues(t);return e5(n,{expected:T.joinValues(e),received:n.parsedType,code:e2.invalid_type}),e7}if(this._cache||(this._cache=new Set(T.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=T.objectValues(t);return e5(n,{received:n.data,code:e2.invalid_enum_value,options:e}),e7}return te(e.data)}get enum(){return this._def.values}};tG.create=(e,t)=>new tG({values:e,typeName:P.ZodNativeEnum,...to(t)});let tY=class extends tl{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==e0.promise&&!1===t.common.async?(e5(t,{code:e2.invalid_type,expected:e0.promise,received:t.parsedType}),e7):te((t.parsedType===e0.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};tY.create=(e,t)=>new tY({type:e,typeName:P.ZodPromise,...to(t)});let tJ=class extends tl{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{e5(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return e7;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?e7:"dirty"===r.status||"dirty"===t.value?e8(r.value):r});{if("aborted"===t.value)return e7;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?e7:"dirty"===r.status||"dirty"===t.value?e8(r.value):r}}if("refinement"===r.type){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==n.common.async)return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?e7:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))));{let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?e7:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}}if("transform"===r.type){if(!1!==n.common.async)return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>tr(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):e7);{let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!tr(e))return e7;let s=r.transform(e.value,i);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}}T.assertNever(r)}};
1tJ.create=(e,t,n)=>new tJ({schema:e,typeName:P.ZodEffects,effect:t,...to(n)}),tJ.createWithPreprocess=(e,t,n)=>new tJ({schema:t,effect:{type:"preprocess",transform:e},typeName:P.ZodEffects,...to(n)});let tQ=class extends tl{_parse(e){return this._getType(e)===e0.undefined?te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};tQ.create=(e,t)=>new tQ({innerType:e,typeName:P.ZodOptional,...to(t)});let tX=class extends tl{_parse(e){return this._getType(e)===e0.null?te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};tX.create=(e,t)=>new tX({innerType:e,typeName:P.ZodNullable,...to(t)});let t0=class extends tl{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===e0.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};t0.create=(e,t)=>new t0({innerType:e,typeName:P.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...to(t)});let t1=class extends tl{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ti(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new e4(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new e4(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};t1.create=(e,t)=>new t1({innerType:e,typeName:P.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...to(t)});let t2=class extends tl{_parse(e){if(this._getType(e)!==e0.nan){let t=this._getOrReturnCtx(e);return e5(t,{code:e2.invalid_type,expected:e0.nan,received:t.parsedType}),e7}return{status:"valid",value:e.data}}};t2.create=e=>new t2({typeName:P.ZodNaN,...to(e)});let t4=class extends tl{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},t3=class e extends tl{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?e7:"dirty"===e.status?(t.dirty(),e8(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?e7:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:P.ZodPipeline})}},t9=class extends tl{_parse(e){let t=this._def.innerType._parse(e),n=e=>(tr(e)&&(e.value=Object.freeze(e.value)),e);return ti(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};t9.create=(e,t)=>new t9({innerType:e,typeName:P.ZodReadonly,...to(t)}),(w=P||(P={})).ZodString="ZodString",w.ZodNumber="ZodNumber",w.ZodNaN="ZodNaN",w.ZodBigInt="ZodBigInt",w.ZodBoolean="ZodBoolean",w.ZodDate="ZodDate",w.ZodSymbol="ZodSymbol",w.ZodUndefined="ZodUndefined",w.ZodNull="ZodNull",w.ZodAny="ZodAny",w.ZodUnknown="ZodUnknown",w.ZodNever="ZodNever",w.ZodVoid="ZodVoid",w.ZodArray="ZodArray",w.ZodObject="ZodObject",w.ZodUnion="ZodUnion",w.ZodDiscriminatedUnion="ZodDiscriminatedUnion",w.ZodIntersection="ZodIntersection",w.ZodTuple="ZodTuple",w.ZodRecord="ZodRecord",w.ZodMap="ZodMap",w.ZodSet="ZodSet",w.ZodFunction="ZodFunction",w.ZodLazy="ZodLazy",w.ZodLiteral="ZodLiteral",w.ZodEnum="ZodEnum",w.ZodEffects="ZodEffects",w.ZodNativeEnum="ZodNativeEnum",w.ZodOptional="ZodOptional",w.ZodNullable="ZodNullable",w.ZodDefault="ZodDefault",w.ZodCatch="ZodCatch",w.ZodPromise="ZodPromise",w.ZodBranded="ZodBranded",w.ZodPipeline="ZodPipeline",w.ZodReadonly="ZodReadonly";let t5=tE.create,t6=tT.create;tD.create,tF.create;let t7=tU.create;t$.create,tV.create,tq.create;let t8=tK.create;tY.create,tQ.create,tX.create;let ne=()=>{document.documentElement.style.setProperty("--doc-height",`${window.innerHeight}px`)},nt=({size:e=24,color:t,dataTestId:n="chevronLeftRegular"})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg","data-testid":n,children:(0,q.jsx)("path",{d:"m16.6 23.6l-10.2-10.7c-0.3-0.2-0.4-0.6-0.4-0.9 0-0.3 0.1-0.7 0.4-0.9l10.2-10.7c0.5-0.5 1.3-0.5 1.9 0 0.5 0.5 0.5 1.3 0 1.9l-9.3 9.7 9.3 9.7c0.5 0.6 0.5 1.4 0 1.9-0.6 0.5-1.4 0.5-1.9 0z"})}),nn=({size:e=24,color:t,dataTestId:n="chevronRightRegular"})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg","data-testid":n,children:(0,q.jsx)("path",{d:"m8.3 0.4l10.2 10.7c0.3 0.2 0.4 0.6 0.4 0.9 0 0.3-0.1 0.7-0.4 0.9l-10.2 10.7c-0.5 0.5-1.4 0.5-1.9 0-0.5-0.5-0.5-1.3 0-1.9l9.3-9.7-9.3-9.7c-0.5-0.6-0.5-1.4 0-1.9 0.5-0.5 1.4-0.5 1.9 0z"})});var nr={exports:{}};C=function(){return function(e,t,n){t.prototype.isToday=function(){var e="YYYY-MM-DD",t=n();return this.format(e)===t.format(e)}}},nr.exports=C();let ni=G(nr.exports),ns=["Dom.","Seg.","Ter.","Qua.","Qui.","Sex.","S\xe1b"],na=["Janeiro","Fevereiro","Mar\xe7o","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],no=({first:e,last:t,isSelecting:n,startDate:r,limitDate:i,singleDate:s,vertical:a,weekdaysName:o=ns,monthsName:l=na,onFirstDateSelected:c,onLastDateSelected:u,onSelectionComplete:d,allowToday:h=!1})=>{let p=new Date,{elementRef:f,mouseDownHandler:m}=function(){let e={top:0,left:0,x:0,y:0},t=(0,z.useRef)(null),n=n=>{if(!t.current)return;let r=n.clientX-e.x,i=n.clientY-e.y;t.current.scrollTop=e.top-i,t.current.scrollLeft=e.left-r},r=()=>{var e,i;document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",r),null==(e=t.current)||e.style.removeProperty("user-select"),null==(i=t.current)||i.classList.remove("grabbing")};return{elementRef:t,mouseDownHandler:i=>{t.current&&(t.current.style.userSelect="none",t.current.classList.add("grabbing"),e={left:t.current.scrollLeft,top:t.current.scrollTop,x:i.clientX,y:i.clientY},document.addEventListener("mousemove",n),document.addEventListener("mouseup",r))}}}(),[g,_]=(0,z.useState)(new Date),[v,y]=(0,z.useState)(p.getMonth()),[w,C]=(0,z.useState)(p.getFullYear()),b=s?!!e:!!e&&!!t,k=(0,z.useCallback)(()=>(0,q.jsx)(q.Fragment,{children:o.map(e=>(0,q.jsx)("div",{className:J("vdp-ui-daterangepicker-weekday-label",{vertical:a}),children:e},e.replace(/[^0-9a-z]/gi,"").toLowerCase()))}),[o,a]),x=(0,z.useCallback)((e,t,n)=>!s&&!!n&&!!t&&eX(e).isAfter(t)&&eX(e).isBefore(n),[s]),I=(0,z.useCallback)((e,t)=>e.getTime()>(null==t?void 0:t.getTime()),[]),E=(0,z.useCallback)((e,t)=>{let n=e.getTime()>(null==t?void 0:t.getTime()),r=eX(e).isSame(t);return n||r},[]),T=(0,z.useCallback)((e,t)=>e.getTime()<(null==t?void 0:t.getTime()),[]),S=(0,z.useCallback)((e,t,n,r)=>(0,q.jsx)("button",{type:"button",className:J("vdp-ui-daterangepicker-day-slot",e,{vertical:a}),onClick:n,onMouseEnter:r,children:t},t),[a]),N=(0,z.useCallback)(n=>{e&&t||!e&&!t||_(n)},[e,t,_]),P=(0,z.useCallback)((e,t)=>t>11?{year:e+1,month:0}:{year:e,month:t},[]),R=(0,z.useCallback)(r=>{if(s){c(r),d();return}if(e&&t&&!n){c(r),u(void 0),_(new Date);return}if(e&&t&&n){switch(n){case"first":if(c(r),I(r,t)){u(void 0);return}break;case"last":u(r),_(new Date)}d();return}if(e&&!t&&n){switch(n){case"first":c(r);break;case"last":u(r),_(new Date),d()}return}if(!e){c(r);return}e&&!I(r,e)&&c(r),e&&E(r,e)&&(u(r),d())},[e,t,c,u,d,I,E,n,s]),O=(0,z.useCallback)((o,l,c)=>{if(0===o)return(0,q.jsx)("div",{className:J("day-slot EMPTY",{vertical:a})});let u=P(c,l),d=new Date(`${u.month+1}/${o}/${u.year}`),p=[];eX.extend(ni),eX(d).isToday()&&p.push("TODAY"),s&&p.push("SINGLE-DATE"),null!=e&&p.push("FIRST-SELECTED"),eX(d).isSame(e)&&p.push("FIRST"),eX(d).isSame(t)&&p.push("LAST"),eX(d).isToday()?h||p.push("DISABLED"):r&&d.getTime()<r.getTime()&&p.push("DISABLED"),i&&d.getTime()>i.getTime()&&p.push("DISABLED"),n&&"last"===n&&T(d,e||new Date)&&p.push("DISABLED");let f=x(d,e||new Date,g),m=!!t&&x(d,e||new Date,t);return("first"!==n||!n||t)&&e&&(f||m)&&p.push("BETWEEN"),p.includes("DISABLED")?S(p.join(" "),o):S(p.join(" "),o,()=>R(d),()=>N(d))},[a,r,i,n,e,t,S,T,x,N,P,R,g,s,h]),L=(0,z.useCallback)((e,t)=>{let n=eX(`${e}-${t+1}-01`),r=eX(`${e}-${t+1}-01`).daysInMonth(),i=n.startOf("month").day(),s=Array.from(Array(r).keys()),a=Array(42-(s=[...Array(i).fill(-1),...s]).length).fill(-1);return s=[...s,...a],(0,q.jsx)("div",{className:"vdp-ui-daterangepicker-days-container","data-cy":"calendar-month-days",children:s.map((n,r)=>(0,q.jsx)(z.Fragment,{children:O(n+1,t,e)},r))})},[O]),A=(0,z.useCallback)(()=>
1{if(v>0){y(v-1);return}y(11),C(w-1)},[w,v,C,y]),j=(0,z.useCallback)(()=>{if(v<11){y(v+1);return}y(0),C(w+1)},[w,v,C,y]),D=(0,z.useCallback)(()=>{let e=eX(`${w}-${v+1}-01`).add(1,"month").add(-1,"day"),t=!i||eX(e).isBefore(i);return(0,q.jsx)("button",{type:"button","data-cy":"next-calendar-month-button",className:"header-button",onClick:j,children:t?(0,q.jsx)(nn,{}):""})},[w,v,j,i]),M=(0,z.useCallback)(()=>{let e=eX(`${w}-${v+1}-01`).add(-1,"day"),t=!r||eX(e).isAfter(r);return(0,q.jsx)("button",{type:"button","data-cy":"previous-calendar-month-button",className:"header-button",onClick:A,children:t?(0,q.jsx)(nt,{}):""})},[w,v,A,r]),F=(0,z.useCallback)((e,t)=>{let n=P(e,t);return(0,q.jsxs)("div",{className:"vdp-ui-daterangepicker-header-label",children:[(0,q.jsx)("div",{className:"vdp-ui-daterangepicker-header-month",children:l[n.month]}),(0,q.jsx)("div",{className:"vdp-ui-daterangepicker-header-year",children:n.year})]})},[P,l]),U=(0,z.useCallback)((e,t)=>(0,q.jsxs)("div",{"data-cy":"calendar-month",className:J("vdp-ui-daterangepicker-month-container",{vertical:a}),children:[(0,q.jsx)(Q,{value:a,children:(0,q.jsxs)("div",{className:"vdp-ui-daterangepicker-vertical-month-label",children:[(0,q.jsxs)("span",{className:"vdp-ui-daterangepicker-vertical-month-label-month",children:[" ",l[t]]}),(0,q.jsx)("span",{className:"vdp-ui-daterangepicker-vertical-month-label-year",children:e})]})}),L(e,t)]}),[a,l,L]),$=(0,z.useCallback)(e=>{let t=eX(),n=(e?eX(e):t.add(1,"year")).diff(t,"month")+2,r=[];for(let e=1;e<n;e+=1){let n=t.add(e,"month");r.push(U(n.year(),n.month()))}return r},[U]);return{month:v,setMonth:y,year:w,setYear:C,elementRef:f,mouseDownHandler:m,RenderPreviousMonthButton:M,RenderHeader:F,RenderNextMonthButton:D,RenderWeekDays:k,RenderMonth:U,RenderAllMonths:$,selectionIsCompleted:b}};(0,z.forwardRef)((e,t)=>{let{month:n,setMonth:r,year:i,setYear:s,elementRef:a,mouseDownHandler:o,RenderPreviousMonthButton:l,RenderHeader:c,RenderNextMonthButton:u,RenderWeekDays:d,RenderMonth:h,RenderAllMonths:p,selectionIsCompleted:f}=no(e),{first:m,vertical:g,multiple:_,last:v,onClear:y,onConfirm:w,limitDate:C,palette:b="vdp-palette"}=e;return(0,z.useEffect)(()=>{m&&(r(m.getMonth()),s(m.getFullYear()))},[]),(0,q.jsxs)("div",{className:J("vdp-ui-daterangepicker-container",{vertical:g},b),ref:t,children:[(0,q.jsx)(Q,{value:!g,children:(0,q.jsxs)("div",{className:"vdp-ui-daterangepicker-header",children:[l(),c(i,n),(0,q.jsxs)(Q,{value:_&&!g,children:[(0,q.jsx)("div",{className:"header-label-gap"}),c(i,n+1)]}),u()]})}),(0,q.jsxs)("div",{className:J("vdp-ui-daterangepicker-weekday-labels-container",{vertical:g}),children:[(0,q.jsx)("div",{className:J("vdp-ui-daterangepicker-weekdays-labels",{vertical:g}),children:d()}),(0,q.jsx)(Q,{value:_&&!g,children:(0,q.jsx)("div",{className:"vdp-ui-daterangepicker-weekdays-labels",children:d()})})]}),(0,q.jsxs)("div",{role:"button",tabIndex:0,ref:a,onMouseDown:o,className:J("vdp-ui-daterangepicker-multiple-months-container",{vertical:g}),children:[h(i,n),(0,q.jsxs)(Q,{value:_&&!g,children:[(0,q.jsx)("div",{className:"multiple-months-gap"}),h(i,n+1)]}),(0,q.jsx)(Q,{value:g,children:p(C).map((e,t)=>(0,q.jsx)(z.Fragment,{children:e},e.key||t))})]}),(0,q.jsxs)("div",{className:J("vdp-ui-daterangepicker-bottom-container",{vertical:g}),children:[(0,q.jsxs)("div",{className:"vdp-ui-daterangepicker-bottom-selected-date",children:[(0,q.jsx)("span",{className:"bottom-selected-date-value",children:function(e,t){let n=e?`${e.getDate()}/${e.getMonth()+1}`:"",r=t?` - ${t.getDate()}/${t.getMonth()+1}`:"";return`${n}${r}`}(m,v)}),y&&(0,q.jsx)("span",{role:"button",tabIndex:0,className:"bottom-selected-date-clear",onClick:y,children:"Limpar"})]}),(0,q.jsx)("div",{className:"vdp-ui-daterangepicker-bottom-buttons",children:(0,q.jsx)(ee,{theme:"primary",label:"Confirmar","data-cy":"confirm-calendar-date",onClick:w,disabled:!f,palette:b})})]})]})});let nl=(0,z.createContext)({}),nc=()=>(0,z.useContext)(nl),nu=({onOptionSelect:e=()=>{},onRecentRemove:t=()=>{},...n})=>{let[r,i]=(0,z.useState)(!1),s=(0,z.useCallback)(e=>{var t;null==(t=n.onFocus)||t.call(n,e),i(!0)},[n,i]),{containerRef:a}=eY({onClickOutside:()=>i(!1)});return{isActive:r,handleOnFocus:s,containerRef:a,handleOptionClick:(0,z.useCallback)(t=>{e(t),i(!1)},[e]),handleBlurCapture:(0,z.useCallback)(()=>{i(!1)},[]),handleRecentRemove:(0,z.useCallback)(e=>{t(e)},[t])}},nd=(0,z.forwardRef)(({value:e="",options:t,disableDropdown:n=!1,recentOptions:r=[],recommendedOptions:i=[],hasError:s,validation:a=!!e.length,validationMessage:o="Digite para pesquisar",noResultsMessage:l="Nenhum resultado encontrado",recentTitle:c="Suas pesquisas recentes",recommendedTitle:u="Resultados populares",onOptionSelect:d=()=>{},onRecentRemove:h=()=>{},palette:p="vdp-palette",...f},m)=>{let{isActive:g,handleOnFocus:_,containerRef:v,handleOptionClick:y}=nu({onOptionSelect:d,onRecentRemove:h,...f});return(0,q.jsxs)("div",{ref:v,className:J("vdp-ui-autocomplete-group",p),children:[(0,q.jsx)(eG,{...f,ref:m,className:J({"vdp-ui-autocomplete-input"
1:g&&!n}),onFocus:_,value:e,hasError:!g&&s,palette:p}),(0,q.jsx)(Q,{value:g&&!n,children:(0,q.jsxs)("div",{className:"vdp-ui-autocomplete-container",children:[(0,q.jsx)(Q,{value:!a,children:(0,q.jsx)("span",{className:"vdp-ui-validation-message",children:o})}),(0,q.jsx)(Q,{value:a&&!t.length,children:(0,q.jsx)("span",{className:"vdp-ui-validation-message",children:l})}),(0,q.jsx)(Q,{value:!!t.length||!!r.length||!!i.length,children:(0,q.jsxs)("ul",{className:"vdp-ui-autocomplete-options",children:[(0,q.jsx)(Q,{value:!!t.length,children:t.map(({key:e,value:t})=>(0,q.jsx)("button",{type:"button","data-cy":"autocomplete-regular-item","data-code":e,onClick:y,className:"vdp-ui-autocomplete-option",children:t},e))}),(0,q.jsxs)(Q,{value:!!r.length,children:[(0,q.jsx)("span",{className:"vdp-ui-options-title",children:c}),(0,q.jsx)("ul",{className:"vdp-ui-autocomplete-options-sub",children:r.map(e=>(0,q.jsxs)("button",{type:"button","data-cy":"autocomplete-recent-item","data-code":e.key,className:"vdp-ui-autocomplete-option",children:[(0,q.jsx)("span",{role:"button",tabIndex:0,className:"vdp-ui-autocomplete-option-text",onClick:y,children:e.value}),(0,q.jsx)("button",{type:"button",className:"vdp-ui-autocomplete-option-button",onClick:()=>h(e),children:(0,q.jsx)(en,{})})]},e.key))})]}),(0,q.jsxs)(Q,{value:!!i.length,children:[(0,q.jsx)("span",{className:"vdp-ui-options-title",children:u}),(0,q.jsx)("ul",{className:"vdp-ui-autocomplete-options-sub",children:i.map(({key:e,value:t})=>(0,q.jsx)("button",{type:"button","data-cy":"autocomplete-recommended-item","data-code":e,onClick:y,className:"vdp-ui-autocomplete-option",children:t},e))})]})]})})]})})]})});(0,z.createContext)({});let nh=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"M20 11.9231C20 12.4346 19.5885 12.8462 19.0769 12.8462H4.92308C4.41346 12.8462 4 12.4331 4 11.9235C4 11.4154 4.41346 11 4.92308 11H19.0769C19.5885 11 20 11.4154 20 11.9231Z"})}),np=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"M20 12C20 12.5096 19.5865 12.9231 19.0769 12.9231H12.9231V19.0769C12.9231 19.5865 12.5096 20 12 20C11.4904 20 11.0769 19.5865 11.0769 19.0769V12.923
11H4.92308C4.41346 12.9231 4 12.5096 4 12C4 11.4904 4.41346 11.0769 4.92308 11.0769H11.0769V4.92308C11.0769 4.41346 11.4904 4 12 4C12.5096 4 12.9231 4.41346 12.9231 4.92308V11.0769H19.0769C19.5865 11.0769 20 11.4904 20 12Z"})});(0,z.forwardRef)(({id:e,title:t,description:n,minValue:r,maxValue:i,variant:s,startingValue:a=0,size:o="medium",onChange:l},c)=>{let[u,d]=(0,z.useState)(a??0),h=u<=r,p=u>=i,f=(0,z.useCallback)(()=>{l(u+1),d(u+1)},[u,l,d]),m=(0,z.useCallback)(()=>{l(u-1),d(u-1)},[u,l,d]);return(0,z.useEffect)(()=>{d(a)},[a]),(0,q.jsxs)("div",{ref:c,className:J("vdp-ui-number-picker-container",s),children:[(0,q.jsxs)("div",{className:J("vdp-ui-number-picker-labels",s),children:[(0,q.jsx)(Q,{value:t,children:(0,q.jsx)("span",{className:J("vdp-ui-number-picker-title",{small:"small"===o}),children:t})}),(0,q.jsx)(Q,{value:n,children:(0,q.jsx)("span",{className:J("vdp-ui-number-picker-description",{small:"small"===o}),children:n})})]}),(0,q.jsxs)("div",{className:J("vdp-ui-number-picker-buttons",s),children:[(0,q.jsx)("button",{type:"button","data-cy":`${e}-minus`,"data-testid":"number-picker-minus",className:J("vdp-ui-number-picker-button",{small:"small"===o}),onClick:()=>!h&&m(),children:(0,q.jsx)("div",{className:J("vdp-ui-number-picker-button-minus",h?"disabled":"",s),children:(0,q.jsx)(nh,{})})}),(0,q.jsx)("span",{"data-testid":"number-picker-value",className:J("vdp-ui-number-picker-value",s),children:u}),(0,q.jsx)("button",{type:"button","data-cy":`${e}-plus`,"data-testid":"number-picker-plus",className:J("vdp-ui-number-picker-button",{small:"small"===o}),onClick:()=>!p&&f(),children:(0,q.jsx)("div",{className:J("vdp-ui-number-picker-button-plus",p?"disabled":"",s),children:(0,q.jsx)(np,{})})})]})]})});let nf=(0,z.forwardRef)(({label:e,...t},n)=>{let r=(0,z.createRef)();return(0,q.jsxs)("label",{htmlFor:t.id||"radio-input",className:J("vdp-ui-radio-group",t.className),children:[(0,q.jsx)("input",{ref:n??r,type:"radio","data-cy":t.id,className:"vdp-ui-radio-input",...t}),e]})}),nm=({tabs:e=[],className:t="",initialTabId:n=0,onChange:r=()=>{},palette:i="vdp-palette"})=>{let[s,a]=(0,z.useState)(e[n]),o=(0,z.useCallback)(e=>{a(e),r(e)},[r]);return(0,q.jsxs)("div",{className:J("vdp-ui-tabs",{[t]:t},i),children:[(0,q.jsx)("div",{className:"vdp-ui-tabs__header",children:e.map((e,t)=>(0,q.jsx)("div",{role:"button",tabIndex:t,"data-testid":`vdp-ui-tabs__item-${e.id}`,className:J("vdp-ui-tabs__item",{active:s.id===e.id}),onClick:()=>o(e),children:(0,q.jsx)("span",{className:"vdp-ui-tabs__item__title",children:e.title})},e.id))}),(0,q.jsx)("div",{className:"vdp-ui-tabs__item__content",children:s.content})]})};(0,z.forwardRef)((e,t)=>{let{control:n,getValues:r,setValue:i,resetField:s,setError:a,clearErrors:o}=nT(),l=(0,z.useCallback)(e=>{switch(i("travelType",e),e){case"round-trip":s("returnDate",{defaultValue:""}),a("returnDate",{type:"required",message:"Informe a data de volta"});break;case"one-way":i("returnDate","n/a"),o("returnDate"),i("travelDate",r("departureDate"))}},[i,s,o,r,a]);return(0,q.jsx)("div",{className:"_container_1bmbj_1",children:Object.entries(nI).map(([r,i])=>(0,q.jsx)(eT,{name:"travelType",control:n,render:({field:{ref:n,onChange:s,value:a,...o}})=>(0,q.jsx)(nf,{id:r,ref:t,label:i,checked:a===r,value:a,className:K("_radioInput_1bmbj_1",{_mobile_1bmbj_18:"mobile"===e.layout}),onChange:e=>{s(e),l(r)},...o})},r))})});let ng=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"M4.36605 9.40351C4.8514 9.84993 5.57282 9.77851 5.98103 9.33208L7.13816 8.06781V18.8534C7.13816 19.4891 7.64887 19.9998 8.28101 19.9998C8.91314 19.9998 9.42385 19.488 9.42385 18.8559V8.06781L10.581 9.33208C11.0078 9.79672 11.731 9.82922 12.196 9.40255C12.6613 8.97577 12.6924 8.25185 12.2663 7.78578L9.12386 4.35535C8.691 3.88179 7.87173 3.88179 7.43852 4.35535L4.32784 7.7871C3.86938 8.25352 3.90063 8.97852 4.36605 9.40351ZM11.2238 14.5963C10.7585 15.0231 10.7274 15.747 11.1535 16.2131L14.2642 19.6448C14.697 20.1184 15.5163 20.1184 15.9495 19.6448L19.0602 16.2131C19.4866 15.747 19.4552 15.0234 18.9899 14.5963C18.5045 14.1513 17.7828 14.222 17.3749 14.6666L16.2809 15.932V5.14392C16.2809 4.51178 15.7702 4 15.1381 4C14.5059 4 13.9952 4.51178 13.9952 5.14392V15.9295L12.8381 14.6652C12.4095 14.2035 11.6881 14.1713 11.2238 14.5963Z"})}),n_=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"m17.1 16.8l-12-3.2q-0.4-0.1-0.7-0.3l-3.6-2.9c-0.5-0.4-0.8-1-0.8-1.6v-3.6c0-1 0.9-1.7 1.9-1.5l1 0.3c0.7 0.1 1.2 0.6 1.5 1.2l0.8 2 2.2 0.7-1.1-4c-0.3-0.9 0.4-1.9 1.4-1.9h1.5c0.6 0 1.1 0.3 1.4 0.8l3.8 6.9 3.9 1.1c0.9 0.2 1.8 0.7 2.4 1.3l1.2 1.1c1.2 1.1 0.8 3-0.7 3.5-1.4 0.4-2.8 0.5-4.1 0.1zm2.4-3.4q-0.7-0.6-1.6-0.9l-4.6-1.2-4.3-7.5h-0.9l2 6.6-6.3-1.6-1.1-2.9q-0.1-0.1-0.2-0.2l-0.7-0.1v3.2q0 0.1 0.1 0.2l3.6 2.8q0 0.1 0.1 0.1l11.9 3.2c1 0.2 2.1 0.2 3.1-0.1 0.2-0.1 0.3-0.4 0.1-0.5zm3.6 6c0.5 0 0.9 0.4 0.9 0.9 0 0.5-0.4 0.9-0.9 0.9h-22.2c-0.5 0-0.9-0.4-0.9-0.9 0-0.5 0.4-0.9 0.9-0.9zm-15.9-3.6c0 0.7-0.5 1.2-1.2 1.2-0.7 0-1.2-0.5-1.2-1.2 0-0.7 0.5-1.2 1.2-1.2 0.7 0 1.2 0.5 1.2 1.2zm1.2 1.2c0-0.7 0.5-1.2 1.2-1.2 0.7 0 1.2 0.5 1.2 1.2 0 0.7-0.5 1.2-1.2 1.2-0.7 0-1.2-0.5-1.2-1.2zm-3-4.2l0.2-0.9z"})}),nv=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"m14.1 5.5l2.7-1.4q1.3-0.7 2.7-0.7h1.9c1.7 0 2.9 1.8 2.1 3.4-0.8 1.7-2.1 3.2-3.8 4.1l-9.4 4.9q-0.5 0.2-1 0.2h-4.5c-0.7 0-1.2-0.2-1.6-0.7l-2.8-3.2c-0.6-0.7-0.4-1.9 0.5-2.3l1.2-0.6c0.6-0.3 1.2-0.3 1.8-0.1l1.8 0.8 1.5-0.8-4-2.5c-1-0.6-0.9-2.2 0.2-2.6l1.7-0.7c0.8-0.4 1.6-0.4 2.4-0.1zm-9.5-0.1l6.2 3.8-5.1 2.7-2.5-1.2q-0.2 0-0.3 0l-0.9 0.5 2.5 2.9c0.1 0 0.2 0.1 0.3 0.1h4.5q0.1 0 0.1 0l9.4-5c1.4-0.7 2.4-1.8 3.1-3.2 0.2-0.4-0.1-0.8-0.5-0.8h-1.9c-0.6 0-1.3 0.1-1.8 0.4l-3.5 1.9-7.3-2.7c-0.4-0.1-0.8-0.1-1.1 0.1zm18.5 13.6c0.5 0 0.9 0.4 0.9 0.9 0 0.5-0.4 0.9-0.9 0.9h-22.2c-0.5 0-0.9-0.4-0.9-0.9 0-0.5 0.4-0.9 0.9-0.9zm-20.6-9l-0.4-0.8zm0.6 5.3l0.7-0.6z"})}),ny=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"m22 22.5c0 0.8-0.6 1.5-1.4 1.5h-17.2c-0.8 0-1.4-0.7-1.4-1.5 0-4.6 3.5-8.3 7.9-8.3h4.2c4.4 0 7.9 3.7 7.9 8.3zm-2.2-0.8c-0.3-2.9-2.7-5.2-5.7-5.2h-4.2c-3 0-5.4 2.3-5.7 5.2zm-7.8-9.7c-3.2 0-5.7-2.7-5.7-6 0-3.3 2.5-6 5.7-6 3.1 0 5.7 2.7 5.7 6 0 3.3-2.6 6-5.7 6zm3.5-6c0-2.1-1.6-3.8-3.5-3.8-2 0-3.6 1.7-3.6 3.8 0 2.1 1.6 3.7 3.6 3.7 1.9 0 3.5-1.6 3.5-3.7z"})}),nw=(0,z.forwardRef)(({inputBehavior:e,onOptionSelect:t,...n},r)=>{let{control:i,getValues:s,setValue:a,setError:o,clearErrors:l,resetField:c}=nT(),{setDrawer:u,openDrawer:d,closeDrawer:h}=nc(),[p,f]=(0,z.useState)([]),[m,g]=(0,z.useState)(()=>
1{if("u">typeof localStorage){let e=localStorage.getItem("recentDepartures")??"";return e?JSON.parse(e):[]}return[]});(0,z.useEffect)(()=>{"u">typeof localStorage&&localStorage.setItem("recentDepartures",JSON.stringify(m))},[m]);let _=(0,z.useCallback)(()=>{switch(o("departure",{type:"required",message:"Selecione algum aeroporto que apare\xe7a na lista"}),e){case"dropdown":break;case"drawer":u({content:(0,q.jsx)(nx,{focusedInput:"departure"}),title:(0,q.jsx)(q.Fragment,{children:"Pesquisar voos"}),fullWidth:!0,noPadding:!0,onBack:h}),d()}},[u,d,h,e,o]),v=(0,z.useCallback)(async e=>{let t=e.currentTarget.value.replace(/\d+/g,"");t.length>=3?f((await eJ(t)).map(({0:e,1:t})=>({key:e,value:t}))):f([])},[f]),y=(0,z.useCallback)(()=>{c("departure",{defaultValue:""}),f([])},[f,c]),w=(0,z.useCallback)(e=>{var r;let i=e.currentTarget.innerText,s={key:e.currentTarget.getAttribute("data-code")||eS(i),value:i};g(e=>[...e.filter(e=>e.key!==s.key),s]),a("departure",s.value),l("departure"),null==(r=null==n?void 0:n.onBlur)||r.call(n),null==t||t()},[n,a,l,t]),C=(0,z.useCallback)(e=>{g(t=>[...t.filter(t=>t.key!==e.key)])},[g]),b=(0,z.useCallback)(()=>{var e;(null==(e=s("departure"))?void 0:e.length)<3&&f([])},[s,f]);return(0,q.jsx)(eT,{name:"departure",control:i,render:({field:{ref:t,onChange:i,...s},fieldState:a})=>{var o,l;return(0,q.jsx)(nd,{role:"combobox","data-cy":s.name,placeholder:"De onde voc\xea vai sair?",leftIcon:(0,q.jsx)(nv,{size:16}),disableDropdown:"drawer"===e,validation:(null==(o=s.value)?void 0:o.length)>=3,validationMessage:"Digite 3 ou mais letras para pesquisar",noResultsMessage:"Aeroporto inv\xe1lido",hasError:!!a.error,autoComplete:"off",errorMessage:null==(l=a.error)?void 0:l.message,onSelect:_,onFocus:y,onOptionSelect:w,onRecentRemove:C,onKeyDown:b,options:p,recentOptions:m,onChange:e=>{i(e),v(e)},...n,...s,ref:r})}})}),nC=({orientation:e="horizontal",layout:t})=>{let{setValue:n,getValues:r}=nT(),i=(0,z.useCallback)(()=>{let e=r("departure");n("departure",r("arrival")),n("arrival",e)},[r,n]);return(0,q.jsx)("button",{type:"button",className:K("_container_1qpjr_1",{_mobile_1qpjr_29:"mobile"===t,_vertical_1qpjr_25:"vertical"===e}),onClick:i,children:(0,q.jsx)(ng,{size:24})})},nb=(0,z.forwardRef)(({inputBehavior:e,onOptionSelect:t,...n},r)=>{let{control:i,getValues:s,setValue:a,setError:o,clearErrors:l,resetField:c}=nT(),{setDrawer:u,openDrawer:d,closeDrawer:h}=nc(),[p,f]=(0,z.useState)([]),[m,g]=(0,z.useState)(()=>{if("u">typeof localStorage){let e=localStorage.getItem("recentArrivals")??"";return e?JSON.parse(e):[]}return[]}),_=(0,z.useMemo)(()=>[{key:"Todos os aeroportos, Belo Horizonte, MG (BHZ)",value:"Todos os aeroportos, Belo Horizonte, MG (BHZ)"},{key:"Todos os aeroportos, S\xe3o Paulo, SP (SAO)",value:"Todos os aeroportos, S\xe3o Paulo, SP (SAO)"},{key:"Todos os aeroportos, Rio de Janeiro, RJ (RIO)",value:"Todos os aeroportos, Rio de Janeiro, RJ (RIO)"},{key:"Lu\xeds Eduardo Magalh\xe3es, Salvador, BA (SSA)",value:"Lu\xeds Eduardo Magalh\xe3es, Salvador, BA (SSA)"},{key:"Juscelino Kubitschek, Bras\xedlia, DF (BSB)",value:"Juscelino Kubitschek, Bras\xedlia, DF (BSB)"}],[]);(0,z.useEffect)(()=>{"u">typeof localStorage&&localStorage.setItem("recentArrivals",JSON.stringify(m))},[m]);let v=(0,z.useCallback)(()=>{switch(o("arrival",{type:"required",message:"Selecione algum aeroporto que apare\xe7a na lista"}),e){case"dropdown":break;case"drawer":u({content:(0,q.jsx)(nx,{focusedInput:"arrival"}),title:(0,q.jsx)(q.Fragment,{children:"Pesquisar voos"}),fullWidth:!0,noPadding:!0,onBack:h}),d()}},[u,d,h,e,o]),y=(0,z.useCallback)(async e=>{let t=e.currentTarget.value.replace(/\d+/g,"");t.length>=3?f((await eJ(t)).map(({0:e,1:t})=>({key:e,value:t}))):f([])},[f]),w=(0,z.useCallback)(()=>{c("arrival",{defaultValue:""}),f([])},[f,c]),C=(0,z.useCallback)(e=>{var r;let i=e.currentTarget.innerText,s={key:e.currentTarget.getAttribute("data-code")??eS(i),value:i};g(e=>[...e.filter(e=>e.key!==s.key),s]),a("arrival",s.value),l("arrival"),null==(r=null==n?void 0:n.onBlur)||r.call(n),null==t||t()},[n,a,l,t]),b=(0,z.useCallback)(e=>{g(t=>[...t.filter(t=>
1t.key!==e.key)])},[g]),k=(0,z.useCallback)(()=>{var e;(null==(e=s("arrival"))?void 0:e.length)<3&&f([])},[s,f]);return(0,q.jsx)(eT,{name:"arrival",control:i,render:({field:{ref:t,onChange:i,...s},fieldState:a})=>{var o,l;return(0,q.jsx)(nd,{role:"combobox","data-cy":s.name,placeholder:"Para onde voc\xea vai?",leftIcon:(0,q.jsx)(n_,{size:16}),disableDropdown:"drawer"===e,validation:(null==(o=s.value)?void 0:o.length)>=3,validationMessage:"Digite 3 ou mais letras para pesquisar",noResultsMessage:"Aeroporto inv\xe1lido",hasError:!!a.error,autoComplete:"off",errorMessage:null==(l=a.error)?void 0:l.message,onSelect:v,onFocus:w,onOptionSelect:C,onRecentRemove:b,onKeyDown:k,options:p,recentOptions:m,recommendedOptions:_,onChange:e=>{i(e),y(e)},...n,...s,ref:r})}})}),nk=({inputBehavior:e,focusedInput:t,layout:n,swapOrientation:r,onDepartureChange:i,onArrivalChange:s})=>{let{isOpening:a}=nc(),o=(0,z.useRef)(null),l=(0,z.useRef)(null);return(0,z.useEffect)(()=>{setTimeout(()=>{var e,n;switch(t){case"departure":null==(e=o.current)||e.focus();break;case"arrival":null==(n=l.current)||n.focus()}},500)},[a,t]),(0,q.jsxs)("div",{className:K("_container_o69bl_1",{_mobile_o69bl_17:"mobile"===n}),children:[(0,q.jsx)(nw,{inputBehavior:e,ref:o,onOptionSelect:i}),(0,q.jsx)(nC,{layout:n,orientation:r}),(0,q.jsx)(nb,{inputBehavior:e,ref:l,onOptionSelect:s})]})},nx=({focusedInput:e})=>{let{closeDrawer:t}=nc(),{getValues:n,setValue:r}=nT(),i=[{id:"round-trip",title:"Ida e volta",content:(0,q.jsx)(nk,{focusedInput:e,swapOrientation:"vertical",onArrivalChange:t})},{id:"one-way",title:"S\xf3 ida",content:(0,q.jsx)(nk,{focusedInput:e,swapOrientation:"vertical",onArrivalChange:t})}];return(0,q.jsxs)("div",{className:"_drawer_o69bl_25",children:[(0,q.jsx)(nm,{tabs:i,initialTabId:i.findIndex(e=>e.id===n("travelType")),onChange:e=>{("round-trip"===e.id||"one-way"===e.id)&&r("travelType",e.id)}}),(0,q.jsx)("div",{className:"_drawerContent_o69bl_29"})]})};(0,z.createContext)({});let nI={"round-trip":"Ida e volta","one-way":"S\xf3 ida"};t7({departure:t5({required_error:"Origem inv\xe1lida"}).min(3,"M\xednimo 3 letras"),arrival:t5({required_error:"Destino inv\xe1lido"}).min(3,"M\xednimo 3 letras"),travelType:t8(["round-trip","one-way"]),travelDate:t5({required_error:"Informe a data de ida e de volta"}).nonempty({message:"Informe a data de ida e de volta"}),departureDate:t5({required_error:"Informe a data de ida"}).min(1,"Informe a data de ida"),returnDate:t5({required_error:"Informe a data de volta"}).min(1,"Informe a data de volta"),adults:t6(),children:t6(),babies:t6(),classType:t8(["economic","premium_economic","executive","first_class"])}).refine(({departure:e,arrival:t})=>eS(e)!==eS(t),{message:"Destino n\xe3o pode ser igual a origem",path:["arrival"]}).refine(({departureDate:e,returnDate:t})=>{let n=eN(e),r=eN(t);return!r||!n||r>=n},{message:"Data de volta n\xe3o pode ser menor que a data de ida",path:["returnDate"]});let nE=(0,z.createContext)({}),nT=()=>(0,z.useContext)(nE);var nS=((f=nS||{})[f.Login=0]="Login",f[f.CreateAccount=1]="CreateAccount",f[f.CreatePassword=2]="CreatePassword",f[f.VerificationCode=3]="VerificationCode",f[f.CreateAccountSuccess=4]="CreateAccountSuccess",f[f.ForgotPassword=5]="ForgotPassword",f[f.ResetPassword=6]="ResetPassword",f[f.ResetPasswordCode=7]="ResetPasswordCode",f[f.ResetPasswordSuccess=8]="ResetPasswordSuccess",f[f.LoginV2=9]="LoginV2",f);let nN=async function(e){return(await fetch(e.url,{headers:e.headers})).json()},nP=async function(e){return await (await fetch(e.url,{method:"POST",headers:e.headers,body:JSON.stringify(e.payload)})).json()},nR=function(e,t){if(!e)throw nO(t)},nO=function(e){return Error("Firebase Database (${JSCORE_VERSION}) INTERNAL ASSERT FAILED: "+e)},nL=function(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:((64512&i)==55296&&r+1<e.length&&(64512&e.charCodeAt(r+1))==56320?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128):t[n++]=i>>12|224,t[n++]=i>>6&63|128),t[n++]=63&i|128)}return t},nA=function(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){let s=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){let s=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(s>>10)),t[r++]=String.fromCharCode(56320+(1023&s))}else{let s=e[n++],a=e[n++];
1t[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&a)}}return t.join("")},nj={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:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){let i=e[t],s=t+1<e.length,a=s?e[t+1]:0,o=t+2<e.length,l=o?e[t+2]:0,c=i>>2,u=(3&i)<<4|a>>4,d=(15&a)<<2|l>>6,h=63&l;o||(h=64,s||(d=64)),r.push(n[c],n[u],n[d],n[h])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(nL(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):nA(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();let n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){let i=n[e.charAt(t++)],s=t<e.length?n[e.charAt(t)]:0,a=++t<e.length?n[e.charAt(t)]:64,o=++t<e.length?n[e.charAt(t)]:64;if(++t,null==i||null==s||null==a||null==o)throw new nD;let l=i<<2|s>>4;if(r.push(l),64!==a){let e=s<<4&240|a>>2;if(r.push(e),64!==o){let e=a<<6&192|o;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class nD extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let nM=function(e){let t=nL(e);return nj.encodeByteArray(t,!0)},nF=function(e){return nM(e).replace(/\./g,"")},nU=function(e){try{return nj.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null},n$=()=>(function(){if("u">typeof self)return self;if("u">typeof window)return window;if("u">typeof global)return global;throw Error("Unable to locate global object.")})().__FIREBASE_DEFAULTS__,nV=()=>{if(typeof B>"u"||typeof B.env>"u")return;let e=B.env.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},nq=()=>{let e;if(typeof document>"u")return;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let t=e&&nU(e[1]);return t&&JSON.parse(t)},nz=()=>{try{return n$()||nV()||nq()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},nB=e=>{var t,n;return null===(n=null===(t=nz())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]},nW=e=>{let t=nB(e);if(!t)return;let n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw Error(`Invalid host ${t} with no separate hostname and port!`);let r=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),r]:[t.substring(0,n),r]},nH=()=>{var e;return null===(e=nz())||void 0===e?void 0:e.config},nZ=e=>{var t;return null===(t=nz())||void 0===t?void 0:t[`_${e}`]};class nK{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}function nG(){return"u">typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function nY(){return"u">typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(nG())}function nJ(){return"object"==typeof navigator&&"ReactNative"===navigator.product}let nQ=class e extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,e.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,nX.prototype.create)}};
1class nX{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){let n=t[0]||{},r=`${this.service}/${e}`,i=this.errors[e],s=i?i.replace(n0,(e,t)=>{let r=n[t];return null!=r?String(r):`<${t}?>`}):"Error",a=`${this.serviceName}: ${s} (${r}).`;return new nQ(r,a,n)}}let n0=/\{\$([^}]+)}/g;function n1(e){return JSON.parse(e)}function n2(e){return JSON.stringify(e)}let n4=function(e){let t={},n={},r={},i="";try{let s=e.split(".");t=n1(nU(s[0])||""),n=n1(nU(s[1])||""),i=s[2],r=n.d||{},delete n.d}catch{}return{header:t,claims:n,data:r,signature:i}},n3=function(e){let t=n4(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")},n9=function(e){let t=n4(e).claims;return"object"==typeof t&&!0===t.admin};function n5(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function n6(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]}function n7(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function n8(e,t,n){let r={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=t.call(n,e[i],i,e));return r}function re(e,t){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);for(let i of n){if(!r.includes(i))return!1;let n=e[i],s=t[i];if(rt(n)&&rt(s)){if(!re(n,s))return!1}else if(n!==s)return!1}for(let e of r)if(!n.includes(e))return!1;return!0}function rt(e){return null!==e&&"object"==typeof e}function rn(e){let t=[];for(let[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function rr(e){let t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){let[n,r]=e.split("=");
1t[decodeURIComponent(n)]=decodeURIComponent(r)}}),t}function ri(e){let t=e.indexOf("?");if(!t)return"";let n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class rs{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,t){t||(t=0);let n=this.W_;if("string"==typeof e)for(let r=0;r<16;r++)n[r]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let r=0;r<16;r++)n[r]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let e=16;e<80;e++){let t=n[e-3]^n[e-8]^n[e-14]^n[e-16];n[e]=(t<<1|t>>>31)&4294967295}let r=this.chain_[0],i=this.chain_[1],s=this.chain_[2],a=this.chain_[3],o=this.chain_[4],l,c;for(let e=0;e<80;e++){e<40?e<20?(l=a^i&(s^a),c=1518500249):(l=i^s^a,c=1859775393):e<60?(l=i&s|a&(i|s),c=2400959708):(l=i^s^a,c=3395469782);let t=(r<<5|r>>>27)+l+o+c+n[e]&4294967295;o=a,a=s,s=(i<<30|i>>>2)&4294967295,i=r,r=t}this.chain_[0]=this.chain_[0]+r&4294967295,this.chain_[1]=this.chain_[1]+i&4294967295,this.chain_[2]=this.chain_[2]+s&4294967295,this.chain_[3]=this.chain_[3]+a&4294967295,this.chain_[4]=this.chain_[4]+o&4294967295}update(e,t){if(null==e)return;void 0===t&&(t=e.length);let n=t-this.blockSize,r=0,i=this.buf_,s=this.inbuf_;for(;r<t;){if(0===s)for(;r<=n;)this.compress_(e,r),r+=this.blockSize;if("string"==typeof e){for(;r<t;)if(i[s]=e.charCodeAt(r),++s,++r,s===this.blockSize){this.compress_(i),s=0;break}}else for(;r<t;)if(i[s]=e[r],++s,++r,s===this.blockSize){this.compress_(i),s=0;break}}this.inbuf_=s,this.total_+=t}digest(){let e=[],t=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let e=this.blockSize-1;e>=56;e--)this.buf_[e]=255&t,t/=256;this.compress_(this.buf_);let n=0;for(let t=0;t<5;t++)for(let r=24;r>=0;r-=8)e[n]=this.chain_[t]>>r&255,++n;return e}}class ra{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw Error("Missing Observer.");void 0===(r=!function(e,t){if("object"!=typeof e||null===e)return!1;for(let n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?{next:e,error:t,complete:n}:e).next&&(r.next=ro),void 0===r.error&&(r.error=ro),void 0===r.complete&&(r.complete=ro);let i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch{}}),this.observers.push(r),i}unsubscribeOne(e){void 0===this.observers||void 0===this.observers[e]||(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"u">typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function ro(){}function rl(e,t){return`${e} failed: ${t} argument `}let rc=function(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>=55296&&i<=56319){let t=i-55296;nR(++r<e.length,"Surrogate pair missing trail surrogate."),i=65536+(t<<10)+(e.charCodeAt(r)-56320)}i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:(i<65536?t[n++]=i>>12|224:(t[n++]=i>>18|240,t[n++]=i>>12&63|128),t[n++]=i>>6&63|128),t[n++]=63&i|128)}return t},ru=function(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t++:r<2048?t+=2:r>=55296&&r<=56319?(t+=4,n++):t+=3}return t};function rd(e){return e&&e._delegate?e._delegate:e}let rh=class{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,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}},rp="[DEFAULT]";class rf{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let e=new nK;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{let n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;let n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(r)return null;throw e}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:rp})}catch{}for(let[e,t]of this.instancesDeferred.entries()){let n=this.normalizeInstanceIdentifier(e);try{let e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch{}}}}clearInstance(e=rp){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=rp){return this.instances.has(e)}getOptions(e=rp){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(let[e,t]of this.instancesDeferred.entries())n===this.normalizeInstanceIdentifier(e)&&t.resolve(r);return r}onInit(e,t){var n;let r=this.normalizeInstanceIdentifier(t),i=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;i.add(e),this.onInitCallbacks.set(r,i);let s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){let n=this.onInitCallbacks.get(t);if(n)for(let r of n)try{r(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:e===rp?void 0:e,options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch{}return n||null}normalizeInstanceIdentifier(e=rp){return this.component?this.component.multipleInstances?e:rp:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class rm{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new rf(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}
1(b=R||(R={}))[b.DEBUG=0]="DEBUG",b[b.VERBOSE=1]="VERBOSE",b[b.INFO=2]="INFO",b[b.WARN=3]="WARN",b[b.ERROR=4]="ERROR",b[b.SILENT=5]="SILENT";let rg={debug:R.DEBUG,verbose:R.VERBOSE,info:R.INFO,warn:R.WARN,error:R.ERROR,silent:R.SILENT},r_=R.INFO,rv={[R.DEBUG]:"log",[R.VERBOSE]:"log",[R.INFO]:"info",[R.WARN]:"warn",[R.ERROR]:"error"},ry=(e,t,...n)=>{if(t<e.logLevel)return;let r=new Date().toISOString(),i=rv[t];if(i)console[i](`[${r}]  ${e.name}:`,...n);else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class rw{constructor(e){this.name=e,this._logLevel=r_,this._logHandler=ry,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in R))throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?rg[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,R.DEBUG,...e),this._logHandler(this,R.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,R.VERBOSE,...e),this._logHandler(this,R.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,R.INFO,...e),this._logHandler(this,R.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,R.WARN,...e),this._logHandler(this,R.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,R.ERROR,...e),this._logHandler(this,R.ERROR,...e)}}let rC=(e,t)=>t.some(t=>e instanceof t),rb=new WeakMap,rk=new WeakMap,rx=new WeakMap,rI=new WeakMap,rE=new WeakMap,rT={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return rk.get(e);if("objectStoreNames"===t)return e.objectStoreNames||rx.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return rS(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function rS(e){if(e instanceof IDBRequest)return function(e){let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(rS(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",s)});return t.then(t=>{t instanceof IDBCursor&&rb.set(t,e)}).catch(()=>{}),rE.set(t,e),t}(e);if(rI.has(e))return rI.get(e);let t="function"==typeof e?e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(s||(s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(rN(this),t),rS(rb.get(this))}:function(...t){return rS(e.apply(rN(this),t))}:function(t,...n){let r=e.call(rN(this),t,...n);return rx.set(r,t.sort?t.sort():[t]),rS(r)}:(e instanceof IDBTransaction&&function(e){if(rk.has(e))return;let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});rk.set(e,t)}(e),rC(e,i||(i=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,rT):e);return t!==e&&(rI.set(e,t),rE.set(t,e)),t}let rN=e=>rE.get(e),rP=["get","getKey","getAll","getAllKeys","count"],rR=["put","add","delete","clear"],rO=new Map;function rL(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(rO.get(t))return rO.get(t);let n=t.replace(/FromIndex$/,""),r=t!==n,i=rR.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||rP.includes(n)))return;let s=async function(e,...t){let s=this.transaction(e,i?"readwrite":"readonly"),a=s.store;return r&&(a=a.index(t.shift())),(await Promise.all([a[n](...t),i&&s.done]))[0]};return rO.set(t,s),s}rT={...g=rT,get:(e,t,n)=>rL(e,t)||g.get(e,t,n),has:(e,t)=>!!rL(e,t)||g.has(e,t)};class rA{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(!function(e){let t=e.getComponent();return(null==t?void 0:t.type)==="VERSION"}(e))return null;{let t=e.getImmediate();return`${t.library}/${t.version}`}}).filter(e=>e).join(" ")}}let rj="@firebase/app",rD="0.10.13",rM=new rw("@firebase/app"),rF="[DEFAULT]",rU={[rj]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/data-connect":"fire-data-connect","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","@firebase/vertexai-preview":"fire-vertex","fire-js":"fire-js",firebase:"fire-js-all"},r$=new Map,rV=new Map,rq=new Map;function rz(e,t){try{e.container.addComponent(t)}catch(n){rM.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function rB(e){let t=e.name;if(rq.has(t))return rM.debug(`There were multiple attempts to register component ${t}.`),!1;
1for(let n of(rq.set(t,e),r$.values()))rz(n,e);for(let t of rV.values())rz(t,e);return!0}function rW(e,t){let n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function rH(e){return void 0!==e.settings}let rZ=new nX("app","Firebase",{"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","server-app-deleted":"Firebase Server App has been 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}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class rK{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new rh("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 rZ.create("app-deleted",{appName:this._name})}}let rG="10.14.1";function rY(e,t={}){let n=e;"object"!=typeof t&&(t={name:t});let r=Object.assign({name:rF,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!=typeof i||!i)throw rZ.create("bad-app-name",{appName:String(i)});if(n||(n=nH()),!n)throw rZ.create("no-options");let s=r$.get(i);if(s){if(re(n,s.options)&&re(r,s.config))return s;throw rZ.create("duplicate-app",{appName:i})}let a=new rm(i);for(let e of rq.values())a.addComponent(e);let o=new rK(n,r,a);return r$.set(i,o),o}function rJ(e=rF){let t=r$.get(e);if(!t&&e===rF&&nH())return rY();if(!t)throw rZ.create("no-app",{appName:e});return t}function rQ(e,t,n){var r;let i=null!==(r=rU[e])&&void 0!==r?r:e;n&&(i+=`-${n}`);let s=i.match(/\s|\//),a=t.match(/\s|\//);if(s||a){let e=[`Unable to register library "${i}" with version "${t}":`];s&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),rM.warn(e.join(" "));return}rB(new rh(`${i}-version`,()=>({library:i,version:t}),"VERSION"))}let rX="firebase-heartbeat-store",r0=null;function r1(){return r0||(r0=(function(e,t,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){let a=indexedDB.open(e,1),o=rS(a);return r&&a.addEventListener("upgradeneeded",e=>{r(rS(a.result),e.oldVersion,e.newVersion,rS(a.transaction),e)}),n&&a.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),o.then(e=>{s&&e.addEventListener("close",()=>s()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o})("firebase-heartbeat-database",0,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(rX)}catch(e){console.warn(e)}}}).catch(e=>{throw rZ.create("idb-open",{originalErrorMessage:e.message})})),r0}async function r2(e){try{let t=(await r1()).transaction(rX),n=await t.objectStore(rX).get(r3(e));return await t.done,n}catch(e){if(e instanceof nQ)rM.warn(e.message);else{let t=rZ.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});rM.warn(t.message)}}}async function r4(e,t){try{let n=(await r1()).transaction(rX,"readwrite");await n.objectStore(rX).put(t,r3(e)),await n.done}catch(e){if(e instanceof nQ)rM.warn(e.message);else{let t=rZ.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});rM.warn(t.message)}}}function r3(e){return`${e.name}!${e.options.appId}`}class r9{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new r6(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{let n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=r5();return(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(e=>e.date===r)?void 0:(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(e=>{let t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),this._storage.overwrite(this._heartbeatsCache))}catch(e){rM.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)==null||0===this._heartbeatsCache.heartbeats.length)return"";let t=r5(),{heartbeatsToSend:n,unsentEntries:r}=function(e,t=1024){let n=[],r=e.slice();for(let i of e){let e=n.find(e=>e.agent===i.agent);if(e){if(e.dates.push(i.date),r7(n)>t){e.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),r7(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),i=nF(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return rM.warn(e),""}}}function r5(){return new Date().toISOString().substring(0,10)}class r6{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch{return!1}}()&&new Promise((e,t)=>
1{try{let n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}).then(()=>!0).catch(()=>!1)}async read(){if(!await this._canUseIndexedDBPromise)return{heartbeats:[]};{let e=await r2(this.app);return null!=e&&e.heartbeats?e:{heartbeats:[]}}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){let n=await this.read();return r4(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){let n=await this.read();return r4(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function r7(e){return nF(JSON.stringify({version:2,heartbeats:e})).length}rB(new rh("platform-logger",e=>new rA(e),"PRIVATE")),rB(new rh("heartbeat",e=>new r9(e),"PRIVATE")),rQ(rj,rD,""),rQ(rj,rD,"esm2017"),rQ("fire-js","");let r8="@firebase/database",ie="1.0.8",it="";class ir{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,t){null==t?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),n2(t))}get(e){let t=this.domStorage_.getItem(this.prefixedName_(e));return null==t?null:n1(t)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}}class ii{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,t){null==t?delete this.cache_[e]:this.cache_[e]=t}get(e){return n5(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}}let is=function(e){try{if("u">typeof window&&"u">typeof window[e]){let t=window[e];return t.setItem("firebase:sentinel","cache"),t.removeItem("firebase:sentinel"),new ir(t)}}catch{}return new ii},ia=is("localStorage"),io=is("sessionStorage"),il=new rw("@firebase/database"),ic=(m=1,function(){return m++}),iu=function(e){let t=rc(e),n=new rs;n.update(t);let r=n.digest();return nj.encodeByteArray(r)},id=function(...e){let t="";for(let n=0;n<e.length;n++){let r=e[n];Array.isArray(r)||r&&"object"==typeof r&&"number"==typeof r.length?t+=id.apply(null,r):"object"==typeof r?t+=n2(r):t+=r,t+=" "}return t},ih=null,ip=!0,im=function(e,t){nR(!0,"Can't turn on custom loggers persistently."),il.logLevel=R.VERBOSE,ih=il.log.bind(il)},ig=function(...e){if(!0===ip&&(ip=!1,null===ih&&!0===io.get("logging_enabled")&&im()),ih){let t=id.apply(null,e);ih(t)}},i_=function(e){return function(...t){ig(e,...t)}},iv=function(...e){let t="FIREBASE INTERNAL ERROR: "+id(...e);il.error(t)},iy=function(...e){let t=`FIREBASE FATAL ERROR: ${id(...e)}`;throw il.error(t),Error(t)},iw=function(...e){let t="FIREBASE WARNING: "+id(...e);il.warn(t)},iC=function(){"u">typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&iw("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},ib=function(e){return"number"==typeof e&&(e!=e||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY)},ik=function(e){if("complete"===document.readyState)e();else{let t=!1,n=function(){if(!document.body){setTimeout(n,Math.floor(10));return}t||(t=!0,e())};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{"complete"===document.readyState&&n()}),window.attachEvent("onload",n))}},ix="[MIN_NAME]",iI="[MAX_NAME]",iE=function(e,t){if(e===t)return 0;if(e===ix||t===iI)return -1;if(t===ix||e===iI)return 1;{let n=iA(e),r=iA(t);return null!==n?null!==r?n-r==0?e.length-t.length:n-r:-1:null!==r?1:e<t?-1:1}},iT=function(e,t){return e===t?0:e<t?-1:1},iS=function(e,t){if(t&&e in t)return t[e];throw Error("Missing required key ("+e+") in object: "+n2(t))},iN=function(e){if("object"!=typeof e||null===e)return n2(e);let t=[];for(let n in e)t.push(n);
1t.sort();let n="{";for(let r=0;r<t.length;r++)0!==r&&(n+=","),n+=n2(t[r])+":"+iN(e[t[r]]);return n+"}"},iP=function(e,t){let n=e.length;if(n<=t)return[e];let r=[];for(let i=0;i<n;i+=t)i+t>n?r.push(e.substring(i,n)):r.push(e.substring(i,i+t));return r};function iR(e,t){for(let n in e)e.hasOwnProperty(n)&&t(n,e[n])}let iO=function(e){let t,n,r,i,s;nR(!ib(e),"Invalid JSON number"),0===e?(n=0,r=0,t=1/e==-1/0?1:0):(t=e<0,(e=Math.abs(e))>=22250738585072014e-324?(n=(i=Math.min(Math.floor(Math.log(e)/Math.LN2),1023))+1023,r=Math.round(e*Math.pow(2,52-i)-4503599627370496)):(n=0,r=Math.round(e/5e-324)));let a=[];for(s=52;s;s-=1)a.push(r%2?1:0),r=Math.floor(r/2);for(s=11;s;s-=1)a.push(n%2?1:0),n=Math.floor(n/2);a.push(t?1:0),a.reverse();let o=a.join(""),l="";for(s=0;s<64;s+=8){let e=parseInt(o.substr(s,8),2).toString(16);1===e.length&&(e="0"+e),l+=e}return l.toLowerCase()},iL=RegExp("^-?(0*)\\d{1,10}$"),iA=function(e){if(iL.test(e)){let t=Number(e);if(t>=-2147483648&&t<=2147483647)return t}return null},ij=function(e){try{e()}catch(e){setTimeout(()=>{throw iw("Exception was thrown by user callback.",e.stack||""),e},Math.floor(0))}},iD=function(e,t){let n=setTimeout(e,t);return"number"==typeof n&&"u">typeof Deno&&Deno.unrefTimer?Deno.unrefTimer(n):"object"==typeof n&&n.unref&&n.unref(),n};class iM{constructor(e,t){this.appName_=e,this.appCheckProvider=t,this.appCheck=null==t?void 0:t.getImmediate({optional:!0}),this.appCheck||null==t||t.get().then(e=>this.appCheck=e)}getToken(e){return this.appCheck?this.appCheck.getToken(e):new Promise((t,n)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(t,n):t(null)},0)})}addTokenChangeListener(e){var t;null===(t=this.appCheckProvider)||void 0===t||t.get().then(t=>t.addTokenListener(e))}notifyForInvalidToken(){iw(`Provided AppCheck credentials for the app named "${this.appName_}" are invalid. This usually indicates your app was not initialized correctly.`)}}class iF{constructor(e,t,n){this.appName_=e,this.firebaseOptions_=t,this.authProvider_=n,this.auth_=null,this.auth_=n.getImmediate({optional:!0}),this.auth_||n.onInit(e=>this.auth_=e)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(e=>e&&"auth/token-not-initialized"===e.code?(ig("Got auth/token-not-initialized error.  Treating as null token."),null):Promise.reject(e)):new Promise((t,n)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(t,n):t(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(t=>t.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(t=>t.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/.',iw(e)}}class iU{constructor(e){this.accessToken=e}getToken(e){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(e){e(this.accessToken)}removeTokenChangeListener(e){}notifyForInvalidToken(){}}iU.OWNER="owner";let i$=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,iV="websocket",iq="long_polling",iz=class{constructor(e,t,n,r,i=!1,s="",a=!1,o=!1){this.secure=t,this.namespace=n,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=s,this.includeNamespaceInQueryParams=a,this.isUsingEmulator=o,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=ia.get("host:"+e)||this._host}isCacheableHost(){return"s-"===this.internalHost.substr(0,2)}isCustomHost(){return"firebaseio.com"!==this._domain&&"firebaseio-demo.com"!==this._domain}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&ia.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){let e=this.secure?"https://":"http://",t=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${t}`}};function iB(e,t,n){let r;if(nR("string"==typeof t,"typeof type must == string"),nR("object"==typeof n,"typeof params must == object"),t===iV)r=(e.secure?"wss://":"ws://")+e.internalHost+"/.ws?";else if(t===iq)r=(e.secure?"https://":"http://")+e.internalHost+"/.lp?";else throw Error("Unknown connection type: "+t);(e.host!==e.internalHost||e.isCustomHost()||e.includeNamespaceInQueryParams)&&
1(n.ns=e.namespace);let i=[];return iR(n,(e,t)=>{i.push(e+"="+t)}),r+i.join("&")}class iW{constructor(){this.counters_={}}incrementCounter(e,t=1){n5(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=t}get(){return function e(t,n){if(!(n instanceof Object))return n;switch(n.constructor){case Date:return new Date(n.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return n}for(let r in n)n.hasOwnProperty(r)&&"__proto__"!==r&&(t[r]=e(t[r],n[r]));return t}(void 0,this.counters_)}}let iH={},iZ={};function iK(e){let t=e.toString();return iH[t]||(iH[t]=new iW),iH[t]}class iG{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,t){this.closeAfterResponse=e,this.onClose=t,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,t){for(this.pendingResponses[e]=t;this.pendingResponses[this.currentResponseNum];){let e=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let t=0;t<e.length;++t)e[t]&&ij(()=>{this.onMessage_(e[t])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}let iY="start",iJ=class e{constructor(e,t,n,r,i,s,a){this.connId=e,this.repoInfo=t,this.applicationId=n,this.appCheckToken=r,this.authToken=i,this.transportSessionId=s,this.lastSessionId=a,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=i_(e),this.stats_=iK(t),this.urlFn=e=>(this.appCheckToken&&(e.ac=this.appCheckToken),iB(t,iq,e))}open(e,t){this.curSegmentNum=0,this.onDisconnect_=t,this.myPacketOrderer=new iG(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(3e4)),ik(()=>
1{if(this.isClosed_)return;this.scriptTagHolder=new iQ((...e)=>{let[t,n,r,i,s]=e;if(this.incrementIncomingBytes_(e),this.scriptTagHolder){if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,t===iY)this.id=n,this.password=r;else if("close"===t)n?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(n,()=>{this.onClosed_()})):this.onClosed_();else throw Error("Unrecognized command received: "+t)}},(...e)=>{let[t,n]=e;this.incrementIncomingBytes_(e),this.myPacketOrderer.handleResponse(t,n)},()=>{this.onClosed_()},this.urlFn);let e={};e[iY]="t",e.ser=Math.floor(1e8*Math.random()),this.scriptTagHolder.uniqueCallbackIdentifier&&(e.cb=this.scriptTagHolder.uniqueCallbackIdentifier),e.v="5",this.transportSessionId&&(e.s=this.transportSessionId),this.lastSessionId&&(e.ls=this.lastSessionId),this.applicationId&&(e.p=this.applicationId),this.appCheckToken&&(e.ac=this.appCheckToken),"u">typeof location&&location.hostname&&i$.test(location.hostname)&&(e.r="f");let t=this.urlFn(e);this.log_("Connecting via long-poll to "+t),this.scriptTagHolder.addTag(t,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){e.forceAllow_=!0}static forceDisallow(){e.forceDisallow_=!0}static isAvailable(){return!!e.forceAllow_||!e.forceDisallow_&&"u">typeof document&&null!=document.createElement&&!("object"==typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))&&!("object"==typeof Windows&&"object"==typeof Windows.UI)}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){let t=n2(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);let n=iP(nM(t),1840);for(let e=0;e<n.length;e++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,n.length,n[e]),this.curSegmentNum++}addDisconnectPingFrame(e,t){this.myDisconnFrame=document.createElement("iframe");let n={};n.dframe="t",n.id=e,n.pw=t,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){let t=n2(e).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)}};class iQ{constructor(e,t,n,r){this.onDisconnect=n,this.urlFn=r,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0;{this.uniqueCallbackIdentifier=ic(),window["pLPCommand"+this.uniqueCallbackIdentifier]=e,window["pRTLPCB"+this.uniqueCallbackIdentifier]=t,this.myIFrame=iQ.createIFrame_();let n="";this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,11)&&(n='<script>document.domain="'+document.domain+'";</script>');let r="<html><body>"+n+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(r),this.myIFrame.doc.close()}catch(e){ig("frame writing exception"),e.stack&&ig(e.stack),ig(e)}}}static createIFrame_(){let e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||ig("No IE domain setting required")}catch{let t=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+t+"';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(()=>{null!==this.myIFrame&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));let e=this.onDisconnect;e&&(this.onDisconnect=null,e())}
1startLongPoll(e,t){for(this.myID=e,this.myPW=t,this.alive=!0;this.newRequest_(););}newRequest_(){if(!this.alive||!this.sendNewPolls||!(this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)))return!1;{this.currentSerial++;let e={};e.id=this.myID,e.pw=this.myPW,e.ser=this.currentSerial;let t=this.urlFn(e),n="",r=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+30+n.length<=1870;){let e=this.pendingSegs.shift();n=n+"&seg"+r+"="+e.seg+"&ts"+r+"="+e.ts+"&d"+r+"="+e.d,r++}return t+=n,this.addLongPollTag_(t,this.currentSerial),!0}}enqueueSegment(e,t,n){this.pendingSegs.push({seg:e,ts:t,d:n}),this.alive&&this.newRequest_()}addLongPollTag_(e,t){this.outstandingRequests.add(t);let n=()=>{this.outstandingRequests.delete(t),this.newRequest_()},r=setTimeout(n,Math.floor(25e3));this.addTag(e,()=>{clearTimeout(r),n()})}addTag(e,t){setTimeout(()=>{try{if(!this.sendNewPolls)return;let n=this.myIFrame.doc.createElement("script");n.type="text/javascript",n.async=!0,n.src=e,n.onload=n.onreadystatechange=function(){let e=n.readyState;e&&"loaded"!==e&&"complete"!==e||(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),t())},n.onerror=()=>{ig("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(n)}catch{}},Math.floor(1))}}let iX=null;"u">typeof MozWebSocket?iX=MozWebSocket:"u">typeof WebSocket&&(iX=WebSocket);let i0=class e{constructor(t,n,r,i,s,a,o){this.connId=t,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_=i_(this.connId),this.stats_=iK(n),this.connURL=e.connectionURL_(n,a,o,i,r),this.nodeAdmin=n.nodeAdmin}static connectionURL_(e,t,n,r,i){let s={};return s.v="5","u">typeof location&&location.hostname&&i$.test(location.hostname)&&(s.r="f"),t&&(s.s=t),n&&(s.ls=n),r&&(s.ac=r),i&&(s.p=i),iB(e,iV,s)}open(e,t){this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,ia.set("previous_websocket_failure",!0);try{let e;this.mySock=new iX(this.connURL,[],e)}catch(t){this.log_("Error instantiating WebSocket.");let e=t.message||t.data;e&&this.log_(e),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=e=>{this.handleIncomingFrame(e)},this.mySock.onerror=e=>{this.log_("WebSocket error.  Closing connection.");let t=e.message||e.data;t&&this.log_(t),this.onClosed_()}}start(){}static forceDisallow(){e.forceDisallow_=!0}static isAvailable(){let t=!1;if("u">typeof navigator&&navigator.userAgent){let e=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);e&&e.length>1&&4.4>parseFloat(e[1])&&(t=!0)}return!t&&null!==iX&&!e.forceDisallow_}static previouslyFailed(){return ia.isInMemoryStorage||!0===ia.get("previous_websocket_failure")}markConnectionHealthy(){ia.remove("previous_websocket_failure")}appendFrame_(e){if(this.frames.push(e),this.frames.length===this.totalFrames){let e=this.frames.join("");this.frames=null;let t=n1(e);this.onMessage(t)}}handleNewFrameCount_(e){this.totalFrames=e,this.frames=[]}extractFrameCount_(e){if(nR(null===this.frames,"We already have a frame buffer"),e.length<=6){let t=Number(e);if(!isNaN(t))return this.handleNewFrameCount_(t),null}return this.handleNewFrameCount_(1),e}handleIncomingFrame(e){if(null===this.mySock)return;let t=e.data;if(this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(t);else{let e=this.extractFrameCount_(t);null!==e&&this.appendFrame_(e)}}send(e){this.resetKeepAlive();let t=n2(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);let n=iP(t,16384);n.length>1&&this.sendString_(String(n.length));for(let e=0;e<n.length;e++)this.sendString_(n[e])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(45e3))}sendString_(e){try{this.mySock.send(e)}catch(e){this.log_("Exception thrown from WebSocket.send():",e.message||e.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}};i0.responsesRequiredToBeHealthy=2,i0.healthyTimeout=3e4;class i1{constructor(e){this.initTransports_(e)}static get ALL_TRANSPORTS(){return[iJ,i0]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}initTransports_(e){let t=i0&&i0.isAvailable(),n=t&&!i0.previouslyFailed();if(e.webSocketOnly&&(t||iw("wss:// URL used, but browser isn't known to support websockets.  Trying anyway."),n=!0),n)this.transports_=[i0];else{let e=this.transports_=[];for(let t of i1.ALL_TRANSPORTS)t&&t.isAvailable()&&e.push(t);i1.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}i1.globalTransportInitialized_=!1;class i2{constructor(e,t,n,r,i,s,a,o,l,c){this.id=e,this.repoInfo_=t,this.applicationId_=n,this.appCheckToken_=r,this.authToken_=i,this.onMessage_=s,this.onReady_=a,this.onDisconnect_=o,this.onKill_=l,this.lastSessionId=c,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=i_("c:"+this.id+":"),this.transportManager_=new i1(t),this.log_("Connection created"),this.start_()}start_(){let 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;let t=this.connReceiver_(this.conn_),n=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(t,n)},Math.floor(0));let r=e.healthyTimeout||0;r>0&&(this.healthyTimeout_=iD(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>102400?(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>10240?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(r)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return t=>{e===this.conn_?this.onConnectionLost_(t):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return t=>{2!==this.state_&&(e===this.rx_?this.onPrimaryMessageReceived_(t):e===this.secondaryConn_?this.onSecondaryMessageReceived_(t):this.log_("message on old connection"))}}sendRequest(e){this.sendData_({t:"d",d:e})}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("t"in e){let t=e.t;"a"===t?this.upgradeIfSecondaryHealthy_():"r"===t?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):"o"===t&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){let t=iS("t",e),n=iS("d",e);if("c"===t)this.onSecondaryControl_(n);else if("d"===t)this.pendingDataMessages.push(n);else throw Error("Unknown protocol layer: "+t)}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
1:"c",d:{t:"p",d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:"a",d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:"n",d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){let t=iS("t",e),n=iS("d",e);"c"===t?this.onControl_(n):"d"===t&&this.onDataMessage_(n)}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){let t=iS("t",e);if("d"in e){let n=e.d;if("h"===t){let e=Object.assign({},n);this.repoInfo_.isUsingEmulator&&(e.h=this.repoInfo_.host),this.onHandshake_(e)}else if("n"===t){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let e=0;e<this.pendingDataMessages.length;++e)this.onDataMessage_(this.pendingDataMessages[e]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===t?this.onConnectionShutdown_(n):"r"===t?this.onReset_(n):"e"===t?iv("Server Error: "+n):"o"===t?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):iv("Unknown control packet command: "+t)}}onHandshake_(e){let t=e.ts,n=e.v,r=e.h;this.sessionId=e.s,this.repoInfo_.host=r,0===this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,t),"5"!==n&&iw("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){let e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}startUpgrade_(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let t=this.connReceiver_(this.secondaryConn_),n=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(t,n),iD(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(6e4))}onReset_(e){this.log_("Reset packet received.  New host: "+e),this.repoInfo_.host=e,1===this.state_?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,t){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(t,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):iD(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(5e3))}sendPingOnPrimaryIfNecessary_(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))}onSecondaryConnectionLost_(){let e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,e||0!==this.state_?1===this.state_&&this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(ia.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),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(1!==this.state_)throw"Connection is not connected";this.tx_.send(e)}close(){2!==this.state_&&(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)}}class i4{put(e,t,n,r){}merge(e,t,n,r){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,t,n){}onDisconnectMerge(e,t,n){}onDisconnectCancel(e,t){}reportStats(e){}}let i3=class{constructor(e){this.allowedEvents_=e,this.listeners_={},nR(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...t){if(Array.isArray(this.listeners_[e])){let n=[...this.listeners_[e]];for(let e=0;e<n.length;e++)n[e].callback.apply(n[e].context,t)}}on(e,t,n){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:t,context:n});let r=this.getInitialEvent(e);r&&t.apply(n,r)}off(e,t,n){this.validateEventType_(e);let r=this.listeners_[e]||[];for(let e=0;e<r.length;
1e++)if(r[e].callback===t&&(!n||n===r[e].context)){r.splice(e,1);return}}validateEventType_(e){nR(this.allowedEvents_.find(t=>t===e),"Unknown event: "+e)}};class i9 extends i3{constructor(){super(["online"]),this.online_=!0,"u">typeof window&&"u">typeof window.addEventListener&&!nY()&&(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 i9}getInitialEvent(e){return nR("online"===e,"Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}}let i5=class{constructor(e,t){if(void 0===t){this.pieces_=e.split("/");let t=0;for(let e=0;e<this.pieces_.length;e++)this.pieces_[e].length>0&&(this.pieces_[t]=this.pieces_[e],t++);this.pieces_.length=t,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=t}toString(){let e="";for(let t=this.pieceNum_;t<this.pieces_.length;t++)""!==this.pieces_[t]&&(e+="/"+this.pieces_[t]);return e||"/"}};function i6(){return new i5("")}function i7(e){return e.pieceNum_>=e.pieces_.length?null:e.pieces_[e.pieceNum_]}function i8(e){return e.pieces_.length-e.pieceNum_}function se(e){let t=e.pieceNum_;return t<e.pieces_.length&&t++,new i5(e.pieces_,t)}function st(e){return e.pieceNum_<e.pieces_.length?e.pieces_[e.pieces_.length-1]:null}function sn(e,t=0){return e.pieces_.slice(e.pieceNum_+t)}function sr(e){if(e.pieceNum_>=e.pieces_.length)return null;let t=[];for(let n=e.pieceNum_;n<e.pieces_.length-1;n++)t.push(e.pieces_[n]);return new i5(t,0)}function si(e,t){let n=[];for(let t=e.pieceNum_;t<e.pieces_.length;t++)n.push(e.pieces_[t]);if(t instanceof i5)for(let e=t.pieceNum_;e<t.pieces_.length;e++)n.push(t.pieces_[e]);else{let e=t.split("/");for(let t=0;t<e.length;t++)e[t].length>0&&n.push(e[t])}return new i5(n,0)}function ss(e){return e.pieceNum_>=e.pieces_.length}function sa(e,t){let n=i7(e),r=i7(t);if(null===n)return t;if(n===r)return sa(se(e),se(t));throw Error("INTERNAL ERROR: innerPath ("+t+") is not within outerPath ("+e+")")}function so(e,t){if(i8(e)!==i8(t))return!1;for(let n=e.pieceNum_,r=t.pieceNum_;n<=e.pieces_.length;n++,r++)if(e.pieces_[n]!==t.pieces_[r])return!1;return!0}function sl(e,t){let n=e.pieceNum_,r=t.pieceNum_;if(i8(e)>i8(t))return!1;for(;n<e.pieces_.length;){if(e.pieces_[n]!==t.pieces_[r])return!1;++n,++r}return!0}class sc{constructor(e,t){this.errorPrefix_=t,this.parts_=sn(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let e=0;e<this.parts_.length;e++)this.byteLength_+=ru(this.parts_[e]);su(this)}}function su(e){if(e.byteLength_>768)throw Error(e.errorPrefix_+"has a key path longer than 768 bytes ("+e.byteLength_+").");if(e.parts_.length>32)throw Error(e.errorPrefix_+"path specified exceeds the maximum depth that can be written (32) or object contains a cycle "+sd(e))}function sd(e){return 0===e.parts_.length?"":"in property '"+e.parts_.join(".")+"'"}class sh extends i3{constructor(){let e,t;super(["visible"]),"u">typeof document&&"u">typeof document.addEventListener&&("u">typeof document.hidden?(t="visibilitychange",e="hidden"):"u">typeof document.mozHidden?(t="mozvisibilitychange",e="mozHidden"):"u">typeof document.msHidden?(t="msvisibilitychange",e="msHidden"):"u">typeof document.webkitHidden&&(t="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,t&&document.addEventListener(t,()=>{let t=!document[e];t!==this.visible_&&(this.visible_=t,this.trigger("visible",t))},!1)}static getInstance(){return new sh}getInitialEvent(e){return nR("visible"===e,"Unknown event type: "+e),[this.visible_]}}let sp=class e extends i4{constructor(t,n,r,i,s,a,o,l){if(super(),this.repoInfo_=t,this.applicationId_=n,this.onDataUpdate_=r,this.onConnectStatus_=i,this.onServerInfoUpdate_=s,this.authTokenProvider_=a,this.appCheckTokenProvider_=o,this.authOverride_=l,this.id=e.nextPersistentConnectionId_++,this.log_=i_("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_=1e3,this.maxReconnectDelay_=3e5,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,l)throw Error("Auth override specified in options, but not supported on non Node.js platforms");sh.getInstance().on("visible",this.onVisible_,this),-1===t.host.indexOf("fblocal")&&i9.getInstance().on("online",this.onOnline_,this)}sendRequest(e,t,n){let r=++this.requestNumber_,i={r:r,a:e,b:t};this.log_(n2(i)),nR(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(i),n&&(this.requestCBHash_[r]=n)}get(e){this.initConnection_();let t=new nK,n={action:"g",request:{p:e._path.toString(),q:e._queryObject},onComplete:e=>{let n=e.d;"ok"===e.s?t.resolve(n):t.reject(n)}};this.outstandingGets_.push(n),this.outstandingGetCount_++;let r=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(r),t.promise}listen(e,t,n,r){this.initConnection_();let i=e._queryIdentifier,s=e._path.toString();this.log_("Listen called for "+s+" "+i),this.listens.has(s)||this.listens.set(s,new Map),nR(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"listen() called for non-default but complete query"),nR(!this.listens.get(s).has(i),"listen() called twice for same path/queryId.");let a={onComplete:r,hashFn:t,query:e,tag:n};this.listens.get(s).set(i,a),this.connected_&&this.sendListen_(a)}sendGet_(e){let t=this.outstandingGets_[e];this.sendRequest("g",t.request,n=>{delete this.outstandingGets_[e],this.outstandingGetCount_--,0===this.outstandingGetCount_&&(this.outstandingGets_=[]),t.onComplete&&t.onComplete(n)})}sendListen_(t){let n=t.query,r=n._path.toString(),i=n._queryIdentifier;this.log_("Listen on "+r+" for "+i);let s={p:r};t.tag&&(s.q=n._queryObject,s.t=t.tag),s.h=t.hashFn(),this.sendRequest("q",s,s=>{let a=s.d,o=s.s;e.warnOnListenWarnings_(a,n),(this.listens.get(r)&&this.listens.get(r).get(i))===t&&(this.log_("listen response",s),"ok"!==o&&this.removeListen_(r,i),t.onComplete&&t.onComplete(o,a))})}static warnOnListenWarnings_(e,t){if(e&&"object"==typeof e&&n5(e,"w")){let n=n6(e,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){let e='".indexOn": "'+t._queryParams.getIndex().toString()+'"',n=t._path.toString();iw(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${e} at ${n} 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&&40===e.length||n9(e))&&(this.log_("Admin auth credential detected.  Reducing max reconnect time."),this.maxReconnectDelay_=3e4)}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_){let e=this.authToken_,t=n3(e)?"auth":"gauth",n={cred:e};null===this.authOverride_?n.noauth=!0:"object"==typeof this.authOverride_&&(n.authvar=this.authOverride_),this.sendRequest(t,n,t=>{let n=t.s,r=t.d||"error";this.authToken_===e&&("ok"===n?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(n,r))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},e=>{let t=e.s,n=e.d||"error";"ok"===t?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(t,n)})}unlisten(e,t){let n=e._path.toString(),r=e._queryIdentifier;this.log_("Unlisten called for "+n+" "+r),nR(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,r)&&this.connected_&&this.sendUnlisten_(n,r,e._queryObject,t)}sendUnlisten_(e,t,n,r){this.log_("Unlisten on "+e+" for "+t);let i={p:e};r&&(i.q=n,i.t=r),this.sendRequest("n",i)}onDisconnectPut(e,t,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",e,t,n):this.onDisconnectRequestQueue_.push({pathString:e,action:"o",data:t,onComplete:n})}onDisconnectMerge(e,t,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",e,t,n):this.onDisconnectRequestQueue_.push({pathString:e,action:"om",data:t,onComplete:n})}onDisconnectCancel(e,t){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",e,null,t):this.onDisconnectRequestQueue_.push({pathString:e,action:"oc",data:null,onComplete:t})}sendOnDisconnect_(e,t,n,r){let i={p:t,d:n};this.log_("onDisconnect "+e,i),this.sendRequest(e,i,e=>{r&&setTimeout(()=>{r(e.s,e.d)},Math.floor(0))})}put(e,t,n,r){this.putInternal("p",e,t,n,r)}merge(e,t,n,r){this.putInternal("m",e,t,n,r)}putInternal(e,t,n,r,i){this.initConnection_();let s={p:t,d:n};void 0!==i&&(s.h=i),this.outstandingPuts_.push({action:e,request:s,onComplete:r}),this.outstandingPutCount_++;let a=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(a):this.log_("Buffering put: "+t)}sendPut_(e){let t=this.outstandingPuts_[e].action,n=this.outstandingPuts_[e].request,r=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(t,n,n=>{this.log_(t+" response",n),delete this.outstandingPuts_[e],this.outstandingPutCount_--,0===this.outstandingPutCount_&&(this.outstandingPuts_=[]),r&&r(n.s,n.d)})}reportStats(e){if(this.connected_){let t={c:e};this.log_("reportStats",t),this.sendRequest("s",t,e=>{if("ok"!==e.s){let t=e.d;this.log_("reportStats","Error sending stats: "+t)}})}}onDataMessage_(e){if("r"in e){this.log_("from server: "+n2(e));let t=e.r,n=this.requestCBHash_[t];n&&(delete this.requestCBHash_[t],n(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,t){this.log_("handleServerMessage",e,t),"d"===e?this.onDataUpdate_(t.p,t.d,!1,t.t):"m"===e?this.onDataUpdate_(t.p,t.d,!0,t.t):"c"===e?this.onListenRevoked_(t.p,t.q):"ac"===e?this.onAuthRevoked_(t.s,t.d):"apc"===e?this.onAppCheckRevoked_(t.s,t.d):"sd"===e?this.onSecurityDebugPacket_(t):iv("Unrecognized action received from server: "+n2(e)+`
2Are you using the latest client?`)}onReady_(e,t){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(e),this.lastSessionId=t,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(e){nR(!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_=1e3,this.realtime_||this.scheduleConnect_(0)),this.visible_=e}onOnline_(e){e?(this.log_("Browser went online."),this.reconnectDelay_=1e3,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_>3e4&&(this.reconnectDelay_=1e3),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible.  Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());let e=new Date().getTime()-this.lastConnectionAttemptTime_,t=Math.max(0,this.reconnectDelay_-e);
2t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;let t=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+e.nextConnectionId_++,s=this.lastSessionId,a=!1,o=null,l=function(){o?o.close():(a=!0,r())};this.realtime_={close:l,sendRequest:function(e){nR(o,"sendRequest call when we're not connected not allowed."),o.sendRequest(e)}};let c=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{let[e,l]=await Promise.all([this.authTokenProvider_.getToken(c),this.appCheckTokenProvider_.getToken(c)]);a?ig("getToken() completed but was canceled"):(ig("getToken() completed. Creating connection."),this.authToken_=e&&e.accessToken,this.appCheckToken_=l&&l.token,o=new i2(i,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,t,n,r,e=>{iw(e+" ("+this.repoInfo_.toString()+")"),this.interrupt("server_kill")},s))}catch(e){this.log_("Failed to get token: "+e),a||(this.repoInfo_.nodeAdmin&&iw(e),l())}}}interrupt(e){ig("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){ig("Resuming connection for reason: "+e),delete this.interruptReasons_[e],n7(this.interruptReasons_)&&(this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(e){let t=e-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:t})}cancelSentTransactions_(){for(let e=0;e<this.outstandingPuts_.length;e++){let t=this.outstandingPuts_[e];t&&"h"in t.request&&t.queued&&(t.onComplete&&t.onComplete("disconnect"),delete this.outstandingPuts_[e],this.outstandingPutCount_--)}0===this.outstandingPutCount_&&(this.outstandingPuts_=[])}onListenRevoked_(e,t){let n;n=t?t.map(e=>iN(e)).join("$"):"default";let r=this.removeListen_(e,n);r&&r.onComplete&&r.onComplete("permission_denied")}removeListen_(e,t){let n;let r=new i5(e).toString();if(this.listens.has(r)){let e=this.listens.get(r);n=e.get(t),e.delete(t),0===e.size&&this.listens.delete(r)}else n=void 0;return n}onAuthRevoked_(e,t){ig("Auth token revoked: "+e+"/"+t),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),("invalid_token"===e||"permission_denied"===e)&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(e,t){ig("App check token revoked: "+e+"/"+t),this.appCheckToken_=null,this.forceTokenRefresh_=!0,("invalid_token"===e||"permission_denied"===e)&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=3&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(e){this.securityDebugCallback_?this.securityDebugCallback_(e):"msg"in e&&console.log("FIREBASE: "+e.msg.replace(`
3`,`
4FIREBASE: `))}restoreState_(){for(let e of(this.tryAuth(),this.tryAppCheck(),this.listens.values()))for(let t of e.values())this.sendListen_(t);for(let e=0;e<this.outstandingPuts_.length;e++)this.outstandingPuts_[e]&&this.sendPut_(e);for(;this.onDisconnectRequestQueue_.length;){let e=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(e.action,e.pathString,e.data,e.onComplete)}for(let e=0;e<this.outstandingGets_.length;e++)this.outstandingGets_[e]&&this.sendGet_(e)}sendConnectStats_(){let e={};e["sdk.js."+it.replace(/\./g,"-")]=1,nY()?e["framework.cordova"]=1:nJ()&&(e["framework.reactnative"]=1),this.reportStats(e)}shouldReconnect_(){let e=i9.getInstance().currentlyOnline();return n7(this.interruptReasons_)&&e}};sp.nextPersistentConnectionId_=0,sp.nextConnectionId_=0;let sf=class e{constructor(e,t){this.name=e,this.node=t}static Wrap(t,n){return new e(t,n)}};class sm{getCompare(){return this.compare.bind(this)}indexedValueChanged(e,t){let n=new sf(ix,e),r=new sf(ix,t);return 0!==this.compare(n,r)}
4minPost(){return sf.MIN}}class sg extends sm{static get __EMPTY_NODE(){return a}static set __EMPTY_NODE(e){a=e}compare(e,t){return iE(e.name,t.name)}isDefinedOn(e){throw nO("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,t){return!1}minPost(){return sf.MIN}maxPost(){return new sf(iI,a)}makePost(e,t){return nR("string"==typeof e,"KeyIndex indexValue must always be a string."),new sf(e,a)}toString(){return".key"}}let s_=new sg;class sv{constructor(e,t,n,r,i=null){this.isReverse_=r,this.resultGenerator_=i,this.nodeStack_=[];let s=1;for(;!e.isEmpty();)if(s=t?n(e.key,t):1,r&&(s*=-1),s<0)e=this.isReverse_?e.left:e.right;else if(0===s){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),e=this.isReverse_?e.right:e.left}getNext(){if(0===this.nodeStack_.length)return null;let e=this.nodeStack_.pop(),t;if(t=this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value},this.isReverse_)for(e=e.left;!e.isEmpty();)this.nodeStack_.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack_.push(e),e=e.left;return t}hasNext(){return this.nodeStack_.length>0}peek(){if(0===this.nodeStack_.length)return null;let e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}}let sy=class e{constructor(t,n,r,i,s){this.key=t,this.value=n,this.color=r??e.RED,this.left=i??sC.EMPTY_NODE,this.right=s??sC.EMPTY_NODE}copy(t,n,r,i,s){return new e(t??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,t,n){let r=this,i=n(e,r.key);return(r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n))).fixUp_()}removeMin_(){if(this.left.isEmpty())return sC.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)).fixUp_()}remove(e,t){let n,r;if(n=this,0>t(e,n.key))n.left.isEmpty()||n.left.isRed_()||n.left.left.isRed_()||(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(e,t),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===t(e,n.key)){if(n.right.isEmpty())return sC.EMPTY_NODE;r=n.right.min_(),n=n.copy(r.key,r.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(e,t))}return n.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=(e=e.copy(null,null,null,null,e.right.rotateRight_())).rotateLeft_()).colorFlip_()),e}moveRedRight_(){let e=this.colorFlip_();return e.left.left.isRed_()&&(e=(e=e.rotateRight_()).colorFlip_()),e}rotateLeft_(){let t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight_(){let t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip_(){let e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth_(){return Math.pow(2,this.check_())<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw Error("Red node has red child("+this.key+","+this.value+")");
4if(this.right.isRed_())throw Error("Right child of ("+this.key+","+this.value+") is red");let e=this.left.check_();if(e!==this.right.check_())throw Error("Black depths differ");return e+(this.isRed_()?0:1)}};sy.RED=!0,sy.BLACK=!1;class sw{copy(e,t,n,r,i){return this}insert(e,t,n){return new sy(e,t,null)}remove(e,t){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}}let sC=class e{constructor(t,n=e.EMPTY_NODE){this.comparator_=t,this.root_=n}insert(t,n){return new e(this.comparator_,this.root_.insert(t,n,this.comparator_).copy(null,null,sy.BLACK,null,null))}remove(t){return new e(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,sy.BLACK,null,null))}get(e){let t,n=this.root_;for(;!n.isEmpty();){if(0===(t=this.comparator_(e,n.key)))return n.value;t<0?n=n.left:t>0&&(n=n.right)}return null}getPredecessorKey(e){let t,n=this.root_,r=null;for(;!n.isEmpty();)if(0===(t=this.comparator_(e,n.key))){if(n.left.isEmpty())return r?r.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}else t<0?n=n.left:t>0&&(r=n,n=n.right);throw 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 sv(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,t){return new sv(this.root_,e,this.comparator_,!1,t)}getReverseIteratorFrom(e,t){return new sv(this.root_,e,this.comparator_,!0,t)}getReverseIterator(e){return new sv(this.root_,null,this.comparator_,!0,e)}};function sb(e,t){return iE(e.name,t.name)}function sk(e,t){return iE(e,t)}sC.EMPTY_NODE=new sw;let sx=function(e){return"number"==typeof e?"number:"+iO(e):"string:"+e},sI=function(e){if(e.isLeafNode()){let t=e.val();nR("string"==typeof t||"number"==typeof t||"object"==typeof t&&n5(t,".sv"),"Priority must be a string or number.")}else nR(e===o||e.isEmpty(),"priority of unexpected type.");nR(e===o||e.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},sE,sT=class e{constructor(t,n=e.__childrenNodeConstructor.EMPTY_NODE){this.value_=t,this.priorityNode_=n,this.lazyHash_=null,nR(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),sI(this.priorityNode_)}static set __childrenNodeConstructor(e){sE=e}static get __childrenNodeConstructor(){return sE}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(t){return new e(this.value_,t)}getImmediateChild(t){return".priority"===t?this.priorityNode_:e.__childrenNodeConstructor.EMPTY_NODE}getChild(t){return ss(t)?this:".priority"===i7(t)?this.priorityNode_:e.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(e,t){return null}updateImmediateChild(t,n){return".priority"===t?this.updatePriority(n):n.isEmpty()&&".priority"!==t?this:e.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,n).updatePriority(this.priorityNode_)}updateChild(t,n){let r=i7(t);return null===r?n:n.isEmpty()&&".priority"!==r?this:(nR(".priority"!==r||1===i8(t),".priority must be the last token in a path"),this.updateImmediateChild(r,e.__childrenNodeConstructor.EMPTY_NODE.updateChild(se(t),n)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(e,t){return!1}val(e){return e&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(null===this.lazyHash_){let e="";this.priorityNode_.isEmpty()||(e+="priority:"+sx(this.priorityNode_.val())+":");let t=typeof this.value_;e+=t+":","number"===t?e+=iO(this.value_):e+=this.value_,this.lazyHash_=iu(e)}return this.lazyHash_}getValue(){return this.value_}compareTo(t){return t===e.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof e.__childrenNodeConstructor?-1:(nR(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))}compareToLeafNode_(t){let n=typeof t.value_,r=typeof this.value_,i=e.VALUE_TYPE_ORDER.indexOf(n),s=e.VALUE_TYPE_ORDER.indexOf(r);return nR(i>=0,"Unknown leaf type: "+n),nR(s>=0,"Unknown leaf type: "+r),i===s?"object"===r?0:this.value_<t.value_?-1:this.value_===t.value_?0:1:s-i}withIndex(){return this}isIndexed(){return!0}equals(e){return e===this||!!e.isLeafNode()&&this.value_===e.value_&&this.priorityNode_.equals(e.priorityNode_)}};sT.VALUE_TYPE_ORDER=["object","boolean","number","string"];class sS extends sm{compare(e,t){let n=e.node.getPriority(),r=t.no
4de.getPriority(),i=n.compareTo(r);return 0===i?iE(e.name,t.name):i}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,t){return!e.getPriority().equals(t.getPriority())}minPost(){return sf.MIN}maxPost(){return new sf(iI,new sT("[PRIORITY-POST]",c))}makePost(e,t){return new sf(t,new sT("[PRIORITY-POST]",l(e)))}toString(){return".priority"}}let sN=new sS,sP=Math.log(2);class sR{constructor(e){this.count=parseInt(Math.log(e+1)/sP,10),this.current_=this.count-1;let t=parseInt(Array(this.count+1).join("1"),2);this.bits_=e+1&t}nextBitIsOne(){let e=!(this.bits_&1<<this.current_);return this.current_--,e}}let sO=function(e,t,n,r){e.sort(t);let i=function(t,r){let s;let a=r-t;if(0===a)return null;if(1===a)return s=e[t],new sy(n?n(s):s,s.node,sy.BLACK,null,null);{let o=parseInt(a/2,10)+t,l=i(t,o),c=i(o+1,r);return s=e[o],new sy(n?n(s):s,s.node,sy.BLACK,l,c)}};return new sC(r||t,function(t){let r=null,s=null,a=e.length,o=function(t,r){let s=a-t,o=a;a-=t;let c=i(s+1,o),u=e[s];l(new sy(n?n(u):u,u.node,r,null,c))},l=function(e){r?r.left=e:s=e,r=e};for(let e=0;e<t.count;++e){let n=t.nextBitIsOne(),r=Math.pow(2,t.count-(e+1));n?o(r,sy.BLACK):(o(r,sy.BLACK),o(r,sy.RED))}return s}(new sR(e.length)))},sL={},sA=class e{constructor(e,t){this.indexes_=e,this.indexSet_=t}static get Default(){return nR(sL&&sN,"ChildrenNode.ts has not been loaded"),u=u||new e({".priority":sL},{".priority":sN})}get(e){let t=n6(this.indexes_,e);if(!t)throw Error("No index defined for "+e);return t instanceof sC?t:null}hasIndex(e){return n5(this.indexSet_,e.toString())}addIndex(t,n){let r;nR(t!==s_,"KeyIndex always exists and isn't meant to be added to the IndexMap.");let i=[],s=!1,a=n.getIterator(sf.Wrap),o=a.getNext();for(;o;)s=s||t.isDefinedOn(o.node),i.push(o),o=a.getNext();r=s?sO(i,t.getCompare()):sL;let l=t.toString(),c=Object.assign({},this.indexSet_);c[l]=t;let u=Object.assign({},this.indexes_);return u[l]=r,new e(u,c)}addToIndexes(t,n){return new e(n8(this.indexes_,(e,r)=>{let i=n6(this.indexSet_,r);if(nR(i,"Missing index implementation for "+r),e===sL){if(!i.isDefinedOn(t.node))return sL;{let e=[],r=n.getIterator(sf.Wrap),s=r.getNext();for(;s;)s.name!==t.name&&e.push(s),s=r.getNext();return e.push(t),sO(e,i.getCompare())}}{let r=n.get(t.name),i=e;return r&&(i=i.remove(new sf(t.name,r))),i.insert(t,t.node)}}),this.indexSet_)}removeFromIndexes(t,n){return new e(n8(this.indexes_,e=>{if(e===sL)return e;{let r=n.get(t.name);return r?e.remove(new sf(t.name,r)):e}}),this.indexSet_)}},sj,sD=class e{constructor(e,t,n){this.children_=e,this.priorityNode_=t,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&sI(this.priorityNode_),this.children_.isEmpty()&&nR(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}static get EMPTY_NODE(){return sj||(sj=new e(new sC(sk),null,sA.Default))}isLeafNode(){return!1}getPriority(){return this.priorityNode_||sj}updatePriority(t){return this.children_.isEmpty()?this:new e(this.children_,t,this.indexMap_)}getImmediateChild(e){if(".priority"===e)return this.getPriority();{let t=this.children_.get(e);return null===t?sj:t}}getChild(e){let t=i7(e);return null===t?this:this.getImmediateChild(t).getChild(se(e))}hasChild(e){return null!==this.children_.get(e)}updateImmediateChild(t,n){if(nR(n,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(n);{let r,i;let s=new sf(t,n);n.isEmpty()?(r=this.children_.remove(t),i=this.indexMap_.removeFromIndexes(s,this.children_)):(r=this.children_.insert(t,n),i=this.indexMap_.addToIndexes(s,this.children_));let a=r.isEmpty()?sj:this.priorityNode_;return new e(r,a,i)}}updateChild(e,t){let n=i7(e);if(null===n)return t;{nR(".priority"!==i7(e)||1===i8(e),".priority must be the last token in a path");let r=this.getImmediateChild(n).updateChild(se(e),t);return this.updateImmediateChild(n,r)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(t){if(this.isEmpty())return null;let n={},r=0,i=0,s=!0;if(this.forEachChild(sN,(a,o)=>{n[a]=o.val(t),r++,s&&e.INTEGER_REGEXP_.test(a)?i=Math.max(i,Number(a)):s=!1}
4),t||!s||!(i<2*r))return t&&!this.getPriority().isEmpty()&&(n[".priority"]=this.getPriority().val()),n;{let e=[];for(let t in n)e[t]=n[t];return e}}hash(){if(null===this.lazyHash_){let e="";this.getPriority().isEmpty()||(e+="priority:"+sx(this.getPriority().val())+":"),this.forEachChild(sN,(t,n)=>{let r=n.hash();""!==r&&(e+=":"+t+":"+r)}),this.lazyHash_=""===e?"":iu(e)}return this.lazyHash_}getPredecessorChildName(e,t,n){let r=this.resolveIndex_(n);if(!r)return this.children_.getPredecessorKey(e);{let n=r.getPredecessorKey(new sf(e,t));return n?n.name:null}}getFirstChildName(e){let t=this.resolveIndex_(e);if(!t)return this.children_.minKey();{let e=t.minKey();return e&&e.name}}getFirstChild(e){let t=this.getFirstChildName(e);return t?new sf(t,this.children_.get(t)):null}getLastChildName(e){let t=this.resolveIndex_(e);if(!t)return this.children_.maxKey();{let e=t.maxKey();return e&&e.name}}getLastChild(e){let t=this.getLastChildName(e);return t?new sf(t,this.children_.get(t)):null}forEachChild(e,t){let n=this.resolveIndex_(e);return n?n.inorderTraversal(e=>t(e.name,e.node)):this.children_.inorderTraversal(t)}getIterator(e){return this.getIteratorFrom(e.minPost(),e)}getIteratorFrom(e,t){let n=this.resolveIndex_(t);if(n)return n.getIteratorFrom(e,e=>e);{let n=this.children_.getIteratorFrom(e.name,sf.Wrap),r=n.peek();for(;null!=r&&0>t.compare(r,e);)n.getNext(),r=n.peek();return n}}getReverseIterator(e){return this.getReverseIteratorFrom(e.maxPost(),e)}getReverseIteratorFrom(e,t){let n=this.resolveIndex_(t);if(n)return n.getReverseIteratorFrom(e,e=>e);{let n=this.children_.getReverseIteratorFrom(e.name,sf.Wrap),r=n.peek();for(;null!=r&&t.compare(r,e)>0;)n.getNext(),r=n.peek();return n}}compareTo(e){return this.isEmpty()?e.isEmpty()?0:-1:e.isLeafNode()||e.isEmpty()?1:e===sF?-1:0}withIndex(t){if(t===s_||this.indexMap_.hasIndex(t))return this;{let n=this.indexMap_.addIndex(t,this.children_);return new e(this.children_,this.priorityNode_,n)}}isIndexed(e){return e===s_||this.indexMap_.hasIndex(e)}equals(e){if(e===this)return!0;if(e.isLeafNode()||!this.getPriority().equals(e.getPriority())||this.children_.count()!==e.children_.count())return!1;{let t=this.getIterator(sN),n=e.getIterator(sN),r=t.getNext(),i=n.getNext();for(;r&&i;){if(r.name!==i.name||!r.node.equals(i.node))return!1;r=t.getNext(),i=n.getNext()}return null===r&&null===i}}resolveIndex_(e){return e===s_?null:this.indexMap_.get(e.toString())}};sD.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class sM extends sD{constructor(){super(new sC(sk),sD.EMPTY_NODE,sA.Default)}compareTo(e){return e===this?0:1}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return sD.EMPTY_NODE}isEmpty(){return!1}}let sF=new sM;function sU(e,t=null){if(null===e)return sD.EMPTY_NODE;if("object"==typeof e&&".priority"in e&&(t=e[".priority"]),nR(null===t||"string"==typeof t||"number"==typeof t||"object"==typeof t&&".sv"in t,"Invalid priority type found: "+typeof t),"object"==typeof e&&".value"in e&&null!==e[".value"]&&(e=e[".value"]),"object"!=typeof e||".sv"in e)return new sT(e,sU(t));if(e instanceof Array){let n=sD.EMPTY_NODE;return iR(e,(t,r)=>{if(n5(e,t)&&"."!==t.substring(0,1)){let e=sU(r);(e.isLeafNode()||!e.isEmpty())&&(n=n.updateImmediateChild(t,e))}}),n.updatePriority(sU(t))}{let n=[],r=!1;if(iR(e,(e,t)=>{if("."!==e.substring(0,1)){let i=sU(t);i.isEmpty()||(r=r||!i.getPriority().isEmpty(),n.push(new sf(e,i)))}}),0===n.length)return sD.EMPTY_NODE;let i=sO(n,sb,e=>e.name,sk);if(!r)return new sD(i,sU(t),sA.Default);{let e=sO(n,sN.getCompare());return new sD(i,sU(t),new sA({".priority":e},{".priority":sN}))}}}Object.defineProperties(sf,{MIN:{value:new sf(ix,sD.EMPTY_NODE)},MAX:{value:new sf(iI,sF)}}),sg.__EMPTY_NODE=sD.EMPTY_NODE,sT.__childrenNodeConstructor=sD,o=sF,c=sF,l=sU;class s$ extends sm{constructor(e){super(),this.indexPath_=e,nR(!ss(e)&&".priority"!==i7(e),"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,t){let n=this.extractChild(e.node),r=this.extractChild(t.node),i=n.compareTo(r);return 0===i?iE(e.name,t.name):i}makePost(e,t){let n=sU(e);return new sf(t,sD.EMPTY_NODE.updateChild(this.indexPath_,n))}maxPost(){return new sf(iI,sD.EMPTY_NODE.updateChild(this.indexPath_,sF))}toString(){return sn(this.indexPath_,0).join("/")}}class sV extends sm{compare(e,t){let n=e.node.compareTo(t.node);return 0===n?iE(e.name,t.name):n}isDefinedOn(e){return!0}indexedValueChanged(e,t){return!e.equals(t)}
4minPost(){return sf.MIN}maxPost(){return sf.MAX}makePost(e,t){return new sf(t,sU(e))}toString(){return".value"}}let sq=new sV;function sz(e){return{type:"value",snapshotNode:e}}function sB(e,t){return{type:"child_added",snapshotNode:t,childName:e}}function sW(e,t){return{type:"child_removed",snapshotNode:t,childName:e}}function sH(e,t,n){return{type:"child_changed",snapshotNode:t,childName:e,oldSnap:n}}class sZ{constructor(e){this.index_=e}updateChild(e,t,n,r,i,s){nR(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");let a=e.getImmediateChild(t);return a.getChild(r).equals(n.getChild(r))&&a.isEmpty()===n.isEmpty()||(null!=s&&(n.isEmpty()?e.hasChild(t)?s.trackChildChange(sW(t,a)):nR(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?s.trackChildChange(sB(t,n)):s.trackChildChange(sH(t,n,a))),e.isLeafNode()&&n.isEmpty())?e:e.updateImmediateChild(t,n).withIndex(this.index_)}updateFullNode(e,t,n){return null!=n&&(e.isLeafNode()||e.forEachChild(sN,(e,r)=>{t.hasChild(e)||n.trackChildChange(sW(e,r))}),t.isLeafNode()||t.forEachChild(sN,(t,r)=>{if(e.hasChild(t)){let i=e.getImmediateChild(t);i.equals(r)||n.trackChildChange(sH(t,r,i))}else n.trackChildChange(sB(t,r))})),t.withIndex(this.index_)}updatePriority(e,t){return e.isEmpty()?sD.EMPTY_NODE:e.updatePriority(t)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}}class sK{constructor(e){this.indexedFilter_=new sZ(e.getIndex()),this.index_=e.getIndex(),this.startPost_=sK.getStartPost_(e),this.endPost_=sK.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){let t=this.startIsInclusive_?0>=this.index_.compare(this.getStartPost(),e):0>this.index_.compare(this.getStartPost(),e),n=this.endIsInclusive_?0>=this.index_.compare(e,this.getEndPost()):0>this.index_.compare(e,this.getEndPost());return t&&n}updateChild(e,t,n,r,i,s){return this.matches(new sf(t,n))||(n=sD.EMPTY_NODE),this.indexedFilter_.updateChild(e,t,n,r,i,s)}updateFullNode(e,t,n){t.isLeafNode()&&(t=sD.EMPTY_NODE);let r=t.withIndex(this.index_);r=r.updatePriority(sD.EMPTY_NODE);let i=this;return t.forEachChild(sN,(e,t)=>{i.matches(new sf(e,t))||(r=r.updateImmediateChild(e,sD.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(e,r,n)}updatePriority(e,t){return e}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(e){if(!e.hasStart())return e.getIndex().minPost();{let t=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),t)}}static getEndPost_(e){if(!e.hasEnd())return e.getIndex().maxPost();{let t=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),t)}}}class sG{constructor(e){this.withinDirectionalStart=e=>this.reverse_?this.withinEndPost(e):this.withinStartPost(e),this.withinDirectionalEnd=e=>this.reverse_?this.withinStartPost(e):this.withinEndPost(e),this.withinStartPost=e=>{let t=this.index_.compare(this.rangedFilter_.getStartPost(),e);return this.startIsInclusive_?t<=0:t<0},this.withinEndPost=e=>{let t=this.index_.compare(e,this.rangedFilter_.getEndPost());return this.endIsInclusive_?t<=0:t<0},this.rangedFilter_=new sK(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft(),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}updateChild(e,t,n,r,i,s){return this.rangedFilter_.matches(new sf(t,n))||(n=sD.EMPTY_NODE),e.getImmediateChild(t).equals(n)?e:e.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(e,t,n,r,i,s):this.fullLimitUpdateChild_(e,t,n,i,s)}updateFullNode(e,t,n){let r;if(t.isLeafNode()||t.isEmpty())r=sD.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<t.numChildren()&&t.isIndexed(this.index_)){let e;r=sD.EMPTY_NODE.withIndex(this.index_),e=this.reverse_?t.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):t.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let n=0;for(;e.hasNext()&&n<this.limit_;){let t=e.getNext();if(this.withinDirectionalStart(t)){if(this.withinDirectionalEnd(t))r=r.updateImmediateChild(t.name,t.node),n++;else break}}}else{let e;r=(r=t.withIndex(this.index_)).updatePriority(sD.EMPTY_NODE),e=this.reverse_?r.getReverseIterator(this.index_):r.getIterator(this.index_);let n=0;for(;e.hasNext();){let t=e.getNext();n<this.limit_&&this.withinDirectionalStart(t)&&this.withinDirectionalEnd(t)?n++:r=r.updateImmediateChild(t.name,sD.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(e,r,n)}updatePriority(e,t){return e}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}
4fullLimitUpdateChild_(e,t,n,r,i){let s;if(this.reverse_){let e=this.index_.getCompare();s=(t,n)=>e(n,t)}else s=this.index_.getCompare();nR(e.numChildren()===this.limit_,"");let a=new sf(t,n),o=this.reverse_?e.getFirstChild(this.index_):e.getLastChild(this.index_),l=this.rangedFilter_.matches(a);if(!e.hasChild(t))return n.isEmpty()?e:l&&s(o,a)>=0?(null!=i&&(i.trackChildChange(sW(o.name,o.node)),i.trackChildChange(sB(t,n))),e.updateImmediateChild(t,n).updateImmediateChild(o.name,sD.EMPTY_NODE)):e;{let c=e.getImmediateChild(t),u=r.getChildAfterChild(this.index_,o,this.reverse_);for(;null!=u&&(u.name===t||e.hasChild(u.name));)u=r.getChildAfterChild(this.index_,u,this.reverse_);let d=null==u?1:s(u,a);if(l&&!n.isEmpty()&&d>=0)return null!=i&&i.trackChildChange(sH(t,n,c)),e.updateImmediateChild(t,n);{null!=i&&i.trackChildChange(sW(t,c));let n=e.updateImmediateChild(t,sD.EMPTY_NODE);return null!=u&&this.rangedFilter_.matches(u)?(null!=i&&i.trackChildChange(sB(u.name,u.node)),n.updateImmediateChild(u.name,u.node)):n}}}}class sY{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_=sN}hasStart(){return this.startSet_}isViewFromLeft(){return""===this.viewFrom_?this.startSet_:"l"===this.viewFrom_}getIndexStartValue(){return nR(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return nR(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:ix}hasEnd(){return this.endSet_}getIndexEndValue(){return nR(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return nR(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:iI}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&""!==this.viewFrom_}getLimit(){return nR(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_===sN}copy(){let e=new sY;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 sJ(e){let t;let n={};if(e.isDefault())return n;if(e.index_===sN?t="$priority":e.index_===sq?t="$value":e.index_===s_?t="$key":(nR(e.index_ instanceof s$,"Unrecognized index type!"),t=e.index_.toString()),n.orderBy=n2(t),e.startSet_){let t=e.startAfterSet_?"startAfter":"startAt";n[t]=n2(e.indexStartValue_),e.startNameSet_&&(n[t]+=","+n2(e.indexStartName_))}if(e.endSet_){let t=e.endBeforeSet_?"endBefore":"endAt";n[t]=n2(e.indexEndValue_),e.endNameSet_&&(n[t]+=","+n2(e.indexEndName_))}return e.limitSet_&&(e.isViewFromLeft()?n.limitToFirst=e.limit_:n.limitToLast=e.limit_),n}function sQ(e){let t={};if(e.startSet_&&(t.sp=e.indexStartValue_,e.startNameSet_&&(t.sn=e.indexStartName_),t.sin=!e.startAfterSet_),e.endSet_&&(t.ep=e.indexEndValue_,e.endNameSet_&&(t.en=e.indexEndName_),t.ein=!e.endBeforeSet_),e.limitSet_){t.l=e.limit_;let n=e.viewFrom_;""===n&&(n=e.isViewFromLeft()?"l":"r"),t.vf=n}return e.index_!==sN&&(t.i=e.index_.toString()),t}class sX extends i4{constructor(e,t,n,r){super(),this.repoInfo_=e,this.onDataUpdate_=t,this.authTokenProvider_=n,this.appCheckTokenProvider_=r,this.log_=i_("p:rest:"),this.listens_={}}reportStats(e){throw Error("Method not implemented.")}static getListenId_(e,t){return void 0!==t?"tag$"+t:(nR(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}listen(e,t,n,r){let i=e._path.toString();this.log_("Listen called for "+i+" "+e._queryIdentifier);let s=sX.getListenId_(e,n),a={};this.listens_[s]=a;let o=sJ(e._queryParams);this.restRequest_(i+".json",o,(e,t)=>{let o=t;404===e&&(o=null,e=null),null===e&&this.onDataUpdate_(i,o,!1,n),n6(this.listens_,s)===a&&r(e?401===e?"permission_denied":"rest_error:"+e:"ok",null)})}unlisten(e,t){let n=sX.getListenId_(e,t);delete this.listens_[n]}get(e){let t=sJ(e._queryParams),n=e._path.toString(),r=new nK;return this.restRequest_(n+".json",t,(e,t)=>{let i=t;404===e&&(i=null,e=null),null===e?(this.onDataUpdate_(n,i,!1,null),r.resolve(i)):r.reject(Error(i))}),r.promise}refreshAuthToken(e){}restRequest_(e,t={},n){return t.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([r,i])=>{r&&r.accessToken&&(t.auth=r.accessToken),i&&i.token&&(t.ac=i.token);let s=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+rn(t);this.log_("Sending REST request for "+s);let a=new XMLHttpRequest;a.onreadystatechange=()=>{if(n&&4===a.readyState){this.log_("REST Response for "+s+" received. status:",a.status,"response:",a.responseText);let e=null;if(a.status>=200&&a.status<300){try{e=n1(a.responseText)}catch{iw("Failed to parse JSON response for "+s+": "+a.responseText)}n(null,e)}else 401!==a.status&&404!==a.status&&iw("Got unsuccessful REST response for "+s+" Status: "+a.status),n(a.status);n=null}},a.open("GET",s,!0),a.send()})}}class s0{constructor(){this.rootNode_=sD.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,t){this.rootNode_=this.rootNode_.updateChild(e,t)}}function s1(){return{value:null,children:new Map}}function s2(e,t,n){null!==e.value?n(t,e.value):function(e,t){e.children.forEac
4h((e,n)=>{t(n,e)})}(e,(e,r)=>{s2(r,new i5(t.toString()+"/"+e),n)})}class s4{constructor(e){this.collection_=e,this.last_=null}get(){let e=this.collection_.get(),t=Object.assign({},e);return this.last_&&iR(this.last_,(e,n)=>{t[e]=t[e]-n}),this.last_=e,t}}class s3{constructor(e,t){this.server_=t,this.statsToReport_={},this.statsListener_=new s4(e),iD(this.reportStats_.bind(this),Math.floor(1e4+2e4*Math.random()))}reportStats_(){let e=this.statsListener_.get(),t={},n=!1;iR(e,(e,r)=>{r>0&&n5(this.statsToReport_,e)&&(t[e]=r,n=!0)}),n&&this.server_.reportStats(t),iD(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))}}function s9(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function s5(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function s6(e){return{fromUser:!1,fromServer:!0,queryId:e,tagged:!0}}(k=O||(O={}))[k.OVERWRITE=0]="OVERWRITE",k[k.MERGE=1]="MERGE",k[k.ACK_USER_WRITE=2]="ACK_USER_WRITE",k[k.LISTEN_COMPLETE=3]="LISTEN_COMPLETE";class s7{constructor(e,t,n){this.path=e,this.affectedTree=t,this.revert=n,this.type=O.ACK_USER_WRITE,this.source=s9()}operationForChild(e){if(!ss(this.path))return nR(i7(this.path)===e,"operationForChild called for unrelated child."),new s7(se(this.path),this.affectedTree,this.revert);if(null!=this.affectedTree.value)return nR(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{let t=this.affectedTree.subtree(new i5(e));return new s7(i6(),t,this.revert)}}}class s8{constructor(e,t){this.source=e,this.path=t,this.type=O.LISTEN_COMPLETE}operationForChild(e){return ss(this.path)?new s8(this.source,i6()):new s8(this.source,se(this.path))}}let ae=class e{constructor(e,t,n){this.source=e,this.path=t,this.snap=n,this.type=O.OVERWRITE}operationForChild(t){return ss(this.path)?new e(this.source,i6(),this.snap.getImmediateChild(t)):new e(this.source,se(this.path),this.snap)}};class at{constructor(e,t,n){this.source=e,this.path=t,this.children=n,this.type=O.MERGE}operationForChild(e){if(!ss(this.path))return nR(i7(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new at(this.source,se(this.path),this.children);{let t=this.children.subtree(new i5(e));return t.isEmpty()?null:t.value?new ae(this.source,i6(),t.value):new at(this.source,i6(),t)}}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}class an{constructor(e,t,n){this.node_=e,this.fullyInitialized_=t,this.filtered_=n}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(e){if(ss(e))return this.isFullyInitialized()&&!this.filtered_;let t=i7(e);return this.isCompleteForChild(t)}isCompleteForChild(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)}getNode(){return this.node_}}class ar{constructor(e){this.query_=e,this.index_=this.query_._queryParams.getIndex()}}function ai(e,t,n,r,i,s){let a=r.filter(e=>e.type===n);a.sort((t,n)=>(function(e,t,n){if(null==t.childName||null==n.childName)throw nO("Should only compare child_ events.");let r=new sf(t.childName,t.snapshotNode),i=new sf(n.childName,n.snapshotNode);return e.index_.compare(r,i)})(e,t,n)),a.forEach(n=>{let r=("value"===n.type||"child_removed"===n.type||(n.prevName=s.getPredecessorChildName(n.childName,n.snapshotNode,e.index_)),n);i.forEach(i=>{i.respondsTo(n.type)&&t.push(i.createEvent(r,e.query_))})})}function as(e,t){return{eventCache:e,serverCache:t}}function aa(e,t,n,r){return as(new an(t,n,r),e.serverCache)}function ao(e,t,n,r){return as(e.eventCache,new an(t,n,r))}function al(e){return e.eventCache.isFullyInitialized()?e.eventCache.getNode():null}function ac(e){return e.serverCache.isFullyInitialized()?e.serverCache.getNode():null}let au=()=>(d||(d=new sC(iT)),d),ad=class e{constructor(e,t=au()){this.value=e,this.children=t}static fromObject(t){let n=new e(null);return iR(t,(e,t)=>{n=n.set(new i5(e),t)}),n}isEmpty(){return null===this.value&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,t){if(null!=this.value&&t(this.value))return{path:i6(),value:this.value};if(ss(e))return null;{let n=i7(e),r=this.children.get(n);if(null===r)return null;{let i=r.findRootMostMatchingPathAndValue(se(e),t);return null!=i?{path:si(new i5(n),i.path),value:i.value}:null}}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(t){if(ss(t))return this;{let n=i7(t),r=this.children.get(n);return null!==r?r.subtree(se(t)):new e(null)}}set(t,n){if(ss(t))return new e(n,this.children);{let r=i7(t),i=(this.children.get(r)||new e(null)).set(se(t),n),s=this.children.insert(r,i);return new e(this.value,s)}}remove(t){if(ss(t))return this.children.isEmpty()?new e(null):new e(null,this.children);{let n=i7(t),r=this.children.get(n);if(!r)return this;{let i;let s=r.remove(se(t));return i=s.isEmpty()?this.children.remove(n):this.children.insert(n,s),null===this.value&&i.isEmpty()?new e(null):new e(this.value,i)}}}get(e){if(ss(e))return this.value;{let t=i7(e),n=this.children.get(t);return n?n.get(se(e)):null}}setTree(t,n){if(ss(t))return n;{let r;let i=i7(t),s=(this.children.get(i)||new e(null)).setTree(se(t),n);return r=s.isEmpty()?this.children.remove(i):this.children.insert(i,s),new e(this.value,r)}}fold(e){return this.fold_(i6(),e)}fold_(e,t){let n={};return this.children.inorderTraversal((r,i)=>{n[r]=i.fold_(si(e,r),t)}
4),t(e,this.value,n)}findOnPath(e,t){return this.findOnPath_(e,i6(),t)}findOnPath_(e,t,n){let r=!!this.value&&n(t,this.value);if(r)return r;if(ss(e))return null;{let r=i7(e),i=this.children.get(r);return i?i.findOnPath_(se(e),si(t,r),n):null}}foreachOnPath(e,t){return this.foreachOnPath_(e,i6(),t)}foreachOnPath_(t,n,r){if(ss(t))return this;{this.value&&r(n,this.value);let i=i7(t),s=this.children.get(i);return s?s.foreachOnPath_(se(t),si(n,i),r):new e(null)}}foreach(e){this.foreach_(i6(),e)}foreach_(e,t){this.children.inorderTraversal((n,r)=>{r.foreach_(si(e,n),t)}),this.value&&t(e,this.value)}foreachChild(e){this.children.inorderTraversal((t,n)=>{n.value&&e(t,n.value)})}},ah=class e{constructor(e){this.writeTree_=e}static empty(){return new e(new ad(null))}};function ap(e,t,n){if(ss(t))return new ah(new ad(n));{let r=e.writeTree_.findRootMostValueAndPath(t);if(null!=r){let i=r.path,s=r.value,a=sa(i,t);return s=s.updateChild(a,n),new ah(e.writeTree_.set(i,s))}{let r=new ad(n);return new ah(e.writeTree_.setTree(t,r))}}}function af(e,t,n){let r=e;return iR(n,(e,n)=>{r=ap(r,si(t,e),n)}),r}function am(e,t){return ss(t)?ah.empty():new ah(e.writeTree_.setTree(t,new ad(null)))}function ag(e,t){return null!=a_(e,t)}function a_(e,t){let n=e.writeTree_.findRootMostValueAndPath(t);return null!=n?e.writeTree_.get(n.path).getChild(sa(n.path,t)):null}function av(e){let t=[],n=e.writeTree_.value;return null!=n?n.isLeafNode()||n.forEachChild(sN,(e,n)=>{t.push(new sf(e,n))}):e.writeTree_.children.inorderTraversal((e,n)=>{null!=n.value&&t.push(new sf(e,n.value))}),t}function ay(e,t){if(ss(t))return e;{let n=a_(e,t);return new ah(null!=n?new ad(n):e.writeTree_.subtree(t))}}function aw(e){return e.writeTree_.isEmpty()}function aC(e,t){return function e(t,n,r){if(null!=n.value)return r.updateChild(t,n.value);{let i=null;return n.children.inorderTraversal((n,s)=>{".priority"===n?(nR(null!==s.value,"Priority writes must always be leaf nodes"),i=s.value):r=e(si(t,n),s,r)}),r.getChild(t).isEmpty()||null===i||(r=r.updateChild(si(t,".priority"),i)),r}}(i6(),e.writeTree_,t)}function ab(e){return e.visible}function ak(e,t,n){let r=ah.empty();for(let i=0;i<e.length;++i){let s=e[i];if(t(s)){let e;let t=s.path;if(s.snap)sl(n,t)?r=ap(r,e=sa(n,t),s.snap):sl(t,n)&&(e=sa(t,n),r=ap(r,i6(),s.snap.getChild(e)));else if(s.children){if(sl(n,t))r=af(r,e=sa(n,t),s.children);else if(sl(t,n)){if(ss(e=sa(t,n)))r=af(r,i6(),s.children);else{let t=n6(s.children,i7(e));if(t){let n=t.getChild(se(e));r=ap(r,i6(),n)}}}}else throw nO("WriteRecord should have .snap or .children")}}return r}function ax(e,t,n,r,i){if(r||i){let s=ay(e.visibleWrites,t);return!i&&aw(s)?n:i||null!=n||ag(s,i6())?aC(ak(e.allWrites,function(e){return(e.visible||i)&&(!r||!~r.indexOf(e.writeId))&&(sl(e.path,t)||sl(t,e.path))},t),n||sD.EMPTY_NODE):null}{let r=a_(e.visibleWrites,t);if(null!=r)return r;{let r=ay(e.visibleWrites,t);return aw(r)?n:null!=n||ag(r,i6())?aC(r,n||sD.EMPTY_NODE):null}}}function aI(e,t,n,r){return ax(e.writeTree,e.treePath,t,n,r)}function aE(e,t){return function(e,t,n){let r=sD.EMPTY_NODE,i=a_(e.visibleWrites,t);if(i)return i.isLeafNode()||i.forEachChild(sN,(e,t)=>{r=r.updateImmediateChild(e,t)}),r;
4if(!n)return av(ay(e.visibleWrites,t)).forEach(e=>{r=r.updateImmediateChild(e.name,e.node)}),r;{let i=ay(e.visibleWrites,t);return n.forEachChild(sN,(e,t)=>{let n=aC(ay(i,new i5(e)),t);r=r.updateImmediateChild(e,n)}),av(i).forEach(e=>{r=r.updateImmediateChild(e.name,e.node)}),r}}(e.writeTree,e.treePath,t)}function aT(e,t,n,r){return function(e,t,n,r,i){nR(r||i,"Either existingEventSnap or existingServerSnap must exist");let s=si(t,n);if(ag(e.visibleWrites,s))return null;{let t=ay(e.visibleWrites,s);return aw(t)?i.getChild(n):aC(t,i.getChild(n))}}(e.writeTree,e.treePath,t,n,r)}function aS(e,t){var n,r;return n=e.writeTree,r=si(e.treePath,t),a_(n.visibleWrites,r)}function aN(e,t,n){return function(e,t,n,r){let i=si(t,n),s=a_(e.visibleWrites,i);return null!=s?s:r.isCompleteForChild(n)?aC(ay(e.visibleWrites,i),r.getNode().getImmediateChild(n)):null}(e.writeTree,e.treePath,t,n)}function aP(e,t){return aR(si(e.treePath,t),e.writeTree)}function aR(e,t){return{treePath:e,writeTree:t}}class aO{constructor(){this.changeMap=new Map}trackChildChange(e){let t=e.type,n=e.childName;nR("child_added"===t||"child_changed"===t||"child_removed"===t,"Only child changes supported for tracking"),nR(".priority"!==n,"Only non-priority child changes can be tracked.");let r=this.changeMap.get(n);if(r){let i=r.type;if("child_added"===t&&"child_removed"===i)this.changeMap.set(n,sH(n,e.snapshotNode,r.snapshotNode));else if("child_removed"===t&&"child_added"===i)this.changeMap.delete(n);else if("child_removed"===t&&"child_changed"===i)this.changeMap.set(n,sW(n,r.oldSnap));else if("child_changed"===t&&"child_added"===i)this.changeMap.set(n,sB(n,e.snapshotNode));else if("child_changed"===t&&"child_changed"===i)this.changeMap.set(n,sH(n,e.snapshotNode,r.oldSnap));else throw nO("Illegal combination of changes: "+e+" occurred after "+r)}else this.changeMap.set(n,e)}getChanges(){return Array.from(this.changeMap.values())}}class aL{getCompleteChild(e){return null}getChildAfterChild(e,t,n){return null}}let aA=new aL;class aj{constructor(e,t,n=null){this.writes_=e,this.viewCache_=t,this.optCompleteServerCache_=n}getCompleteChild(e){let t=this.viewCache_.eventCache;if(t.isCompleteForChild(e))return t.getNode().getImmediateChild(e);{let t=null!=this.optCompleteServerCache_?new an(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return aN(this.writes_,e,t)}}getChildAfterChild(e,t,n){var r;let i=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:ac(this.viewCache_),s=function(e,t,n,r,i,s,a){let o;let l=ay(e.visibleWrites,t),c=a_(l,i6());if(null!=c)o=c;else{if(null==n)return[];o=aC(l,n)}if((o=o.withIndex(a)).isEmpty()||o.isLeafNode())return[];{let e=[],t=a.getCompare(),n=s?o.getReverseIteratorFrom(r,a):o.getIteratorFrom(r,a),i=n.getNext();for(;i&&e.length<1;)0!==t(i,r)&&e.push(i),i=n.getNext();return e}}((r=this.writes_).writeTree,r.treePath,i,t,0,n,e);return 0===s.length?null:s[0]}}function aD(e,t,n,r,i,s){let a=t.eventCache;if(null!=aS(r,n))return t;{let o,l;if(ss(n)){if(nR(t.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),t.serverCache.isFiltered()){let n=ac(t),i=aE(r,n instanceof sD?n:sD.EMPTY_NODE);o=e.filter.updateFullNode(t.eventCache.getNode(),i,s)}else{let n=aI(r,ac(t));o=e.filter.updateFullNode(t.eventCache.getNode(),n,s)}}else{let c=i7(n);if(".priority"===c){nR(1===i8(n),"Can't have a priority with additional path components");let i=a.getNode(),s=aT(r,n,i,l=t.serverCache.getNode());o=null!=s?e.filter.updatePriority(i,s):a.getNode()}else{let u;let d=se(n);if(a.isCompleteForChild(c)){l=t.serverCache.getNode();let e=aT(r,n,a.getNode(),l);u=null!=e?a.getNode().getImmediateChild(c).updateChild(d,e):a.getNode().getImmediateChild(c)}else u=aN(r,c,t.serverCache);o=null!=u?e.filter.updateChild(a.getNode(),c,u,d,i,s):a.getNode()}}return aa(t,o,a.isFullyInitialized()||ss(n),e.filter.filtersNodes())}}function aM(e,t,n,r,i,s,a,o){let l;let c=t.serverCache,u=a?e.filter:e.filter.getIndexedFilter();if(ss(n))l=u.updateFullNode(c.getNode(),r,null);else if(u.filtersNodes()&&!c.isFiltered()){let e=c.getNode().updateChild(n,r);l=u.updateFullNode(c.getNode(),e,null)}else{let e=i7(n);if(!c.isCompleteForPath(n)&&i8(n)>1)return t;let i=se(n),s=c.getNode().getImmediateChild(e).updateChild(i,r);l=".priority"===e?u.updatePriority(c.getNode(),s):u.updateChild(c.getNode(),e,s,i,aA,null)}let d=ao(t,l,c.isFullyInitialized()||ss(n),u.filtersNodes()),h=new aj(i,d,s);return aD(e,d,n,i,h,o)}function aF(e,t,n,r,i,s,a){let o,l;
4let c=t.eventCache,u=new aj(i,t,s);if(ss(n))l=e.filter.updateFullNode(t.eventCache.getNode(),r,a),o=aa(t,l,!0,e.filter.filtersNodes());else{let i=i7(n);if(".priority"===i)l=e.filter.updatePriority(t.eventCache.getNode(),r),o=aa(t,l,c.isFullyInitialized(),c.isFiltered());else{let s;let l=se(n),d=c.getNode().getImmediateChild(i);if(ss(l))s=r;else{let e=u.getCompleteChild(i);s=null!=e?".priority"===st(l)&&e.getChild(sr(l)).isEmpty()?e:e.updateChild(l,r):sD.EMPTY_NODE}o=d.equals(s)?t:aa(t,e.filter.updateChild(c.getNode(),i,s,l,u,a),c.isFullyInitialized(),e.filter.filtersNodes())}}return o}function aU(e,t){return e.eventCache.isCompleteForChild(t)}function a$(e,t,n){return n.foreach((e,n)=>{t=t.updateChild(e,n)}),t}function aV(e,t,n,r,i,s,a,o){if(t.serverCache.getNode().isEmpty()&&!t.serverCache.isFullyInitialized())return t;let l=t,c;c=ss(n)?r:new ad(null).setTree(n,r);let u=t.serverCache.getNode();return c.children.inorderTraversal((n,r)=>{if(u.hasChild(n)){let c=a$(e,t.serverCache.getNode().getImmediateChild(n),r);l=aM(e,l,new i5(n),c,i,s,a,o)}}),c.children.inorderTraversal((n,r)=>{let c=!t.serverCache.isCompleteForChild(n)&&null===r.value;if(!u.hasChild(n)&&!c){let c=a$(e,t.serverCache.getNode().getImmediateChild(n),r);l=aM(e,l,new i5(n),c,i,s,a,o)}}),l}class aq{constructor(e,t){this.query_=e,this.eventRegistrations_=[];let n=this.query_._queryParams,r=new sZ(n.getIndex()),i=n.loadsAllData()?new sZ(n.getIndex()):n.hasLimit()?new sG(n):new sK(n);this.processor_={filter:i};let s=t.serverCache,a=t.eventCache,o=r.updateFullNode(sD.EMPTY_NODE,s.getNode(),null),l=i.updateFullNode(sD.EMPTY_NODE,a.getNode(),null),c=new an(o,s.isFullyInitialized(),r.filtersNodes()),u=new an(l,a.isFullyInitialized(),i.filtersNodes());this.viewCache_=as(u,c),this.eventGenerator_=new ar(this.query_)}get query(){return this.query_}}function az(e){return 0===e.eventRegistrations_.length}
4function aB(e,t,n){let r=[];if(n){nR(null==t,"A cancel should cancel all event registrations.");let i=e.query._path;e.eventRegistrations_.forEach(e=>{let t=e.createCancelEvent(n,i);t&&r.push(t)})}if(t){let n=[];for(let r=0;r<e.eventRegistrations_.length;++r){let i=e.eventRegistrations_[r];if(i.matches(t)){if(t.hasAnyCallback()){n=n.concat(e.eventRegistrations_.slice(r+1));break}}else n.push(i)}e.eventRegistrations_=n}else e.eventRegistrations_=[];return r}function aW(e,t,n,r){var i,s;t.type===O.MERGE&&null!==t.source.queryId&&(nR(ac(e.viewCache_),"We should always have a full cache before handling merges"),nR(al(e.viewCache_),"Missing event cache, even though we have a server cache"));let a=e.viewCache_,o=function(e,t,n,r,i){let s,a;let o=new aO;if(n.type===O.OVERWRITE)n.source.fromUser?s=aF(e,t,n.path,n.snap,r,i,o):(nR(n.source.fromServer,"Unknown source."),a=n.source.tagged||t.serverCache.isFiltered()&&!ss(n.path),s=aM(e,t,n.path,n.snap,r,i,a,o));else if(n.type===O.MERGE){var l,c;let u;n.source.fromUser?(l=n.path,c=n.children,u=t,c.foreach((n,s)=>{let a=si(l,n);aU(t,i7(a))&&(u=aF(e,u,a,s,r,i,o))}),c.foreach((n,s)=>{let a=si(l,n);aU(t,i7(a))||(u=aF(e,u,a,s,r,i,o))}),s=u):(nR(n.source.fromServer,"Unknown source."),a=n.source.tagged||t.serverCache.isFiltered(),s=aV(e,t,n.path,n.children,r,i,a,o))}else if(n.type===O.ACK_USER_WRITE)s=n.revert?function(e,t,n,r,i,s){let a;if(null!=aS(r,n))return t;{let o;let l=new aj(r,t,i),c=t.eventCache.getNode();if(ss(n)||".priority"===i7(n)){let n;if(t.serverCache.isFullyInitialized())n=aI(r,ac(t));else{let e=t.serverCache.getNode();nR(e instanceof sD,"serverChildren would be complete if leaf node"),n=aE(r,e)}o=e.filter.updateFullNode(c,n,s)}else{let i=i7(n),u=aN(r,i,t.serverCache);null==u&&t.serverCache.isCompleteForChild(i)&&(u=c.getImmediateChild(i)),(o=null!=u?e.filter.updateChild(c,i,u,se(n),l,s):t.eventCache.getNode().hasChild(i)?e.filter.updateChild(c,i,sD.EMPTY_NODE,se(n),l,s):c).isEmpty()&&t.serverCache.isFullyInitialized()&&(a=aI(r,ac(t))).isLeafNode()&&(o=e.filter.updateFullNode(o,a,s))}return a=t.serverCache.isFullyInitialized()||null!=aS(r,i6()),aa(t,o,a,e.filter.filtersNodes())}}(e,t,n.path,r,i,o):function(e,t,n,r,i,s,a){if(null!=aS(i,n))return t;let o=t.serverCache.isFiltered(),l=t.serverCache;if(null!=r.value){if(ss(n)&&l.isFullyInitialized()||l.isCompleteForPath(n))return aM(e,t,n,l.getNode().getChild(n),i,s,o,a);if(!ss(n))return t;{let r=new ad(null);return l.getNode().forEachChild(s_,(e,t)=>{r=r.set(new i5(e),t)}),aV(e,t,n,r,i,s,o,a)}}{let c=new ad(null);return r.foreach((e,t)=>{let r=si(n,e);l.isCompleteForPath(r)&&(c=c.set(e,l.getNode().getChild(r)))}),aV(e,t,n,c,i,s,o,a)}}(e,t,n.path,n.affectedTree,r,i,o);else if(n.type===O.LISTEN_COMPLETE)s=function(e,t,n,r,i){let s=t.serverCache;return aD(e,ao(t,s.getNode(),s.isFullyInitialized()||ss(n),s.isFiltered()),n,r,aA,i)}(e,t,n.path,r,o);else throw nO("Unknown operation type: "+n.type);let u=o.getChanges();return function(e,t,n){let r=t.eventCache;if(r.isFullyInitialized()){let i=r.getNode().isLeafNode()||r.getNode().isEmpty(),s=al(e);!(n.length>0)&&e.eventCache.isFullyInitialized()&&(!i||r.getNode().equals(s))&&r.getNode().getPriority().equals(s.getPriority())||n.push(sz(al(t)))}}(t,s,u),{viewCache:s,changes:u}}(e.processor_,a,t,n,r);return i=e.processor_,nR((s=o.viewCache).eventCache.getNode().isIndexed(i.filter.getIndex()),"Event snap not indexed"),nR(s.serverCache.getNode().isIndexed(i.filter.getIndex()),"Server snap not indexed"),nR(o.viewCache.serverCache.isFullyInitialized()||!a.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),e.viewCache_=o.viewCache,aH(e,o.changes,o.viewCache.eventCache.getNode(),null)}function aH(e,t,n,r){let i=r?[r]:e.eventRegistrations_;return function(e,t,n,r){let i=[],s=[];return t.forEach(t=>{var n;"child_changed"===t.type&&e.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&s.push((n=t.childName,{type:"child_moved",snapshotNode:t.snapshotNode,childName:n}))}),ai(e,i,"child_removed",t,r,n),ai(e,i,"child_added",t,r,n),ai(e,i,"child_moved",s,r,n),ai(e,i,"child_changed",t,r,n),ai(e,i,"value",t,r,n),i}(e.eventGenerator_,t,n,i)}class aZ{constructor(){this.views=new Map}}function aK(e,t,n,r){let i=t.source.queryId;if(null!==i){let s=e.views.get(i);
4return nR(null!=s,"SyncTree gave us an op for an invalid query."),aW(s,t,n,r)}{let i=[];for(let s of e.views.values())i=i.concat(aW(s,t,n,r));return i}}function aG(e,t,n,r,i){let s=t._queryIdentifier,a=e.views.get(s);if(!a){let e=aI(n,i?r:null),s=!1;return e?s=!0:(e=r instanceof sD?aE(n,r):sD.EMPTY_NODE,s=!1),new aq(t,as(new an(e,s,!1),new an(r,i,!1)))}return a}function aY(e){let t=[];for(let n of e.views.values())n.query._queryParams.loadsAllData()||t.push(n);return t}function aJ(e,t){let n=null;for(let r of e.views.values())n=n||function(e,t){let n=ac(e.viewCache_);return n&&(e.query._queryParams.loadsAllData()||!ss(t)&&!n.getImmediateChild(i7(t)).isEmpty())?n.getChild(t):null}(r,t);return n}function aQ(e,t){if(t._queryParams.loadsAllData())return a0(e);{let n=t._queryIdentifier;return e.views.get(n)}}function aX(e){return null!=a0(e)}function a0(e){for(let t of e.views.values())if(t.query._queryParams.loadsAllData())return t;return null}let a1=1;class a2{constructor(e){this.listenProvider_=e,this.syncPointTree_=new ad(null),this.pendingWriteTree_={visibleWrites:ah.empty(),allWrites:[],lastWriteId:-1},this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function a4(e,t,n=!1){let r=function(e,t){for(let n=0;n<e.allWrites.length;n++){let r=e.allWrites[n];if(r.writeId===t)return r}return null}(e.pendingWriteTree_,t);if(!function(e,t){let n=e.allWrites.findIndex(e=>e.writeId===t);nR(n>=0,"removeWrite called with nonexistent writeId.");let r=e.allWrites[n];e.allWrites.splice(n,1);let i=r.visible,s=!1,a=e.allWrites.length-1;for(;i&&a>=0;){let t=e.allWrites[a];t.visible&&(a>=n&&function(e,t){if(e.snap)return sl(e.path,t);for(let n in e.children)if(e.children.hasOwnProperty(n)&&sl(si(e.path,n),t))return!0;return!1}(t,r.path)?i=!1:sl(r.path,t.path)&&(s=!0)),a--}return!!i&&(s?(e.visibleWrites=ak(e.allWrites,ab,i6()),e.allWrites.length>0?e.lastWriteId=e.allWrites[e.allWrites.length-1].writeId:e.lastWriteId=-1):r.snap?e.visibleWrites=am(e.visibleWrites,r.path):iR(r.children,t=>{e.visibleWrites=am(e.visibleWrites,si(r.path,t))}),!0)}(e.pendingWriteTree_,t))return[];{let t=new ad(null);return null!=r.snap?t=t.set(i6(),!0):iR(r.children,e=>{t=t.set(new i5(e),!0)}),a7(e,new s7(r.path,t,n))}}function a3(e,t,n){return a7(e,new ae(s5(),t,n))}function a9(e,t,n,r,i=!1){let s=t._path,a=e.syncPointTree_.get(s),o=[];
4if(a&&("default"===t._queryIdentifier||null!=aQ(a,t))){let l=function(e,t,n,r){let i=t._queryIdentifier,s=[],a=[],o=aX(e);if("default"===i)for(let[t,i]of e.views.entries())a=a.concat(aB(i,n,r)),az(i)&&(e.views.delete(t),i.query._queryParams.loadsAllData()||s.push(i.query));else{let t=e.views.get(i);t&&(a=a.concat(aB(t,n,r)),az(t)&&(e.views.delete(i),t.query._queryParams.loadsAllData()||s.push(t.query)))}return o&&!aX(e)&&s.push(new(nR(h,"Reference.ts has not been loaded"),h)(t._repo,t._path)),{removed:s,events:a}}(a,t,n,r);0===a.views.size&&(e.syncPointTree_=e.syncPointTree_.remove(s));let c=l.removed;if(o=l.events,!i){let n=-1!==c.findIndex(e=>e._queryParams.loadsAllData()),i=e.syncPointTree_.findOnPath(s,(e,t)=>aX(t));if(n&&!i){let t=e.syncPointTree_.subtree(s);if(!t.isEmpty()){let n=t.fold((e,t,n)=>{if(t&&aX(t))return[a0(t)];{let e=[];return t&&(e=aY(t)),iR(n,(t,n)=>{e=e.concat(n)}),e}});for(let t=0;t<n.length;++t){let r=n[t],i=r.query,s=a8(e,r);e.listenProvider_.startListening(os(i),oe(e,i),s.hashFn,s.onComplete)}}}i||!(c.length>0)||r||(n?e.listenProvider_.stopListening(os(t),null):c.forEach(t=>{let n=e.queryToTagMap.get(ot(t));e.listenProvider_.stopListening(os(t),n)}))}!function(e,t){for(let n=0;n<t.length;++n){let r=t[n];
4if(!r._queryParams.loadsAllData()){let t=ot(r),n=e.queryToTagMap.get(t);e.queryToTagMap.delete(t),e.tagToQueryMap.delete(n)}}}(e,c)}return o}function a5(e,t,n,r){let i=on(e,r);if(null==i)return[];{let r=or(i),s=r.path,a=r.queryId,o=sa(s,t);return oi(e,s,new ae(s6(a),o,n))}}function a6(e,t,n){let r=e.pendingWriteTree_,i=e.syncPointTree_.findOnPath(t,(e,n)=>{let r=aJ(n,sa(e,t));if(r)return r});return ax(r,t,i,n,!0)}function a7(e,t){var n;return function e(t,n,r,i){if(ss(t.path))return function e(t,n,r,i){let s=n.get(i6());null==r&&null!=s&&(r=aJ(s,i6()));let a=[];return n.children.inorderTraversal((n,s)=>{let o=r?r.getImmediateChild(n):null,l=aP(i,n),c=t.operationForChild(n);c&&(a=a.concat(e(c,s,o,l)))}),s&&(a=a.concat(aK(s,t,i,r))),a}(t,n,r,i);{let s=n.get(i6());null==r&&null!=s&&(r=aJ(s,i6()));let a=[],o=i7(t.path),l=t.operationForChild(o),c=n.children.get(o);if(c&&l){let t=r?r.getImmediateChild(o):null,n=aP(i,o);a=a.concat(e(l,c,t,n))}return s&&(a=a.concat(aK(s,t,i,r))),a}}(t,e.syncPointTree_,null,(n=e.pendingWriteTree_,aR(i6(),n)))}function a8(e,t){let n=t.query,r=oe(e,n);return{hashFn:()=>(t.viewCache_.serverCache.getNode()||sD.EMPTY_NODE).hash(),onComplete:t=>{if("ok"===t){var i;return r?function(e,t,n){let r=on(e,n);if(!r)return[];{let n=or(r),i=n.path,s=n.queryId,a=sa(i,t);return oi(e,i,new s8(s6(s),a))}}(e,n._path,r):(i=n._path,a7(e,new s8(s5(),i)))}{let r=function(e,t){let n="Unknown Error";"too_big"===e?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"===e?n="Client doesn't have permission to access the desired data.":"unavailable"===e&&(n="The service is unavailable");let r=Error(e+" at "+t._path.toString()+": "+n);return r.code=e.toUpperCase(),r}(t,n);return a9(e,n,null,r)}}}}function oe(e,t){let n=ot(t);return e.queryToTagMap.get(n)}function ot(e){return e._path.toString()+"$"+e._queryIdentifier}function on(e,t){return e.tagToQueryMap.get(t)}function or(e){let t=e.indexOf("$");return nR(-1!==t&&t<e.length-1,"Bad queryKey."),{queryId:e.substr(t+1),path:new i5(e.substr(0,t))}}function oi(e,t,n){let r=e.syncPointTree_.get(t);return nR(r,"Missing sync point for query tag that we're tracking"),aK(r,n,aR(t,e.pendingWriteTree_),null)}
4function os(e){return e._queryParams.loadsAllData()&&!e._queryParams.isDefault()?new(nR(p,"Reference.ts has not been loaded"),p)(e._repo,e._path):e}class oa{constructor(e){this.node_=e}getImmediateChild(e){return new oa(this.node_.getImmediateChild(e))}node(){return this.node_}}class oo{constructor(e,t){this.syncTree_=e,this.path_=t}getImmediateChild(e){let t=si(this.path_,e);return new oo(this.syncTree_,t)}node(){return a6(this.syncTree_,this.path_)}}let ol=function(e,t,n){return e&&"object"==typeof e?(nR(".sv"in e,"Unexpected leaf node or priority contents"),"string"==typeof e[".sv"])?oc(e[".sv"],t,n):"object"==typeof e[".sv"]?ou(e[".sv"],t):void nR(!1,"Unexpected server value: "+JSON.stringify(e,null,2)):e},oc=function(e,t,n){if("timestamp"===e)return n.timestamp;nR(!1,"Unexpected server value: "+e)},ou=function(e,t,n){e.hasOwnProperty("increment")||nR(!1,"Unexpected server value: "+JSON.stringify(e,null,2));let r=e.increment;"number"!=typeof r&&nR(!1,"Unexpected increment value: "+r);let i=t.node();if(nR(null!==i&&"u">typeof i,"Expected ChildrenNode.EMPTY_NODE for nulls"),!i.isLeafNode())return r;let s=i.getValue();return"number"!=typeof s?r:s+r};function od(e,t,n){let r;let i=ol(e.getPriority().val(),t.getImmediateChild(".priority"),n);if(!e.isLeafNode())return r=e,i!==e.getPriority().val()&&(r=r.updatePriority(new sT(i))),e.forEachChild(sN,(e,i)=>{let s=od(i,t.getImmediateChild(e),n);s!==i&&(r=r.updateImmediateChild(e,s))}),r;{let r=ol(e.getValue(),t,n);return r!==e.getValue()||i!==e.getPriority().val()?new sT(r,sU(i)):e}}class oh{constructor(e="",t=null,n={children:{},childCount:0}){this.name=e,this.parent=t,this.node=n}}function op(e,t){let n=t instanceof i5?t:new i5(t),r=e,i=i7(n);for(;null!==i;){let e=n6(r.node.children,i)||{children:{},childCount:0};r=new oh(i,r,e),i=i7(n=se(n))}return r}function of(e){return e.node.value}function om(e,t){e.node.value=t,function e(t){null!==t.parent&&function(t,n,r){let i=void 0===of(r)&&!og(r),s=n5(t.node.children,n);i&&s?(delete t.node.children[n],t.node.childCount--,e(t)):i||s||(t.node.children[n]=r.node,t.node.childCount++,e(t))}(t.parent,t.name,t)}(e)}function og(e){return e.node.childCount>0}function o_(e,t){iR(e.node.children,(n,r)=>{t(new oh(n,e,r))})}function ov(e){return new i5(null===e.parent?e.name:ov(e.parent)+"/"+e.name)}let oy=/[\[\].#$\/\u0000-\u001F\u007F]/,ow=/[\[\].#$\u0000-\u001F\u007F]/,oC=function(e){return"string"==typeof e&&0!==e.length&&!oy.test(e)},ob=function(e){return"string"==typeof e&&0!==e.length&&!ow.test(e)},ok=function(e,t,n){let r=n instanceof i5?new sc(n,e):n;if(void 0===t)throw Error(e+"contains undefined "+sd(r));if("function"==typeof t)throw Error(e+"contains a function "+sd(r)+" with contents = "+t.toString());if(ib(t))throw Error(e+"contains "+t.toString()+" "+sd(r));if("string"==typeof t&&t.length>3495253.3333333335&&ru(t)>10485760)throw Error(e+"contains a string greater than 10485760 utf8 bytes "+sd(r)+" ('"+t.substring(0,50)+"...')");if(t&&"object"==typeof t){let n=!1,i=!1;if(iR(t,(t,s)=>{if(".value"===t)n=!0;else if(".priority"!==t&&".sv"!==t&&(i=!0,!oC(t)))throw Error(e+" contains an invalid key ("+t+") "+sd(r)+'.  Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');r.parts_.length>0&&(r.byteLength_+=1),r.parts_.push(t),r.byteLength_+=ru(t),su(r),ok(e,s,r),function(e){let t=e.parts_.pop();e.byteLength_-=ru(t),e.parts_.length>0&&(e.byteLength_-=1)}(r)}),n&&i)throw Error(e+' contains ".value" child '+sd(r)+" in addition to actual children.")}},ox=function(e,t,n,r){if(!ob(n))throw Error(rl(e,t)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')},oI=function(e,t,n,r){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),ox(e,t,n)},oE=function(e,t){var n;let r=t.path.toString();if("string"!=typeof t.repoInfo.host||0===t.repoInfo.host.length||!oC(t.repoInfo.namespace)&&"localhost"!==t.repoInfo.host.split(":")[0]||0!==r.length&&((n=r)&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),!ob(n)))throw Error(rl(e,"url")+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')};class oT{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function oS(e,t,n){(function(e,t){let n=null;for(let r=0;r<t.length;r++){let i=t[r],s=i.getPath();null===n||so(s,n.path)||(e.eventLists_.push(n),n=null),null===n&&(n={events:[],path:s}),n.events.push(i)}n&&e.eventLists_.push(n)})(e,n),function(e,t){e.recursionDepth_++;let n=!0;for(let r=0;r<e.eventLists_.length;r++){let i=e.eventLists_[r];i&&(t(i.path)?(function(e){for(let t=0;t<e.events.length;t++){let n=e.events[t];if(null!==n){e.events[t]=null;let r=n.getEventRunner();ih&&ig("event: "+n.toString()),ij(r)}}}(e.eventLists_[r]),e.eventLists_[r]=null):n=!1)}n&&(e.eventLists_=[]),e.recursionDepth_--}(e,e=>sl(e,t)||sl(t,e))}class oN{constructor(e,t,n,r){this.repoInfo_=e,this.forceRestClient_=t,this.authTokenProvider_=n,this.appCheckProvider_=r,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new oT,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=s1(),this.transactionQueueTree_=new oh,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function oP(e){var t;return(t=t={timestamp:function(e){let t=e.infoData_.getNode(new i5(".info/serverTimeOffset")).val()||0;return new Date().getTime()+t}(e)}).timestamp=t.timestamp||new Date().getTime(),t}function oR(e,t,n,r,i){e.dataUpdateCount++;let s=new i5(t);n=e.interceptServerDataCallback_?e.interceptServerDataCallback_(t,n):n;let a=[];if(i){if(r){let t=n8(n,e=>sU(e));a=function(e,t,n,r){let i=on(e,r);if(!i)return[];{let r=or(i),s=r.path,a=r.queryId,o=sa(s,t),l=ad.fromObject(n);return oi(e,s,new at(s6(a),o,l))}}(e.serverSyncTree_,s,t,i)}else{let t=sU(n);a=a5(e.serverSyncTree_,s,t,i)}}else if(r){let t=n8(n,e=>sU(e));
4a=function(e,t,n){let r=ad.fromObject(n);return a7(e,new at(s5(),t,r))}(e.serverSyncTree_,s,t)}else{let t=sU(n);a=a3(e.serverSyncTree_,s,t)}let o=s;a.length>0&&(o=oD(e,s)),oS(e.eventQueue_,o,a)}function oO(e,t){oL(e,"connected",t),!1===t&&function(e){oA(e,"onDisconnectEvents");let t=oP(e),n=s1();s2(e.onDisconnect_,i6(),(r,i)=>{let s=od(i,new oo(e.serverSyncTree_,r),t);!function e(t,n,r){if(ss(n))t.value=r,t.children.clear();else if(null!==t.value)t.value=t.value.updateChild(n,r);else{let i=i7(n);t.children.has(i)||t.children.set(i,s1()),e(t.children.get(i),n=se(n),r)}}(n,r,s)});let r=[];s2(n,i6(),(t,n)=>{r=r.concat(a3(e.serverSyncTree_,t,n));let i=function(e,t){let n=ov(oM(e,t)),r=op(e.transactionQueueTree_,t);return function(e,t,n){let r=e.parent;for(;null!==r;){if(t(r))return!0;r=r.parent}}(r,t=>{o$(e,t)}),o$(e,r),function e(t,n,r,i){r&&n(t),o_(t,t=>{e(t,n,!0)})}(r,t=>{o$(e,t)}),n}(e,t);oD(e,i)}),e.onDisconnect_=s1(),oS(e.eventQueue_,i6(),r)}(e)}function oL(e,t,n){let r=new i5("/.info/"+t),i=sU(n);e.infoData_.updateSnapshot(r,i);let s=a3(e.infoSyncTree_,r,i);oS(e.eventQueue_,r,s)}function oA(e,...t){let n="";e.persistentConnection_&&(n=e.persistentConnection_.id+":"),ig(n,...t)}function oj(e,t,n){return a6(e.serverSyncTree_,t,n)||sD.EMPTY_NODE}function oD(e,t){let n=oM(e,t),r=ov(n),i=oF(e,n);return function(e,t,n){if(0===t.length)return;let r=[],i=[],s=t.filter(e=>0===e.status).map(e=>e.currentWriteId);for(let a=0;a<t.length;a++){let o=t[a],l=sa(n,o.path),c=!1,u;if(nR(null!==l,"rerunTransactionsUnderNode_: relativePath should not be null."),4===o.status)c=!0,u=o.abortReason,i=i.concat(a4(e.serverSyncTree_,o.currentWriteId,!0));else if(0===o.status){if(o.retryCount>=25)c=!0,u="maxretry",i=i.concat(a4(e.serverSyncTree_,o.currentWriteId,!0));else{let n=oj(e,o.path,s);o.currentInputSnapshot=n;let r=t[a].update(n.val());if(void 0!==r){ok("transaction failed: Data returned ",r,o.path);let t=sU(r);"object"==typeof r&&null!=r&&n5(r,".priority")||(t=t.updatePriority(n.getPriority()));let a=o.currentWriteId,l=oP(e),c=od(t,new oa(n),l);o.currentOutputSnapshotRaw=t,o.currentOutputSnapshotResolved=c,o.currentWriteId=e.nextWriteId_++,s.splice(s.indexOf(a),1),i=(i=i.concat(function(e,t,n,r,i){var s,a;return s=e.pendingWriteTree_,a=i,nR(r>s.lastWriteId,"Stacking an older write on top of newer ones"),void 0===a&&(a=!0),s.allWrites.push({path:t,snap:n,writeId:r,visible:a}),a&&(s.visibleWrites=ap(s.visibleWrites,t,n)),s.lastWriteId=r,i?a7(e,new ae(s9(),t,n)):[]}(e.serverSyncTree_,o.path,c,o.currentWriteId,o.applyLocally))).concat(a4(e.serverSyncTree_,a,!0))}else c=!0,u="nodata",i=i.concat(a4(e.serverSyncTree_,o.currentWriteId,!0))}}oS(e.eventQueue_,n,i),i=[],c&&(t[a].status=2,setTimeout(t[a].unwatcher,Math.floor(0)),t[a].onComplete&&("nodata"===u?r.push(()=>t[a].onComplete(null,!1,t[a].currentInputSnapshot)):r.push(()=>t[a].onComplete(Error(u),!1,null))))}oU(e,e.transactionQueueTree_);for(let e=0;e<r.length;e++)ij(r[e]);(function e(t,n=t.transactionQueueTree_){if(n||oU(t,n),of(n)){let r=oF(t,n);nR(r.length>0,"Sending zero length transaction queue"),r.every(e=>0===e.status)&&function(t,n,r){let i=oj(t,n,r.map(e=>e.currentWriteId)),s=i,a=i.hash();for(let e=0;e<r.length;e++){let t=r[e];nR(0===t.status,"tryToSendTransactionQueue_: items in queue should all be run."),t.status=1,t.retryCount++;let i=sa(n,t.path);s=s.updateChild(i,t.currentOutputSnapshotRaw)}let o=s.val(!0);t.server_.put(n.toString(),o,i=>{oA(t,"transaction put response",{path:n.toString(),status:i});let s=[];if("ok"===i){let i=[];for(let e=0;e<r.length;e++)r[e].status=2,s=s.concat(a4(t.serverSyncTree_,r[e].currentWriteId)),r[e].onComplete&&i.push(()=>r[e].onComplete(null,!0,r[e].currentOutputSnapshotResolved)),r[e].unwatcher();oU(t,op(t.transactionQueueTree_,n)),e(t,t.transactionQueueTree_),oS(t.eventQueue_,n,s);for(let e=0;e<i.length;e++)ij(i[e])}else{if("datastale"===i)for(let e=0;e<r.length;e++)3===r[e].status?r[e].status=4:r[e].status=0;else{iw("transaction at "+n.toString()+" failed: "+i);for(let e=0;e<r.length;e++)r[e].status=4,r[e].abortReason=i}oD(t,n)}},a)}(t,ov(n),r)}else og(n)&&o_(n,n=>{e(t,n)})})(e,e.transactionQueueTree_)}(e,i,r),r}function oM(e,t){let n,r=e.transactionQueueTree_;
4for(n=i7(t);null!==n&&void 0===of(r);)r=op(r,n),n=i7(t=se(t));return r}function oF(e,t){let n=[];return function e(t,n,r){let i=of(n);if(i)for(let e=0;e<i.length;e++)r.push(i[e]);o_(n,n=>{e(t,n,r)})}(e,t,n),n.sort((e,t)=>e.order-t.order),n}function oU(e,t){let n=of(t);if(n){let e=0;for(let t=0;t<n.length;t++)2!==n[t].status&&(n[e]=n[t],e++);n.length=e,om(t,n.length>0?n:void 0)}o_(t,t=>{oU(e,t)})}function o$(e,t){let n=of(t);if(n){let r=[],i=[],s=-1;for(let t=0;t<n.length;t++)3===n[t].status||(1===n[t].status?(nR(s===t-1,"All SENT items should be at beginning of queue."),s=t,n[t].status=3,n[t].abortReason="set"):(nR(0===n[t].status,"Unexpected transaction status in abort"),n[t].unwatcher(),i=i.concat(a4(e.serverSyncTree_,n[t].currentWriteId,!0)),n[t].onComplete&&r.push(n[t].onComplete.bind(null,Error("set"),!1,null))));-1===s?om(t,void 0):n.length=s+1,oS(e.eventQueue_,ov(t),i);for(let e=0;e<r.length;e++)ij(r[e])}}let oV=function(e,t){let n=oq(e),r=n.namespace;"firebase.com"===n.domain&&iy(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),r&&"undefined"!==r||"localhost"===n.domain||iy("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),n.secure||iC();let i="ws"===n.scheme||"wss"===n.scheme;return{repoInfo:new iz(n.host,n.secure,r,i,t,"",r!==n.subdomain),path:new i5(n.pathString)}},oq=function(e){let t="",n="",r="",i="",s="",a=!0,o="https",l=443;if("string"==typeof e){let c=e.indexOf("//");c>=0&&(o=e.substring(0,c-1),e=e.substring(c+2));let u=e.indexOf("/");-1===u&&(u=e.length);let d=e.indexOf("?");-1===d&&(d=e.length),t=e.substring(0,Math.min(u,d)),u<d&&(i=function(e){let t="",n=e.split("/");for(let e=0;e<n.length;e++)if(n[e].length>0){let r=n[e];try{r=decodeURIComponent(r.replace(/\+/g," "))}catch{}t+="/"+r}return t}(e.substring(u,d)));let h=function(e){let t={};for(let n of("?"===e.charAt(0)&&(e=e.substring(1)),e.split("&"))){if(0===n.length)continue;let r=n.split("=");2===r.length?t[decodeURIComponent(r[0])]=decodeURIComponent(r[1]):iw(`Invalid query segment '${n}' in query '${e}'`)}return t}(e.substring(Math.min(e.length,d)));(c=t.indexOf(":"))>=0?(a="https"===o||"wss"===o,l=parseInt(t.substring(c+1),10)):c=t.length;let p=t.slice(0,c);if("localhost"===p.toLowerCase())n="localhost";else if(p.split(".").length<=2)n=p;else{let e=t.indexOf(".");r=t.substring(0,e).toLowerCase(),n=t.substring(e+1),s=r}"ns"in h&&(s=h.ns)}return{host:t,port:l,domain:n,subdomain:r,secure:a,scheme:o,pathString:i,namespace:s}};class oz{constructor(e,t,n,r){this.eventType=e,this.eventRegistration=t,this.snapshot=n,this.prevName=r}getPath(){let e=this.snapshot.ref;return"value"===this.eventType?e._path:e.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+n2(this.snapshot.exportVal())}}class oB{constructor(e,t,n){this.eventRegistration=e,this.error=t,this.path=n}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}class oW{constructor(e,t){this.snapshotCallback=e,this.cancelCallback=t}onValue(e,t){this.snapshotCallback.call(null,e,t)}onCancel(e){return nR(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||void 0!==this.snapshotCallback.userCallback&&this.snapshotCallback.userCallback===e.snapshotCallback.userCallback&&this.snapshotCallback.context===e.snapshotCallback.context}}class oH{constructor(e,t,n,r){this._repo=e,this._path=t,this._queryParams=n,this._orderByCalled=r}get key(){return ss(this._path)?null:st(this._path)}get ref(){return new oZ(this._repo,this._path)}get _queryIdentifier(){let e=iN(sQ(this._queryParams));return"{}"===e?"default":e}get _queryObject(){return sQ(this._queryParams)}isEqual(e){if(!((e=rd(e))instanceof oH))return!1;let t=this._repo===e._repo,n=so(this._path,e._path),r=this._queryIdentifier===e._queryIdentifier;return t&&n&&r}toJSON(){return this.toString()}toString(){return this._repo.toString()+function(e){let t="";for(let n=e.pieceNum_;n<e.pieces_.length;n++)""!==e.pieces_[n]&&(t+="/"+encodeURIComponent(String(e.pieces_[n])));return t||"/"}(this._path)}}let oZ=class e extends oH{constructor(e,t){super(e,t,new sY,!1)}get parent(){let t=sr(this._path);return null===t?null:new e(this._repo,t)}get root(){let e=this;for(;null!==e.parent;)e=e.parent;return e}};class oK{constructor(e,t,n){this._node=e,this.ref=t,this._index=n}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(e){let t=new i5(e),n=oG(this.ref,e);return new oK(this._node.getChild(t),n,sN)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(e){return!this._node.isLeafNode()&&!!this._node.forEachChild(this._index,(t,n)=>e(new oK(n,oG(this.ref,t),sN)))}hasChild(e){let t=new i5(e);return!this._node.getChild(t).isEmpty()}hasChildren(){return!this._node.isLeafNode()&&!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function oG(e,t){return null===i7((e=rd(e))._path)?oI("child","path",t):ox("child","path",t),new oZ(e._repo,si(e._path,t))}class oY{constructor(e){this.callbackContext=e}respondsTo(e){return"value"===e}createEvent(e,t){let n=t._queryParams.getIndex();return new oz("value",this,new oK(e.snapshotNode,new oZ(t._repo,t._path),n))}getEventRunner(e){return"cancel"===e.getEventType()?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,null)}createCancelEvent(e,t){return this.callbackContext.hasCancelCallback?new oB(this,e,t):null}matches(e){return e instanceof oY&&(!e.callbackContext||!this.callbackContext||e.callbackContext.matches(this.callbackContext))}hasAnyCallback(){return null!==this.callbackContext}}nR(!h,"__referenceConstructor has already been defined"),h=oZ,nR(!p,"__referenceConstructor has already been defined"),p=oZ;let oJ={};class oQ{constructor(e,t){this._repoInternal=e,this.app=t,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(function(e,t,n){if(e.stats_=iK(e.repoInfo_),e.forceRestClient_||("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0)e.server_=new sX(e.repoInfo_,(t,n,r,i)=>{oR(e,t,n,r,i)},e.authTokenProvider_,e.appCheckProvider_),setTimeout(()=>
4oO(e,!0),0);else{if("u">typeof n&&null!==n){if("object"!=typeof n)throw Error("Only objects are supported for option databaseAuthVariableOverride");try{n2(n)}catch(e){throw Error("Invalid authOverride provided: "+e)}}e.persistentConnection_=new sp(e.repoInfo_,t,(t,n,r,i)=>{oR(e,t,n,r,i)},t=>{oO(e,t)},t=>{iR(t,(t,n)=>{oL(e,t,n)})},e.authTokenProvider_,e.appCheckProvider_,n),e.server_=e.persistentConnection_}e.authTokenProvider_.addTokenChangeListener(t=>{e.server_.refreshAuthToken(t)}),e.appCheckProvider_.addTokenChangeListener(t=>{e.server_.refreshAppCheckToken(t.token)}),e.statsReporter_=function(e,t){let n=e.toString();return iZ[n]||(iZ[n]=t()),iZ[n]}(e.repoInfo_,()=>new s3(e.stats_,e.server_)),e.infoData_=new s0,e.infoSyncTree_=new a2({startListening:(t,n,r,i)=>{let s=[],a=e.infoData_.getNode(t._path);return a.isEmpty()||(s=a3(e.infoSyncTree_,t._path,a),setTimeout(()=>{i("ok")},0)),s},stopListening:()=>{}}),oL(e,"connected",!1),e.serverSyncTree_=new a2({startListening:(t,n,r,i)=>(e.server_.listen(t,r,n,(n,r)=>{let s=i(n,r);oS(e.eventQueue_,t._path,s)}),[]),stopListening:(t,n)=>{e.server_.unlisten(t,n)}})}(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new oZ(this._repo,i6())),this._rootInternal}_delete(){return null!==this._rootInternal&&(function(e,t){let n=oJ[t];n&&n[e.key]===e||iy(`Database ${t}(${e.repoInfo_}) has already been deleted.`),e.persistentConnection_&&e.persistentConnection_.interrupt("repo_interrupt"),delete n[e.key]}(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){null===this._rootInternal&&iy("Cannot call "+e+" on a deleted database.")}}function oX(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function o0(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}sp.prototype.simpleListen=function(e,t){this.sendRequest("q",{p:e},t)},sp.prototype.echo=function(e,t){this.sendRequest("echo",{d:e},t)},it=rG,rB(new rh("database",(e,{instanceIdentifier:t})=>(function(e,t,n,r,i){var s,a;let o,l,c=r||e.options.databaseURL;void 0===c&&(e.options.projectId||iy("Can't determine Firebase Database URL. Be sure to include  a Project ID when calling firebase.initializeApp()."),ig("Using default host for project ",e.options.projectId),c=`${e.options.projectId}-default-rtdb.firebaseio.com`);let u=oV(c,void 0),d=u.repoInfo,h;"u">typeof B&&B.env&&(h=B.env.FIREBASE_DATABASE_EMULATOR_HOST),h?d=(u=oV(c=`http://${h}?ns=${d.namespace}`,void 0)).repoInfo:u.repoInfo.secure;let p=new iF(e.name,e.options,t);return oE("Invalid Firebase Database URL",u),ss(u.path)||iy("Database URL must point to the root of a Firebase Database (not including a child path)."),new oQ((s=d,a=new iM(e.name,n),(o=oJ[e.name])||(o={},oJ[e.name]=o),(l=o[s.toURLString()])&&iy("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),l=new oN(s,!1,p,a),o[s.toURLString()]=l,l),e)})(e.getProvider("app").getImmediate(),e.getProvider("auth-internal"),e.getProvider("app-check-internal"),t),"PUBLIC").setMultipleInstances(!0)),rQ(r8,ie,void 0),rQ(r8,ie,"esm2017"),rQ("firebase","10.14.1","app");let o1=new nX("auth","Firebase",o0()),o2=new rw("@firebase/auth");function o4(e,...t){o2.logLevel<=R.ERROR&&o2.error(`Auth (${rG}): ${e}`,...t)}function o3(e,...t){throw o7(e,...t)}function o9(e,...t){return o7(e,...t)}function o5(e,t,n){return new nX("auth","Firebase",Object.assign(Object.assign({},o0()),{[t]:n})).create(t,{appName:e.name})}function o6(e){return o5(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function o7(e,...t){if("string"!=typeof e){let n=t[0],r=[...t.slice(1)];
4return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return o1.create(e,...t)}function o8(e,t,...n){if(!e)throw o7(t,...n)}function le(e){let t="INTERNAL ASSERTION FAILED: "+e;throw o4(t),Error(t)}function lt(){var e;return"u">typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function ln(){var e;return"u">typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}class lr{constructor(e,t){var n;this.shortDelay=e,this.longDelay=t,n="Short delay should be less than long delay!",t>e||le(n),this.isMobile=nY()||nJ()}get(){return!("u">typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&("http:"===ln()||"https:"===ln()||function(){let e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}()||"connection"in navigator))||navigator.onLine?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function li(e,t){var n,r;n=e.emulator,r="Emulator should always be set here",n||le(r);let{url:i}=e.emulator;return t?`${i}${t.startsWith("/")?t.slice(1):t}`:i}class ls{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"u">typeof self&&"fetch"in self?self.fetch:"u">typeof globalThis&&globalThis.fetch?globalThis.fetch:"u">typeof fetch?fetch:void le("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"u">typeof self&&"Headers"in self?self.Headers:"u">typeof globalThis&&globalThis.Headers?globalThis.Headers:"u">typeof Headers?Headers:void le("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"u">typeof self&&"Response"in self?self.Response:"u">typeof globalThis&&globalThis.Response?globalThis.Response:"u">typeof Response?Response:void le("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}let la={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-rec
4aptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},lo=new lr(3e4,6e4);function ll(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function lc(e,t,n,r,i={}){return lu(e,i,async()=>{let i={},s={};r&&("GET"===t?s=r:i={body:JSON.stringify(r)});let a=rn(Object.assign({key:e.config.apiKey},s)).slice(1),o=await e._getAdditionalHeaders();o["Content-Type"]="application/json",e.languageCode&&(o["X-Firebase-Locale"]=e.languageCode);let l=Object.assign({method:t,headers:o},i);return"u">typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(l.referrerPolicy="no-referrer"),ls.fetch()(lh(e,e.config.apiHost,n,a),l)})}async function lu(e,t,n){e._canInitEmulator=!1;let r=Object.assign(Object.assign({},la),t);try{let t=new lp(e),i=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();let s=await i.json();if("needConfirmation"in s)throw lf(e,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{let[t,n]=(i.ok?s.errorMessage:s.error.message).split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===t)throw lf(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===t)throw lf(e,"email-already-in-use",s);if("USER_DISABLED"===t)throw lf(e,"user-disabled",s);let a=r[t]||t.toLowerCase().replace(/[_\s]+/g,"-");if(n)throw o5(e,a,n);o3(e,a)}}catch(t){if(t instanceof nQ)throw t;o3(e,"network-request-failed",{message:String(t)})}}async function ld(e,t,n,r,i={}){let s=await lc(e,t,n,r,i);return"mfaPendingCredential"in s&&o3(e,"multi-factor-auth-required",{_serverResponse:s}),s}function lh(e,t,n,r){let i=`${t}${n}?${r}`;return e.config.emulator?li(e.config,i):`${e.config.apiScheme}://${i}`}class lp{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(o9(this.auth,"network-request-failed")),lo.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function lf(e,t,n){let r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);let i=o9(e,t,r);return i.customData._tokenResponse=n,i}function lm(e){return void 0!==e&&void 0!==e.enterprise}class lg{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(let t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return function(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}(t.enforcementState);return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}}async function l_(e,t){return lc(e,"GET","/v2/recaptchaConfig",ll(e,t))}async function lv(e,t){return lc(e,"POST","/v1/accounts:delete",t)}async function ly(e,t){return lc(e,"POST","/v1/accounts:lookup",t)}function lw(e){if(e)try{let t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function lC(e,t=!1){let n=rd(e),r=await n.getIdToken(t),i=lk(r);o8(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s="object"==typeof i.firebase?i.firebase:void 0,a=null==s?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:lw(lb(i.auth_time)),issuedAtTime:lw(lb(i.iat)),expirationTime:lw(lb(i.exp)),signInProvider:a||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}function lb(e){return 1e3*Number(e)}function lk(e){let[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return o4("JWT malformed, contained fewer than 3 sections"),null;try{let e=nU(n);return e?JSON.parse(e):(o4("Failed to decode base64 JWT payload"),null)}catch(e){return o4("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}function lx(e){let t=lk(e);return o8(t,"internal-error"),o8("u">typeof t.exp,"internal-error"),o8("u">typeof t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}async function lI(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof nQ&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class lE{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(!e)return this.errorBackoff=3e4,Math.max(0,(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5);{let e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}}schedule(e=!1){if(!this.isRunning)return;let t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(null==e?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}class lT{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=lw(this.lastLoginAt),this.creationTime=lw(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function lS(e){var t;let n=e.auth,r=await e.getIdToken(),i=await lI(e,ly(n,{idToken:r}));o8(null==i?void 0:i.users.length,n,"internal-error");let s=i.users[0];e._notifyReloadListener(s);let a=!(null===(t=s.providerUserInfo)||void 0===t)&&t.length?lP(s.providerUserInfo):[],o=[...e.providerData.filter(e=>!a.some(t=>t.providerId===e.providerId)),...a],l=e.isAnonymous,c=!(e.email&&s.passwordHash)&&!(null!=o&&o.length);Object.assign(e,{uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new lT(s.createdAt,s.lastLoginAt),isAnonymous:!!l&&c})}async function lN(e){let t=rd(e);await lS(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function lP(e){return e.map(e=>{var{providerId:t}=e,n=oX(e,["providerId"]);
4return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})}async function lR(e,t){let n=await lu(e,{},async()=>{let n=rn({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:i}=e.config,s=lh(e,r,"/v1/token",`key=${i}`),a=await e._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",ls.fetch()(s,{method:"POST",headers:a,body:n})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function lO(e,t){return lc(e,"POST","/v2/accounts:revokeToken",ll(e,t))}class lL{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){o8(e.idToken,"internal-error"),o8("u">typeof e.idToken,"internal-error"),o8("u">typeof e.refreshToken,"internal-error");let t="expiresIn"in e&&"u">typeof e.expiresIn?Number(e.expiresIn):lx(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){o8(0!==e.length,"internal-error");let t=lx(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(o8(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){let{accessToken:n,refreshToken:r,expiresIn:i}=await lR(e,t);this.updateTokensAndExpiration(n,r,Number(i))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){let{refreshToken:n,accessToken:r,expirationTime:i}=t,s=new lL;return n&&(o8("string"==typeof n,"internal-error",{appName:e}),s.refreshToken=n),r&&(o8("string"==typeof r,"internal-error",{appName:e}),s.accessToken=r),i&&(o8("number"==typeof i,"internal-error",{appName:e}),s.expirationTime=i),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new lL,this.toJSON())}_performRefresh(){return le("not implemented")}}function lA(e,t){o8("string"==typeof e||typeof e>"u","internal-error",{appName:t})}let lj=class e{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,i=oX(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new lE(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new lT(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){let t=await lI(this,this.stsTokenManager.getToken(this.auth,e));return o8(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return lC(this,e)}reload(){return lN(this)}_assign(e){this!==e&&(o8(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(t){let n=new e(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){o8(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await lS(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(rH(this.auth.app))return Promise.reject(o6(this.auth));let e=await this.getIdToken();return await lI(this,lv(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
4nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,n){var r,i,s,a,o,l,c,u;let d=null!==(r=n.displayName)&&void 0!==r?r:void 0,h=null!==(i=n.email)&&void 0!==i?i:void 0,p=null!==(s=n.phoneNumber)&&void 0!==s?s:void 0,f=null!==(a=n.photoURL)&&void 0!==a?a:void 0,m=null!==(o=n.tenantId)&&void 0!==o?o:void 0,g=null!==(l=n._redirectEventId)&&void 0!==l?l:void 0,_=null!==(c=n.createdAt)&&void 0!==c?c:void 0,v=null!==(u=n.lastLoginAt)&&void 0!==u?u:void 0,{uid:y,emailVerified:w,isAnonymous:C,providerData:b,stsTokenManager:k}=n;o8(y&&k,t,"internal-error");let x=lL.fromJSON(this.name,k);o8("string"==typeof y,t,"internal-error"),lA(d,t.name),lA(h,t.name),o8("boolean"==typeof w,t,"internal-error"),o8("boolean"==typeof C,t,"internal-error"),lA(p,t.name),lA(f,t.name),lA(m,t.name),lA(g,t.name),lA(_,t.name),lA(v,t.name);let I=new e({uid:y,auth:t,email:h,emailVerified:w,displayName:d,isAnonymous:C,photoURL:f,phoneNumber:p,tenantId:m,stsTokenManager:x,createdAt:_,lastLoginAt:v});return b&&Array.isArray(b)&&(I.providerData=b.map(e=>Object.assign({},e))),g&&(I._redirectEventId=g),I}static async _fromIdTokenResponse(t,n,r=!1){let i=new lL;i.updateFromServerResponse(n);let s=new e({uid:n.localId,auth:t,stsTokenManager:i,isAnonymous:r});return await lS(s),s}static async _fromGetAccountInfoResponse(t,n,r){let i=n.users[0];o8(void 0!==i.localId,"internal-error");let s=void 0!==i.providerUserInfo?lP(i.providerUserInfo):[],a=!(i.email&&i.passwordHash)&&!(null!=s&&s.length),o=new lL;o.updateFromIdToken(r);let l=new e({uid:i.localId,auth:t,stsTokenManager:o,isAnonymous:a});return Object.assign(l,{uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new lT(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!(null!=s&&s.length)}),l}},lD=new Map;function lM(e){var t,n;t="Expected a class definition",e instanceof Function||le(t);let r=lD.get(e);return r?(n="Instance stored in cache mismatched with class",r instanceof e||le(n)):(r=new e,lD.set(e,r)),r}class lF{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){let t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}function lU(e,t,n){return`firebase:${e}:${t}:${n}`}lF.type="NONE";let l$=class e{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;let{config:r,name:i}=this.auth;this.fullUserKey=lU(this.userKey,r.apiKey,i),this.fullPersistenceKey=lU("persistence",r.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);return e?lj._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,n,r="authUser"){if(!n.length)return new e(lM(lF),t,r);let i=(await Promise.all(n.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e),s=i[0]||lM(lF),a=lU(r,t.config.apiKey,t.name),o=null;for(let e of n)try{let n=await e._get(a);if(n){let r=lj._fromJSON(t,n);e!==s&&(o=r),s=e;break}}catch{}let l=i.filter(e=>e._shouldAllowMigration);return s._shouldAllowMigration&&l.length&&(s=l[0],o&&await s._set(a,o.toJSON()),await Promise.all(n.map(async e=>{if(e!==s)try{await e._remove(a)}catch{}}))),new e(s,t,r)}};function lV(e){let t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(lW(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(lq(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(lZ(t))return"Blackberry";if(lK(t))return"Webos";if(lz(t))return"Safari";if((t.includes("chrome/")||lB(t))&&!t.includes("edge/"))return"Chrome";if(lH(t))return"Android";{let t=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);if((null==t?void 0:t.length)===2)return t[1]}return"Other"}function lq(e=nG()){return/firefox\//i.test(e)}function lz(e=nG()){let t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function lB(e=nG()){return/crios\//i.test(e)}function lW(e=nG()){return/iemobile/i.test(e)}function lH(e=nG()){return/android/i.test(e)}function lZ(e=nG()){return/blackberry/i.test(e)}function lK(e=nG()){return/webos/i.test(e)}function lG(e=nG()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function lY(e=nG()){return lG(e)||lH(e)||lK(e)||lZ(e)||/windows phone/i.test(e)||lW(e)}function lJ(e,t=[]){let n;switch(e){case"Browser":n=lV(nG());break;case"Worker":n=`${lV(nG())}-${e}`;break;default:n=e}let r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${rG}/${r}`}class lQ{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let n=t=>new Promise((n,r)=>{try{let r=e(t);n(r)}catch(e){r(e)}});n.onAbort=t,this.queue.push(n);let r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){for(let e of(t.reverse(),t))try{e()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}async function lX(e,t={}){return lc(e,"GET","/v2/passwordPolicy",ll(e,t))}class l0{constructor(e){var t,n,r,i;let s=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=s.minPasswordLength)&&void 0!==t?t:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(r=null===(n=e.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==r?r:"",this.forceUpgradeOnSignin=null!==(i=e.forceUpgradeOnSignin)&&void 0!==i&&i,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,r,i,s,a;let o={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,o),this.validatePasswordCharacterOptions(e,o),o.isValid&&
4(o.isValid=null===(t=o.meetsMinPasswordLength)||void 0===t||t),o.isValid&&(o.isValid=null===(n=o.meetsMaxPasswordLength)||void 0===n||n),o.isValid&&(o.isValid=null===(r=o.containsLowercaseLetter)||void 0===r||r),o.isValid&&(o.isValid=null===(i=o.containsUppercaseLetter)||void 0===i||i),o.isValid&&(o.isValid=null===(s=o.containsNumericCharacter)||void 0===s||s),o.isValid&&(o.isValid=null===(a=o.containsNonAlphanumericCharacter)||void 0===a||a),o}validatePasswordLengthOptions(e,t){let n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let r=0;r<e.length;r++)n=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,r,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}class l1{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new l2(this),this.idTokenSubscription=new l2(this),this.beforeStateQueue=new lQ(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=o1,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=lM(t)),this._initializationPromise=this.queue(async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await l$.create(this,e),!this._deleted)){if(!(null===(n=this._popupRedirectResolver)||void 0===n)&&n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let t=await ly(this,{idToken:e}),n=await lj._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(rH(this.app)){let e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}let n=await this.assertedPersistence.getCurrentUser(),r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,s=null==r?void 0:r._redirectEventId,a=await this.tryRedirectSignIn(e);(!n||n===s)&&null!=a&&a.user&&(r=a.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);
4if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(e){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return o8(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await lS(e)}catch(e){if((null==e?void 0:e.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if(typeof navigator>"u")return null;let e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(rH(this.app))return Promise.reject(o6(this));let t=e?rd(e):null;return t&&o8(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&o8(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return rH(this.app)?Promise.reject(o6(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return rH(this.app)?Promise.reject(o6(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(lM(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=new l0(await lX(this));null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new nX("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{let n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){let t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await lO(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){let n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&lM(e)||this._popupRedirectResolver;o8(t,this,"argument-error"),this.redirectPersistenceManager=await l$.create(this,[lM(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue(async()=>{}),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};let i="function"==typeof t?t:t.next.bind(t),s=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(o8(a,this,"internal-error"),a.then(()=>{s||i(this.currentUser)}),"function"==typeof t){let i=e.addObserver(t,n,r);return()=>{s=!0,i()}}{let n=e.addObserver(t);return()=>{s=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return o8(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=lJ(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);let n=await (null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);let r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var e;let t=await (null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return null!=t&&t.error&&function(e,...t){o2.logLevel<=R.WARN&&o2.warn(`Auth (${rG}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}class l2{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){let n=new ra(e,void 0);return n.subscribe.bind(n)}(e=>this.observer=e)}get next(){return o8(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let l4={async loadJS(){throw Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};class l3{constructor(e){this.type="recaptcha-enterprise",this.auth=rd(e)}async verify(e="verify",t=!1){async function n(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,n)=>
4{l_(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(r=>{if(void 0===r.recaptchaKey)n(Error("recaptcha Enterprise site key undefined"));else{let n=new lg(r);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}}).catch(e=>{n(e)})})}function r(t,n,r){let i=window.grecaptcha;lm(i)?i.enterprise.ready(()=>{i.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n("NO_RECAPTCHA")})}):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((e,i)=>{n(this.auth).then(n=>{if(!t&&lm(window.grecaptcha))r(n,e,i);else{var s;if(typeof window>"u"){i(Error("RecaptchaVerifier is only supported in browser"));return}let t=l4.recaptchaEnterpriseScript;0!==t.length&&(t+=n),(s=t,l4.loadJS(s)).then(()=>{r(n,e,i)}).catch(e=>{i(e)})}}).catch(e=>{i(e)})})}}async function l9(e,t,n,r=!1){let i;let s=new l3(e);try{i=await s.verify(n)}catch{i=await s.verify(n,!0)}let a=Object.assign({},t);return r?Object.assign(a,{captchaResp:i}):Object.assign(a,{captchaResponse:i}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function l5(e,t,n,r){var i;if(!(!(null===(i=e._getRecaptchaConfig())||void 0===i)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")))return r(e,t).catch(async i=>{if("auth/missing-recaptcha-token"!==i.code)return Promise.reject(i);{console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let i=await l9(e,t,n,"getOobCode"===n);return r(e,i)}});{let i=await l9(e,t,n,"getOobCode"===n);return r(e,i)}}function l6(e){let t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function l7(e){if(!e)return null;let t=Number(e);return isNaN(t)?null:t}class l8{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return le("not implemented")}_getIdTokenResponse(e){return le("not implemented")}_linkToIdToken(e,t){return le("not implemented")}_getReauthenticationResolver(e){return le("not implemented")}}async function ce(e,t){return lc(e,"POST","/v1/accounts:signUp",t)}async function ct(e,t){return ld(e,"POST","/v1/accounts:signInWithPassword",ll(e,t))}async function cn(e,t){return ld(e,"POST","/v1/accounts:signInWithEmailLink",ll(e,t))}async function cr(e,t){return ld(e,"POST","/v1/accounts:signInWithEmailLink",ll(e,t))}class ci extends l8{constructor(e,t,n,r=null){super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new ci(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new ci(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t="string"==typeof e?JSON.parse(e):e;if(null!=t&&t.email&&null!=t&&t.password){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return l5(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",ct);case"emailLink":return cn(e,{email:this._email,oobCode:this._password});default:o3(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return l5(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",ce);case"emailLink":return cr(e,{idToken:t,email:this._email,oobCode:this._password});default:o3(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function cs(e,t){return ld(e,"POST","/v1/accounts:signInWithIdp",ll(e,t))}let ca=class e extends l8{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){let n=new e(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(n.idToken=t.idToken),t.accessToken&&(n.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(n.nonce=t.nonce),t.pendingToken&&
4(n.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(n.accessToken=t.oauthToken,n.secret=t.oauthTokenSecret):o3("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){let n="string"==typeof t?JSON.parse(t):t,{providerId:r,signInMethod:i}=n,s=oX(n,["providerId","signInMethod"]);if(!r||!i)return null;let a=new e(r,i);return a.idToken=s.idToken||void 0,a.accessToken=s.accessToken||void 0,a.secret=s.secret,a.nonce=s.nonce,a.pendingToken=s.pendingToken||null,a}_getIdTokenResponse(e){return cs(e,this.buildRequest())}_linkToIdToken(e,t){let n=this.buildRequest();return n.idToken=t,cs(e,n)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,cs(e,t)}buildRequest(){let e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=rn(t)}return e}};class co{constructor(e){var t,n,r,i,s,a;let o=rr(ri(e)),l=null!==(t=o.apiKey)&&void 0!==t?t:null,c=null!==(n=o.oobCode)&&void 0!==n?n:null,u=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=o.mode)&&void 0!==r?r:null);o8(l&&c&&u,"argument-error"),this.apiKey=l,this.operation=u,this.code=c,this.continueUrl=null!==(i=o.continueUrl)&&void 0!==i?i:null,this.languageCode=null!==(s=o.languageCode)&&void 0!==s?s:null,this.tenantId=null!==(a=o.tenantId)&&void 0!==a?a:null}static parseLink(e){let t=function(e){let t=rr(ri(e)).link,n=t?rr(ri(t)).deep_link_id:null,r=rr(ri(e)).deep_link_id;return(r?rr(ri(r)).link:null)||r||n||t||e}(e);try{return new co(t)}catch{return null}}}let cl=class e{constructor(){this.providerId=e.PROVIDER_ID}static credential(e,t){return ci._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let n=co.parseLink(t);return o8(n,"argument-error"),ci._fromEmailAndCode(e,n.code,n.tenantId)}};cl.PROVIDER_ID="password",cl.EMAIL_PASSWORD_SIGN_IN_METHOD="password",cl.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class cc{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class cu extends cc{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class cd extends cu{constructor(){super("facebook.com")}static credential(e){return ca._fromParams({providerId:cd.PROVIDER_ID,signInMethod:cd.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return cd.credentialFromTaggedObject(e)}static credentialFromError(e){return cd.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return cd.credential(e.oauthAccessToken)}catch{return null}}}cd.FACEBOOK_SIGN_IN_METHOD="facebook.com",cd.PROVIDER_ID="facebook.com";class ch extends cu{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return ca._fromParams({providerId:ch.PROVIDER_ID,signInMethod:ch.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return ch.credentialFromTaggedObject(e)}static credentialFromError(e){return ch.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return ch.credential(t,n)}catch{return null}}}ch.GOOGLE_SIGN_IN_METHOD="google.com",ch.PROVIDER_ID="google.com";let cp=class e extends cu{constructor(){super("github.com")}static credential(t){return ca._fromParams({providerId:e.PROVIDER_ID,signInMethod:e.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return e.credentialFromTaggedObject(t)}static credentialFromError(t){return e.credentialFromTaggedObject(t.customData||{})}
4static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return e.credential(t.oauthAccessToken)}catch{return null}}};cp.GITHUB_SIGN_IN_METHOD="github.com",cp.PROVIDER_ID="github.com";class cf extends cu{constructor(){super("twitter.com")}static credential(e,t){return ca._fromParams({providerId:cf.PROVIDER_ID,signInMethod:cf.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return cf.credentialFromTaggedObject(e)}static credentialFromError(e){return cf.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return cf.credential(t,n)}catch{return null}}}async function cm(e,t){return ld(e,"POST","/v1/accounts:signUp",ll(e,t))}cf.TWITTER_SIGN_IN_METHOD="twitter.com",cf.PROVIDER_ID="twitter.com";let cg=class e{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(t,n,r,i=!1){return new e({user:await lj._fromIdTokenResponse(t,r,i),providerId:c_(r),_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){return await t._updateTokensIfNecessary(r,!0),new e({user:t,providerId:c_(r),_tokenResponse:r,operationType:n})}};function c_(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class cv extends nQ{constructor(e,t,n,r){var i;super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,cv.prototype),this.customData={appName:e.name,tenantId:null!==(i=e.tenantId)&&void 0!==i?i:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new cv(e,t,n,r)}}function cy(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{throw"auth/multi-factor-auth-required"===n.code?cv._fromErrorAndOperation(e,n,t,r):n})}async function cw(e,t,n=!1){let r=await lI(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return cg._forOperation(e,"link",r)}async function cC(e,t,n=!1){let{auth:r}=e;if(rH(r.app))return Promise.reject(o6(r));let i="reauthenticate";try{let s=await lI(e,cy(r,i,t,e),n);o8(s.idToken,r,"internal-error");let a=lk(s.idToken);o8(a,r,"internal-error");let{sub:o}=a;return o8(e.uid===o,r,"user-mismatch"),cg._forOperation(e,i,s)}catch(e){throw(null==e?void 0:e.code)==="auth/user-not-found"&&o3(r,"user-mismatch"),e}}async function cb(e,t,n=!1){if(rH(e.app))return Promise.reject(o6(e));let r="signIn",i=await cy(e,r,t),s=await cg._fromIdTokenResponse(e,r,i);return n||await e._updateCurrentUser(s.user),s}async function ck(e,t){return cb(rd(e),t)}async function cx(e){let t=rd(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function cI(e,t,n){if(rH(e.app))return Promise.reject(o6(e));let r=rd(e),i=await l5(r,{returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",cm).catch(t=>{throw"auth/password-does-not-meet-requirements"===t.code&&cx(e),t}),s=await cg._fromIdTokenResponse(r,"signIn",i);return await r._updateCurrentUser(s.user),s}function cE(e,t,n){return rH(e.app)?Promise.reject(o6(e)):ck(rd(e),cl.credential(t,n)).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&cx(e),t})}async function cT(e,t){return lc(e,"POST","/v1/accounts:update",t)}async function cS(e,{displayName:t,photoURL:n}){if(void 0===t&&void 0===n)return;let r=rd(e),i={idToken:await r.getIdToken(),displayName:t,photoUrl:n,returnSecureToken:!0},s=await lI(r,cT(r.auth,i));r.displayName=s.displayName||null,r.photoURL=s.photoUrl||null;let a=r.providerData.find(({providerId:e})=>"password"===e);a&&(a.displayName=r.displayName,a.photoURL=r.photoURL),await r._updateTokensIfNecessary(s)}function cN(e,t){return rd(e).setPersistence(t)}function cP(e){return rd(e).signOut()}let cR="__sak";class cO{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(cR,"1"),this.storage.removeItem(cR),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){let t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class cL extends cO{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=lY(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let n=this.storage.getItem(t),r=this.localCache[t];n!==r&&e(t,r,n)}}
4onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)});return}let n=e.key;t?this.detachListener():this.stopPolling();let r=()=>{let e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},i=this.storage.getItem(n);(function(){let e=nG();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0})()&&10===document.documentMode&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,10):r()}notifyListeners(e,t){this.localCache[e]=t;let n=this.listeners[e];if(n)for(let e of Array.from(n))e(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){let t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}cL.type="LOCAL";class cA extends cO{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}cA.type="SESSION";class cj{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;let n=new cj(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let{eventId:t,eventType:n,data:r}=e.data,i=this.handlersMap[n];if(!(null!=i&&i.size))return;e.ports[0].postMessage({status:"ack",eventId:t,eventType:n});let s=Array.from(i).map(async t=>t(e.origin,r)),a=await Promise.all(s.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}}));e.ports[0].postMessage({status:"done",eventId:t,eventType:n,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function cD(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}cj.receivers=[];class cM{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,n=50){let r,i;let s="u">typeof MessageChannel?new MessageChannel:null;if(!s)throw Error("connection_unavailable");return new Promise((a,o)=>{let l=cD("",20);s.port1.start();let c=setTimeout(()=>{o(Error("unsupported_event"))},n);i={messageChannel:s,onMessage(e){if(e.data.eventId===l)switch(e.data.status){case"ack":clearTimeout(c),r=setTimeout(()=>{o(Error("timeout"))},3e3);break;case"done":clearTimeout(r),a(e.data.response);break;default:clearTimeout(c),clearTimeout(r),o(Error("invalid_response"))}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:e,eventId:l,data:t},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}function cF(){return window}function cU(){return"u">typeof cF().WorkerGlobalScope&&"function"==typeof cF().importScripts}async function c$(){if(!(null!=navigator&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}let cV="firebaseLocalStorageDb",cq="firebaseLocalStorage",cz="fbase_key",cB=class{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>
4{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}};function cW(e,t){return e.transaction([cq],t?"readwrite":"readonly").objectStore(cq)}function cH(){let e=indexedDB.open(cV,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{let t=e.result;try{t.createObjectStore(cq,{keyPath:cz})}catch(e){n(e)}}),e.addEventListener("success",async()=>{let n=e.result;n.objectStoreNames.contains(cq)?t(n):(n.close(),await new cB(indexedDB.deleteDatabase(cV)).toPromise(),t(await cH()))})})}async function cZ(e,t,n){return new cB(cW(e,!0).put({[cz]:t,value:n})).toPromise()}async function cK(e,t){let n=cW(e,!1).get(t),r=await new cB(n).toPromise();return void 0===r?null:r.value}function cG(e,t){return new cB(cW(e,!0).delete(t)).toPromise()}class cY{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db||(this.db=await cH()),this.db}async _withRetries(e){let t=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return cU()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=cj._getInstance(cU()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;if(this.activeServiceWorker=await c$(),!this.activeServiceWorker)return;this.sender=new cM(this.activeServiceWorker);let n=await this.sender._send("ping",{},800);n&&!(null===(e=n[0])||void 0===e)&&e.fulfilled&&!(null===(t=n[0])||void 0===t)&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(!(!this.sender||!this.activeServiceWorker||((null===(t=null==navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null)!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await cH();return await cZ(e,cR,"1"),await cG(e,cR),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(n=>cZ(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(t=>cK(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>cG(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(e=>new cB(cW(e,!1).getAll()).toPromise());if(!e||0!==this.pendingWrites)return[];let t=[],n=new Set;if(0!==e.length)for(let{fbase_key:r,value:i}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),t.push(r));for(let e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;let n=this.listeners[e];if(n)for(let e of Array.from(n))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}function cJ(e,t){return t?lM(t):(o8(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}cY.type="LOCAL",new lr(3e4,6e4);class cQ extends l8{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return cs(e,this._buildIdpRequest())}_linkToIdToken(e,t){return cs(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return cs(e,this._buildIdpRequest())}_buildIdpRequest(e){let t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function cX(e){return cb(e.auth,new cQ(e),e.bypassAuthState)}function c0(e){let{auth:t,user:n}=e;return o8(n,t,"internal-error"),cC(n,new cQ(e),e.bypassAuthState)}async function c1(e){let{auth:t,user:n}=e;return o8(n,t,"internal-error"),cw(n,new cQ(e),e.bypassAuthState)}class c2{constructor(e,t,n,r,i=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){let{urlResponse:t,sessionId:n,postBody:r,tenantId:i,error:s,type:a}=e;if(s){this.reject(s);return}let o={auth:this.auth,requestUri:t,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(o))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return cX;case"linkViaPopup":case"linkViaRedirect":return c1;case"reauthViaPopup":case"reauthViaRedirect":return c0;default:o3(this.auth,"internal-error")}}resolve(e){var t,n;t=this.pendingPromise,n="Pending promise was never set",t||le(n),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){var t,n;t=this.pendingPromise,n="Pending promise was never set",t||le(n),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}let c4=new lr(2e3,1e4);async function c3(e,t,n){if(rH(e.app))return Promise.reject(o9(e,"operation-not-supported-in-this-environment"));let r=rd(e);!function(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&o3(e,"argument-error"),o5(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}(e,t,cc);let i=cJ(r,n);return new c9(r,"signInViaPopup",t,i).executeNotNull()}let c9=class e extends c2{constructor(t,n,r,i,s){super(t,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,e.currentPopupAction&&e.currentPopupAction.cancel(),e.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return o8(e,this.auth,"internal-error"),e}async onExecution(){var e,t;e=1===this.filter.length,t="Popup operations only handle one event",e||le(t);let n=cD();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],n),this.authWindow.associatedEvent=n,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(o9(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(o9(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,e.currentPopupAction=null}pollUserCancellation(){let e=()=>{var t,n;if(!(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n)&&n.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(o9(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,c4.get())};e()}};c9.currentPopupAction=null;
4let c5=new Map;class c6 extends c2{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=c5.get(this.auth._key());if(!e){try{let t=await c7(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}c5.set(this.auth._key(),e)}return this.bypassAuthState||c5.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"===e.type){this.resolve(null);return}if(e.eventId){let t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function c7(e,t){let n=lU("pendingRedirect",t.config.apiKey,t.name),r=lM(e._redirectPersistence);if(!await r._isAvailable())return!1;let i=await r._get(n)==="true";return await r._remove(n),i}function c8(e,t){c5.set(e._key(),t)}async function ue(e,t,n=!1){if(rH(e.app))return Promise.reject(o6(e));let r=rd(e),i=cJ(r,t),s=await new c6(r,i,n).execute();return s&&!n&&(delete s.user._redirectEventId,await r._persistUserIfCurrent(s.user),await r._setRedirectUser(null,t)),s}class ut{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return ur(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!ur(e)){let r=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(o9(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(un(e))}saveEventToCache(e){this.cachedEventUids.add(un(e)),this.lastProcessedEventTime=Date.now()}}function un(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function ur({type:e,error:t}){return"unknown"===e&&(null==t?void 0:t.code)==="auth/no-auth-event"}async function ui(e,t={}){return lc(e,"GET","/v1/projects",t)}let us=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ua=/^https?/;async function uo(e){if(e.config.emulator)return;let{authorizedDomains:t}=await ui(e);for(let e of t)try{if(function(e){let t=lt(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){let i=new URL(e);return""===i.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!ua.test(n))return!1;if(us.test(e))return r===e;let i=e.replace(/\./g,"\\.");return RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}(e))return}catch{}o3(e,"unauthorized-domain")}let ul=new lr(3e4,6e4);function uc(){let e=cF().___jsl;if(null!=e&&e.H){for(let t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}}let uu=null,ud=new lr(5e3,15e3),uh={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},up=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function uf(e){let t=await (uu=uu||new Promise((t,n)=>{var r,i,s,a;function o(){uc(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{uc(),n(o9(e,"network-request-failed"))},timeout:ul.get()})}if(!(null===(i=null===(r=cF().gapi)||void 0===r?void 0:r.iframes)||void 0===i)&&i.Iframe)t(gapi.iframes.getContext());else if(!(null===(s=cF().gapi)||void 0===s)&&s.load)o();else{let t=`__iframefcb${Math.floor(1e6*Math.random())}`;return cF()[t]=()=>{gapi.load?o():n(o9(e,"network-request-failed"))},(a=`${l4.gapiScript}?onload=${t}`,l4.loadJS(a)).catch(e=>n(e))}}).catch(e=>{throw uu=null,e})),n=cF().gapi;return o8(n,e,"internal-error"),t.open({where:document.body,url:function(e){let t=e.config;o8(t.authDomain,e,"auth-domain-config-required");let n=t.emulator?li(t,"emulator/auth/iframe"):`https://${e.config.authDomain}
4/__/auth/iframe`,r={apiKey:t.apiKey,appName:e.name,v:rG},i=up.get(e.config.apiHost);i&&(r.eid=i);let s=e._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${rn(r).slice(1)}`}(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:uh,dontclear:!0},t=>new Promise(async(n,r)=>{await t.restyle({setHideOnLeave:!1});let i=o9(e,"network-request-failed"),s=cF().setTimeout(()=>{r(i)},ud.get());function a(){cF().clearTimeout(s),n(t)}t.ping(a).then(a,()=>{r(i)})}))}let um={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class ug{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}let u_=encodeURIComponent("fac");async function uv(e,t,n,r,i,s){o8(e.config.authDomain,e,"auth-domain-config-required"),o8(e.config.apiKey,e,"invalid-api-key");let a={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:rG,eventId:i};if(t instanceof cc)for(let[n,r]of(t.setDefaultLanguage(e.languageCode),a.providerId=t.providerId||"",n7(t.getCustomParameters())||(a.customParameters=JSON.stringify(t.getCustomParameters())),Object.entries({})))a[n]=r;if(t instanceof cu){let e=t.getScopes().filter(e=>""!==e);e.length>0&&(a.scopes=e.join(","))}for(let t of(e.tenantId&&(a.tid=e.tenantId),Object.keys(a)))void 0===a[t]&&delete a[t];let o=await e._getAppCheckToken(),l=o?`#${u_}=${encodeURIComponent(o)}`:"";return`${function({config:e}){return e.emulator?li(e,"emulator/auth/handler"):`https://${e.authDomain}/__/auth/handler`}(e)}?${rn(a).slice(1)}${l}`}let uy="webStorageSupport";class uw{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=cA,this._completeRedirectFn=ue,this._overrideRedirectResult=c8}async _openPopup(e,t,n,r){var i,s,a;s=null===(i=this.eventManagers[e._key()])||void 0===i?void 0:i.manager,a="_initialize() not called before _openPopup()",s||le(a);let o=await uv(e,t,n,lt(),r);return function(e,t,n,r=500,i=600){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString(),o="",l=Object.assign(Object.assign({},um),{width:r.toString(),height:i.toString(),top:s,left:a}),c=nG().toLowerCase();n&&(o=lB(c)?"_blank":n),lq(c)&&(t=t||"http://localhost",l.scrollbars="yes");let u=Object.entries(l).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=nG()){var t;return lG(e)&&!!(!(null===(t=window.navigator)||void 0===t)&&t.standalone)}(c)&&"_self"!==o)return function(e,t){let n=document.createElement("a");n.href=e,n.target=t;let r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}(t||"",o),new ug(null);let d=window.open(t||"",o,u);o8(d,e,"popup-blocked");try{d.focus()}catch{}return new ug(d)}(e,o,cD())}async _openRedirect(e,t,n,r){var i;return await this._originValidation(e),i=await uv(e,t,n,lt(),r),cF().location.href=i,new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){var n;let{manager:e,promise:r}=this.eventManagers[t];return e?Promise.resolve(e):(n="If manager is not set, promise should be",r||le(n),r)}let r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){let t=await uf(e),n=new ut(e);return t.register("authEvent",t=>(o8(null==t?void 0:t.authEvent,e,"invalid-auth-event"),{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(uy,{type:uy},n=>{var r;let i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[uy];void 0!==i&&t(!!i),o3(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=uo(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return lY()||lz()||lG()}}var uC="@firebase/auth",ub="1.7.9";class uk{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let t=this.auth.onIdTokenChanged(t=>{e((null==t?void 0:t.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){o8(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}let ux=nZ("authIdTokenMaxAge")||300,uI=null,uE=e=>async t=>{let n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>ux)return;let i=null==n?void 0:n.token;uI!==i&&(uI=i,await fetch(e,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};l4={loadJS:e=>
4new Promise((t,n)=>{var r,i;let s=document.createElement("script");s.setAttribute("src",e),s.onload=t,s.onerror=e=>{let t=o9("internal-error");t.customData=e,n(t)},s.type="text/javascript",s.charset="UTF-8",(null!==(i=null===(r=document.getElementsByTagName("head"))||void 0===r?void 0:r[0])&&void 0!==i?i:document).appendChild(s)}),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},x="Browser",rB(new rh("auth",(e,{options:t})=>{let n=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:s,authDomain:a}=n.options;o8(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});let o=new l1(n,r,i,{apiKey:s,authDomain:a,clientPlatform:x,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:lJ(x)});return function(e,t){let n=(null==t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(lM);null!=t&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(o,t),o},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),rB(new rh("auth-internal",e=>new uk(rd(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),rQ(uC,ub,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(x)),rQ(uC,ub,"esm2017");let uT="",uS;if("u">typeof window){let e=window.location.hostname;e.includes("dev.vaidepromo")||e.includes("localhost")?(uT="https://dev.backsafearea.vaidepromo.com.br",uS=rY({apiKey:"AIzaSyCv-cWJA0zjVuBNKGf6WSb_6B1hNP_r3C8",authDomain:"vai-de-promo-dev.firebaseapp.com",databaseURL:"https://vai-de-promo-dev-default-rtdb.firebaseio.com",projectId:"vai-de-promo-dev",storageBucket:"vai-de-promo-dev.appspot.com",messagingSenderId:"445506039967",appId:"1:445506039967:web:f234cadd71db13512fb2aa",measurementId:"G-23QSWHWKGW"})):(uT="https://backsafearea.vaidepromo.com.br",uS=rY({apiKey:"AIzaSyAjTkQK8Dt2dS2fDj3XZmVfy1rDsuFIDIE",authDomain:"VAI-DE-PROMO.FIREBASEAPP.COM",databaseURL:"HTTPS://VAI-DE-PROMO-DEFAULT-RTDB.FIREBASEIO.COM",projectId:"VAI-DE-PROMO",storageBucket:"VAI-DE-PROMO.APPSPOT.COM",messagingSenderId:"548220451677",appId:"1:548220451677:WEB:9E9A995A95E98EE8E346B4",measurementId:"G-907H061FT2"}))}let uN=function(e=rJ(),t){let n=rW(e,"database").getImmediate({identifier:void 0});if(!n._instanceStarted){let e=nW("database");e&&function(e,t,n,r={}){var i;let s;(e=rd(e))._checkNotDeleted("useEmulator"),e._instanceStarted&&iy("Cannot call useEmulator() after instance has already been initialized.");let a=e._repoInternal;a.repoInfo_.nodeAdmin?(r.mockUserToken&&iy('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 iU(iU.OWNER)):r.mockUserToken&&(s=new iU("string"==typeof r.mockUserToken?r.mockUserToken:function(e,t){if(e.uid)throw Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let n=t||"demo-project",r=e.iat||0,i=e.sub||e.user_id;if(!i)throw Error("mockUserToken must contain 'sub' or 'user_id' field!");let s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e);return[nF(JSON.stringify({alg:"none",type:"JWT"})),nF(JSON.stringify(s)),""].join(".")}(r.mockUserToken,e.app.options.projectId))),i=s,a.repoInfo_=new iz(`${t}:${n}`,!1,a.repoInfo_.namespace,a.repoInfo_.webSocketOnly,a.repoInfo_.nodeAdmin,a.repoInfo_.persistenceKey,a.repoInfo_.includeNamespaceInQueryParams,!0),i&&(a.authTokenProvider_=i)}(n,...e)}return n}(uS),uP=function(e=rJ()){let t=rW(e,"auth");if(t.isInitialized())return t.getImmediate();let n=function(e,t){let n=rW(e,"auth");if(n.isInitialized()){let e=n.getImmediate();if(re(n.getOptions(),t??{}))return e;o3(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:uw,persistence:[cY,cL,cA]}),r=nZ("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){let e=new URL(r,location.origin);if(location.origin===e.origin){var i,s;let t=uE(e.toString());i=()=>t(n.currentUser),rd(n).beforeAuthStateChanged(t,i),s=e=>t(e),rd(n).onIdTokenChanged(s,void 0,void 0)}}let a=nB("auth");return a&&function(e,t,n){let r=rd(e);o8(r._canInitEmulator,r,"emulator-config-failed"),o8(/^https?:\/\//.test(t),r,"invali
4d-emulator-scheme");let i=l6(t),{host:s,port:a}=function(e){let t=l6(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};let r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){let e=i[1];return{host:e,port:l7(r.substr(e.length+1))}}{let[e,t]=r.split(":");return{host:e,port:l7(t)}}}(t),o=null===a?"":`:${a}`;r.config.emulator={url:`${i}//${s}${o}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:s,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:!1})}),function(){function e(){let e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"u">typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials."),"u">typeof window&&"u">typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}(n,`http://${a}`),n}(uS),uR={firebaseUpdatePassword:async function(e){return await nP({url:`${uT}/firebase/update-password/`,payload:e})},firebaseSendUpdatePasswordEmail:async function(e){return await nN({url:`${uT}/firebase/send-update-password-email/${e}/`})},firebaseSendVerificationEmail:async function(e){return await nN({url:`${uT}/firebase/send-verification-email/${e}/`})},firebaseVerifyEmail:async function(e){return await nP({url:`${uT}/firebase/verify-email/`,payload:e})},firebaseVerifyEmailRegistered:async function(e,t){return await nP({url:`${uT}/firebase/verify-user-exists/${e}/`,payload:{token:t}})},firebaseVerifyUpdatePasswordCode:async function(e){return await nP({url:`${uT}/firebase/verify-update-password-code/`,payload:e})}},uO={},uL=e=>{let t;let n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=r??("object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,s={setState:r,getState:i,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{(uO?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(r,i,s);return s},uA=e=>e?uL(e):uL;
4var uj={exports:{}},uD={},uM={exports:{}},uF={};uj.exports=function(){if(j)return uD;j=1;var e=(A||(A=1,uM.exports=function(){if(L)return uF;L=1;var e="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},t=z.useState,n=z.useEffect,r=z.useLayoutEffect,i=z.useDebugValue;function s(t){var n=t.getSnapshot;t=t.value;try{var r=n();return!e(t,r)}catch{return!0}}var a=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(e,t){return t()}:function(e,a){var o=a(),l=t({inst:{value:o,getSnapshot:a}}),c=l[0].inst,u=l[1];return r(function(){c.value=o,c.getSnapshot=a,s(c)&&u({inst:c})},[e,o,a]),n(function(){return s(c)&&u({inst:c}),e(function(){s(c)&&u({inst:c})})},[e]),i(o),o};return uF.useSyncExternalStore=void 0!==z.useSyncExternalStore?z.useSyncExternalStore:a,uF}()),uM.exports),t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useSyncExternalStore,r=z.useRef,i=z.useEffect,s=z.useMemo,a=z.useDebugValue;return uD.useSyncExternalStoreWithSelector=function(e,o,l,c,u){var d=r(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;var p=n(e,(d=s(function(){function e(e){if(!i){if(i=!0,n=e,e=c(e),void 0!==u&&h.hasValue){var s=h.value;if(u(s,e))return r=s}return r=e}if(s=r,t(n,e))return s;var a=c(e);return void 0!==u&&u(s,a)?(n=e,s):(n=e,r=a)}var n,r,i=!1,s=void 0===l?null:l;return[function(){return e(o())},null===s?void 0:function(){return e(s())}]},[o,l,c,u]))[0],d[1]);return i(function(){h.hasValue=!0,h.value=p},[p]),a(p),p},uD}();let uU=H(uj.exports),u$={},{useDebugValue:uV}=z,{useSyncExternalStoreWithSelector:uq}=uU,uz=!1,uB=e=>e,uW=e=>{(u$?"production":void 0)!=="production"&&"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let t="function"==typeof e?uA(e):e,n=(e,n)=>(function(e,t=uB,n){(u$?"production":void 0)!=="production"&&n&&!uz&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),uz=!0);let r=uq(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return uV(r),r})(t,e,n);return Object.assign(n,t),n},uH=uW((e,t)=>({authUnsubscribe:uP.onAuthStateChanged(async t=>{if(e(()=>({user:t,userLogged:!!t,isFetchingUser:!1})),t)try{var n;let r=await t.getIdToken();e(()=>({idToken:r}));let i=(n=uN,(n=rd(n))._checkNotDeleted("ref"),n._root);(function(e){e=rd(e);let t=new oY(new oW(()=>{}));return(function(e,t,n){let r=function(e,t){var n;let r=t._path,i=null;e.syncPointTree_.foreachOnPath(r,(e,t)=>{let n=sa(e,r);i=i||aJ(t,n)});let s=e.syncPointTree_.get(r);s?i=i||aJ(s,i6()):(s=new aZ,e.syncPointTree_=e.syncPointTree_.set(r,s));let a=null!=i,o=a?new an(i,!0,!1):null,l=(n=e.pendingWriteTree_,aR(t._path,n));return al(aG(s,t,l,a?o.getNode():sD.EMPTY_NODE,a).viewCache_)}(e.serverSyncTree_,t);return null!=r?Promise.resolve(r):e.server_.get(t).then(r=>{let i;let s=sU(r).withIndex(t._queryParams.getIndex());if(!function(e,t,n,r=!1){var i;let s;let a=t._path,o=null,l=!1;e.syncPointTree_.foreachOnPath(a,(e,t)=>{let n=sa(e,a);o=o||aJ(t,n),l=l||aX(t)});let c=e.syncPointTree_.get(a);c?(l=l||aX(c),o=o||aJ(c,i6())):(c=new aZ,e.syncPointTree_=e.syncPointTree_.set(a,c)),null!=o?s=!0:(s=!1,o=sD.EMPTY_NODE,e.syncPointTree_.subtree(a).foreachChild((e,t)=>{let n=aJ(t,i6());n&&(o=o.updateImmediateChild(e,n))}));let u=null!=aQ(c,t);if(!u&&!t._queryParams.loadsAllData()){let n=ot(t);nR(!e.queryToTagMap.has(n),"View does not exist, but we have a tag");let r=a1++;e.queryToTagMap.set(n,r),e.tagToQueryMap.set(r,n)}let d=function(e,t,n,r,i,s){let a=aG(e,t,r,i,s);return e.views.has(t._queryIdentifier)||e.views.set(t._queryIdentifier,a),function(e,t){e.eventRegistrations_.push(t)}(a,n),function(e,t){let n=e.viewCache_.eventCache,r=[];return n.getNode().isLeafNode()||n.getNode().forEachChild(sN,(e,t)=>{r.push(sB(e,t))}),n.isFullyInitialized()&&r.push(sz(n.getNode())),aH(e,r,n.getNode(),t)}(a,n)}(c,t,n,(i=e.pendingWriteTree_,aR(a,i)),o,s);if(!u&&!l&&!r){let n=aQ(c,t);d=d.concat(function(e,t,n){let r=t._path,i=oe(e,t),s=a8(e,n),a=e.listenProvi
4der_.startListening(os(t),i,s.hashFn,s.onComplete),o=e.syncPointTree_.subtree(r);if(i)nR(!aX(o.value),"If we're adding a query, it shouldn't be shadowed");else{let t=o.fold((e,t,n)=>{if(!ss(e)&&t&&aX(t))return[a0(t).query];{let e=[];return t&&(e=e.concat(aY(t).map(e=>e.query))),iR(n,(t,n)=>{e=e.concat(n)}),e}});for(let n=0;n<t.length;++n){let r=t[n];e.listenProvider_.stopListening(os(r),oe(e,r))}}return a}(e,t,n))}}(e.serverSyncTree_,t,n,!0),t._queryParams.loadsAllData())i=a3(e.serverSyncTree_,t._path,s);else{let n=oe(e.serverSyncTree_,t);i=a5(e.serverSyncTree_,t._path,s,n)}return oS(e.eventQueue_,t._path,i),a9(e.serverSyncTree_,t,n,null,!0),s},n=>(oA(e,"get for query "+n2(t)+" failed: "+n),Promise.reject(Error(n))))})(e._repo,e,t).then(t=>new oK(t,new oZ(e._repo,e._path),e._queryParams.getIndex()))})(oG(i,`users/${t.uid}`)).then(t=>{t.exists()&&e(()=>({storedUserData:t.val()}))}).catch(e=>{console.error(e)})}catch{e(()=>({idToken:null}))}else e(()=>({idToken:null}))}),userLogged:!1,isFetchingUser:!0,storedUserData:null,user:null,idToken:null,setIsFetchingUser:t=>e(()=>({isFetchingUser:t})),getIdToken:async(n=!1)=>{let{user:r,idToken:i}=t();if(!r)return null;if(i&&!n)return i;try{let t=await r.getIdToken(n);return e(()=>({idToken:t})),t}catch{return null}}})),uZ=uW((e,t)=>({currentScreen:0,recoverPasswordEmail:"",sendEmailTimer:0,verificationCode:"",newUserEmail:"",newUserName:"",newUserPassword:"",loginModalOpen:!1,isSendingRecoverPasswordEmail:!1,loginError:!1,createAccountLoginError:"",newPasswordError:!1,loginEmail:"",loginPassword:"",loginStayConnected:!1,recoverPasswordCode:"",newPassword:"",verificationCodeError:!1,createPasswordError:!1,emailAlreadyUsedError:!1,recaptchaToken:"",isLoading:!1,recoverPasswordCodeError:!1,setIsLoading:t=>e(()=>({isLoading:t})),setIsSendingRecoverPasswordEmail:t=>e(()=>({isSendingRecoverPasswordEmail:t})),setCurrentScreen:t=>e(()=>({currentScreen:t})),setRecoverPasswordEmail:t=>e(()=>({recoverPasswordEmail:t})),setVerificationCode:t=>e(()=>({verificationCode:t})),setRecaptchaToken:t=>e(()=>({recaptchaToken:t})),setEmailAlreadyUsedError:t=>e(()=>({emailAlreadyUsedError:t})),setNewPasswordError:t=>e(()=>({newPasswordError:t})),setRecoverPasswordCodeError:t=>e(()=>({recoverPasswordCodeError:t})),setCreatePasswordError:t=>e(()=>({createPasswordError:t})),setVerificationCodeError:t=>e(()=>({verificationCodeError:t})),setRecoverPasswordCode:t=>e(()=>({recoverPasswordCode:t})),setNewPassword:t=>e(()=>({newPassword:t})),setLoginEmail:t=>e(()=>({loginEmail:t})),setLoginPassword:t=>e(()=>({loginPassword:t})),setLoginStayConnected:t=>e(()=>({loginStayConnected:t})),setLoginError:t=>e(()=>({loginError:t})),setCreateAccountLoginError:t=>e(()=>({createAccountLoginError:t})),setLoginModalOpen:t=>e(()=>({loginModalOpen:t})),setNewUserEmail:t=>e(()=>({newUserEmail:t})),setNewUserName:t=>e(()=>({newUserName:t})),setNewUserPassword:t=>e(()=>({newUserPassword:t})),startSendEmailTimer:()=>{if(t().timer)return;e(()=>({sendEmailTimer:60})),console.log("start timer");let n=setInterval(()=>void e(t=>t.sendEmailTimer>=1?{sendEmailTimer:t.sendEmailTimer-1}:(clearInterval(t.timer),console.log("end timer"),e(()=>({timer:void 0})),{})),1e3);e(()=>({timer:n}))},signOut:()=>{uP.signOut(),window.location.href.includes("cliente")?window.location.replace("https://www.vaidepromo.com.br"):window.location.reload()},updatePassword:async()=>{let e=t();return(await uR.firebaseUpdatePassword({code:e.recoverPasswordCode,user_email:e.recoverPasswordEmail,password:e.newPassword})).success},validatePasswordRecoverCode:async()=>{let e=t();return(await uR.firebaseVerifyUpdatePasswordCode({user_email:e.recoverPasswordEmail,code:e.recoverPasswordCode})).success},verifyEmail:async()=>{let e=t();return(await uR.firebaseVerifyEmail({user_email:e.newUserEmail,code:e.verificationCode})).success},sendVerificationEmail:async e=>{let n=t();try{let t=await uR.firebaseSendVerificationEmail(e||n.newUserEmail);return n.startSendEmailTimer(),t.success}catch{return console.log("errr"),!1}},sendRecoverPasswordEmail:async e=>{let n=t();if(n.sendEmailTimer>1)return!1;try{let t=await uR.firebaseSendUpdatePasswordEmail(e||n.recoverPasswordEmail);return n.startSendEmailTimer(),t.success}catch{return console.log("errr"),!1}},resetAllValues:()=>e(()=>({loginEmail:"",loginPassword:"",loginError:!1,newUserName:"",newUserEmail:"",verificationCode:"",createAccountLoginError:"",recoverPasswordCode:"",recoverPasswordEmail:"",newPassword:"",newPasswordError:!1}))}));function uK(){let[e,t]=(0,z.useState)({width:0,height:0});return(0,z.useEffect)(()=>{function e(){t({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),e}let uG={container:"_container_pqe63_1","vdp-palette":"_vdp-palette_pqe63_9","seguro-chip-pallete":"_seguro-chip-pallete_pqe63_117",solid:"_solid_pqe63_239",primary:"_primary_pqe63_242",secondary:"_secondary_pqe63_271",outline:"_outline_pqe63_300",link:"_link_pqe63_363"},uY=({leftIcon:e,rightIcon:t,label:n,className:r,theme:i="primary",variant:s="solid",palette:a="vdp-palette",onClick:o=()=>{},...l})=>(0,q.jsxs)("button",{type:"button",className:J(uG.container,uG[i],uG[s],r,uG[a]),onClick:e=>{o(e),e.currentTarget.blur()},...l,children:[(0,q.jsx)(Q,{value:e,children:e}),n,(0,q.jsx)(Q,{value:t,children:t})]}),uJ=({className:e,size:t})=>(0,q.jsx)("div",{className:J("vdp-ui-divider-container",e,t)}),uQ=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"M18 6H6C4.89531 6 4 6.89531 4 8V16C4 17.1047 4.89531 18 6 18H18C19.1047 18 20 17.1047 20 16V8C20 6.89531 19.1031 6 18 6ZM6 7.5H18C18.2757 7.5 18.5 7.72431 18.5 8V8.6925L13.2875 13.0081C12.5628 13.6106 11.4331 13.6103 10.7103 13.0086L5.5 8.69375V8C5.5 7.725 5.72438 7.5 6 7.5ZM18 16.5H6C5.72431 16.5 5.5 16.2757 5.5 16V10.6469L9.75313 14.1906C10.3844 14.7125 11.1813 15 12 15C12.8188 15 13.6172 14.7129 14.2491 14.1881L18.5 10.6469V16C18.5 16.275 18.275 16.5 18 16.5Z"})}),uX=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"M17 10H16V8C16 5.79444 14.2056 4 12 4C9.79444 4 8 5.79444 8 8V10H7C5.89544 10 5 10.8954 5 12V18C5 19.1046 5.89544 20 7 20H17C18.1046 20 19 19.1046 19 18V12C19 10.8954 18.1046 10 17 10ZM9.5 8C9.5 6.62159 10.6216 5.5 12 5.5C13.3784 5.5 14.5 6.62159 14.5 8V10H9.5V8ZM17.5 18C17.5 18.2757 17.2757 18.5 17 18.5H7C6.72431 18.5 6.5 18.2757 6.5 18V12C6.5 11.7243 6.72431 11.5 7 11.5H17C17.2757 11.5 17.5 11.7243 17.5 12V18Z"})}),u0=({size:e=16})=>(0,q.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:`0 0 ${e} ${e}`,fill:"none",children:[(0,q.jsx)("path",{d:"M23.999 12.2638C24.0131 11.4391 23.9264 10.6158 23.7409 9.81128H12.2422V14.2642H18.988C18.8601 15.0447 18.5724 15.7918 18.1422 16.4606C17.7119 17.1294 17.148 17.706 16.4845 18.1558L16.461 18.3053L20.0932 21.0645L20.3455 21.0893C21.5494 19.9497 22.496 18.5755 23.1243 17.0554C23.7526 15.5352 24.0486 13.903 23.9932 12.2638",fill:"#4D92F
45"}),(0,q.jsx)("path",{d:"M12.244 23.9943C15.2272 24.0765 18.1294 23.0371 20.3551 21.0894L16.4883 18.1559C15.236 18.98 13.7519 19.3995 12.244 19.3554C10.6957 19.3475 9.18931 18.8619 7.93869 17.9676C6.68806 17.0733 5.75677 15.8158 5.27712 14.3736L5.13434 14.385L1.35358 17.2591L1.30469 17.3933C2.32312 19.3806 3.88594 21.0511 5.81824 22.2179C7.75054 23.3846 9.97608 24.0017 12.246 24",fill:"#25B23E"}),(0,q.jsx)("path",{d:"M5.27595 14.3717C5.0087 13.6081 4.87065 12.8068 4.8672 11.9996C4.87065 11.1931 5.00264 10.3921 5.25838 9.62554V9.46846L1.43063 6.55597L1.30552 6.61351C0.447137 8.28443 0 10.129 0 11.9996C0 13.8702 0.447137 15.7148 1.30552 17.3857L5.27796 14.3737",fill:"#FFBC07"}),(0,q.jsx)("path",{d:"M12.244 4.63964C13.9988 4.61237 15.6961 5.25252 16.9793 6.42549L20.4353 3.12024C18.2183 1.08358 15.2831 -0.0342354 12.244 0.000799344C9.97444 0.000276291 7.74939 0.618024 5.81757 1.78506C3.88575 2.9521 2.32323 4.62249 1.30469 6.60943L5.26346 9.62343C5.748 8.18155 6.68233 6.92506 7.93477 6.03123C9.18721 5.13741 10.6945 4.65135 12.244 4.6416",fill:"#CD4E42"})]}),u1=({label:e,onSuccess:t})=>{let n=new ch,{setIsFetchingUser:r}=uH();return n.addScope("profile"),n.addScope("email"),(0,q.jsx)("button",{type:"button",className:"_container_i6d2s_1",onClick:()=>{r(!0),c3(uP,n).then(()=>{null==t||t(),r(!1)}).catch(e=>{console.log(e,"err"),r(!1)})},children:(0,q.jsxs)("div",{className:"_content_i6d2s_42",children:[(0,q.jsx)(u0,{size:24}),(0,q.jsx)("span",{className:"_labelText_i6d2s_34",children:e})]})})},u2={header:"_header_fqlsk_1",container:"_container_fqlsk_1",text:"_text_fqlsk_36"},u4=({children:e,isMilesLogin:t})=>{let n=uZ();return n.currentScreen==nS.LoginV2?(0,q.jsx)(q.Fragment,{children:e}):(0,q.jsxs)("div",{className:u2.container,children:[(0,q.jsx)("div",{className:u2.header,children:(0,q.jsx)("span",{className:u2.text,children:function(){switch(n.currentScreen){case nS.Login:return t?(0,q.jsx)(q.Fragment,{children:"Crie ou acesse sua conta para gerenciar seus pedidos, vender suas milhas, gerenciar suas negocia\xe7\xf5es e aproveitar condi\xe7\xf5es exclusivas"}):(0,q.jsx)(q.Fragment,{children:"Para ver seus pedidos e mais"});case nS.CreateAccount:return t?(0,q.jsx)(q.Fragment,{children:"Crie sua conta e tenha acesso a tudo o que precisa em um s\xf3 lugar."}):(0,q.jsx)(q.Fragment,{children:"Crie a sua agora e tenha a experi\xeancia completa do Vai de Promo!"});case nS.CreatePassword:return(0,q.jsx)(q.Fragment,{children:"Agora \xe9 s\xf3 criar uma senha para proteger sua conta"});case nS.VerificationCode:return(0,q.jsx)(q.Fragment,{children:"Insira abaixo o c\xf3digo que enviamos para o seu e-mail"});case nS.ResetPassword:return(0,q.jsx)(q.Fragment,{children:"Agora \xe9 s\xf3 criar uma nova senha para proteger sua conta"});case nS.ResetPasswordCode:return(0,q.jsxs)(q.Fragment,{children:["Insira abaixo o c\xf3digo que enviamos para o e-mail"," ",(0,q.jsx)("strong",{children:n.recoverPasswordEmail})]});case nS.ForgotPassword:return(0,q.jsx)(q.Fragment,{children:"Insira seu e-mail para redefinir a senha"});case nS.CreateAccountSuccess:case nS.ResetPasswordSuccess:case nS.LoginV2:default:return""}}()})}),e]})},u3="_link_jq9ry_38",u9=({onClose:e,title:t="Acesse sua conta"})=>{let n=uZ(),r=t5().email(),i=t5().min(6),s=(0,z.useCallback)(()=>{try{r.parse(n.loginEmail),i.parse(n.loginPassword)}catch{return!1}return!0},[n.loginEmail,n.loginPassword,r,i]);return(0,q.jsx)(u4,{children:(0,q.jsxs)("div",{className:"_container_jq9ry_65",children:[(0,q.jsx)("span",{className:"_title_jq9ry_72",children:t}),(0,q.jsx)(eG,{"data-cy":"email",id:"email",type:"email",placeholder:"E-mail",mask:"email",value:n.loginEmail,onChange:e=>n.setLoginEmail(e.target.value),leftIcon:(0,q.jsx)(uQ,{color:"#4A4949",size:24}),onFocus:()=>n.setLoginError(!1),hasError:n.loginError}),(0,q.jsx)(eG,{"data-cy":"password",id:"password",placeholder:"Senha",type:"password",value:n.loginPassword,onChange:e=>n.setLoginPassword(e.target.value),leftIcon:(0,q.jsx)(uX,{color:"#4A4949",size:24}),onFocus:()=>n.setLoginError(!1),hasError:n.loginError}),(0,q.jsx)("div",{className:"_forgotPassword_jq9ry_29",children:(0,q.jsx)("button",{type:"button",className:u3,onClick:()=>n.setCurrentScreen(nS.ForgotPassword),children:"Esqueci minha senha"})}),(0,q.jsx)(eR,{value:n.loginError,children:(0,q.jsx)("div",{className:"_errorMessage_jq9ry_20",children:(0,q.jsx)("span",{children:"E-mail ou senha incorretos"})})}),(0,q.jsx)(ee,{disabled:n.isLoading??!s(),"data-cy":"login-button",label:"Continuar",onClick:function(){n.setIsLoading(!0),(n.loginStayConnected?cN(uP,cL):Promise.resolve()).then(()=>{cE(uP,n.loginEmail,n.loginPassword).then(async t=>{t.user.emailVerified?e():(cP(uP),n.setNewUserEmail(n.loginEmail),n.sendVerificationEmail(n.loginEmail),n.setCurrentScreen(nS.VerificationCode))}).catch(()=>{n.setLoginError(!0)}).finally(()=>n.setIsLoading(!1))})},theme:"primary",className:"_loginBtn_jq9ry_95"}),(0,q.jsx)("div",{className:"_footer_jq9ry_59",children:(0,q.jsx)("button",{type:"button",className:K(u3,"_createAccount_jq9ry_109"),onClick:()=>n.setCurrentScreen(nS.CreateAccount),children:"Criar uma nova conta"})}),(0,q.jsxs)("div",{className:"_divider_jq9ry_1",children:[(0,q.jsx)(uJ,{size:"sm"}),(0,q.jsx)("span",{children:"ou"}),(0,q.jsx)(uJ,{size:"sm"})]}),(0,q.jsx)("div",{className:"_socialLogin_jq9ry_90",children:(0,q.jsx)(u1,{label:"Acessar com Google",onSuccess:()=>{e(),n.setLoginModalOpen(!1)}})})]})})},u5=()=>(0,q.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"106",height:"107",viewBox:"0 0 106 107",fill:"none",children:[(0,q.jsx)("path",{d:"M96.6058 62.41C95.6447 63.6008 95.2278 65.1448 95.4663 66.6589L97.134 77.197C97.2877 78.045 96.8036 78.8789 95.9927 79.1651L86.0535 82.9758C84.6189 83.527 83.4794 84.6541 82.93 86.0851L79.1175 96.0262C78.8313 96.8388 77.9975 97.3229 77.1495 97.1674L66.6131 95.4997C65.099 95.263 63.5532 95.6781 62.3642 96.641L54.0927 103.333C53.439 103.886 52.4815 103.886 51.8261 103.333L43.5545 96.6392C42.3656 95.6781 40.8197 95.2612 39.3057 95.4979L28.7675 97.1657C27.9195 97.3211 27.0874 96.8371 26.8012 96.0244L22.9905 86.0834C22.4411 84.6471 21.3122 83.5093 19.8812 82.9564L9.97903 79.1492C9.16636 78.8648 8.68406 78.0309 8.83776 77.1811L10.5055 66.6447C10.7405 65.1289 10.3253 63.5831 9.36423 62.3941L2.67386 54.1385C2.11913 53.4848 2.11913 52.5273 2.67386 51.8736L9.36423 43.6003C10.3253 42.4114 10.7422 40.8655 10.5055 39.3515L8.83423 28.8098C8.68053 27.9618 9.16283 27.1279 9.97373 26.8435L19.913 23.0328C21.3493 22.4816 22.487 21.3545 23.0382 19.9235L26.8507 9.98066C27.1351 9.16799 27.969 8.68569 28.817 8.83939L39.3534 10.5071C40.8692 10.7439 42.415 10.3269 43.6022 9.36586L51.8738 2.67373C52.5292 2.11899 53.4867 2.11899 54.1404 2.67373L62.4137 9.36586C63.6027 10.3269 65.1485 10.7439 66.6625 10.5054L77.2007 8.83763C78.0487 8.68393 78.8826 9.16799 79.167 9.97889L82.9777 19.9182C83.5289 21.3545 84.656 22.4922 86.087 23.0452L96.0263 26.8559C96.839 27.1421 97.3213 27.9759 97.1676 28.8239L95.4998 39.3621C95.2631 40.8779 95.6783 42.422 96.6411 43.6109L103.331 51.8842C103.884 52.5379 103.884 53.4954 103.331 54.1509",fill:"#B7E0F3"}),(0,q.jsx)("path",{d:"M104.821 56.324C106.393 54.3806 106.393 51.607 104.821 49.6637L98.2841 41.6006C97.9696 41.2066 97.8354 40.7031 97.9166 40.2084L99.5349 29.9582C99.9253 27.4937 98.535 25.0928 96.2047 24.2007L86.4651 20.4854C85.9934 20.3052 85.6242 19.9342 85.444 19.4643L81.7287 9.77585C80.833 7.44562 78.432 6.05525 75.9693 6.44745L65.7156 8.06925C65.2227 8.14698 64.7174 8.01625 64.3252 7.69825L56.3293 1.17925C54.386 -0.393083 51.6123 -0.393083 49.6689 1.17925L41.6041 7.71592C41.2101 8.03215 40.7066 8.16642 40.212 8.08515L29.96 6.46512C27.4955 6.07292 25.0946 7.46505 24.2007 9.79352L20.4854 19.5331C20.3052 20.0031 19.9342 20.3741 19.4643 20.5543L9.77232 24.2696C7.44385 25.1635 6.05348 27.5626 6.44568 30.0289L8.06572 40.2774C8.14522 40.772 8.01272 41.2773 7.69472 41.6695L1.17925 49.6654C-0.393083 51.6087 -0.393083 54.3806 1.17925 56.3222L7.71415 64.3888C8.02862 64.781 8.16465 65.2863 8.08162 65.7792L6.46335 76.0312C6.07115 78.4957 7.46152 80.8965 9.79175 81.7887L19.5314 85.5075C20.0031 85.6877 20.3723 86.0552 20.5543 86.5269L24.2696 96.2135C25.1635 98.5402 27.5644 99.9342 30.0307 99.5384L40.2809 97.9201C40.7756 97.8424 41.2808 97.9731 41.673 98.2911L49.7396 104.824C51.683 106.397 54.4566 106.397 56.3999 104.824L64.4683 98.2911C64.8605 97.9731 65.3658 97.8389 65.8569 97.9184L76.1089 99.5384C78.5787 99.9342 80.9761 98.5402 81.8682 96.2135L85.5164 86.4562C85.6966 85.9828 86.0641 85.6135 86.5358 85.4351L96.2259 81.718C98.5526 80.8241 99.9465 78.4232 99.5508 75.9587L97.9325 65.7085C97.853 65.2139 97.9855 64.7086 98.3035 64.3181L104.821 56.324ZM95.6694 62.207C94.7243 63.3765 94.3197 64.8923 94.5564 66.3745L96.1817 76.653C96.3143 7
47.4781 95.8461 78.2784 95.0705 78.5787L85.3574 82.3028C83.9476 82.8399 82.8381 83.9493 82.301 85.3591L78.5734 95.0723C78.2731 95.8496 77.4728 96.316 76.6477 96.1853L66.3675 94.5599C64.887 94.3214 63.373 94.726 62.2017 95.6712L54.1139 102.226C53.4638 102.752 52.5363 102.752 51.8879 102.226L43.7966 95.673C42.627 94.7295 41.113 94.3232 39.6308 94.5617L29.3505 96.187C28.5255 96.3195 27.7252 95.8514 27.4249 95.074L23.6989 85.3609C23.1601 83.9529 22.0524 82.8434 20.6426 82.3046L10.9295 78.5769C10.1521 78.2766 9.68575 77.4781 9.81648 76.6513L11.4418 66.3728C11.6785 64.8923 11.2722 63.3783 10.3288 62.207L3.77625 54.1156C3.24802 53.4673 3.24802 52.5398 3.77625 51.8896L10.3271 43.7983C11.2722 42.6323 11.6785 41.1165 11.44 39.6343L9.81472 29.354C9.68222 28.529 10.1486 27.7287 10.9259 27.4284L20.6391 23.7025C22.0471 23.1637 23.1566 22.056 23.6954 20.6462L27.4231 10.933C27.7216 10.1557 28.5219 9.68928 29.347 9.82002L39.6255 11.4454C41.1095 11.6821 42.6235 11.2758 43.7948 10.3324L51.8826 3.77978C52.5363 3.25155 53.462 3.25155 54.1121 3.77978L62.2034 10.3306C63.3712 11.2775 64.887 11.6821 66.3693 11.4436L76.6477 9.81825C77.4728 9.68752 78.2731 10.1539 78.5734 10.9312L82.2975 20.6462C82.8363 22.0524 83.9458 23.1619 85.3539 23.7007L95.067 27.4284C95.8443 27.7269 96.3107 28.5273 96.18 29.3523L94.5546 39.6307C94.3179 41.1147 94.7225 42.6288 95.6676 43.8001L102.218 51.8879C102.747 52.538 102.747 53.4655 102.218 54.1139L95.6676 62.2052L95.6694 62.207Z",fill:"#046ABC"}),(0,q.jsx)("path",{d:"M76.1584 39.991C75.4712 39.2967 74.3635 39.2967 73.6745 39.991L48.4783 65.5989L35.6346 52.5432C33.9828 51.1051 31.7356 53.3912 33.1507 55.0678L47.2452 69.3954C47.9342 70.0897 49.0419 70.0897 49.7309 69.3954L76.1602 42.5315C76.8563 41.8337 76.8563 40.6871 76.1602 39.9875",fill:"white"}),(0,q.jsx)("path",{d:"M53.5636 20.9534C35.5595 20.9534 20.9492 35.5638 20.9492 53.5661C20.9492 71.5684 35.5596 86.1788 53.5619 86.1788C71.5642 86.1788 86.1745 71.5684 86.1745 53.5661C86.1745 35.5638 71.566 20.9534 53.5636 20.9534Z",fill:"#17B51C",stroke:"#00C7BB",strokeWidth:"2"}),(0,q.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M47.0407 69.8724L30.7344 53.5661L35.333 48.9675L47.0407 60.6434L71.7952 35.8906L76.3939 40.521L47.0407 69.8724Z",fill:"white"})]});function u6({onClose:e}){return(0,q.jsxs)(u4,{children:[(0,q.jsxs)("div",{className:"_container_1ozy6_1",children:[(0,q.jsx)(u5,{}),(0,q.jsx)("strong",{children:"Tudo certo! Sua conta foi criada com sucesso"}),(0,q.jsx)("span",{children:"Acesse agora sua nova conta e nunca mais perca nenhuma promo de viagem"})]}),(0,q.jsx)(ee,{label:"Ok",theme:"secondary","data-cy":"resetpassword",onClick:e})]})}let u7=({size:e=48,color:t="#fff"})=>(0,q.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 48 48",fill:t,children:[(0,q.jsx)("path",{d:"M24 45.6C24 46.9255 22.9228 48.0124 21.604 47.8801C19.2742 47.6463 16.9868 47.0724 14.8156 46.1731C11.9038 44.967 9.25804 43.1992 7.02943 40.9706C4.80083 38.742 3.033 36.0962 1.82689 33.1844C0.620777 30.2726 -8.39104e-07 27.1517 0 24C8.39106e-07 20.8483 0.62078 17.7274 1.82689 14.8156C3.03301 11.9038 4.80084 9.25804 7.02944 7.02943C9.25805 4.80083 11.9038 3.033 14.8156 1.82689C16.9868 0.927552 19.2742 0.353658 21.604 0.119899C22.9229 -0.0124293 24 1.07452 24 2.4C24 3.72548 22.9214 4.78455 21.6062 4.9498C19.9074 5.16328 18.241 5.60351 16.6525 6.26151C14.323 7.2264 12.2064 8.64066 10.4236 10.4235C8.64067 12.2064 7.22641 14.323 6.26151 16.6525C5.29662 18.9819 4.8 21.4786 4.8 24C4.8 26.5214 5.29662 29.0181 6.26151 31.3475C7.2264 33.677 8.64066 35.7936 10.4235 37.5765C12.2064 39.3593 14.323 40.7736 16.6525 41.7385C18.241 42.3965 19.9073 42.8367 21.6062 43.0502C22.9214 43.2155 24 44.2745 24 45.6Z",className:"vdp-ui-spinner-rotate-left"}),(0,q.jsx)("path",{d:"M24 12.95C24 11.873 24.8778 10.985 25.9427 11.146C26.9815 11.303 27.9998 11.5857 28.9749 11.9896C30.5521 12.6429 31.9852 13.6005 33.1924 14.8076C34.3996 16.0148 35.3571 17.4479 36.0104 19.0251C36.6637 20.6024 37 22.2928 37 24C37 25.7072 36.6637 27.3977 36.0104 28.9749C35.3571 30.5521 34.3995 31.9852 33.1924 33.1924C31.9852 34.3996 30.5521 35.3571 28.9749 36.0104C27.9998 36.4143 26.9815 36.697 25.9427 36.854C24.8778 37.015 24 36.127 24 35.05C24 33.973 24.8828 33.1209 25.9351 32.89
419C26.463 32.777 26.9809 32.615 27.4824 32.4073C28.5865 31.95 29.5897 31.2797 30.4347 30.4347C31.2797 29.5897 31.95 28.5865 32.4073 27.4824C32.8646 26.3784 33.1 25.195 33.1 24C33.1 22.805 32.8646 21.6216 32.4073 20.5176C31.95 19.4135 31.2797 18.4103 30.4347 17.5653C29.5897 16.7203 28.5865 16.05 27.4824 15.5927C26.9809 15.385 26.463 15.223 25.9351 15.1081C24.8828 14.8791 24 14.027 24 12.95Z",className:"vdp-ui-spinner-rotate-right"})]}),u8=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"M19.9036 11.6379C18.3967 8.20881 15.4149 5.88867 12 5.88867C8.58506 5.88867 5.60244 8.21034 4.09636 11.6379C4.04339 11.7609 4 11.9731 4 12.1109C4 12.2491 4.04339 12.4608 4.09636 12.5838C5.60331 16.0129 8.58506 18.3331 12 18.3331C15.4149 18.3331 18.3976 16.0114 19.9036 12.5838C19.9566 12.4608 20 12.2486 20 12.1109C20 11.9726 19.9566 11.7609 19.9036 11.6379ZM12 16.9998C9.23669 16.9998 6.68989 15.1248 5.34511 12.111C6.69472 9.09326 9.23919 7.22201 12 7.22201C14.7633 7.22201 17.3101 9.09695 18.6549 12.1107C17.3053 15.1285 14.7608 16.9998 12 16.9998ZM12 8.55534C10.0371 8.55534 8.44444 10.1483 8.44444 12.1109C8.44444 14.0734 10.0371 15.6664 12 15.6664H12.0016C13.9637 15.6664 15.5556 14.0742 15.5556 12.1124V12.1109C15.5556 10.1483 13.963 8.55534 12 8.55534ZM12 14.3331C10.7747 14.3331 9.77778 13.3362 9.77778 12.1109C9.77778 12.0901 9.78331 12.0709 9.78392 12.0502C9.92436 12.0866 10.07 12.1109 10.2222 12.1109C11.2041 12.1109 12 11.3149 12 10.3331C12 10.1809 11.9757 10.0353 11.9393 9.89481C11.96 9.8942 11.9792 9.88867 12 9.88867C13.2253 9.88867 14.2222 10.8856 14.2222 12.1124C14.2222 13.3369 13.226 14.3331 12 14.3331Z"})}),de=e=>{let[t,n]=(0,z.useState)(!0);return(0,q.jsx)(eG,{...e,type:t?"password":"",rightIcon:(0,q.jsx)("button",{type:"button",className:"_iconButton_z591q_1",onClick:()=>n(!t),children:(0,q.jsx)(u8,{})})})};function dt({onClose:e}){let t=uZ(),[n,r]=(0,z.useState)(!1),i=t5().min(6);async function s(){r(!0);try{i.parse(t.newUserPassword),cI(uP,t.newUserEmail,t.newUserPassword).then(n=>{let r=n.user;if(r.emailVerified)return e();cS(r,{displayName:t.newUserName}),t.sendVerificationEmail(),t.setCurrentScreen(nS.VerificationCode),cP(uP)}).catch(e=>{e.message.includes("email-already-in-use")&&t.setEmailAlreadyUsedError(!0)}).finally(()=>{r(!1)})}catch{t.setCreatePasswordError(!0)}}return(0,q.jsxs)(u4,{children:[(0,q.jsx)(de,{className:"_removeFill_1gpus_1","data-cy":"",placeholder:"Senha",leftIcon:(0,q.jsx)(uX,{color:"#4A4949",size:24}),value:t.newUserPassword,type:"password",hasError:t.createPasswordError,errorMessage:t.createPasswordError?"Sua senha deve conter no m\xednimo 6 caracteres":"",onChange:e=>t.setNewUserPassword(e.target.value),onFocus:()=>t.setCreatePasswordError(!1)}),(0,q.jsx)("span",{className:"_passwordHint_1gpus_5",children:"Sua senha deve conter no m\xednimo 6 caracteres"}),(0,q.jsx)("div",{className:"_button_1gpus_13",children:(0,q.jsx)(ee,{"data-cy":"",label:"Criar minha conta",onClick:s,theme:"secondary",disabled:n||t.newUserPassword.trim().length<6,leftIcon:(0,q.jsx)(eR,{value:n,children:(0,q.jsx)(u7,{size:20})})})})]})}let dn="_input_1ttgj_21";function dr(){let e=uZ(),t=t5().email();async function n(){e.isSendingRecoverPasswordEmail||(e.setIsSendingRecoverPasswordEmail(!0),await e.sendRecoverPasswordEmail(),e.setIsSendingRecoverPasswordEmail(!1),e.setCurrentScreen(nS.ResetPasswordCode))}let r=(0,z.useCallback)(()=>{try{t.parse(e.recoverPasswordEmail)}catch{return!1}return!0},[e.recoverPasswordEmail,t]);return(0,q.jsxs)(u4,{children:[(0,q.jsx)(eG,{className:dn,"data-cy":"",placeholder:"E-mail",leftIcon:(0,q.jsx)(uQ,{color:"#4A4949",size:24}),value:null==e?void 0:e.recoverPasswordEmail,onChange:t=>null==e?void 0:e.setRecoverPasswordEmail(t.target.value)}),(0,q.jsx)(uY,{className:"_button_1ttgj_1",theme:"primary","data-cy":"resetPassword",label:e.isSendingRecoverPasswordEmail?"Carregando...":"Redefinir senha",disabled:e.isSendingRecoverPasswordEmail||!r(),leftIcon:(0,q.jsx)(eR,{value:e.isSendingRecoverPasswordEmail,children:(0,q.jsx)(u7,{size:20})}),onClick:n}),(0,q.jsx)(uY,{className:dn,leftIcon:(0,q.jsx)(et,{size:24,color:"#f59a1b"}),"data-cy":"backToLoginScreen",label:"Voltar pro login",variant:"outline",onClick:()=>e.setCurrentScreen(nS.Login)}),(0,q.jsxs)("div",{className:"_footer_1ttgj_7",children:[(0,q.jsx)("span",{children:"Ainda n\xe3o tem conta?"}),(0,q.jsx)("button",{type:"button",className:"_link_1ttgj_11",onClick:()=>e.setCurrentScreen(nS.CreateAccount),children:"Crie a sua aqui"})]})]})}let di=({className:e,...t})=>(0,q.jsxs)("div",{className:J("vdp-ui-checkbox-group",e),children:[(0,q.jsx)("input",{"data-testid":"checkbox-input",type:"checkbox",className:"vdp-ui-checkbox-input",...t}),(0,q.jsx)("label",{className:"vdp-ui-checkbox-label",htmlFor:t.i
4d,children:t.label})]}),ds="_link_yui2k_38",da="_input_yui2k_56";function dl({onClose:e,isMilesLogin:t}){let n=uZ(),r=t5().email(),i=t5().min(6),s=(0,z.useCallback)(()=>{try{r.parse(n.loginEmail),i.parse(n.loginPassword)}catch{return!1}return!0},[n.loginEmail,n.loginPassword,r,i]);return(0,q.jsxs)(u4,{isMilesLogin:t,children:[(0,q.jsx)(u1,{label:"Acessar com Google",onSuccess:()=>{e(),n.setLoginModalOpen(!1)}}),(0,q.jsxs)("div",{className:"_divider_yui2k_1",children:[(0,q.jsx)(uJ,{size:"sm"}),(0,q.jsx)("span",{children:"ou"}),(0,q.jsx)(uJ,{size:"sm"})]}),(0,q.jsx)(eG,{className:da,"data-cy":"email",id:"email",type:"email",placeholder:"E-mail",mask:"email",value:n.loginEmail,onChange:e=>n.setLoginEmail(e.target.value),leftIcon:(0,q.jsx)(uQ,{color:"#4A4949",size:24}),onFocus:()=>n.setLoginError(!1),hasError:n.loginError}),(0,q.jsx)(eG,{className:da,"data-cy":"password",id:"password",placeholder:"Senha",type:"password",value:n.loginPassword,onChange:e=>n.setLoginPassword(e.target.value),leftIcon:(0,q.jsx)(uX,{color:"#4A4949",size:24}),onFocus:()=>n.setLoginError(!1),hasError:n.loginError}),(0,q.jsx)(eR,{value:n.loginError,children:(0,q.jsx)("div",{className:"_errorMessage_yui2k_20",children:(0,q.jsx)("span",{children:"E-mail ou senha incorretos"})})}),(0,q.jsx)("div",{className:"_forgotPassword_yui2k_29",children:(0,q.jsx)("button",{type:"button",className:ds,onClick:()=>n.setCurrentScreen(nS.ForgotPassword),children:"Esqueceu sua senha?"})}),(0,q.jsx)(di,{id:"stay_connected",label:"Mantenha-me conectado",className:"_stayConnected_yui2k_48",onChange:()=>{n.setLoginStayConnected(!n.loginStayConnected)}}),(0,q.jsx)(uY,{className:da,disabled:n.isLoading??!s(),"data-cy":"login-button",label:"Entrar",onClick:function(){n.setIsLoading(!0),(n.loginStayConnected?cN(uP,cL):Promise.resolve()).then(()=>{cE(uP,n.loginEmail,n.loginPassword).then(async t=>{t.user.emailVerified?e():(cP(uP),n.setNewUserEmail(n.loginEmail),n.sendVerificationEmail(n.loginEmail),n.setCurrentScreen(nS.VerificationCode))}).catch(()=>{n.setLoginError(!0)}).finally(()=>n.setIsLoading(!1))})},theme:"primary"}),(0,q.jsxs)("div",{className:"_footer_yui2k_52",children:[(0,q.jsx)("span",{children:"Ainda n\xe3o tem conta?"}),(0,q.jsx)("button",{type:"button",className:ds,onClick:()=>n.setCurrentScreen(nS.CreateAccount),children:"Crie a sua aqui"})]})]})}function dc({isMilesLogin:e}){let[t,n]=(0,z.useState)(!1),r=t5().min(6),i=uZ();async function s(){if(!t)try{r.parse(i.newPassword),n(!0);let e=await i.updatePassword();n(!1),e?i.setCurrentScreen(nS.ResetPasswordSuccess):i.setNewPasswordError(!0)}catch{i.setNewPasswordError(!0)}finally{n(!1)}}return(0,q.jsxs)(u4,{children:[(0,q.jsx)(de,{"data-cy":"new-password",id:"new-password",placeholder:"Senha",leftIcon:(0,q.jsx)(uX,{color:"#4A4949",size:24}),value:i.newPassword,onChange:e=>i.setNewPassword(e.target.value),hasError:i.newPasswordError,type:"password",errorMessage:i.newPasswordError?"Sua senha deve conter no m\xednimo 6 caracteres":""}),(0,q.jsx)("span",{className:"_passwordHint_19nfr_1",children:"Sua senha deve conter no m\xednimo 6 caracteres"}),(0,q.jsx)("div",{className:"_button_19nfr_9",children:(0,q.jsx)(uY,{theme:e?"primary":"secondary",label:t?"Carregando...":"Redefinir senha","data-cy":"resetpassword",onClick:s,disabled:t||i.newPassword.length<6,leftIcon:(0,q.jsx)(eR,{value:t,children:(0,q.jsx)(u7,{size:20})})})})]})}function du({onClose:e,isMilesLogin:t}){return(0,q.jsxs)(u4,{children:[(0,q.jsxs)("div",{className:"_container_1ozy6_1",children:[(0,q.jsx)(u5,{}),(0,q.jsx)("strong",{children:"Tudo certo! Sua senha foi alterada com sucesso!"}),(0,q.jsx)("span",{children:"Estreie a nova senha acessando sua conta e encontre agora nossas melhores promos!"})]}),(0,q.jsx)(uY,{label:"Ok",theme:t?"primary":"secondary","data-cy":"resetpassword",onClick:e})]})}var dd={exports:{}},dh={exports:{}},dp={};dd.exports=(function(){if(V)return $;V=1;var e=U?F:(U=1,F="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");function t(){}function n(){}return n.resetWarningCache=t,$=function(){function r(t,n,r,i,s,a){if(a!==e){var o=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 o.name="Invariant Violation",o}}function i(){return r}r.isRequired=r;var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s}})()();
4let df=H(dd.exports);var dm=["sitekey","onChange","theme","type","tabindex","onExpired","onErrored","size","stoken","grecaptcha","badge","hl","isolated"];function dg(){return(dg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function d_(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dv(e,t){return(dv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var dy=function(e){function t(){var t;return(t=e.call(this)||this).handleExpired=t.handleExpired.bind(d_(t)),t.handleErrored=t.handleErrored.bind(d_(t)),t.handleChange=t.handleChange.bind(d_(t)),t.handleRecaptchaRef=t.handleRecaptchaRef.bind(d_(t)),t}t.prototype=Object.create(e.prototype),t.prototype.constructor=t,dv(t,e);var n=t.prototype;return n.getCaptchaFunction=function(e){return this.props.grecaptcha?this.props.grecaptcha.enterprise?this.props.grecaptcha.enterprise[e]:this.props.grecaptcha[e]:null},n.getValue=function(){var e=this.getCaptchaFunction("getResponse");return e&&void 0!==this._widgetId?e(this._widgetId):null},n.getWidgetId=function(){return this.props.grecaptcha&&void 0!==this._widgetId?this._widgetId:null},n.execute=function(){var e=this.getCaptchaFunction("execute");if(e&&void 0!==this._widgetId)return e(this._widgetId);this._executeRequested=!0},n.executeAsync=function(){var e=this;return new Promise(function(t,n){e.executionResolve=t,e.executionReject=n,e.execute()})},n.reset=function(){var e=this.getCaptchaFunction("reset");e&&void 0!==this._widgetId&&e(this._widgetId)},n.forceReset=function(){var e=this.getCaptchaFunction("reset");e&&e()},n.handleExpired=function(){this.props.onExpired?this.props.onExpired():this.handleChange(null)},n.handleErrored=function(){this.props.onErrored&&this.props.onErrored(),this.executionReject&&(this.executionReject(),delete this.executionResolve,delete this.executionReject)},n.handleChange=function(e){this.props.onChange&&this.props.onChange(e),this.executionResolve&&(this.executionResolve(e),delete this.executionReject,delete this.executionResolve)},n.explicitRender=function(){var e=this.getCaptchaFunction("render");if(e&&void 0===this._widgetId){var t=document.createElement("div");this._widgetId=e(t,{sitekey:this.props.sitekey,callback:this.handleChange,theme:this.props.theme,type:this.props.type,tabindex:this.props.tabindex,"expired-callback":this.handleExpired,"error-callback":this.handleErrored,size:this.props.size,stoken:this.props.stoken,hl:this.props.hl,badge:this.props.badge,isolated:this.props.isolated}),this.captcha.appendChild(t)}this._executeRequested&&this.props.grecaptcha&&void 0!==this._widgetId&&(this._executeRequested=!1,this.execute())},n.componentDidMount=function(){this.explicitRender()},n.componentDidUpdate=function(){this.explicitRender()},n.handleRecaptchaRef=function(e){this.captcha=e},n.render=function(){var e=this.props;e.sitekey,e.onChange,e.theme,e.type,e.tabindex,e.onExpired,e.onErrored,e.size,e.stoken,e.grecaptcha,e.badge,e.hl,e.isolated;var t=function(e,t){if(null==e)return{};var n,r,i={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,dm);return z.createElement("div",dg({},t,{ref:this.handleRecaptchaRef}))},t}(z.Component);dy.displayName="ReCAPTCHA",dy.propTypes={sitekey:df.string.isRequired,onChange:df.func,grecaptcha:df.object,theme:df.oneOf(["dark","light"]),type:df.oneOf(["image","audio"]),tabindex:df.number,onExpired:df.func,onErrored:df.func,size:df.oneOf(["compact","normal","invisible"]),stoken:df.string,hl:df.string,badge:df.oneOf(["bottomright","bottomleft","inline"]),isolated:df.bool},dy.defaultProps={onChange:function(){},theme:"light",type:"image",tabindex:0,size:"normal",badge:"bottomright"};var dw=(M||(M=1,dh.exports=function(){if(D)return dp;D=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,f=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,_=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function y(e){if("object"==typeof e&&null!==e){var h=e.$$typeof;switch(h){case t:switch(e=e.type){case l:case c:case r:case s:case i:case d:return e;default:switch(e=e&&e.$$typeof){case o:case u:case f:case p:case a:return e;default:return h}}case n:return h}}}function w(e){return y(e)===c}return dp.AsyncMode=l,dp.ConcurrentMode=c,dp.ContextConsumer=o,dp.ContextProvider=a,dp.Element=t,dp.ForwardRef=u,dp.Fragment=r,dp.Lazy=f,dp.Memo=p,dp.Portal=n,dp.Profiler=s,dp.StrictMode=i,dp.Suspense=
4d,dp.isAsyncMode=function(e){return w(e)||y(e)===l},dp.isConcurrentMode=w,dp.isContextConsumer=function(e){return y(e)===o},dp.isContextProvider=function(e){return y(e)===a},dp.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},dp.isForwardRef=function(e){return y(e)===u},dp.isFragment=function(e){return y(e)===r},dp.isLazy=function(e){return y(e)===f},dp.isMemo=function(e){return y(e)===p},dp.isPortal=function(e){return y(e)===n},dp.isProfiler=function(e){return y(e)===s},dp.isStrictMode=function(e){return y(e)===i},dp.isSuspense=function(e){return y(e)===d},dp.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===c||e===s||e===i||e===d||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===a||e.$$typeof===o||e.$$typeof===u||e.$$typeof===g||e.$$typeof===_||e.$$typeof===v||e.$$typeof===m)},dp.typeOf=y,dp}()),dh.exports),dC={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},db={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},dk={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},dx={};function dI(e){return dw.isMemo(e)?dk:dx[e.$$typeof]||dC}dx[dw.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},dx[dw.Memo]=dk;var dE=Object.defineProperty,dT=Object.getOwnPropertyNames,dS=Object.getOwnPropertySymbols,dN=Object.getOwnPropertyDescriptor,dP=Object.getPrototypeOf,dR=Object.prototype;let dO=H(function e(t,n,r){if("string"!=typeof n){if(dR){var i=dP(n);i&&i!==dR&&e(t,i,r)}var s=dT(n);dS&&(s=s.concat(dS(n)));for(var a=dI(t),o=dI(n),l=0;l<s.length;++l){var c=s[l];if(!db[c]&&!(r&&r[c])&&!(o&&o[c])&&!(a&&a[c])){var u=dN(n,c);try{dE(t,c,u)}catch{}}}}return t});function dL(){return(dL=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var dA={},dj=0,dD="onloadcallback";function dM(){return"u">typeof window&&window.recaptchaOptions||{}}let dF=(I=function(){var e=dM(),t=e.useRecaptchaNet?"recaptcha.net":"www.google.com";return e.enterprise?"https://"+t+"/recaptcha/enterprise.js?onload="+dD+"&render=explicit":"https://"+t+"/recaptcha/api.js?onload="+dD+"&render=explicit"},E=(E={callbackName:dD,globalName:"grecaptcha",attributes:dM().nonce?{nonce:dM().nonce}:{}})||{},function(e){var t=e.displayName||e.name||"Component",n=function(t){function n(e,n){var r;return(r=t.call(this,e,n)||this).state={},r.__scriptURL="",r}n.prototype=Object.create(t.prototype),n.prototype.constructor=n,n.__proto__=t;var r=n.prototype;return r.asyncScriptLoaderGetScriptLoaderID=function(){return this.__scriptLoaderID||(this.__scriptLoaderID="async-script-loader-"+dj++),this.__scriptLoaderID},r.setupScriptURL=function(){return this.__scriptURL="function"==typeof I?I():I,this.__scriptURL},r.asyncScriptLoaderHandleLoad=function(e){var t=this;this.setState(e,function(){return t.props.asyncScriptOnLoad&&t.props.asyncScriptOnLoad(t.state)})},r.asyncScriptLoaderTriggerOnScriptLoaded=function(){var e=dA[this.__scriptURL];if(!e||!e.loaded)throw Error("Script is not loaded.");for(var t in e.observers)e.observers[t](e);delete window[E.callbackName]},r.componentDidMount=function(){var e=this,t=this.setupScriptURL(),n=this.asyncScriptLoaderGetScriptLoaderID(),r=E,i=r.globalName,s=r.callbackName,a=r.scriptId;if(i&&"u">typeof window[i]&&(dA[t]={loaded:!0,observers:{}}),dA[t]){var o=dA[t];if(o&&(o.loaded||o.errored)){this.asyncScriptLoaderHandleLoad(o);return}o.observers[n]=function(t){return e.asyncScriptLoaderHandleLoad(t)};return}var l={};l[n]=function(t){return e.asyncScriptLoaderHandleLoad(t)},dA[t]={loaded:!1,observers:l};var c=document.createElement("script");for(var u in c.src=t,c.async=!0,E.attributes)c.setAttribute(u,E.attributes[u]);a&&(c.id=a);var d=function(e){if(dA[t]){var n=dA[t].observers;for(var r in n)e(n[r])&&delete n[r]}};s&&"u">typeof window&&(window[s]=function(){return e.asyncScriptLoaderTriggerOnScriptLoaded()}),c.onload=function(){var e=dA[t];e&&(e.loaded=!0,d(function(t){return!s&&(t(e),!0)}))},c.onerror=function(){var e=dA[t];e&&(e.errored=!0,d(function(t){return t(e),!0}))},document.body.appendChild(c)},r.componentWillUnmount=function(){var e=this.__scriptURL;if(!0===E.removeOnUnmount)for(var t=document.getElementsByTagName("script"),n=0;n<t.length;n+=1)t[n].src.indexOf(e)>-1&&t[n].parentNode&&t[n].parentNode.removeChild(t[n]);var r=dA[e];r&&(delete r.observers[this.asyncScriptLoaderGetScriptLoaderID()],!0===E.removeOnUnmount&&delete dA[e])},r.render=function(){var t=E.globalName,n=this.props;n.asyncScriptOnLoad;var r=n.forwardedRef,i=function(e,t){if(null==e)return{};var n,r,i={},s=Object.keys(e);for(r=0;r<s.length;r++)t.indexOf(n=s[r])>=0||(i[n]=e[n]);return i}(n,["asyncScriptOnLoad","forwardedRef"]);return t&&"u">typeof window&&(i[t]="u">typeof window[t]?window[t]:void 0),i.ref=r,(0,z.createElement)(e,i)},n}(z.Component),r=(0,z.forwardRef)(function(e,t){return(0,z.createElement)(n,dL({},e,{forwardedRef:t}))});
4return r.displayName="AsyncScriptLoader("+t+")",r.propTypes={asyncScriptOnLoad:df.func},dO(r,e)})(dy),dU="_footer_1hkr3_27",d$="_button_1hkr3_34",dV="_input_1hkr3_44";function dq({isMilesLogin:e}){let t=uZ(),n=t5().email(),r=t5().min(3),i=(0,z.useRef)(null),s=(0,z.useCallback)(async()=>{var e;try{n.parse(t.newUserEmail),r.parse(t.newUserName)}catch{t.setCreateAccountLoginError("E-mail ou senha invalidos");return}t.setIsLoading(!0);let s=await uR.firebaseVerifyEmailRegistered(t.newUserEmail,t.recaptchaToken);t.setIsLoading(!1),t.setRecaptchaToken(""),null==(e=i.current)||e.reset(),(null==s?void 0:s.success)===!0?null!=s&&s.message&&s.message.includes("sem")?t.setCurrentScreen(nS.CreatePassword):t.setCreateAccountLoginError(null==s?void 0:s.message):t.setCreateAccountLoginError((null==s?void 0:s.message)||"Falha ao conectar ao servidor")},[n,r,t,i]),a=(0,z.useCallback)(()=>{try{n.parse(t.newUserEmail),r.parse(t.newUserName)}catch{return!1}return t.recaptchaToken.length>0},[t.recaptchaToken,t.newUserEmail,t.newUserName,n,r]);return(0,q.jsxs)(u4,{isMilesLogin:e,children:[(0,q.jsx)(u1,{label:"Criar conta com Google"}),(0,q.jsxs)("div",{className:"_divider_1hkr3_1",children:[(0,q.jsx)(uJ,{size:"sm"}),(0,q.jsx)("span",{children:"ou"}),(0,q.jsx)(uJ,{size:"sm"})]}),(0,q.jsx)(eG,{className:dV,"data-cy":"name",id:"name",placeholder:"Nome completo",leftIcon:(0,q.jsx)(ny,{color:"#4A4949",size:16}),value:t.newUserName,onChange:e=>t.setNewUserName(e.target.value.trimStart().normalize("NFD").replace(/([\u0300-\u036f]|[^a-zA-Z\s])/g,"")),onFocus:()=>t.setCreateAccountLoginError(""),hasError:t.createAccountLoginError.length>0}),(0,q.jsx)(eG,{className:dV,"data-cy":"email",id:"email",type:"email",placeholder:"E-mail",mask:"email",leftIcon:(0,q.jsx)(uQ,{color:"#4A4949",size:24}),value:t.newUserEmail,onChange:e=>t.setNewUserEmail(e.target.value),onFocus:()=>t.setCreateAccountLoginError(""),hasError:t.createAccountLoginError.length>0}),(0,q.jsx)(eR,{value:t.createAccountLoginError.length>0,children:(0,q.jsx)("div",{className:"_errorMessage_1hkr3_1",children:(0,q.jsx)("span",{children:t.createAccountLoginError})})}),(0,q.jsx)(dF,{ref:i,sitekey:"6Lf4kMwnAAAAAKEJVKkgxtX4kxCuqw1QJ4ZO_PM2",onReset:()=>t.setRecaptchaToken(""),onChange:e=>t.setRecaptchaToken(e??""),hl:"pt-BR"}),(0,q.jsx)(uY,{theme:"primary",className:dV,"data-cy":"create-account-button",label:"Criar minha conta",onClick:s,disabled:t.isLoading||!a()}),(0,q.jsx)("div",{className:dU,children:(0,q.jsxs)("span",{children:["Ao continuar, voc\xea concorda com nossos"," ",(0,q.jsx)("button",{type:"button",className:d$,onClick:()=>window.open("https://www.vaidepromo.com.br/atendimento/wp-content/uploads/2023/06/Termo_de_Uso_e_Condicoes-Vai_de_Promo-22052023.pdf"),children:"Termos de Uso e Condi\xe7\xf5es"})]})}),(0,q.jsxs)("div",{className:dU,children:[(0,q.jsx)("span",{children:"Ja tem uma conta?"}),(0,q.jsx)("button",{type:"button",className:d$,onClick:()=>t.setCurrentScreen(nS.Login),children:"Entrar"})]})]})}function dz(){let e=uZ(),[t,n]=(0,z.useState)(!1),[r,i]=(0,z.useState)(!1);async function s(){n(!0);let t=await e.validatePasswordRecoverCode();n(!1),t?e.setCurrentScreen(nS.ResetPassword):e.setRecoverPasswordCodeError(!0)}let a=(0,z.useCallback)(()=>{e.sendRecoverPasswordEmail(),i(!0)},[e]);return(0,q.jsxs)(u4,{children:[(0,q.jsx)(eG,{"data-cy":"",placeholder:"C\xf3digo de verifica\xe7\xe3o",leftIcon:(0,q.jsx)(uX,{color:"#4A4949",size:24}),value:null==e?void 0:e.recoverPasswordCode,hasError:e.recoverPasswordCodeError,errorMessage:e.recoverPasswordCodeError?"C\xf3digo invalido ou expirado":"",onChange:t=>null==e?void 0:e.setRecoverPasswordCode(t.target.value),onFocus:()=>e.setRecoverPasswordCodeError(!1)}),(0,q.jsxs)("div",{className:"_footer_u0nn6_1",children:[(0,q.jsx)(eR,{value:e&&(null==e?void 0:e.sendEmailTimer)>1,children:(0,q.jsxs)("span",{children:["Reenviar c\xf3digo em"," ",e&&dK(null==e?void 0:e.sendEmailTimer)]})}),(0,q.jsx)(eR,{value:e&&(null==e?void 0:e.sendEmailTimer)<=1,children:(0,q.jsx)("button",{type:"button",className:"_sendCode_u0nn6_24",onClick:a,children:"Reenviar c\xf3digo"})}),(0,q.jsx)(ee,{theme:"secondary",label:"Continuar","data-cy":"continue",className:"_button_u0nn6_20",disabled:t||e.recoverPasswordCode.length<4,onClick:()=>s(),leftIcon:(0,q.jsx)(eR,{value:t,children:(0,q.jsx)(u7,{size:20})})}),(0,q.jsx)(eR,{value:r,children:(0,q.jsx)("div",{className:"_sendAlert_u0nn6_31",children:(0,q.jsx)("p",{children:`Enviamos um novo c\xf3digo para o e-mail ${dZ(e.recoverPasswordEmail)} para voc\xea redefinir sua senha.`})})})]})]})}function dB(){let e=uZ(),[t,n]=(0,z.useState)(!1),[r,i]=(0,z.useState)(!1);async function s(){n(!0);let t=await e.verifyEmail();n(!1),t?e.setCurrentScreen(nS.CreateAccountSuccess):e.setVerificationCodeError(!0)}let a=(0,z.useCallback)(()=>{e.sendVerificationEmail(),i(!0)},[e]);return(0,q.jsxs)(u4,{children:[(0,q.jsx)(eG,{"data-cy":"verification-code",placeholder:"C\xf3digo de verifica\xe7\xe3o",leftIcon:(0,q.jsx)(uX,{color:"#4A4949",size:24}),value:null==e?void 0:e.verificationCode,hasError:e.verificationCodeError,errorMessage:e.verificationCodeError?"C\xf3digo invali
4do ou expirado":"",onFocus:()=>e.setVerificationCodeError(!1),onChange:t=>null==e?void 0:e.setVerificationCode(t.target.value)}),(0,q.jsxs)("div",{className:"_footer_1srsa_1",children:[(0,q.jsx)(eR,{value:e&&(null==e?void 0:e.sendEmailTimer)>1,children:(0,q.jsxs)("span",{children:["Reenviar c\xf3digo em"," ",e&&dK(null==e?void 0:e.sendEmailTimer)]})}),(0,q.jsx)(eR,{value:e&&(null==e?void 0:e.sendEmailTimer)<=1,children:(0,q.jsx)("button",{type:"button",onClick:a,className:"_sendCode_1srsa_24",children:"Reenviar c\xf3digo"})}),(0,q.jsx)(ee,{theme:"secondary",label:"Continuar","data-cy":"continue",className:"_button_1srsa_20",onClick:()=>s(),disabled:t||e.verificationCode.length<4,leftIcon:(0,q.jsx)(eR,{value:t,children:(0,q.jsx)(u7,{size:20})})}),(0,q.jsx)(eR,{value:r,children:(0,q.jsx)("div",{className:"_sendAlert_1srsa_31",children:(0,q.jsx)("p",{children:`Enviamos um novo c\xf3digo para o e-mail ${dZ(e.newUserEmail)} para voc\xea redefinir sua senha.`})})})]})]})}let dW=e=>{switch(uZ().currentScreen){case nS.Login:return e?"Crie ou acesse sua conta":"Fa\xe7a login";case nS.CreateAccount:return e?"Boas vindas ao Vai de Promo!":"Ainda n\xe3o tem uma conta?";case nS.ForgotPassword:return"Esqueceu sua senha?";case nS.VerificationCode:case nS.ResetPasswordCode:return"Verifique seu e-mail";case nS.CreatePassword:case nS.ResetPassword:return"Estamos quase l\xe1";default:return""}};function dH(e){let t=uZ();function n(){t.setCurrentScreen(0),t.resetAllValues(),e.onClose()}switch((0,z.useEffect)(()=>{e.initialScreen&&t.setCurrentScreen(e.initialScreen)},[e.initialScreen]),t.currentScreen){case nS.Login:return(0,q.jsx)(dl,{onClose:n,isMilesLogin:e.isMilesLogin});case nS.CreateAccount:return(0,q.jsx)(dq,{isMilesLogin:e.isMilesLogin});case nS.ForgotPassword:return(0,q.jsx)(dr,{});case nS.CreatePassword:return(0,q.jsx)(dt,{onClose:n});case nS.VerificationCode:return(0,q.jsx)(dB,{});case nS.CreateAccountSuccess:return(0,q.jsx)(u6,{onClose:n});case nS.ResetPassword:return(0,q.jsx)(dc,{});case nS.ResetPasswordCode:return(0,q.jsx)(dz,{});case nS.ResetPasswordSuccess:return(0,q.jsx)(du,{onClose:n});case nS.LoginV2:default:return(0,q.jsx)(u9,{onClose:n,title:e.title})}}function dZ(e){let[t,n]=e.split("@"),r=t.charAt(0),i=t.charAt(t.length-1);return`${r}*********${i}@${n}`}function dK(e){let t=String(Math.floor(e/60)).padStart(2,"0"),n=String(e%60).padStart(2,"0");return`${t}:${n}`}let dG=({size:e=24,color:t})=>(0,q.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:t,xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)("path",{d:"M17.6733 16.4677C18.0237 16.8182 18.0237 17.3867 17.6733 17.7372C17.3229 18.0876 16.7543 18.0876 16.4039 17.7372L11.9844 13.2848L7.53349 17.7357C7.18307 18.0861 6.61451 18.0861 6.26405 17.7357C5.91359 17.3852 5.91363 16.8167 6.26405 16.4662L10.7164 12.0168L6.26282 7.53227C5.91239 7.18185 5.91239 6.61329 6.26282 6.26283C6.61324 5.91237 7.1818 5.91241 7.53226 6.26283L11.9844 10.7489L16.4353 6.29799C16.7857 5.94757 17.3543 5.94757 17.7047 6.29799C18.0552 6.64841 18.0552 7.21697 17.7047 7.56743L13.2523 12.0168L17.6733 16.4677Z"})});function dY({onClose:e,noCloseButton:t,isMilesLogin:n}){let r=dW(n);return(0,q.jsx)("div",{className:"_container_18p03_1",children:(0,q.jsx)("div",{className:"_content_18p03_1",children:(0,q.jsxs)(eR,{value:""!=r,children:[(0,q.jsx)("h1",{children:r}),(0,q.jsx)(eR,{value:!t,children:(0,q.jsx)("button",{type:"button",onClick:e,children:(0,q.jsx)(dG,{})})})]})})})}let dJ=({noCloseButton:e=!0,...t})=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(eR,{value:!t.noHeader,children:(0,q.jsx)(dY,{onClose:()=>{},noCloseButton:e,isMilesLogin:t.isMilesLogin})}),(0,q.jsx)(dH,{onClose:t.onClose,title:t.screenTitle,initialScreen:t.initialScreen,isMilesLogin:t.isMilesLogin})]}),dQ=({isOpen:e,className:t,customHeader:n,onBackButtonClick:r,backButtonIcon:i,modalTitle:s,children:a})=>((0,z.useEffect)(()=>{document.body.style.overflow=e?"hidden":"unset"},[e]),(0,z.useEffect)(()=>{window.addEventListener("resize",ne),ne()},[]),(0,q.jsxs)("div",{"data-testid":"fullscreenmodal-container",className:J("vdp-ui-fullscreenmodal-container",t,{open:e}),children:[(0,q.jsx)("div",{className:"vdp-ui-fullscreenmodal-top-container-fixed",children:n||(0,q.jsxs)("div",{className:"vdp-ui-fullscreenmodal-top-container",children:[(0,q.jsx)("div",{role:"button",tabIndex:0,onClick:r,children:i}),(0,q.jsx)("span",{className:"vdp-ui-fullscreenmodal-top-title",children:s??""}),(0,q.jsx)("span",{})]})}),a]})),dX=({isOpen:e,onClose:t=()=>{},children:n,className:r,title:i,isCloseOutsideClick:s=!0,renderCloseButton:a=!0,"data-cy":o})=>{let{containerRef:l}=eY({onClickOutside:()=>s&&t()});return e?(0,q.jsx)("div",{"data-cy":o,className:"vdp-ui-modal","data-testid":o,children:(0,q.jsxs)("div",{className:J("vdp-ui-modal-content",r),ref:l,children:[(0,q.jsx)(Q,{value:a,children:(0,q.jsx)("button",{type:"button",className:"vdp-ui-modal-close",onClick:t,children:(0,q.jsx)(en,{})})}),(0,q.jsx)(Q,{value:i,children:(0,q.jsx)("div",{children:(0,q.jsx)("div",{className:"vdp-ui-modal-title",children:i})})}),(0,q.jsx)("div",{className:"vdp-ui-modal-footer",children:n})]})}):null},d0={containerFullscreen:"_containerFullscreen_1x7tm_1",content:"_content_1x7tm_1",container:"_container_1x7tm_1",fullscreen:"_fullscreen_1x7tm_31"},d1=e=>{let t=uZ(),{width:n}=uK(),r=n<768;function i(){t.setCurrentScreen(0),t.resetAllValues(),e.onClose()}return(0,z.useEffect)(()=>{"quit"===e.customCommand&&(console.log("sign out request"),t.signOut())},[e.customCommand,t]),uP.onAuthStateChanged(t=>{var n;null==(n=e.onAuthChange)||n.call(e,t)}),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(eR,{value:!r,children:(0,q.jsxs)(dX,{className:d0.container,isOpen:e.isOpen,onClose:i,renderCloseButton:!1,children:[(0,q.jsx)(dY,{onClose:i,isMilesLogin:e.isMilesLogin}),(0,q.jsx)("div",{className:d0.content,children:(0,q.jsx)(dJ,{onClose:e.onClose,noHeader:!0,isMilesLogin:e.isMilesLogin})})]})}),(0,q.jsx)(eR,{value:r,children:e.mobileModal?(0,q.jsxs)(dX,{className:d0.container,isOpen:e.isOpen,onClose:i,renderCloseButton:!1,children:[(0,q.jsx)(dY,{onClose:i,isMilesLogin:e.isMilesLogin}),(0,q.jsx)("div",{className:d0.content,children:(0,q.jsx)(dJ,{onClose:e.onClose,noHeader:!0,isMilesLogin:e.isMilesLogin})})]}):(0,q.jsx)(dQ,{customHeader:(0,q.jsx)(dY,{onClose:i,isMilesLogin:e.isMilesLogin}),isOpen:e.isOpen,className:d0.fullscreen,children:(0,q.jsx)("div",{className:d0.containerFullscreen,children:(0,q.jsx)(dJ,{onClose:e.onClose,noHeader:!0,isMilesLogin:e.isMilesLogin})})})})]})},d2={dropdown:"_dropdown_19b3d_1",backgroundImage:"_backgroundImage_19b3d_7",content:"_content_19b3d_18",contentCampaignPromoDay:"_contentCampaignPromoDay_19b3d_25",birthdayCampaignDropdown:"_birthdayCampaignDropdown_19b3d_33",textBox:"_textBox_19b3d_86",infoBoxText:"_infoBoxText_19b3d_96",infoBoxTextPromoDay:"_infoBoxTextPromoDay_19b3d_105",textBoxPromoDay:"_textBoxPromoDay_19b3d_117",socialLogin:"_socialLogin_19b3d_121",loginButton:"_loginButton_19b3d_145",keepWithoutBenefitsSection:"_keepWithoutBenefitsSection_19b3d_195",keepWithoutBenefits:"_keepWithoutBenefits_19b3d_195",infoTextForBirthdayCampaignSpan:"_infoTextForBirthdayCampaignSpan_19b3d_220",infoTextForBirthdayCampaignSpanYellow:"_infoTextForBirthdayCampaignSpanYellow_19b3d_234",infoTextForBirthdayCampaignSpanBlue:"_infoTextForBirthdayCampaignSpanBlue_19b3d_238"},d4=!1,d3=e=>e?(0,q.jsxs)("span",{className:d2.infoTextForBirthdayCampaignSpan,children:[(0,q.jsx)("span",{className:d2.infoTextForBirthdayCampaignSpanYellow,children:"Cadastre-se"})," ","e receba com"," ",(0,q.jsx)("span",{className:d2.infoTextForBirthdayCampaignSpanBlue,children:"exclusividade os descontos"})," ","do Promo Day!"]}):"Garanta descontos exclusivos e encontre os menores pre\xe7os do mercado!",d9=e=>e?"https://storage.googleapis.com/vdp-images/assets/assets_campaign-img.png":null,d5=({isPromoDayCampaignActive:e=d4,infoText:t,campaignImgUrl:n,onClose:r,className:i})=>{let s=uZ(),{width:a}=uK(),o=t??d3(e),l=n??d9(e);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)("div",{className:K(d2.dropdown,i,{[d2.birthdayCampaignDropdown]:e}),children:[l&&(0,q.jsx)("img",{src:l,className:d2.backgroundImage}),(0,q.jsxs)("div",{className:K(d2.content,{[d2.contentCampaignPromoDay]:e}),children:[(0,q.jsx)("div",{className:K(d2.textBox,{[d2.textBoxPromoDay]:e}),children:(0,q.jsx)("span",{className:K(d2.infoBoxText,{[d2.infoBoxTextPromoDay]:e}),children:o})}),(0,q.jsx)("div",{className:d2.socialLogin,children:(0,q.jsx)(u1,{label:"Acessar com Google"})}),(0,q.jsx)("div",{className:d2.emailLogin,children:(0,q.jsx)(uY,{"data-cy":"email-login",label:"Entrar c
4om e-mail",variant:"solid",onClick:()=>{s.setCurrentScreen(nS.Login),s.setLoginModalOpen(!0)},className:d2.loginButton})}),r&&(0,q.jsx)("div",{className:d2.keepWithoutBenefitsSection,role:"button",onClick:r,children:(0,q.jsx)("span",{className:d2.keepWithoutBenefits,children:"Continuar sem benef\xedcios"})})]})]}),a<768&&(0,q.jsx)(d1,{isOpen:s.loginModalOpen,onClose:()=>s.setLoginModalOpen(!1)})]})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.