sito web:Un Murmur morbidosoddisfare
ASoftMurmur vare=Object.defineProperty,t=(t,n,i)=>(((t,n,i)=>{nint?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i})(t,"symbol"!=typeofn?n+"":n,i),i);functionn(){import.meta.url,import("_").catch((()=>1))}!function(){conste=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(consteofdocument.querySelectorAll('link[rel="modulepreload"]'))t(e);newMutationObserver((e=>{for(constnofe)if("childList"===n.type)for(consteofn.addedNodes)"LINK"===e.tName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}functiont(e){if(e.ep)return;e.ep=!0;constt=function(e){constt={};returne.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();vari,s,r,o,a,c,l,u={},h=[],d=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,p=Array.isArray;functionf(e,t){for(varnint)e[n]=t[n];returne}functionm(e){vart=e.parentNode;t&&t.removeChild(e)}functiong(e,t,n,i,o){vara={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void0,__c:null,__h:null,constructor:void0,__v:null==o?++r:o};returnnull==o&&null!=s.vnode&&s.vnode(a),a}functiony(e){returne.children}functionv(e,t){this.props=e,this.context=t}functionw(e,t){if(null==t)returne.__?w(e.__,e.__.__k.indexOf(e)+1):null;for(varn;tT?M>L-T?N+=C-T:N--:N=C=0||a=0){if((c=t[o])&&s==c.key&&r===c.type)returno;o--}if(a{e.timer[t]!==n.timer[t]&&(i=!0)})),Object.keys(e.mixes).length!==Object.keys(n.mixes).length&&(i=!0),i}handleChangeMode(e){"fade"===e?(this.props.handleContentClass("fade"),this.setState({mode:"fade"})):(this.props.handleContentClass(""),this.setState({mode:e}))}handleStartTimer(){conste={isActive:!0,mode:this.state.mode,secondsLeft:(t=this.state.hours,n=this.state.minutes,60*(60*t+n))};vart,n;if("fade"===this.state.mode){constt=this.state.fadeOrigin,n=this.state.fadeDestination;e.origin=t,e.destination=n}this.props.timerStart(e)}handleSetFadeOrigin(e){constt={fadeOrigin:e.target.value};this.state.fadeDestination===e.target.value&&("silence"!==e.target.value?t.fadeDestination="silence":t.fadeDestination="current"),this.setState(t)}handleSetFadeDestination(e){constt={fadeDestination:e.target.value};this.state.fadeOrigin===e.target.value&&("current"!==e.target.value?t.fadeOrigin="current":t.fadeOrigin="silence"),this.setState(t)}render(){const{timer:e}=this.props,t=Object.keys(this.props.mixes).sort(((e,t)=>this.props.mixes[e].name.toString()>this.props.mixes[t].name.toString())).map((e=>this.props.mixes[e]));returnF("div",{className:"TimerInput".concat("fade"===this.state.mode?"extraHeight":""),children:e.isActive?F(H,{timer:e,onCancel:this.props.timerCancel,onClose:this.props.onClose}):F("div",{className:"input",children:[F("div",{className:"step1".concat(null===this.state.mode?"noSelection":"heSelection"),children:[F("button",{className:"interactive".concat("stop"===this.state.mode?"selected":"deselected"),onClick:()=>this.handleChangeMode("stop"),children:"Stopplayingafter"}),F("button",{className:"interactive".concat("start"===this.state.mode?"selected":"deselected"),onClick:()=>this.handleChangeMode("start"),children:"Startplayingafter"}),F("button",{className:"interactive".concat("fade"===this.state.mode?"selected":"deselected"),onClick:()=>this.handleChangeMode("fade"),children:"Fade"})]}),F("div",{className:"step2".concat("fade"===this.state.mode?"":"empty"),children:"fade"===this.state.mode&&F("div",{className:"wrap",children:[F("div",{className:"origin",children:[F("label",{children:"Startpoint:"}),F("select",{onChange:this.handleSetFadeOrigin,value:this.state.fadeOrigin,children:[F("option",{value:"current",label:"Currentvolume"}),F("option",{value:"silence",label:"Silence"}),t.map((e=>F("option",{value:"mix:".concat(e.id),label:e.name.substring(0,32)})))]})]}),F("div",{className:"to",children:[F("span",{children:"fadeto"}),F("span",{children:"➝"})]}),F("div",{className:"destination",children:[F("label",{children:"Endpoint:"}),F("select",{onChange:this.handleSetFadeDestination,value:this.state.fadeDestination,children:[F("option",{value:"silence",label:"Silence"}),F("option",{value:"current",label:"Currentvolume"}),t.map((e=>F("option",{value:"mix:".concat(e.id),label:e.name.substring(0,32)})))]})]})]})}),F("div",{className:"step3",children:F("div",{className:"wrap",children:[F("input",{type:"number",value:this.state.hours,onChange:e=>this.setState({hours:e.target.value}),min:0,max:24}),"hoursand",F("input",{type:"number",value:this.state.minutes,onChange:e=>this.setState({minutes:e.target.value}),min:0,max:59}),"minutes"]})}),F("div",{className:"step4",children:[F("button",{className:"interactive",onClick:this.props.onClose,children:"Cancel"}),F("button",{className:"interactive",onClick:this.handleStartTimer,children:"Starttimer"})]})]})})}}classQextendsv{constructor(){super(),this.state={deletePending:!1},this.handleDeleteClick=this.handleDeleteClick.bind(this)}handleDeleteClick(e){"cancel"===e?this.setState({deletePending:!1}):"confirm"===e?this.props.deleteMix(this.props.mix.id):this.setState({deletePending:!0})}render(){const{mix:e}=this.props;returnF("li",{className:"MixInputItem",children:F("span",{className:"wrap",children:[this.state.deletePending&&F("span",{className:"deletePending",children:[F("button",{className:"deleteCancelinteractive",onClick:()=>this.handleDeleteClick("cancel"),children:"Cancel"}),F("button",{className:"deleteConfirminteractive",onClick:()=>this.handleDeleteClick("confirm"),children:"DeleteMix"})]}),F("button",{className:"maininteractive",onClick:()=>this.props.loadMix(e.id),children:e.name}),F("button",{className:"shareinteractive",onClick:()=>this.props.shareMix(e.id),children:"Share"}),F("button",{className:"deleteinteractive",onClick:this.handleDeleteClick,children:"✕"})]})})}}constY=["rain","thunder","wes","wind","fire","birds","crickets","people","sbowl","whitenoise","aircon","fanhigh","fanlow","city","chimesmetal","stream","raintinroof","raintrees","raincabin","waterfall","cicadas","brownnoise","pinknoise","frogs","vinyl"],J={rain:"Rain",thunder:"Thunder",wes:"Wes",wind:"Wind",fire:"Fire",birds:"Birds",crickets:"Crickets",people:"Coffeeshop",sbowl:"SingingBowl",whitenoise:"Whitenoise",aircon:"Airconditioning",fanhigh:"Fanonhigh",fanlow:"Fanonlow",city:"City",chimesmetal:"Metalchimes",stream:"Stream",raintinroof:"Rainontinroof",raintrees:"Rainontrees",raincabin:"Rainoncabin",waterfall:"Waterfall",cicadas:"Cicadas",brownnoise:"Brownnoise",pinknoise:"Pinknoise",frogs:"Frogs",clock:"Clock",vinyl:"Recordplayer"},X={rain:"rno",thunder:"thn",wes:"wve",wind:"wnd",fire:"fre",birds:"brd",crickets:"crk",people:"pep",sbowl:"sbo",whitenoise:"wno",aircon:"arc",fanhigh:"fnh",fanlow:"fnl",city:"cit",chimesmetal:"chm",stream:"str",raintinroof:"rnr",raintrees:"rnt",raincabin:"rnc",waterfall:"wtr",cicadas:"cic",brownnoise:"brn",pinknoise:"pnk",frogs:"frg",clock:"clk",vinyl:"vnl"},Z={rain:!0,thunder:!0,wes:!0,wind:!0,fire:!0,birds:!0,crickets:!0,people:!0,sbowl:!0,whitenoise:!0,aircon:!1,fanhigh:!1,fanlow:!1,city:!1,chimesmetal:!1,stream:!1,raintinroof:!1,raintrees:!1,raincabin:!1,waterfall:!1,cicadas:!1,brownnoise:!1,pinknoise:!1,frogs:!1,clock:!1,vinyl:!1},$={rain:0,thunder:1,wes:3,wind:9,fire:2,birds:4,crickets:6,people:5,sbowl:7,whitenoise:8,aircon:100,fanhigh:100,fanlow:100,city:100,chimesmetal:100,stream:100,raintinroof:100,raintrees:100,raincabin:100,waterfall:100,cicadas:100,brownnoise:100,pinknoise:100,frogs:100,clock:100,vinyl:100},ee={rain:1,thunder:2,wes:3,wind:4,fire:5,birds:6,crickets:7,people:8,sbowl:9,whitenoise:10,aircon:21,fanhigh:20,fanlow:19,city:18,chimesmetal:17,stream:14,raintinroof:12,raintrees:11,raincabin:13,waterfall:15,cicadas:16,frogs:22,clock:23,brownnoise:99,pinknoise:100,vinyl:24},te={rain:["downpour","shower","drizzle"],thunder:["lightning","storm","rumble"],wes:["wes","swimming","hightide"],wind:["breeze","gale","stronggusts"],fire:["fire"],birds:["birdsong","songbirds"],crickets:["crickets","chirping"],people:["murmur","conversation"],sbowl:["meditation"],whitenoise:["whitenoise","static","untunedradio"],aircon:["airconditioning","hum"],fanhigh:["fan"],fanlow:["fan"],city:["murmur","rumble,"],chimesmetal:["windchimes","tinkling,"],stream:["burble"],raintinroof:["downpour","shower","drizzle"],raintrees:["downpour","shower","drizzle"],raincabin:["downpour","shower","drizzle"],waterfall:["waterfall"],cicadas:["drone","buzzing","cicadas"],brownnoise:["whitenoise","static","untunedradio"],pinknoise:["whitenoise","static","untunedradio"],frogs:["frogs","chirping","croaking"],clock:["clock","grandfatherclock","timepiece"],vinyl:["recordplayer","turntable","hiss","crackling"]},ne={rain:["wet","damp","rainy"],thunder:["stormy","turbulent"],wes:["surging","stormy","choppy"],wind:["windswept","wild","airy"],fire:["cozy","snug"],birds:["early","lively"],crickets:["early","solitary","chirping"],people:["ambient"],sbowl:["peaceful","mellow","relaxing"],whitenoise:["humming"],aircon:["humid","warm","hot","sunny"],fanhigh:["humid","warm","hot","sunny"],fanlow:["humid","warm","hot","sunny"],city:["busy"],chimesmetal:["breezy","gusty","windswept"],stream:["bubbling","streaming","flowing"],raintinroof:["wet","damp","rainy"],raintrees:["wet","damp","rainy"],raincabin:["wet","damp","rainy"],waterfall:["bubbling","streaming","flowing"],frogs:["swampy","waterlogged","reedy"],cicadas:["hot","peaceful","buzzing"],brownnoise:["humming"],pinknoise:["humming"],clock:["old","ticking","clicking","clacking"],vinyl:["spinning","revolving"]},ie={rain:["thevalley","thehillside","theplains","theforest","GlenShiel"],thunder:["thecabin"],wes:["thebeach","thelake","theseaside","theocean","theriver","therockpool","Balnahard"],wind:["mytent","themountaintop","CairnToul"],fire:["theinn","thecampfire","thebonfire"],birds:["thewoods","thepark"],crickets:["themeadow","theprairie","thewildgrass","thepasture"],frogs:["theswamp","thepond","thelake","theriver","theloon"],people:["thecoffeeshop","thecafé","thetearoom"],sbowl:["thetemple","themountains","Kyoto"],whitenoise:["thepowerlines"],aircon:["thehotel","home","myhouse"],fanhigh:["thehotel","home","myhouse"],fanlow:["thehotel","home","myhouse"],city:["thecity",,"Ginza","thethirty-sixthfloor"],chimesmetal:["thegarden","thefrontporch"],stream:["thestream","theriver","thebrook","theburn"],raintinroof:["theboathouse","theshed"],raintrees:["thewetforest","thedrippingbranches"],raincabin:["thecabin","thecotte"],waterfall:["thewaterfall","FiveFingers"],cicadas:["thepines","themeadow","thetrees","thetallgrass"],brownnoise:["thedunes"],pinknoise:["theriverbend"],clock:["thestudy","theoffice","themuseum"],vinyl:["therecordshop","thestudy","themusicroom"]},se=e=>{constt={};letn=!0;returnObject.keys(e).forEach((i=>{t[e[i]]&&(n=!1),t[e[i]]=!0})),n},re=(()=>{if(!se(X))thrownewError("non-uniqueshortcodesdetected");if(!se(ee))thrownewError("non-uniquesortordersdetected");vare;e=[J,X,Z,$,ee,te,ne,ie],Y.forEach((t=>{e.forEach((e=>{if(void0===e[t])thrownewError("missingvalueforkey"+t)}))}));constt={};returnY.forEach((e=>{t[e]={id:e},t[e].key=e,t[e].shortcode=X[e],t[e].pro=Boolean(!Z[e]),t[e].label=J[e],t[e].sortKey=ee[e],t[e].nouns=te[e],t[e].adjectives=ne[e],t[e].places=ie[e],t[e].volumeStringOrder=$[e],t[e].volume="rain"===e?.6:"thunder"===e?.3:0})),t})(),oe={};functionae(e){if(globalThis.location){vart=RegExp("[?&]"+e+"=([^&]*)").exec(globalThis.location.search);returnt&&decodeURIComponent(t[1].replace(/\+/g,""))}}Object.keys(re).forEach((e=>{constt=re[e];t.pro||(oe[e]=t)}));constce=e=>{constt=ae("v");if(!t)returne;if("0000"===t)returne;constn=Object.assign({},e),i=t.match(/.{1,2}/g).map((e=>(e=>parseInt(e,16)/100)(e)));returnObject.keys(n).forEach((t=>{consts=Object.assign({},e[t]);if(null!=s.volumeStringOrder){conste=i[s.volumeStringOrder];e>=0&&e{constt={};letn=ae("autoplay");n=n?parseInt(n,10):0,t.isPlaying=Boolean(n);leti=((e,t)=>{constn=ae("m"),i=ae("v");if(!n)returni?ce(e):e;try{conste=[];for(lett=0;t{constn=e.substring(0,3),r=e.substring(3,5),o=Number(r)/100,a=Object.keys(t).filter((e=>t[e].shortcode===n)),c=t[a];c.pro&&(i=!1),s[c.key]=Object.assign({},c,{volume:o})})),i){conste=Object.assign({},oe);e.rain=Object.assign({},e.rain,{volume:0}),e.thunder=Object.assign({},e.thunder,{volume:0}),s=Object.assign({},e,s)}returns}catch(s){returne}})(e.sounds,e.library);i&&(t.sounds=i);lets=ae("token");t.token=s;constr=ae("utm_source"),o=ae("utm_campaign");leta;r&&o?a="&utm_source=".concat(r,"&utm_campaign=").concat(o):r?a="&utm_source=".concat(r):o&&(a="&utm_campaign=".concat(o)),a&&(t.utmCampaign=o,t.utmSubstring=a);returnae("waitingForLicense")&&(t.waitingForLicense=!0),t},ue=e=>e[Math.floor(Math.random()*e.length)],he=e=>e.adjectives[Math.floor(Math.random()*e.adjectives.length)],de=e=>e.nouns[Math.floor(Math.random()*e.nouns.length)],pe=e=>e.places[Math.floor(Math.random()*e.places.length)],fe=()=>ue(["day","night","morning","afternoon","evening","sunset","sunrise"]),me=(e="")=>"".concat(e.substring(0,1).toUpperCase()).concat(e.substring(1,e.length)),ge=[{sounds:1,template:e=>"A".concat(he(e[0]),"").concat(fe())},{sounds:1,template:e=>"".concat(me(he(e[0])),"").concat(de(e[0]))},{sounds:2,template:e=>"".concat(me(he(e[0])),"").concat(de(e[1]))},{sounds:2,template:e=>"A".concat(he(e[0]),",").concat(he(e[1]),"").concat(fe())},{sounds:2,template:e=>"".concat(me(he(e[0])),"").concat(fe(),"at").concat(pe(e[1]))},{sounds:2,template:e=>"".concat(me(de(e[0])),"at").concat(pe(e[1]))},{sounds:2,template:e=>"".concat(me(he(e[0])),"at").concat(pe(e[1]))},{sounds:2,template:e=>"".concat(me(de(e[0])),"at").concat(pe(e[1]))},{sounds:3,template:e=>"A".concat(he(e[0]),",").concat(he(e[1]),",").concat(he(e[2]),"").concat(fe())},{sounds:3,template:e=>"A".concat(he(e[0]),",").concat(he(e[1]),"").concat(fe(),"at").concat(pe(e[2]))},{sounds:3,template:e=>"".concat(me(he(e[0])),"").concat(de(e[1]),"at").concat(pe(e[2]))}],ye=e=>{constt=e.filter((e=>e.volume>=.02)).sort(((e,t)=>t.volume-e.volume)),n=ge.filter((e=>e.sounds===t.length));if(0===t.length)return"Silence";consti=ue(n).template;returnve(i(t))},ve=e=>{constt=["a","e","i","o","u"],n=e.split("");for(leti=0;i-1&&("a"===e&&(n[i]="an"),"A"===e&&(n[i]="An"))}returnn.join("")},we=e=>Object.keys(e).sort(((t,n)=>e[t].name.toString()>e[n].name.toString())).map((t=>e[t]));class_eextendsv{constructor(){super(),this.state={name:""},this.seMix=this.seMix.bind(this),this.loadMix=this.loadMix.bind(this),this.loadRandomMix=this.loadRandomMix.bind(this),this.deleteMix=this.deleteMix.bind(this),this.adjustSizeForNumMixes=this.adjustSizeForNumMixes.bind(this)}componentWillMount(){this.adjustSizeForNumMixes(this.props)}componentWillReceiveProps(e){constt=Object.keys(e.mixes).length,n=Object.keys(this.props.mixes).length;if(t!==n&&(this.adjustSizeForNumMixes(e),t>n&&t>6)){constt=Object.keys(e.mixes).filter((e=>!Object.keys(this.props.mixes).some((t=>t===e))))[0],n=60*we(e.mixes).findIndex((e=>e.id===t));this.mixList&&(this.mixList.scrollTop=n)}}adjustSizeForNumMixes(e){constt=Object.keys(e.mixes).length;t>6?e.handleContentClass("mixesLots"):t>3?e.handleContentClass("mixes"+t):e.handleContentClass("")}seMix(){this.props.onAddMix(this.state.name),this.setState({name:""})}loadMix(e){this.props.onLoadMix(e)}loadRandomMix(){conste=((e,t)=>{letn=Object.keys(t).map((e=>t[e]));consti=[2,3],s=i[Math.floor(Math.random()*i.length)],r=[];leto=100;consta=["whitenoise","pinknoise"];for(leth=0;h-1&&(t=Math.floor(Math.random()*n.length)),h+1===s?e=o:(e=Math.floor(Math.random()*o),o-=e);consti=n[t];i.volume=e/100,r.push(i),n.splice(t,1)}constc={};r.forEach((e=>c[e.key]=e));constl=Object.keys(e).filter((e=>!c[e])).map((t=>e[t])).sort(((e,t)=>e.sortKey-t.sortKey)),u=Math.min(10-Object.keys(c).length,l.length);for(leth=0;hthis.input=e,type:"text",placeholder:"Newmixname",value:this.state.name,onInput:e=>this.setState({name:e.target.value}),onKeyDown:e=>{13===e.keyCode&&(this.seMix(),this.input&&this.input.blur())},autofocus:0===e.length}),F("button",{className:"interactiveseMix",onClick:this.seMix,disabled:""===this.state.name,children:"Se"})]}),F("div",{className:"mixList",ref:e=>this.mixList=e,children:0===e.length?F("span",{className:"noMixMesse",children:"Nomixesyet"}):F("ol",{children:e.map((e=>F(Q,{mix:e,loadMix:this.loadMix,deleteMix:this.deleteMix,shareMix:this.props.onShareMix},e.id)))})}),F("div",{className:"controls",children:[F("button",{className:"closeinteractive",onClick:this.props.onClose,children:"Close"}),F("button",{className:"interactiveseMix",onClick:this.loadRandomMix,children:"Randommix"})]})]})}}constbe=!1,Ie=globalThis&&globalThis.location&&"beta.asoftmurmur.com"===globalThis.location.host,Te=(e,t,n)=>{if("DEV"===globalThis.ENV)return"src/assets/p/content/".concat(e.key,"/");if(Ie)return"beta.asoftmurmur.com/assets/p/content/".concat(e.key,"/");leti=Ie?"privatebeta.asoftmurmur.com":"asoftmurmur.com",s=t?e.glueSubdomain:e.subdomain;returns=s||e.label.length%3+1,"st".concat(s,".").concat(i,"/assets/p/content/").concat(e.key,"/")};letSe=classextendsv{constructor(){super(),this.state={active:null},this.handleToggle=this.handleToggle.bind(this)}componentWillMount(){this.setState({active:this.props.isActive})}componentWillReceiveProps(e){this.setState({active:e.isActive})}handleToggle(){if(!this.props.canToggle)returnthis.props.onCancelledToggleAttempt();clearTimeout(this.timeout),this.setState({active:!this.state.active}),this.timeout=setTimeout((()=>this.props.toggleSound(this.props.sound.key)),100)}render(){const{sound:e,isActive:t,toggleSound:n}=this.props;returnF("li",{className:"SoundItem".concat(this.state.active?"active":"inactive"),children:[F("div",{className:"biggerTarget",onClick:this.handleToggle}),F("p",{className:"label",children:e.label}),this.props.isActive?null:F("div",{className:"previewButton".concat(this.props.isPreviewing?"previewing":""),children:F("button",{className:"buttoninteractive",onClick:this.props.onTogglePreview,children:[F("div",{className:"touchTarget"}),F("div",{className:"previewInnerContainer",children:F("div",{className:"previewInner"})})]})}),F("div",{className:"buttonContainer".concat(this.props.isActive?"right":"left"),children:F("button",{className:"interactive",onClick:this.handleToggle,children:F("div",{className:"buttonInner",children:F("div",{className:"buttonInnerContent"})})})})]})}};classEeextendsv{constructor(){super(),this.state={soundPreviewing:null},this.togglePreview=this.togglePreview.bind(this),this.handleCancelledToggleAttempt=this.handleCancelledToggleAttempt.bind(this)}togglePreview(e){this.props.handleStopActivity(),this.setState({soundPreviewing:this.state.soundPreviewing===e?null:e})}handleCancelledToggleAttempt(){clearTimeout(this.timeout),this.setState({showSlotMesse:!0});this.timeout=setTimeout((()=>this.setState({showSlotMesse:!1})),2e3)}render(){conste=Object.keys(this.props.sounds).map((e=>this.props.sounds[e])).sort(((e,t)=>e.sortKey-t.sortKey)),t=Object.keys(this.props.library).filter((e=>!Boolean(this.props.sounds[e]))).map((e=>this.props.library[e])).sort(((e,t)=>t.sortKey-e.sortKey)),n=[],i=Boolean(this.state.soundPreviewing&&-1===e.findIndex((e=>e.key===this.state.soundPreviewing)));for(lets=e.length;sF(Se,{sound:e,isActive:!0,toggleSound:this.props.onToggleSoundActive,isPreviewing:this.state.soundPreviewing===e.key,onTogglePreview:this.togglePreview.bind(this,e.key),canToggle:!0}))),n.map(((e,t)=>F("div",{className:"emptySlot",children:F("p",{children:"-empty-"})},t)))]})}),F("div",{className:"clearAllContainer",children:F("button",{className:"interactive",onClick:this.props.handleClearAllSounds,children:[0===e.length?"Resetdefaultsounds":"Clearallactivesounds","",F("span",{className:"bar"})]})})]}),F("div",{className:"pane2",children:[F("div",{className:"slots",children:F("p",{children:"ailablesounds"})}),F("div",{className:"inactiveList",children:F("ol",{children:t.map((t=>F(Se,{sound:t,isActive:!1,toggleSound:this.props.onToggleSoundActive,isPreviewing:this.state.soundPreviewing===t.key,onTogglePreview:this.togglePreview.bind(this,t.key),canToggle:e.lengththis.setState({soundPreviewing:null})},this.state.soundPreviewing):null]})}}letke=classextendsv{constructor(){super()}componentWillUnmount(){Promise.resolve(this).then((()=>this.nextBase=this.__b=null))}componentDidMount(){setTimeout((()=>{if(this.player)try{this.player.play()}catch(KS){}}),100)}render(){returnthis.props,F("audio",{ref:e=>this.player=e,className:"PreviewSound",autoplay:!0,preload:"auto",onEnded:this.props.onEnd,children:[F("source",{className:"mp4"+this.props.sound.key,src:"".concat(Te(this.props.sound),"glue-").concat(this.props.sound.key,".mp4"),type:"audio/mp4"}),F("source",{className:"ogg"+this.props.sound.key,src:"".concat(Te(this.props.sound),"glue-").concat(this.props.sound.key,".ogg"),type:"audio/ogg"})]})}};constCe=(e,t)=>{constn={};returnObject.keys(t).forEach((i=>{consts=Object.assign({},e[i]);s.volume=t[i].volume,n[i]=s})),n},Ae=(e,t)=>{constn=Object.assign({},t);returnn.sounds=Ce(e,t.sounds),n},Ne=globalThis.encodeURIComponent("CheckoutthisambientnoisemixImade!"),xe=(e,t,n,i)=>{consts=(e=>{lett="";returnObject.keys(e).sort(((t,n)=>e[t].sortKey-e[n].sortKey)).forEach((n=>{leti=Math.round(100*e[n].volume).toString();"0"!==i&&(1===i.length&&(i="0"+i),"100"===i&&(i="99"),i="".concat(e[n].shortcode).concat(i),t+=i)})),t})("current"===e?n:t[e].sounds),r=i?"&autoplay=1":"";return"asoftmurmur.com/?m=".concat(s).concat(r)};classPeextendsv{constructor(){super(),this.state={autoplay:!1,copyStatus:null,mixListOption:"current",highlightMixOption:!1},this.handleClipboard=this.handleClipboard.bind(this)}componentWillMount(){if(this.props.selectedMix){this.setState({mixListOption:this.props.selectedMix,highlightMixOption:!0});conste=()=>this.setState({highlightMixOption:!1});this.timeout=setTimeout(e,500)}}componentWillUnmount(){this.timeout&&clearTimeout(this.timeout)}componentWillReceiveProps(e){this.setState({copyStatus:null})}handleClipboard(){((e,t)=>{constn=document.querySelector(e),i=document.createRange();i.selectNode(n),window.getSelection().addRange(i);try{t(document.execCommand("copy"))}catch(s){t(!1)}try{window.getSelection().removeAllRanges()}catch(s){}})("#shareUrlContent",(e=>{e?this.setState({copyStatus:"success"}):this.setState({copyStatus:"error"})}))}render(){conste=((e,t)=>{constn={};returnObject.keys(t).forEach((i=>{n[i]=Ae(e,t[i])})),n})(this.props.library,this.props.mixes),t=xe(this.state.mixListOption,e,this.props.sounds,this.state.autoplay),n=Object.keys(e).sort(((t,n)=>e[t].name.toString()>e[n].name.toString())).map((t=>e[t]));returnF("div",{className:"ShareInput",children:[F("div",{className:"linkStuff",children:[F("div",{className:"shareUrl",children:F("a",{id:"shareUrlContent",href:t,onClick:e=>e.preventDefault(),children:t})}),F("div",{className:"options",children:[F("div",{className:"mixListContainer".concat(this.state.highlightMixOption?"highlight":""),children:[F("label",{children:"Chooseamix:"}),F("select",{value:this.state.mixListOption,onChange:e=>this.setState({mixListOption:e.target.value}),children:[F("option",{value:"current",label:"Currentsounds"}),n.map((e=>F("option",{value:e.id,label:e.name.substring(0,32)})))]})]}),F("div",{className:"option",children:[F("label",{title:"Withgreatpowercomesgreatresponsibility",for:"autoplay",children:"Autoplay"}),F("input",{id:"autoplay",type:"checkbox",value:this.state.autoplay,onChange:()=>this.setState({autoplay:!this.state.autoplay,copyStatus:null})})]}),F("div",{className:"clipboardContainer",children:F("button",{className:"clipboardinteractive",onClick:this.handleClipboard,children:(i=this.state.copyStatus,null===i?"Copytoclipboard":"success"===i?"Copied!":"Couldn'tcopy")})})]})]}),F("div",{className:"letsGetSocial",children:[F("h3",{children:"↓Sharethismix↓"}),F("div",{className:"links",children:[F("a",{className:"fb",title:"ShareyourmixonFacebook",href:"http/sharer/sharer.php?s=100&p[url]=".concat(encodeURIComponent(t),"&p[summary]=").concat(Ne),target:"_blank",rel:"noopener",children:[F("span",{}),"Facebook"]}),F("a",{className:"tw",title:"ShareyourmixonTwitter",href:"httptwitter.com/home?status=".concat(Ne).concat(encodeURIComponent(t)).concat(globalThis.encodeURIComponent("@asoftmurmur")),target:"_blank",rel:"noopener",children:[F("span",{}),"Twitter"]}),F("a",{className:"re",title:"ShareyourmixonReddit",href:"http/submit?url=".concat(encodeURIComponent(t)),target:"_blank",rel:"noopener",children:[F("span",{}),"Reddit"]}),F("a",{className:"tu",title:"ShareyourmixonTumblr",href:"",target:"_blank",rel:"noopener",children:[F("span",{}),"Tumblr"]})]})]})]});vari}}classDeextendsv{constructor(){super(),this.state={expandedControl:null,selectedMix:null,contentClass:""},this.handleCloseTabs=this.handleCloseTabs.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleShareMix=this.handleShareMix.bind(this),this.handleContentClass=this.handleContentClass.bind(this)}handleCloseTabs(){this.setState({expandedControl:null,contentClass:""})}handleTabClick(e){if(this.state.expandedControl===e)this.setState({expandedControl:null,selectedMix:null,contentClass:""});else{constt={expandedControl:e,selectedMix:null,contentClass:""};"mane"!==e||this.props.usedSoundManerBefore||(t.showManerHelpText=!0),this.setState(t)}}handleShareMix(e){this.setState({expandedControl:"share",selectedMix:e})}handleContentClass(e){this.state.contentClass!==e&&this.setState({contentClass:e})}render(){returnF("div",{className:"RowControls".concat(this.state.expandedControl),children:[F("div",{className:"container",children:[F("button",{onClick:()=>this.handleTabClick("timers"),className:"rowControlinteractivetimers\n".concat("timers"===this.state.expandedControl?"expanded":"initial","\n").concat(this.props.timer.isActive&&"timers"!==this.state.expandedControl?"timeDisplay":"","\n"),children:this.props.timer.isActive&&"timers"!==this.state.expandedControl?K(this.props.timer.secondsLeft):"Timers"}),F("button",{onClick:()=>this.handleTabClick("mixes"),className:"rowControlinteractivemixes".concat("mixes"===this.state.expandedControl?"expanded":"initial"),children:"Mixes"}),this.props.pro?F("button",{onClick:()=>this.handleTabClick("mane"),className:"rowControlinteractivesounds".concat("mane"===this.state.expandedControl?"expanded":"initial"),children:"Sounds"}):null,F("button",{onClick:()=>this.handleTabClick("share"),className:"rowControlinteractiveshare".concat("share"===this.state.expandedControl?"expanded":"initial"),children:"Share"})]}),F("div",{className:"controlContent".concat(this.state.expandedControl?"expanded"+this.state.expandedControl:"initial","").concat(this.state.contentClass),children:F("div",{className:"inner",children:["timers"===this.state.expandedControl?F(W,{timer:this.props.timer,timerStart:this.props.timerStart,timerCancel:this.props.timerCancel,sedTimer:this.props.sedTimer,mixes:this.props.mixes,onClose:this.handleCloseTabs,handleContentClass:this.handleContentClass}):null,"mixes"===this.state.expandedControl?F(_e,{mixes:this.props.mixes,sounds:this.props.sounds,library:this.props.library,onAddMix:this.props.onAddMix,onLoadMix:this.props.onLoadMix,onDeleteMix:this.props.onDeleteMix,onShareMix:this.handleShareMix,onClose:this.handleCloseTabs,handleContentClass:this.handleContentClass}):null,"mane"===this.state.expandedControl?F(Ee,{sounds:this.props.sounds,library:this.props.library,onClose:this.handleCloseTabs,handleContentClass:this.handleContentClass,onToggleSoundActive:this.props.onToggleSoundActive,handleStopActivity:this.props.handleStopActivity,handleClearAllSounds:this.props.handleClearAllSounds}):null,"share"===this.state.expandedControl?F(Pe,{sounds:this.props.sounds,library:this.props.library,mixes:this.props.mixes,selectedMix:this.state.selectedMix,onClose:this.handleCloseTabs}):null,this.state.showManerHelpText?F("div",{className:"manerHelpText",children:F("div",{className:"content",children:[F("p",{children:"Welcometothesoundmaner!"}),F("p",{children:"Upto10soundscanbeactiveatonetime."}),F("p",{children:["First,createsomeemptyslotsbyremovingsoundsfromthe",F("span",{className:"it",children:"Activesounds"}),"list."]}),F("p",{children:["Then,activatesomenewsoundsfromthe",F("span",{className:"it",children:"ailablesounds"}),"list."]}),F("button",{className:"interactivenoSelect",onClick:()=>{this.props.onOpenSoundManer(),this.setState({showManerHelpText:!1})},children:"OK"})]})}):null]})})]})}}classOeextendsv{constructor(){super(),this.state={loading:!1,loadAudio:!1,canBeginPlay:!1,glueDuration:10},this.handleCanBeginPlay=this.handleCanBeginPlay.bind(this),this.handleGlueTimeUpdate=this.handleGlueTimeUpdate.bind(this),this.handleMainTimeUpdate=this.handleMainTimeUpdate.bind(this),this.playMain=this.playMain.bind(this),this.playGlue=this.playGlue.bind(this),this.stop=this.stop.bind(this),this.handleError=this.handleError.bind(this)}componentWillMount(){this.props.sound.volume>.02&&this.setState({loadAudio:!0})}componentWillReceiveProps(e){const{props:t}=this;if(e.sound.volume,e.globalVolume,e.sound.key,this.props.sound.key,!this.state.loadAudio&&e.sound.volume>.02)returnthis.setState({loadAudio:!0,loading:!0}),voidthis.props.onUpdateLoading({loadingGlue:!0,loadingMain:!0});e.isPlaying&&!this.props.isPlaying?this.playMain(e):!e.isPlaying&&this.props.isPlaying&&this.stop(e),e.globalVolume===t.globalVolume&&e.sound.volume===t.sound.volume||this.setVolume(e,this.props)}setVolume(e,t){const{globalVolume:n,isPlaying:i,sound:s}=e,r=s.volume*n;if(this.audioPlayerMain&&(this.audioPlayerMain.volume=r),this.audioPlayerGlue&&(this.audioPlayerGlue.volume=r),i&&t){constn=s.volume,i=t.sound.volume;n.02?this.stop():n>.02&&i.02&&e.isPlaying&&this.state.loadAudio&&this.audioPlayerMain){constt=e.sound.volume*e.globalVolume;this.audioPlayerMain.volume=t,this.audioPlayerMain.networkState{})):this.handleError()}}playGlue(e){if(e.sound.volume>.02&&e.isPlaying&&this.state.loadAudio&&this.audioPlayerGlue){constt=e.sound.volume*e.globalVolume;this.audioPlayerGlue.volume=t,this.audioPlayerGlue.networkState{})):this.handleError()}}stop(){this.audioPlayerMain&&this.audioPlayerMain.pause(),this.audioPlayerGlue&&this.audioPlayerGlue.pause()}handleCanBeginPlay(e){const{props:t}=this,{sound:n}=t;if(!this.heDoneHandleCanBeginPlay&&(this.heDoneHandleCanBeginPlay=!0,this.setState({canBeginPlay:!0}),this.props.onUpdateLoading({loadingGlue:!1},Boolean("canBeginPlay")),!this.state.glueDuration&&e&&e.target&&e.target.duration&&this.setState({glueDuration:e.target.duration}),t.isPlaying&&n.volume>.02))try{this.audioPlayerGlue.volume=n.volume*t.globalVolume,this.audioPlayerGlue.play().catch((e=>{this.handleError()}))}catch(KS){}}handleError(e,t){this.heDoneHandleCanBeginPlay=!1,this.audioPlayerMain=null,this.audioPlayerGlue=null,this.setState({loading:!1,loadAudio:!1,canBeginPlay:!1}),this.timeout=setTimeout((()=>this.setState({loadAudio:!0})),5e3)}handleGlueTimeUpdate(e){constt=e.target.duration;e.target.currentTime>t/2&&(this.playMain(this.props),this.glueShouldPlay=!1)}handleMainTimeUpdate(e){constt=e.target.duration,n=e.target.currentTime,i=this.state.glueDuration;!this.glueShouldPlay&&n>t-i/2&&(this.audioPlayerGlue&&(this.audioPlayerGlue.currentTime=0),this.glueShouldPlay=!0,this.playGlue(this.props))}componentWillUnmount(){this.audioPlayerMain=null,this.audioPlayerGlue=null,this.heDoneHandleCanBeginPlay=!1,clearTimeout(this.timeout)}render({sound:e}){returnF("div",{className:"SoundPlayer",children:this.state.loadAudio&&F("div",{children:[F(Re,{sound:e,handleMainTimeUpdate:this.handleMainTimeUpdate,handleError:this.handleError,onReceiveRef:e=>this.audioPlayerMain=e,playerType:"main"}),F(Me,{sound:e,onReceiveRef:e=>{this.audioPlayerGlue=e},handleCanBeginPlay:this.handleCanBeginPlay,handleGlueTimeUpdate:this.handleGlueTimeUpdate,onError:this.handleError,onAbort:this.handleError,playerType:"glue"})]})},e.key)}}classReextendsv{componentDidMount(){try{lete=this.player.play();e&&e.catch((e=>null)),this.player.pause()}catch(KS){}}componentWillUnmount(){Promise.resolve(this).then((()=>this.nextBase=this.__b=null)).catch((e=>{}))}render(){const{props:e}=this;returnF("audio",{ref:e=>{this.props.onReceiveRef(e),this.player=e},preload:"auto",loop:!0,controls:Boolean(be),onTimeUpdate:e.handleMainTimeUpdate,onError:t=>e.handleError(t,"error"),onAbort:t=>this.ignoreErrors?null:e.handleError(t,"abort"),children:[F("source",{ref:e=>this.source1=e,className:"mp4"+e.sound.key,src:"".concat(Te(e.sound)).concat(e.playerType,"-").concat(e.sound.key,".mp4").concat(""),type:"audio/mp4"}),F("source",{ref:e=>this.source2=e,className:"ogg"+e.sound.key,src:"".concat(Te(e.sound)).concat(e.playerType,"-").concat(e.sound.key,".ogg").concat(""),type:"audio/ogg"})]})}}classMeextendsv{componentDidMount(){}componentWillUnmount(){Promise.resolve(this).then((()=>this.nextBase=this.__b=null))}render(){const{props:e}=this;returnF("audio",{ref:t=>{e.onReceiveRef(t),this.player=t},preload:"auto",onLoadStart:()=>this.heLoadStart=!0,onCanPlayThrough:t=>{this.firedCanPlayThrough=!0,e.handleCanBeginPlay(t)},onTimeUpdate:e.handleGlueTimeUpdate,onError:t=>this.ignoreErrors?null:e.onError(t),onAbort:t=>this.ignoreErrors?null:e.onError(t),controls:Boolean(be),style:{marginTop:"-40px"},children:[F("source",{ref:e=>this.source1=e,class:"gluemp4",src:"".concat(Te(e.sound,e.playerType)).concat(e.playerType,"-").concat(e.sound.key,".mp4").concat(""),type:"audio/mp4"}),F("source",{ref:e=>this.source2=e,class:"glueogg",src:"".concat(Te(e.sound,e.playerType)).concat(e.playerType,"-").concat(e.sound.key,".ogg").concat(""),type:"audio/ogg"})]})}}classLeextendsv{constructor(){super(),this.playMain=this.playMain.bind(this)}componentWillReceiveProps(e){const{props:t}=this,n=e.isPlaying,i=t.isPlaying,s=e.sound.volume>.02,r=t.sound.volume>.02;n&&!i&&s?this.playMain():n&&i?s&&!r?this.playMain():!s&&r&&this.stop():!n&&i&&r&&this.stop()}playMain(){this.player&&this.player.play()}stop(){this.player&&this.player.pause()}render(){const{props:e}=this;returnF("div",{className:"SoundPlayerIos",children:F("audio",{ref:e=>{this.player=e},preload:"auto",loop:!0,controls:Boolean(be),onError:t=>e.handleError(t,"error"),onAbort:t=>e.handleError(t,"abort"),children:F("source",{class:"mp4",src:"".concat(Te(e.sound,!1),"ios-web-").concat(e.sound.key,".mp4").concat(""),type:"audio/mp4"})})})}}classFeextendsv{constructor(){super(),this.state={loadingGlue:!1,loadingMain:!1},this.updateLoading=this.updateLoading.bind(this)}updateLoading(e,t){constn=Object.assign({},this.state,e);this.setState(n),t&&this.props.onSoundLoaded(this.props.sound.key)}render({sound:e,onTapSoundIme:t,isPlaying:n,meanderActive:i}){consts=globalThis&&globalThis.IOS;letr="loadingIndicator";returnthis.props.alreadyLoaded||(r="".concat(r,"\n").concat(this.state.loadingGlue?"loadingGlue":"","\n").concat(this.state.loadingMain?"loadingMain":"","\n")),F("div",{className:"SoundContainer",children:[F("div",{className:"inner",children:[F("button",{onClick:()=>t(this.props.sound.key),className:"imeContainerinteractive".concat(this.props.sound.key,"").concat(this.props.sound.pro?"pro":""),children:[F("div",{className:r,children:F("img",{src:"/assets/spinner.gif",height:"32",width:"30",alt:"Loadingicon"})}),F("div",{className:"imeoutline".concat(this.props.sound.key)}),F("div",{className:"imefill".concat(this.props.sound.key),style:{opacity:e.volume}})]}),F("h3",{children:[e.label,n&&e.volume>.02&&i&&F("span",{className:"meanderIndicator"})]}),this.props.children]}),s?F(Le,{isPlaying:n,sound:e}):F(Oe,{isPlaying:n,sound:e,globalVolume:this.props.globalVolume,onUpdateLoading:this.updateLoading},e.key)]})}}classVeextendsv{constructor(){super(),this.state={forceSlider:!1,forceSliderValue:0},this.updateSoundVolume=this.updateSoundVolume.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this)}componentWillReceiveProps(e){e.forceUpdateIndex!==this.props.forceUpdateIndex?this.setState({forceSlider:!0,forceSliderValue:e.volume}):this.setState({forceSlider:!1})}shouldComponentUpdate(e){return!this.touchInProgress&&e.forceUpdateIndex!==this.props.forceUpdateIndex}updateSoundVolume(e){this.props.updateSoundVolume(this.props.soundKey,parseFloat(e.target.value))}handleTouchStart(){this.touchInProgress=!0,this.props.onTouchStart()}handleTouchEnd(){this.touchInProgress=!1,this.props.onTouchEnd()}componentWillUnmount(){this.state.forceSliderValue=0,this.state.forceSlider=!1,Promise.resolve(this).then((()=>this.nextBase=this.__b=null))}render(){returnF("div",{className:"SoundSlider",children:F("span",{children:F("input",{type:"range",min:"0",max:"1",step:"0.02",...this.state.forceSlider?{value:this.state.forceSliderValue+.001*Math.random()}:{},defaultValue:this.props.volume,onInput:this.updateSoundVolume,onChange:()=>this.setState({touchInProgress:!1}),onMouseDown:this.handleTouchStart,onTouchStart:this.handleTouchStart,onMouseUp:this.handleTouchEnd,onTouchEnd:this.handleTouchEnd},"".concat(this.props.soundKey).concat(this.props.forceUpdateIndex))})})}}classUeextendsv{constructor(){super(),this.state={soundsLoaded:{}},this.handleSoundLoaded=this.handleSoundLoaded.bind(this)}handleSoundLoaded(e){if(this.state.soundsLoaded[e])return;constt=Object.assign({},this.state.soundsLoaded);t[e]=!0,this.setState({soundsLoaded:t})}render(){conste=this.props.sounds;returnF("div",{className:"SoundList",children:Object.keys(e).map((t=>e[t])).sort(((e,t)=>e.sortKey-t.sortKey)).map((e=>F(Fe,{globalVolume:this.props.globalVolume,isPlaying:this.props.isPlaying,sound:Object.assign({},e),onTapSoundIme:this.props.onTapSoundIme,meanderActive:this.props.meanderActive,onSoundLoaded:this.handleSoundLoaded,alreadyLoaded:Boolean(this.state.soundsLoaded[e.key]),children:F(Ve,{soundKey:e.key,volume:e.volume,updateSoundVolume:this.props.updateSoundVolume,forceUpdateIndex:this.props.forceUpdateIndex,onTouchStart:this.props.onTouchStart,onTouchEnd:this.props.onTouchEnd},e.key)},e.key)))})}}classjeextendsv{render(){returnF("footer",{className:"Footer",children:F("div",{className:"container",children:[F("a",{href:"/docs/privacy-policy.html",title:"PrivacyPolicy",children:"PrivacyPolicy"}),F("a",{href:"/docs/terms-of-use.html",title:"Termsofuse",children:"Termsofuse"}),this.props.showAppLinks&&F("a",{title:"ASoftMurmuronTheAppStore",href:"itunes.apple.com/us/app/a-soft-murmur/id55?ls=1&mt=8",children:"iPhoneapp"}),this.props.showAppLinks&&F("a",{href:"play.google.com/store/apps/details?id=com.gabemart.asoftmurmur",title:"ASoftMurmuronGooglePlay",children:"Androidapp"})]})})}}classBeextendsv{render(){returnF("div",{className:"AppLinks".concat(this.props.hidden?"hidden":""),children:[F("button",{className:"interactivehide",onClick:this.props.hideAppLinks,children:"✕"}),F("a",{className:"cupertinointeractive",title:"ASoftMurmuronTheAppStore",href:"itunes.apple.com/app/apple-store/id55?pt=7&ct=".concat(this.props.utmCampaign?this.props.utmCampaign:"","&mt=8"),children:F("span",{})}),F("a",{className:"mountainviewinteractive",title:"ASoftMurmuronGooglePlay",href:"play.google.com/store/apps/details?id=com.gabemart.asoftmurmur".concat(this.props.utmSubstring?this.props.utmSubstring:""),children:F("span",{})})]})}}classqeextendsv{render(){returnF("div",{className:"MoreSounds",children:[F("button",{className:"buttoninteractive",onClick:this.props.onStart,children:"Moresounds"}),F("div",{className:"footest"})]})}}classzeextendsv{constructor(){super(),this.state={autorenew:!0,externalScriptLoaded:!1},this.toggleAutorenew=this.toggleAutorenew.bind(this)}toggleAutorenew(){this.state.autorenew;conste=!this.state.autorenew;this.setState({autorenew:e})}componentDidMount(){try{if(document.getElementById("paddleScript"))this.setState({externalScriptLoaded:!0});else{conste=document.createElement("script");e.src="cdn.paddle.com/paddle/paddle.js",e.onload=()=>{this.setState({externalScriptLoaded:!0})},e.id="paddleScript",document.body.appendChild(e)}}catch(KS){}this.escListener=e=>{27===e.keyCode&&(e.stopPropation(),this.props.onSetSte(null))},window.addEventListener("keyup",this.escListener)}componentWillUnmount(){window.removeEventListener("keyup",this.escListener)}render(){conste=Math.abs(this.props.ste);returnF("div",{className:"UpgradeModal",children:[F(Ge,{onSetLogin:()=>this.props.onSetSte(2),showLoginLink:1===e&&!this.props.user}),F("div",{className:"container",children:[1===e?F(He,{extraSounds:this.props.extraSounds,onSetSte:this.props.onSetSte,user:this.props.user}):null,2===e?F(We,{onSetSte:this.props.onSetSte,onSetEmail:this.props.onSetEmail,user:this.props.user,inSignupFlow:2===this.props.ste,firebaseAuth:this.props.firebaseAuth}):null,3===e?F(Ye,{autorenew:!0,onToggleAutorenew:this.toggleAutorenew,onSetSte:this.props.onSetSte,user:this.props.user,externalScriptLoaded:this.state.externalScriptLoaded}):null,4===e?F(We,{onSetSte:this.props.onSetSte,onSetEmail:this.props.onSetEmail,user:this.props.user,justPrompting:!0,finishEmailPrompt:this.props.finishEmailPrompt,firebaseAuth:this.props.firebaseAuth}):null]})]})}}classGeextendsv{render(){returnF("div",{className:"UpgradeHeader",children:F("div",{className:"content",children:[F("img",{className:"icon",src:"/assets/ficon.png"}),F("h2",{className:"title",children:F("a",{className:"interactive",href:"/",children:"ASoftMurmur"})}),F("div",{className:"signIn",children:this.props.showLoginLink?F("button",{className:"interactive",onClick:this.props.onSetLogin,children:"Signin"}):null})]})})}}classKeextendsv{constructor(){super()}componentWillUnmount(){Promise.resolve(this).then((()=>this.nextBase=this.__b=null))}componentDidMount(){setTimeout((()=>{if(this.player)try{this.player.play()}catch(KS){}}),100)}render(){returnthis.props,F("audio",{ref:e=>this.player=e,className:"PreviewSound",autoplay:!0,preload:"auto",onEnded:this.props.onEnd,children:[F("source",{className:"mp4"+this.props.sound.key,src:"".concat(Te(this.props.sound),"glue-").concat(this.props.sound.key,".mp4"),type:"audio/mp4"}),F("source",{className:"ogg"+this.props.sound.key,src:"".concat(Te(this.props.sound),"glue-").concat(this.props.sound.key,".ogg"),type:"audio/ogg"})]})}}classHeextendsv{constructor(){super(),this.state={soundPreviewing:null},this.togglePreview=this.togglePreview.bind(this)}togglePreview(e){this.setState({soundPreviewing:this.state.soundPreviewing===e?null:e})}render(){conste=Object.keys(this.props.extraSounds).map((e=>this.props.extraSounds[e])).sort(((e,t)=>e.sortKey-t.sortKey));returnF("div",{className:"Ste1",children:[F("p",{children:["Upgradeforaccessto",F("span",{className:"numSounds",children:""+e.length+""}),"extrawebsounds."]}),F("p",{children:"You'llalsogetaccesstoanynewwebsoundsreleasedinthefuture."}),F("div",{className:"previewSounds",children:[F("ul",{children:e.map((e=>F(Qe,{sound:e,isActive:!0,toggleSound:()=>null,isPreviewing:this.state.soundPreviewing===e.key,onTogglePreview:this.togglePreview.bind(this,e.key)})))}),this.state.soundPreviewing?F(Ke,{sound:this.props.extraSounds[this.state.soundPreviewing],onEnd:()=>this.setState({soundPreviewing:null})},this.state.soundPreviewing):null]}),F("div",{className:"continueContainer",children:[F("button",{className:"interactivecancelbutton",onClick:()=>{this.props.onSetSte(null)},children:"Close"}),F("button",{className:"interactivecontinuebutton",onClick:()=>{conste=this.props.user?3:2;this.props.onSetSte(e)},children:"Continue"})]})]})}}classWeextendsv{constructor(){super(...arguments),t(this,"state",{emailText:"",emailValidationError:null})}render(){lete="".concat(window.location.protocol,"//").concat(window.location.hostname);window.location.port&&80!==window.location.port&&(e="".concat(e,":").concat(window.location.port));constt={url:this.props.inSignupFlow?"".concat(e,"/?upgradeAccountCreated=1"):"".concat(e,"/"),handleCodeInApp:!0};returnthis.sendSignInLink=()=>{this.setState({loading:!0}),this.props.firebaseAuth().sendSignInLinkToEmail(this.state.emailText,t).then((()=>{this.props.onSetEmail(this.state.emailText),this.setState({awaitingEmailValidation:!0,loading:!1})})).catch((e=>{this.setState({emailValidationError:"remote",loading:!1})}))},this.finishEmailPrompt=e=>{this.props.finishEmailPrompt(e)},this.state.awaitingEmailValidation?F("div",{className:"Ste2",children:[F("p",{children:["Sign-inemailsentto",F("span",{className:"userEnteredEmail",children:this.state.emailText})]}),F("p",{children:"Anemailwithasign-inlinkshouldarriveinafewminutes.Pleaseremembertocheckyourjunkfolder."}),F("div",{className:"continueContainer",children:[F("button",{className:"interactivecancelbutton",onClick:()=>{this.setState({awaitingEmailValidation:!1})},children:"Wrongemailaddress?"}),F("button",{className:"interactivecontinuebutton",onClick:()=>{this.props.onSetSte(null)},children:"Close"})]})]}):F("div",{className:"Ste2",children:[this.state.loading&&F("div",{className:"loadingContainer",children:F("div",{className:"loading"})}),F("h3",{children:this.props.justPrompting?"Enteryouremailaddresstofinishsigningin":"Signinorregister"}),F("label",{for:"upgradeEmail",className:"emailLabel",children:"Emailaddress"}),F("input",{type:"email",id:"upgradeEmail",className:"".concat(this.state.emailValidationError?"invalid":""),onInput:()=>{this.state.emailValidationError&&this.setState({emailValidationError:null})},onChange:e=>{this.setState({emailText:e.target.value})},value:this.state.emailText}),this.state.emailValidationError?F("p",{className:"validationWarning",children:"Oops,somethingwentwrong-pleasedoublecheckyouremailaddress"}):null,F("div",{className:"continueContainer",children:[F("button",{className:"interactivecancelbutton",onClick:()=>{this.props.onSetSte(null)},children:"Cancel"}),F("button",{className:"interactivecontinuebutton",onClick:()=>{vare;!(e=this.state.emailText)||e.lengh{this.props.onSetSte(null)},children:"Close"}),F("button",{className:"interactivecontinuebutton",onClick:()=>{Paddle.Checkout.open({product:,...e})},disabled:!this.props.externalScriptLoaded,children:"Continue"})]})]})}}classJeextendsv{constructor(){super(),this.state={emailText:"",showErrorState:!1,submitted:!1}}render(){returnF("div",{className:"Modal".concat(this.props.addClassNames?this.props.addClassNames:""),children:F("div",{className:"inner",children:[F("div",{className:"header",children:[F("h2",{children:this.props.title}),F("button",{className:"cornerCloseinteractivehoverOpacity",onClick:this.props.onPositiveAction,children:"×"})]}),F("div",{className:"content",children:this.props.children}),F("div",{className:"buttonContainer",children:[F("button",{className:"buttoninteractivesubmit",onClick:this.props.onPositiveAction,children:this.props.positiveText||"OK"}),this.props.onNegativeAction?F("button",{className:"buttoninteractivecancel",onClick:this.props.onNegativeAction,children:this.props.negativeText||"Cancel"}):null]})]})})}}constXe=e=>{if(!(e&&e.expires&&e.expires{constt=re[e];t.pro&&(it[e]=t)}));constst={globalVolume:1,isPlaying:!1,timesLaunched:0,checkedUrl:!1,checkedStore:!1,ailableSounds:Object.assign({},oe,it),library:Object.assign({},oe),sounds:Object.assign({},oe),timer:{isActive:!1,secondsLeft:null,mode:null},sedTimer:{lastUsedMode:"stop",stop:{seconds:300}},meander:{isActive:!1,sounds:null},sedMixes:{},usedMeanderBefore:!1,usedSoundManerBefore:!1,appLinkshidden:!1,forceUpdateIndex:0,stateToReset:null,utmSubstring:null,utmCampaign:null,pro:!1,proExpires:null,proLastChecked:null,inLoginView:!1},rt=e=>{try{if(URLSearchParams&&window.location&&history&&history.replaceState){constt=newURL(window.location),n=newURLSearchParams(t.search);if(!n.get(e))return;n.delete(e);consti=n.toString().length?"?":"";history.replaceState("","","".concat(window.location.pathname).concat(i).concat(n.toString()))}}catch(KS){return}},ot=e=>{constt={};returnObject.keys(e).forEach((n=>{t[n]={key:n,volume:e[n].volume}})),t},{ailableSounds:at}=st,ct=()=>{if(globalThis.localStore){conste=globalThis.localStore.getItem("asm-stored-state"),t=e?JSON.parse(e):null;if(t&&t.sounds){Object.keys(t.sounds).every((e=>0===parseFloat(t.sounds[e].volume))),t.upgradeDialog&&(t.upgradeDialog=null);lete=!1;try{constn=Number(t.proExpires),i=e5;n>Date.now()&&n!Object.keys(t.library).find((t=>t===e))))&&(t.sounds=Object.assign({},oe))),t}return{}}return{}},lt=e=>{if(!globalThis.localStore)return{};{lett=Object.assign({},e);t.storeDate=Date.now(),t.isPlaying=!1,t.stateToReset=null,t.meander={isActive:!1,sounds:null},t.timer={isActive:!1},t.forceUpdateIndex=0;constn=JSON.stringify(t);globalThis.localStore.setItem("asm-stored-state",n)}},ut=function(e){constt=[];letn=0;for(leti=0;i12&63|128,t[n++]=s>>6&63|128,t[n++]=63&s|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=63&s|128)}returnt},ht={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz89",getENCODED_VALS(){returnthis.ENCODED_VALS_BASE+"+/="},getENCODED_VALS_WEBSAFE(){returnthis.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeofatob,encodeByteArray(e,t){if(!Array.isArray(e))throwError("encodeByteArraytakesanarrayasaparameter");this.init_();constn=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(lets=0;s{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){leti;if(void0===e&&void0===t&&void0===n)thrownewError("MissingObserver.");i=function(e,t){if("object"!=typeofe||null===e)return!1;for(constnoft)if(nine&&"function"==typeofe[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void0===i.next&&(i.next=Ft),void0===i.error&&(i.error=Ft),void0===i.complete&&(i.complete=Ft);consts=this.unsubscribeOne.bind(this,this.observers.length);returnthis.finalized&&this.task.then((()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(KS){}})),this.observers.push(i),s}unsubscribeOne(e){void0!==this.observers&&void0!==this.observers[e]&&(deletethis.observers[e],this.observerCount-=1,0===this.observerCount&&void0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(lett=0;t{if(void0!==this.observers&&void0!==this.observers[e])try{t(this.observers[e])}catch(KS){"undefined"!=typeofconsole&&console.error}}))}close(e){this.finalized||(this.finalized=!0,void0!==e&&(this.finalError=e),this.task.then((()=>{this.observers=void0,this.onNoObservers=void0})))}}functionFt(){}functionVt(e){returne&&e._delegate?e._delegate:e}classUt{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){returnthis.instantiationMode=e,this}setMultipleInstances(e){returnthis.multipleInstances=e,this}setServiceProps(e){returnthis.serviceProps=e,this}setInstanceCreatedCallback(e){returnthis.onInstanceCreated=e,this}}constjt="[DEFAULT]";classBt{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=newMap,this.instancesDeferred=newMap,this.instancesOptions=newMap,this.onInitCallbacks=newMap}get(e){constt=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){conste=newwt;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{constn=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(KS){}}returnthis.instancesDeferred.get(t).promise}getImmediate(e){vart;constn=this.normalizeInstanceIdentifier(null==e?void0:e.identifier),i=null!==(t=null==e?void0:e.optional)&&void0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(i)returnnull;throwError("Service".concat(this.name,"isnotailable"))}try{returnthis.getOrInitializeService({instanceIdentifier:n})}catch(KS){if(i)returnnull;throwKS}}getComponent(){returnthis.component}setComponent(e){if(e.name!==this.name)throwError("MismatchingComponent".concat(e.name,"forProvider").concat(this.name,"."));if(this.component)throwError("Componentfor".concat(this.name,"hasalreadybeenprovided"));if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:jt})}catch(KS){}for(const[e,t]ofthis.instancesDeferred.entries()){constn=this.normalizeInstanceIdentifier(e);try{conste=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(KS){}}}}clearInstance(e=jt){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}asyncdelete(){conste=Array.from(this.instances.values());awaitPromise.all([...e.filter((e=>"INTERNAL"ine)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"ine)).map((e=>e._delete()))])}isComponentSet(){returnnull!=this.component}isInitialized(e=jt){returnthis.instances.has(e)}getOptions(e=jt){returnthis.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throwError("".concat(this.name,"(").concat(n,")hasalreadybeeninitialized"));if(!this.isComponentSet())throwError("Component".concat(this.name,"hasnotbeenregisteredyet"));consti=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[s,r]ofthis.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(s)&&r.resolve(i)}returni}onInit(e,t){varn;consti=this.normalizeInstanceIdentifier(t),s=null!==(n=this.onInitCallbacks.get(i))&&void0!==n?n:newSet;s.add(e),this.onInitCallbacks.set(i,s);constr=this.instances.get(i);returnr&&e(r,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){constn=this.onInitCallbacks.get(t);if(n)for(constiofn)try{i(e,t)}catch(ha){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){letn=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(i=e,i===jt?void0:i),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(ha){}vari;returnn||null}normalizeInstanceIdentifier(e=jt){returnthis.component?this.component.multipleInstances?e:jt:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}classqt{constructor(e){this.name=e,this.providers=newMap}addComponent(e){constt=this.getProvider(e.name);if(t.isComponentSet())thrownewError("Component".concat(e.name,"hasalreadybeenregisteredwith").concat(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))returnthis.providers.get(e);constt=newBt(e,this);returnthis.providers.set(e,t),t}getProviders(){returnArray.from(this.providers.values())}}constzt=[];varGt,Kt;(Kt=Gt||(Gt={}))[Kt.DEBUG=0]="DEBUG",Kt[Kt.VERBOSE=1]="VERBOSE",Kt[Kt.INFO=2]="INFO",Kt[Kt.WARN=3]="WARN",Kt[Kt.ERROR=4]="ERROR",Kt[Kt.SILENT=5]="SILENT";constHt={debug:Gt.DEBUG,verbose:Gt.VERBOSE,info:Gt.INFO,warn:Gt.WARN,error:Gt.ERROR,silent:Gt.SILENT},Wt=Gt.INFO,Qt={[Gt.DEBUG]:"log",[Gt.VERBOSE]:"log",[Gt.INFO]:"info",[Gt.WARN]:"warn",[Gt.ERROR]:"error"},Yt=(e,t,...n)=>{if(tt.some((t=>einstanceoft));letZt,$t;consten=newWeakMap,tn=newWeakMap,nn=newWeakMap,sn=newWeakMap,rn=newWeakMap;leton={get(e,t,n){if(einstanceofIDBTransaction){if("done"===t)returntn.get(e);if("objectStoreNames"===t)returne.objectStoreNames||nn.get(e);if("store"===t)returnn.objectStoreNames[1]?void0:n.objectStore(n.objectStoreNames[0])}returnln(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>einstanceofIDBTransaction&&("done"===t||"store"===t)||tine};functionan(e){returne!==IDBDatabase.prototype.transaction||"objectStoreNames"inIDBTransaction.prototype?($t||($t=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){returne.apply(un(this),t),ln(en.get(this))}:function(...t){returnln(e.apply(un(this),t))}:function(t,...n){consti=e.call(un(this),t,...n);returnnn.set(i,t.sort?t.sort():[t]),ln(i)}}functioncn(e){return"function"==typeofe?an(e):(einstanceofIDBTransaction&&function(e){if(tn.has(e))return;constt=newPromise(((t,n)=>{consti=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",r),e.removeEventListener("abort",r)},s=()=>{t(),i()},r=()=>{n(e.error||newDOMException("AbortError","AbortError")),i()};e.addEventListener("complete",s),e.addEventListener("error",r),e.addEventListener("abort",r)}));tn.set(e,t)}(e),Xt(e,Zt||(Zt=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?newProxy(e,on):e)}functionln(e){if(einstanceofIDBRequest)returnfunction(e){constt=newPromise(((t,n)=>{consti=()=>{e.removeEventListener("success",s),e.removeEventListener("error",r)},s=()=>{t(ln(e.result)),i()},r=()=>{n(e.error),i()};e.addEventListener("success",s),e.addEventListener("error",r)}));returnt.then((t=>{tinstanceofIDBCursor&&en.set(t,e)})).catch((()=>{})),rn.set(t,e),t}(e);if(sn.has(e))returnsn.get(e);constt=cn(e);returnt!==e&&(sn.set(e,t),rn.set(t,e)),t}constun=e=>rn.get(e);consthn=["get","getKey","getAll","getAllKeys","count"],dn=["put","add","delete","clear"],pn=newMap;functionfn(e,t){if(!(einstanceofIDBDatabase)||tine||"string"!=typeoft)return;if(pn.get(t))returnpn.get(t);constn=t.replace(/FromIndex$/,""),i=t!==n,s=dn.includes(n);if(!(nin(i?IDBIndex:IDBObjectStore).prototype)||!s&&!hn.includes(n))return;constr=asyncfunction(e,...t){constr=this.transaction(e,s?"readwrite":"readonly");leto=r.store;returni&&(o=o.index(t.shift())),(awaitPromise.all([o[n](...t),s&&r.done]))[0]};returnpn.set(t,r),r}on=(e=>({...e,get:(t,n,i)=>fn(t,n)||e.get(t,n,i),has:(t,n)=>!!fn(t,n)||e.has(t,n)}))(on);classmn{constructor(e){this.container=e}getPlatformInfoString(){returnthis.container.getProviders().map((e=>{if(function(e){constt=e.getComponent();return"VERSION"===(null==t?void0:t.type)}(e)){constt=e.getImmediate();return"".concat(t.library,"/").concat(t.version)}returnnull})).filter((e=>e)).join("")}}constgn="@firebase/app",yn="0.9.18",vn=newJt("@firebase/app"),wn="[DEFAULT]",_n={[gn]:"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/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/messing":"fire-fcm","@firebase/messing-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/store":"fire-gcs","@firebase/store-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},bn=newMap,In=newMap;functionTn(e,t){try{e.container.addComponent(t)}catch(KS){vn.debug("Component".concat(t.name,"failedtoregisterwithFirebaseApp").concat(e.name),KS)}}functionSn(e,t){e.container.addOrOverwriteComponent(t)}functionEn(e){constt=e.name;if(In.has(t))returnvn.debug("Thereweremultipleattemptstoregistercomponent".concat(t,".")),!1;In.set(t,e);for(constnofbn.values())Tn(n,e);return!0}functionkn(e,t){constn=e.container.getProvider("heartbeat").getImmediate({optional:!0});returnn&&n.triggerHeartbeat(),e.container.getProvider(t)}constCn=newCt("app","Firebase",{"no-app":"NoFirebaseApp'{$appName}'hasbeencreated-callinitializeApp()first","bad-app-name":"IllegalAppname:'{$appName}","duplicate-app":"FirebaseAppnamed'{$appName}'alreadyexistswithdifferentoptionsorconfig","app-deleted":"FirebaseAppnamed'{$appName}'alreadydeleted","no-options":"Needtoprovideoptions,whennotbeingdeployedtohostingviasource.","invalid-app-argument":"firebase.{$appName}()takeseithernoargumentoraFirebaseAppinstance.","invalid-log-argument":"Firstargumentto`onLog`mustbenullorafunction.","idb-open":"ErrorthrownwhenopeningIndexedDB.Originalerror:{$originalErrorMesse}.","idb-get":"ErrorthrownwhenreadingfromIndexedDB.Originalerror:{$originalErrorMesse}.","idb-set":"ErrorthrownwhenwritingtoIndexedDB.Originalerror:{$originalErrorMesse}.","idb-delete":"ErrorthrownwhendeletingfromIndexedDB.Originalerror:{$originalErrorMesse}."});letAn=class{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(newUt("app",(()=>this),"PUBLIC"))}getautomaticDataCollectionEnabled(){returnthis.checkDestroyed(),this._automaticDataCollectionEnabled}setautomaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}getname(){returnthis.checkDestroyed(),this._name}getoptions(){returnthis.checkDestroyed(),this._options}getconfig(){returnthis.checkDestroyed(),this._config}getcontainer(){returnthis._container}getisDeleted(){returnthis._isDeleted}setisDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throwCn.create("app-deleted",{appName:this._name})}};constNn="10.3.1";functionxn(e,t={}){letn=e;if("object"!=typeoft){t={name:t}}consti=Object.assign({name:wn,automaticDataCollectionEnabled:!1},t),s=i.name;if("string"!=typeofs||!s)throwCn.create("bad-app-name",{appName:String(s)});if(n||(n=vt()),!n)throwCn.create("no-options");constr=bn.get(s);if(r){if(xt(n,r.options)&&xt(i,r.config))returnr;throwCn.create("duplicate-app",{appName:s})}consto=newqt(s);for(constcofIn.values())o.addComponent(c);consta=newAn(n,i,o);returnbn.set(s,a),a}asyncfunctionPn(e){constt=e.name;bn.has(t)&&(bn.delete(t),awaitPromise.all(e.container.getProviders().map((e=>e.delete()))),e.isDeleted=!0)}functionDn(e,t,n){vari;lets=null!==(i=_n[e])&&void0!==i?i:e;n&&(s+="-".concat(n));constr=s.match(/\s|\//),o=t.match(/\s|\//);if(r||o){conste=['Unabletoregisterlibrary"'.concat(s,'"withversion"').concat(t,'":')];returnr&&e.push('libraryname"'.concat(s,'"containsillegalcharacters(whitespaceor"/")')),r&&o&&e.push("and"),o&&e.push('versionname"'.concat(t,'"containsillegalcharacters(whitespaceor"/")')),voidvn.warn(e.join(""))}En(newUt("".concat(s,"-version"),(()=>({library:s,version:t})),"VERSION"))}functionOn(e,t){if(null!==e&&"function"!=typeofe)throwCn.create("invalid-log-argument");!function(e,t){for(constnofzt){leti=null;t&&t.level&&(i=Ht[t.level]),n.userLogHandler=null===e?null:(t,n,...s)=>{constr=s.map((e=>{if(null==e)returnnull;if("string"==typeofe)returne;if("number"==typeofe||"boolean"==typeofe)returne.toString();if(einstanceofError)returne.messe;try{returnJSON.stringify(e)}catch(t){returnnull}})).filter((e=>e)).join("");n>=(null!=i?i:t.logLevel)&&e({level:Gt[n].toLowerCase(),messe:r,args:s,type:t.name})}}}(e,t)}functionRn(e){vart;t=e,zt.forEach((e=>{e.setLogLevel(t)}))}constMn="firebase-heartbeat-database",Ln=1,Fn="firebase-heartbeat-store";letVn=null;functionUn(){returnVn||(Vn=function(e,t,{blocked:n,upgrade:i,blocking:s,terminated:r}={}){consto=indexedDB.open(e,t),a=ln(o);returni&&o.addEventListener("upgradeneeded",(e=>{i(ln(o.result),e.oldVersion,e.newVersion,ln(o.transaction),e)})),n&&o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),a.then((e=>{r&&e.addEventListener("close",(()=>r())),s&&e.addEventListener("versionchange",(e=>s(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),a}(Mn,Ln,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(Fn)}}).catch((e=>{throwCn.create("idb-open",{originalErrorMesse:e.messe})}))),Vn}asyncfunctionjn(e,t){try{constn=(awaitUn()).transaction(Fn,"readwrite"),i=n.objectStore(Fn);awaiti.put(t,Bn(e)),awaitn.done}catch(KS){if(KSinstanceofkt)vn.warn(KS.messe);else{constt=Cn.create("idb-set",{originalErrorMesse:nulUn Murmur morbidol==KS?void0:KS.messe});vn.warn(t.messe)}}}functionBn(e){return"".concat(e.name,"!").concat(e.options.appId)}classqn{constructor(e){this.container=e,this._heartbeatsCache=null;constt=this.container.getProvider("app").getImmediate();this._store=newGn(t),this._heartbeatsCachePromise=this._store.read().then((e=>(this._heartbeatsCache=e,e)))}asynctriggerHeartbeat(){conste=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=zn();if(null===this._heartbeatsCache&&(this._heartbeatsCache=awaitthis._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==t&&!this._heartbeatsCache.heartbeats.some((e=>e.date===t)))returnthis._heartbeatsCache.heartbeats.push({date:t,ent:e}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{constt=newDate(e.date).valueOf();returnDate.now()-te.ent===s.ent));if(e){if(e.dates.push(s.date),Kn(n)>t){e.dates.pop();break}}elseif(n.push({ent:s.ent,dates:[s.date]}),Kn(n)>t){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}(this._heartbeatsCache.heartbeats),i=pt(JSON.stringify({version:2,heartbeats:t}));returnthis._heartbeatsCache.lastSentHeartbeatDate=e,n.length>0?(this._heartbeatsCache.heartbeats=n,awaitthis._store.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._store.overwrite(this._heartbeatsCache)),i}}functionzn(){return(newDate).toISOString().substring(0,10)}classGn{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}asyncrunIndexedDBEnvironmentCheck(){return!!Et()&&newPromise(((e,t)=>{try{letn=!0;consti="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(i);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{vare;t((null===(e=s.error)||void0===e?void0:e.messe)||"")}}catch(n){t(n)}})).then((()=>!0)).catch((()=>!1))}asyncread(){if(awaitthis._canUseIndexedDBPromise){returnawaitasyncfunction(e){try{constt=awaitUn();returnawaitt.transaction(Fn).objectStore(Fn).get(Bn(e))}catch(KS){if(KSinstanceofkt)vn.warn(KS.messe);else{constt=Cn.create("idb-get",{originalErrorMesse:null==KS?void0:KS.messe});vn.warn(t.messe)}}}(this.app)||{heartbeats:[]}}return{heartbeats:[]}}asyncoverwrite(e){vart;if(awaitthis._canUseIndexedDBPromise){constn=awaitthis.read();returnjn(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}asyncadd(e){vart;if(awaitthis._canUseIndexedDBPromise){constn=awaitthis.read();returnjn(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}functionKn(e){returnpt(JSON.stringify({version:2,heartbeats:e})).length}varHn;Hn="",En(newUt("platform-logger",(e=>newmn(e)),"PRIVATE")),En(newUt("heartbeat",(e=>newqn(e)),"PRIVATE")),Dn(gn,yn,Hn),Dn(gn,yn,"esm2017"),Dn("fire-js","");constWn=Object.freeze(Object.defineProperty({__proto__:null,FirebaseError:kt,SDK_VERSION:Nn,_DEFAULT_ENTRY_NAME:wn,_addComponent:Tn,_addOrOverwriteComponent:Sn,_apps:bn,_clearComponents:function(){In.clear()},_components:In,_getProvider:kn,_registerComponent:En,_removeServiceInstance:function(e,t,n=wn){kn(e,t).clearInstance(n)},deleteApp:Pn,getApp:function(e=wn){constt=bn.get(e);if(!t&&e===wn&&vt())returnxn();if(!t)throwCn.create("no-app",{appName:e});returnt},getApps:function(){returnArray.from(bn.values())},initializeApp:xn,onLog:On,registerVersion:Dn,setLogLevel:Rn},Symbol.toStringT,{value:"Module"}));classQn{constructor(e,t){this._delegate=e,this.firebase=t,Tn(e,newUt("app-compat",(()=>this),"PUBLIC")),this.container=e.container}getautomaticDataCollectionEnabled(){returnthis._delegate.automaticDataCollectionEnabled}setautomaticDataCollectionEnabled(e){this._delegate.automaticDataCollectionEnabled=e}getname(){returnthis._delegate.name}getoptions(){returnthis._delegate.options}delete(){returnnewPromise((e=>{this._delegate.checkDestroyed(),e()})).then((()=>(this.firebase.INTERNAL.removeApp(this.name),Pn(this._delegate))))}_getService(e,t=wn){varn;this._delegate.checkDestroyed();consti=this._delegate.container.getProvider(e);returni.isInitialized()||"EXPLICIT"!==(null===(n=i.getComponent())||void0===n?void0:n.instantiationMode)||i.initialize(),i.getImmediate({identifier:t})}_removeServiceInstance(e,t=wn){this._delegate.container.getProvider(e).clearInstance(t)}_addComponent(e){Tn(this._delegate,e)}_addOrOverwriteComponent(e){Sn(this._delegate,e)}toJSON(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}}}constYn=newCt("app-compat","Firebase",{"no-app":"NoFirebaseApp'{$appName}'hasbeencreated-callFirebaseApp.initializeApp()","invalid-app-argument":"firebase.{$appName}()takeseithernoargumentoraFirebaseAppinstance."});constJn=functione(){constt=function(e){constt={},n={__esModule:!0,initializeApp:function(i,s={}){constr=xn(i,s);if(Nt(t,r.name))returnt[r.name];consto=newe(r,n);returnt[r.name]=o,o},app:i,registerVersion:Dn,setLogLevel:Rn,onLog:On,apps:null,SDK_VERSION:Nn,INTERNAL:{registerComponent:function(t){consts=t.name,r=s.replace("-compat","");if(En(t)&&"PUBLIC"===t.type){consto=(e=i())=>{if("function"!=typeofe[r])throwYn.create("invalid-app-argument",{appName:s});returne[r]()};void0!==t.serviceProps&&mt(o,t.serviceProps),n[r]=o,e.prototype[r]=function(...e){returnthis._getService.bind(this,s).apply(this,t.multipleInstances?e:[])}}return"PUBLIC"===t.type?n[r]:null},removeApp:function(e){deletet[e]},useAsService:function(e,t){return"serverAuth"===t?null:t},modularAPIs:Wn}};functioni(e){if(!Nt(t,e=e||wn))throwYn.create("no-app",{appName:e});returnt[e]}returnn.default=n,Object.defineProperty(n,"apps",{get:function(){returnObject.keys(t).map((e=>t[e]))}}),i.App=e,n}(Qn);returnt.INTERNAL=Object.assign(Object.assign({},t.INTERNAL),{createFirebaseNamespace:e,extendNamespace:function(e){mt(t,e)},createSubscribe:Mt,ErrorFactory:Ct,deepExtend:mt}),t}(),Xn=newJt("@firebase/app-compat");if("object"==typeofself&&self.self===self&&void0!==self.firebase){Xn.warn("\nWarning:Firebaseisalreadydefinedintheglobalscope.Pleasemakesure\nFirebaselibraryisonlyloadedonce.\n");conste=self.firebase.SDK_VERSION;e&&e.indexOf("LITE")>=0&&Xn.warn("\nWarning:YouaretryingtoloadFirebasewhileusingFirebasePerformancestandalonescript.\nYoushouldloadFirebasePerformancewiththisinstanceofFirebasetooidloadingduplicatecode.\n")}constZn=Jn;!function(e){Dn("@firebase/app-compat","0.2.18",e)}();function$n(e,t){varn={};for(variine)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i){this.timer=setTimeout((()=>t(yi(this.auth,"network-request-failed"))),Pi.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}functionVi(e,t,n){consti={appName:e.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);consts=yi(e,t,i);returns.customData._tokenResponse=n,s}functionUi(e){if(e)try{constt=newDate(Number(e));if(!isNaN(t.getTime()))returnt.toUTCString()}catch(KS){}}functionji(e){return1e3*Number(e)}functionBi(e){const[t,n,i]=e.split(".");if(void0===t||void0===n||void0===i)returnmi("JWTmalformed,containedfewerthan3sections"),null;try{conste=ft(n);returne?JSON.parse(e):(mi("Failedtodecodebase64JWTpayload"),null)}catch(KS){returnmi("CaughterrorparsingJWTpayloadasJSON",null==KS?void0:KS.toString()),null}}asyncfunctionqi(e,t,n=!1){if(n)returnt;try{returnawaitt}catch(KS){throwKSinstanceofkt&&function({code:e}){returne==="auth/".concat("user-disabled")||e==="auth/".concat("user-token-expired")}(KS)&&e.auth.currentUser===e&&awaite.auth.signOut(),KS}}classzi{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){vart;if(e){conste=this.errorBackoff;returnthis.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;conste=(null!==(t=this.user.stsTokenManer.expirationTime)&&void0!==t?t:0)-Date.now()-3e5;returnMath.max(0,e)}}schedule(e=!1){if(!this.isRunning)return;constt=this.getInterval(e);this.timerId=setTimeout((async()=>{awaitthis.iteration()}),t)}asynciteration(){try{awaitthis.user.getIdToken(!0)}catch(KS){returnvoid((null==KS?void0:KS.code)==="auth/".concat("network-request-failed")&&this.schedule(!0))}this.schedule()}}classGi{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ui(this.lastLoginAt),this.creationTime=Ui(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}asyncfunctionKi(e){vart;constn=e.auth,i=awaite.getIdToken(),s=awaitqi(e,asyncfunction(e,t){returnOi(e,"POST","/v1/accounts:lookup",t)}(n,{idToken:i}));bi(null==s?void0:s.users.length,n,"internal-error");constr=s.users[0];e._notifyReloadListener(r);consto=(null===(t=r.providerUserInfo)||void0===t?void0:t.length)?r.providerUserInfo.map((e=>{var{providerId:t}=e,n=$n(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];consta=(c=e.providerData,l=o,[...c.filter((e=>!l.some((t=>t.providerId===e.providerId)))),...l]);varc,l;constu=e.isAnonymous,h=!(e.email&&r.passwordHash||(null==a?void0:a.length)),d=!!u&&h,p={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:a,metadata:newGi(r.createdAt,r.lastLoginAt),isAnonymous:d};Object.assign(e,p)}classHi{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}getisExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){bi(e.idToken,"internal-error"),bi(void0!==e.idToken,"internal-error"),bi(void0!==e.refreshToken,"internal-error");constt="expiresIn"ine&&void0!==e.expiresIn?Number(e.expiresIn):function(e){constt=Bi(e);returnbi(t,"internal-error"),bi(void0!==t.exp,"internal-error"),bi(void0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}asyncgetToken(e,t=!1){returnbi(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired?this.refreshToken?(awaitthis.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}asyncrefresh(e,t){const{accessToken:n,refreshToken:i,expiresIn:s}=awaitasyncfunction(e,t){constn=awaitRi(e,{},(async()=>{constn=Dt({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:i,apiKey:s}=e.config,r=Li(e,i,"/v1/token","key=".concat(s)),o=awaite._getAdditionalHeaders();returno["Content-Type"]="application/x-",Ni.fetch()(r,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,i,Number(s))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}staticfromJSON(e,t){const{refreshToken:n,accessToken:i,expirationTime:s}=t,r=newHi;returnn&&(bi("string"==typeofn,"internal-error",{appName:e}),r.refreshToken=n),i&&(bi("string"==typeofi,"internal-error",{appName:e}),r.accessToken=i),s&&(bi("number"==typeofs,"internal-error",{appName:e}),r.expirationTime=s),r}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(){returnObject.assign(newHi,this.toJSON())}_performRefresh(){returnIi("notimplemented")}}functionWi(e,t){bi("string"==typeofe||void0===e,"internal-error",{appName:t})}classQi{constructor(e){var{uid:t,auth:n,stsTokenManer:i}=e,s=$n(e,["uid","auth","stsTokenManer"]);this.providerId="firebase",this.proactiveRefresh=newzi(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManer=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=newGi(s.createdAt||void0,s.lastLoginAt||void0)}asyncgetIdToken(e){constt=awaitqi(this,this.stsTokenManer.getToken(this.auth,e));returnbi(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,awaitthis.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){returnasyncfunction(e,t=!1){constn=Vt(e),i=awaitn.getIdToken(t),s=Bi(i);bi(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");constr="object"==typeofs.firebase?s.firebase:void0,o=null==r?void0:r.sign_in_provider;return{claims:s,token:i,authTime:Ui(ji(s.auth_time)),issuedAtTime:Ui(ji(s.iat)),expirationTime:Ui(ji(s.exp)),signInProvider:o||null,signInSecondFactor:(null==r?void0:r.sign_in_second_factor)||null}}(this,e)}reload(){returnasyncfunction(e){constt=Vt(e);awaitKi(t),awaitt.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(bi(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.stsTokenManer._assign(e.stsTokenManer))}_clone(e){constt=newQi(Object.assign(Object.assign({},this),{auth:e,stsTokenManer:this.stsTokenManer._clone()}));returnt.metadata._copy(this.metadata),t}_onReload(e){bi(!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){letn=!1;e.idToken&&e.idToken!==this.stsTokenManer.accessToken&&(this.stsTokenManer.updateFromServerResponse(e),n=!0),t&&awaitKi(this),awaitthis.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}asyncdelete(){conste=awaitthis.getIdToken();returnawaitqi(this,asyncfunction(e,t){returnOi(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManer.clearRefreshToken(),this.auth.signOut()}toJSON(){returnObject.assign(Object.assign({uid:this.uid,email:this.email||void0,emailVerified:this.emailVerified,displayName:this.displayName||void0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void0,phoneNumber:this.phoneNumber||void0,tenantId:this.tenantId||void0,providerData:this.providerData.map((e=>Object.assign({},e))),stsTokenManer:this.stsTokenManer.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}getrefreshToken(){returnthis.stsTokenManer.refreshToken||""}static_fromJSON(e,t){varn,i,s,r,o,a,c,l;constu=null!==(n=t.displayName)&&void0!==n?n:void0,h=null!==(i=t.email)&&void0!==i?i:void0,d=null!==(s=t.phoneNumber)&&void0!==s?s:void0,p=null!==(r=t.photoURL)&&void0!==r?r:void0,f=null!==(o=t.tenantId)&&void0!==o?o:void0,m=null!==(a=t._redirectEventId)&&void0!==a?a:void0,g=null!==(c=t.createdAt)&&void0!==c?c:void0,y=null!==(l=t.lastLoginAt)&&void0!==l?l:void0,{uid:v,emailVerified:w,isAnonymous:_,providerData:b,stsTokenManer:I}=t;bi(v&&I,e,"internal-error");constT=Hi.fromJSON(this.name,I);bi("string"==typeofv,e,"internal-error"),Wi(u,e.name),Wi(h,e.name),bi("boolean"==typeofw,e,"internal-error"),bi("boolean"==typeof_,e,"internal-error"),Wi(d,e.name),Wi(p,e.name),Wi(f,e.name),Wi(m,e.name),Wi(g,e.name),Wi(y,e.name);constS=newQi({uid:v,auth:e,email:h,emailVerified:w,displayName:u,isAnonymous:_,photoURL:p,phoneNumber:d,tenantId:f,stsTokenManer:T,createdAt:g,lastLoginAt:y});returnb&&Array.isArray(b)&&(S.providerData=b.map((e=>Object.assign({},e)))),m&&(S._redirectEventId=m),S}staticasync_fromIdTokenResponse(e,t,n=!1){consti=newHi;i.updateFromServerResponse(t);consts=newQi({uid:t.localId,auth:e,stsTokenManer:i,isAnonymous:n});returnawaitKi(s),s}}constYi=newMap;functionJi(e){Ti(einstanceofFunction,"Expectedaclassdefinition");lett=Yi.get(e);returnt?(Ti(tinstanceofe,"Instancestoredincachemismatchedwithclass"),t):(t=newe,Yi.set(e,t),t)}classXi{constructor(){this.type="NONE",this.store={}}async_isailable(){return!0}async_set(e,t){this.store[e]=t}async_get(e){constt=this.store[e];returnvoid0===t?null:t}async_remove(e){deletethis.store[e]}_addListener(e,t){}_removeListener(e,t){}}Xi.type="NONE";constZi=Xi;function$i(e,t,n){return"".concat("firebase",":").concat(e,":").concat(t,":").concat(n)}classes{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:i,name:s}=this.auth;this.fullUserKey=$i(this.userKey,i.apiKey,s),this.fullPersistenceKey=$i("persistence",i.apiKey,s),this.boundEventHandler=t._onStoreEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){returnthis.persistence._set(this.fullUserKey,e.toJSON())}asyncgetCurrentUser(){conste=awaitthis.persistence._get(this.fullUserKey);returne?Qi._fromJSON(this.auth,e):null}removeCurrentUser(){returnthis.persistence._remove(this.fullUserKey)}sePersistenceForRedirect(){returnthis.persistence._set(this.fullPersistenceKey,this.persistence.type)}asyncsetPersistence(e){if(this.persistence===e)return;constt=awaitthis.getCurrentUser();returnawaitthis.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}staticasynccreate(e,t,n="authUser"){if(!t.length)returnnewes(Ji(Zi),e,n);consti=(awaitPromise.all(t.map((asynce=>{if(awaite._isailable())returne})))).filter((e=>e));lets=i[0]||Ji(Zi);constr=$i(n,e.config.apiKey,e.name);leto=null;for(constcoft)try{constt=awaitc._get(r);if(t){constn=Qi._fromJSON(e,t);c!==s&&(o=n),s=c;break}}catch(ha){}consta=i.filter((e=>e._shouldAllowMigration));returns._shouldAllowMigration&&a.length?(s=a[0],o&&awaits._set(r,o.toJSON()),awaitPromise.all(t.map((asynce=>{if(e!==s)try{awaite._remove(r)}catch(ha){}}))),newes(s,e,n)):newes(s,e,n)}}functionts(e){constt=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(rs(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(ns(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(as(t))return"Blackberry";if(cs(t))return"Webos";if(is(t))return"Safari";if((t.includes("chrome/")||ss(t))&&!t.includes("edge/"))return"Chrome";if(os(t))return"Android";{constt=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===(null==n?void0:n.length))returnn[1]}return"Other"}functionns(e=_t()){return/firefox\//i.test(e)}functionis(e=_t()){constt=e.toLowerCase();returnt.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}functionss(e=_t()){return/crios\//i.test(e)}functionrs(e=_t()){return/iemobile/i.test(e)}functionos(e=_t()){return/android/i.test(e)}functionas(e=_t()){return/blackberry/i.test(e)}functioncs(e=_t()){return/webos/i.test(e)}functionls(e=_t()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}functionus(e=_t()){returnls(e)||os(e)||cs(e)||as(e)||/windowsphone/i.test(e)||rs(e)}functionhs(e,t=[]){letn;switch(e){case"Browser":n=ts(_t());break;case"Worker":n="".concat(ts(_t()),"-").concat(e);break;default:n=e}consti=t.length?t.join(","):"FirebaseCore-web";return"".concat(n,"/").concat("JsCore","/").concat(Nn,"/").concat(i)}classds{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){constn=t=>newPromise(((n,i)=>{try{n(e(t))}catch(KS){i(KS)}}));n.onAbort=t,this.queue.push(n);consti=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}asyncrunMiddleware(e){if(this.auth.currentUser===e)return;constt=[];try{for(constnofthis.queue)awaitn(e),n.onAbort&&t.push(n.onAbort)}catch(KS){t.reverse();for(constioft)try{i()}catch(n){}throwthis.auth._errorFactory.create("login-blocked",{originalMesse:null==KS?void0:KS.messe})}}}classps{constructor(e){vart,n,i,s;constr=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=r.minPasswordLength)&&void0!==t?t:6,r.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=r.maxPasswordLength),void0!==r.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=r.containsLowercaseCharacter),void0!==r.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=r.containsUppercaseCharacter),void0!==r.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=r.containsNumericCharacter),void0!==r.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=r.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(n=e.allowedNonAlphanumericCharacters)||void0===n?void0:n.join(""))&&void0!==i?i:"",this.forceUpgradeOnSignin=null!==(s=e.forceUpgradeOnSignin)&&void0!==s&&s,this.schemersion=e.schemersion}validatePassword(e){vart,n,i,s,r,o;consta={isValid:!0,passwordPolicy:this};returnthis.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&(a.isValid=null===(t=a.meetsMinPasswordLength)||void0===t||t),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void0===n||n),a.isValid&&(a.isValid=null===(i=a.containsLowercaseLetter)||void0===i||i),a.isValid&&(a.isValid=null===(s=a.containsUppercaseLetter)||void0===s||s),a.isValid&&(a.isValid=null===(r=a.containsNumericCharacter)||void0===r||r),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void0===o||o),a}validatePasswordLengthOptions(e,t){constn=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),i&&(t.meetsMaxPasswordLength=e.lengthPromise.reject(KS)))}returni?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}returnbi(this._popupRedirectResolver,this,"argument-error"),awaitthis.getOrInitRedirectPersistenceManer(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}asynctryRedirectSignIn(e){lett=null;try{t=awaitthis._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(KS){awaitthis._setRedirectUser(null)}returnt}asyncreloadAndSetCurrentUserOrClear(e){try{awaitKi(e)}catch(KS){if((null==KS?void0:KS.code)!=="auth/".concat("network-request-failed"))returnthis.directlySetCurrentUser(null)}returnthis.directlySetCurrentUser(e)}useDeviceLangue(){this.langueCode=function(){if("undefined"==typeofnigator)returnnull;conste=nigator;returne.langues&&e.langues[0]||e.langue||null}()}async_delete(){this._deleted=!0}asyncupdateCurrentUser(e){constt=e?Vt(e):null;returnt&&bi(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)returne&&bi(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||awaitthis.beforeStateQueue.runMiddleware(e),this.queue((async()=>{awaitthis.directlySetCurrentUser(e),this.notifyAuthListeners()}))}asyncsignOut(){returnawaitthis.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManer||this._popupRedirectResolver)&&awaitthis._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){returnthis.queue((async()=>{awaitthis.assertedPersistence.setPersistence(Ji(e))}))}_getRecaptchaConfig(){returnnull==this.tenantId?this._entRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}asyncvalidatePassword(e){this._getPasswordPolicyInternal()||awaitthis._updatePasswordPolicy();constt=this._getPasswordPolicyInternal();returnt.schemersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){returnnull===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async_updatePasswordPolicy(){conste=awaitasyncfunction(e,t={}){returnOi(e,"GET","/v2/passwordPolicy",Di(e,t))}(this),t=newps(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){returnthis.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=newCt("auth","Firebase",e())}onAuthStateChanged(e,t,n){returnthis.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){returnthis.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){returnthis.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){returnnewPromise(((e,t)=>{if(this.currentUser)e();else{constn=this.onAuthStateChanged((()=>{n(),e()}),t)}}))}toJSON(){vare;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void0===e?void0:e.toJSON()}}async_setRedirectUser(e,t){constn=awaitthis.getOrInitRedirectPersistenceManer(t);returnnull===e?n.removeCurrentUser():n.setCurrentUser(e)}asyncgetOrInitRedirectPersistenceManer(e){if(!this.redirectPersistenceManer){constt=e&&Ji(e)||this._popupRedirectResolver;bi(t,this,"argument-error"),this.redirectPersistenceManer=awaites.create(this,[Ji(t._redirectPersistence)],"redirectUser"),this.redirectUser=awaitthis.redirectPersistenceManer.getCurrentUser()}returnthis.redirectPersistenceManer}async_redirectUserForId(e){vart,n;returnthis._isInitialized&&awaitthis.queue((async()=>{})),(null===(t=this._currentUser)||void0===t?void0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void0===n?void0:n._redirectEventId)===e?this.redirectUser:null}async_persistUserIfCurrent(e){if(e===this.currentUser)returnthis.queue((async()=>this.directlySetCurrentUser(e)))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return"".concat(this.config.authDomain,":").concat(this.config.apiKey,":").concat(this.name)}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get_currentUser(){returnthis.currentUser}notifyAuthListeners(){vare,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);constn=null!==(t=null===(e=this.currentUser)||void0===e?void0:e.uid)&&void0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,i){if(this._deleted)return()=>{};consts="function"==typeoft?t:t.next.bind(t);letr=!1;consto=this._isInitialized?Promise.resolve():this._initializationPromise;if(bi(o,this,"internal-error"),o.then((()=>{r||s(this.currentUser)})),"function"==typeoft){consts=e.addObserver(t,n,i);return()=>{r=!0,s()}}{constn=e.addObserver(t);return()=>{r=!0,n()}}}asyncdirectlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?awaitthis.assertedPersistence.setCurrentUser(e):awaitthis.assertedPersistence.removeCurrentUser()}queue(e){returnthis.operations=this.operations.then(e,e),this.operations}getassertedPersistence(){returnbi(this.persistenceManer,this,"internal-error"),this.persistenceManer}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=hs(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){returnthis.frameworks}async_getAdditionalHeaders(){vare;constt={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);constn=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void0===e?void0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);consti=awaitthis._getAppCheckToken();returni&&(t["X-Firebase-AppCheck"]=i),t}async_getAppCheckToken(){vare;constt=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void0===e?void0:e.getToken());return(null==t?void0:t.error)&&function(e,...t){fi.logLevelthis.observer=e))}getnext(){returnbi(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}functionys(e){returnnewPromise(((t,n)=>{consti=document.createElement("script");vars,r;i.setAttribute("src",e),i.onload=t,i.onerror=e=>{constt=yi("internal-error");t.customData=e,n(t)},i.type="text/jascript",i.charset="UTF-8",(null!==(r=null===(s=document.getElementsByTName("head"))||void0===s?void0:s[0])&&void0!==r?r:document).appendChild(i)}))}functionvs(e){return"__".concat(e).concat(Math.floor(1e6*Math.random()))}classws{constructor(e){this.type="recaptcha-enterprise",this.auth=ms(e)}asyncverify(e="verify",t=!1){asyncfunctionn(e){if(!t){if(null==e.tenantId&&null!=e._entRecaptchaConfig)returne._entRecaptchaConfig.siteKey;if(null!=e.tenantId&&void0!==e._tenantRecaptchaConfigs[e.tenantId])returne._tenantRecaptchaConfigs[e.tenantId].siteKey}returnnewPromise((async(t,n)=>{(asyncfunction(e,t){returnOi(e,"GET","/v2/recaptchaConfig",Di(e,t))})(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((i=>{if(void0!==i.recaptchaKey){constn=newli(i);returnnull==e.tenantId?e._entRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(newError("recaptchaEnterprisesitekeyundefined"))})).catch((e=>{n(e)}))}))}functioni(t,n,i){consts=window.grecaptcha;ci(s)?s.enterprise.ready((()=>{s.enterprise.execute(t,{action:e}).then((e=>{n(e)})).catch((()=>{n("NO_RECAPTCHA")}))})):i(Error("NoreCAPTCHAenterprisescriptloaded."))}returnnewPromise(((e,s)=>{n(this.auth).then((n=>{if(!t&&ci(window.grecaptcha))i(n,e,s);else{if("undefined"==typeofwindow)returnvoids(newError("Recaptcherifierisonlysupportedinbrowser"));ys("/recaptcha/enterprise.js?render="+n).then((()=>{i(n,e,s)})).catch((e=>{s(e)}))}})).catch((e=>{s(e)}))}))}}asyncfunction_s(e,t,n,i=!1){consts=newws(e);letr;try{r=awaits.verify(n)}catch(a){r=awaits.verify(n,!0)}consto=Object.assign({},t);returni?Object.assign(o,{captchaResp:r}):Object.assign(o,{captchaResponse:r}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchersion:"RECAPTCHA_ENTERPRISE"}),o}functionbs(e,t,n){consti=ms(e);bi(i._canInitEmulator,i,"emulator-config-failed"),bi(/^?:\/\//.test(t),i,"invalid-emulator-scheme");consts=!!(null==n?void0:n.disableWarnings),r=Is(t),{host:o,port:a}=function(e){constt=Is(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};consti=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(i);if(s){conste=s[1];return{host:e,port:Ts(i.substr(e.length+1))}}{const[e,t]=i.split(":");return{host:e,port:Ts(t)}}}(t),c=null===a?"":":".concat(a);i.config.emulator={url:"".concat(r,"//").concat(o).concat(c,"/")},i.settings.appVerificationDisabledForTesting=!0,i.emulatorConfig=Object.freeze({host:o,port:a,protocol:r.replace(":",""),options:Object.freeze({disableWarnings:s})}),s||function(){functione(){conste=document.createElement("p"),t=e.style;e.innerText="Runninginemulatormode.Donotusewithproductioncredentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1emsolid#",t.color="#b",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeofconsole&&console.info;"undefined"!=typeofwindow&&"undefined"!=typeofdocument&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}functionIs(e){constt=e.indexOf(":");returnt{if(t.code==="auth/".concat("missing-recaptcha-token")){constt=await_s(e,n,"signInWithPassword");returnCs(e,t)}returnPromise.reject(t)}));case"emailLink":returnasyncfunction(e,t){returnMi(e,"POST","/v1/accounts:signInWithEmailLink",Di(e,t))}(e,{email:this._email,oobCode:this._password});default:gi(e,"internal-error")}}async_linkToIdToken(e,t){switch(this.signInMethod){case"password":returnks(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":returnasyncfunction(e,t){returnMi(e,"POST","/v1/accounts:signInWithEmailLink",Di(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:gi(e,"internal-error")}}_getReauthenticationResolver(e){returnthis._getIdTokenResponse(e)}}asyncfunctionDs(e,t){returnMi(e,"POST","/v1/accounts:signInWithIdp",Di(e,t))}classOsextendsSs{constructor(){super(...arguments),this.pendingToken=null}static_fromParams(e){constt=newOs(e.providerId,e.signInMethod);returne.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):gi("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}staticfromJSON(e){constt="string"==typeofe?JSON.parse(e):e,{providerId:n,signInMethod:i}=t,s=$n(t,["providerId","signInMethod"]);if(!n||!i)returnnull;constr=newOs(n,i);returnr.idToken=s.idToken||void0,r.accessToken=s.accessToken||void0,r.secret=s.secret,r.nonce=s.nonce,r.pendingToken=s.pendingToken||null,r}_getIdTokenResponse(e){returnDs(e,this.buildRequest())}_linkToIdToken(e,t){constn=this.buildRequest();returnn.idToken=t,Ds(e,n)}_getReauthenticationResolver(e){constt=this.buildRequest();returnt.autoCreate=!1,Ds(e,t)}buildRequest(){conste={requestUri:"httplocalhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{constt={};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=Dt(t)}returne}}constRs={USER_NOT_FOUND:"user-not-found"};classMsextendsSs{constructor(e){super("phone","phone"),this.params=e}static_fromVerification(e,t){returnnewMs({verificationId:e,verificationCode:t})}static_fromTokenResponse(e,t){returnnewMs({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){returnasyncfunction(e,t){returnMi(e,"POST","/v1/accounts:signInWithPhoneNumber",Di(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){returnasyncfunction(e,t){constn=awaitMi(e,"POST","/v1/accounts:signInWithPhoneNumber",Di(e,t));if(n.temporaryProof)throwVi(e,"account-exists-with-different-credential",n);returnn}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){returnasyncfunction(e,t){returnMi(e,"POST","/v1/accounts:signInWithPhoneNumber",Di(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),Rs)}(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:i}=this.params;returne&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:i}}toJSON(){conste={providerId:this.providerId};returnthis.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}staticfromJSON(e){"string"==typeofe&&(e=JSON.parse(e));const{verificationId:t,verificationCode:n,phoneNumber:i,temporaryProof:s}=e;returnn||t||i||s?newMs({verificationId:t,verificationCode:n,phoneNumber:i,temporaryProof:s}):null}}classLs{constructor(e){vart,n,i,s,r,o;consta=Ot(Rt(e)),c=null!==(t=a.apiKey)&&void0!==t?t:null,l=null!==(n=a.oobCode)&&void0!==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:returnnull}}(null!==(i=a.mode)&&void0!==i?i:null);bi(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(s=a.continueUrl)&&void0!==s?s:null,this.langueCode=null!==(r=a.langueCode)&&void0!==r?r:null,this.tenantId=null!==(o=a.tenantId)&&void0!==o?o:null}staticparseLink(e){constt=function(e){constt=Ot(Rt(e)).link,n=t?Ot(Rt(t)).deep_link_id:null,i=Ot(Rt(e)).deep_link_id;return(i?Ot(Rt(i)).link:null)||i||n||t||e}(e);try{returnnewLs(t)}catch(ha){returnnull}}}classFs{constructor(){this.providerId=Fs.PROVIDER_ID}staticcredential(e,t){returnPs._fromEmailAndPassword(e,t)}staticcredentialWithLink(e,t){constn=Ls.parseLink(t);returnbi(n,"argument-error"),Ps._fromEmailAndCode(e,n.code,n.tenantId)}}Fs.PROVIDER_ID="password",Fs.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Fs.EMAIL_LINK_SIGN_IN_METHOD="emailLink";classVs{constructor(e){this.providerId=e,this.defaultLangueCode=null,this.customParameters={}}setDefaultLangue(e){this.defaultLangueCode=e}setCustomParameters(e){returnthis.customParameters=e,this}getCustomParameters(){returnthis.customParameters}}classUsextendsVs{constructor(){super(...arguments),this.scopes=[]}addScope(e){returnthis.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}classjsextendsUs{staticcredentialFromJSON(e){constt="string"==typeofe?JSON.parse(e):e;returnbi("providerId"int&&"signInMethod"int,"argument-error"),Os._fromParams(t)}credential(e){returnthis._credential(Object.assign(Object.assign({},e),{nonce:e.rawNonce}))}_credential(e){returnbi(e.idToken||e.accessToken,"argument-error"),Os._fromParams(Object.assign(Object.assign({},e),{providerId:this.providerId,signInMethod:this.providerId}))}staticcredentialFromResult(e){returnjs.oauthCredentialFromTgedObject(e)}staticcredentialFromError(e){returnjs.oauthCredentialFromTgedObject(e.customData||{})}staticoauthCredentialFromTgedObject({_tokenResponse:e}){if(!e)returnnull;const{oauthIdToken:t,oauthAccessToken:n,oauthTokenSecret:i,pendingToken:s,nonce:r,providerId:o}=e;if(!(n||i||t||s))returnnull;if(!o)returnnull;try{returnnewjs(o)._credential({idToken:t,accessToken:n,nonce:r,pendingToken:s})}catch(KS){returnnull}}}classBsextendsUs{constructor(){super("facebook.com")}staticcredential(e){returnOs._fromParams({providerId:Bs.PROVIDER_ID,signInMethod:Bs.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}staticcredentialFromResult(e){returnBs.credentialFromTgedObject(e)}staticcredentialFromError(e){returnBs.credentialFromTgedObject(e.customData||{})}staticcredentialFromTgedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"ine))returnnull;if(!e.oauthAccessToken)returnnull;try{returnBs.credential(e.oauthAccessToken)}catch(ha){returnnull}}}Bs.FACEBOOK_SIGN_IN_METHOD="facebook.com",Bs.PROVIDER_ID="facebook.com";classqsextendsUs{constructor(){super("google.com"),this.addScope("profile")}staticcredential(e,t){returnOs._fromParams({providerId:qs.PROVIDER_ID,signInMethod:qs.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}staticcredentialFromResult(e){returnqs.credentialFromTgedObject(e)}staticcredentialFromError(e){returnqs.credentialFromTgedObject(e.customData||{})}staticcredentialFromTgedObject({_tokenResponse:e}){if(!e)returnnull;const{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)returnnull;try{returnqs.credential(t,n)}catch(ha){returnnull}}}qs.GOOGLE_SIGN_IN_METHOD="google.com",qs.PROVIDER_ID="google.com";classzsextendsUs{constructor(){super("github.com")}staticcredential(e){returnOs._fromParams({providerId:zs.PROVIDER_ID,signInMethod:zs.GITHUB_SIGN_IN_METHOD,accessToken:e})}staticcredentialFromResult(e){returnzs.credentialFromTgedObject(e)}staticcredentialFromError(e){returnzs.credentialFromTgedObject(e.customData||{})}staticcredentialFromTgedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"ine))returnnull;if(!e.oauthAccessToken)returnnull;try{returnzs.credential(e.oauthAccessToken)}catch(ha){returnnull}}}zs.GITHUB_SIGN_IN_METHOD="github.com",zs.PROVIDER_ID="github.com";classGsextendsSs{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){returnDs(e,this.buildRequest())}_linkToIdToken(e,t){constn=this.buildRequest();returnn.idToken=t,Ds(e,n)}_getReauthenticationResolver(e){constt=this.buildRequest();returnt.autoCreate=!1,Ds(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}staticfromJSON(e){constt="string"==typeofe?JSON.parse(e):e,{providerId:n,signInMethod:i,pendingToken:s}=t;returnn&&i&&s&&n===i?newGs(n,s):null}static_create(e,t){returnnewGs(e,t)}buildRequest(){return{requestUri:"httplocalhost",returnSecureToken:!0,pendingToken:this.pendingToken}}}classKsextendsVs{constructor(e){bi(e.startsWith("saml."),"argument-error"),super(e)}staticcredentialFromResult(e){returnKs.samlCredentialFromTgedObject(e)}staticcredentialFromError(e){returnKs.samlCredentialFromTgedObject(e.customData||{})}staticcredentialFromJSON(e){constt=Gs.fromJSON(e);returnbi(t,"argument-error"),t}staticsamlCredentialFromTgedObject({_tokenResponse:e}){if(!e)returnnull;const{pendingToken:t,providerId:n}=e;if(!t||!n)returnnull;try{returnGs._create(n,t)}catch(KS){returnnull}}}classHsextendsUs{constructor(){super("twitter.com")}staticcredential(e,t){returnOs._fromParams({providerId:Hs.PROVIDER_ID,signInMethod:Hs.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}staticcredentialFromResult(e){returnHs.credentialFromTgedObject(e)}staticcredentialFromError(e){returnHs.credentialFromTgedObject(e.customData||{})}staticcredentialFromTgedObject({_tokenResponse:e}){if(!e)returnnull;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)returnnull;try{returnHs.credential(t,n)}catch(ha){returnnull}}}asyncfunctionWs(e,t){returnMi(e,"POST","/v1/accounts:signUp",Di(e,t))}Hs.TWITTER_SIGN_IN_METHOD="twitter.com",Hs.PROVIDER_ID="twitter.com";classQs{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}staticasync_fromIdTokenResponse(e,t,n,i=!1){consts=awaitQi._fromIdTokenResponse(e,n,i),r=Ys(n);returnnewQs({user:s,providerId:r,_tokenResponse:n,operationType:t})}staticasync_forOperation(e,t,n){awaite._updateTokensIfNecessary(n,!0);consti=Ys(n);returnnewQs({user:e,providerId:i,_tokenResponse:n,operationType:t})}}functionYs(e){returne.providerId?e.providerId:"phoneNumber"ine?"phone":null}classJsextendskt{constructor(e,t,n,i){vars;super(t.code,t.messe),this.operationType=n,this.user=i,Object.setPrototypeOf(this,Js.prototype),this.customData={appName:e.name,tenantId:null!==(s=e.tenantId)&&void0!==s?s:void0,_serverResponse:t.customData._serverResponse,operationType:n}}static_fromErrorAndOperation(e,t,n,i){returnnewJs(e,t,n,i)}}functionXs(e,t,n,i){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch((n=>{if(n.code==="auth/".concat("multi-factor-auth-required"))throwJs._fromErrorAndOperation(e,n,t,i);thrown}))}functionZs(e){returnnewSet(e.map((({providerId:e})=>e)).filter((e=>!!e)))}asyncfunction$s(e,t){constn=Vt(e);awaittr(!0,n,t);const{providerUserInfo:i}=awaitasyncfunction(e,t){returnOi(e,"POST","/v1/accounts:update",t)}(n.auth,{idToken:awaitn.getIdToken(),deleteProvider:[t]}),s=Zs(i||[]);returnn.providerData=n.providerData.filter((e=>s.has(e.providerId))),s.has("phone")||(n.phoneNumber=null),awaitn.auth._persistUserIfCurrent(n),n}asyncfunctioner(e,t,n=!1){consti=awaitqi(e,t._linkToIdToken(e.auth,awaite.getIdToken()),n);returnQs._forOperation(e,"link",i)}asyncfunctiontr(e,t,n){awaitKi(t);consti=!1===e?"provider-already-linked":"no-such-provider";bi(Zs(t.providerData).has(n)===e,t.auth,i)}asyncfunctionnr(e,t,n=!1){const{auth:i}=e,s="reauthenticate";try{constr=awaitqi(e,Xs(i,s,t,e),n);bi(r.idToken,i,"internal-error");consto=Bi(r.idToken);bi(o,i,"internal-error");const{sub:a}=o;returnbi(e.uid===a,i,"user-mismatch"),Qs._forOperation(e,s,r)}catch(KS){throw(null==KS?void0:KS.code)==="auth/".concat("user-not-found")&&gi(i,"user-mismatch"),KS}}asyncfunctionir(e,t,n=!1){consti="signIn",s=awaitXs(e,i,t),r=awaitQs._fromIdTokenResponse(e,i,s);returnn||awaite._updateCurrentUser(r.user),r}asyncfunctionsr(e,t){returnir(ms(e),t)}asyncfunctionrr(e,t){constn=Vt(e);returnawaittr(!1,n,t.providerId),er(n,t)}asyncfunctionor(e,t){returnnr(Vt(e),t)}asyncfunctionar(e,t){constn=ms(e),i=awaitasyncfunction(e,t){returnMi(e,"POST","/v1/accounts:signInWithCustomToken",Di(e,t))}(n,{token:t,returnSecureToken:!0}),s=awaitQs._fromIdTokenResponse(n,"signIn",i);returnawaitn._updateCurrentUser(s.user),s}classcr{constructor(e,t){this.factorId=e,this.uid=t.mfaEnrollmentId,this.enrollmentTime=newDate(t.enrolledAt).toUTCString(),this.displayName=t.displayName}static_fromServerResponse(e,t){return"phoneInfo"int?lr._fromServerResponse(e,t):"totpInfo"int?ur._fromServerResponse(e,t):gi(e,"internal-error")}}classlrextendscr{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static_fromServerResponse(e,t){returnnewlr(t)}}classurextendscr{constructor(e){super("totp",e)}static_fromServerResponse(e,t){returnnewur(t)}}functionhr(e,t,n){vari;bi((null===(i=n.url)||void0===i?void0:i.length)>0,e,"invalid-continue-uri"),bi(void0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,e,"invalid-dynamic-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(bi(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(bi(n.android.packeName.length>0,e,"missing-android-pkg-name"),t.androidInstallApp=n.android.installApp,t.androidMinimumVersionCode=n.android.minimumVersion,t.androidPackeName=n.android.packeName)}asyncfunctiondr(e){constt=ms(e);t._getPasswordPolicyInternal()&&awaitt._updatePasswordPolicy()}asyncfunctionpr(e,t){awaitasyncfunction(e,t){returnOi(e,"POST","/v1/accounts:update",Di(e,t))}(Vt(e),{oobCode:t})}asyncfunctionfr(e,t){constn=Vt(e),i=awaitEs(n,{oobCode:t}),s=i.requestType;switch(bi(s,n,"internal-error"),s){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":bi(i.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":bi(i.mfaInfo,n,"internal-error");default:bi(i.email,n,"internal-error")}letr=null;returni.mfaInfo&&(r=cr._fromServerResponse(ms(n),i.mfaInfo)),{data:{email:("VERIFY_AND_CHANGE_EMAIL"===i.requestType?i.newEmail:i.email)||null,previousEmail:("VERIFY_AND_CHANGE_EMAIL"===i.requestType?i.email:i.newEmail)||null,multiFactorInfo:r},operation:s}}asyncfunctionmr(e,t){constn={identifier:t,continueUri:Ei()?Si():"httplocalhost"},{signinMethods:i}=awaitasyncfunction(e,t){returnOi(e,"POST","/v1/accounts:createAuthUri",Di(e,t))}(Vt(e),n);returni||[]}asyncfunctiongr(e,t){constn=Vt(e),i={requestType:"VERIFY_EMAIL",idToken:awaite.getIdToken()};t&&hr(n.auth,i,t);const{email:s}=awaitasyncfunction(e,t){returnAs(e,t)}(n.auth,i);s!==e.email&&awaite.reload()}asyncfunctionyr(e,t,n){consti=Vt(e),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:awaite.getIdToken(),newEmail:t};n&&hr(i.auth,s,n);const{email:r}=awaitasyncfunction(e,t){returnAs(e,t)}(i.auth,s);r!==e.email&&awaite.reload()}asyncfunctionvr(e,{displayName:t,photoURL:n}){if(void0===t&&void0===n)return;consti=Vt(e),s={idToken:awaiti.getIdToken(),displayName:t,photoUrl:n,returnSecureToken:!0},r=awaitqi(i,asyncfunction(e,t){returnOi(e,"POST","/v1/accounts:update",t)}(i.auth,s));i.displayName=r.displayName||null,i.photoURL=r.photoUrl||null;consto=i.providerData.find((({providerId:e})=>"password"===e));o&&(o.displayName=i.displayName,o.photoURL=i.photoURL),awaiti._updateTokensIfNecessary(r)}asyncfunctionwr(e,t,n){const{auth:i}=e,s={idToken:awaite.getIdToken(),returnSecureToken:!0};t&&(s.email=t),n&&(s.password=n);constr=awaitqi(e,ks(i,s));awaite._updateTokensIfNecessary(r,!0)}class_r{constructor(e,t,n={}){this.isNewUser=e,this.providerId=t,this.profile=n}}classbrextends_r{constructor(e,t,n,i){super(e,t,n),this.username=i}}classIrextends_r{constructor(e,t){super(e,"facebook.com",t)}}classTrextendsbr{constructor(e,t){super(e,"github.com",t,"string"==typeof(null==t?void0:t.login)?null==t?void0:t.login:null)}}classSrextends_r{constructor(e,t){super(e,"google.com",t)}}classErextendsbr{constructor(e,t,n){super(e,"twitter.com",t,n)}}functionkr(e){const{user:t,_tokenResponse:n}=e;returnt.isAnonymous&&!n?{providerId:null,isNewUser:!1,profile:null}:function(e){vart,n;if(!e)returnnull;const{providerId:i}=e,s=e.rawUserInfo?JSON.parse(e.rawUserInfo):{},r=e.isNewUser||"identitytoolkit#SignupNewUserResponse"===e.kind;if(!i&&(null==e?void0:e.idToken)){consti=null===(n=null===(t=Bi(e.idToken))||void0===t?void0:t.firebase)||void0===n?void0:n.sign_in_provider;if(i)returnnew_r(r,"anonymous"!==i&&"custom"!==i?i:null)}if(!i)returnnull;switch(i){case"facebook.com":returnnewIr(r,s);case"github.com":returnnewTr(r,s);case"google.com":returnnewSr(r,s);case"twitter.com":returnnewEr(r,s,e.screenName||null);case"custom":case"anonymous":returnnew_r(r,null);default:returnnew_r(r,i,s)}}(n)}classCr{constructor(e,t,n){this.type=e,this.credential=t,this.user=n}static_fromIdtoken(e,t){returnnewCr("enroll",e,t)}static_fromMfaPendingCredential(e){returnnewCr("signin",e)}toJSON(){return{multiFactorSession:{["enroll"===this.type?"idToken":"pendingCredential"]:this.credential}}}staticfromJSON(e){vart,n;if(null==e?void0:e.multiFactorSession){if(null===(t=e.multiFactorSession)||void0===t?void0:t.pendingCredential)returnCr._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(null===(n=e.multiFactorSession)||void0===n?void0:n.idToken)returnCr._fromIdtoken(e.multiFactorSession.idToken)}returnnull}}classAr{constructor(e,t,n){this.session=e,this.hints=t,this.signInResolver=n}static_fromError(e,t){constn=ms(e),i=t.customData._serverResponse,s=(i.mfaInfo||[]).map((e=>cr._fromServerResponse(n,e)));bi(i.mfaPendingCredential,n,"internal-error");constr=Cr._fromMfaPendingCredential(i.mfaPendingCredential);returnnewAr(r,s,(asynce=>{consts=awaite._process(n,r);deletei.mfaInfo,deletei.mfaPendingCredential;consto=Object.assign(Object.assign({},i),{idToken:s.idToken,refreshToken:s.refreshToken});switch(t.operationType){case"signIn":conste=awaitQs._fromIdTokenResponse(n,t.operationType,o);returnawaitn._updateCurrentUser(e.user),e;case"reauthenticate":returnbi(t.user,n,"internal-error"),Qs._forOperation(t.user,t.operationType,o);default:gi(n,"internal-error")}}))}asyncresolveSignIn(e){constt=e;returnthis.signInResolver(t)}}classNr{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload((t=>{t.mfaInfo&&(this.enrolledFactors=t.mfaInfo.map((t=>cr._fromServerResponse(e.auth,t))))}))}static_fromUser(e){returnnewNr(e)}asyncgetSession(){returnCr._fromIdtoken(awaitthis.user.getIdToken(),this.user)}asyncenroll(e,t){constn=e,i=awaitthis.getSession(),s=awaitqi(this.user,n._process(this.user.auth,i,t));returnawaitthis.user._updateTokensIfNecessary(s),this.user.reload()}asyncunenroll(e){constt="string"==typeofe?e:e.uid,n=awaitthis.user.getIdToken();try{conste=awaitqi(this.user,(i=this.user.auth,s={idToken:n,mfaEnrollmentId:t},Oi(i,"POST","/v2/accounts/mfaEnrollment:withdraw",Di(i,s))));this.enrolledFactors=this.enrolledFactors.filter((({uid:e})=>e!==t)),awaitthis.user._updateTokensIfNecessary(e),awaitthis.user.reload()}catch(KS){throwKS}vari,s}}constxr=newWeakMap;constPr="__sak";classDr{constructor(e,t){this.storeRetriever=e,this.type=t}_isailable(){try{returnthis.store?(this.store.setItem(Pr,"1"),this.store.removeItem(Pr),Promise.resolve(!0)):Promise.resolve(!1)}catch(ha){returnPromise.resolve(!1)}}_set(e,t){returnthis.store.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){constt=this.store.getItem(e);returnPromise.resolve(t?JSON.parse(t):null)}_remove(e){returnthis.store.removeItem(e),Promise.resolve()}getstore(){returnthis.storeRetriever()}}classOrextendsDr{constructor(){super((()=>window.localStore),"LOCAL"),this.boundEventHandler=(e,t)=>this.onStoreEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStoreNotSynced=function(){conste=_t();returnis(e)||ls(e)}()&&function(){try{return!(!window||window===window.top)}catch(KS){return!1}}(),this.fallbackToPolling=us(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(consttofObject.keys(this.listeners)){constn=this.store.getItem(t),i=this.localCache[t];n!==i&&e(t,i,n)}}onStoreEvent(e,t=!1){if(!e.key)returnvoidthis.forAllChangedKeys(((e,t,n)=>{this.notifyListeners(e,n)}));constn=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStoreNotSynced){consti=this.store.getItem(n);if(e.newValue!==i)null!==e.newValue?this.store.setItem(n,e.newValue):this.store.removeItem(n);elseif(this.localCache[n]===e.newValue&&!t)return}consti=()=>{conste=this.store.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},s=this.store.getItem(n);St()&&10===document.documentMode&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,10):i()}notifyListeners(e,t){this.localCache[e]=t;constn=this.listeners[e];if(n)for(constiofArray.from(n))i(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((e,t,n)=>{this.onStoreEvent(newStoreEvent("store",{key:e,oldValue:t,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("store",this.boundEventHandler)}detachListener(){window.removeEventListener("store",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=newSet,this.localCache[e]=this.store.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&deletethis.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async_set(e,t){awaitsuper._set(e,t),this.localCache[e]=JSON.stringify(t)}async_get(e){constt=awaitsuper._get(e);returnthis.localCache[e]=JSON.stringify(t),t}async_remove(e){awaitsuper._remove(e),deletethis.localCache[e]}}Or.type="LOCAL";constRr=Or;classMrextendsDr{constructor(){super((()=>window.sessionStore),"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Mr.type="SESSION";constLr=Mr;classFr{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static_getInstance(e){constt=this.receivers.find((t=>t.isListeningto(e)));if(t)returnt;constn=newFr(e);returnthis.receivers.push(n),n}isListeningto(e){returnthis.eventTarget===e}asynchandleEvent(e){constt=e,{eventId:n,eventType:i,data:s}=t.data,r=this.handlersMap[i];if(!(null==r?void0:r.size))return;t.ports[0].postMesse({status:"ack",eventId:n,eventType:i});consto=Array.from(r).map((asynce=>e(t.origin,s))),a=awaitfunction(e){returnPromise.all(e.map((asynce=>{try{return{fulfilled:!0,value:awaite}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);t.ports[0].postMesse({status:"done",eventId:n,eventType:i,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("messe",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=newSet),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||deletethis.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("messe",this.boundEventHandler)}}functionVr(e="",t=10){letn="";for(leti=0;i{constc=Vr("",20);i.port1.start();constl=setTimeout((()=>{a(newError("unsupported_event"))}),n);r={messeChannel:i,onMesse(e){constt=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(l),s=setTimeout((()=>{a(newError("timeout"))}),3e3);break;case"done":clearTimeout(s),o(t.data.response);break;default:clearTimeout(l),clearTimeout(s),a(newError("invalid_response"))}}},this.handlers.add(r),i.port1.addEventListener("messe",r.onMesse),this.target.postMesse({eventType:e,eventId:c,data:t},[i.port2])})).finally((()=>{r&&this.removeMesseHandler(r)}))}}functionjr(){returnwindow}functionBr(){returnvoid0!==jr().WorkerGlobalScope&&"function"==typeofjr().importScripts}constqr="firebaseLocalStoreDb",zr="firebaseLocalStore",Gr="fbase_key";classKr{constructor(e){this.request=e}toPromise(){returnnewPromise(((e,t)=>{this.request.addEventListener("success",(()=>{e(this.request.result)})),this.request.addEventListener("error",(()=>{t(this.request.error)}))}))}}functionHr(e,t){returne.transaction([zr],t?"readwrite":"readonly").objectStore(zr)}functionWr(){conste=indexedDB.open(qr,1);returnnewPromise(((t,n)=>{e.addEventListener("error",(()=>{n(e.error)})),e.addEventListener("upgradeneeded",(()=>{constt=e.result;try{t.createObjectStore(zr,{keyPath:Gr})}catch(KS){n(KS)}})),e.addEventListener("success",(async()=>{constn=e.result;n.objectStoreNames.contains(zr)?t(n):(n.close(),awaitfunction(){conste=indexedDB.deleteDatabase(qr);returnnewKr(e).toPromise()}(),t(awaitWr()))}))}))}asyncfunctionQr(e,t,n){consti=Hr(e,!0).put({[Gr]:t,value:n});returnnewKr(i).toPromise()}functionYr(e,t){constn=Hr(e,!0).delete(t);returnnewKr(n).toPromise()}classJr{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessing().then((()=>{}),(()=>{}))}async_openDb(){returnthis.db||(this.db=awaitWr()),this.db}async_withRetries(e){lett=0;for(;;)try{constt=awaitthis._openDb();returnawaite(t)}catch(KS){if(t++>3)throwKS;this.db&&(this.db.close(),this.db=void0)}}asyncinitializeServiceWorkerMessing(){returnBr()?this.initializeReceiver():this.initializeSender()}asyncinitializeReceiver(){this.receiver=Fr._getInstance(Br()?self:null),this.receiver._subscribe("keyChanged",(async(e,t)=>({keyProcessed:(awaitthis._poll()).includes(t.key)}))),this.receiver._subscribe("ping",(async(e,t)=>["keyChanged"]))}asyncinitializeSender(){vare,t;if(this.activeServiceWorker=awaitasyncfunction(){if(!(null===nigator||void0===nigator?void0:nigator.serviceWorker))returnnull;try{return(awaitnigator.serviceWorker.ready).active}catch(e){returnnull}}(),!this.activeServiceWorker)return;this.sender=newUr(this.activeServiceWorker);constn=awaitthis.sender._send("ping",{},800);n&&(null===(e=n[0])||void0===e?void0:e.fulfilled)&&(null===(t=n[0])||void0===t?void0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverailable=!0)}asyncnotifyServiceWorker(e){vart;if(this.sender&&this.activeServiceWorker&&((null===(t=null===nigator||void0===nigator?void0:nigator.serviceWorker)||void0===t?void0:t.controller)||null)===this.activeServiceWorker)try{awaitthis.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverailable?800:50)}catch(t){}}async_isailable(){try{if(!indexedDB)return!1;conste=awaitWr();returnawaitQr(e,Pr,"1"),awaitYr(e,Pr),!0}catch(ha){}return!1}async_withPendingWrite(e){this.pendingWrites++;try{awaite()}finally{this.pendingWrites--}}async_set(e,t){returnthis._withPendingWrite((async()=>(awaitthis._withRetries((n=>Qr(n,e,t))),this.localCache[e]=t,this.notifyServiceWorker(e))))}async_get(e){constt=awaitthis._withRetries((t=>asyncfunction(e,t){constn=Hr(e,!1).get(t),i=awaitnewKr(n).toPromise();returnvoid0===i?null:i.value}(t,e)));returnthis.localCache[e]=t,t}async_remove(e){returnthis._withPendingWrite((async()=>(awaitthis._withRetries((t=>Yr(t,e))),deletethis.localCache[e],this.notifyServiceWorker(e))))}async_poll(){conste=awaitthis._withRetries((e=>{constt=Hr(e,!1).getAll();returnnewKr(t).toPromise()}));if(!e)return[];if(0!==this.pendingWrites)return[];constt=[],n=newSet;for(const{fbase_key:i,value:s}ofe)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),t.push(i));for(constiofObject.keys(this.localCache))this.localCache[i]&&!n.has(i)&&(this.notifyListeners(i,null),t.push(i));returnt}notifyListeners(e,t){this.localCache[e]=t;constn=this.listeners[e];if(n)for(constiofArray.from(n))i(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]=newSet,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&deletethis.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Jr.type="LOCAL";constXr=Jr;constZr=1e12;class$r{constructor(e){this.auth=e,this.counter=Zr,this._widgets=newMap}render(e,t){constn=this.counter;returnthis._widgets.set(n,neweo(e,this.auth.name,t||{})),this.counter++,n}reset(e){vart;constn=e||Zr;null===(t=this._widgets.get(n))||void0===t||t.delete(),this._widgets.delete(n)}getResponse(e){vart;constn=e||Zr;return(null===(t=this._widgets.get(n))||void0===t?void0:t.getResponse())||""}asyncexecute(e){vart;constn=e||Zr;returnnull===(t=this._widgets.get(n))||void0===t||t.execute(),""}}classeo{constructor(e,t,n){this.params=n,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};consti="string"==typeofe?document.getElementById(e):e;bi(i,"argument-error",{appName:t}),this.container=i,this.isVisible="invisible"!==this.params.size,this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){returnthis.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),this.timerId||(this.timerId=window.setTimeout((()=>{this.responseToken=function(e){constt=[],n="90abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(leti=0;i{if(this.timerId=null,this.responseToken=null,t)try{t()}catch(KS){}this.isVisible&&this.execute()}),6e4)}),500))}checkIfDeleted(){if(this.deleted)thrownewError("reCAPTCHAmockwasalreadydeleted!")}}constto=vs("rcb"),no=newCi(3e4,6e4);classio{constructor(){vare;this.hostLangue="",this.counter=0,this.librarySeparatelyLoaded=!!(null===(e=jr().grecaptcha)||void0===e?void0:e.render)}load(e,t=""){returnbi(function(e){returne.length{consts=jr().setTimeout((()=>{i(yi(e,"network-request-failed"))}),no.get());jr()[to]=()=>{jr().clearTimeout(s),deletejr()[to];constr=jr().grecaptcha;if(!r||!ai(r))returnvoidi(yi(e,"internal-error"));consto=r.render;r.render=(e,t)=>{constn=o(e,t);returnthis.counter++,n},this.hostLangue=t,n(r)};ys("".concat("/recaptcha/api.js?","?").concat(Dt({onload:to,render:"explicit",hl:t}))).catch((()=>{clearTimeout(s),i(yi(e,"internal-error"))}))}))}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){vart;return!!(null===(t=jr().grecaptcha)||void0===t?void0:t.render)&&(e===this.hostLangue||this.counter>0||this.librarySeparatelyLoaded)}}classso{asyncload(e){returnnew$r(e)}clearedOneInstance(){}}constro="recaptcha",oo={theme:"light",type:"ime"};letao=class{constructor(e,t,n=Object.assign({},oo)){this.parameters=n,this.type=ro,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=newSet,this.renderPromise=null,this.recaptcha=null,this.auth=ms(e),this.isInvisible="invisible"===this.parameters.size,bi("undefined"!=typeofdocument,this.auth,"operation-not-supported-in-this-environment");consti="string"==typeoft?document.getElementById(t):t;bi(i,this.auth,"argument-error"),this.container=i,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?newso:newio,this.validateStartingState()}asyncverify(){this.assertNotDestroyed();conste=awaitthis.render(),t=this.getAssertedRecaptcha(),n=t.getResponse(e);returnn||newPromise((n=>{consti=e=>{e&&(this.tokenChangeListeners.delete(i),n(e))};this.tokenChangeListeners.add(i),this.isInvisible&&t.execute(e)}))}render(){try{this.assertNotDestroyed()}catch(KS){returnPromise.reject(KS)}returnthis.renderPromise||(this.renderPromise=this.makeRenderPromise().catch((e=>{throwthis.renderPromise=null,e}))),this.renderPromise}_reset(){this.assertNotDestroyed(),null!==this.widgetId&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach((e=>{this.container.removeChild(e)}))}validateStartingState(){bi(!this.parameters.sitekey,this.auth,"argument-error"),bi(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),bi("undefined"!=typeofdocument,this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){returnt=>{if(this.tokenChangeListeners.forEach((e=>e(t))),"function"==typeofe)e(t);elseif("string"==typeofe){constn=jr()[e];"function"==typeofn&&n(t)}}}assertNotDestroyed(){bi(!this.destroyed,this.auth,"internal-error")}asyncmakeRenderPromise(){if(awaitthis.init(),!this.widgetId){lete=this.container;if(!this.isInvisible){constt=document.createElement("div");e.appendChild(t),e=t}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}returnthis.widgetId}asyncinit(){bi(Ei()&&!Br(),this.auth,"internal-error"),awaitfunction(){lete=null;returnnewPromise((t=>{"complete"!==document.readyState?(e=()=>t(),window.addEventListener("load",e)):t()})).catch((t=>{throwe&&window.removeEventListener("load",e),t}))}(),this.recaptcha=awaitthis._recaptchaLoader.load(this.auth,this.auth.langueCode||void0);conste=awaitasyncfunction(e){return(awaitOi(e,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}(this.auth);bi(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){returnbi(this.recaptcha,this.auth,"internal-error"),this.recaptcha}};classco{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){constt=Ms._fromVerification(this.verificationId,e);returnthis.onConfirmation(t)}}asyncfunctionlo(e,t,n){vari;consts=awaitn.verify();try{letr;if(bi("string"==typeofs,e,"argument-error"),bi(n.type===ro,e,"argument-error"),r="string"==typeoft?{phoneNumber:t}:t,"session"inr){constt=r.session;if("phoneNumber"inr){bi("enroll"===t.type,e,"internal-error");constn=awaitfunction(e,t){returnOi(e,"POST","/v2/accounts/mfaEnrollment:start",Di(e,t))}(e,{idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,recaptchaToken:s}});returnn.phoneSessionInfo.sessionInfo}{bi("signin"===t.type,e,"internal-error");constn=(null===(i=r.multiFactorHint)||void0===i?void0:i.uid)||r.multiFactorUid;bi(n,e,"missing-multi-factor-info");consto=awaitfunction(e,t){returnOi(e,"POST","/v2/accounts/mfaSignIn:start",Di(e,t))}(e,{mfaPendingCredential:t.credential,mfaEnrollmentId:n,phoneSignInInfo:{recaptchaToken:s}});returno.phoneResponseInfo.sessionInfo}}{const{sessionInfo:t}=awaitasyncfunction(e,t){returnOi(e,"POST","/v1/accounts:sendVerificationCode",Di(e,t))}(e,{phoneNumber:r.phoneNumber,recaptchaToken:s});returnt}}finally{n._reset()}}letuo=classe{constructor(t){this.providerId=e.PROVIDER_ID,this.auth=ms(t)}verifyPhoneNumber(e,t){returnlo(this.auth,e,Vt(t))}staticcredential(e,t){returnMs._fromVerification(e,t)}staticcredentialFromResult(t){constn=t;returne.credentialFromTgedObject(n)}staticcredentialFromError(t){returne.credentialFromTgedObject(t.customData||{})}staticcredentialFromTgedObject({_tokenResponse:e}){if(!e)returnnull;const{phoneNumber:t,temporaryProof:n}=e;returnt&&n?Ms._fromTokenResponse(t,n):null}};functionho(e,t){returnt?Ji(t):(bi(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}uo.PROVIDER_ID="phone",uo.PHONE_SIGN_IN_METHOD="phone";classpoextendsSs{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){returnDs(e,this._buildIdpRequest())}_linkToIdToken(e,t){returnDs(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){returnDs(e,this._buildIdpRequest())}_buildIdpRequest(e){constt={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};returne&&(t.idToken=e),t}}functionfo(e){returnir(e.auth,newpo(e),e.bypassAuthState)}functionmo(e){const{auth:t,user:n}=e;returnbi(n,t,"internal-error"),nr(n,newpo(e),e.bypassAuthState)}asyncfunctiongo(e){const{auth:t,user:n}=e;returnbi(n,t,"internal-error"),er(n,newpo(e),e.bypassAuthState)}classyo{constructor(e,t,n,i,s=!1){this.auth=e,this.resolver=n,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManer=null,this.filter=Array.isArray(t)?t:[t]}execute(){returnnewPromise((async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManer=awaitthis.resolver._initialize(this.auth),awaitthis.onExecution(),this.eventManer.registerConsumer(this)}catch(KS){this.reject(KS)}}))}asynconAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:i,tenantId:s,error:r,type:o}=e;if(r)returnvoidthis.reject(r);consta={auth:this.auth,requestUri:t,sessionId:n,tenantId:s||void0,postBody:i||void0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(awaitthis.getIdpTask(o)(a))}catch(KS){this.reject(KS)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":returnfo;case"linkViaPopup":case"linkViaRedirect":returngo;case"reauthViaPopup":case"reauthViaRedirect":returnmo;default:gi(this.auth,"internal-error")}}resolve(e){Ti(this.pendingPromise,"Pendingpromisewasneverset"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Ti(this.pendingPromise,"Pendingpromisewasneverset"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManer&&this.eventManer.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}constvo=newCi(2e3,1e4);classwoextendsyo{constructor(e,t,n,i,s){super(e,t,i,s),this.provider=n,this.authWindow=null,this.pollId=null,wo.currentPopupAction&&wo.currentPopupAction.cancel(),wo.currentPopupAction=this}asyncexecuteNotNull(){conste=awaitthis.execute();returnbi(e,this.auth,"internal-error"),e}asynconExecution(){Ti(1===this.filter.length,"Popupoperationsonlyhandleoneevent");conste=Vr();this.authWindow=awaitthis.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch((e=>{this.reject(e)})),this.resolver._isIframeWebStoreSupported(this.auth,(e=>{e||this.reject(yi(this.auth,"web-store-unsupported"))})),this.pollUserCancellation()}geteventId(){vare;return(null===(e=this.authWindow)||void0===e?void0:e.associatedEvent)||null}cancel(){this.reject(yi(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,wo.currentPopupAction=null}pollUserCancellation(){conste=()=>{vart,n;(null===(n=null===(t=this.authWindow)||void0===t?void0:t.window)||void0===n?void0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(yi(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(e,vo.get())};e()}}wo.currentPopupAction=null;const_o="pendingRedirect",bo=newMap;classIoextendsyo{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void0,n),this.eventId=null}asyncexecute(){lete=bo.get(this.auth._key());if(!e){try{constt=awaitasyncfunction(e,t){constn=ko(t),i=Eo(e);if(!(awaiti._isailable()))return!1;consts="true"===awaiti._get(n);returnawaiti._remove(n),s}(this.resolver,this.auth)?awaitsuper.execute():null;e=()=>Promise.resolve(t)}catch(KS){e=()=>Promise.reject(KS)}bo.set(this.auth._key(),e)}returnthis.bypassAuthState||bo.set(this.auth._key(),(()=>Promise.resolve(null))),e()}asynconAuthEvent(e){if("signInViaRedirect"===e.type)returnsuper.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){constt=awaitthis.auth._redirectUserForId(e.eventId);if(t)returnthis.user=t,super.onAuthEvent(e);this.resolve(null)}}elsethis.resolve(null)}asynconExecution(){}cleanUp(){}}asyncfunctionTo(e,t){returnEo(e)._set(ko(t),"true")}functionSo(e,t){bo.set(e._key(),t)}functionEo(e){returnJi(e._redirectPersistence)}functionko(e){return$i(_o,e.config.apiKey,e.name)}functionCo(e,t,n){returnasyncfunction(e,t,n){consti=ms(e);wi(e,t,Vs),awaiti._initializationPromise;consts=ho(i,n);returnawaitTo(s,i),s._openRedirect(i,t,"signInViaRedirect")}(e,t,n)}functionAo(e,t,n){returnasyncfunction(e,t,n){consti=Vt(e);wi(i.auth,t,Vs),awaiti.auth._initializationPromise;consts=ho(i.auth,n);awaitTo(s,i.auth);constr=awaitPo(i);returns._openRedirect(i.auth,t,"reauthViaRedirect",r)}(e,t,n)}functionNo(e,t,n){returnasyncfunction(e,t,n){consti=Vt(e);wi(i.auth,t,Vs),awaiti.auth._initializationPromise;consts=ho(i.auth,n);awaittr(!1,i,t.providerId),awaitTo(s,i.auth);constr=awaitPo(i);returns._openRedirect(i.auth,t,"linkViaRedirect",r)}(e,t,n)}asyncfunctionxo(e,t,n=!1){consti=ms(e),s=ho(i,t),r=newIo(i,s,n),o=awaitr.execute();returno&&!n&&(deleteo.user._redirectEventId,awaiti._persistUserIfCurrent(o.user),awaiti._setRedirectUser(null,t)),o}asyncfunctionPo(e){constt=Vr("".concat(e.uid,":::"));returne._redirectEventId=t,awaite.auth._setRedirectUser(e),awaite.auth._persistUserIfCurrent(e),t}classDo{constructor(e){this.auth=e,this.cachedEventUids=newSet,this.consumers=newSet,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.seEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;lett=!1;returnthis.consumers.forEach((n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.seEventToCache(e))})),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":returnRo(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){varn;if(e.error&&!Ro(e)){consti=(null===(n=e.error.code)||void0===n?void0:n.split("auth/")[1])||"internal-error";t.onError(yi(this.auth,i))}elset.onAuthEvent(e)}isEventForConsumer(e,t){constn=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;returnt.filter.includes(e.type)&&n}hasEventBeenHandled(e){returnDate.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(Oo(e))}seEventToCache(e){this.cachedEventUids.add(Oo(e)),this.lastProcessedEventTime=Date.now()}}functionOo(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((e=>e)).join("-")}functionRo({type:e,error:t}){return"unknown"===e&&(null==t?void0:t.code)==="auth/".concat("no-auth-event")}asyncfunctionMo(e,t={}){returnOi(e,"GET","/v1/projects",t)}constLo=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Fo=/^?/;functionVo(e){constt=Si(),{protocol:n,hostname:i}=newURL(t);if(e.startsWith("chrome-extension")){consts=newURL(e);return""===s.hostname&&""===i?"chrome-extension:"===n&&e.replace("chrome-extension","")===t.replace("chrome-extension",""):"chrome-extension:"===n&&s.hostname===i}if(!Fo.test(n))return!1;if(Lo.test(e))returni===e;consts=e.replace(/\./g,"\\.");returnnewRegExp("^(.+\\."+s+"|"+s+")$","i").test(i)}constUo=newCi(3e4,6e4);functionjo(){conste=jr().___jsl;if(null==e?void0:e.H)for(consttofObject.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(letn=0;n{vari,s,r;functiono(){jo(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{jo(),n(yi(e,"network-request-failed"))},timeout:Uo.get()})}if(null===(s=null===(i=jr().gapi)||void0===i?void0:i.iframes)||void0===s?void0:s.Iframe)t(gapi.iframes.getContext());else{if(!(null===(r=jr().gapi)||void0===r?void0:r.load)){constt=vs("iframefcb");returnjr()[t]=()=>{gapi.load?o():n(yi(e,"network-request-failed"))},ys("apis.google.com/js/api.js?onload=".concat(t)).catch((e=>n(e)))}o()}})).catch((e=>{throwBo=null,e}))}(e),Bo}constzo=newCi(5e3,15e3),Go="__/auth/iframe",Ko="emulator/auth/iframe",Ho={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Wo=newMap([["identitytoolkit.googleapis.com","p"],["sting-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);functionQo(e){constt=e.config;bi(t.authDomain,e,"auth-domain-config-required");constn=t.emulator?Ai(t,Ko):"".concat(e.config.authDomain,"/").concat(Go),i={apiKey:t.apiKey,appName:e.name,v:Nn},s=Wo.get(e.config.apiHost);s&&(i.eid=s);constr=e._getFrameworks();returnr.length&&(i.fw=r.join(",")),"".concat(n,"?").concat(Dt(i).slice(1))}constYo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};classJo{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(KS){}}}functionXo(e,t,n,i=500,s=600){constr=Math.max((window.screen.ailHeight-s)/2,0).toString(),o=Math.max((window.screen.ailWidth-i)/2,0).toString();leta="";constc=Object.assign(Object.assign({},Yo),{width:i.toString(),height:s.toString(),top:r,left:o}),l=_t().toLowerCase();n&&(a=ss(l)?"_blank":n),ns(l)&&(t=t||"httplocalhost",c.scrollbars="yes");constu=Object.entries(c).reduce(((e,[t,n])=>"".concat(e).concat(t,"=").concat(n,",")),"");if(function(e=_t()){vart;returnls(e)&&!!(null===(t=window.nigator)||void0===t?void0:t.standalone)}(l)&&"_self"!==a)returnfunction(e,t){constn=document.createElement("a");n.href=e,n.target=t;consti=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(i)}(t||"",a),newJo(null);consth=window.open(t||"",a,u);bi(h,e,"popup-blocked");try{h.focus()}catch(KS){}returnnewJo(h)}constZo="__/auth/handler",$o="emulator/auth/handler",ea=encodeURIComponent("fac");asyncfunctionta(e,t,n,i,s,r){bi(e.config.authDomain,e,"auth-domain-config-required"),bi(e.config.apiKey,e,"invalid-api-key");consto={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:i,v:Nn,eventId:s};if(tinstanceofVs){t.setDefaultLangue(e.langueCode),o.providerId=t.providerId||"",function(e){for(consttine)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]ofObject.entries(r||{}))o[e]=t}if(tinstanceofUs){conste=t.getScopes().filter((e=>""!==e));e.length>0&&(o.scopes=e.join(","))}e.tenantId&&(o.tid=e.tenantId);consta=o;for(constuofObject.keys(a))void0===a[u]&&deletea[u];constc=awaite._getAppCheckToken(),l=c?"#".concat(ea,"=").concat(encodeURIComponent(c)):"";return"".concat(function({config:e}){if(!e.emulator)return"".concat(e.authDomain,"/").concat(Zo);returnAi(e,$o)}(e),"?").concat(Dt(a).slice(1)).concat(l)}constna="webStoreSupport";constia=class{constructor(){this.eventManers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Lr,this._completeRedirectFn=xo,this._overrideRedirectResult=So}async_openPopup(e,t,n,i){vars;Ti(null===(s=this.eventManers[e._key()])||void0===s?void0:s.maner,"_initialize()notcalledbefore_openPopup()");returnXo(e,awaitta(e,t,n,Si(),i),Vr())}async_openRedirect(e,t,n,i){awaitthis._originValidation(e);returnfunction(e){jr().location.href=e}(awaitta(e,t,n,Si(),i)),newPromise((()=>{}))}_initialize(e){constt=e._key();if(this.eventManers[t]){const{maner:e,promise:n}=this.eventManers[t];returne?Promise.resolve(e):(Ti(n,"Ifmanerisnotset,promiseshouldbe"),n)}constn=this.initAndGetManer(e);returnthis.eventManers[t]={promise:n},n.catch((()=>{deletethis.eventManers[t]})),n}asyncinitAndGetManer(e){constt=awaitasyncfunction(e){constt=awaitqo(e),n=jr().gapi;returnbi(n,e,"internal-error"),t.open({where:document.body,url:Qo(e),messeHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Ho,dontclear:!0},(t=>newPromise((async(n,i)=>{awaitt.restyle({setHideOnLee:!1});consts=yi(e,"network-request-failed"),r=jr().setTimeout((()=>{i(s)}),zo.get());functiono(){jr().clearTimeout(r),n(t)}t.ping(o).then(o,(()=>{i(s)}))}))))}(e),n=newDo(e);returnt.register("authEvent",(t=>{bi(null==t?void0:t.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManers[e._key()]={maner:n},this.iframes[e._key()]=t,n}_isIframeWebStoreSupported(e,t){this.iframes[e._key()].send(na,{type:na},(n=>{vari;consts=null===(i=null==n?void0:n[0])||void0===i?void0:i[na];void0!==s&&t(!!s),gi(e,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){constt=e._key();returnthis.originValidationPromises[t]||(this.originValidationPromises[t]=asyncfunction(e){if(e.config.emulator)return;const{authorizedDomains:t}=awaitMo(e);for(constnoft)try{if(Vo(n))return}catch(ha){}gi(e,"unauthorized-domain")}(e)),this.originValidationPromises[t]}get_shouldInitProactively(){returnus()||is()||ls()}};classsa{constructor(e){this.factorId=e}_process(e,t,n){switch(t.type){case"enroll":returnthis._finalizeEnroll(e,t.credential,n);case"signin":returnthis._finalizeSignIn(e,t.credential);default:returnIi("unexpectedMultiFactorSessionType")}}}classraextendssa{constructor(e){super("phone"),this.credential=e}static_fromCredential(e){returnnewra(e)}_finalizeEnroll(e,t,n){returnfunction(e,t){returnOi(e,"POST","/v2/accounts/mfaEnrollment:finalize",Di(e,t))}(e,{idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,t){returnfunction(e,t){returnOi(e,"POST","/v2/accounts/mfaSignIn:finalize",Di(e,t))}(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}}classoa{constructor(){}staticassertion(e){returnra._fromCredential(e)}}oa.FACTOR_ID="phone";varaa="@firebase/auth",ca="1.3.0";classla{constructor(e){this.auth=e,this.internalListeners=newMap}getUid(){vare;returnthis.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void0===e?void0:e.uid)||null}asyncgetToken(e){if(this.assertAuthConfigured(),awaitthis.auth._initializationPromise,!this.auth.currentUser)returnnull;return{accessToken:awaitthis.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;constt=this.auth.onIdTokenChanged((t=>{e((null==t?void0:t.stsTokenManer.accessToken)||null)}));this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();constt=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){bi(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}varua,ha,da;functionpa(){returnwindow}ua="authIdTokenMaxe",null===(ha=yt())||void0===ha||ha["_".concat(ua)],da="Browser",En(newUt("auth",((e,{options:t})=>{constn=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:r,authDomain:o}=n.options;bi(r&&!r.includes(":"),"invalid-api-key",{appName:n.name});consta={apiKey:r,authDomain:o,clientPlatform:da,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"",sdkClientVersion:hs(da)},c=newfs(n,i,s,a);returnfunction(e,t){constn=(null==t?void0:t.persistence)||[],i=(Array.isArray(n)?n:[n]).map(Ji);(null==t?void0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(i,null==t?void0:t.popupRedirectResolver)}(c,t),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,n)=>{e.getProvider("auth-internal").initialize()}))),En(newUt("auth-internal",(e=>{constt=ms(e.getProvider("auth").getImmediate());returnnewla(t)}),"PRIVATE").setInstantiationMode("EXPLICIT")),Dn(aa,ca,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(da)),Dn(aa,ca,"esm2017");asyncfunctionfa(e,t,n){vari;const{BuildInfo:s}=pa();Ti(t.sessionId,"AuthEventdidnotcontainasessionID");constr=awaitasyncfunction(e){constt=function(e){if(Ti(/[0-9a-zA-Z]+/.test(e),"Canonlyconvertalpha-numericstrings"),"undefined"!=typeofTextEncoder)return(newTextEncoder).encode(e);constt=newArrayBuffer(e.length),n=newUint8Array(t);for(leti=0;ie.toString(16).padStart(2,"0"))).join("")}(t.sessionId),o={};returnls()?o.ibi=s.packeName:os()?o.apn=s.packeName:gi(e,"operation-not-supported-in-this-environment"),s.displayName&&(o.appDisplayName=s.displayName),o.sessionId=r,ta(e,n,t.type,void0,null!==(i=t.eventId)&&void0!==i?i:void0,o)}functionma(e){const{cordova:t}=pa();returnnewPromise((n=>{t.plugins.browsertab.isailable((i=>{lets=null;i?t.plugins.browsertab.openUrl(e):s=t.InAppBrowser.open(e,function(e=_t()){return/(iPad|iPhone|iPod).*OS7_\d/i.test(e)||/(iPad|iPhone|iPod).*OS8_\d/i.test(e)}()?"_blank":"_system","location=yes"),n(s)}))}))}constga=20;classyaextendsDo{constructor(){super(...arguments),this.passiveListeners=newSet,this.initPromise=newPromise((e=>{this.resolveInialized=e}))}addPassiveListener(e){this.passiveListeners.add(e)}removePassiveListener(e){this.passiveListeners.delete(e)}resetRedirect(){this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1}onEvent(e){returnthis.resolveInialized(),this.passiveListeners.forEach((t=>t(e))),super.onEvent(e)}asyncinitialized(){awaitthis.initPromise}}asyncfunctionva(e){constt=awaitba()._get(Ia(e));returnt&&awaitba()._remove(Ia(e)),t}functionwa(e,t){varn,i;consts=function(e){constt=Ta(e),n=t.link?decodeURIComponent(t.link):void0,i=Ta(n).link,s=t.deep_link_id?decodeURIComponent(t.deep_link_id):void0;returnTa(s).link||s||i||n||e}(t);if(s.includes("/__/auth/callback")){constt=Ta(s),r=t.firebaseError?function(e){try{returnJSON.parse(e)}catch(KS){returnnull}}(decodeURIComponent(t.firebaseError)):null,o=null===(i=null===(n=null==r?void0:r.code)||void0===n?void0:n.split("auth/"))||void0===i?void0:i[1],a=o?yi(o):null;returna?{type:e.type,eventId:e.eventId,tenantId:e.tenantId,error:a,urlResponse:null,sessionId:null,postBody:null}:{type:e.type,eventId:e.eventId,tenantId:e.tenantId,sessionId:e.sessionId,urlResponse:s,postBody:null}}returnnull}function_a(){conste=[],t="90abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(letn=0;n{};try{awaitnewPromise(((r,o)=>{leta=null;functionc(){vare;r();constt=null===(e=i.plugins.browsertab)||void0===e?void0:e.close;"function"==typeoft&&t(),"function"==typeof(null==n?void0:n.close)&&n.close()}functionl(){a||(a=window.setTimeout((()=>{o(yi(e,"redirect-cancelled-by-user"))}),2e3))}functionu(){"visible"===(null===document||void0===document?void0:document.visibilityState)&&l()}t.addPassiveListener(c),document.addEventListener("resume",l,!1),os()&&document.addEventListener("visibilitychange",u,!1),s=()=>{t.removePassiveListener(c),document.removeEventListener("resume",l,!1),document.removeEventListener("visibilitychange",u,!1),a&&window.clearTimeout(a)}}))}finally{s()}}(e,s,awaitma(o))}_isIframeWebStoreSupported(e,t){thrownewError("Methodnotimplemented.")}_originValidation(e){constt=e._key();returnthis.originValidationPromises[t]||(this.originValidationPromises[t]=asyncfunction(e){const{BuildInfo:t}=pa(),n={};ls()?n.iosBundleId=t.packeName:os()?n.androidPackeName=t.packeName:gi(e,"operation-not-supported-in-this-environment"),awaitMo(e,n)}(e)),this.originValidationPromises[t]}attachCallbackListeners(e,t){const{universalLinks:n,handleOpenURL:i,BuildInfo:s}=pa(),r=setTimeout((async()=>{awaitva(e),t.onEvent(Ea())}),500),o=asyncn=>{clearTimeout(r);consti=awaitva(e);lets=null;i&&(null==n?void0:n.url)&&(s=wa(i,n.url)),t.onEvent(s||Ea())};void0!==n&&"function"==typeofn.subscribe&&n.subscribe(null,o);consta=i,c="".concat(s.packeName.toLowerCase(),"");pa().handleOpenURL=asynce=>{if(e.toLowerCase().startsWith(c)&&o({url:e}),"function"==typeofa)try{a(e)}catch(KS){}}}};functionEa(){return{type:"unknown",eventId:null,sessionId:null,urlResponse:null,postBody:null,tenantId:null,error:yi("no-auth-event")}}functionka(){vare;return(null===(e=null===self||void0===self?void0:self.location)||void0===e?void0:e.protocol)||null}functionCa(e=_t()){return!("file:"!==ka()&&"ionic:"!==ka()&&"capacitor:"!==ka()||!e.toLowerCase().match(/iphone|ipad|ipod|android/))}functionAa(e=_t()){returnSt()&&11===(null===document||void0===document?void0:document.documentMode)||function(e=_t()){return/Edge\/\d+/.test(e)}(e)}functionNa(){try{conste=self.localStore,t=Vr();if(e)returne.setItem(t,"1"),e.removeItem(t),!Aa()||Et()}catch(KS){returnxa()&&Et()}return!1}functionxa(){return"undefined"!=typeofglobal&&"WorkerGlobalScope"inglobal&&"importScripts"inglobal}functionPa(){return("http:"===ka()||":"===ka()||It()||Ca())&&!(Tt()||bt())&&Na()&&!xa()}functionDa(){returnCa()&&"undefined"!=typeofdocument}constOa={LOCAL:"local",NONE:"none",SESSION:"session"},Ra=bi,Ma="persistence";asyncfunctionLa(e){awaite._initializationPromise;constt=Fa(),n=$i(Ma,e.config.apiKey,e.name);t&&t.setItem(n,e._getPersistence())}functionFa(){vare;try{return(null===(e="undefined"!=typeofwindow?window:null)||void0===e?void0:e.sessionStore)||null}catch(KS){returnnull}}constVa=bi;classUa{constructor(){this.browserResolver=Ji(ia),this.cordovaResolver=Ji(Sa),this.underlyingResolver=null,this._redirectPersistence=Lr,this._completeRedirectFn=xo,this._overrideRedirectResult=So}async_initialize(e){returnawaitthis.selectUnderlyingResolver(),this.assertedUnderlyingResolver._initialize(e)}async_openPopup(e,t,n,i){returnawaitthis.selectUnderlyingResolver(),this.assertedUnderlyingResolver._openPopup(e,t,n,i)}async_openRedirect(e,t,n,i){returnawaitthis.selectUnderlyingResolver(),this.assertedUnderlyingResolver._openRedirect(e,t,n,i)}_isIframeWebStoreSupported(e,t){this.assertedUnderlyingResolver._isIframeWebStoreSupported(e,t)}_originValidation(e){returnthis.assertedUnderlyingResolver._originValidation(e)}get_shouldInitProactively(){returnDa()||this.browserResolver._shouldInitProactively}getassertedUnderlyingResolver(){returnVa(this.underlyingResolver,"internal-error"),this.underlyingResolver}asyncselectUnderlyingResolver(){if(this.underlyingResolver)return;conste=awaitasyncfunction(){return!!Da()&&newPromise((e=>{constt=setTimeout((()=>{e(!1)}),1e3);document.addEventListener("deviceready",(()=>{clearTimeout(t),e(!0)}))}))}();this.underlyingResolver=e?this.cordovaResolver:this.browserResolver}}functionja(e){returne.unwrap()}functionBa(e,t){varn;consti=null===(n=t.customData)||void0===n?void0:n._tokenResponse;if("auth/multi-factor-auth-required"===(null==t?void0:t.code)){t.resolver=newKa(e,function(e,t){varn;consti=Vt(e),s=t;returnbi(t.customData.operationType,i,"argument-error"),bi(null===(n=s.customData._serverResponse)||void0===n?void0:n.mfaPendingCredential,i,"argument-error"),Ar._fromError(i,s)}(e,t))}elseif(i){conste=qa(t),n=t;e&&(n.credential=e,n.tenantId=i.tenantId||void0,n.email=i.email||void0,n.phoneNumber=i.phoneNumber||void0)}}functionqa(e){const{_tokenResponse:t}=einstanceofkt?e.customData:e;if(!t)returnnull;if(!(einstanceofkt)&&"temporaryProof"int&&"phoneNumber"int)returnuo.credentialFromResult(e);constn=t.providerId;if(!n||n===ei.PASSWORD)returnnull;leti;switch(n){caseei.GOOGLE:i=qs;break;caseei.FACEBOOK:i=Bs;break;caseei.GITHUB:i=zs;break;caseei.TWITTER:i=Hs;break;default:const{oauthIdToken:e,oauthAccessToken:s,oauthTokenSecret:r,pendingToken:o,nonce:a}=t;returns||r||e||o?o?n.startsWith("saml.")?Gs._create(n,o):Os._fromParams({providerId:n,signInMethod:n,pendingToken:o,idToken:e,accessToken:s}):newjs(n).credential({idToken:e,accessToken:s,rawNonce:a}):null}returneinstanceofkt?i.credentialFromError(e):i.credentialFromResult(e)}functionza(e,t){returnt.catch((t=>{throwtinstanceofkt&&Ba(e,t),t})).then((e=>{constt=e.operationType,n=e.user;return{operationType:t,credential:(i=e,qa(i)),additionalUserInfo:kr(e),user:Ha.getOrCreate(n)};vari}))}asyncfunctionGa(e,t){constn=awaitt;return{verificationId:n.verificationId,confirm:t=>za(e,n.confirm(t))}}classKa{constructor(e,t){this.resolver=t,this.auth=e.wrapped()}getsession(){returnthis.resolver.session}gethints(){returnthis.resolver.hints}resolveSignIn(e){returnza(ja(this.auth),this.resolver.resolveSignIn(e))}}letHa=classe{constructor(e){this._delegate=e,this.multiFactor=function(e){constt=Vt(e);returnxr.has(t)||xr.set(t,Nr._fromUser(t)),xr.get(t)}(e)}staticgetOrCreate(t){returne.USER_MAP.has(t)||e.USER_MAP.set(t,newe(t)),e.USER_MAP.get(t)}delete(){returnthis._delegate.delete()}reload(){returnthis._delegate.reload()}toJSON(){returnthis._delegate.toJSON()}getIdTokenResult(e){returnthis._delegate.getIdTokenResult(e)}getIdToken(e){returnthis._delegate.getIdToken(e)}linkAndRetrieveDataWithCredential(e){returnthis.linkWithCredential(e)}asynclinkWithCredential(e){returnza(this.auth,rr(this._delegate,e))}asynclinkWithPhoneNumber(e,t){returnGa(this.auth,asyncfunction(e,t,n){consti=Vt(e);awaittr(!1,i,"phone");consts=awaitlo(i.auth,t,Vt(n));returnnewco(s,(e=>rr(i,e)))}(this._delegate,e,t))}asynclinkWithPopup(e){returnza(this.auth,asyncfunction(e,t,n){consti=Vt(e);wi(i.auth,t,Vs);consts=ho(i.auth,n);returnnewwo(i.auth,"linkViaPopup",t,s,i).executeNotNull()}(this._delegate,e,Ua))}asynclinkWithRedirect(e){returnawaitLa(ms(this.auth)),No(this._delegate,e,Ua)}reauthenticateAndRetrieveDataWithCredential(e){returnthis.reauthenticateWithCredential(e)}asyncreauthenticateWithCredential(e){returnza(this.auth,or(this._delegate,e))}reauthenticateWithPhoneNumber(e,t){returnGa(this.auth,asyncfunction(e,t,n){consti=Vt(e),s=awaitlo(i.auth,t,Vt(n));returnnewco(s,(e=>or(i,e)))}(this._delegate,e,t))}reauthenticateWithPopup(e){returnza(this.auth,asyncfunction(e,t,n){consti=Vt(e);wi(i.auth,t,Vs);consts=ho(i.auth,n);returnnewwo(i.auth,"reauthViaPopup",t,s,i).executeNotNull()}(this._delegate,e,Ua))}asyncreauthenticateWithRedirect(e){returnawaitLa(ms(this.auth)),Ao(this._delegate,e,Ua)}sendEmailVerification(e){returngr(this._delegate,e)}asyncunlink(e){returnawait$s(this._delegate,e),this}updateEmail(e){returnfunction(e,t){returnwr(Vt(e),t,null)}(this._delegate,e)}updatePassword(e){returnfunction(e,t){returnwr(Vt(e),null,t)}(this._delegate,e)}updatePhoneNumber(e){returnasyncfunction(e,t){awaiter(Vt(e),t)}(this._delegate,e)}updateProfile(e){returnvr(this._delegate,e)}verifyBeforeUpdateEmail(e,t){returnyr(this._delegate,e,t)}getemailVerified(){returnthis._delegate.emailVerified}getisAnonymous(){returnthis._delegate.isAnonymous}getmetadata(){returnthis._delegate.metadata}getphoneNumber(){returnthis._delegate.phoneNumber}getproviderData(){returnthis._delegate.providerData}getrefreshToken(){returnthis._delegate.refreshToken}gettenantId(){returnthis._delegate.tenantId}getdisplayName(){returnthis._delegate.displayName}getemail(){returnthis._delegate.email}getphotoURL(){returnthis._delegate.photoURL}getproviderId(){returnthis._delegate.providerId}getuid(){returnthis._delegate.uid}getauth(){returnthis._delegate.auth}};Ha.USER_MAP=newWeakMap;constWa=bi;classQa{constructor(e,t){if(this.app=e,t.isInitialized())returnthis._delegate=t.getImmediate(),voidthis.linkUnderlyingAuth();const{apiKey:n}=e.options;Wa(n,"invalid-api-key",{appName:e.name}),Wa(n,"invalid-api-key",{appName:e.name});consti="undefined"!=typeofwindow?Ua:void0;this._delegate=t.initialize({options:{persistence:Ja(n,e.name),popupRedirectResolver:i}}),this._delegate._updateErrorMap(hi),this.linkUnderlyingAuth()}getemulatorConfig(){returnthis._delegate.emulatorConfig}getcurrentUser(){returnthis._delegate.currentUser?Ha.getOrCreate(this._delegate.currentUser):null}getlangueCode(){returnthis._delegate.langueCode}setlangueCode(e){this._delegate.langueCode=e}getsettings(){returnthis._delegate.settings}gettenantId(){returnthis._delegate.tenantId}settenantId(e){this._delegate.tenantId=e}useDeviceLangue(){this._delegate.useDeviceLangue()}signOut(){returnthis._delegate.signOut()}useEmulator(e,t){bs(this._delegate,e,t)}applyActionCode(e){returnpr(this._delegate,e)}checkActionCode(e){returnfr(this._delegate,e)}confirmPasswordReset(e,t){returnasyncfunction(e,t,n){awaitEs(Vt(e),{oobCode:t,newPassword:n}).catch((asynct=>{throwt.code==="auth/".concat("password-does-not-meet-requirements")&&dr(e),t}))}(this._delegate,e,t)}asynccreateUserWithEmailAndPassword(e,t){returnza(this._delegate,asyncfunction(e,t,n){vari;consts=ms(e),r={returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"};leto;if(null===(i=s._getRecaptchaConfig())||void0===i?void0:i.emailPasswordEnabled){conste=await_s(s,r,"signUpPassword");o=Ws(s,e)}elseo=Ws(s,r).catch((asynce=>{if(e.code==="auth/".concat("missing-recaptcha-token")){conste=await_s(s,r,"signUpPassword");returnWs(s,e)}throwe}));consta=awaito.catch((t=>{throwt.code==="auth/".concat("password-does-not-meet-requirements")&&dr(e),t})),c=awaitQs._fromIdTokenResponse(s,"signIn",a);returnawaits._updateCurrentUser(c.user),c}(this._delegate,e,t))}fetchProvidersForEmail(e){returnthis.fetchSignInMethodsForEmail(e)}fetchSignInMethodsForEmail(e){returnmr(this._delegate,e)}isSignInWithEmailLink(e){returnfunction(e,t){constn=Ls.parseLink(t);return"EMAIL_SIGNIN"===(null==n?void0:n.operation)}(this._delegate,e)}asyncgetRedirectResult(){Wa(Pa(),this._delegate,"operation-not-supported-in-this-environment");conste=awaitasyncfunction(e,t){returnawaitms(e)._initializationPromise,xo(e,t,!1)}(this._delegate,Ua);returne?za(this._delegate,Promise.resolve(e)):{credential:null,user:null}}addFrameworkForLogging(e){!function(e,t){ms(e)._logFramework(t)}(this._delegate,e)}onAuthStateChanged(e,t,n){const{next:i,error:s,complete:r}=Ya(e,t,n);returnthis._delegate.onAuthStateChanged(i,s,r)}onIdTokenChanged(e,t,n){const{next:i,error:s,complete:r}=Ya(e,t,n);returnthis._delegate.onIdTokenChanged(i,s,r)}sendSignInLinkToEmail(e,t){returnasyncfunction(e,t,n){vari;consts=ms(e),r={requestType:"EMAIL_SIGNIN",email:t,clientType:"CLIENT_TYPE_WEB"};functiono(e,t){bi(t.handleCodeInApp,s,"argument-error"),t&&hr(s,e,t)}if(null===(i=s._getRecaptchaConfig())||void0===i?void0:i.emailPasswordEnabled){conste=await_s(s,r,"getOobCode",!0);o(e,n),awaitxs(s,e)}elseo(r,n),awaitxs(s,r).catch((asynce=>{if(e.code!=="auth/".concat("missing-recaptcha-token"))returnPromise.reject(e);{conste=await_s(s,r,"getOobCode",!0);o(e,n),awaitxs(s,e)}}))}(this._delegate,e,t)}sendPasswordResetEmail(e,t){returnasyncfunction(e,t,n){vari;consts=ms(e),r={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};if(null===(i=s._getRecaptchaConfig())||void0===i?void0:i.emailPasswordEnabled){conste=await_s(s,r,"getOobCode",!0);n&&hr(s,e,n),awaitNs(s,e)}elsen&&hr(s,r,n),awaitNs(s,r).catch((asynce=>{if(e.code!=="auth/".concat("missing-recaptcha-token"))returnPromise.reject(e);{conste=await_s(s,r,"getOobCode",!0);n&&hr(s,e,n),awaitNs(s,e)}}))}(this._delegate,e,t||void0)}asyncsetPersistence(e){lett;switch(function(e,t){Ra(Object.values(Oa).includes(t),e,"invalid-persistence-type"),Tt()?Ra(t!==Oa.SESSION,e,"unsupported-persistence-type"):bt()?Ra(t===Oa.NONE,e,"unsupported-persistence-type"):xa()?Ra(t===Oa.NONE||t===Oa.LOCAL&&Et(),e,"unsupported-persistence-type"):Ra(t===Oa.NONE||Na(),e,"unsupported-persistence-type")}(this._delegate,e),e){caseOa.SESSION:t=Lr;break;caseOa.LOCAL:t=awaitJi(Xr)._isailable()?Xr:Rr;break;caseOa.NONE:t=Zi;break;default:returngi("argument-error",{appName:this._delegate.name})}returnthis._delegate.setPersistence(t)}signInAndRetrieveDataWithCredential(e){returnthis.signInWithCredential(e)}signInAnonymously(){returnza(this._delegate,asyncfunction(e){vart;constn=ms(e);if(awaitn._initializationPromise,null===(t=n.currentUser)||void0===t?void0:t.isAnonymous)returnnewQs({user:n.currentUser,providerId:null,operationType:"signIn"});consti=awaitWs(n,{returnSecureToken:!0}),s=awaitQs._fromIdTokenResponse(n,"signIn",i,!0);returnawaitn._updateCurrentUser(s.user),s}(this._delegate))}signInWithCredential(e){returnza(this._delegate,sr(this._delegate,e))}signInWithCustomToken(e){returnza(this._delegate,ar(this._delegate,e))}signInWithEmailAndPassword(e,t){returnza(this._delegate,function(e,t,n){returnsr(Vt(e),Fs.credential(t,n)).catch((asynct=>{throwt.code==="auth/".concat("password-does-not-meet-requirements")&&dr(e),t}))}(this._delegate,e,t))}signInWithEmailLink(e,t){returnza(this._delegate,asyncfunction(e,t,n){consti=Vt(e),s=Fs.credentialWithLink(t,n||Si());returnbi(s._tenantId===(i.tenantId||null),i,"tenant-id-mismatch"),sr(i,s)}(this._delegate,e,t))}signInWithPhoneNumber(e,t){returnGa(this._delegate,asyncfunction(e,t,n){consti=ms(e),s=awaitlo(i,t,Vt(n));returnnewco(s,(e=>sr(i,e)))}(this._delegate,e,t))}asyncsignInWithPopup(e){returnWa(Pa(),this._delegate,"operation-not-supported-in-this-environment"),za(this._delegate,asyncfunction(e,t,n){consti=ms(e);wi(e,t,Vs);consts=ho(i,n);returnnewwo(i,"signInViaPopup",t,s).executeNotNull()}(this._delegate,e,Ua))}asyncsignInWithRedirect(e){returnWa(Pa(),this._delegate,"operation-not-supported-in-this-environment"),awaitLa(this._delegate),Co(this._delegate,e,Ua)}updateCurrentUser(e){returnthis._delegate.updateCurrentUser(e)}verifyPasswordResetCode(e){returnasyncfunction(e,t){const{data:n}=awaitfr(Vt(e),t);returnn.email}(this._delegate,e)}unwrap(){returnthis._delegate}_delete(){returnthis._delegate._delete()}linkUnderlyingAuth(){this._delegate.wrapped=()=>this}}functionYa(e,t,n){leti=e;"function"!=typeofe&&({next:i,error:t,complete:n}=e);consts=i;return{next:e=>s(e&&Ha.getOrCreate(e)),error:t,complete:n}}functionJa(e,t){constn=function(e,t){constn=Fa();if(!n)return[];consti=$i(Ma,e,t);switch(n.getItem(i)){caseOa.NONE:return[Zi];caseOa.LOCAL:return[Xr,Lr];caseOa.SESSION:return[Lr];default:return[]}}(e,t);if("undefined"==typeofself||n.includes(Xr)||n.push(Xr),"undefined"!=typeofwindow)for(constiof[Rr,Lr])n.includes(i)||n.push(i);returnn.includes(Zi)||n.push(Zi),n}Qa.Persistence=Oa;classXa{constructor(){this.providerId="phone",this._delegate=newuo(ja(Zn.auth()))}staticcredential(e,t){returnuo.credential(e,t)}verifyPhoneNumber(e,t){returnthis._delegate.verifyPhoneNumber(e,t)}unwrap(){returnthis._delegate}}Xa.PHONE_SIGN_IN_METHOD=uo.PHONE_SIGN_IN_METHOD,Xa.PROVIDER_ID=uo.PROVIDER_ID;constZa=bi;class$a{constructor(e,t,n=Zn.app()){vari;Za(null===(i=n.options)||void0===i?void0:i.apiKey,"invalid-api-key",{appName:n.name}),this._delegate=newao(n.auth(),e,t),this.type=this._delegate.type}clear(){this._delegate.clear()}render(){returnthis._delegate.render()}verify(){returnthis._delegate.verify()}}varec;(ec=Zn).INTERNAL.registerComponent(newUt("auth-compat",(e=>{constt=e.getProvider("app-compat").getImmediate(),n=e.getProvider("auth");returnnewQa(t,n)}),"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:ti,PASSWORD_RESET:ni,RECOVER_EMAIL:ii,REVERT_SECOND_FACTOR_ADDITION:si,VERIFY_AND_CHANGE_EMAIL:ri,VERIFY_EMAIL:oi}},EmailAuthProvider:Fs,FacebookAuthProvider:Bs,GithubAuthProvider:zs,GoogleAuthProvider:qs,OAuthProvider:js,SAMLAuthProvider:Ks,PhoneAuthProvider:Xa,PhoneMultiFactorGenerator:oa,Recaptcherifier:$a,TwitterAuthProvider:Hs,Auth:Qa,AuthCredential:Ss,Error:kt}).setInstantiationMode("LAZY").setMultipleInstances(!1)),ec.registerVersion("@firebase/auth-compat","0.4.6");vartc,nc="undefined"!=typeofglobalThis?globalThis:"undefined"!=typeofwindow?window:"undefined"!=typeofglobal?global:"undefined"!=typeofself?self:{},ic=ic||{},sc=nc||self;functionrc(e){vart=typeofe;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeofe.length}functionoc(e){vart=typeofe;return"object"==t&&null!=e||"function"==t}varac="closure_uid_"+(1e9*Math.random()>>>0),cc=0;functionlc(e,t,n){returne.call.apply(e.bind,arguments)}functionuc(e,t,n){if(!e)throwError();if(222))+((o=s+(t^(r|~n))+i[14]+91&95)>17))+((o=n+(r^(s|~t))+i[5]+41&95)>11))+((o=t+(s^(n|~r))+i[12]+71&95)>26))+((o=r+(n^(t|~s))+i[3]+90&95)>22))+((o=s+(t^(r|~n))+i[10]+73&95)>17))+((o=n+(r^(s|~t))+i[1]+97&95)>11))+((o=t+(s^(n|~r))+i[8]+59&95)>26))+((o=r+(n^(t|~s))+i[15]+52&95)>22))+((o=s+(t^(r|~n))+i[6]+16&95)>17))+((o=n+(r^(s|~t))+i[13]+49&95)>11))+((r=(t=n+((o=t+(s^(n|~r))+i[4]+26&95)>26))+((o=r+(n^(t|~s))+i[11]+17&95)>22))^((s=r+((o=s+(t^(r|~n))+i[2]+9&95)>17))|~t))+i[9]+45&95,e.g[0]=e.g[0]+t&95,e.g[1]=e.g[1]+(s+(o>11))&95,e.g[2]=e.g[2]+s&95,e.g[3]=e.g[3]+r&95}functionHh(e,t){this.h=t;for(varn=[],i=!0,s=e.length-1;0"content-type"==e.toLowerCase())),s=sc.FormData&&einstanceofsc.FormData,!(0=n;i++)t[i]=e/n|0,n*=Jh;returnnewHh(t,0)}varJh=96,Xh=Qh(0),Zh=Qh(1),$h=Qh();functioned(e){if(0!=e.h)return!1;for(vart=0;t>16,e[t]&=,t++}functionrd(e,t){this.g=e,this.h=t}functionod(e,t){if(ed(t))throwError("divisionbyzero");if(ed(e))returnnewrd(Xh,Xh);if(td(e))returnt=od(nd(e),t),newrd(nd(t.g),nd(t.h));if(td(t))returnt=od(e,nd(t)),newrd(nd(t.g),t.h);if(30=i.X(e);)n=ad(n),i=ad(i);vars=cd(n,1),r=cd(i,1);for(i=cd(i,2),n=cd(n,2);!ed(i);){varo=r.add(i);0>=o.X(e)&&(s=s.add(n),r=o),i=cd(i,1),n=cd(n,1)}returnt=id(e,s.R(t)),newrd(s,t)}for(s=Xh;0=(i=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,i-48),o=(r=Yh(n)).R(t);td(o)||0>5;t%=32;for(vari=e.g.length-n,s=[],r=0;r>t|e.D(r+n+1)e?0:e>16)+(this.D(s)>>>16)+(e.D(s)>>>16);i=o>>>16,r&=,o&=,n[s]=oe.X($h))returnYh(this.ea()*e.ea());for(vart=this.g.length+e.g.length,n=[],i=0;i16,o=&this.D(i),a=e.D(s)>>>16,c=&e.D(s);n[2*i+2*s]+=o*c,sd(n,2*i+2*s),n[2*i+2*s+1]+=r*c,sd(n,2*i+2*s+1),n[2*i+2*s+1]+=o*a,sd(n,2*i+2*s+1),n[2*i+2*s+2]+=r*a,sd(n,2*i+2*s+2)}for(i=0;io(e))),setTimeout((()=>{if(!this.auth){conste=this.t.getImmediate({optional:!0});e?o(e):(Td("FirebaseAuthCredentialsProvider","Authnotyetdetected"),s.resolve(),s=newDd)}}),0),r()}getToken(){conste=this.i,t=this.forceRefresh;returnthis.forceRefresh=!1,this.auth?this.auth.getToken(t).then((t=>this.i!==e?(Td("FirebaseAuthCredentialsProvider","getTokenabortedduetotokenchange."),this.getToken()):t?(Ad("string"==typeoft.accessToken),newOd(t.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){conste=this.auth&&this.auth.getUid();returnAd(null===e||"string"==typeofe),newwd(e)}}classFd{constructor(e,t,n){this.l=e,this.h=t,this.P=n,this.type="FirstParty",this.user=wd.FIRST_PARTY,this.I=newMap}T(){returnthis.P?this.P():null}getheaders(){this.I.set("X-Goog-AuthUser",this.l);conste=this.T();returne&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}classVd{constructor(e,t,n){this.l=e,this.h=t,this.P=n}getToken(){returnPromise.resolve(newFd(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable((()=>t(wd.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}classUd{constructor(e){this.value=e,this.type="AppCheck",this.headers=newMap,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}classjd{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){constn=e=>{null!=e.error&&Td("FirebaseAppCheckTokenProvider","ErrorgettingAppChecktoken;usingplaceholdertokeninstead.Error:".concat(e.error.messe));constn=e.token!==this.R;returnthis.R=e.token,Td("FirebaseAppCheckTokenProvider","Received".concat(n?"new":"existing","token.")),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable((()=>n(t)))};consti=e=>{Td("FirebaseAppCheckTokenProvider","AppCheckdetected"),this.appCheck=e,this.appCheck.addTokenListener(this.o)};this.A.onInit((e=>i(e))),setTimeout((()=>{if(!this.appCheck){conste=this.A.getImmediate({optional:!0});e?i(e):Td("FirebaseAppCheckTokenProvider","AppChecknotyetdetected")}}),0)}getToken(){conste=this.forceRefresh;returnthis.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((e=>e?(Ad("string"==typeofe.token),this.R=e.token,newUd(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}functionBd(e){constt="undefined"!=typeofself&&(self.crypto||self.msCrypto),n=newUint8Array(e);if(t&&"function"==typeoft.getRandomValues)t.getRandomValues(n);elsefor(leti=0;i2===e.kind))}functiontp(e){returne.fields.filter((e=>2!==e.kind))}$d.UNKNOWN_ID=-1;classnp{constructor(e,t){this.fieldPath=e,this.kind=t}}classip{constructor(e,t){this.sequenceNumber=e,this.offset=t}staticempty(){returnnewip(0,op.min())}}functionsp(e,t){constn=e.toTimestamp().seconds,i=e.toTimestamp().nanoseconds+1,s=Wd.fromTimestamp(1e9===i?newHd(n+1,0):newHd(n,i));returnnewop(s,Zd.empty(),t)}functionrp(e){returnnewop(e.readTime,e.key,-1)}classop{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}staticmin(){returnnewop(Wd.min(),Zd.empty(),-1)}staticmax(){returnnewop(Wd.max(),Zd.empty(),-1)}}functionap(e,t){letn=e.readTime.compareTo(t.readTime);return0!==n?n:(n=Zd.comparator(e.documentKey,t.documentKey),0!==n?n:zd(e.largestBatchId,t.largestBatchId))}constcp="Thecurrenttabisnotintherequiredstatetoperformthisoperation.Itmightbenecessarytorefreshthebrowsertab.";classlp{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}asyncfunctionup(e){if(e.code!==xd.FAILED_PRECONDITION||e.messe!==cp)throwe;Td("LocalStore","Unexpectedlylostprimarylease")}classhp{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void0,this.error=void0,this.isDone=!1,this.callbackAttached=!1,e((e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)}),(e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)}))}catch(e){returnthis.next(void0,e)}next(e,t){returnthis.callbackAttached&&Cd(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):newhp(((n,i)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,i)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,i)}}))}toPromise(){returnnewPromise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(e){try{constt=e();returntinstanceofhp?t:hp.resolve(t)}catch(t){returnhp.reject(t)}}wrapSuccess(e,t){returne?this.wrapUserFunction((()=>e(t))):hp.resolve(t)}wrapFailure(e,t){returne?this.wrapUserFunction((()=>e(t))):hp.reject(t)}staticresolve(e){returnnewhp(((t,n)=>{t(e)}))}staticreject(e){returnnewhp(((t,n)=>{n(e)}))}staticwaitFor(e){returnnewhp(((t,n)=>{leti=0,s=0,r=!1;e.forEach((e=>{++i,e.next((()=>{++s,r&&s===i&&t()}),(e=>n(e)))})),r=!0,s===i&&t()}))}staticor(e){lett=hp.resolve(!1);for(constnofe)t=t.next((e=>e?hp.resolve(e):n()));returnt}staticforEach(e,t){constn=[];returne.forEach(((e,i)=>{n.push(t.call(this,e,i))})),this.waitFor(n)}staticmapArray(e,t){returnnewhp(((n,i)=>{consts=e.length,r=newArray(s);leto=0;for(leta=0;a{r[c]=e,++o,o===s&&n(r)}),(e=>i(e)))}}))}staticdoWhile(e,t){returnnewhp(((n,i)=>{consts=()=>{!0===e()?t().next((()=>{s()}),i):n()};s()}))}}classdp{constructor(e,t){this.action=e,this.transaction=t,this.aborted=!1,this.m=newDd,this.transaction.oncomplete=()=>{this.m.resolve()},this.transaction.onabort=()=>{t.error?this.m.reject(newmp(e,t.error)):this.m.resolve()},this.transaction.onerror=t=>{constn=_p(t.target.error);this.m.reject(newmp(e,n))}}staticopen(e,t,n,i){try{returnnewdp(t,e.transaction(i,n))}catch(s){thrownewmp(t,s)}}getg(){returnthis.m.promise}abort(e){e&&this.m.reject(e),this.aborted||(Td("SimpleDb","Abortingtransaction:",e?e.messe:"Client-initiatedabort"),this.aborted=!0,this.transaction.abort())}p(){conste=this.transaction;this.aborted||"function"!=typeofe.commit||e.commit()}store(e){constt=this.transaction.objectStore(e);returnnewyp(t)}}classpp{constructor(e,t,n){this.name=e,this.version=t,this.S=n,12.2===pp.D(_t())&&Sd("FirestorepersistencesuffersfromabuginiOS12.2Safarithatmaycauseyourapptostopworking.Seestackoverflow.com/q//fordetailsandapotentialworkaround.")}staticdelete(e){returnTd("SimpleDb","Removingdatabase:",e),vp(window.indexedDB.deleteDatabase(e)).toPromise()}staticC(){if(!Et())return!1;if(pp.v())return!0;conste=_t(),t=pp.D(e),n=0{consti=indexedDB.open(this.name,this.version);i.onsuccess=e=>{constn=e.target.result;t(n)},i.onblocked=()=>{n(newmp(e,"CannotupgradeIndexedDBschemawhileanothertabisopen.ClosealltabsthataccessFirestoreandreloadthispetoproceed."))},i.onerror=t=>{consti=t.target.error;"VersionError"===i.name?n(newPd(xd.FAILED_PRECONDITION,"AnewerversionoftheFirestoreSDKwaspreviouslyusedandsothepersisteddataisnotcompatiblewiththeversionoftheSDKyouarenowusing.TheSDKwilloperatewithpersistencedisabled.Ifyouneedpersistence,pleasere-upgradetoanewerversionoftheSDKorelseclearthepersistedIndexedDBdataforyourapptostartfresh.")):"InvalidStateError"===i.name?n(newPd(xd.FAILED_PRECONDITION,"UnabletoopenanIndexedDBconnection.ThiscouldbeduetorunninginaprivatebrowsingsessiononabrowserwhoseprivatebrowsingsessionsdonotsupportIndexedDB:"+i)):n(newmp(e,i))},i.onupgradeneeded=e=>{Td("SimpleDb",'Database"'+this.name+'"requiresupgradefromversion:',e.oldVersion);constt=e.target.result;this.S.B(t,i.transaction,e.oldVersion,this.version).next((()=>{Td("SimpleDb","Databaseupgradetoversion"+this.version+"complete")}))}}))),this.L&&(this.db.onversionchange=e=>this.L(e)),this.db}k(e){this.L=e,this.db&&(this.db.onversionchange=t=>e(t))}asyncrunTransaction(e,t,n,i){consts="readonly"===t;letr=0;for(;;){++r;try{this.db=awaitthis.N(e);constt=dp.open(this.db,e,s?"readonly":"readwrite",n),r=i(t).next((e=>(t.p(),e))).catch((e=>(t.abort(e),hp.reject(e)))).toPromise();returnr.catch((()=>{})),awaitt.g,r}catch(o){conste=o,t="FirebaseError"!==e.name&&r(void0===t&&(t=null),Td("SimpleDb","GET",this.store.name,e,t),t)))}delete(e){returnTd("SimpleDb","DELETE",this.store.name,e),vp(this.store.delete(e))}count(){returnTd("SimpleDb","COUNT",this.store.name),vp(this.store.count())}G(e,t){constn=this.options(e,t);if(n.index||"function"!=typeofthis.store.getAll){conste=this.cursor(n),t=[];returnthis.j(e,((e,n)=>{t.push(n)})).next((()=>t))}{conste=this.store.getAll(n.range);returnnewhp(((t,n)=>{e.onerror=e=>{n(e.target.error)},e.onsuccess=e=>{t(e.target.result)}}))}}H(e,t){constn=this.store.getAll(e,null===t?void0:t);returnnewhp(((e,t)=>{n.onerror=e=>{t(e.target.error)},n.onsuccess=t=>{e(t.target.result)}}))}J(e,t){Td("SimpleDb","DELETEALL",this.store.name);constn=this.options(e,t);n.Y=!1;consti=this.cursor(n);returnthis.j(i,((e,t,n)=>n.delete()))}Z(e,t){letn;t?n=e:(n={},t=e);consti=this.cursor(n);returnthis.j(i,t)}X(e){constt=this.cursor({});returnnewhp(((n,i)=>{t.onerror=e=>{constt=_p(e.target.error);i(t)},t.onsuccess=t=>{consti=t.target.result;i?e(i.primaryKey,i.value).next((e=>{e?i.continue():n()})):n()}}))}j(e,t){constn=[];returnnewhp(((i,s)=>{e.onerror=e=>{s(e.target.error)},e.onsuccess=e=>{consts=e.target.result;if(!s)returnvoidi();constr=newfp(s),o=t(s.primaryKey,s.value,r);if(oinstanceofhp){conste=o.catch((e=>(r.done(),hp.reject(e))));n.push(e)}r.isDone?i():null===r.U?s.continue():s.continue(r.U)}})).next((()=>hp.waitFor(n)))}options(e,t){letn;returnvoid0!==e&&("string"==typeofe?n=e:t=e),{index:n,range:t}}cursor(e){lett="next";if(e.reverse&&(t="prev"),e.index){constn=this.store.index(e.index);returne.Y?n.openKeyCursor(e.range,t):n.openCursor(e.range,t)}returnthis.store.openCursor(e.range,t)}}functionvp(e){returnnewhp(((t,n)=>{e.onsuccess=e=>{constn=e.target.result;t(n)},e.onerror=e=>{constt=_p(e.target.error);n(t)}}))}letwp=!1;function_p(e){constt=pp.D(_t());if(t>=12.2&&t=0){conste=newPd("internal","IOS_INDEXEDDB_BUG1:IndexedDbhasthrown'".concat(t,"'.ThisislikelyduetoanunoidablebuginiOS.Seestackoverflow.com/q//fordetailsandapotentialworkaround."));returnwp||(wp=!0,setTimeout((()=>{throwe}),0)),e}}returne}classbp{constructor(e,t){this.asyncQueue=e,this.ee=t,this.task=null}start(){this.te(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}getstarted(){returnnull!==this.task}te(e){Td("IndexBackiller","Scheduledin".concat(e,"ms")),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,(async()=>{this.task=null;try{Td("IndexBackiller","Documentswritten:".concat(awaitthis.ee.ne()))}catch(e){gp(e)?Td("IndexBackiller","IgnoringIndexedDBerrorduringindexbackfill:",e):awaitup(e)}awaitthis.te(6e4)}))}}classIp{constructor(e,t){this.localStore=e,this.persistence=t}asyncne(e=50){returnthis.persistence.runTransaction("BackfillIndexes","readwrite-primary",(t=>this.re(t,e)))}re(e,t){constn=newSet;leti=t,s=!0;returnhp.doWhile((()=>!0===s&&i>0),(()=>this.localStore.indexManer.getNextCollectionGroupToUpdate(e).next((t=>{if(null!==t&&!n.has(t))returnTd("IndexBackiller","Processingcollection:".concat(t)),this.ie(e,t,i).next((e=>{i-=e,n.add(t)}));s=!1})))).next((()=>t-i))}ie(e,t,n){returnthis.localStore.indexManer.getMinOffsetFromCollectionGroup(e,t).next((i=>this.localStore.localDocuments.getNextDocuments(e,t,i,n).next((n=>{consts=n.changes;returnthis.localStore.indexManer.updateIndexEntries(e,s).next((()=>this.se(i,n))).next((n=>(Td("IndexBackiller","Updatingoffset:".concat(n)),this.localStore.indexManer.updateCollectionGroup(e,t,n)))).next((()=>s.size))}))))}se(e,t){letn=e;returnt.changes.forEach(((e,t)=>{consti=rp(t);ap(i,n)>0&&(n=i)})),newop(n.readTime,n.documentKey,Math.max(t.batchId,e.largestBatchId))}}classTp{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.oe(e),this._e=e=>t.writeSequenceNumber(e))}oe(e){returnthis.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){conste=++this.previousValue;returnthis._e&&this._e(e),e}}functionSp(e){returnnull==e}functionEp(e){return0===e&&1/e==-1/0}functionkp(e){return"number"==typeofe&&Number.isInteger(e)&&!Ep(e)&&e=Number.MIN_SAFE_INTEGER}functionCp(e){lett="";for(letn=0;n0&&(t=Np(t)),t=Ap(e.get(n),t);returnNp(t)}functionAp(e,t){letn=t;consti=e.length;for(lets=0;s=2),2===t)returnAd(""===e.charAt(0)&&""===e.charAt(1)),Yd.emptyPath();constn=t-2,i=[];lets="";for(letr=0;r(e.push("".concat(t,":").concat(n)),!1))),"{".concat(e.join(","),"}")}reverseTrersal(e){returnthis.root.reverseTrersal(e)}getIterator(){returnnewaf(this.root,null,this.comparator,!1)}getIteratorFrom(e){returnnewaf(this.root,e,this.comparator,!1)}getReverseIterator(){returnnewaf(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){returnnewaf(this.root,e,this.comparator,!0)}}classaf{constructor(e,t,n,i){this.isReverse=i,this.nodeStack=[];lets=1;for(;!e.isEmpty();)if(s=t?n(e.key,t):1,t&&i&&(s*=-1),s0}peek(){if(0===this.nodeStack.length)returnnull;conste=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}classcf{constructor(e,t,n,i,s){this.key=e,this.value=t,this.color=null!=n?n:cf.RED,this.left=null!=i?i:cf.EMPTY,this.right=null!=s?s:cf.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,i,s){returnnewcf(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=i?i:this.left,null!=s?s:this.right)}isEmpty(){return!1}inorderTrersal(e){returnthis.left.inorderTrersal(e)||e(this.key,this.value)||this.right.inorderTrersal(e)}reverseTrersal(e){returnthis.right.reverseTrersal(e)||e(this.key,this.value)||this.left.reverseTrersal(e)}min(){returnthis.left.isEmpty()?this:this.left.min()}minKey(){returnthis.min().key}maxKey(){returnthis.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){leti=this;consts=n(e,i.key);returni=s{e.push(t)})),e}toString(){conste=[];returnthis.forEach((t=>e.push(t))),"SortedSet("+e.toString()+")"}copy(e){constt=newlf(this.comparator);returnt.data=e,t}}classuf{constructor(e){this.iter=e}getNext(){returnthis.iter.getNext().key}hasNext(){returnthis.iter.hasNext()}}functionhf(e){returne.hasNext()?e.getNext():void0}classdf{constructor(e){this.fields=e,e.sort(Xd.comparator)}staticempty(){returnnewdf([])}unionWith(e){lett=newlf(Xd.comparator);for(constnofthis.fields)t=t.add(n);for(constnofe)t=t.add(n);returnnewdf(t.toArray())}covers(e){for(consttofthis.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){returnGd(this.fields,e.fields,((e,t)=>e.isEqual(t)))}}classpfextendsError{constructor(){super(...arguments),this.name="Base64DecodeError"}}classff{constructor(e){this.binaryString=e}staticfromBase64String(e){constt=function(e){try{returnatob(e)}catch(t){throw"undefined"!=typeofDOMException&&tinstanceofDOMException?newpf("Invalidbase64string:"+t):t}}(e);returnnewff(t)}staticfromUint8Array(e){constt=function(e){lett="";for(letn=0;nee.concat(t.getFlattenedFilters())),[])),this.ce}getFilters(){returnObject.assign([],this.filters)}getFirstInequalityField(){conste=this.le((e=>e.isInequality()));returnnull!==e?e.field:null}le(e){for(consttofthis.getFlattenedFilters())if(e(t))returnt;returnnull}}functionnm(e){return"and"===e.op}functionim(e){return"or"===e.op}functionsm(e){returnrm(e)&&nm(e)}functionrm(e){for(consttofe.filters)if(tinstanceoftm)return!1;return!0}functionom(e){if(einstanceofem)returne.field.canonicalString()+e.op.toString()+Pf(e.value);if(sm(e))returne.filters.map((e=>om(e))).join(",");{constt=e.filters.map((e=>om(e))).join(",");return"".concat(e.op,"(").concat(t,")")}}functionam(e,t){returneinstanceofem?(n=e,(i=t)instanceofem&&n.op===i.op&&n.field.isEqual(i.field)&&Cf(n.value,i.value)):einstanceoftm?function(e,t){returntinstanceoftm&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce(((e,n,i)=>e&&am(n,t.filters[i])),!0)}(e,t):voidCd();varn,i}functioncm(e,t){constn=e.filters.concat(t);returntm.create(n,e.op)}functionlm(e){returneinstanceofem?"".concat((t=e).field.canonicalString(),"").concat(t.op,"").concat(Pf(t.value)):einstanceoftm?function(e){returne.op.toString()+"{"+e.getFilters().map(lm).join(",")+"}"}(e):"Filter";vart}classumextendsem{constructor(e,t,n){super(e,t,n),this.key=Zd.fromName(n.referenceValue)}matches(e){constt=Zd.comparator(e.key,this.key);returnthis.matchesComparison(t)}}classhmextendsem{constructor(e,t){super(e,"in",t),this.keys=pm("in",t)}matches(e){returnthis.keys.some((t=>t.isEqual(e.key)))}}classdmextendsem{constructor(e,t){super(e,"not-in",t),this.keys=pm("not-in",t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}}functionpm(e,t){varn;return((null===(n=t.arrayValue)||void0===n?void0:n.values)||[]).map((e=>Zd.fromName(e.referenceValue)))}classfmextendsem{constructor(e,t){super(e,"array-contains",t)}matches(e){constt=e.data.field(this.field);returnMf(t)&&Af(t.arrayValue,this.value)}}classmmextendsem{constructor(e,t){super(e,"in",t)}matches(e){constt=e.data.field(this.field);returnnull!==t&&Af(this.value.arrayValue,t)}}classgmextendsem{constructor(e,t){super(e,"not-in",t)}matches(e){if(Af(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;constt=e.data.field(this.field);returnnull!==t&&!Af(this.value.arrayValue,t)}}classymextendsem{constructor(e,t){super(e,"array-contains-any",t)}matches(e){constt=e.data.field(this.field);return!(!Mf(t)||!t.arrayValue.values)&&t.arrayValue.values.some((e=>Af(this.value.arrayValue,e)))}}classvm{constructor(e,t=null,n=[],i=[],s=null,r=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=i,this.limit=s,this.startAt=r,this.endAt=o,this.he=null}}functionwm(e,t=null,n=[],i=[],s=null,r=null,o=null){returnnewvm(e,t,n,i,s,r,o)}function_m(e){constt=Nd(e);if(null===t.he){lete=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map((e=>om(e))).join(","),e+="|ob:",e+=t.orderBy.map((e=>{return(t=e).field.canonicalString()+t.dir;vart})).join(","),Sp(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((e=>Pf(e))).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((e=>Pf(e))).join(",")),t.he=e}returnt.he}functionbm(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(letn=0;n0?e.explicitOrderBy[0].field:null}functionPm(e){for(consttofe.filters){conste=t.getFirstInequalityField();if(null!==e)returne}returnnull}functionDm(e){returnnull!==e.collectionGroup}functionOm(e){constt=Nd(e);if(null===t.Pe){t.Pe=[];conste=Pm(t),n=xm(t);if(null!==e&&null===n)e.isKeyField()||t.Pe.push(newXf(e)),t.Pe.push(newXf(Xd.keyField(),"asc"));else{lete=!1;for(constnoft.explicitOrderBy)t.Pe.push(n),n.field.isKeyField()&&(e=!0);if(!e){conste=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc";t.Pe.push(newXf(Xd.keyField(),e))}}}returnt.Pe}functionRm(e){constt=Nd(e);returnt.Ie||(t.Ie=function(e,t){if("F"===e.limitType)returnwm(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map((e=>{constt="desc"===e.dir?"asc":"desc";returnnewXf(e.field,t)}));constn=e.endAt?newQf(e.endAt.position,e.endAt.inclusive):null,i=e.startAt?newQf(e.startAt.position,e.startAt.inclusive):null;returnwm(e.path,e.collectionGroup,t,e.filters,e.limit,n,i)}}(t,Om(e))),t.Ie}functionMm(e,t){t.getFirstInequalityField(),Pm(e);constn=e.filters.concat([t]);returnnewkm(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}functionLm(e,t,n){returnnewkm(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}functionFm(e,t){returnbm(Rm(e),Rm(t))&&e.limitType===t.limitType}functionVm(e){return"".concat(_m(Rm(e)),"|lt:").concat(e.limitType)}functionUm(e){return"Query(target=".concat(function(e){lett=e.path.canonicalString();returnnull!==e.collectionGroup&&(t+="collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=",filters:[".concat(e.filters.map((e=>lm(e))).join(","),"]")),Sp(e.limit)||(t+=",limit:"+e.limit),e.orderBy.length>0&&(t+=",orderBy:[".concat(e.orderBy.map((e=>{return"".concat((t=e).field.canonicalString(),"(").concat(t.dir,")");vart})).join(","),"]")),e.startAt&&(t+=",startAt:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((e=>Pf(e))).join(",")),e.endAt&&(t+=",endAt:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((e=>Pf(e))).join(",")),"Target(".concat(t,")")}(Rm(e)),";limitType=").concat(e.limitType,")")}functionjm(e,t){returnt.isFoundDocument()&&function(e,t){constn=t.key.path;returnnull!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):Zd.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(constnofOm(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(constnofe.filters)if(!n.matches(t))return!1;return!0}(e,t)&&(i=t,!((n=e).startAt&&!function(e,t,n){consti=Yf(e,t,n);returne.inclusive?i0}(n.endAt,Om(n),i)));varn,i}functionBm(e){returne.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}functionqm(e){return(t,n)=>{leti=!1;for(constsofOm(e)){conste=zm(s,t,n);if(0!==e)returne;i=i||s.field.isKeyField()}return0}}functionzm(e,t,n){consti=e.field.isKeyField()?Zd.comparator(t.key,n.key):function(e,t,n){consti=t.data.field(e),s=n.data.field(e);returnnull!==i&&null!==s?Nf(i,s):Cd()}(e.field,t,n);switch(e.dir){case"asc":returni;case"desc":return-1*i;default:returnCd()}}classGm{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){constt=this.mapKeyFn(e),n=this.inner[t];if(void0!==n)for(const[i,s]ofn)if(this.equalsFn(i,e))returns}has(e){returnvoid0!==this.get(e)}set(e,t){constn=this.mapKeyFn(e),i=this.inner[n];if(void0===i)returnthis.inner[n]=[[e,t]],voidthis.innerSize++;for(lets=0;st=t.insert(e,n.overlayedDocument))),t}functionJm(){returnZm()}functionXm(){returnZm()}functionZm(){returnnewGm((e=>e.toString()),((e,t)=>e.isEqual(t)))}const$m=newof(Zd.comparator),eg=newlf(Zd.comparator);functiontg(...e){lett=eg;for(constnofe)t=t.add(n);returnt}constng=newlf(zd);functionig(){returnng}functionsg(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Ep(t)?"-0":t}}functionrg(e){return{integerValue:""+e}}functionog(e,t){returnkp(t)?rg(t):sg(e,t)}class{constructor(){this._=void0}}functioncg(e,t,n){returneinstanceofhg?function(e,t){constn={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};returnt&&wf(t)&&(t=_f(t)),t&&(n.fields.__previous_value__=t),{mapValue:n}}(n,t):einstanceofdg?pg(e,t):einstanceoffg?mg(e,t):function(e,t){constn=ug(e,t),i=yg(n)+yg(e.Te);returnRf(n)&&Rf(e.Te)?rg(i):sg(e.serializer,i)}(e,t)}functionlg(e,t,n){returneinstanceofdg?pg(e,t):einstanceoffg?mg(e,t):n}functionug(e,t){returneinstanceofgg?Rf(n=t)||(i=n)&&"doubleValue"ini?t:{integerValue:0}:null;varn,i}classhgextends{}classdgextends{constructor(e){super(),this.elements=e}}functionpg(e,t){constn=vg(t);for(constiofe.elements)n.some((e=>Cf(e,i)))||n.push(i);return{arrayValue:{values:n}}}classfgextends{constructor(e){super(),this.elements=e}}functionmg(e,t){letn=vg(t);for(constiofe.elements)n=n.filter((e=>!Cf(e,i)));return{arrayValue:{values:n}}}classggextends{constructor(e,t){super(),this.serializer=e,this.Te=t}}functionyg(e){returnyf(e.integerValue||e.doubleValue)}functionvg(e){returnMf(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}classwg{constructor(e,t){this.field=e,this.transform=t}}class_g{constructor(e,t){this.version=e,this.transformResults=t}}classbg{constructor(e,t){this.updateTime=e,this.exists=t}staticnone(){returnnewbg}staticexists(e){returnnewbg(void0,e)}staticupdateTime(e){returnnewbg(e)}getisNone(){returnvoid0===this.updateTime&&void0===this.exists}isEqual(e){returnthis.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}functionIg(e,t){returnvoid0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void0===e.exists||e.exists===t.isFoundDocument()}classTg{}functionSg(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)returnnull;if(null===t)returne.isNoDocument()?newRg(e.key,bg.none()):newNg(e.key,e.data,bg.none());{constn=e.data,i=Kf.empty();lets=newlf(Xd.comparator);for(leteoft.fields)if(!s.has(e)){lett=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?i.delete(e):i.set(e,t),s=s.add(e)}returnnewxg(e.key,i,newdf(s.toArray()),bg.none())}}functionEg(e,t,n){vari;einstanceofNg?function(e,t,n){consti=e.value.clone(),s=Dg(e.fieldTransforms,t,n.transformResults);i.setAll(s),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):einstanceofxg?function(e,t,n){if(!Ig(e.precondition,t))returnvoidt.convertToUnknownDocument(n.version);consti=Dg(e.fieldTransforms,t,n.transformResults),s=t.data;s.setAll(Pg(e)),s.setAll(i),t.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(e,t,n):(i=n,t.convertToNoDocument(i.version).setHasCommittedMutations())}functionkg(e,t,n,i){returneinstanceofNg?function(e,t,n,i){if(!Ig(e.precondition,t))returnn;consts=e.value.clone(),r=Og(e.fieldTransforms,i,t);returns.setAll(r),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null}(e,t,n,i):einstanceofxg?function(e,t,n,i){if(!Ig(e.precondition,t))returnn;consts=Og(e.fieldTransforms,i,t),r=t.data;returnr.setAll(Pg(e)),r.setAll(s),t.convertToFoundDocument(t.version,r).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e=>e.field)))}(e,t,n,i):(s=t,r=n,Ig(e.precondition,s)?(s.convertToNoDocument(s.version).setHasLocalMutations(),null):r);vars,r}functionCg(e,t){letn=null;for(constiofe.fieldTransforms){conste=t.data.field(i.field),s=ug(i.transform,e||null);null!=s&&(null===n&&(n=Kf.empty()),n.set(i.field,s))}returnn||null}function(e,t){returne.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&(n=e.fieldTransforms,i=t.fieldTransforms,!!(void0===n&&void0===i||n&&i&&Gd(n,i,((e,t)=>function(e,t){returne.field.isEqual(t.field)&&(n=e.transform,i=t.transform,ninstanceofdg&&iinstanceofdg||ninstanceoffg&&iinstanceoffg?Gd(n.elements,i.elements,Cf):ninstanceofgg&&iinstanceofgg?Cf(n.Te,i.Te):ninstanceofhg&&iinstanceofhg);varn,i}(e,t))))&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask)));varn,i}classNgextendsTg{constructor(e,t,n,i=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){returnnull}}classxgextendsTg{constructor(e,t,n,i,s=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){returnthis.fieldMask}}functionPg(e){constt=newMap;returne.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){consti=e.data.field(n);t.set(n,i)}})),t}functionDg(e,t,n){consti=newMap;Ad(e.length===n.length);for(lets=0;se.add(t.key)),tg())}isEqual(e){returnthis.batchId===e.batchId&&Gd(this.mutations,e.mutations,((e,t)=>(e,t)))&&Gd(this.baseMutations,e.baseMutations,((e,t)=>(e,t)))}}classFg{constructor(e,t,n,i){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=i}staticfrom(e,t,n){Ad(e.mutations.length===n.length);leti=$m;consts=e.mutations;for(letr=0;r{consts=this.Qe.st(),r="projects/".concat(s.projectId,"/databases/").concat(s.database,"/documents/").concat(n.path.canonicalString());e.mightContain(r)||(this.je(t,n,null),i++)})),i}_t(e){constt=newMap;this.Ke.forEach(((n,i)=>{consts=this.et(i);if(s){if(n.current&&Im(s.target)){constt=newZd(s.target.path);null!==this.$e.get(t)||this.ut(i,t)||this.je(i,t,Wf.newNoDocument(t,e))}n.Fe&&(t.set(i,n.xe()),n.Oe())}}));letn=tg();this.Ue.forEach(((e,t)=>{leti=!0;t.forEachWhile((e=>{constt=this.et(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(i=!1,!1)})),i&&(n=n.add(e))})),this.$e.forEach(((t,n)=>n.setReadTime(e)));consti=newJg(e,t,this.We,this.$e,n);returnthis.$e=Hm(),this.Ue=iy(),this.We=newof(zd),i}ze(e,t){if(!this.Ye(e))return;constn=this.ut(e,t.key)?2:0;this.Je(e).Ne(t.key,n),this.$e=this.$e.insert(t.key,t),this.Ue=this.Ue.insert(t.key,this.ct(t.key).add(e))}je(e,t,n){if(!this.Ye(e))return;consti=this.Je(e);this.ut(e,t)?i.Ne(t,1):i.Be(t),this.Ue=this.Ue.insert(t,this.ct(t).delete(e)),n&&(this.$e=this.$e.insert(t,n))}removeTarget(e){this.Ke.delete(e)}tt(e){constt=this.Je(e).xe();returnthis.Qe.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Le(e){this.Je(e).Le()}Je(e){lett=this.Ke.get(e);returnt||(t=newty,this.Ke.set(e,t)),t}ct(e){lett=this.Ue.get(e);returnt||(t=newlf(zd),this.Ue=this.Ue.insert(e,t)),t}Ye(e){constt=null!==this.et(e);returnt||Td("WatchChangegregator","Detectedinactivetarget",e),t}et(e){constt=this.Ke.get(e);returnt&&t.ve?null:this.Qe.lt(e)}Ze(e){this.Ke.set(e,newty),this.Qe.getRemoteKeysForTarget(e).forEach((t=>{this.je(e,t,null)}))}ut(e,t){returnthis.Qe.getRemoteKeysForTarget(e).has(t)}}functioniy(){returnnewof(Zd.comparator)}functionsy(){returnnewof(Zd.comparator)}constry={asc:"ASCENDING",desc:"DESCENDING"},oy={"=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},ay={and:"AND",or:"OR"};classcy{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}functionly(e,t){returne.useProto3Json||Sp(t)?t:{value:t}}functionuy(e,t){returne.useProto3Json?"".concat(newDate(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z",""),".").concat(("0"+t.nanoseconds).slice(-9),"Z"):{seconds:""+t.seconds,nanos:t.nanoseconds}}functionhy(e,t){returne.useProto3Json?t.toBase64():t.toUint8Array()}functiondy(e,t){returnuy(e,t.toTimestamp())}functionpy(e){returnAd(!!e),Wd.fromTimestamp(function(e){constt=gf(e);returnnewHd(t.seconds,t.nanos)}(e))}functionfy(e,t){return(n=e,newYd(["projects",n.projectId,"databases",n.database])).child("documents").child(t).canonicalString();varn}functionmy(e){constt=Yd.fromString(e);returnAd(FyUn Murmur morbido(t)),t}functiongy(e,t){returnfy(e.databaseId,t.path)}functionyy(e,t){constn=my(t);if(n.get(1)!==e.databaseId.projectId)thrownewPd(xd.INVALID_ARGUMENT,"Triedtodeserializekeyfromdifferentproject:"+n.get(1)+"vs"+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)thrownewPd(xd.INVALID_ARGUMENT,"Triedtodeserializekeyfromdifferentdatabase:"+n.get(3)+"vs"+e.databaseId.database);returnnewZd(by(n))}functionvy(e,t){returnfy(e.databaseId,t)}functionwy(e){constt=my(e);return4===t.length?Yd.emptyPath():by(t)}function_y(e){returnnewYd(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}functionby(e){returnAd(e.length>4&&"documents"===e.get(4)),e.popFirst(5)}functionIy(e,t,n){return{name:gy(e,t),fields:n.value.mapValue.fields}}functionTy(e,t,n){consti=yy(e,t.name),s=py(t.updateTime),r=t.createTime?py(t.createTime):Wd.min(),o=newKf({mapValue:{fields:t.fields}}),a=Wf.newFoundDocument(i,s,r,o);returnn&&a.setHasCommittedMutations(),n?a.setHasCommittedMutations():a}functionSy(e,t){letn;if(tinstanceofNg)n={update:Iy(e,t.key,t.value)};elseif(tinstanceofRg)n={delete:gy(e,t.key)};elseif(tinstanceofxg)n={update:Iy(e,t.key,t.data),updateMask:Ly(t.fieldMask)};else{if(!(tinstanceofMg))returnCd();n={verify:gy(e,t.key)}}returnt.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map((e=>function(e,t){constn=t.transform;if(ninstanceofhg)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(ninstanceofdg)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(ninstanceoffg)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(ninstanceofgg)return{fieldPath:t.field.canonicalString(),increment:n.Te};throwCd()}(0,e)))),t.precondition.isNone||(n.currentDocument=(i=e,void0!==(s=t.precondition).updateTime?{updateTime:dy(i,s.updateTime)}:void0!==s.exists?{exists:s.exists}:Cd())),n;vari,s}functionEy(e,t){constn=t.currentDocument?void0!==(s=t.currentDocument).updateTime?bg.updateTime(py(s.updateTime)):void0!==s.exists?bg.exists(s.exists):bg.none():bg.none(),i=t.updateTransforms?t.updateTransforms.map((t=>function(e,t){letn=null;if("setToServerValue"int)Ad("REQUEST_TIME"===t.setToServerValue),n=newhg;elseif("appendMissingElements"int){conste=t.appendMissingElements.values||[];n=newdg(e)}elseif("removeAllFromArray"int){conste=t.removeAllFromArray.values||[];n=newfg(e)}else"increment"int?n=newgg(e,t.increment):Cd();consti=Xd.fromServerFormat(t.fieldPath);returnnewwg(i,n)}(e,t))):[];vars;if(t.update){t.update.name;consts=yy(e,t.update.name),r=newKf({mapValue:{fields:t.update.fields}});if(t.updateMask){conste=function(e){constt=e.fieldPaths||[];returnnewdf(t.map((e=>Xd.fromServerFormat(e))))}(t.updateMask);returnnewxg(s,r,e,n,i)}returnnewNg(s,r,n,i)}if(t.delete){consti=yy(e,t.delete);returnnewRg(i,n)}if(t.verify){consti=yy(e,t.verify);returnnewMg(i,n)}returnCd()}functionky(e,t){return{documents:[vy(e,t.path)]}}functionCy(e,t){constn={structuredQuery:{}},i=t.path;null!==t.collectionGroup?(n.parent=vy(e,i),n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(n.parent=vy(e,i.popLast()),n.structuredQuery.from=[{collectionId:i.lastSegment()}]);consts=function(e){if(0!==e.length)returnMy(tm.create(e,"and"))}(t.filters);s&&(n.structuredQuery.where=s);constr=function(e){if(0!==e.length)returne.map((e=>{return{field:Oy((t=e).field),direction:xy(t.dir)};vart}))}(t.orderBy);r&&(n.structuredQuery.orderBy=r);consto=ly(e,t.limit);returnnull!==o&&(n.structuredQuery.limit=o),t.startAt&&(n.structuredQuery.startAt={before:(a=t.startAt).inclusive,values:a.position}),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),n;vara}functionAy(e){lett=wy(e.parent);constn=e.structuredQuery,i=n.from?n.from.length:0;lets=null;if(i>0){Ad(1===i);conste=n.from[0];e.allDescendants?s=e.collectionId:t=t.child(e.collectionId)}letr=[];n.where&&(r=function(e){constt=Ny(e);returntinstanceoftm&&sm(t)?t.getFilters():[t]}(n.where));leto=[];n.orderBy&&(o=n.orderBy.map((e=>{returnnewXf(Ry((t=e).field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction));vart})));leta=null;n.limit&&(a=function(e){lett;returnt="object"==typeofe?e.value:e,Sp(t)?null:t}(n.limit));letc=null;n.startAt&&(c=function(e){constt=!!e.before,n=e.values||[];returnnewQf(n,t)}(n.startAt));letl=null;returnn.endAt&&(l=function(e){constt=!e.before,n=e.values||[];returnnewQf(n,t)}(n.endAt)),Cm(t,s,o,r,a,"F",c,l)}functionNy(e){returnvoid0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":constt=Ry(e.unaryFilter.field);returnem.create(t,"==",{doubleValue:NaN});case"IS_NULL":constn=Ry(e.unaryFilter.field);returnem.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":consti=Ry(e.unaryFilter.field);returnem.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":consts=Ry(e.unaryFilter.field);returnem.create(s,"!=",{nullValue:"NULL_VALUE"});default:returnCd()}}(e):void0!==e.fieldFilter?(t=e,em.create(Ry(t.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"").concat(n)),1))}Vi(){null!==this.document&&"function"==typeofthis.document.addEventListener&&(this.hi=()=>{this._i.enqueueAndForget((()=>(this.inForeground="visible"===this.document.visibilityState,this.Ri())))},this.document.addEventListener("visibilitychange",this.hi),this.inForeground="visible"===this.document.visibilityState)}Ni(){this.hi&&(this.document.removeEventListener("visibilitychange",this.hi),this.hi=null)}mi(){vare;"function"==typeof(null===(e=this.window)||void0===e?void0:e.addEventListener)&&(this.li=()=>{this.Oi();conste=/(?:Version|Mobile)\/1[456]/;!bt()&&nigator.userent.includes("Safari")&&!nigator.userent.includes("Chrome")&&(nigator.appVersion.match(e)||nigator.userent.match(e))&&this._i.enterRestrictedMode(!0),this._i.enqueueAndForget((()=>this.shutdown()))},this.window.addEventListener("pehide",this.li))}Bi(){this.li&&(this.window.removeEventListener("pehide",this.li),this.li=null)}xi(e){vart;try{constn=null!==(null===(t=this.Ai)||void0===t?void0:t.getItem(this.Mi(e)));returnTd("IndexedDbPersistence","Client'".concat(e,"'").concat(n?"is":"isnot","zombiedinLocalStore")),n}catch(n){returnSd("IndexedDbPersistence","Failedtogetzombiedclientid.",n),!1}}Oi(){if(this.Ai)try{this.Ai.setItem(this.Mi(this.clientId),String(Date.now()))}catch(KS){Sd("Failedtosetzombieclientid.",KS)}}Li(){if(this.Ai)try{this.Ai.removeItem(this.Mi(this.clientId))}catch(KS){}}Mi(e){return"firestore_zombie_".concat(this.persistenceKey,"_").concat(e)}}functionTw(e){returntf(e,"owner")}functionSw(e){returntf(e,"clientMetadata")}functionEw(e,t){letn=e.projectId;returne.isDefaultDatabase||(n+="."+e.database),"firestore/"+t+"/"+n+"/"}classkw{constructor(e,t,n,i){this.targetId=e,this.fromCache=t,this.Qi=n,this.Ki=i}static$i(e,t){letn=tg(),i=tg();for(constsoft.docChanges)switch(s.type){case0:n=n.add(s.doc.key);break;case1:i=i.add(s.doc.key)}returnnewkw(e,t.fromCache,n,i)}}classCw{constructor(){this._documentReadCount=0}getdocumentReadCount(){returnthis._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}classAw{constructor(){this.Ui=!1,this.Wi=!1,this.Gi=100,this.zi=2}initialize(e,t){this.ji=e,this.indexManer=t,this.Ui=!0}getDocumentsMatchingQuery(e,t,n,i){consts={result:null};returnthis.Hi(e,t).next((e=>{s.result=e})).next((()=>{if(!s.result)returnthis.Ji(e,t,i,n).next((e=>{s.result=e}))})).next((()=>{if(s.result)return;constn=newCw;returnthis.Yi(e,t,n).next((i=>{if(s.result=i,this.Wi)returnthis.Zi(e,t,n,i.size)}))})).next((()=>s.result))}Zi(e,t,n,i){returnn.documentReadCountthis.indexManer.getMinOffset(e,n).next((n=>{constr=this.Xi(t,i);returnthis.es(t,r,s,n.readTime)?this.Hi(e,Lm(t,null,"F")):this.ts(e,r,t,n)}))))})))))}Ji(e,t,n,i){returnNm(t)||i.isEqual(Wd.min())?hp.resolve(null):this.ji.getDocuments(e,n).next((s=>{constr=this.Xi(t,s);returnthis.es(t,r,n,i)?hp.resolve(null):(Id()e)))}))}Xi(e,t){letn=newlf(qm(e));returnt.forEach(((t,i)=>{jm(e,i)&&(n=n.add(i))})),n}es(e,t,n,i){if(null===e.limit)return!1;if(n.size!==t.size)return!0;consts="F"===e.limitType?t.last():t.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}Yi(e,t,n){returnId()(t.forEach((t=>{e=e.insert(t.key,t)})),e)))}}classNw{constructor(e,t,n,i){this.persistence=e,this.ns=t,this.serializer=i,this.rs=newof(zd),this.ss=newGm((e=>_m(e)),bm),this.os=newMap,this._s=e.getRemoteDocumentCache(),this.Kr=e.getTargetCache(),this.Ur=e.getBundleCache(),this.us(n)}us(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManer=this.persistence.getIndexManer(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManer),this.localDocuments=newaw(this._s,this.mutationQueue,this.documentOverlayCache,this.indexManer),this._s.setIndexManer(this.indexManer),this.ns.initialize(this.localDocuments,this.indexManer)}collectGarbe(e){returnthis.persistence.runTransaction("Collectgarbe","readwrite-primary",(t=>e.collect(t,this.rs)))}}functionxw(e,t,n,i){returnnewNw(e,t,n,i)}asyncfunctionPw(e,t){constn=Nd(e);returnawaitn.persistence.runTransaction("Handleuserchange","readonly",(e=>{leti;returnn.mutationQueue.getAllMutationBatches(e).next((s=>(i=s,n.us(t),n.mutationQueue.getAllMutationBatches(e)))).next((t=>{consts=[],r=[];leto=tg();for(consteofi){s.push(e.batchId);for(consttofe.mutations)o=o.add(t.key)}for(consteoft){r.push(e.batchId);for(consttofe.mutations)o=o.add(t.key)}returnn.localDocuments.getDocuments(e,o).next((e=>({cs:e,removedBatchIds:s,addedBatchIds:r})))}))}))}functionDw(e){constt=Nd(e);returnt.persistence.runTransaction("Getlastremotesnapshotversion","readonly",(e=>t.Kr.getLastRemoteSnapshotVersion(e)))}functionOw(e,t,n){leti=tg(),s=tg();returnn.forEach((e=>i=i.add(e))),t.getEntries(e,i).next((e=>{leti=Hm();returnn.forEach(((n,r)=>{consto=e.get(n);r.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),r.isNoDocument()&&r.version.isEqual(Wd.min())?(t.removeEntry(n,r.readTime),i=i.insert(n,r)):!o.isValidDocument()||r.version.compareTo(o.version)>0||0===r.version.compareTo(o.version)&&o.hasPendingWrites?(t.addEntry(r),i=i.insert(n,r)):Td("LocalStore","Ignoringoutdatedwatchupdatefor",n,".Currentversion:",o.version,"Watchversion:",r.version)})),{ls:i,hs:s}}))}functionRw(e,t){constn=Nd(e);returnn.persistence.runTransaction("Getnextmutationbatch","readonly",(e=>(void0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t))))}functionMw(e,t){constn=Nd(e);returnn.persistence.runTransaction("Allocatetarget","readwrite",(e=>{leti;returnn.Kr.getTargetData(e,t).next((s=>s?(i=s,hp.resolve(i)):n.Kr.allocateTargetId(e).next((s=>(i=newVy(t,s,"TargetPurposeListen",e.currentSequenceNumber),n.Kr.addTargetData(e,i).next((()=>i)))))))})).then((e=>{consti=n.rs.get(e.targetId);return(null===i||e.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.rs=n.rs.insert(e.targetId,e),n.ss.set(t,e.targetId)),e}))}asyncfunctionLw(e,t,n){consti=Nd(e),s=i.rs.get(t),r=n?"readwrite":"readwrite-primary";try{n||awaiti.persistence.runTransaction("Releasetarget",r,(e=>i.persistence.referenceDelegate.removeTarget(e,s)))}catch(o){if(!gp(o))throwo;Td("LocalStore","Failedtoupdatesequencenumbersfortarget".concat(t,":").concat(o))}i.rs=i.rs.remove(t),i.ss.delete(s.target)}functionFw(e,t,n){consti=Nd(e);lets=Wd.min(),r=tg();returni.persistence.runTransaction("Executequery","readwrite",(e=>function(e,t,n){consti=Nd(e),s=i.ss.get(n);returnvoid0!==s?hp.resolve(i.rs.get(s)):i.Kr.getTargetData(t,n)}(i,e,Rm(t)).next((t=>{if(t)returns=t.lastLimboFreeSnapshotVersion,i.Kr.getMatchingKeysForTargetId(e,t.targetId).next((e=>{r=e}))})).next((()=>i.ns.getDocumentsMatchingQuery(e,t,n?s:Wd.min(),n?r:tg()))).next((e=>(jw(i,Bm(t),e),{documents:e,Ps:r})))))}functionVw(e,t){constn=Nd(e),i=Nd(n.Kr),s=n.rs.get(t);returns?Promise.resolve(s.target):n.persistence.runTransaction("Gettargetdata","readonly",(e=>i.lt(e,t).next((e=>e?e.target:null))))}functionUw(e,t){constn=Nd(e),i=n.os.get(t)||Wd.min();returnn.persistence.runTransaction("Getnewdocumentchanges","readonly",(e=>n._s.getAllFromCollectionGroup(e,t,sp(i,-1),Number.MAX_SAFE_INTEGER))).then((e=>(jw(n,t,e),e)))}functionjw(e,t,n){leti=e.os.get(t)||Wd.min();n.forEach(((e,t)=>{t.readTime.compareTo(i)>0&&(i=t.readTime)})),e.os.set(t,i)}asyncfunctionBw(e,t,n=tg()){consti=awaitMw(e,Rm(Wy(t.bundledQuery))),s=Nd(e);returns.persistence.runTransaction("Senamedquery","readwrite",(e=>{constr=py(t.readTime);if(i.snapshotVersion.compareTo(r)>=0)returns.Ur.seNamedQuery(e,t);consto=i.withResumeToken(ff.EMPTY_BYTE_STRING,r);returns.rs=s.rs.insert(o.targetId,o),s.Kr.updateTargetData(e,o).next((()=>s.Kr.removeMatchingKeysForTargetId(e,i.targetId))).next((()=>s.Kr.addMatchingKeys(e,n,i.targetId))).next((()=>s.Ur.seNamedQuery(e,t)))}))}functionqw(e,t){return"firestore_clients_".concat(e,"_").concat(t)}functionzw(e,t,n){leti="firestore_mutations_".concat(e,"_").concat(n);returnt.isAuthenticated()&&(i+="_".concat(t.uid)),i}functionGw(e,t){return"firestore_targets_".concat(e,"_").concat(t)}classKw{constructor(e,t,n,i){this.user=e,this.batchId=t,this.state=n,this.error=i}staticEs(e,t,n){consti=JSON.parse(n);lets,r="object"==typeofi&&-1!==["pending","acknowledged","rejected"].indexOf(i.state)&&(void0===i.error||"object"==typeofi.error);returnr&&i.error&&(r="string"==typeofi.error.messe&&"string"==typeofi.error.code,r&&(s=newPd(i.error.code,i.error.messe))),r?newKw(e,t,i.state,s):(Sd("SharedClientState","FailedtoparsemutationstateforID'".concat(t,"':").concat(n)),null)}As(){conste={state:this.state,updateTimeMs:Date.now()};returnthis.error&&(e.error={code:this.error.code,messe:this.error.messe}),JSON.stringify(e)}}classHw{constructor(e,t,n){this.targetId=e,this.state=t,this.error=n}staticEs(e,t){constn=JSON.parse(t);leti,s="object"==typeofn&&-1!==["not-current","current","rejected"].indexOf(n.state)&&(void0===n.error||"object"==typeofn.error);returns&&n.error&&(s="string"==typeofn.error.messe&&"string"==typeofn.error.code,s&&(i=newPd(n.error.code,n.error.messe))),s?newHw(e,n.state,i):(Sd("SharedClientState","FailedtoparsetargetstateforID'".concat(e,"':").concat(t)),null)}As(){conste={state:this.state,updateTimeMs:Date.now()};returnthis.error&&(e.error={code:this.error.code,messe:this.error.messe}),JSON.stringify(e)}}classWw{constructor(e,t){this.clientId=e,this.activeTargetIds=t}staticEs(e,t){constn=JSON.parse(t);leti="object"==typeofn&&n.activeTargetIdsinstanceofArray,s=ig();for(letr=0;i&&rthis.shutdown())),this.started=!0}writeSequenceNumber(e){this.setItem(this.bs,JSON.stringify(e))}getAllActiveQueryTargets(){returnthis.Bs(this.ys)}isActiveQueryTarget(e){lett=!1;returnthis.ys.forEach(((n,i)=>{i.activeTargetIds.has(e)&&(t=!0)})),t}addPendingMutation(e){this.Ls(e,"pending")}updateMutationState(e,t,n){this.Ls(e,t,n),this.ks(e)}addLocalQueryTarget(e){lett="not-current";if(this.isActiveQueryTarget(e)){constn=this.store.getItem(Gw(this.persistenceKey,e));if(n){consti=Hw.Es(e,n);i&&(t=i.state)}}returnthis.qs.Rs(e),this.xs(),t}removeLocalQueryTarget(e){this.qs.Vs(e),this.xs()}isLocalQueryTarget(e){returnthis.qs.activeTargetIds.has(e)}clearQueryState(e){this.removeItem(Gw(this.persistenceKey,e))}updateQueryState(e,t,n){this.Qs(e,t,n)}handleUserChange(e,t,n){t.forEach((e=>{this.ks(e)})),this.currentUser=e,n.forEach((e=>{this.addPendingMutation(e)}))}setOnlineState(e){this.Ks(e)}notifyBundleLoaded(e){this.$s(e)}shutdown(){this.started&&(this.window.removeEventListener("store",this.gs),this.removeItem(this.Ss),this.started=!1)}getItem(e){constt=this.store.getItem(e);returnTd("SharedClientState","READ",e,t),t}setItem(e,t){Td("SharedClientState","SET",e,t),this.store.setItem(e,t)}removeItem(e){Td("SharedClientState","REMOVE",e),this.store.removeItem(e)}ps(e){constt=e;if(t.storeArea===this.store){if(Td("SharedClientState","EVENT",t.key,t.newValue),t.key===this.Ss)returnvoidSd("ReceivedWebStorenotificationforlocalchange.Anotherclientmighthegarbe-collectedourstate");this._i.enqueueRetryable((async()=>{if(this.started){if(null!==t.key)if(this.Ds.test(t.key)){if(null==t.newValue){conste=this.Us(t.key);returnthis.Ws(e,null)}{conste=this.Gs(t.key,t.newValue);if(e)returnthis.Ws(e.clientId,e)}}elseif(this.Cs.test(t.key)){if(null!==t.newValue){conste=this.zs(t.key,t.newValue);if(e)returnthis.js(e)}}elseif(this.vs.test(t.key)){if(null!==t.newValue){conste=this.Hs(t.key,t.newValue);if(e)returnthis.Js(e)}}elseif(t.key===this.Fs){if(null!==t.newValue){conste=this.Os(t.newValue);if(e)returnthis.Ns(e)}}elseif(t.key===this.bs){conste=function(e){lett=Tp.ae;if(null!=e)try{constn=JSON.parse(e);Ad("number"==typeofn),t=n}catch(n){Sd("SharedClientState","FailedtoreadsequencenumberfromWebStore",n)}returnt}(t.newValue);e!==Tp.ae&&this.sequenceNumberHandler(e)}elseif(t.key===this.Ms){conste=this.Ys(t.newValue);awaitPromise.all(e.map((e=>this.syncEngine.Zs(e))))}}elsethis.ws.push(t)}))}}getqs(){returnthis.ys.get(this.fs)}xs(){this.setItem(this.Ss,this.qs.As())}Ls(e,t,n){consti=newKw(this.currentUser,e,t,n),s=zw(this.persistenceKey,this.currentUser,e);this.setItem(s,i.As())}ks(e){constt=zw(this.persistenceKey,this.currentUser,e);this.removeItem(t)}Ks(e){constt={clientId:this.fs,onlineState:e};this.store.setItem(this.Fs,JSON.stringify(t))}Qs(e,t,n){consti=Gw(this.persistenceKey,e),s=newHw(e,t,n);this.setItem(i,s.As())}$s(e){constt=JSON.stringify(Array.from(e));this.setItem(this.Ms,t)}Us(e){constt=this.Ds.exec(e);returnt?t[1]:null}Gs(e,t){constn=this.Us(e);returnWw.Es(n,t)}zs(e,t){constn=this.Cs.exec(e),i=Number(n[1]),s=void0!==n[2]?n[2]:null;returnKw.Es(newwd(s),i,t)}Hs(e,t){constn=this.vs.exec(e),i=Number(n[1]);returnHw.Es(i,t)}Os(e){returnQw.Es(e)}Ys(e){returnJSON.parse(e)}asyncjs(e){if(e.user.uid===this.currentUser.uid)returnthis.syncEngine.Xs(e.batchId,e.state,e.error);Td("SharedClientState","Ignoringmutationfornon-activeuser".concat(e.user.uid))}Js(e){returnthis.syncEngine.eo(e.targetId,e.state,e.error)}Ws(e,t){constn=t?this.ys.insert(e,t):this.ys.remove(e),i=this.Bs(this.ys),s=this.Bs(n),r=[],o=[];returns.forEach((e=>{i.has(e)||r.push(e)})),i.forEach((e=>{s.has(e)||o.push(e)})),this.syncEngine.no(r,o).then((()=>{this.ys=n}))}Ns(e){this.ys.get(e.clientId)&&this.onlineStateHandler(e.onlineState)}Bs(e){lett=ig();returne.forEach(((e,n)=>{t=t.unionWith(n.activeTargetIds)})),t}}classXw{constructor(){this.ro=newYw,this.io={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e){returnthis.ro.Rs(e),this.io[e]||"not-current"}updateQueryState(e,t,n){this.io[e]=t}removeLocalQueryTarget(e){this.ro.Vs(e)}isLocalQueryTarget(e){returnthis.ro.activeTargetIds.has(e)}clearQueryState(e){deletethis.io[e]}getAllActiveQueryTargets(){returnthis.ro.activeTargetIds}isActiveQueryTarget(e){returnthis.ro.activeTargetIds.has(e)}start(){returnthis.ro=newYw,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}classZw{so(e){}shutdown(){}}class$w{constructor(){this.oo=()=>this._o(),this.ao=()=>this.uo(),this.co=[],this.lo()}so(e){this.co.push(e)}shutdown(){window.removeEventListener("online",this.oo),window.removeEventListener("offline",this.ao)}lo(){window.addEventListener("online",this.oo),window.addEventListener("offline",this.ao)}_o(){Td("ConnectivityMonitor","Networkconnectivitychanged:AILABLE");for(consteofthis.co)e(0)}uo(){Td("ConnectivityMonitor","Networkconnectivitychanged:UNAILABLE");for(consteofthis.co)e(1)}staticC(){return"undefined"!=typeofwindow&&void0!==window.addEventListener&&void0!==window.removeEventListener}}lete_=null;functiont_(){returnnull===e_?e_=6+Math.round(48*Math.random()):e_++,"0x"+e_.toString(16)}constn_={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RungregationQuery:"rungregationQuery"};classi_{constructor(e){this.ho=e.ho,this.Po=e.Po}Io(e){this.To=e}Eo(e){this.Ao=e}onMesse(e){this.Ro=e}close(){this.Po()}send(e){this.ho(e)}Vo(){this.To()}mo(e){this.Ao(e)}fo(e){this.Ro(e)}}consts_="WebChannelConnection";classr_extendsclass{constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;constt=e.ssl?"":"http",n=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.po=t+""+e.host,this.yo="projects/".concat(n,"/databases/").concat(i),this.wo="(default)"===this.databaseId.database?"project_id=".concat(n):"project_id=".concat(n,"&database_id=").concat(i)}getSo(){return!1}bo(e,t,n,i,s){constr=t_(),o=this.Do(e,t);Td("RestConnection","SendingRPC'".concat(e,"'").concat(r,":"),o,n);consta={"google-cloud-resource-prefix":this.yo,"x-goog-request-params":this.wo};returnthis.Co(a,i,s),this.vo(e,o,a,n).then((t=>(Td("RestConnection","ReceivedRPC'".concat(e,"'").concat(r,":"),t),t)),(t=>{throwEd("RestConnection","RPC'".concat(e,"'").concat(r,"failedwitherror:"),t,"url:",o,"request:",n),t}))}Fo(e,t,n,i,s,r){returnthis.bo(e,t,n,i,s)}Co(e,t,n){e["X-Goog-Api-Client"]="gl-js/fire/"+_d,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach(((t,n)=>e[n]=t)),n&&n.headers.forEach(((t,n)=>e[n]=t))}Do(e,t){constn=n_[e];return"".concat(this.po,"/v1/").concat(t,":").concat(n)}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}vo(e,t,n,i){consts=t_();returnnewPromise(((r,o)=>{consta=newmd;a.setWithCredentials(!0),a.listenOnce(ud.COMPLETE,(()=>{try{switch(a.getLastErrorCode()){caseld.NO_ERROR:constt=a.getResponseJson();Td(s_,"XHRforRPC'".concat(e,"'").concat(s,"received:"),JSON.stringify(t)),r(t);break;caseld.TIMEOUT:Td(s_,"RPC'".concat(e,"'").concat(s,"timedout")),o(newPd(xd.DEADLINE_EXCEEDED,"Requesttimeout"));break;caseld.:constn=a.getStatus();if(Td(s_,"RPC'".concat(e,"'").concat(s,"failedwithstatus:"),n,"responsetext:",a.getResponseText()),n>0){lete=a.getResponseJson();Array.isArray(e)&&(e=e[0]);constt=null==e?void0:e.error;if(t&&t.status&&t.messe){conste=function(e){constt=e.toLowerCase().replace(/_/g,"-");returnObject.values(xd).indexOf(t)>=0?t:xd.UNKNOWN}(t.status);o(newPd(e,t.messe))}elseo(newPd(xd.UNKNOWN,"Serverrespondedwithstatus"+a.getStatus()))}elseo(newPd(xd.UNAILABLE,"Connectionfailed."));break;default:Cd()}}finally{Td(s_,"RPC'".concat(e,"'").concat(s,"completed."))}}));constc=JSON.stringify(i);Td(s_,"RPC'".concat(e,"'").concat(s,"sendingrequest:"),i),a.send(t,"POST",c,n,15)}))}Mo(e,t,n){consti=t_(),s=[this.po,"/","google.firestore.v1.Firestore","/",e,"/channel"],r=newUh,o=Fl(),a={:"gsessionid",initMesseHeaders:{},messeUrlParams:{database:"projects/".concat(this.databaseId.projectId,"/databases/").concat(this.databaseId.database)},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;void0!==c&&(a.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(a.useFetchStreams=!0),this.Co(a.initMesseHeaders,t,n),a.encodeInitMesseHeaders=!0;constl=s.join("");Td(s_,"CreatingRPC'".concat(e,"'stream").concat(i,":").concat(l),a);constu=r.createWebChannel(l,a);leth=!1,d=!1;constp=newi_({ho:t=>{d?Td(s_,"NotsendingbecauseRPC'".concat(e,"'stream").concat(i,"isclosed:"),t):(h||(Td(s_,"OpeningRPC'".concat(e,"'stream").concat(i,"transport.")),u.open(),h=!0),Td(s_,"RPC'".concat(e,"'stream").concat(i,"sending:"),t),u.send(t))},Po:()=>u.close()}),f=(e,t,n)=>{e.listen(t,(e=>{try{n(e)}catch(t){setTimeout((()=>{throwt}),0)}}))};returnf(u,fd.EventType.OPEN,(()=>{d||Td(s_,"RPC'".concat(e,"'stream").concat(i,"transportopened."))})),f(u,fd.EventType.CLOSE,(()=>{d||(d=!0,Td(s_,"RPC'".concat(e,"'stream").concat(i,"transportclosed")),p.mo())})),f(u,fd.EventType.ERROR,(t=>{d||(d=!0,Ed(s_,"RPC'".concat(e,"'stream").concat(i,"transporterrored:"),t),p.mo(newPd(xd.UNAILABLE,"Theoperationcouldnotbecompleted")))})),f(u,fd.EventType.MESSE,(t=>{varn;if(!d){consts=t.data[0];Ad(!!s);constr=s,o=r.error||(null===(n=r[0])||void0===n?void0:n.error);if(o){Td(s_,"RPC'".concat(e,"'stream").concat(i,"receivederror:"),o);constt=o.status;letn=function(e){constt=jg[e];if(void0!==t)returnzg(t)}(t),s=o.messe;void0===n&&(n=xd.INTERNAL,s="Unknownerrorstatus:"+t+"withmesse"+o.messe),d=!0,p.mo(newPd(n,s)),u.close()}elseTd(s_,"RPC'".concat(e,"'stream").concat(i,"received:"),s),p.fo(s)}})),f(o,hd.STAT_EVENT,(t=>{t.stat===dd?Td(s_,"RPC'".concat(e,"'stream").concat(i,"detectedbufferingproxy")):t.stat===pd&&Td(s_,"RPC'".concat(e,"'stream").concat(i,"detectednobufferingproxy"))})),setTimeout((()=>{p.Vo()}),0),p}}functiono_(){return"undefined"!=typeofwindow?window:null}functiona_(){return"undefined"!=typeofdocument?document:null}functionc_(e){returnnewcy(e,!0)}classl_{constructor(e,t,n=1e3,i=1.5,s=6e4){this._i=e,this.timerId=t,this.xo=n,this.Oo=i,this.No=s,this.Bo=0,this.Lo=null,this.ko=Date.now(),this.reset()}reset(){this.Bo=0}qo(){this.Bo=this.No}Qo(e){this.cancel();constt=Math.floor(this.Bo+this.Ko()),n=Math.max(0,Date.now()-this.ko),i=Math.max(0,t-n);i>0&&Td("ExponentialBackoff","Backingofffor".concat(i,"ms(basedelay:").concat(this.Bo,"ms,delaywithjitter:").concat(t,"ms,lastattempt:").concat(n,"mso)")),this.Lo=this._i.enqueueAfterDelay(this.timerId,i,(()=>(this.ko=Date.now(),e()))),this.Bo*=this.Oo,this.Bothis.No&&(this.Bo=this.No)}$o(){null!==this.Lo&&(this.Lo.skipDelay(),this.Lo=null)}cancel(){null!==this.Lo&&(this.Lo.cancel(),this.Lo=null)}Ko(){return(Math.random()-.5)*this.Bo}}classu_{constructor(e,t,n,i,s,r,o,a){this._i=e,this.Uo=n,this.Wo=i,this.connection=s,this.authCredentialsProvider=r,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.Go=0,this.zo=null,this.jo=null,this.stream=null,this.Ho=newl_(e,t)}Jo(){return1===this.state||5===this.state||this.Yo()}Yo(){return2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Zo()}asyncstop(){this.Jo()&&awaitthis.close(0)}Xo(){this.state=0,this.Ho.reset()}e_(){this.Yo()&&null===this.zo&&(this.zo=this._i.enqueueAfterDelay(this.Uo,6e4,(()=>this.t_())))}n_(e){this.r_(),this.stream.send(e)}asynct_(){if(this.Yo())returnthis.close(0)}r_(){this.zo&&(this.zo.cancel(),this.zo=null)}i_(){this.jo&&(this.jo.cancel(),this.jo=null)}asyncclose(e,t){this.r_(),this.i_(),this.Ho.cancel(),this.Go++,4!==e?this.Ho.reset():t&&t.code===xd.RESOURCE_EXHAUSTED?(Sd(t.toString()),Sd("Usingmaximumbackoffdelaytopreventoverloadingthebackend."),this.Ho.qo()):t&&t.code===xd.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.s_(),this.stream.close(),this.stream=null),this.state=e,awaitthis.listener.Eo(t)}s_(){}auth(){this.state=1;conste=this.o_(this.Go),t=this.Go;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([e,n])=>{this.Go===t&&this.__(e,n)}),(t=>{e((()=>{conste=newPd(xd.UNKNOWN,"Fetchingauthtokenfailed:"+t.messe);returnthis.a_(e)}))}))}__(e,t){constn=this.o_(this.Go);this.stream=this.u_(e,t),this.stream.Io((()=>{n((()=>(this.state=2,this.jo=this._i.enqueueAfterDelay(this.Wo,1e4,(()=>(this.Yo()&&(this.state=3),Promise.resolve()))),this.listener.Io())))})),this.stream.Eo((e=>{n((()=>this.a_(e)))})),this.stream.onMesse((e=>{n((()=>this.onMesse(e)))}))}Zo(){this.state=5,this.Ho.Qo((async()=>{this.state=0,this.start()}))}a_(e){returnTd("PersistentStream","closewitherror:".concat(e)),this.stream=null,this.close(4,e)}o_(e){returnt=>{this._i.enqueueAndForget((()=>this.Go===e?t():(Td("PersistentStream","streamcallbackskippedbygetCloseGuardedDispatcher."),Promise.resolve())))}}}classh_extendsu_{constructor(e,t,n,i,s,r){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,i,r),this.serializer=s}u_(e,t){returnthis.connection.Mo("Listen",e,t)}onMesse(e){this.Ho.reset();constt=function(e,t){letn;if("targetChange"int){t.targetChange;consts="NO_CHANGE"===(i=t.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===i?1:"REMOVE"===i?2:"CURRENT"===i?3:"RESET"===i?4:Cd(),r=t.targetChange.targetIds||[],o=function(e,t){returne.useProto3Json?(Ad(void0===t||"string"==typeoft),ff.fromBase64String(t||"")):(Ad(void0===t||tinstanceofUint8Array),ff.fromUint8Array(t||newUint8Array))}(e,t.targetChange.resumeToken),a=t.targetChange.cause,c=a&&function(e){constt=void0===e.code?xd.UNKNOWN:zg(e.code);returnnewPd(t,e.messe||"")}(a);n=newey(s,r,o,c||null)}elseif("documentChange"int){t.documentChange;consti=t.documentChange;i.document,i.document.name,i.document.updateTime;consts=yy(e,i.document.name),r=py(i.document.updateTime),o=i.document.createTime?py(i.document.createTime):Wd.min(),a=newKf({mapValue:{fields:i.document.fields}}),c=Wf.newFoundDocument(s,r,o,a),l=i.targetIds||[],u=i.removedTargetIds||[];n=newZg(l,u,c.key,c)}elseif("documentDelete"int){t.documentDelete;consti=t.documentDelete;i.document;consts=yy(e,i.document),r=i.readTime?py(i.readTime):Wd.min(),o=Wf.newNoDocument(s,r),a=i.removedTargetIds||[];n=newZg([],a,o.key,o)}elseif("documentRemove"int){t.documentRemove;consti=t.documentRemove;i.document;consts=yy(e,i.document),r=i.removedTargetIds||[];n=newZg([],r,s,null)}else{if(!("filter"int))returnCd();{t.filter;conste=t.filter;e.targetId;const{count:i=0,unchangedNames:s}=e,r=newUg(i,s),o=e.targetId;n=new$g(o,r)}}vari;returnn}(this.serializer,e),n=function(e){if(!("targetChange"ine))returnWd.min();constt=e.targetChange;returnt.targetIds&&t.targetIds.length?Wd.min():t.readTime?py(t.readTime):Wd.min()}(e);returnthis.listener.c_(t,n)}l_(e){constt={};t.database=_y(this.serializer),t.addTarget=function(e,t){letn;consti=t.target;if(n=Im(i)?{documents:ky(e,i)}:{query:Cy(e,i)},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=hy(e,t.resumeToken);consti=ly(e,t.expectedCount);null!==i&&(n.expectedCount=i)}elseif(t.snapshotVersion.compareTo(Wd.min())>0){n.readTime=uy(e,t.snapshotVersion.toTimestamp());consti=ly(e,t.expectedCount);null!==i&&(n.expectedCount=i)}returnn}(this.serializer,e);constn=function(e,t){constn=function(e){switch(e){case"TargetPurposeListen":returnnull;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:returnCd()}}(t.purpose);returnnull==n?null:{"goog-listen-ts":n}}(this.serializer,e);n&&(t.labels=n),this.n_(t)}h_(e){constt={};t.database=_y(this.serializer),t.removeTarget=e,this.n_(t)}}classd_extendsu_{constructor(e,t,n,i,s,r){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,i,r),this.serializer=s,this.P_=!1}getI_(){returnthis.P_}start(){this.P_=!1,this.lastStreamToken=void0,super.start()}s_(){this.P_&&this.d_([])}u_(e,t){returnthis.connection.Mo("Write",e,t)}onMesse(e){if(Ad(!!e.streamToken),this.lastStreamToken=e.streamToken,this.P_){this.Ho.reset();constt=function(e,t){returne&&e.length>0?(Ad(void0!==t),e.map((e=>function(e,t){letn=e.updateTime?py(e.updateTime):py(t);returnn.isEqual(Wd.min())&&(n=py(t)),new_g(n,e.transformResults||[])}(e,t)))):[]}(e.writeResults,e.commitTime),n=py(e.commitTime);returnthis.listener.T_(n,t)}returnAd(!e.writeResults||0===e.writeResults.length),this.P_=!0,this.listener.E_()}A_(){conste={};e.database=_y(this.serializer),this.n_(e)}d_(e){constt={streamToken:this.lastStreamToken,writes:e.map((e=>Sy(this.serializer,e)))};this.n_(t)}}classp_extendsclass{}{constructor(e,t,n,i){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=i,this.R_=!1}V_(){if(this.R_)thrownewPd(xd.FAILED_PRECONDITION,"Theclienthasalreadybeenterminated.")}bo(e,t,n){returnthis.V_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,s])=>this.connection.bo(e,t,n,i,s))).catch((e=>{throw"FirebaseError"===e.name?(e.code===xd.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):newPd(xd.UNKNOWN,e.toString())}))}Fo(e,t,n,i){returnthis.V_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([s,r])=>this.connection.Fo(e,t,n,s,r,i))).catch((e=>{throw"FirebaseError"===e.name?(e.code===xd.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):newPd(xd.UNKNOWN,e.toString())}))}terminate(){this.R_=!0}}classf_{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.f_=0,this.g_=null,this.p_=!0}y_(){0===this.f_&&(this.w_("Unknown"),this.g_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.g_=null,this.S_("Backenddidn'trespondwithin10seconds."),this.w_("Offline"),Promise.resolve()))))}b_(e){"Online"===this.state?this.w_("Unknown"):(this.f_++,this.f_>=1&&(this.D_(),this.S_("Connectionfailed1times.Mostrecenterror:".concat(e.toString())),this.w_("Offline")))}set(e){this.D_(),this.f_=0,"Online"===e&&(this.p_=!1),this.w_(e)}w_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}S_(e){constt="CouldnotreachCloudFirestorebackend.".concat(e,"\nThistypicallyindicatesthatyourdevicedoesnotheahealthyInternetconnectionatthemoment.Theclientwilloperateinofflinemodeuntilitisabletosuccessfullyconnecttothebackend.");this.p_?(Sd(t),this.p_=!1):Td("OnlineStateTracker",t)}D_(){null!==this.g_&&(this.g_.cancel(),this.g_=null)}}classm_{constructor(e,t,n,i,s){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.C_=[],this.v_=newMap,this.F_=newSet,this.M_=[],this.x_=s,this.x_.so((e=>{n.enqueueAndForget((async()=>{S_(this)&&(Td("RemoteStore","Restartingstreamsfornetworkreachabilitychange."),awaitasyncfunction(e){constt=Nd(e);t.F_.add(4),awaity_(t),t.O_.set("Unknown"),t.F_.delete(4),awaitg_(t)}(this))}))})),this.O_=newf_(n,i)}}asyncfunctiong_(e){if(S_(e))for(consttofe.M_)awaitt(!0)}asyncfunctiony_(e){for(consttofe.M_)awaitt(!1)}functionv_(e,t){constn=Nd(e);n.v_.has(t.targetId)||(n.v_.set(t.targetId,t),T_(n)?I_(n):q_(n).Yo()&&__(n,t))}functionw_(e,t){constn=Nd(e),i=q_(n);n.v_.delete(t),i.Yo()&&b_(n,t),0===n.v_.size&&(i.Yo()?i.e_():S_(n)&&n.O_.set("Unknown"))}function__(e,t){if(e.N_.Le(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(Wd.min())>0){constn=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}q_(e).l_(t)}functionb_(e,t){e.N_.Le(t),q_(e).h_(t)}functionI_(e){e.N_=newny({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),lt:t=>e.v_.get(t)||null,st:()=>e.datastore.serializer.databaseId}),q_(e).start(),e.O_.y_()}functionT_(e){returnS_(e)&&!q_(e).Jo()&&e.v_.size>0}functionS_(e){return0===Nd(e).F_.size}functionE_(e){e.N_=void0}asyncfunctionk_(e){e.v_.forEach(((t,n)=>{__(e,t)}))}asyncfunctionC_(e,t){E_(e),T_(e)?(e.O_.b_(t),I_(e)):e.O_.set("Unknown")}asyncfunctionA_(e,t,n){if(e.O_.set("Online"),tinstanceofey&&2===t.state&&t.cause)try{awaitasyncfunction(e,t){constn=t.cause;for(constioft.targetIds)e.v_.has(i)&&(awaite.remoteSyncer.rejectListen(i,n),e.v_.delete(i),e.N_.removeTarget(i))}(e,t)}catch(i){Td("RemoteStore","Failedtoremovetargets%s:%s",t.targetIds.join(","),i),awaitN_(e,i)}elseif(tinstanceofZg?e.N_.Ge(t):tinstanceof$g?e.N_.Xe(t):e.N_.He(t),!n.isEqual(Wd.min()))try{constt=awaitDw(e.localStore);n.compareTo(t)>=0&&awaitfunction(e,t){constn=e.N_._t(t);returnn.targetChanges.forEach(((n,i)=>{if(n.resumeToken.approximateByteSize()>0){consts=e.v_.get(i);s&&e.v_.set(i,s.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach(((t,n)=>{consti=e.v_.get(t);if(!i)return;e.v_.set(t,i.withResumeToken(ff.EMPTY_BYTE_STRING,i.snapshotVersion)),b_(e,t);consts=newVy(i.target,t,n,i.sequenceNumber);__(e,s)})),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(s){Td("RemoteStore","Failedtoraisesnapshot:",s),awaitN_(e,s)}}asyncfunctionN_(e,t,n){if(!gp(t))throwt;e.F_.add(1),awaity_(e),e.O_.set("Offline"),n||(n=()=>Dw(e.localStore)),e.asyncQueue.enqueueRetryable((async()=>{Td("RemoteStore","RetryingIndexedDBaccess"),awaitn(),e.F_.delete(1),awaitg_(e)}))}functionx_(e,t){returnt().catch((n=>N_(e,n,t)))}asyncfunctionP_(e){constt=Nd(e),n=z_(t);leti=t.C_.length>0?t.C_[t.C_.length-1].batchId:-1;for(;D_(t);)try{conste=awaitRw(t.localStore,i);if(null===e){0===t.C_.length&&n.e_();break}i=e.batchId,O_(t,e)}catch(s){awaitN_(t,s)}R_(t)&&M_(t)}functionD_(e){returnS_(e)&&e.C_.length0}functionM_(e){z_(e).start()}asyncfunctionL_(e){z_(e).A_()}asyncfunctionF_(e){constt=z_(e);for(constnofe.C_)t.d_(n.mutations)}asyncfunctionV_(e,t,n){consti=e.C_.shift(),s=Fg.from(i,t,n);awaitx_(e,(()=>e.remoteSyncer.applySuccessfulWrite(s))),awaitP_(e)}asyncfunctionU_(e,t){t&&z_(e).I_&&awaitasyncfunction(e,t){if(qg(n=t.code)&&n!==xd.ABORTED){constn=e.C_.shift();z_(e).Xo(),awaitx_(e,(()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t))),awaitP_(e)}varn}(e,t),R_(e)&&M_(e)}asyncfunctionj_(e,t){constn=Nd(e);n.asyncQueue.verifyOperationInProgress(),Td("RemoteStore","RemoteStorereceivednewcredentials");consti=S_(n);n.F_.add(3),awaity_(n),i&&n.O_.set("Unknown"),awaitn.remoteSyncer.handleCredentialChange(t),n.F_.delete(3),awaitg_(n)}asyncfunctionB_(e,t){constn=Nd(e);t?(n.F_.delete(2),awaitg_(n)):t||(n.F_.add(2),awaity_(n),n.O_.set("Unknown"))}functionq_(e){returne.B_||(e.B_=function(e,t,n){consti=Nd(e);returni.V_(),newh_(t,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)}(e.datastore,e.asyncQueue,{Io:k_.bind(null,e),Eo:C_.bind(null,e),c_:A_.bind(null,e)}),e.M_.push((asynct=>{t?(e.B_.Xo(),T_(e)?I_(e):e.O_.set("Unknown")):(awaite.B_.stop(),E_(e))}))),e.B_}functionz_(e){returne.L_||(e.L_=function(e,t,n){consti=Nd(e);returni.V_(),newd_(t,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)}(e.datastore,e.asyncQueue,{Io:L_.bind(null,e),Eo:U_.bind(null,e),E_:F_.bind(null,e),T_:V_.bind(null,e)}),e.M_.push((asynct=>{t?(e.L_.Xo(),awaitP_(e)):(awaite.L_.stop(),e.C_.length>0&&(Td("RemoteStore","Stoppingwritestreamwith".concat(e.C_.length,"pendingwrites")),e.C_=[]))}))),e.L_}classG_{constructor(e,t,n,i,s){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=i,this.removalCallback=s,this.deferred=newDd,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((e=>{}))}getpromise(){returnthis.deferred.promise}staticcreateAndSchedule(e,t,n,i,s){constr=Date.now()+n,o=newG_(e,t,r,i,s);returno.start(n),o}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){returnthis.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(newPd(xd.CANCELLED,"Operationcancelled"+(e?":"+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}functionK_(e,t){if(Sd("AsyncQueue","".concat(t,":").concat(e)),gp(e))returnnewPd(xd.UNAILABLE,"".concat(t,":").concat(e));throwe}classH_{constructor(e){this.comparator=e?(t,n)=>e(t,n)||Zd.comparator(t.key,n.key):(e,t)=>Zd.comparator(e.key,t.key),this.keyedMap=Qm(),this.sortedSet=newof(this.comparator)}staticemptySet(e){returnnewH_(e.comparator)}has(e){returnnull!=this.keyedMap.get(e)}get(e){returnthis.keyedMap.get(e)}first(){returnthis.sortedSet.minKey()}last(){returnthis.sortedSet.maxKey()}isEmpty(){returnthis.sortedSet.isEmpty()}indexOf(e){constt=this.keyedMap.get(e);returnt?this.sortedSet.indexOf(t):-1}getsize(){returnthis.sortedSet.size}forEach(e){this.sortedSet.inorderTrersal(((t,n)=>(e(t),!1)))}add(e){constt=this.delete(e.key);returnt.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){constt=this.get(e);returnt?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(einstanceofH_))return!1;if(this.size!==e.size)return!1;constt=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){conste=t.getNext().key,i=n.getNext().key;if(!e.isEqual(i))return!1}return!0}toString(){conste=[];returnthis.forEach((t=>{e.push(t.toString())})),0===e.length?"DocumentSet()":"DocumentSet(\n"+e.join("\n")+"\n)"}copy(e,t){constn=newH_;returnn.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}classW_{constructor(){this.k_=newof(Zd.comparator)}track(e){constt=e.doc.key,n=this.k_.get(t);n?0!==e.type&&3===n.type?this.k_=this.k_.insert(t,e):3===e.type&&1!==n.type?this.k_=this.k_.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.k_=this.k_.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.k_=this.k_.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.k_=this.k_.remove(t):1===e.type&&2===n.type?this.k_=this.k_.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.k_=this.k_.insert(t,{type:2,doc:e.doc}):Cd():this.k_=this.k_.insert(t,e)}q_(){conste=[];returnthis.k_.inorderTrersal(((t,n)=>{e.push(n)})),e}}classQ_{constructor(e,t,n,i,s,r,o,a,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=s,this.fromCache=r,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}staticfromInitialDocuments(e,t,n,i,s){constr=[];returnt.forEach((e=>{r.push({type:0,doc:e})})),newQ_(e,t,H_.emptySet(t),r,n,i,!0,!1,s)}gethasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Fm(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;constt=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(leti=0;iVm(e)),Fm),this.onlineState="Unknown",this.K_=newSet}}asyncfunctionX_(e,t){constn=Nd(e),i=t.query;lets=!1,r=n.queries.get(i);if(r||(s=!0,r=newY_),s)try{r.Q_=awaitn.onListen(i)}catch(o){conste=K_(o,"Initializationofquery'".concat(Um(t.query),"'failed"));returnvoidt.onError(e)}n.queries.set(i,r),r.listeners.push(t),t.U_(n.onlineState),r.Q_&&t.W_(r.Q_)&&tb(n)}asyncfunctionZ_(e,t){constn=Nd(e),i=t.query;lets=!1;constr=n.queries.get(i);if(r){conste=r.listeners.indexOf(t);e>=0&&(r.listeners.splice(e,1),s=0===r.listeners.length)}if(s)returnn.queries.delete(i),n.onUnlisten(i)}function$_(e,t){constn=Nd(e);leti=!1;for(constsoft){conste=s.query,t=n.queries.get(e);if(t){for(consteoft.listeners)e.W_(s)&&(i=!0);t.Q_=s}}i&&tb(n)}functioneb(e,t,n){consti=Nd(e),s=i.queries.get(t);if(s)for(constrofs.listeners)r.onError(n);i.queries.delete(t)}functiontb(e){e.K_.forEach((e=>{e.next()}))}classnb{constructor(e,t,n){this.query=e,this.G_=t,this.z_=!1,this.j_=null,this.onlineState="Unknown",this.options=n||{}}W_(e){if(!this.options.includeMetadataChanges){constt=[];for(constnofe.docChanges)3!==n.type&&t.push(n);e=newQ_(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}lett=!1;returnthis.z_?this.H_(e)&&(this.G_.next(e),t=!0):this.J_(e,this.onlineState)&&(this.Y_(e),t=!0),this.j_=e,t}onError(e){this.G_.error(e)}U_(e){this.onlineState=e;lett=!1;returnthis.j_&&!this.z_&&this.J_(this.j_,e)&&(this.Y_(this.j_),t=!0),t}J_(e,t){if(!e.fromCache)return!0;constn="Offline"!==t;return(!this.options.Z_||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}H_(e){if(e.docChanges.length>0)return!0;constt=this.j_&&this.j_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}Y_(e){e=Q_.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.z_=!0,this.G_.next(e)}}classib{constructor(e,t){this.X_=e,this.byteLength=t}ea(){return"metadata"inthis.X_}}classsb{constructor(e){this.serializer=e}Is(e){returnyy(this.serializer,e)}ds(e){returne.metadata.exists?Ty(this.serializer,e.document,!1):Wf.newNoDocument(this.Is(e.metadata.name),this.Ts(e.metadata.readTime))}Ts(e){returnpy(e)}}classrb{constructor(e,t,n){this.ta=e,this.localStore=t,this.serializer=n,this.queries=[],this.documents=[],this.collectionGroups=newSet,this.progress=ob(e)}na(e){this.progress.bytesLoaded+=e.byteLength;lett=this.progress.documentsLoaded;if(e.X_.namedQuery)this.queries.push(e.X_.namedQuery);elseif(e.X_.documentMetadata){this.documents.push({metadata:e.X_.documentMetadata}),e.X_.documentMetadata.exists||++t;constn=Yd.fromString(e.X_.documentMetadata.name);this.collectionGroups.add(n.get(n.length-2))}elsee.X_.document&&(this.documents[this.documents.length-1].document=e.X_.document,++t);returnt!==this.progress.documentsLoaded?(this.progress.documentsLoaded=t,Object.assign({},this.progress)):null}ra(e){constt=newMap,n=newsb(this.serializer);for(constiofe)if(i.metadata.queries){conste=n.Is(i.metadata.name);for(constnofi.metadata.queries){consti=(t.get(n)||tg()).add(e);t.set(n,i)}}returnt}asynccomplete(){conste=awaitasyncfunction(e,t,n,i){consts=Nd(e);letr=tg(),o=Hm();for(constuofn){conste=t.Is(u.metadata.name);u.document&&(r=r.add(e));constn=t.ds(u);n.setReadTime(t.Ts(u.metadata.readTime)),o=o.insert(e,n)}consta=s._s.newChangeBuffer({trackRemovals:!0}),c=awaitMw(s,(l=i,Rm(Am(Yd.fromString("__bundle__/docs/".concat(l))))));varl;returns.persistence.runTransaction("Applybundledocuments","readwrite",(e=>Ow(e,a,o).next((t=>(a.apply(e),t))).next((t=>s.Kr.removeMatchingKeysForTargetId(e,c.targetId).next((()=>s.Kr.addMatchingKeys(e,r,c.targetId))).next((()=>s.localDocuments.getLocalViewOfDocuments(e,t.ls,t.hs))).next((()=>t.ls))))))}(this.localStore,newsb(this.serializer),this.documents,this.ta.id),t=this.ra(this.documents);for(constnofthis.queries)awaitBw(this.localStore,n,t.get(n.name));returnthis.progress.taskState="Success",{progress:this.progress,ia:this.collectionGroups,sa:e}}}functionob(e){return{taskState:"Running",documentsLoaded:0,bytesLoaded:0,totalDocuments:e.totalDocuments,totalBytes:e.totalBytes}}classab{constructor(e){this.key=e}}classcb{constructor(e){this.key=e}}classlb{constructor(e,t){this.query=e,this.oa=t,this._a=null,this.hasCachedResults=!1,this.current=!1,this.aa=tg(),this.mutatedKeys=tg(),this.ua=qm(e),this.ca=newH_(this.ua)}getla(){returnthis.oa}ha(e,t){constn=t?t.Pa:newW_,i=t?t.ca:this.ca;lets=t?t.mutatedKeys:this.mutatedKeys,r=i,o=!1;consta="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,c="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(e.inorderTrersal(((e,t)=>{constl=i.get(e),u=jm(this.query,t)?t:null,h=!!l&&this.mutatedKeys.has(l.key),d=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations);letp=!1;l&&u?l.data.isEqual(u.data)?h!==d&&(n.track({type:3,doc:u}),p=!0):this.Ia(l,u)||(n.track({type:2,doc:u}),p=!0,(a&&this.ua(u,a)>0||c&&this.ua(u,c)this.query.limit;){conste="F"===this.query.limitType?r.last():r.first();r=r.delete(e.key),s=s.delete(e.key),n.track({type:1,doc:e})}return{ca:r,Pa:n,es:o,mutatedKeys:s}}Ia(e,t){returne.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n){consti=this.ca;this.ca=e.ca,this.mutatedKeys=e.mutatedKeys;consts=e.Pa.q_();s.sort(((e,t)=>function(e,t){constn=e=>{switch(e){case0:return1;case2:case3:return2;case1:return0;default:returnCd()}};returnn(e)-n(t)}(e.type,t.type)||this.ua(e.doc,t.doc))),this.da(n);constr=t?this.Ta():[],o=0===this.aa.size&&this.current?1:0,a=o!==this._a;returnthis._a=o,0!==s.length||a?{snapshot:newQ_(this.query,e.ca,i,s,e.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Ea:r}:{Ea:r}}U_(e){returnthis.current&&"Offline"===e?(this.current=!1,this.applyChanges({ca:this.ca,Pa:newW_,mutatedKeys:this.mutatedKeys,es:!1},!1)):{Ea:[]}}Aa(e){return!this.oa.has(e)&&!!this.ca.has(e)&&!this.ca.get(e).hasLocalMutations}da(e){e&&(e.addedDocuments.forEach((e=>this.oa=this.oa.add(e))),e.modifiedDocuments.forEach((e=>{})),e.removedDocuments.forEach((e=>this.oa=this.oa.delete(e))),this.current=e.current)}Ta(){if(!this.current)return[];conste=this.aa;this.aa=tg(),this.ca.forEach((e=>{this.Aa(e.key)&&(this.aa=this.aa.add(e.key))}));constt=[];returne.forEach((e=>{this.aa.has(e)||t.push(newcb(e))})),this.aa.forEach((n=>{e.has(n)||t.push(newab(n))})),t}Ra(e){this.oa=e.Ps,this.aa=tg();constt=this.ha(e.documents);returnthis.applyChanges(t,!0)}Va(){returnQ_.fromInitialDocuments(this.query,this.ca,this.mutatedKeys,0===this._a,this.hasCachedResults)}}classub{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}classhb{constructor(e){this.key=e,this.ma=!1}}classdb{constructor(e,t,n,i,s,r){this.localStore=e,this.remoteStore=t,this.eventManer=n,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=r,this.fa={},this.ga=newGm((e=>Vm(e)),Fm),this.pa=newMap,this.ya=newSet,this.wa=newof(Zd.comparator),this.Sa=newMap,this.ba=newuw,this.Da={},this.Ca=newMap,this.va=jv.Ln(),this.onlineState="Unknown",this.Fa=void0}getisPrimaryClient(){return!0===this.Fa}}asyncfunctionpb(e,t){constn=Ub(e);leti,s;constr=n.ga.get(t);if(r)i=r.targetId,n.sharedClientState.addLocalQueryTarget(i),s=r.view.Va();else{conste=awaitMw(n.localStore,Rm(t)),r=n.sharedClientState.addLocalQueryTarget(e.targetId);i=e.targetId,s=awaitfb(n,t,i,"current"===r,e.resumeToken),n.isPrimaryClient&&v_(n.remoteStore,e)}returns}asyncfunctionfb(e,t,n,i,s){e.Ma=(t,n,i)=>asyncfunction(e,t,n,i){lets=t.view.ha(n);s.es&&(s=awaitFw(e.localStore,t.query,!1).then((({documents:e})=>t.view.ha(e,s))));constr=i&&i.targetChanges.get(t.targetId),o=t.view.applyChanges(s,e.isPrimaryClient,r);returnEb(e,t.targetId,o.Ea),o.snapshot}(e,t,n,i);constr=awaitFw(e.localStore,t,!0),o=newlb(t,r.Ps),a=o.ha(r.documents),c=Xg.createSynthesizedTargetChangeForCurrentChange(n,i&&"Offline"!==e.onlineState,s),l=o.applyChanges(a,e.isPrimaryClient,c);Eb(e,n,l.Ea);constu=newub(t,n,o);returne.ga.set(t,u),e.pa.has(n)?e.pa.get(n).push(t):e.pa.set(n,[t]),l.snapshot}asyncfunctionmb(e,t){constn=Nd(e),i=n.ga.get(t),s=n.pa.get(i.targetId);if(s.length>1)returnn.pa.set(i.targetId,s.filter((e=>!Fm(e,t)))),voidn.ga.delete(t);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(i.targetId),n.sharedClientState.isActiveQueryTarget(i.targetId)||awaitLw(n.localStore,i.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(i.targetId),w_(n.remoteStore,i.targetId),Tb(n,i.targetId)})).catch(up)):(Tb(n,i.targetId),awaitLw(n.localStore,i.targetId,!0))}asyncfunctiongb(e,t){constn=Nd(e);try{conste=awaitfunction(e,t){constn=Nd(e),i=t.snapshotVersion;lets=n.rs;returnn.persistence.runTransaction("Applyremoteevent","readwrite-primary",(e=>{constr=n._s.newChangeBuffer({trackRemovals:!0});s=n.rs;consto=[];t.targetChanges.forEach(((r,a)=>{constc=s.get(a);if(!c)return;o.push(n.Kr.removeMatchingKeys(e,r.removedDocuments,a).next((()=>n.Kr.addMatchingKeys(e,r.addedDocuments,a))));letl=c.withSequenceNumber(e.currentSequenceNumber);varu,h,d;null!==t.targetMismatches.get(a)?l=l.withResumeToken(ff.EMPTY_BYTE_STRING,Wd.min()).withLastLimboFreeSnapshotVersion(Wd.min()):r.resumeToken.approximateByteSize()>0&&(l=l.withResumeToken(r.resumeToken,i)),s=s.insert(a,l),h=l,d=r,(0===(u=c).resumeToken.approximateByteSize()||h.snapshotVersion.toMicroseconds()-u.snapshotVersion.toMicroseconds()>=3e8||d.addedDocuments.size+d.modifiedDocuments.size+d.removedDocuments.size>0)&&o.push(n.Kr.updateTargetData(e,l))}));leta=Hm(),c=tg();if(t.documentUpdates.forEach((i=>{t.resolvedLimboDocuments.has(i)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,i))})),o.push(Ow(e,r,t.documentUpdates).next((e=>{a=e.ls,c=e.hs}))),!i.isEqual(Wd.min())){constt=n.Kr.getLastRemoteSnapshotVersion(e).next((t=>n.Kr.setTargetsMetadata(e,e.currentSequenceNumber,i)));o.push(t)}returnhp.waitFor(o).next((()=>r.apply(e))).next((()=>n.localDocuments.getLocalViewOfDocuments(e,a,c))).next((()=>a))})).then((e=>(n.rs=s,e)))}(n.localStore,t);t.targetChanges.forEach(((e,t)=>{consti=n.Sa.get(t);i&&(Ad(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size0?i.ma=!0:e.modifiedDocuments.size>0?Ad(i.ma):e.removedDocuments.size>0&&(Ad(i.ma),i.ma=!1))})),awaitAb(n,e,t)}catch(i){awaitup(i)}}functionyb(e,t,n){consti=Nd(e);if(i.isPrimaryClient&&0===n||!i.isPrimaryClient&&1===n){conste=[];i.ga.forEach(((n,i)=>{consts=i.view.U_(t);s.snapshot&&e.push(s.snapshot)})),function(e,t){constn=Nd(e);n.onlineState=t;leti=!1;n.queries.forEach(((e,n)=>{for(constsofn.listeners)s.U_(t)&&(i=!0)})),i&&tb(n)}(i.eventManer,t),e.length&&i.fa.c_(e),i.onlineState=t,i.isPrimaryClient&&i.sharedClientState.setOnlineState(t)}}asyncfunctionvb(e,t,n){consti=Nd(e);i.sharedClientState.updateQueryState(t,"rejected",n);consts=i.Sa.get(t),r=s&&s.key;if(r){lete=newof(Zd.comparator);e=e.insert(r,Wf.newNoDocument(r,Wd.min()));constn=tg().add(r),s=newJg(Wd.min(),newMap,newof(zd),e,n);awaitgb(i,s),i.wa=i.wa.remove(r),i.Sa.delete(t),Cb(i)}elseawaitLw(i.localStore,t,!1).then((()=>Tb(i,t,n))).catch(up)}asyncfunctionwb(e,t){constn=Nd(e),i=t.batch.batchId;try{conste=awaitfunction(e,t){constn=Nd(e);returnn.persistence.runTransaction("Acknowledgebatch","readwrite-primary",(e=>{consti=t.batch.keys(),s=n._s.newChangeBuffer({trackRemovals:!0});returnfunction(e,t,n,i){consts=n.batch,r=s.keys();leto=hp.resolve();returnr.forEach((e=>{o=o.next((()=>i.getEntry(t,e))).next((t=>{constr=n.docVersions.get(e);Ad(null!==r),t.version.compareTo(r)e.mutationQueue.removeMutationBatch(t,s)))}(n,e,t,s).next((()=>s.apply(e))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t.batch.batchId))).next((()=>n.localDocuments.recalculateAndSeOverlaysForDocumentKeys(e,function(e){lett=tg();for(letn=0;n0&&(t=t.add(e.batch.mutations[n].key));returnt}(t)))).next((()=>n.localDocuments.getDocuments(e,i)))}))}(n.localStore,t);Ib(n,i,null),bb(n,i),n.sharedClientState.updateMutationState(i,"acknowledged"),awaitAb(n,e)}catch(s){awaitup(s)}}asyncfunction_b(e,t,n){consti=Nd(e);try{conste=awaitfunction(e,t){constn=Nd(e);returnn.persistence.runTransaction("Rejectbatch","readwrite-primary",(e=>{leti;returnn.mutationQueue.lookupMutationBatch(e,t).next((t=>(Ad(null!==t),i=t.keys(),n.mutationQueue.removeMutationBatch(e,t)))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t))).next((()=>n.localDocuments.recalculateAndSeOverlaysForDocUn Murmur morbidoumentKeys(e,i))).next((()=>n.localDocuments.getDocuments(e,i)))}))}(i.localStore,t);Ib(i,t,n),bb(i,t),i.sharedClientState.updateMutationState(t,"rejected",n),awaitAb(i,e)}catch(s){awaitup(s)}}functionbb(e,t){(e.Ca.get(t)||[]).forEach((e=>{e.resolve()})),e.Ca.delete(t)}functionIb(e,t,n){consti=Nd(e);lets=i.Da[i.currentUser.toKey()];if(s){conste=s.get(t);e&&(n?e.reject(n):e.resolve(),s=s.remove(t)),i.Da[i.currentUser.toKey()]=s}}functionTb(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(constiofe.pa.get(t))e.ga.delete(i),n&&e.fa.xa(i,n);e.pa.delete(t),e.isPrimaryClient&&e.ba.mr(t).forEach((t=>{e.ba.containsKey(t)||Sb(e,t)}))}functionSb(e,t){e.ya.delete(t.path.canonicalString());constn=e.wa.get(t);null!==n&&(w_(e.remoteStore,n),e.wa=e.wa.remove(t),e.Sa.delete(n),Cb(e))}functionEb(e,t,n){for(constiofn)iinstanceofab?(e.ba.addReference(i.key,t),kb(e,i)):iinstanceofcb?(Td("SyncEngine","Documentnolongerinlimbo:"+i.key),e.ba.removeReference(i.key,t),e.ba.containsKey(i.key)||Sb(e,i.key)):Cd()}functionkb(e,t){constn=t.key,i=n.path.canonicalString();e.wa.get(n)||e.ya.has(i)||(Td("SyncEngine","Newdocumentinlimbo:"+n),e.ya.add(i),Cb(e))}functionCb(e){for(;e.ya.size>0&&e.wa.size{o.push(i.Ma(a,t,n).then((e=>{if((e||n)&&i.isPrimaryClient&&i.sharedClientState.updateQueryState(a.targetId,(null==e?void0:e.fromCache)?"not-current":"current"),e){s.push(e);constt=kw.$i(a.targetId,e);r.push(t)}})))})),awaitPromise.all(o),i.fa.c_(s),awaitasyncfunction(e,t){constn=Nd(e);try{awaitn.persistence.runTransaction("notifyLocalViewChanges","readwrite",(e=>hp.forEach(t,(t=>hp.forEach(t.Qi,(i=>n.persistence.referenceDelegate.addReference(e,t.targetId,i))).next((()=>hp.forEach(t.Ki,(i=>n.persistence.referenceDelegate.removeReference(e,t.targetId,i)))))))))}catch(i){if(!gp(i))throwi;Td("LocalStore","Failedtoupdatesequencenumbers:"+i)}for(constsoft){conste=s.targetId;if(!s.fromCache){constt=n.rs.get(e),i=t.snapshotVersion,s=t.withLastLimboFreeSnapshotVersion(i);n.rs=n.rs.insert(e,s)}}}(i.localStore,r))}asyncfunctionNb(e,t){constn=Nd(e);if(!n.currentUser.isEqual(t)){Td("SyncEngine","Userchange.Newuser:",t.toKey());conste=awaitPw(n.localStore,t);n.currentUser=t,s="'waitForPendingWrites'promiseisrejectedduetoauserchange.",(i=n).Ca.forEach((e=>{e.forEach((e=>{e.reject(newPd(xd.CANCELLED,s))}))})),i.Ca.clear(),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),awaitAb(n,e.cs)}vari,s}functionxb(e,t){constn=Nd(e),i=n.Sa.get(t);if(i&&i.ma)returntg().add(i.key);{lete=tg();consti=n.pa.get(t);if(!i)returne;for(consttofi){consti=n.ga.get(t);e=e.unionWith(i.view.la)}returne}}asyncfunctionPb(e,t){constn=Nd(e),i=awaitFw(n.localStore,t.query,!0),s=t.view.Ra(i);returnn.isPrimaryClient&&Eb(n,t.targetId,s.Ea),s}asyncfunctionDb(e,t){constn=Nd(e);returnUw(n.localStore,t).then((e=>Ab(n,e)))}asyncfunctionOb(e,t,n,i){consts=Nd(e),r=awaitfunction(e,t){constn=Nd(e),i=Nd(n.mutationQueue);returnn.persistence.runTransaction("Lookupmutationdocuments","readonly",(e=>i.Fn(e,t).next((t=>t?n.localDocuments.getDocuments(e,t):hp.resolve(null)))))}(s.localStore,t);varo,a;null!==r?("pending"===n?awaitP_(s.remoteStore):"acknowledged"===n||"rejected"===n?(Ib(s,t,i||null),bb(s,t),o=s.localStore,a=t,Nd(Nd(o).mutationQueue).xn(a)):Cd(),awaitAb(s,r)):Td("SyncEngine","Cannotapplymutationbatchwithid:"+t)}asyncfunctionRb(e,t,n){consti=Nd(e),s=[],r=[];for(constooft){lete;constt=i.pa.get(o);if(t&&0!==t.length){e=awaitMw(i.localStore,Rm(t[0]));for(consteoft){constt=i.ga.get(e),n=awaitPb(i,t);n.snapshot&&r.push(n.snapshot)}}else{constt=awaitVw(i.localStore,o);e=awaitMw(i.localStore,t),awaitfb(i,Mb(t),o,!1,e.resumeToken)}s.push(e)}returni.fa.c_(r),s}functionMb(e){returnCm(e.path,e.collectionGroup,e.orderBy,e.filters,e.limit,"F",e.startAt,e.endAt)}functionLb(e){returnt=Nd(e).localStore,Nd(Nd(t).persistence).ki();vart}asyncfunctionFb(e,t,n,i){consts=Nd(e);if(s.Fa)returnvoidTd("SyncEngine","Ignoringunexpectedquerystatenotification.");constr=s.pa.get(t);if(r&&r.length>0)switch(n){case"current":case"not-current":{conste=awaitUw(s.localStore,Bm(r[0])),i=Jg.createSynthesizedRemoteEventForCurrentChange(t,"current"===n,ff.EMPTY_BYTE_STRING);awaitAb(s,e,i);break}case"rejected":awaitLw(s.localStore,t,!0),Tb(s,t,i);break;default:Cd()}}asyncfunctionVb(e,t,n){consti=Ub(e);if(i.Fa){for(consteoft){if(i.pa.has(e)){Td("SyncEngine","Addinganalreadyactivetarget"+e);continue}constt=awaitVw(i.localStore,e),n=awaitMw(i.localStore,t);awaitfb(i,Mb(t),n.targetId,!1,n.resumeToken),v_(i.remoteStore,n)}for(consteofn)i.pa.has(e)&&awaitLw(i.localStore,e,!1).then((()=>{w_(i.remoteStore,e),Tb(i,e)})).catch(up)}}functionUb(e){constt=Nd(e);returnt.remoteStore.remoteSyncer.applyRemoteEvent=gb.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=xb.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=vb.bind(null,t),t.fa.c_=$_.bind(null,t.eventManer),t.fa.xa=eb.bind(null,t.eventManer),t}functionjb(e){constt=Nd(e);returnt.remoteStore.remoteSyncer.applySuccessfulWrite=wb.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=_b.bind(null,t),t}classBb{constructor(){this.synchronizeTabs=!1}asyncinitialize(e){this.serializer=c_(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),awaitthis.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbeCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbeCollectionScheduler(e,t){returnnull}createIndexBackfillerScheduler(e,t){returnnull}createLocalStore(e){returnxw(this.persistence,newAw,e.initialUser,this.serializer)}createPersistence(e){returnnewgw(vw.Jr,this.serializer)}createSharedClientState(e){returnnewXw}asyncterminate(){this.gcScheduler&&this.gcScheduler.stop(),awaitthis.sharedClientState.shutdown(),awaitthis.persistence.shutdown()}}classqbextendsBb{constructor(e,t,n){super(),this.Na=e,this.cacheSizeBytes=t,this.forceOwnership=n,this.synchronizeTabs=!1}asyncinitialize(e){awaitsuper.initialize(e),awaitthis.Na.initialize(this,e),awaitjb(this.Na.syncEngine),awaitP_(this.Na.remoteStore),awaitthis.persistence.gi((()=>(this.gcScheduler&&!this.gcScheduler.started&&this.gcScheduler.start(),this.indexBackfillerScheduler&&!this.indexBackfillerScheduler.started&&this.indexBackfillerScheduler.start(),Promise.resolve())))}createLocalStore(e){returnxw(this.persistence,newAw,e.initialUser,this.serializer)}createGarbeCollectionScheduler(e,t){constn=this.persistence.referenceDelegate.garbeCollector;returnnewWv(n,e.asyncQueue,t)}createIndexBackfillerScheduler(e,t){constn=newIp(t,this.persistence);returnnewbp(e.asyncQueue,n)}createPersistence(e){constt=Ew(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey),n=void0!==this.cacheSizeBytes?Dv.withCacheSize(this.cacheSizeBytes):Dv.DEFAULT;returnnewIw(this.synchronizeTabs,t,e.clientId,n,e.asyncQueue,o_(),a_(),this.serializer,this.sharedClientState,!!this.forceOwnership)}createSharedClientState(e){returnnewXw}}classzbextendsqb{constructor(e,t){super(e,t,!1),this.Na=e,this.cacheSizeBytes=t,this.synchronizeTabs=!0}asyncinitialize(e){awaitsuper.initialize(e);constt=this.Na.syncEngine;this.sharedClientStateinstanceofJw&&(this.sharedClientState.syncEngine={Xs:Ob.bind(null,t),eo:Fb.bind(null,t),no:Vb.bind(null,t),ki:Lb.bind(null,t),Zs:Db.bind(null,t)},awaitthis.sharedClientState.start()),awaitthis.persistence.gi((asynce=>{awaitasyncfunction(e,t){constn=Nd(e);if(Ub(n),jb(n),!0===t&&!0!==n.Fa){conste=n.sharedClientState.getAllActiveQueryTargets(),t=awaitRb(n,e.toArray());n.Fa=!0,awaitB_(n.remoteStore,!0);for(constioft)v_(n.remoteStore,i)}elseif(!1===t&&!1!==n.Fa){conste=[];lett=Promise.resolve();n.pa.forEach(((i,s)=>{n.sharedClientState.isLocalQueryTarget(s)?e.push(s):t=t.then((()=>(Tb(n,s),Lw(n.localStore,s,!0)))),w_(n.remoteStore,s)})),awaitt,awaitRb(n,e),function(e){constt=Nd(e);t.Sa.forEach(((e,n)=>{w_(t.remoteStore,n)})),t.ba.gr(),t.Sa=newMap,t.wa=newof(Zd.comparator)}(n),n.Fa=!1,awaitB_(n.remoteStore,!1)}}(this.Na.syncEngine,e),this.gcScheduler&&(e&&!this.gcScheduler.started?this.gcScheduler.start():e||this.gcScheduler.stop()),this.indexBackfillerScheduler&&(e&&!this.indexBackfillerScheduler.started?this.indexBackfillerScheduler.start():e||this.indexBackfillerScheduler.stop())}))}createSharedClientState(e){constt=o_();if(!Jw.C(t))thrownewPd(xd.UNIMPLEMENTED,"IndexedDBpersistenceisonlyailableonplatformsthatsupportLocalStore.");constn=Ew(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey);returnnewJw(t,e.asyncQueue,n,e.clientId,e.initialUser)}}classGb{asyncinitialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManer=this.createEventManer(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>yb(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Nb.bind(null,this.syncEngine),awaitB_(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManer(e){returnnewJ_}createDatastore(e){constt=c_(e.databaseInfo.databaseId),n=(i=e.databaseInfo,newr_(i));vari;returnfunction(e,t,n,i){returnnewp_(e,t,n,i)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){returnt=this.localStore,n=this.datastore,i=e.asyncQueue,s=e=>yb(this.syncEngine,e,0),r=$w.C()?new$w:newZw,newm_(t,n,i,s,r);vart,n,i,s,r}createSyncEngine(e,t){returnfunction(e,t,n,i,s,r,o){consta=newdb(e,t,n,i,s,r);returno&&(a.Fa=!0),a}(this.localStore,this.remoteStore,this.eventManer,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}terminate(){returnasyncfunction(e){constt=Nd(e);Td("RemoteStore","RemoteStoreshuttingdown."),t.F_.add(5),awaity_(t),t.x_.shutdown(),t.O_.set("Unknown")}(this.remoteStore)}}functionKb(e,t=){letn=0;return{asyncread(){if(n{this.muted||e(t)}),0)}}classWb{constructor(e,t){this.ka=e,this.serializer=t,this.metadata=newDd,this.buffer=newUint8Array,this.qa=newTextDecoder("utf-8"),this.Qa().then((e=>{e&&e.ea()?this.metadata.resolve(e.X_.metadata):this.metadata.reject(newError("Thefirstelementofthebundleisnotametadata,itis\n".concat(JSON.stringify(null==e?void0:e.X_))))}),(e=>this.metadata.reject(e)))}close(){returnthis.ka.cancel()}asyncgetMetadata(){returnthis.metadata.promise}asyncOa(){returnawaitthis.getMetadata(),this.Qa()}asyncQa(){conste=awaitthis.Ka();if(null===e)returnnull;constt=this.qa.decode(e),n=Number(t);isNaN(n)&&this.$a("lengthstring(".concat(t,")isnotvalidnumber"));consti=awaitthis.Ua(n);returnnewib(JSON.parse(i),e.length+n)}Wa(){returnthis.buffer.findIndex((e=>e==="{".charCodeAt(0)))}asyncKa(){for(;this.Wa(){constt=function(e,t){return"found"int?function(e,t){Ad(!!t.found),t.found.name,t.found.updateTime;constn=yy(e,t.found.name),i=py(t.found.updateTime),s=t.found.createTime?py(t.found.createTime):Wd.min(),r=newKf({mapValue:{fields:t.found.fields}});returnWf.newFoundDocument(n,i,s,r)}(e,t):"missing"int?function(e,t){Ad(!!t.missing),Ad(!!t.readTime);constn=yy(e,t.missing),i=py(t.readTime);returnWf.newNoDocument(n,i)}(e,t):Cd()}(n.serializer,e);o.set(t.key.toString(),t)}));consta=[];returnt.forEach((e=>{constt=o.get(e.toString());Ad(!!t),a.push(t)})),a}(this.datastore,e);returnt.forEach((e=>this.recordVersion(e))),t}set(e,t){this.write(t.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,t){try{this.write(t.toMutation(e,this.preconditionForUpdate(e)))}catch(n){this.lastWriteError=n}this.writtenDocs.add(e.toString())}delete(e){this.write(newRg(e,this.precondition(e))),this.writtenDocs.add(e.toString())}asynccommit(){if(this.ensureCommitNotCalled(),this.lastWriteError)throwthis.lastWriteError;conste=this.readVersions;this.mutations.forEach((t=>{e.delete(t.key.toString())})),e.forEach(((e,t)=>{constn=Zd.fromPath(t);this.mutations.push(newMg(n,this.precondition(n)))})),awaitasyncfunction(e,t){constn=Nd(e),i=_y(n.serializer)+"/documents",s={writes:t.map((e=>Sy(n.serializer,e)))};awaitn.bo("Commit",i,s)}(this.datastore,this.mutations),this.committed=!0}recordVersion(e){lett;if(e.isFoundDocument())t=e.version;else{if(!e.isNoDocument())throwCd();t=Wd.min()}constn=this.readVersions.get(e.key.toString());if(n){if(!t.isEqual(n))thrownewPd(xd.ABORTED,"Documentversionchangedbetweentworeads.")}elsethis.readVersions.set(e.key.toString(),t)}precondition(e){constt=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&t?t.isEqual(Wd.min())?bg.exists(!1):bg.updateTime(t):bg.none()}preconditionForUpdate(e){constt=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&t){if(t.isEqual(Wd.min()))thrownewPd(xd.INVALID_ARGUMENT,"Can'tupdateadocumentthatdoesn'texist.");returnbg.updateTime(t)}returnbg.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}}classYb{constructor(e,t,n,i,s){this.asyncQueue=e,this.datastore=t,this.options=n,this.updateFunction=i,this.deferred=s,this.za=n.maxAttempts,this.Ho=newl_(this.asyncQueue,"transaction_retry")}run(){this.za-=1,this.ja()}ja(){this.Ho.Qo((async()=>{conste=newQb(this.datastore),t=this.Ha(e);t&&t.then((t=>{this.asyncQueue.enqueueAndForget((()=>e.commit().then((()=>{this.deferred.resolve(t)})).catch((e=>{this.Ja(e)}))))})).catch((e=>{this.Ja(e)}))}))}Ha(e){try{constt=this.updateFunction(e);return!Sp(t)&&t.catch&&t.then?t:(this.deferred.reject(Error("TransactioncallbackmustreturnaPromise")),null)}catch(t){returnthis.deferred.reject(t),null}}Ja(e){this.za>0&&this.Ya(e)?(this.za-=1,this.asyncQueue.enqueueAndForget((()=>(this.ja(),Promise.resolve())))):this.deferred.reject(e)}Ya(e){if("FirebaseError"===e.name){constt=e.code;return"aborted"===t||"failed-precondition"===t||"already-exists"===t||!qg(t)}return!1}}classJb{constructor(e,t,n,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=i,this.user=wd.UNAUTHENTICATED,this.clientId=qd.V(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(asynce=>{Td("FirestoreClient","Receiveduser=",e.uid),awaitthis.authCredentialListener(e),this.user=e})),this.appCheckCredentials.start(n,(e=>(Td("FirestoreClient","Receivednewappchecktoken=",e),this.appCheckCredentialListener(e,this.user))))}asyncgetConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)thrownewPd(xd.FAILED_PRECONDITION,"Theclienthasalreadybeenterminated.")}terminate(){this.asyncQueue.enterRestrictedMode();conste=newDd;returnthis.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&awaitthis._onlineComponents.terminate(),this._offlineComponents&&awaitthis._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(jS){constn=K_(jS,"Failedtoshutdownpersistence");e.reject(n)}})),e.promise}}asyncfunctionXb(e,t){e.asyncQueue.verifyOperationInProgress(),Td("FirestoreClient","InitializingOfflineComponentProvider");constn=awaite.getConfiguration();awaitt.initialize(n);leti=n.initialUser;e.setCredentialChangeListener((asynce=>{i.isEqual(e)||(awaitPw(t.localStore,e),i=e)})),t.persistence.setDatabaseDeletedListener((()=>e.terminate())),e._offlineComponents=t}asyncfunctionZb(e,t){e.asyncQueue.verifyOperationInProgress();constn=awaiteI(e);Td("FirestoreClient","InitializingOnlineComponentProvider");consti=awaite.getConfiguration();awaitt.initialize(n,i),e.setCredentialChangeListener((e=>j_(t.remoteStore,e))),e.setAppCheckTokenChangeListener(((e,n)=>j_(t.remoteStore,n))),e._onlineComponents=t}function$b(e){return"FirebaseError"===e.name?e.code===xd.FAILED_PRECONDITION||e.code===xd.UNIMPLEMENTED:!("undefined"!=typeofDOMException&&einstanceofDOMException)||22===e.code||20===e.code||11===e.code}asyncfunctioneI(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){Td("FirestoreClient","UsinguserprovidedOfflineComponentProvider");try{awaitXb(e,e._uninitializedComponentsProvider._offline)}catch(jS){constn=jS;if(!$b(n))thrown;Ed("Errorusinguserprovidedcache.Fallingbacktomemorycache:"+n),awaitXb(e,newBb)}}elseTd("FirestoreClient","UsingdefaultOfflineComponentProvider"),awaitXb(e,newBb);returne._offlineComponents}asyncfunctiontI(e){returne._onlineComponents||(e._uninitializedComponentsProvider?(Td("FirestoreClient","UsinguserprovidedOnlineComponentProvider"),awaitZb(e,e._uninitializedComponentsProvider._online)):(Td("FirestoreClient","UsingdefaultOnlineComponentProvider"),awaitZb(e,newGb))),e._onlineComponents}functionnI(e){returneI(e).then((e=>e.persistence))}functioniI(e){returneI(e).then((e=>e.localStore))}functionsI(e){returntI(e).then((e=>e.remoteStore))}functionrI(e){returntI(e).then((e=>e.syncEngine))}asyncfunctionoI(e){constt=awaittI(e),n=t.eventManer;returnn.onListen=pb.bind(null,t.syncEngine),n.onUnlisten=mb.bind(null,t.syncEngine),n}functionaI(e,t,n={}){consti=newDd;returne.asyncQueue.enqueueAndForget((async()=>function(e,t,n,i,s){constr=newHb({next:r=>{t.enqueueAndForget((()=>Z_(e,o)));consta=r.docs.has(n);!a&&r.fromCache?s.reject(newPd(xd.UNAILABLE,"Failedtogetdocumentbecausetheclientisoffline.")):a&&r.fromCache&&i&&"server"===i.source?s.reject(newPd(xd.UNAILABLE,'Failedtogetdocumentfromserver.(However,thisdocumentdoesexistinthelocalcache.Runainwithoutsettingsourceto"server"toretrievethecacheddocument.)')):s.resolve(r)},error:e=>s.reject(e)}),o=newnb(Am(n.path),r,{includeMetadataChanges:!0,Z_:!0});returnX_(e,o)}(awaitoI(e),e.asyncQueue,t,n,i))),i.promise}functioncI(e,t,n={}){consti=newDd;returne.asyncQueue.enqueueAndForget((async()=>function(e,t,n,i,s){constr=newHb({next:n=>{t.enqueueAndForget((()=>Z_(e,o))),n.fromCache&&"server"===i.source?s.reject(newPd(xd.UNAILABLE,'Failedtogetdocumentsfromserver.(However,thesedocumentsmayexistinthelocalcache.Runainwithoutsettingsourceto"server"toretrievethecacheddocuments.)')):s.resolve(n)},error:e=>s.reject(e)}),o=newnb(n,r,{includeMetadataChanges:!0,Z_:!0});returnX_(e,o)}(awaitoI(e),e.asyncQueue,t,n,i))),i.promise}functionlI(e,t,n,i){consts=function(e,t){letn;returnn="string"==typeofe?Gg().encode(e):e,i=function(e,t){if(einstanceofUint8Array)returnKb(e,t);if(einstanceofArrayBuffer)returnKb(newUint8Array(e),t);if(einstanceofReadableStream)returne.getReader();thrownewError("Sourceof`toByteStreamReader`hastobeaArrayBufferorReadableStream")}(n),newWb(i,t);vari}(n,c_(t));e.asyncQueue.enqueueAndForget((async()=>{!function(e,t,n){consti=Nd(e);(asyncfunction(e,t,n){try{consts=awaitt.getMetadata();if(awaitfunction(e,t){constn=Nd(e),i=py(t.createTime);returnn.persistence.runTransaction("hasNewerBundle","readonly",(e=>n.Ur.getBundleMetadata(e,t.id))).then((e=>!!e&&e.createTime.compareTo(i)>=0))}(e.localStore,s))returnawaitt.close(),n._completeWith({taskState:"Success",documentsLoaded:(i=s).totalDocuments,bytesLoaded:i.totalBytes,totalDocuments:i.totalDocuments,totalBytes:i.totalBytes}),Promise.resolve(newSet);n._updateProgress(ob(s));constr=newrb(s,e.localStore,t.serializer);leto=awaitt.Oa();for(;o;){conste=awaitr.na(o);e&&n._updateProgress(e),o=awaitt.Oa()}consta=awaitr.complete();returnawaitAb(e,a.sa,void0),awaitfunction(e,t){constn=Nd(e);returnn.persistence.runTransaction("Sebundle","readwrite",(e=>n.Ur.seBundleMetadata(e,t)))}(e.localStore,s),n._completeWith(a.progress),Promise.resolve(a.ia)}catch(i){returnEd("SyncEngine","Loadingbundlefailedwith".concat(i)),n._failWith(i),Promise.resolve(newSet)}vari})(i,t,n).then((e=>{i.sharedClientState.notifyBundleLoaded(e)}))}(awaitrI(e),s,i)}))}functionuI(e){constt={};returnvoid0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}consthI=newMap;functiondI(e,t,n){if(!n)thrownewPd(xd.INVALID_ARGUMENT,"Function".concat(e,"()cannotbecalledwithanempty").concat(t,"."))}functionpI(e,t,n,i){if(!0===t&&!0===i)thrownewPd(xd.INVALID_ARGUMENT,"".concat(e,"and").concat(n,"cannotbeusedtogether."))}functionfI(e){if(!Zd.isDocumentKey(e))thrownewPd(xd.INVALID_ARGUMENT,"Invaliddocumentreference.Documentreferencesmustheanevennumberofsegments,but".concat(e,"has").concat(e.length,"."))}functionmI(e){if(Zd.isDocumentKey(e))thrownewPd(xd.INVALID_ARGUMENT,"Invalidcollectionreference.Collectionreferencesmustheanoddnumberofsegments,but".concat(e,"has").concat(e.length,"."))}functiongI(e){if(void0===e)return"undefined";if(null===e)return"null";if("string"==typeofe)returne.length>20&&(e="".concat(e.substring(0,20),"...")),JSON.stringify(e);if("number"==typeofe||"boolean"==typeofe)return""+e;if("object"==typeofe){if(einstanceofArray)return"anarray";{constn=(t=e).constructor?t.constructor.name:null;returnn?"acustom".concat(n,"object"):"anobject"}}vart;return"function"==typeofe?"afunction":Cd()}functionyI(e,t){if("_delegate"ine&&(e=e._delegate),!(einstanceoft)){if(t.name===e.constructor.name)thrownewPd(xd.INVALID_ARGUMENT,"Typedoesnotmatchtheexpectedinstance.DidyoupassareferencefromadifferentFirestoreSDK?");{constn=gI(e);thrownewPd(xd.INVALID_ARGUMENT,"Expectedtype'".concat(t.name,"',butitwas:").concat(n))}}returne}functionvI(e,t){if(t{}));constt=newDd;returnthis.au((()=>this.eu&&this.iu?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.Xa.push(e),this.uu())))}asyncuu(){if(0!==this.Xa.length){try{awaitthis.Xa[0](),this.Xa.shift(),this.Ho.reset()}catch(KS){if(!gp(KS))throwKS;Td("AsyncQueue","Operationfailedwithretryableerror:"+KS)}this.Xa.length>0&&this.Ho.Qo((()=>this.uu()))}}au(e){constt=this.Za.then((()=>(this.ru=!0,e().catch((e=>{this.nu=e,this.ru=!1;throwSd("INTERNALUNHANDLEDERROR:",function(e){lett=e.messe||"";returne.stack&&(t=e.stack.includes(e.messe)?e.stack:e.messe+"\n"+e.stack),t}(e)),e})).then((e=>(this.ru=!1,e))))));returnthis.Za=t,t}enqueueAfterDelay(e,t,n){this._u(),this.su.indexOf(e)>-1&&(t=0);consti=G_.createAndSchedule(this,e,t,n,(e=>this.cu(e)));returnthis.tu.push(i),i}_u(){this.nu&&Cd()}verifyOperationInProgress(){}asynclu(){lete;do{e=this.Za,awaite}while(e!==this.Za)}hu(e){for(consttofthis.tu)if(t.timerId===e)return!0;return!1}Pu(e){returnthis.lu().then((()=>{this.tu.sort(((e,t)=>e.targetTimeMs-t.targetTimeMs));for(consttofthis.tu)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;returnthis.lu()}))}Iu(e){this.su.push(e)}cu(e){constt=this.tu.indexOf(e);this.tu.splice(t,1)}}functionxI(e){returnfunction(e,t){if("object"!=typeofe||null===e)return!1;constn=e;for(constioft)if(iinn&&"function"==typeofn[i])return!0;return!1}(e,["next","error","complete"])}classPI{constructor(){this._progressObserver={},this._taskCompletionResolver=newDd,this._lastProgress={taskState:"Running",totalBytes:0,totalDocuments:0,bytesLoaded:0,documentsLoaded:0}}onProgress(e,t,n){this._progressObserver={next:e,error:t,complete:n}}catch(e){returnthis._taskCompletionResolver.promise.catch(e)}then(e,t){returnthis._taskCompletionResolver.promise.then(e,t)}_completeWith(e){this._updateProgress(e),this._progressObserver.complete&&this._progressObserver.complete(),this._taskCompletionResolver.resolve(e)}_failWith(e){this._lastProgress.taskState="Error",this._progressObserver.next&&this._progressObserver.next(this._lastProgress),this._progressObserver.error&&this._progressObserver.error(e),this._taskCompletionResolver.reject(e)}_updateProgress(e){this._lastProgress=e,this._progressObserver.next&&this._progressObserver.next(e)}}letDI=classextends_I{constructor(e,t,n,i){super(e,t,n,i),this.type="firestore",this._queue=newNI,this._persistenceKey=(null==i?void0:i.name)||"[DEFAULT]"}_terminate(){returnthis._firestoreClient||RI(this),this._firestoreClient.terminate()}};functionOI(e){returne._firestoreClient||RI(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}functionRI(e){vart,n,i;consts=e._freezeSettings(),r=(o=e._databaseId,a=(null===(t=e._app)||void0===t?void0:t.options.appId)||"",c=e._persistenceKey,newIf(o,a,c,(l=s).host,l.ssl,l.experimentalForceLongPolling,l.experimentalAutoDetectLongPolling,uI(l.experimentalLongPollingOptions),l.useFetchStreams));varo,a,c,l;e._firestoreClient=newJb(e._authCredentials,e._appCheckCredentials,e._queue,r),(null===(n=s.localCache)||void0===n?void0:n._offlineComponentProvider)&&(null===(i=s.localCache)||void0===i?void0:i._onlineComponentProvider)&&(e._firestoreClient._uninitializedComponentsProvider={_offlineKind:s.localCache.kind,_offline:s.localCache._offlineComponentProvider,_online:s.localCache._onlineComponentProvider})}functionMI(e,t,n){consti=newDd;returne.asyncQueue.enqueue((async()=>{try{awaitXb(e,n),awaitZb(e,t),i.resolve()}catch(s){conste=s;if(!$b(e))throwe;Ed("Errorenablingindexeddbcache.Fallingbacktomemorycache:"+e),i.reject(e)}})).then((()=>i.promise))}functionLI(e){returnfunction(e){constt=newDd;returne.asyncQueue.enqueueAndForget((async()=>asyncfunction(t,n){consti=Nd(t);S_(i.remoteStore)||Td("SyncEngine","Thenetworkisdisabled.Thetaskreturnedby'awaitPendingWrites()'willnotcompleteuntilthenetworkisenabled.");try{conste=awaitfunction(e){constt=Nd(e);returnt.persistence.runTransaction("Gethighestunacknowledgedbatchid","readonly",(e=>t.mutationQueue.getHighestUnacknowledgedBatchId(e)))}(i.localStore);if(-1===e)returnvoidn.resolve();constt=i.Ca.get(e)||[];t.push(n),i.Ca.set(e,t)}catch(e){consti=K_(e,"InitializationofwaitForPendingWrites()operationfailed");n.reject(i)}}(awaitrI(e),t))),t.promise}(OI(e=yI(e,DI)))}functionFI(e){returnfunction(e){returne.asyncQueue.enqueue((async()=>{constt=awaitnI(e),n=awaitsI(e);returnt.setNetworkEnabled(!0),function(e){constt=Nd(e);returnt.F_.delete(0),g_(t)}(n)}))}(OI(e=yI(e,DI)))}functionVI(e){returnfunction(e){returne.asyncQueue.enqueue((async()=>{constt=awaitnI(e),n=awaitsI(e);returnt.setNetworkEnabled(!1),asyncfunction(e){constt=Nd(e);t.F_.add(0),awaity_(t),t.O_.set("Offline")}(n)}))}(OI(e=yI(e,DI)))}functionUI(e,t){returnfunction(e,t){returne.asyncQueue.enqueue((async()=>function(e,t){constn=Nd(e);returnn.persistence.runTransaction("Getnamedquery","readonly",(e=>n.Ur.getNamedQuery(e,t)))}(awaitiI(e),t)))}(OI(e=yI(e,DI)),t).then((t=>t?newII(e,null,t.query):null))}functionjI(e){if(e._initialized||e._terminated)thrownewPd(xd.FAILED_PRECONDITION,"Firestorehasalreadybeenstartedandpersistencecannolongerbeenabled.YoucanonlyenablepersistencebeforecallinganyothermethodsonaFirestoreobject.")}classBI{constructor(e){this._byteString=e}staticfromBase64String(e){try{returnnewBI(ff.fromBase64String(e))}catch(t){thrownewPd(xd.INVALID_ARGUMENT,"FailedtoconstructdatafromBase64string:"+t)}}staticfromUint8Array(e){returnnewBI(ff.fromUint8Array(e))}toBase64(){returnthis._byteString.toBase64()}toUint8Array(){returnthis._byteString.toUint8Array()}toString(){return"Bytes(base64:"+this.toBase64()+")"}isEqual(e){returnthis._byteString.isEqual(e._byteString)}}letqI=class{constructor(...e){for(lett=0;te.isPrefixOf(t)))||void0!==this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))}du(){if(this.path)for(lete=0;ec.covers(e.field)))}elsec=null,l=o.fieldTransforms;returnnewHI(newKf(a),c,l)}class$IextendszI{_toFieldTransform(e){if(2!==e.Tu)throw1===e.Tu?e.gu("".concat(this._methodName,"()canonlyappearatthetoplevelofyourupdatedata")):e.gu("".concat(this._methodName,"()cannotbeusedwithset()unlessyoupass{merge:true}"));returne.fieldMask.push(e.path),null}isEqual(e){returneinstanceof$I}}functioneT(e,t,n){returnnewYI({Tu:3,yu:t.settings.yu,methodName:e._methodName,Ru:n},t.databaseId,t.serializer,t.ignoreUndefinedProperties)}classtTextendszI{_toFieldTransform(e){returnnewwg(e.path,newhg)}isEqual(e){returneinstanceoftT}}classnTextendszI{constructor(e,t){super(e),this.Su=t}_toFieldTransform(e){constt=eT(this,e,!0),n=this.Su.map((e=>cT(e,t))),i=newdg(n);returnnewwg(e.path,i)}isEqual(e){returnthis===e}}classiTextendszI{constructor(e,t){super(e),this.Su=t}_toFieldTransform(e){constt=eT(this,e,!0),n=this.Su.map((e=>cT(e,t))),i=newfg(n);returnnewwg(e.path,i)}isEqual(e){returnthis===e}}classsTextendszI{constructor(e,t){super(e),this.bu=t}_toFieldTransform(e){constt=newgg(e.serializer,og(e.serializer,this.bu));returnnewwg(e.path,t)}isEqual(e){returnthis===e}}functionrT(e,t,n,i){consts=e.wu(1,t,n);hT("Datamustbeanobject,butitwas:",s,i);constr=[],o=Kf.empty();sf(i,((e,i)=>{consta=fT(t,e,n);i=Vt(i);constc=s.mu(a);if(iinstanceof$I)r.push(a);else{conste=cT(i,c);null!=e&&(r.push(a),o.set(a,e))}}));consta=newdf(r);returnnewWI(o,a,s.fieldTransforms)}functionoT(e,t,n,i,s,r){consto=e.wu(1,t,n),a=[dT(t,i,n)],c=[s];if(r.length%2!=0)thrownewPd(xd.INVALID_ARGUMENT,"Function".concat(t,"()needstobecalledwithanevennumberofargumentsthatalternatebetweenfieldnamesandvalues."));for(letd=0;d=0;--d)if(!gT(l,a[d])){conste=a[d];lett=c[d];t=Vt(t);constn=o.mu(e);if(tinstanceof$I)l.push(e);else{consti=cT(t,n);null!=i&&(l.push(e),u.set(e,i))}}consth=newdf(l);returnnewWI(u,h,o.fieldTransforms)}functionaT(e,t,n,i=!1){returncT(n,e.wu(i?4:3,t))}functioncT(e,t){if(uT(e=Vt(e)))returnhT("Unsupportedfieldvalue:",t,e),lT(e,t);if(einstanceofzI)returnfunction(e,t){if(!QI(t.Tu))throwt.gu("".concat(e._methodName,"()canonlybeusedwithupdate()andset()"));if(!t.path)throwt.gu("".concat(e._methodName,"()isnotcurrentlysupportedinsidearrays"));constn=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void0===e&&t.ignoreUndefinedProperties)returnnull;if(t.path&&t.fieldMask.push(t.path),einstanceofArray){if(t.settings.Ru&&4!==t.Tu)throwt.gu("Nestedarraysarenotsupported");returnfunction(e,t){constn=[];leti=0;for(constsofe){lete=cT(s,t.fu(i));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),i++}return{arrayValue:{values:n}}}(e,t)}returnfunction(e,t){if(null===(e=Vt(e)))return{nullValue:"NULL_VALUE"};if("number"==typeofe)returnog(t.serializer,e);if("boolean"==typeofe)return{booleanValue:e};if("string"==typeofe)return{stringValue:e};if(einstanceofDate){constn=Hd.fromDate(e);return{timestampValue:uy(t.serializer,n)}}if(einstanceofHd){constn=newHd(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:uy(t.serializer,n)}}if(einstanceofGI)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(einstanceofBI)return{bytesValue:hy(t.serializer,e._byteString)};if(einstanceofTI){constn=t.databaseId,i=e.firestore._databaseId;if(!i.isEqual(n))throwt.gu("Documentreferenceisfordatabase".concat(i.projectId,"/").concat(i.database,"butshouldbefordatabase").concat(n.projectId,"/").concat(n.database));return{referenceValue:fy(e.firestore._databaseId||t.databaseId,e._key.path)}}throwt.gu("Unsupportedfieldvalue:".concat(gI(e)))}(e,t)}functionlT(e,t){constn={};returnrf(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):sf(e,((e,i)=>{consts=cT(i,t.Au(e));null!=s&&(n[e]=s)})),{mapValue:{fields:n}}}functionuT(e){return!("object"!=typeofe||null===e||einstanceofArray||einstanceofDate||einstanceofHd||einstanceofGI||einstanceofBI||einstanceofTI||einstanceofzI)}functionhT(e,t,n){if(!uT(n)||("object"!=typeof(i=n)||null===i||Object.getPrototypeOf(i)!==Object.prototype&&null!==Object.getPrototypeOf(i))){consti=gI(n);throw"anobject"===i?t.gu(e+"acustomobject"):t.gu(e+""+i)}vari}functiondT(e,t,n){if((t=Vt(t))instanceofqI)returnt._internalPath;if("string"==typeoft)returnfT(e,t);throwmT("Fieldpathargumentsmustbeoftypestringor",e,!1,void0,n)}constpT=newRegExp("[~\\*/\\[\\]]");functionfT(e,t,n){if(t.search(pT)>=0)throwmT("Invalidfieldpath(".concat(t,").Pathsmustnotcontain'~','*','/','[',or']'"),e,!1,void0,n);try{returnnewqI(...t.split("."))._internalPath}catch(zS){throwmT("Invalidfieldpath(".concat(t,").Pathsmustnotbeempty,beginwith'.',endwith'.',orcontain'..'"),e,!1,void0,n)}}functionmT(e,t,n,i,s){constr=i&&!i.isEmpty(),o=void0!==s;leta="Function".concat(t,"()calledwithinvaliddata");n&&(a+="(via`toFirestore()`)"),a+=".";letc="";return(r||o)&&(c+="(found",r&&(c+="infield".concat(i)),o&&(c+="indocument".concat(s)),c+=")"),newPd(xd.INVALID_ARGUMENT,a+e+c)}functiongT(e,t){returne.some((e=>e.isEqual(t)))}classyT{constructor(e,t,n,i,s){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=i,this._converter=s}getid(){returnthis._key.path.lastSegment()}getref(){returnnewTI(this._firestore,this._converter,this._key)}exists(){returnnull!==this._document}data(){if(this._document){if(this._converter){conste=newvT(this._firestore,this._userDataWriter,this._key,this._document,null);returnthis._converter.fromFirestore(e)}returnthis._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){constt=this._document.data.field(wT("DocumentSnapshot.get",e));if(null!==t)returnthis._userDataWriter.convertValue(t)}}}classvTextendsyT{data(){returnsuper.data()}}functionwT(e,t){return"string"==typeoft?fT(e,t):tinstanceofqI?t._internalPath:t._delegate._internalPath}function_T(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)thrownewPd(xd.UNIMPLEMENTED,"limitToLast()queriesrequirespecifyingatleastoneorderBy()clause")}classbT{}classITextendsbT{}functionTT(e,t,...n){leti=[];tinstanceofbT&&i.push(t),i=i.concat(n),function(e){constt=e.filter((e=>einstanceofET)).length,n=e.filter((e=>einstanceofST)).length;if(t>1||t>0&&n>0)thrownewPd(xd.INVALID_ARGUMENT,"InvalidQuery.Whenusingcompositefilters,youcannotusemorethanonefilteratthetoplevel.Considernestingthemultiplefilterswithinan`and(...)`statement.Forexample:change`query(query,where(...),or(...))`to`query(query,and(where(...),or(...)))`.")}(i);for(constsofi)e=s._apply(e);returne}classSTextendsIT{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static_create(e,t,n){returnnewST(e,t,n)}_apply(e){constt=this._parse(e);returnOT(e._query,t),newII(e.firestore,e.converter,Mm(e._query,t))}_parse(e){constt=XI(e.firestore);returnfunction(e,t,n,i,s,r,o){leta;if(s.isKeyField()){if("array-contains"===r||"array-contains-any"===r)thrownewPd(xd.INVALID_ARGUMENT,"InvalidQuery.Youcan'tperform'".concat(r,"'queriesondocumentId()."));if("in"===r||"not-in"===r){DT(o,r);constt=[];for(constnofo)t.push(PT(i,e,n));a={arrayValue:{values:t}}}elsea=PT(i,e,o)}else"in"!==r&&"not-in"!==r&&"array-contains-any"!==r||DT(o,r),a=aT(n,t,o,"in"===r||"not-in"===r);returnem.create(s,r,a)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}classETextendsbT{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static_create(e,t){returnnewET(e,t)}_parse(e){constt=this._queryConstraints.map((t=>t._parse(e))).filter((e=>e.getFilters().length>0));return1===t.length?t[0]:tm.create(t,this._getOperator())}_apply(e){constt=this._parse(e);return0===t.getFilters().length?e:(function(e,t){letn=e;consti=t.getFlattenedFilters();for(constsofi)OT(n,s),n=Mm(n,s)}(e._query,t),newII(e.firestore,e.converter,Mm(e._query,t)))}_getQueryConstraints(){returnthis._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}classkTextendsIT{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static_create(e,t){returnnewkT(e,t)}_apply(e){constt=function(e,t,n){if(null!==e.startAt)thrownewPd(xd.INVALID_ARGUMENT,"Invalidquery.YoumustnotcallstartAt()orstartAfter()beforecallingorderBy().");if(null!==e.endAt)thrownewPd(xd.INVALID_ARGUMENT,"Invalidquery.YoumustnotcallendAt()orendBefore()beforecallingorderBy().");consti=newXf(t,n);returnfunction(e,t){if(null===xm(e)){constn=Pm(e);null!==n&&RT(e,n,t.field)}}(e,i),i}(e._query,this._field,this._direction);returnnewII(e.firestore,e.converter,function(e,t){constn=e.explicitOrderBy.concat([t]);returnnewkm(e.path,e.collectionGroup,n,e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(e._query,t))}}classCTextendsIT{constructor(e,t,n){super(),this.type=e,this._limit=t,this._limitType=n}static_create(e,t,n){returnnewCT(e,t,n)}_apply(e){returnnewII(e.firestore,e.converter,Lm(e._query,this._limit,this._limitType))}}classATextendsIT{constructor(e,t,n){super(),this.type=e,this._docOrFields=t,this._inclusive=n}static_create(e,t,n){returnnewAT(e,t,n)}_apply(e){constt=xT(e,this.type,this._docOrFields,this._inclusive);returnnewII(e.firestore,e.converter,(n=e._query,i=t,newkm(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),n.limit,n.limitType,i,n.endAt)));varn,i}}classNTextendsIT{constructor(e,t,n){super(),this.type=e,this._docOrFields=t,this._inclusive=n}static_create(e,t,n){returnnewNT(e,t,n)}_apply(e){constt=xT(e,this.type,this._docOrFields,this._inclusive);returnnewII(e.firestore,e.converter,(n=e._query,i=t,newkm(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),n.limit,n.limitType,n.startAt,i)));varn,i}}functionxT(e,t,n,i){if(n[0]=Vt(n[0]),n[0]instanceofyT)returnfunction(e,t,n,i,s){if(!i)thrownewPd(xd.NOT_FOUND,"Can'tuseaDocumentSnapshotthatdoesn'texistfor".concat(n,"()."));constr=[];for(constoofOm(e))if(o.field.isKeyField())r.push(Of(t,i.key));else{conste=i.data.field(o.field);if(wf(e))thrownewPd(xd.INVALID_ARGUMENT,'Invalidquery.Youaretryingtostartorendaqueryusingadocumentforwhichthefield"'+o.field+'"isanuncommittedservertimestamp.(Sincethevalueofthisfieldisunknown,youcannotstart/endaquerywithit.)');if(null===e){conste=o.field.canonicalString();thrownewPd(xd.INVALID_ARGUMENT,"Invalidquery.Youaretryingtostartorendaqueryusingadocumentforwhichthefield'".concat(e,"'(usedastheorderBy)doesnotexist."))}r.push(e)}returnnewQf(r,s)}(e._query,e.firestore._databaseId,t,n[0]._document,i);{consts=XI(e.firestore);returnfunction(e,t,n,i,s,r){consto=e.explicitOrderBy;if(s.length>o.length)thrownewPd(xd.INVALID_ARGUMENT,"Toomanyargumentsprovidedto".concat(i,"().ThenumberofargumentsmustbelessthanorequaltothenumberoforderBy()clauses"));consta=[];for(letc=0;c=0)returne.op;returnnull}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)thrown===t.op?newPd(xd.INVALID_ARGUMENT,"Invalidquery.Youcannotusemorethanone'".concat(t.op.toString(),"'filter.")):newPd(xd.INVALID_ARGUMENT,"Invalidquery.Youcannotuse'".concat(t.op.toString(),"'filterswith'").concat(n.toString(),"'filters."))}functionRT(e,t,n){if(!n.isEqual(t))thrownewPd(xd.INVALID_ARGUMENT,"Invalidquery.Youheawherefilterwithaninequality(=)onfield'".concat(t.toString(),"'andsoyoumustalsouse'").concat(t.toString(),"'asyourfirstargumenttoorderBy(),butyourfirstorderBy()isonfield'").concat(n.toString(),"'instead."))}classMT{convertValue(e,t="none"){switch(kf(e)){case0:returnnull;case1:returne.booleanValue;case2:returnyf(e.integerValue||e.doubleValue);case3:returnthis.convertTimestamp(e.timestampValue);case4:returnthis.convertServerTimestamp(e,t);case5:returne.stringValue;case6:returnthis.convertBytes(vf(e.bytesValue));case7:returnthis.convertReference(e.referenceValue);case8:returnthis.convertGeoPoint(e.geoPointValue);case9:returnthis.convertArray(e.arrayValue,t);case10:returnthis.convertObject(e.mapValue,t);default:throwCd()}}convertObject(e,t){returnthis.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){constn={};returnsf(e,((e,i)=>{n[e]=this.convertValue(i,t)})),n}convertGeoPoint(e){returnnewGI(yf(e.latitude),yf(e.longitude))}convertArray(e,t){return(e.values||[]).map((e=>this.convertValue(e,t)))}convertServerTimestamp(e,t){switch(t){case"previous":constn=_f(e);returnnull==n?null:this.convertValue(n,t);case"estimate":returnthis.convertTimestamp(bf(e));default:returnnull}}convertTimestamp(e){constt=gf(e);returnnewHd(t.seconds,t.nanos)}convertDocumentKey(e,t){constn=Yd.fromString(e);Ad(Fy(n));consti=newTf(n.get(1),n.get(3)),s=newZd(n.popFirst(5));returni.isEqual(t)||Sd("Document".concat(s,"containsadocumentreferencewithinadifferentdatabase(").concat(i.projectId,"/").concat(i.database,")whichisnotsupported.Itwillbetreatedasareferenceinthecurrentdatabase(").concat(t.projectId,"/").concat(t.database,")instead.")),s}}functionLT(e,t,n){leti;returni=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,i}classFTextendsMT{constructor(e){super(),this.firestore=e}convertBytes(e){returnnewBI(e)}convertReference(e){constt=this.convertDocumentKey(e,this.firestore._databaseId);returnnewTI(this.firestore,null,t)}}classVT{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){returnthis.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}letUT=classextendsyT{constructor(e,t,n,i,s,r){super(e,t,n,i,r),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){returnsuper.exists()}data(e={}){if(this._document){if(this._converter){constt=newjT(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);returnthis._converter.fromFirestore(t,e)}returnthis._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){constn=this._document.data.field(wT("DocumentSnapshot.get",e));if(null!==n)returnthis._userDataWriter.convertValue(n,t.serverTimestamps)}}},jT=classextendsUT{data(e={}){returnsuper.data(e)}},BT=class{constructor(e,t,n,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=newVT(i.hasPendingWrites,i.fromCache),this.query=n}getdocs(){conste=[];returnthis.forEach((t=>e.push(t))),e}getsize(){returnthis._snapshot.docs.size}getempty(){return0===this.size}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,newjT(this._firestore,this._userDataWriter,n.key,n,newVT(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){constt=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)thrownewPd(xd.INVALID_ARGUMENT,"Toincludemetadatachangeswithyourdocumentchanges,youmustalsopass{includeMetadataChanges:true}toonSnapshot().");returnthis._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){lett=0;returne._snapshot.docChanges.map((n=>{consti=newjT(e._firestore,e._userDataWriter,n.doc.key,n.doc,newVT(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);returnn.doc,{type:"added",doc:i,oldIndex:-1,newIndex:t++}}))}{letn=e._snapshot.oldDocs;returne._snapshot.docChanges.filter((e=>t||3!==e.type)).map((t=>{consti=newjT(e._firestore,e._userDataWriter,t.doc.key,t.doc,newVT(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);lets=-1,r=-1;return0!==t.type&&(s=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),r=n.indexOf(t.doc.key)),{type:qT(t.type),doc:i,oldIndex:s,newIndex:r}}))}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}};functionqT(e){switch(e){case0:return"added";case2:case3:return"modified";case1:return"removed";default:returnCd()}}functionzT(e,t){returneinstanceofUT&&tinstanceofUT?e._firestore===t._firestore&&e._key.isEqual(t._key)&&(null===e._document?null===t._document:e._document.isEqual(t._document))&&e._converter===t._converter:einstanceofBT&&tinstanceofBT&&e._firestore===t._firestore&&AI(e.query,t.query)&&e.metadata.isEqual(t.metadata)&&e._snapshot.isEqual(t._snapshot)}classGTextendsMT{constructor(e){super(),this.firestore=e}convertBytes(e){returnnewBI(e)}convertReference(e){constt=this.convertDocumentKey(e,this.firestore._databaseId);returnnewTI(this.firestore,null,t)}}functionKT(e){e=yI(e,TI);constt=yI(e.firestore,DI),n=OI(t),i=newGT(t);returnfunction(e,t){constn=newDd;returne.asyncQueue.enqueueAndForget((async()=>asyncfunction(e,t,n){try{consti=awaitfunction(e,t){constn=Nd(e);returnn.persistence.runTransaction("readdocument","readonly",(e=>n.localDocuments.getDocument(e,t)))}(e,t);i.isFoundDocument()?n.resolve(i):i.isNoDocument()?n.resolve(null):n.reject(newPd(xd.UNAILABLE,"Failedtogetdocumentfromcache.(However,thisdocumentmayexistontheserver.Runainwithoutsetting'source'intheGetOptionstoattempttoretrievethedocumentfromtheserver.)"))}catch(i){conste=K_(i,"Failedtogetdocument'".concat(t,"fromcache"));n.reject(e)}}(awaitiI(e),t,n))),n.promise}(n,e._key).then((n=>newUT(t,i,e._key,n,newVT(null!==n&&n.hasLocalMutations,!0),e.converter)))}functionHT(e){e=yI(e,II);constt=yI(e.firestore,DI),n=OI(t),i=newGT(t);returnfunction(e,t){constn=newDd;returne.asyncQueue.enqueueAndForget((async()=>asyncfunction(e,t,n){try{consti=awaitFw(e,t,!0),s=newlb(t,i.Ps),r=s.ha(i.documents),o=s.applyChanges(r,!1);n.resolve(o.snapshot)}catch(i){conste=K_(i,"Failedtoexecutequery'".concat(t,"ainstcache"));n.reject(e)}}(awaitiI(e),t,n))),n.promise}(n,e._query).then((n=>newBT(t,i,e,n)))}functionWT(e,t,n){e=yI(e,TI);consti=yI(e.firestore,DI),s=LT(e.converter,t,n);returnXT(i,[ZI(XI(i),"setDoc",e._key,s,null!==e.converter,n).toMutation(e._key,bg.none())])}functionQT(e,t,n,...i){e=yI(e,TI);consts=yI(e.firestore,DI),r=XI(s);leto;returno="string"==typeof(t=Vt(t))||tinstanceofqI?oT(r,"updateDoc",e._key,t,n,i):rT(r,"updateDoc",e._key,t),XT(s,[o.toMutation(e._key,bg.exists(!0))])}functionYT(e,...t){varn,i,s;e=Vt(e);letr={includeMetadataChanges:!1},o=0;"object"!=typeoft[o]||xI(t[o])||(r=t[o],o++);consta={includeMetadataChanges:r.includeMetadataChanges};if(xI(t[o])){conste=t[o];t[o]=null===(n=e.next)||void0===n?void0:n.bind(e),t[o+1]=null===(i=e.error)||void0===i?void0:i.bind(e),t[o+2]=null===(s=e.complete)||void0===s?void0:s.bind(e)}letc,l,u;if(einstanceofTI)l=yI(e.firestore,DI),u=Am(e._key.path),c={next:n=>{t[o]&&t[o](ZT(l,e,n))},error:t[o+1],complete:t[o+2]};else{constn=yI(e,II);l=yI(n.firestore,DI),u=n._query;consti=newGT(l);c={next:e=>{t[o]&&t[o](newBT(l,i,n,e))},error:t[o+1],complete:t[o+2]},_T(e._query)}returnfunction(e,t,n,i){consts=newHb(i),r=newnb(t,s,n);returne.asyncQueue.enqueueAndForget((async()=>X_(awaitoI(e),r))),()=>{s.La(),e.asyncQueue.enqueueAndForget((async()=>Z_(awaitoI(e),r)))}}(OI(l),u,a,c)}functionJT(e,t){returnfunction(e,t){constn=newHb(t);returne.asyncQueue.enqueueAndForget((async()=>{returnt=awaitoI(e),i=n,Nd(t).K_.add(i),voidi.next();vart,i})),()=>{n.La(),e.asyncQueue.enqueueAndForget((async()=>{returnt=awaitoI(e),i=n,voidNd(t).K_.delete(i);vart,i}))}}(OI(e=yI(e,DI)),xI(t)?t:{next:t})}functionXT(e,t){returnfunction(e,t){constn=newDd;returne.asyncQueue.enqueueAndForget((async()=>asyncfunction(t,n,i){consts=jb(t);try{conste=awaitfunction(e,t){constn=Nd(e),i=Hd.now(),s=t.reduce(((e,t)=>e.add(t.key)),tg());letr,o;returnn.persistence.runTransaction("Locallywritemutations","readwrite",(e=>{leta=Hm(),c=tg();returnn._s.getEntries(e,s).next((e=>{a=e,a.forEach(((e,t)=>{t.isValidDocument()||(c=c.add(e))}))})).next((()=>n.localDocuments.getOverlayedDocuments(e,a))).next((s=>{r=s;consto=[];for(consteoft){constt=Cg(e,r.get(e.key).overlayedDocument);null!=t&&o.push(newxg(e.key,t,Hf(t.value.mapValue),bg.exists(!0)))}returnn.mutationQueue.addMutationBatch(e,i,o,t)})).next((t=>{o=t;consti=t.applyToLocalDocumentSet(r,c);returnn.documentOverlayCache.seOverlays(e,t.batchId,i)}))})).then((()=>({batchId:o.batchId,changes:Ym(r)})))}(s.localStore,n);s.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){leti=e.Da[e.currentUser.toKey()];i||(i=newof(zd)),i=i.insert(t,n),e.Da[e.currentUser.toKey()]=i}(s,e.batchId,i),awaitAb(s,e.changes),awaitP_(s.remoteStore)}catch(e){constn=K_(e,"Failedtopersistwrite");i.reject(n)}}(awaitrI(e),t,n))),n.promise}(OI(e),t)}functionZT(e,t,n){consti=n.docs.get(t._key),s=newGT(e);returnnewUT(e,s,t._key,i,newVT(n.hasPendingWrites,n.fromCache),t.converter)}const$T={maxAttempts:5};leteS=class{constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=XI(e)}set(e,t,n){this._verifyNotCommitted();consti=tS(e,this._firestore),s=LT(i.converter,t,n),r=ZI(this._dataReader,"WriteBatch.set",i._key,s,null!==i.converter,n);returnthis._mutations.push(r.toMutation(i._key,bg.none())),this}update(e,t,n,...i){this._verifyNotCommitted();consts=tS(e,this._firestore);letr;returnr="string"==typeof(t=Vt(t))||tinstanceofqI?oT(this._dataReader,"WriteBatch.update",s._key,t,n,i):rT(this._dataReader,"WriteBatch.update",s._key,t),this._mutations.push(r.toMutation(s._key,bg.exists(!0))),this}delete(e){this._verifyNotCommitted();constt=tS(e,this._firestore);returnthis._mutations=this._mutations.concat(newRg(t._key,bg.none())),this}commit(){returnthis._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)thrownewPd(xd.FAILED_PRECONDITION,"Awritebatchcannolongerbeusedaftercommit()hasbeencalled.")}};functiontS(e,t){if((e=Vt(e)).firestore!==t)thrownewPd(xd.INVALID_ARGUMENT,"ProvideddocumentreferenceisfromadifferentFirestoreinstance.");returne}letnS=classextendsclass{constructor(e,t){this._firestore=e,this._transaction=t,this._dataReader=XI(e)}get(e){constt=tS(e,this._firestore),n=newFT(this._firestore);returnthis._transaction.lookup([t._key]).then((e=>{if(!e||1!==e.length)returnCd();consti=e[0];if(i.isFoundDocument())returnnewyT(this._firestore,n,i.key,i,t.converter);if(i.isNoDocument())returnnewyT(this._firestore,n,t._key,null,t.converter);throwCd()}))}set(e,t,n){consti=tS(e,this._firestore),s=LT(i.converter,t,n),r=ZI(this._dataReader,"Transaction.set",i._key,s,null!==i.converter,n);returnthis._transaction.set(i._key,r),this}update(e,t,n,...i){consts=tS(e,this._firestore);letr;returnr="string"==typeof(t=Vt(t))||tinstanceofqI?oT(this._dataReader,"Transaction.update",s._key,t,n,i):rT(this._dataReader,"Transaction.update",s._key,t),this._transaction.update(s._key,r),this}delete(e){constt=tS(e,this._firestore);returnthis._transaction.delete(t._key),this}}{constructor(e,t){super(e,t),this._firestore=e}get(e){constt=tS(e,this._firestore),n=newGT(this._firestore);returnsuper.get(e).then((e=>newUT(this._firestore,n,t._key,e._document,newVT(!1,!1),t.converter)))}};functioniS(e,t,n){e=yI(e,DI);consti=Object.assign(Object.assign({},$T),n);returnfunction(e){if(e.maxAttempts{consts=awaitfunction(e){returntI(e).then((e=>e.datastore))}(e);newYb(e.asyncQueue,s,n,t,i).run()})),i.promise}(OI(e),(n=>t(newnS(e,n))),i)}!function(e,t=!0){_d=Nn,En(newUt("firestore",((e,{instanceIdentifier:n,options:i})=>{consts=e.getProvider("app").getImmediate(),r=newDI(newLd(e.getProvider("auth-internal")),newjd(e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))thrownewPd(xd.INVALID_ARGUMENT,'"projectId"notprovidedinfirebase.initializeApp.');returnnewTf(e.options.projectId,t)}(s,n),s);returni=Object.assign({useFetchStreams:t},i),r._setSettings(i),r}),"PUBLIC").setMultipleInstances(!0)),Dn(vd,"4.1.3",e),Dn(vd,"4.1.3","esm2017")}();functionsS(e,t){if(void0===t)return{merge:!1};if(void0!==t.mergeFields&&void0!==t.merge)thrownewPd("invalid-argument","Invalidoptionspassedtofunction".concat(e,"():Youcannot")+'specifyboth"merge"and"mergeFields".');returnt}functionrS(){if("undefined"==typeofUint8Array)thrownewPd("unimplemented","Uint8Arraysarenotailableinthisenvironment.")}functionoS(){if("undefined"==typeofatob)thrownewPd("unimplemented","BlobsareunailableinFirestoreinthisenvironment.")}classaS{constructor(e){this._delegate=e}staticfromBase64String(e){returnoS(),newaS(BI.fromBase64String(e))}staticfromUint8Array(e){returnrS(),newaS(BI.fromUint8Array(e))}toBase64(){returnoS(),this._delegate.toBase64()}toUint8Array(){returnrS(),this._delegate.toUint8Array()}isEqual(e){returnthis._delegate.isEqual(e._delegate)}toString(){return"Blob(base64:"+this.toBase64()+")"}}functioncS(e){returnfunction(e,t){if("object"!=typeofe||null===e)return!1;constn=e;for(constioft)if(iinn&&"function"==typeofn[i])return!0;return!1}(e,["next","error","complete"])}classlS{enableIndexedDbPersistence(e,t){returnfunction(e,t){jI(e=yI(e,DI));constn=OI(e);if(n._uninitializedComponentsProvider)thrownewPd(xd.FAILED_PRECONDITION,"SDKcacheisalreadyspecified.");Ed("enableIndexedDbPersistence()willbedeprecatedinthefuture,youcanuse`FirestoreSettings.cache`instead.");consti=e._freezeSettings(),s=newGb;returnMI(n,s,newqb(s,i.cacheSizeBytes,null==t?void0:t.forceOwnership))}(e._delegate,{forceOwnership:t})}enableMultiTabIndexedDbPersistence(e){returnfunction(e){jI(e=yI(e,DI));constt=OI(e);if(t._uninitializedComponentsProvider)thrownewPd(xd.FAILED_PRECONDITION,"SDKcacheisalreadyspecified.");Ed("enableMultiTabIndexedDbPersistence()willbedeprecatedinthefuture,youcanuse`FirestoreSettings.cache`instead.");constn=e._freezeSettings(),i=newGb;returnMI(t,i,newzb(i,n.cacheSizeBytes))}(e._delegate)}clearIndexedDbPersistence(e){returnfunction(e){if(e._initialized&&!e._terminated)thrownewPd(xd.FAILED_PRECONDITION,"PersistencecanonlybeclearedbeforeaFirestoreinstanceisinitializedorafteritisterminated.");constt=newDd;returne._queue.enqueueAndForgetEvenWhileRestricted((async()=>{try{awaitasyncfunction(e){if(!pp.C())returnPromise.resolve();constt=e+"main";awaitpp.delete(t)}(Ew(e._databaseId,e._persistenceKey)),t.resolve()}catch(n){t.reject(n)}})),t.promise}(e._delegate)}}classuS{constructor(e,t,n){this._delegate=t,this._persistenceProvider=n,this.INTERNAL={delete:()=>this.terminate()},einstanceofTf||(this._appCompat=e)}get_databaseId(){returnthis._delegate._databaseId}settings(e){constt=this._delegate._getSettings();e.merge||t.host===e.host||Ed("Youareoverridingtheoriginalhost.Ifyoudidnotintendtooverrideyoursettings,use{merge:true}."),e.merge&&delete(e=Object.assign(Object.assign({},t),e)).merge,this._delegate._setSettings(e)}useEmulator(e,t,n={}){bI(this._delegate,e,t,n)}enableNetwork(){returnFI(this._delegate)}disableNetwork(){returnVI(this._delegate)}enablePersistence(e){lett=!1,n=!1;returne&&(t=!!e.synchronizeTabs,n=!!e.experimentalForceOwningTab,pI("synchronizeTabs",t,"experimentalForceOwningTab",n)),t?this._persistenceProvider.enableMultiTabIndexedDbPersistence(this):this._persistenceProvider.enableIndexedDbPersistence(this,n)}clearPersistence(){returnthis._persistenceProvider.clearIndexedDbPersistence(this)}terminate(){returnthis._appCompat&&(this._appCompat._removeServiceInstance("firestore-compat"),this._appCompat._removeServiceInstance("firestore")),this._delegate._delete()}waitForPendingWrites(){returnLI(this._delegate)}onSnapshotsInSync(e){returnJT(this._delegate,e)}getapp(){if(!this._appCompat)thrownewPd("failed-precondition","FirestorewasnotinitializedusingtheFirebaseSDK.'app'isnotailable");returnthis._appCompat}collection(e){try{returnnewSS(this,EI(this._delegate,e))}catch(KS){throwgS(KS,"collection()","Firestore.collection()")}}doc(e){try{returnnewmS(this,kI(this._delegate,e))}catch(KS){throwgS(KS,"doc()","Firestore.doc()")}}collectionGroup(e){try{returnnewbS(this,function(e,t){if(e=yI(e,_I),dI("collectionGroup","collectionid",t),t.indexOf("/")>=0)thrownewPd(xd.INVALID_ARGUMENT,"InvalidcollectionID'".concat(t,"'passedtofunctioncollectionGroup().CollectionIDsmustnotcontain'/'."));returnnewII(e,null,(n=t,newkm(Yd.emptyPath(),n)));varn}(this._delegate,e))}catch(KS){throwgS(KS,"collectionGroup()","Firestore.collectionGroup()")}}runTransaction(e){returniS(this._delegate,(t=>e(newdS(this,t))))}batch(){returnOI(this._delegate),newpS(neweS(this._delegate,(e=>XT(this._delegate,e))))}loadBundle(e){returnfunction(e,t){constn=OI(e=yI(e,DI)),i=newPI;returnlI(n,e._databaseId,t,i),i}(this._delegate,e)}namedQuery(e){returnUI(this._delegate,e).then((e=>e?newbS(this,e):null))}}classhSextendsMT{constructor(e){super(),this.firestore=e}convertBytes(e){returnnewaS(newBI(e))}convertReference(e){constt=this.convertDocumentKey(e,this.firestore._databaseId);returnmS.forKey(t,this.firestore,null)}}classdS{constructor(e,t){this._firestore=e,this._delegate=t,this._userDataWriter=newhS(e)}get(e){constt=ES(e);returnthis._delegate.get(t).then((e=>newwS(this._firestore,newUT(this._firestore._delegate,this._userDataWriter,e._key,e._document,e.metadata,t.converter))))}set(e,t,n){consti=ES(e);returnn?(sS("Transaction.set",n),this._delegate.set(i,t,n)):this._delegate.set(i,t),this}update(e,t,n,...i){consts=ES(e);return2===arguments.length?this._delegate.update(s,t):this._delegate.update(s,t,n,...i),this}delete(e){constt=ES(e);returnthis._delegate.delete(t),this}}classpS{constructor(e){this._delegate=e}set(e,t,n){consti=ES(e);returnn?(sS("WriteBatch.set",n),this._delegate.set(i,t,n)):this._delegate.set(i,t),this}update(e,t,n,...i){consts=ES(e);return2===arguments.length?this._delegate.update(s,t):this._delegate.update(s,t,n,...i),this}delete(e){constt=ES(e);returnthis._delegate.delete(t),this}commit(){returnthis._delegate.commit()}}classfS{constructor(e,t,n){this._firestore=e,this._userDataWriter=t,this._delegate=n}fromFirestore(e,t){constn=newjT(this._firestore._delegate,this._userDataWriter,e._key,e._document,e.metadata,null);returnthis._delegate.fromFirestore(new_S(this._firestore,n),null!=t?t:{})}toFirestore(e,t){returnt?this._delegate.toFirestore(e,t):this._delegate.toFirestore(e)}staticgetInstance(e,t){constn=fS.INSTANCES;leti=n.get(e);i||(i=newWeakMap,n.set(e,i));lets=i.get(t);returns||(s=newfS(e,newhS(e),t),i.set(t,s)),s}}fS.INSTANCES=newWeakMap;classmS{constructor(e,t){this.firestore=e,this._delegate=t,this._userDataWriter=newhS(e)}staticforPath(e,t,n){if(e.length%2!=0)thrownewPd("invalid-argument","Invaliddocumentreference.Documentreferencesmustheanevennumberofsegments,but"+"".concat(e.canonicalString(),"has").concat(e.length));returnnewmS(t,newTI(t._delegate,n,newZd(e)))}staticforKey(e,t,n){returnnewmS(t,newTI(t._delegate,n,e))}getid(){returnthis._delegate.id}getparent(){returnnewSS(this.firestore,this._delegate.parent)}getpath(){returnthis._delegate.path}collection(e){try{returnnewSS(this.firestore,EI(this._delegate,e))}catch(KS){throwgS(KS,"collection()","DocumentReference.collection()")}}isEqual(e){return(e=Vt(e))instanceofTI&&CI(this._delegate,e)}set(e,t){t=sS("DocumentReference.set",t);try{returnt?WT(this._delegate,e,t):WT(this._delegate,e)}catch(KS){throwgS(KS,"setDoc()","DocumentReference.set()")}}update(e,t,...n){try{return1===arguments.length?QT(this._delegate,e):QT(this._delegate,e,t,...n)}catch(KS){throwgS(KS,"updateDoc()","DocumentReference.update()")}}delete(){returnXT(yI((e=this._delegate).firestore,DI),[newRg(e._key,bg.none())]);vare}onSnapshot(...e){constt=yS(e),n=vS(e,(e=>newwS(this.firestore,newUT(this.firestore._delegate,this._userDataWriter,e._key,e._document,e.metadata,this._delegate.converter))));returnYT(this._delegate,t,n)}get(e){lett;returnt="cache"===(null==e?void0:e.source)?KT(this._delegate):"server"===(null==e?void0:e.source)?function(e){e=yI(e,TI);constt=yI(e.firestore,DI);returnaI(OI(t),e._key,{source:"server"}).then((n=>ZT(t,e,n)))}(this._delegate):function(e){e=yI(e,TI);constt=yI(e.firestore,DI);returnaI(OI(t),e._key).then((n=>ZT(t,e,n)))}(this._delegate),t.then((e=>newwS(this.firestore,newUT(this.firestore._delegate,this._userDataWriter,e._key,e._document,e.metadata,this._delegate.converter))))}withConverter(e){returnnewmS(this.firestore,e?this._delegate.withConverter(fS.getInstance(this.firestore,e)):this._delegate.withConverter(null))}}functiongS(e,t,n){returne.messe=e.messe.replace(t,n),e}functionyS(e){for(consttofe)if("object"==typeoft&&!cS(t))returnt;return{}}functionvS(e,t){varn,i;lets;returns=cS(e[0])?e[0]:cS(e[1])?e[1]:"function"==typeofe[0]?{next:e[0],error:e[1],complete:e[2]}:{next:e[1],error:e[2],complete:e[3]},{next:e=>{s.next&&s.next(t(e))},error:null===(n=s.error)||void0===n?void0:n.bind(s),complete:null===(i=s.complete)||void0===i?void0:i.bind(s)}}classwS{constructor(e,t){this._firestore=e,this._delegate=t}getref(){returnnewmS(this._firestore,this._delegate.ref)}getid(){returnthis._delegate.id}getmetadata(){returnthis._delegate.metadata}getexists(){returnthis._delegate.exists()}data(e){returnthis._delegate.data(e)}get(e,t){returnthis._delegate.get(e,t)}isEqual(e){returnzT(this._delegate,e._delegate)}}class_SextendswS{data(e){constt=this._delegate.data(e);returnvoid0!==t||Cd(),t}}classbS{constructor(e,t){this.firestore=e,this._delegate=t,this._userDataWriter=newhS(e)}where(e,t,n){try{returnnewbS(this.firestore,TT(this._delegate,function(e,t,n){consti=t,s=wT("where",e);returnST._create(s,i,n)}(e,t,n)))}catch(KS){throwgS(KS,/(orderBy|where)\(\)/,"Query.$1()")}}orderBy(e,t){try{returnnewbS(this.firestore,TT(this._delegate,function(e,t="asc"){constn=t,i=wT("orderBy",e);returnkT._create(i,n)}(e,t)))}catch(KS){throwgS(KS,/(orderBy|where)\(\)/,"Query.$1()")}}limit(e){try{returnnewbS(this.firestore,TT(this._delegate,(vI("limit",t=e),CT._create("limit",t,"F"))))}catch(t){throwgS(t,"limit()","Query.limit()")}vart}limitToLast(e){try{returnnewbS(this.firestore,TT(this._delegate,(vI("limitToLast",t=e),CT._create("limitToLast",t,"L"))))}catch(t){throwgS(t,"limitToLast()","Query.limitToLast()")}vart}startAt(...e){try{returnnewbS(this.firestore,TT(this._delegate,function(...e){returnAT._create("startAt",e,!0)}(...e)))}catch(KS){throwgS(KS,"startAt()","Query.startAt()")}}startAfter(...e){try{returnnewbS(this.firestore,TT(this._delegate,function(...e){returnAT._create("startAfter",e,!1)}(...e)))}catch(KS){throwgS(KS,"startAfter()","Query.startAfter()")}}endBefore(...e){try{returnnewbS(this.firestore,TT(this._delegate,function(...e){returnNT._create("endBefore",e,!1)}(...e)))}catch(KS){throwgS(KS,"endBefore()","Query.endBefore()")}}endAt(...e){try{returnnewbS(this.firestore,TT(this._delegate,function(...e){returnNT._create("endAt",e,!0)}(...e)))}catch(KS){throwgS(KS,"endAt()","Query.endAt()")}}isEqual(e){returnAI(this._delegate,e._delegate)}get(e){lett;returnt="cache"===(null==e?void0:e.source)?HT(this._delegate):"server"===(null==e?void0:e.source)?function(e){e=yI(e,II);constt=yI(e.firestore,DI),n=OI(t),i=newGT(t);returncI(n,e._query,{source:"server"}).then((n=>newBT(t,i,e,n)))}(this._delegate):function(e){e=yI(e,II);constt=yI(e.firestore,DI),n=OI(t),i=newGT(t);return_T(e._query),cI(n,e._query).then((n=>newBT(t,i,e,n)))}(this._delegate),t.then((e=>newTS(this.firestore,newBT(this.firestore._delegate,this._userDataWriter,this._delegate,e._snapshot))))}onSnapshot(...e){constt=yS(e),n=vS(e,(e=>newTS(this.firestore,newBT(this.firestore._delegate,this._userDataWriter,this._delegate,e._snapshot))));returnYT(this._delegate,t,n)}withConverter(e){returnnewbS(this.firestore,e?this._delegate.withConverter(fS.getInstance(this.firestore,e)):this._delegate.withConverter(null))}}classIS{constructor(e,t){this._firestore=e,this._delegate=t}gettype(){returnthis._delegate.type}getdoc(){returnnew_S(this._firestore,this._delegate.doc)}getoldIndex(){returnthis._delegate.oldIndex}getnewIndex(){returnthis._delegate.newIndex}}classTS{constructor(e,t){this._firestore=e,this._delegate=t}getquery(){returnnewbS(this._firestore,this._delegate.query)}getmetadata(){returnthis._delegate.metadata}getsize(){returnthis._delegate.size}getempty(){returnthis._delegate.empty}getdocs(){returnthis._delegate.docs.map((e=>new_S(this._firestore,e)))}docChanges(e){returnthis._delegate.docChanges(e).map((e=>newIS(this._firestore,e)))}forEach(e,t){this._delegate.forEach((n=>{e.call(t,new_S(this._firestore,n))}))}isEqual(e){returnzT(this._delegate,e._delegate)}}classSSextendsbS{constructor(e,t){super(e,t),this.firestore=e,this._delegate=t}getid(){returnthis._delegate.id}getpath(){returnthis._delegate.path}getparent(){conste=this._delegate.parent;returne?newmS(this.firestore,e):null}doc(e){try{returnnewmS(this.firestore,void0===e?kI(this._delegate):kI(this._delegate,e))}catch(KS){throwgS(KS,"doc()","CollectionReference.doc()")}}add(e){returnfunction(e,t){constn=yI(e.firestore,DI),i=kI(e),s=LT(e.converter,t);returnXT(n,[ZI(XI(e.firestore),"addDoc",i._key,s,null!==e.converter,{}).toMutation(i._key,bg.exists(!1))]).then((()=>i))}(this._delegate,e).then((e=>newmS(this.firestore,e)))}isEqual(e){returnCI(this._delegate,e._delegate)}withConverter(e){returnnewSS(this.firestore,e?this._delegate.withConverter(fS.getInstance(this.firestore,e)):this._delegate.withConverter(null))}}functionES(e){returnyI(e,TI)}classkS{constructor(...e){this._delegate=newqI(...e)}staticdocumentId(){returnnewkS(Xd.keyField().canonicalString())}isEqual(e){return(e=Vt(e))instanceofqI&&this._delegate._internalPath.isEqual(e._internalPath)}}classCS{constructor(e){this._delegate=e}staticserverTimestamp(){conste=newtT("serverTimestamp");returne._methodName="FieldValue.serverTimestamp",newCS(e)}staticdelete(){conste=new$I("deleteField");returne._methodName="FieldValue.delete",newCS(e)}staticarrayUnion(...e){constt=function(...e){returnnewnT("arrayUnion",e)}(...e);returnt._methodName="FieldValue.arrayUnion",newCS(t)}staticarrayRemove(...e){constt=function(...e){returnnewiT("arrayRemove",e)}(...e);returnt._methodName="FieldValue.arrayRemove",newCS(t)}staticincrement(e){constt=newsT("increment",e);returnt._methodName="FieldValue.increment",newCS(t)}isEqual(e){returnthis._delegate.isEqual(e._delegate)}}constAS={Firestore:uS,GeoPoint:GI,Timestamp:Hd,Blob:aS,Transaction:dS,WriteBatch:pS,DocumentReference:mS,DocumentSnapshot:wS,Query:bS,QueryDocumentSnapshot:_S,QuerySnapshot:TS,CollectionReference:SS,FieldPath:kS,FieldValue:CS,setLogLevel:function(e){vart;t=e,bd.setLogLevel(t)},CACHE_SIZE_UNLIMITED:-1};!function(e){vart;t=(e,t)=>newuS(e,t,newlS),e.INTERNAL.registerComponent(newUt("firestore-compat",(e=>{constn=e.getProvider("app-compat").getImmediate(),i=e.getProvider("firestore").getImmediate();returnt(n,i)}),"PUBLIC").setServiceProps(Object.assign({},AS))),e.registerVersion("@firebase/firestore-compat","0.3.17")}(Zn);constNS={apiKey:"AIzaSyCpvPuy_47jY5Sk-nDbIzrLPRuM3rGXqgU",authDomain:"a-soft-murmur.firebaseapp.com",databaseURL:"a-soft-murmur.firebaseio.com",projectId:"a-soft-murmur",storeBucket:"a-soft-murmur.appspot.com",messingSenderId:"2943",appId:"1:2943:web:f6af491dbe904aa",measurementId:"G-XHDJFXXR2F"};!globalThis.nigator||(globalThis.nigator.userent.includes("Node.js")||globalThis.nigator.userent.includes("jsdom"))||Zn.initializeApp(NS);constxS={pro:"p",expires:"e",source:"s",recurring:"r",subscription_plan_id:"spi",currency:"c",price:"pr",update_hash:"h",paddle_user_id:"pid",product_id:"pi"},PS=()=>{try{rt("upgradeAccountCreated"),rt("apiKey"),rt("mode"),rt("oobCode")}catch(KS){}},DS=e=>{lett=e.displayName;t&&""!==t||(t="{}");letn={};try{consti=JSON.parse(t);Object.entries(i).forEach((e=>{constt=e[0],i=e[1],s=Object.entries(xS).filter((e=>e[1]===t))[0][0];n[s]=i})),n.expires=Number(n.expires),n.cancel_url=e.photoURL}catch(KS){}return{email:e.email,photoUrl:e.photoURL,emailVerified:e.emailVerified,uid:e.uid,licenseState:n}},OS=(e,t,n,i,s)=>{e().isSignInWithEmailLink(window.location.href)&&n({waitingForLogin:!0},(()=>{constr=s||t.emailPendingVerification;r?e().signInWithEmailLink(r,window.location.href).then((e=>{constt=DS(e.user);leti=window.location.href.indexOf("upgradeAccountCreated")>-1;consts={emailPendingVerification:null,waitingForLogin:!1};PS();const{licenseState:r}=t;r.pro&&(i=!1),s.upgradeDialog=i?3:null,n(s)})).catch((function(e){PS(),n({waitingForLogin:!1,upgradeDialog:null,showToast:"bad_link"})})):setTimeout((()=>n({waitingForLogin:!1},i)),1)}))},RS=(e,t)=>{if(!e||!e.uid)return;constn=(e=>{constt=Object.assign({},e);returnt.sounds=ot(e.sounds),t.created||(t.created=Date.now()),t})(t);window._firebase.firestore().collection("users").doc(e.uid).collection("mixes").doc(n.id).set(n)},MS=(e,t,n,i,s)=>{e().onAuthStateChanged((e=>{constr=t();if(e){window._firebaseUser=e;consta=DS(e);((e,t,n)=>{consti=t().sedMixes,s=Object.assign({},i),r=[];window._firebase.firestore().collection("users").doc(e.uid).collection("mixes").get().then((e=>{e.forEach((e=>{constt=e.data(),n=t.deleted,o=Boolean(i&&i[t.id]);r.push(t.id),n||o||(s[t.id]=Object.assign({},t)),n&&o&&deletes[t.id]}))})).then((()=>{n({sedMixes:s})})).then((()=>{Object.keys(i).forEach((t=>{t&&-1===r.indexOf(t)&&RS(e,i[t])}))})).catch((e=>{}))})(e,t,n);const{licenseState:c}=a,l=!(!(o=c)||!o.expires)&&!o.recurring&&o.expires{if(s(),l){lett=JSON.parse(e.displayName);t[xS.pro]=!1,t=JSON.stringify(t),e.updateProfile({displayName:t})}n({user:a})};(c.pro!==r.pro||l)&&(c.pro&&!l?i(c.expires):window._firebase.firestore().collection("users").doc(e.uid).collection("rc_license_state").doc(e.uid).get().then((e=>{if(e.exists){constt=e.data();if(t.subscriptions&&t.subscriptions.asm_2023_sub_alpha){conste=newDate(t.subscriptions.asm_2023_sub_alpha.expires_date).getTime();if(e{constt=()=>{this.setState({showToast:"pro_timeout",waitingForLicense:!1})},n=()=>{e{try{VS().currentUser.reload()}catch(KS){}})(),setTimeout((()=>this.getUpdatedUser(e+1)),2500)):t()};this.state.user||n();consti=JSON.parse(VS().currentUser.displayName||"{}");i.p?(this.activatePro(i.expires),this._setState({showToast:"welcome"})):n()})),t(this,"activatePro",((e,t)=>{this._setState({library:Object.assign({},this.state.ailableSounds),pro:!0,proExpires:e,proLastChecked:Date.now(),proFirstLoad:t,waitingForLicense:!1})})),t(this,"deactivatePro",(()=>{this._setState({library:Object.assign({},oe),pro:!1,proExpires:null,proLastChecked:null,proFirstLoad:null})})),t(this,"promptForEmail",(()=>{this._setState({upgradeDialog:4})})),t(this,"toggleAccountView",(()=>{this.toggleModal("accountView")})),t(this,"toggleModal",(e=>{if(this.state.modal===e)returnthis._setState({modal:null});this._setState({modal:e})})),t(this,"signOut",(()=>{VS().signOut().then((()=>this._setState({modal:null,user:null},this.deactivatePro))).catch((e=>{}))})),t(this,"getModal",(()=>"accountView"===this.state.modal?F(Ze,{user:this.state.user,onSignOut:this.signOut,onCancel:this.toggleAccountView,upgradeToPro:()=>this._setState({upgradeDialog:1,modal:null})}):null)),t(this,"getToast",(()=>this.state.showToast?F(nt,{variety:this.state.showToast,onClose:()=>this._setState({showToast:null})}):null)),t(this,"hideSiteDescription",(()=>{this._setState({hideSiteDescription:!0})})),this.state={},this._setState=this._setState.bind(this),this.changeGlobalVolume=this.changeGlobalVolume.bind(this),this.togglePlay=this.togglePlay.bind(this),this.hideAppLinks=this.hideAppLinks.bind(this),this.updateSoundVolume=this.updateSoundVolume.bind(this),this.onTapSoundIme=this.onTapSoundIme.bind(this),this.handleTimerStart=this.handleTimerStart.bind(this),this.handleTimerCancel=this.handleTimerCancel.bind(this),this.handleAddMix=this.handleAddMix.bind(this),this.handleLoadMix=this.handleLoadMix.bind(this),this.handleDeleteMix=this.handleDeleteMix.bind(this),this.toggleMeander=this.toggleMeander.bind(this),this.toggleReset=this.toggleReset.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.handleToggleSoundActive=this.handleToggleSoundActive.bind(this),this.handleStopActivity=this.handleStopActivity.bind(this),this.handleClearAllSounds=this.handleClearAllSounds.bind(this),this.activatePro=this.activatePro.bind(this),this.showProHelp=this.showProHelp.bind(this)}componentWillMount(){lete=Object.assign({},st);constt=ct();t&&(e=Object.assign({},e,t)),deletee.waitingForLicense;constn=le(e);e=Object.assign({},e,n),e.waitingForLicense&&(rt("waitingForLicense"),setTimeout(this.getUpdatedUser,2500)),e.pro&&deletee.waitingForLicense,deletee.token,deletee.modal,LS||(MS(VS,(()=>this.state),this._setState,this.activatePro,this.deactivatePro),OS(VS,e,this._setState,this.promptForEmail)),this._setState(e)}componentWillUpdate(e,t){constn=Boolean(this.state.timer.isActive||this.state.meander.isActive),i=Boolean(t.timer.isActive&&!this.state.timer.isActive),s=Boolean(t.meander.isActive&&!this.state.meander.isActive);!i&&!s||n||(this.lastScheduled=Date.now(),this.timer=()=>{conste=(e=>{const{timer:t}=e,{secondsLeft:n}=t,i=Object.assign({},e),s=e.meander.isActive,r=e.touchInProgress||!e.isPlaying||t.isActive&&"fade"===t.mode&&t.secondsLeft>180;if(t.isActive&&n1&&(i.timer.secondsLeft=i.timer.secondsLeft-1),s&&!e.meander.sounds){constt={};Object.keys(e.sounds).forEach((n=>{consti=e.sounds[n];lets={};s.baseVolume=i.volume,s.tickOffset=0,s.direction=Math.random()>.5?"right":"left",t[n]=s}));constn=Object.assign({},e.meander,{sounds:t,tickCount:0});i.meander=n}if(s&&!r){conste=Object.assign({},i.meander);e.sounds=Object.assign({},i.meander.sounds),Object.keys(e.sounds).forEach((t=>{e.sounds[t]=Object.assign({},e.sounds[t])}));constt=e.tickCount,n=t+1;e.tickCount=n;consts=Object.assign({},i.sounds);Object.keys(e.sounds).forEach((n=>{consti=e.sounds[n],r=i.baseVolume;if(r.5?"right":"left");const{direction:c}=i;letl;l="right"===c?r+(1-r)/3:r/1.5;constu=(a>30?30-(a-30):a)*(Math.abs(r-l)/30);leth;h="right"===c?r+u:r-u,s[n]=Object.assign({},s[n],{volume:h})})),i.meander=e,i.sounds=s,i.forceUpdateIndex=i.forceUpdateIndex+1||1}returnt.isActive&&n>0&&"fade"===t.mode&&(Object.keys(i.sounds).forEach((e=>{lets=i.sounds[e],r=s.volume-t.destination[e].volume;Math.abs(r)>0&&(s.volume=r>0?s.volume-s.volume/n:s.volume+Math.abs(r)/n),s=Object.assign({},s),i.sounds[e]=s})),i.sounds=Object.assign({},i.sounds),i.forceUpdateIndex=i.forceUpdateIndex+1),i})(Object.assign({},this.state));if(e.timer.isActive||e.meander.isActive){conste=FS-(Date.now()-this.lastScheduled),t=FS+e;this.lastScheduled=Date.now(),setTimeout(this.timer,t)}this._setState(e,null,Boolean("fromTimer"))},setTimeout(this.timer,FS));constr=Boolean(t.timer.isActive||t.meander.isActive);n&&!r&&clearTimeout(this.timer),!this.state.proFirstLoad&&t.proFirstLoad&&this.showProHelp()}_setState(e,t,n){this.state.stateToReset&&!n&&(e.stateToReset=null);try{this.setState(e,(()=>{lt(this.state),t&&t()}))}catch(KS){this.setState(e),t&&setTimeout(t,1)}}showProHelp(){setTimeout((()=>{this.state.proFirstLoad&&this._setState({proFirstLoad:!1})}),5e3)}changeGlobalVolume(e){this._setState({globalVolume:e})}togglePlay(){if(this.state.isPlaying){conste={isActive:!1,sounds:null};this._setState({isPlaying:!1,meander:e})}elsethis._setState({isPlaying:!0})}hideAppLinks(){this._setState({appLinksHidden:!0})}handleClearAllSounds(){this._setState({sounds:0===Object.keys(this.state.sounds).length?Object.assign({},oe):{},forceUpdateIndex:this.state.forceUpdateIndex+1||1}),this.handleStopActivity()}handleToggleSoundActive(e){constt=Object.assign({},this.state.sounds);Boolean(this.state.sounds[e])?deletet[e]:t[e]=Object.assign({},this.state.library[e]),this._setState({sounds:t,forceUpdateIndex:this.state.forceUpdateIndex+1||1}),this.handleStopActivity()}handleStopActivity(){this.state.isPlaying&&this.togglePlay(),this.state.timer.isActive&&this.handleTimerCancel(),this.state.meander.isActive&&this._setState({meander:{isActive:!1,sounds:null}})}handleTimerStart(e){constt={},n=e.mode,i={isActive:!0,secondsLeft:e.secondsLeft,mode:n};if("fade"===n){if("current"===e.origin);elseif("silence"===e.origin){conste={};Object.keys(this.state.sounds).map((e=>Object.assign({},this.state.sounds[e]))).map((e=>(e.volume=0,e))).forEach((t=>{e[t.key]=t})),t.sounds=e,t.forceUpdateIndex=this.state.forceUpdateIndex+1||1}elseif(e.origin.indexOf("mix:")>-1){constn=e.origin.replace("mix:","");t.sounds=Ce(this.state.library,this.state.sedMixes[n].sounds)}letn={};if(Object.keys(this.state.sounds).forEach((t=>{if(n[t]=Object.assign({},this.state.sounds[t]),deleten[t].volume,"current"===e.destination)this.state.sounds[t]?n[t].volume=this.state.sounds[t].volume:n[t].volume=0;elseif("silence"===e.destination)n[t].volume=0;elseif(e.destination.indexOf("mix:")>-1){consti=e.destination.replace("mix:",""),s=Ae(this.state.library,this.state.sedMixes[i]);s.sounds[t]?n[t].volume=s.sounds[t].volume:n[t].volume=0}})),"current"===e.destination)i.destinationMesse="Fadeinwillfinishin";elseif("silence"===e.destination)i.destinationMesse="Fadeoutwillfinishin";elseif(e.destination.indexOf("mix:")>-1){constt=e.destination.replace("mix:",""),n=this.state.sedMixes[t].name;i.destinationMesse='Fadeto"'.concat(n,'"willfinishin')}i.destination=n}lets=this.state.isPlaying;"stop"!==n&&"fade"!==n||(s=!0),"start"===n&&(s=!1),t.timer=i,t.isPlaying=s,t.forceUpdateIndex=this.state.forceUpdateIndex+1||1,this._setState(t)}handleTimerCancel(){this._setState({timer:{isActive:!1}})}updateSoundVolume(e,t,n){consti=Object.assign({},this.state.sounds[e]);vars;i.volume=(s=t).02?0:1:t{constn=Object.assign({},this.state.sounds[t]);n.volume=0,e[t]=n}));constt=Object.assign({},this.state),n=Object.assign({},this.state,{sounds:e},{timer:Object.assign({},st.timer)},{meander:Object.assign({},st.meander)},{globalVolume:st.globalVolume});Object.keys(n.sounds).forEach((e=>n.sounds[e].volume=0)),n.stateToReset=t,n.forceUpdateIndex=this.state.forceUpdateIndex+1||1,this._setState(n)}}onTouchStart(){this.setState({touchInProgress:!0})}onTouchEnd(){this.setState({touchInProgress:!1})}render(){returnF("div",{id:"App",className:"".concat(globalThis.IOS?"ios":""),children:[F(V,{}),F(q,{volume:this.state.globalVolume,onChangeVolume:this.changeGlobalVolume,toggleLoginView:()=>this._setState({upgradeDialog:-2}),toggleAccountView:this.toggleAccountView,user:this.state.user}),this.state.waitingForLicense?F($e,{onClose:()=>this._setState({waitingForLicense:!1})}):null,this.state.waitingForLogin?F(et,{onClose:()=>this._setState({waitingForLogin:!1})}):null,this.getModal(),this.getToast(),F(U,{}),F(z,{isPlaying:this.state.isPlaying,togglePlay:this.togglePlay,toggleMeander:this.toggleMeander,toggleReset:this.toggleReset,canRestore:Boolean(this.state.stateToReset),meanderActive:this.state.meander.isActive,showMeanderHelpText:this.state.showMeanderHelpText}),F(De,{pro:this.state.pro,sounds:this.state.sounds,library:this.state.library,timer:Object.assign({},this.state.timer),timerStart:this.handleTimerStart,timerCancel:this.handleTimerCancel,sedTimer:this.state.sedTimer,mixes:this.state.sedMixes,onAddMix:this.handleAddMix,onLoadMix:this.handleLoadMix,onDeleteMix:this.handleDeleteMix,onToggleSoundActive:this.handleToggleSoundActive,handleClearAllSounds:this.handleClearAllSounds,handleStopActivity:this.handleStopActivity,usedSoundManerBefore:this.state.usedSoundManerBefore,onOpenSoundManer:()=>this._setState({usedSoundManerBefore:!0})}),F(Be,{hideAppLinks:this.hideAppLinks,hidden:this.state.appLinksHidden,utmSubstring:this.state.utmSubstring,utmCampaign:this.state.utmCampaign}),F(Ue,{globalVolume:this.state.globalVolume,isPlaying:this.state.isPlaying,sounds:this.state.sounds,updateSoundVolume:this.updateSoundVolume,onTapSoundIme:this.onTapSoundIme,forceUpdateIndex:this.state.forceUpdateIndex,onTouchStart:this.onTouchStart,onTouchEnd:this.onTouchEnd,meanderActive:this.state.meander.isActive}),this.state.pro?null:F(qe,{onStart:()=>this.setState({upgradeDialog:1})}),this.state.upgradeDialog?F(ze,{ste:this.state.upgradeDialog,onDismiss:()=>this._setState({upgradeDialog:null}),onSetSte:e=>this._setState({upgradeDialog:e}),onSetEmail:e=>{this._setState({emailPendingVerification:e})},extraSounds:it,user:this.state.user,firebaseAuth:VS,finishEmailPrompt:e=>{OS(VS,this.state,this._setState,this.promptForEmail,e)}}):null,F(je,{showAppLinks:this.state.appLinksHidden}),this.state.hideSiteDescription?null:F(tt,{onHide:this.hideSiteDescription})]})}},{}),jS=document.getElementById("root"),s.__&&s.__(US,jS),zS=(qS="function"==typeofBS)?null:BS&&BS.__k||jS.__k,GS=[],KS=[],P(jS,US=(!qS&&BS||jS).__k=function(e,t,n){vars,r,o,a={};for(oint)"key"==o?s=t[o]:"ref"==o?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?i.call(arguments,2):n),"function"==typeofe&&null!=e.defaultProps)for(oine.defaultProps)void0===a[o]&&(a[o]=e.defaultProps[o]);returng(e,a,s,r,null)}(y,null,[US]),zS||u,u,void0!==jS.ownerSVGElement,!qS&&BS?[BS]:zS?null:jS.firstChild?i.call(jS.childNodes):null,GS,!qS&&BS?BS:zS?zS.__e:jS.firstChild,qS,KS),D(GS,US,KS);export{nas__vite_legacy_guard};