PageSourceSearch

https://behkhaan.ir/main-MPLIJVGN.js

js behkhaan.ir collected 2026-10-02 20:08:48 UTC 734,225 bytes, 5 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7cacaf6c-b41a-5f6f-aa2a-e1e0e117448f")}catch(e){}}();
3import"./chunk-KV76JPKS.js";import{a as Bn}from"./chunk-YLPJFEUW.js";import{a as HE}from"./chunk-JE37DTLK.js";import{b as BE}from"./chunk-RPXKH2A3.js";import{a as LE}from"./chunk-Q2OLQ4KN.js";import{a as uh}from"./chunk-RWMYDDJQ.js";import{a as HS,b as ah}from"./chunk-IF3KJAEL.js";import"./chunk-3XJDM44B.js";import"./chunk-KGN6ZI45.js";import{b as bp}from"./chunk-WIQB4A4E.js";import{a as lh}from"./chunk-O5WWSXZ6.js";import{a as UE}from"./chunk-SKABVLAU.js";import"./chunk-DEPWC7N4.js";import"./chunk-WSXQHAJO.js";import"./chunk-VMVTHG57.js";import{a as sh}from"./chunk-RXVX4XLL.js";import{a as mE}from"./chunk-O2CZETJO.js";import{c as fE}from"./chunk-YY2RRGAR.js";import{a as KS,b as QS}from"./chunk-HPR2ZYUS.js";import"./chunk-FPQZ56PN.js";import"./chunk-ZNUNMZFW.js";import{a as qS}from"./chunk-6J3GALI7.js";import{a as bE}from"./chunk-D5BWLMGK.js";import"./chunk-EK5ZBAE3.js";import{a as _p,b as BS}from"./chunk-IUVJ2V4L.js";import"./chunk-LAV5GBJM.js";import{a as vp,b as jS,c as Cl,d as VS,e as zS,f as YS,g as uE}from"./chunk-FXHDKZ2H.js";import{a as vE}from"./chunk-6STJCLY3.js";import"./chunk-2GWIPHCY.js";import{a as cE}from"./chunk-IVYRXMZG.js";import"./chunk-INRATVRR.js";import"./chunk-CXOWEMCD.js";import{a as tE}from"./chunk-5U2LHHID.js";import"./chunk-3VYBMKPN.js";import{c as aE}from"./chunk-ZDD4SSOU.js";import"./chunk-SFWJFPVV.js";import"./chunk-JHZSSS4L.js";import"./chunk-2BLGNMFL.js";import{a as ve,b as FE}from"./chunk-P7XVDCLH.js";import{a as DE}from"./chunk-KIP2LOP4.js";import{a as nE}from"./chunk-65B7CLR5.js";import"./chunk-FW7T5YYS.js";import"./chunk-E6RRQXV2.js";import{a as sE}from"./chunk-VURTDJFK.js";import"./chunk-36FOKMIU.js";import"./chunk-FFQKLXM3.js";import"./chunk-DT4ZYN7H.js";import"./chunk-YVUYRCAN.js";import{a as iE}from"./chunk-47OVVS4W.js";import"./chunk-QAHDJRZN.js";import"./chunk-SQHZDWWP.js";import"./chunk-OLDUJV3Y.js";import"./chunk-VIKOVFXV.js";import{b as NE,c as ME}from"./chunk-RPXBNDDE.js";import{a as rE}from"./chunk-P3KXSEK4.js";import{a as PE}from"./chunk-JQZ3TB4A.js";import{a as Sp,b as pE,c as dE}from"./chunk-HJPHCPZY.js";import"./chunk-O67LTWTD.js";import"./chunk-OT6L4V34.js";import{a as oE}from"./chunk-7YUR2SVM.js";import{a as OE}from"./chunk-J5737UC5.js";import"./chunk-IIBOKAPV.js";import{a as XS,d as JS}from"./chunk-SKJ77IZJ.js";import"./chunk-URYFW5NH.js";import"./chunk-PSIRUHTF.js";import{a as $S,c as SE}from"./chunk-XI6AL42F.js";import{a as oh}from"./chunk-Q7W3KTVA.js";import"./chunk-R6PLWBMX.js";import"./chunk-MULDP6DY.js";import"./chunk-GLRT253R.js";import{a as lE}from"./chunk-RGU4C5LD.js";import"./chunk-LXVW4ISU.js";import{a as US}from"./chunk-TBICCHSJ.js";import"./chunk-KBQMZSAB.js";import{a as Ep}from"./chunk-ZQ3UACEX.js";import"./chunk-ZV4HIMXA.js";import{b as vO}from"./chunk-R62SIVBY.js";import{a as Tp}from"./chunk-25BL5HKZ.js";import{b as ZS,d as eE}from"./chunk-4FC5T6ZK.js";import"./chunk-E57IMVFK.js";import"./chunk-Y4ZE2WQQ.js";import{a as RE}from"./chunk-SOYTEPB3.js";import"./chunk-TWGJTGNY.js";import{a as hE,b as gE,c as _E,d as yE}from"./chunk-ZPSQYJWN.js";import{a as GS,b as WS}from"./chunk-KAAT6SRE.js";import"./chunk-WKWFG6OV.js";import"./chunk-THBDF75G.js";import{C as Fn,d as Ko,e as gp,f as PS,z as FS}from"./chunk-RJ2UG3RJ.js";import"./chunk-AB3LHRRD.js";import"./chunk-CI2HCF2F.js";import{a as MS,h as Ln}from"./chunk-GXYF7J3H.js";import{F as NS,c as AS,e as rh,h as kS,l as RS,p as OS}from"./chunk-JHTWTYPN.js";import{a as EE,b as TE,c as IE,d as ch,e as CE,f as wE,g as Ip,i as Li,k as ts,l as wl,m as tr,n as Cp,o as wp,p as Un,q as xE,r as AE,s as kE,t as xp}from"./chunk-Y3IYSGTC.js";import{b as dp}from"./chunk-J72HKFXQ.js";import"./chunk-34HMAESX.js";import{a as yp}from"./chunk-B3Z3NAS4.js";import{a as SS,d as ES,m as TS,n as hi}from"./chunk-TGFFJGSM.js";import{a as Il,c as gi,d as Ut,e as _i}from"./chunk-FPZ453VA.js";import{a as Ee,b as ep,c as Wv,d as tp,f as qs,h as js,i as lS,j as Gs,k as cS,l as uS,m as dS,n as mS,o as ap,p as ih,t as fS}from"./chunk-EL6WFV23.js";import{a as Qo,b as lt,c as _t}from"./chunk-JSRFQSGR.js";import{a as pS}from"./chunk-3EP7OHNH.js";import{A as Jv,B as rp,C as kt,D as Zv,E as eS,F as fi,G as Zr,H as sp,I as Sl,J as tS,K as nS,N as iS,P as ae,Q as Dn,R as Ft,S as th,T as rS,U as El,V as bn,W as Cr,X as op,Y as nh,Z as sS,_ as zo,a as L,b as Vo,c as ip,d as Vv,ea as Tl,f as zv,ga as oS,ha as aS,j as zt,k as Zf,l as Yv,m as $v,ma as Yo,n as Kv,p as eh,t as Qv,v as Zi,w as Xv}from"./chunk-LWW7BOTF.js";import{e as xS,f as hp,g as $o}from"./chunk-ERBHIP22.js";import{c as wr}from"./chunk-LHPA4E6N.js";import{a as Xn,b as LS}from"./chunk-3Y7FMX6W.js";import{E as mp,U as fp,V as CS,W as wS,a as ln,m as IS,na as es,ra as Xo,sa as DS}from"./chunk-BBW6WW7Z.js";import{a as np,b as Et}from"./chunk-WLEWPZ6N.js";import{a as Av,b as kv,g as Mv,h as Pv,i as Dv,j as hS,k as Ws,l as lp,m as cp,n as gS,o as _S,q as up,r as yS,s as Yt,t as er,u as bS,v as vS,w as pp}from"./chunk-OFQRR3BE.js";import{a as Lv,b as Fv,c as Uv,d as Bv,e as Ji,g as Hv,i as Zu,n as qv,o as jv,p as Gv,r as Qe}from"./chunk-NWCZTZ2F.js";import{E as Di,F as Hs,H as Rv,I as Ov,J as Nv,g as Tv,i as Go,j as Iv,k as Cv,l as Wo,p as Ku,q as Qu,r as wv,s as Xu,t as Ju,u as Jr,z as xv}from"./chunk-3BAKG5RY.js";import{$ as bl,$b as yv,Aa as Z,Ac as pi,Bc as w,Da as Ls,Ea as ju,Eb as hv,Ed as vl,F as _l,Fc as Ho,Fd as $u,G as Qr,Ga as lv,Gc as qo,H as an,Hc as jo,Ia as cv,J as qt,Ka as uv,L as yl,Lc as Pt,M as K0,Mc as vv,N as Q0,Na as $f,Nb as be,Nc as Jf,O as yn,Oa as Gu,Ob as Ir,Pc as E,Q as X0,Qa as pv,Qc as Ae,R as Bu,Ra as Uo,Rb as Pn,Rc as Me,S as J0,Sb as Fe,T as Z0,Tb as gv,U as ev,Xb as Wu,Xc as Vu,Y as tv,Yc as zu,Z as Yf,Za as Fs,Zb as Xf,Zc as Bs,_ as nv,_a as Kf,_b as _v,_c as Yu,a as G0,ab as dv,ad as Sv,ba as iv,bd as it,c as Nn,ca as rv,cd as rt,da as Le,dd as Dt,ea as Fo,ec as se,ed as At,f as Qi,fa as jt,fd as Ev,g as hl,gc as oe,ha as Ze,hc as Zt,ic as bv,j as W0,ja as sv,jc as Wt,kc as Vt,l as V0,la as Hu,lc as x,ld as $,m as Mn,ma as we,mc as b,md as Lt,n as Qn,na as ov,nb as Bo,nc as S,nd as di,o as Ce,ob as He,oc as M,od as xt,p as pe,pa as vt,pc as F,q as zf,qa as Tr,qc as W,qd as St,rb as mv,rc as qe,rd as mi,sa as gt,sb as Qf,sc as en,ta as ue,tb as y,tc as tn,u as De,ua as T,uc as Xr,va as av,vc as ge,w as Y0,wc as Us,xa as qu,xb as fv,y as $0,yb as Xi,za as J,zb as Gt,zc as ee}from"./chunk-5U7LGHIW.js";import{b as z0,c as gl}
3from"./chunk-ALSDDZFP.js";import{a as g,b as D,d as Lo,h as bO,j as d,l as k}from"./chunk-EKFLB6J2.js";var SO=t=>{let e=t.getCookieItem(Ji),n=t.getCookieItem(Hv);return e?pe(e):pe(n)},EO=(t,e)=>{if(!e||t.url.includes("cloudImageUrl/baseUrl"))return t;let n={Authorization:"Bearer ".concat(e)};return t.clone({setHeaders:n})},TO=t=>{let e={"X-Client-Id":"api.angular.client"};return t.clone({withCredentials:!0,setHeaders:e})},IO=(t,e)=>(t=TO(t),SO(e).pipe(yn(1),De(n=>EO(t,n)),qt(()=>pe(null)))),qE=(t,e)=>{let n=T(Qe);return IO(t,n).pipe(yl(i=>i!=null&&i.url.includes("undefined")?pe(null):e(i)))};var CO=["password","otp_token","google_oauth","register_auth"],wO=["unsupported_grant_type","invalid_scope","invalid_client","unauthorized_client"],VE=(t,e)=>{if(!xO(t))return e(t);let n=zE(t.body);return e(t).pipe(De(i=>{if(i instanceof Di&&i.status===200){let r=i.body;if(!r||!r.access_token)return i.clone({body:MO(n)})}return i}),qt(i=>{var r;return i instanceof Hs?i.status===429?zf(()=>i):pe(new Di({status:200,url:(r=i.url)!=null?r:t.url,body:kO(i,n)})):zf(()=>i)}))};function xO(t){return t.method!=="POST"||!t.url.includes("/connect/token")?!1:zE(t.body)!==null}function zE(t){try{let e;if(typeof t=="string")e=t;else if(t&&typeof t.toString=="function")e=String(t);else return null;let n=new URLSearchParams(e),i=n.get("grant_type");if(!i||!CO.includes(i))return null;let r=i,s=n.get("input_type");return{grantType:r,inputType:s==="otpToken"||s==="googleAuth"?s:null}}catch{return null}}function AO(t){let e=t.error;if(e==null)return{};if(typeof e=="string"){let n=e.trim();if(!n)return{};try{return JSON.parse(n)}catch{return{}}}if(typeof e=="object"){let n=typeof ProgressEvent<"u"&&e instanceof ProgressEvent,i=typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer;if(!n&&!i)return e}return{}}function kO(t,e,n=new Date){let i=t.status;if(i===0)return Vs(Ee.NetworkError,e,t,n);if(i===401||i===403)return Vs(Ee.ConfigurationError,e,t,n);if(i>=500)return Vs(Ee.ServerError,e,t,n);let r=AO(t),s=jE(r.error),o=jE(r.error_description),a=o?o.toLowerCase():null;if(a==="banned")return Vs(Ee.Banned,e,t,n,{code:s,description:o});if(a==="delete_pending"){let c=GE(r.restriction_expires_at,n);return Vs(Ee.DeletePending,e,t,n,{code:s,description:o,restrictionExpiresAt:c})}if(a==="locked_out"){let c=GE(r.restriction_expires_at,n);return Vs(Ee.LockedOut,e,t,n,{code:s,description:o,restrictionExpiresAt:c})}let l=i===400?RO(e,s,a):Ee.Unknown;return l===Ee.Unknown&&s&&wO.includes(s)&&(l=Ee.ConfigurationError),Vs(l,e,t,n,{code:s,description:o})}function RO(t,e,n){let{grantType:i,inputType:r}=t;return i==="password"?e==="invalid_grant"&&n==="invalid_username_or_password"?Ee.InvalidCredentials:Ee.Unknown:i==="otp_token"?e==="invalid_grant"&&n==="invalid verify_phone_number_token credential"?Ee.ClientRequestBug:e==="invalid_grant"&&n===null?Ee.InvalidOrExpiredOtp:Ee.Unknown:i==="google_oauth"?e==="invalid_request"&&n==="invalid_gmail_id_token"?Ee.GoogleTokenMissing:e==="invalid_request"&&n==="invalid token_id"?Ee.GoogleTokenRejected:e==="invalid_request"&&n==="user_is_not_found"?Ee.UserNotFound:Ee.Unknown:i==="register_auth"?r==="otpToken"?e==="invalid_grant"&&n==="invalid inputtype"?Ee.ClientRequestBug:e==="unauthorized_client"&&n==="invalid token or verification id"?Ee.InvalidOrExpiredOtp:e==="unauthorized_client"&&n==="user_is_not_found"?Ee.RegistrationFailed:Ee.Unknown:r==="googleAuth"?e==="invalid_grant"&&n==="invalid inputtype"?Ee.ClientRequestBug:e==="invalid_request"&&n==="invalid_gmail_id_token"?Ee.GoogleTokenMissing:e==="invalid_request"&&n==="invalid token_id"?Ee.GoogleTokenRejected:e==="invalid_request"&&n==="username not exist"?Ee.UsernameMissing:e==="invalid_request"&&n==="username is exist"?Ee.UsernameTaken:e==="invalid_request"&&n!==null?Ee.RegistrationFailed:e==="invalid_grant"&&n===null?Ee.ServerError:Ee.Unknown:e==="invalid_grant"&&n==="invalid inputtype"?Ee.ClientRequestBug:Ee.Unknown:Ee.Unknown}function jE(t){if(t==null)return null;let e=t.trim();return e===""?null:e}function GE(t,e){if(!t)return null;let n=new Date(t);return Number.isNaN(n.getTime())||n.getTime()<=e.getTime()?null:n}var YE=6e4,ph=60*YE,WE=24*ph;function OO(t,e,n){let i=Wv[t];if(!e)return i;let r=e.getTime()-n.getTime();return r<=0?i:t===Ee.DeletePending&&r>WE?"".concat(Math.ceil(r/WE)," \u0631\u0648\u0632 \u062F\u06CC\u06AF\u0631"):r>=ph?"".concat(Math.ceil(r/ph)," \u0633\u0627\u0639\u062A \u062F\u06CC\u06AF\u0631"):"".concat(Math.max(1,Math.ceil(r/YE))," \u062F\u0642\u06CC\u0642\u0647 \u062F\u06CC\u06AF\u0631")}function NO(t,e,n){if(t===Ee.DeletePending||t===Ee.LockedOut){let i=OO(t,e,n);return ep[t].replace("{remaining}",i)}return ep[t]}function Vs(t,e,n,i,r){var c,u,p,m;let s=(c=r==null?void 0:r.restrictionExpiresAt)!=null?c:null,o=NO(t,s,i),a=(u
3=r==null?void 0:r.code)!=null?u:null,l=(p=r==null?void 0:r.description)!=null?p:null;return(t===Ee.ClientRequestBug||t===Ee.ConfigurationError)&&console.error("[connect-token] mapped failure",{url:n.url,status:n.status,code:a,description:l}),{hasError:!0,reason:t,message:o,error:a,error_description:l,restrictionExpiresAt:(m=r==null?void 0:r.restrictionExpiresAt)!=null?m:null,status:n.status,grantType:e.grantType,inputType:e.inputType,error_message:o}}function MO(t){let e=ep[Ee.Unknown];return{hasError:!0,reason:Ee.Unknown,message:e,error:null,error_description:null,restrictionExpiresAt:null,status:200,grantType:t.grantType,inputType:t.inputType,error_message:e}}var Ap=new hl(!1),dh=new hl(null),KE=new Qi,QE=(t,e)=>{let n=T(fS),i=T(Yt),r=T(hi);return n.getUserAccessToken()&&(t=mh(t,n.getUserAccessToken())),e(t).pipe(jt(KE),qt(s=>PO(s,t,e,n,i,r)))},PO=(t,e,n,i,r,s)=>{if(t instanceof Hs){if(t.status==401)return DO(e,n,i,r,s);if(t.status==429)return pe(t).pipe(Ze(()=>console.log("Retrying...")),tv({delay:4e3,count:5,resetOnSuccess:!0}),qt(o=>{var a,l;return pe(new Di({body:new Il((a=o==null?void 0:o.error)==null?void 0:a.error,t==null?void 0:t.error,!0,(l=o==null?void 0:o.error)==null?void 0:l.error)}))}));if(!i.Repository.IsInBrowser)console.error("Custom Error LOG => request failed with url:".concat(e.url,"/n"),"status:".concat(t.status,"/n"));else{let o=t.error,l=o&&typeof o=="object"&&LO(o)?o:new Il(o==null?void 0:o.error,o,!0,o==null?void 0:o.error);return pe(new Di({body:l}))}}return pe(null)},DO=(t,e,n,i,r)=>{let s=n.getUserAccessToken(),o=n.getUserRefreshToken();return!s&&!o?$E(n,i,r):Ap.getValue()?dh.pipe(an(a=>a!=null),yn(1),Le(a=>e(mh(t,a)))):(Ap.next(!0),dh.next(null),n.refreshToken().pipe(Le(a=>(Ap.next(!1),dh.next(a==null?void 0:a.access_token),e(mh(t,a==null?void 0:a.access_token)))),qt(a=>{var l,c;return Ap.next(!1),a instanceof Hs&&a.status==401?$E(n,i,r):pe(new Di({body:new Il((l=a==null?void 0:a.error)==null?void 0:l.error,a==null?void 0:a.error,!0,(c=a==null?void 0:a.error)==null?void 0:c.error)}))})))},mh=(t,e)=>t.clone({setHeaders:{Authorization:"Bearer ".concat(e)}}),$E=(t,e,n)=>(KE.next(),t.repo.clearUserData(),n.userData=null,e.navigate([Et.home]),pe(new Di({body:new Il("Session expired",null,!0,"401")})));function LO(t){if(!t||typeof t!="object")return!1;let e=["message","error","hasError","referenceId"],n=["apiError"],i=Object.keys(t);return e.every(r=>i.includes(r))&&i.every(r=>e.includes(r)||n.includes(r))}var FO=["POST","PUT","PATCH"],UO="6ba7b810-9dad-11d1-80b4-00c04fd430c8",XE=(t,e)=>{var s;let i=FO.includes(t.method)?"".concat(t.method,":").concat(t.urlWithParams,":").concat(JSON.stringify((s=t.body)!=null?s:{})):"".concat(t.method,":").concat(t.urlWithParams),r=dp(i,UO);return e(t.clone({setHeaders:{"X-Correlation-ID":r}}))};var me=(function(t){return t[t.State=0]="State",t[t.Transition=1]="Transition",t[t.Sequence=2]="Sequence",t[t.Group=3]="Group",t[t.Animate=4]="Animate",t[t.Keyframes=5]="Keyframes",t[t.Style=6]="Style",t[t.Trigger=7]="Trigger",t[t.Reference=8]="Reference",t[t.AnimateChild=9]="AnimateChild",t[t.AnimateRef=10]="AnimateRef",t[t.Query=11]="Query",t[t.Stagger=12]="Stagger",t})(me||{}),yi="*";function xl(t,e){return{type:me.Trigger,name:t,definitions:e,options:{}}}function ns(t,e=null){return{type:me.Animate,styles:e,timings:t}}function fh(t,e=null){return{type:me.Group,steps:t,options:e}}function JE(t,e=null){return{type:me.Sequence,steps:t,options:e}}function nn(t){return{type:me.Style,styles:t,offset:null}}function is(t,e,n=null){return{type:me.Transition,expr:t,animation:e,options:n}}function xr(t,e,n=null){return{type:me.Query,selector:t,animation:e,options:n}}var nr=class{constructor(e=0,n=0){d(this,"_onDoneFns",[]);d(this,"_onStartFns",[]);d(this,"_onDestroyFns",[]);d(this,"_originalOnDoneFns",[]);d(this,"_originalOnStartFns",[]);d(this,"_started",!1);d(this,"_destroyed",!1);d(this,"_finished",!1);d(this,"_position",0);d(this,"parentPlayer",null);d(this,"totalTime");this.totalTime=e+n}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}hasStarted(){return this._started}init(){}play(){this.hasStarted()||(this._onStart(),this.triggerMicrotask()),this._started=!0}triggerMicrotask(){queueMicrotask(()=>this._onFinish())}
vendor: 21,714 bytes, line 3
3_onStart(){this._onStartFns.forEach(e=>e()),this._onStartFns=[]}pause(){}restart(){}finish(){this._onFinish()}destroy(){this._destroyed||(this._destroyed=!0,this.hasStarted()||this._onStart(),this.finish(),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}reset(){this._started=!1,this._finished=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}setPosition(e){this._position=this.totalTime?e*this.totalTime:1}getPosition(){return this.totalTime?this._position/this.totalTime:1}triggerCallback(e){let n=e=="start"?this._onStartFns:this._onDoneFns;n.forEach(i=>i()),n.length=0}},zs=class{constructor(e){d(this,"_onDoneFns",[]);d(this,"_onStartFns",[]);d(this,"_finished",!1);d(this,"_started",!1);d(this,"_destroyed",!1);d(this,"_onDestroyFns",[]);d(this,"parentPlayer",null);d(this,"totalTime",0);d(this,"players");this.players=e;let n=0,i=0,r=0,s=this.players.length;s==0?queueMicrotask(()=>this._onFinish()):this.players.forEach(o=>{o.onDone(()=>{++n==s&&this._onFinish()}),o.onDestroy(()=>{++i==s&&this._onDestroy()}),o.onStart(()=>{++r==s&&this._onStart()})}),this.totalTime=this.players.reduce((o,a)=>Math.max(o,a.totalTime),0)}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this.players.forEach(e=>e.init())}onStart(e){this._onStartFns.push(e)}_onStart(){this.hasStarted()||(this._started=!0,this._onStartFns.forEach(e=>e()),this._onStartFns=[])}onDone(e){this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}hasStarted(){return this._started}play(){this.parentPlayer||this.init(),this._onStart(),this.players.forEach(e=>e.play())}pause(){this.players.forEach(e=>e.pause())}restart(){this.players.forEach(e=>e.restart())}finish(){this._onFinish(),this.players.forEach(e=>e.finish())}destroy(){this._onDestroy()}_onDestroy(){this._destroyed||(this._destroyed=!0,this._onFinish(),this.players.forEach(e=>e.destroy()),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}reset(){this.players.forEach(e=>e.reset()),this._destroyed=!1,this._finished=!1,this._started=!1}setPosition(e){let n=e*this.totalTime;this.players.forEach(i=>{let r=i.totalTime?Math.min(1,n/i.totalTime):1;i.setPosition(r)})}getPosition(){let e=this.players.reduce((n,i)=>n===null||i.totalTime>n.totalTime?i:n,null);return e!=null?e.getPosition():0}beforeDestroy(){this.players.forEach(e=>{e.beforeDestroy&&e.beforeDestroy()})}triggerCallback(e){let n=e=="start"?this._onStartFns:this._onDoneFns;n.forEach(i=>i()),n.length=0}},Jo="!";function ZE(t){return new we(3e3,!1)}function BO(){return new we(3100,!1)}function HO(){return new we(3101,!1)}function qO(t){return new we(3001,!1)}function jO(t){return new we(3003,!1)}function GO(t){return new we(3004,!1)}function tT(t,e){return new we(3005,!1)}function nT(){return new we(3006,!1)}function iT(){return new we(3007,!1)}function rT(t,e){return new we(3008,!1)}function sT(t){return new we(3002,!1)}function oT(t,e,n,i,r){return new we(3010,!1)}function aT(){return new we(3011,!1)}function lT(){return new we(3012,!1)}function cT(){return new we(3200,!1)}function uT(){return new we(3202,!1)}function pT(){return new we(3013,!1)}function dT(t){return new we(3014,!1)}function mT(t){return new we(3015,!1)}function fT(t){return new we(3016,!1)}function hT(t,e){return new we(3404,!1)}function WO(t){return new we(3502,!1)}function gT(t){return new we(3503,!1)}function _T(){return new we(3300,!1)}function yT(t){return new we(3504,!1)}function bT(t){return new we(3301,!1)}function vT(t,e){return new we(3302,!1)}function ST(t){return new we(3303,!1)}function ET(t,e){return new we(3400,!1)}function TT(t){return new we(3401,!1)}function IT(t){return new we(3402,!1)}function CT(t,e){return new we(3505,!1)}function Ar(t){switch(t.length){case 0:return new nr;case 1:return t[0];default:return new zs(t)}}function yh(t,e,n=new Map,i=new Map){let r=[],s=[],o=-1,a=null;if(e.forEach(l=>{let c=l.get("offset"),u=c==o,p=u&&a||new Map;l.forEach((m,f)=>{let h=f,_=m;if(f!=="offset")switch(h=t.normalizePropertyName(h,r),_){case Jo:_=n.get(f);break;case yi:_=i.get(f);break;default:_=t.normalizeStyleValue(f,h,_,r);break}p.set(h,_)}),u||s.push(p),a=p,o=c}),r.length)throw WO(r);return s}function kp(t,e,n,i){switch(e){case"start":t.onStart(()=>i(n&&hh(n,"start",t)));break;case"done":t.onDone(()=>i(n&&hh(n,"done",t)));break;case"destroy":t.onDestroy(()=>i(n&&hh(n,"destroy",t)));break}}function hh(t,e,n){let i=n.totalTime,r=!!n.disabled,s=Rp(t.element,t.triggerName,t.fromState,t.toState,e||t.phaseName,i==null?t.totalTime:i,r),o=t._data;return o!=null&&(s._data=o),s}function Rp(t,e,n,i,r="",s=0,o){return{element:t,triggerName:e,fromState:n,toState:i,phaseName:r,totalTime:s,disabled:!!o}}function Hn(t,e,n){let i=t.get(e);return i||t.set(e,i=n),i}function bh(t){let e=t.indexOf(":"),n=t.substring(1,e),i=t.slice(e+1);return[n,i]}var VO=typeof document>"u"?null:document.documentElement;function Op(t){let e=t.parentNode||t.host||null;return e===VO?null:e}function zO(t){return t.substring(1,6)=="ebkit"}var Ys=null,eT=!1;function wT(t){Ys||(Ys=YO()||{},eT=Ys.style?"WebkitAppearance"in Ys.style:!1);let e=!0;return Ys.style&&!zO(t)&&(e=t in Ys.style,!e&&eT&&(e="Webkit"+t.charAt(0).toUpperCase()+t.slice(1)in Ys.style)),e}function YO(){return typeof document<"u"?document.body:null}function vh(t,e){for(;e;){if(e===t)return!0;e=Op(e)}return!1}function Sh(t,e,n){if(n)return Array.from(t.querySelectorAll(e));let i=t.querySelector(e);return i?[i]:[]}var $O=1e3,Eh="{{",KO="}}",Th="ng-enter",Np="ng-leave",Al="ng-trigger",kl=".ng-trigger",Ih="ng-animating",Mp=".ng-animating";function ir(t){if(typeof t=="number")return t;let e=t.match(/^(-?[\.\d]+)(m?s)/);return!e||e.length<2?0:gh(parseFloat(e[1]),e[2])}function gh(t,e){switch(e){case"s":return t*$O;default:return t}}function Rl(t,e,n){return t.hasOwnProperty("duration")?t:XO(t,e,n)}var QO=/^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i;function XO(t,e,n){let i,r=0,s="";if(typeof t=="string"){let o=t.match(QO);if(o===null)return e.push(ZE(t)),{duration:0,delay:0,easing:""};i=gh(parseFloat(o[1]),o[2]);let a=o[3];a!=null&&(r=gh(parseFloat(a),o[4]));let l=o[5];l&&(s=l)}else i=t;if(!n){let o=!1,a=e.length;i<0&&(e.push(BO()),o=!0),r<0&&(e.push(HO()),o=!0),o&&e.splice(a,0,ZE(t))}return{duration:i,delay:r,easing:s}}function xT(t){return t.length?t[0]instanceof Map?t:t.map(e=>new Map(Object.entries(e))):[]}function Fi(t,e,n){e.forEach((i,r)=>{let s=Pp(r);n&&!n.has(r)&&n.set(r,t.style[s]),t.style[s]=i})}function rs(t,e){e.forEach((n,i)=>{let r=Pp(i);t.style[r]=""})}function Zo(t){return Array.isArray(t)?t.length==1?t[0]:JE(t):t}function AT(t,e,n){let i=e.params||{},r=Ch(t);r.length&&r.forEach(s=>{i.hasOwnProperty(s)||n.push(qO(s))})}var _h=new RegExp("".concat(Eh,"\\s*(.+?)\\s*").concat(KO),"g");function Ch(t){let e=[];if(typeof t=="string"){let n;for(;n=_h.exec(t);)e.push(n[1]);_h.lastIndex=0}return e}function ea(t,e,n){let i="".concat(t),r=i.replace(_h,(s,o)=>{let a=e[o];return a==null&&(n.push(jO(o)),a=""),a.toString()});return r==i?t:r}var JO=/-+([a-z0-9])/g;function Pp(t){return t.replace(JO,(...e)=>e[1].toUpperCase())}function kT(t,e){return t===0||e===0}function RT(t,e,n){if(n.size&&e.length){let i=e[0],r=[];if(n.forEach((s,o)=>{i.has(o)||r.push(o),i.set(o,s)}),r.length)for(let s=1;s<e.length;s++){let o=e[s];r.forEach(a=>o.set(a,Dp(t,a)))}}return e}function qn(t,e,n){switch(e.type){case me.Trigger:return t.visitTrigger(e,n);case me.State:return t.visitState(e,n);case me.Transition:return t.visitTransition(e,n);case me.Sequence:return t.visitSequence(e,n);case me.Group:return t.visitGroup(e,n);case me.Animate:return t.visitAnimate(e,n);case me.Keyframes:return t.visitKeyframes(e,n);case me.Style:return t.visitStyle(e,n);case me.Reference:return t.visitReference(e,n);case me.AnimateChild:return t.visitAnimateChild(e,n);case me.AnimateRef:return t.visitAnimateRef(e,n);case me.Query:return t.visitQuery(e,n);case me.Stagger:return t.visitStagger(e,n);default:throw GO(e.type)}}function Dp(t,e){return window.getComputedStyle(t)[e]}var jh=(()=>{let e=class e{validateStyleProperty(i){return wT(i)}containsElement(i,r){return vh(i,r)}getParentElement(i){return Op(i)}query(i,r,s){return Sh(i,r,s)}computeStyle(i,r,s){return s||""}animate(i,r,s,o,a,l=[],c){return new nr(s,o)}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",vt({token:e,factory:e.\u0275fac}));let t=e;return t})(),ss=class{};d(ss,"NOOP",new jh);var Ks=class{};var ZO=new Set(["width","height","minWidth","minHeight","maxWidth","maxHeight","left","top","bottom","right","fontSize","outlineWidth","outlineOffset","paddingTop","paddingLeft","paddingBottom","paddingRight","marginTop","marginLeft","marginBottom","marginRight","borderRadius","borderWidth","borderTopWidth","borderLeftWidth","borderRightWidth","borderBottomWidth","textIndent","perspective"]),Hp=class extends Ks{normalizePropertyName(e,n){return Pp(e)}normalizeStyleValue(e,n,i,r){let s="",o=i.toString().trim();if(ZO.has(n)&&i!==0&&i!=="0")if(typeof i=="number")s="px";else{let a=i.match(/^[+-]?[\d\.]+([a-z]*)$/);a&&a[1].length==0&&r.push(tT(e,i))}return o+s}};var qp="*";function eN(t,e){let n=[];return typeof t=="string"?t.split(/\s*,\s*/).forEach(i=>tN(i,n,e)):n.push(t),n}function tN(t,e,n){if(t[0]==":"){let l=nN(t,n);if(typeof l=="function"){e.push(l);return}t=l}let i=t.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/);if(i==null||i.length<4)return n.push(mT(t)),e;let r=i[1],s=i[2],o=i[3];e.push(OT(r,o));let a=r==qp&&o==qp;s[0]=="<"&&!a&&e.push(OT(o,r))}function nN(t,e){switch(t){case":enter":return"void => *";case":leave":return"* => void";case":increment":return(n,i)=>parseFloat(i)>parseFloat(n);case":decrement":return(n,i)=>parseFloat(i)<parseFloat(n);default:return e.push(fT(t)),"* => *"}}var Lp=new Set(["true","1"]),Fp=new Set(["false","0"]);function OT(t,e){let n=Lp.has(t)||Fp.has(t),i=Lp.has(e)||Fp.has(e);return(r,s)=>{let o=t==qp||t==r,a=e==qp||e==s;return!o&&n&&typeof r=="boolean"&&(o=r?Lp.has(t):Fp.has(t)),!a&&i&&typeof s=="boolean"&&(a=s?Lp.has(e):Fp.has(e)),o&&a}}var qT=":self",iN=new RegExp("s*".concat(qT,"s*,?"),"g");function jT(t,e,n,i){return new Oh(t).build(e,n,i)}var NT="",Oh=class{constructor(e){d(this,"_driver");this._driver=e}build(e,n,i){let r=new Nh(n);return this._resetContextStyleTimingState(r),qn(this,Zo(e),r)}_resetContextStyleTimingState(e){e.currentQuerySelector=NT,e.collectedStyles=new Map,e.collectedStyles.set(NT,new Map),e.currentTime=0}visitTrigger(e,n){let i=n.queryCount=0,r=n.depCount=0,s=[],o=[];return e.name.charAt(0)=="@"&&n.errors.push(nT()),e.definitions.forEach(a=>{if(this._resetContextStyleTimingState(n),a.type==me.State){let l=a,c=l.name;c.toString().split(/\s*,\s*/).forEach(u=>{l.name=u,s.push(this.visitState(l,n))}),l.name=c}else if(a.type==me.Transition){let l=this.visitTransition(a,n);i+=l.queryCount,r+=l.depCount,o.push(l)}else n.errors.push(iT())}),{type:me.Trigger,name:e.name,states:s,transitions:o,queryCount:i,depCount:r,options:null}}visitState(e,n){let i=this.visitStyle(e.styles,n),r=e.options&&e.options.params||null;if(i.containsDynamicStyles){let s=new Set,o=r||{};i.styles.forEach(a=>{a instanceof Map&&a.forEach(l=>{Ch(l).forEach(c=>{o.hasOwnProperty(c)||s.add(c)})})}),s.size&&n.errors.push(rT(e.name,[...s.values()]))}return{type:me.State,name:e.name,style:i,options:r?{params:r}:null}}visitTransition(e,n){n.queryCount=0,n.depCount=0;let i=qn(this,Zo(e.animation),n),r=eN(e.expr,n.errors);return{type:me.Transition,matchers:r,animation:i,queryCount:n.queryCount,depCount:n.depCount,options:$s(e.options)}}visitSequence(e,n){return{type:me.Sequence,steps:e.steps.map(i=>qn(this,i,n)),options:$s(e.options)}}visitGroup(e,n){let i=n.currentTime,r=0,s=e.steps.map(o=>{n.currentTime=i;let a=qn(this,o,n);return r=Math.max(r,n.currentTime),a});return n.currentTime=r,{type:me.Group,steps:s,options:$s(e.options)}}visitAnimate(e,n){let i=aN(e.timings,n.errors);n.currentAnimateTimings=i;let r,s=e.styles?e.styles:nn({});if(s.type==me.Keyframes)r=this.visitKeyframes(s,n);else{let o=e.styles,a=!1;if(!o){a=!0;let c={};i.easing&&(c.easing=i.easing),o=nn(c)}n.currentTime+=i.duration+i.delay;let l=this.visitStyle(o,n);l.isEmptyStep=a,r=l}return n.currentAnimateTimings=null,{type:me.Animate,timings:i,style:r,options:null}}visitStyle(e,n){let i=this._makeStyleAst(e,n);return this._validateStyleAst(i,n),i}_makeStyleAst(e,n){let i=[],r=Array.isArray(e.styles)?e.styles:[e.styles];for(let a of r)typeof a=="string"?a===yi?i.push(a):n.errors.push(sT(a)):i.push(new Map(Object.entries(a)));let s=!1,o=null;return i.forEach(a=>{if(a instanceof Map&&(a.has("easing")&&(o=a.get("easing"),a.delete("easing")),!s)){for(let l of a.values())if(l.toString().indexOf(Eh)>=0){s=!0;break}}}),{type:me.Style,styles:i,easing:o,offset:e.offset,containsDynamicStyles:s,options:null}}_validateStyleAst(e,n){let i=n.currentAnimateTimings,r=n.currentTime,s=n.currentTime;i&&s>0&&(s-=i.duration+i.delay),e.styles.forEach(o=>{typeof o!="string"&&o.forEach((a,l)=>{let c=n.collectedStyles.get(n.currentQuerySelector),u=c.get(l),p=!0;u&&(s!=r&&s>=u.startTime&&r<=u.endTime&&(n.errors.push(oT(l,u.startTime,u.endTime,s,r)),p=!1),s=u.startTime),p&&c.set(l,{startTime:s,endTime:r}),n.options&&AT(a,n.options,n.errors)})})}visitKeyframes(e,n){let i={type:me.Keyframes,styles:[],options:null};if(!n.currentAnimateTimings)return n.errors.push(aT()),i;let r=1,s=0,o=[],a=!1,l=!1,c=0,u=e.steps.map(I=>{let N=this._makeStyleAst(I,n),j=N.offset!=null?N.offset:oN(N.styles),P=0;return j!=null&&(s++,P=N.offset=j),l=l||P<0||P>1,a=a||P<c,c=P,o.push(P),N});l&&n.errors.push(lT()),a&&n.errors.push(cT());let p=e.steps.length,m=0;s>0&&s<p?n.errors.push(uT()):s==0&&(m=r/(p-1));let f=p-1,h=n.currentTime,_=n.currentAnimateTimings,v=_.duration;return u.forEach((I,N)=>{let j=m>0?N==f?1:m*N:o[N],P=j*v;n.currentTime=h+_.delay+P,_.duration=P,this._validateStyleAst(I,n),I.offset=j,i.styles.push(I)}),i}visitReference(e,n){return{type:me.Reference,animation:qn(this,Zo(e.animation),n),options:$s(e.options)}}visitAnimateChild(e,n){return n.depCount++,{type:me.AnimateChild,options:$s(e.options)}}visitAnimateRef(e,n){return{type:me.AnimateRef,animation:this.visitReference(e.animation,n),options:$s(e.options)}}visitQuery(e,n){let i=n.currentQuerySelector,r=e.options||{};n.queryCount++,n.currentQuery=e;let[s,o]=rN(e.selector);n.currentQuerySelector=i.length?i+" "+s:s,Hn(n.collectedStyles,n.currentQuerySelector,new Map);let a=qn(this,Zo(e.animation),n);return n.currentQuery=null,n.currentQuerySelector=i,{type:me.Query,selector:s,limit:r.limit||0,optional:!!r.optional,includeSelf:o,animation:a,originalSelector:e.selector,options:$s(e.options)}}visitStagger(e,n){n.currentQuery||n.errors.push(pT());let i=e.timings==="full"?{duration:0,delay:0,easing:"full"}:Rl(e.timings,n.errors,!0);return{type:me.Stagger,animation:qn(this,Zo(e.animation),n),timings:i,options:null}}};function rN(t){let e=!!t.split(/\s*,\s*/).find(n=>n==qT);return e&&(t=t.replace(iN,"")),t=t.replace(/@\*/g,kl).replace(/@\w+/g,n=>kl+"-"+n.slice(1)).replace(/:animating/g,Mp),[t,e]}function sN(t){return t?g({},t):null}var Nh=class{constructor(e){d(this,"errors");d(this,"queryCount",0);d(this,"depCount",0);d(this,"currentTransition",null);d(this,"currentQuery",null);d(this,"currentQuerySelector",null);d(this,"currentAnimateTimings",null);d(this,"currentTime",0);d(this,"collectedStyles",new Map);d(this,"options",null);d(this,"unsupportedCSSPropertiesFound",new Set);this.errors=e}};function oN(t){if(typeof t=="string")return null;let e=null;if(Array.isArray(t))t.forEach(n=>{if(n instanceof Map&&n.has("offset")){let i=n;e=parseFloat(i.get("offset")),i.delete("offset")}});else if(t instanceof Map&&t.has("offset")){let n=t;e=parseFloat(n.get("offset")),n.delete("offset")}return e}function aN(t,e){if(t.hasOwnProperty("duration"))return t;if(typeof t=="number"){let s=Rl(t,e).duration;return wh(s,0,"")}let n=t;if(n.split(/\s+/).some(s=>s.charAt(0)=="{"&&s.charAt(1)=="{")){let s=wh(0,0,"");return s.dynamic=!0,s.strValue=n,s}let r=Rl(n,e);return wh(r.duration,r.delay,r.easing)}function $s(t){return t?(t=g({},t),t.params&&(t.params=sN(t.params))):t={},t}function wh(t,e,n){return{duration:t,delay:e,easing:n}}function Gh(t,e,n,i,r,s,o=null,a=!1){return{type:1,element:t,keyframes:e,preStyleProps:n,postStyleProps:i,duration:r,delay:s,totalTime:r+s,easing:o,subTimeline:a}}var Nl=class{constructor(){d(this,"_map",new Map)}get(e){return this._map.get(e)||[]}append(e,n){let i=this._map.get(e);i||this._map.set(e,i=[]),i.push(...n)}has(e){return this._map.has(e)}clear(){this._map.clear()}},lN=1,cN=":enter",uN=new RegExp(cN,"g"),pN=":leave",dN=new RegExp(pN,"g");function GT(t,e,n,i,r,s=new Map,o=new Map,a,l,c=[]){return new Mh().buildKeyframes(t,e,n,i,r,s,o,a,l,c)}var Mh=class{buildKeyframes(e,n,i,r,s,o,a,l,c,u=[]){c=c||new Nl;let p=new Ph(e,n,c,r,s,u,[]);p.options=l;let m=l.delay?ir(l.delay):0;p.currentTimeline.delayNextStep(m),p.currentTimeline.setStyles([o],null,p.errors,l),qn(this,i,p);let f=p.timelines.filter(h=>h.containsAnimation());if(f.length&&a.size){let h;for(let _=f.length-1;_>=0;_--){let v=f[_];if(v.element===n){h=v;break}}h&&!h.allowOnlyTimelineStyles()&&h.setStyles([a],null,p.errors,l)}return f.length?f.map(h=>h.buildKeyframes()):[Gh(n,[],[],[],0,m,"",!1)]}visitTrigger(e,n){}visitState(e,n){}visitTransition(e,n){}visitAnimateChild(e,n){let i=n.subInstructions.get(n.element);if(i){let r=n.createSubContext(e.options),s=n.currentTimeline.currentTime,o=this._visitSubInstructions(i,r,r.options);s!=o&&n.transformIntoNewTimeline(o)}n.previousNode=e}visitAnimateRef(e,n){let i=n.createSubContext(e.options);i.transformIntoNewTimeline(),this._applyAnimationRefDelays([e.options,e.animation.options],n,i),this.visitReference(e.animation,i),n.transformIntoNewTimeline(i.currentTimeline.currentTime),n.previousNode=e}_applyAnimationRefDelays(e,n,i){var r;for(let s of e){let o=s==null?void 0:s.delay;if(o){let a=typeof o=="number"?o:ir(ea(o,(r=s==null?void 0:s.params)!=null?r:{},n.errors));i.delayNextStep(a)}}}_visitSubInstructions(e,n,i){let s=n.currentTimeline.currentTime,o=i.duration!=null?ir(i.duration):null,a=i.delay!=null?ir(i.delay):null;return o!==0&&e.forEach(l=>{let c=n.appendInstructionToTimeline(l,o,a);s=Math.max(s,c.duration+c.delay)}),s}visitReference(e,n){n.updateOptions(e.options,!0),qn(this,e.animation,n),n.previousNode=e}visitSequence(e,n){let i=n.subContextCount,r=n,s=e.options;if(s&&(s.params||s.delay)&&(r=n.createSubContext(s),r.transformIntoNewTimeline(),s.delay!=null)){r.previousNode.type==me.Style&&(r.currentTimeline.snapshotCurrentStyles(),r.previousNode=jp);let o=ir(s.delay);r.delayNextStep(o)}e.steps.length&&(e.steps.forEach(o=>qn(this,o,r)),r.currentTimeline.applyStylesToKeyframe(),r.subContextCount>i&&r.transformIntoNewTimeline()),n.previousNode=e}visitGroup(e,n){let i=[],r=n.currentTimeline.currentTime,s=e.options&&e.options.delay?ir(e.options.delay):0;e.steps.forEach(o=>{let a=n.createSubContext(e.options);s&&a.delayNextStep(s),qn(this,o,a),r=Math.max(r,a.currentTimeline.currentTime),i.push(a.currentTimeline)}),i.forEach(o=>n.currentTimeline.mergeTimelineCollectedStyles(o)),n.transformIntoNewTimeline(r),n.previousNode=e}_visitTiming(e,n){if(e.dynamic){let i=e.strValue,r=n.params?ea(i,n.params,n.errors):i;return Rl(r,n.errors)}else return{duration:e.duration,delay:e.delay,easing:e.easing}}visitAnimate(e,n){let i=n.currentAnimateTimings=this._visitTiming(e.timings,n),r=n.currentTimeline;i.delay&&(n.incrementTime(i.delay),r.snapshotCurrentStyles());let s=e.style;s.type==me.Keyframes?this.visitKeyframes(s,n):(n.incrementTime(i.duration),this.visitStyle(s,n),r.applyStylesToKeyframe()),n.currentAnimateTimings=null,n.previousNode=e}visitStyle(e,n){let i=n.currentTimeline,r=n.currentAnimateTimings;!r&&i.hasCurrentStyleProperties()&&i.forwardFrame();let s=r&&r.easing||e.easing;e.isEmptyStep?i.applyEmptyStep(s):i.setStyles(e.styles,s,n.errors,n.options),n.previousNode=e}visitKeyframes(e,n){let i=n.currentAnimateTimings,r=n.currentTimeline.duration,s=i.duration,a=n.createSubContext().currentTimeline;a.easing=i.easing,e.styles.forEach(l=>{let c=l.offset||0;a.forwardTime(c*s),a.setStyles(l.styles,l.easing,n.errors,n.options),a.applyStylesToKeyframe()}),n.currentTimeline.mergeTimelineCollectedStyles(a),n.transformIntoNewTimeline(r+s),n.previousNode=e}visitQuery(e,n){let i=n.currentTimeline.currentTime,r=e.options||{},s=r.delay?ir(r.delay):0;s&&(n.previousNode.type===me.Style||i==0&&n.currentTimeline.hasCurrentStyleProperties())&&(n.currentTimeline.snapshotCurrentStyles(),n.previousNode=jp);let o=i,a=n.invokeQuery(e.selector,e.originalSelector,e.limit,e.includeSelf,!!r.optional,n.errors);n.currentQueryTotal=a.length;let l=null;a.forEach((c,u)=>{n.currentQueryIndex=u;let p=n.createSubContext(e.options,c);s&&p.delayNextStep(s),c===n.element&&(l=p.currentTimeline),qn(this,e.animation,p),p.currentTimeline.applyStylesToKeyframe();let m=p.currentTimeline.currentTime;o=Math.max(o,m)}),n.currentQueryIndex=0,n.currentQueryTotal=0,n.transformIntoNewTimeline(o),l&&(n.currentTimeline.mergeTimelineCollectedStyles(l),n.currentTimeline.snapshotCurrentStyles()),n.previousNode=e}visitStagger(e,n){let i=n.parentContext,r=n.currentTimeline,s=e.timings,o=Math.abs(s.duration),a=o*(n.currentQueryTotal-1),l=o*n.currentQueryIndex;switch(s.duration<0?"reverse":s.easing){case"reverse":l=a-l;break;case"full":l=i.currentStaggerTime;break}let u=n.currentTimeline;l&&u.delayNextStep(l);let p=u.currentTime;qn(this,e.animation,n),n.previousNode=e,i.currentStaggerTime=r.currentTime-p+(r.startTime-i.currentTimeline.startTime)}},jp={},Ph=class t{constructor(e,n,i,r,s,o,a,l){d(this,"_driver");d(this,"element");
3d(this,"subInstructions");d(this,"_enterClassName");d(this,"_leaveClassName");d(this,"errors");d(this,"timelines");d(this,"parentContext",null);d(this,"currentTimeline");d(this,"currentAnimateTimings",null);d(this,"previousNode",jp);d(this,"subContextCount",0);d(this,"options",{});d(this,"currentQueryIndex",0);d(this,"currentQueryTotal",0);d(this,"currentStaggerTime",0);this._driver=e,this.element=n,this.subInstructions=i,this._enterClassName=r,this._leaveClassName=s,this.errors=o,this.timelines=a,this.currentTimeline=l||new Gp(this._driver,n,0),a.push(this.currentTimeline)}get params(){return this.options.params}updateOptions(e,n){if(!e)return;let i=e,r=this.options;i.duration!=null&&(r.duration=ir(i.duration)),i.delay!=null&&(r.delay=ir(i.delay));let s=i.params;if(s){let o=r.params;o||(o=this.options.params={}),Object.keys(s).forEach(a=>{(!n||!o.hasOwnProperty(a))&&(o[a]=ea(s[a],o,this.errors))})}}_copyOptions(){let e={};if(this.options){let n=this.options.params;if(n){let i=e.params={};Object.keys(n).forEach(r=>{i[r]=n[r]})}}return e}createSubContext(e=null,n,i){let r=n||this.element,s=new t(this._driver,r,this.subInstructions,this._enterClassName,this._leaveClassName,this.errors,this.timelines,this.currentTimeline.fork(r,i||0));return s.previousNode=this.previousNode,s.currentAnimateTimings=this.currentAnimateTimings,s.options=this._copyOptions(),s.updateOptions(e),s.currentQueryIndex=this.currentQueryIndex,s.currentQueryTotal=this.currentQueryTotal,s.parentContext=this,this.subContextCount++,s}transformIntoNewTimeline(e){return this.previousNode=jp,this.currentTimeline=this.currentTimeline.fork(this.element,e),this.timelines.push(this.currentTimeline),this.currentTimeline}appendInstructionToTimeline(e,n,i){let r={duration:n!=null?n:e.duration,delay:this.currentTimeline.currentTime+(i!=null?i:0)+e.delay,easing:""},s=new Dh(this._driver,e.element,e.keyframes,e.preStyleProps,e.postStyleProps,r,e.stretchStartingKeyframe);return this.timelines.push(s),r}incrementTime(e){this.currentTimeline.forwardTime(this.currentTimeline.duration+e)}delayNextStep(e){e>0&&this.currentTimeline.delayNextStep(e)}invokeQuery(e,n,i,r,s,o){let a=[];if(r&&a.push(this.element),e.length>0){e=e.replace(uN,"."+this._enterClassName),e=e.replace(dN,"."+this._leaveClassName);let l=i!=1,c=this._driver.query(this.element,e,l);i!==0&&(c=i<0?c.slice(c.length+i,c.length):c.slice(0,i)),a.push(...c)}return!s&&a.length==0&&o.push(dT(n)),a}},Gp=class t{constructor(e,n,i,r){d(this,"_driver");d(this,"element");d(this,"startTime");d(this,"_elementTimelineStylesLookup");d(this,"duration",0);d(this,"easing",null);d(this,"_previousKeyframe",new Map);d(this,"_currentKeyframe",new Map);d(this,"_keyframes",new Map);d(this,"_styleSummary",new Map);d(this,"_localTimelineStyles",new Map);d(this,"_globalTimelineStyles");d(this,"_pendingStyles",new Map);d(this,"_backFill",new Map);d(this,"_currentEmptyStepKeyframe",null);this._driver=e,this.element=n,this.startTime=i,this._elementTimelineStylesLookup=r,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(n),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(n,this._localTimelineStyles)),this._loadKeyframe()}containsAnimation(){switch(this._keyframes.size){case 0:return!1;case 1:return this.hasCurrentStyleProperties();default:return!0}}hasCurrentStyleProperties(){return this._currentKeyframe.size>0}get currentTime(){return this.startTime+this.duration}delayNextStep(e){let n=this._keyframes.size===1&&this._pendingStyles.size;this.duration||n?(this.forwardTime(this.currentTime+e),n&&this.snapshotCurrentStyles()):this.startTime+=e}fork(e,n){return this.applyStylesToKeyframe(),new t(this._driver,e,n||this.currentTime,this._elementTimelineStylesLookup)}_loadKeyframe(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=new Map,this._keyframes.set(this.duration,this._currentKeyframe))}forwardFrame(){this.duration+=lN,this._loadKeyframe()}forwardTime(e){this.applyStylesToKeyframe(),this.duration=e,this._loadKeyframe()}_updateStyle(e,n){this._localTimelineStyles.set(e,n),this._globalTimelineStyles.set(e,n),this._styleSummary.set(e,{time:this.currentTime,value:n})}allowOnlyTimelineStyles(){return this._currentEmptyStepKeyframe!==this._currentKeyframe}
3applyEmptyStep(e){e&&this._previousKeyframe.set("easing",e);for(let[n,i]of this._globalTimelineStyles)this._backFill.set(n,i||yi),this._currentKeyframe.set(n,yi);this._currentEmptyStepKeyframe=this._currentKeyframe}setStyles(e,n,i,r){var a;n&&this._previousKeyframe.set("easing",n);let s=r&&r.params||{},o=mN(e,this._globalTimelineStyles);for(let[l,c]of o){let u=ea(c,s,i);this._pendingStyles.set(l,u),this._localTimelineStyles.has(l)||this._backFill.set(l,(a=this._globalTimelineStyles.get(l))!=null?a:yi),this._updateStyle(l,u)}}applyStylesToKeyframe(){this._pendingStyles.size!=0&&(this._pendingStyles.forEach((e,n)=>{this._currentKeyframe.set(n,e)}),this._pendingStyles.clear(),this._localTimelineStyles.forEach((e,n)=>{this._currentKeyframe.has(n)||this._currentKeyframe.set(n,e)}))}snapshotCurrentStyles(){for(let[e,n]of this._localTimelineStyles)this._pendingStyles.set(e,n),this._updateStyle(e,n)}getFinalKeyframe(){return this._keyframes.get(this.duration)}get properties(){let e=[];for(let n in this._currentKeyframe)e.push(n);return e}
3mergeTimelineCollectedStyles(e){e._styleSummary.forEach((n,i)=>{let r=this._styleSummary.get(i);(!r||n.time>r.time)&&this._updateStyle(i,n.value)})}buildKeyframes(){this.applyStylesToKeyframe();let e=new Set,n=new Set,i=this._keyframes.size===1&&this.duration===0,r=[];this._keyframes.forEach((a,l)=>{let c=new Map([...this._backFill,...a]);c.forEach((u,p)=>{u===Jo?e.add(p):u===yi&&n.add(p)}),i||c.set("offset",l/this.duration),r.push(c)});let s=[...e.values()],o=[...n.values()];if(i){let a=r[0],l=new Map(a);a.set("offset",0),l.set("offset",1),r=[a,l]}return Gh(this.element,r,s,o,this.duration,this.startTime,this.easing,!1)}},Dh=class extends Gp{constructor(n,i,r,s,o,a,l=!1){super(n,i,a.delay);d(this,"keyframes");d(this,"preStyleProps");d(this,"postStyleProps");d(this,"_stretchStartingKeyframe");d(this,"timings");this.keyframes=r,this.preStyleProps=s,this.postStyleProps=o,this._stretchStartingKeyframe=l,this.timings={duration:a.duration,delay:a.delay,easing:a.easing}}containsAnimation(){return this.keyframes.length>1}buildKeyframes(){let n=this.keyframes,{delay:i,duration:r,easing:s}=this.timings;if(this._stretchStartingKeyframe&&i){let o=[],a=r+i,l=i/a,c=new Map(n[0]);c.set("offset",0),o.push(c);let u=new Map(n[0]);u.set("offset",MT(l)),o.push(u);let p=n.length-1;for(let m=1;m<=p;m++){let f=new Map(n[m]),h=f.get("offset"),_=i+h*r;f.set("offset",MT(_/a)),o.push(f)}r=a,i=0,s="",n=o}return Gh(this.element,n,this.preStyleProps,this.postStyleProps,r,i,s,!0)}};function MT(t,e=3){let n=Math.pow(10,e-1);return Math.round(t*n)/n}function mN(t,e){let n=new Map,i;return t.forEach(r=>{if(r==="*"){i!=null||(i=e.keys());for(let s of i)n.set(s,yi)}else for(let[s,o]of r)n.set(s,o)}),n}function PT(t,e,n,i,r,s,o,a,l,c,u,p,m){return{type:0,element:t,triggerName:e,isRemovalTransition:r,fromState:n,fromStyles:s,toState:i,toStyles:o,timelines:a,queriedElements:l,preStyleProps:c,postStyleProps:u,totalTime:p,errors:m}}var xh={},Wp=class{constructor(e,n,i){d(this,"_triggerName");d(this,"ast");d(this,"_stateStyles");this._triggerName=e,this.ast=n,this._stateStyles=i}match(e,n,i,r){return fN(this.ast.matchers,e,n,i,r)}buildStyles(e,n,i){let r=this._stateStyles.get("*");return e!==void 0&&(r=this._stateStyles.get(e==null?void 0:e.toString())||r),r?r.buildStyles(n,i):new Map}build(e,n,i,r,s,o,a,l,c,u){var Y;let p=[],m=this.ast.options&&this.ast.options.params||xh,f=a&&a.params||xh,h=this.buildStyles(i,f,p),_=l&&l.params||xh,v=this.buildStyles(r,_,p),I=new Set,N=new Map,j=new Map,P=r==="void",X={params:WT(_,m),delay:(Y=this.ast.options)==null?void 0:Y.delay},V=u?[]:GT(e,n,this.ast.animation,s,o,h,v,X,c,p),A=0;return V.forEach(Pe=>{A=Math.max(Pe.duration+Pe.delay,A)}),p.length?PT(n,this._triggerName,i,r,P,h,v,[],[],N,j,A,p):(V.forEach(Pe=>{let H=Pe.element,re=Hn(N,H,new Set);Pe.preStyleProps.forEach(Ie=>re.add(Ie));let Te=Hn(j,H,new Set);Pe.postStyleProps.forEach(Ie=>Te.add(Ie)),H!==n&&I.add(H)}),PT(n,this._triggerName,i,r,P,h,v,V,[...I.values()],N,j,A))}};function fN(t,e,n,i,r){return t.some(s=>s(e,n,i,r))}function WT(t,e){let n=g({},e);return Object.entries(t).forEach(([i,r])=>{r!=null&&(n[i]=r)}),n}var Lh=class{constructor(e,n,i){d(this,"styles");d(this,"defaultParams");d(this,"normalizer");this.styles=e,this.defaultParams=n,this.normalizer=i}buildStyles(e,n){let i=new Map,r=WT(e,this.defaultParams);return this.styles.styles.forEach(s=>
3{typeof s!="string"&&s.forEach((o,a)=>{o&&(o=ea(o,r,n));let l=this.normalizer.normalizePropertyName(a,n);o=this.normalizer.normalizeStyleValue(a,l,o,n),i.set(a,o)})}),i}};function hN(t,e,n){return new Fh(t,e,n)}var Fh=class{constructor(e,n,i){d(this,"name");d(this,"ast");d(this,"_normalizer");d(this,"transitionFactories",[]);d(this,"fallbackTransition");d(this,"states",new Map);this.name=e,this.ast=n,this._normalizer=i,n.states.forEach(r=>{let s=r.options&&r.options.params||{};this.states.set(r.name,new Lh(r.style,s,i))}),DT(this.states,"true","1"),DT(this.states,"false","0"),n.transitions.forEach(r=>{this.transitionFactories.push(new Wp(e,r,this.states))}),this.fallbackTransition=gN(e,this.states)}get containsQueries(){return this.ast.queryCount>0}matchTransition(e,n,i,r){return this.transitionFactories.find(o=>o.match(e,n,i,r))||null}matchStyles(e,n,i){return this.fallbackTransition.buildStyles(e,n,i)}};function gN(t,e,n){let i=[(o,a)=>!0],r={type:me.Sequence,steps:[],options:null},s={type:me.Transition,animation:r,matchers:i,options:null,queryCount:0,depCount:0};return new Wp(t,s,e)}function DT(t,e,n){t.has(e)?t.has(n)||t.set(n,t.get(e)):t.has(n)&&t.set(e,t.get(n))}var _N=new Nl,Uh=class{constructor(e,n,i){d(this,"bodyNode");d(this,"_driver");d(this,"_normalizer");d(this,"_animations",new Map);d(this,"_playersById",new Map);d(this,"players",[]);this.bodyNode=e,this._driver=n,this._normalizer=i}register(e,n){let i=[],r=[],s=jT(this._driver,n,i,r);if(i.length)throw gT(i);this._animations.set(e,s)}_buildPlayer(e,n,i){let r=e.element,s=yh(this._normalizer,e.keyframes,n,i);return this._driver.animate(r,s,e.duration,e.delay,e.easing,[],!0)}create(e,n,i={}){let r=[],s=this._animations.get(e),o,a=new Map;if(s?(o=GT(this._driver,n,s,Th,Np,new Map,new Map,i,_N,r),o.forEach(u=>{let p=Hn(a,u.element,new Map);u.postStyleProps.forEach(m=>p.set(m,null))})):(r.push(_T()),o=[]),r.length)throw yT(r);a.forEach((u,p)=>{u.forEach((m,f)=>{u.set(f,this._driver.computeStyle(p,f,yi))})});let l=o.map(u=>{let p=a.get(u.element);return this._buildPlayer(u,new Map,p)}),c=Ar(l);return this._playersById.set(e,c),c.onDestroy(()=>this.destroy(e)),this.players.push(c),c}destroy(e){let n=this._getPlayer(e);n.destroy(),this._playersById.delete(e);let i=this.players.indexOf(n);i>=0&&this.players.splice(i,1)}_getPlayer(e){let n=this._playersById.get(e);if(!n)throw bT(e);return n}listen(e,n,i,r){let s=Rp(n,"","","");return kp(this._getPlayer(e),i,s,r),()=>{}}command(e,n,i,r){if(i=="register"){this.register(e,r[0]);return}if(i=="create"){let o=r[0]||{};this.create(e,n,o);return}let s=this._getPlayer(e);switch(i){case"play":s.play();break;case"pause":s.pause();break;case"reset":s.reset();break;case"restart":s.restart();break;case"finish":s.finish();break;case"init":s.init();break;case"setPosition":s.setPosition(parseFloat(r[0]));break;case"destroy":this.destroy(e);break}}},LT="ng-animate-queued",yN=".ng-animate-queued",Ah="ng-animate-disabled",bN=".ng-animate-disabled",vN="ng-star-inserted",SN=".ng-star-inserted",EN=[],VT={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},TN={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},Ui="__ng_removed",Ml=class{constructor(e,n=""){d(this,"namespaceId");d(this,"value");d(this,"options");this.namespaceId=n;let i=e&&e.hasOwnProperty("value"),r=i?e.value:e;if(this.value=CN(r),i){let s=e,{value:o}=s,a=Lo(s,["value"]);this.options=a}else this.options={};this.options.params||(this.options.params={})}get params(){return this.options.params}absorbOptions(e){let n=e.params;if(n){let i=this.options.params;Object.keys(n).forEach(r=>{i[r]==null&&(i[r]=n[r])})}}},Ol="void",kh=new Ml(Ol),Bh=class{constructor(e,n,i){d(this,"id");d(this,"hostElement");d(this,"_engine");d(this,"players",[]);d(this,"_triggers",new Map);d(this,"_queue",[]);d(this,"_elementListeners",new Map);d(this,"_hostClassName");this.id=e,this.hostElement=n,this._engine=i,this._hostClassName="ng-tns-"
vendor: 4,365 bytes, line 3
3+e,bi(n,this._hostClassName)}listen(e,n,i,r){if(!this._triggers.has(n))throw vT(i,n);if(i==null||i.length==0)throw ST(n);if(!wN(i))throw ET(i,n);let s=Hn(this._elementListeners,e,[]),o={name:n,phase:i,callback:r};s.push(o);let a=Hn(this._engine.statesByElement,e,new Map);return a.has(n)||(bi(e,Al),bi(e,Al+"-"+n),a.set(n,kh)),()=>{this._engine.afterFlush(()=>{let l=s.indexOf(o);l>=0&&s.splice(l,1),this._triggers.has(n)||a.delete(n)})}}register(e,n){return this._triggers.has(e)?!1:(this._triggers.set(e,n),!0)}_getTrigger(e){let n=this._triggers.get(e);if(!n)throw TT(e);return n}trigger(e,n,i,r=!0){let s=this._getTrigger(n),o=new Pl(this.id,n,e),a=this._engine.statesByElement.get(e);a||(bi(e,Al),bi(e,Al+"-"+n),this._engine.statesByElement.set(e,a=new Map));let l=a.get(n),c=new Ml(i,this.id);if(!(i&&i.hasOwnProperty("value"))&&l&&c.absorbOptions(l.options),a.set(n,c),l||(l=kh),!(c.value===Ol)&&l.value===c.value){if(!kN(l.params,c.params)){let _=[],v=s.matchStyles(l.value,l.params,_),I=s.matchStyles(c.value,c.params,_);_.length?this._engine.reportError(_):this._engine.afterFlush(()=>{rs(e,v),Fi(e,I)})}return}let m=Hn(this._engine.playersByElement,e,[]);m.forEach(_=>{_.namespaceId==this.id&&_.triggerName==n&&_.queued&&_.destroy()});let f=s.matchTransition(l.value,c.value,e,c.params),h=!1;if(!f){if(!r)return;f=s.fallbackTransition,h=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:n,transition:f,fromState:l,toState:c,player:o,isFallbackTransition:h}),h||(bi(e,LT),o.onStart(()=>{ta(e,LT)})),o.onDone(()=>{let _=this.players.indexOf(o);_>=0&&this.players.splice(_,1);let v=this._engine.playersByElement.get(e);if(v){let I=v.indexOf(o);I>=0&&v.splice(I,1)}}),this.players.push(o),m.push(o),o}deregister(e){this._triggers.delete(e),this._engine.statesByElement.forEach(n=>n.delete(e)),this._elementListeners.forEach((n,i)=>{this._elementListeners.set(i,n.filter(r=>r.name!=e))})}clearElementCache(e){this._engine.statesByElement.delete(e),this._elementListeners.delete(e);let n=this._engine.playersByElement.get(e);n&&(n.forEach(i=>i.destroy()),this._engine.playersByElement.delete(e))}_signalRemovalForInnerTriggers(e,n){let i=this._engine.driver.query(e,kl,!0);i.forEach(r=>{if(r[Ui])return;let s=this._engine.fetchNamespacesByElement(r);s.size?s.forEach(o=>o.triggerLeaveAnimation(r,n,!1,!0)):this.clearElementCache(r)}),this._engine.afterFlushAnimationsDone(()=>i.forEach(r=>this.clearElementCache(r)))}triggerLeaveAnimation(e,n,i,r){let s=this._engine.statesByElement.get(e),o=new Map;if(s){let a=[];if(s.forEach((l,c)=>{if(o.set(c,l.value),this._triggers.has(c)){let u=this.trigger(e,c,Ol,r);u&&a.push(u)}}),a.length)return this._engine.markElementAsRemoved(this.id,e,!0,n,o),i&&Ar(a).onDone(()=>this._engine.processLeaveNode(e)),!0}return!1}prepareLeaveAnimationListeners(e){let n=this._elementListeners.get(e),i=this._engine.statesByElement.get(e);if(n&&i){let r=new Set;n.forEach(s=>{let o=s.name;if(r.has(o))return;r.add(o);let l=this._triggers.get(o).fallbackTransition,c=i.get(o)||kh,u=new Ml(Ol),p=new Pl(this.id,o,e);this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:o,transition:l,fromState:c,toState:u,player:p,isFallbackTransition:!0})})}}removeNode(e,n){let i=this._engine;if(e.childElementCount&&this._signalRemovalForInnerTriggers(e,n),this.triggerLeaveAnimation(e,n,!0))return;let r=!1;if(i.totalAnimations){let s=i.players.length?i.playersByQueriedElement.get(e):[];if(s&&s.length)r=!0;else{let o=e;for(;o=o.parentNode;)if(i.statesByElement.get(o)){r=!0;break}}}if(this.prepareLeaveAnimationListeners(e),r)i.markElementAsRemoved(this.id,e,!1,n);else{let s=e[Ui];(!s||s===VT)&&(i.afterFlush(()=>this.clearElementCache(e)),i.destroyInnerAnimations(e),i._onRemovalComplete(e,n))}}insertNode(e,n){bi(e,this._hostClassName)}drainQueuedTransitions(e){let n=[];return this._queue.forEach(i=>{let r=i.player;if(r.destroyed)return;let s=i.element,o=this._elementListeners.get(s);o&&o.forEach(a=>{if(a.name==i.triggerName){let l=Rp(s,i.triggerName,i.fromState.value,i.toState.value);l._data=e,kp(i.player,a.phase,l,a.callback)}}),r.markedForDestroy?this._engine.afterFlush(()=>{r.destroy()}):n.push(i)}),this._queue=[],n.sort((i,r)=>{let s=i.transition.ast.depCount,o=r.transition.ast.depCount;return s==0||o==0?s-o:this._engine.driver.containsElement(i.element,r.element)?1:-1})}
3destroy(e){this.players.forEach(n=>n.destroy()),this._signalRemovalForInnerTriggers(this.hostElement,e)}},Hh=class{constructor(e,n,i){d(this,"bodyNode");d(this,"driver");d(this,"_normalizer");d(this,"players",[]);d(this,"newHostElements",new Map);d(this,"playersByElement",new Map);d(this,"playersByQueriedElement",new Map);d(this,"statesByElement",new Map);d(this,"disabledNodes",new Set);d(this,"totalAnimations",0);d(this,"totalQueuedPlayers",0);d(this,"_namespaceLookup",{});d(this,"_namespaceList",[]);d(this,"_flushFns",[]);d(this,"_whenQuietFns",[]);d(this,"namespacesByHostElement",new Map);d(this,"collectedEnterElements",[]);d(this,"collectedLeaveElements",[]);d(this,"onRemovalComplete",(e,n)=>{});this.bodyNode=e,this.driver=n,this._normalizer=i}_onRemovalComplete(e,n){this.onRemovalComplete(e,n)}get queuedPlayers(){let e=[];return this._namespaceList.forEach(n=>{n.players.forEach(i=>{i.queued&&e.push(i)})}),e}createNamespace(e,n){let i=new Bh(e,n,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,n)?this._balanceNamespaceList(i,n):(this.newHostElements.set(n,i),this.collectEnterElement(n)),this._namespaceLookup[e]=i}_balanceNamespaceList(e,n){let i=this._namespaceList,r=this.namespacesByHostElement;if(i.length-1>=0){let o=!1,a=this.driver.getParentElement(n);for(;a;){let l=r.get(a);if(l){let c=i.indexOf(l);i.splice(c+1,0,e),o=!0;break}a=this.driver.getParentElement(a)}o||i.unshift(e)}else i.push(e);return r.set(n,e),e}register(e,n){let i=this._namespaceLookup[e];return i||(i=this.createNamespace(e,n)),i}registerTrigger(e,n,i){let r=this._namespaceLookup[e];r&&r.register(n,i)&&this.totalAnimations++}destroy(e,n){e&&(this.afterFlush(()=>{}),this.afterFlushAnimationsDone(()=>{let i=this._fetchNamespace(e);this.namespacesByHostElement.delete(i.hostElement);let r=this._namespaceList.indexOf(i);r>=0&&this._namespaceList.splice(r,1),i.destroy(n),delete this._namespaceLookup[e]}))}_fetchNamespace(e){return this._namespaceLookup[e]}fetchNamespacesByElement(e){let n=new Set,i=this.statesByElement.get(e);if(i){for(let r of i.values())if(r.namespaceId){let s=this._fetchNamespace(r.namespaceId);s&&n.add(s)}}return n}trigger(e,n,i,r){if(Up(n)){let s=this._fetchNamespace(e);if(s)return s.trigger(n,i,r),!0}return!1}insertNode(e,n,i,r){if(!Up(n))return;let s=n[Ui];if(s&&s.setForRemoval){s.setForRemoval=!1,s.setForMove=!0;let o=this.collectedLeaveElements.indexOf(n);o>=0&&this.collectedLeaveElements.splice(o,1)}if(e){let o=this._fetchNamespace(e);o&&o.insertNode(n,i)}r&&this.collectEnterElement(n)}collectEnterElement(e){this.collectedEnterElements.push(e)}markElementAsDisabled(e,n){n?this.disabledNodes.has(e)||(this.disabledNodes.add(e),bi(e,Ah)):this.disabledNodes.has(e)&&(this.disabledNodes.delete(e),ta(e,Ah))}removeNode(e,n,i){if(Up(n)){let r=e?this._fetchNamespace(e):null;r?r.removeNode(n,i):this.markElementAsRemoved(e,n,!1,i);let s=this.namespacesByHostElement.get(n);s&&s.id!==e&&s.removeNode(n,i)}else this._onRemovalComplete(n,i)}markElementAsRemoved(e,n,i,r,s){this.collectedLeaveElements.push(n),n[Ui]={namespaceId:e,setForRemoval:r,hasAnimation:i,removedBeforeQueried:!1,previousTriggersValues:s}}listen(e,n,i,r,s){return Up(n)?this._fetchNamespace(e).listen(n,i,r,s):()=>{}}_buildInstruction(e,n,i,r,s){return e.transition.build(this.driver,e.element,e.fromState.value,e.toState.value,i,r,e.fromState.options,e.toState.options,n,s)}destroyInnerAnimations(e){let n=this.driver.query(e,kl,!0);n.forEach(i=>this.destroyActiveAnimationsForElement(i)),this.playersByQueriedElement.size!=0&&(n=this.driver.query(e,Mp,!0),n.forEac
vendor: 7,252 bytes, line 3
3h(i=>this.finishActiveQueriedAnimationOnElement(i)))}destroyActiveAnimationsForElement(e){let n=this.playersByElement.get(e);n&&n.forEach(i=>{i.queued?i.markedForDestroy=!0:i.destroy()})}finishActiveQueriedAnimationOnElement(e){let n=this.playersByQueriedElement.get(e);n&&n.forEach(i=>i.finish())}whenRenderingDone(){return new Promise(e=>{if(this.players.length)return Ar(this.players).onDone(()=>e());e()})}processLeaveNode(e){var i;let n=e[Ui];if(n&&n.setForRemoval){if(e[Ui]=VT,n.namespaceId){this.destroyInnerAnimations(e);let r=this._fetchNamespace(n.namespaceId);r&&r.clearElementCache(e)}this._onRemovalComplete(e,n.setForRemoval)}(i=e.classList)!=null&&i.contains(Ah)&&this.markElementAsDisabled(e,!1),this.driver.query(e,bN,!0).forEach(r=>{this.markElementAsDisabled(r,!1)})}flush(e=-1){let n=[];if(this.newHostElements.size&&(this.newHostElements.forEach((i,r)=>this._balanceNamespaceList(i,r)),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(let i=0;i<this.collectedEnterElements.length;i++){let r=this.collectedEnterElements[i];bi(r,vN)}if(this._namespaceList.length&&(this.totalQueuedPlayers||this.collectedLeaveElements.length)){let i=[];try{n=this._flushAnimations(i,e)}finally{for(let r=0;r<i.length;r++)i[r]()}}else for(let i=0;i<this.collectedLeaveElements.length;i++){let r=this.collectedLeaveElements[i];this.processLeaveNode(r)}if(this.totalQueuedPlayers=0,this.collectedEnterElements.length=0,this.collectedLeaveElements.length=0,this._flushFns.forEach(i=>i()),this._flushFns=[],this._whenQuietFns.length){let i=this._whenQuietFns;this._whenQuietFns=[],n.length?Ar(n).onDone(()=>{i.forEach(r=>r())}):i.forEach(r=>r())}}reportError(e){throw IT(e)}_flushAnimations(e,n){let i=new Nl,r=[],s=new Map,o=[],a=new Map,l=new Map,c=new Map,u=new Set;this.disabledNodes.forEach(U=>{u.add(U);let O=this.driver.query(U,yN,!0);for(let R=0;R<O.length;R++)u.add(O[R])});let p=this.bodyNode,m=Array.from(this.statesByElement.keys()),f=BT(m,this.collectedEnterElements),h=new Map,_=0;f.forEach((U,O)=>{let R=Th+_++;h.set(O,R),U.forEach(Q=>bi(Q,R))});let v=[],I=new Set,N=new Set;for(let U=0;U<this.collectedLeaveElements.length;U++){let O=this.collectedLeaveElements[U],R=O[Ui];R&&R.setForRemoval&&(v.push(O),I.add(O),R.hasAnimation?this.driver.query(O,SN,!0).forEach(Q=>I.add(Q)):N.add(O))}let j=new Map,P=BT(m,Array.from(I));P.forEach((U,O)=>{let R=Np+_++;j.set(O,R),U.forEach(Q=>bi(Q,R))}),e.push(()=>{f.forEach((U,O)=>{let R=h.get(O);U.forEach(Q=>ta(Q,R))}),P.forEach((U,O)=>{let R=j.get(O);U.forEach(Q=>ta(Q,R))}),v.forEach(U=>{this.processLeaveNode(U)})});let X=[],V=[];for(let U=this._namespaceList.length-1;U>=0;U--)this._namespaceList[U].drainQueuedTransitions(n).forEach(R=>{let Q=R.player,q=R.element;if(X.push(Q),this.collectedEnterElements.length){let ht=q[Ui];if(ht&&ht.setForMove){if(ht.previousTriggersValues&&ht.previousTriggersValues.has(R.triggerName)){let Jt=ht.previousTriggersValues.get(R.triggerName),Ht=this.statesByElement.get(R.element);if(Ht&&Ht.has(R.triggerName)){let ui=Ht.get(R.triggerName);ui.value=Jt,Ht.set(R.triggerName,ui)}}Q.destroy();return}}let he=!p||!this.driver.containsElement(p,q),ye=j.get(q),We=h.get(q),Se=this._buildInstruction(R,i,We,ye,he);if(Se.errors&&Se.errors.length){V.push(Se);return}if(he){Q.onStart(()=>rs(q,Se.fromStyles)),Q.onDestroy(()=>Fi(q,Se.toStyles)),r.push(Q);return}if(R.isFallbackTransition){Q.onStart(()=>rs(q,Se.fromStyles)),Q.onDestroy(()=>Fi(q,Se.toStyles)),r.push(Q);return}let Rn=[];Se.timelines.forEach(ht=>{ht.stretchStartingKeyframe=!0,this.disabledNodes.has(ht.element)||Rn.push(ht)}),Se.timelines=Rn,i.append(q,Se.timelines);let Mi={instruction:Se,player:Q,element:q};o.push(Mi),Se.queriedElements.forEach(ht=>Hn(a,ht,[]).push(Q)),Se.preStyleProps.forEach((ht,Jt)=>{if(ht.size){let Ht=l.get(Jt);Ht||l.set(Jt,Ht=new Set),ht.forEach((ui,Do)=>Ht.add(Do))}}),Se.postStyleProps.forEach((ht,Jt)=>{let Ht=c.get(Jt);Ht||c.set(Jt,Ht=new Set),ht.forEach((ui,Do)=>Ht.add(Do))})});if(V.length){let U=[];V.forEach(O=>{U.push(CT(O.triggerName,O.errors))}),X.forEach(O=>O.destroy()),this.reportError(U)}let A=new Map,Y=new Map;o.forEach(U=>{let O=U.element;i.has(O)&&(Y.set(O,O),this._beforeAnimationBuild(U.player.namespaceId,U.instruction,A))}),r.forEach(U=>{let O=U.element;this._getPreviousPlayers(O,!1,U.namespaceId,U.triggerName,null).forEach(Q=>{Hn(A,O,[]).push(Q),Q.destroy()})});let Pe=v.filter(U=>HT(U,l,c)),H=new Map;UT(H,this.driver,N,c,yi).forEach(U=>{HT(U,l,c)&&Pe.push(U)});let Te=new Map;f.forEach((U,O)=>{UT(Te,this.driver,new Set(U),l,Jo)}),Pe.forEach(U=>{var Q,q;let O=H.get(U),R=Te.get(U);H.set(U,new Map([...(Q=O==null?void 0:O.entries())!=null?Q:[],...(q=R==null?void 0:R.entries())!=null?q:[]]))});let Ie=[],fe=[],ft={};o.forEach(U=>{let{element:O,player:R,instruction:Q}=U;if(i.has(O)){if(u.has(O)){R.onDestroy(()=>Fi(O,Q.toStyles)),R.disabled=!0,R.overrideTotalTime(Q.totalTime),r.push(R);return}let q=ft;if(Y.size>1){let ye=O,We=[];for(;ye=ye.parentNode;){let Se=Y.get(ye);if(Se){q=Se;break}We.push(ye)}We.forEach(Se=>Y.set(Se,q))}let he=this._buildAnimation(R.namespaceId,Q,A,s,Te,H);if(R.setRealPlayer(he),q===ft)Ie.push(R);else{let ye=this.playersByElement.get(q);ye&&ye.length&&(R.parentPlayer=Ar(ye)),r.push(R)}}else rs(O,Q.fromStyles),R.onDestroy(()=>Fi(O,Q.toStyles)),fe.push(R),u.has(O)&&r.push(R)}),fe.forEach(U=>{let O=s.get(U.element);if(O&&O.length){let R=Ar(O);U.setRealPlayer(R)}}),r.forEach(U=>{U.parentPlayer?U.syncPlayerEvents(U.parentPlayer):U.destroy()});for(let U=0;U<v.length;U++){let O=v[U],R=O[Ui];if(ta(O,Np),R&&R.hasAnimation)continue;let Q=[];if(a.size){let he=a.get(O);he&&he.length&&Q.push(...he);let ye=this.driver.query(O,Mp,!0);for(let We=0;We<ye.length;We++){let Se=a.get(ye[We]);Se&&Se.length&&Q.push(...Se)}}let q=Q.filter(he=>!he.destroyed);q.length?xN(this,O,q):this.processLeaveNode(O)}return v.length=0,Ie.forEach(U=>{this.players.push(U),U.onDone(()=>{U.destroy();let O=this.players.indexOf(U);this.players.splice(O,1)}),U.play()}),Ie}afterFlush(e){this._flushFns.push(e)}afterFlushAnimationsDone(e){this._whenQuietFns.push(e)}_getPreviousPlayers(e,n,i,r,s){let o=[];if(n){let a=this.playersByQueriedElement.get(e);a&&(o=a)}else{let a=this.playersByElement.get(e);if(a){let l=!s||s==Ol;a.forEach(c=>{c.queued||!l&&c.triggerName!=r||o.push(c)})}}return(i||r)&&(o=o.filter(a=>!(i&&i!=a.namespaceId||r&&r!=a.triggerName))),o}_beforeAnimationBuild(e,n,i){let r=n.triggerName,s=n.element,o=n.isRemovalTransition?void 0:e,a=n.isRemovalTransition?void 0:r;for(let l of n.timelines){let c=l.element,u=c!==s,p=Hn(i,c,[]);this._getPreviousPlayers(c,u,o,a,n.toState).forEach(f=>{let h=f.getRealPlayer();h.beforeDestroy&&h.beforeDestroy(),f.destroy(),p.push(f)})}rs(s,n.fromStyles)}_buildAnimation(e,n,i,r,s,o){let a=n.triggerName,l=n.element,c=[],u=new Set,p=new Set,m=n.timelines.map(h=>{let _=h.element;u.add(_);let v=_[Ui];if(v&&v.removedBeforeQueried)return new nr(h.duration,h.delay);let I=_!==l,N=AN((i.get(_)||EN).map(A=>A.getRealPlayer())).filter(A=>{let Y=A;return Y.element?Y.element===_:!1}),j=s.get(_),P=o.get(_),X=yh(this._normalizer,h.keyframes,j,P),V=this._buildPlayer(h,X,N);if(h.subTimeline&&r&&p.add(_),I){let A=new Pl(e,a,_);A.setRealPlayer(V),c.push(A)}return V});
3c.forEach(h=>{Hn(this.playersByQueriedElement,h.element,[]).push(h),h.onDone(()=>IN(this.playersByQueriedElement,h.element,h))}),u.forEach(h=>bi(h,Ih));let f=Ar(m);return f.onDestroy(()=>{u.forEach(h=>ta(h,Ih)),Fi(l,n.toStyles)}),p.forEach(h=>{Hn(r,h,[]).push(f)}),f}_buildPlayer(e,n,i){return n.length>0?this.driver.animate(e.element,n,e.duration,e.delay,e.easing,i):new nr(e.duration,e.delay)}},Pl=class{constructor(e,n,i){d(this,"namespaceId");d(this,"triggerName");d(this,"element");d(this,"_player",new nr);d(this,"_containsRealPlayer",!1);d(this,"_queuedCallbacks",new Map);d(this,"destroyed",!1);d(this,"parentPlayer",null);d(this,"markedForDestroy",!1);d(this,"disabled",!1);d(this,"queued",!0);d(this,"totalTime",0);this.namespaceId=e,this.triggerName=n,this.element=i}setRealPlayer(e){this._containsRealPlayer||(this._player=e,this._queuedCallbacks.forEach((n,i)=>{n.forEach(r=>kp(e,i,void 0,r))}),this._queuedCallbacks.clear(),this._containsRealPlayer=!0,this.overrideTotalTime(e.totalTime),this.queued=!1)}getRealPlayer(){return this._player}overrideTotalTime(e){this.totalTime=e}syncPlayerEvents(e){let n=this._player;n.triggerCallback&&e.onStart(()=>n.triggerCallback("start")),e.onDone(()=>this.finish()),e.onDestroy(()=>this.destroy())}_queueEvent(e,n){Hn(this._queuedCallbacks,e,[]).push(n)}onDone(e){this.queued&&this._queueEvent("done",e),this._player.onDone(e)}onStart(e){this.queued&&this._queueEvent("start",e),this._player.onStart(e)}onDestroy(e){this.queued&&this._queueEvent("destroy",e),this._player.onDestroy(e)}init(){this._player.init()}hasStarted(){return this.queued?!1:this._player.hasStarted()}play(){!this.queued&&this._player.play()}pause(){!this.queued&&this._player.pause()}restart(){!this.queued&&this._player.restart()}finish(){this._player.finish()}destroy(){this.destroyed=!0,this._player.destroy()}reset(){!this.queued&&this._player.reset()}setPosition(e){this.queued||this._player.setPosition(e)}getPosition(){return this.queued?0:this._player.getPosition()}triggerCallback(e){let n=this._player;n.triggerCallback&&n.triggerCallback(e)}};function IN(t,e,n){let i=t.get(e);if(i){if(i.length){let r=i.indexOf(n);i.splice(r,1)}i.length==0&&t.delete(e)}return i}function CN(t){return t!=null?t:null}function Up(t){return t&&t.nodeType===1}function wN(t){return t=="start"||t=="done"}function FT(t,e){let n=t.style.display;return t.style.display=e!=null?e:"none",n}function UT(t,e,n,i,r){let s=[];n.forEach(l=>s.push(FT(l)));let o=[];i.forEach((l,c)=>{let u=new Map;l.forEach(p=>{let m=e.computeStyle(c,p,r);u.set(p,m),(!m||m.length==0)&&(c[Ui]=TN,o.push(c))}),t.set(c,u)});let a=0;return n.forEach(l=>FT(l,s[a++])),o}function BT(t,e){let n=new Map;if(t.forEach(a=>n.set(a,[])),e.length==0)return n;let i=1,r=new Set(e),s=new Map;function o(a){if(!a)return i;let l=s.get(a);if(l)return l;let c=a.parentNode;return n.has(c)?l=c:r.has(c)?l=i:l=o(c),s.set(a,l),l}return e.forEach(a=>{let l=o(a);l!==i&&n.get(l).push(a)}),n}function bi(t,e){var n;(n=t.classList)==null||n.add(e)}function ta(t,e){var n;(n=t.classList)==null||n.remove(e)}function xN(t,e,n){Ar(n).onDone(()=>t.processLeaveNode(e))}function AN(t){let e=[];return zT(t,e),e}function zT(t,e){for(let n=0;n<t.length;n++){let i=t[n];i instanceof zs?zT(i.players,e):e.push(i)}}function kN(t,e){let n=Object.keys(t),i=Object.keys(e);if(n.length!=i.length)return!1;for(let r=0;r<n.length;r++){let s=n[r];if(!e.hasOwnProperty(s)||t[s]!==e[s])return!1}return!0}function HT(t,e,n){let i=n.get(t);if(!i)return!1;let r=e.get(t);return r?i.forEach(s=>r.add(s)):e.set(t,i),n.delete(t),!0}var na=class{constructor(e,n,i){d(this,"_driver");d(this,"_normalizer");d(this,"_transitionEngine");d(this,"_timelineEngine");d(this,"_triggerCache",{});d(this,"onRemovalComplete",(e,n)=>{});this._driver=n,this._normalizer=i,this._transitionEngine=new Hh(e.body,n,i),this._timelineEngine=new Uh(e.body,n,i),this._transitionEngine.onRemovalComplete=(r,s)=>this.onRemovalComplete(r,s)}registerTrigger(e,n,i,r,s){let o=e+"-"+r,a=this._triggerCache[o];if(!a){let l=[],c=[],u=jT(this._driver,s,l,c);if(l.length)throw hT(r,l);a=hN(r,u,this._normalizer),this._triggerCache[o]=a}this._transitionEngine.registerTrigger(n,r,a)}register(e,n){this._transitionEngine.register(e,n)}destroy(e,n){this._transitionEngine.destroy(e,n)}
3onInsert(e,n,i,r){this._transitionEngine.insertNode(e,n,i,r)}onRemove(e,n,i){this._transitionEngine.removeNode(e,n,i)}disableAnimations(e,n){this._transitionEngine.markElementAsDisabled(e,n)}process(e,n,i,r){if(i.charAt(0)=="@"){let[s,o]=bh(i),a=r;this._timelineEngine.command(s,n,o,a)}else this._transitionEngine.trigger(e,n,i,r)}listen(e,n,i,r,s){if(i.charAt(0)=="@"){let[o,a]=bh(i);return this._timelineEngine.listen(o,n,a,s)}return this._transitionEngine.listen(e,n,i,r,s)}flush(e=-1){this._transitionEngine.flush(e)}get players(){return[...this._transitionEngine.players,...this._timelineEngine.players]}whenRenderingDone(){return this._transitionEngine.whenRenderingDone()}afterFlushAnimationsDone(e){this._transitionEngine.afterFlushAnimationsDone(e)}};function RN(t,e){let n=null,i=null;return Array.isArray(e)&&e.length?(n=Rh(e[0]),e.length>1&&(i=Rh(e[e.length-1]))):e instanceof Map&&(n=Rh(e)),n||i?new ON(t,n,i):null}var ON=(()=>{let e=class e{constructor(i,r,s){d(this,"_element");d(this,"_startStyles");d(this,"_endStyles");d(this,"_state",0);d(this,"_initialStyles");this._element=i,this._startStyles=r,this._endStyles=s;let o=e.initialStylesByElement.get(i);o||e.initialStylesByElement.set(i,o=new Map),this._initialStyles=o}start(){this._state<1&&(this._startStyles&&Fi(this._element,this._startStyles,this._initialStyles),this._state=1)}finish(){this.start(),this._state<2&&(Fi(this._element,this._initialStyles),this._endStyles&&(Fi(this._element,this._endStyles),this._endStyles=null),this._state=1)}destroy(){this.finish(),this._state<3&&(e.initialStylesByElement.delete(this._element),this._startStyles&&(rs(this._element,this._startStyles),this._endStyles=null),this._endStyles&&(rs(this._element,this._endStyles),this._endStyles=null),Fi(this._element,this._initialStyles),this._state=3)}};d(e,"initialStylesByElement",new WeakMap);let t=e;return t})();function Rh(t){let e=null;return t.forEach((n,i)=>{NN(i)&&(e=e||new Map,e.set(i,n))}),e}function NN(t){return t==="display"||t==="position"}var Vp=class{constructor(e,n,i,r){d(this,"element");d(this,"keyframes");d(this,"options");d(this,"_specialStyles");d(this,"_onDoneFns",[]);d(this,"_onStartFns",[]);d(this,"_onDestroyFns",[]);d(this,"_duration");d(this,"_delay");d(this,"_initialized",!1);d(this,"_finished",!1);d(this,"_started",!1);d(this,"_destroyed",!1);d(this,"_finalKeyframe");d(this,"_originalOnDoneFns",[]);d(this,"_originalOnStartFns",[]);d(this,"domPlayer");d(this,"time",0);d(this,"parentPlayer",null);d(this,"currentSnapshot",new Map);this.element=e,this.keyframes=n,this.options=i,this._specialStyles=r,this._duration=i.duration,this._delay=i.delay||0,this.time=this._duration+this._delay}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this._buildPlayer(),this._preparePlayerBeforeStart()}_buildPlayer(){if(this._initialized)return;this._initialized=!0;let e=this.keyframes;this.domPlayer=this._triggerWebAnimation(this.element,e,this.options),this._finalKeyframe=e.length?e[e.length-1]:new Map;let n=()=>this._onFinish();this.domPlayer.addEventListener("finish",n),this.onDestroy(()=>{this.domPlayer.removeEventListener("finish",n)})}_preparePlayerBeforeStart(){this._delay?this._resetDomPlayerState():this.domPlayer.pause()}_convertKeyframesToObject(e){let n=[];return e.forEach(i=>{n.push(Object.fromEntries(i))}),n}_triggerWebAnimation(e,n,i){return e.animate(this._convertKeyframesToObject(n),i)}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}play(){this._buildPlayer(),this.hasStarted()||(this._onStartFns.forEach(e=>e()),this._onStartFns=[],this._started=!0,this._specialStyles&&this._specialStyles.start()),this.domPlayer.play()}pause(){this.init(),this.domPlayer.pause()}finish(){this.init(),this._specialStyles&&this._specialStyles.finish(),this._onFinish(),this.domPlayer.finish()}reset(){this._resetDomPlayerState(),this._destroyed=!1,this._finished=!1,this._started=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}_resetDomPlayerState(){this.domPlayer&&this.domPlayer.cancel()}restart(){this.reset(),this.play()}hasStarted(){return this._started}destroy(){this._destroyed||(this._destroyed=!0,this._resetDomPlayerState(),this._onFinish(),this._specialStyles&&this._specialStyles.destroy(),this._onDestroyFns.forEach(e
3=>e()),this._onDestroyFns=[])}setPosition(e){this.domPlayer===void 0&&this.init(),this.domPlayer.currentTime=e*this.time}getPosition(){var e;return+((e=this.domPlayer.currentTime)!=null?e:0)/this.time}get totalTime(){return this._delay+this._duration}beforeDestroy(){let e=new Map;this.hasStarted()&&this._finalKeyframe.forEach((i,r)=>{r!=="offset"&&e.set(r,this._finished?i:Dp(this.element,r))}),this.currentSnapshot=e}triggerCallback(e){let n=e==="start"?this._onStartFns:this._onDoneFns;n.forEach(i=>i()),n.length=0}},zp=class{validateStyleProperty(e){return!0}validateAnimatableStyleProperty(e){return!0}containsElement(e,n){return vh(e,n)}getParentElement(e){return Op(e)}query(e,n,i){return Sh(e,n,i)}computeStyle(e,n,i){return Dp(e,n)}animate(e,n,i,r,s,o=[]){let a=r==0?"both":"forwards",l={duration:i,delay:r,fill:a};s&&(l.easing=s);let c=new Map,u=o.filter(f=>f instanceof Vp);kT(i,r)&&u.forEach(f=>{f.currentSnapshot.forEach((h,_)=>c.set(_,h))});let p=xT(n).map(f=>new Map(f));p=RT(e,p,c);let m=RN(e,p);return new Vp(e,p,l,m)}};var Bp="@",YT="@.disabled",Yp=class{constructor(e,n,i,r){d(this,"namespaceId");d(this,"delegate");d(this,"engine");d(this,"_onDestroy");d(this,"\u0275type",0);this.namespaceId=e,this.delegate=n,this.engine=i,this._onDestroy=r}get data(){return this.delegate.data}destroyNode(e){var n,i;(i=(n=this.delegate).destroyNode)==null||i.call(n,e)}destroy(){var e;this.engine.destroy(this.namespaceId,this.delegate),this.engine.afterFlushAnimationsDone(()=>{queueMicrotask(()=>{this.delegate.destroy()})}),(e=this._onDestroy)==null||e.call(this)}createElement(e,n){return this.delegate.createElement(e,n)}createComment(e){return this.delegate.createComment(e)}createText(e){return this.delegate.createText(e)}appendChild(e,n){this.delegate.appendChild(e,n),this.engine.onInsert(this.namespaceId,n,e,!1)}insertBefore(e,n,i,r=!0){this.delegate.insertBefore(e,n,i),this.engine.onInsert(this.namespaceId,n,e,r)}removeChild(e,n,i,r){if(r){this.delegate.removeChild(e,n,i);return}this.parentNode(n)&&this.engine.onRemove(this.namespaceId,n,this.delegate)}selectRootElement(e,n){return this.delegate.selectRootElement(e,n)}parentNode(e){return this.delegate.parentNode(e)}nextSibling(e){return this.delegate.nextSibling(e)}setAttribute(e,n,i,r){this.delegate.setAttribute(e,n,i,r)}removeAttribute(e,n,i){this.delegate.removeAttribute(e,n,i)}addClass(e,n){this.delegate.addClass(e,n)}removeClass(e,n){this.delegate.removeClass(e,n)}setStyle(e,n,i,r){this.delegate.setStyle(e,n,i,r)}removeStyle(e,n,i){this.delegate.removeStyle(e,n,i)}setProperty(e,n,i){n.charAt(0)==Bp&&n==YT?this.disableAnimations(e,!!i):this.delegate.setProperty(e,n,i)}setValue(e,n){this.delegate.setValue(e,n)}listen(e,n,i,r){return this.delegate.listen(e,n,i,r)}disableAnimations(e,n){this.engine.disableAnimations(e,n)}},qh=class extends Yp{constructor(n,i,r,s,o){super(i,r,s,o);d(this,"factory");this.factory=n,this.namespaceId=i}setProperty(n,i,r){i.charAt(0)==Bp?i.charAt(1)=="."&&i==YT?(r=r===void 0?!0:!!r,this.disableAnimations(n,r)):this.engine.process(this.namespaceId,n,i.slice(1),r):this.delegate.setProperty(n,i,r)}listen(n,i,r,s){if(i.charAt(0)==Bp){let o=MN(n),a=i.slice(1),l="";return a.charAt(0)!=Bp&&([a,l]=PN(a)),this.engine.listen(this.namespaceId,o,a,l,c=>{let u=c._data||-1;this.factory.scheduleListenerCallback(u,r,c)})}return this.delegate.listen(n,i,r,s)}};function MN(t){switch(t){case"body":return document.body;case"document":return document;case"window":return window;default:return t}}function PN(t){let e=t.indexOf("."),n=t.substring(0,e),i=t.slice(e+1);return[n,i]}var $p=class{constructor(e,n,i){d(this,"delegate");d(this,"engine");d(this,"_zone");d(this,"_currentId",0);d(this,"_microtaskId",1);d(this,"_animationCallbacksBuffer",[]);d(this,"_rendererCache",new Map);d(this,"_cdRecurDepth",0);this.delegate=e,this.engine=n,this._zone=i,n.onRemovalComplete=(r,s)=>{s==null||s.removeChild(null,r)}}createRenderer(e,n){var c;let r=this.delegate.createRenderer(e,n);if(!e||!((c=n==null?void 0:n.data)!=null&&c.animation)){let u=this._rendererCache,p=u.get(r);if(!p){let m=()=>u.delete(r);p=new Yp("",r,this.engine,m),u.set(r,p)}return p}let s=n.id,o=n.id+"-"+this._currentId;this._currentId++,this.engine.register(o,e);let a=u=>{Array.isArray(u)?u.forEach(a):this.engine.registerTrigger(s,o,e,u.name,u)};return n.data.animation.forEach(a),new qh(this,o,r,this.engine)}begin(){this._cdRecurDepth++,this.delegate.begin&&this.delegate.begin()}_scheduleCountTask(){queueMicrotask(()=>{this._microtaskId++})}scheduleListenerCallback(e,n,i){if(e>=0&&e<this._microtaskId){this._zone.run(()=>n(i));return}let r=this._animationCallbacksBuffer;r.length==0&&queueMicrotask(()=>{this._zone.run(()=>{r.forEach(s=>{let[o,a]=s;o(a)}),this._animationCallbacksBuffer=[]})}),r.push([n,i])}end(){this._cdRecurDepth--,this._cdRecurDepth==0&&this._zone.runOutsideAngular(()=>{this._scheduleCountTask(),this.engine.flush(this._microtaskId)}),this.delegate.end&&this.delegate.end()}whenRenderingDone(){return this.engine.whenRenderingDone()}componentReplaced(e){var n,i;this.engine.flush(),(i=(n=this.delegate).componentReplaced)==null||i.call(n,e)}};var LN=(()=>{let e=class e extends na{constructor(i,r,s){super(i,r,s)}ngOnDestroy(){this.flush()}};d(e,"\u0275fac",function(r){return new(r||e)(ue(ju),ue(ss),ue(Ks))}),d(e,"\u0275prov",vt({token:e,factory:e.\u0275fac}));let t=e;return t})();function FN(){return new Hp}function UN(t,e,n){return new $p(t,e,n)}var $T=[{provide:Ks,useFactory:FN},{provide:na,useClass:LN},{provide:hv,useFactory:UN,deps:[Av,na,Gt]}],HG=[{provide:ss,useClass:jh},{provide:Kf,useValue:"NoopAnimations"},...$T],BN=[{provide:ss,useFactory:()=>new zp},{provide:Kf,useFactory:()=>"BrowserAnimations"},...$T];function KT(){return fv("NgEagerAnimations"),[...BN]}var Wh="Service workers are disabled or not supported by this browser",ia=class{constructor(e,n){d(this,"serviceWorker");d(this,"worker");d(this,"registration");d(this,"events");if(this.serviceWorker=e,!e)this.worker=this.events=this.registration=new Nn(i=>i.error(new we(5601,!1)));else{let i=null,r=new Qi;this.worker=new Nn(c=>(i!==null&&c.next(i),r.subscribe(u=>c.next(u))));let s=()=>{let{controller:c}=e;c!==null&&(i=c,r.next(i))};e.addEventListener("controllerchange",s),s(),this.registration=this.worker.pipe(Le(()=>e.getRegistration().then(c=>{if(!c)throw new we(5601,!1);return c})));let o=new Qi;this.events=o.asObservable();let a=c=>{let{data:u}=c;u!=null&&u.type&&o.next(u)};e.addEventListener("message",a);let l=n==null?void 0:n.get(Xf,null,{optional:!0});l==null||l.onDestroy(()=>{e.removeEventListener("controllerchange",s),e.removeEventListener("message",a)})}}postMessage(e,n){return new Promise(i=>{this.worker.pipe(yn(1)).subscribe(r=>{r.postMessage(g({action:e},n)),i()})})}postMessageWithOperation(e,n,i){let r=this.waitForOperationCompleted(i),s=this.postMessage(e,n);return Promise.all([s,r]).then(([,o])=>o)}generateNonce(){return Math.round(Math.random()*1e7)}eventsOfType(e){let n;return typeof e=="string"?n=i=>i.type===e:n=i=>e.includes(i.type),this.events.pipe(an(n))}nextEventOfType(e){return this.eventsOfType(e).pipe(yn(1))}waitForOperationCompleted(e){return new Promise((n,i)=>{this.eventsOfType("OPERATION_COMPLETED").pipe(an(r=>r.nonce===e),yn(1),De(r=>{if(r.result!==void 0)return r.result;throw new Error(r.error)})).subscribe({next:n,error:i})})}get isEnabled(){return!!this.serviceWorker}},HN=(()=>{let e=class e{constructor(i){d(this,"sw");d(this,"messages");d(this,"notificationClicks");d(this,"notificationCloses");d(this,"pushSubscriptionChanges");d(this,"subscription");d(this,"pushManager",null);d(this,"subscriptionChanges",new Qi);if(this.sw=i,!i.isEnabled){this.messages=Qr,this.notificationClicks=Qr,this.notificationCloses=Qr,this.pushSubscriptionChanges=Qr,this.subscription=Qr;return}this.messages=this.sw.eventsOfType("PUSH").pipe(De(s=>s.data)),this.notificationClicks=this.sw.eventsOfType("NOTIFICATION_CLICK").pipe(De(s=>s.data)),this.notificationCloses=this.sw.eventsOfType("NOTIFICATION_CLOSE").pipe(De(s=>s.data)),this.pushSubscriptionChanges=this.sw.eventsOfType("PUSH_SUBSCRIPTION_CHANGE").pipe(De(s=>s.data)),this.pushManager=this.sw.registration.pipe(De(s=>s.pushManager));let r=this.pushManager.pipe(Le(s=>s.getSubscription()));this.subscription=new Nn(s=>{let o=r.subscribe(s),a=this.subscriptionChanges.subscribe(s);return()=>{o.unsubscribe(),a.unsubscribe()}})}get isEnabled(){return this.sw.isEnabled}requestSubscription(i){if(!this.sw.isEnabled||this.pushManager===null)return Promise.reject(new Error(Wh));let r={userVisibleOnly:!0},s=this.decodeBase64(i.serverPublicKey.replace(/_/g,"/").replace(/-/g,"+")),o=new Uint8Array(new ArrayBuffer(s.length));for(let a=0;a<s.length;a++)o[a]=s.charCodeAt(a);return r.applicationServerKey=o,new Promise((a,l)=>{this.pushManager.pipe(Le(c=>c.subscribe(r)),yn(1)).subscribe({next:c=>{this.subscriptionChanges.next(c),a(c)},error:l})})}unsubscribe(){if(!this.sw.isEnabled)return Promise.reject(new Error(Wh));let i=r=>{if(r===null)throw new we(5602,!1);return r.unsubscribe().then(s=>{if(!s)throw new we(5603,!1);this.subscriptionChanges.next(null)})};return new Promise((r,s)=>{this.subscription.pipe(yn(1),Le(i)).subscribe({next:r,error:s})})}decodeBase64(i){return atob(i)}};d(e,"\u0275fac",function(r){return new(r||e)(ue(ia))}),d(e,"\u0275prov",vt({token:e,factory:e.\u0275fac}));let t=e;return t})(),Vh=(()=>{let e=class e{constructor(i){d(this,"sw");d(this,"versionUpdates");d(this,"unrecoverable");d(this,"ongoingCheckForUpdate",null);if(this.sw=i,!i.isEnabled){this.versionUpdates=Qr,this.unrecoverable=Qr;return}this.versionUpdates=this.sw.eventsOfType(["VERSION_DETECTED","VERSION_INSTALLATION_FAILED","VERSION_READY","NO_NEW_VERSION_DETECTED","VERSION_FAILED"]),this.unrecoverable=this.sw.eventsOfType("UNRECOVERABLE_STATE")}get isEnabled(){return this.sw.isEnabled}checkForUpdate(){if(!this.sw.isEnabled)return Promise.reject(new Error(Wh));if(this.ongoingCheckForUpdate)return this.ongoingCheckForUpdate;let i=this.sw.generateNonce();return this.ongoingCheckForUpdate=this.sw.postMessageWithOperation("CHECK_FOR_UPDATES",{nonce:i},i).finally(()=>{this.ongoingCheckForUpdate=null}),this.ongoingCheckForUpdate}activateUpdate(){if(!this.sw.isEnabled)return Promise.reject(new we(5601,!1));let i=this.sw.generateNonce();return this.sw.postMessageWithOperation("ACTIVATE_UPDATE",{nonce:i},i)}};d(e,"\u0275fac",function(r){return new(r||e)(ue(ia))}),d(e,"\u0275prov",vt({token:e,factory:e.\u0275fac}));let t=e;return t})();var XT=new gt("");function qN(){let t=T(Dl);
3if(!("serviceWorker"in navigator&&t.enabled!==!1))return;let e=T(XT),n=T(Gt),i=T(Xf);n.runOutsideAngular(()=>{let r=navigator.serviceWorker,s=()=>{var o;return(o=r.controller)==null?void 0:o.postMessage({action:"INITIALIZE"})};r.addEventListener("controllerchange",s),i.onDestroy(()=>{r.removeEventListener("controllerchange",s)})}),n.runOutsideAngular(()=>{let r,{registrationStrategy:s}=t;if(typeof s=="function")r=new Promise(o=>s().subscribe(()=>o()));else{let[o,...a]=(s||"registerWhenStable:30000").split(":");switch(o){case"registerImmediately":r=Promise.resolve();break;case"registerWithDelay":r=QT(+a[0]||0);break;case"registerWhenStable":r=Promise.race([i.whenStable(),QT(+a[0])]);break;default:throw new we(5600,!1)}}r.then(()=>{i.destroyed||navigator.serviceWorker.register(e,{scope:t.scope,updateViaCache:t.updateViaCache,type:t.type}).catch(o=>console.error(ov(5604,!1)))})})}function QT(t){return new Promise(e=>setTimeout(e,t))}function jN(t,e){return new ia(t.enabled!==!1?navigator.serviceWorker:void 0,e)}var Dl=class{constructor(){d(this,"enabled");d(this,"updateViaCache");d(this,"type");d(this,"scope");d(this,"registrationStrategy")}};function JT(t,e={}){return av([HN,Vh,{provide:XT,useValue:t},{provide:Dl,useValue:e},{provide:ia,useFactory:jN,deps:[Dl,Ls]},Wu(qN)])}var Ll=t=>(t||"").split("?")[0].startsWith(Et.message);var zh=t=>({item:t}),GN=(t,e)=>[t,e],WN=(t,e,n)=>[t,e,n,".jpg",null,null,"sm"];function VN(t,e){t&1&&Xr(0)}function zN(t,e){if(t&1&&Fe(0,VN,1,0,"ng-container",6),t&2){let n=e.$implicit;w(2);let i=Pt(11);x("ngTemplateOutlet",i)("ngTemplateOutletContext",rt(2,zh,n))}}function YN(t,e){if(t&1&&Wt(0,zN,1,4,"ng-container",null,Zt),t&2){let n=w();Vt(n.mergeAuthorsList)}}function $N(t,e){t&1&&Xr(0)}function KN(t,e){if(t&1&&Fe(0,$N,1,0,"ng-container",6),t&2){let n=e.$implicit;w(2);let i=Pt(11);x("ngTemplateOutlet",i)("ngTemplateOutletContext",rt(2,zh,n))}}function QN(t,e){if(t&1&&Wt(0,KN,1,4,"ng-container",null,Zt),t&2){let n=w();Vt(n.mergePublisherList)}}function XN(t,e){t&1&&Xr(0)}function JN(t,e){if(t&1&&Fe(0,XN,1,0,"ng-container",6),t&2){let n=e.$implicit;w(2);let i=Pt(11);x("ngTemplateOutlet",i)("ngTemplateOutletContext",rt(2,zh,n))}}function ZN(t,e){if(t&1&&Wt(0,JN,1,4,"ng-container",null,Zt),t&2){let n=w();Vt(n.mergeBookList)}}function eM(t,e){if(t&1&&(M(0,"img",10),$(1,"image")),t&2){let n=w().item,i=w();x("src",Yu(St(1,3,At(11,WN,n==null?null:n.id,i.imageType.book,n==null?null:n.hasPhoto))),He)("alt",n.name)}}function tM(t,e){if(t&1&&(M(0,"img",11),$(1,"image")),t&2){let n=w().item,i=w();x("src",Yu(xt(1,3,n==null?null:n.id,i.imageType.publisherAvatar,n==null?null:n.hasPhoto)),He)("alt",n.name)}}function nM(t,e){if(t&1&&(M(0,"img",11),$(1,"image")),t&2){let n=w().item,i=w();x("src",Yu(xt(1,3,n==null?null:n.id,i.imageType.authorAvatar,n==null?null:n.hasPhoto)),He)("alt",n.name)}}function iM(t,e){if(t&1){let n=ge();b(0,"div",7)(1,"div",8)(2,"a",9),ee("click",function(){J(n);let r=w();return Z(r.dialog.closeAll())}),se(3,eM,2,15,"img",10)(4,tM,2,7,"img",11)(5,nM,2,7,"img",11),b(6,"span",12),E(7),S()()(),b(8,"button",13),ee("click",function(){let r=J(n).item,s=w();return Z(s.removeItem(r))}),M(9,"span",14),S()()}if(t&2){let n=e.item,i=w();y(2),x("routerLink",Dt(3,GN,(i.mergeBookList==null?null:i.mergeBookList.length)>0?i.routes.book:i.routes.profile,n==null?null:n.id)),y(),oe((i.mergeBookList==null?null:i.mergeBookList.length)>0?3:(i.mergePublisherList==null?null:i.mergePublisherList.length)>0?4:5),y(4),Ae(n.name)}}var ZT=(()=>{let e=class e{constructor(){d(this,"router",T(Yt));d(this,"dialog",T(_i));d(this,"mergeService",T(bp));d(this,"mergeBooksAggrService",T(qS));d(this,"snackbarService",T(LS));d(this,"_location",T(Tv));d(this,"mergeAuthorsList",[]);d(this,"mergePublisherList",[]);d(this,"mergeBookList",[]);d(this,"isLoading",!1);d(this,"routes",Et);d(this,"imageType",_t);this.mergeAuthorsList=this.mergeService.GetAuthorsMergeList,this.mergeBookList=this.mergeService.GetBookMergeList}ngOnInit(){var i,r,s;(i=this.mergeService.selectedAuthorToMerge)==null||i.subscribe(o=>{o&&(this.mergeAuthorsList=o)}),(r=this.mergeService.selectedPublisherToMerge)==null||r.subscribe(o=>
3{o&&(this.mergePublisherList=o)}),(s=this.mergeService.selectedBookToMerge)==null||s.subscribe(o=>{o&&(this.mergeBookList=o)})}removeItem(i){var r,s,o;this.mergeService.RemoveMergeItem(i.id,i.type),((r=this.mergeAuthorsList)==null?void 0:r.length)>0||((s=this.mergePublisherList)==null?void 0:s.length)>0||((o=this.mergeBookList)==null?void 0:o.length)>0||this.dialog.closeAll()}gotoMerge(){var i;this.isLoading=!0,((i=this.mergeBookList)==null?void 0:i.length)>0?this.checkBookConvert().subscribe():(this.router.navigate([this.routes.merge]),this.isLoading=!1,this.dialog.closeAll())}checkBookConvert(){let i=[];return this.mergeBookList.forEach(r=>{i.push(r.id)}),this.mergeBooksAggrService.compareSeveralBook(i).pipe(Ze(r=>{var s;if(((s=r==null?void 0:r.result)==null?void 0:s.length)<1||r!=null&&r.hasError)this.snackbarService.openSnackbar(Xn.error,"\u0645\u0634\u06A9\u0644\u06CC \u0631\u062E \u062F\u0627\u062F\u0647 \u0627\u0633\u062A. \u0644\u0637\u0641\u0627\u064B \u06A9\u0645\u06CC \u0628\u0639\u062F\u060C \u0645\u062C\u062F\u062F \u062F\u0631\u062E\u0648\u0627\u0633\u062A \u06A9\u0646\u06CC\u062F."),this.dialog.closeAll();else{let o=i[1],a=r==null?void 0:r.result.find(l=>(l==null?void 0:l.bookId)===o);a!=null&&a.hasDependency?(this.snackbarService.openSnackbar(Xn.error,"\u0627\u06CC\u0646 \u06A9\u062A\u0627\u0628 \u0642\u0627\u0628\u0644 \u062A\u0644\u0641\u06CC\u0642 \u06A9\u0631\u062F\u0646 \u0646\u06CC\u0633\u062A."),this.dialog.closeAll()):(this.router.navigate([this.routes.merge],{state:{bookData:r==null?void 0:r.result}}),this.dialog.closeAll())}}),Z0(()=>this.isLoading=!1))}get mergeTitle(){var i,r,s;return((i=this.mergePublisherList)==null?void 0:i.length)>0?"\u0646\u0627\u0634\u0631":((r=this.mergeAuthorsList)==null?void 0:r.length)>0?"\u0646\u0648\u06CC\u0633\u0646\u062F\u0647":((s=this.mergeBookList)==null?void 0:s.length)>0?"\u06A9\u062A\u0627\u0628":""}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275cmp",be({type:e,selectors:[["app-merge-list"]],decls:12,vars:6,consts:[["MergeItemTemplate",""],[1,"w-full","p-3","rounded-lg","bg-gray-50","dark:bg-gray-900"],[1,"w-full","my-2","pb-2","border-b","border-gray-100","dark:border-gray-700"],[1,"text-gray-500","text-sm"],[1,"w-full","mt-3"],["type","button",1,"w-full","btn-green-flat","my-3",3,"click","appButtonLoader","disabled"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"w-full","flex","justify-between","mb-3","items-center"],[1,"grow"],["tabindex","-1",1,"cursor-pointer","flex","justify-start","items-center",3,"click","routerLink"],["loading","lazy","onerror","this.src='https://storage.behkhaan.ir/assets/images/default/default_book'","width","48","height","48",1,"book-sm","ml-2","object-cover",3,"src","alt"],["loading","lazy","onerror","this.src='https://storage.behkhaan.ir/assets/images/default/default_avatar.svg'","width","48","height","48",1,"avatar-md","ml-2",3,"src","alt"],[1,"text-sm","font-medium","text-gray-900","mr-1"],[1,"focus-visible:outline-none","focus-visible:border-none","w-7","h-7","!min-w-7","!min-h-7","!px-0","rounded-full","flex","items-center","justify-center","hover:bg-gray-200","dark:hover:bg-gary-700",3,"click"],[1,"icon","dismiss-regular","text-gray-700","text-sm"]],template:function(r,s){if(r&1){let o=ge();b(0,"div",1)(1,"div",2)(2,"p",3),E(3),S()(),b(4,"div",4),se(5,YN,2,0),se(6,QN,2,0),se(7,ZN,2,0),S(),b(8,"button",5),ee("click",function(){return J(o),Z(s.gotoMerge())}),E(9," \u0627\u062F\u0627\u0645\u0647 \u0641\u0631\u0622\u06CC\u0646\u062F \u062A\u0631\u06A9\u06CC\u0628 "),S()(),Fe(10,iM,10,6,"ng-template",null,0,mi)}r&2&&(y(3),Me(" \u062A\u0644\u0641\u06CC\u0642 ",s.mergeTitle," "),y(2),oe((s.mergeAuthorsList==null?null:s.mergeAuthorsList.length)>0?5:-1),y(),oe((s.mergePublisherList==null?null:s.mergePublisherList.length)>0?6:-1),y(),oe((s.mergeBookList==null?null:s.mergeBookList.length)>0?7:-1),y(),x("appButtonLoader",s.isLoading)("disabled",(s.mergeAuthorsList==null?null:s.mergeAuthorsList.length)<1&&(s.mergePublisherList==null?null:s.mergePublisherList.length)<1&&(s.mergeBookList==null?null:s.mergeBookList.length)<1))},dependencies:[pp,er,Ln,Qu,MS,Jr,lt],encapsulation:2}));let t=e;return t})();var rM=t=>({fade:t}),sM=t=>({"rotate-[225deg] !transition !duration-[1s]":t});function oM(t,e){t&1&&Xr(0)}function aM(t,e){if(t&1&&(en(0),Fe(1,oM,1,0,"ng-container",5),tn()),t&2){w();let n=Pt(5);y(),x("ngTemplateOutlet",n)}}function lM(t,e){if(t&1){let n=ge();b(0,"div",6)(1,"button",7),ee("click",function(){J(n);let r=w();return Z(r.displayActions=!r.displayActions)}),M(2,"span",8),S()()}if(t&2){let n=w();y(),x("ngClass",rt(1,sM,n.displayActions))}}function cM(t,e){if(t&1){let n=ge();b(0,"div",13),ee("click",function(){J(n);let r=w(2);return Z(r.closeDialog(r.routes.challenges_progress))}),b(1,"button",22),M(2,"span",23),S(),b(3,"span",24),E(4," \u06AF\u0632\u0627\u0631\u0634 \u0645\u0637\u0627\u0644\u0639\u0647 "),S()()}}function uM(t,e){if(t&1){let n=ge();b(0,"div",9),ee("click",function(){J(n);let r=w();return Z(r.closeDialog(r.routes.review_create))}),b(1,"button",10),M(2,"span",11),S(),b(3,"span",12),E(4," \u06CC\u0627\u062F\u062F\u0627\u0634\u062A "),S()(),b(5,"div",13),ee("click",function(){J(n);let r=w();return Z(r.closeDialog(r.routes.create_booklist))}),b(6,"button",10),M(7,"span",14),S(),b(8,"span",12),E(9," \u0644\u06CC\u0633\u062A "),S()(),Fe(10,
3cM,5,0,"div",15),b(11,"div",13),ee("click",function(){J(n);let r=w();return Z(r.closeDialog(r.routes.post_create))}),b(12,"button",16),M(13,"span",17),S(),b(14,"span",18),E(15," \u067E\u0633\u062A "),S()(),b(16,"div",9),ee("click",function(){J(n);let r=w();return Z(r.closeDialog(r.routes.quote_create))}),b(17,"button",19),M(18,"span",20),S(),b(19,"span",18),E(20," \u0628\u0631\u06CC\u062F\u06C0 \u06A9\u062A\u0627\u0628\u200C "),S()(),b(21,"div",9),ee("click",function(){J(n);let r=w();return Z(r.closeDialog(r.routes.challenges))}),b(22,"button",19),M(23,"span",21),S(),b(24,"span",18),E(25,"\u0686\u0627\u0644\u0634\u200C\u0647\u0627"),S()()}if(t&2){let n=w();y(10),x("ngIf",n.currentUser)}}var Yh=(()=>{let e=class e extends Fn{constructor(){super();d(this,"router",T(Yt));d(this,"injector",T(Ls));d(this,"_localRepository",T(Qe));d(this,"displayActions");d(this,"displayAdd",!1);d(this,"routes",Et);d(this,"dialogData");d(this,"dialogRef",null);this.dialogRef=this.injector.get(gi,e),this.dialogData=this.injector.get(Ut,e)}ngOnInit(){var r,s;((r=this.dialogData)==null?void 0:r.displayActions)!=null&&(this.displayActions=(s=this.dialogData)==null?void 0:s.displayActions)}closeDialog(r){var s;this._localRepository.IsInMobile&&((s=this.dialogRef)==null||s.close({type:null}),this.displayActions=!1),this.router.navigate([r]),this.displayActions=!1}};d(e,"\u0275fac",function(s){return new(s||e)}),d(e,"\u0275cmp",be({type:e,selectors:[["app-floating-actions"]],inputs:{displayActions:"displayActions",displayAdd:"displayAdd"},features:[Pn],decls:6,vars:5,consts:[["Buttons",""],[1,"flex","flex-wrap","rounded-lg","w-full"],[1,"w-full","md:mb-2","py-2","md:py-0","flex","flex-wrap","items-center","rounded-md","lg:bg-gray-50","dark:bg-gray-800",3,"ngClass"],[4,"ngIf"],["class","hidden lg:flex w-4/12 sm:w-full justify-center sm:justify-start",4,"ngIf"],[4,"ngTemplateOutlet"],[1,"hidden","lg:flex","w-4/12","sm:w-full","justify-center","sm:justify-start"],[1,"w-14","h-14","!rounded-full","btn-green-flat","flex","items-center","justify-center",3,"click","ngClass"],[1,"icon","add-regular","text-xl","text-white"],[1,"w-1/3","md:w-full","flex","max-md:flex-wrap","justify-center","md:justify-start","items-center","py-1","md:pr-2","cursor-pointer","lg:hover:bg-gray-100","lg:hover:dark:bg-gray-700","rounded-md",3,"click"],["tabindex","-1",1,"icon-btn","flex","items-center","justify-center","cursor-pointer"],[1,"icon","text-green-500","dark:bg-gray-700","notepad-edit-regular","min-w-8","min-h-8","rounded-full","flex","items-center","justify-center","text-xs","shadow-xl","dark:shadow-gray-900"],[1,"w-full","text-green-500","text-center","md:text-start","md:mr-2","text-xs"],[1,"w-1/3","md:w-full","flex","max-md:flex-wrap","justify-center","md:justify-start","items-center","py-1","md:pr-2","cursor-pointer","lg:hover:bg-gray-100","lg:hover:dark:bg-gray-700",3,"click"],[1,"icon","text-green-500","dark:bg-gray-700","apps-list-regular","[transform:rotateY(180deg)]","min-w-8","min-h-8","rounded-full","flex","items-center","justify-center","text-xs","shadow-xl","dark:shadow-gray-900"],["class","w-1/3 md:w-full flex max-md:flex-wrap justify-center md:justify-start items-center py-1 md:pr-2 cursor-pointer lg:hover:bg-gray-100 lg:hover:dark:bg-gray-700",3,"click",4,"ngIf"],["tabindex","-1",1,"relative","icon-btn","flex","items-center","justify-center","cursor-pointer"],[1,"icon","text-green-500","dark:bg-gray-700","compose-regular","min-w-8","min-h-8","rounded-full","flex","items-center","justify-center","text-xs","shadow-xl","dark:shadow-gray-900"],[1,"w-full","text-green-500","text-center","md:text-start","text-xs","md:mr-2"],["tabindex","-1",1,"icon-btn","text-green-500","flex","items-center","justify-center","cursor-pointer"],[1,"icon","dark:bg-gray-700","text-green-500","text-quote-regular","min-w-8","min-h-8","rounded-full","flex","items-center","justify-center","text-sm","shadow-xl","dark:shadow-gray-900"],[1,"icon","dark:bg-gray-700","text-green-500","ribbon-star-regular","min-w-8","min-h-8","rounded-full","flex","items-center","justify-center","text-sm","shadow-xl","dark:shadow-gray-900"],["tabindex","-1",1,"icon-btn","btn-progress","flex","items-center","justify-center","cursor-pointer"],[1,"icon","dark:bg-gray-700","text-green-500","book-open-regular","min-w-8","min-h-8","rounded-full","flex","items-center","justify-center","text-xs","
3shadow-xl","dark:shadow-gray-900"],[1,"mt-1","w-full","text-center","md:text-start","md:mr-2","text-xs","text-green-500"]],template:function(s,o){s&1&&(b(0,"div",1)(1,"div",2),Fe(2,aM,2,1,"ng-container",3),S(),Fe(3,lM,3,3,"div",4),S(),Fe(4,uM,26,1,"ng-template",null,0,mi)),s&2&&(y(),x("ngClass",rt(3,rM,o.displayActions)),y(),x("ngIf",o.displayActions),y(),x("ngIf",o.displayAdd))},dependencies:[Ln,Go,Wo,Qu,pp,es],styles:[".fade[_ngcontent-%COMP%]{opacity:0;animation:_ngcontent-%COMP%_fade .5s ease-in-out forwards}@keyframes _ngcontent-%COMP%_fade{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}"],changeDetection:0}));let t=e;return t})();var eI=(()=>{let e=class e extends Fn{constructor(){super();d(this,"_dialog",T(_i));d(this,"cdr",T($u));d(this,"fileService",T(tp));d(this,"_localRepository",T(Qe));d(this,"close",new Xi);d(this,"dialogRef");d(this,"loadingSetAvatar");d(this,"recivedResult");d(this,"uploadingAvatar");d(this,"uploadingBanner");d(this,"recivedImage");d(this,"uploadableImage");d(this,"userCurrentAvatarSrc","")}closeSuggestion(){this.close.emit(Ul.userClosed)}uploadAvatar(){this.loadingSetAvatar=!0,this._localRepository.IsInBrowser&&(this.dialogRef=this._dialog.open(WS,{panelClass:"cropper-container",data:{aspect_ratio:GS.circle_350,fromQuote:!1,fileType:"users_avatars"}}),this.subscriptions.push(this.dialogRef.afterClosed().pipe(Ze(r=>{r!=null&&(this.userCurrentAvatarSrc=r.croppedImageData),this.uploadableImage=r.base64}),Le(()=>{var r;return this.fileService.uploadFile(this.uploadableImage,"avatars",(r=this.currentUser)==null?void 0:r.id)})).subscribe(r=>{this.loadingSetAvatar=!1,!r.hasError&&r.result?(this.fileService.userImage_$.next(this.userCurrentAvatarSrc),this.snackbarService.openSnackbar(Xn.success,"\u062A\u0635\u0648\u06CC\u0631 \u0634\u0645\u0627 \u0628\u0627 \u0645\u0648\u0641\u0642\u06CC\u062A \u062B\u0628\u062A \u0634\u062F."),this.close.emit(Ul.uploaded)):(this.snackbarService.openSnackbar(Xn.success,"\u0645\u062A\u0627\u0633\u0641\u0627\u0646\u0647 \u062B\u0628\u062A \u062A\u0635\u0648\u06CC\u0631\u062A\u0627\u0646 \u0628\u0627 \u0645\u0648\u0627\u062C\u0647 \u0645\u0634\u06A9\u0644 \u0634\u062F."),this.userCurrentAvatarSrc="")})))}};d(e,"\u0275fac",function(s){return new(s||e)}),d(e,"\u0275cmp",be({type:e,selectors:[["app-behkhaan-suggestion-set-avatar"]],outputs:{close:"close"},features:[Pn],decls:16,vars:2,consts:[[1,"w-full","h-full","p-2","flex","flex-wrap","items-start","bg-gray-50","dark:bg-gray-800","rounded-md","relative"],[1,"w-full","flex","items-center","justify-between"],[1,"text-gray-900","text-sm","md:text-xs","ml-2"],[1,"!h-5","!w-5","!min-w-5","!min-h-5","py-4","icon-btn","absolute","left-0","dark:hover:bg-gray-900",3,"click"],[1,"icon","dismiss-filled","text-sm"],[1,"w-full","flex","mt-3","items-center"],[1,"icon-btn","border","border-gray-500","dark:border-gray-400",3,"click"],[1,"icon","camera-regular","text-sm","text-gray-500","cursor-pointer"],[1,"grow","pr-2","flex","flex-wrap"],[1,"w-full"],[1,"text-sm","text-gray-900"],[1,"w-full","mt-2"],["dir","ltr",1,"text-sm","text-gray-500","text-right"]],template:function(s,o){s&1&&(b(0,"div",0)(1,"div",1)(2,"p",2),E(3," \u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0635\u0648\u06CC\u0631 \u0628\u0647 \u062F\u06CC\u062F\u0647\u200C\u0634\u062F\u0646 \u0634\u0645\u0627 \u06A9\u0645\u06A9 \u0645\u06CC\u200C\u06A9\u0646\u062F. "),S(),b(4,"button",3),ee("click",function(){return o.closeSuggestion()}),M(5,"span",4),S()(),b(6,"div",5)(7,"button",6),ee("click",function(){return o.uploadAvatar()}),M(8,"span",7),S(),b(9,"div",8)(10,"div",9)(11,"p",10),E(12),S()(),b(13,"div",11)(14,"p",12),E(15),S()()()()()),s&2&&(y(12),Me(" ",o.currentUser==null?null:o.currentUser.firstName," "),y(3),Me(" ","@"+(o.currentUser==null?null:o.currentUser.uniqeName)," "))},dependencies:[Jr,es,mp],encapsulation:2,changeDetection:0}));let t=e;return t})(),Ul=(function(t){return t[t.uploaded=1]="uploaded",t[t.userClosed=2]="userClosed",t})(Ul||{});var dM=(t,e)=>[t,e];function mM(t,e){if(t&1&&(M(0,"img",4),$(1,"image")),t&2){let n=w();x("src",xt(1,2,n.Post.mediaId,n.imageType.videoThumbnail,!0),He)("alt",n.Post==null?null:n.Post.title)}}function fM(t,e){if(t&1&&(M(0,"img",5),$(1,"image")),t&2){let n=w();x("src",xt(1,2,n.Post.mediaId,n.imageType.post,n.Post==null?null:n.Post.hasPhoto),He)("alt",n.Post==null?null:n.Post.title)}}var tI=(()=>{let e=class e{constructor(){d(this,"Post");d(this,"routes",Et);d(this,"imageType",_t)}ngOnInit(){}};d(e,"\u0275fac",function(r){return new(r||e)}
3),d(e,"\u0275cmp",be({type:e,selectors:[["app-post-suggeste-item"]],inputs:{Post:"Post"},decls:7,vars:12,consts:[[1,"w-full","flex","flex-wrap"],[3,"User","inside","displayDate","size"],[1,"w-full","mt-2"],[3,"routerLink"],["onerror","this.src='https://storage.behkhaan.ir/assets/images/default/default_broken.svg'",1,"w-full","rounded-md","aspect-[2/1]","object-cover",3,"src","alt"],["onerror","this.src='https://storage.behkhaan.ir/assets/images/default/default_broken.svg'",1,"rounded-lg","ratio-2-1","object-cover",3,"src","alt"]],template:function(r,s){r&1&&(b(0,"div",0),M(1,"app-user-activity-info",1),$(2,"getUserData"),b(3,"div",2)(4,"a",3),se(5,mM,2,6,"img",4)(6,fM,2,6,"img",5),S()()()),r&2&&(y(),x("User",di(2,6,s.Post,!1))("inside",!0)("displayDate",!1)("size","small"),y(3),x("routerLink",Dt(9,dM,s.routes.post,s.Post.id)),y(),oe(s.Post.mediaExtension===3?5:6))},dependencies:[Ln,er,JS,lt,XS],styles:["img[_ngcontent-%COMP%]{width:100%;aspect-ratio:2/1}"]}));let t=e;return t})();var hM=(t,e)=>[t,e],gM=t=>({bookState:2,shelfName:"CurrentlyReading",shelfOwner:t}),_M=(t,e,n)=>[t,e,n,".jpg",null,null,"sm"],yM=()=>({height:"100%",width:"100%"}),bM=()=>({height:"16px",width:"60px"}),vM=()=>({height:"14px",width:"70%"}),SM=()=>({height:"14px",width:"30px"}),EM=()=>[0,1,2],TM=()=>({height:"14px",width:"100px"}),IM=()=>({height:"100%",width:"100%",borderRadius:"12px"});function CM(t,e){if(t&1&&(en(0),M(1,"app-post-suggeste-item",10),tn()),t&2){let n=e.$implicit;y(),x("Post",n)}}function wM(t,e){if(t&1&&(en(0),Fe(1,CM,2,1,"ng-container",9),tn()),t&2){let n=w(2);y(),x("ngForOf",n.guestPosts)}}function xM(t,e){if(t&1&&(en(0),M(1,"app-post-suggeste-item",10),tn()),t&2){let n=e.$implicit;y(),x("Post",n)}}function AM(t,e){if(t&1&&(en(0),Fe(1,xM,2,1,"ng-container",9),tn()),t&2){let n=w(2);y(),x("ngForOf",n.suggestedPosts)}}function kM(t,e){if(t&1&&(en(0),b(1,"section",5)(2,"div",6)(3,"p",7),E(4," \u067E\u0633\u062A\u200C\u0647\u0627\u06CC \u0627\u062E\u06CC\u0631 \u0627\u06CC\u0646 \u06A9\u0627\u0631\u0628\u0631 "),S(),Fe(5,wM,2,1,"ng-container",4),S(),b(6,"div",8)(7,"p",7),E(8,"\u067E\u0633\u062A\u200C\u0647\u0627\u06CC \u067E\u06CC\u0634\u0646\u0647\u0627\u062F\u06CC"),S(),Fe(9,AM,2,1,"ng-container",4),S()(),tn()),t&2){let n=w(),i=Pt(8);y(5),x("ngIf",!n.gettingPostData)("ngIfElse",i),y(4),x("ngIf",!n.gettingPostData)("ngIfElse",i)}}function RM(t,e){if(t&1&&(b(0,"p",26),E(1),S()),t&2){let n=w().$implicit;y(),Me(" ",n==null?null:n.name," ")}}function OM(t,e){if(t&1&&(b(0,"p",27),E(1),$(2,"authorType"),S()),t&2){let n=e.$implicit;y(),Me(" ",Lt(2,1,n).name," ")}}function NM(t,e){if(t&1){let n=ge();b(0,"div",18),ee("click",function(){let r=J(n).$implicit,s=w(4);return Z(s.close(r))}),M(1,"img",19),$(2,"image"),b(3,"div",20)(4,"div",21),Fe(5,RM,2,1,"p",22),S(),b(6,"div",23),Fe(7,OM,3,3,"p",24),$(8,"authorSort"),$(9,"slice"),S(),M(10,"app-progress-bar",25),S()()}if(t&2){let n=e.$implicit,i=w(4);y(),x("src",St(2,6,At(20,_M,n==null?null:n.id,i.imageType.book,n==null?null:n.hasPhoto)),He)("alt",n==null?null:n.name),y(4),x("ngIf",n==null?null:n.name),y(2),x("ngForOf",xt(9,16,Lt(8,14,n.authors),0,1)),y(3),x("totalCount",n==null||n.steps==null?null:n.steps.totalPages)("unitCount",n==null||n.steps==null?null:n.steps.steps)}}function MM(t,e){if(t&1&&(en(0),b(1,"div",5)(2,"div",11)(3,"div",12)(4,"span",13),E(5,"\u062F\u0631 \u062D\u0627\u0644 \u062E\u0648\u0627\u0646\u062F\u0646 "),b(6,"a",14)(7,"span",15),E(8),S()()()()(),b(9,"div",16),Fe(10,NM,11,24,"div",17),$(11,"slice"),S()(),tn()),t&2){let n=w(3);y(6),x("routerLink",Dt(9,hM,n.routes.library_book,n.currentUser==null?null:n.currentUser.id))("queryParams",rt(12,gM,n.currentUser==null?null:n.currentUser.uniqeName)),y(2),Ae(n.allBooksCount),y(2),x("ngForOf",xt(11,5,n.books,0,3))("ngForTrackBy",n.trackBooks)}}function PM(t,e){if(t&1&&(en(0),Fe(1,MM,12,14,"ng-container",4),tn()),t&2){let n=w(2),i=Pt(4);y(),x("ngIf",n.books&&(n.books==null?null:n.books.length)>0)("ngIfElse",i)}}function DM(t,e){if(t&1&&(b(0,"section",5),Fe(1,PM,2,2,"ng-container",4),S()),t&2){let n=w(),i=Pt(6);y(),x("ngIf",!n.loading&&n._localRepository.IsInBrowser)("ngIfElse",i)}}function LM(t,e){t&1&&(b(0,"section",5)(1,"div",28)(2,"span",29),E(3,"\u062F\u0631 \u062D\u0627\u0644 \u062E\u0648\u0627\u0646\u062F\u0646"),S()(),b(4,"div",23),M(5,"div",30),b(6,"p",31),E(7," \u06A9\u062A\u0627\u0628 \u062F\u0631 \u062D\u0627\u0644 \u062E\u0648\u0627\u0646\u062F\u0646\u06CC \u0648\u062C\u0648\u062F \u0646\u062F\u0627\u0631\u062F. "),S(),b(8,"p",32),E(9," \u0628\u0627 \u062C\u0633\u062A\u200C\u0648\u200C\u062C\u0648 \u062F\u0631 \u0633\u0627\u06CC\u062A \u0645\u06CC\u200C\u062A\u0648\u0627\u0646\u06CC\u062F \u06A9\u062A\u0627\u0628\u200C\u0647\u0627\u06CC \u0645\u0648\u0631\u062F \u0646\u0638\u0631\u062A\u0627\u0646 \u0631\u0627 \u0628\u0647 \u0627\u06CC\u0646 \u0642\u0641\u0633\u0647 \u0627\u0636\u0627\u0641\u0647 \u06A9\u0646\u06CC\u062F. "),S()()())}function FM(t,e){t&1&&(b(0,"div",5)(1,"div",16)(2,"div",33),M(3,"ngx-skeleton-loader",34),b(4,"div",35)(5,"div",36),M(6,"ngx-skeleton-loader",37),S(),b(7,"div",33),M(8,"ngx-skeleton-loader",38),S(),b(9,"div",36),M(10,"ngx-skeleton-loader",37),S()()()()()),t&2&&(y(3),x("theme",it(4,yM)),y(3),x("theme",it(5,bM)),y(2),x("theme",it(6,vM)),y(2),x("theme",it(7,SM)))}function UM(t,e){t&1&&(en(0),b(1,"div",39)(2,"div",21),M(3,"ngx-skeleton-loader",40)(4,"ngx-skeleton-loader",41),S(),b(5,"div",42),M(6,"ngx-skeleton-loader",43),S()(),tn()),t&2&&(y(3),x("appearance","circle"),y(),x("theme",it(3,TM)),y(2),x("theme",it(4,IM)))}function BM(t,e){t&1&&Fe(0,UM,7,5,"ng-container",9),t&2&&x("ngForOf",it(1,EM))}var iI=(()=>{let e=class e extends Fn{constructor(){super();d(this,"router",T(Yt));d(this,"cdr",T($u));d(this,"_localRepository",T(Qe));d(this,"shelvesAggrigatorService",T(US));d(this,"routes",Et);d(this,"allBooksCount");d(this,"bookState",oh);d(this,"loading",!0);d(this,"books",[]);d(this,"bookShelf",new KS);d(this,"searchFilterModel",new ZS);d(this,"changeBookState",new QS);d(this,"loadingNewBooks",!1);d(this,"imageType",_t);d(this,"closeBottomSheet",new Xi);d(this,"hasMoreCurrentlyReadingBooks");d(this,"inPostPage");d(this,"gettingPostData",!0);d(this,"guestPosts",[]);d(this,"suggestedPosts",[]);d(this,"routeSubscription");this.searchFilterModel.pgNumber=0,this.searchFilterModel.pgSize=15,this.searchFilterModel.orderFilters=[{propertyName:"CreatedAt",direction:eE.Descending}]}ngOnInit(){this.getPostData(),this.getCurrentlyReading().subscribe(),this.appStateService.currentlyReadingNotifier$.subscribe(r=>{if(r!=null&&r.id)if(r.state===oh.CurrentlyReading){let s=this.books.find(o=>o.id===r.id);s?(s.state=r.state,s.steps=r.steps):this.books.unshift(r),this.cdr.detectChanges()}else{let s=this.books.findIndex(o=>o.id===r.id);s>-1&&(this.books.splice(s,1),this.cdr.detectChanges())}})}getCurrentlyReading(){var r;return this.shelvesAggrigatorService.getGuestLibWithFilter((r=this.currentUser)==null?void 0:r.id,tE.currentlyReading,"",this.searchFilterModel).pipe(Ze(s=>{var o,a,l;s.hasError?(this.books=[],this.hasMoreCurrentlyReadingBooks=!1):(this.books=(o=s==null?void 0:s.result)==null?void 0:o.items,this.hasMoreCurrentlyReadingBooks=(a=s.result)==null?void 0:a.hasNextPage,this.allBooksCount=(l=s==null?void 0:s.result)==null?void 0:l.totalCount),this.loading=!1}))}getPostData(){this.routeSubscription=this.appStateService.otherPosts.subscribe(r=>{r!=null&&r.inPost?(this.inPostPage=!0,this.suggestedPosts=r.suggested,this.guestPosts=r.userPosts,this.gettingPostData=!1,this.cdr.detectChanges()):this.inPostPage=!1})}loadMoreBooks(){this.loadingNewBooks=!0,this.searchFilterModel.pgNumber++}trackBooks(r,s){return s}close(r){var s;this.router.navigate([this.routes.history,r.id],{queryParams:{user:(s=this.currentUser)==null?void 0:s.uniqeName}}),this._localRepository.IsInMobile&&this.closeBottomSheet.emit()}};d(e,"\u0275fac",function(s){return new(s||e)}
3),d(e,"\u0275cmp",be({type:e,selectors:[["app-home-currently-reading"]],outputs:{closeBottomSheet:"closeBottomSheet"},features:[Pn],decls:9,vars:2,consts:[["CurrentlyReadingTemplate",""],["emptyTemplate",""],["skeletonTemplate",""],["skeletonLeftPosts",""],[4,"ngIf","ngIfElse"],[1,"w-full","flex","flex-wrap"],[1,"w-full","flex","flex-wrap","border-b","border-gray-100","dark:border-gray-700"],[1,"text-gray-600","text-base","font-medium","mb-4"],[1,"w-full","mt-4","flex","flex-wrap","border-b","border-gray-100","dark:border-gray-700"],[4,"ngFor","ngForOf"],[1,"w-full","mb-4",3,"Post"],[1,"w-full","flex","flex-wrap","justify-between","items-center"],[1,"w-6/12","md:w-8/12","flex","items-center"],[1,"text-base","font-medium","text-gray-900"],[3,"routerLink","queryParams"],[1,"text-sm","bg-gray-50","dark:bg-gray-800","text-gray-500","px-2","rounded-md"],[1,"w-full","mt-4"],["class","w-full flex book-item p-2 mb-4 rounded-md bg-gray-50 dark:bg-gray-800",3,"click",4,"ngFor","ngForOf","ngForTrackBy"],[1,"w-full","flex","book-item","p-2","mb-4","rounded-md","bg-gray-50","dark:bg-gray-800",3,"click"],["loading","lazy","width","64","height","96","onerror","this.src='https://storage.behkhaan.ir/assets/images/default/default_book.svg'",1,"w-16","min-w-16","h-24","rounded-lg","cursor-pointer","object-cover",3,"src","alt"],[1,"grow","flex","flex-wrap","pr-2"],[1,"w-full","flex","flex-wrap","items-center"],["class","text-gray-900 text-base font-medium cursor-pointer line-clamp-1",4,"ngIf"],[1,"w-full"],["class","text-sm cursor-pointer text-gray-700",4,"ngFor","ngForOf"],[3,"totalCount","unitCount"],[1,"text-gray-900","text-base","font-medium","cursor-pointer","line-clamp-1"],[1,"text-sm","cursor-pointer","text-gray-700"],[1,"w-full","justify-between"],[1,"text-base","text-gray-800"],[1,"empty-shelf","mb-4"],[1,"text-base","text-gray-900","text-center"],[1,"text-sm","text-gray-700","text-center","mt-4"],[1,"w-full","flex"],[1,"flex","book-md",3,"theme"],[1,"grow","pr-4","flex","flex-wrap"],[1,"w-full","flex","items-center","justify-between"],[1,"flex",3,"theme"],[1,"flex","w-full",3,"theme"],[1,"flex","flex-wrap","w-full","mb-4"],[1,"flex",3,"appearance"],[1,"flex","mr-1",3,"theme"],[1,"w-full","flex","flex-wrap","mt-2","justify-center"],[1,"flex","w-full","h-[140px]",3,"theme"]],template:function(s,o){if(s&1&&Fe(0,kM,10,4,"ng-container",4)(1,DM,2,2,"ng-template",null,0,mi)(3,LM,10,0,"ng-template",null,1,mi)(5,FM,11,8,"ng-template",null,2,mi)(7,BM,1,2,"ng-template",null,3,mi),s&2){let a=Pt(2);x("ngIf",o.inPostPage)("ngIfElse",a)}},dependencies:[Ln,Cv,Wo,Xo,er,$S,tI,Ju,lt,Ep,Tp],encapsulation:2}));let t=e;return t})();var HM=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,qM=HM?"0ms":"160ms",rI=()=>[xr(":leave",nn({display:"none"}),{optional:!0}),xr(":enter",[nn({opacity:0}),ns("".concat(qM," cubic-bezier(0.2, 0, 0, 1)"),nn({opacity:1}))],{optional:!0})],Xp=xl("routeTransition",[is("messaging => *",rI()),is("* => messaging",rI()),is("* <=> *",[xr(":enter, :leave",[nn({position:"absolute",width:"100%",top:0,left:0})],{optional:!0}),xr(":leave .star",nn({opacity:0}),{optional:!0}),xr(":enter",[nn({transform:"translateY(-15px)",opacity:0})],{optional:!0}),fh([xr(":leave",[ns("300ms cubic-bezier(0.4, 0, 0.2, 1)",nn({opacity:0,transform:"translateY(10px)"}))],{optional:!0}),xr(":enter",[ns("500ms cubic-bezier(0.4, 0, 0.2, 1)",nn({transform:"translateY(0)",opacity:1}))],{optional:!0})])])]);var jM=()=>({originX:"start",originY:"bottom",overlayX:"start",overlayY:"top"}),GM=()=>({originX:"start",originY:"top",overlayX:"start",overlayY:"bottom"}),os=(t,e)=>[t,e],WM=t=>[t],VM=(t,e)=>({q:t,category:e}),zM=()=>[1,1,1],YM=()=>({height:"48px",width:"30px"}),$M=()=>({height:"12px",width:"100px"}),KM=()=>({height:"8px",width:"160px"}),Bl=(t,e,n)=>[t,e,n,".jpg",null,null,"sm"],QM=()=>({isPublisher:!0});function XM(t,e){if(t&1){let n=ge();b(0,"p",7),ee("click",function(){J(n);let r=w();return Z(r.clearSearch())}),M(1,"span",8),S()}}function JM(t,e){if(t&1){let n=ge();b(0,"div",17)(1,"div",18),ee("click",function(){let r=J(n).$implicit,s=w(4);return Z(s.loadHistory(r))}),b(2,"a",19),E(3),S()(),b(4,"div",20),ee("click",function(){let r=J(n).$index,s=w(4);return Z(s.removeHistoryItem(r))}),M(5,"span",21),S()()}if(t&2){let n=e.$implicit,i=w(4);y(2),x("routerLink",rt(3,WM,i.routes.search))("queryParams",Dt(5,VM,n,i.searchTabEnum.books)),y(),Me(" ",n," ")}}function ZM(t,e){if(t&1&&(b(0,"div",11)(1,"div",14)(2,"span",15),E(3,"\u062C\u0633\u062A\u200C\u0648\u200C\u062C\u0648\u0647\u0627\u06CC \u0627\u062E\u06CC\u0631"),S()(),b(4,"div",16),Wt(5,JM,6,8,"div",17,Zt),$(7,"slice"),S()()),t&2){let n=w(3);y(5),Vt(xt(7,0,n.searchHistory,0,7))}}function eP(t,e){t&1&&(b(0,"div",22),M(1,"ngx-skeleton-loader",23),b(2,"div",24)(3,"div",25),M(4,"ngx-skeleton-loader",23),S(),b(5,"div",26),M(6,"ngx-skeleton-loader",23),S()()()),t&2&&(y(),x("theme",it(3,YM)),y(3),x("theme",it(4,$M)),y(2),x("theme",it(5,KM)))}function tP(t,e){t&1&&(b(0,"div",12),Wt(1,eP,7,6,"div",22,Zt),S()),t&2&&(y(),Vt(it(0,zM)))}function nP(t,e){if(t&1&&(b(0,"span",37),E(1),S()),t&2){let n=w().$implicit;y(),Me(" \u062C\u0644\u062F ",n.seriesNumber," ")}}function iP(t,e){if(t&1){let n=ge();b(0,"a",40),ee("click",function(){J(n);let r=w(6);return Z(r.closePanel())}),E(1),$(2,"authorType"),S()}if(t&2){let n,i=e.$implicit,r=w(6);x("routerLink",Dt(4,os,r.routes.profile,i.id)),y(),Me(" ",(n=Lt(2,2,i))==null?null:n.name," ")}}function rP(t,e){if(t&1){let n=ge();b(0,"div",32)(1,"a",33),ee("click",function(){J(n);let r=w(5);return Z(r.closePanel())}),M(2,"img",34),$(3,"image"),S(),b(4,"div",35)(5,"a",33),ee("click",function(){J(n);let r=w(5);return Z(r.closePanel())}),M(6,"span",36),$(7,"highlight"),se(8,nP,2,1,"span",37),S(),b(9,"div",38),Wt(10,iP,3,7,"a",39,Zt),$(12,"authorSort"),$(13,"slice"),S()()()}if(t&2){let n=e.$implicit,i=w(5);y(),x("routerLink",Dt(23,os,i.routes.book,n.id)),y(),x("src",St(3,6,At(26,Bl,n.id,i.imageType.book,n==null?null:n.hasPhoto)),He)("alt",n==null?null:n.name),y(3),x("routerLink",Dt(30,os,i.routes.book,n.id)),y(),x("innerHTML",di(7,14,n==null?null:n.name,i.termControl.value),Bo),y(2),oe(n.seriesNumber?8:-1),y(2),Vt(xt(13,19,Lt(12,17,n==null?null:n.authors),0,1))}}function sP(t,e){if(t&1){let n=ge();b(0,"div",27)(1,"div",28),ee("click",function(r){J(n);let s=w(4);return s.navigateToSearchPage(s.searchTabEnum.books),Z(r.stopPropagation())}),b(2,"p",29),E(3," \u06A9\u062A\u0627\u0628 "),b(4,"span",30),E(5),$(6,"number"),S()(),b(7,"p",31),E(8,"\u0646\u062A\u0627\u06CC\u062C \u0628\u06CC\u0634\u062A\u0631"),S()(),Wt(9,rP,14,33,"div",32,Zt),$(11,"slice"),S()}if(t&2){let n=w(4);y(5),Me("(",Lt(6,1,n.result==null||n.result.books==null?null:n.result.books.totalCount),")"),y(4),Vt(xt(11,3,n.result==null||n.result.books==null?null:n.result.books.items,0,5))}}function oP(t,e){if(t&1){let n=ge();b(0,"div",41)(1,"div",42)(2,"a",43),ee("click",function(){J(n);let r=w(5);return Z(r.closePanel())}),M(3,"img",44),$(4,"image"),b(5,"div",45),M(6,"p",36),$(7,"highlight"),S()()(),b(8,"app-follow-btn",46),$(9,"followUserData"),ee("Follow",function(r){J(n);let s=w(5);return Z(s.FollowClicked(r))}),S()()}if(t&2){let n=e.$implicit,i=w(5);y(2),x("routerLink",Dt(19,os,i.routes.profile,n.id)),y(),x("src",St(4,6,At(22,Bl,n.id,i.imageType.authorAvatar,n==null?null:n.hasPhoto)),He)("alt",n.firstName),y(3),x("innerHTML",di(7,14,n.firstName,i.termControl==null?null:i.termControl.value),Bo),y(2),x("tabindex",-1)("user",Lt(9,17,n)
3)}}function aP(t,e){if(t&1){let n=ge();b(0,"div",27)(1,"div",28),ee("click",function(r){J(n);let s=w(4);return s.navigateToSearchPage(s.searchTabEnum.authors),Z(r.stopPropagation())}),b(2,"p",29),E(3," \u067E\u062F\u06CC\u062F\u0622\u0648\u0631 "),b(4,"span",30),E(5),$(6,"number"),S()(),b(7,"p",31),E(8,"\u0646\u062A\u0627\u06CC\u062C \u0628\u06CC\u0634\u062A\u0631"),S()(),Wt(9,oP,10,26,"div",41,Zt),$(11,"slice"),S()}if(t&2){let n=w(4);y(5),Me("(",Lt(6,1,n.result==null||n.result.authors==null?null:n.result.authors.totalCount),")"),y(4),Vt(xt(11,3,n.result==null||n.result.authors==null?null:n.result.authors.items,0,3))}}function lP(t,e){if(t&1&&M(0,"img",51),t&2){let n=w(6);x("src","../../../assets/images/pro/pro-icon-border"+(n.isDark?"-dark":"")+".svg",He)}}function cP(t,e){if(t&1){let n=ge();b(0,"div",48)(1,"div",42)(2,"a",49),ee("click",function(){J(n);let r=w(5);return Z(r.closePanel())}),b(3,"div",50),M(4,"img",44),$(5,"image"),se(6,lP,1,1,"img",51),S(),b(7,"div",45),M(8,"p",36),$(9,"highlight"),S()()(),b(10,"app-follow-btn",46),$(11,"followUserData"),ee("Follow",function(r){J(n);let s=w(5);return Z(s.FollowClicked(r))}),S()()}if(t&2){let n=e.$implicit,i=w(5);y(2),x("routerLink",Dt(20,os,i.routes.profile,n.uniqeName)),y(2),x("src",St(5,7,At(23,Bl,n.id,i.imageType.userAvatar,n==null?null:n.hasPhoto)),He)("alt",n.firstName),y(2),oe(n!=null&&n.hasProAccount?6:-1),y(2),x("innerHTML",di(9,15,n.firstName,i.termControl==null?null:i.termControl.value),Bo),y(2),x("tabindex",-1)("user",Lt(11,18,n))}}function uP(t,e){if(t&1){let n=ge();b(0,"div",27)(1,"div",47),ee("click",function(r){J(n);let s=w(4);return s.navigateToSearchPage(s.searchTabEnum.users),Z(r.stopPropagation())}),b(2,"p",29),E(3," \u06A9\u0627\u0631\u0628\u0631 "),b(4,"span",30),E(5),$(6,"number"),S()(),b(7,"p",31),E(8,"\u0646\u062A\u0627\u06CC\u062C \u0628\u06CC\u0634\u062A\u0631"),S()(),Wt(9,cP,12,27,"div",48,Zt),$(11,"slice"),S()}if(t&2){let n=w(4);y(5),Me("(",Lt(6,1,n.result==null||n.result.customers==null?null:n.result.customers.totalCount),")"),y(4),Vt(xt(11,3,n.result==null||n.result.customers==null?null:n.result.customers.items,0,3))}}function pP(t,e){if(t&1){let n=ge();b(0,"div",52)(1,"div",42)(2,"a",53),ee("click",function(){J(n);let r=w(5);return Z(r.closePanel())}),M(3,"img",44),$(4,"image"),b(5,"div",45),M(6,"p",36),$(7,"highlight"),S()()(),b(8,"app-follow-btn",46),$(9,"followUserData"),ee("Follow",function(r){J(n);let s=w(5);return Z(s.FollowClicked(r))}),S()()}if(t&2){let n=e.$implicit,i=w(5);y(2),x("routerLink",Dt(20,os,i.routes.profile,n.id))("queryParams",it(23,QM)),y(),x("src",St(4,7,At(24,Bl,n.id,i.imageType.publisherAvatar,n==null?null:n.hasPhoto)),He)("alt",n.title),y(3),x("innerHTML",di(7,15,n.title,i.termControl==null?null:i.termControl.value),Bo),y(2),x("tabindex",-1)("user",Lt(9,18,n))}}function dP(t,e){if(t&1){let n=ge();b(0,"div",27)(1,"div",47),ee("click",function(r){J(n);let s=w(4);return s.navigateToSearchPage(s.searchTabEnum.publishers),Z(r.stopPropagation())}),b(2,"p",29),E(3," \u0646\u0627\u0634\u0631 "),b(4,"span",30),E(5),$(6,"number"),S()(),b(7,"p",31),E(8,"\u0646\u062A\u0627\u06CC\u062C \u0628\u06CC\u0634\u062A\u0631"),S()(),Wt(9,pP,10,28,"div",52,Zt),$(11,"slice"),S()}if(t&2){let n=w(4);y(5),Me("(",Lt(6,1,n.result==null||n.result.publishers==null?null:n.result.publishers.totalCount),")"),y(4),Vt(xt(11,3,n.result==null||n.result.publishers==null?null:n.result.publishers.items,0,3))}}function mP(t,e){if(t&1){let n=ge();b(0,"div",41)(1,"div",45)(2,"a",43),ee("click",function(){J(n);let r=w(5);return Z(r.closePanel())}),M(3,"img",44),$(4,"image"),b(5,"div",45),M(6,"p",54),$(7,"highlight"),S()()()()}if(t&2){let n=e.$implicit,i=w(5);y(2),x("routerLink",Dt(15,os,i.routes.club,n.id)),y(),x("src",St(4,4,At(18,Bl,n.id,i.imageType.clubAvatar,n==null?null:n.hasPhoto)),He)("alt",n==null?null:n.name),y(3),x("innerHTML",di(7,12,n.name,i.termControl==null?null:i.termControl.value),Bo)}}function fP(t,e){if(t&1){let n=ge();b(0,"div",27)(1,"div",47),ee("click",function(r){J(n);let s=w(4);return s.navigateToSearchPage(s.searchTabEnum.clubs),Z(r.stopPropagation())}),b(2,"p",29),E(3," \u0628\u0627\u0634\u06AF\u0627\u0647\u200C "),b(4,"span",30),E(5),$(6,"number"),S()(),b(7,"p",31),E(8,"\u0646\u062A\u0627\u06CC\u062C \u0628\u06CC\u0634\u062A\u0631"),S()(),Wt(9,mP,8,22,"div",41,Zt),$(11,"slice"),S()}if(t&2){let n=w(4);y(5),Me("(",Lt(6,1,n.result==null||n.result.clubs==null?null:n.result.clubs.totalCount),")"),y(4),Vt(xt(11,3,n.result==null||n.result.clubs==null?null:n.result.clubs.items,0,3))}}function hP(t,e){if(t&1&&(b(0,"div",13),se(1,sP,12,7,"div",27),se(2,aP,12,7,"div",27),se(3,uP,12,7,"div",27),se(4,dP,12,7,"div",27),se(5,fP,12,7,"div",27),S()),t&2){let n=w(3);y(),oe(!(n.result==null||n.result.books==null)&&n.result.books.items&&(n.result==null||n.result.books==null||n.result.books.items==null?null:n.result.books.items.length)>0?1:-1),y(),oe(!(n.result==null||n.result.authors==null)&&n.result.authors.items&&(n.result==null||n.result.authors==null||n.result.authors.items==null?null:n.result.authors.items.length)>0?2:-1),y(),oe(!(n.result==null||n.result.customers==null)&&n.result.customers.items&&(n.result==null||n.result.customers==null||n.result.customers.items==null?null:n.result.customers.items.length)>0?3:-1),y(),oe(!(n.result==null||n.result.publishers==null)&&n.result.publishers.items&&(n.result==null||n.result.publishers==null||n.result.publishers.items==null?null:n.result.publishers.items.length)>0?4:-1),y(),oe(!(n.result==null||n.result.clubs==null)&&n.result.clubs.items&&(n.result==null||n.result.clubs==null||n.result.clubs.items==null?null:n.result.clubs.items.length)>0?5:-1)}}function gP(t,e){if(t&1&&(b(0,"div",10),se(1,ZM,8,4,"div",11),se(2,tP,3,1,"div",12),se(3,hP,6,5,"div",13),S()),t&2){let n=w(2),i=Pt(4);vv("width",i.elementRef.nativeElement.offsetWidth,"px"),x("@fade",void 0),y(),oe(n.termControl.value?-1:1),y(),oe(n.loading?2:-1),y(),oe(n.loading?-1:3)}}function _P(t,e){if(t&1&&se(0,gP,4,6,"div",9),t&2){let n=w();oe((n.termControl==null||n.termControl.value==null?null:n.termControl.value.length)>1||n.searchHistory.length>0?0:-1)}}var sI=(()=>{let e=class e extends Fn{constructor(){super();d(this,"origin");d(this,"loading",!1);d(this,"result");d(this,"termChanged",new Xi);d(this,"followUser",new Xi);d(this,"navigateToSearch",new Xi);d(this,"termControl",new RS("",[rh.minLength(2),rh.required]));d(this,"panelOpen",!1);d(this,"imageType",_t);d(this,"routes",Et);d(this,"searchTabEnum",lh);d(this,"searchHistory",[])}ngOnChanges(r){var s,o;this.checkPanelCondition((s=r.result)==null?void 0:s.currentValue,(o=r.loading)==null?void 0:o.currentValue)}checkPanelCondition(r,s){s||r&&r.totalResult>
30?this.openPanel():this.closePanel()}ngOnInit(){this.getSearchHistory(),this.handleTermChange().subscribe()}handleTermChange(){return this.termControl.valueChanges.pipe(Ze(()=>this.closePanel()),K0(500),Bu(),jt(this.unsubscribe$),Ze(r=>{this.termChanged.emit(r)}))}openPanel(){var r;(this.loading||this.result&&this.result.totalResult>0||((r=this.searchHistory)==null?void 0:r.length)>0)&&(this.panelOpen=!0)}closePanel(){this.panelOpen=!1}navigateToSearchPage(r){if(this.termControl.valid){let s=this.termControl.value;this.navigateToSearch.emit({cat:r,term:s}),this.setHistoryItem(s),this.closePanel()}}clearSearch(){this.termControl.reset()}setHistoryItem(r){var s;(s=this.searchHistory)==null||s.unshift(r),this.Repository.setLocalItem("sh",JSON.stringify(this.searchHistory))}removeHistoryItem(r){this.searchHistory.splice(r,1),this.Repository.setLocalItem("sh",JSON.stringify(this.searchHistory))}getSearchHistory(){var r;this.searchHistory=(r=JSON.parse(this.Repository.getLocalItem("sh")))!=null?r:[]}loadHistory(r){this.termControl.setValue(r,{emitEvent:!1}),this.navigateToSearchPage(lh.books)}FollowClicked(r){this.followUser.emit(r)}};d(e,"\u0275fac",function(s){return new(s||e)}),d(e,"\u0275cmp",be({type:e,selectors:[["beh-layout-search"]],viewQuery:function(s,o){if(s&1&&Ho(fp,5),s&2){let a;qo(a=jo())&&(o.origin=a.first)}},inputs:{loading:"loading",result:"result"},outputs:{termChanged:"termChanged",followUser:"followUser",navigateToSearch:"navigateToSearch"},features:[Pn,pv],decls:7,vars:12,consts:[["origin","cdkOverlayOrigin"],[1,"w-full","relative","flex","items-center"],[1,"absolute","right-4","flex","items-center","text-gray-500"],[1,"icon","search-regular","text-base"],["type","text","placeholder","\u062C\u0633\u062A\u200C\u0648\u200C\u062C\u0648 \u062F\u0631 \u0628\u06CC\u0634 \u0627\u0632 1.000.000 \u06A9\u062A\u0627\u0628\u060C \u06A9\u0627\u0631\u0628\u0631 \u0648 \u0646\u0648\u06CC\u0633\u0646\u062F\u0647","cdkOverlayOrigin","","id","searchInput","autocomplete","off",1,"w-full","pr-10",3,"focus","keydown.enter","formControl"],[1,"absolute","left-3","cursor-pointer","text-gray-500"],["cdkConnectedOverlay","",3,"backdropClick","detach","cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayHasBackdrop","cdkConnectedOverlayBackdropClass","cdkConnectedOverlayPositions"],[1,"absolute","left-3","cursor-pointer","text-gray-500",3,"click"],[1,"icon","dismiss-regular","text-xs","text-gray-500"],[1,"custom-panel","w-full","flex","flex-wrap","absolute","z-20","rounded-b-md","bg-gray-50","dark:bg-gray-800","shadow-sm",3,"width"],[1,"custom-panel","w-full","flex","flex-wrap","absolute","z-20","rounded-b-md","bg-gray-50","dark:bg-gray-800","shadow-sm"],[1,"w-full","rounded-md","bg-gray-50","dark:bg-gray-800","shadow-sm","border","border-gray-200","dark:border-gray-700"],[1,"w-full","dark:bg-gray-700"],[1,"w-full","dark:bg-gray-800","overflow-y-auto","hide-scrollbar","max-h-[calc(100dvh-7rem)]"],[1,"w-full","px-4","pt-2","flex","flex-wrap","justify-between"],[1,"text-sm","text-gray-400"],[1,"w-full","p-2","flex","flex-wrap","justify-between"],[1,"cursor-pointer","min-h-8","rounded-md","w-full","flex","flex-wrap","justify-start","items-center","my-1"],[1,"w-11/12","flex","items-center","px-2","h-full",3,"click"],[1,"text-sm","text-gray-800",3,"routerLink","queryParams"],[1,"w-1/12","px-2","h-full","flex","justify-end","items-center",3,"click"],[1,"icon","dismiss-regular","text-gray-500","text-xs"],[1,"px-4","py-1","flex","justify-start","items-start"],[3,"theme"],[1,"w-11/12","flex","flex-wrap","px-4"],[1,"w-full",2,"max-height","20px"],[1,"w-full",2,"max-height","12px"],[1,"flex","flex-wrap"],[1,"w-full","h-12","px-4","flex","flex-wrap","items-center","justify-between","cursor-pointer","bg-gray-100","dark:bg-gray-700",3,"click"],[1,"text-sm","text-gray-600"],[1,"text-sm","mr-1","text-gray-500"],[1,"text-xs","text-blue-500"],[1,"w-full","dark:bg-gray-800","px-4","flex","my-2","items-center","cursor-pointer","text-gray-600"],[1,"cursor-pointer",3,"click","routerLink"],["loading","lazy","onerror","this.src='https://storage.behkhaan.ir/assets/images/default/default_book.svg'",1,"w-[34px]","h-[51px]","object-cover","rounded-md",3,"src","alt"],[1,"relative","px-4","grow","flex","flex-wrap"],[1,"text-sm","text-gray-800",3,"innerHTML"],[1,"mr-2","btn-yellow-mute"],[1,"w-full","line-clamp-1"],[1,"curs
3or-pointer","text-sm","text-gray-500",3,"routerLink"],[1,"cursor-pointer","text-sm","text-gray-500",3,"click","routerLink"],[1,"w-full","px-4","flex","my-2","items-center","relative"],[1,"relative","grow","flex","items-center"],[1,"cursor-pointer","link","text-gray-600","items-center","flex",3,"click","routerLink"],["loading","lazy","width","32","height","32","onerror","this.src='https://storage.behkhaan.ir/assets/images/default/default_avatar.svg'",1,"avatar-sm",3,"src","alt"],[1,"w-full","relative","px-4","grow","flex","items-center"],[1,"h-8","md:h-10","w-28","min-w-28","max-w-28",3,"Follow","tabindex","user"],[1,"w-full","h-12","px-4","flex","items-center","flex-wrap","justify-between","cursor-pointer","bg-gray-100","dark:bg-gray-700",3,"click"],[1,"w-full","px-4","flex","items-center","my-2","relative"],[1,"cursor-pointer","text-gray-600","items-center","flex",3,"click","routerLink"],[1,"relative"],["alt","pro",1,"w-4","h-4","absolute","-bottom-[5px]","right-5","md:-bottom-0.5","md:right-[1.45rem]","z-29",3,"src"],[1,"w-full","px-4","my-2","flex","items-center","relative"],[1,"cursor-pointer","text-gray-600","items-center","flex",3,"click","routerLink","queryParams"],[1,"text-sm","text-gray-800","cursor-pointer",3,"innerHTML"]],template:function(s,o){if(s&1){let a=ge();b(0,"div",1)(1,"span",2),M(2,"span",3),S(),b(3,"input",4,0),ee("focus",function(){return J(a),Z(o.openPanel())})("keydown.enter",function(){return J(a),o.navigateToSearchPage(o.searchTabEnum.books),Z(o.closePanel())}),S(),se(5,XM,2,0,"p",5),S(),Fe(6,_P,1,1,"ng-template",6),ee("backdropClick",function(){return J(a),Z(o.closePanel())})("detach",function(){return J(a),Z(o.closePanel())})}if(s&2){let a=Pt(4);y(3),x("formControl",o.termControl),y(2),oe(o.termControl.valid?5:-1),y(),x("cdkConnectedOverlayOrigin",a)("cdkConnectedOverlayOpen",o.panelOpen)("cdkConnectedOverlayHasBackdrop",!0)("cdkConnectedOverlayBackdropClass","cdk-overlay-transparent-backdrop")("cdkConnectedOverlayPositions",Dt(9,os,it(7,jM),it(8,GM)))}},dependencies:[NS,AS,kS,OS,wS,CS,fp,DS,Xo,er,pE,Xu,lt,bE,Tp,Ep,dE,Ju],styles:[".custom-panel[_ngcontent-%COMP%]{background:#fff;border-radius:6px;box-shadow:0 4px 16px #00000026;height:auto;overflow-y:auto;min-width:180px}.item[_ngcontent-%COMP%]{padding:8px 12px;cursor:pointer}.item[_ngcontent-%COMP%]:hover{background:#0000000d}"],data:{animation:[xl("fade",[is(":enter",[nn({opacity:0,transform:"scaleY(0.9)"}),ns("120ms ease-out",nn({opacity:1,transform:"scaleY(1)"}))]),is(":leave",[ns("100ms ease-in",nn({opacity:0,transform:"scaleY(0.95)"}))])])]}}));let t=e;return t})();var yP=t=>({"!h-[calc(100%-56px)]":t}),oI=()=>["/feeds"],aI=(t,e)=>[t,e],ra=t=>[t],bP=(t,e,n,i)=>[t,e,n,".jpg",null,i,"sm"],vP=()=>[],SP=t=>({"!text-gray-900":t}),EP=()=>["text-green-500"],TP=()=>({exact:!0}),Jp=()=>["!text-green-500"],IP=t=>({"btn-add--active":t}),CP=t=>({"transform rotate-45":t}),wP=()=>({height:"100%",width:"100%"});function xP(t,e){if(t&1){let n=ge();en(0),b(1,"button",26),ee("click",function(){J(n);let r=w(2);return Z(r.openSignin())}),E(2,"\u062B\u0628\u062A\u200C\u0646\u0627\u0645 | \u0648\u0631\u0648\u062F"),S(),tn()}}function AP(t,e){if(t&1&&M(0,"img",31),t&2){let n=w(3);x("src",n.profileImage,He)("alt",n.currentUser==null?null:n.currentUser.firstName)}}function kP(t,e){if(t&1&&(M(0,"img",31),$(1,"image")),t&2){let n=w(3);x("src",St(1,2,Ev(10,bP,n.currentUser==null?null:n.currentUser.id,n.imageType.userAvatar,n.currentUser==null?null:n.currentUser.hasPhoto,n.currentUser==null?null:n.currentUser.modifiedAt)),He)("alt",n.currentUser==null?null:n.currentUser.firstName)}}function RP(t,e){if(t&1&&M(0,"img",32),t&2){let n=w(3);x("src","../../assets/images/pro/pro-icon-border"+(n.isDark?"-dark":"")+".svg",He)}}function OP(t,e){if(t&1){let n=ge();b(0,"div",27)(1,"div",28)(2,"a",29)(3,"div",30),se(4,AP,1,2,"img",31)(5,kP,2,15,"img",31),se(6,RP,1,1,"img",32),$(7,"isAllowed"),S(),b(8,"div",33)(9,"p",34),E(10),S(),b(11,"p",35),E(12),S()()()(),b(13,"button",36),ee("click",function(){J(n);let r=w(2);return Z(r.logout())}),M(14,"span",37),S()()}if(t&2){let n=w(2);y(2),x("routerLink",Dt(7,aI,n.routes.profile,n.currentUser==null?null:n.currentUser.uniqeName)),y(2),oe(n.profileImage?4:5),y(2),oe(Lt(7,5,rt(10,ra,n.PERMS.PRO_ACCOUNT))?6:-1),y(4),Me(" ",n.currentUser==null?null:n.currentUser.firstName," "),y(2),Me(" ","@"+(n.currentUser==null?null:n.currentUser.uniqeName)," ")}}function NP(t,e){if(t&1){let n=ge();b(0,"header",6)(1,"div",20),M(2,"a",21),S(),b(3,"div",22)(4,"beh-layout-search",23),ee("termChanged",function(r){J(n);let s=w();return Z(s.search(r))})("navigateToSearch",function(r){J(n);let s=w();return Z(s.navigateToSearchPage(r))})("followUser",function(r){J(n);let s=w();return Z(s.FollowClicked(r))}),S()(),b(5,"div",24),Fe(6,xP,3,0,"ng-container",25)(7,OP,15,12,"ng-template",null,2,mi),S()()}if(t&2){let n=Pt(8),i=w();y(2),x("routerLink",it(5,oI)),y(2),x("result",i.result)("loading",i.loadingResult),y(2),x("ngIf",!i.currentUser)("ngIfElse",n)}}function MP(t,e){t&1&&(b(0,"div",10),M(1,"a",38),S()),t&2&&(y(),x("routerLink",it(1,oI)))}function PP(t,e){if(t&1&&(b(0,"a",41)(1,"div",42),M(2,"span",43),b(3,"span",44),E(4),S()()()),t&2){let n=e.$implicit;x("routerLink",n.link?rt(7,ra,n.link):it(9,vP))("queryParams",n.query
3),y(),x("ngClass",rt(10,SP,!n.link))("routerLinkActive",it(12,EP))("routerLinkActiveOptions",it(13,TP)),y(),x("ngClass",n.icon),y(2),Me(" ",n.title," ")}}function DP(t,e){if(t&1){let n=ge();b(0,"div",11)(1,"app-sidenav-menu-item",39,3),ee("click",function(){let r=J(n).$implicit,s=Pt(2),o=w();return Z(o.onSidenavItemClicked(r,s))}),S(),b(3,"mat-menu",40,4),Wt(5,PP,5,14,"a",41,bv),S()()}if(t&2){let n=e.$implicit,i=Pt(4),r=w();y(),x("notificationCount",r.notificationCount)("messagesCount",r.unreadMessages())("displayCount",!1)("item",n)("matMenuTriggerFor",n.type===r.eSlidenavMenu.More?i:null),y(4),Vt(n.children)}}function LP(t,e){if(t&1&&(b(0,"span",49),E(1),S()),t&2){w(2);let n=Bs(0);y(),Me(" ",n," ")}}function FP(t,e){if(t&1){let n=ge();en(0),b(1,"div",45),ee("click",function(){J(n);let r=w();return Z(r.openMergeDialog())}),M(2,"span",46),b(3,"span",47),E(4," \u062A\u0644\u0641\u06CC\u0642 \u0646\u0648\u06CC\u0633\u0646\u062F\u0647 "),Fe(5,LP,2,1,"span",48),S()(),tn()}if(t&2){w();let n=Bs(0);y(5),x("ngIf",n>0)}}function UP(t,e){if(t&1&&(b(0,"span",49),E(1),S()),t&2){w(2);let n=Bs(2);y(),Me(" ",n," ")}}function BP(t,e){if(t&1){let n=ge();en(0),b(1,"div",45),ee("click",function(){J(n);let r=w();return Z(r.openMergeDialog())}),M(2,"span",46),b(3,"span",47),E(4," \u062A\u0644\u0641\u06CC\u0642 \u0646\u0627\u0634\u0631 "),Fe(5,UP,2,1,"span",48),S()(),tn()}if(t&2){w();let n=Bs(2);y(5),x("ngIf",n>0)}}function HP(t,e){if(t&1&&(b(0,"span",49),E(1),S()),t&2){w(2);let n=Bs(4);y(),Me(" ",n," ")}}function qP(t,e){if(t&1){let n=ge();en(0),b(1,"div",45),ee("click",function(){J(n);let r=w();return Z(r.openMergeDialog())}),M(2,"span",50),b(3,"span",47),E(4," \u062A\u0644\u0641\u06CC\u0642 \u06A9\u062A\u0627\u0628 "),se(5,HP,2,1,"span",49),S()(),tn()}if(t&2){w();let n=Bs(4);y(5),oe(n>0?5:-1)}}function jP(t,e){if(t&1&&(b(0,"a",13),M(1,"span",51),b(2,"span",52),E(3," \u062D\u0645\u0627\u06CC\u062A \u0645\u0627\u0644\u06CC "),S()()),t&2){let n=w();x("routerLink",rt(1,ra,n.routes.predonation))}}function GP(t,e){t&1&&(b(0,"div",14),M(1,"app-floating-actions",53),S()),t&2&&(y(),x("displayActions",!1)("displayAdd",!0))}function WP(t,e){if(t&1){let n=ge();b(0,"app-behkhaan-suggestion-set-avatar",56),ee("close",function(r){J(n);let s=w(2);return Z(s.removeSetAvatarCard(r))}),S()}}function VP(t,e){if(t&1&&(se(0,WP,1,0,"app-behkhaan-suggestion-set-avatar",54),M(1,"app-home-currently-reading",55)),t&2){let n=w();oe(n.displaySetAvatar?0:-1)}}function zP(t,e){if(t&1&&(b(0,"span",70),E(1),S()),t&2){let n=w(2);y(),Ae(n.notificationCount>9?"+9":n.notificationCount)}}function YP(t,e){if(t&1){let n=ge();en(0),b(1,"footer",57)(2,"a",58),M(3,"span",59),S(),b(4,"a",60)(5,"span",61),Fe(6,zP,2,1,"span",62),M(7,"span",63),S()(),b(8,"div",64)(9,"button",65),ee("click",function(){J(n);let r=w();return Z(r.actionButtonsMobile())}),M(10,"span",66),S()(),b(11,"a",67),M(12,"span",68),S(),b(13,"a",67),M(14,"span",69),S()(),tn()}if(t&2){let n=w();y(),Jf("!hidden",n.isMessagesRoute()),y(),x("routerLink",Dt(13,aI,n.routes.profile,n.currentUser==null?null:n.currentUser.uniqeName))("routerLinkActive",it(16,Jp)),y(2),x("routerLink",rt(17,ra,n.routes.notifications))("routerLinkActive",it(19,Jp)),y(2),x("ngIf",n.notificationCount),y(3),x("ngClass",rt(20,IP,n.displayActions)),y(),x("ngClass",rt(22,CP,n.displayActions)),y(),x("routerLink",rt(24,ra,n.routes.explore))("routerLinkActive",it(26,Jp)),y(2),x("routerLink",rt(27,ra,n.routes.feed))("routerLinkActive",it(29,Jp))}}function $P(t,e){t&1&&M(0,"ngx-skeleton-loader",71),t&2&&x("theme",it(1,wP))}var KP="displaySetAvatar",lI=(()=>{let e=class e extends Fn{constructor(){super();d(this,"router",T(Yt));d(this,"dialog",T(_i));d(this,"_bottomSheet",T($o));d(this,"fileService",T(tp));d(this,"searchService",T(_p));d(this,"signalHubService",T(vp));d(this,"invokeSignalService",T(jS));d(this,"activitiesUpdateService",T(HS));d(this,"mergeService",T(bp));d(this,"followItemService",T(Sp));d(this,"_sidenavMenuGenerator",T(zS));d(this,"feedsFacadeService",T(uE));d(this,"notificationFacadeService",T(ah));d(this,"notifFacadeService",T(ah));d(this,"viewTrackerService",T(aE));d(this,"exploreFacadeService",T(mE));d(this,"badgeNotifierService",T(SE));d(this,"_localRepository",T(Qe));d(this,"proHandler",T(lE));d(this,"chatFacade",T(xp));d(this,"unreadMessages",this.chatFacade.totalUnread);
3d(this,"isMessagesRoute",uv(Ll(this.router.url)));d(this,"displaySetAvatar",!1);d(this,"profileImage",null);d(this,"routes",Et);d(this,"notificationCount",0);d(this,"suggesstionTermFilter",new yp);d(this,"loadingResult");d(this,"mergePublisherCount$",this.mergeService.selectedPublisherToMerge);d(this,"mergeAuthCount$",this.mergeService.selectedAuthorToMerge);d(this,"mergeBookCount$",this.mergeService.selectedBookToMerge);d(this,"displayActions",!1);d(this,"imageType",_t);d(this,"sidenavItems",[]);d(this,"eSlidenavMenu",Cl);d(this,"currentUrl","");d(this,"prevUrl","");d(this,"result",null);d(this,"PERMS",TS);d(this,"isDark");d(this,"pendingMessagesRoute",null);d(this,"pendingNavigationId",null)}ngOnInit(){this.userDataChangeHandler().subscribe(),this.Repository.IsInBrowser&&(this.handleNotifCount().subscribe(),this.routerEventListener().subscribe(),this.newNotificationListener().subscribe(),this.avatarChangeHandler().subscribe(),this.initTheme().subscribe(),this.chatFacade.init(),this.currentUser&&(this.getUnSeenNotificationsCount().subscribe(),this.openUnseenBadgePopup().subscribe(),this.preloadMessaging()))}initTheme(){let r=this.Repository.getCookieItem(Zu);return this.isDark=r==="dark",this.appStateService.theme.pipe(Ze(s=>this.isDark=s==="dark"))}handleNotifCount(){return this.appStateService.notificationCountModifier$.pipe(jt(this.unsubscribe$),Ze(r=>this.notificationCount=r||0))}sendQueuedViews(r){var s;return r instanceof Ws&&(this.prevUrl=this.currentUrl,this.currentUrl=r.url,(s=this.prevUrl)==null?void 0:s.includes("profile"))?this.viewTrackerService.submitQueuedViews():pe(null)}trackMessagesRoute(r){if(r instanceof gS){this.pendingMessagesRoute=Ll(r.urlAfterRedirects),this.pendingNavigationId=r.id;return}if(r instanceof lp||r instanceof cp){if(this.pendingNavigationId!==null&&r.id!==this.pendingNavigationId)return;this.pendingMessagesRoute=null,this.pendingNavigationId=null,this.isMessagesRoute.set(Ll(this.router.url))}}settleMessagesRoute(r){r instanceof Ws&&(this.pendingMessagesRoute=null,this.pendingNavigationId=null,this.isMessagesRoute.set(Ll(this.router.url)))}onOutletActivate(){this.pendingMessagesRoute!==null&&(this.isMessagesRoute.set(this.pendingMessagesRoute),this.pendingMessagesRoute=null,this.pendingNavigationId=null)}routerEventListener(){return this.router.events.pipe(jt(this.unsubscribe$),Le(r=>(this.trackMessagesRoute(r),this.settleMessagesRoute(r),this.Repository.getCookieItem(Ji)?this.sendQueuedViews(r):pe(null))))}preloadMessaging(){var a;let r=navigator.connection;if(r!=null&&r.saveData||/^(slow-)?2g$/.test((a=r==null?void 0:r.effectiveType)!=null?a:""))return;let s=()=>import("./chunk-V6RUPCFN.js").catch(()=>{}),o=window.requestIdleCallback;if(typeof o=="function"){o(s,{timeout:4e3});return}setTimeout(s,2500)}newNotificationListener(){return this.invokeSignalService.newNotification$.pipe(jt(this.unsubscribe$),Ze(r=>{var s,o;r&&((o=(s=r==null?void 0:r.data)==null?void 0:s.payLoad)==null?void 0:o.type)=="Notif"&&(this.notificationCount++,this.appStateService.hasNewNotification$=!0)}))}userDataChangeHandler(){return this.userStateService.userData.pipe(jt(this.unsubscribe$),Ze(r=>{r!=null&&r.id||this.clearClientSideCache(),this.displaySetAvatar=!(r!=null&&r.hasPhoto),this.generateMenuItems()}))}avatarChangeHandler(){return this.fileService.userImageOBS_$.pipe(jt(this.unsubscribe$),Ze(r=>{var s;r?(this.profileImage=r,this.displaySetAvatar=!1):(s=this.currentUser)!=null&&s.id&&(this.profileImage="",this.displaySetAvatar=!0,this.currentUser.hasPhoto=!1)}))}search(r){r&&r.length>1?(this.loadingResult=!0,this.suggesstionTermFilter.searchTerm=this.utilFunctions.replaceFaNumbers(r),this.searchService.searchSuggesstion(this.suggesstionTermFilter).pipe(yn(1)).subscribe(s=>{this.loadingResult=!1,s&&!s.hasError?this.result=s.result:this.clearResults()})):(this.loadingResult=!1,this.clearResults())}clearClientSideCache(){this.feedsFacadeService.clearFeedCache(),this.notifFacadeService.clearNotificationCache()}generateMenuItems(){this.sidenavItems=this._sidenavMenuGenerator.generate(VS.LAYOUT)}removeSetAvatarCard(r){r===Ul.userClosed&&this.Repository.setLocalItem(KP,"F"),this.displaySetAvatar=!1}getUnSeenNotificationsCount(){return this.activitiesUpdateService.getUnSeenNotificationsCount().pipe(Le(r=>(!r.hasError&&r.result&&(this.notificationCount=r.result),this.appStateService.n
3otificationCountModifier$)),Ze(r=>{this.notificationCount=r||0}),jt(this.unsubscribe$))}openSignin(){this.Repository.IsInBrowser&&this.dialog.open(FS,{panelClass:"auth-dialog",data:{redirectPath:null},disableClose:!0})}logout(){if(this.Repository.IsInBrowser){if(this.Repository.IsInMobile){this._bottomSheet.open(sh,{panelClass:"exit-bottom-sheet"});return}this.dialog.open(sh,{panelClass:"basic-dialog"})}}openMergeDialog(){this.dialog.open(ZT,{panelClass:"merge-dialog",width:"400px",height:"auto"})}navigateToSearchPage(r){this.Repository.IsInBrowser&&this.router.navigate([Et.search],{queryParamsHandling:"merge",queryParams:{q:r.term,category:r.cat}})}clearResults(){this.result=null}FollowClicked(r){this.followItemService.Follow(r)}prepareRoute(r){return!r||!r.isActivated?pe(null):this.isMessagesRoute()?"messaging":r==null?void 0:r.activatedRoute.url}onAnimationDone(){this.feedsFacadeService.runSetTimeout(),this.exploreFacadeService.runSetTimeout(),this.notificationFacadeService.runSetTimeout()}actionButtonsMobile(){this.displayActions=!this.displayActions,this.dialog.open(Yh,{panelClass:"floatin-mobile",width:"100%",data:{displayActions:this.displayActions}}).afterClosed().pipe(jt(this.unsubscribe$)).subscribe(s=>{this.displayActions=!1,(s==null?void 0:s.type)==="displayReadingBooks"&&this.router.navigate([this.routes.challenges_progress])})}onSidenavItemClicked(r,s){r.type===Cl.SUPPORT?Goftino.open():r.type===Cl.More?s==null||s.openMenu():r.type===Cl.Pro&&this.openProDialog()}openProDialog(){this.proHandler.preProcessProFeature(!0).subscribe()}closeSubmenu(r){r.expanded=!1}openUnseenBadgePopup(){return this.badgeNotifierService.badgeNotifire$.pipe(X0(5e3),yn(1),Le(()=>this.badgeNotifierService.checkForBadge()))}};d(e,"\u0275fac",function(s){return new(s||e)}),d(e,"\u0275cmp",be({type:e,selectors:[["layout"]],features:[Pn],decls:29,vars:30,consts:[["outlet","outlet"],["loadingTemplate",""],["userTemplate",""],["menuTrigger","matMenuTrigger"],["menuDropdown","matMenu"],[1,"flex","flex-wrap","justify-between","w-full","min-[767.98px]:w-[1136px]","mx-auto","duration-200","bg-white","dark:bg-gray-900",3,"ngClass"],[1,"hidden","w-screen","sm:flex","h-24","flex-wrap","items-center","justify-between","sticky","top-0","z-50","bg-white","dark:bg-gray-900"],[1,"h-full","lg:!h-[calc(100%-96px)]","w-screen","min-[1136px]:w-full","flex","items-start","justify-between",3,"ngClass"],[1,"hidden","sm:w-3/12","lg:w-44","lg:min-w-44","sm:flex","sm:content-start","sm:items-start","sm:sticky","z-[1000]","sm:px-2","sm:border-l","sm:border-gray-100","dark:sm:border-gray-700","transition-none",3,"ngClass"],[1,"w-full","flex","flex-wrap","items-center"],[1,"w-full","h-24","flex","items-center"],[1,"w-full","h-10","xl:h-11","2xl:h-12","outline-none","flex","items-center","justify-center","text-gray-900"],[4,"ngIf"],[1,"flex","w-full","items-center","justify-center","btn-green-mute","mt-3",3,"routerLink"],[1,"min-h-12","min-w-12","max-w-[90%]","flex","absolute","bottom-4"],[1,"h-full","flex","flex-1","min-w-0","max-w-full","items-center","justify-center",3,"ngClass"],["id","scrollableLayout",1,"h-full","w-full","relative","hide-scroll",3,"ngClass"],[1,"w-full","h-full"],[3,"activate"],[1,"hidden","lg:w-[272px]","lg:min-w-[272px]","lg:flex-wrap","px-2","lg:pl-2","lg:pr-4","sticky","top-24","content-start","justify-end","h-[calc(100dvh-6rem)]","items-start","border-r","border-gray-100","dark:border-gray-700","overflow-auto","hide-scroll"],[1,"sm:w-3/12","lg:w-44","sm:flex","h-24","px-2","items-center","border-gray-100","dark:border-gray-700","border-l-[1px]"],["width","112px","height","38.34px","alt","\u0628\u0647\u062E\u0648\u0627\u0646","id","behkhaanLogo",1,"cursor-pointer",3,"routerLink"],[1,"h-24","w-fit","grow","p-4","flex","items-center","justify-center","border-b","border-gray-100","dark:border-gray-700"],[1,"w-full",3,"termChanged","navigateToSearch","followUser","result","loading"],[1,"hidden","lg:h-24","lg:w-[272px]","lg:flex","lg:items-center","lg:justify-end","lg:pr-4","border-gray-100","dark:border-gray-700","border-r-[1px]"],[4,"ngIf","ngIfElse"],["id","loginBtn",1,"btn-sm","bg-green-500","text-white","dark:text-black",3,"click"],[1,"w-full","flex","items-center","justify-between"],[1,"grow","flex"],[1,"w-full","flex","items-center","cursor-pointer",3,"routerLink"],[1,"relative"],["loading","lazy","onerror","this.src='https://storage.behkhaan.ir/assets/images/default/default_avatar.svg'",1,"avatar-md",3,"src","alt"],["alt","pro",1,"absolute","top-8","-left-1","h-5","w-5",3,"src"],[1,"w-full","px-2","grow","flex","flex-wrap"],[1,"w-full","text-sm","text-gray-900"],["dir","ltr",1,"text-sm","text-gray-900","text-right"],[1,"icon-btn",3,"click"],[1,"icon","arrow-exit-regular","text-gray-900","text-2xl"],["width","112px","height","38.34px","alt","\u0628\u0647\u062E\u0648\u0627\u0646","aria-label","\u0628\u0647\u062E\u0648\u0627\u0646","id","behkh
3aanLogo",1,"cursor-pointer",3,"routerLink"],["yPosition","above",1,"w-full",3,"click","notificationCount","messagesCount","displayCount","item","matMenuTriggerFor"],[1,"!w-[240px]","!h-40","md:!h-40","!rounded-xl"],["mat-menu-item","",1,"flex","items-center","justify-between","text-gray-900",3,"routerLink","queryParams"],[1,"flex","items-center",3,"ngClass","routerLinkActive","routerLinkActiveOptions"],[1,"icon","text-xl",3,"ngClass"],[1,"text-sm","mr-2"],[1,"w-full","flex","items-center","relative","cursor-pointer","mt-2",3,"click"],[1,"icon","text-gray-900","table-move-right-regular","text-xl"],[1,"grow","flex","justify-start","items-center","text-sm","g","text-gray-900","mr-2"],["class","rounded-full mr-2 text-sm w-[17px] h-[17px] flex flex-wrap content-center justify-center bg-red-700 text-white",4,"ngIf"],[1,"rounded-full","mr-2","text-sm","w-[17px]","h-[17px]","flex","flex-wrap","content-center","justify-center","bg-red-700","text-white"],[1,"icon","text-gray-900","Merge","text-xl"],[1,"icon","ri_candle-line","text-lg","text-green-500"],[1,"text-sm","font-normal","mr-2","text-green-500"],[1,"w-full",3,"displayActions","displayAdd"],[1,"w-full","mb-4","h-[106px]"],[1,"w-full"],[1,"w-full","mb-4","h-[106px]",3,"close"],[1,"w-full","flex-wrap","flex","lg:hidden","items-center","justify-between","border-t","border-gray-100","dark:border-gray-800","bg-white","dark:bg-gray-900","fixed","bottom-0","z-50","py-1"],[1,"text-xs","cursor-pointer","w-1/5","flex","items-center","justify-center","h-12","outline-none","text-gray-700",3,"routerLink","routerLinkActive"],[1,"icon","person-regular","text-3xl","ml-1"],[1,"text-xs","cursor-pointer","w-1/5","flex","items-center","justify-center","h-12","outline-none","text-gray-700","relative",3,"routerLink","routerLinkActive"],[1,"relative","flex"],["class","absolute bottom-4 left-6 w-[15px] h-[15px] rounded-full flex items-center justify-center text-white text-[0.65rem] text-center bg-red-700",4,"ngIf"],[1,"icon","alert-regular","text-3xl","ml-1"],[1,"w-1/5","flex","items-center","justify-center","h-11","outline-none","text-gray-700"],[1,"w-10","h-10","flex","items-center","justify-center","border-[1.5px]","border-gray-700","dark:border-gray-200","p-2","rounded-full",3,"click","ngClass"],[1,"icon","add-regular","duration-300","text-2xl",3,"ngClass"],[1,"text-sm","cursor-pointer","w-1/5","flex","items-center","justify-center","h-12","outline-none","text-gray-700",3,"routerLink","routerLinkActive"],[1,"icon","search-regular","text-3xl"],[1,"icon","home-regular","text-3xl","ml-1"],[1,"absolute","bottom-4","left-6","w-[15px]","h-[15px]","rounded-full","flex","items-center","justify-center","text-white","text-[0.65rem]","text-center","bg-red-700"],[1,"flex","w-full","h-12","outline-none",3,"theme"]],template:function(s,o){var a,l,c;if(s&1){let u=ge();Vu(0),$(1,"async"),Vu(2),$(3,"async"),Vu(4),$(5,"async"),b(6,"section",5),se(7,NP,9,6,"header",6),b(8,"main",7)(9,"article",8)(10,"div",9),se(11,MP,2,2,"div",10),Wt(12,DP,7,5,"div",11,Zt),Fe(14,FP,6,1,"ng-container",12)(15,BP,6,1,"ng-container",12)(16,qP,6,1,"ng-container",12),se(17,jP,4,3,"a",13),S(),se(18,GP,2,2,"div",14),S(),b(19,"article",15)(20,"div",16)(21,"div",17),ee("@routeTransition.done",function(){return J(u),Z(o.onAnimationDone())}),b(22,"router-outlet",18,0),ee("activate",function(){return J(u),Z(o.onOutletActivate())}),S()()()(),b(24,"article",19),se(25,VP,2,1),S()(),Fe(26,YP,15,30,"ng-container",12),S(),Fe(27,$P,1,2,"ng-template",null,1,mi)}if(s&2){let u,p,m,f=Pt(23),h=zu((a=(u=Lt(1,19,o.mergeAuthCount$))==null?null:u.length)!=null?a:0);y(2);let _=zu((l=(p=Lt(3,22,o.mergePublisherCount$))==null?null:p.length)!=null?l:0);y(2);let v=zu((c=(m=Lt(5,25,o.mergeBookCount$))==null?null:m.length)!=null?c:0);y(2),x("ngClass",o.isMessagesRoute()?"messages-layout":"h-full"),y(),oe(o.isMessagesRoute()?-1:7),y(),x("ngClass",rt(28,yP,o.currentUser&&!(o.router.url.includes("donate")||o.router.url.includes("annual-report")||o.router.url.includes("monthly-report")))),y(),x("ngClass",o.isMessagesRoute()?"sm:h-full sm:top-0":"sm:h-[calc(100dvh-6rem)] sm:top-24"),y(2),oe(o.isMessagesR
3oute()?11:-1),y(),Vt(o.sidenavItems),y(2),x("ngIf",(o.currentUser==null?null:o.currentUser.isLibrarian)&&h>0),y(),x("ngIf",(o.currentUser==null?null:o.currentUser.isLibrarian)&&_>0),y(),x("ngIf",(o.currentUser==null?null:o.currentUser.isLibrarian)&&v>0),y(),oe(o.currentUser?17:-1),y(),oe(o.currentUser?18:-1),y(),x("ngClass",o.isMessagesRoute()?"w-full":"max-[639px]:w-full min-[640px]:w-8/12 min-[767.98px]:!w-7/12"),y(),x("ngClass",o.isMessagesRoute()?"overflow-hidden py-3 px-3":"overflow-auto"),y(),x("@routeTransition",o.prepareRoute(f)),y(3),Jf("lg:flex",!o.isMessagesRoute())("lg:hidden",o.isMessagesRoute()),y(),oe(o.currentUser&&o.Repository.IsInBrowser?25:-1),y(),x("ngIf",o.currentUser&&!(o.router.url.includes("donate")||o.router.url.includes("annual-report")||o.router.url.includes("monthly-report")))}},dependencies:[Ln,Go,Wo,Xo,mp,er,bS,YS,Yh,up,eI,iI,yE,gE,hE,_E,es,fE,sI,wv,lt,vE],styles:['@charset "UTF-8";.messages-layout[_ngcontent-%COMP%]{height:100dvh;overflow:hidden}.messages-layout[_ngcontent-%COMP%] > main[_ngcontent-%COMP%]{height:100%!important;transition-property:none}.hide-scroll[_ngcontent-%COMP%]::-webkit-scrollbar{display:none}.hide-scroll[_ngcontent-%COMP%]{-ms-overflow-style:none;scrollbar-width:none}  .mat-menu-item:hover{color:#22c55e!important;background-color:transparent!important}  .mat-menu-item.active-link{color:#22c55e!important}.seri-number[_ngcontent-%COMP%]{border-radius:.375rem;background-color:#a162070d;padding:.25rem .5rem;font-family:ESTEDAD_MEDIUM;font-size:.75rem;line-height:1rem;font-weight:500;--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}'],data:{animation:[Xp]}}));let t=e;return t})();var cI=()=>{let t=T(Yt),e=T(hi);return T(Qe).getCookieItem(Ji)&&e.userData?(t.navigate([Et.feed]),!1):!0};var uI=()=>{let t=T(Qo),e=T(LE);return t.categories$.pipe(J0(n=>(n==null?void 0:n.length)>0?pe(!0):e.getAllCategories().pipe(De(i=>(t.categories$=i!=null&&i.hasError?[]:i==null?void 0:i.result,!0)))))};var pI=[{path:"",canActivate:[cI],children:[{path:"",loadComponent:()=>import("./chunk-W4TWIF22.js").then(t=>t.HomeComponent),title:"\u0628\u0647\u062E\u0648\u0627\u0646 | \u0628\u0647\u062A\u0631 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u060C \u0628\u0647\u062A\u0631 \u0628\u062E\u0648\u0627\u0646",data:{shouldReuse:!0,key:"home",header:!0}}]},{path:"",component:lI,children:[{path:"",loadChildren:()=>import("./chunk-XUZB7JYP.js").then(t=>t.LayoutRouting)}],resolve:[uI]},{path:np.CHALLENGE_INTRO,loadChildren:()=>import("./chunk-6VFPULV3.js").then(t=>t.routes)},{path:np.ONBOARDING,loadChildren:()=>import("./chunk-B76BAJHD.js").then(t=>t.ONBOARDING_ROUTES)},{path:"**",redirectTo:"not-found"},{path:np.NotFound,loadComponent:()=>import("./chunk-COXW277D.js").then(t=>t.NotFoundComponent)}];var dI={parse:{dateInput:"jYYYY-jMM-jDD"},display:{dateInput:"jYYYY-jMM-jDD",monthYearLabel:"jYYYY jMMMM",dateA11yLabel:"jYYYY-jMM-jDD",monthYearA11yLabel:"jYYYY jMMMM"}},mI={parse:{dateInput:"l"},display:{dateInput:"l",monthYearLabel:"MMM YYYY",dateA11yLabel:"LL",monthYearA11yLabel:"MMMM YYYY"}};var rr=bO(vO());var QP=new gt("MAT_MOMENT_DATE_ADAPTER_OPTIONS",{providedIn:"root",factory:XP});function XP(){return{useUtc:!1}}function fI(t,e){let n=Array(t);for(let i=0;i<t;i++)n[i]=e(i);return n}var Zp=class extends gp{constructor(n,i){super();d(this,"options");d(this,"_localeData");this.options=i,this.setLocale(n||rr.default.locale())}setLocale(n){super.setLocale(n);let i=rr.default.localeData(n);n==="fa"?this._localeData={firstDayOfWeek:i.firstDayOfWeek(),longMonths:i.jMonths(),shortMonths:i.jMonths(),dates:fI(31,r=>this.createPersianDateFrom3Numbers(2017,0,r+1).format("D")),longDaysOfWeek:i.weekdays(),shortDaysOfWeek:i.weekdaysShort(),narrowDaysOfWeek:i.weekdaysMin()}:this._localeData={firstDayOfWeek:i.firstDayOfWeek(),longMonths:i.months(),shortMonths:i.monthsShort(),dates:fI(31,r=>this.createDate(2017,0,r+1).format("D")),longDaysOfWeek:i.weekdays(),shortDaysOfWeek:i.weekdaysShort(),narrowDaysOfWeek:i.weekdaysMin()}}getYear(n){return this.locale==="fa"?this.clone(n).jYear():this.clone(n).year()}getMonth(n){return this.locale==="fa"?this.clone(n).jMonth():this.clone(n).month()}getDate(n){return this.locale==="fa"?this.clone(n).jDate():this.clone(n).date()}getDayOfWeek(n){return this.clone(n).day()}getMonthNames(n){return n=="long"?this._localeData.longMonths:this._localeData.shortMonths}getDateNames(){return this._localeData.dates}getDayOfWeekNames(n){return n=="long"?this._localeData.longDaysOfWeek:n=="short"?this._localeData.shortDaysOfWeek:this._localeData.narrowDaysOfWeek}getYearName(n){return this.locale==="fa"?this.clone(n).jYear().toString():this.clone(n).year().toString()}getFirstDayOfWeek(){return this._localeData.firstDayOfWeek}getNumDaysInMonth(n){return this.locale==="fa"?this.clone(n).jDaysInMonth():this.clone(n).daysInMonth()}clone(n){return n.clone().locale(this.locale)}createPersianDateFrom3Numbers(n,i,r){let s;return this.options&&this.options.useUtc?s=(0,rr.default)().utc():s=(0,rr.default)(),s.jYear(n).j
3Month(i).jDate(r).hours(0).minutes(0).seconds(0).milliseconds(0).locale("fa")}createDate(n,i,r){if(i<0||i>11)throw Error('Invalid month index "'.concat(i,'". Month index has to be between 0 and 11.'));if(r<1)throw Error('Invalid date "'.concat(r,'". Date has to be greater than 0.'));let s;if(this.locale==="fa"?s=this.createPersianDateFrom3Numbers(n,i,r):s=this._createMoment({year:n,month:i,date:r}).locale(this.locale),!s.isValid())throw Error('Invalid date "'.concat(r,'" for month with index "').concat(i,'".'));return s}today(){return this._createMoment().locale(this.locale)}parse(n,i){return n&&typeof n=="string"?this._createMoment(n,i,this.locale):n?this._createMoment(n).locale(this.locale):null}format(n,i){if(n=this.clone(n),!this.isValid(n))throw Error("JalaliMomentDateAdapter: Cannot format invalid date.");return n.format(i)}addCalendarYears(n,i){return this.locale==="fa"?this.clone(n).add(i,"jYear"):this.clone(n).add(i,"years")}addCalendarMonths(n,i){return this.locale==="fa"?this.clone(n).add(i,"jmonth"):this.clone(n).add(i,"month")}addCalendarDays(n,i){return this.locale==="fa"?this.clone(n).add(i,"jDay"):this.clone(n).add(i,"day")}toIso8601(n){return this.clone(n).format()}isDateInstance(n){return rr.default.isMoment(n)}isValid(n){return this.clone(n).isValid()}invalid(){return rr.default.invalid()}deserialize(n){let i;if(n instanceof Date&&(i=this._createMoment(n)),typeof n=="string"){if(!n)return null;this.locale==="fa"?i=(0,rr.default)(n).locale("fa"):i=this._createMoment(n).locale(this.locale)}return i&&this.isValid(i)?i:super.deserialize(n)}_createMoment(...n){return this.options&&this.options.useUtc?rr.default.utc(...n):(0,rr.default)(...n)}};Zp=z0([gl(0,Gu()),gl(0,$f(Ko)),gl(1,Gu()),gl(1,$f(QP))],Zp);var ed=class{constructor(){d(this,"userStateService",T(hi));d(this,"cache",new Map)}shouldReuseRoute(e,n){var i,r,s;if(this.isLeavingContentEdit(e,n)){let o=(i=this.userStateService.userDataSnapshot)==null?void 0:i.uniqeName;o&&this.cache.delete(o)}return e.routeConfig===n.routeConfig&&((s=(r=e==null?void 0:e.parent)==null?void 0:r.routeConfig)==null?void 0:s.path)!=="profile"}isLeavingContentEdit(e,n){var s,o,a,l;let i=(s=n.routeConfig)==null?void 0:s.path,r=(o=e.routeConfig)==null?void 0:o.path;return i==="edit"&&r!=="edit"||i==="create"&&((l=(a=n.parent)==null?void 0:a.routeConfig)==null?void 0:l.path)==="reviews"&&r!=="create"}shouldAttach(e){var s,o;let n=(o=(s=e.parent)==null?void 0:s.url[0])==null?void 0:o.path,i=e.paramMap.get("id"),r=i;return n==="profile"&&!!i&&this.cache.has(r)}retrieve(e){let i=e.paramMap.get("id");return this.cache.get(i)}shouldDetach(e){var r,s;let n=(s=(r=e.parent)==null?void 0:r.url[0])==null?void 0:s.path,i=e.paramMap.get("id");return n==="profile"&&!!i}store(e,n){var s;let i=e.paramMap.get("id"),r=i;((s=this.userStateService.userDataSnapshot)==null?void 0:s.uniqeName)!==i&&this.cache.forEach((o,a)=>{var l;a!==((l=this.userStateService.userDataSnapshot)==null?void 0:l.uniqeName)&&this.cache.delete(a)}),this.cache.set(r,n)}};var JP="firebase",ZP="11.10.0";Bn.registerVersion(JP,ZP,"app-compat");var eD=["ngOnDestroy"],td=(t,e,n,i={})=>new Proxy(t,{get:(r,s)=>n.runOutsideAngular(()=>{var a;if(t[s])return(a=i==null?void 0:i.spy)!=null&&a.get&&i.spy.get(s,t[s]),t[s];if(eD.indexOf(s)>-1)return()=>{};let o=e.toPromise().then(l=>{let c=l==null?void 0:l[s];return typeof c=="function"?c.bind(l):c!=null&&c.then?c.then(u=>n.run(()=>u)):n.run(()=>c)});return new Proxy(()=>{},{get:(l,c)=>o[c],apply:(l,c,u)=>o.then(p=>{var f;let m=p==null?void 0:p(...u);return(f=i==null?void 0:i.spy)!=null&&f.apply&&i.spy.apply(s,u,m),m})})})});var Kh=class{constructor(e){return e}},as=new gt("angularfire2.app.options"),sa=new gt("angularfire2.app.name");function oa(t,e,n){let i=typeof n=="string"&&n||"[DEFAULT]",r=typeof n=="object"&&n||{};r.name=r.name||i;let o=Bn.apps.filter(a=>a&&a.name===r.name)[0]||e.runOutsideAngular(()=>Bn.initializeApp(t,r));try{if(JSON.stringify(t)!==JSON.stringify(o.options)){let a=!!module.hot;tD("error","".concat(o.name," Firebase App already initialized with different options").concat(a?", you may 
3need to reload as Firebase is not HMR aware.":"."))}}catch{}return new Kh(o)}var tD=(t,...e)=>{vl()&&typeof console<"u"&&console[t](...e)};function aa(t,e,n,i,r){let[,s,o]=globalThis.\u0275AngularfireInstanceCache.find(a=>a[0]===t)||[];if(s)return nD(r,o)||(hI("error","".concat(e," was already initialized on the ").concat(n," Firebase App with different settings.").concat(iD?" You may need to reload as Firebase is not HMR aware.":"")),hI("warn",{is:r,was:o})),s;{let a=i();return globalThis.\u0275AngularfireInstanceCache.push([t,a,r]),a}}function nD(t,e){try{return t.toString()===e.toString()}catch{return t===e}}var iD=typeof module<"u"&&!!module.hot,hI=(t,...e)=>{vl()&&typeof console<"u"&&console[t](...e)};globalThis.\u0275AngularfireInstanceCache||(globalThis.\u0275AngularfireInstanceCache=[]);var B=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var z=globalThis;var sr="10.70.0";function vn(){return kr(z),z}function kr(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||sr,e[sr]=e[sr]||{}}function Bi(t,e,n=z){let i=n.__SENTRY__=n.__SENTRY__||{},r=i[sr]=i[sr]||{};return r[t]||(r[t]=e())}var la=["debug","info","warn","error","log","assert","trace"],rD="Sentry Logger ",Qs={};function Bt(t){if(!("console"in z))return t();let e=z.console,n={},i=Object.keys(Qs);i.forEach(r=>{let s=Qs[r];n[r]=e[r],e[r]=s});try{return t()}finally{i.forEach(r=>{e[r]=n[r]})}}function sD(){Xh().enabled=!0}function oD(){Xh().enabled=!1}function gI(){return Xh().enabled}function aD(...t){Qh("log",...t)}function lD(...t){Qh("warn",...t)}function cD(...t){Qh("error",...t)}function Qh(t,...e){B&&gI()&&Bt(()=>{z.console[t]("".concat(rD,"[").concat(t,"]:"),...e)})}function Xh(){return B?Bi("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var C={enable:sD,disable:oD,isEnabled:gI,log:aD,warn:lD,error:cD};var _I=/\(error: (.*)\)/,yI=/captureMessage|captureException/;function Hl(...t){let e=t.sort((n,i)=>n[0]-i[0]).map(n=>n[1]);return(n,i=0,r=0)=>{let s=[],o=n.split("\n");for(let a=i;a<o.length;a++){let l=o[a];l.length>1024&&(l=l.slice(0,1024));let c=_I.test(l)?l.replace(_I,"$1"):l;if(!c.includes("Error: ")){for(let u of e){let p=u(c);if(p){s.push(p);break}}if(s.length>=50+r)break}}return Zh(s.slice(r))}}function id(t){return Array.isArray(t)?Hl(...t):t}function Zh(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(nd(e).function||"")&&e.pop(),e.reverse(),yI.test(nd(e).function||"")&&(e.pop(),yI.test(nd(e).function||"")&&e.pop()),e.slice(0,50).map(n=>D(g({},n),{filename:n.filename||nd(e).filename,function:n.function||"?"}))}function nd(t){return t[t.length-1]||{}}var Jh="<anonymous>";function Sn(t){try{return!t||typeof t!="function"?Jh:t.name||Jh}catch{return Jh}}function ql(t){let e=t.exception;if(e){let n=[];try{return e.values.forEach(i=>{i.stacktrace.frames&&n.push(...i.stacktrace.frames)}),n}catch{return}}}var jl={},bI={};function cn(t,e){return jl[t]=jl[t]||[],jl[t].push(e),()=>{let n=jl[t];if(n){let i=n.indexOf(e);i!==-1&&n.splice(i,1)}}}function un(t,e){if(!bI[t]){bI[t]=!0;try{e()}catch(n){B&&C.error("Error while instrumenting ".concat(t),n)}}}function Rt(t,e){let n=t&&jl[t];if(n)for(let i of n)try{i(e)}catch(r){B&&C.error("Error while triggering instrumentation handler.\nType: ".concat(t,"\nName: ").concat(Sn(i),"\nError:"),r)}}var eg=null;function Gl(t){let e="error";cn(e,t),un(e,uD)}function uD(){eg=z.onerror,z.onerror=function(t,e,n,i,r){return Rt("error",{column:i,error:r,line:n,msg:t,url:e}),eg?eg.apply(this,arguments):!1},z.onerror.__SENTRY_INSTRUMENTED__=!0}var tg=null;function Wl(t){let e="unhandledrejection";cn(e,t),un(e,pD)}function pD(){tg=z.onunhandledrejection,z.onunhandledrejection=function(t){return Rt("unhandledrejection",t),tg?tg.apply(this,arguments):!0},z.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var vI=Object.prototype.toString;function pn(t){switch(vI.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Xs(t,Error)}}function ca(t,e){return vI.call(t)==="[object ".concat(e,"]")}function ua(t){return ca(t,"ErrorEvent")}function Vl(t){return ca(t,"DOMError")}function rd(t){return ca(t,"DOMException")}function Ot(t){return ca(t,"String")}function ls(t){return typeof t=="object"&&t!==null&&"__sentry_template_str
3ing__"in t&&"__sentry_template_values__"in t}function jn(t){return t===null||ls(t)||typeof t!="object"&&typeof t!="function"}function or(t){return ca(t,"Object")}function Jn(t){return typeof t=="object"&&t!==null}function cs(t){return typeof Event<"u"&&Xs(t,Event)}function sd(t){return ca(t,"RegExp")}function Hi(t){return!!(t!=null&&t.then&&typeof t.then=="function")}function Xs(t,e){try{return t instanceof e}catch{return!1}}function zl(t){return typeof Request<"u"&&Xs(t,Request)}function Tt(t,e,n){if(!(e in t))return;let i=t[e];if(typeof i!="function")return;let r=n(i);typeof r=="function"&&Yl(r,i);try{t[e]=r}catch{B&&C.log('Failed to replace method "'.concat(e,'" in object'),t)}}function et(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{B&&C.log('Failed to add non-enumerable property "'.concat(String(e),'" to object'),t)}}function Yl(t,e){try{let n=e.prototype||{};t.prototype=e.prototype=n,et(t,"__sentry_original__",e)}catch{}}function us(t){return t.__sentry_original__}function $l(t){if(pn(t))return g({message:t.message,name:t.name,stack:t.stack},SI(t));if(cs(t)){let{type:e,target:n,currentTarget:i,detail:r}=t;return g(g({type:e,target:n,currentTarget:i},r?{detail:r}:{}),SI(t))}return t}function SI(t){return Jn(t)?Object.fromEntries(Object.entries(t)):{}}function od(t){let e=Object.keys($l(t));return e.sort(),e[0]?e.join(", "):"[object has no keys]"}var pa;function Js(t){if(pa!==void 0)return pa?pa(t):t();let e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=z;return e in n&&typeof n[e]=="function"?(pa=n[e],pa(t)):(pa=null,t())}function vi(){return Js(()=>Math.random())}function Si(){return Js(()=>Date.now())}var dD=Symbol.for("sentry.skipNormalization"),mD=Symbol.for("sentry.overrideNormalizationDepth");function EI(t){return!!t[dD]}function TI(t){let e=t[mD];return typeof e=="number"?e:void 0}var ng;function ad(t){ng=t}function dn(t,e=100,n=1/0){try{return ig("",t,e,n)}catch(i){return{ERROR:"**non-serializable** (".concat(i,")")}}}function Kl(t,e=3,n=100*1024){let i=dn(t,e);return gD(i)>n?Kl(t,e-1,n):i}function ig(t,e,n=1/0,i=1/0,r=_D()){let[s,o]=r;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=rg(t,e);if(!a.startsWith("[object "))return a;if(EI(e))return e;let l=TI(e),c=l!==void 0?l:n;if(c===0)return a.replace("object ","");if(s(e))return"[Circular ~]";let u=e;if(u&&typeof u.toJSON=="function")try{let h=u.toJSON();return ig("",h,c-1,i,r)}catch{}let p=Array.isArray(e)?[]:{},m=0,f=$l(e);for(let h in f){if(!Object.prototype.hasOwnProperty.call(f,h))continue;if(m>=i){p[h]="[MaxProperties ~]";break}let _=f[h];p[h]=ig(h,_,c-1,i,r),m++}return o(e),p}function rg(t,e){try{if(ng){let i=ng(e);if(i)return i}if(typeof global<"u"&&e===global)return"[Global]";if(typeof e=="number"&&!Number.isFinite(e))return"[".concat(e,"]");if(typeof e=="function")return"[Function: ".concat(Sn(e),"]");if(typeof e=="symbol")return"[".concat(String(e),"]");if(typeof e=="bigint")return"[BigInt: ".concat(String(e),"]");let n=fD(e);return"[object ".concat(n,"]")}catch(n){return"**non-serializable** (".concat(n,")")}}function fD(t){let e=Object.getPrototypeOf(t);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function hD(t){return~-encodeURI(t).split(/%..|./).length}function gD(t){return hD(JSON.stringify(t))}function _D(){let t=new WeakSet;function e(i){return t.has(i)?!0:(t.add(i),!1)}function n(i){t.delete(i)}return[e,n]}function Zs(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:"".concat(t.slice(0,e),"...")}function ps(t,e){if(!Array.isArray(t))return"";let n=[];for(let i=0;i<t.length;i++){let r=t[i];jn(r)?n.push(String(r)):r instanceof Error?n.push(r.message?"".concat(r.name,": ").concat(r.message):r.name):n.push(rg(void 0,r))}return n.join(e)}function ds(t,e,n=!1){return Ot(t)?sd(e)?e.test(t):Ot(e)?n?t===e:t.includes(e):typeof e=="function"?e(t):!1:!1}function rn(t,e=[],n=!1){for(let i of e)if(ds(t,i,n))return!0;return!1}function yD(){let t=z;return t.crypto||t.msCrypto}var sg;function bD(){return vi()*16}function It(t=yD()){try{if(t!=null&&t.randomUUID)return Js(()=>t.randomUUID()).replace(/-/g,"")}catch{}return sg||(sg="10000000100040008000"+1e11),sg.replace(/[018]/g,e=>(e^(bD()&15)>>e/4).toString(16))}function II(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}function qi(t){let{message:e,event_id:n}=t;if(e)return e;let i=II(t);return i?i.type&&i.value?"".concat(i.type,": ").concat(i.value):i.t
3ype||i.value||n||"<unknown>":n||"<unknown>"}function eo(t,e,n){let i=t.exception=t.exception||{},r=i.values=i.values||[],s=r[0]=r[0]||{};s.value||(s.value=e||""),s.type||(s.type=n||"Error")}function mn(t,e){let n=II(t);if(!n)return;let i={type:"generic",handled:!0},r=n.mechanism;if(n.mechanism=g(g(g({},i),r),e),e&&"data"in e){let s=g(g({},r==null?void 0:r.data),e.data);n.mechanism.data=s}}function Ql(t){if(og(t))return!0;try{et(t,"__sentry_captured__",!0)}catch{}return!1}function og(t){try{return t.__sentry_captured__}catch{}}var CI=1e3;function Gn(){return Si()/CI}function vD(){let{performance:t}=z;if(!(t!=null&&t.now)||!t.timeOrigin)return Gn;let e=t.timeOrigin;return()=>(e+Js(()=>t.now()))/CI}var ld;function Ve(){return(ld!=null?ld:ld=vD())()}var ag=null;function SD(){var o;let{performance:t}=z;if(!(t!=null&&t.now))return;let e=3e5,n=Js(()=>t.now()),i=Si(),r=t.timeOrigin;if(typeof r=="number"&&Math.abs(r+n-i)<e)return r;let s=(o=t.timing)==null?void 0:o.navigationStart;return typeof s=="number"&&Math.abs(s+n-i)<e?s:i-n}function tt(){return ag===null&&(ag=SD()),ag}function wI(t){let e=Ve(),n={sid:It(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>ED(n)};return t&&Rr(n,t),n}function Rr(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Ve(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:It()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did="".concat(e.did)),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function xI(t,e){let n={};e?n={status:e}:t.status==="ok"&&(n={status:"exited"}),Rr(t,n)}function ED(t){return{sid:"".concat(t.sid),init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?"".concat(t.did):void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function ms(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;let i=g({},t);for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=ms(i[r],e[r],n-1));return i}function En(){return It()}function fn(){return It().substring(16)}function cd(t){try{let e=z.WeakRef;if(typeof e=="function")return new e(t)}catch{}return t}function ud(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch{return}return t}}var lg="_sentrySpan";function fs(t,e){e?et(t,lg,cd(e)):delete t[lg]}function to(t){return ud(t[lg])}var TD=100,Wn=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:En(),sampleRand:vi()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags=g({},this._tags),e._attributes=g({},this._attributes),e._extra=g({},this._extra),e._contexts=g({},this._contexts),this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata=g({},this._sdkProcessingMetadata),e._propagationContext=g({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,fs(e,to(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Rr(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags=g(g({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes=g(g({},this._attributes),e),this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra=g(g({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,n){return this._extra=D(g({},this._extra),{[e]:n}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let n=typeof e=="function"?e(this):e,i=n instanceof t?n.getScopeData():or(n)?e:void 0,{tags:r,attributes:s,extra:o,user:a,contexts:l,level:c,fingerprint:u=[],propagationContext:p,conversationId:m}=i||{};return this._tags=g(g({},this._tags),r),this._attributes=g(g({},this._attributes),s),this._extra=g(g({},this._extra),o),this._contexts=g(g({},this._contexts),l),a&&Object.keys(a).length&&(this._user=a),c&&(this._level=c),u.length&&(this._fingerprint=u),p&&(this._propagationContext=p),m&&(this._conversationId=m),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,fs(this,void 0),this._attachments=[],this.setPropagationContext({traceId:En(),sampleRand:vi()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){var s;let i=typeof n=="number"?n:TD;if(i<=0)return this;let r=D(g({timestamp:Gn()},e),{message:e.message?Zs(e.message,2048):e.message});return this._breadcrumbs.push(r),this._breadcrumbs.length>i&&(this._breadcrumbs=this._breadcrumbs.slice(-i),(s=this._client)==null||s.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:to(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ms(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){let i=(n==null?void 0:n.event_id)||It();if(!this._client)return B&&C.warn("No client configured on scope - will not capture exception!"),i;let r=new Error("Sentry syntheticException");return this._client.captureException(e,D(g({originalException:e,syntheticException:r},n),{event_id:i}),this),i}captureMessage(e,n,i){var o;let r=(i==null?void 0:i.event_id)||It();if(!this._client)return B&&C.warn("No client configured on scope - will not capture message!"),r;let s=(o=i==null?void 0:i.syntheticException)!=null?o:new Error(e);return this._client.captureMessage(e,n,D(g({originalException:e,syntheticException:s},i),{event_id:r}),this),r}
3captureEvent(e,n){let i=e.event_id||(n==null?void 0:n.event_id)||It();return this._client?(this._client.captureEvent(e,D(g({},n),{event_id:i}),this),i):(B&&C.warn("No client configured on scope - will not capture event!"),i)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function AI(){return Bi("defaultCurrentScope",()=>new Wn)}function kI(){return Bi("defaultIsolationScope",()=>new Wn)}var RI=t=>t instanceof Promise&&!t[OI],OI=Symbol("chained PromiseLike"),NI=(t,e,n)=>{let i=t.then(r=>(e(r),r),r=>{throw n(r),r});return RI(i)&&RI(t)?i:ID(t,i)},ID=(t,e)=>{if(!e)return t;let n=!1;for(let i in t){if(i in e)continue;n=!0;let r=t[i];typeof r=="function"?Object.defineProperty(e,i,{value:(...s)=>r.apply(t,s),enumerable:!0,configurable:!0,writable:!0}):e[i]=r}return n&&Object.assign(e,{[OI]:!0}),e};var cg=class{constructor(e,n){let i;e?i=e:i=new Wn;let r;n?r=n:r=new Wn,this._stack=[{scope:i}],this._isolationScope=r}withScope(e){let n=this._pushScope(),i;try{i=e(n)}catch(r){throw this._popScope(),r}return Hi(i)?NI(i,()=>this._popScope(),()=>this._popScope()):(this._popScope(),i)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function da(){let t=vn(),e=kr(t);return e.stack=e.stack||new cg(AI(),kI())}function CD(t){return da().withScope(t)}function wD(t,e){let n=da();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function MI(t){return da().withScope(()=>t(da().getIsolationScope()))}function PI(){return{withIsolationScope:MI,withScope:CD,withSetScope:wD,withSetIsolationScope:(t,e)=>MI(e),getCurrentScope:()=>da().getScope(),getIsolationScope:()=>da().getIsolationScope()}}function ar(t){let e=kr(t);return e.acs?e.acs:PI()}function xD(t){return typeof t=="object"&&t!=null&&!Array.isArray(t)&&Object.keys(t).includes("value")}function AD(t,e){var a;let{value:n,unit:i}=xD(t)?t:{value:t,unit:void 0},r=kD(n),s=i&&typeof i=="string"?{unit:i}:{};if(r)return g(g({},r),s);if(!e||e==="skip-undefined"&&n===void 0)return;let o="";try{o=(a=JSON.stringify(n))!=null?a:""}catch{}return g({value:o,type:"string"},s)}function ug(t,e=!1){let n={};for(let[i,r]of Object.entries(t!=null?t:{})){let s=AD(r,e);s&&(n[i]=s)}return n}function kD(t){if(Array.isArray(t))return{value:t,type:"array"};let e=typeof t=="string"?"string":typeof t=="boolean"?"boolean":typeof t=="number"&&!Number.isNaN(t)?Number.isInteger(t)?"integer":"double":null;if(e)return{value:t,type:e}}var pd;function pg(){return pd==null?void 0:pd()}function dd(){return pd!==void 0}function te(){let t=vn();return ar(t).getCurrentScope()}function st(){let t=vn();return ar(t).getIsolationScope()}function Xl(){return Bi("globalScope",()=>new Wn)}function lr(...t){let e=vn(),n=ar(e);if(t.length===2){let[i,r]=t;return i?n.withSetScope(i,r):n.withScope(r)}return n.withScope(t[0])}function G(){return te().getClient()}function md(t){let e=pg();if(e)return{trace_id:e.traceId,span_id:e.spanId};let n=t.getPropagationContext(),{traceId:i,parentSpanId:r,propagationSpanId:s}=n,o={trace_id:i,span_id:s||fn()};return r&&(o.parent_span_id=r),o}var dt="sentry.source",Or="sentry.sample_rate",ma="sentry.previous_trace_sample_rate",ot="sentry.op",Oe="sentry.origin",fd="sentry.status.message",Nr="sentry.idle_span_finish_reason",ji="sentry.measurement_unit",Gi="sentry.measurement_value";var fa="sentry.custom_span_name",no="sentry.profile_id",hn="sentry.exclusive_time";var hd="sentry.link.type",gd="gen_ai.conversation.id";function dg(t){if(t<400&&t>=100)return{code:1};if(t>=400&&t<500)switch(t){case 401:return{code:2,message:"unauthenticated"};case 403:return{code:2,message:"permission_denied"};case 404:return{code:2,message:"not_found"};case 409:return{code:2,message:"already_exists"};case 413:return{code:2,message:"failed_precondition"};case 429:return{code:2,message:"resource_exhausted"};case 499:return{code:2,message:"cancelled"};default:return{code:2,message:"invalid_argument"}}if(t>=500&&t<600)switch(t){case 501:return{code:2,message:"unimplemented"};case 503:return{code:2,message:"unavailable"};case 504:return{code:2,message:"deadline_exceeded"};default:return{code:2,message:"internal_error"}}return{code:2,message:"internal_error"}}function ha(t,e){t.setAttribute("http.response.status_code",e);let n=dg(e);n.message!=="unknown_error"&&t.setStatus(n)}var DI="_sentryScope",LI="_sentryIsolationScope",RD=Symbol.for("sentry.otelSourceInference"),OD=Symbol.for("sentry.otelSourceExplicitlySet"),ND=Symbol.for("sentry.tracerProviderSpan");function hs(t,e,n){t&&(et(t,LI,cd(n)),et(t,DI,e))}function Mr(t){let e=t;return{scope:e[DI],isolationScope:ud(e[LI])}}function mg(t){return t[RD]===!0}function FI(t){et(t,OD,!0)}function fg(t){return t[ND]===!0}var Jl="sentry-";var MD=8192;function _d(t){let e=PD(t);if(!e)return;let n=Object.entries(e).reduce((i,[r,s])=>{if(r.startsWith(Jl)){let o=r.slice(Jl.length);i[o]=s}return i},{});if(Object.keys(n).length>0)return n}function hg(t){if(!t)return;let e=Object.entries(t).reduce((n,[i,r])=>(r&&(n["".concat(Jl).concat(i)]=r),n),{});return DD(e)}function PD(t){if(!(!t||!Ot(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{let i=UI(n);
3return Object.entries(i).forEach(([r,s])=>{e[r]=s}),e},{}):UI(t)}function UI(t){return t.split(",").map(e=>{let n=e.indexOf("=");if(n===-1)return[];let i=e.slice(0,n),r=e.slice(n+1);return[i,r].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((e,[n,i])=>(n&&i&&(e[n]=i),e),{})}function DD(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,i],r)=>{let s="".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(i)),o=r===0?s:"".concat(e,",").concat(s);return o.length>MD?(B&&C.warn("Not adding key: ".concat(n," with val: ").concat(i," to baggage header due to exceeding baggage size limits.")),e):o},"")}var LD=/^o(\d+)\./,FD=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function UD(t){return t==="http"||t==="https"}function Zn(t,e=!1){let{host:n,path:i,pass:r,port:s,projectId:o,protocol:a,publicKey:l}=t;return"".concat(a,"://").concat(l).concat(e&&r?":".concat(r):"","@").concat(n).concat(s?":".concat(s):"","/").concat(i&&"".concat(i,"/")).concat(o)}function BD(t){let e=FD.exec(t);if(!e){Bt(()=>{console.error("Invalid Sentry Dsn: ".concat(t))});return}let[n,i,r="",s="",o="",a=""]=e.slice(1),l="",c=a,u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){let p=c.match(/^\d+/);p&&(c=p[0])}return BI({host:s,pass:r,path:l,projectId:c,port:o,protocol:n,publicKey:i})}function BI(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function HD(t){if(!B)return!0;let{port:e,projectId:n,protocol:i}=t;return["protocol","publicKey","host","projectId"].find(o=>t[o]?!1:(C.error("Invalid Sentry Dsn: ".concat(o," missing")),!0))?!1:n.match(/^\d+$/)?UD(i)?e&&isNaN(parseInt(e,10))?(C.error("Invalid Sentry Dsn: Invalid port ".concat(e)),!1):!0:(C.error("Invalid Sentry Dsn: Invalid protocol ".concat(i)),!1):(C.error("Invalid Sentry Dsn: Invalid projectId ".concat(n)),!1)}function qD(t){let e=t.match(LD);return e==null?void 0:e[1]}function HI(t){let e=t.getOptions(),{host:n}=t.getDsn()||{},i;return e.orgId?i=String(e.orgId):n&&(i=qD(n)),i}function yd(t){let e=typeof t=="string"?BD(t):BI(t);if(!(!e||!HD(e)))return e}function ei(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var bd=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function qI(t){if(!t)return;let e=t.match(bd);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function gg(t,e){let n=qI(t),i=_d(e);if(!(n!=null&&n.traceId))return{traceId:En(),sampleRand:vi()};let r=jD(n,i);i&&(i.sample_rand=r.toString());let{traceId:s,parentSpanId:o,parentSampled:a}=n;return{traceId:s,parentSpanId:o,sampled:a,dsc:i||{},sampleRand:r}}function Zl(t=En(),e=fn(),n){let i="";return n!==void 0&&(i=n?"-1":"-0"),"".concat(t,"-").concat(e).concat(i)}function ec(t=En(),e=fn(),n){return"00-".concat(t,"-").concat(e,"-").concat(n?"01":"00")}function jD(t,e){let n=ei(e==null?void 0:e.sample_rand);if(n!==void 0)return n;let i=ei(e==null?void 0:e.sample_rate);return i&&(t==null?void 0:t.parentSampled)!==void 0?t.parentSampled?vi()*i:i+vi()*(1-i):vi()}var vd=0,nc=1,jI=!1;function VI(t){let{spanId:e,traceId:n}=t.spanContext(),{data:i,op:r,parent_span_id:s,status:o,origin:a,links:l}=ne(t);return{parent_span_id:s,span_id:e,trace_id:n,data:i,op:r,status:o,origin:a,links:l}}function Sd(t){let{spanId:e,traceId:n,isRemote:i}=t.spanContext(),r=i?e:ne(t).parent_span_id,s=Mr(t).scope,o=i?(s==null?void 0:s.getPropagationContext().propagationSpanId)||fn():e;return{parent_span_id:r,span_id:o,trace_id:n}}function ic(t){let{traceId:e,spanId:n}=t.spanContext(),i=zn(t);return Zl(e,n,i)}function zI(t){let{traceId:e,spanId:n}=t.spanContext(),i=zn(t);return ec(e,n,i)}function rc(t){if(t&&t.length>0)return t.map(o=>{var a=o,{context:l}=a,c=l,{spanId:e,traceId:n,traceFlags:i}=c,r=Lo(c,["spanId","traceId","traceFlags"]),{attributes:s}=a;return g({span_id:e,trace_id:n,sampled:i===nc,attributes:s},r)})}function bg(t){if(t!=null&&t.length)return t.map(({context:{spanId:e,traceId:n,traceFlags:i},attributes:r})=>({span_id:e,trace_id:n,sampled:i===nc,attributes:r}))}function Vn(t){return typeof t=="number"?GI(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?GI(t.getTime()):Ve()}function GI(t){return t>9999999999?t/1e3:t}function ne(t){if(Ed(t))return t.getSpanJSON();let{spanId:e,traceId:n}=t.spanContext();if(KI(t)){let{attributes:i,startTime:r,name:s,endTime:o,status:a,links:l}=t;return{span_id:e,trace_id:n,data:i,description:s,parent_span_id:YI(t),start_timestamp:Vn(r),timestamp:Vn(o)||void 0,status:oc(a),op:i[ot],origin:i[Oe],links:rc(l)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function sc(t){if(Ed(t))return t.getStreamedSpanJSON();let{spanId:e,traceId:n}=t.spanContext();if(KI(t)){let{attributes:i,startTime:r,name:s,endTime:o,status:a,links:l}=t;return{name:s,span_id:e,trace_id:n,parent_span_id:YI(t),start_timestamp:Vn(r),end_timestamp:Vn(o),is_segment:t===tc(t),status:Td(a),attributes:vg(i,a),links:bg(l)}}return{span_id:e,trace_id:n,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:t===tc(t)}}function YI(t){var e;return"parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?(e=t.parentSpanContext)==null?void 0:e.spanId:void 0}function $I(t){var e;return D(g({},t),{attributes:ug(t.attributes),links:(e=t.links)==null?void 0:e.map(n=>D(g({},n),{attributes:ug(n.attributes)}))})}function KI(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Ed(t){return typeof t.getSpanJSON=="function"}function zn(t){let{traceFlags:e}=t.spanContext();return e===nc}function oc(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"internal_error"}function Td(t){return!t||t.code===1||t.code===0||t.message==="cancelled"?"ok":"error"}function vg(t,e){let n=Td(e)==="error"?e==null?void 0:e.message:void 0;return g(g({},n&&{[fd]:n}),t)}var io="_sentryChildSpans",_g="_sentryRootSpan";function ro(t,e){let n=t[_g]||t;
3et(e,_g,n),t[io]?t[io].add(e):et(t,io,new Set([e]))}function QI(t,e){t[io]&&t[io].delete(e)}function Pr(t){let e=new Set;function n(i){if(!e.has(i)&&zn(i)){e.add(i);let r=i[io]?Array.from(i[io]):[];for(let s of r)n(s)}}return n(t),Array.from(e)}var Ue=tc;function tc(t){return t[_g]||t}function Ge(){let t=vn(),e=ar(t);return e.getActiveSpan?e.getActiveSpan():to(te())}function ac(){jI||(Bt(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),jI=!0)}var XI=!1;function Id(){if(XI)return;function t(){let e=Ge(),n=e&&Ue(e);if(n){let i="internal_error";B&&C.log("[Tracing] Root span: ".concat(i," -> Global error occurred")),n.setStatus({code:2,message:i})}}XI=!0,Gl(t),Wl(t)}function Ct(t){var n;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||((n=G())==null?void 0:n.getOptions());return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function JI(t){C.log("Ignoring span ".concat(t.op," - ").concat(t.description," because it matches `ignoreSpans`."))}function Dr(t,e){if(!(e!=null&&e.length))return!1;for(let n of e){if(WD(n)){if(t.description&&ds(t.description,n))return B&&JI(t),!0;continue}let i=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!i)continue;let r=n.name?t.description&&ds(t.description,n.name):!0,s=n.op?t.op&&ds(t.op,n.op):!0,o=n.attributes?Object.entries(n.attributes).every(([a,l])=>{var c;return GD((c=t.attributes)==null?void 0:c[a],l)}):!0;if(r&&s&&o)return B&&JI(t),!0}return!1}function GD(t,e){return typeof t=="string"&&(typeof e=="string"||e instanceof RegExp)?ds(t,e):Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((n,i)=>n===e[i]):t===e}function ZI(t,e){let n=e.parent_span_id,i=e.span_id;if(n)for(let r of t)r.parent_span_id===i&&(r.parent_span_id=n)}function WD(t){return typeof t=="string"||t instanceof RegExp}var eC=Symbol.for("sentry.nonRecordingSpan"),Yn=class{constructor(e={}){this._traceId=e.traceId||En(),this._spanId=e.spanId||fn(),this.dropReason=e.dropReason,et(this,eC,!0)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:vd}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,i){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}};function cr(t){return!!t&&t[eC]===!0}var ga="production";var tC="_frozenDsc";function Sg(t,e){et(t,tC,e)}function Cd(t,e){let n=e.getOptions(),{publicKey:i}=e.getDsn()||{},r={environment:n.environment||ga,release:n.release,public_key:i,trace_id:t,org_id:HI(e)};return e.emit("createDsc",r),r}function oo(t,e){let n=e.getPropagationContext();return n.dsc||Cd(n.traceId,t)}function sn(t){var v,I,N,j,P;let e=G();if(!e)return{};let n=Ue(t),i=ne(n),r=i.data,s=n.spanContext().traceState,o=(I=(v=s==null?void 0:s.get("sentry.sample_rate"))!=null?v:r[Or])!=null?I:r[ma];function a(X){return(typeof o=="number"||typeof o=="string")&&(X.sample_rate="".concat(o)),X}let l=n[tC];if(l)return a(l);let c=cr(n),u=c&&n.dropReason==="ignored";if(c&&(!Ct(e.getOptions())||u)){let X=Mr(n).scope;if(X){let V=g({},oo(e,X));return u&&(V.sampled="false"),a(V)}}let p=s==null?void 0:s.get("sentry.dsc"),m=p&&_d(p);if(m)return a(m);let f=Cd(t.spanContext().traceId,e),h=(N=r[dt])!=null?N:r["sentry.segment.name.source"],_=i.description;return h!=="url"&&_&&(f.transaction=_),Ct()&&(f.sampled=String(zn(n)),f.sample_rand=(P=s==null?void 0:s.get("sentry.sample_rand"))!=null?P:(j=Mr(n).scope)==null?void 0:j.getPropagationContext().sampleRand.toString()),a(f),e.emit("createDsc",f,n),f}function wd(t){return!!t&&typeof t=="function"&&"_streamed"in t&&!!t._streamed}function Tn(t,e=[]){return[t,e]}function xd(t,e){let[n,i]=t;return[n,[...i,e]]}function lc(t,e){let n=t[1];for(let i of n){let r=i[0].type;if(e(i,r))return!0}return!1}function Tg(t,e){return lc(t,(n,i)=>e.includes(i))}function Eg(t){let e=kr(z);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function Ig(t){let[e,n]=t,i=JSON.stringify(e);function r(s){typeof i=="string"?i=typeof s=="string"?i+s:[Eg(i),s]:i.push(typeof s=="string"?Eg(s):s)}for(let s of n){let[o,a]=s;
3if(r("\n".concat(JSON.stringify(o),"\n")),typeof a=="string"||a instanceof Uint8Array)r(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(dn(a))}r(l)}}return typeof i=="string"?i:VD(i)}function VD(t){let e=t.reduce((r,s)=>r+s.length,0),n=new Uint8Array(e),i=0;for(let r of t)n.set(r,i),i+=r.length;return n}function Cg(t){return[{type:"span"},t]}function wg(t){let e=typeof t.data=="string"?Eg(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var nC={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function zD(t){return t in nC}function Ad(t){return zD(t)?nC[t]:t}function _a(t){if(!(t!=null&&t.sdk))return;let{name:e,version:n}=t.sdk;return{name:e,version:n}}function cc(t,e,n,i){var s;let r=(s=t.sdkProcessingMetadata)==null?void 0:s.dynamicSamplingContext;return g(g(g({event_id:t.event_id,sent_at:new Date(Si()).toISOString()},e&&{sdk:e}),!!n&&i&&{dsn:Zn(i)}),r&&{trace:r})}function YD(t,e){var i,r,s,o;if(!e)return t;let n=t.sdk||{};return t.sdk=D(g({},n),{name:n.name||e.name,version:n.version||e.version,integrations:[...((i=t.sdk)==null?void 0:i.integrations)||[],...e.integrations||[]],packages:[...((r=t.sdk)==null?void 0:r.packages)||[],...e.packages||[]],settings:(s=t.sdk)!=null&&s.settings||e.settings?g(g({},(o=t.sdk)==null?void 0:o.settings),e.settings):void 0}),t}function iC(t,e,n,i){let r=_a(n),s=g(g({sent_at:new Date(Si()).toISOString()},r&&{sdk:r}),!!i&&e&&{dsn:Zn(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return Tn(s,[o])}function rC(t,e,n,i){let r=_a(n),s=t.type&&t.type!=="replay_event"?t.type:"event";YD(t,n==null?void 0:n.sdk);let o=cc(t,r,i,e);return delete t.sdkProcessingMetadata,Tn(o,[[{type:s},t]])}function sC(t,e){function n(f){return!!f.trace_id&&!!f.public_key}let i=sn(t[0]),r=e==null?void 0:e.getDsn(),s=e==null?void 0:e.getOptions().tunnel,o=g(g({sent_at:new Date(Si()).toISOString()},n(i)&&{trace:i}),!!s&&r&&{dsn:Zn(r)}),{beforeSendSpan:a,ignoreSpans:l}=(e==null?void 0:e.getOptions())||{},c=l!=null&&l.length?t.filter(f=>{let h=ne(f);return!Dr({description:h.description,op:h.op,attributes:h.data},l)}):t,u=t.length-c.length;u&&(e==null||e.recordDroppedEvent("before_send","span",u));let p=a?f=>{let h=ne(f),_=wd(a)?h:a(h);return _||(ac(),h)}:ne,m=[];for(let f of c){let h=p(f);h&&m.push(Cg(h))}return Tn(o,m)}function oC(t){if(!B)return;let{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:i}=ne(t),{spanId:r}=t.spanContext(),s=zn(t),o=Ue(t),a=o===t,l="[Tracing] Starting ".concat(s?"sampled":"unsampled"," ").concat(a?"root ":"","span"),c=["op: ".concat(n),"name: ".concat(e),"ID: ".concat(r)];if(i&&c.push("parent ID: ".concat(i)),!a){let{op:u,description:p}=ne(o);c.push("root ID: ".concat(o.spanContext().spanId)),u&&c.push("root op: ".concat(u)),p&&c.push("root description: ".concat(p))}C.log("".concat(l,"\n  ").concat(c.join("\n  ")))}function aC(t){if(!B)return;let{description:e="< unknown name >",op:n="< unknown op >"}=ne(t),{spanId:i}=t.spanContext(),s=Ue(t)===t,o='[Tracing] Finishing "'.concat(n,'" ').concat(s?"root ":"",'span "').concat(e,'" with ID ').concat(i);C.log(o)}function uc(t,e,n,i=Ge()){let r=i&&Ue(i);r&&(B&&C.log("[Measurement] Setting measurement on root span: ".concat(t," = ").concat(e," ").concat(n)),r.addEvent(t,{[Gi]:e,[ji]:n}))}function kd(t){if(!t||t.length===0)return;let e={};return t.forEach(n=>{let i=n.attributes||{},r=i[ji],s=i[Gi];typeof r=="string"&&typeof s=="number"&&(e[n.name]={value:s,unit:r})}),e}function xg(){return kr(vn()).segmentSpanCaptureStrategy}function $t(t){return t.getOptions().traceLifecycle==="stream"}var lC=1e3,gs=class{constructor(e={}){this._traceId=e.traceId||En(),this._spanId=e.spanId||fn(),this._startTime=e.startTimestamp||Ve(),this._links=e.links,this._attributes={},this.setAttributes(g({[Oe]:"manual",[ot]:e.op},e.attributes)),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}
3addLink(e){return this._frozen?this:(this._links?this._links.push(e):this._links=[e],this)}addLinks(e){return this._frozen?this:(this._links?this._links.push(...e):this._links=e,this)}recordException(e,n){}spanContext(){let{_spanId:e,_traceId:n,_sampled:i}=this;return{spanId:e,traceId:n,traceFlags:i?nc:vd}}setAttribute(e,n){return this._frozen?this:(n===void 0?delete this._attributes[e]:this._attributes[e]=n,e===dt&&n!==void 0&&mg(this)&&FI(this),this)}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._frozen||(this._startTime=Vn(e))}setStatus(e){return this._frozen?this:(this._status=e,this)}updateName(e){return this._frozen?this:(this._name=e,mg(this)||this.setAttribute(dt,"custom"),this)}end(e){if(this._endTime){this._frozen=fg(this);return}this._endTime=Vn(e),aC(this),this._onSpanEnded(),this._frozen=fg(this)}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[ot],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:oc(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[Oe],profile_id:this._attributes[no],exclusive_time:this._attributes[hn],measurements:kd(this._events),is_segment:this._isStandaloneSpan&&Ue(this)===this||void 0,segment_id:this._isStandaloneSpan?Ue(this).spanContext().spanId:void 0,links:rc(this._links)}}getStreamedSpanJSON(){var e,n;return{name:(e=this._name)!=null?e:"",span_id:this._spanId,trace_id:this._traceId,parent_span_id:this._parentSpanId,start_timestamp:this._startTime,end_timestamp:(n=this._endTime)!=null?n:this._startTime,is_segment:this._isStandaloneSpan||this===Ue(this),status:Td(this._status),attributes:vg(this._attributes,this._status),links:bg(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,i){if(this._frozen)return this;B&&C.log("[Tracing] Adding an event to span:",e);let r=cC(n)?n:i||Ve(),s=cC(n)?{}:n||{},o={name:e,time:Vn(r),attributes:s};return this._events.push(o),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let e=G();e&&(e.emit("spanEnd",this),this._isStandaloneSpan||e.emit("afterSpanEnd",this));let n=Ue(this),i=this._isStandaloneSpan||this===n;if(this._isStandaloneSpan){this._sampled?KD(sC([this],e)):(B&&C.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}if(!i){let o=xg();if(o){let a=Mr(this).scope||te();o.onChildSpanEnded(this,n,l=>this._convertSpanToTransaction(l),a)}return}if(e&&$t(e)){e.emit("afterSegmentSpanEnd",this);return}let r=Mr(this).scope||te(),s=xg();if(s)s.onSegmentSpanEnded(o=>this._convertSpanToTransaction(o),r);else{let o=this._convertSpanToTransaction();o&&r.captureEvent(o)}}_convertSpanToTransaction(e={}){var p,m,f,h;if(!uC(ne(this)))return;this._name||(B&&C.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");let{scope:n,isolationScope:i}=Mr(this),r=(p=n==null?void 0:n.getScopeData().sdkProcessingMetadata)==null?void 0:p.normalizedRequest;if(this._sampled!==!0)return;(m=e.onSpanCaptured)==null||m.call(e,this);let s=[];for(let _ of Pr(this)){if(_===this||$D(_)||(f=e.isSpanAlreadyCaptured)!=null&&f.call(e,_))continue;let v=ne(_);uC(v)&&((h=e.onSpanCaptured)==null||h.call(e,_),s.push(v))}let o=this._attributes[dt];delete this._attributes[fa];let a=!1;s.forEach(_=>{var v;delete _.data[fa],(v=_.op)!=null&&v.startsWith("gen_ai.")&&(a=!0)});let l=g({contexts:{trace:VI(this)},spans:s.length>lC?s.sort((_,v)=>_.start_timestamp-v.start_timestamp).slice(0,lC):s,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:n,capturedSpanIsolationScope:i,dynamicSamplingContext:sn(this),hasGenAiSpans:a},request:r},o&&{transaction_info:{source:o}}),c=kd(this._events);return c&&Object.keys(c).length&&(B&&C.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),l.measurements=c),l}};function cC(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function uC(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function $D(t){return t instanceof gs&&t.isStandaloneSpan()}function KD(t){let e=G();if(!e)return;let n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}function pC(t,e,n){if(!Ct(t))return[!1];let i,r;typeof t.tracesSampler=="function"?(r=t.tracesSampler(D(g({},e),{inheritOrSampleWith:a=>typeof e.parentSampleRate=="number"?e.parentSampleRate:typeof e.parentSampled=="boolean"?Number(e.parentSampled):a})),i=!0):e.parentSampled!==void 0?r=e.parentSampled:typeof t.tracesSampleRate<"u"&&(r=t.tracesSampleRate,i=!0);let s=ei(r);if(s===void 0)return B&&C.warn("[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ".concat(JSON.stringify(r)," of type ").concat(JSON.stringify(typeof r),".")),[!1];if(!s)return B&&C.log("[Tracing] Discarding transaction because ".concat(typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0")),[!1,s,i];let o=n<s;return o||B&&C.log("[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ".concat(Number(r),")")),[o,s,i]}var Ag="__SENTRY_SUPPRESS_TRACING__";function Nt(t){let e=kg();return e.startInactiveSpan?e.startInactiveSpan(t):QD(t)}function QD(t){let e=ZD(t),{forceTransaction:n,parentSpan:i}=t;return(t.scope?s=>lr(t.scope,s):i!==void 0?s=>ya(i,s):s=>s())(()=>{let s=te(),o=t2(s,i),a=G();
3return t.onlyIfParent&&!o?XD(s,a):JD({parentSpan:o,spanArguments:e,forceTransaction:n,scope:s})})}function ya(t,e){let n=kg();return n.withActiveSpan?n.withActiveSpan(t,e):lr(i=>(fs(i,t||void 0),e(i)))}function pc(t=te()){let e=kg();return e.isTracingSuppressed?e.isTracingSuppressed(t):t.getScopeData().sdkProcessingMetadata[Ag]===!0}function XD(t,e){e==null||e.recordDroppedEvent("no_parent_span","span");let n=new Yn({traceId:t.getPropagationContext().traceId});return hs(n,t,st()),n}function JD({parentSpan:t,spanArguments:e,forceTransaction:n,scope:i}){var a;let r=st();if(!Ct()){let l=g(g({},r.getPropagationContext()),i.getPropagationContext()),c=t?t.spanContext().traceId:l.traceId,u=new Yn({traceId:c});return t&&!n&&ro(t,u),hs(u,i,r),u}let s=G();if(n2(s,e)){pc(i)||s==null||s.recordDroppedEvent("ignored","span");let l=new Yn({dropReason:"ignored",traceId:(a=t==null?void 0:t.spanContext().traceId)!=null?a:i.getPropagationContext().traceId});return t&&!n&&ro(t,l),hs(l,i,r),l}let o;if(t&&!n)o=e2(t,i,e,r),ro(t,o);else if(t){let l=sn(t),{traceId:c,spanId:u}=t.spanContext(),p=zn(t);o=dC(g({traceId:c,parentSpanId:u},e),i,r,p),Sg(o,l)}else{let{traceId:l,dsc:c,parentSpanId:u,sampled:p}=g(g({},r.getPropagationContext()),i.getPropagationContext());o=dC(g({traceId:l,parentSpanId:u},e),i,r,p),c&&Sg(o,c)}return oC(o),o}function ZD(t){let e=t.experimental||{},n=g({isStandalone:e.standalone},t);if(t.startTime){let i=g({},n);return i.startTimestamp=Vn(t.startTime),delete i.startTime,i}return n}function kg(){let t=vn();return ar(t)}function dC(t,e,n,i){var v,I;let r=G(),s=(r==null?void 0:r.getOptions())||{},{name:o=""}=t,a={spanAttributes:g({},t.attributes),spanName:o,parentSampled:i};r==null||r.emit("beforeSampling",a,{decision:!1});let l=(v=a.parentSampled)!=null?v:i,c=a.spanAttributes,u=e.getPropagationContext(),p=pc(e),[m,f,h]=p?[!1]:pC(s,{name:o,parentSampled:l,attributes:c,normalizedRequest:n.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampleRate:ei((I=u.dsc)==null?void 0:I.sample_rate)},u.sampleRand),_=new gs(D(g({},t),{attributes:g({[dt]:"custom",[Or]:f!==void 0&&h?f:void 0},c),sampled:m}));return!m&&r&&!p&&(B&&C.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate",$t(r)?"span":"transaction")),hs(_,e,n),r&&r.emit("spanStart",_),_}function e2(t,e,n,i){let{spanId:r,traceId:s}=t.spanContext(),o=pc(e),a=o?!1:zn(t),l=a?new gs(D(g({},n),{parentSpanId:r,traceId:s,sampled:a})):new Yn({traceId:s});ro(t,l),hs(l,e,i);let c=G();return c&&($t(c)&&cr(l)&&(cr(t)&&t.dropReason?(l.dropReason=t.dropReason,c.recordDroppedEvent(t.dropReason,"span")):o||(l.dropReason="sample_rate",c.recordDroppedEvent("sample_rate","span"))),c.emit("spanStart",l),n.endTimestamp&&(c.emit("spanEnd",l),c.emit("afterSpanEnd",l))),l}function t2(t,e){if(e)return e;if(e===null)return;let n=to(t);if(!n)return;let i=G();return(i?i.getOptions():{}).parentSpanIsAlwaysRootSpan?Ue(n):n}function n2(t,e){var i;let n=t==null?void 0:t.getOptions().ignoreSpans;return!t||!$t(t)||!(n!=null&&n.length)?!1:Dr({description:e.name||"",op:((i=e.attributes)==null?void 0:i[ot])||e.op,attributes:e.attributes},n)}function ba(t){return cr(t)&&t.dropReason==="ignored"}var va={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},i2="heartbeatFailed",r2="idleTimeout",s2="finalTimeout",o2="externalFinish";function Rd(t,e={}){let n=new Map,i=!1,r,s=o2,o=!e.disableAutoFinish,a=[],{idleTimeout:l=va.idleTimeout,finalTimeout:c=va.finalTimeout,childSpanTimeout:u=va.childSpanTimeout,beforeSpanEnd:p,trimIdleSpanEndTimestamp:m=!0}=e,f=G(),h=te();if(!f||!Ct()){let A=new Yn({traceId:h.getPropagationContext().traceId});return hs(A,h,st()),A}let _=Ge(),v=a2(t);v.end=new Proxy(v.end,{apply(A,Y,Pe){if(p&&p(v),cr(Y))return;let[H,...re]=Pe,Te=H||Ve(),Ie=Vn(Te),fe=Pr(v).filter(q=>q!==v),ft=ne(v);if(!fe.length||!m)return V(Ie),Reflect.apply(A,Y,[Ie,...re]);let U=f.getOptions().ignoreSpans,O=fe==null?void 0:fe.reduce((q,he)=>{let ye=ne(he);return!ye.timestamp||U&&Dr({description:ye.description,op:ye.op,attributes:ye.data},U)?q:q?Math.max(q,ye.timestamp):ye.timestamp},void 0),R=ft.start_timestamp,Q=Math.min(R?R+c/1e3:1/0,Math.max(R||-1/0,Math.min(Ie,O||1/0)));return V(Q),Reflect.apply(A,Y,[Q,...re])}});function I(){r&&(clearTimeout(r),r=void 0)}function N(A){I(),r=setTimeout(()=>{!i&&n.size===0&&o&&(s=r2,v.end(A))},l)}function j(A){r=setTimeout(()=>{!i&&o&&(s=i2,v.end(A))},u)}function P(A){I(),n.set(A,!0);let Y=Ve();j(Y+u/1e3)}function X(A){if(n.has(A)&&n.delete(A),n.size===0){let Y=Ve();N(Y+l/1e3)}}function V(A){i=!0,n.clear(),a.forEach(fe=>fe()),fs(h,_);let Y=ne(v),{start_timestamp:Pe}=Y;if(!Pe)return;Y.data[Nr]||v.setAttribute(Nr,s);let re=Y.status;(!re||re==="unknown")&&v.setStatus({code:1}),C.log('[Tracing] Idle span "'.concat(Y.op,'" finished'));let Te=Pr(v).filter(fe=>fe!==v),Ie=0;Te.forEach(fe=>{fe.isRecording()&&(fe.setStatus({code:2,message:"cancelled"}),fe.end(A),B&&C.log("[Tracing] Cancelling span since span ended early",JSON.stringify(fe,void 0,2)));let ft=ne(fe),{timestamp:U=0,start_timestamp:O=0}=ft,R=O<=A,Q=(c+l)/1e3,q=U-O<=Q;
3if(B){let he=JSON.stringify(fe,void 0,2);R?q||C.log("[Tracing] Discarding span since it finished after idle span final timeout",he):C.log("[Tracing] Discarding span since it happened after idle span was finished",he)}(!q||!R)&&(QI(v,fe),Ie++)}),Ie>0&&v.setAttribute("sentry.idle_span_discarded_spans",Ie)}return a.push(f.on("spanStart",A=>{if(i||A===v||ne(A).timestamp||A instanceof gs&&A.isStandaloneSpan())return;Pr(v).includes(A)&&P(A.spanContext().spanId)})),a.push(f.on("spanEnd",A=>{i||X(A.spanContext().spanId)})),a.push(f.on("idleSpanEnableAutoFinish",A=>{A===v&&(o=!0,N(),n.size&&j())})),e.disableAutoFinish||N(),setTimeout(()=>{i||(v.setStatus({code:2,message:"deadline_exceeded"}),s=s2,v.end())},c),v}function a2(t){let e=Nt(t);return fs(te(),e),B&&C.log("[Tracing] Started span is an idle span"),e}function Rg(t,e,n){let i,r,s,o=n!=null&&n.maxWait?Math.max(n.maxWait,e):0,a=(n==null?void 0:n.setTimeoutImpl)||setTimeout;function l(){return c(),i=t(),i}function c(){r!==void 0&&clearTimeout(r),s!==void 0&&clearTimeout(s),r=s=void 0}function u(){return r!==void 0||s!==void 0?l():i}function p(){return r&&clearTimeout(r),r=a(l,e),o&&s===void 0&&(s=a(l,o)),i}return p.cancel=c,p.flush=u,p}function fC(t,e){let{fingerprint:n,span:i,breadcrumbs:r,sdkProcessingMetadata:s}=e;l2(t,e),i&&p2(t,i),d2(t,n),c2(t,r),u2(t,s)}function mC(t,e){let{extra:n,tags:i,attributes:r,user:s,contexts:o,level:a,sdkProcessingMetadata:l,breadcrumbs:c,fingerprint:u,eventProcessors:p,attachments:m,propagationContext:f,transactionName:h,span:_}=e;dc(t,"extra",n),dc(t,"tags",i),dc(t,"attributes",r),dc(t,"user",s),dc(t,"contexts",o),t.sdkProcessingMetadata=ms(t.sdkProcessingMetadata,l,2),a&&(t.level=a),h&&(t.transactionName=h),_&&(t.span=_),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),p.length&&(t.eventProcessors=[...t.eventProcessors,...p]),m.length&&(t.attachments=[...t.attachments,...m]),t.propagationContext=g(g({},t.propagationContext),f)}function dc(t,e,n){t[e]=ms(t[e],n,1)}function Od(t,e){let n=Xl().getScopeData();return t&&mC(n,t.getScopeData()),e&&mC(n,e.getScopeData()),n}function l2(t,e){let{extra:n,tags:i,user:r,contexts:s,level:o,transactionName:a}=e;Object.keys(n).length&&(t.extra=g(g({},n),t.extra)),Object.keys(i).length&&(t.tags=g(g({},i),t.tags)),Object.keys(r).length&&(t.user=g(g({},r),t.user)),Object.keys(s).length&&(t.contexts=g(g({},s),t.contexts)),o&&(t.level=o),a&&t.type!=="transaction"&&(t.transaction=a)}function c2(t,e){let n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function u2(t,e){t.sdkProcessingMetadata=g(g({},t.sdkProcessingMetadata),e)}function p2(t,e){t.contexts=g({trace:Sd(e)},t.contexts),t.sdkProcessingMetadata=g({dynamicSamplingContext:sn(e)},t.sdkProcessingMetadata);let n=Ue(e),i=ne(n).description;i&&!t.transaction&&t.type==="transaction"&&(t.transaction=i)}function d2(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}var Nd="http.url";var Og="sentry.segment.name";var Ng="sentry.transaction";var ti="url.full",Md="url.path";var hC="url.template";function Lr(t,e){var i;let n=(i=t.attributes)!=null?i:t.attributes={};Object.entries(e).forEach(([r,s])=>{s!=null&&!(r in n)&&(n[r]=s)})}var Mg=0,gC=1,_C=2;function ur(t){return new mc(e=>{e(t)})}function fc(t){return new mc((e,n)=>{n(t)})}var mc=class t{constructor(e){this._state=Mg,this._handlers=[],this._runExecutor(e)}then(e,n){return new t((i,r)=>{this._handlers.push([!1,s=>{if(!e)i(s);else try{i(e(s))}catch(o){r(o)}},s=>{if(!n)r(s);else try{i(n(s))}catch(o){r(o)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new t((n,i)=>{let r,s;return this.then(o=>{s=!1,r=o,e&&e()},o=>{s=!0,r=o,e&&e()}).then(()=>{if(s){i(r);return}n(r)})})}_executeHandlers(){if(this._state===Mg)return;let e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===gC&&n[1](this._value),this._state===_C&&n[2](this._value),n[0]=!0)})}_runExecutor(e){let n=(s,o)=>
3{if(this._state===Mg){if(Hi(o)){o.then(i,r);return}this._state=s,this._value=o,this._executeHandlers()}},i=s=>{n(gC,s)},r=s=>{n(_C,s)};try{e(i,r)}catch(s){r(s)}}};function yC(t,e,n,i=0){try{let r=Pg(e,n,t,i);return Hi(r)?r:ur(r)}catch(r){return fc(r)}}function Pg(t,e,n,i){let r=n[i];if(!t||!r)return t;let s=r(g({},t),e);return B&&s===null&&C.log('Event processor "'.concat(r.id||"?",'" dropped event')),Hi(s)?s.then(o=>Pg(o,e,n,i+1)):Pg(s,e,n,i+1)}var Fr,bC,vC,_s;function SC(t){let e=z._sentryDebugIds,n=z._debugIds;if(!e&&!n)return{};let i=e?Object.keys(e):[],r=n?Object.keys(n):[];if(_s&&i.length===bC&&r.length===vC)return _s;bC=i.length,vC=r.length,_s={},Fr||(Fr={});let s=(o,a)=>{for(let l of o){let c=a[l],u=Fr==null?void 0:Fr[l];if(u&&_s&&c)_s[u[0]]=c,Fr&&(Fr[l]=[u[0],c]);else if(c){let p=t(l);for(let m=p.length-1;m>=0;m--){let f=p[m],h=f==null?void 0:f.filename;if(h&&_s&&Fr){_s[h]=c,Fr[l]=[h,c];break}}}}};return e&&s(i,e),n&&s(r,n),_s}function hc(t,e,n,i,r,s){let{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,l=D(g({},e),{event_id:e.event_id||n.event_id||It(),timestamp:e.timestamp||Gn()}),c=n.integrations||t.integrations.map(I=>I.name);m2(l,t),g2(l,c),r&&r.emit("applyFrameMetadata",e),e.type===void 0&&f2(l,t.stackParser);let u=y2(i,n.captureContext);n.mechanism&&mn(l,n.mechanism);let p=r?r.getEventProcessors():[],m=Od(s,u),f=[...n.attachments||[],...m.attachments];f.length&&(n.attachments=f),fC(l,m);let h=[...p,...m.eventProcessors];return(n.data&&n.data.__sentry__===!0?ur(l):yC(h,l,n)).then(I=>(I&&h2(I),typeof o=="number"&&o>0?_2(I,o,a):I))}function m2(t,e){var a,l;let{environment:n,release:i,dist:r,maxValueLength:s}=e;t.environment=t.environment||n||ga,!t.release&&i&&(t.release=i),!t.dist&&r&&(t.dist=r);let o=t.request;o!=null&&o.url&&s&&(o.url=Zs(o.url,s)),s&&((l=(a=t.exception)==null?void 0:a.values)==null||l.forEach(c=>{c.value&&(c.value=Zs(c.value,s))}))}function f2(t,e){var i,r;let n=SC(e);(r=(i=t.exception)==null?void 0:i.values)==null||r.forEach(s=>{var o,a;(a=(o=s.stacktrace)==null?void 0:o.frames)==null||a.forEach(l=>{l.filename&&(l.debug_id=n[l.filename])})})}function h2(t){var i,r;let e={};if((r=(i=t.exception)==null?void 0:i.values)==null||r.forEach(s=>{var o,a;(a=(o=s.stacktrace)==null?void 0:o.frames)==null||a.forEach(l=>{l.debug_id&&(l.abs_path?e[l.abs_path]=l.debug_id:l.filename&&(e[l.filename]=l.debug_id),delete l.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let n=t.debug_meta.images;Object.entries(e).forEach(([s,o])=>{n.push({type:"sourcemap",code_file:s,debug_id:o})})}function g2(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function _2(t,e,n){var r,s;if(!t)return null;let i=g(g(g(g(g({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>g(g({},o),o.data&&{data:dn(o.data,e,n)}))}),t.user&&{user:dn(t.user,e,n)}),t.contexts&&{contexts:dn(t.contexts,e,n)}),t.extra&&{extra:dn(t.extra,e,n)});return(r=t.contexts)!=null&&r.trace&&i.contexts&&(i.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(i.contexts.trace.data=dn(t.contexts.trace.data,e,n))),t.spans&&(i.spans=t.spans.map(o=>g(g({},o),o.data&&{data:dn(o.data,e,n)}))),(s=t.contexts)!=null&&s.flags&&i.contexts&&(i.contexts.flags=dn(t.contexts.flags,3,n)),i}function y2(t,e){if(!e)return t;let n=t?t.clone():new Wn;return n.update(e),n}function EC(t){if(t)return b2(t)?{captureContext:t}:S2(t)?{captureContext:t}:t}function b2(t){return t instanceof Wn||typeof t=="function"}var v2=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function S2(t){return Object.keys(t).some(e=>v2.includes(e))}function Wi(t,e){return te().captureException(t,EC(e))}function Ur(t,e){return te().captureEvent(t,e)}function ao(t,e){st().setContext(t,e)}function gc(){return st().lastEventId()}function _c(){let t=G();return(t==null?void 0:t.getOptions().enabled)!==!1&&!!(t!=null&&t.getTransport())}function yc(t){st().addEventProcessor(t)}function Sa(t){let e=st(),{user:n}=Od(e,te()),{userAgent:i}=z.navigator||{},r=wI(g(g({user:n},i&&{userAgent:i}),t)),s=e.getSession();return(s==null?void 0:s.status)==="ok"&&Rr(s,{status:"exited"}),bc(),e.setSession(r),r}function bc(){let t=st(),n=te().getSession()||t.getSession();n&&xI(n),TC(),t.setSession()}function TC(){let t=st(),e=G(),n=t.getSession();n&&e&&e.captureSession(n)}function lo(t=!1){if(t){bc();return}TC()}function Pd(t){return typeof t=="object"&&typeof t.unref=="function"&&t.unref(),t}var IC="7";function CC(t){let e=t.protocol?"".concat(t.protocol,":"):"",n=t.port?":".concat(t.port):"";return"".concat(e,"//").concat(t.host).concat(n).concat(t.path?"/".concat(t.path):"","/api/")}function E2(t){return"".concat(CC(t)).concat(t.projectId,"/envelope/")}function T2(t,e){let n={sentry_version:IC};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client="".concat(e.name,"/").concat(e.version)),new URLSearchParams(n).toString()}function Lg(t,e,n){return e||"".concat(E2(t),"?").concat(T2(t,n))}function Fg(t,e){let n=yd(t);if(!n)return"";let i="".concat(CC(n),"embed/error-page/"),r="dsn=".concat(Zn(n));for(let s in e)if(s!=="dsn"&&s!=="onClose")if(s==="user"){let o=e.user;if(!o)continue;o.name&&(r+="&name=".concat(encodeURIComponent(o.name))),o.email&&(r+="&email=".concat(encodeURIComponent(o.email)))}else r+="&".concat(encodeURIComponent(s),"=").concat(encodeURIComponent(e[s]));return"".concat(i,"?").concat(r)}var Ug=[];function I2(t){let e={};return t.forEach(n=>{let{name:i}=n,r=e[i];r&&!r.isDefaultInstance&&n.isDefaultInstance||(e[i]=n)}),Object.values(e)}function Bg(t){let e=t.defaultIntegrations||[],n=t.integrations;e.forEach(r=>{r.isDefaultInstance=!0});let i;if(Array.isArray(n))i=[...e,...n];else if(typeof n=="function"){let r=n(e);i=Array.isArray(r)?r:[r]}else i=e;return I2(i)}function wC(t,e){let n={};return e.forEach(i=>
3{i!=null&&i.beforeSetup&&i.beforeSetup(t)}),e.forEach(i=>{i&&qg(t,i,n)}),n}function Hg(t,e){for(let n of e)n!=null&&n.afterAllSetup&&n.afterAllSetup(t)}function qg(t,e,n){if(n[e.name]){B&&C.log("Integration skipped because it was already installed: ".concat(e.name));return}if(n[e.name]=e,!Ug.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),Ug.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let i=e.preprocessEvent.bind(e);t.on("preprocessEvent",(r,s)=>i(r,s,t))}if(typeof e.processEvent=="function"){let i=e.processEvent.bind(e),r=Object.assign((s,o)=>i(s,o,t),{id:e.name});t.addEventProcessor(r)}["processSpan","processSegmentSpan"].forEach(i=>{let r=e[i];typeof r=="function"&&t.on(i,s=>r.call(e,s,t))}),B&&C.log("Integration installed: ".concat(e.name))}function jg(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function Gg(){return"npm"}function xC(){return!jg()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function Ei(){return typeof window<"u"&&(!xC()||C2())}function C2(){let t=z.process;return(t==null?void 0:t.type)==="renderer"}function w2(t,e){let n=e?"auto":"never";return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},D(g({version:2},Ei()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}}),{items:t})]}function AC(t,e,n,i,r){let s={};return e!=null&&e.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&i&&(s.dsn=Zn(i)),Tn(s,[w2(t,r)])}function kC(t,e){var s;let n=(s=e!=null?e:x2(t))!=null?s:[];if(n.length===0)return;let i=t.getOptions(),r=AC(n,i._metadata,i.tunnel,t.getDsn(),t.getDataCollectionOptions().userInfo);RC().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(r)}function x2(t){return RC().get(t)}function RC(){return Bi("clientToLogBufferMap",()=>new WeakMap)}function A2(t,e){let n=e?"auto":"never";return[{type:"trace_metric",item_count:t.length,content_type:"application/vnd.sentry.items.trace-metric+json"},D(g({version:2},Ei()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}}),{items:t})]}function OC(t,e,n,i,r){let s={};return e!=null&&e.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&i&&(s.dsn=Zn(i)),Tn(s,[A2(t,r)])}function NC(t,e){var s;let n=(s=e!=null?e:k2(t))!=null?s:[];if(n.length===0)return;let i=t.getOptions(),r=OC(n,i._metadata,i.tunnel,t.getDsn(),t.getDataCollectionOptions().userInfo);MC().set(t,[]),t.emit("flushMetrics"),t.sendEnvelope(r)}function k2(t){return MC().get(t)}function MC(){return Bi("clientToMetricBufferMap",()=>new WeakMap)}function PC(t){let e={trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,name:t.description||"",start_timestamp:t.start_timestamp,end_timestamp:t.timestamp||t.start_timestamp,status:!t.status||t.status==="ok"||t.status==="cancelled"?"ok":"error",is_segment:!1,attributes:g({},t.data),links:t.links};return $I(e)}function DC(t,e){var s,o,a;if(t.type!=="transaction"||!((s=t.spans)!=null&&s.length)||!((o=t.sdkProcessingMetadata)!=null&&o.hasGenAiSpans)||e.getOptions().streamGenAiSpans===!1||$t(e))return;let n=[],i=[];for(let l of t.spans)(a=l.op)!=null&&a.startsWith("gen_ai.")?n.push(PC(l)):i.push(l);if(n.length===0)return;t.spans=i;let r=e.getDataCollectionOptions().userInfo?"auto":"never";return[{type:"span",item_count:n.length,content_type:"application/vnd.sentry.items.span.v2+json"},D(g({version:2},Ei()&&{ingest_settings:{infer_ip:r,infer_user_agent:r}}),{items:n})]}var Ea=Symbol.for("SentryBufferFullError");function co(t=100){let e=new Set;function n(){return e.size<t}function i(o){e.delete(o)}function r(o){if(!n())return fc(Ea);let a=o();return e.add(a),a.then(()=>i(a),()=>i(a)),a}function s(o){if(!e.size)return ur(!0);
3let a=Promise.allSettled(Array.from(e)).then(()=>!0);if(!o)return a;let l=[a,new Promise(c=>Pd(setTimeout(()=>c(!1),o)))];return Promise.race(l)}return{get $(){return Array.from(e)},add:r,drain:s}}var LC=60*1e3;function FC(t,e=Si()){let n=parseInt("".concat(t),10);if(!isNaN(n))return n*1e3;let i=Date.parse("".concat(t));return isNaN(i)?LC:i-e}function UC(t,e){return t[e]||t.all||0}function vc(t,e,n=Si()){return UC(t,e)>n}function Sc(t,{statusCode:e,headers:n},i=Si()){let r=g({},t),s=n==null?void 0:n["x-sentry-rate-limits"],o=n==null?void 0:n["retry-after"];if(s)for(let a of s.trim().split(",")){let[l,c,,,u]=a.split(":",5),p=parseInt(l,10),m=(isNaN(p)?60:p)*1e3;if(!c)r.all=i+m;else for(let f of c.split(";"))f==="metric_bucket"?(!u||u.split(";").includes("custom"))&&(r[f]=i+m):r[f]=i+m}else o?r.all=i+FC(o,i):e===429&&(r.all=i+60*1e3);return r}var Wg=64;function Dd(t,e,n=co(t.bufferSize||Wg)){let i={},r=o=>n.drain(o);function s(o){let a=[];if(lc(o,(p,m)=>{let f=Ad(m);vc(i,f)?t.recordDroppedEvent("ratelimit_backoff",f):a.push(p)}),a.length===0)return Promise.resolve({});let l=Tn(o[0],a),c=p=>{if(Tg(l,["client_report"])){B&&C.warn("Dropping client report. Will not send outcomes (reason: ".concat(p,")."));return}lc(l,(m,f)=>{t.recordDroppedEvent(p,Ad(f))})},u=()=>e({body:Ig(l)}).then(p=>p.statusCode===413?(B&&C.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),c("send_error"),p):(B&&p.statusCode!==void 0&&(p.statusCode<200||p.statusCode>=300)&&C.warn("Sentry responded with status code ".concat(p.statusCode," to sent event.")),i=Sc(i,p),p),p=>{throw c("network_error"),B&&C.error("Encountered error running transport request:",p),p});return n.add(u).then(p=>p,p=>{if(p===Ea)return B&&C.error("Skipped sending event because buffer is full."),c("queue_overflow"),Promise.resolve({});throw p})}return{send:s,flush:r}}function BC(t,e,n){let i=[{type:"client_report"},{timestamp:n||Gn(),discarded_events:t}];return Tn(e?{dsn:e}:{},[i])}function Ld(t){let e=[];t.message&&e.push(t.message);try{let n=t.exception.values[t.exception.values.length-1];n!=null&&n.value&&(e.push(n.value),n.type&&e.push("".concat(n.type,": ").concat(n.value)))}catch{}return e}function HC(t){var l,c,u;let{trace_id:e,parent_span_id:n,span_id:i,status:r,origin:s,data:o,op:a}=(c=(l=t.contexts)==null?void 0:l.trace)!=null?c:{};return{data:o!=null?o:{},description:t.transaction,op:a,parent_span_id:n,span_id:i!=null?i:"",start_timestamp:(u=t.start_timestamp)!=null?u:0,status:r,timestamp:t.timestamp,trace_id:e!=null?e:"",origin:s,profile_id:o==null?void 0:o[no],exclusive_time:o==null?void 0:o[hn],measurements:t.measurements,is_segment:!0}}function qC(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:g(g(g({},t.data),t.profile_id&&{[no]:t.profile_id}),t.exclusive_time&&{[hn]:t.exclusive_time})}},measurements:t.measurements}}var uo="[Filtered]",Ec=["forwarded","-ip","remote-","via","-user"],Vg=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","sid","identity","set-cookie","cookie"],jC=[".sid","sessid","remember","oidc","pkce","nonce","__secure-","__host-","awsalb","awselb","akamai","__stripe","cognito","firebase","supabase","sb-","mfa","2fa"];function GC(t){return t===!0?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:7}:{userInfo:!1,cookies:{deny:Ec},httpHeaders:{request:{deny:Ec},response:{deny:Ec}},httpBodies:[],urlQueryParams:{deny:Ec},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}var R2={userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0}
3,databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:5};function WC(t){var i,r,s,o,a,l,c,u,p,m,f,h,_,v,I,N,j,P,X,V,A;let e=t.dataCollection!=null?R2:GC(t.sendDefaultPii),n=(i=t.dataCollection)!=null?i:{};return{userInfo:(r=n.userInfo)!=null?r:e.userInfo,cookies:(s=n.cookies)!=null?s:e.cookies,httpHeaders:{request:(a=(o=n.httpHeaders)==null?void 0:o.request)!=null?a:e.httpHeaders.request,response:(c=(l=n.httpHeaders)==null?void 0:l.response)!=null?c:e.httpHeaders.response},httpBodies:(u=n.httpBodies)!=null?u:e.httpBodies,urlQueryParams:(m=(p=n.urlQueryParams)!=null?p:n.queryParams)!=null?m:e.urlQueryParams,graphQL:{document:(h=(f=n.graphQL)==null?void 0:f.document)!=null?h:e.graphQL.document,variables:(v=(_=n.graphQL)==null?void 0:_.variables)!=null?v:e.graphQL.variables},genAI:{inputs:(N=(I=n.genAI)==null?void 0:I.inputs)!=null?N:e.genAI.inputs,outputs:(P=(j=n.genAI)==null?void 0:j.outputs)!=null?P:e.genAI.outputs},databaseQueryData:(X=n.databaseQueryData)!=null?X:e.databaseQueryData,stackFrameVariables:(V=n.stackFrameVariables)!=null?V:e.stackFrameVariables,frameContextLines:(A=n.frameContextLines)!=null?A:e.frameContextLines}}var VC="Not capturing exception because it's already been captured.",zC="Discarded session because of missing or non-string release",JC=Symbol.for("SentryInternalError"),ZC=Symbol.for("SentryDoNotSendEventError"),O2=5e3;function Fd(t){return{message:t,[JC]:!0}}function zg(t){return{message:t,[ZC]:!0}}function YC(t){return Jn(t)&&JC in t}function $C(t){return Jn(t)&&ZC in t}function KC(t,e,n,i,r){let s=0,o,a=!1;t.on(n,()=>{s=0,clearTimeout(o),a=!1}),t.on(e,l=>{var c;if(s+=i(l),s>=8e5)r(t);else if(!a){let u=(c=t.getOptions()._flushInterval)!=null?c:O2;u>0&&(a=!0,o=Pd(setTimeout(()=>{r(t)},u)))}}),t.on("flush",()=>{r(t)})}var Tc=class{constructor(e){var i,r,s,o,a,l,c;if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=co((r=(i=e.transportOptions)==null?void 0:i.bufferSize)!=null?r:Wg),this._dataCollection=WC(e),e.dsn?this._dsn=yd(e.dsn):B&&C.warn("No DSN provided, client will not send events."),this._dsn){let u=Lg(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport(D(g({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:u}))}this._options.enableLogs=(o=this._options.enableLogs)!=null?o:(s=this._options._experiments)==null?void 0:s.enableLogs,this._options.enableLogs&&KC(this,"afterCaptureLog","flushLogs",D2,kC),((c=(l=this._options.enableMetrics)!=null?l:(a=this._options._experiments)==null?void 0:a.enableMetrics)!=null?c:!0)&&KC(this,"afterCaptureMetric","flushMetrics",P2,NC)}captureException(e,n,i){let r=It();if(Ql(e))return B&&C.log(VC),r;let s=g({event_id:r},n);return this._process(()=>this.eventFromException(e,s).then(o=>this._captureEvent(o,s,i)).then(o=>o),"error"),s.event_id}captureMessage(e,n,i,r){let s=g({event_id:It()},i),o=ls(e)?e:String(e),a=jn(e),l=a?this.eventFromMessage(o,n,s):this.eventFromException(e,s);return this._process(()=>l.then(c=>this._captureEvent(c,s,r)),a?"unknown":"error"),s.event_id}captureEvent(e,n,i){let r=It();if(n!=null&&n.originalException&&Ql(n.originalException))return B&&C.log(VC),r;let s=g({event_id:r},n),o=e.sdkProcessingMetadata||{},a=o.capturedSpanScope,l=o.capturedSpanIsolationScope,c=QC(e.type);return this._process(()=>this._captureEvent(e,s,a||i,l),c),s.event_id}captureSession(e){this.sendSession(e),Rr(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){return k(this,null,function*(){let n=this._transport;if(this.emit("flush"),!n)return!0;let i=yield this._isClientDoneProcessing(e),r=yield n.flush(e);return i&&r})}close(e){return k(this,null,function*(){let n=yield this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),n})}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(e){let n=this._integrations[e.name];!n&&e.beforeSetup&&e.beforeSetup(this),qg(this,e,this._integrations),n||Hg(this,[e])}sendEvent(e,n={}
3){this.emit("beforeSendEvent",e,n);let i=DC(e,this),r=rC(e,this._dsn,this._options._metadata,this._options.tunnel);for(let s of n.attachments||[])r=xd(r,wg(s));i&&(r=xd(r,i)),this.sendEnvelope(r).then(s=>this.emit("afterSendEvent",e,s))}sendSession(e){let{release:n,environment:i=ga}=this._options;if("aggregates"in e){let s=e.attrs||{};if(!s.release&&!n){B&&C.warn(zC);return}s.release=s.release||n,s.environment=s.environment||i,e.attrs=s}else{if(!e.release&&!n){B&&C.warn(zC);return}e.release=e.release||n,e.environment=e.environment||i}this.emit("beforeSendSession",e);let r=iC(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,n,i=1){if(this._options.sendClientReports){let r="".concat(e,":").concat(n);B&&C.log('Recording outcome: "'.concat(r,'"').concat(i>1?" (".concat(i," times)"):"")),this._outcomes[r]=(this._outcomes[r]||0)+i}}on(e,n){let i=this._hooks[e]=this._hooks[e]||new Set,r=(...s)=>n(...s);return i.add(r),()=>{i.delete(r)}}emit(e,...n){let i=this._hooks[e];i&&i.forEach(r=>r(...n))}sendEnvelope(e){return k(this,null,function*(){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return yield this._transport.send(e)}catch(n){return B&&C.error("Error while sending envelope:",n),{}}return B&&C.error("Transport disabled"),{}})}registerCleanup(e){}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=wC(this,e),Hg(this,e)}_updateSessionFromEvent(e,n){var l,c;let i=n.level==="fatal",r=!1,s=(l=n.exception)==null?void 0:l.values;if(s){r=!0,i=!1;for(let u of s)if(((c=u.mechanism)==null?void 0:c.handled)===!1){i=!0;break}}let o=e.status==="ok";(o&&e.errors===0||o&&i)&&(Rr(e,D(g({},i&&{status:"crashed"}),{errors:e.errors||Number(r||i)})),this.captureSession(e))}_isClientDoneProcessing(e){return k(this,null,function*(){let n=0;for(;!e||n<e;){if(yield new Promise(i=>setTimeout(i,1)),!this._numProcessing)return!0;n++}return!1})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,i,r){let s=this.getOptions(),o=this.getIntegrationNames();return!n.integrations&&o.length&&(n.integrations=o),this.emit("preprocessEvent",e,n),e.type||r.setLastEventId(e.event_id||n.event_id),hc(s,e,n,i,this,r).then(a=>{var c;if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts=g({trace:g(g({},(c=a.contexts)==null?void 0:c.trace),md(i))},a.contexts);let l=oo(this,i);return a.sdkProcessingMetadata=g({dynamicSamplingContext:l},a.sdkProcessingMetadata),a})}_captureEvent(e,n={},i=te(),r=st()){return B&&Yg(e)&&C.log("Captured error event `".concat(Ld(e)[0]||"<unknown>","`")),this._processEvent(e,n,i,r).then(s=>s.event_id,s=>{B&&($C(s)?C.log(s.message):YC(s)?C.warn(s.message):C.warn(s))})}_processEvent(e,n,i,r){let s=this.getOptions(),{sampleRate:o}=s,a=ew(e),l=Yg(e),c=e.type||"error",u="before send for type `".concat(c,"`"),p=typeof o>"u"?void 0:ei(o),m=QC(e.type);return this._prepareEvent(e,n,i,r).then(f=>{var v;if(f===null)throw this.recordDroppedEvent("event_processor",m),zg("An event processor returned `null`, will not send event.");if(((v=n.data)==null?void 0:v.__sentry__)===!0)return f;let _=M2(this,s,f,n);return N2(_,u)}).then(f=>{var v;if(f===null){if(this.recordDroppedEvent("before_send",m),a){let N=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",N)}throw zg("".concat(u," returned `null`, will not send event."))}let h=i.getSession()||r.getSession();if(l&&h&&this._updateSessionFromEvent(h,f),l&&typeof p=="number"&&vi()>p)throw this.recordDroppedEvent("sample_rate","error"),zg("Discarding event because it's not included in the random sample (sampling rate = ".concat(o,")"));if(a){let I=((v=f.sdkProcessingMetadata)==null?void 0:v.spanCountBeforeProcessing)||0,N=f.spans?f.spans.length:0,j=I-N;j>0&&this.recordDroppedEvent("before_send","span",j)}let _=f.transaction_info;if(a&&_&&f.transaction!==e.transaction){let I="custom";f.transaction_info=D(g({},_),{source:I})}return this.sendEvent(f,n),f}).then(null,f=>{throw $C(f)||YC(f)?f:(this.captureException(f,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:f}),Fd("Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ".concat(f)))})}_process(e,n){this._numProcessing++,this._promiseBuffer.add(e).then(i=>(this._numProcessing--,i),i=>(this._numProcessing--,i===Ea&&this.recordDroppedEvent("queue_overflow",n),i))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,i])=>{let[r,s]=n.split(":");return{reason:r,category:s,quantity:i}})}_flushOutcomes(){B&&C.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){B&&C.log("No outcomes to send");return}if(!this._dsn){B&&C.log("No dsn provided, will not send outcomes");return}B&&C.log("Sending outcomes:",e);let n=BC(e,this._options.tunnel&&Zn(this._dsn));this.sendEnvelope(n)}};function QC(t){return t==="replay_event"?"replay":t||"error"}function N2(t,e){let n="".concat(e," must return `null` or a valid event.");if(Hi(t))return t.then(i=>{if(!or(i)&&i!==null)throw Fd(n);return i},i=>{throw Fd("".concat(e," rejected with ").concat(i))});if(!or(t)&&t!==null)throw Fd(n);return t}function M2(t,e,n,i){let{beforeSend:r,beforeSendTransaction:s,ignoreSpans:o}=e,a=!wd(e.beforeSendSpan)&&e.beforeSendSpan,l=n;if(Yg(l)&&r)return r(l,i);if(ew(l)){if(a||o){let c=HC(l);if(o!=null&&o.length&&Dr({description:c.description,op:c.op,attributes:c.data},o))return null;if(a){let u=a(c);u?l=ms(n,qC(u)):ac()}if(l.spans){let u=[],p=l.spans;for(let f of p){if(o!=null&&o.length&&Dr({description:f.description,op:f.op,attributes:f.data},o)){ZI(p,f);continue}if(a){let h=a(f);h?u.push(h):(ac(),u.push(f))}else u.push(f)}let m=l.spans.length-u.length;m&&t.recordDroppedEvent("before_send","span",m),l.spans=u}}if(s){if(l.spans){let c=l.spans.length;l.sdkProcessingMetadata=D(g({},n.sdkProcessingMetadata),{spanCountBeforeProcessing:c})}return s(l,i)}}return l}function Yg(t){return t.type===void 0}function ew(t){return t.type==="transaction"}function P2(t){let e=0;return t.name&&(e+=t.name.length*2),e+=8,e+tw(t.attributes)}function D2(t){let e=0;return t.message&&(e+=t.message.length*2),e+tw(t.attributes)}function tw(t){if(!t)return 0;let e=0;return Object.values(t).forEach(n=>{Array.isArray(n)?e+=n.length*XC(n[0]):jn(n)?e+=XC(n):e+=100}),e}function XC(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}function $g(t,e){e.debug===!0&&(B?C.enable():Bt(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),te().update(e.initialScope);let i=new t(e);return Kg(i),i.init(),i}function Kg(t){te().setClient(t)}function Qg(t,e){return e.some(n=>t.includes(n))}function ys(t,e,n){if(e===!1)return{};let i=n!=null?[...Vg,...n]:Vg,r={};if(e===!0){for(let o of Object.keys(t))r[o]=Qg(o.toLowerCase(),i)?uo:t[o];return r}if("deny"in e){let o=e.deny.map(a=>a.toLowerCase());
3for(let a of Object.keys(t)){let l=a.toLowerCase(),c=Qg(l,i)||o.some(u=>l.includes(u));r[a]=c?uo:t[a]}return r}let s=e.allow.map(o=>o.toLowerCase());for(let o of Object.keys(t)){let a=o.toLowerCase();if(Qg(a,i))r[o]=uo;else{let l=s.some(c=>a.includes(c));r[o]=l?t[o]:uo}}return r}function nw(t){let e={},n=0;for(;n<t.length;){let i=t.indexOf("=",n);if(i===-1)break;let r=t.indexOf(";",n);if(r===-1)r=t.length;else if(r<i){n=t.lastIndexOf(";",i-1)+1;continue}let s=t.slice(n,i).trim();if(e[s]===void 0){let o=t.slice(i+1,r).trim();o.charCodeAt(0)===34&&(o=o.slice(1,-1));try{e[s]=o.indexOf("%")!==-1?decodeURIComponent(o):o}catch{e[s]=o}}n=r+1}return e}function Ic(t,e){if(e===!1)return{};try{let n=nw(t);return Object.keys(n).length===0?{}:ys(n,e,jC)}catch{return uo}}var L2="thismessage:/";function Br(t){return"isRelative"in t}function ni(t,e){let n=t.indexOf("://")<=0&&t.indexOf("//")!==0,i=e!=null?e:n?L2:void 0;try{if("canParse"in URL&&!URL.canParse(t,i))return;let r=new URL(t,i);return n?{isRelative:n,pathname:r.pathname,search:r.search,hash:r.hash}:r}catch{}}function Ta(t){if(Br(t))return t.pathname;let e=new URL(t);return e.search="",e.hash="",["80","443"].includes(e.port)&&(e.port=""),e.password&&(e.password="%filtered%"),e.username&&(e.username="%filtered%"),e.toString()}function Ti(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let n=e[6]||"",i=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:i,relative:e[5]+n+i}}function Ia(t){return t.split(/[?#]/,1)[0]}function on(t,e=!0){if(t.startsWith("data:")){let n=t.match(/^data:([^;,]+)/),i=n?n[1]:"text/plain",r=t.includes(";base64,"),s=t.indexOf(","),o="";if(e&&s!==-1){let a=t.slice(s+1);o=a.length>10?"".concat(a.slice(0,10),"... [truncated]"):a}return"data:".concat(i).concat(r?",base64":"").concat(o?",".concat(o):"")}return t}function Ca(t,e){let n=e==null?void 0:e.getDsn(),i=e==null?void 0:e.getOptions().tunnel;return U2(t,n)||F2(t,i)}function F2(t,e){return e?iw(t)===iw(e):!1}
3function U2(t,e){let n=ni(t);return!n||Br(n)||!e?!1:B2(n.hostname,e.host)&&/(^|&|\?)sentry_key=/.test(n.search)}function B2(t,e){return t===e||e.length>0&&t.endsWith(".".concat(e))}function iw(t){return t[t.length-1]==="/"?t.slice(0,-1):t}function Xg(t){var e;"aggregates"in t?((e=t.attrs)==null?void 0:e.ip_address)===void 0&&(t.attrs=D(g({},t.attrs),{ip_address:"{{auto}}"})):t.ipAddress===void 0&&(t.ipAddress="{{auto}}")}function wa(t,e,n=[e],i="npm"){let r=(t._metadata=t._metadata||{}).sdk=t._metadata.sdk||{};r.name||(r.name="sentry.javascript.".concat(e),r.packages=n.map(s=>({name:"".concat(i,":@sentry/").concat(s),version:sr})),r.version=sr)}function xa(t={}){let e=t.client||G();if(!_c()||!e)return{};let n=vn(),i=ar(n);if(i.getTraceData)return i.getTraceData(t);let r=t.scope||te(),s=t.span||Ge(),o=cr(s)&&!Ct(e.getOptions());if(!s&&dd())return{};let a=s&&!o?ic(s):H2(r),l=s?sn(s):oo(e,r),c=hg(l);if(!bd.test(a))return C.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let p={"sentry-trace":a,baggage:c};return t.propagateTraceparent&&(p.traceparent=s&&!o?zI(s):q2(r)),p}function H2(t){let{traceId:e,sampled:n,propagationSpanId:i}=t.getPropagationContext();return Zl(e,i,n)}function q2(t){let{traceId:e,sampled:n,propagationSpanId:i}=t.getPropagationContext();return ec(e,i,n)}var j2=100;function ii(t,e){let n=G(),i=st();if(!n)return;let{beforeBreadcrumb:r=null,maxBreadcrumbs:s=j2}=n.getOptions();if(s<=0)return;let o=Gn(),a=g({timestamp:o},t),l=r?Bt(()=>r(a,e)):a;l!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",l,e),i.addBreadcrumb(l,s))}var G2="FunctionToString",rw=new WeakMap,W2=()=>({name:G2,setupOnce(){let t=Function.prototype.toString;try{Function.prototype.toString=function(...e){let n=us(this),i;try{rw.has(G())&&n!==void 0&&(i=n)}catch{}return t.apply(i!=null?i:this,e)}}catch{}},setup(t){rw.set(t,!0)}}),po=W2;var V2=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],z2="EventFilters",Bd=(t={})=>{let e;return{name:z2,setup(n){let i=n.getOptions();e=sw(t,i)},processEvent(n,i,r){if(!e){let s=r.getOptions();e=sw(t,s)}return Y2(n,e)?null:n}}},mo=(t={})=>D(g({},Bd(t)),{name:"InboundFilters"});function sw(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:V2],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function Y2(t,e){if(t.type){if(t.type==="transaction"&&K2(t,e.ignoreTransactions))return B&&C.warn("Event dropped due to being matched by `ignoreTransactions` option.\nEvent: ".concat(qi(t))),!0}else{if($2(t,e.ignoreErrors))return B&&C.warn("Event dropped due to being matched by `ignoreErrors` option.\nEvent: ".concat(qi(t))),!0;if(Z2(t))return B&&C.warn("Event dropped due to not having an error message, error type or stacktrace.\nEvent: ".concat(qi(t))),!0;if(Q2(t,e.denyUrls))return B&&C.warn("Event dropped due to being matched by `denyUrls` option.\nEvent: ".concat(qi(t),".\nUrl: ").concat(Ud(t))),!0;if(!X2(t,e.allowUrls))return B&&C.warn("Event dropped due to not being matched by `allowUrls` option.\nEvent: ".concat(qi(t),".\nUrl: ").concat(Ud(t))),!0}return!1}function $2(t,e){return e!=null&&e.length?Ld(t).some(n=>rn(n,e)):!1}function K2(t,e){if(!(e!=null&&e.length))return!1;let n=t.transaction;return n?rn(n,e):!1}function Q2(t,e){if(!(e!=null&&e.length))return!1;let n=Ud(t);return n?rn(n,e):!1}function X2(t,e){if(!(e!=null&&e.length))return!0;let n=Ud(t);return n?rn(n,e):!0}function J2(t=[]){for(let e=t.length-1;e>=0;e--){let n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function Ud(t){var e,n,i;try{let r=[...(n=(e=t.exception)==null?void 0:e.values)!=null?n:[]].reverse().find(o=>{var a,l,c;return((a=o.mechanism)==null?void 0:a.parent_id)===void 0&&((c=(l=o.stacktrace)==null?void 0:l.frames)==null?void 0:c.length)}),s=(i=r==null?void 0:r.stacktrace)==null?void 0:i.frames;return s?J2(s):null}catch{return B&&C.error("Cannot extract url for event ".concat(qi(t))),null}}function Z2(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)!=null&&n.length?!t.message&&!t.exception.values.some(i=>i.stacktrace||i.type&&i.type!=="Error"||i.value):!1}function Zg(t,e,n,i,r,s){var a;if(!((a=r.exception)!=null&&a.values)||!s||!pn(s.originalException))return;let o=r.exception.values.length>0?r.exception.values[r.exception.values.length-1]:void 0;o&&(r.exception.values=Jg(t,e,i,s.originalException,n,r.exception.values,o,0))}function Jg(t,e,n,i,r,s,o,a){if(s.length>=n+1)return s;let l=[...s];if(pn(i[r])){ow(o,a,i);let c=t(e,i[r]),u=l.length;aw(c,r,u,a),l=Jg(t,e,n,i[r],r,[c,...l],c,u)}
3return lw(i)&&i.errors.forEach((c,u)=>{if(pn(c)){ow(o,a,i);let p=t(e,c),m=l.length;aw(p,"errors[".concat(u,"]"),m,a),l=Jg(t,e,n,c,r,[p,...l],p,m)}}),l}function lw(t){return Array.isArray(t.errors)}function ow(t,e,n){t.mechanism=D(g(g({handled:!0,type:"auto.core.linked_errors"},lw(n)&&{is_exception_group:!0}),t.mechanism),{exception_id:e})}function aw(t,e,n,i){t.mechanism=D(g({handled:!0},t.mechanism),{type:"chained",source:e,exception_id:n,parent_id:i})}function eL(t){return pn(t)&&"__sentry_fetch_url_host__"in t&&typeof t.__sentry_fetch_url_host__=="string"}function Hd(t){return eL(t)?"".concat(t.message," (").concat(t.__sentry_fetch_url_host__,")"):t.message}var cw=new Set([]);function Cc(t){let e="console",n=cn(e,t);return un(e,tL),n}var uw=new Set;function tL(){"console"in z&&la.forEach(function(t){uw.has(t)||!(t in z.console)||(uw.add(t),Tt(z.console,t,function(e){return Qs[t]=e,function(...n){let i=n[0],r=Qs[t],s=cw.size&&typeof i=="string"&&rn(i,cw);s||Rt("console",{args:n,level:t}),(!s||B&&C.isEnabled())&&(r==null||r.apply(z.console,n))}}))})}function Hr(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var nL="CaptureConsole",iL=(t={})=>{var i;let e=t.levels||la,n=(i=t.handled)!=null?i:!0;return{name:nL,setup(r){"console"in z&&Cc(({args:s,level:o})=>{G()!==r||!e.includes(o)||rL(s,o,n)})}}},qd=iL;function rL(t,e,n){let i=Hr(e),r=new Error,s={level:Hr(e),extra:{arguments:t}};lr(o=>{if(o.addEventProcessor(c=>(c.logger="console",mn(c,{handled:n,type:"auto.core.capture_console"}),c)),e==="assert"){if(!t[0]){let c="Assertion failed: ".concat(ps(t.slice(1)," ")||"console.assert");o.setExtra("arguments",t.slice(1)),o.captureMessage(c,i,{captureContext:s,syntheticException:r})}return}let a=t.find(c=>c instanceof Error);if(a){Wi(a,s);return}let l=ps(t," ");o.captureMessage(l,i,{captureContext:s,syntheticException:r})})}var sL="Dedupe",oL=()=>{let t;return{name:sL,processEvent(e){if(e.type)return e;try{if(aL(e,t))return B&&C.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},fo=oL;function aL(t,e){return e?!!(lL(t,e)||cL(t,e)):!1}function lL(t,e){let n=t.message,i=e.message;return!(!n&&!i||n&&!i||!n&&i||n!==i||!mw(t,e)||!dw(t,e))}function cL(t,e){let n=pw(e),i=pw(t);return!(!n||!i||n.type!==i.type||n.value!==i.value||!mw(t,e)||!dw(t,e))}function dw(t,e){let n=ql(t),i=ql(e);if(!n&&!i)return!0;if(n&&!i||!n&&i||(n=n,i=i,i.length!==n.length))return!1;for(let r=0;r<i.length;r++){let s=i[r],o=n[r];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function mw(t,e){let n=t.fingerprint,i=e.fingerprint;if(!n&&!i)return!0;if(n&&!i||!n&&i)return!1;n=n,i=i;try{return n.join("")===i.join("")}catch{return!1}}function pw(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}var uL="ConversationId",pL=()=>({name:uL,setup(t){t.on("spanStart",e=>{let n=te().getScopeData(),i=st().getScopeData(),r=n.conversationId||i.conversationId;if(r){let{op:s,data:o,description:a}=ne(e);if(!(s!=null&&s.startsWith("gen_ai."))&&!o["ai.operationId"]&&!(a!=null&&a.startsWith("ai.")))return;e.setAttribute(gd,r)}})}}),Aa=pL;function e_(t,e,n,i,r){if(!t.fetchData)return;let{method:s,url:o}=t.fetchData,a=Ct()&&e(o);if(t.endTimestamp){let _=t.fetchData.__span;if(!_)return;let v=i[_];v&&(a&&(mL(v,t),dL(v,t,r)),delete i[_]);return}let{spanOrigin:l="auto.http.browser",propagateTraceparent:c=!1}=typeof r=="object"?r:{spanOrigin:r},u=G(),p=!!Ge(),m=p||!!u&&$t(u),f=a&&m?Nt(gL(o,s,l)):new Yn,h=ba(f)&&p?void 0:f;if(a&&!m&&(u==null||u.recordDroppedEvent("no_parent_span","span")),t.fetchData.__span=f.spanContext().spanId,i[f.spanContext().spanId]=f,n(t.fetchData.url)){let _=t.args[0],v=g({},t.args[1]||{}),I=hw(_,v,Ct()&&m?h:void 0,c);I&&(t.args[1]=v,v.headers=I)}if(u){let _={input:t.args,response:t.response,startTimestamp:t.startTimestamp,endTimestamp:t.endTimestamp};u.emit("beforeOutgoingRequestSpan",f,_)}return f}function dL(t,e,n){var r;let i=typeof n=="object"&&n!==null?n.onRequestSpanEnd:void 0;i==null||i(t,{headers:(r=e.response)==null?void 0:r.headers,error:e.error})}
3function hw(t,e,n,i){let r=xa({span:n,propagateTraceparent:i}),s=r["sentry-trace"],o=r.baggage,a=r.traceparent;if(!s)return;let l=e.headers||(zl(t)?t.headers:void 0);if(l)if(fL(l)){let c=new Headers(l);if(c.get("sentry-trace")||c.set("sentry-trace",s),i&&a&&!c.get("traceparent")&&c.set("traceparent",a),o){let u=c.get("baggage");u?jd(u)||c.set("baggage","".concat(u,",").concat(o)):c.set("baggage",o)}return c}else if(hL(l)){let c=[...l];c.find(p=>p[0]==="sentry-trace")||c.push(["sentry-trace",s]),i&&a&&!c.find(p=>p[0]==="traceparent")&&c.push(["traceparent",a]);let u=l.find(p=>p[0]==="baggage"&&typeof p[1]=="string"&&jd(p[1]));return o&&!u&&c.push(["baggage",o]),c}else{let c="sentry-trace"in l?l["sentry-trace"]:void 0,u="traceparent"in l?l.traceparent:void 0,p="baggage"in l?l.baggage:void 0,m=p?Array.isArray(p)?[...p]:[p]:[],f=p&&(Array.isArray(p)?p.find(_=>jd(_)):jd(p));o&&!f&&m.push(o);let h=Object.assign({},l,g({"sentry-trace":c!=null?c:s},m.length>0&&{baggage:m.join(",")}));return i&&a&&!u&&(h.traceparent=a),h}else return g(g({"sentry-trace":s},o&&{baggage:o}),a&&{traceparent:a})}function mL(t,e){var n,i;if(e.response){ha(t,e.response.status);let r=(i=(n=e.response)==null?void 0:n.headers)==null?void 0:i.get("content-length");if(r){let s=parseInt(r);s>0&&t.setAttribute("http.response_content_length",s)}}else e.error&&t.setStatus({code:2,message:"internal_error"});t.end()}function jd(t){return typeof t!="string"?!1:t.split(",").some(e=>e.trim().startsWith(Jl))}function fL(t){return typeof Headers<"u"&&Xs(t,Headers)}function hL(t){return Array.isArray(t)?t.every(e=>Array.isArray(e)&&e.length===2&&typeof e[0]=="string"):!1}function gL(t,e,n){if(t.startsWith("data:")){let s=on(t);return{name:"".concat(e," ").concat(s),attributes:fw(t,void 0,e,n)}}let i=ni(t),r=i?Ta(i):t;return{name:"".concat(e," ").concat(r),attributes:fw(t,i,e,n)}}function fw(t,e,n,i){let r={url:on(t),type:"fetch","http.method":n,[Oe]:i,[ot]:"http.client"};return e&&(Br(e)||(r[Nd]=on(e.href),r[ti]=on(e.href),r["server.address"]=e.host),e.search&&(r["http.query"]=e.search),e.hash&&(r["http.fragment"]=e.hash)),r}function Gd(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}var wc=z;function Wd(){return"history"in wc&&!!wc.history}function _L(){if(!("fetch"in wc))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function ka(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Ra(){var n;if(typeof EdgeRuntime=="string")return!0;if(!_L())return!1;if(ka(wc.fetch))return!0;let t=!1,e=wc.document;if(e&&typeof e.createElement=="function")try{let i=e.createElement("iframe");i.hidden=!0,e.head.appendChild(i),(n=i.contentWindow)!=null&&n.fetch&&(t=ka(i.contentWindow.fetch)),e.head.removeChild(i)}catch(i){B&&C.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",i)}return t}function pr(t,e){let n="fetch",i=cn(n,t);return un(n,()=>_w(void 0,e)),i}function zd(t){let e="fetch-body-resolved",n=cn(e,t);return un(e,()=>_w(bL)),n}function _w(t,e=!1){e&&!Ra()||Tt(z,"fetch",function(n){return function(...i){let r=new Error,{method:s,url:o}=vL(i),a={args:i,fetchData:{method:s,url:o},startTimestamp:Ve()*1e3,virtualError:r,headers:SL(i)};return t||Rt("fetch",g({},a)),n.apply(z,i).then(l=>k(null,null,function*(){return t?t(l):Rt("fetch",D(g({},a),{endTimestamp:Ve()*1e3,response:l})),l}),l=>{var m;Rt("fetch",D(g({},a),{endTimestamp:Ve()*1e3,error:l})),pn(l)&&l.stack===void 0&&(l.stack=r.stack,et(l,"framesToPop",1));let c=G(),u=(m=c==null?void 0:c.getOptions().enhanceFetchErrorMessages)!=null?m:"always";if(u!==!1&&pn(l)&&l.name==="TypeError"&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{let h=new URL(a.fetchData.url).host;u==="always"?l.message="".concat(l.message," (").concat(h,")"):et(l,"__sentry_fetch_url_host__",h)}catch{}throw l})}})}function yL(t,e){return k(this,null,function*(){if(t!=null&&t.body){let n=t.body,i=n.getReader(),r=setTimeout(()=>{n.cancel().then(null,()=>{})},90*1e3),s=!0;for(;s;){let o;try{o=setTimeout(()=>{n.cancel().then(null,()=>{})},5e3);let{done:a}=yield i.read();clearTimeout(o),a&&(e(),s=!1)}catch{s=!1}finally{clearTimeout(o)}}clearTimeout(r),i.releaseLock(),n.cancel().then(null,()=>{})}})}function bL(t){let e;try{e=t.clone()}catch{return}yL(e,()=>{Rt("fetch-body-resolved",{endTimestamp:Ve()*1e3,response:t})})}function Vd(t,e){return Jn(t)&&!!t[e]}function gw(t){return typeof t=="string"?t:t?Vd(t,"url")?t.url:t.toString?t.toString():"":""}function vL(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[n,i]=t;return{url:gw(n),method:Vd(i,"method")?String(i.method).toUpperCase():zl(n)&&Vd(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:gw(e),method:Vd(e,"method")?String(e.method).toUpperCase():"GET"}}function SL(t){let[e,n]=t;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(zl(e))return new Headers(e.headers)}catch{}}var yw=z;function In(){try{return yw.document.location.href}catch{return""}}
3function Oa(t,e=5){if(!yw.HTMLElement)return null;let n=t;for(let i=0;i<e;i++){if(!n)return null;if(n instanceof HTMLElement){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}n=n.parentNode}return null}var ie=z,t_=0;function n_(){return t_>0}function c6(){t_++,setTimeout(()=>{t_--})}function ho(t,e={}){function n(r){return typeof r=="function"}if(!n(t))return t;try{if(Object.prototype.hasOwnProperty.call(t,"__sentry_wrapped__")){let s=t.__sentry_wrapped__;return typeof s=="function"?s:t}if(us(t))return t}catch{return t}let i=function(...r){z._sentryWrappedDepth=(z._sentryWrappedDepth||0)+1;try{let s=r.map(o=>ho(o,e));return t.apply(this,s)}catch(s){throw c6(),lr(o=>{o.addEventProcessor(a=>(e.mechanism&&(eo(a,void 0,void 0),mn(a,e.mechanism)),a.extra=D(g({},a.extra),{arguments:r}),a)),Wi(s)}),s}finally{z._sentryWrappedDepth=(z._sentryWrappedDepth||0)-1}};try{for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}catch{}Yl(i,t),et(t,"__sentry_wrapped__",i);try{Object.getOwnPropertyDescriptor(i,"name").configurable&&Object.defineProperty(i,"name",{get(){return t.name}})}catch{}return i}function Na(){let t=In(),{referrer:e}=ie.document||{},{userAgent:n}=ie.navigator||{},i=g(g({},e&&{Referer:e}),n&&{"User-Agent":n});return{url:t,headers:i}}function Yd(t,e){let n=$d(t,e),i={type:f6(e),value:h6(e)};return n.length&&(i.stacktrace={frames:n}),i.type===void 0&&i.value===""&&(i.value="Unrecoverable error caught"),i}function u6(t,e,n,i){let r=G(),s=r==null?void 0:r.getOptions().normalizeDepth,o=y6(e),a={__serialized__:Kl(e,s)};if(o)return{exception:{values:[Yd(t,o)]},extra:a};let l={exception:{values:[{type:cs(e)?e.constructor.name:i?"UnhandledRejection":"Error",value:g6(e,{isUnhandledRejection:i})}]},extra:a};if(n){let c=$d(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function i_(t,e){return{exception:{values:[Yd(t,e)]}}}function $d(t,e){let n=e.stacktrace||e.stack||"",i=d6(e),r=m6(e);try{return t(n,i,r)}catch{}return[]}var p6=/Minified React error #\d+;/i;function d6(t){return t&&p6.test(t.message)?1:0}function m6(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Uw(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function f6(t){let e=t==null?void 0:t.name;return!e&&Uw(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function h6(t){let e=t==null?void 0:t.message;return Uw(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?Hd(e.error):Hd(t):"No error message"}function Bw(t,e,n,i){let r=(n==null?void 0:n.syntheticException)||void 0,s=Kd(t,e,r,i);return mn(s),s.level="error",n!=null&&n.event_id&&(s.event_id=n.event_id),ur(s)}function Hw(t,e,n="info",i,r){let s=(i==null?void 0:i.syntheticException)||void 0,o=r_(t,e,s,r);return o.level=n,i!=null&&i.event_id&&(o.event_id=i.event_id),ur(o)}function Kd(t,e,n,i,r){var o,a;let s;if(ua(e)&&e.error)return i_(t,e.error);if(Vl(e)||rd(e)){let l=e;if("stack"in e){s=i_(t,e);let c=(a=(o=s.exception)==null?void 0:o.values)==null?void 0:a[0];if(i&&n&&c&&!c.stacktrace){let u=$d(t,n);u.length&&(c.stacktrace={frames:u},mn(s,{synthetic:!0}))}}else{let c=l.name||(Vl(l)?"DOMError":"DOMException"),u=l.message?"".concat(c,": ").concat(l.message):c;s=r_(t,u,n,i),eo(s,u)}return"code"in l&&(s.tags=D(g({},s.tags),{"DOMException.code":"".concat(l.code)})),s}return pn(e)?i_(t,e):or(e)||cs(e)?(s=u6(t,e,n,r),mn(s,{synthetic:!0}),s):(s=r_(t,e,n,i),eo(s,"".concat(e),void 0),mn(s,{synthetic:!0}),s)}function r_(t,e,n,i){let r={};if(i&&n){let s=$d(t,n);s.length&&(r.exception={values:[{value:e,stacktrace:{frames:s}}]}),mn(r,{synthetic:!0})}if(ls(e)){let{__sentry_template_string__:s,__sentry_template_values__:o}=e;return r.logentry={message:s,params:o},r}return r.message=e,r}function g6(t,{isUnhandledRejection:e}){let n=od(t),i=e?"promise rejection":"exception";if(ua(t))return"Event `ErrorEvent` captured as ".concat(i," with message `").concat(t.message,"`");
3if(cs(t)){let r=_6(t);return"Event `".concat(r,"` (type=").concat(t.type,") captured as ").concat(i)}return"Object captured as ".concat(i," with keys: ").concat(n)}function _6(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function y6(t){return Object.values(t).find(pn)}var Qd=class extends Tc{constructor(e){var o;let n=b6(e),i=ie.SENTRY_SDK_SOURCE||Gg();wa(n,"browser",["browser"],i),super(n);let{userInfo:r}=this.getDataCollectionOptions();(o=n._metadata)!=null&&o.sdk&&(n._metadata.sdk.settings=g({infer_ip:r?"auto":"never"},n._metadata.sdk.settings));let{sendClientReports:s}=this._options;ie.document&&ie.document.addEventListener("visibilitychange",()=>{ie.document.visibilityState==="hidden"&&(s&&this._flushOutcomes(),queueMicrotask(()=>{this.flush()}))}),r&&this.on("beforeSendSession",Xg)}eventFromException(e,n){return Bw(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",i){return Hw(this._options.stackParser,e,n,i,this._options.attachStacktrace)}_prepareEvent(e,n,i,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,i,r)}};function b6(t){var e;return g({release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(e=ie.SENTRY_RELEASE)==null?void 0:e.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0},t)}var Kt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var K=z;var v6=(t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good",mr=(t,e,n,i)=>{let r,s;return o=>{e.value>=0&&(o||i)&&(s=e.value-(r!=null?r:0),(s||r===void 0)&&(r=e.value,e.delta=s,e.rating=v6(e.value,n),t(e)))}};var jr=(t=!0)=>{var n,i;let e=(i=(n=K.performance)==null?void 0:n.getEntriesByType)==null?void 0:i.call(n,"navigation")[0];if(!t||e&&e.responseStart>0&&e.responseStart<performance.now())return e};var Ii=()=>{var e;let t=jr();return(e=t==null?void 0:t.activationStart)!=null?e:0};function Ci(t,e,n){K.document&&K.addEventListener(t,e,n)}function go(t,e,n){K.document&&K.removeEventListener(t,e,n)}var Ma=-1,qw=new Set,S6=()=>{var t,e;return((t=K.document)==null?void 0:t.visibilityState)==="hidden"&&!((e=K.document)!=null&&e.prerendering)?0:1/0},Xd=t=>{if(E6(t)&&Ma>-1){if(t.type==="visibilitychange"||t.type==="pagehide")for(let e of qw)e();isFinite(Ma)||(Ma=t.type==="visibilitychange"?t.timeStamp:0,go("prerenderingchange",Xd,!0))}},fr=()=>{var t;if(K.document&&Ma<0){let e=Ii(),n=K.document.prerendering||(t=globalThis.performance.getEntriesByType("visibility-state").filter(i=>i.name==="hidden"&&i.startTime>e)[0])==null?void 0:t.startTime;Ma=n!=null?n:S6(),Ci("visibilitychange",Xd,!0),Ci("pagehide",Xd,!0),Ci("prerenderingchange",Xd,!0)}return{get firstHiddenTime(){return Ma},onHidden(e){qw.add(e)}}};function E6(t){var e;return t.type==="pagehide"||((e=K.document)==null?void 0:e.visibilityState)==="hidden"}var jw=()=>"v5-".concat(Date.now(),"-").concat(Math.floor(Math.random()*8999999999999)+1e12);var hr=(t,e=-1)=>{var s,o;let n=jr(),i="navigate";return n&&((s=K.document)!=null&&s.prerendering||Ii()>0?i="prerender":(o=K.document)!=null&&o.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:t,value:e,rating:"good",delta:0,entries:[],id:jw(),navigationType:i}};var s_=new WeakMap;function Pa(t,e){try{return s_.get(t)||s_.set(t,new e),s_.get(t)}catch{return new e}}var Jd=class{constructor(){this._sessionValue=0,this._sessionEntries=[]}_processEntry(e){var r;if(e.hadRecentInput)return;let n=this._sessionEntries[0],i=this._sessionEntries[this._sessionEntries.length-1];this._sessionValue&&n&&i&&e.startTime-i.startTime<1e3&&e.startTime-n.startTime<5e3?(this._sessionValue+=e.value,this._sessionEntries.push(e)):(this._sessionValue=e.value,this._sessionEntries=[e]),(r=this._onAfterProcessingUnexpectedShift)==null||r.call(this,e)}};var wi=(t,e,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(t)){let i=new PerformanceObserver(r=>{Promise.resolve().then(()=>{e(r.getEntries())})});return i.observe(g({type:t,buffered:!0},n)),i}}catch{}};var Da=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var bs=t=>{var e;(e=K.document)!=null&&e.prerendering?addEventListener("prerenderingchange",()=>t(),!0):t()};var T6=[1800,3e3],Gw=(t,e={})=>{bs(()=>{let n=fr(),i=hr("FCP"),r,o=wi("paint",a=>
3{for(let l of a)l.name==="first-contentful-paint"&&(o.disconnect(),l.startTime<n.firstHiddenTime&&(i.value=Math.max(l.startTime-Ii(),0),i.entries.push(l),r(!0)))});o&&(r=mr(t,i,T6,e.reportAllChanges))})};var I6=[.1,.25],Ww=(t,e={})=>{Gw(Da(()=>{var l,c;let n=hr("CLS",0),i,r=fr(),s=Pa(e,Jd),o=u=>{for(let p of u)s._processEntry(p);s._sessionValue>n.value&&(n.value=s._sessionValue,n.entries=s._sessionEntries,i())},a=wi("layout-shift",o);a&&(i=mr(t,n,I6,e.reportAllChanges),r.onHidden(()=>{o(a.takeRecords()),i(!0)}),(c=(l=K)==null?void 0:l.setTimeout)==null||c.call(l,i))}))};var Vw=0,o_=1/0,Zd=0,C6=t=>{t.forEach(e=>{e.interactionId&&(o_=Math.min(o_,e.interactionId),Zd=Math.max(Zd,e.interactionId),Vw=Zd?(Zd-o_)/7+1:0)})},a_,l_=()=>a_?Vw:performance.interactionCount||0,zw=()=>{"interactionCount"in performance||a_||(a_=wi("event",C6,{type:"event",buffered:!0,durationThreshold:0}))};var c_=10,Yw=0,w6=()=>l_()-Yw,em=class{constructor(){this._longestInteractionList=[],this._longestInteractionMap=new Map}_resetInteractions(){Yw=l_(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){let e=Math.min(this._longestInteractionList.length-1,Math.floor(w6()/50));return this._longestInteractionList[e]}_processEntry(e){var r,s;if((r=this._onBeforeProcessingEntry)==null||r.call(this,e),!(e.interactionId||e.entryType==="first-input"))return;let n=this._longestInteractionList.at(-1),i=this._longestInteractionMap.get(e.interactionId);if(i||this._longestInteractionList.length<c_||e.duration>n._latency){if(i?e.duration>i._latency?(i.entries=[e],i._latency=e.duration):e.duration===i._latency&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(i={id:e.interactionId,entries:[e],_latency:e.duration},this._longestInteractionMap.set(i.id,i),this._longestInteractionList.push(i)),this._longestInteractionList.sort((o,a)=>a._latency-o._latency),this._longestInteractionList.length>c_){let o=this._longestInteractionList.splice(c_);for(let a of o)this._longestInteractionMap.delete(a.id)}(s=this._onAfterProcessingINPCandidate)==null||s.call(this,i)}}};var _o=t=>{var n;let e=K.requestIdleCallback||K.setTimeout;((n=K.document)==null?void 0:n.visibilityState)==="hidden"?t():(t=Da(t),Ci("visibilitychange",t,{once:!0,capture:!0}),Ci("pagehide",t,{once:!0,capture:!0}),e(()=>{t(),go("visibilitychange",t,{capture:!0}),go("pagehide",t,{capture:!0})}))};var x6=[200,500],A6=40,$w=(t,e={})=>{if(!(globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype))return;let n=fr();bs(()=>{var l;zw();let i=hr("INP"),r,s=Pa(e,em),o=c=>{_o(()=>{for(let p of c)s._processEntry(p);let u=s._estimateP98LongestInteraction();u&&u._latency!==i.value&&(i.value=u._latency,i.entries=u.entries,r())})},a=wi("event",o,{durationThreshold:(l=e.durationThreshold)!=null?l:A6});r=mr(t,i,x6,e.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{o(a.takeRecords()),r(!0)}))})};var tm=class{_processEntry(e){var n;(n=this._onBeforeProcessingEntry)==null||n.call(this,e)}};var k6=[2500,4e3],Kw=(t,e={})=>{bs(()=>{let n=fr(),i=hr("LCP"),r,s=Pa(e,tm),o=l=>{e.reportAllChanges||(l=l.slice(-1));for(let c of l)s._processEntry(c),c.startTime<n.firstHiddenTime&&(i.value=Math.max(c.startTime-Ii(),0),i.entries=[c],r())},a=wi("largest-contentful-paint",o);if(a){r=mr(t,i,k6,e.reportAllChanges);let l=Da(()=>{o(a.takeRecords()),a.disconnect(),r(!0)}),c=u=>{u.isTrusted&&(_o(l),go(u.type,c,{capture:!0}))};for(let u of["keydown","click","visibilitychange"])Ci(u,c,{capture:!0})}})};var R6=[800,1800],u_=t=>{var e,n;(e=K.document)!=null&&e.prerendering?bs(()=>u_(t)):((n=K.document)==null?void 0:n.readyState)!=="complete"?addEventListener("load",()=>u_(t),!0):setTimeout(t)},Qw=(t,e={})=>{let n=hr("TTFB"),i=mr(t,n,R6,e.reportAllChanges);u_(()=>{let r=jr();r&&(n.value=Math.max(r.responseStart-Ii(),0),n.entries=[r],i(!0))})};var xc={},nm={},Xw,Jw,Zw,e1;function Gr(t,e=!1){return im("cls",t,O6,Xw,e)}function Wr(t,e=!1){return im("lcp",t,N6,Jw,e)}function p_(t){return im("ttfb",t,M6,Zw)}function yo(t){return im("inp",t,P6,e1)}function xi(t,e){return t1(t,e),nm[t]||(D6(t),nm[t]=!0),n1(t,e)}function Ac(t,e){let n=xc[t];if(n!=null&&n.length)for(let i of n)try{i(e)}catch(r){Kt&&C.error("Error while triggering instrumentation handler.\nType: ".concat(t,"\nName: ").concat(Sn(i),"\nError:"),r)}}function O6(){return Ww(t=>{Ac("cls",{metric:t}),Xw=t},{reportAllChanges:!0})}function N6(){return Kw(t=>{Ac("lcp",{metric:t}),Jw=t},{reportAllChanges:!0})}function M6(){return Qw(t=>{Ac("ttfb",{metric:t}),Zw=t})}function P6(){return $w(t=>{Ac("inp",{metric:t}),e1=t})}function im(t,e,n,i,r=!1){t1(t,e);let s;return nm[t]||(s=n(),nm[t]=!0),i&&e({metric:i}),n1(t,e,r?s:void 0)}function D6(t){let e={};t==="event"&&(e.durationThreshold=0),wi(t,n=>
3{Ac(t,{entries:n})},e)}function t1(t,e){xc[t]=xc[t]||[],xc[t].push(e)}function n1(t,e,n){return()=>{n&&n();let i=xc[t];if(!i)return;let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}function i1(t){return"duration"in t}var L6=80,bo={};try{typeof Node<"u"&&(bo.parentNode=Object.getOwnPropertyDescriptor(Node.prototype,"parentNode").get),typeof Element<"u"&&(bo.tagName=Object.getOwnPropertyDescriptor(Element.prototype,"tagName").get,bo.id=Object.getOwnPropertyDescriptor(Element.prototype,"id").get,bo.className=Object.getOwnPropertyDescriptor(Element.prototype,"className").get,bo.getAttribute=Element.prototype.getAttribute),typeof HTMLElement<"u"&&(bo.dataset=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"dataset").get)}catch{}function vs(t,e,n){let i=bo[e];if(i)try{return i.call(t,n)}catch{}let r=t[e];return typeof r=="function"?r.call(t,n):r}function nt(t,e={}){if(!t)return"<unknown>";try{let n=t,i=5,r=[],s=0,o=0,a=" > ",l=a.length,c,u=Array.isArray(e)?e:e.keyAttrs,p=!Array.isArray(e)&&e.maxStringLength||L6;for(;n&&s++<i&&(c=F6(n,u),!(c==="html"||s>1&&o+r.length*l+c.length>=p));)r.push(c),o+=c.length,n=vs(n,"parentNode");return r.reverse().join(a)}catch{return"<unknown>"}}function F6(t,e){let n=[],i=vs(t,"tagName");if(!i)return"";if(typeof HTMLElement<"u"&&t instanceof HTMLElement){let s=vs(t,"dataset");if(s){if(s.sentryComponent)return s.sentryComponent;if(s.sentryElement)return s.sentryElement}}n.push(i.toLowerCase());let r=e!=null&&e.length?e.filter(s=>vs(t,"getAttribute",s)).map(s=>[s,vs(t,"getAttribute",s)]):null;if(r!=null&&r.length)r.forEach(s=>{n.push("[".concat(s[0],'="').concat(s[1],'"]'))});else{let s=vs(t,"id");s&&n.push("#".concat(s));let o=vs(t,"className");if(o&&Ot(o)){let a=o.split(/\s+/);for(let l of a)n.push(".".concat(l))}}for(let s of["aria-label","type","name","title","alt"]){let o=vs(t,"getAttribute",s);o&&n.push("[".concat(s,'="').concat(o,'"]'))}return n.join("")}var r1=t=>{let e=n=>{var i;(n.type==="pagehide"||((i=K.document)==null?void 0:i.visibilityState)==="hidden")&&t(n)};Ci("visibilitychange",e,{capture:!0,once:!0}),Ci("pagehide",e,{capture:!0,once:!0})};function rm(t){return typeof t=="number"&&isFinite(t)}function Vr(t,e,n,r){var i=Lo(r,[]);let s=ne(t).start_timestamp;return s&&s>e&&typeof t.updateStartTime=="function"&&t.updateStartTime(e),ya(t,()=>{let o=Nt(g({startTime:e},i));return o&&o.end(n),o})}function La(t){var v;let e=G();if(!e)return;let{name:n,transaction:i,attributes:r,startTime:s}=t,{release:o,environment:a}=e.getOptions(),{userInfo:l}=e.getDataCollectionOptions(),c=e.getIntegrationByName("Replay"),u=c==null?void 0:c.getReplayId(),p=te(),m=p.getUser(),f=m!==void 0?m.email||m.id||m.ip_address:void 0,h;try{h=p.getScopeData().contexts.profile.profile_id}catch{}let _=g({release:o,environment:a,user:f||void 0,profile_id:h||void 0,replay_id:u||void 0,transaction:i,"user_agent.original":(v=K.navigator)==null?void 0:v.userAgent,"client.address":l?"{{auto}}":void 0},r);return Nt({name:n,attributes:_,startTime:s,experimental:{standalone:!0}})}function gr(){return K.addEventListener&&K.performance}function Ke(t){return t/1e3}function s1(t){let e="unknown",n="unknown",i="";for(let r of t){if(r==="/"){[e,n]=t.split("/");break}if(!isNaN(Number(r))){e=i==="h"?"http":i,n=t.split(i)[1];break}i+=r}return i===t&&(e=i),{name:e,version:n}}function vo(t){try{return PerformanceObserver.supportedEntryTypes.includes(t)}catch{return!1}}function So(t,e){let n,i=!1;function r(a){!i&&n&&e(a,n.spanContext().spanId,n),i=!0}r1(()=>{r("pagehide")});let s=t.on("beforeStartNavigationSpan",(a,l)=>{l!=null&&l.isRedirect||(r("navigation"),s(),o())}),o=t.on("afterStartPageLoadSpan",a=>{n=a,o()})}function o1(t){let e=0,n;if(!vo("layout-shift"))return;let i=Gr(({metric:r})=>{let s=r.entries[r.entries.length-1];s&&(e=r.value,n=s)},!0);So(t,(r,s)=>{U6(e,n,s,r),i()})}function U6(t,e,n,i){var c;Kt&&C.log("Sending CLS span (".concat(t,")"));let r=e?Ke((tt()||0)+e.startTime):Ve(),s=te().getScopeData().transactionName,o=e?nt((c=e.sources[0])==null?void 0:c.node):"Layout shift",a={[Oe]:"auto.http.browser.cls",[ot]:"ui.webvital.cls",[hn]:0,"sentry.pageload.span_id":n,"sentry.report_event":i};
3e!=null&&e.sources&&e.sources.forEach((u,p)=>{a["cls.source.".concat(p+1)]=nt(u.node)});let l=La({name:o,transaction:s,attributes:a,startTime:r});l&&(l.addEvent("cls",{[ji]:"",[Gi]:t}),l.end(r))}var B6=6e4;function Eo(t){return t!=null&&t>0&&t<=B6}function a1(t){let e=0,n;if(!vo("largest-contentful-paint"))return;let i=Wr(({metric:r})=>{let s=r.entries[r.entries.length-1];!s||!Eo(r.value)||(e=r.value,n=s)},!0);So(t,(r,s)=>{H6(e,n,s,r),i()})}function H6(t,e,n,i){if(!Eo(t))return;Kt&&C.log("Sending LCP span (".concat(t,")"));let r=Ke((tt()||0)+((e==null?void 0:e.startTime)||0)),s=te().getScopeData().transactionName,o=e?nt(e.element):"Largest contentful paint",a={[Oe]:"auto.http.browser.lcp",[ot]:"ui.webvital.lcp",[hn]:0,"sentry.pageload.span_id":n,"sentry.report_event":i};e&&(e.element&&(a["lcp.element"]=nt(e.element)),e.id&&(a["lcp.id"]=e.id),e.url&&(a["lcp.url"]=e.url),e.loadTime!=null&&(a["lcp.loadTime"]=e.loadTime),e.renderTime!=null&&(a["lcp.renderTime"]=e.renderTime),e.size!=null&&(a["lcp.size"]=e.size));let l=La({name:o,transaction:s,attributes:a,startTime:r});l&&(l.addEvent("lcp",{[ji]:"millisecond",[Gi]:t}),l.end(r))}function Ai(t){return t&&((tt()||performance.timeOrigin)+t)/1e3}function kc(t){var n;let e={};if(t.nextHopProtocol!=null){let{name:i,version:r}=s1(t.nextHopProtocol);e["network.protocol.version"]=r,e["network.protocol.name"]=i}return tt()||(n=gr())!=null&&n.timeOrigin?q6(D(g({},e),{"http.request.redirect_start":Ai(t.redirectStart),"http.request.redirect_end":Ai(t.redirectEnd),"http.request.worker_start":Ai(t.workerStart),"http.request.fetch_start":Ai(t.fetchStart),"http.request.domain_lookup_start":Ai(t.domainLookupStart),"http.request.domain_lookup_end":Ai(t.domainLookupEnd),"http.request.connect_start":Ai(t.connectStart),"http.request.secure_connection_start":Ai(t.secureConnectionStart),"http.request.connection_end":Ai(t.connectEnd),"http.request.request_start":Ai(t.requestStart),"http.request.response_start":Ai(t.responseStart),"http.request.response_end":Ai(t.responseEnd),"http.request.time_to_first_byte":t.responseStart!=null?t.responseStart/1e3:void 0})):e}function q6(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!=null))}var j6=2147483647,l1=0,Kn={},$n,Fa;function d_({recordClsStandaloneSpans:t,recordLcpStandaloneSpans:e,client:n}){let i=gr();if(i&&tt()){i.mark&&K.performance.mark("sentry-tracing-init");let r=e?a1(n):e===!1?W6():void 0,s=t?o1(n):t===!1?G6():void 0,o=V6(),a=z6();return()=>{o(),a(),r==null||r(),s==null||s()}}return()=>{}}function m_(){xi("longtask",({entries:t})=>{let e=Ge();if(!e)return;let{op:n,start_timestamp:i}=ne(e);for(let r of t){let s=Ke(tt()+r.startTime),o=Ke(r.duration);n==="navigation"&&i&&s<i||Vr(e,s,s+o,{name:"Main UI thread blocked",op:"ui.long-task",attributes:{[Oe]:"auto.ui.browser.metrics"}})}})}function f_(){new PerformanceObserver(e=>{let n=Ge();if(n)for(let i of e.getEntries()){if(!i.scripts[0])continue;let r=Ke(tt()+i.startTime),{start_timestamp:s,op:o}=ne(n);if(o==="navigation"&&s&&r<s)continue;let a=Ke(i.duration),l={[Oe]:"auto.ui.browser.metrics"},c=i.scripts[0],{invoker:u,invokerType:p,sourceURL:m,sourceFunctionName:f,sourceCharPosition:h}=c;l["browser.script.invoker"]=u,l["browser.script.invoker_type"]=p,m&&(l["code.filepath"]=m),f&&(l["code.function"]=f),h!==-1&&(l["browser.script.source_char_position"]=h),Vr(n,r,r+a,{name:"Main UI thread blocked",op:"ui.long-animation-frame",attributes:l})}}).observe({type:"long-animation-frame",buffered:!0})}function h_(){xi("event",({entries:t})=>{let e=Ge();if(e){for(let n of t)if(n.name==="click"){let i=Ke(tt()+n.startTime),r=Ke(n.duration),s={name:nt(n.target),op:"ui.interaction.".concat(n.name),startTime:i,attributes:{[Oe]:"auto.ui.browser.metrics"}},o=Oa(n.target);o&&(s.attributes["ui.component_name"]=o),Vr(e,i,i+r,s)}}})}function G6(){return Gr(({metric:t})=>{let e=t.entries[t.entries.length-1];e&&(Kn.cls={value:t.value,unit:""},Fa=e)},!0)}function W6(){return Wr(({metric:t})=>{let e=t.entries[t.entries.length-1];!e||!Eo(t.value)||(Kn.lcp={value:t.value,unit:"millisecond"},$n=e)},!0)}function V6(){return p_(({metric:t})=>{t.entries[t.entries.length-1]&&(Kn.ttfb={value:t.value,unit:"millisecond"})})}function z6(){return xi("paint",({entries:t})=>{let e=fr();for(let n of t){let i=n.startTime<e.firstHiddenTime;n.name==="first-paint"&&i&&(Kn.fp={value:n.startTime,unit:"millisecond"}),n.name==="first-contentful-paint"&&i&&(Kn.fcp={value:n.startTime,unit:"millisecond"})}})}function g_(t,e){let n=gr(),i=tt();if(!(n!=null&&n.getEntries)||!i)return;let{spanStreamingEnabled:r,ignorePerformanceApiSpans:s,ignoreResourceSpans:o}=e,a=Ke(i),l=n.getEntries(),{op:c,start_timestamp:u}=ne(t);
3l.slice(l1).forEach(p=>{let m=Ke(p.startTime),f=Ke(Math.max(0,p.duration));if(!(c==="navigation"&&u&&a+m<u))switch(p.entryType){case"navigation":{Q6(t,p,a);break}case"mark":case"paint":case"measure":{$6(t,p,m,f,a,s);break}case"resource":{Z6(t,p,p.name,m,f,a,o);break}}}),l1=Math.max(l.length-1,0),eF(t,r)}function __(t,e){var a;let n=tt();if(!((a=gr())!=null&&a.getEntries)||!n){c1();return}let{spanStreamingEnabled:i,recordClsOnPageloadSpan:r,recordLcpOnPageloadSpan:s}=e,o=Ke(n);if(ne(t).op==="pageload"){if(iF(Kn),i){let l=(c,u,p)=>{let m=p!=null?p:"browser.web_vital.".concat(c,".value");t.setAttribute(m,u),Kt&&C.log("Setting web vital attribute",{[m]:u},"on pageload span")};["ttfb","fp","fcp"].forEach(c=>{Kn[c]&&l(c,Kn[c].value)}),Kn["ttfb.requestTime"]&&l("ttfb.requestTime",Kn["ttfb.requestTime"].value,"browser.web_vital.ttfb.request_time")}else r||delete Kn.cls,s||delete Kn.lcp,Object.entries(Kn).forEach(([l,c])=>{uc(l,c.value,c.unit,t)}),tF(t,e);t.setAttribute(i?"browser.performance.time_origin":"performance.timeOrigin",o),t.setAttribute(i?"browser.performance.navigation.activation_start":"performance.activationStart",Ii())}c1()}function c1(){$n=void 0,Fa=void 0,Kn={}}function Y6(t){if((t==null?void 0:t.entryType)==="measure")try{return t.detail.devtools.track==="Components \u269B"}catch{return}}function $6(t,e,n,i,r,s){if(Y6(e)||["mark","measure"].includes(e.entryType)&&rn(e.name,s))return;let o=jr(!1),a=Ke(o?o.requestStart:0),l=r+Math.max(n,a),c=r+n,u=c+i,p={[Oe]:"auto.resource.browser.metrics"};l!==c&&(p["sentry.browser.measure_happened_before_request"]=!0,p["sentry.browser.measure_start_time"]=l),K6(p,e),l<=u&&Vr(t,l,u,{name:e.name,op:e.entryType,attributes:p})}function K6(t,e){try{let n=e.detail;if(!n)return;if(typeof n=="object"){for(let[i,r]of Object.entries(n))if(r&&jn(r))t["sentry.browser.measure.detail.".concat(i)]=r;else if(r!==void 0)try{t["sentry.browser.measure.detail.".concat(i)]=JSON.stringify(r)}catch{}return}if(jn(n)){t["sentry.browser.measure.detail"]=n;return}try{t["sentry.browser.measure.detail"]=JSON.stringify(n)}catch{}}catch{}}function Q6(t,e,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(i=>{sm(t,e,i,n)}),sm(t,e,"secureConnection",n,"TLS/SSL"),sm(t,e,"fetch",n,"cache"),sm(t,e,"domainLookup",n,"DNS"),J6(t,e,n)}function sm(t,e,n,i,r=n){let s=X6(n),o=e[s],a=e["".concat(n,"Start")];!a||!o||Vr(t,i+Ke(a),i+Ke(o),{op:"browser.".concat(r),name:e.name,attributes:g({[Oe]:"auto.ui.browser.metrics"},n==="redirect"&&e.redirectCount!=null?{"http.redirect_count":e.redirectCount}:{})})}function X6(t){return t==="secureConnection"?"connectEnd":t==="fetch"?"domainLookupStart":"".concat(t,"End")}function J6(t,e,n){let i=n+Ke(e.requestStart),r=n+Ke(e.responseEnd),s=n+Ke(e.responseStart);e.responseEnd&&(Vr(t,i,r,{op:"browser.request",name:e.name,attributes:{[Oe]:"auto.ui.browser.metrics"}}),Vr(t,s,r,{op:"browser.response",name:e.name,attributes:{[Oe]:"auto.ui.browser.metrics"}}))}function Z6(t,e,n,i,r,s,o){if(e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch")return;let a=e.initiatorType?"resource.".concat(e.initiatorType):"resource.other";if(o!=null&&o.includes(a))return;let l={[Oe]:"auto.resource.browser.metrics"},c=Ti(n);c.protocol&&(l["url.scheme"]=c.protocol.split(":").pop()),c.host&&(l["server.address"]=c.host),l["url.same_origin"]=n.includes(K.location.origin),l[ti]=n,nF(e,l,[["responseStatus","http.response.status_code"],["transferSize","http.response_transfer_size"],["encodedBodySize","http.response_content_length"],["decodedBodySize","http.decoded_response_content_length"],["renderBlockingStatus","resource.render_blocking_status"],["deliveryType","http.response_delivery_type"]]);let u=g(g({},l),kc(e)),p=s+i,m=p+r;Vr(t,p,m,{name:n.replace(K.location.origin,""),op:a,attributes:u})}function eF(t,e){let n=K.navigator;if(!n)return;let i=n.connection;i&&(i.effectiveType&&t.setAttribute(e?"network.connection.effective_type":"effectiveConnectionType",i.effectiveType),i.type&&t.setAttribute(e?"network.connection.type":"connectionType",i.type),rm(i.rtt)&&(e?t.setAttribute("network.connection.rtt",i.rtt):ne(t).op==="pageload"&&uc("connection.rtt",i.rtt,"millisecond"))),rm(n.deviceMemory)&&(e?t.setAttribute("device.memory.estimated_capacity",n.deviceMemory):t.setAttribute("deviceMemory","".concat(n.deviceMemory," GB"))),rm(n.hardwareConcurrency)&&(e?t.setAttribute("device.processor_count",n.hardwareConcurrency):t.setAttribute("hardwareConcurrency",String(n.hardwareConcurrency)))}function tF(t,e){$n&&e.recordLcpOnPageloadSpan&&($n.element&&t.setAttribute("lcp.element",nt($n.element)),$n.id&&t.setAttribute("lcp.id",$n.id),$n.url&&t.setAttribute("lcp.url",$n.url.trim().slice(0,200)),$n.loadTime!=null&&t.setAttribute("lcp.loadTime",$n.loadTime),$n.renderTime!=null&&t.setAttribute("lcp.renderTime",$n.renderTime),t.setAttribute("lcp.size",$
3n.size)),Fa!=null&&Fa.sources&&e.recordClsOnPageloadSpan&&Fa.sources.forEach((n,i)=>t.setAttribute("cls.source.".concat(i+1),nt(n.node)))}function nF(t,e,n){n.forEach(([i,r])=>{let s=t[i];s!=null&&(typeof s=="number"&&s<j6||typeof s=="string")&&(e[r]=s)})}function iF(t){let e=jr(!1);if(!e)return;let{responseStart:n,requestStart:i}=e;i<=n&&(t["ttfb.requestTime"]={value:n-i,unit:"millisecond"})}var y_=[],Rc=new Map,Ua=new Map,b_=60;function v_(){if(gr()&&tt()){let e=rF();return()=>{e()}}return()=>{}}var Ba={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function rF(){return yo(sF)}var sF=({metric:t})=>{if(t.value==null)return;let e=Ke(t.value);if(e>b_)return;let n=t.entries.find(h=>h.duration===t.value&&Ba[h.name]);if(!n)return;let{interactionId:i}=n,r=Ba[n.name],s=Ke(tt()+n.startTime),o=Ge(),a=o?Ue(o):void 0,l=i!=null?Rc.get(i):void 0,c=(l==null?void 0:l.span)||a,u=c?ne(c).description:te().getScopeData().transactionName,p=(l==null?void 0:l.elementName)||nt(n.target),m={[Oe]:"auto.http.browser.inp",[ot]:"ui.interaction.".concat(r),[hn]:n.duration},f=La({name:p,transaction:u,attributes:m,startTime:s});f&&(f.addEvent("inp",{[ji]:"millisecond",[Gi]:t.value}),f.end(s+e))};function u1(t){return t!=null?Rc.get(t):void 0}function S_(){let t=Object.keys(Ba);Ei()&&t.forEach(r=>{K.addEventListener(r,e,{capture:!0,passive:!0})});function e(r){let s=r.target;if(!s)return;let o=nt(s),a=Math.round(r.timeStamp);if(Ua.set(a,o),Ua.size>50){let l=Ua.keys().next().value;l!==void 0&&Ua.delete(l)}}function n(r){let s=Math.round(r.startTime),o=Ua.get(s);if(!o)for(let a=-5;a<=5;a++){let l=Ua.get(s+a);if(l){o=l;break}}return o||"<unknown>"}let i=({entries:r})=>{let s=Ge(),o=s&&Ue(s);r.forEach(a=>{if(!i1(a))return;let l=a.interactionId;if(l==null||Rc.has(l))return;let c=a.target?nt(a.target):n(a);if(y_.length>10){let u=y_.shift();Rc.delete(u)}y_.push(l),Rc.set(l,{span:o,elementName:c})})};xi("event",i),xi("first-input",i)}function E_(t){var h,_;let{name:e,op:n,origin:i,metricName:r,value:s,attributes:o,parentSpan:a,reportEvent:l,startTime:c,endTime:u}=t,p=te().getScopeData().transactionName,m=g({[Oe]:i,[ot]:n,[hn]:0,["browser.web_vital.".concat(r,".value")]:s,[Ng]:p,[Og]:p,"user_agent.original":(h=K.navigator)==null?void 0:h.userAgent},o);a&&((_=sc(a).attributes)==null?void 0:_[ot])==="pageload"&&(m["sentry.pageload.span_id"]=a.spanContext().spanId),l&&(m["browser.web_vital.".concat(r,".report_event")]=l);let f=Nt({name:e,attributes:m,startTime:c,parentSpan:a});f&&f.end(u!=null?u:c)}function T_(t){let e=0,n;if(!vo("largest-contentful-paint"))return;let i=Wr(({metric:r})=>{let s=r.entries[r.entries.length-1];!s||!Eo(r.value)||(e=r.value,n=s)},!0);So(t,(r,s,o)=>{oF(e,n,o,r),i()})}function oF(t,e,n,i){if(!Eo(t))return;Kt&&C.log("Sending LCP span (".concat(t,")"));let r=tt()||0,s=Ke(r),o=Ke(r+((e==null?void 0:e.startTime)||0)),a=e?nt(e.element):"Largest contentful paint",l={};e!=null&&e.element&&(l["browser.web_vital.lcp.element"]=nt(e.element)),e!=null&&e.id&&(l["browser.web_vital.lcp.id"]=e.id),e!=null&&e.url&&(l["browser.web_vital.lcp.url"]=e.url),(e==null?void 0:e.loadTime)!=null&&(l["browser.web_vital.lcp.load_time"]=e.loadTime),(e==null?void 0:e.renderTime)!=null&&(l["browser.web_vital.lcp.render_time"]=e.renderTime),(e==null?void 0:e.size)!=null&&(l["browser.web_vital.lcp.size"]=e.size),E_({name:a,op:"ui.webvital.lcp",origin:"auto.http.browser.lcp",metricName:"lcp",value:t,attributes:l,parentSpan:n,reportEvent:i,startTime:s,endTime:o})}function I_(t){let e=0,n;if(!vo("layout-shift"))return;let i=Gr(({metric:r})=>{let s=r.entries[r.entries.length-1];s&&(e=r.value,n=s)},!0);So(t,(r,s,o)=>{aF(e,n,o,r),i()})}function aF(t,e,n,i){var a;Kt&&C.log("Sending CLS span (".concat(t,")"));let r=e?Ke((tt()||0)+e.startTime):Ve(),s=e?nt((a=e.sources[0])==null?void 0:a.node):"Layout shift",o={};
3e!=null&&e.sources&&e.sources.forEach((l,c)=>{o["browser.web_vital.cls.source.".concat(c+1)]=nt(l.node)}),E_({name:s,op:"ui.webvital.cls",origin:"auto.http.browser.cls",metricName:"cls",value:t,attributes:o,parentSpan:n,reportEvent:i,startTime:r})}function C_(){if(!gr()||!tt())return;yo(({metric:n})=>{if(n.value==null||Ke(n.value)>b_)return;let r=n.entries.find(s=>s.duration===n.value&&Ba[s.name]);r&&lF(n.value,r)})}function lF(t,e){Kt&&C.log("Sending INP span (".concat(t,")"));let n=Ke(tt()+e.startTime),i=Ke(t),r=Ba[e.name],s=u1(e.interactionId),o=Ge(),a=o?Ue(o):void 0,l=(s==null?void 0:s.span)||a,c=l?sc(l).name:te().getScopeData().transactionName,u=(s==null?void 0:s.elementName)||nt(e.target);E_({name:u,op:"ui.interaction.".concat(r),origin:"auto.http.browser.inp",metricName:"inp",value:t,attributes:{[hn]:e.duration,[Ng]:c,[Og]:c},startTime:n,endTime:n+i,parentSpan:l})}var cF=1e3,p1,w_,x_;function Oc(t){cn("dom",t),un("dom",uF)}function uF(){if(!K.document)return;let t=Rt.bind(null,"dom"),e=d1(t,!0);K.document.addEventListener("click",e,!1),K.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{var s,o;let r=(s=K[n])==null?void 0:s.prototype;(o=r==null?void 0:r.hasOwnProperty)!=null&&o.call(r,"addEventListener")&&(Tt(r,"addEventListener",function(a){return function(l,c,u){if(l==="click"||l=="keypress")try{let p=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},m=p[l]=p[l]||{refCount:0};if(!m.handler){let f=d1(t);m.handler=f,a.call(this,l,f,u)}m.refCount++}catch{}return a.call(this,l,c,u)}}),Tt(r,"removeEventListener",function(a){return function(l,c,u){if(l==="click"||l=="keypress")try{let p=this.__sentry_instrumentation_handlers__||{},m=p[l];m&&(m.refCount--,m.refCount<=0&&(a.call(this,l,m.handler,u),m.handler=void 0,delete p[l]),Object.keys(p).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,l,c,u)}}))})}function pF(t){if(t.type!==w_)return!1;try{if(!t.target||t.target._sentryId!==x_)return!1}catch{}return!0}function dF(t,e){return t!=="keypress"?!1:e!=null&&e.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function d1(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;let i=mF(n);if(dF(n.type,i))return;et(n,"_sentryCaptured",!0),i&&!i._sentryId&&et(i,"_sentryId",It());let r=n.type==="keypress"?"input":n.type;pF(n)||(t({event:n,name:r,global:e}),w_=n.type,x_=i?i._sentryId:void 0),clearTimeout(p1),p1=K.setTimeout(()=>{x_=void 0,w_=void 0},cF)}}function mF(t){try{return t.target}catch{return null}}var om;function zr(t){let e="history";cn(e,t),un(e,fF)}function fF(){if(K.addEventListener("popstate",()=>{let e=K.location.href,n=om;if(om=e,n===e)return;Rt("history",{from:n,to:e})}),!Wd())return;function t(e){return function(...n){let i=n.length>2?n[2]:void 0;if(i){let r=om,s=hF(String(i));if(om=s,r===s)return e.apply(this,n);Rt("history",{from:r,to:s})}return e.apply(this,n)}}Tt(K.history,"pushState",t),Tt(K.history,"replaceState",t)}function hF(t){try{return new URL(t,K.location.origin).toString()}catch{return t}}var am={};function lm(t){let e=am[t];if(e)return e;let n=K[t];if(ka(n))return am[t]=n.bind(K);let i=K.document;if(i&&typeof i.createElement=="function")try{let r=i.createElement("iframe");r.hidden=!0,i.head.appendChild(r);let s=r.contentWindow;s!=null&&s[t]&&(n=s[t]),i.head.removeChild(r)}catch(r){Kt&&C.warn("Could not create sandbox iframe for ".concat(t," check, bailing to window.").concat(t,": "),r)}return n&&(am[t]=n.bind(K))}function A_(t){am[t]=void 0}function To(...t){return lm("setTimeout")(...t)}var ri="__sentry_xhr_v3__";function Io(t){cn("xhr",t),un("xhr",gF)}function gF(){if(!K.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,i){let r=new Error,s=Ve()*1e3,o=Ot(i[0])?i[0].toUpperCase():void 0,a=_F(i[1]);if(!o||!a)return e.apply(n,i);n[ri]={method:o,url:a,request_headers:{}},o==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);let l=()=>{let c=n[ri];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}let u={endTimestamp:Ve()*1e3,startTimestamp:s,xhr:n,virtualError:r};Rt("xhr",u),n.removeEventListener("readystatechange",l)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(c,u,p){return l(),c.apply(u,p)}}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,u,p){let[m,f]=p,h=u[ri];return h&&Ot(m)&&Ot(f)&&(h.request_headers[m.toLowerCase()]=f),c.apply(u,p)}}),e.apply(n,i)}}),t.send=new Proxy(t.send,{apply(e,n,i){let r=n[ri];if(!r)return e.apply(n,i);i[0]!==void 0&&(r.body=i[0]);let s={startTimestamp:Ve()*1e3,xhr:n};return Rt("xhr",s),e.apply(n,i)}})}function _F(t){if(Ot(t))return t;try{return t.toString()}catch{}}var yF=Symbol.for("sentry__originalRequestBody");function cm(t){return new URLSearchParams(t).toString()}function um(t,e=C){try{if(typeof t=="string")return[t];if(t instanceof URLSearchParams)return[t.toString()];if(t instanceof FormData)return[cm(t)];if(!t)return[void 0]}catch(n){return Kt&&e.error(n,"Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return Kt&&e.log("Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function pm(t=[]){if(t.length>=2&&t[1]&&typeof t[1]=="object"&&"body"in t[1])return t[1].body;if(t.length>=1&&t[0]instanceof Request){let n=t[0][yF];return n!==void 0?n:void 0}}function Nc(t){let e;try{e=t.getAllResponseHeaders()}catch(n){return Kt&&C.error(n,"Failed to get xhr response headers",t),{}}return e?e.split("\r\n").reduce((n,i)=>{let[r,s]=i.split(": ");return s&&(n[r.toLowerCase()]=s),n},{}):{}}function k_(t){if(typeof Element>"u")return!1;try{return t instanceof Element}catch{return!1}}function Mc(t){try{return new URL(t,K.location.origin).toString()}catch{return t}}var bF=40;function m1(t,e=lm("fetch")){let n=0,i=0;function r(s){return k(this,null,function*(){let o=s.body.length;n+=o,i++;
3let a=g({body:s.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:n<=6e4&&i<15},t.fetchOptions);try{let l=yield e(t.url,a);return{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}}catch(l){throw A_("fetch"),l}finally{n-=o,i--}})}return Dd(t,r,co(t.bufferSize||bF))}var mt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var vF=30;var SF=50;function R_(t,e,n,i){let r={filename:t,function:e==="<anonymous>"?"?":e,in_app:!0};return n!==void 0&&(r.lineno=n),i!==void 0&&(r.colno=i),r}var EF=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,TF=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,IF=/\((\S*)(?::(\d+))(?::(\d+))\)/,CF=/at (.+?) ?\(data:(.+?),/,wF=t=>{var r;let e=t.match(CF);if(e)return{filename:"<data:".concat(e[2],">"),function:e[1]};let n=EF.exec(t);if(n){let[,s,o,a]=n;return R_(s,"?",+o,+a)}let i=TF.exec(t);if(i){if(((r=i[2])==null?void 0:r.indexOf("eval"))===0){let l=IF.exec(i[2]);l&&(i[2]=l[1],i[3]=l[2],i[4]=l[3])}let[o,a]=h1(i[1]||"?",i[2]);return R_(a,o,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},xF=[vF,wF],AF=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,kF=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,RF=t=>{let e=AF.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let s=kF.exec(e[3]);s&&(e[1]=e[1]||"eval",e[3]=s[1],e[4]=s[2],e[5]="")}let i=e[3],r=e[1]||"?";return[r,i]=h1(r,i),R_(i,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},OF=[SF,RF];var NF=[xF,OF],f1=Hl(...NF),h1=(t,e)=>{let n=t.indexOf("safari-extension")!==-1,i=t.indexOf("safari-web-extension")!==-1;return n||i?[t.indexOf("@")!==-1?t.split("@")[0]:"?",n?"safari-extension:".concat(e):"safari-web-extension:".concat(e)]:[t,e]};var dm=1024,MF="Breadcrumbs",PF=(t={})=>{let e=g({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:MF,setup(n){e.console&&Cc(FF(n)),e.dom&&Oc(LF(n,e.dom)),e.xhr&&Io(UF(n)),e.fetch&&pr(BF(n)),e.history&&zr(HF(n)),e.sentry&&n.on("beforeSendEvent",DF(n))}}},Pc=PF;function DF(t){return function(n){G()===t&&ii({category:"sentry.".concat(n.type==="transaction"?"transaction":"event"),event_id:n.event_id,level:n.level,message:qi(n)},{event:n})}}function LF(t,e){return function(i){if(G()!==t)return;let r,s,o=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>dm&&(mt&&C.warn("`dom.maxStringLength` cannot exceed ".concat(dm,", but a value of ").concat(a," was configured. Sentry will use ").concat(dm," instead.")),a=dm),typeof o=="string"&&(o=[o]);try{let c=i.event,u=qF(c)?c.target:c;r=nt(u,{keyAttrs:o,maxStringLength:a}),s=Oa(u)}catch{r="<unknown>"}if(r.length===0)return;let l={category:"ui.".concat(i.name),message:r};s&&(l.data={"ui.component_name":s}),ii(l,{event:i.event,name:i.name,global:i.global})}}function FF(t){return function(n){if(G()!==t)return;let i={category:"console",data:{arguments:n.args,logger:"console"},level:Hr(n.level),message:ps(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)i.message="Assertion failed: ".concat(ps(n.args.slice(1)," ")||"console.assert"),i.data.arguments=n.args.slice(1);else return;ii(i,{input:n.args,level:n.level})}}function UF(t){return function(n){if(G()!==t)return;let{startTimestamp:i,endTimestamp:r}=n,s=n.xhr[ri];if(!i||!r||!s)return;let{method:o,url:a,status_code:l,body:c}=s,u={method:o,url:a,status_code:l},p={xhr:n.xhr,input:c,startTimestamp:i,endTimestamp:r},m={category:"xhr",data:u,type:"http",level:Gd(l)};t.emit("beforeOutgoingRequestBreadcrumb",m,p),ii(m,p)}}function BF(t){return function(n){if(G()!==t)return;let{startTimestamp:i,endTimestamp:r}=n;if(r&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.error){let s={data:n.error,input:n.args,startTimestamp:i,endTimestamp:r},o={category:"fetch",data:n.fetchData,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",o,s),ii(o,s)}else{let s=n.response,o=D(g({},n.fetchData),{status_code:s==null?void 0:s.status}),a={input:n.args,response:s,startTimestamp:i,endTimestamp:r},l={category:"fetch",data:o,type:"http",level:Gd(o.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",l,a),ii(l,a)}}}function HF(t){return function(n){if(G()!==t)return;let i=n.from,r=n.to,s=Ti(ie.location.href),o=i?Ti(i):void 0,a=Ti(r);o!=null&&o.path||(o=s),s.protocol===a.protocol&&s.host===a.host&&(r=a.relative),s.protocol===o.protocol&&s.host===o.host&&(i=o.relative),ii({category:"navigation",data:{from:i,to:r}})}}function qF(t){return!!t&&!!t.target}var jF="EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDB
3Request,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(","),GF="BrowserApiErrors",WF=(t={})=>{let e=g({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1},t);return{name:GF,setupOnce(){e.setTimeout&&Tt(ie,"setTimeout",g1),e.setInterval&&Tt(ie,"setInterval",g1),e.requestAnimationFrame&&Tt(ie,"requestAnimationFrame",VF),e.XMLHttpRequest&&"XMLHttpRequest"in ie&&Tt(XMLHttpRequest.prototype,"send",zF);let n=e.eventTarget;n&&(Array.isArray(n)?n:jF).forEach(r=>YF(r,e))}}},_1=WF;function g1(t){return function(...e){let n=e[0];return e[0]=ho(n,{mechanism:{handled:!1,type:"auto.browser.browserapierrors.".concat(Sn(t))}}),t.apply(this,e)}}function VF(t){return function(e){return t.apply(this,[ho(e,{mechanism:{data:{handler:Sn(t)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function zF(t){return function(...e){let n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in n&&typeof n[r]=="function"&&Tt(n,r,function(s){let o={mechanism:{data:{handler:Sn(s)},handled:!1,type:"auto.browser.browserapierrors.xhr.".concat(r)}},a=us(s);return a&&(o.mechanism.data.handler=Sn(a)),ho(s,o)})}),t.apply(this,e)}}function YF(t,e){var r,s;let i=(r=ie[t])==null?void 0:r.prototype;(s=i==null?void 0:i.hasOwnProperty)!=null&&s.call(i,"addEventListener")&&(Tt(i,"addEventListener",function(o){return function(a,l,c){try{$F(l)&&(l.handleEvent=ho(l.handleEvent,{mechanism:{data:{handler:Sn(l),target:t},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return e.unregisterOriginalCallbacks&&KF(this,a,l),o.apply(this,[a,ho(l,{mechanism:{data:{handler:Sn(l),target:t},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),c])}}),Tt(i,"removeEventListener",function(o){return function(a,l,c){try{if(Object.prototype.hasOwnProperty.call(l,"__sentry_wrapped__")){let u=l.__sentry_wrapped__;u&&o.call(this,a,u,c)}}catch{}return o.call(this,a,l,c)}}))}function $F(t){return typeof t.handleEvent=="function"}function KF(t,e,n){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,n)}var Dc=(t={})=>{var n;let e=(n=t.lifecycle)!=null?n:"route";return{name:"BrowserSession",setupOnce(){if(typeof ie.document>"u"){mt&&C.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Sa({ignoreDuration:!0});let i=!1;_o(()=>{i||(lo(),i=!0)});let r=st(),s=r.getUser();r.addScopeListener(o=>{let a=o.getUser();((s==null?void 0:s.id)!==(a==null?void 0:a.id)||(s==null?void 0:s.ip_address)!==(a==null?void 0:a.ip_address))&&(s=a,i&&lo())}),e==="route"&&zr(({from:o,to:a})=>{o!==a&&(Sa({ignoreDuration:!0}),lo(),i=!0)})}}};var QF="CultureContext",XF=()=>({name:QF,preprocessEvent(t){var n;let e=y1();e&&(t.contexts=D(g({},t.contexts),{culture:g(g({},e),(n=t.contexts)==null?void 0:n.culture)}))},processSegmentSpan(t){let e=y1();e&&Lr(t,{"culture.locale":e.locale,"culture.timezone":e.timezone,"culture.calendar":e.calendar})}}),Lc=XF;function y1(){try{let t=ie.Intl;if(!t)return;let e=t.DateTimeFormat().resolvedOptions();return{locale:e.locale,timezone:e.timeZone,calendar:e.calendar}}catch{return}}var JF="GlobalHandlers",ZF=(t={})=>{let e=g({onerror:!0,onunhandledrejection:!0},t);return{name:JF,setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(eU(n),b1("onerror")),e.onunhandledrejection&&(tU(n),b1("onunhandledrejection"))}}},Fc=ZF;function eU(t){Gl(e=>{let{stackParser:n,attachStacktrace:i}=v1();if(G()!==t||n_())return;let{msg:r,url:s,line:o,column:a,error:l}=e,c=rU(Kd(n,l||r,void 0,i,!1),s,o,a);c.level="error",Ur(c,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function tU(t){Wl(e=>{let{stackParser:n,attachStacktrace:i}=v1();if(G()!==t||n_())return;let r=nU(e),s=jn(r)?iU(r):Kd(n,r,void 0,i,!0);s.level="error",Ur(s,{originalException:r,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function nU(t){if(jn(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function iU(t){return{exception:{values:[{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: ".concat(String(t))}]}}}function rU(t,e,n,i){var c;let r=t.exception=t.exception||{},s=r.values=r.values||[],o=s[0]=s[0]||{},a=o.stacktrace=o.stacktrace||{},l=a.frames=a.frames||[];return l.length===0&&l.push({colno:i,lineno:n,filename:(c=sU(e))!=null?c:In(),function:"?",in_app:!0}),t}function b1(t){mt&&C.log("Global Handler attached: ".concat(t))}function v1(){let t=G();return(t==null?void 0:t.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}function sU(t){if(!(!Ot(t)||t.length===0))return t.startsWith("data:")?"<".concat(on(t,!1),">"):t}var Uc=()=>({name:"HttpContext",preprocessEvent(t){var i;if(!ie.navigator&&!ie.location&&!ie.document)return;let e=Na(),n=g(g({},e.headers),(i=t.request)==null?void 0:i.headers);t.request=D(g(g({},e),t.request),{headers:n})},processSegmentSpan(t){var i;let e=(i=t.attributes)==null?void 0:i[ot];if(!ie.navigator&&!ie.location&&!ie.document)return;let n=Na();Lr(t,{[ti]:e!=="http.client"?n.url:void 0,"http.request.header.user_agent":n.headers["User-Agent"],"http.request.header.referer":n.headers.Referer})}});
3var oU="cause",aU=5,lU="LinkedErrors",cU=(t={})=>{let e=t.limit||aU,n=t.key||oU;return{name:lU,preprocessEvent(i,r,s){let o=s.getOptions();Zg(Yd,o.stackParser,n,e,i,r)}}},Bc=cU;var uU=/^HTML(\w*)Element$/;function S1(t){if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(k_(t)){let e=pU(t);if(uU.test(e))return"[HTMLElement: ".concat(nt(t),"]")}}function pU(t){let e=Object.getPrototypeOf(t);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function E1(){return dU()?(mt&&Bt(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function dU(){var r;if(typeof ie.window>"u")return!1;let t=ie;if(t.nw)return!1;let e=t.chrome||t.browser;if(!((r=e==null?void 0:e.runtime)!=null&&r.id))return!1;let n=In();return!(ie===ie.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(n))}function T1(t){return[mo(),po(),Aa(),_1(),Pc(),Fc(),Bc(),fo(),Uc(),Lc(),Dc()]}function O_(t={}){let e=!t.skipBrowserExtensionCheck&&E1(),n=t.defaultIntegrations==null?T1():t.defaultIntegrations,i=D(g({},t),{enabled:e?!1:t.enabled,stackParser:id(t.stackParser||f1),integrations:Bg({integrations:t.integrations,defaultIntegrations:n}),transport:t.transport||m1});return ad(S1),$g(Qd,i)}function mm(t={}){let e=ie.document,n=(e==null?void 0:e.head)||(e==null?void 0:e.body);if(!n){mt&&C.error("[showReportDialog] Global document not defined");return}let i=te(),r=G(),s=r==null?void 0:r.getDsn();if(!s){mt&&C.error("[showReportDialog] DSN not configured");return}let o=D(g({},t),{user:g(g({},i.getUser()),t.user),eventId:t.eventId||gc()}),a=ie.document.createElement("script");a.async=!0,a.crossOrigin="anonymous",a.src=Fg(s,o);let{onLoad:l,onClose:c}=o;if(l&&(a.onload=l),c){let u=p=>{if(p.data==="__sentry_reportdialog_closed__")try{c()}finally{ie.removeEventListener("message",u)}};ie.addEventListener("message",u)}n.appendChild(a)}var mU="HttpClient",fU=(t={})=>{let e=g({failedRequestStatusCodes:[[500,599]],failedRequestTargets:[/.*/]},t);return{name:mU,setup(n){SU(n,e),EU(n,e)}}},N_=fU;function hU(t,e,n,i,r){if(C1(t,n.status,n.url)){let s=TU(e,i),o,a,l,c,u=x1();if(u.requestHeaders!==!1&&(o=ys(I1(s.headers),u.requestHeaders)),u.responseHeaders!==!1&&(a=ys(I1(n.headers),u.responseHeaders)),u.cookies!==!1){let m=s.headers.get("Cookie")||void 0;if(m){let h=Ic(m,u.cookies);typeof h=="object"&&(l=h)}let f=n.headers.get("Set-Cookie")||void 0;if(f){let h=Ic(f,u.cookies);typeof h=="object"&&(c=h)}}let p=w1({url:s.url,method:s.method,status:n.status,requestHeaders:o,responseHeaders:a,requestCookies:l,responseCookies:c,error:r,type:"fetch"});Ur(p)}}function gU(t,e,n,i,r){if(C1(t,e.status,e.responseURL)){let s,o,a,l=x1();if(l.cookies!==!1)try{let u=e.getResponseHeader("Set-Cookie")||e.getResponseHeader("set-cookie")||void 0;if(u){let p=Ic(u,l.cookies);typeof p=="object"&&(o=p)}}catch{}if(l.responseHeaders!==!1)try{a=ys(yU(e),l.responseHeaders)}catch{}l.requestHeaders!==!1&&(s=ys(i,l.requestHeaders));let c=w1({url:e.responseURL,method:n,status:e.status,requestHeaders:s,responseHeaders:a,responseCookies:o,error:r,type:"xhr"});Ur(c)}}function _U(t){if(t){let e=t["Content-Length"]||t["content-length"];if(e)return parseInt(e,10)}}function I1(t){let e={};return t.forEach((n,i)=>{e[i]=n}),e}function yU(t){let e=t.getAllResponseHeaders();return e?e.split("\r\n").reduce((n,i)=>{let[r,s]=i.split(": ");return r&&s&&(n[r]=s),n},{}):{}}function bU(t,e){return t.some(n=>typeof n=="string"?e.includes(n):n.test(e))}function vU(t,e){return t.some(n=>typeof n=="number"?n===e:e>=n[0]&&e<=n[1])}function SU(t,e){Ra()&&pr(n=>{if(G()!==t)return;let{response:i,args:r,error:s,virtualError:o}=n,[a,l]=r;i&&hU(e,a,i,l,s||o)},!1)}function EU(t,e){"XMLHttpRequest"in z&&Io(n=>{if(G()!==t)return;let{error:i,virtualError:r}=n,s=n.xhr,o=s[ri];if(!o)return;let{method:a,request_headers:l}=o;try{gU(e,s,a,l,i||r)}catch(c){mt&&C.warn("Error while extracting response event form XHR response",c)}})}function C1(t,e,n){return vU(t.failedRequestStatusCodes,e)&&bU(t.failedRequestTargets,n)&&!Ca(n,G())}function w1(t){let e=G(),n=e&&t.error&&t.error instanceof Error?t.error.stack:void 0,i=n&&e?e.getOptions().stackParser(n,0,1):void 0,r="HTTP Client Error with status code: ".concat(t.status),s={message:r,exception:{values:[{type:"Error",value:r,stacktrace:i?{frames:i}:void 0}]},request:{url:t.url,method:t.method,headers:t.requestHeaders,cookies:t.requestCookies},contexts:{response:{status_code:t.status,headers:t.responseHeaders,cookies:t.responseCookies,body_size:_U(t.responseHeaders)}}};return mn(s,{type:"auto.http.client.".concat(t.type),handled:!1}),s}function TU(t,e){return!e&&t instanceof Request||t instanceof Request&&t.bodyUsed?t:new Request
3(t,e)}function x1(){let t=G();if(!t)return{cookies:!1,requestHeaders:!1,responseHeaders:!1};let e=t.getOptions();if(e.dataCollection==null){let r=!!e.sendDefaultPii;return{cookies:r,requestHeaders:r,responseHeaders:r}}let{cookies:n,httpHeaders:i}=t.getDataCollectionOptions();return{cookies:n,requestHeaders:i.request,responseHeaders:i.response}}var ut=z,ly="sentryReplaySession",IU="replay_event",cy="Unable to send Replay",CU=3e5,wU=9e5,xU=5e3,AU=5500,kU=6e4,RU=5e3,OU=3,A1=15e4,fm=5e3,NU=3e3,MU=300,uy=2e7,PU=4999,DU=5e4,k1=36e5,LU=Object.defineProperty,FU=(t,e,n)=>e in t?LU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,R1=(t,e,n)=>FU(t,typeof e!="symbol"?e+"":e,n),Mt=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(Mt||{});function UU(t){return t.nodeType===t.ELEMENT_NODE}function jc(t){let e=t==null?void 0:t.host;return(e==null?void 0:e.shadowRoot)===t}function Gc(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function BU(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function HU(t){let{cssText:e}=t;if(e.split('"').length<3)return e;let n=["@import","url(".concat(JSON.stringify(t.href),")")];return t.layerName===""?n.push("layer"):t.layerName&&n.push("layer(".concat(t.layerName,")")),t.supportsText&&n.push("supports(".concat(t.supportsText,")")),t.media.length&&n.push(t.media.mediaText),n.join(" ")+";"}function ym(t){try{let e=t.rules||t.cssRules;return e?BU(Array.from(e,nx).join("")):null}catch{return null}}function qU(t){let e="";for(let n=0;n<t.style.length;n++){let i=t.style,r=i[n],s=i.getPropertyPriority(r);e+="".concat(r,":").concat(i.getPropertyValue(r)).concat(s?" !important":"",";")}return"".concat(t.selectorText," { ").concat(e," }")}function nx(t){let e;if(GU(t))try{e=ym(t.styleSheet)||HU(t)}catch{}else if(WU(t)){let n=t.cssText,i=t.selectorText.includes(":"),r=typeof t.style.all=="string"&&t.style.all;if(r&&(n=qU(t)),i&&(n=jU(n)),i||r)return n}return e||t.cssText}function jU(t){let e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return t.replace(e,"$1\\$2")}function GU(t){return"styleSheet"in t}function WU(t){return"selectorText"in t}var bm=class{constructor(){R1(this,"idNodeMap",new Map),R1(this,"nodeMetaMap",new WeakMap)}getId(e){var i;if(!e)return-1;let n=(i=this.getMeta(e))==null?void 0:i.id;return n!=null?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){let n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,n){let i=n.id;this.idNodeMap.set(i,e),this.nodeMetaMap.set(e,n)}replace(e,n){let i=this.getNode(e);if(i){let r=this.nodeMetaMap.get(i);r&&this.nodeMetaMap.set(n,r)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function VU(){return new bm}function Mm({maskInputOptions:t,tagName:e,type:n}){return e==="OPTION"&&(e="SELECT"),!!(t[e.toLowerCase()]||n&&t[n]||n==="password"||e==="INPUT"&&!n&&t.text)}function Vc({isMasked:t,element:e,value:n,maskInputFn:i}){let r=n||"";return t?(i&&(r=i(r,e)),"*".repeat(r.length)):r}function Ya(t){return t.toLowerCase()}function U_(t){return t.toUpperCase()}var O1="__rrweb_original__";function zU(t){let e=t.getContext("2d");if(!e)return!0;let n=50;for(let i=0;i<t.width;i+=n)for(let r=0;r<t.height;r+=n){let s=e.getImageData,o=O1 in s?s[O1]:s;if(new Uint32Array(o.call(e,i,r,Math.min(n,t.width-i),Math.min(n,t.height-r)).data.buffer).some(l=>l!==0))return!1}return!0}function py(t){let e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Ya(e):null}function vm(t,e,n){return e==="INPUT"&&(n==="radio"||n==="checkbox")?t.getAttribute("value")||"":t.value}function ix(t,e){var s;let n;try{n=new URL(t,e!=null?e:window.location.href)}catch{return null}let i=/\.([0-9a-z]+)(?:$)/i,r=n.pathname.match(i);return(s=r==null?void 0:r[1])!=null?s:null}var N1={};function rx(t){let e=N1[t];if(e)return e;let n=window.document,i=window[t];if(n&&typeof n.createElement=="function")try{let r=n.createElement("iframe");r.hidden=!0,n.head.appendChild(r);let s=r.contentWindow;s&&s[t]&&(i=s[t]),n.head.removeChild(r)}catch{}return N1[t]=i.bind(window)}function B_(...t){return rx("setTimeout")(...t)}function sx(...t){return rx("clearTimeout")(...t)}function ox(t){try{return t.contentDocument}catch{}}function YU(t){try{return t.contentWindow}catch{}}var $U=1,KU=new RegExp("[^a-z0-9-_:]"),zc=-2;function dy(){return $U++}function QU(t){if(t instanceof HTMLFormElement)return"form";let e=Ya(t.tagName);return KU.test(e)?"div":e}function XU(t){let e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var Ha,M1,JU=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ZU=/^(?:[a-z+]+:)?\/\//i,e4=/^www\..*/i,t4=/^(data:)([^,]*),(.*)/i;function n4(t,e){if(!t||e.size===0)return t;try{let n=t.split(";"),i=[];for(let r of n){if(r=r.trim(),!r)continue;let s=r.indexOf(":");if(s===-1){i.push(r);continue}let o=r.slice(0,s).trim();e.has(o)||i.push(r)}return i.join("; ")+(i.length>0&&t.endsWith(";")?";":"")}catch(n){return console.warn("Error filtering CSS properties:",n),t}}function Sm(t,e){return(t||"").replace(JU,(n,i,r,s,o,a)=>{let l=r||o||a,c=i||s||"";if(!l)return n;
3if(ZU.test(l)||e4.test(l)||t4.test(l))return"url(".concat(c).concat(l).concat(c,")");if(l[0]==="/")return"url(".concat(c).concat(XU(e)+l).concat(c,")");let u=e.split("/"),p=l.split("/");u.pop();for(let m of p)m!=="."&&(m===".."?u.pop():u.push(m));return"url(".concat(c).concat(u.join("/")).concat(c,")")})}var i4=/^[^ \t\n\r\u000c]+/,r4=/^[, \t\n\r\u000c]+/;function s4(t,e){if(e.trim()==="")return e;let n=0;function i(s){let o,a=s.exec(e.substring(n));return a?(o=a[0],n+=o.length,o):""}let r=[];for(;i(r4),!(n>=e.length);){let s=i(i4);if(s.slice(-1)===",")s=Ga(t,s.substring(0,s.length-1)),r.push(s);else{let o="";s=Ga(t,s);let a=!1;for(;;){let l=e.charAt(n);if(l===""){r.push((s+o).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){n+=1,r.push((s+o).trim());break}else l==="("&&(a=!0);o+=l,n+=1}}}return r.join(", ")}var P1=new WeakMap;function Ga(t,e){return!e||e.trim()===""?e:Pm(t,e)}function o4(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function Pm(t,e){let n=P1.get(t);if(n||(n=t.createElement("a"),P1.set(t,n)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return n.setAttribute("href",e),n.href}function ax(t,e,n,i,r,s,o){if(!i)return i;if(n==="src"||n==="href"&&!(e==="use"&&i[0]==="#"))return Ga(t,i);if(n==="xlink:href"&&i[0]!=="#")return Ga(t,i);if(n==="background"&&(e==="table"||e==="td"||e==="th"))return Ga(t,i);if(n==="srcset")return s4(t,i);if(n==="style"){let a=Sm(i,Pm(t));return o&&o.size>0&&(a=n4(a,o)),a}else if(e==="object"&&n==="data")return Ga(t,i);return typeof s=="function"?s(n,i,r):i}function lx(t,e,n){return(t==="video"||t==="audio")&&e==="autoplay"}function a4(t,e,n,i){try{if(i&&t.matches(i))return!1;if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(let r=t.classList.length;r--;){let s=t.classList[r];if(e.test(s))return!0}if(n)return t.matches(n)}catch{}return!1}function l4(t,e){for(let n=t.classList.length;n--;){let i=t.classList[n];if(e.test(i))return!0}return!1}function Co(t,e,n=1/0,i=0){return!t||t.nodeType!==t.ELEMENT_NODE||i>n?-1:e(t)?i:Co(t.parentNode,e,n,i+1)}function Wa(t,e){return n=>{let i=n;if(i===null)return!1;try{if(t){if(typeof t=="string"){if(i.matches(".".concat(t)))return!0}else if(l4(i,t))return!0}return!!(e&&i.matches(e))}catch{return!1}}}function $a(t,e,n,i,r,s){try{let o=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(o===null)return!1;if(o.tagName==="INPUT"){let c=o.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(c))return!0}let a=-1,l=-1;if(s){if(l=Co(o,Wa(i,r)),l<0)return!0;a=Co(o,Wa(e,n),l>=0?l:1/0)}else{if(a=Co(o,Wa(e,n)),a<0)return!1;l=Co(o,Wa(i,r),a>=0?a:1/0)}return a>=0?l>=0?a<=l:!0:l>=0?!1:!!s}catch{}return!!s}function c4(t,e,n){let i=YU(t);if(!i)return;let r=!1,s;try{s=i.document.readyState}catch{return}if(s!=="complete"){let a=B_(()=>{r||(e(),r=!0)},n);t.addEventListener("load",()=>{sx(a),r=!0,e()});return}let o="about:blank";if(i.location.href!==o||t.src===o||t.src==="")return B_(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}function u4(t,e,n){let i=!1,r;try{r=t.sheet}catch{r=null}if(r)return;let s=B_(()=>{i||(e(),i=!0)},n);t.addEventListener("load",()=>{sx(s),i=!0,e()})}function p4(t,e){let{doc:n,mirror:i,blockClass:r,blockSelector:s,unblockSelector:o,maskAllText:a,maskAttributeFn:l,maskTextClass:c,unmaskTextClass:u,maskTextSelector:p,unmaskTextSelector:m,inlineStylesheet:f,maskInputOptions:h={},maskTextFn:_,maskInputFn:v,dataURLOptions:I={},inlineImages:N,recordCanvas:j,keepIframeSrcFn:P,newlyAddedElement:X=!1,ignoreCSSAttributes:V}=e,A=d4(n,i);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:Mt.Document,childNodes:[],compatMode:t.compatMode}:{type:Mt.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:Mt.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:A};case t.ELEMENT_NODE:return f4(t,{doc:n,blockClass:r,blockSelector:s,unblockSelector:o,inlineStylesheet:f,maskAttributeFn:l,maskInputOptions:h,maskInputFn:v,dataURLOptions:I,inlineImages:N,recordCanvas:j,keepIframeSrcFn:P,newlyAddedElement:X,rootId:A,maskTextClass:c,unmaskTextClass:u,maskTextSelector:p,unmaskTextSelector:m,ignoreCSSAttributes:V});case t.TEXT_NODE:return m4(t,{doc:n,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:p,unmaskTextSelector:m,maskTextFn:_,maskInputOptions:h,maskInputFn:v,rootId:A});case t.CDATA_SECTION_NODE:return{type:Mt.CDATA,textContent:"",rootId:A};case t.COMMENT_NODE:return{type:Mt.Comment,textContent:t.textContent||"",rootId:A};default:return!1}}function d4(t,e){if(!e.hasNode(t))return;let n=e.getId(t);return n===1?void 0:n}function m4(t,e){var I;let{maskAllText:n,maskTextClass:i,unmaskTextClass:r,maskTextSelector:s,unmaskTextSelector:o,maskTextFn:a,maskInputOptions:l,maskInputFn:c,rootId:u}=e,p=t.parentNode&&t.parentNode.tagName,m=t.textContent,f=p==="STYLE"?!0:void 0,h=p==="SCRIPT"?!0:void 0,_=p==="TEXTAREA"?!0:void 0;if(f&&m){try{t.nextSibling||t.previousSibling||(I=t.parentNode.sheet)!=null&&I.cssRules&&(m=ym(t.parentNode.sheet))}catch(N){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(N),t)}m=Sm(m,Pm(e.doc))}h&&(m="SCRIPT_PLACEHOLDER");let v=$a(t,i,s,r,o,n);if(!f&&!h&&!_&&m&&v&&(m=a?a(m,t.parentElement):m.replace(/[\S]/g,"*")),_&&m&&(l.textarea||v)&&(m=c?c(m,t.parentNode):m.replace(/[\S]/g,"*")),p==="OPTION"&&m){let N=Mm({type:null,tagName:p,maskInputOptions:l});m=Vc({isMasked:$a(t,i,s,r,o,N),element:t,value:m,maskInputFn:c})}return{type:Mt.Text,textContent:m||"",isStyle:f,rootId:u}}function f4(t,e){let{doc:n,blockClass:i,blockSelector:r,unblockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskAttributeFn:l,maskInputFn:c,dataURLOptions:u={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:f,newlyAddedElement:h=!1,rootId:_,maskTextClass:v,unmaskTextClass:I,maskTextSelector:N,unmaskTextSelector:j,ignoreCSSAttributes:P}
3=e,X=a4(t,i,r,s),V=QU(t),A={},Y=t.attributes.length;for(let H=0;H<Y;H++){let re=t.attributes[H];re.name&&!lx(V,re.name,re.value)&&(A[re.name]=ax(n,V,Ya(re.name),re.value,t,l,P))}if(V==="link"&&o){let H=Array.from(n.styleSheets).find(Te=>Te.href===t.href),re=null;H&&(re=ym(H)),re&&(A.rel=null,A.href=null,A.crossorigin=null,A._cssText=Sm(re,H.href))}if(V==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){let H=ym(t.sheet);H&&(A._cssText=Sm(H,Pm(n)))}if(V==="input"||V==="textarea"||V==="select"||V==="option"){let H=t,re=py(H),Te=vm(H,U_(V),re),Ie=H.checked;if(re!=="submit"&&re!=="button"&&Te){let fe=$a(H,v,N,I,j,Mm({type:re,tagName:U_(V),maskInputOptions:a}));A.value=Vc({isMasked:fe,element:H,value:Te,maskInputFn:c})}Ie&&(A.checked=Ie)}if(V==="option"&&(t.selected&&!a.select?A.selected=!0:delete A.selected),V==="canvas"&&m){if(t.__context==="2d")zU(t)||(A.rr_dataURL=t.toDataURL(u.type,u.quality));else if(!("__context"in t)){let H=t.toDataURL(u.type,u.quality),re=n.createElement("canvas");re.width=t.width,re.height=t.height;let Te=re.toDataURL(u.type,u.quality);H!==Te&&(A.rr_dataURL=H)}}if(V==="img"&&p){Ha||(Ha=n.createElement("canvas"),M1=Ha.getContext("2d"));let H=t,re=H.currentSrc||H.getAttribute("src")||"<unknown-src>",Te=H.crossOrigin,Ie=()=>{H.removeEventListener("load",Ie);try{Ha.width=H.naturalWidth,Ha.height=H.naturalHeight,M1.drawImage(H,0,0),A.rr_dataURL=Ha.toDataURL(u.type,u.quality)}catch(fe){if(H.crossOrigin!=="anonymous"){H.crossOrigin="anonymous",H.complete&&H.naturalWidth!==0?Ie():H.addEventListener("load",Ie);return}else console.warn("Cannot inline img src=".concat(re,"! Error: ").concat(fe))}H.crossOrigin==="anonymous"&&(Te?A.crossOrigin=Te:H.removeAttribute("crossorigin"))};H.complete&&H.naturalWidth!==0?Ie():H.addEventListener("load",Ie)}if((V==="audio"||V==="video")&&(A.rr_mediaState=t.paused?"paused":"played",A.rr_mediaCurrentTime=t.currentTime),h||(t.scrollLeft&&(A.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(A.rr_scrollTop=t.scrollTop)),X){let{width:H,height:re}=t.getBoundingClientRect();A={class:A.class,rr_width:"".concat(H,"px"),rr_height:"".concat(re,"px")}}V==="iframe"&&!f(A.src)&&(!X&&!ox(t)&&(A.rr_src=A.src),delete A.src);let Pe;try{customElements.get(V)&&(Pe=!0)}catch{}return{type:Mt.Element,tagName:V,attributes:A,childNodes:[],isSVG:o4(t)||void 0,needBlock:X,rootId:_,isCustom:Pe}}function ct(t){return t==null?"":t.toLowerCase()}function h4(t,e){if(e.comment&&t.type===Mt.Comment)return!0;if(t.type===Mt.Element){if(e.script&&(t.tagName==="script"||t.tagName==="link"&&(t.attributes.rel==="preload"||t.attributes.rel==="modulepreload")||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&ix(t.attributes.href)==="js"))return!0;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(ct(t.attributes.name).match(/^msapplication-tile(image|color)$/)||ct(t.attributes.name)==="application-name"||ct(t.attributes.rel)==="icon"||ct(t.attributes.rel)==="apple-touch-icon"||ct(t.attributes.rel)==="shortcut icon")))return!0;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&ct(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ct(t.attributes.property).match(/^(og|twitter|fb):/)||ct(t.attributes.name).match(/^(og|twitter):/)||ct(t.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(ct(t.attributes.name)==="robots"||ct(t.attributes.name)==="googlebot"||ct(t.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(ct(t.attributes.name)==="author"||ct(t.attributes.name)==="generator"||ct(t.attributes.name)==="framework"||ct(t.attributes.name)==="publisher"||ct(t.attributes.name)==="progid"||ct(t.attributes.property).match(/^article:/)||ct(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(ct(t.attributes.name)==="google-site-verification"||ct(t.attributes.name)==="yandex-verification"||ct(t.attributes.name)==="csrf-token"||ct(t.attributes.name)==="p:domain_verify"||ct(t.attributes.name)==="verify-v1"||ct(t.attributes.name)==="verification"||ct(t.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Va(t,e){let{doc:n,mirror:i,blockClass:r,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:l,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:p,skipChild:m=!1,inlineStylesheet:f=!0,maskInputOptions:h={},maskAttributeFn:_,maskTextFn:v,maskInputFn:I,slimDOMOptions:N,dataURLOptions:j={}
3,inlineImages:P=!1,recordCanvas:X=!1,onSerialize:V,onIframeLoad:A,iframeLoadTimeout:Y=5e3,onBlockedImageLoad:Pe,onStylesheetLoad:H,stylesheetLoadTimeout:re=5e3,keepIframeSrcFn:Te=()=>!1,newlyAddedElement:Ie=!1,ignoreCSSAttributes:fe}=e,{preserveWhiteSpace:ft=!0}=e,U=p4(t,{doc:n,mirror:i,blockClass:r,blockSelector:s,maskAllText:a,unblockSelector:o,maskTextClass:l,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:p,inlineStylesheet:f,maskInputOptions:h,maskAttributeFn:_,maskTextFn:v,maskInputFn:I,dataURLOptions:j,inlineImages:P,recordCanvas:X,keepIframeSrcFn:Te,newlyAddedElement:Ie,ignoreCSSAttributes:fe});if(!U)return console.warn(t,"not serialized"),null;let O;i.hasNode(t)?O=i.getId(t):h4(U,N)||!ft&&U.type===Mt.Text&&!U.isStyle&&!U.textContent.trim().length?O=zc:O=dy();let R=Object.assign(U,{id:O});if(i.add(t,R),O===zc)return null;V&&V(t);let Q=!m;if(R.type===Mt.Element){Q=Q&&!R.needBlock;let q=t.shadowRoot;q&&Gc(q)&&(R.isShadowHost=!0)}if((R.type===Mt.Document||R.type===Mt.Element)&&Q){N.headWhitespace&&R.type===Mt.Element&&R.tagName==="head"&&(ft=!1);let q={doc:n,mirror:i,blockClass:r,blockSelector:s,maskAllText:a,unblockSelector:o,maskTextClass:l,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:p,skipChild:m,inlineStylesheet:f,maskInputOptions:h,maskAttributeFn:_,maskTextFn:v,maskInputFn:I,slimDOMOptions:N,dataURLOptions:j,inlineImages:P,recordCanvas:X,preserveWhiteSpace:ft,onSerialize:V,onIframeLoad:A,iframeLoadTimeout:Y,onBlockedImageLoad:Pe,onStylesheetLoad:H,stylesheetLoadTimeout:re,keepIframeSrcFn:Te,ignoreCSSAttributes:fe},he=t.childNodes?Array.from(t.childNodes):[];for(let ye of he){let We=Va(ye,q);We&&R.childNodes.push(We)}if(UU(t)&&t.shadowRoot)for(let ye of Array.from(t.shadowRoot.childNodes)){let We=Va(ye,q);We&&(Gc(t.shadowRoot)&&(We.isShadow=!0),R.childNodes.push(We))}}if(t.parentNode&&jc(t.parentNode)&&Gc(t.parentNode)&&(R.isShadow=!0),R.type===Mt.Element&&R.tagName==="iframe"&&!R.needBlock&&c4(t,()=>{let q=ox(t);if(q&&A){let he=Va(q,{doc:q,mirror:i,blockClass:r,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:l,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:p,skipChild:!1,inlineStylesheet:f,maskInputOptions:h,maskAttributeFn:_,maskTextFn:v,maskInputFn:I,slimDOMOptions:N,dataURLOptions:j,inlineImages:P,recordCanvas:X,preserveWhiteSpace:ft,onSerialize:V,onIframeLoad:A,iframeLoadTimeout:Y,onStylesheetLoad:H,stylesheetLoadTimeout:re,keepIframeSrcFn:Te,ignoreCSSAttributes:fe});he&&A(t,he)}},Y),R.type===Mt.Element&&R.tagName==="img"&&!t.complete&&R.needBlock){let q=t,he=()=>{if(q.isConnected&&!q.complete&&Pe)try{let ye=q.getBoundingClientRect();ye.width>0&&ye.height>0&&Pe(q,R,ye)}catch{}q.removeEventListener("load",he)};q.isConnected&&q.addEventListener("load",he)}return R.type===Mt.Element&&R.tagName==="link"&&typeof R.attributes.rel=="string"&&(R.attributes.rel==="stylesheet"||R.attributes.rel==="preload"&&typeof R.attributes.href=="string"&&ix(R.attributes.href)==="css")&&u4(t,()=>{if(H){let q=Va(t,{doc:n,mirror:i,blockClass:r,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:l,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:p,skipChild:!1,inlineStylesheet:f,maskInputOptions:h,maskAttributeFn:_,maskTextFn:v,maskInputFn:I,slimDOMOptions:N,dataURLOptions:j,inlineImages:P,recordCanvas:X,preserveWhiteSpace:ft,onSerialize:V,onIframeLoad:A,iframeLoadTimeout:Y,onStylesheetLoad:H,stylesheetLoadTimeout:re,keepIframeSrcFn:Te,ignoreCSSAttributes:fe});q&&H(t,q)}},re),R.type===Mt.Element&&delete R.needBlock,R}function g4(t,e){let{mirror:n=new bm,blockClass:i="rr-block",blockSelector:r=null,unblockSelector:s=null,maskAllText:o=!1,maskTextClass:a="rr-mask",unmaskTextClass:l=null,maskTextSelector:c=null,unmaskTextSelector:u=null,inlineStylesheet:p=!0,inlineImages:m=!1,recordCanvas:f=!1,maskAllInputs:h=!1,maskAttributeFn:_,maskTextFn:v,maskInputFn:I,slimDOM:N=!1,dataURLOptions:j,preserveWhiteSpace:P,onSerialize:X,onIframeLoad:V,iframeLoadTimeout:A,onBlockedImageLoad:Y,onStylesheetLoad:Pe,stylesheetLoadTimeout:H,keepIframeSrcFn:re=()=>!1,ignoreCSSAttributes:Te=new Set([])}=e||{};return Va(t,{doc:t,mirror:n,blockClass:i,blockSelector:r,unblockSelector:s,maskAllText:o,maskTextClass:a,unmaskTextClass:l,maskTextSelector:c,unmaskTextSelector:u,skipChild:!1,inlineStylesheet:p,maskInputOptions:h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:h===!1?{}:h,maskAttributeFn:_,maskTextFn:v,maskInputFn:I,slimDOMOptions:N===!0||N==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:N==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}
3:N===!1?{}:N,dataURLOptions:j,inlineImages:m,recordCanvas:f,preserveWhiteSpace:P,onSerialize:X,onIframeLoad:V,iframeLoadTimeout:A,onBlockedImageLoad:Y,onStylesheetLoad:Pe,stylesheetLoadTimeout:H,keepIframeSrcFn:re,newlyAddedElement:!1,ignoreCSSAttributes:Te})}function wn(t,e,n=document){let i={capture:!0,passive:!0};return n.addEventListener(t,e,i),()=>n.removeEventListener(t,e,i)}var qa="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",D1={map:{},getId(){return console.error(qa),-1},getNode(){return console.error(qa),null},removeNodeFromMap(){console.error(qa)},has(){return console.error(qa),!1},reset(){console.error(qa)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(D1=new Proxy(D1,{get(t,e,n){return e==="map"&&console.error(qa),Reflect.get(t,e,n)}}));function Yc(t,e,n={}){let i=null,r=0;return function(...s){let o=Date.now();!r&&n.leading===!1&&(r=o);let a=e-(o-r),l=this;a<=0||a>e?(i&&(E4(i),i=null),r=o,t.apply(l,s)):!i&&n.trailing!==!1&&(i=Dm(()=>{r=n.leading===!1?0:Date.now(),i=null,t.apply(l,s)},a))}}function cx(t,e,n,i,r=window){let s=r.Object.getOwnPropertyDescriptor(t,e);return r.Object.defineProperty(t,e,i?n:{set(o){Dm(()=>{n.set.call(this,o)},0),s&&s.set&&s.set.call(this,o)}}),()=>cx(t,e,s||{},!0)}function my(t,e,n){try{if(!(e in t))return()=>{};let i=t[e],r=n(i);return typeof r=="function"&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:i}})),t[e]=r,()=>{t[e]=i}}catch{return()=>{}}}var Em=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Em=()=>new Date().getTime());function ux(t){var n,i,r,s,o,a;let e=t.document;return{left:e.scrollingElement?e.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:(e==null?void 0:e.documentElement.scrollLeft)||((i=(n=e==null?void 0:e.body)==null?void 0:n.parentElement)==null?void 0:i.scrollLeft)||((r=e==null?void 0:e.body)==null?void 0:r.scrollLeft)||0,top:e.scrollingElement?e.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:(e==null?void 0:e.documentElement.scrollTop)||((o=(s=e==null?void 0:e.body)==null?void 0:s.parentElement)==null?void 0:o.scrollTop)||((a=e==null?void 0:e.body)==null?void 0:a.scrollTop)||0}}function px(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function dx(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function mx(t){if(!t)return null;try{return t.nodeType===t.ELEMENT_NODE?t:t.parentElement}catch{return null}}function si(t,e,n,i,r){if(!t)return!1;let s=mx(t);if(!s)return!1;let o=Wa(e,n);if(!r){let c=i&&s.matches(i);return o(s)&&!c}let a=Co(s,o),l=-1;return a<0?!1:(i&&(l=Co(s,Wa(null,i))),a>-1&&l<0?!0:a<l)}function _4(t,e){return e.getId(t)!==-1}function M_(t,e){return e.getId(t)===zc}function fx(t,e){if(jc(t))return!1;let n=e.getId(t);return e.has(n)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?fx(t.parentNode,e):!0:!0}function H_(t){return!!t.changedTouches}function y4(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let n=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function hx(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function gx(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function q_(t){return!!(t!=null&&t.shadowRoot)}var j_=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var n;return(n=this.styleIDMap.get(e))!=null?n:-1}has(e){return this.styleIDMap.has(e)}add(e,n){if(this.has(e))return this.getId(e);let i;return n===void 0?i=this.id++:i=n,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function _x(t){var n,i;let e=null;return((i=(n=t.getRootNode)==null?void 0:n.call(t))==null?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&t.getRootNode().host&&(e=t.getRootNode().host),e}function b4(t){let e=t,n;for(;n=_x(e);)e=n;return e}function v4(t){let e=t.ownerDocument;if(!e)return!1;let n=b4(t);return e.contains(n)}function yx(t){let e=t.ownerDocument;return e?e.contains(t)||v4(t):!1}var L1={};function fy(t){let e=L1[t];if(e)return e;let n=window.document,i=window[t];if(n&&typeof n.createElement=="function")try{let r=n.createElement("iframe");r.hidden=!0,n.head.appendChild(r);let s=r.contentWindow;s&&s[t]&&(i=s[t]),n.head.removeChild(r)}catch{}return L1[t]=i.bind(window)}function S4(...t){return fy("requestAnimationFrame")(...t)}function Dm(...t){return fy("setTimeout")(...t)}function E4(...t){return fy("clearTimeout")(...t)}var xe=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(xe||{}),de=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.In
3put=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(de||{}),Cn=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(Cn||{}),Yr=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(Yr||{}),ja=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(ja||{}),Wc;function T4(t){Wc=t}function I4(){Wc=void 0}var je=t=>Wc?(...n)=>{try{return t(...n)}catch(i){if(Wc&&Wc(i)===!0)return()=>{};throw i}}:t,F1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",C4=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Hc=0;Hc<F1.length;Hc++)C4[F1.charCodeAt(Hc)]=Hc;var Hc,Tm=class{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}};function hy(t){try{return t.contentDocument}catch{}}function $c(t){try{return t.contentWindow}catch{}}var G_=class{constructor(e){this.doc=e,this.unattachedDoc=null}parse(e){return this.parseWithConstructableStylesheet(e)||this.parseWithDetachedElement(e)}parseWithConstructableStylesheet(e){if(typeof CSSStyleSheet>"u"||typeof CSSStyleSheet.prototype.replaceSync!="function")return null;try{let n=new CSSStyleSheet;n.replaceSync("x { ".concat(e," }"));let i=n.cssRules[0];return!i||i.type!==CSSRule.STYLE_RULE?null:i.style}catch{return null}}parseWithDetachedElement(e){let n=this.getUnattachedDoc().createElement("span");return n.setAttribute("style",e),n.style}getUnattachedDoc(){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}return this.unattachedDoc}};function U1(t){return"__ln"in t}var W_=class{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let i=0;i<e;i++)n=(n==null?void 0:n.next)||null;return n}addNode(e){let n={value:e,previous:null,next:null};if(e.__ln=n,e.previousSibling&&U1(e.previousSibling)){let i=e.previousSibling.__ln.next;n.next=i,n.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=n,i&&(i.previous=n)}else if(e.nextSibling&&U1(e.nextSibling)&&e.nextSibling.__ln.previous){let i=e.nextSibling.__ln.previous;n.previous=i,n.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=n,i&&(i.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(e){let n=e.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},B1=(t,e)=>"".concat(t,"@").concat(e),V_=class{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;let e=[],n=new Set,i=new W_,r=l=>{let c=l,u=zc;for(;u===zc;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},s=l=>{if(!l.parentNode||!yx(l))return;let c=jc(l.parentNode)?this.mirror.getId(_x(l)):this.mirror.getId(l.parentNode),u=r(l);if(c===-1||u===-1)return i.addNode(l);let p=Va(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskAllText:this.maskAllText,unblockSelector:this.unblockSelector,maskTextClass:this.maskTextClass,unmaskTextClass:this.unmaskTextClass,maskTextSelector:this.maskTextSelector,unmaskTextSelector:this.unmaskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inl
3ineStylesheet,maskInputOptions:this.maskInputOptions,maskAttributeFn:this.maskAttributeFn,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:m=>{hx(m,this.mirror)&&!si(m,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(m),gx(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),q_(l)&&this.shadowDomManager.addShadowRoot(l.shadowRoot,this.doc)},onIframeLoad:(m,f)=>{if(si(m,this.blockClass,this.blockSelector,this.unblockSelector,!1))return;this.iframeManager.attachIframe(m,f);let h=$c(m);h&&this.canvasManager.addWindow(h),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,f)=>{this.stylesheetManager.attachLinkElement(m,f)},onBlockedImageLoad:(m,f,{width:h,height:_})=>{this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:f.id,attributes:{style:{width:"".concat(h,"px"),height:"".concat(_,"px")}}}]})},ignoreCSSAttributes:this.ignoreCSSAttributes});p&&(e.push({parentId:c,nextId:u,node:p}),n.add(p.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)H1(this.removes,l,this.mirror)&&!this.movedSet.has(l.parentNode)||s(l);for(let l of this.addedSet)!q1(this.droppedSet,l)&&!H1(this.removes,l,this.mirror)||q1(this.movedSet,l)?s(l):this.droppedSet.add(l);let o=null;for(;i.length;){let l=null;if(o){let c=this.mirror.getId(o.value.parentNode),u=r(o.value);c!==-1&&u!==-1&&(l=o)}if(!l){let c=i.tail;for(;c;){let u=c;if(c=c.previous,u){let p=this.mirror.getId(u.value.parentNode);if(r(u.value)===-1)continue;if(p!==-1){l=u;break}else{let f=u.value;if(f.parentNode&&f.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let h=f.parentNode.host;if(this.mirror.getId(h)!==-1){l=u;break}}}}}}if(!l){for(;i.head;)i.removeNode(i.head.value);break}o=l.previous,i.removeNode(l.value),s(l.value)}let a={texts:this.texts.map(l=>({id:this.mirror.getId(l.node),value:l.value})).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{let{attributes:c}=l;if(typeof c.style=="string"){let u=JSON.stringify(l.styleDiff),p=JSON.stringify(l._unchangedStyles);u.length<c.style.length&&(u+p).split("var(").length===c.style.split("var(").length&&(c.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:c}}).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:e};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.processMutation=e=>{if(!M_(e.target,this.mirror))switch(e.type){case"characterData":{let n=e.target.textContent;!si(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&n!==e.oldValue&&this.texts.push({value:$a(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&n?this.maskTextFn?this.maskTextFn(n,mx(e.target)):n.replace(/[\S]/g,"*"):n,node:e.target});break}case"attributes":{let n=e.target,i=e.attributeName,r=e.target.getAttribute(i);if(i==="value"){let o=py(n),a=n.tagName;r=vm(n,a,o);let l=Mm({maskInputOptions:this.maskInputOptions,tagName:a,type:o}),c=$a(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,l);r=Vc({isMasked:c,element:n,value:r,maskInputFn:this.maskInputFn})}if(si(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||r===e.oldValue)return;let s=this.attributeMap.get(e.target);if(n.tagName==="IFRAME"&&i==="src"&&!this.keepIframeSrcFn(r))if(!hy(n))i="rr_src";else return;if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(e.target,s)),i==="type"&&n.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!lx(n.tagName,i)&&(s.attributes[i]=ax(this.doc,Ya(n.tagName),Ya(i),r,n,this.maskAttributeFn),i==="style")){let o=e.oldValue?this.styleDeclarationParser.parse(e.oldValue):null;for(let a of Array.from(n.style)){let l=n.style.getPropertyValue(a),c=n.style.getPropertyPriority(a);l!==((o==null?void 0:o.getPropertyValue(a))||"")||c!==((o==null?void 0:o.getPropertyPriority(a)
3)||"")?c===""?s.styleDiff[a]=l:s.styleDiff[a]=[l,c]:s._unchangedStyles[a]=[l,c]}if(o)for(let a of Array.from(o))n.style.getPropertyValue(a)===""&&(s.styleDiff[a]=!1)}break}case"childList":{if(si(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;e.addedNodes.forEach(n=>this.genAdds(n,e.target)),e.removedNodes.forEach(n=>{let i=this.mirror.getId(n),r=jc(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);si(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||M_(n,this.mirror)||!_4(n,this.mirror)||(this.addedSet.has(n)?(z_(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(e.target)&&i===-1||fx(e.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[B1(i,r)]?z_(this.movedSet,n):this.removes.push({parentId:r,id:i,isShadow:jc(e.target)&&Gc(e.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(e,n)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(M_(e,this.mirror))return;this.movedSet.add(e);let i=null;n&&this.mirror.hasNode(n)&&(i=this.mirror.getId(n)),i&&i!==-1&&(this.movedMap[B1(this.mirror.getId(e),i)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);si(e,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(e.childNodes&&e.childNodes.forEach(i=>this.genAdds(i)),q_(e)&&e.shadowRoot.childNodes.forEach(i=>{this.processedNodeManager.add(i,this),this.genAdds(i,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager","ignoreCSSAttributes"].forEach(n=>{this[n]=e[n]}),this.styleDeclarationParser=new G_(this.doc)}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function z_(t,e){var n;t.delete(e),(n=e.childNodes)==null||n.forEach(i=>z_(t,i))}function H1(t,e,n){return t.length===0?!1:w4(t,e,n)}function w4(t,e,n){let i=e.parentNode;for(;i;){let r=n.getId(i);if(t.some(s=>s.id===r))return!0;i=i.parentNode}return!1}function q1(t,e){return t.size===0?!1:bx(t,e)}function bx(t,e){let{parentNode:n}=e;return n?t.has(n)?!0:bx(t,n):!1}var za=[];function Zc(t){try{if("composedPath"in t){let e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch{}return t&&t.target}function vx(t,e){var o,a;let n=new V_;za.push(n),n.init(t);let i=window.MutationObserver||window.__rrMutationObserver,r=(a=(o=window==null?void 0:window.Zone)==null?void 0:o.__symbol__)==null?void 0:a.call(o,"MutationObserver");r&&window[r]&&(i=window[r]);let s=new i(je(l=>{t.onMutation&&t.onMutation(l)===!1||n.processMutations.bind(n)(l)}));return s.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function x4({mousemoveCb:t,sampling:e,doc:n,mirror:i}){if(e.mousemove===!1)return()=>{};let r=typeof e.mousemove=="number"?e.mousemove:50,s=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,o=[],a,l=Yc(je(p=>{let m=Date.now()-a;t(o.map(f=>(f.timeOffset-=m,f)),p),o=[],a=null}),s),c=je(Yc(je(p=>{let m=Zc(p),{clientX:f,clientY:h}=H_(p)?p.changedTouches[0]:p;a||(a=Em()),o.push({x:f,y:h,id:i.getId(m),timeOffset:Em()-a}),l(typeof DragEvent<"u"&&p instanceof DragEvent?de.Drag:p instanceof MouseEvent?de.MouseMove:de.TouchMove)}),r,{trailing:!1})),u=[wn("mousemove",c,n),wn("touchmove",c,n),wn("drag",c,n)];return je(()=>{u.forEach(p=>p())})}function A4({mouseInteractionCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,unblockSelector:s,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,l=[],c=null,u=p=>m=>{let f=Zc(m);if(si(f,i,r,s,!0))return;let h=null,_=p;if("pointerType"in m){switch(m.pointerType){case"mouse":h=Yr.Mouse;break;case"touch":h=Yr.Touch;break;case"pen":h=Yr.Pen;break}h===Yr.Touch?Cn[p]===Cn.MouseDown?_="TouchStart":Cn[p]===Cn.MouseUp&&(_="TouchEnd"):Yr.Pen}else H_(m)&&(h=Yr.Touch);h!==null?(c=h,(_.startsWith("Touch")&&h===Yr.Touch||_.startsWith("Mouse")&&h===Yr.Mouse)&&(h=null)):Cn[p]===Cn.Click&&(h=c,c=null);let v=H_(m)?m.changedTouches[0]:m;if(!v)return;let I=n.getId(f),{clientX:N,clientY:j}=v;je(t)(g({type:Cn[_],id:I,x:N,y:j},h!==null&&{pointerType:h}))};return Object.keys(Cn).filter(p=>Number.isNaN(Number(p))&&!p.endsWith("_Departed")&&a[p]!==!1).forEac
3h(p=>{let m=Ya(p),f=u(p);if(window.PointerEvent)switch(Cn[p]){case Cn.MouseDown:case Cn.MouseUp:m=m.replace("mouse","pointer");break;case Cn.TouchStart:case Cn.TouchEnd:return}l.push(wn(m,f,e))}),je(()=>{l.forEach(p=>p())})}function Sx({scrollCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,unblockSelector:s,sampling:o}){let a=je(Yc(je(l=>{let c=Zc(l);if(!c||si(c,i,r,s,!0))return;let u=n.getId(c);if(c===e&&e.defaultView){let p=ux(e.defaultView);t({id:u,x:p.left,y:p.top})}else t({id:u,x:c.scrollLeft,y:c.scrollTop})}),o.scroll||100));return wn("scroll",a,e)}function k4({viewportResizeCb:t},{win:e}){let n=-1,i=-1,r=je(Yc(je(()=>{let s=px(),o=dx();(n!==s||i!==o)&&(t({width:Number(o),height:Number(s)}),n=s,i=o)}),200));return wn("resize",r,e)}var R4=["INPUT","TEXTAREA","SELECT"],j1=new WeakMap;function O4({inputCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,unblockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:l,maskInputFn:c,sampling:u,userTriggeredOnInput:p,maskTextClass:m,unmaskTextClass:f,maskTextSelector:h,unmaskTextSelector:_}){function v(A){let Y=Zc(A),Pe=A.isTrusted,H=Y&&U_(Y.tagName);if(H==="OPTION"&&(Y=Y.parentElement),!Y||!H||R4.indexOf(H)<0||si(Y,i,r,s,!0))return;let re=Y;if(re.classList.contains(o)||a&&re.matches(a))return;let Te=py(Y),Ie=vm(re,H,Te),fe=!1,ft=Mm({maskInputOptions:l,tagName:H,type:Te}),U=$a(Y,m,h,f,_,ft);(Te==="radio"||Te==="checkbox")&&(fe=Y.checked),Ie=Vc({isMasked:U,element:Y,value:Ie,maskInputFn:c}),I(Y,p?{text:Ie,isChecked:fe,userTriggered:Pe}:{text:Ie,isChecked:fe});let O=Y.name;Te==="radio"&&O&&fe&&e.querySelectorAll('input[type="radio"][name="'.concat(O,'"]')).forEach(R=>{if(R!==Y){let Q=Vc({isMasked:U,element:R,value:vm(R,H,Te),maskInputFn:c});I(R,p?{text:Q,isChecked:!fe,userTriggered:!1}:{text:Q,isChecked:!fe})}})}function I(A,Y){let Pe=j1.get(A);if(!Pe||Pe.text!==Y.text||Pe.isChecked!==Y.isChecked){j1.set(A,Y);let H=n.getId(A);je(t)(D(g({},Y),{id:H}))}}
vendor: 8,738 bytes, line 3
3let j=(u.input==="last"?["change"]:["input","change"]).map(A=>wn(A,je(v),e)),P=e.defaultView;if(!P)return()=>{j.forEach(A=>A())};let X=P.Object.getOwnPropertyDescriptor(P.HTMLInputElement.prototype,"value"),V=[[P.HTMLInputElement.prototype,"value"],[P.HTMLInputElement.prototype,"checked"],[P.HTMLSelectElement.prototype,"value"],[P.HTMLTextAreaElement.prototype,"value"],[P.HTMLSelectElement.prototype,"selectedIndex"],[P.HTMLOptionElement.prototype,"selected"]];return X&&X.set&&j.push(...V.map(A=>cx(A[0],A[1],{set(){je(v)({target:this,isTrusted:!1})}},!1,P))),je(()=>{j.forEach(A=>A())})}function Im(t){let e=[];function n(i,r){if(hm("CSSGroupingRule")&&i.parentRule instanceof CSSGroupingRule||hm("CSSMediaRule")&&i.parentRule instanceof CSSMediaRule||hm("CSSSupportsRule")&&i.parentRule instanceof CSSSupportsRule||hm("CSSConditionRule")&&i.parentRule instanceof CSSConditionRule){let o=Array.from(i.parentRule.cssRules).indexOf(i);r.unshift(o)}else if(i.parentStyleSheet){let o=Array.from(i.parentStyleSheet.cssRules).indexOf(i);r.unshift(o)}return r}return n(t,e)}function Ss(t,e,n){let i,r;return t?(t.ownerNode?i=e.getId(t.ownerNode):r=n.getId(t),{styleId:r,id:i}):{}}function N4({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};let r=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:je((u,p,m)=>{let[f,h]=m,{id:_,styleId:v}=Ss(p,e,n.styleMirror);return(_&&_!==-1||v&&v!==-1)&&t({id:_,styleId:v,adds:[{rule:f,index:h}]}),u.apply(p,m)})});let s=i.CSSStyleSheet.prototype.deleteRule;i.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:je((u,p,m)=>{let[f]=m,{id:h,styleId:_}=Ss(p,e,n.styleMirror);return(h&&h!==-1||_&&_!==-1)&&t({id:h,styleId:_,removes:[{index:f}]}),u.apply(p,m)})});let o;i.CSSStyleSheet.prototype.replace&&(o=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:je((u,p,m)=>{let[f]=m,{id:h,styleId:_}=Ss(p,e,n.styleMirror);return(h&&h!==-1||_&&_!==-1)&&t({id:h,styleId:_,replace:f}),u.apply(p,m)})}));let a;i.CSSStyleSheet.prototype.replaceSync&&(a=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:je((u,p,m)=>{let[f]=m,{id:h,styleId:_}=Ss(p,e,n.styleMirror);return(h&&h!==-1||_&&_!==-1)&&t({id:h,styleId:_,replaceSync:f}),u.apply(p,m)})}));let l={};gm("CSSGroupingRule")?l.CSSGroupingRule=i.CSSGroupingRule:(gm("CSSMediaRule")&&(l.CSSMediaRule=i.CSSMediaRule),gm("CSSConditionRule")&&(l.CSSConditionRule=i.CSSConditionRule),gm("CSSSupportsRule")&&(l.CSSSupportsRule=i.CSSSupportsRule));let c={};return Object.entries(l).forEach(([u,p])=>{c[u]={insertRule:p.prototype.insertRule,deleteRule:p.prototype.deleteRule},p.prototype.insertRule=new Proxy(c[u].insertRule,{apply:je((m,f,h)=>{let[_,v]=h,{id:I,styleId:N}=Ss(f.parentStyleSheet,e,n.styleMirror);return(I&&I!==-1||N&&N!==-1)&&t({id:I,styleId:N,adds:[{rule:_,index:[...Im(f),v||0]}]}),m.apply(f,h)})}),p.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:je((m,f,h)=>{let[_]=h,{id:v,styleId:I}=Ss(f.parentStyleSheet,e,n.styleMirror);return(v&&v!==-1||I&&I!==-1)&&t({id:v,styleId:I,removes:[{index:[...Im(f),_]}]}),m.apply(f,h)})})}),je(()=>{i.CSSStyleSheet.prototype.insertRule=r,i.CSSStyleSheet.prototype.deleteRule=s,o&&(i.CSSStyleSheet.prototype.replace=o),a&&(i.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([u,p])=>{p.prototype.insertRule=c[u].insertRule,p.prototype.deleteRule=c[u].deleteRule})})}function Ex({mirror:t,stylesheetManager:e},n){var o,a,l;let i=null;n.nodeName==="#document"?i=t.getId(n):i=t.getId(n.host);let r=n.nodeName==="#document"?(o=n.defaultView)==null?void 0:o.Document:(l=(a=n.ownerDocument)==null?void 0:a.defaultView)==null?void 0:l.ShadowRoot,s=r!=null&&r.prototype?Object.getOwnPropertyDescriptor(r==null?void 0:r.prototype,"adoptedStyleSheets"):void 0;return i===null||i===-1||!r||!s?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get(){var c;return(c=s.get)==null?void 0:c.call(this)},set(c){var p;let u=(p=s.set)==null?void 0:p.call(this,c);if(i!==null&&i!==-1)try{e.adoptStyleSheets(c,i)}catch{}return u}}),je(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get:s.get,set:s.set})}))}function M4({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:i},{win:r}){let s=r.CSSStyleDeclaration.prototype.setProperty;r.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:je((a,l,c)=>{var _;let[u,p,m]=c;if(n.has(u))return s.apply(l,[u,p,m]);let{id:f,styleId:h}=Ss((_=l.parentRule)==null?void 0:_.parentStyleSheet,e,i.styleMirror);return(f&&f!==-1||h&&h!==-1)&&t({id:f,styleId:h,set:{property:u,value:p,priority:m},index:Im(l.parentRule)}),a.apply(l,c)})});let o=r.CSSStyleDeclaration.prototype.removeProperty;return r.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:je((a,l,c)=>{var f;let[u]=c;if(n.has(u))return o.apply(l,[u]);let{id:p,styleId:m}=Ss((f=l.parentRule)==null?void 0:f.parentStyleSheet,e,i.styleMirror);return(p&&p!==-1||m&&m!==-1)&&t({id:p,styleId:m,remove:{property:u},index:Im(l.parentRule)}),a.apply(l,c)})}),je(()=>{r.CSSStyleDeclaration.prototype.setProperty=s,r.CSSStyleDeclaration.prototype.removeProperty=o})}function P4({mediaInteractionCb:t,blockClass:e,blockSelector:n,unblockSelector:i,mirror:r,sampling:s,doc:o}){let a=je(c=>Yc(je(u=>{let p=Zc(u);if(!p||si(p,e,n,i,!0))return;let{currentTime:m,volume:f,muted:h,playbackRate:_}=p;t({type:c,id:r.getId(p),currentTime:m,volume:f,muted:h,playbackRate:_})}),s.media||500)),l=[wn("play",a(ja.Play),o),wn("pause",a(ja.Pause),o),wn("seeked",a(ja.Seeked),o),wn("volumechange",a(ja.VolumeChange),o),wn("ratechange",a(ja.RateChange),o)];return je(()=>{l.forEach(c=>c())})}function D4({fontCb:t,doc:e}){let n=e.defaultView;if(!n)return()=>{};let i=[],r=new WeakMap,s=n.FontFace;n.FontFace=function(l,c,u){let p=new s(l,c,u);return r.set(p,{family:l,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),p};let o=my(e.fonts,"add",function(a){return function(l){return Dm(je(()=>{let c=r.get(l);c&&(t(c),r.delete(l))}),0),a.apply(this,[l])}});return i.push(()=>{n.FontFace=s}),i.push(o),je(()=>{i.forEach(a=>a())})}function L4(t){let{doc:e,mirror:n,blockClass:i,blockSelector:r,unblockSelector:s,selectionCb:o}=t,a=!0,l=je(()=>{let c=e.getSelection();if(!c||a&&(c!=null&&c.isCollapsed))return;a=c.isCollapsed||!1;let u=[],p=c.rangeCount||0;for(let m=0;m<p;m++){let f=c.getRangeAt(m),{startContainer:h,startOffset:_,endContainer:v,endOffset:I}=f;si(h,i,r,s,!0)||si(v,i,r,s,!0)||u.push({start:n.getId(h),startOffset:_,end:n.getId(v),endOffset:I})}o({ranges:u})});return l(),wn("selectionchange",l)}function F4({doc:t,customElementCb:e}){let n=t.defaultView;return!n||!n.customElements?()=>{}:my(n.customElements,"define",function(r){return function(s,o,a){try{e({define:{name:s}})}catch{}return r.apply(this,[s,o,a])}})}function U4(t,e={}){let n=t.doc.defaultView;if(!n)return()=>{};let i;t.recordDOM&&(i=vx(t,t.doc));let r=x4(t),s=A4(t),o=Sx(t),a=k4(t,{win:n}),l=O4(t),c=P4(t),u=()=>{},p=()=>{},m=()=>{},f=()=>{};t.recordDOM&&(u=N4(t,{win:n}),p=Ex(t,t.doc),m=M4(t,{win:n}),t.collectFonts&&(f=D4(t)));let h=L4(t),_=F4(t),v=[];for(let I of t.plugins)v.push(I.observer(I.callback,n,I.options));return je(()=>{za.forEach(I=>I.reset()),i==null||i.disconnect(),r(),s(),o(),a(),l(),c(),u(),p(),m(),f(),h(),_(),v.forEach(I=>I())})}function hm(t){return typeof window[t]<"u"}function gm(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var Kc=class{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,n,i,r){let s=i||this.getIdToRemoteIdMap(e),o=r||this.getRemoteIdToIdMap(e),a=s.get(n);return a||(a=this.generateIdFn(),s.set(n,a),o.set(a,n)),a}getIds(e,n){let i=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return n.map(s=>this.getId(e,s,i,r))}getRemoteId(e,n,i){let r=i||this.getRemoteIdToIdMap(e);if(typeof n!="number")return n;let s=r.get(n);return s||-1}getRemoteIds(e,n){let i=this.getRemoteIdToIdMap(e);return n.map(r=>this.getRemoteId(e,r,i))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let n=this.iframeIdToRemoteIdMap.get(e);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(e,n)),n}getRemoteIdToIdMap(e){let n=this.iframeRemoteIdToIdMap.get(e);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(e,n)),n}}
3,Y_=class{constructor(){this.crossOriginIframeMirror=new Kc(dy),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}},$_=class{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Kc(dy),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Kc(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0);let n=$c(e);n&&this.crossOriginIframeMap.set(n,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,n){var r,s;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=$c(e))==null||r.addEventListener("message",this.handleMessage.bind(this))),(s=this.loadListener)==null||s.call(this,e);let i=hy(e);i&&i.adoptedStyleSheets&&i.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(i.adoptedStyleSheets,this.mirror.getId(i))}handleMessage(e){let n=e;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!e.source)return;let r=this.crossOriginIframeMap.get(e.source);if(!r)return;let s=this.transformCrossOriginEvent(r,n.data.event);s&&this.wrappedEmit(s,n.data.isCheckout)}transformCrossOriginEvent(e,n){var i;switch(n.type){case xe.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(n.data.node,e);let r=n.data.node.id;return this.crossOriginIframeRootIdMap.set(e,r),this.patchRootIdOnNode(n.data.node,r),{timestamp:n.timestamp,type:xe.IncrementalSnapshot,data:{source:de.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case xe.Meta:case xe.Load:case xe.DomContentLoaded:return!1;case xe.Plugin:return n;case xe.Custom:return this.replaceIds(n.data.payload,e,["id","parentId","previousId","nextId"]),n;case xe.IncrementalSnapshot:switch(n.data.source){case de.Mutation:return n.data.adds.forEach(r=>{this.replaceIds(r,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(r.node,e);let s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(r.node,s)}),n.data.removes.forEach(r=>{this.replaceIds(r,e,["parentId","id"])}),n.data.attributes.forEach(r=>{this.replaceIds(r,e,["id"])}),n.data.texts.forEach(r=>{this.replaceIds(r,e,["id"])}),n;case de.Drag:case de.TouchMove:case de.MouseMove:return n.data.positions.forEach(r=>{this.replaceIds(r,e,["id"])}),n;case de.ViewportResize:return!1;case de.MediaInteraction:case de.MouseInteraction:case de.Scroll:case de.CanvasMutation:case de.Input:return this.replaceIds(n.data,e,["id"]),n;case de.StyleSheetRule:case de.StyleDeclaration:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleId"]),n;case de.Font:return n;case de.Selection:return n.data.ranges.forEach(r=>{this.replaceIds(r,e,["start","end"])}),n;case de.AdoptedStyleSheet:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleIds"]),(i=n.data.styles)==null||i.forEach(r=>{this.replaceStyleIds(r,e,["styleId"])}),n}}return!1}replace(e,n,i,r){for(let s of r)!Array.isArray(n[s])&&typeof n[s]!="number"||(Array.isArray(n[s])?n[s]=e.getIds(i,n[s]):n[s]=e.getId(i,n[s]));return n}replaceIds(e,n,i){return this.replace(this.crossOriginIframeMirror,e,n,i)}replaceStyleIds(e,n,i){return this.replace(this.crossOriginIframeStyleMirror,e,n,i)}replaceIdOnNode(e,n){this.replaceIds(e,n,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(i=>{this.replaceIdOnNode(i,n)})}patchRootIdOnNode(e,n){e.type!==Mt.Document&&!e.rootId&&(e.rootId=n),"childNodes"in e&&e.childNodes.forEach(i=>{this.patchRootIdOnNode(i,n)})}},K_=class{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}},Q_=class{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,n){if(!Gc(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e),this.bypassOptions.canvasManager.addShadowRoot(e);let i=vx(D(g({},this.bypassOptions),{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>i.disconnect()),this.restoreHandlers.push(Sx(D(g({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),Dm(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(Ex({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){let n=hy(e),i=$c(e);!n||!i||this.patchAttachShadow(i.Element,n)}patchAttachShadow(e,n){let i=this;this.restoreHandlers.push(my(e.prototype,"attachShadow",function(r){return function(s){let o=r.call(this,s);return this.shadowRoot&&yx(this)&&i.addShadowRoot(this.shadowRoot,n),o}}))}
3reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}},X_=class{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new j_,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,n){if(e.length===0)return;let i={id:n,styleIds:[]},r=[];for(let s of e){let o;this.styleMirror.has(s)?o=this.styleMirror.getId(s):(o=this.styleMirror.add(s),r.push({styleId:o,rules:Array.from(s.rules||CSSRule,(a,l)=>({rule:nx(a),index:l}))})),i.styleIds.push(o)}r.length>0&&(i.styles=r),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},J_=class{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(e,n){let i=this.nodeMap.get(e);return i&&Array.from(i).some(r=>r!==n)}add(e,n){this.active||(this.active=!0,S4(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(n))}destroy(){}},wt,Cm,tx;try{if(Array.from([1],t=>t*2)[0]!==2){let t=document.createElement("iframe");document.body.appendChild(t),Array.from=((tx=t.contentWindow)==null?void 0:tx.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var Vi=VU();function zi(t={}){let{emit:e,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:r="rr-block",blockSelector:s=null,unblockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskAllText:c=!1,maskTextClass:u="rr-mask",unmaskTextClass:p=null,maskTextSelector:m=null,unmaskTextSelector:f=null,inlineStylesheet:h=!0,maskAllInputs:_,maskInputOptions:v,slimDOMOptions:I,maskAttributeFn:N,maskInputFn:j,maskTextFn:P,maxCanvasSize:X=null,packFn:V,sampling:A={},dataURLOptions:Y={},mousemoveWait:Pe,recordDOM:H=!0,recordCanvas:re=!1,recordCrossOriginIframes:Te=!1,recordAfter:Ie=t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load",userTriggeredOnInput:fe=!1,collectFonts:ft=!1,inlineImages:U=!1,plugins:O,keepIframeSrcFn:R=()=>!1,ignoreCSSAttributes:Q=new Set([]),errorHandler:q,onMutation:he,getCanvasManager:ye}=t;T4(q);let We=Te?window.parent===window:!0,Se=!1;if(!We)try{window.parent.document&&(Se=!1)}catch{Se=!0}if(We&&!e)throw new Error("emit function is required");if(!We&&!Se)return()=>{};Pe!==void 0&&A.mousemove===void 0&&(A.mousemove=Pe),Vi.reset();let Rn=_===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,radio:!0,checkbox:!0}:v!==void 0?v:{},Mi=I===!0||I==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:I==="all",headMetaDescKeywords:I==="all"}:I||{};y4();let ht,Jt=0,Ht=$e=>{for(let Pi of O||[])Pi.eventProcessor&&($e=Pi.eventProcessor($e));return V&&!Se&&($e=V($e)),$e};wt=($e,Pi)=>{var On;let Be=$e;if(Be.timestamp=Em(),(On=za[0])!=null&&On.isFrozen()&&Be.type!==xe.FullSnapshot&&!(Be.type===xe.IncrementalSnapshot&&Be.data.source===de.Mutation)&&za.forEach(_n=>_n.unfreeze()),We)e==null||e(Ht(Be),Pi);else if(Se){let _n={type:"rrweb",event:Ht(Be),origin:window.location.origin,isCheckout:Pi};window.parent.postMessage(_n,"*")}if(Be.type===xe.FullSnapshot)ht=Be,Jt=0;else if(Be.type===xe.IncrementalSnapshot){if(Be.data.source===de.Mutation&&Be.data.isAttachIframe)return;Jt++;let _n=i&&Jt>=i,Je=n&&ht&&Be.timestamp-ht.timestamp>n;(_n||Je)&&Wf(!0)}};let ui=$e=>{wt({type:xe.IncrementalSnapshot,data:g({source:de.Mutation},$e)})},Do=$e=>wt({type:xe.IncrementalSnapshot,data:g({source:de.Scroll},$e)}),_O=$e=>wt({type:xe.IncrementalSnapshot,data:g({source:de.CanvasMutation},$e)}),yO=$e=>wt({type:xe.IncrementalSnapshot,data:g({source:de.AdoptedStyleSheet},$e)}),Ps=new X_({mutationCb:ui,adoptedStyleSheetCb:yO}),Ds=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new Y_:new $_({mirror:Vi,mutationCb:ui,stylesheetManager:Ps,recordCrossOriginIframes:Te,wrappedEmit:wt});for(let $e of O||[])$e.getMirror&&$e.getMirror({nodeMirror:Vi,crossOriginIframeMirror:Ds.crossOriginIframeMirror,crossOriginIframeStyleMirror:Ds.crossOriginIframeStyleMirror});let jf=new J_,Gf=H4(ye,{mirror:Vi,win:window,mutationCb:$e=>wt({type:xe.IncrementalSnapshot,data:g({source:de.CanvasMutation},$e)}),recordCanvas:re,blockClass:r,blockSelector:s,unblockSelector:o,maxCanvasSize:X,sampling:A.canvas,dataURLOptions:Y,errorHandler:q}),Uu=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new K_:new Q_({mutationCb:ui,scrollCb:Do,bypassOptions:{onMutation:he,blockClass:r,blockSelector:s,unblockSelector:o,maskAllText:c,maskTextClass:u,unmaskTextClass:p,maskTextSelector:m,unmaskTextSelector:f,inlineStylesheet:h,maskInputOptions:Rn,dataURLOptions:Y,maskAttributeFn:N,maskTextFn:P,maskInputFn:j,recordCanvas:re,inlineImages:U,sampling:A,slimDOMOptions:Mi,iframeManager:Ds,stylesheetManager:Ps,canvasManager:Gf,keepIframeSrcFn:R,processedNodeManager:jf,ignoreCSSAttributes:Q},mirror:Vi}),Wf=($e=!1)=>
3{if(!H)return;wt({type:xe.Meta,data:{href:window.location.href,width:dx(),height:px()}},$e),Ps.reset(),Uu.init(),za.forEach(Be=>Be.lock());let Pi=g4(document,{mirror:Vi,blockClass:r,blockSelector:s,unblockSelector:o,maskAllText:c,maskTextClass:u,unmaskTextClass:p,maskTextSelector:m,unmaskTextSelector:f,inlineStylesheet:h,maskAllInputs:Rn,maskAttributeFn:N,maskInputFn:j,maskTextFn:P,slimDOM:Mi,dataURLOptions:Y,recordCanvas:re,inlineImages:U,onSerialize:Be=>{hx(Be,Vi)&&Ds.addIframe(Be),gx(Be,Vi)&&Ps.trackLinkElement(Be),q_(Be)&&Uu.addShadowRoot(Be.shadowRoot,document)},onIframeLoad:(Be,On)=>{Ds.attachIframe(Be,On);let _n=$c(Be);_n&&Gf.addWindow(_n),Uu.observeAttachShadow(Be)},onStylesheetLoad:(Be,On)=>{Ps.attachLinkElement(Be,On)},onBlockedImageLoad:(Be,On,{width:_n,height:Je})=>{ui({adds:[],removes:[],texts:[],attributes:[{id:On.id,attributes:{style:{width:"".concat(_n,"px"),height:"".concat(Je,"px")}}}]})},keepIframeSrcFn:R,ignoreCSSAttributes:Q});if(!Pi)return console.warn("Failed to snapshot the document");wt({type:xe.FullSnapshot,data:{node:Pi,initialOffset:ux(window)}}),za.forEach(Be=>Be.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Ps.adoptStyleSheets(document.adoptedStyleSheets,Vi.getId(document))};Cm=Wf;try{let $e=[],Pi=On=>{var _n;return je(U4)({onMutation:he,mutationCb:ui,mousemoveCb:(Je,Vf)=>wt({type:xe.IncrementalSnapshot,data:{source:Vf,positions:Je}}),mouseInteractionCb:Je=>wt({type:xe.IncrementalSnapshot,data:g({source:de.MouseInteraction},Je)}),scrollCb:Do,viewportResizeCb:Je=>wt({type:xe.IncrementalSnapshot,data:g({source:de.ViewportResize},Je)}),inputCb:Je=>wt({type:xe.IncrementalSnapshot,data:g({source:de.Input},Je)}),mediaInteractionCb:Je=>wt({type:xe.IncrementalSnapshot,data:g({source:de.MediaInteraction},Je)}),styleSheetRuleCb:Je=>wt({type:xe.IncrementalSnapshot,data:g({source:de.StyleSheetRule},Je)}),styleDeclarationCb:Je=>wt({type:xe.IncrementalSnapshot,data:g({source:de.StyleDeclaration},Je)}),canvasMutationCb:_O,fontCb:Je=>wt({type:xe.IncrementalSnapshot,data:g({source:de.Font},Je)}),selectionCb:Je=>{wt({type:xe.IncrementalSnapshot,data:g({source:de.Selection},Je)})},customElementCb:Je=>{wt({type:xe.IncrementalSnapshot,data:g({source:de.CustomElement},Je)})},blockClass:r,ignoreClass:a,ignoreSelector:l,maskAllText:c,maskTextClass:u,unmaskTextClass:p,maskTextSelector:m,unmaskTextSelector:f,maskInputOptions:Rn,inlineStylesheet:h,sampling:A,recordDOM:H,recordCanvas:re,inlineImages:U,userTriggeredOnInput:fe,collectFonts:ft,doc:On,maskAttributeFn:N,maskInputFn:j,maskTextFn:P,keepIframeSrcFn:R,blockSelector:s,unblockSelector:o,slimDOMOptions:Mi,dataURLOptions:Y,mirror:Vi,iframeManager:Ds,stylesheetManager:Ps,shadowDomManager:Uu,processedNodeManager:jf,canvasManager:Gf,ignoreCSSAttributes:Q,plugins:((_n=O==null?void 0:O.filter(Je=>Je.observer))==null?void 0:_n.map(Je=>({observer:Je.observer,options:Je.options,callback:Vf=>wt({type:xe.Plugin,data:{plugin:Je.name,payload:Vf}})})))||[]},{})};Ds.addLoadListener(On=>{try{$e.push(Pi(On.contentDocument))}catch(_n){console.warn(_n)}});let Be=()=>{Wf(),$e.push(Pi(document))};return document.readyState==="interactive"||document.readyState==="complete"?Be():($e.push(wn("DOMContentLoaded",()=>{wt({type:xe.DomContentLoaded,data:{}}),Ie==="DOMContentLoaded"&&Be()})),$e.push(wn("load",()=>{wt({type:xe.Load,data:{}}),Ie==="load"&&Be()},window))),()=>{$e.forEach(On=>On()),jf.destroy(),Cm=void 0,I4()}}catch($e){console.warn($e)}}function B4(t){if(!Cm)throw new Error("please take full snapshot after start recording");Cm(t)}zi.mirror=Vi;zi.takeFullSnapshot=B4;function H4(t,e){try{return t?t(e):new Tm}catch{return console.warn("Unable to initialize CanvasManager"),new Tm}}var G1;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(G1||(G1={}));var q4=3,j4=5;function gy(t){return t>9999999999?t:t*1e3}function P_(t){return t>9999999999?t/1e3:t}function eu(t,e){e.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(e.category)?t.triggerUserActivity():t.checkAndHandleExpiredSession(),t.addUpdate(()=>(t.throttledAddEvent({type:xe.Custom,timestamp:(e.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:dn(e,10,1e3)}}),e.category==="console")))}var G4="button,a";function Tx(t){return t.closest(G4)||t}function Ix(t){let e=Cx(t);return!e||!(e instanceof Element)?e:Tx(e)}function Cx(t){return W4(t)?t.target:t}function W4(t){return Jn(t)&&"target"in t}var Es;function V4(t){return Es||(Es=[],z4()),Es.push(t),()=>{let e=Es?Es.indexOf(t):-1;e>-1&&Es.splice(e,1)}}function z4(){Tt(ut,"open",function(t){return function(...e){if(Es)try{Es.forEach(n=>n())}catch{}return t.apply(ut,e)}})}var Y4=new Set([de.Mutation,de.StyleSheetRule,de.StyleDeclaration,de.AdoptedStyleSheet,de.CanvasMutation,de.Selection,de.MediaInteraction]);function $4(t,e,n){t.handleClick(e,n)}var Z_=class{constructor(e,n,i=eu){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=n.timeout/1e3,this._threshold=n.threshold/1e3,this._scrollTimeout=n.scrollTimeout/1e3,this._replay=e,this._ignoreSelector=n.ignoreSelector,this._addBreadcrumbEvent=i}addListeners(){let e=V4(()=>{this._lastMutation=W1()});this._teardown=()=>{e(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(e,n){if(Q4(n,this._ignoreSelector)||!X4(e))return;let i={timestamp:P_(e.timestamp),clickBreadcrumb:e,clickCount:0,node:n};this._clicks.some(r=>r.node===i.node&&Math.abs(r.timestamp-i.timestamp)<1)||(this._clicks.push(i),this._clicks.length===1&&this._scheduleCheckClicks())}registerMutation(e=Date.now()){this._lastMutation=P_(e)}registerScroll(e=Date.now()){this._lastScroll=P_(e)}registerClick(e){let n=Tx(e);this._handleMultiClick(n)}_handleMultiClick(e){this._getClicks(e).forEach(n=>
3{n.clickCount++})}_getClicks(e){return this._clicks.filter(n=>n.node===e)}_checkClicks(){let e=[],n=W1();this._clicks.forEach(i=>{!i.mutationAfter&&this._lastMutation&&(i.mutationAfter=i.timestamp<=this._lastMutation?this._lastMutation-i.timestamp:void 0),!i.scrollAfter&&this._lastScroll&&(i.scrollAfter=i.timestamp<=this._lastScroll?this._lastScroll-i.timestamp:void 0),i.timestamp+this._timeout<=n&&e.push(i)});for(let i of e){let r=this._clicks.indexOf(i);r>-1&&(this._generateBreadcrumbs(i),this._clicks.splice(r,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(e){let n=this._replay,i=e.scrollAfter&&e.scrollAfter<=this._scrollTimeout,r=e.mutationAfter&&e.mutationAfter<=this._threshold,s=!i&&!r,{clickCount:o,clickBreadcrumb:a}=e;if(s){let l=Math.min(e.mutationAfter||this._timeout,this._timeout)*1e3,c=l<this._timeout*1e3?"mutation":"timeout",u={type:"default",message:a.message,timestamp:a.timestamp,category:"ui.slowClickDetected",data:D(g({},a.data),{url:ut.location.href,route:n.getCurrentRoute(),timeAfterClickMs:l,endReason:c,clickCount:o||1})};this._addBreadcrumbEvent(n,u);return}if(o>1){let l={type:"default",message:a.message,timestamp:a.timestamp,category:"ui.multiClick",data:D(g({},a.data),{url:ut.location.href,route:n.getCurrentRoute(),clickCount:o,metric:!0})};this._addBreadcrumbEvent(n,l)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=To(()=>this._checkClicks(),1e3)}},K4=["A","BUTTON","INPUT"];function Q4(t,e){return!!(!K4.includes(t.tagName)||t.tagName==="INPUT"&&!["submit","button"].includes(t.getAttribute("type")||"")||t.tagName==="A"&&(t.hasAttribute("download")||t.hasAttribute("target")&&t.getAttribute("target")!=="_self")||e&&t.matches(e))}function X4(t){return!!(t.data&&typeof t.data.nodeId=="number"&&t.timestamp)}function W1(){return Date.now()/1e3}function J4(t,e){try{if(!Z4(e))return;let{source:n}=e.data;if(Y4.has(n)&&t.registerMutation(e.timestamp),n===de.Scroll&&t.registerScroll(e.timestamp),e3(e)){let{type:i,id:r}=e.data,s=zi.mirror.getNode(r);s instanceof HTMLElement&&i===Cn.Click&&t.registerClick(s)}}catch{}}function Z4(t){return t.type===q4}function e3(t){return t.data.source===de.MouseInteraction}function _r(t){return g({timestamp:Date.now()/1e3,type:"default"},t)}var Lm=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(Lm||{}),t3=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function n3(t){let e={};!t["data-sentry-component"]&&t["data-sentry-element"]&&(t["data-sentry-component"]=t["data-sentry-element"]);for(let n in t)if(t3.has(n)){let i=n;(n==="data-testid"||n==="data-test-id")&&(i="testId"),e[i]=t[n]}return e}var i3=t=>e=>{if(!t.isEnabled())return;let n=r3(e);if(!n)return;let i=e.name==="click",r=i?e.event:void 0;i&&t.clickDetector&&(r!=null&&r.target)&&!r.altKey&&!r.metaKey&&!r.ctrlKey&&!r.shiftKey&&$4(t.clickDetector,n,Ix(e.event)),eu(t,n)};function wx(t,e){let n=zi.mirror.getId(t),i=n&&zi.mirror.getNode(n),r=i&&zi.mirror.getMeta(i),s=r&&o3(r)?r:null;return{message:e,data:s?{nodeId:n,node:{id:n,tagName:s.tagName,textContent:Array.from(s.childNodes).map(o=>o.type===Lm.Text&&o.textContent).filter(Boolean).map(o=>o.trim()).join(""),attributes:n3(s.attributes)}}:{}}}function r3(t){let{target:e,message:n}=s3(t);return _r(g({category:"ui.".concat(t.name)},wx(e,n)))}function s3(t){let e=t.name==="click",n,i=null;try{i=e?Ix(t.event):Cx(t.event),n=nt(i,{maxStringLength:200})||"<unknown>"}catch{n="<unknown>"}return{target:i,message:n}}function o3(t){return t.type===Lm.Element}function a3(t,e){if(!t.isEnabled())return;t.updateUserActivity();let n=l3(e);n&&eu(t,n)}function l3(t){let{metaKey:e,shiftKey:n,ctrlKey:i,altKey:r,key:s,target:o}=t;if(!o||c3(o)||!s)return null;let a=e||i||r,l=s.length===1;if(!a&&l)return null;let c=nt(o,{maxStringLength:200})||"<unknown>",u=wx(o,c);return _r({category:"ui.keyDown",message:c,data:D(g({},u.data),{metaKey:e,shiftKey:n,ctrlKey:i,altKey:r,key:s})})}function c3(t){return t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable}var u3={resource:h3,paint:m3,navigation:f3};function D_(t,e){return({metric:n})=>void e.replayPerformanceEntries.push(t(n))}
3function p3(t){return t.map(d3).filter(Boolean)}function d3(t){let e=u3[t.entryType];return e?e(t):null}function Ka(t){return((tt()||ut.performance.timeOrigin)+t)/1e3}function m3(t){let{duration:e,entryType:n,name:i,startTime:r}=t,s=Ka(r);return{type:n,name:i,start:s,end:s+e,data:void 0}}function f3(t){let{entryType:e,name:n,decodedBodySize:i,duration:r,domComplete:s,encodedBodySize:o,domContentLoadedEventStart:a,domContentLoadedEventEnd:l,domInteractive:c,loadEventStart:u,loadEventEnd:p,redirectCount:m,startTime:f,transferSize:h,type:_}=t;return r===0?null:{type:"".concat(e,".").concat(_),start:Ka(f),end:Ka(s),name:n,data:{size:h,decodedBodySize:i,encodedBodySize:o,duration:r,domInteractive:c,domContentLoadedEventStart:a,domContentLoadedEventEnd:l,loadEventStart:u,loadEventEnd:p,domComplete:s,redirectCount:m}}}function h3(t){let{entryType:e,initiatorType:n,name:i,responseEnd:r,startTime:s,decodedBodySize:o,encodedBodySize:a,responseStatus:l,transferSize:c}=t;return["fetch","xmlhttprequest"].includes(n)?null:{type:"".concat(e,".").concat(n),start:Ka(s),end:Ka(r),name:i,data:{size:c,statusCode:l,decodedBodySize:o,encodedBodySize:a}}}function g3(t){let e=t.entries[t.entries.length-1],n=e!=null&&e.element?[e.element]:void 0;return _y(t,"largest-contentful-paint",n)}function _3(t){return t.sources!==void 0}function y3(t){let e=[],n=[];for(let i of t.entries)if(_3(i)){let r=[];for(let s of i.sources)if(s.node){n.push(s.node);let o=zi.mirror.getId(s.node);o&&r.push(o)}e.push({value:i.value,nodeIds:r.length?r:void 0})}return _y(t,"cumulative-layout-shift",n,e)}function b3(t){let e=t.entries[t.entries.length-1],n=e!=null&&e.target?[e.target]:void 0;return _y(t,"interaction-to-next-paint",n)}function _y(t,e,n,i){let r=t.value,s=t.rating,o=Ka(r);return{type:"web-vital",name:e,start:o,end:o,data:{value:r,size:r,rating:s,nodeIds:n?n.map(a=>zi.mirror.getId(a)):void 0,attributions:i}}}function v3(t){function e(r){t.performanceEntries.includes(r)||t.performanceEntries.push(r)}function n({entries:r}){r.forEach(e)}let i=[];return["navigation","paint","resource"].forEach(r=>{i.push(xi(r,n))}),i.push(Wr(D_(g3,t)),Gr(D_(y3,t)),yo(D_(b3,t))),()=>{i.forEach(r=>r())}}var le=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,S3='
vendor: 10,329 bytes, line 3
3var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(t,e){for(var i=new n(31),s=0;s<31;++s)i[s]=e+=1<<t[s-1];var a=new r(i[30]);for(s=1;s<30;++s)for(var o=i[s];o<i[s+1];++o)a[o]=o-i[s]<<5|s;return{b:i,r:a}},o=a(e,2),h=o.b,f=o.r;h[28]=258,f[258]=28;for(var l=a(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,s=0,a=new n(r);s<i;++s)t[s]&&++a[t[s]-1];var o,h=new n(r);for(s=1;s<r;++s)h[s]=h[s-1]+a[s-1]<<1;if(e){o=new n(1<<r);var f=15-r;for(s=0;s<i;++s)if(t[s])for(var l=s<<4|t[s],c=r-t[s],v=h[t[s]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>f]=l}else for(o=new n(i),s=0;s<i;++s)t[s]&&(o[s]=u[h[t[s]-1]++]>>15-t[s]);return o},p=new t(288);for(c=0;c<144;++c)p[c]=8;for(c=144;c<256;++c)p[c]=9;for(c=256;c<280;++c)p[c]=7;for(c=280;c<288;++c)p[c]=8;var g=new t(32);for(c=0;c<32;++c)g[c]=5;var w=d(p,9,0),y=d(g,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],s=0;s<r.length;++s)r[s]&&i.push({s:s,f:r[s]});var a=i.length,o=i.slice();if(!a)return{t:F,l:0};if(1==a){var h=new t(i[0].s+1);return h[i[0].s]=1,{t:h,l:1}}i.sort(function(t,n){return t.f-n.f}),i.push({s:-1,f:25001});var f=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:f.f+l.f,l:f,r:l};c!=a-1;)f=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:f.f+l.f,l:f,r:l};var d=o[0].s;for(s=1;s<a;++s)o[s].s>d&&(d=o[s].s);var p=new n(d+1),g=A(i[c-1],p,0);if(g>e){s=0;var w=0,y=g-e,m=1<<y;for(o.sort(function(t,n){return p[n.s]-p[t.s]||t.f-n.f});s<a;++s){var b=o[s].s;if(!(p[b]>e))break;w+=m-(1<<g-p[b]),p[b]=e}for(w>>=y;w>0;){var M=o[s].s;p[M]<e?w-=1<<e-p[M]++-1:++s}for(;s>=0&&w;--s){var E=o[s].s;p[E]==e&&(--p[E],++w)}g=e}return{t:new t(p),l:g}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,s=t[0],a=1,o=function(t){e[i++]=t},h=1;h<=r;++h)if(t[h]==s&&h!=r)++a;else{if(!s&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(s),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(s);a=1,s=t[h]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;s<e;++s)t[i+s+4]=r[s];return 8*(i+4+e)},U=function(t,r,a,o,h,f,l,u,c,v,m){z(r,m++,a),++h[256];for(var b=x(h,15),M=b.t,E=b.l,A=x(f,15),U=A.t,C=A.l,F=D(M),I=F.c,S=F.n,L=D(U),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=x(q,7),H=G.t,J=G.l,K=19;K>4&&!H[s[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(h,p)+T(f,g)+l,X=T(h,M)+T(f,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(U,C,0),R=U;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[s[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=w,P=p,Q=y,R=g;for(B=0;B<u;++B){var rt=o[B];if(rt>255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,s=0|r.length,a=0;a!=s;){for(var o=Math.min(a+2655,s);a<o;++a)i+=e+=r[a];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},L=function(s,a,o,h,u){if(!u&&(u={l:1},a.dictionary)){var c=a.dictionary.subarray(-32768),v=new t(c.length+s.length);v.set(c),v.set(s,c.length),s=v,u.w=c.length}return function(s,a,o,h,u,c){var v=c.z||s.length,d=new t(h+v+5*(1+Math.ceil(v/7e3))+u),p=d.subarray(h,d.length-u),g=c.l,w=7&(c.r||0);if(a){w&&(p[0]=c.r>>3);for(var y=C[a-1],M=y>>13,E=8191&y,z=(1<<o)-1,_=c.p||new n(32768),x=c.h||new n(z+1),A=Math.ceil(o/3),D=2*A,T=function(t){return(s[t]^s[t+1]<<A^s[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=x[H];if(_[J]=K,x[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!g)){w=U(s,p,0,F,I,S,O,q,G,j-G,w),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(s[j+Q]==s[j+Q-W]){for(var $=0;$<Z&&s[j+$]==s[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-_[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|f[Q]<<18|l[R];var it=31&f[Q],st=31&l[R];O+=e[it]+i[st],++I[257+it],++S[st],B=j+Q,++L}else F[q++]=s[j],++I[s[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=s[j],++I[s[j]];w=U(s,p,g,F,I,S,O,q,G,j-G,w),g||(c.r=7&w|p[w/8|0]<<3,w-=7,c.h=x,c.p=_,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+g;j+=65535){var at=j+65535;at>=v&&(p[w/8|0]=g,at=v),w=k(p,w+1,s.subarray(j,at))}c.i=v}return b(d,0,h+m(w)+u)}(s,null==a.level?6:a.level,null==a.mem?u.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):20:12+a.mem,o,h,u)},O=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},j=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(L(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var s=this.b.length-this.s.z;this.b.set(n.subarray(0,s),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(s),32768),this.s.z=n.length-s+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n.prototype.flush=function(){this.ondata||E(5),this.s.l&&E(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},n}();function q(t,n){n||(n={});var r=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}}(),e=t.length;r.p(t);var i,s=L(t,n,10+((i=n).filename?i.filename.length+1:0),8),a=s.length;return function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&O(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}}(s,n),O(s,a-8,r.d()),O(s,a-4,e),s}var B=function(){function t(t,n){this.c=S(),this.v=1,j.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),j.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=L(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=S();i.p(n.dictionary),O(t,2,i.d())}}(r,this.o),this.v=0),n&&O(r,r.length-4,this.c.d()),this.ondata(r,n)},t.prototype.flush=function(){j.prototype.flush.call(this)},t}(),G="undefined"!=typeof TextEncoder&&new TextEncoder,H="undefined"!=typeof TextDecoder&&new TextDecoder;try{H.decode(F,{stream:!0})}catch(t){}var J=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(K(t),this.d=n||!1)},t}();function K(n,r){if(G)return G.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),s=0,a=function(t){i[s++]=t},o=0;o<e;++o){if(s+5>i.length){var h=new t(s+8+(e-o<<1));h.set(i),i=h}var f=n.charCodeAt(o);f<128||r?a(f):f<2048?(a(192|f>>6),a(128|63&f)):f>55295&&f<57344?(a(240|(f=65536+(1047552&f)|1023&n.charCodeAt(++o))>>18),a(128|f>>12&63),a(128|f>>6&63),a(128|63&f)):(a(224|f>>12),a(128|f>>6&63),a(128|63&f))}return b(i,0,s)}const N=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new B,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new J((t,n)=>{this.deflate.push(t,n)}),this.stream.push("[")}},P={clear:()=>{N.clear()},addEvent:t=>N.addEvent(t),finish:()=>N.finish(),compress:t=>function(t){return q(K(t))}(t)};addEventListener("message",function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in P&&"function"==typeof P[n])try{const t=P[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}}),postMessage({id:void 0,method:"init",success:!0,response:void 0});
3';function E3(){let t=new Blob([S3],{type:"text/javascript"});return URL.createObjectURL(t)}var V1=["log","warn","error"],_m="[Replay] ";function L_(t,e="info"){ii({category:"console",data:{logger:"replay"},level:e,message:"".concat(_m).concat(t)},{level:e})}function T3(){let t=!1,e=!1,n={exception:()=>{},infoTick:()=>{},setConfig:i=>{t=!!i.captureExceptions,e=!!i.traceInternals}};return le?(V1.forEach(i=>{n[i]=(...r)=>{C[i](_m,...r),e&&L_(r.join(""),Hr(i))}}),n.exception=(i,...r)=>{r.length&&n.error&&n.error(...r),C.error(_m,i),t?Wi(i,{mechanism:{handled:!0,type:"auto.function.replay.debug"}}):e&&L_(i,"error")},n.infoTick=(...i)=>{C.log(_m,...i),e&&setTimeout(()=>L_(i[0]),0)}):V1.forEach(i=>{n[i]=()=>{}}),n}var ce=T3(),Qc=class extends Error{constructor(){super("Event buffer exceeded maximum size of ".concat(uy,"."))}},wm=class{constructor(){this.events=[],this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return this.events.length>0}get type(){return"sync"}destroy(){this.events=[]}addEvent(e){return k(this,null,function*(){let n=JSON.stringify(e).length;if(this._totalSize+=n,this._totalSize>uy)throw new Qc;this.events.push(e)})}finish(){return new Promise(e=>{let n=this.events;this.clear(),e(JSON.stringify(n))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){let e=null;for(let{timestamp:n}of this.events)(e===null||n<e)&&(e=n);return e===null?e:gy(e)}},ey=class{constructor(e){this._onMessage=({data:n})=>{let i=n;if(typeof i.id!="number")return;let r=this._pending.get(i.id);if(!(!r||r.method!==i.method)){if(this._pending.delete(i.id),!i.success){le&&ce.error("Error in compression worker: ",i.response),r.reject(new Error("Error in compression worker"));return}r.resolve(i.response)}},this._worker=e,this._id=0,this._pending=new Map,this._worker.addEventListener("message",this._onMessage)}ensureReady(){return this._ensureReadyPromise?this._ensureReadyPromise:(this._ensureReadyPromise=new Promise((e,n)=>{this._worker.addEventListener("message",({data:i})=>{i.success?e():(le&&ce.warn("Received worker message with unsuccessful status",i),n(new Error("Received worker message with unsuccessful status")))},{once:!0}),this._worker.addEventListener("error",i=>{le&&ce.warn("Failed to load Replay compression worker",i),n(new Error("Failed to load Replay compression worker: ".concat(i instanceof ErrorEvent&&i.message?i.message:"Unknown error. This can happen due to CSP policy restrictions, network issues, or the worker script failing to load.")))},{once:!0})}),this._ensureReadyPromise)}destroy(){le&&ce.log("Destroying compression worker"),this._worker.removeEventListener("message",this._onMessage),this._pending.forEach(e=>e.reject(new Error("Worker destroyed"))),this._pending.clear(),this._worker.terminate()}postMessage(e,n){let i=this._getAndIncrementId();return new Promise((r,s)=>{this._pending.set(i,{method:e,resolve:r,reject:s});try{this._worker.postMessage({id:i,method:e,arg:n})}catch(o){this._pending.delete(i),s(o)}})}_getAndIncrementId(){return this._id++}},ty=class{constructor(e){this._worker=new ey(e),this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return!!this._earliestTimestamp}get type(){return"worker"}ensureReady(){return this._worker.ensureReady()}destroy(){this._worker.destroy()}addEvent(e){let n=gy(e.timestamp);(!this._earliestTimestamp||n<this._earliestTimestamp)&&(this._earliestTimestamp=n);let i=JSON.stringify(e);return this._totalSize+=i.length,this._totalSize>uy?Promise.reject(new Qc):this._sendEventToWorker(i)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,e=>{le&&ce.exception(e,'Sending "clear" message to worker failed',e)})}getEarliestTimestamp(){return this._earliestTimestamp}_sendEventToWorker(e){return this._worker.postMessage("addEvent",e)}_finishRequest(){return k(this,null,function*(){let e=yield this._worker.postMessage("finish");return this._earliestTimestamp=null,this._totalSize=0,e})}},ny=class{constructor(e){this._fallback=new wm,this._compression=new ty(e),this._used=this._fallback,this._ensureWorkerIsLoadedProm
3ise=this._ensureWorkerIsLoaded()}get waitForCheckout(){return this._used.waitForCheckout}get type(){return this._used.type}get hasEvents(){return this._used.hasEvents}get hasCheckout(){return this._used.hasCheckout}set hasCheckout(e){this._used.hasCheckout=e}set waitForCheckout(e){this._used.waitForCheckout=e}destroy(){this._fallback.destroy(),this._compression.destroy()}clear(){return this._used.clear()}getEarliestTimestamp(){return this._used.getEarliestTimestamp()}addEvent(e){return this._used.addEvent(e)}finish(){return k(this,null,function*(){return yield this.ensureWorkerIsLoaded(),this._used.finish()})}ensureWorkerIsLoaded(){return this._ensureWorkerIsLoadedPromise}_ensureWorkerIsLoaded(){return k(this,null,function*(){try{yield this._compression.ensureReady()}catch(e){le&&ce.exception(e,"Failed to load the compression worker, falling back to simple buffer");return}yield this._switchToCompressionWorker()})}_switchToCompressionWorker(){return k(this,null,function*(){let{events:e,hasCheckout:n,waitForCheckout:i}=this._fallback,r=[];for(let s of e)r.push(this._compression.addEvent(s));this._compression.hasCheckout=n,this._compression.waitForCheckout=i,this._used=this._compression;try{yield Promise.all(r),this._fallback.clear()}catch(s){le&&ce.exception(s,"Failed to add events when switching buffers.")}})}};function I3({useCompression:t,workerUrl:e}){if(t&&window.Worker){let n=C3(e);if(n)return n}return le&&ce.log("Using simple buffer"),new wm}function C3(t){try{let e=t||w3();if(!e)return;le&&ce.log("Using compression worker".concat(t?" from ".concat(t):""));let n=new Worker(e);return new ny(n)}catch(e){le&&ce.exception(e,"Failed to create compression worker")}}function w3(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?E3():""}function yy(){try{return"sessionStorage"in ut&&!!ut.sessionStorage}catch{return!1}}function x3(t){A3(),t.session=void 0}function A3(){if(yy())try{ut.sessionStorage.removeItem(ly)}catch{}}function xx(t){return t===void 0?!1:Math.random()<t}function Fm(t){if(yy())try{ut.sessionStorage.setItem(ly,JSON.stringify(t))}catch{}}function Ax(t){let e=Date.now(),n=t.id||It(),i=t.started||e,r=t.lastActivity||e,s=t.segmentId||0,o=t.sampled,a=t.previousSessionId,l=t.dirty||!1;return{id:n,started:i,lastActivity:r,segmentId:s,sampled:o,previousSessionId:a,dirty:l}}function k3(t,e){return xx(t)?"session":e?"buffer":!1}function z1({sessionSampleRate:t,allowBuffering:e,stickySession:n=!1},{previousSessionId:i}={}){let r=k3(t,e),s=Ax({sampled:r,previousSessionId:i});return n&&Fm(s),s}function R3(){if(!yy())return null;try{let t=ut.sessionStorage.getItem(ly);if(!t)return null;let e=JSON.parse(t);return le&&ce.infoTick("Loading existing session"),Ax(e)}catch{return null}}function iy(t,e,n=+new Date){return t===null||e===void 0||e<0?!0:e===0?!1:t+e<=n}function O3(t,{maxReplayDuration:e,sessionIdleExpire:n,targetTime:i=Date.now()}){return iy(t.started,e,i)||iy(t.lastActivity,n,i)}function xm(t,{sessionIdleExpire:e,maxReplayDuration:n}){return!(!O3(t,{sessionIdleExpire:e,maxReplayDuration:n})||t.sampled==="buffer"&&t.segmentId===0)}function F_({sessionIdleExpire:t,maxReplayDuration:e,previousSessionId:n},i){let r=i.stickySession&&R3();return r?xm(r,{sessionIdleExpire:t,maxReplayDuration:e})?(le&&ce.infoTick("Session in sessionStorage is expired, creating new one..."),z1(i,{previousSessionId:r.id})):r:(le&&ce.infoTick("Creating new session"),z1(i,{previousSessionId:n}))}function N3(t){return t.type===xe.Custom}function by(t,e,n){return Rx(t,e)?(kx(t,e,n),!0):!1}function M3(t,e,n){return Rx(t,e)?kx(t,e,n):Promise.resolve(null)}function kx(t,e,n){return k(this,null,function*(){let{eventBuffer:i}=t;if(!i||i.waitForCheckout&&!n)return null;let r=t.recordingMode==="buffer";try{n&&r&&i.clear(),n&&(i.hasCheckout=!0,i.waitForCheckout=!1);let s=t.getOptions(),o=P3(e,s.beforeAddRecordingEvent);return o?yield i.addEvent(o):void 0}catch(s){if(!t.isEnabled())return t.handleException(s),null;let o=s&&s instanceof Qc,a=o?"eventBufferOverflow":"eventBufferError",l=G();if(l){let c=o?"buffer_overflow":"internal_sdk_error";l.recordDroppedEvent(c,"replay")}if(o&&r)return i.clear(),i.waitForCheckout=!0,null;t.handleException(s),yield t.stop({reason:a})}})}function Rx(t,e){if(!t.eventBuffer||t.isPaused()||!t.isEnabled())return!1;let n=gy(e.timestamp);return n+t.timeouts.sessionIdlePause<Date.now()?!1:n>t.getContext().initialTimestamp+t.getOptions().maxReplayDuration?(le&&ce.infoTick("Skipping event with timestamp ".concat(n," because it is after maxReplayDuration")),!1):!0}function P3(t,e){try{if(typeof e=="function"&&N3(t))return e(t)}catch(n){return le&&ce.exception(n,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return t}var Y1=100;function Ox(t,e,n){let i=t.getContext();e&&i.traceIds.size<Y1&&i.traceIds.add(e),n&&i.segmentNames.size<Y1&&i.segmentNames.add(n)}function D3(t){return e=>{t.isEnabled()&&Ox(t,e.trace_id,e.name||void 0)}}function vy(t){return!t.type}function ry(t){return t.type==="transaction"}function L3(t){return t.type==="replay_event"}function $1(t){return t.type==="feedback"}function F3(t){return(e,n)=>{if(!t.isEnabled()||!vy(e)&&!ry(e))return;let i=n.statusCode;if(!(!i||i<200||i>=300)){if(ry(e)){U3(t,e);return}B3(t,e)}}}function U3(t,e){var n,i;Ox(t,(i=(n=e.contexts)==null?void 0:n.trace)==null?void 0:i.trace_id,e.transaction)}function B3(t,e){var r;let n=t.getContext();if(e.event_id&&n.errorIds.size<100&&n.errorIds.add(e.event_id),t.recordingMode!=="buffer"||!((r=e.tags)!=null&&r.replayId))return;let{beforeErrorSampling:i}=t.getOptions();typeof i=="function"&&!i(e)||To(()=>k(null,null,function*(){try{yield t.sendBufferedReplayOrFlush()}catch(s){t.handleException(s)}}))}function H3(t){return e=>{!t.isEnabled()||!vy(e)||q3(t,e)}}function q3(t,e){var i,r,s;let n=(s=(r=(i=e.exception)==null?void 0:i.values)==null?void 0:r[0])==null?void 0:s.value;if(typeof n=="string"&&(n.match(/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/)||n.match(/(does not match server-rendered HTML|Hydration failed because)/i))){let o=_r({category:"replay.hydrate-error",data:{url:In()}});eu(t,o)}}function j3(t){let e=G();e&&e.on("beforeAddBreadcrumb",n=>G3(t,n))}function G3(t,e){if(!t.isEnabled()||!Nx(e))return;let n=W3(e);n&&eu(t,n)}function W3(t){return!Nx(t)||["fetch","xhr","sentry.event","sentry.transaction"].includes(t.category)||t.category.startsWith("ui.")?null:t.category==="console"?V3(t):_r(t)}function V3(t){var r;let e=(r=t.data)==null?void 0:r.arguments;if(!Array.isArray(e)||e.length===0)return _r(t);let n=!1,i=e.map(s=>{if(!s)return s;if(typeof s=="string")return s.length>fm?(n=!0,"".concat(s.slice(0,fm),"\u2026")):s;if(typeof s=="object")try{let o=dn(s,7);return JSON.stringify(o).length>fm?(n=!0,"".concat(JSON.stringify(o,null,2).slice(0,fm),"\u2026")):o}catch{}return s});return _r(D(g({},t),{data:g(D(g({},t.data),{arguments:i}),n?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{})}))}function Nx(t){return!!t.category}function z3(t,e){var n,i,r;return t.type||!((i=(n=t.exception)==null?void 0:n.values)!=null&&i.length)?!1:!!((r=e.originalException)!=null&&r.__rrweb__)}function Am(){let t=te().getPropagationContext().dsc;t&&delete t.replay_id;let e=Ge();if(e){let n=sn(e);delete n.replay_id}}function K1(t){let e=te().getPropagationContext().dsc;e&&(e.replay_id=t);let n=Ge();if(n){let i=sn(n);i.replay_id=t}}function Y3(t,e){t.triggerUserActivity(),t.addUpdate(()=>e.timestamp?(t.throttledAddEvent({type:xe.Custom,timestamp:e.timestamp*1e3,data:{tag:"breadcrumb",payload:{timestamp:e.timestamp,type:"default",category:"sentry.feedback",data:{feedbackId:e.event_id}}}}),!1):!0)}function $3(t,e){return t.recordingMode!=="buffer"||e.message===cy||!e.exception||e.type?!1:xx(t.getOptions().errorSampleRate)}function K3(t){return Object.assign((e,n)=>{var o;if(t.session&&xm(t.session,{maxReplayDuration:t.getOptions().maxReplayDuration,sessionIdleExpire:t.timeouts.sessionIdleExpire})&&Am(),!t.isEnabled()||t.isPaused())return e;if(L3(e))return delete e.breadcrumbs,e;if(!vy(e)&&!ry(e)&&!$1(e))return e;if(!t.checkAndHandleExpiredSession())return Am(),e;if($1(e))return t.flush(),e.contexts.feedback.replay_id=t.getSessionId(),Y3(t,e),e;if(z3(e,n)&&!t.getOptions()._experiments.captureExceptions)return le&&ce.log("Ignoring error from rrweb internals",e),null;let r=$3(t,e);if((r||t.recordingMode==="session")&&(e.tags=D(g({},e.tags),{replayId:t.getSessionId()})),r&&t.recordingMode==="buffer"&&((o=t.session)==null?void 0:o.sampled)==="buffer"){let a=t.session;a.dirty=!0,t.getOptions().stickySession&&Fm(a)}return e},{id:"Replay"})}function Um(t,e){return e.map(({type:n,start:i,end:r,name:s,data:o})=>{let a=t.throttledAddEvent({type:xe.Custom,timestamp:i,data:{tag:"performanceSpan",payload:{op:n,description:s,startTimestamp:i,endTimestamp:r,data:o}}});
3return typeof a=="string"?Promise.resolve(null):a})}function Q3(t){let{from:e,to:n}=t,i=Date.now()/1e3;return{type:"navigation.push",start:i,end:i,name:n,data:{previous:e}}}function X3(t){return e=>{if(!t.isEnabled())return;let n=Q3(e);n!==null&&(t.getContext().urls.push(n.name),t.triggerUserActivity(),t.addUpdate(()=>(Um(t,[n]),!1)))}}function J3(t,e){return le&&t.getOptions()._experiments.traceInternals?!1:Ca(e,G())}function Mx(t,e){t.isEnabled()&&e!==null&&(J3(t,e.name)||t.addUpdate(()=>(Um(t,[e]),!0)))}function Bm(t){if(!t)return;let e=new TextEncoder;try{if(typeof t=="string")return e.encode(t).length;if(t instanceof URLSearchParams)return e.encode(t.toString()).length;if(t instanceof FormData){let n=cm(t);return e.encode(n).length}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength}catch{}}function Px(t){if(!t)return;let e=parseInt(t,10);return isNaN(e)?void 0:e}function km(t,e){if(!t)return{headers:{},size:void 0,_meta:{warnings:[e]}};let n=g({},t._meta),i=n.warnings||[];return n.warnings=[...i,e],t._meta=n,t}function Dx(t,e){if(!e)return null;let{startTimestamp:n,endTimestamp:i,url:r,method:s,statusCode:o,request:a,response:l}=e;return{type:t,start:n/1e3,end:i/1e3,name:r,data:{method:s,statusCode:o,request:a,response:l}}}function Xc(t){return{headers:{},size:t,_meta:{warnings:["URL_SKIPPED"]}}}function Ts(t,e,n){if(!e&&Object.keys(t).length===0)return;if(!e)return{headers:t};if(!n)return{headers:t,size:e};let i={headers:t,size:e},{body:r,warnings:s}=Z3(n);return i.body=r,s!=null&&s.length&&(i._meta={warnings:s}),i}function sy(t,e){return Object.entries(t).reduce((n,[i,r])=>{let s=i.toLowerCase();return e.includes(s)&&t[i]&&(n[s]=r),n},{})}function Z3(t){if(!t||typeof t!="string")return{body:t};let e=t.length>A1,n=eB(t);if(e){let i=t.slice(0,A1);return n?{body:i,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:"".concat(i,"\u2026"),warnings:["TEXT_TRUNCATED"]}}if(n)try{return{body:JSON.parse(t)}}catch{}return{body:t}}function eB(t){let e=t[0],n=t[t.length-1];return e==="["&&n==="]"||e==="{"&&n==="}"}function Rm(t,e){let n=tB(t);return rn(n,e)}function tB(t,e=ut.document.baseURI){if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith(ut.location.origin))return t;let n=new URL(t,e);if(n.origin!==new URL(e).origin)return t;let i=n.href;return!t.endsWith("/")&&i.endsWith("/")?i.slice(0,-1):i}function nB(t,e,n){return k(this,null,function*(){try{let i=yield rB(t,e,n),r=Dx("resource.fetch",i);Mx(n.replay,r)}catch(i){le&&ce.exception(i,"Failed to capture fetch breadcrumb")}})}
3function iB(t,e){let{input:n,response:i}=e,r=n?pm(n):void 0,s=Bm(r),o=i?Px(i.headers.get("content-length")):void 0;s!==void 0&&(t.data.request_body_size=s),o!==void 0&&(t.data.response_body_size=o)}function rB(t,e,n){return k(this,null,function*(){let i=Date.now(),{startTimestamp:r=i,endTimestamp:s=i}=e,{url:o,method:a,status_code:l=0,request_body_size:c,response_body_size:u}=t.data,p=Rm(o,n.networkDetailAllowUrls)&&!Rm(o,n.networkDetailDenyUrls),m=p?sB(n,e.input,c):Xc(c),f=yield oB(p,n,e.response,u);return{startTimestamp:r,endTimestamp:s,url:o,method:a,statusCode:l,request:m,response:f}})}function sB({networkCaptureBodies:t,networkRequestHeaders:e},n,i){let r=n?cB(n,e):{};if(!t)return Ts(r,i,void 0);let s=pm(n),[o,a]=um(s,ce),l=Ts(r,i,o);return a?km(l,a):l}function oB(s,o,a,l){return k(this,arguments,function*(t,{networkCaptureBodies:e,networkResponseHeaders:n},i,r){if(!t&&r!==void 0)return Xc(r);let c=i?Lx(i.headers,n):{};if(!i||!e&&r!==void 0)return Ts(c,r,void 0);let[u,p]=yield lB(i),m=aB(u,{networkCaptureBodies:e,responseBodySize:r,captureDetails:t,headers:c});return p?km(m,p):m})}function aB(t,{networkCaptureBodies:e,responseBodySize:n,captureDetails:i,headers:r}){try{let s=t!=null&&t.length&&n===void 0?Bm(t):n;return i?e?Ts(r,s,t):Ts(r,s,void 0):Xc(s)}catch(s){return le&&ce.exception(s,"Failed to serialize response body"),Ts(r,n,void 0)}}function lB(t){return k(this,null,function*(){let e=uB(t);if(!e)return[void 0,"BODY_PARSE_ERROR"];try{return[yield pB(e)]}catch(n){return n instanceof Error&&n.message.indexOf("Timeout")>-1?(le&&ce.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(le&&ce.exception(n,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}})}function Lx(t,e){let n={};return e.forEach(i=>{t.get(i)&&(n[i]=t.get(i))}),n}function cB(t,e){return t.length===1&&typeof t[0]!="string"?Q1(t[0],e):t.length===2?Q1(t[1],e):{}}function Q1(t,e){if(!t)return{};let n=t.headers;return n?n instanceof Headers?Lx(n,e):Array.isArray(n)?{}:sy(n,e):{}}function uB(t){try{return t.clone()}catch(e){le&&ce.exception(e,"Failed to clone response body")}}function pB(t){return new Promise((e,n)=>{let i=To(()=>n(new Error("Timeout while trying to read response body")),500);dB(t).then(r=>e(r),r=>n(r)).finally(()=>clearTimeout(i))})}function dB(t){return k(this,null,function*(){return yield t.text()})}function mB(t,e,n){return k(this,null,function*(){try{let i=hB(t,e,n),r=Dx("resource.xhr",i);Mx(n.replay,r)}catch(i){le&&ce.exception(i,"Failed to capture xhr breadcrumb")}})}function fB(t,e){let{xhr:n,input:i}=e;if(!n)return;let r=Bm(i),s=n.getResponseHeader("content-length")?Px(n.getResponseHeader("content-length")):yB(n.response,n.responseType);r!==void 0&&(t.data.request_body_size=r),s!==void 0&&(t.data.response_body_size=s)}function hB(t,e,n){let i=Date.now(),{startTimestamp:r=i,endTimestamp:s=i,input:o,xhr:a}=e,{url:l,method:c,status_code:u=0,request_body_size:p,response_body_size:m}=t.data;if(!l)return null;if(!a||!Rm(l,n.networkDetailAllowUrls)||Rm(l,n.networkDetailDenyUrls)){let V=Xc(p),A=Xc(m);return{startTimestamp:r,endTimestamp:s,url:l,method:c,statusCode:u,request:V,response:A}}let f=a[ri],h=f?sy(f.request_headers,n.networkRequestHeaders):{},_=sy(Nc(a),n.networkResponseHeaders),[v,I]=n.networkCaptureBodies?um(o,ce):[void 0],[N,j]=n.networkCaptureBodies?gB(a):[void 0],P=Ts(h,p,v),X=Ts(_,m,N);return{startTimestamp:r,endTimestamp:s,url:l,method:c,statusCode:u,request:I?km(P,I):P,response:j?km(X,j):X}}function gB(t){let e=[];try{return[t.responseText]}catch(n){e.push(n)}try{return _B(t.response,t.responseType)}catch(n){e.push(n)}return le&&ce.warn("Failed to get xhr response body",...e),[void 0]}function _B(t,e){try{if(typeof t=="string")return[t];if(t instanceof Document)return[t.body.outerHTML];if(e==="json"&&Jn(t))return[JSON.stringify(t)];if(!t)return[void 0]}catch(n){return le&&ce.exception(n,"Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return le&&ce.log("Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function yB(t,e){try{let n=e==="json"&&Jn(t)?JSON.stringify(t):t;return Bm(n)}catch{return}}function bB(t){let e=G();try{let{networkDetailAllowUrls:n,networkDetailDenyUrls:i,networkCaptureBodies:r,networkRequestHeaders:s,networkResponseHeaders:o}=t.getOptions(),a={replay:t,networkDetailAllowUrls:n,networkDetailDenyUrls:i,networkCaptureBodies:r,networkRequestHeaders:s,networkResponseHeaders:o};e&&e.on("beforeAddBreadcrumb",(l,c)=>vB(a,l,c))}catch{}}function vB(t,e,n){if(e.data)try{SB(e)&&TB(n)&&(fB(e,n),mB(e,n,t)),EB(e)&&IB(n)&&(iB(e,n
3),nB(e,n,t))}catch(i){le&&ce.exception(i,"Error when enriching network breadcrumb")}}function SB(t){return t.category==="xhr"}function EB(t){return t.category==="fetch"}function TB(t){return t==null?void 0:t.xhr}function IB(t){return(t==null?void 0:t.input)!==void 0}function CB(t){let e=G();Oc(i3(t)),zr(X3(t)),j3(t),bB(t);let n=K3(t);yc(n),e&&(e.on("beforeSendEvent",H3(t)),e.on("afterSendEvent",F3(t)),e.on("createDsc",i=>{let r=t.getSessionId();r&&t.isEnabled()&&t.recordingMode==="session"&&t.checkAndHandleExpiredSession()&&(i.replay_id=r)}),e.on("processSegmentSpan",D3(t)),e.on("spanStart",i=>{t.lastActiveSpan=i}),e.on("spanEnd",i=>{t.lastActiveSpan=i}),e.on("beforeSendFeedback",(i,r)=>k(null,null,function*(){var o;let s=t.getSessionId();r!=null&&r.includeReplay&&t.isEnabled()&&s&&((o=i.contexts)!=null&&o.feedback)&&(i.contexts.feedback.source==="api"&&(yield t.sendBufferedReplayOrFlush()),i.contexts.feedback.replay_id=s)})),e.on("openFeedbackWidget",()=>k(null,null,function*(){yield t.sendBufferedReplayOrFlush()})))}function wB(t){return k(this,null,function*(){try{return Promise.all(Um(t,[xB(ut.performance.memory)]))}catch{return[]}})}function xB(t){let{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:i}=t,r=Date.now()/1e3;return{type:"memory",name:"memory",start:r,end:r,data:{memory:{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:i}}}}function AB(t,e,n){return Rg(t,e,D(g({},n),{setTimeoutImpl:To}))}var ki=z.navigator;function kB(){var t,e;return/iPhone|iPad|iPod/i.test((t=ki==null?void 0:ki.userAgent)!=null?t:"")||/Macintosh/i.test((e=ki==null?void 0:ki.userAgent)!=null?e:"")&&(ki!=null&&ki.maxTouchPoints)&&(ki==null?void 0:ki.maxTouchPoints)>1?{sampling:{mousemove:!1}}:{}}function RB(t){let e=!1;return(n,i)=>{try{if(!t.checkAndHandleExpiredSession()){le&&ce.warn("Received replay event after session expired.");return}let r=i||!e;e=!0,OB(n),t.clickDetector&&J4(t.clickDetector,n),t.addUpdate(()=>{if(t.recordingMode==="buffer"&&r&&t.setInitialState(),!by(t,n,r))return!0;if(!r)return!1;let s=t.session;if(MB(t,r),t.recordingMode==="buffer"&&s&&t.eventBuffer&&!s.dirty){let o=t.eventBuffer.getEarliestTimestamp();o&&(le&&ce.log("Updating session start time to earliest event in buffer to ".concat(new Date(o))),s.started=o,t.getOptions().stickySession&&Fm(s))}return s!=null&&s.previousSessionId||t.recordingMode==="session"&&t.flush(),!0})}catch(r){t.handleException(r)}}}function OB(t){let e=t.data;if(!(t.type!==xe.IncrementalSnapshot||!e||typeof e!="object"||!("source"in e)||e.source!==de.Mutation||!("attributes"in e)||!Array.isArray(e.attributes)))for(let n of e.attributes){let i=zi.mirror.getNode(n.id),r=i&&zi.mirror.getMeta(i);if((r==null?void 0:r.type)===Lm.Element)for(let[s,o]of Object.entries(n.attributes))o===null?delete r.attributes[s]:r.attributes[s]=o}}function NB(t){let e=t.getOptions();return{type:xe.Custom,timestamp:Date.now(),data:{tag:"options",payload:{shouldRecordCanvas:t.isRecordingCanvas(),sessionSampleRate:e.sessionSampleRate,errorSampleRate:e.errorSampleRate,useCompressionOption:e.useCompression,blockAllMedia:e.blockAllMedia,maskAllText:e.maskAllText,maskAllInputs:e.maskAllInputs,useCompression:t.eventBuffer?t.eventBuffer.type==="worker":!1,networkDetailHasUrls:e.networkDetailAllowUrls.length>0,networkCaptureBodies:e.networkCaptureBodies,networkRequestHasHeaders:e.networkRequestHeaders.length>0,networkResponseHasHeaders:e.networkResponseHeaders.length>0}}}}function MB(t,e){var n;!e||((n=t.session)==null?void 0:n.segmentId)!==0||by(t,NB(t),!1)}function PB(t){if(!t)return null;try{return t.nodeType===t.ELEMENT_NODE?t:t.parentElement}catch{return null}}function DB(t,e,n,i){return Tn(cc(t,_a(t),i,n),[[{type:"replay_event"},t],[{type:"replay_recording",length:typeof e=="string"?new TextEncoder().encode(e).length:e.length},e]])}function LB({recordingData:t,headers:e}){let n,i="".concat(JSON.stringify(e),"\n");if(typeof t=="string")n="".concat(i).concat(t);else{let s=new TextEncoder().encode(i);n=new Uint8Array(s.length+t.length),n.set(s),n.set(t,s.length)}return n}function FB(r){return k(this,arguments,function*({client:t,scope:e,replayId:n,event:i}){let s=typeof t._integrations=="object"&&t._integrations!==null&&!Array.isArray(t._integrations)?Object.keys(t._integrations):void 0,o={event_id:n,integrations:s};t.emit("preprocessEvent",i,o);let a=yield hc(t.getOptions(),i,o,e,t,st());if(!a)return null;t.emit("postprocessEvent",a,o),a.platform=a.platform||"javascript";let l=t.getSdkMetadata(),{name:c,version:u,settings:p}=(l==null?void 0:l.sdk)||{};return a.sdk=D(g({},a.sdk),{name:c||"sentry.javascript.unknown",version:u||"0.0.0",settings:p}),a})}function UB(o){return k(this,arguments,function*({recordingData:t,replayId:e,segmentId:n,eventContext:i,timestamp:r,session:s}){let a=LB({recordingData:t,headers:{segment_id:n}}),{urls:l,errorIds:c,traceIds:u,segmentNames:p,initialTimestamp:m}=i,f=G(),h=te(),_=f==null?void 0:f.getTransport(),v=f==null?void 0:f.getDsn();if(!f||!_||!v||!s.sampled)return Promise.resolve({});
3let I={type:IU,replay_start_timestamp:m/1e3,timestamp:r/1e3,error_ids:c,trace_ids:u,segment_names:p,urls:l,replay_id:e,segment_id:n,replay_type:s.sampled},N=yield FB({scope:h,client:f,replayId:e,event:I});if(!N)return f.recordDroppedEvent("event_processor","replay"),le&&ce.log("An event processor returned `null`, will not send event."),Promise.resolve({});delete N.sdkProcessingMetadata;let j=DB(N,a,v,f.getOptions().tunnel),P;try{P=yield _.send(j)}catch(V){let A=new Error(cy);try{A.cause=V}catch{}throw A}let X=Sc({},P);if(vc(X,"replay"))throw new Jc(X);if(typeof P.statusCode=="number"&&(P.statusCode<200||P.statusCode>=300))throw new Om(P.statusCode);return P})}var Om=class extends Error{constructor(e){super("Transport returned status code ".concat(e))}},Jc=class extends Error{constructor(e){super("Rate limit hit"),this.rateLimits=e}},Nm=class extends Error{constructor(){super("Session is too long, not sending replay")}};function Fx(n){return k(this,arguments,function*(t,e={count:0,interval:RU}){let{recordingData:i,onError:r}=t;if(i.length)try{return yield UB(t),!0}catch(s){if(s instanceof Om||s instanceof Jc)throw s;if(ao("Replays",{_retryCount:e.count}),r&&r(s),e.count>=OU){let o=new Error("".concat(cy," - max retries exceeded"));try{o.cause=s}catch{}throw o}return e.interval*=++e.count,new Promise((o,a)=>{To(()=>k(null,null,function*(){try{yield Fx(t,e),o(!0)}catch(l){a(l)}}),e.interval)})}})}var Ux="__THROTTLED",BB="__SKIPPED";function HB(t,e,n){let i=new Map,r=a=>{let l=a-n;i.forEach((c,u)=>{u<l&&i.delete(u)})},s=()=>[...i.values()].reduce((a,l)=>a+l,0),o=!1;return(...a)=>{let l=Math.floor(Date.now()/1e3);if(r(l),s()>=e){let u=o;return o=!0,u?BB:Ux}o=!1;let c=i.get(l)||0;return i.set(l,c+1),t(...a)}}var oy=class{constructor({options:e,recordingOptions:n}){this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:CU,sessionIdleExpire:wU},this._lastActivity=Date.now(),this._isEnabled=!1,this._isPaused=!1,this._requiresManualStart=!1,this._hasInitializedCoreListeners=!1,this._context={errorIds:new Set,traceIds:new Set,segmentNames:new Set,urls:[],initialTimestamp:Date.now(),initialUrl:""},this._recordingOptions=n,this._options=e,this._debouncedFlush=AB(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=HB((o,a)=>M3(this,o,a),300,5);let{slowClickTimeout:i,slowClickIgnoreSelectors:r}=this.getOptions(),s=i?{threshold:Math.min(NU,i),timeout:i,scrollTimeout:MU,ignoreSelector:r?r.join(","):""}:void 0;if(s&&(this.clickDetector=new Z_(this,s)),le){let o=e._experiments;ce.setConfig({captureExceptions:!!o.captureExceptions,traceInternals:!!o.traceInternals})}this._handleVisibilityChange=()=>{ut.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()},this._handleWindowBlur=()=>{let o=_r({category:"ui.blur"});this._doChangeToBackgroundTasks(o)},this._handleWindowFocus=()=>{let o=_r({category:"ui.focus"});this._doChangeToForegroundTasks(o)},this._handleKeyboardEvent=o=>{a3(this,o)}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(e){le&&ce.exception(e),this._options.onError&&this._options.onError(e)}initializeSampling(e){let{errorSampleRate:n,sessionSampleRate:i}=this._options,r=n<=0&&i<=0;if(this._requiresManualStart=r,!r){if(this._initializeSessionForSampling(e),!this.session){le&&ce.exception(new Error("Unable to initialize and create session"));return}this.session.sampled!==!1&&(this.recordingMode=this.session.sampled==="buffer"&&this.session.segmentId===0?"buffer":"session",le&&ce.infoTick("Starting replay in ".concat(this.recordingMode," mode")),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session"){le&&ce.log("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){le&&ce.log("Buffering is in progress, call `flush()` to save the replay");return}le&&ce.infoTick("Starting replay in session mode"),this._updateUserActivity();let e=F_({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=e,this.recordingMode="session",this._initializeRecording()}
3startBuffering(){if(this._isEnabled){le&&ce.log("Buffering is in progress, call `flush()` to save the replay");return}le&&ce.infoTick("Starting replay in buffer mode");let e=F_({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration},{stickySession:this._options.stickySession,sessionSampleRate:0,allowBuffering:!0});this.session=e,this.recordingMode="buffer",this._initializeRecording()}startRecording(){try{let e=this._canvas;this._stopRecording=zi(g(D(g(D(g(g({},this._recordingOptions),this.recordingMode==="buffer"?{checkoutEveryNms:kU}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)}),{emit:RB(this)}),kB()),{onMutation:this._onMutationHandler.bind(this)}),e?{recordCanvas:e.recordCanvas,getCanvasManager:e.getCanvasManager,sampling:e.sampling,dataURLOptions:e.dataURLOptions}:{}))}catch(e){this.handleException(e)}}stopRecording(){try{return this._stopRecording&&(this._stopRecording(),this._stopRecording=void 0),!0}catch(e){return this.handleException(e),!1}}stop(){return k(this,arguments,function*({forceFlush:e=!1,reason:n}={}){var r,s,o;if(!this._isEnabled)return;this._isEnabled=!1,this.recordingMode="buffer";let i=n!=null?n:"manual";(s=G())==null||s.emit("replayEnd",{sessionId:(r=this.session)==null?void 0:r.id,reason:i});try{le&&ce.log("Stopping Replay triggered by ".concat(i)),Am(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),e&&(yield this._flush({force:!0})),(o=this.eventBuffer)==null||o.destroy(),this.eventBuffer=null,x3(this)}catch(a){this.handleException(a)}})}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),le&&ce.log("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),le&&ce.log("Resuming replay"))}sendBufferedReplayOrFlush(){return k(this,arguments,function*({continueRecording:e=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();let n=Date.now();le&&ce.log("Converting buffer to session"),yield this.flushImmediate();let i=this.stopRecording();!e||!i||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this.session.dirty=!1,this._updateUserActivity(n),this._updateSessionActivity(n),this._maybeSaveSession(),K1(this.session.id)),this.startRecording())})}addUpdate(e){let n=e();this.recordingMode==="buffer"||!this._isEnabled||n!==!0&&this._debouncedFlush()}triggerUserActivity(){if(this._updateUserActivity(),!this._stopRecording){if(!this._checkSession())return;this.resume();return}this.checkAndHandleExpiredSession(),this._updateSessionActivity()}updateUserActivity(){this._updateUserActivity(),this._updateSessionActivity()}conditionalFlush(){return this.recordingMode==="buffer"?Promise.resolve():this.flushImmediate()}flush(){return this._debouncedFlush()}flushImmediate(){return this._debouncedFlush(),this._debouncedFlush.flush()}cancelFlush(){this._debouncedFlush.cancel()}getSessionId(e){var n,i;if(!(e&&((n=this.session)==null?void 0:n.sampled)===!1))return(i=this.session)==null?void 0:i.id}checkAndHandleExpiredSession(){var e;if(this._lastActivity&&iy(this._lastActivity,this.timeouts.sessionIdlePause)&&((e=this.session)==null?void 0:e.sampled)==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){let e="".concat(ut.location.pathname).concat(ut.location.hash).concat(ut.location.search),n="".concat(ut.location.origin).concat(e);this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=n,this._context.initialTimestamp=Date.now(),this._context.urls.push(n)}throttledAddEvent(e,n){let i=this._throttledAddEvent(e,n);if(i===Ux){let r=_r({category:"replay.throttled"});this.addUpdate(()=>!by(this,{type:j4,timestamp:r.timestamp||0,data:{tag:"breadcrumb",payload:r,metric:!0}}))}return i}getCurrentRoute(){let e=this.lastActiveSpan||Ge(),n=e&&Ue(e),r=(n&&ne(n).data||{})[dt];if(!(!n||!r||!["route","custom"].includes(r)))return ne(n).description}_initializeRecording(){var e;this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=I3({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.session&&((e=G())==null||e.emit("replayStart",{sessionId:this.session.id,recordingMode:this.recordingMode})),this.startRecording(),this.recordingMode==="session"&&this.session&&K1(this.session.id)}_initializeSessionForSampling(e){let n=this._options.errorSampleRate>0,i=F_({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,previousSessionId:e},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:n});this.session=i}_checkSession(){if(!this.session)return!1;let e=this.session;return xm(e,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})?(this._refreshSession(e),!1):!0}_refreshSession(e){return k(this,null,function*(){this._isEnabled&&(yield this.stop({reason:"sessionExpired"}),this.initializeSampling(e.id))})}_addListeners(){try{ut.document.addEventListener("visibilitychange",this._handleVisibilityChange),ut.addEventListener("blur",this._handleWindowBlur),ut.addEventListener("focus",this._handleWindowFocus),ut.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(CB(this),this._hasInitializedCoreListeners=!0)}catch(e){this.handleException(e)}this._performanceCleanupCallback=v3(this)}_removeListeners(){try{ut.document.removeEventListener("visibilitychange",this._handleVisibilityChange),ut.removeEventListener("blur",this._handleWindowBlur),ut.removeEventListener("focus",this._handleWindowFocus),ut.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(e){this.handleException(e)}}
3_doChangeToBackgroundTasks(e){if(!this.session)return;if(xm(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})){Am();return}e&&this._createCustomBreadcrumb(e),this.conditionalFlush()}_doChangeToForegroundTasks(e){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){le&&ce.log("Document has become active, but session has expired");return}e&&this._createCustomBreadcrumb(e)}_updateUserActivity(e=Date.now()){this._lastActivity=e}_updateSessionActivity(e=Date.now()){this.session&&(this.session.lastActivity=e,this._maybeSaveSession())}_createCustomBreadcrumb(e){this.addUpdate(()=>{this.throttledAddEvent({type:xe.Custom,timestamp:e.timestamp||0,data:{tag:"breadcrumb",payload:e}})})}_addPerformanceEntries(){let e=p3(this.performanceEntries).concat(this.replayPerformanceEntries);if(this.performanceEntries=[],this.replayPerformanceEntries=[],this._requiresManualStart){let n=this._context.initialTimestamp/1e3;e=e.filter(i=>i.start>=n)}return Promise.all(Um(this,e))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.segmentNames.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){let{session:e,eventBuffer:n}=this;if(!e||!n||this._requiresManualStart||e.segmentId)return;let i=n.getEarliestTimestamp();i&&i<this._context.initialTimestamp&&(this._context.initialTimestamp=i)}
3_popEventContext(){let e={initialTimestamp:this._context.initialTimestamp,initialUrl:this._context.initialUrl,errorIds:Array.from(this._context.errorIds),traceIds:Array.from(this._context.traceIds),segmentNames:Array.from(this._context.segmentNames),urls:this._context.urls};return this._clearContext(),e}_runFlush(){return k(this,null,function*(){var n;let e=this.getSessionId();if(!this.session||!this.eventBuffer||!e){le&&ce.error("No session or eventBuffer found to flush.");return}if(yield this._addPerformanceEntries(),!!((n=this.eventBuffer)!=null&&n.hasEvents)&&(yield wB(this),!!this.eventBuffer&&e===this.getSessionId()))try{this._updateInitialTimestampFromEventBuffer();let i=Date.now();if(i-this._context.initialTimestamp>this._options.maxReplayDuration+3e4)throw new Nm;let r=this._popEventContext(),s=this.session.segmentId++;this._maybeSaveSession();let o=yield this.eventBuffer.finish();yield Fx({replayId:e,recordingData:o,segmentId:s,eventContext:r,session:this.session,timestamp:i,onError:a=>this.handleException(a)})}catch(i){this.handleException(i),this.stop({reason:"sendError"});let r=G();if(r){let s;i instanceof Jc?s="ratelimit_backoff":i instanceof Nm?s="invalid":s="send_error",r.recordDroppedEvent(s,"replay")}}})}_flush(){return k(this,arguments,function*({force:e=!1}={}){if(!this._isEnabled&&!e)return;if(!this.checkAndHandleExpiredSession()){le&&ce.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;let n=this.session.started,r=Date.now()-n;this._debouncedFlush.cancel();let s=r<this._options.minReplayDuration,o=r>this._options.maxReplayDuration+5e3;if(s||o){le&&ce.log("Session duration (".concat(Math.floor(r/1e3),"s) is too ").concat(s?"short":"long",", not sending replay.")),s&&this._debouncedFlush();return}let a=this.eventBuffer;a&&this.session.segmentId===0&&!a.hasCheckout&&le&&ce.log("Flushing initial segment without checkout.");let l=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{yield this._flushLock}catch(c){this.handleException(c)}finally{this._flushLock=void 0,l&&this._debouncedFlush()}})}_maybeSaveSession(){this.session&&this._options.stickySession&&Fm(this.session)}_onMutationHandler(e){let{ignoreMutations:n}=this._options._experiments;if(n!=null&&n.length&&e.some(a=>{let l=PB(a.target),c=n.join(",");return l==null?void 0:l.matches(c)}))return!1;let i=e.length,r=this._options.mutationLimit,s=this._options.mutationBreadcrumbLimit,o=r&&i>r;if(i>s||o){let a=_r({category:"replay.mutations",data:{count:i,limit:o}});this._createCustomBreadcrumb(a)}return o?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}};function qc(t,e){return[...t,...e].join(",")}function qB({mask:t,unmask:e,block:n,unblock:i,ignore:r}){let s=["base","iframe[srcdoc]:not([src])"],o=qc(t,[".sentry-mask","[data-sentry-mask]"]),a=qc(e,[]);return{maskTextSelector:o,unmaskTextSelector:a,blockSelector:qc(n,[".sentry-block","[data-sentry-block]",...s]),unblockSelector:qc(i,[]),ignoreSelector:qc(r,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function jB({el:t,key:e,maskAttributes:n,maskAllText:i,privacyOptions:r,value:s}){if(r.unmaskTextSelector&&t.matches(r.unmaskTextSelector))return s;let o=n.includes(e),a=i&&e==="value"&&t.tagName==="INPUT"&&["submit","button"].includes(t.getAttribute("type")||"");return o||a?s.replace(/[\S]/g,"*"):s}var X1='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',GB=["content-length","content-type","accept"],WB=Symbol.for("sentry__originalRequestBody"),J1=!1,Z1=!1;function VB(){if(typeof Request>"u"||Z1)return;let t=Request;try{let e=function(n,i){let r=new t(n,i);return(i==null?void 0:i.body)!=null&&(r[WB]=i.body),r};e.prototype=t.prototype,z.Request=e,Z1=!0}catch{}}var Sy=t=>new ay(t),ay=class{constructor({flushMinDelay:e=xU,flushMaxDelay:n=AU,minReplayDuration:i=PU,maxReplayDuration:r=k1,stickySession:s=!0,useCompression:o=!0,workerUrl:a,_experiments:l={},maskAllText:c=!0,maskAllInputs:u=!0,blockAllMedia:p=!0,mutationBreadcrumbLimit:m=750,mutationLimit:f=1e4,slowClickTimeout:h=7e3,slowClickIgnoreSelectors:_=[],networkDetailAllowUrls:v=[],networkDetailDenyUrls:I=[],networkCaptureBodies:N=!0,networkRequestHeaders:j=[],networkResponseHeaders:P=[],mask:X=[],maskAttributes:V=["title","placeholder","aria-label"],unmask:A=[],block:Y=[],unblock:Pe=[],ignore:H=[],maskFn:re,beforeAddRecordingEvent:Te,beforeErrorSampling:Ie,onError:fe,attachRawBodyFromRequest:ft=!1}={}){this.name="Replay";let U=qB({mask:X,unmask:A,block:Y,unblock:Pe,ignore:H});if(this._recordingOptions=D(g({maskAllInputs:u,maskAllText:c,maskInputOptions:{password:!0},maskTextFn:re,maskInputFn:re,maskAttributeFn:(O,R,Q)=>jB({maskAttributes:V,maskAllText:c,privacyOptions:U,key:O,value:R,el:Q})},U),{slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:O=>{try{O.__rrweb__=!0}catch{}},recordCrossOriginIframes:!!l.recordCrossOriginIframes}),this._initialOptions={flushMinDelay:e,flushMaxDelay:n,minReplayDuration:Math.min(i,DU),maxReplayDuration:Math.min(r,k1),stickySession:s,useCompression:o,workerUrl:a,blockAllMedia:p,maskAllInputs:u,maskAllText:c,mutationBreadcrumbLimit:m,mutationLimit:f,slowClickTimeout:h,slowClickIgnoreSelectors:_,networkDetailAllowUrls:v,networkDetailDenyUrls:I,networkCaptureBodies:N,networkRequestHeaders:ex(j),networkResponseHeaders:ex(P),beforeAddRecordingEvent:Te,beforeErrorSampling:Ie,onError:fe,attachRawBodyFromRequest:ft,_experiments:l},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?"".concat(this._recordingOptions.blockSelector,",").concat(X1):X1,this._recordingOptions.ignoreCSSAttributes=new Set(["background-image"])),this._isInitialized&&Ei())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return J1}set _isInitialized(e){J1=e}afterAllSetup(e){!Ei()||this._replay||(this._initialOptions.attachRawBodyFromRequest&&VB(),this._setup(e),this._initialize(e))}start(){this._replay&&this._replay.start()}
3startBuffering(){this._replay&&this._replay.startBuffering()}stop(e){var n;return this._replay?this._replay.stop({forceFlush:(n=e==null?void 0:e.flush)!=null?n:this._replay.recordingMode==="session",reason:"manual"}):Promise.resolve()}flush(e){return this._replay?this._replay.isEnabled()?this._replay.sendBufferedReplayOrFlush(e):(this._replay.start(),Promise.resolve()):Promise.resolve()}getReplayId(e){var n;if((n=this._replay)!=null&&n.isEnabled())return this._replay.getSessionId(e)}getRecordingMode(){var e;if((e=this._replay)!=null&&e.isEnabled())return this._replay.recordingMode}processSpan(e){let n=this.getReplayId(!0);n&&(Lr(e,{"sentry.replay_id":n}),this.getRecordingMode()==="buffer"&&Lr(e,{"sentry._internal.replay_is_buffering":!0}))}_initialize(e){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(e),this._replay.initializeSampling())}_setup(e){let n=zB(this._initialOptions,e);this._replay=new oy({options:n,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(e){try{let n=e.getIntegrationByName("ReplayCanvas");if(!n)return;this._replay._canvas=n.getOptions()}catch{}}};function zB(t,e){let n=e.getOptions(),i=g({sessionSampleRate:0,errorSampleRate:0},t),r=ei(n.replaysSessionSampleRate),s=ei(n.replaysOnErrorSampleRate);return r==null&&s==null&&Bt(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),r!=null&&(i.sessionSampleRate=r),s!=null&&(i.errorSampleRate=s),i}function ex(t){return[...GB,...t.map(e=>e.toLowerCase())]}function Bx(t){return t.split(",").some(e=>e.trim().startsWith("sentry-"))}function Ey(t){try{return new URL(t,ie.location.origin).href}catch{return}}function Hx(t){return t.entryType==="resource"&&"initiatorType"in t&&typeof t.nextHopProtocol=="string"&&(t.initiatorType==="fetch"||t.initiatorType==="xmlhttprequest")}function Ty(t){try{return new Headers(t)}catch{return}}var Iy={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function jx(t,e){let{traceFetch:n,traceXHR:i,shouldCreateSpanForRequest:r,enableHTTPTimings:s,tracePropagationTargets:o,onRequestSpanStart:a,onRequestSpanEnd:l}=g(g({},Iy),e),c=typeof r=="function"?r:f=>!0,u=f=>$B(f,o),p={},m=t.getOptions().propagateTraceparent;n&&pr(f=>{let h=e_(f,c,u,p,{propagateTraceparent:m,onRequestSpanEnd:l});if(h){let _=Ey(f.fetchData.url),v=_?Ti(_).host:void 0,I=_?on(_):void 0;h.setAttributes({[Nd]:I,[ti]:I,"server.address":v}),s&&qx(h,t),a==null||a(h,{headers:f.headers})}}),i&&Io(f=>{var _;let h=KB(f,c,u,p,m,l);h&&(s&&qx(h,t),a==null||a(h,{headers:Ty((_=f.xhr.__sentry_xhr_v3__)==null?void 0:_.request_headers)}))})}var YB=300;function qx(t,e){let{url:n}=ne(t).data;if(!n||typeof n!="string")return;let i=()=>void setTimeout(r);if($t(e)){let s=t.end.bind(t);t.end=o=>{let a=o!=null?o:Ve(),l=!1,c=()=>{l||(l=!0,setTimeout(r),s(a),clearTimeout(u))};i=c;let u=setTimeout(c,YB)}}let r=xi("resource",({entries:s})=>{s.forEach(o=>{Hx(o)&&o.name.endsWith(n)&&(t.setAttributes(kc(o)),i())})})}function $B(t,e){let n=In();if(n){let i,r;try{i=new URL(t,n),r=new URL(n).origin}catch{return!1}let s=i.origin===r;return e?rn(i.toString(),e)||s&&rn(i.pathname,e):s}else{let i=!!t.match(/^\/(?!\/)/);return e?rn(t,e):i}}function KB(t,e,n,i,r,s){let o=t.xhr,a=o==null?void 0:o[ri];if(!o||o.__sentry_own_request__||!a)return;let{url:l,method:c}=a,u=Ct()&&e(l);if(t.endTimestamp){let P=o.__sentry_xhr_span_id__;if(!P)return;let X=i[P];X&&(u&&a.status_code!==void 0&&(ha(X,a.status_code),X.end(),s==null||s(X,{headers:Ty(Nc(o)),error:t.error})),delete i[P]);return}let p=Ey(l),m=p?Ti(p):Ti(l),f=p?on(p):void 0,h=on(Ia(l)),_=G(),v=!!Ge(),I=v||!!_&&$t(_),N=u&&I?Nt({name:"".concat(c," ").concat(h),attributes:g(g({url:on(l),type:"xhr","http.method":c,"http.url":f,[ti]:f,"server.address":m==null?void 0:m.host,[Oe]:"auto.http.browser",[ot]:"http.client"},(m==null?void 0:m.search)&&{"http.query":m==null?void 0:m.search}),(m==null?void 0:m.hash)&&{"http.fragment":m==null?void 0:m.hash})}):new Yn,j=ba(N)&&v?void 0:N;return u&&!I&&(_==null||_.recordDroppedEvent("no_parent_span","span")),o.__sentry_xhr_span_id__=N.spanContext().spanId,i[o.__sentry_xhr_span_id__]=N,n(l)&&QB(o,Ct()&&I?j:void 0,r),_&&_.emit("beforeOutgoingRequestSpan",N,t),N}function QB(t,e,n){let{"sentry-trace":i,baggage:r,traceparent:s}=xa({span:e,propagateTraceparent:n});i&&XB(t,i,r,s)}function XB(t,e,n,i){var s;let r=(s=t.__sentry_xhr_v3__)==null?void 0:s.request_headers;if(!(r!=null&&r["sentry-trace"]||!t.setRequestHeader))try{if(t.setRequestHeader("sentry-trace",e),i&&!(r!=null&&r.traceparent)&&t.setRequestHeader("traceparent",i),n){let o=r==null?void 0:r.baggage;(!o||!Bx(o))&&t.setRequestHeader("baggage",n)}}catch{}}var Gx=new WeakMap,Wx=new WeakMap,JB=9e4,ZB=["text/event-stream","application/x-ndjson","application/stream+json"],Vx=()=>({name:"FetchStreamPerformance",setup(){zd(t=>{if(t.response){let e=Gx.get(t.response);if(e&&t.endTimestamp){e.end(t.endTimestamp);let n=Wx.get(t.response);n&&clearTimeout(n)}}}),pr(t=>{var e,n,i,r;if(t.endTimestamp&&t.response){let s=((e=t.response.headers)==null?void 0:e.get("
3content-type"))||"";if((n=t.response.headers)!=null&&n.get("content-length")||!ZB.some(m=>s.startsWith(m)))return;let o=((i=t.fetchData)==null?void 0:i.url)||"",a=((r=t.fetchData)==null?void 0:r.method)||"GET",l=ni(o),c=o.startsWith("data:")?on(o):l?Ta(l):o,u=Nt({name:"".concat(a," ").concat(c),startTime:t.endTimestamp,attributes:{url:on(o),"http.method":a,type:"fetch",[ot]:"http.client.stream",[Oe]:"auto.http.browser.stream"}});Gx.set(t.response,u);let p=setTimeout(()=>{u.isRecording()&&u.end()},JB);Wx.set(t.response,p)}})}});var Cy="WebVitals",zx=(t={})=>{var n;let e=new Set((n=t.ignore)!=null?n:[]);return{name:Cy,setup(i){var p;let r=$t(i),{enableStandaloneClsSpans:s,enableStandaloneLcpSpans:o}=(p=t._experiments)!=null?p:{},a=r||e.has("cls")?void 0:s||!1,l=r||e.has("lcp")?void 0:o||!1,c=d_({recordClsStandaloneSpans:a,recordLcpStandaloneSpans:l,client:i}),u=new WeakSet;i.on("afterStartPageLoadSpan",m=>{u.add(m)}),i.on("spanEnd",m=>{u.delete(m)&&(c(),__(m,{recordClsOnPageloadSpan:a===!1,recordLcpOnPageloadSpan:l===!1,spanStreamingEnabled:r}))}),r?(e.has("lcp")||T_(i),e.has("cls")||I_(i),e.has("inp")||C_()):e.has("inp")||v_()},afterAllSetup(){e.has("inp")||S_()}}};function Yx(){ie.document?ie.document.addEventListener("visibilitychange",()=>{let t=Ge();if(!t)return;let e=Ue(t);if(ie.document.hidden&&e){let n="cancelled",{op:i,status:r}=ne(e);mt&&C.log("[Tracing] Transaction: ".concat(n," -> since tab moved to the background, op: ").concat(i)),r||e.setStatus({code:2,message:n}),e.setAttribute("sentry.cancellation_reason","document.hidden"),e.end()}}):mt&&C.warn("[Tracing] Could not set up background tab detection due to lack of global document")}var e5=3600,$x="sentry_previous_trace",t5="sentry.previous_trace";function Kx(t,{linkPreviousTrace:e,consistentTraceSampling:n}){let i=e==="session-storage",r=i?r5():void 0;t.on("spanStart",o=>{if(Ue(o)!==o)return;let a=te().getPropagationContext();r=n5(r,o,a),i&&i5(r)});let s=!0;n&&t.on("beforeSampling",o=>{if(!r)return;let a=te(),l=a.getPropagationContext();if(s&&l.parentSpanId){s=!1;return}a.setPropagationContext(D(g({},l),{dsc:D(g({},l.dsc),{sample_rate:String(r.sampleRate),sampled:String(wy(r.spanContext))}),sampleRand:r.sampleRand})),o.parentSampled=wy(r.spanContext),o.parentSampleRate=r.sampleRate,o.spanAttributes=D(g({},o.spanAttributes),{[ma]:r.sampleRate})})}function n5(t,e,n){let i=ne(e);function r(){var a,l,c;try{let u=Number((c=(a=i.data)==null?void 0:a[Or])!=null?c:(l=n.dsc)==null?void 0:l.sample_rate);return Number.isNaN(u)?0:u}catch{return 0}}let s={spanContext:e.spanContext(),startTimestamp:i.start_timestamp,sampleRate:r(),sampleRand:n.sampleRand};if(!t)return s;let o=t.spanContext;return o.traceId===i.trace_id?t:(Date.now()/1e3-t.startTimestamp<=e5&&(mt&&C.log("Adding previous_trace `".concat(JSON.stringify(o),"` link to span `").concat(JSON.stringify(g({op:i.op},e.spanContext())),"`")),e.addLink({context:o,attributes:{[hd]:"previous_trace"}}),e.setAttribute(t5,"".concat(o.traceId,"-").concat(o.spanId,"-").concat(wy(o)?1:0))),s)}function i5(t){try{ie.sessionStorage.setItem($x,JSON.stringify(t))}catch(e){mt&&C.warn("Could not store previous trace in sessionStorage",e)}}function r5(){var t;try{let e=(t=ie.sessionStorage)==null?void 0:t.getItem($x);return JSON.parse(e)}catch{return}}function wy(t){return t.traceFlags===1}var s5="BrowserTracing",o5=/Googlebot|Google-InspectionTool|Storebot-Google|Bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Facebot|facebookexternalhit|LinkedInBot|Twitterbot|Applebot/i;function eA(){let t=ie.navigator;return t!=null&&t.userAgent?o5.test(t.userAgent):!1}var a5=g(D(g({},va),{instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,ignoreResourceSpans:[],ignorePerformanceApiSpans:[],detectRedirects:!0,linkPreviousTrace:"in-memory",consistentTraceSampling:!1,enableReportPageLoaded:!1,_experiments:{}}),Iy),xy=(t={})=>{"enableElementTiming"in t&&Bt(()=>{console.warn("[Sentry] `enableElementTiming` is deprecated and no longer has any effect. Use the standalone `elementTimingIntegration` instead.")});let e={name:void 0,source:void 0},n=ie.document,{enableInp:i,enableLongTask:r,enableLongAnimationFrame:s,_experiments:{enableInteractions:o,enableStandaloneClsSpans:a,enableStandaloneLcpSpans:l},beforeStartSpan:c,idleTimeout:u,finalTimeout:p,childSpanTimeout:m,markBackgroun
3dSpan:f,traceFetch:h,traceXHR:_,trackFetchStreamPerformance:v,shouldCreateSpanForRequest:I,enableHTTPTimings:N,ignoreResourceSpans:j,ignorePerformanceApiSpans:P,instrumentPageLoad:X,instrumentNavigation:V,detectRedirects:A,linkPreviousTrace:Y,consistentTraceSampling:Pe,enableReportPageLoaded:H,onRequestSpanStart:re,onRequestSpanEnd:Te}=g(g({},a5),t),Ie=eA(),fe,ft;function U(O,R,Q=!0,q){let he=R.op==="pageload",ye=R.name,We=c?c(R):R,Se=ni(q||In()),Rn=g(g(g({},(Se==null?void 0:Se.pathname)&&{[Md]:Se.pathname}),Se&&!Br(Se)&&{[ti]:Se.href}),We.attributes);if(ye!==We.name&&(Rn[dt]="custom"),We.attributes=Rn,!Q){let Jt=Gn();Nt(D(g({},We),{startTime:Jt})).end(Jt);return}e.name=We.name,e.source=Rn[dt];let Mi=Rd(We,{idleTimeout:u,finalTimeout:p,childSpanTimeout:m,disableAutoFinish:he,beforeSpanEnd:Jt=>{g_(Jt,{ignoreResourceSpans:j,ignorePerformanceApiSpans:P,spanStreamingEnabled:$t(O)}),Jx(O,void 0);let Ht=te(),ui=Ht.getPropagationContext();Ht.setPropagationContext(D(g({},ui),{traceId:Mi.spanContext().traceId,sampled:zn(Mi),dsc:sn(Jt)})),he&&(ft=void 0)},trimIdleSpanEndTimestamp:!H});he&&H&&(ft=Mi),Jx(O,Mi);function ht(){n&&["interactive","complete"].includes(n.readyState)&&(O.emit("idleSpanEnableAutoFinish",Mi),n.removeEventListener("readystatechange",ht))}he&&!H&&n&&(n.addEventListener("readystatechange",ht),ht())}return{name:s5,setup(O){var Q;if(Ie){mt&&C.log("[Tracing] Skipping browserTracingIntegration setup for bot user agent.");return}if(Id(),s&&z.PerformanceObserver&&((Q=PerformanceObserver.supportedEntryTypes)!=null&&Q.includes("long-animation-frame"))?f_():r&&m_(),o&&h_(),A&&n){let q=()=>{fe=Ve()};addEventListener("click",q,{capture:!0}),addEventListener("keydown",q,{capture:!0,passive:!0})}function R(){let q=tu(O);q&&!ne(q).timestamp&&(mt&&C.log("[Tracing] Finishing current active span with op: ".concat(ne(q).op)),q.setAttribute(Nr,"cancelled"),q.end())}O.on("startNavigationSpan",(q,he)=>{if(G()!==O)return;if(he!=null&&he.isRedirect){mt&&C.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),U(O,g({op:"navigation.redirect"},q),!1,he.url);return}fe=void 0,R(),st().setPropagationContext({traceId:En(),sampleRand:Math.random(),propagationSpanId:Ct()?void 0:fn()});let ye=te();ye.setPropagationContext({traceId:En(),sampleRand:Math.random(),propagationSpanId:Ct()?void 0:fn()}),ye.setSDKProcessingMetadata({normalizedRequest:void 0}),U(O,D(g({op:"navigation"},q),{parentSpan:null,forceTransaction:!0}),!0,he==null?void 0:he.url)}),O.on("startPageLoadSpan",(q,he={})=>{if(G()!==O)return;R();let ye=he.sentryTrace||Qx("sentry-trace")||Xx("sentry-trace"),We=he.baggage||Qx("baggage")||Xx("baggage"),Se=gg(ye,We),Rn=te();Rn.setPropagationContext(Se),Ct()||(Rn.getPropagationContext().propagationSpanId=fn()),Rn.setSDKProcessingMetadata({normalizedRequest:Na()}),U(O,g({op:"pageload"},q))}),O.on("endPageloadSpan",()=>{H&&ft&&(ft.setAttribute(Nr,"reportPageLoaded"),ft.end())})},afterAllSetup(O){var Q;if(Ie)return;O.addIntegration&&!((Q=O.getIntegrationByName)!=null&&Q.call(O,Cy))&&O.addIntegration(zx({ignore:i?[]:["inp"],_experiments:{enableStandaloneClsSpans:a,enableStandaloneLcpSpans:l}}));let R=In();if(Y!=="off"&&Kx(O,{linkPreviousTrace:Y,consistentTraceSampling:Pe}),ie.location){if(X){let q=tt();tA(O,{name:ie.location.pathname,startTime:q?q/1e3:void 0,attributes:{[dt]:"url",[Oe]:"auto.pageload.browser"}})}V&&zr(({to:q,from:he})=>{if(he===void 0&&(R==null?void 0:R.indexOf(q))!==-1){R=void 0;return}R=void 0;let ye=ni(q),We=tu(O),Se=We&&A&&c5(We,fe);Hm(O,{name:(ye==null?void 0:ye.pathname)||ie.location.pathname,attributes:{[dt]:"url",[Oe]:"auto.navigation.browser"}},{url:q,isRedirect:Se})})}f&&Yx(),o&&l5(O,u,p,m,e),jx(O,{traceFetch:h,traceXHR:_,tracePropagationTargets:O.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:I,enableHTTPTimings:N,onRequestSpanStart:re,onRequestSpanEnd:Te}),v&&O.addIntegration(Vx())}}};function tA(t,e,n){t.emit("startPageLoadSpan",e,n),te().setTransactionName(e.name);let i=tu(t);return i&&t.emit("afterStartPageLoadSpan",i),i}function Hm(t,e,n){let{url:i,isRedirect:r}=n||{};t.emit("beforeStartNavigationSpan",e,{isRedirect:r,url:i}),t.emit("startNavigationSpan",e,{isRedirect:r,url:i});let s=te();return s.setTransactionName(e.name),i&&!r&&s.setSDKProcessingMetadata({normalizedRequest:D(g({},Na()),{url:i})}),tu(t)}function Qx(t){let e=ie.document,n=e==null?void 0:e.querySelector("meta[name=".concat(t,"]"));return(n==null?void 0:n.getAttribute("content"))||void 0}function Xx(t){var i,r,s;let e=(r=(i=ie.performance)==null?void 0:i.getEntriesByType)==null?void 0:r.call(i,"navigation")[0],n=(s=e==null?void 0:e.serverTiming)==null?void 0:s.find(o=>o.name===t);return n==null?void 0:n.description}function l5(t,e,n,i,r){let s=ie.document,o,a=()=>{let l="ui.action.click",c=tu(t);if(c){let u=ne(c).op;
3if(["navigation","pageload"].includes(u)){mt&&C.warn("[Tracing] Did not create ".concat(l," span because a pageload or navigation span is in progress."));return}}if(o&&(o.setAttribute(Nr,"interactionInterrupted"),o.end(),o=void 0),!r.name){mt&&C.warn("[Tracing] Did not create ".concat(l," transaction because _latestRouteName is missing."));return}o=Rd({name:r.name,op:l,attributes:{[dt]:r.source||"url"}},{idleTimeout:e,finalTimeout:n,childSpanTimeout:i})};s&&addEventListener("click",a,{capture:!0})}var nA="_sentry_idleSpan";function tu(t){return t[nA]}function Jx(t,e){et(t,nA,e)}var Zx=1.5;function c5(t,e){let n=ne(t),i=Gn(),r=n.start_timestamp;return!(i-r>Zx||e&&i-e<=Zx)}var rA=typeof __SENTRY_DEBUG__>"u"?!0:__SENTRY_DEBUG__;function p5(t={}){return[mo(),po(),Aa(),Pc(),Fc(),Bc(),fo(),Uc(),Lc(),Dc()]}function sA(t){let e=g({defaultIntegrations:p5()},t);return wa(e,"angular"),d5(),O_(e)}function d5(){var n;let e=((n=Hu)==null?void 0:n.major)&&parseInt(Hu.major,10);e&&(e<14&&rA&&C.warn("This Sentry SDK does not officially support Angular ".concat(e,"."),"This SDK only supports Angular 14 and above.","If you're using lower Angular versions, check the Angular Version Compatibility table in our docs: https://docs.sentry.io/platforms/javascript/guides/angular/#angular-version-compatibility.","Otherwise, please consider upgrading your Angular version."),ao("angular",{version:e}))}var iA,m5=typeof Zone<"u"&&((iA=Zone.root)==null?void 0:iA.run);function Qa(t){return m5?Zone.root.run(t):t()}function f5(t){return t!=null&&t.ngOriginalError?t.ngOriginalError:t}function h5(t){return oA(t.error)?t.error:typeof ErrorEvent<"u"&&t.error instanceof ErrorEvent&&t.error.message?t.error.message:typeof t.error=="string"?"Server returned code ".concat(t.status,' with body "').concat(t.error,'"'):t.message}function oA(t){if(t instanceof Error)return!0;if(t===null||typeof t!="object")return!1;let e=t;return Ot(e.name)&&Ot(e.message)&&(e.stack===void 0||Ot(e.stack))}var g5=(()=>{class t{constructor(n){this._options=g({logErrors:!0},n)}ngOnDestroy(){this._removeAfterSendEventListener&&this._removeAfterSendEventListener()}handleError(n){let i=this._extractError(n)||"Handled unknown error",r=Qa(()=>Wi(i,{mechanism:{type:"auto.function.angular.error_handler",handled:!1}}));if(this._options.logErrors&&Bt(()=>console.error(i)),this._options.showDialog){let s=G();s&&!this._removeAfterSendEventListener?this._removeAfterSendEventListener=s.on("afterSendEvent",o=>{!o.type&&o.event_id&&Qa(()=>{mm(D(g({},this._options.dialogOptions),{eventId:o.event_id}))})}):s||Qa(()=>{mm(D(g({},this._options.dialogOptions),{eventId:r}))})}}_extractError(n){if(this._options.extractor){let i=this._defaultExtractor.bind(this);return this._options.extractor(n,i)}return this._defaultExtractor(n)}_defaultExtractor(n){let i=f5(n);return i instanceof Hs?h5(i):typeof i=="string"||oA(i)?i:null}}return t.\u0275fac=function(n){return new(n||t)(ue("errorHandlerOptions"))},t.\u0275prov=vt({token:t,factory:t.\u0275fac,providedIn:"root"}),t})();function aA(t){return new g5(t)}var _5="ui.angular.routing";var lA;function cA(t={}){return t.instrumentNavigation!==!1&&(lA=!0),xy(D(g({},t),{instrumentNavigation:!1}))}function y5(t,e,n){var s;if(!n)return;let{data:i,op:r}=ne(n);if(!i||i[dt]==="url"){n.updateName(t);let o=Mc(e);n.setAttributes({[Oe]:"auto.".concat(r,".angular"),[dt]:"route",[ti]:o,[Md]:(s=ni(o))==null?void 0:s.pathname,[hC]:t})}}var uA=(()=>{class t{constructor(n){this._router=n,this.navStart$=this._router.events.pipe(an(i=>i instanceof hS),Ze(i=>{if(!lA){rA&&C.error("Angular integration has tracing enabled, but Tracing integration is not configured");return}this._routingSpan&&(this._routingSpan.end(),this._routingSpan=null);let r=G(),s=Ia(i.url);if(r){this._isPageloadOngoing()?this._pageloadOngoing=!1:Qa(()=>{Hm(r,{name:s,attributes:{[Oe]:"auto.navigation.angular",[dt]:"url"}},{url:Mc(i.url)})}),this._routingSpan=Qa(()=>Nt({name:"".concat(i.url),op:_5,attributes:g({[Oe]:"auto.ui.angular",[dt]:"url",url:s},i.navigationTrigger&&{navigationTrigger:i.navigationTrigger})}))||null;return}})),this.resEnd$=this._router.events.pipe(an(i=>i instanceof _S),Ze(i=>{let r=b5(i.state.root);r&&te().setTransactionName(r);let s=Ge(),o=s&&Ue(s);y5(r,i.urlAfterRedirects,o)})),this.navEnd$=this._router.events.pipe(an(i=>i instanceof Ws||i instanceof lp||i instanceof cp),Ze(()=>{this._routingSpan&&(Qa(()=>{this._routingSpan.end()}),this._routingSpan=null)})),this._routingSpan=null,this._pageloadOngoing=!0,this._subscription=new G0,this._subscription.add(this.navStart$.subscribe()),this._subscription.add(this.resEnd$.subscribe()),this._subscription.add(this.navEnd$.subscribe())}ngOnDestroy(){this._subscription.unsubscribe()}_isPageloadOngoing(){if(!this._pageloadOngoing)return!1;let n=Ge();if(!n)return this._pageloadOngoing=!1,!1;let i=Ue(n);return this._pageloadOngoing=ne(i).op==="pageload",this._pageloadOngoing}}return t.\u0275fac=function(n){return new(n||t)(ue(Yt))},t.\u0275prov=vt({token:t,factory:t.\u0275fac,providedIn:"root"}),t})();function b5(t){let e=[],n=t==null?void 0:t.firstChild;for(;n;
3){let r=(n==null?void 0:n.routeConfig)&&n.routeConfig.path;if(r==null)break;e.push(r),n=n.firstChild}let i=e.filter(r=>r).join("/");return i?"/".concat(i,"/"):"/"}var qm=class{constructor(){d(this,"sentryErrorHandler",aA({logErrors:!0}));d(this,"repo",T(Qe))}handleError(e){var i,r;if(((i=e==null?void 0:e.message)==null?void 0:i.includes("Failed to load module"))||((r=e==null?void 0:e.message)==null?void 0:r.includes("MIME type"))){console.warn("Chunk load error detected, forcing reload"),this.repo.IsInBrowser&&window.location.reload();return}this.sentryErrorHandler.handleError(e)}};var v5=["class","component"],pA=(()=>{let e=class e{constructor(){d(this,"dialogRef",T(gi));d(this,"data",T(Ut));d(this,"remainingdays",0)}ngOnInit(){this.remainingdays=Math.ceil(+this.data/86400)}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275cmp",be({type:e,selectors:[["beh-restriction-user-by-app-dialog",8,"component"]],attrs:v5,decls:25,vars:1,consts:[[1,"w-full","flex","flex-wrap","p-6"],[1,"w-full","flex","flex-wrap","justify-between","items-center"],[1,"w-9/12","flex","flex-wrap","items-center"],[1,"flex","justify-center","items-center","rounded-full","bg-red-50","dark:!bg-[#3D2928]","min-h-8","max-h-8","w-8","md:min-
3h-9","md:max-h-9","md:w-9"],[1,"icon","error-circle-regular","text-2xl","text-red-700","dark:text-[#D12D2C]"],[1,"text-red-700","dark:text-[#D12D2C]","font-semibold","text-base","mr-2"],[1,"!px-0","icon","dismiss-regular","text-gray-900","text-xl","cursor-pointer",3,"click"],[1,"w-full","block","font-regular","text-sm","text-gray-600","mt-4"],[1,"font-medium","text-sm","text-red-700","dark:text-[#D12D2C]"],[1,"w-full","flex","items-start","gap-1","mt-6"],[1,"icon","dismiss-regular","text-xl","text-red-700","dark:text-[#D12D2C]"],[1,"font-medium","text-sm","text-gray-500","mr-1"],[1,"icon","checkmark-regular","text-xl","text-green-500"],[1,"w-full","flex","items-center","justify-between","mt-4","gap-1"],[1,"w-full","btn-green-flat","!min-h-10","md:font-medium","text-sm",3,"click"],[1,"font-medium","text-sm"]],template:function(r,s){r&1&&(F(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),qe(4,"span",4),W(),F(5,"span",5),E(6,"\u0634\u0645\u0627 \u0645\u062D\u062F\u0648\u062F\u0634\u062F\u0647\u200C\u0627\u06CC\u062F"),W()(),F(7,"span",6),pi("click",function(){return s.dialogRef.close()}),W()(),F(8,"p",7),E(9," \u0634\u0645\u0627 \u062A\u0648\u0633\u0637 \u0628\u0631\u0646\u0627\u0645\u0647 \u0645\u062D\u062F\u0648\u062F\u0634\u062F\u0647\u200C\u0627\u06CC\u062F \u0648 \u062A\u0627 \u067E\u0627\u06CC\u0627\u0646 \u0645\u062D\u062F\u0648\u062F\u06CC\u062A\u200C\u062A\u0627\u0646 "),F(10,"span",8),E(11),W(),E(12," \u0628\u0627\u0642\u06CC \u0645\u0627\u0646\u062F\u0647 \u0627\u0633\u062A. "),W(),F(13,"div",9),qe(14,"span",10),F(15,"span",11),E(16,"\u0646\u0645\u06CC\u200C\u062A\u0648\u0627\u0646\u06CC\u062F \u0647\u06CC\u0686 \u0646\u0648\u0639 \u0645\u062D\u062A\u0648\u0627\u06CC\u06CC \u062A\u0648\u0644\u06CC\u062F \u06A9\u0646\u06CC\u062F\u060C \u0628\u067E\u0633\u0646\u062F\u06CC\u062F \u0648 \u06CC\u0627 \u0646\u0638\u0631 \u062F\u0647\u06CC\u062F."),W()(),F(17,"div",9),qe(18,"span",12),F(19,"span",11),E(20," \u0645\u06CC\u200C\u062A\u0648\u0627\u0646\u06CC\u062F \u06AF\u0632\u0627\u0631\u0634 \u0645\u0637\u0627\u0644\u0639\u0647 \u0628\u062F\u0648\u0646 \u0645\u062A\u0646 \u062B\u0628\u062A \u06A9\u0646\u06CC\u062F\u060C \u0628\u0647 \u0686\u0627\u0644\u0634 \u0628\u067E\u06CC\u0648\u0646\u062F\u06CC\u062F \u0648 \u06A9\u062A\u0627\u0628\u200C\u0647\u0627 \u0631\u0627 \u0628\u0647 \u06A9\u062A\u0627\u0628\u062E\u0627\u0646\u0647\u200C\u062A\u0627\u0646 \u0627\u0636\u0627\u0641\u0647 \u06A9\u0646\u06CC\u062F. "),W()(),F(21,"div",13)(22,"button",14),pi("click",function(){return s.dialogRef.close()}),F(23,"span",15),E(24,"\u0645\u062A\u0648\u062C\u0647 \u0634\u062F\u0645"),W()()()()),r&2&&(y(11),Me(" ",s.remainingdays," \u0631\u0648\u0632 "))},encapsulation:2}));let t=e;return t})();var jm="CACHE_KEY",S5="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function mA(t,e){var o,a,l;let n=T(Qe),i=T(_i),r=E5(t,n),s=I5(r,n);if(s){let c=(l=(a=(o=s.apiError)==null?void 0:o.details[0])==null?void 0:a.message)!=null?l:"";return dA(i,c),pe(new Di({body:s}))}return e(t).pipe(Ze(c=>{var u,p,m,f;if(c instanceof Di){let h=c.body;if(((p=(u=h==null?void 0:h.apiError)==null?void 0:u.code)!=null?p:h==null?void 0:h.error)==="RESTRICTED_USER"){let v=(f=(m=h.apiError)==null?void 0:m.details[0])==null?void 0:f.message;dA(i,v),T5(r,h,n)}}}))}function E5(t,e){var l;let n=e.getCookieItem(Ji),i=t.urlWithParams,r=t.method,s="";(i.includes("MakeProgressOnBook")||i.includes("urp/monthly")||i.includes("urp/publish"))&&(s=(l=t.body)==null?void 0:l.body);let o="".concat(n,":").concat(r,":").concat(i,":").concat(s);return dp(o,S5)}function T5(t,e,n){var s;let i={data:e,expireAt:Date.now()+9e5},r=JSON.parse((s=n.getLocalItem(jm))!=null?s:"{}");r[t]=i,n.setLocalItem(jm,JSON.stringify(r))}function I5(t,e){var r;let n=JSON.parse((r=e.getLocalItem(jm))!=null?r:"{}");C5(n,e);let i=n[t];return i?i.data:null}function C5(t,e){let n=!1;for(let i of Object.keys(t)){let r=t[i];r!=null&&r.expireAt&&Date.now()>r.expireAt&&(delete t[i],n=!0)}n&&e.setLocalItem(jm,JSON.stringify(t))}function dA(t,e){t.open(pA,{width:"408px",data:e})}var w5=t=>{let e=t;if(typeof(e==null?void 0:e.createClient)=="function")return e;let n=t==null?void 0:t.default;if(typeof(n==null?void 0:n.createClient)=="function")return n;throw new Error("matrix-js-sdk loaded without a usable createClient export")},x5=()=>k(null,null,function*(){var t,e,n;
3if(!ln.matrixVerboseLogs)try{let i=yield import("./chunk-FABNJCBK.js"),r=(e=i==null?void 0:i.logger)!=null?e:(t=i==null?void 0:i.default)==null?void 0:t.logger;(n=r==null?void 0:r.setLevel)==null||n.call(r,"warn",!1)}catch{}}),nu=":behkhaan.ir",Gm="matrix_token",Ay="matrix_token_user",ky="ir.behkhaan.hidden_messages",Ry="ir.behkhaan.club",A5=1e4,Oy=30,k5=3,R5=4,O5=3e3,fA=(()=>{let e=class e extends Ip{constructor(){super(...arguments);d(this,"repo",T(Qe));d(this,"userState",T(hi));d(this,"searchService",T(_p));d(this,"zone",T(Gt));d(this,"capabilities",{send:!0,history:!0,startDirect:!0,edit:!0,delete:!0,reactions:!0,typing:!0,presence:!0,receipts:!0,attachments:!0,groups:!0,pinAndMute:!1,mute:!0,moderation:!0,groupAvatar:!0,leave:!0,blockUser:!0,invitations:!0,clubLink:!0,clubLinkForClubMembers:!0,groupVisibility:!0,joinPublicGroup:!0});d(this,"_events$",new Qi);d(this,"_connection$",new hl(tr.disconnected));d(this,"events$",this._events$.asObservable());d(this,"connection$",this._connection$.asObservable());d(this,"sdk",null);d(this,"client",null);d(this,"matrixUserId","");d(this,"initPromise",null);d(this,"generation",0);d(this,"retriedAuth",!1);d(this,"readyResolve");d(this,"readyReject");d(this,"ready",new Promise(()=>{}));d(this,"uploadedMedia",new Map);d(this,"directRoomIds",new Set);d(this,"hiddenMessages",new Map);d(this,"initialSyncPending",!1);d(this,"initialPresence",new Map);d(this,"pendingEvents",[]);d(this,"flushScheduled",!1);d(this,"txnAttempt",0)}emit(r){this.pendingEvents.push(r),!this.flushScheduled&&(this.flushScheduled=!0,queueMicrotask(()=>this.flushEvents()))}flushEvents(){if(this.flushScheduled=!1,this.pendingEvents.length===0)return;let r=this.pendingEvents;this.pendingEvents=[],this.zone.run(()=>{for(let s of r)this._events$.next(s)})}setConnection(r){this.zone.run(()=>this._connection$.next(r))}connect(){if(!this.repo.IsInBrowser||this.initPromise)return;this.setConnection(tr.connecting),this.retriedAuth=!1,this.initialSyncPending=!0,this.ready=new Promise((s,o)=>{this.readyResolve=s,this.readyReject=o}),this.ready.catch(()=>{});let r=this.generation;this.initPromise=this.zone.runOutsideAngular(()=>this.initialize(r)).catch(s=>{r===this.generation&&(console.error("[matrix-chat] initialization failed",s),this.setConnection(tr.disconnected),this.readyReject(s),this.initPromise=null)})}disconnect(){var r,s;this.generation++,(r=this.client)==null||r.stopClient(),this.client=null,this.initPromise=null,this.retriedAuth=!1,this.pendingEvents=[],this.initialSyncPending=!1,this.initialPresence.clear(),(s=this.readyReject)==null||s.call(this,new Error("chat disconnected")),this.setConnection(tr.disconnected)}initialize(r){return k(this,null,function*(){var u;let s=(u=this.userState.userDataSnapshot)==null?void 0:u.id;if(!s)throw new Error("no authenticated behkhaan user");if(this.sdk=w5(yield import("./chunk-UTGGL4YQ.js")),yield x5(),r!==this.generation)return;let o="@".concat(s).concat(nu),a=yield this.resolveAccessToken(s,r);if(r!==this.generation)return;let l=yield this.resolveIdentity(a,s);if(r!==this.generation)return;if(!l||l!==o){if(this.repo.removeLocalItem(Gm),this.repo.removeLocalItem(Ay),a=yield this.resolveAccessToken(s,r),r!==this.generation||(l=yield this.resolveIdentity(a,s),r!==this.generation))return;if(!l)throw new Error("matrix authentication failed (whoami)");if(l!==o)throw new Error("matrix identity mismatch: got ".concat(l,", expected ").concat(o))}this.matrixUserId=l;let c=this.sdk.createClient({baseUrl:ln.MatrixBaseUrl,accessToken:a,userId:this.matrixUserId,timelineSupport:!0,cryptoStore:void 0});this.client=c,this.bindClientEvents(),yield c.startClient({initialSyncLimit:Oy,lazyLoadMembers:!0}),r!==this.generation&&(c.stopClient(),this.client===c&&(this.client=null))})}resolveAccessToken(r,s){return k(this,null,function*(){let o=this.repo.getLocalItem(Gm),a=this.repo.getLocalItem(Ay);if(o&&a===r)return o;let l=this.repo.getCookieItem(Ji);if(!l)throw new Error("matrix login blocked: no behkhaan bearer token");let c=yield fetch(ln.MatrixLoginURL,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(l)},body:JSON.stringify({type:"m.login.password",user:r,password:r,initial_device_display_name:""})}),u=yield c.json().catch(()=>({}));if(!c.ok||!(u!=null&&u.access_token))throw new Error("matrix login failed: ".concat((u==null?void 0:u.errcode)||c.status," ").concat((u==null?void 0:u.error)||"").trim());return s===this.generation&&(this.repo.setLocalItem(Gm,u.access_token),this.repo.setLocalItem(Ay,r)),u.access_token})}resolveIdentity(r,s){return k(this,null,function*(){let o=this.sdk.createClient({baseUrl:ln.MatrixBaseUrl,accessToken:r});
3try{let a=yield o.whoami();return(a==null?void 0:a.user_id)||"@".concat(s).concat(nu)}catch(a){return(a==null?void 0:a.errcode)==="M_UNKNOWN_TOKEN"||(a==null?void 0:a.httpStatus)===401||(a==null?void 0:a.httpStatus)===403?null:"@".concat(s).concat(nu)}})}bindClientEvents(){let r=this.sdk,s=this.client,o=(l,c)=>{s.on(l,(...u)=>{this.client===s&&c(...u)})},a=(l,c)=>{o(l,(...u)=>{this.initialSyncPending||c(...u)})};o(r.ClientEvent.Sync,(l,c,u)=>{l==="PREPARED"?(this.refreshDirectRooms(),this.refreshHiddenMessages(),this.setConnection(tr.connected),this.retriedAuth=!1,this.endInitialSync(),this.readyResolve()):l==="SYNCING"?this.setConnection(tr.connected):l==="RECONNECTING"||l==="CATCHUP"?this.setConnection(tr.reconnecting):l==="ERROR"&&(this.setConnection(tr.reconnecting),this.handleAuthError(u==null?void 0:u.error))}),a(r.RoomEvent.Timeline,(l,c,u)=>{!c||u||l.status||this.onLiveEvent(l,c)}),a(r.RoomEvent.Redaction,(l,c)=>{var f,h;if(!c)return;let u=(f=l.event)==null?void 0:f.redacts;if(!u)return;let p=c.findEventById(u),m=(h=p==null?void 0:p.getContent())==null?void 0:h["m.relates_to"];(p==null?void 0:p.getType())==="m.reaction"&&(m!=null&&m.event_id)?this.emit({type:"message.reaction",chatId:c.roomId,messageId:m.event_id,reactions:this.buildReactions(c,m.event_id)}):this.emit({type:"message.deleted",chatId:c.roomId,messageId:u})}),a(r.RoomEvent.Receipt,(l,c)=>{var p,m;let u=l.getContent()||{};for(let[f,h]of Object.entries(u)){let _=(h==null?void 0:h["m.read"])||{};for(let[v,I]of Object.entries(_)){if(v===this.matrixUserId)continue;let N=(m=(p=c.findEventById(f))==null?void 0:p.getTs())!=null?m:I==null?void 0:I.ts;N&&this.emit({type:"receipt",chatId:c.roomId,userId:this.toLocalId(v),upToSentAt:new Date(N).toISOString(),kind:"seen"})}}}),a(r.RoomMemberEvent.Typing,(l,c)=>{this.emit({type:"typing",chatId:c.roomId,user:{id:this.toLocalId(c.userId),name:this.cleanName(c.name),hasPhoto:!1},isTyping:!!c.typing})}),o(r.UserEvent.Presence,(l,c)=>{let u={type:"presence",userId:this.toLocalId(c.userId),isOnline:c.presence==="online",lastSeenAt:c.lastActiveAgo?new Date(Date.now()-c.lastActiveAgo).toISOString():null};this.initialSyncPending?this.initialPresence.set(u.userId,u):this.emit(u)}),a(r.RoomEvent.Name,l=>{this.emitRoomState(l)}),a(r.ClientEvent.Room,l=>{this.emitRoomState(l)}),a(r.RoomEvent.MyMembership,(l,c,u)=>{c==="invite"?this.emit({type:"chat.invited",chat:this.toSummary(l)}):c==="join"?this.emit({type:"chat.updated",chat:this.toSummary(l)}):c==="leave"&&u!=="leave"&&this.emit({type:"chat.removed",chatId:l.roomId})}),o(r.ClientEvent.AccountData,l=>{var c,u;switch((c=l.getType)==null?void 0:c.call(l)){case"m.direct":this.refreshDirectRooms();break;case ky:this.refreshHiddenMessages();break;case"m.ignored_user_list":if(this.initialSyncPending)break;for(let p of((u=this.client)==null?void 0:u.getRooms())||[])this.membershipOf(p)==="join"&&this.isDirect(p)&&this.emitRoomState(p);break}})}endInitialSync(){if(this.initialSyncPending){this.initialSyncPending=!1;
3for(let r of this.initialPresence.values())this.emit(r);this.initialPresence.clear()}}emitRoomState(r){let s=this.membershipOf(r);s==="join"?this.emit({type:"chat.updated",chat:this.toSummary(r)}):s==="invite"?this.emit({type:"chat.invited",chat:this.toSummary(r)}):(s==="leave"||s==="ban")&&this.emit({type:"chat.removed",chatId:r.roomId})}handleAuthError(r){var o;if(!this.client||(r==null?void 0:r.errcode)!=="M_UNKNOWN_TOKEN"||this.retriedAuth)return;this.retriedAuth=!0,this.repo.removeLocalItem(Gm),(o=this.client)==null||o.stopClient(),this.client=null;let s=this.generation;this.initPromise=this.initialize(s).catch(()=>{s===this.generation&&(this.setConnection(tr.disconnected),this.initPromise=null)})}onLiveEvent(r,s){var l,c,u,p,m;let o=r.getType();if(o==="m.reaction"){let f=(c=(l=r.getContent())==null?void 0:l["m.relates_to"])==null?void 0:c.event_id;f&&this.emit({type:"message.reaction",chatId:s.roomId,messageId:f,reactions:this.buildReactions(s,f)});return}if(o==="m.room.member"){this.membershipNoteOf(r,s)&&this.emit({type:"message.new",message:this.toMessage(r,s)}),this.emitRoomState(s);return}if(o!=="m.room.message")return;let a=(u=r.getContent())==null?void 0:u["m.relates_to"];if((a==null?void 0:a.rel_type)==="m.replace"&&a.event_id){let f=(p=r.getContent())==null?void 0:p["m.new_content"];this.emit({type:"message.edited",chatId:s.roomId,messageId:a.event_id,body:(f==null?void 0:f.body)||((m=r.getContent())==null?void 0:m.body)||"",editedAt:new Date(r.getTs()).toISOString()});return}this.emit({type:"message.new",message:this.toMessage(r,s)})}listChats(){return new Nn(r=>{let s=!0;return this.ready.then(()=>k(this,null,function*(){let o=this.joinedRooms().filter(c=>this.needsMembers(c)),a=this.hydrateMembers(o),l=o.length===0||(yield this.settlesWithin(a,O5));if(s){if(r.next(this.buildChatPage()),!l){if(yield a,!s)return;r.next(this.buildChatPage())}r.complete()}})).catch(o=>{s&&r.error(o)}),()=>{s=!1}})}joinedRooms(){var r;return(((r=this.client)==null?void 0:r.getRooms())||[]).filter(s=>this.membershipOf(s)==="join")}buildChatPage(){let r=new Map;for(let o of this.joinedRooms())try{let a=this.toSummary(o);this.isRealConversation(o,a)&&r.set(a.id,a)}catch(a){console.warn("[matrix-chat] skipped unmappable room",o.roomId,a)}let s=this.dedupeDirectsByPeer([...r.values()]);return s.sort((o,a)=>a.lastActivityAt.localeCompare(o.lastActivityAt)),{items:s,nextCursor:null}}needsMembers(r){var s;if((s=r.membersLoaded)!=null&&s.call(r))return!1;if(this.isDirect(r)){let o=this.findPeer(r);return!o||!r.getMember(o.userId)}return!this.explicitRoomName(r)}settlesWithin(r,s){return new Promise(o=>{let a=this.zone.runOutsideAngular(()=>setTimeout(()=>o(!1),s));r.then(()=>{clearTimeout(a),o(!0)})})}joinedCountOf(r){var a,l;let s=r.getJoinedMembers().length;if(((a=r.membersLoaded)==null?void 0:a.call(r))!==!1)return s;let o=(l=r.getJoinedMemberCount)==null?void 0:l.call(r);return typeof o=="number"&&o>s?o:s}invitedCountOf(r){var a,l,c;let s=((a=r.getMembersWithMembership("invite"))==null?void 0:a.length)||0;if(((l=r.membersLoaded)==null?void 0:l.call(r))!==!1)return s;let o=(c=r.getInvitedMemberCount)==null?void 0:c.call(r);return typeof o=="number"&&o>s?o:s}isRealConversation(r,s){if(s.lastMessage||this.hasAnyMessage(r))return!0;if(s.kind!==Li.group)return!1;if(r.getJoinedMembers().filter(l=>l.userId!==this.matrixUserId).length>0||this.joinedCountOf(r)>1)return!0;let a=!!this.explicitRoomName(r).trim();return this.invitedCountOf(r)>0&&a}canonicalDirectRoom(r){return this.pickDirectRoom(r,s=>this.isPeerInTouch(s))}pickDirectRoom(r,s){var l;let o=null,a="";for(let c of((l=this.client)==null?void 0:l.getRooms())||[]){if(this.membershipOf(c)!=="join"||!this.isDirectWith(c,r)||!s(c))continue;let u=this.activityTimestampOf(c,this.lastMessageEvent(c),!1)+"|"+c.roomId;(!o||u>a)&&(o=c,a=u)}return o}isDirectWith(r,s){if(this.directRoomIdsFor(s).has(r.roomId))return!0;if(!this.isDirect(r))return!1;let o=this.findPeer(r);return!!o&&this.toLocalId(o.userId)===s}directRoomIdsFor(r){var s,o,a,l;try{let u=(((l=(a=(o=(s=this.client)==null?void 0:s.getAccountData)==null?void 0:o.call(s,"m.direct"))==null?void 0:a.getContent)==null?void 0:l.call(a))||{})[this.toMatrixId(r)]||[];return new Set(u)}catch{return new Set}}isPeerInTouch(r){let s=this.findPeer(r);if(!s)return!0;let o=this.peerMembershipOf(r,s);return o?o==="join"||o==="invite":!0}peerMembershipOf(r,s){var o;return((o=r.getMember(s.userId))==null?void 0:o.membership)||null}dedupeDirectsByPeer(r){let s=new Map,o=[];for(let a of r){if(a.kind!==Li.direct||!a.peerId){o.push(a);continue}let l=s.get(a.peerId);(!l||this.directRank(a)>this.directRank(l))&&s.set(a.peerId,a)}return[...o,...s.values()]}directRank(r){return(this.isFinished(r)?"0":"1")+"|"+r.lastActivityAt+"|"+r.id}isFinished(r){return r.sendBlock===Un.peerLeft||r.sendBlock===Un.requestDeclined||r.sendBlock===Un.notMember||r.sendBlock===Un.inviteDeclined}settleDirect(r){if(!this.isDirect(r))return this.toSummary(r);let s=this.findPeer(r);if(!s)return this.toSummary(r);let o=this.canonicalDirectRoom(this.toLocalId(s.userId));return this.toSummary(o||r)}isDirectInvite(r){var s;return this.directRoomIds.has(r.roomId)?!0:this.explicitRoomName(r)?!1:!!((s=r.getDMInviter)!=null&&s.call(r))}invitePeerOf(r){var a;let s=this.inviterOf(r);
3if(s!=null&&s.id)return s.id;let o=(a=r.getDMInviter)==null?void 0:a.call(r);return o?this.toLocalId(o):null}dropRedundantInvite(r){return k(this,null,function*(){try{yield this.client.leave(r)}catch(s){console.warn("[matrix-chat] could not decline the redundant invite",r,s)}yield this.forgetRoom(r),this.emit({type:"chat.removed",chatId:r})})}membershipOf(r){var s;return((s=r.getMyMembership)==null?void 0:s.call(r))||r.selfMembership||""}hydrateMembers(r){return k(this,null,function*(){let s=[...r],o=()=>k(null,null,function*(){var a;for(let l=s.shift();l;l=s.shift())try{yield(a=l.loadMembersIfNeeded)==null?void 0:a.call(l)}catch{}});yield Promise.all(Array.from({length:Math.min(R5,s.length)},o))})}listInvites(){return Ce(this.ready.then(()=>k(this,null,function*(){var a;let r=(((a=this.client)==null?void 0:a.getRooms())||[]).filter(l=>this.membershipOf(l)==="invite"),s=[];for(let l of r)try{s.push(this.toSummary(l))}catch(c){console.warn("[matrix-chat] skipped unmappable invite",l.roomId,c)}let o=s.sort((l,c)=>c.lastActivityAt.localeCompare(l.lastActivityAt));return this.dedupeInvitesByPeer(o)})))}dedupeInvitesByPeer(r){let s=new Set;return r.filter(o=>{var l;let a=o.peerId||((l=o.invitedBy)==null?void 0:l.id);return o.kind!==Li.direct||!a?!0:s.has(a)?!1:(s.add(a),!0)})}withdrawPendingInvitation(r){return Ce(this.ready.then(()=>k(this,null,function*(){var l;let s=(l=this.client)==null?void 0:l.getRoom(r);if(!s||s.getJoinedMembers().filter(c=>c.userId!==this.matrixUserId).length>0)return!1;let a=s.getMembersWithMembership("invite")||[];if(a.length===0)return!1;for(let c of a)try{yield this.client.kick(r,c.userId)}catch(u){console.warn("[matrix-chat] could not withdraw invitation",r,c.userId,u)}return yield this.forgetRoom(r),this.emit({type:"chat.removed",chatId:r}),!0})))}acceptInvite(r){return Ce(this.ready.then(()=>k(this,null,function*(){var l,c;let s=this.client,o=s.getRoom(r);if(o&&this.membershipOf(o)==="join")return this.settleDirect(o);let a=o&&this.isDirectInvite(o)?this.invitePeerOf(o):null;if(a){let u=this.canonicalDirectRoom(a);if(u&&u.roomId!==r)return yield this.dropRedundantInvite(r),this.toSummary(u)}try{let u=this.viaServersFor(r,o),p=yield s.joinRoom(r,{viaServers:u}),m=(p==null?void 0:p.roomId)||r,f=(yield this.awaitJoinedRoom(m))||s.getRoom(m)||p;if(!(f!=null&&f.roomId))throw new Error("joined room not available");yield this.hydrateMembers([f]),yield this.fillInitialHistory(f);let h=(l=f.getDMInviter)==null?void 0:l.call(f);return h&&this.rememberDirectRoom(f.roomId,this.toLocalId(h)),this.settleDirect(f)}catch(u){if(this.isDeadRoomError(u))throw yield this.forgetRoom(r),new Error(EE);let p=(u==null?void 0:u.errcode)||((c=u==null?void 0:u.data)==null?void 0:c.errcode)||(u==null?void 0:u.message)||"unknown";throw console.error("[matrix-chat] joinRoom failed",r,p,u),new Error(p)}})))}isDeadRoomError(r){var l,c;let s=(r==null?void 0:r.httpStatus)||(r==null?void 0:r.status),o=(r==null?void 0:r.errcode)||((l=r==null?void 0:r.data)==null?void 0:l.errcode)||"",a=((c=r==null?void 0:r.data)==null?void 0:c.error)||(r==null?void 0:r.message)||"";return o==="M_NOT_FOUND"?!0:s===404&&/no servers that are in the room/i.test(a)}forgetRoom(r){return k(this,null,function*(){try{yield this.client.leave(r)}catch{}try{yield this.client.forget(r)}catch{}})}awaitJoinedRoom(r){return k(this,null,function*(){var s,o;for(let a=0;a<10;a++){let l=(s=this.client)==null?void 0:s.getRoom(r);if(l&&this.membershipOf(l)==="join")return l;yield new Promise(c=>setTimeout(c,200))}return((o=this.client)==null?void 0:o.getRoom(r))||null})}fillInitialHistory(r){return k(this,null,function*(){for(let s=0;s<k5;s++){if(this.messageEventsOf(r).length>0||r.getLiveTimeline().getPaginationToken(this.sdk.Direction.Backward)===null)return;try{yield this.client.scrollback(r,Oy)}catch(o){console.warn("[matrix-chat] initial history pagination failed",r.roomId,o);return}}})}messageEventsOf(r){return(r.getLiveTimeline().getEvents()||[]).filter(s=>s.getType()==="m.room.message"&&!this.isEditEvent(s))}timelineEventsOf(r){return(r.getLiveTimeline().getEvents()||[]).filter(s=>s.getType()==="m.room.message"?!this.isEditEvent(s):this.membershipNoteOf(s,r)!==null)}viaServersFor(r,s){var c,u,p;let o=new Set,a=r.split(":")[1];a&&o.add(a);try{let m=(u=(c=s==null?void 0:s.currentState)==null?void 0:c.getStateEvents)==null?void 0:u.call(c,"m.room.member",this.matrixUserId),f=(p=m==null?void 0:m.getSender())==null?void 0:p.split(":")[1];f&&o.add(f)}catch{}let l=this.matrixUserId.split(":")[1];return l&&o.add(l),[...o]}declineInvite(r){return Ce(this.ready.then(()=>k(this,null,function*(){yield this.forgetRoom(r)})))}getChatDetails(r){return Ce(this.ready.then(()=>k(this,null,function*(){var p,m,f,h;let s=(p=this.client)==null?void 0:p.getRoom(r);if(!s)throw new Error("room not found");yield this.hydrateMembers([s]);let o=_=>({id:this.toLocalId(_.userId),name:this.cleanName(_.name),hasPhoto:!0,role:_.powerLevel>=100?Cp.owner:_.powerLevel>=50?Cp.admin:Cp.member}),a=_=>(s.getMembersWithMembership(_)||[]).map(o),l=(f=(m=s.currentState)==null?void 0:m.getStateEvents)==null?void 0:f.call(m,"m.room.create",""),c=this.toSummary(s),u=s.getMember(this.matrixUserId);return{id:s.roomId,kind:c.kind,title:c.title,hasAvatar:c.hasAvatar,avatarUrl:c.avatarUrl,createdAt:l?new Date(l.getTs()).toISOString():"",members:s.getJoinedMembers().map(o),invitedMembers:a("invite"),bannedMembers:a("ban"),canModerate:((h=u==null?void 0:u.powerLevel)!=null?h:0)>=50}})))}getMessages(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){var m;let o=(m=this.client)==null?void 0:m.getRoom(r);if(!o)throw new Error("room not found");s?yield this.client.scrollback(o,Oy):yield this.fillInitialHistory(o);let a=o.getLiveTimeline(),l=this.hiddenMessages.get(r),c=this.reactionIndexOf(o),u=this.timelineEventsOf(o).filter(f=>!(l!=null&&l.has(f.getId()||""))).map(f=>this.toMessage(f,o,c));this.applyReadReceipts(o,u);let p=a.getPaginationToken(this.sdk.Direction.Backward);return{items:u,nextCursor:p||null}})))}sendMessage(r){return Ce(this.ready.then(()=>k(this,null,function*(){var p,m,f;let s=((p=this.client)==null?void 0:p.getRoom(r.chatId))||(yield this.awaitJoinedRoom(r.chatId));if(s&&this.sendBlockOf(s,this.isDirect(s),this.findPeer(s))!==Un.none)throw new Error(TE);this.releaseStuckSends(s);let o=this.buildContent(r,s||null),a=Date.now(),l=yield this.client.sendEvent(r.chatId,"m.room.message",o,this.nextTxnId(r.clientId)),c=r.replyToId&&s?this.toRef(s,r.replyToId):null,u={id:l.event_id,clientId:r.clientId,chatId:r.chatId,senderId:this.toLocalId(this.matrixUserId),senderName:((m=this.userState.userDataSnapshot)==null?void 0:m.firstName)||"\u0645\u0646",kind:r.kind,body:r.body,imageUrl:r.imageUrl,replyTo:c,reactions:[],sentAt:this.toIso(((f=s==null?void 0:s.findEventById(l.event_id))==null?void 0:f.getTs())||a),editedAt:null,isDeleted:!1,status:wl.sent};return s&&this.applyReadReceipts(s,[u]),u})))}releaseStuckSends(r){var o,a,l,c,u;if(!r||!this.client)return;let s=[];try{s=((o=r.getPendingEvents)==null?void 0:o.call(r))||[]}catch{s=((c=(l=(a=r.getLiveTimeline)==null?void 0:a.call(r))==null?void 0:l.getEvents)==null?void 0:c.call(l))||[]}for(let p of s)if(p.status==="not_sent")try{this.client.cancelPendingEvent(p)}catch(m){console.warn("[matrix-chat] could not clear a stuck pen
3ding send",(u=p.getTxnId)==null?void 0:u.call(p),m)}}nextTxnId(r){return"".concat(r,"~").concat(++this.txnAttempt)}clientIdOf(r){var a;let s=(a=r.getTxnId)==null?void 0:a.call(r);if(!s)return;let o=s.indexOf("~");return o>0?s.slice(0,o):s}buildContent(r,s){var a;if(r.kind===ts.image&&r.imageUrl){let l=this.uploadedMedia.get(r.imageUrl);return{msgtype:"m.image",body:"\u062A\u0635\u0648\u06CC\u0631",url:(l==null?void 0:l.mxc)||r.imageUrl,info:{mimetype:l==null?void 0:l.mimeType}}}let o={msgtype:"m.text",body:r.body};if(r.replyToId){let l=s==null?void 0:s.findEventById(r.replyToId),c=((a=l==null?void 0:l.getContent())==null?void 0:a.body)||"",u=(l==null?void 0:l.getSender())||"";o.body="> <".concat(u,"> ").concat(c,"\n\n").concat(r.body),o["m.relates_to"]={"m.in_reply_to":{event_id:r.replyToId}}}return o}editMessage(r,s,o){return Ce(this.ready.then(()=>k(this,null,function*(){var u,p;let a=(u=this.client.getRoom(r))==null?void 0:u.findEventById(s),l=(p=a==null?void 0:a.getTs)==null?void 0:p.call(a);if(typeof l=="number"&&!AE(new Date(l).toISOString()))throw new Error(xE);let c={msgtype:"m.text",body:"* ".concat(o),"m.new_content":{msgtype:"m.text",body:o},"m.relates_to":{rel_type:"m.replace",event_id:s}};yield this.client.sendEvent(r,"m.room.message",c,void 0)})))}deleteMessage(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){let o=this.hiddenMessages.get(r)||new Set;o.has(s)||(o.add(s),this.hiddenMessages.set(r,o),yield this.persistHiddenMessages())})))}hiddenMessageIds(r){return Ce(this.ready.then(()=>[...this.hiddenMessages.get(r)||[]]))}refreshHiddenMessages(){var r,s,o,a;try{let l=((a=(o=(s=(r=this.client)==null?void 0:r.getAccountData)==null?void 0:s.call(r,ky))==null?void 0:o.getContent)==null?void 0:a.call(o))||{},c=new Map;for(let[u,p]of Object.entries(l))c.set(u,new Set(p||[]));this.hiddenMessages=c}catch{}}persistHiddenMessages(){return k(this,null,function*(){let r={};for(let[s,o]of this.hiddenMessages)o.size&&(r[s]=[...o]);yield this.client.setAccountData(ky,r)})}toggleReaction(r,s,o){return Ce(this.ready.then(()=>k(this,null,function*(){let a=this.client.getRoom(r),l=a?this.myReactionEvents(a,s):[],c=l.find(m=>{var f,h;return((h=(f=m.getContent())==null?void 0:f["m.relates_to"])==null?void 0:h.key)===o}),u=c?[c]:l,p=[];for(let m of u){let f=m.getId();f&&(yield this.client.redactEvent(r,f),p.push(f))}if(!c){let m={"m.relates_to":{rel_type:"m.annotation",event_id:s,key:o}};yield this.client.sendEvent(r,"m.reaction",m,void 0)}a&&this.emit({type:"message.reaction",chatId:r,messageId:s,reactions:this.buildReactions(a,s,p)})})))}markSeen(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){let o=this.client.getRoom(r),a=o==null?void 0:o.findEventById(s);a&&(yield this.client.sendReadReceipt(a,this.sdk.ReceiptType.Read))})))}setTyping(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){yield this.client.sendTyping(r,s,A5)})))}createDirectChat(r){return Ce(this.ready.then(()=>k(this,null,function*(){let s=this.canonicalDirectRoom(r);if(s)return this.toSummary(s);let o=yield this.client.createRoom({invite:[this.toMatrixId(r)],is_direct:!0,preset:this.sdk.Preset.PrivateChat,visibility:this.sdk.Visibility.Private});this.rememberDirectRoom(o.room_id,r);let a=(yield this.awaitJoinedRoom(o.room_id))||this.client.getRoom(o.room_id);return a?D(g({},this.toSummary(a)),{kind:Li.direct,peerId:r}):{id:o.room_id,kind:Li.direct,title:"\u06AF\u0641\u062A\u200C\u0648\u06AF\u0648\u06CC \u062C\u062F\u06CC\u062F",hasAvatar:!1,peerId:r,lastMessage:null,unreadCount:0,isMuted:!1,isPinned:!1,lastActivityAt:new Date().toISOString()}})))}createGroupChat(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){let o=yield this.client.createRoom({name:r,invite:s.map(l=>this.toMatrixId(l)),is_direct:!1,preset:this.sdk.Preset.PrivateChat,visibility:this.sdk.Visibility.Private});yield this.setRoomNotificationsEnabled(o.room_id);let a=this.client.getRoom(o.room_id);return a?D(g({},this.toSummary(a)),{kind:Li.group,title:r}):{id:o.room_id,kind:Li.group,title:r,hasAvatar:!1,memberCount:s.length+1,lastMessage:null,unreadCount:0,isMuted:!1,isPinned:!1,lastActivityAt:new Date().toISOString()}})))}addMembers(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){for(let o of s)yield this.client.invite(r,this.toMatrixId(o))})))}removeMember(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){yield this.client.kick(r,this.toMatrixId(s))})))}renameChat(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){yield this.client.setRoomName(r,s)})))}leaveChat(r){return Ce(this.ready.then(()=>k(this,null,function*(){let s=[];for(let o of yield this.endedRoomsFor(r)){let a=!0;try{yield this.leaveWithRateLimit(o)}catch(l){a=!this.isStillJoined(o),console.warn("[matrix-chat] leave rejected",o,a?"(already out)":"(still joined)",l)}if(!a){s.push(o);continue}try{yield this.client.forget(o)}catch{}
3o!==r&&this.emit({type:"chat.removed",chatId:o})}if(s.length>0)throw new Error(IE)})))}leaveWithRateLimit(r,s=0){return k(this,null,function*(){var o,a;try{yield this.client.leave(r)}catch(l){if(!(((l==null?void 0:l.errcode)||((o=l==null?void 0:l.data)==null?void 0:o.errcode))==="M_LIMIT_EXCEEDED"||(l==null?void 0:l.httpStatus)===429)||s>=2)throw l;let p=Number((a=l==null?void 0:l.data)==null?void 0:a.retry_after_ms)||1e3*(s+1);yield new Promise(m=>setTimeout(m,Math.min(p,5e3))),yield this.leaveWithRateLimit(r,s+1)}})}isStillJoined(r){var o;let s=(o=this.client)==null?void 0:o.getRoom(r);return!!s&&this.membershipOf(s)==="join"}endedRoomsFor(r){return k(this,null,function*(){var p,m;let s=(p=this.client)==null?void 0:p.getRoom(r);if(!s)return[r];if(yield this.hydrateMembers([s]),!this.isDirect(s))return[r];let o=this.findPeer(s),a=o?this.toLocalId(o.userId):null;if(!a)return[r];let l=(((m=this.client)==null?void 0:m.getRooms())||[]).filter(f=>f.roomId!==r&&this.membershipOf(f)==="join"),c=yield this.serverDirectRoomIds(a);yield this.hydrateMembers(l.filter(f=>!c.has(f.roomId)&&this.needsMembers(f)));let u=l.filter(f=>c.has(f.roomId)||this.isDirectWith(f,a));return[r,...u.map(f=>f.roomId)]})}serverDirectRoomIds(r){return k(this,null,function*(){var s,o;try{let a=yield(o=(s=this.client)==null?void 0:s.getAccountDataFromServer)==null?void 0:o.call(s,"m.direct");return new Set((a==null?void 0:a[this.toMatrixId(r)])||[])}catch{return this.directRoomIdsFor(r)}})}setRoomNotificationsEnabled(r){return k(this,null,function*(){var s,o;try{yield(o=(s=this.client).setRoomMutePushRule)==null?void 0:o.call(s,"global",r,!1)}catch{}})}setMuted(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){yield this.client.setRoomMutePushRule("global",r,s)})))}setPinned(){return Ce(Promise.reject(new Error("pinning is not implemented for the matrix transport")))}setChatAvatar(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){let o=yield this.client.uploadContent(s);yield this.client.sendStateEvent(r,"m.room.avatar",{url:o.content_uri},"")})))}banMember(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){yield this.client.ban(r,this.toMatrixId(s))})))}unbanMember(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){yield this.client.unban(r,this.toMatrixId(s))})))}setUserBlocked(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){let o=this.toMatrixId(r),a=this.client.getIgnoredUsers()||[],l=s?Array.from(new Set([...a,o])):a.filter(c=>c!==o);yield this.client.setIgnoredUsers(l)})))}isUserBlocked(r){return Ce(this.ready.then(()=>this.client.isUserIgnored(this.toMatrixId(r))))}getClubLinks(r){return Ce(this.ready.then(()=>k(this,null,function*(){var a;let s=((a=this.client)==null?void 0:a.getRoom(r))||(yield this.awaitJoinedRoom(r)),o=this.readClubLinks(s);return o.length?o:this.readClubLinksFromAliases(r)})))}readClubLinksFromAliases(r){return k(this,null,function*(){try{let s=yield this.client.getLocalAliases(r);return((s==null?void 0:s.aliases)||[]).map(o=>this.clubIdFromAlias(o)).filter(Boolean).map(o=>({clubId:o,clubName:"",linkedAt:null}))}catch{return[]}})}clubIdFromAlias(r){let s=/^#behkhaan-club-(.+?):/.exec(r||"");return(s==null?void 0:s[1])||""}toClubLink(r,s){let o=r==null?void 0:r.clubId;if(typeof o!="string"||!o)return null;let a=r==null?void 0:r.linkedAt;return{clubId:o,clubName:typeof(r==null?void 0:r.clubName)=="string"?r.clubName:"",linkedAt:typeof a=="string"&&a||(s&&Number.isFinite(s)&&s>0?new Date(s).toISOString():null)}}setClubLink(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){yield this.writeClubLink(r,{clubId:s.clubId,clubName:s.clubName,linkedAt:new Date().toISOString()},s.clubId),yield this.releaseClubFromOtherRooms(s.clubId,r),yield this.pointClubAliasAt(s.clubId,r)})))}claimingRooms(r){var s,o;return(((o=(s=this.client)==null?void 0:s.getRooms)==null?void 0:o.call(s))||[]).filter(a=>{var l;return((l=a.getMyMembership)==null?void 0:l.call(a))==="join"&&this.readClubLinks(a).some(c=>c.clubId===r)}).sort((a,l)=>a.roomId.localeCompare(l.roomId))}releaseClubFromOtherRooms(r,s){return k(this,null,function*(){for(let o of this.claimingRooms(r))if(o.roomId!==s)try{yield this.releaseClubFrom(o.roomId,r)}catch(a){console.warn("[matrix-chat] previous group not released from club",r,o.roomId,a)}})}releaseClubFrom(r,s){return k(this,null,function*(){var a;yield this.writeClubLink(r,{},s);let o=this.readClubLinkAt((a=this.client)==null?void 0:a.getRoom(r),"");(o==null?void 0:o.clubId)===s&&(yield this.writeClubLink(r,{},""))})}clearClubLink(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){yield this.releaseClubFrom(r,s),yield this.releaseClubFromOtherRooms(s,r),yield this.dropClubAlias(s)})))}findGroupLinkedToClub(r){return Ce(this.ready.then(()=>k(this,null,function*(){let s=this.claimingRooms(r),o=s.length>1?yield this.roomClaimedByAlias(r,s):s[0];return o?(this.ensureClubAlias(r,o.roomId),this.ensurePublicJoinRule(o),yield this.hydrateMembers([o]),this.toSummary(o)):this.resolveClubAlias(r)})))}roomClaimedByAlias(r,s){return k(this,null,function*(){try{let o=yield this.client.getRoomIdForAlias(this.clubAlias(r)),a=s.find(l=>l.roomId===(o==null?void 0:o.room_id));if(a)return a}catch{}return s[0]})}ensurePublicJoinRule(r){return k(this,null,function*(){var s,o,a;try{if(((s=r.getJoinRule)==null?void 0:s.call(r))==="public")return;let l=this.matrixUserId;if(!l||!((a=(o=r.currentState)==null?void 0:o.maySendStateEvent)!=null&&a.call(o,"m.room.join_rules",l)))return;yield this.client.sendStateEvent(r.roomId,"m.room.join_rules",{join_rule:"public"},"")}catch(l){console.warn("[matrix-chat] club group could not be opened to club members",r.roomId,l)}})}clubAlias(r){return"#behkhaan-club-".concat(r).concat(nu)}pointClubAliasAt(r,s){return k(this,null,function*(){let o=this.clubAlias(r);try{yield this.client.deleteAlias(o).catch(()=>{}),yield this.client.createAlias(o,s)}catch(a){console.warn("[matrix-chat] club alias not published",o,a)}})}ensureClubAlias(r,s){return k(this,null,function*(){try{let o=yield this.client.getRoomIdForAlias(this.clubAlias(r));if((o==null?void 0:o.room_id)===s)return}catch{}yield this.pointClubAliasAt(r,s)})}dropClubAlias(r){return k(this,null,function*(){try{yield this.client.deleteAlias(this.clubAlias(r))}catch{}})}resolveClubAlias(r){return k(this,null,function*(){var s,o;try{let a=yield this.client.getRoomIdForAlias(this.clubAlias(r)),l=a==null?void 0:a.room_id;if(!l)return null;
3let c=(s=this.client)==null?void 0:s.getRoom(l);if(c&&this.membershipOf(c)==="join")return yield this.hydrateMembers([c]),this.toSummary(c);let u=yield this.roomSummaryOf(l);if(!u)return null;let p=u.avatar_url;return{id:l,kind:Li.group,title:u.name||"\u06AF\u0631\u0648\u0647 \u06AF\u0641\u062A\u200C\u0648\u06AF\u0648",hasAvatar:!!p,avatarUrl:p&&((o=this.client)==null?void 0:o.mxcUrlToHttp(p))||void 0,memberCount:u.num_joined_members,lastMessage:null,unreadCount:0,isMuted:!1,isPinned:!1,lastActivityAt:new Date().toISOString(),sendBlock:Un.notMember}}catch{return null}})}roomSummaryOf(r){return k(this,null,function*(){return(yield this.roomSummaryResultOf(r)).summary})}roomSummaryResultOf(r){return k(this,null,function*(){var s,o;try{return{summary:(yield(o=(s=this.client)==null?void 0:s.getRoomSummary)==null?void 0:o.call(s,r,this.viaServersFor(r,null)))||null,missing:!1}}catch(a){return{summary:null,missing:(a==null?void 0:a.errcode)==="M_NOT_FOUND"||(a==null?void 0:a.httpStatus)===404}}})}getGroupPreview(r){return Ce(this.ready.then(()=>k(this,null,function*(){var a;let s=(a=this.client)==null?void 0:a.getRoom(r),o=s?this.membershipOf(s):"";if(s&&o==="join"){yield this.hydrateMembers([s]);let l=this.toSummary(s);return{id:r,title:l.title,avatarUrl:l.avatarUrl,memberCount:l.memberCount,isMember:!0,isInvited:!1,isPublic:(yield this.readJoinRule(r))==="public",exists:!0}}if(s&&o==="invite"){let l=this.toSummary(s);return{id:r,title:l.title,avatarUrl:l.avatarUrl,memberCount:void 0,isMember:!1,isInvited:!0,isPublic:!1,exists:!0}}return this.summariseFromServer(r)})))}summariseFromServer(r){return k(this,null,function*(){var o;let s={id:r,title:"",isMember:!1,isInvited:!1,isPublic:!1};try{let{summary:a}=yield this.roomSummaryResultOf(r);if(!a)return s;let l=a==null?void 0:a.avatar_url;return{id:r,title:(a==null?void 0:a.name)||"",avatarUrl:l&&((o=this.client)==null?void 0:o.mxcUrlToHttp(l))||void 0,memberCount:a==null?void 0:a.num_joined_members,isMember:(a==null?void 0:a.membership)==="join",isInvited:(a==null?void 0:a.membership)==="invite",isPublic:(a==null?void 0:a.join_rule)==="public",exists:!0}}catch{return s}})}readJoinRule(r){return k(this,null,function*(){try{let s=yield this.client.getStateEvent(r,"m.room.join_rules","");return(s==null?void 0:s.join_rule)||""}catch{return""}})}readClubLinks(r){var l,c;let s=((c=(l=r==null?void 0:r.currentState)==null?void 0:l.getStateEvents)==null?void 0:c.call(l,Ry))||[],o=(Array.isArray(s)?s:[s]).map(u=>{var p,m;return this.toClubLink((p=u==null?void 0:u.getContent)==null?void 0:p.call(u),(m=u==null?void 0:u.getTs)==null?void 0:m.call(u))}).filter(u=>!!u),a=new Set;return o.filter(u=>!a.has(u.clubId)&&a.add(u.clubId))}readClubLinkAt(r,s){var a,l,c,u;let o=(l=(a=r==null?void 0:r.currentState)==null?void 0:a.getStateEvents)==null?void 0:l.call(a,Ry,s);return this.toClubLink((c=o==null?void 0:o.getContent)==null?void 0:c.call(o),(u=o==null?void 0:o.getTs)==null?void 0:u.call(o))}writeClubLink(r,s,o){return k(this,null,function*(){try{yield this.client.sendStateEvent(r,Ry,s,o)}catch(a){throw new Error(this.isForbiddenError(a)?ch:this.reasonOf(a))}})}getGroupVisibility(r){return Ce(this.ready.then(()=>k(this,null,function*(){var l,c,u,p,m;let s=((l=this.client)==null?void 0:l.getRoom(r))||(yield this.awaitJoinedRoom(r)),o=(u=(c=s==null?void 0:s.currentState)==null?void 0:c.getStateEvents)==null?void 0:u.call(c,"m.room.join_rules","");return((m=(p=o==null?void 0:o.getContent)==null?void 0:p.call(o))==null?void 0:m.join_rule)==="public"?wp.public:wp.private})))}setGroupVisibility(r,s){return Ce(this.ready.then(()=>k(this,null,function*(){let o=s===wp.public?"public":"invite";try{yield this.client.sendStateEvent(r,"m.room.join_rules",{join_rule:o},"")}catch(a){throw new Error(this.isForbiddenError(a)?ch:this.reasonOf(a))}})))}joinGroup(r){return Ce(this.ready.then(()=>k(this,null,function*(){var a;let s=this.client,o=s.getRoom(r);if(((a=o==null?void 0:o.getMyMembership)==null?void 0:a.call(o))==="join")return this.toSummary(o);try{let l=this.viaServersFor(r,o),c=yield s.joinRoom(r,{viaServers:l}),u=(c==null?void 0:c.roomId)||r,p=(yield this.awaitJoinedRoom(u))||s.getRoom(u)||c;if(!(p!=null&&p.roomId))throw new Error("joined room not available");return yield this.hydrateMembers([p]),yield this.fillInitialHistory(p),this.toSummary(p)}catch(l){throw this.isForbiddenError(l)?new Error(CE):this.isDeadRoomError(l)?new Error(wE):new Error(this.reasonOf(l))}})))}isForbiddenError(r){var o;return((r==null?void 0:r.errcode)||((o=r==null?void 0:r.data)==null?void 0:o.errcode))==="M_FORBIDDEN"||(r==null?void 0:r.httpStatus)===403}reasonOf(r){var s;return(r==null?void 0:r.errcode)||((s=r==null?void 0:r.data)==null?void 0:s.errcode)||(r==null?void 0:r.message)||"unknown"}searchUsers(r){let s=new yp(0,15);return s.searchTerm=r,this.searchService.searchSuggesstion(s,BS.User).pipe(De(o=>{var l,c;return(((c=(l=o==null?void 0:o.result)==null?void 0:l.customers)==null?void 0:c.items)||[]).map(u=>({id:u.id||"",name:(u.firstName||"").trim()||u.uniqeName||"",userName:u.uniqeName,hasPhoto:!!u.hasPhoto}))}
3))}listChatImages(r){return Ce(this.ready.then(()=>{var l,c,u,p,m;let s=(l=this.client)==null?void 0:l.getRoom(r);if(!s)return[];let o=((p=(u=(c=s.getLiveTimeline)==null?void 0:c.call(s))==null?void 0:u.getEvents)==null?void 0:p.call(u))||[],a=[];for(let f of o){let h=f.getContent();if(f.getType()==="m.room.message"&&(h==null?void 0:h.msgtype)==="m.image"&&h.url&&!f.isRedacted()){let _=(m=this.client)==null?void 0:m.mxcUrlToHttp(h.url);_&&a.push(_)}}return a.reverse()}))}uploadImage(r,s){return Ce(this.uploadMedia(s,s.type))}uploadMedia(r,s){return k(this,null,function*(){yield this.ready;let a=(yield this.client.uploadContent(r)).content_uri,l=this.client.mxcUrlToHttp(a)||a;return this.uploadedMedia.set(l,{mxc:a,mimeType:s}),l})}isDirect(r){var l,c;if(this.explicitRoomName(r))return!1;if(this.directRoomIds.has(r.roomId))return!0;let s=(l=r.getDMInviter)==null?void 0:l.call(r);if(s)return this.rememberDirectRoom(r.roomId,this.toLocalId(s)),!0;let o=(c=r.getInvitedAndJoinedMemberCount)==null?void 0:c.call(r),a=typeof o=="number"&&o>0?o:r.getMembers().length;if(r.getJoinRule()==="invite"&&a===2){let u=this.findPeer(r);return u&&this.rememberDirectRoom(r.roomId,this.toLocalId(u.userId)),!0}return this.everHadAtMostTwoMembers(r)}everHadAtMostTwoMembers(r){var a,l,c,u;let s=(a=r.getInvitedAndJoinedMemberCount)==null?void 0:a.call(r);if(typeof s=="number"&&s>2)return!1;let o=new Set;try{for(let p of r.getMembers()||[])p!=null&&p.userId&&o.add(p.userId)}catch{}try{let p=(c=(l=r.currentState)==null?void 0:l.getStateEvents)==null?void 0:c.call(l,"m.room.member"),m=Array.isArray(p)?p:p?[p]:[];for(let f of m){let h=(u=f==null?void 0:f.getStateKey)==null?void 0:u.call(f);h&&o.add(h)}}catch{}return o.size<=2}refreshDirectRooms(){var r,s,o,a;try{let l=((a=(o=(s=(r=this.client)==null?void 0:r.getAccountData)==null?void 0:s.call(r,"m.direct"))==null?void 0:o.getContent)==null?void 0:a.call(o))||{},c=new Set;for(let u of Object.values(l))for(let p of u||[])c.add(p);this.directRoomIds=c}catch{}}rememberDirectRoom(r,s){var a,l,c;if(this.directRoomIds.has(r))return;this.directRoomIds.add(r);let o=this.client;if(!(!o||!s))try{let u=this.toMatrixId(s),p=((c=(l=(a=o.getAccountData)==null?void 0:a.call(o,"m.direct"))==null?void 0:l.getContent)==null?void 0:c.call(l))||{},m=p[u]||[];if(m.includes(r))return;o.setAccountData("m.direct",D(g({},p),{[u]:[...m,r]})).catch(()=>{})}catch{}}sdkRoomName(r){let s=r.name||"";return s.startsWith("Empty room")?"":s}explicitRoomName(r){var s,o,a,l;try{let c=(o=(s=r.currentState)==null?void 0:s.getStateEvents)==null?void 0:o.call(s,"m.room.name","");return((l=(a=c==null?void 0:c.getContent)==null?void 0:a.call(c))==null?void 0:l.name)||""}catch{return""}}inviterOf(r){var s,o;try{let a=(o=(s=r.currentState)==null?void 0:s.getStateEvents)==null?void 0:o.call(s,"m.room.member",this.matrixUserId),l=a==null?void 0:a.getSender();if(!l||l===this.matrixUserId)return null;let c=r.getMember(l);return{id:this.toLocalId(l),name:this.cleanName((c==null?void 0:c.name)||l),hasPhoto:!0}}catch{return null}}findPeer(r){var a,l,c;let s=r.getMembers().find(u=>u.userId!==this.matrixUserId);if(s)return s;try{let p=(((l=(a=r.currentState)==null?void 0:a.getStateEvents)==null?void 0:l.call(a,"m.room.member"))||[]).map(m=>{var f;return(f=m.getStateKey)==null?void 0:f.call(m)}).find(m=>!!m&&m!==this.matrixUserId);if(p)return r.getMember(p)||{userId:p,name:p}}catch{}let o=(c=r.guessDMUserId)==null?void 0:c.call(r);return o&&o!==this.matrixUserId?r.getMember(o)||{userId:o,name:o}:void 0}toSummary(r){var p,m,f;let s=this.membershipOf(r)==="invite",o=this.isDirect(r),a=o?this.findPeer(r):void 0,l=this.lastMessageEvent(r),c=(p=r.getMxcAvatarUrl)==null?void 0:p.call(r),u=s?this.inviterOf(r):null;return{id:r.roomId,kind:o?Li.direct:Li.group,title:this.cleanName((o?(a==null?void 0:a.name)||this.sdkRoomName(r):this.explicitRoomName(r)||this.sdkRoomName(r))||"").trim()||(o?"\u06A9\u0627\u0631\u0628\u0631 \u0628\u0647\u062E\u0648\u0627\u0646":"\u06AF\u0631\u0648\u0647"),hasAvatar:o?!!a:!!c,avatarUrl:!o&&c&&((m=this.client)==null?void 0:m.mxcUrlToHttp(c))||void 0,peerId:a?this.toLocalId(a.userId):void 0,peerUserName:void 0,isInvite:s||void 0,invitedBy:u,sendBlock:this.sendBlockOf(r,o,a),memberCount:o?void 0:this.joinedCountOf(r),lastMessage:l?{body:this.previewOf(l),kind:this.kindOf(l),senderId:this.toLocalId(l.getSender()||""),senderName:this.cleanName(((f=r.getMember(l.getSender()||""))==null?void 0:f.name)||""),sentAt:this.toIso(l.getTs()),isDeleted:l.isRedacted()}:null,unreadCount:r.getUnreadNotificationCount()||0,isMuted:this.isRoomMuted(r.roomId),isPinned:!1,lastActivityAt:this.activityTimestampOf(r,l,s)}}sendBlockOf(r,s,o){let a=this.membershipOf(r);if(a==="leave"||a==="ban")return this.wasInvited(r)?Un.inviteDeclined:Un.notMember;if(a!=="join")return Un.notMember;if(s&&o&&this.isIgnored(o.userId))return Un.blockedPeer;if(s&&o){let l=this.peerMembershipOf(r,o);if(l==="leave"||l==="ban")return this.previousMembershipOf(r,o.userId)==="invite"?Un.requestDeclined:Un.peerLeft}return Un.none}wasInvited(r){return this.previousMembershipOf(r,this.matrixUserId)==="invite"}previousMembershipOf(r,s){var o,a,l,c;try{let u=(a=(o=r.currentState)==null?void 0:o.getStateEvents)==null?void 0:a.call(o,"m.room.member",s);return((c=(l=u==null?void 0:u.getPrevContent)==null?void 0:l.call(u))==null?void 0:c.membership)||null}catch{return null}}isIgnored(r){var s,o;try{return(((o=(s=this.client)==null?void 0:s.getIgnoredUsers)==null?void 0:o.call(s))||[]).includes(r)}catch{return!1}}isRoomMuted(r){var s,o,a,l;try{let c=(o=(s=this.client)==null?void 0:s.getRoomPushRule)==null?void 0:o.call(s,"global",r);return!!((l=(a=c==null?void 0:c.actions)==null?void 0:a.includes)!=null&&l.call(a,"dont_notify"))}catch{return!1}}activityTimestampOf(r,s,o){if(s)return this.toIso(s.getTs());if(o){let a=this.invitedAtOf(r);
3if(a)return this.toIso(a)}return this.toIso(r.getLastActiveTimestamp())}invitedAtOf(r){var s,o,a;try{let l=(o=(s=r.currentState)==null?void 0:s.getStateEvents)==null?void 0:o.call(s,"m.room.member",this.matrixUserId),c=(a=l==null?void 0:l.getTs)==null?void 0:a.call(l);return typeof c=="number"&&Number.isFinite(c)&&c>0?c:null}catch{return null}}toIso(r){return typeof r=="number"&&Number.isFinite(r)&&r>0?new Date(r).toISOString():new Date().toISOString()}toMessage(r,s,o){var m,f,h,_,v,I,N;let a=this.membershipNoteOf(r,s);if(a)return{id:r.getId()||"",chatId:s.roomId,senderId:"",senderName:"",kind:ts.system,body:a,replyTo:null,reactions:[],sentAt:this.toIso(r.getTs()),editedAt:null,isDeleted:!1,status:wl.seen};let l=r.getContent()||{},c=this.kindOf(r),u=(f=(m=l["m.relates_to"])==null?void 0:m["m.in_reply_to"])==null?void 0:f.event_id,p=l.url&&((h=this.client)==null?void 0:h.mxcUrlToHttp(l.url))||void 0;return{id:r.getId()||"",clientId:this.clientIdOf(r),chatId:s.roomId,senderId:this.toLocalId(r.getSender()||""),senderName:this.cleanName(((_=s.getMember(r.getSender()||""))==null?void 0:_.name)||""),kind:c,body:r.isRedacted()?"":c===ts.text?this.stripReplyFallback(l.body||""):"",imageUrl:c===ts.image?p:void 0,replyTo:u?this.toRef(s,u):null,reactions:this.buildReactions(s,r.getId()||"",[],o),sentAt:this.toIso(r.getTs()),editedAt:((N=(I=(v=r.replacingEventDate)==null?void 0:v.call(r))==null?void 0:I.toISOString)==null?void 0:N.call(I))||null,isDeleted:r.isRedacted(),status:wl.sent}}toRef(r,s){var a,l;let o=r.findEventById(s);return o?{id:s,senderId:this.toLocalId(o.getSender()||""),senderName:this.cleanName(((a=r.getMember(o.getSender()||""))==null?void 0:a.name)||""),body:this.stripReplyFallback(((l=o.getContent())==null?void 0:l.body)||""),kind:this.kindOf(o),isDeleted:o.isRedacted()}:null}reactionEventsFor(r,s,o){var l,c,u,p;let a=new Map;try{let m=(u=(c=(l=r.getUnfilteredTimelineSet())==null?void 0:l.relations)==null?void 0:c.getChildEventsForEvent)==null?void 0:u.call(c,s,"m.annotation","m.reaction");for(let f of((p=m==null?void 0:m.getRelations)==null?void 0:p.call(m))||[])f.getId()&&a.set(f.getId(),f)}catch{}for(let m of(o!=null?o:this.reactionIndexOf(r,s)).get(s)||[])a.set(m.getId(),m);return[...a.values()].filter(m=>!m.isRedacted())}reactionIndexOf(r,s){var a,l,c,u;let o=new Map;try{for(let p of((c=(l=(a=r.getLiveTimeline)==null?void 0:a.call(r))==null?void 0:l.getEvents)==null?void 0:c.call(l))||[]){let m=p.getType()==="m.reaction"?(u=p.getContent())==null?void 0:u["m.relates_to"]:null;if((m==null?void 0:m.rel_type)!=="m.annotation"||!m.event_id||!p.getId()||s!==void 0&&m.event_id!==s)continue;let f=o.get(m.event_id);f?f.push(p):o.set(m.event_id,[p])}}catch{}return o}buildReactions(r,s,o=[],a){var c,u;let l=new Map;for(let p of this.reactionEventsFor(r,s,a)){let m=p.getId();if(m&&o.includes(m))continue;let f=(u=(c=p.getContent())==null?void 0:c["m.relates_to"])==null?void 0:u.key;f&&(l.has(f)||l.set(f,new Set),l.get(f).add(this.toLocalId(p.getSender()||"")))}return[...l.entries()].map(([p,m])=>({emoji:p,userIds:[...m]}))}myReactionEvents(r,s){return this.reactionEventsFor(r,s).filter(o=>o.getSender()===this.matrixUserId)}applyReadReceipts(r,s){var o,a,l,c,u,p,m;try{let f=0,h=new Map;for(let v of((l=(a=(o=r.getLiveTimeline)==null?void 0:o.call(r))==null?void 0:a.getEvents)==null?void 0:l.call(a))||[]){let I=v.getId();I&&h.set(I,v.getTs())}for(let v of r.getJoinedMembers()){if(v.userId===this.matrixUserId)continue;let I=(c=r.getReadReceiptForUserId)==null?void 0:c.call(r,v.userId),N=I!=null&&I.eventId?(p=h.get(I.eventId))!=null?p:(u=r.findEventById(I.eventId))==null?void 0:u.getTs():void 0,j=N!=null?N:(m=I==null?void 0:I.data)==null?void 0:m.ts;j&&(f=Math.max(f,j))}if(!f)return;let _=new Date(f).toISOString();for(let v of s)v.senderId===this.toLocalId(this.matrixUserId)&&v.sentAt<=_&&(v.status=wl.seen)}catch{}}lastMessageEvent(r){var a,l,c;let s=this.hiddenMessages.get(r.roomId),o=((c=(l=(a=r.getLiveTimeline)==null?void 0:a.call(r))==null?void 0:l.getEvents)==null?void 0:c.call(l))||r.timeline||[];for(let u=o.length-1;u>=0;u--){let p=o[u];if(!(p.getType()!=="m.room.message"||this.isEditEvent(p))&&!p.isRedacted()&&!(s!=null&&s.has(p.getId()||"")))return p}return null}hasAnyMessage(r){var o,a,l;return(((l=(a=(o=r.getLiveTimeline)==null?void 0:o.call(r))==null?void 0:a.getEvents)==null?void 0:l.call(a))||r.timeline||[]).some(c=>c.getType()==="m.room.message")}isEditEvent(r){var s,o;return((o=(s=r.getContent())==null?void 0:s["m.relates_to"])==null?void 0:o.rel_type)==="m.replace"}membershipNoteOf(r,s){var p,m,f;if(r.getType()!=="m.room.member"||this.isDirect(s))return null;let o=r.getStateKey()||"",a=(r.getContent()||{}).membership,l=(m=(p=r.getPrevContent)==null?void 0:p.call(r))==null?void 0:m.membership;if(a===l)return null;
3let c=o===this.matrixUserId,u=this.cleanName((r.getContent()||{}).displayname||((f=s.getMember(o))==null?void 0:f.name)||"")||"\u06CC\u06A9 \u06A9\u0627\u0631\u0628\u0631";return a==="join"?c?"\u0634\u0645\u0627 \u0628\u0647 \u06AF\u0631\u0648\u0647 \u067E\u06CC\u0648\u0633\u062A\u06CC\u062F.":"".concat(u," \u0628\u0647 \u06AF\u0631\u0648\u0647 \u067E\u06CC\u0648\u0633\u062A."):a==="leave"?l==="invite"?null:r.getSender()!==o?c?"\u0634\u0645\u0627 \u0627\u0632 \u06AF\u0631\u0648\u0647 \u062D\u0630\u0641 \u0634\u062F\u06CC\u062F.":"".concat(u," \u0627\u0632 \u06AF\u0631\u0648\u0647 \u062D\u0630\u0641 \u0634\u062F."):c?"\u0634\u0645\u0627 \u0627\u0632 \u06AF\u0631\u0648\u0647 \u062E\u0627\u0631\u062C \u0634\u062F\u06CC\u062F.":"".concat(u," \u06AF\u0631\u0648\u0647 \u0631\u0627 \u062A\u0631\u06A9 \u06A9\u0631\u062F."):a==="ban"?c?"\u0634\u0645\u0627 \u0627\u0632 \u06AF\u0631\u0648\u0647 \u0645\u0633\u062F\u0648\u062F \u0634\u062F\u06CC\u062F.":"".concat(u," \u0627\u0632 \u06AF\u0631\u0648\u0647 \u0645\u0633\u062F\u0648\u062F \u0634\u062F."):null}kindOf(r){var o;return((o=r.getContent())==null?void 0:o.msgtype)==="m.image"?ts.image:ts.text}previewOf(r){var o;let s=this.kindOf(r);return r.isRedacted()?"":s===ts.image?"\u062A\u0635\u0648\u06CC\u0631":this.stripReplyFallback(((o=r.getContent())==null?void 0:o.body)||"")}stripReplyFallback(r){if(!r.startsWith("> "))return r;let s=r.split("\n"),o=0;for(;o<s.length&&s[o].startsWith("> ");)o++;for(;o<s.length&&s[o].trim()==="";)o++;return s.slice(o).join("\n")}toLocalId(r){return r.replace(/^@/,"").replace(/:.+$/,"")}toMatrixId(r){return"@".concat(r).concat(nu)}cleanName(r){return(r||"").replace(/@(\w+):.+/,"$1")}};d(e,"\u0275fac",(()=>{let r;return function(o){return(r||(r=Uo(e)))(o||e)}})()),d(e,"\u0275prov",vt({token:e,factory:e.\u0275fac}));let t=e;return t})();var hA=()=>({provide:Ip,useClass:fA});var N5=(t,e,n)=>[t,e,n,".jpg",null,null,"sm"];function M5(t,e){t&1&&E(0,"\u060C")}function P5(t,e){if(t&1&&(F(0,"span",6),E(1),se(2,M5,1,0),E(3),W()),t&2){let n=w();y(),Me(" ",n.firstAuthor," "),y(),oe(n.firstAuthor&&n.firstTranslator?2:-1),y(),Me(" ",n.firstTranslator," ")}}function D5(t,e){if(t&1&&(F(0,"span",6),E(1),W()),t&2){let n=w();y(),Me(" ",n.data==null||n.data.authors[0]==null?null:n.data.authors[0].name," ")}}var gA=(()=>{let e=class e{constructor(){d(this,"data",T(Ut));d(this,"imageType",_t);d(this,"firstAuthor");d(this,"firstTranslator")}ngOnInit(){var i,r,s,o;this.firstAuthor=(r=(i=this.data.authors)==null?void 0:i.find(a=>a.type==="Author"))==null?void 0:r.name,this.firstTranslator=(o=(s=this.data.authors)==null?void 0:s.find(a=>a.type==="Translator"))==null?void 0:o.name}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275cmp",be({type:e,selectors:[["beh-share-book-dialog"]],decls:43,vars:24,consts:[[1,"w-full","flex","flex-wrap","justify-center","items-center"],[1,"w-full","flex","flex-wrap","content-start","bg-white","dark:bg-gray-900","rounded-lg","py-4","px-4"],["src","https://storage.behkhaan.ir/assets/icons/beh-logo.svg",1,"w-6"],[1,"w-full","flex","flex-wrap","justify-center","mt-4"],[1,"aspect-[0.70]","h-[180px]","rounded",3,"src"],[1,"w-full","font-bold","text-sm","text-[#03121B]","mt-4","text-center"],[1,"font-medium","text-xs","text-gray-500","mt-2"],[1,"w-full","font-medium","text-xs","text-gray-500","text-center"],[1,"w-full","flex","items-center","justify-center","mt-6"],[1,"text-sm","text-gray-500"],[1,"icon","star-filled","text-xl","mr-1","text-system-rait","border-l","border-[#CED3D7]","pl-3","ml-3"],[1,"font-medium","text-xs","text-gray-500"],[1,"icon","notepad-edit-regular","text-xl","text-gray-500","mr-1"],[1,"w-full","flex","justify-between","mt-6","text-center","text-gray-500","text-xs"],[1,"w-1/3","border-l","border-[#CED3D7]","px-2"],[1,"block","font-medium","text-[10px]","text-gray-400"],[1,"font-medium"],[1,"w-1/3","px-2"],[1,"flex","flex-wrap","flex-col","justify-center","items-center","mt-4"],[1,"text-xs","text-gray-700","dark:text-gray-200","font-medium"],[1,"relative","w-full","my-4"],[1,"border-t","border-gray-500","dark:border-gray-400","absolute","top-1/2","left-0","right-0"],[1,"absolute","top-1/2","left-1/2","transform","-translate-x-1/2","-translate-y-1/2","bg-green-10","dark:bg-green-1000","px-2","text-green-500","text-sm","font-medium"]],template:function(r,s){r&1&&(F(0,"section",0)(1,"div",1),qe(2,"img",2),F(3,"div",3),qe(4,"img",4),$(5,"image"),F(6,"p",5),E(7),W(),se(8,P5,4,3,"span",6)(9,D5,2,1,"span",6),F(10,"p",7),E(11),W(),F(12,"div",8)(13,"span",9),E(14),$(15,"number"),W(),qe(16,"span",10),F(17,"span",11),E(18),W(),qe(19,"span",12),W(),F(20,"div",13)(21,"div",14)(22,"span",15),E(23,"\u062E\u0648\u0627\u0646\u062F\u0647\u200C\u0627\u0646\u062F"),W(),F(24,"span",16),E(25),W()(),F(26,"div",14)(27,"span",15),E(28,"\u062F\u0631\u062D\u0627\u0644 \u062E\u0648\u0627\u0646\u062F\u0646"),W(),F(29,"span",16),E(30),W()(),F(31,"div",17)(32,"span",15),E(33,"\u062E\u0648\u0627\u0647\u0646\u062F \u062E\u0648\u0627\u0646\u062F"),W(),F(34,"span",16),E(35),W()()()()(),F(36,"div",18)(37,"p",19),E(38,"\u0628\u0647\u062E\u0648\u0627\u0646 | \u0634\u0628\u06A9\u0647\u0654 \u0627\u062C\u062A\u0645\u0627\u0639\u06CC \u06A9\u062A\u0627\u0628"),W(),F(39,"div",20),qe(40,"div",21),F(41,"p",22),E(42," behkhaan.ir"),W()()()()),r&2&&(y(4),Us("src",St(5,9,At(20,N5,s.data==null?null:s.data.id,s.imageType.book,s.data.hasPhoto)),He),y(3),Ae(s.data.name),y(),oe(s.firstAuthor||s.firstTranslator?8:9),y(3),Ae("\u0646\u0634\u0631"+(s.data==null||s.data.publishers[0]==null?null:s.data.publishers[0].title)),y(3),Me(" ",di(15,17,(s.data==null?null:s.data.averageRate)||0,"0.1-1")," "),y(4),Ae(s.data.reviewCount),y(7),Ae(s.data.readCount),y(5),Ae(s.data.currentlyReadingCount),y(5),Ae(s.data.wantToReadCount))},dependencies:[lt,Xu],encapsulation:2}));let t=e;return t})();var L5=(t,e,n)=>[t,e,n,".jpg",null,null,"sm"];function F5(t,e){if(t&1&&(F(0,"p",9),E(1),W()),t&2){let n=w();y(),Ae((n.data==null?null:n.data.uniqeName)+"@")}}var _A=(()=>{let e=class e{constructor(){d(this,"followItemService",T(Sp));d(this,"data",T(Ut));d(this,"dialogRef",T(gi));d(this,"imageType",_t)}FollowClicked(i){i.userType=SS.User,this.followItemService.Follow(i)}closeDialog(){this.dialogRef.close()}};d(e,"\u0275fac",function(r){return new(r||e)}
3),d(e,"\u0275cmp",be({type:e,selectors:[["beh-share-profile-dialog"]],decls:31,vars:23,consts:[[1,"w-full","flex","flex-wrap","justify-center","items-center","overflow-hidden"],[1,"w-full","flex","flex-wrap","content-start","bg-white","dark:bg-gray-900","rounded-lg","p-4"],["src","https://storage.behkhaan.ir/assets/icons/beh-logo.svg",1,"w-6"],[1,"w-full","flex","flex-wrap","justify-center","mt-4","relative"],[1,"aspect-2/1","w-full","object-cover","rounded-lg",3,"src","alt"],[1,"z-20","absolute","rounded-full","border-white","dark:border-gray-900","top-[82px]","border-[6px]"],["onerror","this.src='assets/images/default/default_avatar.svg'",1,"rounded-full","object-cover","min-h-20","min-w-20","max-h-20","max-w-20",3,"src"],[1,"w-full","mt-[4rem]","flex","flex-col","items-center","justify-center"],[1,"text-sm","text-gray-900","font-bold"],[1,"text-xs","font-regular","text-gray-500","mt-1"],[1,"w-full","flex","justify-center","btn-xs","btn-blue-flat","!rounded-[10px]","mt-4"],[1,"w-full","flex","justify-center","items-center","mt-4"],[1,"flex","items-center","border-l","border-gray-100","dark:border-gray-700","px-4"],[1,"text-xs","font-medium","text-gray-500"],[1,"icon","notepad-edit-regular","text-gray-500","text-base","mr-1"],[1,"flex","items-center","px-4"],[1,"icon","star-regular","text-gray-500","text-base","mr-1"],[1,"flex","flex-wrap","flex-col","justify-center","items-center","mt-4"],[1,"text-xs","text-gray-700","dark:text-gray-200","font-medium"],[1,"relative","w-full","my-4"],[1,"border-t","border-gray-500","dark:border-gray-400","absolute","top-1/2","left-0","right-0"],[1,"absolute","top-1/2","left-1/2","transform","-translate-x-1/2","-translate-y-1/2","bg-green-10","dark:bg-green-1000","px-2","text-green-500","text-sm","font-medium"]],template:function(r,s){r&1&&(F(0,"section",0)(1,"div",1),qe(2,"img",2),F(3,"div",3),qe(4,"img",4),$(5,"image"),F(6,"div",5),qe(7,"img",6),$(8,"image"),W()(),F(9,"div",7)(10,"p",8),E(11),W(),se(12,F5,2,1,"p",9),W(),F(13,"button",10),E(14,"\u062F\u0646\u0628\u0627\u0644 \u06A9\u0631\u062F\u0646"),W(),F(15,"div",11)(16,"div",12)(17,"span",13),E(18),W(),qe(19,"span",14),W(),F(20,"div",15)(21,"span",13),E(22),W(),qe(23,"span",16),W()()(),F(24,"div",17)(25,"p",18),E(26,"\u0628\u0647\u062E\u0648\u0627\u0646 | \u0634\u0628\u06A9\u0647\u0654 \u0627\u062C\u062A\u0645\u0627\u0639\u06CC \u06A9\u062A\u0627\u0628"),W(),F(27,"div",19),qe(28,"div",20),F(29,"p",21),E(30," behkhaan.ir"),W()()()()),r&2&&(y(4),Us("src",xt(5,7,s.data==null?null:s.data.id,s.imageType.userBanner,s.data==null?null:s.data.hasWallpaper),He)("alt",s.data==null?null:s.data.fullName),y(3),Us("src",St(8,11,At(19,L5,s.data==null?null:s.data.id,s.imageType.userAvatar,s.data==null?null:s.data.hasPhoto)),He),y(4),Ae(s.data==null?null:s.data.firstName),y(),oe(s.data!=null&&s.data.uniqeName?12:-1),y(6),Ae(s.data==null?null:s.data.reviewsCount),y(4),Ae(s.data==null?null:s.data.ratesCount))},dependencies:[lt],encapsulation:2}));let t=e;return t})();var U5=["template"],B5=(t,e,n)=>[t,e,n,".jpg",null,null,"sm"];function H5(t,e){if(t&1&&(b(0,"p",8),E(1),S()),t&2){let n=w();y(),Ae(n.firstAuthor)}}function q5(t,e){if(t&1&&(b(0,"p",9),E(1),S()),t&2){let n=w();y(),Ae(n.firstTranslator)}}function j5(t,e){if(t&1&&(b(0,"p",8),E(1),S()),t&2){let n=w();y(),Ae(!(n.data.object==null||n.data.object.data.book.authors[0]==null)&&n.data.object.data.book.authors[0].name?n.data.object==null||n.data.object.data.book.authors[0]==null?null:n.data.object.data.book.authors[0].name:n.data.object==null||n.data.object.data.book.authors[0]==null?null:n.data.object.data.book.authors[0].fullName)}}var yA=(()=>{let e=class e{constructor(){d(this,"data",T(Ut));d(this,"imageType",_t);d(this,"firstAuthor");d(this,"firstTranslator");d(this,"template")}ngOnInit(){var i,r,s,o,a,l,c,u,p,m;this.firstAuthor=(a=(o=(s=(r=(i=this.data.object)==null?void 0:i.data)==null?void 0:r.book)==null?void 0:s.authors)==null?void 0:o.find(f=>f.type==="Author"))==null?void 0:a.name,this.firstTranslator=(m=(p=(u=(c=(l=this.data.object)==null?void 0:l.data)==null?void 0:c.book)==null?void 0:u.authors)==null?void 0:p.find(f=>f.type==="Translator"))==null?void 0:m.name}};d(e,"\u0275fac",function(r){return new(r||e)}
3),d(e,"\u0275cmp",be({type:e,selectors:[["beh-share-review-presenter"]],viewQuery:function(r,s){if(r&1&&Ho(U5,5),r&2){let o;qo(o=jo())&&(s.template=o.first)}},decls:28,vars:22,consts:[["template",""],[1,"w-full","flex","flex-wrap","justify-center","items-center","mx-auto"],[1,"w-full","flex","flex-wrap","content-start","max-h-[400px]","bg-white","relative","dark:bg-gray-900","rounded-lg","pt-4","pb-9","px-4"],[1,"w-full","flex","flex-wrap"],[1,"w-6/12","flex","flex-wrap"],["src","https://storage.behkhaan.ir/assets/icons/beh-logo.svg",1,"w-6"],[1,"w-full","text-[#03121B]","font-bold","text-sm","mt-2","line-clamp-1"],[1,"w-[18px]","h-1","bg-green-500","mt-1"],[1,"w-full","text-gray-500","font-bold","text-sm","mt-2"],[1,"w-full","text-gray-500","font-bold","text-sm","mt-1"],[1,"w-6/12","flex","justify-end","absolute","left-[16px]","-top-[33px]","z-10"],[1,"w-[100px]","h-[143px]","rounded-xl",3,"src"],[1,"w-full","flex","flex-wrap","mt-[17px]","justify-between","border-b","border-[#CED3D7]","pb-4"],[3,"readonly","size","initialStars"],[1,"font-regular","text-xs","text-gray-500"],[1,"line-clamp-[11]","font-medium","text-xs","text-gray-700","text-justify","mt-4"],[1,"flex","flex-wrap","flex-col","justify-center","items-center","mt-4"],[1,"text-xs","text-gray-700","dark:text-gray-200","font-medium"],[1,"relative","w-full","my-4"],[1,"border-t","border-gray-500","dark:border-gray-400","absolute","top-1/2","left-0","right-0"],[1,"absolute","top-1/2","left-1/2","transform","-translate-x-1/2","-translate-y-1/2","bg-green-10","dark:bg-green-1000","px-2","text-green-500","text-sm","font-medium"]],template:function(r,s){r&1&&(b(0,"section",1,0)(2,"div",2)(3,"div",3)(4,"div",4),M(5,"img",5),b(6,"p",6),E(7),S(),M(8,"span",7),se(9,H5,2,1,"p",8),se(10,q5,2,1,"p",9),se(11,j5,2,1,"p",8),S(),b(12,"div",10),M(13,"img",11),$(14,"image"),S()(),b(15,"div",12),M(16,"app-behkhaan-rating",13),b(17,"span",14),E(18),S()(),b(19,"p",15),E(20),S()(),b(21,"div",16)(22,"p",17),E(23,"\u0628\u0647\u062E\u0648\u0627\u0646 | \u0634\u0628\u06A9\u0647\u0654 \u0627\u062C\u062A\u0645\u0627\u0639\u06CC \u06A9\u062A\u0627\u0628"),S(),b(24,"div",18),M(25,"div",19),b(26,"p",20),E(27," behkhaan.ir"),S()()()()),r&2&&(y(7),Me("",s.data.object==null||s.data.object.data==null||s.data.object.data.book==null?null:s.data.object.data.book.name," "),y(2),oe(s.firstAuthor?9:-1),y(),oe(s.firstTranslator?10:-1),y(),oe(!s.firstTranslator&&!s.firstAuthor?11:-1),y(2),x("src",St(14,10,At(18,B5,s.data.object==null||s.data.object.data==null?null:s.data.object.data.book.id,s.imageType.book,s.data.object==null||s.data.object.data==null||s.data.object.data.book==null?null:s.data.object.data.book.hasPhoto)),He),y(3),x("readonly",!0)("size",1)("initialStars",s.data==null||s.data.actorRate==null?null:s.data.actorRate.averageRate),y(2),Ae((s.data==null||s.data.actor==null?null:s.data.actor.userName)+"@"),y(2),Ae(s.data==null||s.data.review==null||s.data.review.data==null?null:s.data.review.data.body))},dependencies:[OE,lt],encapsulation:2}));let t=e;return t})();var G5=t=>({"-top-[57px]":t}),W5=(t,e,n)=>[t,e,n,".jpg",null,null,"sm"],V5=t=>({"aspect-ratio":t});function z5(t,e){if(t&1&&(b(0,"p",7),E(1),S()),t&2){let n=w();y(),Ae(n.firstAuthor)}}function Y5(t,e){if(t&1&&(b(0,"p",8),E(1),S()),t&2){let n=w();y(),Ae(n.firstTranslator)}}function $5(t,e){if(t&1&&(b(0,"p",7),E(1),S()),t&2){let n=w();y(),Ae(!(n.data==null||n.data.book==null||n.data.book.authors[0]==null)&&n.data.book.authors[0].name?n.data.book==null||n.data.book.authors[0]==null?null:n.data.book.authors[0].name:n.data==null||n.data.book==null||n.data.book.authors[0]==null?null:n.data.book.authors[0].fullName)}}function K5(t,e){if(t&1&&(M(0,"img",21),$(1,"image")),t&2){let n=w();x("ngStyle",rt(5,V5,n.inverseMediaRatio))("src",di(1,2,n.data==null?null:n.data.mediaId,n.imageType.quote),He)}}var bA=(()=>{let e=class e{constructor(){d(this,"data",T(Ut));d(this,"imageType",_t);d(this,"firstAuthor");d(this,"firstTranslator")}get inverseMediaRatio(){let i=(this.data.mediaRatio||"").split(":");if(i.length!==2)return 1;let r=+i[0],s=+i[1];return!r||!s?1:s/r}ngOnInit(){var i,r,s,o,a,l,c,u;this.firstAuthor=(o=(s=(r=(i=this.data)==null?void 0:i.book)==null?void 0:r.authors)==null?void 0:s.find(p=>p.type==="Author"))==null?void 0:o.name,this.firstTranslator=(u=(c=(l=(a=this.data)==null?void 0:a.book)==null?void 0:l.authors)==null?void 0:c.find(p=>p.type==="Translator"))==null?void 0:u.name}};d(e,"\u0275fac",function(r){return new(r||e)}
vendor: 2,403 bytes, line 3
3),d(e,"\u0275cmp",be({type:e,selectors:[["beh-share-quote-presenter"]],decls:38,vars:24,consts:[[1,"w-full","flex","flex-wrap","justify-center","items-center"],[1,"w-full","flex","flex-wrap","content-start","bg-white","dark:bg-gray-900","rounded-lg","pt-4","pb-9","px-4"],[1,"w-full","flex","flex-wrap","relative"],[1,"w-6/12","flex","flex-wrap"],["src","https://storage.behkhaan.ir/assets/icons/beh-logo.svg",1,"w-6"],[1,"w-full","text-[#03121B]","font-bold","text-sm","mt-2","line-clamp-1"],[1,"w-[18px]","h-1","bg-green-500","mt-1"],[1,"w-full","text-gray-500","font-bold","text-sm","mt-2"],[1,"w-full","text-gray-500","font-bold","text-sm","mt-1"],[1,"w-6/12","flex","justify-end","absolute","left-0","-top-[55px]","z-10",3,"ngClass"],[1,"w-[100px]","h-[143px]","rounded-xl",3,"src"],[1,"w-full","flex","flex-wrap","mt-[17px]","justify-between","border-b","border-[#CED3D7]","pb-4"],[1,"flex","items-center"],[1,"icon","ruled-paper-regular","text-green-500","ml-2"],[1,"font","font-medium","text-xs","text-gray-500"],[1,"font-regular","text-xs","text-gray-500"],[1,"w-full","flex","flex-wrap","mt-4"],[1,"w-full","flex","items-center","justify-start"],[1,"icon","quote-filled","text-green-500","ml-2"],[1,"icon","quote-filled","text-green-500"],[1,"font-medium","text-xs","text-gray-700","text-justify","my-2","line-clamp-[11]"],[1,"rounded-xl","w-full","my-2",3,"ngStyle","src"],[1,"w-full","flex","items-center","justify-end"],[1,"icon","quote-filled","text-green-500","rotate-180","ml-2"],[1,"icon","quote-filled","text-green-500","rotate-180"],[1,"flex","flex-wrap","flex-col","justify-center","items-center","mt-4"],[1,"text-xs","text-gray-700","dark:text-gray-200","font-medium"],[1,"relative","w-full","my-4"],[1,"border-t","border-gray-500","dark:border-gray-400","absolute","top-1/2","left-0","right-0"],[1,"absolute","top-1/2","left-1/2","transform","-translate-x-1/2","-translate-y-1/2","bg-green-10","dark:bg-green-1000","px-2","text-green-500","text-sm","font-medium"]],template:function(r,s){r&1&&(b(0,"section",0)(1,"div",1)(2,"div",2)(3,"div",3),M(4,"img",4),b(5,"p",5),E(6),S(),M(7,"span",6),se(8,z5,2,1,"p",7),se(9,Y5,2,1,"p",8),se(10,$5,2,1,"p",7),S(),b(11,"div",9),M(12,"img",10),$(13,"image"),S()(),b(14,"div",11)(15,"div",12),M(16,"span",13),b(17,"span",14),E(18),S()(),b(19,"span",15),E(20),S()(),b(21,"div",16)(22,"div",17),M(23,"span",18)(24,"span",19),S(),b(25,"p",20),E(26
3),S(),se(27,K5,2,7,"img",21),b(28,"div",22),M(29,"span",23)(30,"span",24),S()()(),b(31,"div",25)(32,"p",26),E(33,"\u0628\u0647\u062E\u0648\u0627\u0646 | \u0634\u0628\u06A9\u0647\u0654 \u0627\u062C\u062A\u0645\u0627\u0639\u06CC \u06A9\u062A\u0627\u0628"),S(),b(34,"div",27),M(35,"div",28),b(36,"p",29),E(37," behkhaan.ir"),S()()()()),r&2&&(y(6),Ae(s.data==null?null:s.data.book.name),y(2),oe(s.firstAuthor?8:-1),y(),oe(s.firstTranslator?9:-1),y(),oe(!s.firstTranslator&&!s.firstAuthor?10:-1),y(),x("ngClass",rt(18,G5,!(s.data.book!=null&&s.data.book.hasPhoto))),y(),x("src",St(13,10,At(20,W5,s.data.book==null?null:s.data.book.id,s.imageType.book,s.data.book==null?null:s.data.book.hasPhoto)),He),y(6),Ae("\u0635\u0641\u062D\u0647 "+s.data.pageNum),y(2),Ae((s.data.actor==null?null:s.data.actor.userName)+"@"),y(6),Ae(s.data.body),y(),oe(s.data.hasPhoto?27:-1))},dependencies:[Ln,Go,Ku,lt],encapsulation:2}));let t=e;return t})();var vA=(()=>{let e=class e{constructor(){d(this,"data",T(Ut));d(this,"dialogRef",T(gi));d(this,"imageType",_t)}closeDialog(){this.dialogRef.close()}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275cmp",be({type:e,selectors:[["beh-shareable-post-presenter"]],decls:26,vars:10,consts:[[1,"w-full","flex","flex-wrap","justify-center","items-center","overflow-hidden"],[1,"w-full","flex","flex-wrap","content-start","bg-white","dark:bg-gray-900","rounded-lg","p-4"],[1,"w-full","flex","flex-wrap","justify-between","items-center","border-b","border-gray-100","dark:border-gray-700","pb-4"],["src","https://storage.behkhaan.ir/assets/icons/beh-logo.svg",1,"w-6"],[1,"w-full","flex","flex-wrap","mt-4"],[1,"aspect-2/1","w-full","object-cover","rounded-lg",3,"src","alt"],[1,"w-full","font-bold","text-sm","text-gray-900","mt-3","line-clamp-1"],[1,"w-[18px]","h-1","bg-green-500","mt-1"],[1,"w-full","flex","justify-between","items-center","mt-3"],[1,"flex","items-center"],[1,"icon","timer-regular","text-green-500","font-bold","text-xl"],[1,"font-medium","text-xs","text-gray-500","mr-1"],[1,"text-sm","font-regular","text-gray-500"],[1,"relative","max-h-[200px]","overflow-hidden","text-ellipsis"],["format","html","theme","snow",1,"w-full","prose","prose-sm",3,"content"],[1,"flex","flex-wrap","flex-col","justify-center","items-center","mt-4"],[1,"text-xs","text-gray-700","dark:text-gray-200","font-medium"],[1,"relative","w-full","my-4"],[1,"border-t","border-gray-500","dark:border-gray-400","absolute","top-1/2","left-0","right-0"],[1,"absolute","top-1/2","left-1/2","transform","-translate-x-1/2","-translate-y-1/2","bg-green-10","dark:bg-green-1000","px-2","text-green-500","text-sm","font-medium"]],template:function(r,s){r&1&&(b(0,"section",0)(1,"div",1)(2,"div",2),M(3,"img",3),b(4,"div",4),M(5,"img",5),$(6,"image"),b(7,"p",6),E(8),S(),M(9,"span",7),b(10,"div",8)(11,"div",9),M(12,"span",10),b(13,"p",11),E(14),S()(),b(15,"p",12),E(16),S()()()(),b(17,"div",13),M(18,"quill-view",14),S()(),b(19,"div",15)(20,"p",16),E(21,"\u0628\u0647\u062E\u0648\u0627\u0646 | \u0634\u0628\u06A9\u0647\u0654 \u0627\u062C\u062A\u0645\u0627\u0639\u06CC \u06A9\u062A\u0627\u0628"),S(),b(22,"div",17),M(23,"div",18),b(24,"p",19),E(25," behkhaan.ir"),S()()()()),r&2&&(y(5),x("src",xt(6,6,s.data==null?null:s.data.mediaId,s.imageType.post,s.data==null?null:s.data.hasPhoto),He)("alt",s.data==null?null:s.data.title),y(3),Ae(s.data==null?null:s.data.title),y(6),Me("",s.data==null?null:s.data.readingTimeInMinutes," \u062F\u0642\u06CC\u0642\u0647"),y(2),Ae((s.data==null||s.data.actor==null?null:s.data.actor.userName)+"@"),y(2),x("content",s.data==null?null:s.data.body))},dependencies:[ME,NE,lt],styles:['@charset "UTF-8";.text-ellipsis[_ngcontent-%COMP%]{display:-webkit-box;-webkit-line-clamp:10;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;max-height:200px}']}));let t=e;return t})();var Q5=(t,e,n)=>[t,e,n,".jpg",null,null,"sm"];function X5(t,e){if(t&1&&(qe(0,"img",13),$(1,"image")),t&2){let n=e.$implicit,i=w();Us("src",St(1,1,At(9,Q5,n.book==null?null:n.book.id,i.imageType.book,n.book.hasPhoto)),He)}}var SA=(()=>{let e=class e{constructor(){d(this,"data",T(Ut));d(this,"imageType",_t)}};d(e,"\u0275fac",function(r){return new(r||e)}
3),d(e,"\u0275cmp",be({type:e,selectors:[["beh-share-book-list-dialog"]],decls:27,vars:4,consts:[[1,"w-full","flex","flex-wrap","justify-center","items-center"],[1,"w-full","flex","flex-wrap","content-start","bg-white","dark:bg-gray-900","rounded-lg","pt-4","pb-4","px-4"],[1,"w-full","flex","flex-wrap"],["src",".https://storage.behkhaan.ir/assets/icons/beh-logo.svg",1,"w-6"],[1,"w-full","font-bold","text-sm","text-[#03121B]","dark:text-white","mt-4"],[1,"w-full","flex","flex-wrap","mt-[17px]","justify-between","border-b","border-[#CED3D7]","pb-4"],[1,"flex","items-center"],[1,"icon","ruled-paper-regular","text-green-500","ml-2"],[1,"font","font-medium","text-xs","text-gray-500","dark:text-gray-400","ml-[2px]"],[1,"font","font-medium","text-xs","text-gray-500","dark:text-gray-400"],[1,"font-regular","text-xs","text-gray-500","dark:text-gray-400"],[1,"w-full","font-medium","text-xs","text-gray-700","dark:text-gray-300","mt-3"],[1,"w-full","flex","flex-wrap","justify-between","mt-4"],[1,"aspect-[0.67]","h-24","rounded",3,"src"],[1,"flex","flex-wrap","flex-col","justify-center","items-center","mt-4"],[1,"text-xs","text-gray-700","dark:text-gray-200","font-medium"],[1,"relative","w-full","my-4"],[1,"border-t","border-gray-500","dark:border-gray-400","absolute","top-1/2","left-0","right-0"],[1,"absolute","top-1/2","left-1/2","transform","-translate-x-1/2","-translate-y-1/2","bg-green-10","dark:bg-green-1000","px-2","text-green-500","text-sm","font-medium"]],template:function(r,s){r&1&&(F(0,"section",0)(1,"div",1)(2,"div",2),qe(3,"img",3),F(4,"p",4),E(5),W()(),F(6,"div",5)(7,"div",6),qe(8,"span",7),F(9,"span",8),E(10),W(),F(11,"span",9),E(12,"\u06A9\u062A\u0627\u0628"),W()(),F(13,"span",10),E(14),W(),F(15,"p",11),E(16),W()(),F(17,"div",12),Wt(18,X5,2,13,"img",13,Zt),W()(),F(20,"div",14)(21,"p",15),E(22,"\u0628\u0647\u062E\u0648\u0627\u0646 | \u0634\u0628\u06A9\u0647\u0654 \u0627\u062C\u062A\u0645\u0627\u0639\u06CC \u06A9\u062A\u0627\u0628"),W(),F(23,"div",16),qe(24,"div",17),F(25,"p",18),E(26," behkhaan.ir"),W()()()()),r&2&&(y(5),Me("\u0644\u06CC\u0633\u062A | ",s.data.title),y(5),Ae(s.data.count),y(4),Ae((s.data.actor==null?null:s.data.actor.userName)+"@"),y(2),Ae(s.data.description),y(2),Vt(s.data.books))},dependencies:[lt],encapsulation:2}));let t=e;return t})();var EA=(()=>{let e=class e{};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275cmp",be({type:e,selectors:[["beh-share-donation-dialog"]],decls:16,vars:0,consts:[[1,"w-full","flex","flex-wrap","justify-center","items-center"],[1,"w-full","flex","flex-wrap","content-start","bg-white","relative","dark:bg-gray-900","rounded-lg","pt-4","pb-9","px-4"],["src","https://storage.behkhaan.ir/assets/icons/beh-logo.svg",1,"w-6"],[1,"w-full","font-bold","text-base","text-[#03121B]","mt-2"],["src","https://storage.behkhaan.ir/assets/images/donation.svg",1,"absolute","left-[10px]","-top-[92px]"],[1,"w-[18px]","h-1","bg-green-500","mt-1"],[1,"w-full","font-regular","text-sm","text-gray-800","mt-4"],[1,"flex","flex-wrap","flex-col","justify-center","items-center","mt-4"],[1,"text-xs","text-gray-700","dark:text-gray-200","font-medium"],[1,"relative","w-full","my-4"],[1,"border-t","border-gray-500","dark:border-gray-400","absolute","top-1/2","left-0","right-0"],[1,"absolute","top-1/2","left-1/2","transform","-translate-x-1/2","-translate-y-1/2","bg-green-10","dark:bg-green-1000","px-2","text-green-500","text-sm","font-medium"]],template:function(r,s){r&1&&(F(0,"section",0)(1,"div",1),qe(2,"img",2),F(3,"p",3),E(4,"\u0628\u0627 \u0647\u0645 \u0628\u0631\u0627\u06CC \u06A9\u062A\u0627\u0628\u200C\u0647\u0627..."),W(),qe(5,"img",4)(6,"span",5),F(7,"p",6),E(8," \u0628\u0647\u062E\u0648\u0627\u0646\u060C \u0634\u0628\u06A9\u06C0 \u0627\u062C\u062A\u0645\u0627\u0639\u06CC \u06A9\u062A\u0627\u0628\u200C\u062F\u0648\u0633\u062A\u0627\u200C\u0646\u200C\u060C \u062C\u0647\u0627\u0646 \u0631\u0627 \u0628\u0627 \u062A\u0639\u0627\u0645\u0644 \u0633\u0644\u06CC\u0642\u0647\u200C\u0647\u0627 \u0648 \u0627\u0646\u062F\u06CC\u0634\u0647\u200C\u0647\u0627\u06CC \u0645\u062E\u062A\u0644\u0641 \u062C\u0627\u06CC \u0628\u0647\u062A\u0631\u06CC \u0645\u06CC\u200C\u062F\u0627\u0646\u062F. \u0647\u0631 \u06A9\u0645\u06A9 \u0634\u0645\u0627\u060C \u0647\u0631\u0686\u0646\u062F \u06A9\u0648\u0686\u06A9 \u0642\u062F\u0645\u06CC \u0628\u0632\u0631\u06AF \u0628\u0631\u0627\u06CC \u0631\u0648\u0634\u0646\u200C\u0646\u06AF\u0647\u200C\u062F\u0627\u0634\u062A\u0646 \u0627\u06CC\u0646 \u0641\u0636\u0627\u0633\u062A. \u
3062F\u0631 \u0627\u06CC\u0646 \u0645\u0633\u06CC\u0631 \u0647\u0645\u0631\u0627\u0647 \u0647\u0645 \u0628\u0627\u0634\u06CC\u0645. \u0628\u0631\u0627\u06CC \u062E\u0627\u0637\u0631 \u06A9\u062A\u0627\u0628\u200C\u0647\u0627. \u0628\u0631\u0627\u06CC \u0628\u0647\u062E\u0648\u0627\u0646. "),W()(),F(9,"div",7)(10,"p",8),E(11,"\u0628\u0647\u062E\u0648\u0627\u0646 | \u0634\u0628\u06A9\u0647\u0654 \u0627\u062C\u062A\u0645\u0627\u0639\u06CC \u06A9\u062A\u0627\u0628"),W(),F(12,"div",9),qe(13,"div",10),F(14,"p",11),E(15," behkhaan.ir"),W()()()())},encapsulation:2}));let t=e;return t})();var TA={[ve.Book]:gA,[ve.Profile]:_A,[ve.Review]:yA,[ve.Quote]:bA,[ve.Post]:vA,[ve.BookList]:SA,[ve.Donation]:EA},IA={[ve.Book]:qs.Book,[ve.Profile]:qs.SharedUser,[ve.Review]:qs.Review,[ve.Quote]:qs.Quote,[ve.Post]:qs.Post,[ve.BookList]:qs.Booklist,[ve.Donation]:null},Wm=new gt("SHARE_PAGE_CONTENT_RESOLVERS");var Vm=t=>t.pipe(De(e=>e.hasError?null:e.result),qt(()=>pe(null))),CA=()=>({provide:Wm,useFactory:()=>{let t=T(oE),e=T(sE),n=T(rE),i=T(iE);return{[ve.Review]:r=>Vm(t.getReviewById(r)),[ve.Quote]:r=>Vm(e.getById(r)),[ve.Post]:r=>Vm(n.getPost(r)),[ve.BookList]:r=>Vm(i.getListDetail(r))}}});var J5=()=>T(Qo).getImageBaseUrl(),wA={providers:[vS(pI),cv(),Wu(J5),KT(),Rv(Nv(),Ov([XE,qE,mA,UE,QE,VE])),Dv(Mv({includePostRequests:!0,includeHeaders:["cookie"],includeRequestsWithAuthHeaders:!0}),Pv()),JT("service-worker.js",{enabled:!vl(),registrationStrategy:"registerWhenStable:30000"}),cS(()=>uS(ln.firebase)),dS(()=>mS()),{provide:as,useValue:ln.firebase},kE,xp,hA(),CA(),lt,Lv,Gv,{provide:jv,useValue:{}},{provide:yS,useClass:ed},{provide:lv,useClass:qm},{provide:uA,deps:[Yt]},{provide:gp,useClass:Zp,deps:[Ko]},{provide:Ko,useValue:"fa"},{provide:PS,useFactory:t=>t==="fa"?dI:mI,deps:[Ko]},{provide:"SocialAuthServiceConfig",useValue:{autoLogin:!1,providers:[{id:ih.PROVIDER_ID,provider:new ih("48920246526-rf5uaor5hc2qprrsn2a4hbfv71p5fl0k.apps.googleusercontent.com")}]}}]};var t7=new Map,n7={activated:!1,tokenObservers:[]},i7={initialized:!1,enabled:!1};function Yi(t){return t7.get(t)||Object.assign({},n7)}function RA(){return i7}var r7="https://content-firebaseappcheck.googleapis.com/v1";var s7="exchangeDebugToken",xA={OFFSET_DURATION:300*1e3,RETRIAL_MIN_WAIT:30*1e3,RETRIAL_MAX_WAIT:960*1e3},zpe=1440*60*1e3;var Py=class{constructor(e,n,i,r,s){if(this.operation=e,this.retryPolicy=n,this.getWaitDuration=i,this.lowerBound=r,this.upperBound=s,this.pending=null,this.nextErrorWaitInterval=r,r>s)throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}process(e){return k(this,null,function*(){this.stop();try{this.pending=new zt,this.pending.promise.catch(n=>{}),yield o7(this.getNextRun(e)),this.pending.resolve(),yield this.pending.promise,this.pending=new zt,this.pending.promise.catch(n=>{}),yield this.operation(),this.pending.resolve(),yield this.pending.promise,this.process(!0).catch(()=>{})}catch(n){this.retryPolicy(n)?this.process(!1).catch(()=>{}):this.stop()}})}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{let n=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),n}}};function o7(t){return new Promise(e=>{setTimeout(e,t)})}var a7={"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.","initial-throttle":"{$httpStatus} error. Attempts allowed again after {$time}",throttled:"Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}"},Is=new Jv("appCheck","AppCheck",a7);function OA(t){if(!Yi(t).activated)throw Is.create("use-before-activation",{appName:t.name})}function NA(i,r){return k(this,arguments,function*({url:t,body:e},n){let s={"Content-Type":"application/json"},o=n.getImmediate({optional:!0});if(o){let f=yield o.getHeartbeatsHeader();f&&(s["X-Firebase-Client"]=f)}let a={method:"POST",body:JSON.stringify(e),headers:s},l;try{l=yield fetch(t,a)}catch(f){throw Is.create("fetch-network-error",{originalErrorMessage:f==null?void 0:f.message})}if(l.status!==200)throw Is.create("fetch-status-error",{httpStatus:l.status});let c;try{c=yield l.json()}catch(f){throw Is.create("fetch-parse-error",{originalErrorMessage:f==null?void 0:f.message})}let u=c.ttl.match(/^([\d.]+)(s)$/);if(!u||!u[2]||isNaN(Number(u[1])))throw Is.create("fetch-parse-error",{originalErrorMessage:"ttl field (timeToLive) is not in standard Protobuf Duration "+"format: ".concat(c.ttl)});let p=Number(u[1])*1e3,m=Date.now();return{token:c.token,expireTimeMillis:m+p,issuedAtTimeMillis:m}})}
3function MA(t,e){let{projectId:n,appId:i,apiKey:r}=t.options;return{url:"".concat(r7,"/projects/").concat(n,"/apps/").concat(i,":").concat(s7,"?key=").concat(r),body:{debug_token:e}}}var l7="firebase-app-check-database",c7=1,Dy="firebase-app-check-store";var zm=null;function u7(){return zm||(zm=new Promise((t,e)=>{try{let n=indexedDB.open(l7,c7);n.onsuccess=i=>{t(i.target.result)},n.onerror=i=>{var r;e(Is.create("storage-open",{originalErrorMessage:(r=i.target.error)===null||r===void 0?void 0:r.message}))},n.onupgradeneeded=i=>{let r=i.target.result;switch(i.oldVersion){case 0:r.createObjectStore(Dy,{keyPath:"compositeKey"})}}}catch(n){e(Is.create("storage-open",{originalErrorMessage:n==null?void 0:n.message}))}}),zm)}function p7(t,e){return d7(m7(t),e)}function d7(t,e){return k(this,null,function*(){let i=(yield u7()).transaction(Dy,"readwrite"),s=i.objectStore(Dy).put({compositeKey:t,value:e});return new Promise((o,a)=>{s.onsuccess=l=>{o()},i.onerror=l=>{var c;a(Is.create("storage-set",{originalErrorMessage:(c=l.target.error)===null||c===void 0?void 0:c.message}))}})})}function m7(t){return"".concat(t.options.appId,"-").concat(t.name)}var iu=new zo("@firebase/app-check");function Ny(t,e){return Xv()?p7(t,e).catch(n=>{iu.warn("Failed to write token to IndexedDB. Error: ".concat(n))}):Promise.resolve()}function PA(){return RA().enabled}function DA(){return k(this,null,function*(){let t=RA();if(t.enabled&&t.token)return t.token.promise;throw Error("\n            Can't get debug token in production mode.\n        ")})}var f7={error:"UNKNOWN_ERROR"};function h7(t){return ip.encodeString(JSON.stringify(t),!1)}function Ly(t,e=!1,n=!1){return k(this,null,function*(){let i=t.app;OA(i);let r=Yi(i),s=r.token,o;if(s&&!ru(s)&&(r.token=void 0,s=void 0),!s){let c=yield r.cachedTokenPromise;c&&(ru(c)?s=c:yield Ny(i,void 0))}if(!e&&s&&ru(s))return{token:s.token};let a=!1;if(PA())try{r.exchangeTokenPromise||(r.exchangeTokenPromise=NA(MA(i,yield DA()),t.heartbeatServiceProvider).finally(()=>{r.exchangeTokenPromise=void 0}),a=!0);let c=yield r.exchangeTokenPromise;return yield Ny(i,c),r.token=c,{token:c.token}}catch(c){return c.code==="appCheck/throttled"||c.code==="appCheck/initial-throttle"?iu.warn(c.message):n&&iu.error(c),My(c)}try{r.exchangeTokenPromise||(r.exchangeTokenPromise=r.provider.getToken().finally(()=>{r.exchangeTokenPromise=void 0}),a=!0),s=yield Yi(i).exchangeTokenPromise}catch(c){c.code==="appCheck/throttled"||c.code==="appCheck/initial-throttle"?iu.warn(c.message):n&&iu.error(c),o=c}let l;return s?o?ru(s)?l={token:s.token,internalError:o}:l=My(o):(l={token:s.token},r.token=s,yield Ny(i,s)):l=My(o),a&&b7(i,l),l})}function g7(t){return k(this,null,function*(){let e=t.app;OA(e);let{provider:n}=Yi(e);if(PA()){let i=yield DA(),{token:r}=yield NA(MA(e,i),t.heartbeatServiceProvider);return{token:r}}else{let{token:i}=yield n.getToken();return{token:i}}})}function _7(t,e,n,i){let{app:r}=t,s=Yi(r),o={next:n,error:i,type:e};if(s.tokenObservers=[...s.tokenObservers,o],s.token&&ru(s.token)){let a=s.token;Promise.resolve().then(()=>{n({token:a.token}),AA(t)}).catch(()=>{})}s.cachedTokenPromise.then(()=>AA(t))}function LA(t,e){let n=Yi(t),i=n.tokenObservers.filter(r=>r.next!==e);i.length===0&&n.tokenRefresher&&n.tokenRefresher.isRunning()&&n.tokenRefresher.stop(),n.tokenObservers=i}function AA(t){let{app:e}=t,n=Yi(e),i=n.tokenRefresher;i||(i=y7(t),n.tokenRefresher=i),!i.isRunning()&&n.isTokenAutoRefreshEnabled&&i.start()}function y7(t){let{app:e}=t;return new Py(()=>k(null,null,function*(){let n=Yi(e),i;if(n.token?i=yield Ly(t,!0):i=yield Ly(t),i.error)throw i.error;if(i.internalError)throw i.internalError}),()=>!0,()=>{let n=Yi(e);if(n.token){let i=n.token.issuedAtTimeMillis+(n.token.expireTimeMillis-n.token.issuedAtTimeMillis)*.5+3e5,r=n.token.expireTimeMillis-300*1e3;return i=Math.min(i,r),Math.max(0,i-Date.now())}else return 0},xA.RETRIAL_MIN_WAIT,xA.RETRIAL_MAX_WAIT)}function b7(t,e){let n=Yi(t).tokenObservers;for(let i of n)try{i.type==="EXTERNAL"&&e.error!=null?i.error(e.error):i.next(e)}catch{}}function ru(t){return t.expireTimeMillis-Date.now()>0}function My(t){return{token:h7(f7),error:t}}var Fy=class{constructor(e,n){this.app=e,this.heartbeatServiceProvider=n}_delete(){let{tokenObservers:e}=Yi(this.app);for(let n of e)LA(this.app,n.next);return Promise.resolve()}};function v7(t,e){return new Fy(t,e)}function S7(t){return{getToken:e=>Ly(t,e),getLimitedUseToken:()=>g7(t),addTokenListener:e=>_7(t,"INTERNAL",e),removeTokenListener:e=>LA(t.app,e)}}var E7="@firebase/app-check",T7="0.10.1";var I7="app-check",kA="app-check-internal";function C7(){Tl(new Cr(I7,t=>{let e=t.getProvider("app").getImmediate(),n=t.getProvider("heartbeat");return v7(e,n)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,e,n)=>{t.getProvider(kA).initialize()})),Tl(new Cr(kA,t=>{let e=t.getProvider("app-check").getImmediate();return S7(e)},"PUBLIC").setInstantiationMode("EXPLICIT")),Yo(E7,T7)}C7();var w7="app-check";var Xa=class{constructor(){return lS(w7)}};var x7=["localhost","0.0.0.0","127.0.0.1"],ade=typeof window<"u"&&x7.includes(window.location.hostname);var Uy=new gt("angularfire2.auth.use-emulator"),By=new gt("angularfire2.auth.settings"),Hy=new gt("angularfire2.auth.tenant-id"),qy=new gt("angularfire2.auth.langugage-code"),jy=new gt("angularfire2.auth.use-device-language"),Gy=new gt("angularfire.auth.persistence"),Wy=(t,e,n,i,r,s,o,a)=>aa("".concat(t.name,".auth"),"AngularFireAuth",t.name,()=>{let l=e.runOutsideAngular(()=>t.auth());if(n&&l.useEmulator(...n),i&&(l.tenantId=i),l.languageCode=r,s&&l.useDeviceLanguage(),o)for(let[c,u]of Object.entries(o))l.settings[c]=u;
3return a&&l.setPersistence(a),l},[n,i,r,s,o,a]),Vy=(()=>{let e=class e{constructor(i,r,s,o,a,l,c,u,p,m,f,h){d(this,"injector",T(qu));d(this,"authState");d(this,"idToken");d(this,"user");d(this,"idTokenResult");d(this,"credential");let _=new Qi,v=pe(void 0).pipe(Mn(a.outsideAngular),Le(()=>o.runOutsideAngular(()=>import("./chunk-JXZ6K7KU.js"))),De(()=>oa(i,o,r)),De(I=>Wy(I,o,l,u,p,m,c,f)),bl({bufferSize:1,refCount:!1}));if(xv(s))this.authState=this.user=this.idToken=this.idTokenResult=this.credential=pe(null);else{v.pipe(ev()).subscribe();let I=v.pipe(Le(P=>P.getRedirectResult().then(X=>X,()=>null)),wr(this.injector),bl({bufferSize:1,refCount:!1})),N=v.pipe(Le(P=>new Nn(X=>({unsubscribe:o.runOutsideAngular(()=>P.onAuthStateChanged(V=>X.next(V),V=>X.error(V),()=>X.complete()))})))),j=v.pipe(Le(P=>new Nn(X=>({unsubscribe:o.runOutsideAngular(()=>P.onIdTokenChanged(V=>X.next(V),V=>X.error(V),()=>X.complete()))}))));this.authState=I.pipe(Fo(N),Qn(a.outsideAngular),Mn(a.insideAngular)),this.user=I.pipe(Fo(j),Qn(a.outsideAngular),Mn(a.insideAngular)),this.idToken=this.user.pipe(Le(P=>P?Ce(P.getIdToken()):pe(null))),this.idTokenResult=this.user.pipe(Le(P=>P?Ce(P.getIdTokenResult()):pe(null))),this.credential=_l(I,_,this.authState.pipe(an(P=>!P))).pipe(De(P=>P!=null&&P.user?P:null),Qn(a.outsideAngular),Mn(a.insideAngular))}return td(this,v,o,{spy:{apply:(I,N,j)=>{(I.startsWith("signIn")||I.startsWith("createUser"))&&j.then(P=>_.next(P))}}})}};d(e,"\u0275fac",function(r){return new(r||e)(ue(as),ue(sa,8),ue(Fs),ue(Gt),ue(Gs),ue(Uy,8),ue(By,8),ue(Hy,8),ue(qy,8),ue(jy,8),ue(Gy,8),ue(Xa,8))}),d(e,"\u0275prov",vt({token:e,factory:e.\u0275fac,providedIn:"any"}));let t=e;return t})(),BA=(()=>{let e=class e{constructor(){Bn.registerVersion("angularfire",js.full,"auth-compat")}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275mod",Ir({type:e})),d(e,"\u0275inj",Tr({providers:[Vy]}));let t=e;return t})();var HA="@firebase/database",qA="1.0.20";var i0="";function r0(t){i0=t}var Zy=class{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,n){n==null?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),kt(n))}get(e){let n=this.domStorage_.getItem(this.prefixedName_(e));return n==null?null:rp(n)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}};var eb=class{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,n){n==null?delete this.cache_[e]:this.cache_[e]=n}get(e){return fi(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}};var yk=function(t){try{if(typeof window<"u"&&typeof window[t]<"u"){let e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new Zy(e)}}catch{}return new eb},xo=yk("localStorage"),tb=yk("sessionStorage");var tl=new zo("@firebase/database"),bk=(function(){let t=1;return function(){return t++}})(),vk=function(t){let e=rS(t),n=new iS;n.update(e);let i=n.digest();return ip.encodeByteArray(i)},Au=function(...t){let e="";for(let n=0;n<t.length;n++){let i=t[n];Array.isArray(i)||i&&typeof i=="object"&&typeof i.length=="number"?e+=Au.apply(null,i):typeof i=="object"?e+=kt(i):e+=i,e+=" "}return e},Ao=null,jA=!0,Sk=function(t,e){L(!e||t===!0||t===!1,"Can't turn on custom loggers persistently."),t===!0?(tl.logLevel=sS.VERBOSE,Ao=tl.log.bind(tl),e&&tb.set("logging_enabled",!0)):typeof t=="function"?Ao=t:(Ao=null,tb.remove("logging_enabled"))},Qt=function(...t){if(jA===!0&&(jA=!1,Ao===null&&tb.get("logging_enabled")===!0&&Sk(!0)),Ao){let e=Au.apply(null,t);Ao(e)}},ku=function(t){return function(...e){Qt(t,...e)}},nb=function(...t){let e="FIREBASE INTERNAL ERROR: "+Au(...t);tl.error(e)},vr=function(...t){let e="FIREBASE FATAL ERROR: ".concat(Au(...t));throw tl.error(e),new Error(e)},gn=function(...t){let e="FIREBASE WARNING: "+Au(...t);tl.warn(e)},R7=function(){typeof window<"u"&&window.location&&window.location.protocol&&window.location.protocol.indexOf("https:")!==-1&&gn("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},Sf=function(t){return typeof t=="number"&&(t!==t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)}
vendor: 95,574 bytes, line 3
3,O7=function(t){if(Zi()||document.readyState==="complete")t();else{let e=!1,n=function(){if(!document.body){setTimeout(n,Math.floor(10));return}e||(e=!0,t())};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&n()}),window.attachEvent("onload",n))}},As="[MIN_NAME]",$r="[MAX_NAME]",Ro=function(t,e){if(t===e)return 0;if(t===As||e===$r)return-1;if(e===As||t===$r)return 1;{let n=GA(t),i=GA(e);return n!==null?i!==null?n-i===0?t.length-e.length:n-i:-1:i!==null?1:t<e?-1:1}},N7=function(t,e){return t===e?0:t<e?-1:1},su=function(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+kt(e))},s0=function(t){if(typeof t!="object"||t===null)return kt(t);let e=[];for(let i in t)e.push(i);e.sort();let n="{";for(let i=0;i<e.length;i++)i!==0&&(n+=","),n+=kt(e[i]),n+=":",n+=s0(t[e[i]]);return n+="}",n},Ek=function(t,e){let n=t.length;if(n<=e)return[t];let i=[];for(let r=0;r<n;r+=e)r+e>n?i.push(t.substring(r,n)):i.push(t.substring(r,r+e));return i};function Xt(t,e){for(let n in t)t.hasOwnProperty(n)&&e(n,t[n])}var Tk=function(t){L(!Sf(t),"Invalid JSON number");let e=11,n=52,i=(1<<e-1)-1,r,s,o,a,l;t===0?(s=0,o=0,r=1/t===-1/0?1:0):(r=t<0,t=Math.abs(t),t>=Math.pow(2,1-i)?(a=Math.min(Math.floor(Math.log(t)/Math.LN2),i),s=a+i,o=Math.round(t*Math.pow(2,n-a)-Math.pow(2,n))):(s=0,o=Math.round(t/Math.pow(2,1-i-n))));let c=[];for(l=n;l;l-=1)c.push(o%2?1:0),o=Math.floor(o/2);for(l=e;l;l-=1)c.push(s%2?1:0),s=Math.floor(s/2);c.push(r?1:0),c.reverse();let u=c.join(""),p="";for(l=0;l<64;l+=8){let m=parseInt(u.substr(l,8),2).toString(16);m.length===1&&(m="0"+m),p=p+m}return p.toLowerCase()},M7=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},P7=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function D7(t,e){let n="Unknown Error";t==="too_big"?n="The data requested exceeds the maximum size that can be accessed with a single request.":t==="permission_denied"?n="Client doesn't have permission to access the desired data.":t==="unavailable"&&(n="The service is unavailable");let i=new Error(t+" at "+e._path.toString()+": "+n);return i.code=t.toUpperCase(),i}var L7=new RegExp("^-?(0*)\\d{1,10}$"),F7=-2147483648,U7=2147483647,GA=function(t){if(L7.test(t)){let e=Number(t);if(e>=F7&&e<=U7)return e}return null},ul=function(t){try{t()}catch(e){setTimeout(()=>{let n=e.stack||"";throw gn("Exception was thrown by user callback.",n),e},Math.floor(0))}},B7=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},cu=function(t,e){let n=setTimeout(t,e);return typeof n=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(n):typeof n=="object"&&n.unref&&n.unref(),n};var ib=class{constructor(e,n){this.appCheckProvider=n,this.appName=e.name,oS(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.appCheck=n==null?void 0:n.getImmediate({optional:!0}),this.appCheck||n==null||n.get().then(i=>this.appCheck=i)}getToken(e){if(this.serverAppAppCheckToken){if(e)throw new Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(e):new Promise((n,i)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(n,i):n(null)},0)})}addTokenChangeListener(e){var n;(n=this.appCheckProvider)===null||n===void 0||n.get().then(i=>i.addTokenListener(e))}notifyForInvalidToken(){gn('Provided AppCheck credentials for the app named "'.concat(this.appName,'" ')+"are invalid. This usually indicates your app was not initialized correctly.")}};var rb=class{constructor(e,n,i){this.appName_=e,this.firebaseOptions_=n,this.authProvider_=i,this.auth_=null,this.auth_=i.getImmediate({optional:!0}),this.auth_||i.onInit(r=>this.auth_=r)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(n=>n&&n.code==="auth/token-not-initialized"?(Qt("Got auth/token-not-initialized error.  Treating as null token."),null):Promise.reject(n)):new Promise((n,i)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(n,i):n(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(n=>n.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(n=>n.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',gn(e)}},uu=(()=>{class t{constructor(n){this.accessToken=n}getToken(n){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(n){n(this.accessToken)}removeTokenChangeListener(n){}notifyForInvalidToken(){}}t.OWNER="owner";return t})(),$m="5",Ik="v",Ck="s",wk="r",xk="f",Ak=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,kk="ls",Rk="p",sb="ac",Ok="websocket",Nk="long_polling";var Km=class{constructor(e,n,i,r,s=!1,o="",a=!1,l=!1,c=null){this.secure=n,this.namespace=i,this.webSocketOnly=r,this.nodeAdmin=s,this.persistenceKey=o,this.includeNamespaceInQueryParams=a,this.isUsingEmulator=l,this.emulatorOptions=c,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=xo.get("host:"+e)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&xo.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){let e=this.secure?"https://":"http://",n=this.includeNamespaceInQueryParams?"?ns=".concat(this.namespace):"";return"".concat(e).concat(this.host,"/").concat(n)}};function H7(t){return t.host!==t.internalHost||t.isCustomHost()||t.includeNamespaceInQueryParams}function Mk(t,e,n){L(typeof e=="string","typeof type must == string"),L(typeof n=="object","typeof params must == object");let i;if(e===Ok)i=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else if(e===Nk)i=(t.secure?"https://":"http://")+t.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+e);H7(t)&&(n.ns=t.namespace);let r=[];return Xt(n,(s,o)=>{r.push(s+"="+o)}),i+r.join("&")}var ob=class{constructor(){this.counters_={}}incrementCounter(e,n=1){fi(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=n}get(){return zv(this.counters_)}};var zy={},Yy={};function o0(t){let e=t.toString();return zy[e]||(zy[e]=new ob),zy[e]}function q7(t,e){let n=t.toString();return Yy[n]||(Yy[n]=e()),Yy[n]}var ab=class{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,n){this.closeAfterResponse=e,this.onClose=n,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,n){for(this.pendingResponses[e]=n;this.pendingResponses[this.currentResponseNum];){let i=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let r=0;r<i.length;++r)i[r]&&ul(()=>{this.onMessage_(i[r])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}};var WA="start",j7="close",G7="pLPCommand",W7="pRTLPCB",Pk="id",Dk="pw",Lk="ser",V7="cb",z7="seg",Y7="ts",$7="d",K7="dframe",Fk=1870,Uk=30,Q7=Fk-Uk,X7=25e3,J7=3e4,fu=class t{constructor(e,n,i,r,s,o,a){this.connId=e,this.repoInfo=n,this.applicationId=i,this.appCheckToken=r,this.authToken=s,this.transportSessionId=o,this.lastSessionId=a,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=ku(e),this.stats_=o0(n),this.urlFn=l=>(this.appCheckToken&&(l[sb]=this.appCheckToken),Mk(n,Nk,l))}open(e,n){this.curSegmentNum=0,this.onDisconnect_=n,this.myPacketOrderer=new ab(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(J7)),O7(()=>{if(this.isClosed_)return;this.scriptTagHolder=new lb((...s)=>{let[o,a,l,c,u]=s;if(this.incrementIncomingBytes_(s),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,o===WA)this.id=a,this.password=l;else if(o===j7)a?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(a,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+o)},(...s)=>{let[o,a]=s;this.incrementIncomingBytes_(s),this.myPacketOrderer.handleResponse(o,a)},()=>{this.onClosed_()},this.urlFn);let i={};i[WA]="t",i[Lk]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(i[V7]=this.scriptTagHolder.uniqueCallbackIdentifier),i[Ik]=$m,this.transportSessionId&&(i[Ck]=this.transportSessionId),this.lastSessionId&&(i[kk]=this.lastSessionId),this.applicationId&&(i[Rk]=this.applicationId),this.appCheckToken&&(i[sb]=this.appCheckToken),typeof location<"u"&&location.hostname&&Ak.test(location.hostname)&&(i[wk]=xk);let r=this.urlFn(i);this.log_("Connecting via long-poll to "+r),this.scriptTagHolder.addTag(r,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){t.forceAllow_=!0}static forceDisallow(){t.forceDisallow_=!0}static isAvailable(){return Zi()?!1:t.forceAllow_?!0:!t.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!M7()&&!P7()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){let n=kt(e);this.bytesSent+=n.length,this.stats_.incrementCounter("bytes_sent",n.length);let i=Vv(n),r=Ek(i,Q7);for(let s=0;s<r.length;s++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,r.length,r[s]),this.curSegmentNum++}addDisconnectPingFrame(e,n){if(Zi())return;this.myDisconnFrame=document.createElement("iframe");let i={};i[K7]="t",i[Pk]=e,i[Dk]=n,this.myDisconnFrame.src=this.urlFn(i),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){let n=kt(e).length;this.bytesReceived+=n,this.stats_.incrementCounter("bytes_received",n)}},lb=class t{constructor(e,n,i,r){if(this.onDisconnect=i,this.urlFn=r,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(Math.random()*1e8),this.sendNewPolls=!0,Zi())this.commandCB=e,this.onMessageCB=n;else{this.uniqueCallbackIdentifier=bk(),window[G7+this.uniqueCallbackIdentifier]=e,window[W7+this.uniqueCallbackIdentifier]=n,this.myIFrame=t.createIFrame_();let s="";this.myIFrame.src&&this.myIFrame.src.substr(0,11)==="javascript:"&&(s='<script>document.domain="'+document.domain+'";<\/script>');let o="<html><body>"+s+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(o),this.myIFrame.doc.close()}catch(a){Qt("frame writing exception"),a.stack&&Qt(a.stack),Qt(a)}}}static createIFrame_(){let e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||Qt("No IE domain setting required")}catch{let i=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+i+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));let e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,n){for(this.myID=e,this.myPW=n,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;let e={};e[Pk]=this.myID,e[Dk]=this.myPW,e[Lk]=this.currentSerial;let n=this.urlFn(e),i="",r=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+Uk+i.length<=Fk;){let o=this.pendingSegs.shift();i=i+"&"+z7+r+"="+o.seg+"&"+Y7+r+"="+o.ts+"&"+$7+r+"="+o.d,r++}return n=n+i,this.addLongPollTag_(n,this.currentSerial),!0}else return!1}enqueueSegment(e,n,i){this.pendingSegs.push({seg:e,ts:n,d:i}),this.alive&&this.newRequest_()}addLongPollTag_(e,n){this.outstandingRequests.add(n);let i=()=>{this.outstandingRequests.delete(n),this.newRequest_()},r=setTimeout(i,Math.floor(X7)),s=()=>{clearTimeout(r),i()};this.addTag(e,s)}addTag(e,n){Zi()?this.doNodeLongPoll(e,n):setTimeout(()=>{try{if(!this.sendNewPolls)return;let i=this.myIFrame.doc.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.onload=i.onreadystatechange=function(){let r=i.readyState;(!r||r==="loaded"||r==="complete")&&(i.onload=i.onreadystatechange=null,i.parentNode&&i.parentNode.removeChild(i),n())},i.onerror=()=>{Qt("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(i)}catch{}},Math.floor(1))}};var Z7=16384,eH=45e3,Qm=null;typeof MozWebSocket<"u"?Qm=MozWebSocket:typeof WebSocket<"u"&&(Qm=WebSocket);var Za=(()=>{class t{constructor(n,i,r,s,o,a,l){this.connId=n,this.applicationId=r,this.appCheckToken=s,this.authToken=o,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=ku(this.connId),this.stats_=o0(i),this.connURL=t.connectionURL_(i,a,l,s,r),this.nodeAdmin=i.nodeAdmin}static connectionURL_(n,i,r,s,o){let a={};return a[Ik]=$m,!Zi()&&typeof location<"u"&&location.hostname&&Ak.test(location.hostname)&&(a[wk]=xk),i&&(a[Ck]=i),r&&(a[kk]=r),s&&(a[sb]=s),o&&(a[Rk]=o),Mk(n,Ok,a)}open(n,i){this.onDisconnect=i,this.onMessage=n,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,xo.set("previous_websocket_failure",!0);try{let r;if(Zi()){let s=this.nodeAdmin?"AdminNode":"Node";r={headers:{"User-Agent":"Firebase/".concat($m,"/").concat(i0,"/").concat(process.platform,"/").concat(s),"X-Firebase-GMPID":this.applicationId||""}},this.authToken&&(r.headers.Authorization="Bearer ".concat(this.authToken)),this.appCheckToken&&(r.headers["X-Firebase-AppCheck"]=this.appCheckToken);let o=process.env,a=this.connURL.indexOf("wss://")===0?o.HTTPS_PROXY||o.https_proxy:o.HTTP_PROXY||o.http_proxy;a&&(r.proxy={origin:a})}this.mySock=new Qm(this.connURL,[],r)}catch(r){this.log_("Error instantiating WebSocket.");let s=r.message||r.data;s&&this.log_(s),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=r=>{this.handleIncomingFrame(r)},this.mySock.onerror=r=>{this.log_("WebSocket error.  Closing connection.");let s=r.message||r.data;s&&this.log_(s),this.onClosed_()}}start(){}static forceDisallow(){t.forceDisallow_=!0}static isAvailable(){let n=!1;if(typeof navigator<"u"&&navigator.userAgent){let i=/Android ([0-9]{0,}\.[0-9]{0,})/,r=navigator.userAgent.match(i);r&&r.length>1&&parseFloat(r[1])<4.4&&(n=!0)}return!n&&Qm!==null&&!t.forceDisallow_}static previouslyFailed(){return xo.isInMemoryStorage||xo.get("previous_websocket_failure")===!0}markConnectionHealthy(){xo.remove("previous_websocket_failure")}appendFrame_(n){if(this.frames.push(n),this.frames.length===this.totalFrames){let i=this.frames.join("");this.frames=null;let r=rp(i);this.onMessage(r)}}handleNewFrameCount_(n){this.totalFrames=n,this.frames=[]}extractFrameCount_(n){if(L(this.frames===null,"We already have a frame buffer"),n.length<=6){let i=Number(n);if(!isNaN(i))return this.handleNewFrameCount_(i),null}return this.handleNewFrameCount_(1),n}handleIncomingFrame(n){if(this.mySock===null)return;let i=n.data;if(this.bytesReceived+=i.length,this.stats_.incrementCounter("bytes_received",i.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(i);else{let r=this.extractFrameCount_(i);r!==null&&this.appendFrame_(r)}}send(n){this.resetKeepAlive();let i=kt(n);this.bytesSent+=i.length,this.stats_.incrementCounter("bytes_sent",i.length);let r=Ek(i,Z7);r.length>1&&this.sendString_(String(r.length));for(let s=0;s<r.length;s++)this.sendString_(r[s])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(eH))}sendString_(n){try{this.mySock.send(n)}catch(i){this.log_("Exception thrown from WebSocket.send():",i.message||i.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}t.responsesRequiredToBeHealthy=2,t.healthyTimeout=3e4;return t})(),Bk=(()=>{class t{static get ALL_TRANSPORTS(){return[fu,Za]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(n){this.initTransports_(n)}initTransports_(n){let i=Za&&Za.isAvailable(),r=i&&!Za.previouslyFailed();if(n.webSocketOnly&&(i||gn("wss:// URL used, but browser isn't known to support websockets.  Trying anyway."),r=!0),r)this.transports_=[Za];else{let s=this.transports_=[];for(let o of t.ALL_TRANSPORTS)o&&o.isAvailable()&&s.push(o);t.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}t.globalTransportInitialized_=!1;return t})(),tH=6e4,nH=5e3,iH=10*1024,rH=100*1024,$y="t",VA="d",sH="s",zA="r",oH="e",YA="o",$A="a",KA="n",QA="p",aH="h",cb=class{constructor(e,n,i,r,s,o,a,l,c,u){this.id=e,this.repoInfo_=n,this.applicationId_=i,this.appCheckToken_=r,this.authToken_=s,this.onMessage_=o,this.onReady_=a,this.onDisconnect_=l,this.onKill_=c,this.lastSessionId=u,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=ku("c:"+this.id+":"),this.transportManager_=new Bk(n),this.log_("Connection created"),this.start_()}start_(){let e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let n=this.connReceiver_(this.conn_),i=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(n,i)},Math.floor(0));let r=e.healthyTimeout||0;r>0&&(this.healthyTimeout_=cu(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>rH?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes.  Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>iH?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes.  Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(r)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return n=>{e===this.conn_?this.onConnectionLost_(n):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return n=>{this.state_!==2&&(e===this.rx_?this.onPrimaryMessageReceived_(n):e===this.secondaryConn_?this.onSecondaryMessageReceived_(n):this.log_("message on old connection"))}}sendRequest(e){let n={t:"d",d:e};this.sendData_(n)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if($y in e){let n=e[$y];n===$A?this.upgradeIfSecondaryHealthy_():n===zA?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):n===YA&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){let n=su("t",e),i=su("d",e);if(n==="c")this.onSecondaryControl_(i);else if(n==="d")this.pendingDataMessages.push(i);else throw new Error("Unknown protocol layer: "+n)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:QA,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:$A,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:KA,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){let n=su("t",e),i=su("d",e);n==="c"?this.onControl_(i):n==="d"&&this.onDataMessage_(i)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){let n=su($y,e);if(VA in e){let i=e[VA];if(n===aH){let r=Object.assign({},i);this.repoInfo_.isUsingEmulator&&(r.h=this.repoInfo_.host),this.onHandshake_(r)}else if(n===KA){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let r=0;r<this.pendingDataMessages.length;++r)this.onDataMessage_(this.pendingDataMessages[r]);this.pendingDataMessages=[],this.tryCleanupConnection()}else n===sH?this.onConnectionShutdown_(i):n===zA?this.onReset_(i):n===oH?nb("Server Error: "+i):n===YA?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):nb("Unknown control packet command: "+n)}}onHandshake_(e){let n=e.ts,i=e.v,r=e.h;this.sessionId=e.s,this.repoInfo_.host=r,this.state_===0&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,n),$m!==i&&gn("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){let e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}startUpgrade_(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let n=this.connReceiver_(this.secondaryConn_),i=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,i),cu(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(tH))}onReset_(e){this.log_("Reset packet received.  New host: "+e),this.repoInfo_.host=e,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,n){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(n,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):cu(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(nH))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:QA,d:{}}}))}onSecondaryConnectionLost_(){let e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,!e&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(xo.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(e)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}};var Xm=class{put(e,n,i,r){}merge(e,n,i,r){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,n,i){}onDisconnectMerge(e,n,i){}onDisconnectCancel(e,n){}reportStats(e){}};var Jm=class{constructor(e){this.allowedEvents_=e,this.listeners_={},L(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...n){if(Array.isArray(this.listeners_[e])){let i=[...this.listeners_[e]];for(let r=0;r<i.length;r++)i[r].callback.apply(i[r].context,n)}}on(e,n,i){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:n,context:i});let r=this.getInitialEvent(e);r&&n.apply(i,r)}off(e,n,i){this.validateEventType_(e);let r=this.listeners_[e]||[];for(let s=0;s<r.length;s++)if(r[s].callback===n&&(!i||i===r[s].context)){r.splice(s,1);return}}validateEventType_(e){L(this.allowedEvents_.find(n=>n===e),"Unknown event: "+e)}};var Zm=class t extends Jm{static getInstance(){return new t}constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!eh()&&(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}getInitialEvent(e){return L(e==="online","Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}};var XA=32,JA=768,Ye=class{constructor(e,n){if(n===void 0){this.pieces_=e.split("/");let i=0;for(let r=0;r<this.pieces_.length;r++)this.pieces_[r].length>0&&(this.pieces_[i]=this.pieces_[r],i++);this.pieces_.length=i,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=n}toString(){let e="";for(let n=this.pieceNum_;n<this.pieces_.length;n++)this.pieces_[n]!==""&&(e+="/"+this.pieces_[n]);return e||"/"}};function ze(){return new Ye("")}function ke(t){return t.pieceNum_>=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function ks(t){return t.pieces_.length-t.pieceNum_}function at(t){let e=t.pieceNum_;return e<t.pieces_.length&&e++,new Ye(t.pieces_,e)}function a0(t){return t.pieceNum_<t.pieces_.length?t.pieces_[t.pieces_.length-1]:null}function lH(t){let e="";for(let n=t.pieceNum_;n<t.pieces_.length;n++)t.pieces_[n]!==""&&(e+="/"+encodeURIComponent(String(t.pieces_[n])));return e||"/"}function hu(t,e=0){return t.pieces_.slice(t.pieceNum_+e)}function Hk(t){if(t.pieceNum_>=t.pieces_.length)return null;let e=[];for(let n=t.pieceNum_;n<t.pieces_.length-1;n++)e.push(t.pieces_[n]);return new Ye(e,0)}function yt(t,e){let n=[];for(let i=t.pieceNum_;i<t.pieces_.length;i++)n.push(t.pieces_[i]);if(e instanceof Ye)for(let i=e.pieceNum_;i<e.pieces_.length;i++)n.push(e.pieces_[i]);else{let i=e.split("/");for(let r=0;r<i.length;r++)i[r].length>0&&n.push(i[r])}return new Ye(n,0)}function Re(t){return t.pieceNum_>=t.pieces_.length}function xn(t,e){let n=ke(t),i=ke(e);if(n===null)return e;if(n===i)return xn(at(t),at(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")}function cH(t,e){let n=hu(t,0),i=hu(e,0);for(let r=0;r<n.length&&r<i.length;r++){let s=Ro(n[r],i[r]);if(s!==0)return s}return n.length===i.length?0:n.length<i.length?-1:1}function l0(t,e){if(ks(t)!==ks(e))return!1;for(let n=t.pieceNum_,i=e.pieceNum_;n<=t.pieces_.length;n++,i++)if(t.pieces_[n]!==e.pieces_[i])return!1;return!0}function Ri(t,e){let n=t.pieceNum_,i=e.pieceNum_;if(ks(t)>ks(e))return!1;for(;n<t.pieces_.length;){if(t.pieces_[n]!==e.pieces_[i])return!1;++n,++i}return!0}var ub=class{constructor(e,n){this.errorPrefix_=n,this.parts_=hu(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let i=0;i<this.parts_.length;i++)this.byteLength_+=El(this.parts_[i]);qk(this)}};function uH(t,e){t.parts_.length>0&&(t.byteLength_+=1),t.parts_.push(e),t.byteLength_+=El(e),qk(t)}function pH(t){let e=t.parts_.pop();t.byteLength_-=El(e),t.parts_.length>0&&(t.byteLength_-=1)}function qk(t){if(t.byteLength_>JA)throw new Error(t.errorPrefix_+"has a key path longer than "+JA+" bytes ("+t.byteLength_+").");if(t.parts_.length>XA)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+XA+") or object contains a cycle "+wo(t))}function wo(t){return t.parts_.length===0?"":"in property '"+t.parts_.join(".")+"'"}var pb=class t extends Jm{static getInstance(){return new t}constructor(){super(["visible"]);let e,n;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(n="visibilitychange",e="hidden"):typeof document.mozHidden<"u"?(n="mozvisibilitychange",e="mozHidden"):typeof document.msHidden<"u"?(n="msvisibilitychange",e="msHidden"):typeof document.webkitHidden<"u"&&(n="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,n&&document.addEventListener(n,()=>{let i=!document[e];i!==this.visible_&&(this.visible_=i,this.trigger("visible",i))},!1)}getInitialEvent(e){return L(e==="visible","Unknown event type: "+e),[this.visible_]}};var ou=1e3,dH=300*1e3,ZA=30*1e3,mH=1.3,fH=3e4,hH="server_kill",ek=3,c0=(()=>{class t extends Xm{constructor(n,i,r,s,o,a,l,c){if(super(),this.repoInfo_=n,this.applicationId_=i,this.onDataUpdate_=r,this.onConnectStatus_=s,this.onServerInfoUpdate_=o,this.authTokenProvider_=a,this.appCheckTokenProvider_=l,this.authOverride_=c,this.id=t.nextPersistentConnectionId_++,this.log_=ku("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=ou,this.maxReconnectDelay_=dH,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,c&&!Zi())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");pb.getInstance().on("visible",this.onVisible_,this),n.host.indexOf("fblocal")===-1&&Zm.getInstance().on("online",this.onOnline_,this)}sendRequest(n,i,r){let s=++this.requestNumber_,o={r:s,a:n,b:i};this.log_(kt(o)),L(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(o),r&&(this.requestCBHash_[s]=r)}get(n){this.initConnection_();let i=new zt,s={action:"g",request:{p:n._path.toString(),q:n._queryObject},onComplete:a=>{let l=a.d;a.s==="ok"?i.resolve(l):i.reject(l)}};this.outstandingGets_.push(s),this.outstandingGetCount_++;let o=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(o),i.promise}listen(n,i,r,s){this.initConnection_();let o=n._queryIdentifier,a=n._path.toString();this.log_("Listen called for "+a+" "+o),this.listens.has(a)||this.listens.set(a,new Map),L(n._queryParams.isDefault()||!n._queryParams.loadsAllData(),"listen() called for non-default but complete query"),L(!this.listens.get(a).has(o),"listen() called twice for same path/queryId.");let l={onComplete:s,hashFn:i,query:n,tag:r};this.listens.get(a).set(o,l),this.connected_&&this.sendListen_(l)}sendGet_(n){let i=this.outstandingGets_[n];this.sendRequest("g",i.request,r=>{delete this.outstandingGets_[n],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),i.onComplete&&i.onComplete(r)})}sendListen_(n){let i=n.query,r=i._path.toString(),s=i._queryIdentifier;this.log_("Listen on "+r+" for "+s);let o={p:r},a="q";n.tag&&(o.q=i._queryObject,o.t=n.tag),o.h=n.hashFn(),this.sendRequest(a,o,l=>{let c=l.d,u=l.s;t.warnOnListenWarnings_(c,i),(this.listens.get(r)&&this.listens.get(r).get(s))===n&&(this.log_("listen response",l),u!=="ok"&&this.removeListen_(r,s),n.onComplete&&n.onComplete(u,c))})}static warnOnListenWarnings_(n,i){if(n&&typeof n=="object"&&fi(n,"w")){let r=Zr(n,"w");if(Array.isArray(r)&&~r.indexOf("no_index")){let s='".indexOn": "'+i._queryParams.getIndex().toString()+'"',o=i._path.toString();gn("Using an unspecified index. Your data will be downloaded and "+"filtered on the client. Consider adding ".concat(s," at ")+"".concat(o," to your security rules for better performance."))}}}refreshAuthToken(n){this.authToken_=n,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(n)}reduceReconnectDelayIfAdminCredential_(n){(n&&n.length===40||eS(n))&&(this.log_("Admin auth credential detected.  Reducing max reconnect time."),this.maxReconnectDelay_=ZA)}refreshAppCheckToken(n){this.appCheckToken_=n,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){let n=this.authToken_,i=Zv(n)?"auth":"gauth",r={cred:n};this.authOverride_===null?r.noauth=!0:typeof this.authOverride_=="object"&&(r.authvar=this.authOverride_),this.sendRequest(i,r,s=>{let o=s.s,a=s.d||"error";this.authToken_===n&&(o==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(o,a))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},n=>{let i=n.s,r=n.d||"error";i==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(i,r)})}unlisten(n,i){let r=n._path.toString(),s=n._queryIdentifier;this.log_("Unlisten called for "+r+" "+s),L(n._queryParams.isDefault()||!n._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(r,s)&&this.connected_&&this.sendUnlisten_(r,s,n._queryObject,i)}sendUnlisten_(n,i,r,s){this.log_("Unlisten on "+n+" for "+i);let o={p:n},a="n";s&&(o.q=r,o.t=s),this.sendRequest(a,o)}onDisconnectPut(n,i,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",n,i,r):this.onDisconnectRequestQueue_.push({pathString:n,action:"o",data:i,onComplete:r})}onDisconnectMerge(n,i,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",n,i,r):this.onDisconnectRequestQueue_.push({pathString:n,action:"om",data:i,onComplete:r})}onDisconnectCancel(n,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",n,null,i):this.onDisconnectRequestQueue_.push({pathString:n,action:"oc",data:null,onComplete:i})}sendOnDisconnect_(n,i,r,s){let o={p:i,d:r};this.log_("onDisconnect "+n,o),this.sendRequest(n,o,a=>{s&&setTimeout(()=>{s(a.s,a.d)},Math.floor(0))})}put(n,i,r,s){this.putInternal("p",n,i,r,s)}merge(n,i,r,s){this.putInternal("m",n,i,r,s)}putInternal(n,i,r,s,o){this.initConnection_();let a={p:i,d:r};o!==void 0&&(a.h=o),this.outstandingPuts_.push({action:n,request:a,onComplete:s}),this.outstandingPutCount_++;let l=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(l):this.log_("Buffering put: "+i)}sendPut_(n){let i=this.outstandingPuts_[n].action,r=this.outstandingPuts_[n].request,s=this.outstandingPuts_[n].onComplete;this.outstandingPuts_[n].queued=this.connected_,this.sendRequest(i,r,o=>{this.log_(i+" response",o),delete this.outstandingPuts_[n],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),s&&s(o.s,o.d)})}reportStats(n){if(this.connected_){let i={c:n};this.log_("reportStats",i),this.sendRequest("s",i,r=>{if(r.s!=="ok"){let o=r.d;this.log_("reportStats","Error sending stats: "+o)}})}}onDataMessage_(n){if("r"in n){this.log_("from server: "+kt(n));let i=n.r,r=this.requestCBHash_[i];r&&(delete this.requestCBHash_[i],r(n.b))}else{if("error"in n)throw"A server-side error has occurred: "+n.error;"a"in n&&this.onDataPush_(n.a,n.b)}}onDataPush_(n,i){this.log_("handleServerMessage",n,i),n==="d"?this.onDataUpdate_(i.p,i.d,!1,i.t):n==="m"?this.onDataUpdate_(i.p,i.d,!0,i.t):n==="c"?this.onListenRevoked_(i.p,i.q):n==="ac"?this.onAuthRevoked_(i.s,i.d):n==="apc"?this.onAppCheckRevoked_(i.s,i.d):n==="sd"?this.onSecurityDebugPacket_(i):nb("Unrecognized action received from server: "+kt(n)+"\nAre you using the latest client?")}onReady_(n,i){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(n),this.lastSessionId=i,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(n){L(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(n))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(n){n&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible.  Reducing delay."),this.reconnectDelay_=ou,this.realtime_||this.scheduleConnect_(0)),this.visible_=n}onOnline_(n){n?(this.log_("Browser went online."),this.reconnectDelay_=ou,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline.  Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>fH&&(this.reconnectDelay_=ou),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible.  Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());let n=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_),i=Math.max(0,this.reconnectDelay_-n);i=Math.random()*i,this.log_("Trying to reconnect in "+i+"ms"),this.scheduleConnect_(i),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*mH)}this.onConnectStatus_(!1)}establishConnection_(){return k(this,null,function*(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;let n=this.onDataMessage_.bind(this),i=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),s=this.id+":"+t.nextConnectionId_++,o=this.lastSessionId,a=!1,l=null,c=function(){l?l.close():(a=!0,r())},u=function(m){L(l,"sendRequest call when we're not connected not allowed."),l.sendRequest(m)};this.realtime_={close:c,sendRequest:u};let p=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{let[m,f]=yield Promise.all([this.authTokenProvider_.getToken(p),this.appCheckTokenProvider_.getToken(p)]);a?Qt("getToken() completed but was canceled"):(Qt("getToken() completed. Creating connection."),this.authToken_=m&&m.accessToken,this.appCheckToken_=f&&f.token,l=new cb(s,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,n,i,r,h=>{gn(h+" ("+this.repoInfo_.toString()+")"),this.interrupt(hH)},o))}catch(m){this.log_("Failed to get token: "+m),a||(this.repoInfo_.nodeAdmin&&gn(m),c())}}})}interrupt(n){Qt("Interrupting connection for reason: "+n),this.interruptReasons_[n]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(n){Qt("Resuming connection for reason: "+n),delete this.interruptReasons_[n],sp(this.interruptReasons_)&&(this.reconnectDelay_=ou,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(n){let i=n-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:i})}cancelSentTransactions_(){for(let n=0;n<this.outstandingPuts_.length;n++){let i=this.outstandingPuts_[n];i&&"h"in i.request&&i.queued&&(i.onComplete&&i.onComplete("disconnect"),delete this.outstandingPuts_[n],this.outstandingPutCount_--)}this.outstandingPutCount_===0&&(this.outstandingPuts_=[])}onListenRevoked_(n,i){let r;i?r=i.map(o=>s0(o)).join("$"):r="default";let s=this.removeListen_(n,r);s&&s.onComplete&&s.onComplete("permission_denied")}removeListen_(n,i){let r=new Ye(n).toString(),s;if(this.listens.has(r)){let o=this.listens.get(r);s=o.get(i),o.delete(i),o.size===0&&this.listens.delete(r)}else s=void 0;return s}onAuthRevoked_(n,i){Qt("Auth token revoked: "+n+"/"+i),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(n==="invalid_token"||n==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=ek&&(this.reconnectDelay_=ZA,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(n,i){Qt("App check token revoked: "+n+"/"+i),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(n==="invalid_token"||n==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=ek&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(n){this.securityDebugCallback_?this.securityDebugCallback_(n):"msg"in n&&console.log("FIREBASE: "+n.msg.replace("\n","\nFIREBASE: "))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(let n of this.listens.values())for(let i of n.values())this.sendListen_(i);for(let n=0;n<this.outstandingPuts_.length;n++)this.outstandingPuts_[n]&&this.sendPut_(n);for(;this.onDisconnectRequestQueue_.length;){let n=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(n.action,n.pathString,n.data,n.onComplete)}for(let n=0;n<this.outstandingGets_.length;n++)this.outstandingGets_[n]&&this.sendGet_(n)}sendConnectStats_(){let n={},i="js";Zi()&&(this.repoInfo_.nodeAdmin?i="admin_node":i="node"),n["sdk."+i+"."+i0.replace(/\./g,"-")]=1,eh()?n["framework.cordova"]=1:Qv()&&(n["framework.reactnative"]=1),this.reportStats(n)}shouldReconnect_(){let n=Zm.getInstance().currentlyOnline();return sp(this.interruptReasons_)&&n}}t.nextPersistentConnectionId_=0,t.nextConnectionId_=0;return t})(),Ne=class t{constructor(e,n){this.name=e,this.node=n}static Wrap(e,n){return new t(e,n)}};var nl=class{getCompare(){return this.compare.bind(this)}indexedValueChanged(e,n){let i=new Ne(As,e),r=new Ne(As,n);return this.compare(i,r)!==0}minPost(){return Ne.MIN}};var Ym,ef=class extends nl{static get __EMPTY_NODE(){return Ym}static set __EMPTY_NODE(e){Ym=e}compare(e,n){return Ro(e.name,n.name)}isDefinedOn(e){throw Vo("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,n){return!1}minPost(){return Ne.MIN}maxPost(){return new Ne($r,Ym)}makePost(e,n){return L(typeof e=="string","KeyIndex indexValue must always be a string."),new Ne(e,Ym)}toString(){return".key"}},br=new ef;var el=class{constructor(e,n,i,r,s=null){this.isReverse_=r,this.resultGenerator_=s,this.nodeStack_=[];let o=1;for(;!e.isEmpty();)if(e=e,o=n?i(e.key,n):1,r&&(o*=-1),o<0)this.isReverse_?e=e.left:e=e.right;else if(o===0){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),this.isReverse_?e=e.right:e=e.left}getNext(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_.pop(),n;if(this.resultGenerator_?n=this.resultGenerator_(e.key,e.value):n={key:e.key,value:e.value},this.isReverse_)for(e=e.left;!e.isEmpty();)this.nodeStack_.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack_.push(e),e=e.left;return n}hasNext(){return this.nodeStack_.length>0}peek(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}},$i=(()=>{class t{constructor(n,i,r,s,o){this.key=n,this.value=i,this.color=r!=null?r:t.RED,this.left=s!=null?s:Oi.EMPTY_NODE,this.right=o!=null?o:Oi.EMPTY_NODE}copy(n,i,r,s,o){return new t(n!=null?n:this.key,i!=null?i:this.value,r!=null?r:this.color,s!=null?s:this.left,o!=null?o:this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(n){return this.left.inorderTraversal(n)||!!n(this.key,this.value)||this.right.inorderTraversal(n)}reverseTraversal(n){return this.right.reverseTraversal(n)||n(this.key,this.value)||this.left.reverseTraversal(n)}min_(){return this.left.isEmpty()?this:this.left.min_()}minKey(){return this.min_().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(n,i,r){let s=this,o=r(n,s.key);return o<0?s=s.copy(null,null,null,s.left.insert(n,i,r),null):o===0?s=s.copy(null,i,null,null,null):s=s.copy(null,null,null,null,s.right.insert(n,i,r)),s.fixUp_()}removeMin_(){if(this.left.isEmpty())return Oi.EMPTY_NODE;let n=this;return!n.left.isRed_()&&!n.left.left.isRed_()&&(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.removeMin_(),null),n.fixUp_()}remove(n,i){let r,s;if(r=this,i(n,r.key)<0)!r.left.isEmpty()&&!r.left.isRed_()&&!r.left.left.isRed_()&&(r=r.moveRedLeft_()),r=r.copy(null,null,null,r.left.remove(n,i),null);else{if(r.left.isRed_()&&(r=r.rotateRight_()),!r.right.isEmpty()&&!r.right.isRed_()&&!r.right.left.isRed_()&&(r=r.moveRedRight_()),i(n,r.key)===0){if(r.right.isEmpty())return Oi.EMPTY_NODE;s=r.right.min_(),r=r.copy(s.key,s.value,null,null,r.right.removeMin_())}r=r.copy(null,null,null,null,r.right.remove(n,i))}return r.fixUp_()}isRed_(){return this.color}fixUp_(){let n=this;return n.right.isRed_()&&!n.left.isRed_()&&(n=n.rotateLeft_()),n.left.isRed_()&&n.left.left.isRed_()&&(n=n.rotateRight_()),n.left.isRed_()&&n.right.isRed_()&&(n=n.colorFlip_()),n}moveRedLeft_(){let n=this.colorFlip_();return n.right.left.isRed_()&&(n=n.copy(null,null,null,null,n.right.rotateRight_()),n=n.rotateLeft_(),n=n.colorFlip_()),n}moveRedRight_(){let n=this.colorFlip_();return n.left.left.isRed_()&&(n=n.rotateRight_(),n=n.colorFlip_()),n}rotateLeft_(){let n=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,n,null)}rotateRight_(){let n=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,n)}colorFlip_(){let n=this.left.copy(null,null,!this.left.color,null,null),i=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,n,i)}checkMaxDepth_(){let n=this.check_();return Math.pow(2,n)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");let n=this.left.check_();if(n!==this.right.check_())throw new Error("Black depths differ");return n+(this.isRed_()?0:1)}}return t.RED=!0,t.BLACK=!1,t})(),db=class{copy(e,n,i,r,s){return this}insert(e,n,i){return new $i(e,n,null)}remove(e,n){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}},Oi=class t{constructor(e,n=t.EMPTY_NODE){this.comparator_=e,this.root_=n}insert(e,n){return new t(this.comparator_,this.root_.insert(e,n,this.comparator_).copy(null,null,$i.BLACK,null,null))}remove(e){return new t(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,$i.BLACK,null,null))}get(e){let n,i=this.root_;for(;!i.isEmpty();){if(n=this.comparator_(e,i.key),n===0)return i.value;n<0?i=i.left:n>0&&(i=i.right)}return null}getPredecessorKey(e){let n,i=this.root_,r=null;for(;!i.isEmpty();)if(n=this.comparator_(e,i.key),n===0){if(i.left.isEmpty())return r?r.key:null;for(i=i.left;!i.right.isEmpty();)i=i.right;return i.key}else n<0?i=i.left:n>0&&(r=i,i=i.right);throw new Error("Attempted to find predecessor key for a nonexistent key.  What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new el(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,n){return new el(this.root_,e,this.comparator_,!1,n)}getReverseIteratorFrom(e,n){return new el(this.root_,e,this.comparator_,!0,n)}getReverseIterator(e){return new el(this.root_,null,this.comparator_,!0,e)}};Oi.EMPTY_NODE=new db;function gH(t,e){return Ro(t.name,e.name)}function u0(t,e){return Ro(t,e)}var mb;function _H(t){mb=t}var jk=function(t){return typeof t=="number"?"number:"+Tk(t):"string:"+t},Gk=function(t){if(t.isLeafNode()){let e=t.val();L(typeof e=="string"||typeof e=="number"||typeof e=="object"&&fi(e,".sv"),"Priority must be a string or number.")}else L(t===mb||t.isEmpty(),"priority of unexpected type.");L(t===mb||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};var tk,il=(()=>{class t{static set __childrenNodeConstructor(n){tk=n}static get __childrenNodeConstructor(){return tk}constructor(n,i=t.__childrenNodeConstructor.EMPTY_NODE){this.value_=n,this.priorityNode_=i,this.lazyHash_=null,L(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),Gk(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(n){return new t(this.value_,n)}getImmediateChild(n){return n===".priority"?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE}getChild(n){return Re(n)?this:ke(n)===".priority"?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(n,i){return null}updateImmediateChild(n,i){return n===".priority"?this.updatePriority(i):i.isEmpty()&&n!==".priority"?this:t.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(n,i).updatePriority(this.priorityNode_)}updateChild(n,i){let r=ke(n);return r===null?i:i.isEmpty()&&r!==".priority"?this:(L(r!==".priority"||ks(n)===1,".priority must be the last token in a path"),this.updateImmediateChild(r,t.__childrenNodeConstructor.EMPTY_NODE.updateChild(at(n),i)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(n,i){return!1}val(n){return n&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let n="";this.priorityNode_.isEmpty()||(n+="priority:"+jk(this.priorityNode_.val())+":");let i=typeof this.value_;n+=i+":",i==="number"?n+=Tk(this.value_):n+=this.value_,this.lazyHash_=vk(n)}return this.lazyHash_}getValue(){return this.value_}compareTo(n){return n===t.__childrenNodeConstructor.EMPTY_NODE?1:n instanceof t.__childrenNodeConstructor?-1:(L(n.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(n))}compareToLeafNode_(n){let i=typeof n.value_,r=typeof this.value_,s=t.VALUE_TYPE_ORDER.indexOf(i),o=t.VALUE_TYPE_ORDER.indexOf(r);return L(s>=0,"Unknown leaf type: "+i),L(o>=0,"Unknown leaf type: "+r),s===o?r==="object"?0:this.value_<n.value_?-1:this.value_===n.value_?0:1:o-s}withIndex(){return this}isIndexed(){return!0}equals(n){if(n===this)return!0;if(n.isLeafNode()){let i=n;return this.value_===i.value_&&this.priorityNode_.equals(i.priorityNode_)}else return!1}}t.VALUE_TYPE_ORDER=["object","boolean","number","string"];return t})(),Wk,Vk;function yH(t){Wk=t}function bH(t){Vk=t}var fb=class extends nl{compare(e,n){let i=e.node.getPriority(),r=n.node.getPriority(),s=i.compareTo(r);return s===0?Ro(e.name,n.name):s}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,n){return!e.getPriority().equals(n.getPriority())}minPost(){return Ne.MIN}maxPost(){return new Ne($r,new il("[PRIORITY-POST]",Vk))}makePost(e,n){let i=Wk(e);return new Ne(n,new il("[PRIORITY-POST]",i))}toString(){return".priority"}},pt=new fb;var vH=Math.log(2),hb=class{constructor(e){let n=s=>parseInt(Math.log(s)/vH,10),i=s=>parseInt(Array(s+1).join("1"),2);this.count=n(e+1),this.current_=this.count-1;let r=i(this.count);this.bits_=e+1&r}nextBitIsOne(){let e=!(this.bits_&1<<this.current_);return this.current_--,e}},tf=function(t,e,n,i){t.sort(e);let r=function(l,c){let u=c-l,p,m;if(u===0)return null;if(u===1)return p=t[l],m=n?n(p):p,new $i(m,p.node,$i.BLACK,null,null);{let f=parseInt(u/2,10)+l,h=r(l,f),_=r(f+1,c);return p=t[f],m=n?n(p):p,new $i(m,p.node,$i.BLACK,h,_)}},s=function(l){let c=null,u=null,p=t.length,m=function(h,_){let v=p-h,I=p;p-=h;let N=r(v+1,I),j=t[v],P=n?n(j):j;f(new $i(P,j.node,_,null,N))},f=function(h){c?(c.left=h,c=h):(u=h,c=h)};for(let h=0;h<l.count;++h){let _=l.nextBitIsOne(),v=Math.pow(2,l.count-(h+1));_?m(v,$i.BLACK):(m(v,$i.BLACK),m(v,$i.RED))}return u},o=new hb(t.length),a=s(o);return new Oi(i||e,a)};var Ky,Ja={},rl=class t{static get Default(){return L(Ja&&pt,"ChildrenNode.ts has not been loaded"),Ky=Ky||new t({".priority":Ja},{".priority":pt}),Ky}constructor(e,n){this.indexes_=e,this.indexSet_=n}get(e){let n=Zr(this.indexes_,e);if(!n)throw new Error("No index defined for "+e);return n instanceof Oi?n:null}hasIndex(e){return fi(this.indexSet_,e.toString())}addIndex(e,n){L(e!==br,"KeyIndex always exists and isn't meant to be added to the IndexMap.");let i=[],r=!1,s=n.getIterator(Ne.Wrap),o=s.getNext();for(;o;)r=r||e.isDefinedOn(o.node),i.push(o),o=s.getNext();let a;r?a=tf(i,e.getCompare()):a=Ja;let l=e.toString(),c=Object.assign({},this.indexSet_);c[l]=e;let u=Object.assign({},this.indexes_);return u[l]=a,new t(u,c)}addToIndexes(e,n){let i=Sl(this.indexes_,(r,s)=>{let o=Zr(this.indexSet_,s);if(L(o,"Missing index implementation for "+s),r===Ja)if(o.isDefinedOn(e.node)){let a=[],l=n.getIterator(Ne.Wrap),c=l.getNext();for(;c;)c.name!==e.name&&a.push(c),c=l.getNext();return a.push(e),tf(a,o.getCompare())}else return Ja;else{let a=n.get(e.name),l=r;return a&&(l=l.remove(new Ne(e.name,a))),l.insert(e,e.node)}});return new t(i,this.indexSet_)}removeFromIndexes(e,n){let i=Sl(this.indexes_,r=>{if(r===Ja)return r;{let s=n.get(e.name);return s?r.remove(new Ne(e.name,s)):r}});return new t(i,this.indexSet_)}};var au,_e=(()=>{class t{static get EMPTY_NODE(){return au||(au=new t(new Oi(u0),null,rl.Default))}constructor(n,i,r){this.children_=n,this.priorityNode_=i,this.indexMap_=r,this.lazyHash_=null,this.priorityNode_&&Gk(this.priorityNode_),this.children_.isEmpty()&&L(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||au}updatePriority(n){return this.children_.isEmpty()?this:new t(this.children_,n,this.indexMap_)}getImmediateChild(n){if(n===".priority")return this.getPriority();{let i=this.children_.get(n);return i===null?au:i}}getChild(n){let i=ke(n);return i===null?this:this.getImmediateChild(i).getChild(at(n))}hasChild(n){return this.children_.get(n)!==null}updateImmediateChild(n,i){if(L(i,"We should always be passing snapshot nodes"),n===".priority")return this.updatePriority(i);{let r=new Ne(n,i),s,o;i.isEmpty()?(s=this.children_.remove(n),o=this.indexMap_.removeFromIndexes(r,this.children_)):(s=this.children_.insert(n,i),o=this.indexMap_.addToIndexes(r,this.children_));let a=s.isEmpty()?au:this.priorityNode_;return new t(s,a,o)}}updateChild(n,i){let r=ke(n);if(r===null)return i;{L(ke(n)!==".priority"||ks(n)===1,".priority must be the last token in a path");let s=this.getImmediateChild(r).updateChild(at(n),i);return this.updateImmediateChild(r,s)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(n){if(this.isEmpty())return null;let i={},r=0,s=0,o=!0;if(this.forEachChild(pt,(a,l)=>{i[a]=l.val(n),r++,o&&t.INTEGER_REGEXP_.test(a)?s=Math.max(s,Number(a)):o=!1}),!n&&o&&s<2*r){let a=[];for(let l in i)a[l]=i[l];return a}else return n&&!this.getPriority().isEmpty()&&(i[".priority"]=this.getPriority().val()),i}hash(){if(this.lazyHash_===null){let n="";this.getPriority().isEmpty()||(n+="priority:"+jk(this.getPriority().val())+":"),this.forEachChild(pt,(i,r)=>{let s=r.hash();s!==""&&(n+=":"+i+":"+s)}),this.lazyHash_=n===""?"":vk(n)}return this.lazyHash_}getPredecessorChildName(n,i,r){let s=this.resolveIndex_(r);if(s){let o=s.getPredecessorKey(new Ne(n,i));return o?o.name:null}else return this.children_.getPredecessorKey(n)}getFirstChildName(n){let i=this.resolveIndex_(n);if(i){let r=i.minKey();return r&&r.name}else return this.children_.minKey()}getFirstChild(n){let i=this.getFirstChildName(n);return i?new Ne(i,this.children_.get(i)):null}getLastChildName(n){let i=this.resolveIndex_(n);if(i){let r=i.maxKey();return r&&r.name}else return this.children_.maxKey()}getLastChild(n){let i=this.getLastChildName(n);return i?new Ne(i,this.children_.get(i)):null}forEachChild(n,i){let r=this.resolveIndex_(n);return r?r.inorderTraversal(s=>i(s.name,s.node)):this.children_.inorderTraversal(i)}getIterator(n){return this.getIteratorFrom(n.minPost(),n)}getIteratorFrom(n,i){let r=this.resolveIndex_(i);if(r)return r.getIteratorFrom(n,s=>s);{let s=this.children_.getIteratorFrom(n.name,Ne.Wrap),o=s.peek();for(;o!=null&&i.compare(o,n)<0;)s.getNext(),o=s.peek();return s}}getReverseIterator(n){return this.getReverseIteratorFrom(n.maxPost(),n)}getReverseIteratorFrom(n,i){let r=this.resolveIndex_(i);if(r)return r.getReverseIteratorFrom(n,s=>s);{let s=this.children_.getReverseIteratorFrom(n.name,Ne.Wrap),o=s.peek();for(;o!=null&&i.compare(o,n)>0;)s.getNext(),o=s.peek();return s}}compareTo(n){return this.isEmpty()?n.isEmpty()?0:-1:n.isLeafNode()||n.isEmpty()?1:n===Ru?-1:0}withIndex(n){if(n===br||this.indexMap_.hasIndex(n))return this;{let i=this.indexMap_.addIndex(n,this.children_);return new t(this.children_,this.priorityNode_,i)}}isIndexed(n){return n===br||this.indexMap_.hasIndex(n)}equals(n){if(n===this)return!0;if(n.isLeafNode())return!1;{let i=n;if(this.getPriority().equals(i.getPriority()))if(this.children_.count()===i.children_.count()){let r=this.getIterator(pt),s=i.getIterator(pt),o=r.getNext(),a=s.getNext();for(;o&&a;){if(o.name!==a.name||!o.node.equals(a.node))return!1;o=r.getNext(),a=s.getNext()}return o===null&&a===null}else return!1;else return!1}}resolveIndex_(n){return n===br?null:this.indexMap_.get(n.toString())}}return t.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,t})(),gb=class extends _e{constructor(){super(new Oi(u0),_e.EMPTY_NODE,rl.Default)}compareTo(e){return e===this?0:1}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return _e.EMPTY_NODE}isEmpty(){return!1}},Ru=new gb;Object.defineProperties(Ne,{MIN:{value:new Ne(As,_e.EMPTY_NODE)},MAX:{value:new Ne($r,Ru)}});ef.__EMPTY_NODE=_e.EMPTY_NODE;il.__childrenNodeConstructor=_e;_H(Ru);bH(Ru);var SH=!0;function bt(t,e=null){if(t===null)return _e.EMPTY_NODE;if(typeof t=="object"&&".priority"in t&&(e=t[".priority"]),L(e===null||typeof e=="string"||typeof e=="number"||typeof e=="object"&&".sv"in e,"Invalid priority type found: "+typeof e),typeof t=="object"&&".value"in t&&t[".value"]!==null&&(t=t[".value"]),typeof t!="object"||".sv"in t){let n=t;return new il(n,bt(e))}if(!(t instanceof Array)&&SH){let n=[],i=!1;if(Xt(t,(o,a)=>{if(o.substring(0,1)!=="."){let l=bt(a);l.isEmpty()||(i=i||!l.getPriority().isEmpty(),n.push(new Ne(o,l)))}}),n.length===0)return _e.EMPTY_NODE;let s=tf(n,gH,o=>o.name,u0);if(i){let o=tf(n,pt.getCompare());return new _e(s,bt(e),new rl({".priority":o},{".priority":pt}))}else return new _e(s,bt(e),rl.Default)}else{let n=_e.EMPTY_NODE;return Xt(t,(i,r)=>{if(fi(t,i)&&i.substring(0,1)!=="."){let s=bt(r);(s.isLeafNode()||!s.isEmpty())&&(n=n.updateImmediateChild(i,s))}}),n.updatePriority(bt(e))}}yH(bt);var gu=class extends nl{constructor(e){super(),this.indexPath_=e,L(!Re(e)&&ke(e)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,n){let i=this.extractChild(e.node),r=this.extractChild(n.node),s=i.compareTo(r);return s===0?Ro(e.name,n.name):s}makePost(e,n){let i=bt(e),r=_e.EMPTY_NODE.updateChild(this.indexPath_,i);return new Ne(n,r)}maxPost(){let e=_e.EMPTY_NODE.updateChild(this.indexPath_,Ru);return new Ne($r,e)}toString(){return hu(this.indexPath_,0).join("/")}};var _b=class extends nl{compare(e,n){let i=e.node.compareTo(n.node);return i===0?Ro(e.name,n.name):i}isDefinedOn(e){return!0}indexedValueChanged(e,n){return!e.equals(n)}minPost(){return Ne.MIN}maxPost(){return Ne.MAX}makePost(e,n){let i=bt(e);return new Ne(n,i)}toString(){return".value"}},p0=new _b;function zk(t){return{type:"value",snapshotNode:t}}function sl(t,e){return{type:"child_added",snapshotNode:e,childName:t}}function _u(t,e){return{type:"child_removed",snapshotNode:e,childName:t}}function yu(t,e,n){return{type:"child_changed",snapshotNode:e,childName:t,oldSnap:n}}function EH(t,e){return{type:"child_moved",snapshotNode:e,childName:t}}var bu=class{constructor(e){this.index_=e}updateChild(e,n,i,r,s,o){L(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");let a=e.getImmediateChild(n);return a.getChild(r).equals(i.getChild(r))&&a.isEmpty()===i.isEmpty()||(o!=null&&(i.isEmpty()?e.hasChild(n)?o.trackChildChange(_u(n,a)):L(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?o.trackChildChange(sl(n,i)):o.trackChildChange(yu(n,i,a))),e.isLeafNode()&&i.isEmpty())?e:e.updateImmediateChild(n,i).withIndex(this.index_)}updateFullNode(e,n,i){return i!=null&&(e.isLeafNode()||e.forEachChild(pt,(r,s)=>{n.hasChild(r)||i.trackChildChange(_u(r,s))}),n.isLeafNode()||n.forEachChild(pt,(r,s)=>{if(e.hasChild(r)){let o=e.getImmediateChild(r);o.equals(s)||i.trackChildChange(yu(r,s,o))}else i.trackChildChange(sl(r,s))})),n.withIndex(this.index_)}updatePriority(e,n){return e.isEmpty()?_e.EMPTY_NODE:e.updatePriority(n)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}};var nf=class t{constructor(e){this.indexedFilter_=new bu(e.getIndex()),this.index_=e.getIndex(),this.startPost_=t.getStartPost_(e),this.endPost_=t.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){let n=this.startIsInclusive_?this.index_.compare(this.getStartPost(),e)<=0:this.index_.compare(this.getStartPost(),e)<0,i=this.endIsInclusive_?this.index_.compare(e,this.getEndPost())<=0:this.index_.compare(e,this.getEndPost())<0;return n&&i}updateChild(e,n,i,r,s,o){return this.matches(new Ne(n,i))||(i=_e.EMPTY_NODE),this.indexedFilter_.updateChild(e,n,i,r,s,o)}updateFullNode(e,n,i){n.isLeafNode()&&(n=_e.EMPTY_NODE);let r=n.withIndex(this.index_);r=r.updatePriority(_e.EMPTY_NODE);let s=this;return n.forEachChild(pt,(o,a)=>{s.matches(new Ne(o,a))||(r=r.updateImmediateChild(o,_e.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(e,r,i)}updatePriority(e,n){return e}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(e){if(e.hasStart()){let n=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),n)}else return e.getIndex().minPost()}static getEndPost_(e){if(e.hasEnd()){let n=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),n)}else return e.getIndex().maxPost()}};var yb=class{constructor(e){this.withinDirectionalStart=n=>this.reverse_?this.withinEndPost(n):this.withinStartPost(n),this.withinDirectionalEnd=n=>this.reverse_?this.withinStartPost(n):this.withinEndPost(n),this.withinStartPost=n=>{let i=this.index_.compare(this.rangedFilter_.getStartPost(),n);return this.startIsInclusive_?i<=0:i<0},this.withinEndPost=n=>{let i=this.index_.compare(n,this.rangedFilter_.getEndPost());return this.endIsInclusive_?i<=0:i<0},this.rangedFilter_=new nf(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft(),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}updateChild(e,n,i,r,s,o){return this.rangedFilter_.matches(new Ne(n,i))||(i=_e.EMPTY_NODE),e.getImmediateChild(n).equals(i)?e:e.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(e,n,i,r,s,o):this.fullLimitUpdateChild_(e,n,i,s,o)}updateFullNode(e,n,i){let r;if(n.isLeafNode()||n.isEmpty())r=_e.EMPTY_NODE.withIndex(this.index_);else if(this.limit_*2<n.numChildren()&&n.isIndexed(this.index_)){r=_e.EMPTY_NODE.withIndex(this.index_);let s;this.reverse_?s=n.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):s=n.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let o=0;for(;s.hasNext()&&o<this.limit_;){let a=s.getNext();if(this.withinDirectionalStart(a))if(this.withinDirectionalEnd(a))r=r.updateImmediateChild(a.name,a.node),o++;else break;else continue}}else{r=n.withIndex(this.index_),r=r.updatePriority(_e.EMPTY_NODE);let s;this.reverse_?s=r.getReverseIterator(this.index_):s=r.getIterator(this.index_);let o=0;for(;s.hasNext();){let a=s.getNext();o<this.limit_&&this.withinDirectionalStart(a)&&this.withinDirectionalEnd(a)?o++:r=r.updateImmediateChild(a.name,_e.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(e,r,i)}updatePriority(e,n){return e}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}fullLimitUpdateChild_(e,n,i,r,s){let o;if(this.reverse_){let p=this.index_.getCompare();o=(m,f)=>p(f,m)}else o=this.index_.getCompare();let a=e;L(a.numChildren()===this.limit_,"");let l=new Ne(n,i),c=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),u=this.rangedFilter_.matches(l);if(a.hasChild(n)){let p=a.getImmediateChild(n),m=r.getChildAfterChild(this.index_,c,this.reverse_);for(;m!=null&&(m.name===n||a.hasChild(m.name));)m=r.getChildAfterChild(this.index_,m,this.reverse_);let f=m==null?1:o(m,l);if(u&&!i.isEmpty()&&f>=0)return s!=null&&s.trackChildChange(yu(n,i,p)),a.updateImmediateChild(n,i);{s!=null&&s.trackChildChange(_u(n,p));let _=a.updateImmediateChild(n,_e.EMPTY_NODE);return m!=null&&this.rangedFilter_.matches(m)?(s!=null&&s.trackChildChange(sl(m.name,m.node)),_.updateImmediateChild(m.name,m.node)):_}}else return i.isEmpty()?e:u&&o(c,l)>=0?(s!=null&&(s.trackChildChange(_u(c.name,c.node)),s.trackChildChange(sl(n,i))),a.updateImmediateChild(n,i).updateImmediateChild(c.name,_e.EMPTY_NODE)):e}};var vu=class t{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=pt}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return L(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return L(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:As}hasEnd(){return this.endSet_}getIndexEndValue(){return L(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return L(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:$r}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return L(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===pt}copy(){let e=new t;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}};function TH(t){return t.loadsAllData()?new bu(t.getIndex()):t.hasLimit()?new yb(t):new nf(t)}function IH(t,e){let n=t.copy();return n.limitSet_=!0,n.limit_=e,n.viewFrom_="l",n}function CH(t,e){let n=t.copy();return n.limitSet_=!0,n.limit_=e,n.viewFrom_="r",n}function bb(t,e,n){let i=t.copy();return i.startSet_=!0,e===void 0&&(e=null),i.indexStartValue_=e,n!=null?(i.startNameSet_=!0,i.indexStartName_=n):(i.startNameSet_=!1,i.indexStartName_=""),i}function wH(t,e,n){let i;return t.index_===br||n?i=bb(t,e,n):i=bb(t,e,$r),i.startAfterSet_=!0,i}function vb(t,e,n){let i=t.copy();return i.endSet_=!0,e===void 0&&(e=null),i.indexEndValue_=e,n!==void 0?(i.endNameSet_=!0,i.indexEndName_=n):(i.endNameSet_=!1,i.indexEndName_=""),i}function xH(t,e,n){let i;return t.index_===br||n?i=vb(t,e,n):i=vb(t,e,As),i.endBeforeSet_=!0,i}function Ef(t,e){let n=t.copy();return n.index_=e,n}function nk(t){let e={};if(t.isDefault())return e;let n;if(t.index_===pt?n="$priority":t.index_===p0?n="$value":t.index_===br?n="$key":(L(t.index_ instanceof gu,"Unrecognized index type!"),n=t.index_.toString()),e.orderBy=kt(n),t.startSet_){let i=t.startAfterSet_?"startAfter":"startAt";e[i]=kt(t.indexStartValue_),t.startNameSet_&&(e[i]+=","+kt(t.indexStartName_))}if(t.endSet_){let i=t.endBeforeSet_?"endBefore":"endAt";e[i]=kt(t.indexEndValue_),t.endNameSet_&&(e[i]+=","+kt(t.indexEndName_))}return t.limitSet_&&(t.isViewFromLeft()?e.limitToFirst=t.limit_:e.limitToLast=t.limit_),e}function ik(t){let e={};if(t.startSet_&&(e.sp=t.indexStartValue_,t.startNameSet_&&(e.sn=t.indexStartName_),e.sin=!t.startAfterSet_),t.endSet_&&(e.ep=t.indexEndValue_,t.endNameSet_&&(e.en=t.indexEndName_),e.ein=!t.endBeforeSet_),t.limitSet_){e.l=t.limit_;let n=t.viewFrom_;n===""&&(t.isViewFromLeft()?n="l":n="r"),e.vf=n}return t.index_!==pt&&(e.i=t.index_.toString()),e}var Sb=class t extends Xm{reportStats(e){throw new Error("Method not implemented.")}static getListenId_(e,n){return n!==void 0?"tag$"+n:(L(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}constructor(e,n,i,r){super(),this.repoInfo_=e,this.onDataUpdate_=n,this.authTokenProvider_=i,this.appCheckTokenProvider_=r,this.log_=ku("p:rest:"),this.listens_={}}listen(e,n,i,r){let s=e._path.toString();this.log_("Listen called for "+s+" "+e._queryIdentifier);let o=t.getListenId_(e,i),a={};this.listens_[o]=a;let l=nk(e._queryParams);this.restRequest_(s+".json",l,(c,u)=>{let p=u;if(c===404&&(p=null,c=null),c===null&&this.onDataUpdate_(s,p,!1,i),Zr(this.listens_,o)===a){let m;c?c===401?m="permission_denied":m="rest_error:"+c:m="ok",r(m,null)}})}unlisten(e,n){let i=t.getListenId_(e,n);delete this.listens_[i]}get(e){let n=nk(e._queryParams),i=e._path.toString(),r=new zt;return this.restRequest_(i+".json",n,(s,o)=>{let a=o;s===404&&(a=null,s=null),s===null?(this.onDataUpdate_(i,a,!1,null),r.resolve(a)):r.reject(new Error(a))}),r.promise}refreshAuthToken(e){}restRequest_(e,n={},i){return n.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([r,s])=>{r&&r.accessToken&&(n.auth=r.accessToken),s&&s.token&&(n.ac=s.token);let o=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+nS(n);this.log_("Sending REST request for "+o);let a=new XMLHttpRequest;a.onreadystatechange=()=>{if(i&&a.readyState===4){this.log_("REST Response for "+o+" received. status:",a.status,"response:",a.responseText);let l=null;if(a.status>=200&&a.status<300){try{l=rp(a.responseText)}catch{gn("Failed to parse JSON response for "+o+": "+a.responseText)}i(null,l)}else a.status!==401&&a.status!==404&&gn("Got unsuccessful REST response for "+o+" Status: "+a.status),i(a.status);i=null}},a.open("GET",o,!0),a.send()})}};var Eb=class{constructor(){this.rootNode_=_e.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,n){this.rootNode_=this.rootNode_.updateChild(e,n)}};function rf(){return{value:null,children:new Map}}function pl(t,e,n){if(Re(e))t.value=n,t.children.clear();else if(t.value!==null)t.value=t.value.updateChild(e,n);else{let i=ke(e);t.children.has(i)||t.children.set(i,rf());let r=t.children.get(i);e=at(e),pl(r,e,n)}}function Tb(t,e){if(Re(e))return t.value=null,t.children.clear(),!0;if(t.value!==null){if(t.value.isLeafNode())return!1;{let n=t.value;return t.value=null,n.forEachChild(pt,(i,r)=>{pl(t,new Ye(i),r)}),Tb(t,e)}}else if(t.children.size>0){let n=ke(e);return e=at(e),t.children.has(n)&&Tb(t.children.get(n),e)&&t.children.delete(n),t.children.size===0}else return!0}function Ib(t,e,n){t.value!==null?n(e,t.value):AH(t,(i,r)=>{let s=new Ye(e.toString()+"/"+i);Ib(r,s,n)})}function AH(t,e){t.children.forEach((n,i)=>{e(i,n)})}var Cb=class{constructor(e){this.collection_=e,this.last_=null}get(){let e=this.collection_.get(),n=Object.assign({},e);return this.last_&&Xt(this.last_,(i,r)=>{n[i]=n[i]-r}),this.last_=e,n}};var rk=10*1e3,kH=30*1e3,RH=300*1e3,wb=class{constructor(e,n){this.server_=n,this.statsToReport_={},this.statsListener_=new Cb(e);let i=rk+(kH-rk)*Math.random();cu(this.reportStats_.bind(this),Math.floor(i))}reportStats_(){let e=this.statsListener_.get(),n={},i=!1;Xt(e,(r,s)=>{s>0&&fi(this.statsToReport_,r)&&(n[r]=s,i=!0)}),i&&this.server_.reportStats(n),cu(this.reportStats_.bind(this),Math.floor(Math.random()*2*RH))}};var yr=(function(t){return t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE",t})(yr||{});function d0(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function m0(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function f0(t){return{fromUser:!1,fromServer:!0,queryId:t,tagged:!0}}var xb=class t{constructor(e,n,i){this.path=e,this.affectedTree=n,this.revert=i,this.type=yr.ACK_USER_WRITE,this.source=d0()}operationForChild(e){if(Re(this.path)){if(this.affectedTree.value!=null)return L(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{let n=this.affectedTree.subtree(new Ye(e));return new t(ze(),n,this.revert)}}else return L(ke(this.path)===e,"operationForChild called for unrelated child."),new t(at(this.path),this.affectedTree,this.revert)}};var sf=class t{constructor(e,n){this.source=e,this.path=n,this.type=yr.LISTEN_COMPLETE}operationForChild(e){return Re(this.path)?new t(this.source,ze()):new t(this.source,at(this.path))}};var ol=class t{constructor(e,n,i){this.source=e,this.path=n,this.snap=i,this.type=yr.OVERWRITE}operationForChild(e){return Re(this.path)?new t(this.source,ze(),this.snap.getImmediateChild(e)):new t(this.source,at(this.path),this.snap)}};var Su=class t{constructor(e,n,i){this.source=e,this.path=n,this.children=i,this.type=yr.MERGE}operationForChild(e){if(Re(this.path)){let n=this.children.subtree(new Ye(e));return n.isEmpty()?null:n.value?new ol(this.source,ze(),n.value):new t(this.source,ze(),n)}else return L(ke(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new t(this.source,at(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}};var Sr=class{constructor(e,n,i){this.node_=e,this.fullyInitialized_=n,this.filtered_=i}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(e){if(Re(e))return this.isFullyInitialized()&&!this.filtered_;let n=ke(e);return this.isCompleteForChild(n)}isCompleteForChild(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)}getNode(){return this.node_}};var Ab=class{constructor(e){this.query_=e,this.index_=this.query_._queryParams.getIndex()}};function OH(t,e,n,i){let r=[],s=[];return e.forEach(o=>{o.type==="child_changed"&&t.index_.indexedValueChanged(o.oldSnap,o.snapshotNode)&&s.push(EH(o.childName,o.snapshotNode))}),lu(t,r,"child_removed",e,i,n),lu(t,r,"child_added",e,i,n),lu(t,r,"child_moved",s,i,n),lu(t,r,"child_changed",e,i,n),lu(t,r,"value",e,i,n),r}function lu(t,e,n,i,r,s){let o=i.filter(a=>a.type===n);o.sort((a,l)=>MH(t,a,l)),o.forEach(a=>{let l=NH(t,a,s);r.forEach(c=>{c.respondsTo(a.type)&&e.push(c.createEvent(l,t.query_))})})}function NH(t,e,n){return e.type==="value"||e.type==="child_removed"||(e.prevName=n.getPredecessorChildName(e.childName,e.snapshotNode,t.index_)),e}function MH(t,e,n){if(e.childName==null||n.childName==null)throw Vo("Should only compare child_ events.");let i=new Ne(e.childName,e.snapshotNode),r=new Ne(n.childName,n.snapshotNode);return t.index_.compare(i,r)}function Tf(t,e){return{eventCache:t,serverCache:e}}function pu(t,e,n,i){return Tf(new Sr(e,n,i),t.serverCache)}function Yk(t,e,n,i){return Tf(t.eventCache,new Sr(e,n,i))}function of(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function ko(t){return t.serverCache.isFullyInitialized()?t.serverCache.getNode():null}var Qy,PH=()=>(Qy||(Qy=new Oi(N7)),Qy),An=class t{static fromObject(e){let n=new t(null);return Xt(e,(i,r)=>{n=n.set(new Ye(i),r)}),n}constructor(e,n=PH()){this.value=e,this.children=n}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,n){if(this.value!=null&&n(this.value))return{path:ze(),value:this.value};if(Re(e))return null;{let i=ke(e),r=this.children.get(i);if(r!==null){let s=r.findRootMostMatchingPathAndValue(at(e),n);return s!=null?{path:yt(new Ye(i),s.path),value:s.value}:null}else return null}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(Re(e))return this;{let n=ke(e),i=this.children.get(n);return i!==null?i.subtree(at(e)):new t(null)}}set(e,n){if(Re(e))return new t(n,this.children);{let i=ke(e),s=(this.children.get(i)||new t(null)).set(at(e),n),o=this.children.insert(i,s);return new t(this.value,o)}}remove(e){if(Re(e))return this.children.isEmpty()?new t(null):new t(null,this.children);{let n=ke(e),i=this.children.get(n);if(i){let r=i.remove(at(e)),s;return r.isEmpty()?s=this.children.remove(n):s=this.children.insert(n,r),this.value===null&&s.isEmpty()?new t(null):new t(this.value,s)}else return this}}get(e){if(Re(e))return this.value;{let n=ke(e),i=this.children.get(n);return i?i.get(at(e)):null}}setTree(e,n){if(Re(e))return n;{let i=ke(e),s=(this.children.get(i)||new t(null)).setTree(at(e),n),o;return s.isEmpty()?o=this.children.remove(i):o=this.children.insert(i,s),new t(this.value,o)}}fold(e){return this.fold_(ze(),e)}fold_(e,n){let i={};return this.children.inorderTraversal((r,s)=>{i[r]=s.fold_(yt(e,r),n)}),n(e,this.value,i)}findOnPath(e,n){return this.findOnPath_(e,ze(),n)}findOnPath_(e,n,i){let r=this.value?i(n,this.value):!1;if(r)return r;if(Re(e))return null;{let s=ke(e),o=this.children.get(s);return o?o.findOnPath_(at(e),yt(n,s),i):null}}foreachOnPath(e,n){return this.foreachOnPath_(e,ze(),n)}foreachOnPath_(e,n,i){if(Re(e))return this;{this.value&&i(n,this.value);let r=ke(e),s=this.children.get(r);return s?s.foreachOnPath_(at(e),yt(n,r),i):new t(null)}}foreach(e){this.foreach_(ze(),e)}foreach_(e,n){this.children.inorderTraversal((i,r)=>{r.foreach_(yt(e,i),n)}),this.value&&n(e,this.value)}foreachChild(e){this.children.inorderTraversal((n,i)=>{i.value&&e(n,i.value)})}};var Ki=class t{constructor(e){this.writeTree_=e}static empty(){return new t(new An(null))}};function du(t,e,n){if(Re(e))return new Ki(new An(n));{let i=t.writeTree_.findRootMostValueAndPath(e);if(i!=null){let r=i.path,s=i.value,o=xn(r,e);return s=s.updateChild(o,n),new Ki(t.writeTree_.set(r,s))}else{let r=new An(n),s=t.writeTree_.setTree(e,r);return new Ki(s)}}}function kb(t,e,n){let i=t;return Xt(n,(r,s)=>{i=du(i,yt(e,r),s)}),i}function sk(t,e){if(Re(e))return Ki.empty();{let n=t.writeTree_.setTree(e,new An(null));return new Ki(n)}}function Rb(t,e){return Oo(t,e)!=null}function Oo(t,e){let n=t.writeTree_.findRootMostValueAndPath(e);return n!=null?t.writeTree_.get(n.path).getChild(xn(n.path,e)):null}function ok(t){let e=[],n=t.writeTree_.value;return n!=null?n.isLeafNode()||n.forEachChild(pt,(i,r)=>{e.push(new Ne(i,r))}):t.writeTree_.children.inorderTraversal((i,r)=>{r.value!=null&&e.push(new Ne(i,r.value))}),e}function ws(t,e){if(Re(e))return t;{let n=Oo(t,e);return n!=null?new Ki(new An(n)):new Ki(t.writeTree_.subtree(e))}}function Ob(t){return t.writeTree_.isEmpty()}function al(t,e){return $k(ze(),t.writeTree_,e)}function $k(t,e,n){if(e.value!=null)return n.updateChild(t,e.value);{let i=null;return e.children.inorderTraversal((r,s)=>{r===".priority"?(L(s.value!==null,"Priority writes must always be leaf nodes"),i=s.value):n=$k(yt(t,r),s,n)}),!n.getChild(t).isEmpty()&&i!==null&&(n=n.updateChild(yt(t,".priority"),i)),n}}function If(t,e){return Jk(e,t)}function DH(t,e,n,i,r){L(i>t.lastWriteId,"Stacking an older write on top of newer ones"),r===void 0&&(r=!0),t.allWrites.push({path:e,snap:n,writeId:i,visible:r}),r&&(t.visibleWrites=du(t.visibleWrites,e,n)),t.lastWriteId=i}function LH(t,e,n,i){L(i>t.lastWriteId,"Stacking an older merge on top of newer ones"),t.allWrites.push({path:e,children:n,writeId:i,visible:!0}),t.visibleWrites=kb(t.visibleWrites,e,n),t.lastWriteId=i}function FH(t,e){for(let n=0;n<t.allWrites.length;n++){let i=t.allWrites[n];if(i.writeId===e)return i}return null}function UH(t,e){let n=t.allWrites.findIndex(a=>a.writeId===e);L(n>=0,"removeWrite called with nonexistent writeId.");let i=t.allWrites[n];t.allWrites.splice(n,1);let r=i.visible,s=!1,o=t.allWrites.length-1;for(;r&&o>=0;){let a=t.allWrites[o];a.visible&&(o>=n&&BH(a,i.path)?r=!1:Ri(i.path,a.path)&&(s=!0)),o--}if(r){if(s)return HH(t),!0;if(i.snap)t.visibleWrites=sk(t.visibleWrites,i.path);else{let a=i.children;Xt(a,l=>{t.visibleWrites=sk(t.visibleWrites,yt(i.path,l))})}return!0}else return!1}function BH(t,e){if(t.snap)return Ri(t.path,e);for(let n in t.children)if(t.children.hasOwnProperty(n)&&Ri(yt(t.path,n),e))return!0;return!1}function HH(t){t.visibleWrites=Kk(t.allWrites,qH,ze()),t.allWrites.length>0?t.lastWriteId=t.allWrites[t.allWrites.length-1].writeId:t.lastWriteId=-1}function qH(t){return t.visible}function Kk(t,e,n){let i=Ki.empty();for(let r=0;r<t.length;++r){let s=t[r];if(e(s)){let o=s.path,a;if(s.snap)Ri(n,o)?(a=xn(n,o),i=du(i,a,s.snap)):Ri(o,n)&&(a=xn(o,n),i=du(i,ze(),s.snap.getChild(a)));else if(s.children){if(Ri(n,o))a=xn(n,o),i=kb(i,a,s.children);else if(Ri(o,n))if(a=xn(o,n),Re(a))i=kb(i,ze(),s.children);else{let l=Zr(s.children,ke(a));if(l){let c=l.getChild(at(a));i=du(i,ze(),c)}}}else throw Vo("WriteRecord should have .snap or .children")}}return i}function Qk(t,e,n,i,r){if(!i&&!r){let s=Oo(t.visibleWrites,e);if(s!=null)return s;{let o=ws(t.visibleWrites,e);if(Ob(o))return n;if(n==null&&!Rb(o,ze()))return null;{let a=n||_e.EMPTY_NODE;return al(o,a)}}}else{let s=ws(t.visibleWrites,e);if(!r&&Ob(s))return n;if(!r&&n==null&&!Rb(s,ze()))return null;{let o=function(c){return(c.visible||r)&&(!i||!~i.indexOf(c.writeId))&&(Ri(c.path,e)||Ri(e,c.path))},a=Kk(t.allWrites,o,e),l=n||_e.EMPTY_NODE;return al(a,l)}}}function jH(t,e,n){let i=_e.EMPTY_NODE,r=Oo(t.visibleWrites,e);if(r)return r.isLeafNode()||r.forEachChild(pt,(s,o)=>{i=i.updateImmediateChild(s,o)}),i;if(n){let s=ws(t.visibleWrites,e);return n.forEachChild(pt,(o,a)=>{let l=al(ws(s,new Ye(o)),a);i=i.updateImmediateChild(o,l)}),ok(s).forEach(o=>{i=i.updateImmediateChild(o.name,o.node)}),i}else{let s=ws(t.visibleWrites,e);return ok(s).forEach(o=>{i=i.updateImmediateChild(o.name,o.node)}),i}}function GH(t,e,n,i,r){L(i||r,"Either existingEventSnap or existingServerSnap must exist");let s=yt(e,n);if(Rb(t.visibleWrites,s))return null;{let o=ws(t.visibleWrites,s);return Ob(o)?r.getChild(n):al(o,r.getChild(n))}}function WH(t,e,n,i){let r=yt(e,n),s=Oo(t.visibleWrites,r);if(s!=null)return s;if(i.isCompleteForChild(n)){let o=ws(t.visibleWrites,r);return al(o,i.getNode().getImmediateChild(n))}else return null}function VH(t,e){return Oo(t.visibleWrites,e)}function zH(t,e,n,i,r,s,o){let a,l=ws(t.visibleWrites,e),c=Oo(l,ze());if(c!=null)a=c;else if(n!=null)a=al(l,n);else return[];if(a=a.withIndex(o),!a.isEmpty()&&!a.isLeafNode()){let u=[],p=o.getCompare(),m=s?a.getReverseIteratorFrom(i,o):a.getIteratorFrom(i,o),f=m.getNext();for(;f&&u.length<r;)p(f,i)!==0&&u.push(f),f=m.getNext();return u}else return[]}function YH(){return{visibleWrites:Ki.empty(),allWrites:[],lastWriteId:-1}}function af(t,e,n,i){return Qk(t.writeTree,t.treePath,e,n,i)}function h0(t,e){return jH(t.writeTree,t.treePath,e)}function ak(t,e,n,i){return GH(t.writeTree,t.treePath,e,n,i)}function lf(t,e){return VH(t.writeTree,yt(t.treePath,e))}function $H(t,e,n,i,r,s){return zH(t.writeTree,t.treePath,e,n,i,r,s)}function g0(t,e,n){return WH(t.writeTree,t.treePath,e,n)}function Xk(t,e){return Jk(yt(t.treePath,e),t.writeTree)}function Jk(t,e){return{treePath:t,writeTree:e}}var Nb=class{constructor(){this.changeMap=new Map}trackChildChange(e){let n=e.type,i=e.childName;L(n==="child_added"||n==="child_changed"||n==="child_removed","Only child changes supported for tracking"),L(i!==".priority","Only non-priority child changes can be tracked.");let r=this.changeMap.get(i);if(r){let s=r.type;if(n==="child_added"&&s==="child_removed")this.changeMap.set(i,yu(i,e.snapshotNode,r.snapshotNode));else if(n==="child_removed"&&s==="child_added")this.changeMap.delete(i);else if(n==="child_removed"&&s==="child_changed")this.changeMap.set(i,_u(i,r.oldSnap));else if(n==="child_changed"&&s==="child_added")this.changeMap.set(i,sl(i,e.snapshotNode));else if(n==="child_changed"&&s==="child_changed")this.changeMap.set(i,yu(i,e.snapshotNode,r.oldSnap));else throw Vo("Illegal combination of changes: "+e+" occurred after "+r)}else this.changeMap.set(i,e)}getChanges(){return Array.from(this.changeMap.values())}};var Mb=class{getCompleteChild(e){return null}getChildAfterChild(e,n,i){return null}},Zk=new Mb,Eu=class{constructor(e,n,i=null){this.writes_=e,this.viewCache_=n,this.optCompleteServerCache_=i}getCompleteChild(e){let n=this.viewCache_.eventCache;if(n.isCompleteForChild(e))return n.getNode().getImmediateChild(e);{let i=this.optCompleteServerCache_!=null?new Sr(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return g0(this.writes_,e,i)}}getChildAfterChild(e,n,i){let r=this.optCompleteServerCache_!=null?this.optCompleteServerCache_:ko(this.viewCache_),s=$H(this.writes_,r,n,1,i,e);return s.length===0?null:s[0]}};function KH(t){return{filter:t}}function QH(t,e){L(e.eventCache.getNode().isIndexed(t.filter.getIndex()),"Event snap not indexed"),L(e.serverCache.getNode().isIndexed(t.filter.getIndex()),"Server snap not indexed")}function XH(t,e,n,i,r){let s=new Nb,o,a;if(n.type===yr.OVERWRITE){let c=n;c.source.fromUser?o=Pb(t,e,c.path,c.snap,i,r,s):(L(c.source.fromServer,"Unknown source."),a=c.source.tagged||e.serverCache.isFiltered()&&!Re(c.path),o=cf(t,e,c.path,c.snap,i,r,a,s))}else if(n.type===yr.MERGE){let c=n;c.source.fromUser?o=ZH(t,e,c.path,c.children,i,r,s):(L(c.source.fromServer,"Unknown source."),a=c.source.tagged||e.serverCache.isFiltered(),o=Db(t,e,c.path,c.children,i,r,a,s))}else if(n.type===yr.ACK_USER_WRITE){let c=n;c.revert?o=nq(t,e,c.path,i,r,s):o=eq(t,e,c.path,c.affectedTree,i,r,s)}else if(n.type===yr.LISTEN_COMPLETE)o=tq(t,e,n.path,i,s);else throw Vo("Unknown operation type: "+n.type);let l=s.getChanges();return JH(e,o,l),{viewCache:o,changes:l}}function JH(t,e,n){let i=e.eventCache;if(i.isFullyInitialized()){let r=i.getNode().isLeafNode()||i.getNode().isEmpty(),s=of(t);(n.length>0||!t.eventCache.isFullyInitialized()||r&&!i.getNode().equals(s)||!i.getNode().getPriority().equals(s.getPriority()))&&n.push(zk(of(e)))}}function eR(t,e,n,i,r,s){let o=e.eventCache;if(lf(i,n)!=null)return e;{let a,l;if(Re(n))if(L(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){let c=ko(e),u=c instanceof _e?c:_e.EMPTY_NODE,p=h0(i,u);a=t.filter.updateFullNode(e.eventCache.getNode(),p,s)}else{let c=af(i,ko(e));a=t.filter.updateFullNode(e.eventCache.getNode(),c,s)}else{let c=ke(n);if(c===".priority"){L(ks(n)===1,"Can't have a priority with additional path components");let u=o.getNode();l=e.serverCache.getNode();let p=ak(i,n,u,l);p!=null?a=t.filter.updatePriority(u,p):a=o.getNode()}else{let u=at(n),p;if(o.isCompleteForChild(c)){l=e.serverCache.getNode();let m=ak(i,n,o.getNode(),l);m!=null?p=o.getNode().getImmediateChild(c).updateChild(u,m):p=o.getNode().getImmediateChild(c)}else p=g0(i,c,e.serverCache);p!=null?a=t.filter.updateChild(o.getNode(),c,p,u,r,s):a=o.getNode()}}return pu(e,a,o.isFullyInitialized()||Re(n),t.filter.filtersNodes())}}function cf(t,e,n,i,r,s,o,a){let l=e.serverCache,c,u=o?t.filter:t.filter.getIndexedFilter();if(Re(n))c=u.updateFullNode(l.getNode(),i,null);else if(u.filtersNodes()&&!l.isFiltered()){let f=l.getNode().updateChild(n,i);c=u.updateFullNode(l.getNode(),f,null)}else{let f=ke(n);if(!l.isCompleteForPath(n)&&ks(n)>1)return e;let h=at(n),v=l.getNode().getImmediateChild(f).updateChild(h,i);f===".priority"?c=u.updatePriority(l.getNode(),v):c=u.updateChild(l.getNode(),f,v,h,Zk,null)}let p=Yk(e,c,l.isFullyInitialized()||Re(n),u.filtersNodes()),m=new Eu(r,p,s);return eR(t,p,n,r,m,a)}function Pb(t,e,n,i,r,s,o){let a=e.eventCache,l,c,u=new Eu(r,e,s);if(Re(n))c=t.filter.updateFullNode(e.eventCache.getNode(),i,o),l=pu(e,c,!0,t.filter.filtersNodes());else{let p=ke(n);if(p===".priority")c=t.filter.updatePriority(e.eventCache.getNode(),i),l=pu(e,c,a.isFullyInitialized(),a.isFiltered());else{let m=at(n),f=a.getNode().getImmediateChild(p),h;if(Re(m))h=i;else{let _=u.getCompleteChild(p);_!=null?a0(m)===".priority"&&_.getChild(Hk(m)).isEmpty()?h=_:h=_.updateChild(m,i):h=_e.EMPTY_NODE}if(f.equals(h))l=e;else{let _=t.filter.updateChild(a.getNode(),p,h,m,u,o);l=pu(e,_,a.isFullyInitialized(),t.filter.filtersNodes())}}}return l}function lk(t,e){return t.eventCache.isCompleteForChild(e)}function ZH(t,e,n,i,r,s,o){let a=e;return i.foreach((l,c)=>{let u=yt(n,l);lk(e,ke(u))&&(a=Pb(t,a,u,c,r,s,o))}),i.foreach((l,c)=>{let u=yt(n,l);lk(e,ke(u))||(a=Pb(t,a,u,c,r,s,o))}),a}function ck(t,e,n){return n.foreach((i,r)=>{e=e.updateChild(i,r)}),e}function Db(t,e,n,i,r,s,o,a){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let l=e,c;Re(n)?c=i:c=new An(null).setTree(n,i);let u=e.serverCache.getNode();return c.children.inorderTraversal((p,m)=>{if(u.hasChild(p)){let f=e.serverCache.getNode().getImmediateChild(p),h=ck(t,f,m);l=cf(t,l,new Ye(p),h,r,s,o,a)}}),c.children.inorderTraversal((p,m)=>{let f=!e.serverCache.isCompleteForChild(p)&&m.value===null;if(!u.hasChild(p)&&!f){let h=e.serverCache.getNode().getImmediateChild(p),_=ck(t,h,m);l=cf(t,l,new Ye(p),_,r,s,o,a)}}),l}function eq(t,e,n,i,r,s,o){if(lf(r,n)!=null)return e;let a=e.serverCache.isFiltered(),l=e.serverCache;if(i.value!=null){if(Re(n)&&l.isFullyInitialized()||l.isCompleteForPath(n))return cf(t,e,n,l.getNode().getChild(n),r,s,a,o);if(Re(n)){let c=new An(null);return l.getNode().forEachChild(br,(u,p)=>{c=c.set(new Ye(u),p)}),Db(t,e,n,c,r,s,a,o)}else return e}else{let c=new An(null);return i.foreach((u,p)=>{let m=yt(n,u);l.isCompleteForPath(m)&&(c=c.set(u,l.getNode().getChild(m)))}),Db(t,e,n,c,r,s,a,o)}}function tq(t,e,n,i,r){let s=e.serverCache,o=Yk(e,s.getNode(),s.isFullyInitialized()||Re(n),s.isFiltered());return eR(t,o,n,i,Zk,r)}function nq(t,e,n,i,r,s){let o;if(lf(i,n)!=null)return e;{let a=new Eu(i,e,r),l=e.eventCache.getNode(),c;if(Re(n)||ke(n)===".priority"){let u;if(e.serverCache.isFullyInitialized())u=af(i,ko(e));else{let p=e.serverCache.getNode();L(p instanceof _e,"serverChildren would be complete if leaf node"),u=h0(i,p)}u=u,c=t.filter.updateFullNode(l,u,s)}else{let u=ke(n),p=g0(i,u,e.serverCache);p==null&&e.serverCache.isCompleteForChild(u)&&(p=l.getImmediateChild(u)),p!=null?c=t.filter.updateChild(l,u,p,at(n),a,s):e.eventCache.getNode().hasChild(u)?c=t.filter.updateChild(l,u,_e.EMPTY_NODE,at(n),a,s):c=l,c.isEmpty()&&e.serverCache.isFullyInitialized()&&(o=af(i,ko(e)),o.isLeafNode()&&(c=t.filter.updateFullNode(c,o,s)))}return o=e.serverCache.isFullyInitialized()||lf(i,ze())!=null,pu(e,c,o,t.filter.filtersNodes())}}var Lb=class{constructor(e,n){this.query_=e,this.eventRegistrations_=[];let i=this.query_._queryParams,r=new bu(i.getIndex()),s=TH(i);this.processor_=KH(s);let o=n.serverCache,a=n.eventCache,l=r.updateFullNode(_e.EMPTY_NODE,o.getNode(),null),c=s.updateFullNode(_e.EMPTY_NODE,a.getNode(),null),u=new Sr(l,o.isFullyInitialized(),r.filtersNodes()),p=new Sr(c,a.isFullyInitialized(),s.filtersNodes());this.viewCache_=Tf(p,u),this.eventGenerator_=new Ab(this.query_)}get query(){return this.query_}};function iq(t){return t.viewCache_.serverCache.getNode()}function rq(t){return of(t.viewCache_)}function sq(t,e){let n=ko(t.viewCache_);return n&&(t.query._queryParams.loadsAllData()||!Re(e)&&!n.getImmediateChild(ke(e)).isEmpty())?n.getChild(e):null}function uk(t){return t.eventRegistrations_.length===0}function oq(t,e){t.eventRegistrations_.push(e)}function pk(t,e,n){let i=[];if(n){L(e==null,"A cancel should cancel all event registrations.");let r=t.query._path;t.eventRegistrations_.forEach(s=>{let o=s.createCancelEvent(n,r);o&&i.push(o)})}if(e){let r=[];for(let s=0;s<t.eventRegistrations_.length;++s){let o=t.eventRegistrations_[s];if(!o.matches(e))r.push(o);else if(e.hasAnyCallback()){r=r.concat(t.eventRegistrations_.slice(s+1));break}}t.eventRegistrations_=r}else t.eventRegistrations_=[];return i}function dk(t,e,n,i){e.type===yr.MERGE&&e.source.queryId!==null&&(L(ko(t.viewCache_),"We should always have a full c
3ache before handling merges"),L(of(t.viewCache_),"Missing event cache, even though we have a server cache"));let r=t.viewCache_,s=XH(t.processor_,r,e,n,i);return QH(t.processor_,s.viewCache),L(s.viewCache.serverCache.isFullyInitialized()||!r.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),t.viewCache_=s.viewCache,tR(t,s.changes,s.viewCache.eventCache.getNode(),null)}function aq(t,e){let n=t.viewCache_.eventCache,i=[];return n.getNode().isLeafNode()||n.getNode().forEachChild(pt,(s,o)=>{i.push(sl(s,o))}),n.isFullyInitialized()&&i.push(zk(n.getNode())),tR(t,i,n.getNode(),e)}function tR(t,e,n,i){let r=i?[i]:t.eventRegistrations_;return OH(t.eventGenerator_,e,n,r)}var uf,pf=class{constructor(){this.views=new Map}};function lq(t){L(!uf,"__referenceConstructor has already been defined"),uf=t}function cq(){return L(uf,"Reference.ts has not been loaded"),uf}function uq(t){return t.views.size===0}function _0(t,e,n,i){let r=e.source.queryId;if(r!==null){let s=t.views.get(r);return L(s!=null,"SyncTree gave us an op for an invalid query."),dk(s,e,n,i)}else{let s=[];for(let o of t.views.values())s=s.concat(dk(o,e,n,i));return s}}function nR(t,e,n,i,r){let s=e._queryIdentifier,o=t.views.get(s);if(!o){let a=af(n,r?i:null),l=!1;a?l=!0:i instanceof _e?(a=h0(n,i),l=!1):(a=_e.EMPTY_NODE,l=!1);let c=Tf(new Sr(a,l,!1),new Sr(i,r,!1));return new Lb(e,c)}return o}function pq(t,e,n,i,r,s){let o=nR(t,e,i,r,s);return t.views.has(e._queryIdentifier)||t.views.set(e._queryIdentifier,o),oq(o,n),aq(o,n)}function dq(t,e,n,i){let r=e._queryIdentifier,s=[],o=[],a=Rs(t);if(r==="default")for(let[l,c]of t.views.entries())o=o.concat(pk(c,n,i)),uk(c)&&(t.views.delete(l),c.query._queryParams.loadsAllData()||s.push(c.query));else{let l=t.views.get(r);l&&(o=o.concat(pk(l,n,i)),uk(l)&&(t.views.delete(r),l.query._queryParams.loadsAllData()||s.push(l.query)))}return a&&!Rs(t)&&s.push(new(cq())(e._repo,e._path)),{removed:s,events:o}}function iR(t){let e=[];for(let n of t.views.values())n.query._queryParams.loadsAllData()||e.push(n);return e}function xs(t,e){let n=null;for(let i of t.views.values())n=n||sq(i,e);return n}function rR(t,e){if(e._queryParams.loadsAllData())return Cf(t);{let i=e._queryIdentifier;return t.views.get(i)}}function sR(t,e){return rR(t,e)!=null}function Rs(t){return Cf(t)!=null}function Cf(t){for(let e of t.views.values())if(e.query._queryParams.loadsAllData())return e;return null}var df;function mq(t){L(!df,"__referenceConstructor has already been defined"),df=t}function fq(){return L(df,"Reference.ts has not been loaded"),df}var hq=1,mf=class{constructor(e){this.listenProvider_=e,this.syncPointTree_=new An(null),this.pendingWriteTree_=YH(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}};function y0(t,e,n,i,r){return DH(t.pendingWriteTree_,e,n,i,r),r?dl(t,new ol(d0(),e,n)):[]}function gq(t,e,n,i){LH(t.pendingWriteTree_,e,n,i);let r=An.fromObject(n);return dl(t,new Su(d0(),e,r))}function Cs(t,e,n=!1){let i=FH(t.pendingWriteTree_,e);if(UH(t.pendingWriteTree_,e)){let s=new An(null);return i.snap!=null?s=s.set(ze(),!0):Xt(i.children,o=>{s=s.set(new Ye(o),!0)}),dl(t,new xb(i.path,s,n))}else return[]}function Ou(t,e,n){return dl(t,new ol(m0(),e,n))}function _q(t,e,n){let i=An.fromObject(n);return dl(t,new Su(m0(),e,i))}function yq(t,e){return dl(t,new sf(m0(),e))}function bq(t,e,n){let i=b0(t,n);if(i){let r=v0(i),s=r.path,o=r.queryId,a=xn(s,e),l=new sf(f0(o),a);return S0(t,s,l)}else return[]}function ff(t,e,n,i,r=!1){let s=e._path,o=t.syncPointTree_.get(s),a=[];if(o&&(e._queryIdentifier==="default"||sR(o,e))){let l=dq(o,e,n,i);uq(o)&&(t.syncPointTree_=t.syncPointTree_.remove(s));let c=l.removed;if(a=l.events,!r){let u=c.findIndex(m=>m._queryParams.loadsAllData())!==-1,p=t.syncPointTree_.findOnPath(s,(m,f)=>Rs(f));if(u&&!p){let m=t.syncPointTree_.subtree(s);if(!m.isEmpty()){let f=Eq(m);for(let h=0;h<f.length;++h){let _=f[h],v=_.query,I=cR(t,_);t.listenProvider_.startListening(mu(v),Tu(t,v),I.hashFn,I.onComplete)}}}!p&&c.length>0&&!i&&(u?t.listenProvider_.stopListening(mu(e),null):c.forEach(m=>{let f=t.queryToTagMap.get(xf(m));
vendor: 32,375 bytes, line 3
3t.listenProvider_.stopListening(mu(m),f)}))}Tq(t,c)}return a}function oR(t,e,n,i){let r=b0(t,i);if(r!=null){let s=v0(r),o=s.path,a=s.queryId,l=xn(o,e),c=new ol(f0(a),l,n);return S0(t,o,c)}else return[]}function vq(t,e,n,i){let r=b0(t,i);if(r){let s=v0(r),o=s.path,a=s.queryId,l=xn(o,e),c=An.fromObject(n),u=new Su(f0(a),l,c);return S0(t,o,u)}else return[]}function Fb(t,e,n,i=!1){let r=e._path,s=null,o=!1;t.syncPointTree_.foreachOnPath(r,(m,f)=>{let h=xn(m,r);s=s||xs(f,h),o=o||Rs(f)});let a=t.syncPointTree_.get(r);a?(o=o||Rs(a),s=s||xs(a,ze())):(a=new pf,t.syncPointTree_=t.syncPointTree_.set(r,a));let l;s!=null?l=!0:(l=!1,s=_e.EMPTY_NODE,t.syncPointTree_.subtree(r).foreachChild((f,h)=>{let _=xs(h,ze());_&&(s=s.updateImmediateChild(f,_))}));let c=sR(a,e);if(!c&&!e._queryParams.loadsAllData()){let m=xf(e);L(!t.queryToTagMap.has(m),"View does not exist, but we have a tag");let f=Iq();t.queryToTagMap.set(m,f),t.tagToQueryMap.set(f,m)}let u=If(t.pendingWriteTree_,r),p=pq(a,e,n,u,s,l);if(!c&&!o&&!i){let m=rR(a,e);p=p.concat(Cq(t,e,m))}return p}function wf(t,e,n){let r=t.pendingWriteTree_,s=t.syncPointTree_.findOnPath(e,(o,a)=>{let l=xn(o,e),c=xs(a,l);if(c)return c});return Qk(r,e,s,n,!0)}function Sq(t,e){let n=e._path,i=null;t.syncPointTree_.foreachOnPath(n,(c,u)=>{let p=xn(c,n);i=i||xs(u,p)});let r=t.syncPointTree_.get(n);r?i=i||xs(r,ze()):(r=new pf,t.syncPointTree_=t.syncPointTree_.set(n,r));let s=i!=null,o=s?new Sr(i,!0,!1):null,a=If(t.pendingWriteTree_,e._path),l=nR(r,e,a,s?o.getNode():_e.EMPTY_NODE,s);return rq(l)}function dl(t,e){return aR(e,t.syncPointTree_,null,If(t.pendingWriteTree_,ze()))}function aR(t,e,n,i){if(Re(t.path))return lR(t,e,n,i);{let r=e.get(ze());n==null&&r!=null&&(n=xs(r,ze()));let s=[],o=ke(t.path),a=t.operationForChild(o),l=e.children.get(o);if(l&&a){let c=n?n.getImmediateChild(o):null,u=Xk(i,o);s=s.concat(aR(a,l,c,u))}return r&&(s=s.concat(_0(r,t,i,n))),s}}function lR(t,e,n,i){let r=e.get(ze());n==null&&r!=null&&(n=xs(r,ze()));let s=[];return e.children.inorderTraversal((o,a)=>{let l=n?n.getImmediateChild(o):null,c=Xk(i,o),u=t.operationForChild(o);u&&(s=s.concat(lR(u,a,l,c)))}),r&&(s=s.concat(_0(r,t,i,n))),s}function cR(t,e){let n=e.query,i=Tu(t,n);return{hashFn:()=>(iq(e)||_e.EMPTY_NODE).hash(),onComplete:r=>{if(r==="ok")return i?bq(t,n._path,i):yq(t,n._path);{let s=D7(r,n);return ff(t,n,null,s)}}}}function Tu(t,e){let n=xf(e);return t.queryToTagMap.get(n)}function xf(t){return t._path.toString()+"$"+t._queryIdentifier}function b0(t,e){return t.tagToQueryMap.get(e)}function v0(t){let e=t.indexOf("$");return L(e!==-1&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new Ye(t.substr(0,e))}}function S0(t,e,n){let i=t.syncPointTree_.get(e);L(i,"Missing sync point for query tag that we're tracking");let r=If(t.pendingWriteTree_,e);return _0(i,n,r,null)}function Eq(t){return t.fold((e,n,i)=>{if(n&&Rs(n))return[Cf(n)];{let r=[];return n&&(r=iR(n)),Xt(i,(s,o)=>{r=r.concat(o)}),r}})}function mu(t){return t._queryParams.loadsAllData()&&!t._queryParams.isDefault()?new(fq())(t._repo,t._path):t}function Tq(t,e){for(let n=0;n<e.length;++n){let i=e[n];if(!i._queryParams.loadsAllData()){let r=xf(i),s=t.queryToTagMap.get(r);t.queryToTagMap.delete(r),t.tagToQueryMap.delete(s)}}}function Iq(){return hq++}function Cq(t,e,n){let i=e._path,r=Tu(t,e),s=cR(t,n),o=t.listenProvider_.startListening(mu(e),r,s.hashFn,s.onComplete),a=t.syncPointTree_.subtree(i);if(r)L(!Rs(a.value),"If we're adding a query, it shouldn't be shadowed");else{let l=a.fold((c,u,p)=>{if(!Re(c)&&u&&Rs(u))return[Cf(u).query];{let m=[];return u&&(m=m.concat(iR(u).map(f=>f.query))),Xt(p,(f,h)=>{m=m.concat(h)}),m}});for(let c=0;c<l.length;++c){let u=l[c];t.listenProvider_.stopListening(mu(u),Tu(t,u))}}return o}var Ub=class t{constructor(e){this.node_=e}getImmediateChild(e){let n=this.node_.getImmediateChild(e);return new t(n)}node(){return this.node_}},Bb=class t{constructor(e,n){this.syncTree_=e,this.path_=n}getImmediateChild(e){let n=yt(this.path_,e);return new t(this.syncTree_,n)}node(){return wf(this.syncTree_,this.path_)}},wq=function(t){return t=t||{},t.timestamp=t.timestamp||new Date().getTime(),t},mk=function(t,e,n){if(!t||typeof t!="object")return t;if(L(".sv"in t,"Unexpected leaf node or priority contents"),typeof t[".sv"]=="string")return xq(t[".sv"],e,n);if(typeof t[".sv"]=="object")return Aq(t[".sv"],e);L(!1,"Unexpected server value: "+JSON.stringify(t,null,2))},xq=function(t,e,n){switch(t){case"timestamp":return n.timestamp;default:L(!1,"Unexpected server value: "+t)}},Aq=function(t,e,n){t.hasOwnProperty("increment")||L(!1,"Unexpected server value: "+JSON.stringify(t,null,2));let i=t.increment;typeof i!="number"&&L(!1,"Unexpected increment value: "+i);let r=e.node();if(L(r!==null&&typeof r<"u","Expected ChildrenNode.EMPTY_NODE for nulls"),!r.isLeafNode())return i;let o=r.getValue();return typeof o!="number"?i:o+i},uR=function(t,e,n,i){return T0(e,new Bb(n,t),i)},E0=function(t,e,n){return T0(t,new Ub(e),n)};function T0(t,e,n){let i=t.getPriority().val(),r=mk(i,e.getImmediateChild(".priority"),n),s;if(t.isLeafNode()){let o=t,a=mk(o.getValue(),e,n);return a!==o.getValue()||r!==o.getPriority().val()?new il(a,bt(r)):t}else{let o=t;return s=o,r!==o.getPriority().val()&&(s=s.updatePriority(new il(r))),o.forEachChild(pt,(a,l)=>{let c=T0(l,e.getImmediateChild(a),n);c!==l&&(s=s.updateImmediateChild(a,c))}),s}}var Iu=class{constructor(e="",n=null,i={children:{},childCount:0}){this.name=e,this.parent=n,this.node=i}};function Af(t,e){let n=e instanceof Ye?e:new Ye(e),i=t,r=ke(n);for(;r!==null;){let s=Zr(i.node.children,r)||{children:{},childCount:0};i=new Iu(r,i,s),n=at(n),r=ke(n)}return i}function No(t){return t.node.value}function I0(t,e){t.node.value=e,Hb(t)}function pR(t){return t.node.childCount>0}function kq(t){return No(t)===void 0&&!pR(t)}function kf(t,e){Xt(t.node.children,(n,i)=>{e(new Iu(n,t,i))})}function dR(t,e,n,i){n&&!i&&e(t),kf(t,r=>{dR(r,e,!0,i)}),n&&i&&e(t)}function Rq(t,e,n){let i=n?t:t.parent;for(;i!==null;){if(e(i))return!0;i=i.parent}return!1}function Nu(t){return new Ye(t.parent===null?t.name:Nu(t.parent)+"/"+t.name)}function Hb(t){t.parent!==null&&Oq(t.parent,t.name,t)}function Oq(t,e,n){let i=kq(n),r=fi(t.node.children,e);i&&r?(delete t.node.children[e],t.node.childCount--,Hb(t)):!i&&!r&&(t.node.children[e]=n.node,t.node.childCount++,Hb(t))}var Nq=/[\[\].#$\/\u0000-\u001F\u007F]/,Mq=/[\[\].#$\u0000-\u001F\u007F]/,Xy=10*1024*1024,Rf=function(t){return typeof t=="string"&&t.length!==0&&!Nq.test(t)},mR=function(t){return typeof t=="string"&&t.length!==0&&!Mq.test(t)},Pq=function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),mR(t)},Cu=function(t){return t===null||typeof t=="string"||typeof t=="number"&&!Sf(t)||t&&typeof t=="object"&&fi(t,".sv")},Er=function(t,e,n,i){i&&e===void 0||Mu(Dn(t,"value"),e,n)},Mu=function(t,e,n){let i=n instanceof Ye?new ub(n,t):n;if(e===void 0)throw new Error(t+"contains undefined "+wo(i));if(typeof e=="function")throw new Error(t+"contains a function "+wo(i)+" with contents = "+e.toString());if(Sf(e))throw new Error(t+"contains "+e.toString()+" "+wo(i));if(typeof e=="string"&&e.length>Xy/3&&El(e)>Xy)throw new Error(t+"contains a string greater than "+Xy+" utf8 bytes "+wo(i)+" ('"+e.substring(0,50)+"...')");if(e&&typeof e=="object"){let r=!1,s=!1;if(Xt(e,(o,a)=>{if(o===".value")r=!0;else if(o!==".priority"&&o!==".sv"&&(s=!0,!Rf(o)))throw new Error(t+" contains an invalid key ("+o+") "+wo(i)+'.  Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');uH(i,o),Mu(t,a,i),pH(i)}),r&&s)throw new Error(t+' contains ".value" child '+wo(i)+" in addition to actual children.")}},Dq=function(t,e){let n,i;for(n=0;n<e.length;n++){i=e[n];let s=hu(i);for(let o=0;o<s.length;o++)if(!(s[o]===".priority"&&o===s.length-1)){if(!Rf(s[o]))throw new Error(t+"contains an invalid key ("+s[o]+") in path "+i.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"')}}e.sort(cH);let r=null;for(n=0;n<e.length;n++){if(i=e[n],r!==null&&Ri(r,i))throw new Error(t+"contains a path "+r.toString()+" that is ancestor of another path "+i.toString());r=i}},fR=function(t,e,n,i){if(i&&e===void 0)return;let r=Dn(t,"values");if(!(e&&typeof e=="object")||Array.isArray(e))throw new Error(r+" must be an object containing the children to replace.");let s=[];Xt(e,(o,a)=>{let l=new Ye(o);if(Mu(r,a,yt(n,l)),a0(l)===".priority"&&!Cu(a))throw new Error(r+"contains an invalid value for '"+l.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");s.push(l)}),Dq(r,s)},C0=function(t,e,n){if(!(n&&e===void 0)){if(Sf(e))throw new Error(Dn(t,"priority")+"is "+e.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!Cu(e))throw new Error(Dn(t,"priority")+"must be a valid Firebase priority (a string, finite number, server value, or null).")}},Pu=function(t,e,n,i){if(!(i&&n===void 0)&&!Rf(n))throw new Error(Dn(t,e)+'was an invalid key = "'+n+'".  Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')},ml=function(t,e,n,i){if(!(i&&n===void 0)&&!mR(n))throw new Error(Dn(t,e)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')},Lq=function(t,e,n,i){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),ml(t,e,n,i)},oi=function(t,e){if(ke(e)===".info")throw new Error(t+" failed = Can't modify data under /.info/")},hR=function(t,e){let n=e.path.toString();if(typeof e.repoInfo.host!="string"||e.repoInfo.host.length===0||!Rf(e.repoInfo.namespace)&&e.repoInfo.host.split(":")[0]!=="localhost"||n.length!==0&&!Pq(n))throw new Error(Dn(t,"url")+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')};var qb=class{constructor(){this.eventLists_=[],this.recursionDepth_=0}};function Of(t,e){let n=null;for(let i=0;i<e.length;i++){let r=e[i],s=r.getPath();n!==null&&!l0(s,n.path)&&(t.eventLists_.push(n),n=null),n===null&&(n={events:[],path:s}),n.events.push(r)}n&&t.eventLists_.push(n)}function gR(t,e,n){Of(t,n),_R(t,i=>l0(i,e))}function ai(t,e,n){Of(t,n),_R(t,i=>Ri(i,e)||Ri(e,i))}function _R(t,e){t.recursionDepth_++;let n=!0;for(let i=0;i<t.eventLists_.length;i++){let r=t.eventLists_[i];if(r){let s=r.path;e(s)?(Fq(t.eventLists_[i]),t.eventLists_[i]=null):n=!1}}n&&(t.eventLists_=[]),t.recursionDepth_--}function Fq(t){for(let e=0;e<t.events.length;e++){let n=t.events[e];if(n!==null){t.events[e]=null;let i=n.getEventRunner();Ao&&Qt("event: "+n.toString()),ul(i)}}}var yR="repo_interrupt",Uq=25,jb=class{constructor(e,n,i,r){this.repoInfo_=e,this.forceRestClient_=n,this.authTokenProvider_=i,this.appCheckProvider_=r,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new qb,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=rf(),this.transactionQueueTree_=new Iu,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}};function Bq(t,e,n){if(t.stats_=o0(t.repoInfo_),t.forceRestClient_||B7())t.server_=new Sb(t.repoInfo_,(i,r,s,o)=>{fk(t,i,r,s,o)},t.authTokenProvider_,t.appCheckProvider_),setTimeout(()=>hk(t,!0),0);else{if(typeof n<"u"&&n!==null){if(typeof n!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{kt(n)}catch(i){throw new Error("Invalid authOverride provided: "+i)}}t.persistentConnection_=new c0(t.repoInfo_,e,(i,r,s,o)=>{fk(t,i,r,s,o)},i=>{hk(t,i)},i=>{Hq(t,i)},t.authTokenProvider_,t.appCheckProvider_,n),t.server_=t.persistentConnection_}t.authTokenProvider_.addTokenChangeListener(i=>{t.server_.refreshAuthToken(i)}),t.appCheckProvider_.addTokenChangeListener(i=>{t.server_.refreshAppCheckToken(i.token)}),t.statsReporter_=q7(t.repoInfo_,()=>new wb(t.stats_,t.server_)),t.infoData_=new Eb,t.infoSyncTree_=new mf({startListening:(i,r,s,o)=>{let a=[],l=t.infoData_.getNode(i._path);return l.isEmpty()||(a=Ou(t.infoSyncTree_,i._path,l),setTimeout(()=>{o("ok")},0)),a},stopListening:()=>{}}),w0(t,"connected",!1),t.serverSyncTree_=new mf({startListening:(i,r,s,o)=>(t.server_.listen(i,s,r,(a,l)=>{let c=o(a,l);ai(t.eventQueue_,i._path,c)}),[]),stopListening:(i,r)=>{t.server_.unlisten(i,r)}})}function bR(t){let n=t.infoData_.getNode(new Ye(".info/serverTimeOffset")).val()||0;return new Date().getTime()+n}function Du(t){return wq({timestamp:bR(t)})}function fk(t,e,n,i,r){t.dataUpdateCount++;let s=new Ye(e);n=t.interceptServerDataCallback_?t.interceptServerDataCallback_(e,n):n;let o=[];if(r)if(i){let l=Sl(n,c=>bt(c));o=vq(t.serverSyncTree_,s,l,r)}else{let l=bt(n);o=oR(t.serverSyncTree_,s,l,r)}else if(i){let l=Sl(n,c=>bt(c));o=_q(t.serverSyncTree_,s,l)}else{let l=bt(n);o=Ou(t.serverSyncTree_,s,l)}let a=s;o.length>0&&(a=ll(t,s)),ai(t.eventQueue_,a,o)}function hk(t,e){w0(t,"connected",e),e===!1&&Gq(t)}function Hq(t,e){Xt(e,(n,i)=>{w0(t,n,i)})}function w0(t,e,n){let i=new Ye("/.info/"+e),r=bt(n);t.infoData_.updateSnapshot(i,r);let s=Ou(t.infoSyncTree_,i,r);ai(t.eventQueue_,i,s)}function Nf(t){return t.nextWriteId_++}function qq(t,e,n){let i=Sq(t.serverSyncTree_,e);return i!=null?Promise.resolve(i):t.server_.get(e).then(r=>{let s=bt(r).withIndex(e._queryParams.getIndex());Fb(t.serverSyncTree_,e,n,!0);let o;if(e._queryParams.loadsAllData())o=Ou(t.serverSyncTree_,e._path,s);else{let a=Tu(t.serverSyncTree_,e);o=oR(t.serverSyncTree_,e._path,s,a)}return ai(t.eventQueue_,e._path,o),ff(t.serverSyncTree_,e,n,null,!0),s},r=>(fl(t,"get for query "+kt(e)+" failed: "+r),Promise.reject(new Error(r))))}function x0(t,e,n,i,r){fl(t,"set",{path:e.toString(),value:n,priority:i});let s=Du(t),o=bt(n,i),a=wf(t.serverSyncTree_,e),l=E0(o,a,s),c=Nf(t),u=y0(t.serverSyncTree_,e,l,c,!0);Of(t.eventQueue_,u),t.server_.put(e.toString(),o.val(!0),(m,f)=>{let h=m==="ok";h||gn("set at "+e+" failed: "+m);let _=Cs(t.serverSyncTree_,c,!h);ai(t.eventQueue_,e,_),Os(t,r,m,f)});let p=k0(t,e);ll(t,p),ai(t.eventQueue_,p,[])}function jq(t,e,n,i){fl(t,"update",{path:e.toString(),value:n});let r=!0,s=Du(t),o={};if(Xt(n,(a,l)=>{r=!1,o[a]=uR(yt(e,a),bt(l),t.serverSyncTree_,s)}),r)Qt("update() called with empty data.  Don't do anything."),Os(t,i,"ok",void 0);else{let a=Nf(t),l=gq(t.serverSyncTree_,e,o,a);Of(t.eventQueue_,l),t.server_.merge(e.toString(),n,(c,u)=>{let p=c==="ok";p||gn("update at "+e+" failed: "+c);let m=Cs(t.serverSyncTree_,a,!p),f=m.length>0?ll(t,e):e;ai(t.eventQueue_,f,m),Os(t,i,c,u)}),Xt(n,c=>{let u=k0(t,yt(e,c));ll(t,u)}),ai(t.eventQueue_,e,[])}}function Gq(t){fl(t,"onDisconnectEvents");let e=Du(t),n=rf();Ib(t.onDisconnect_,ze(),(r,s)=>{let o=uR(r,s,t.serverSyncTree_,e);pl(n,r,o)});let i=[];Ib(n,ze(),(r,s)=>{i=i.concat(Ou(t.serverSyncTree_,r,s));let o=k0(t,r);ll(t,o)}),t.onDisconnect_=rf(),ai(t.eventQueue_,ze(),i)}function Wq(t,e,n){t.server_.onDisconnectCancel(e.toString(),(i,r)=>{i==="ok"&&Tb(t.onDisconnect_,e),Os(t,n,i,r)})}function gk(t,e,n,i){let r=bt(n);t.server_.onDisconnectPut(e.toString(),r.val(!0),(s,o)=>{s==="ok"&&pl(t.onDisconnect_,e,r),Os(t,i,s,o)})}function Vq(t,e,n,i,r){let s=bt(n,i);t.server_.onDisconnectPut(e.toString(),s.val(!0),(o,a)=>{o==="ok"&&pl(t.onDisconnect_,e,s),Os(t,r,o,a)})}function zq(t,e,n,i){if(sp(n)){Qt("onDisconnect().update() called with empty data.  Don't do anything."),Os(t,i,"ok",void 0);return}t.server_.onDisconnectMerge(e.toString(),n,(r,s)=>{r==="ok"&&Xt(n,(o,a)=>{let l=bt(a);pl(t.onDisconnect_,yt(e,o),l)}),Os(t,i,r,s)})}function Yq(t,e,n){let i;ke(e._path)===".info"?i=Fb(t.infoSyncTree_,e,n):i=Fb(t.serverSyncTree_,e,n),gR(t.eventQueue_,e._path,i)}function Gb(t,e,n){let i;ke(e._path)===".info"?i=ff(t.infoSyncTree_,e,n):i=ff(t.serverSyncTree_,e,n),gR(t.eventQueue_,e._path,i)}function vR(t){t.persistentConnection_&&t.persistentConnection_.interrupt(yR)}function $q(t){t.persistentConnection_&&t.persistentConnection_.resume(yR)}function fl(t,...e){let n="";t.persistentConnection_&&(n=t.persistentConnection_.id+":"),Qt(n,...e)}function Os(t,e,n,i){e&&ul(()=>{if(n==="ok")e(null);else{let r=(n||"error").toUpperCase(),s=r;i&&(s+=": "+i);let o=new Error(s);o.code=r,e(o)}})}function Kq(t,e,n,i,r,s){fl(t,"transaction on "+e);let o={path:e,update:n,onComplete:i,status:null,order:bk(),applyLocally:s,retryCount:0,unwatcher:r,abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},a=A0(t,e,void 0);o.currentInputSnapshot=a;let l=o.update(a.val());if(l===void 0)o.unwatcher(),o.currentOutputSnapshotRaw=null,o.currentOutputSnapshotResolved=null,o.onComplete&&o.onComplete(null,!1,o.currentInputSnapshot);else{Mu("transaction failed: Data returned ",l,o.path),o.status=0;let c=Af(t.transactionQueueTree_,e),u=No(c)||[];u.push(o),I0(c,u);let p;typeof l=="object"&&l!==null&&fi(l,".priority")?(p=Zr(l,".priority"),L(Cu(p),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):p=(wf(t.serverSyncTree_,e)||_e.EMPTY_NODE).getPriority().val();let m=Du(t),f=bt(l,p),h=E0(f,a,m);o.currentOutputSnapshotRaw=f,o.currentOutputSnapshotResolved=h,o.currentWriteId=Nf(t);let _=y0(t.serverSyncTree_,e,h,o.currentWriteId,o.applyLocally);ai(t.eventQueue_,e,_),Mf(t,t.transactionQueueTree_)}}function A0(t,e,n){return wf(t.serverSyncTree_,e,n)||_e.EMPTY_NODE}function Mf(t,e=t.transactionQueueTree_){if(e||Pf(t,e),No(e)){let n=ER(t,e);L(n.length>0,"Sending zero length transaction queue"),n.every(r=>r.status===0)&&Qq(t,Nu(e),n)}else pR(e)&&kf(e,n=>{Mf(t,n)})}function Qq(t,e,n){let i=n.map(c=>c.currentWriteId),r=A0(t,e,i),s=r,o=r.hash();for(let c=0;c<n.length;c++){let u=n[c];L(u.status===0,"tryToSendTransactionQueue_: items in queue should all be run."),u.status=1,u.retryCount++;let p=xn(e,u.path);s=s.updateChild(p,u.currentOutputSnapshotRaw)}let a=s.val(!0),l=e;t.server_.put(l.toString(),a,c=>{fl(t,"transaction put response",{path:l.toString(),status:c});let u=[];if(c==="ok"){let p=[];for(let m=0;m<n.length;m++)n[m].status=2,u=u.concat(Cs(t.serverSyncTree_,n[m].currentWriteId)),n[m].onComplete&&p.push(()=>n[m].onComplete(null,!0,n[m].currentOutputSnapshotResolved)),n[m].unwatcher();Pf(t,Af(t.transactionQueueTree_,e)),Mf(t,t.transactionQueueTree_),ai(t.eventQueue_,e,u);for(let m=0;m<p.length;m++)ul(p[m])}else{if(c==="datastale")for(let p=0;p<n.length;p++)n[p].status===3?n[p].status=4:n[p].status=0;else{gn("transaction at "+l.toString()+" failed: "+c);for(let p=0;p<n.length;p++)n[p].status=4,n[p].abortReason=c}ll(t,e)}},o)}function ll(t,e){let n=SR(t,e),i=Nu(n),r=ER(t,n);return Xq(t,r,i),i}function Xq(t,e,n){if(e.length===0)return;let i=[],r=[],o=e.filter(a=>a.status===0).map(a=>a.currentWriteId);for(let a=0;a<e.length;a++){let l=e[a],c=xn(n,l.path),u=!1,p;if(L(c!==null,"rerunTransactionsUnderNode_: relativePath should not be null."),l.status===4)u=!0,p=l.abortReason,r=r.concat(Cs(t.serverSyncTree_,l.currentWriteId,!0));else if(l.status===0)if(l.retryCount>=Uq)u=!0,p="maxretry",r=r.concat(Cs(t.serverSyncTree_,l.currentWriteId,!0));else{let m=A0(t,l.path,o);l.currentInputSnapshot=m;let f=e[a].update(m.val());if(f!==void 0){Mu("transaction failed: Data returned ",f,l.path);let h=bt(f);typeof f=="object"&&f!=null&&fi(f,".priority")||(h=h.updatePriority(m.getPriority()));let v=l.currentWriteId,I=Du(t),N=E0(h,m,I);l.currentOutputSnapshotRaw=h,l.currentOutputSnapshotResolved=N,l.currentWriteId=Nf(t),o.splice(o.indexOf(v),1),r=r.concat(y0(t.serverSyncTree_,l.path,N,l.currentWriteId,l.applyLocally)),r=r.concat(Cs(t.serverSyncTree_,v,!0))}else u=!0,p="nodata",r=r.concat(Cs(t.serverSyncTree_,l.currentWriteId,!0))}ai(t.eventQueue_,n,r),r=[],u&&(e[a].status=2,(function(m){setTimeout(m,Math.floor(0))})(e[a].unwatcher),e[a].onComplete&&(p==="nodata"?i.push(()=>e[a].onComplete(null,!1,e[a].currentInputSnapshot)):i.push(()=>e[a].onComplete(new Error(p),!1,null))))}Pf(t,t.transactionQueueTree_);for(let a=0;a<i.length;a++)ul(i[a]);Mf(t,t.transactionQueueTree_)}function SR(t,e){let n,i=t.transactionQueueTree_;for(n=ke(e);n!==null&&No(i)===void 0;)i=Af(i,n),e=at(e),n=ke(e);return i}function ER(t,e){let n=[];return TR(t,e,n),n.sort((i,r)=>i.order-r.order),n}function TR(t,e,n){let i=No(e);if(i)for(let r=0;r<i.length;r++)n.push(i[r]);kf(e,r=>{TR(t,r,n)})}function Pf(t,e){let n=No(e);if(n){let i=0;for(let r=0;r<n.length;r++)n[r].status!==2&&(n[i]=n[r],i++);n.length=i,I0(e,n.length>0?n:void 0)}kf(e,i=>{Pf(t,i)})}function k0(t,e){let n=Nu(SR(t,e)),i=Af(t.transactionQueueTree_,e);return Rq(i,r=>{Jy(t,r)}),Jy(t,i),dR(i,r=>{Jy(t,r)}),n}function Jy(t,e){let n=No(e);if(n){let i=[],r=[],s=-1;for(let o=0;o<n.length;o++)n[o].status===3||(n[o].status===1?(L(s===o-1,"All SENT items should be at beginning of queue."),s=o,n[o].status=3,n[o].abortReason="set"):(L(n[o].status===0,"Unexpected transaction status in abort"),n[o].unwatcher(),r=r.concat(Cs(t.serverSyncTree_,n[o].currentWriteId,!0)),n[o].onComplete&&i.push(n[o].onComplete.bind(null,new Error("set"),!1,null))));s===-1?I0(e,void 0):n.length=s+1,ai(t.eventQueue_,Nu(e),r);for(let o=0;o<i.length;o++)ul(i[o])}}function Jq(t){let e="",n=t.split("/");for(let i=0;i<n.length;i++)if(n[i].length>0){let r=n[i];try{r=decodeURIComponent(r.replace(/\+/g," "))}catch{}e+="/"+r}return e}function Zq(t){let e={};t.charAt(0)==="?"&&(t=t.substring(1));for(let n of t.split("&")){if(n.length===0)continue;let i=n.split("=");i.length===2?e[decodeURIComponent(i[0])]=decodeURIComponent(i[1]):gn("Invalid query segment '".concat(n,"' in query '").concat(t,"'"))}return e}var Wb=function(t,e){let n=ej(t),i=n.namespace;n.domain==="firebase.com"&&vr(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),(!i||i==="undefined")&&n.domain!=="localhost"&&vr("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),n.secure||R7();let r=n.scheme==="ws"||n.scheme==="wss";return{repoInfo:new Km(n.host,n.secure,i,r,e,"",i!==n.subdomain),path:new Ye(n.pathString)}},ej=function(t){let e="",n="",i="",r="",s="",o=!0,a="https",l=443;if(typeof t=="string"){let c=t.indexOf("//");c>=0&&(a=t.substring(0,c-1),t=t.substring(c+2));let u=t.indexOf("/");u===-1&&(u=t.length);let p=t.indexOf("?");p===-1&&(p=t.length),e=t.substring(0,Math.min(u,p)),u<p&&(r=Jq(t.substring(u,p)));let m=Zq(t.substring(Math.min(t.length,p)));c=e.indexOf(":"),c>=0?(o=a==="https"||a==="wss",l=parseInt(e.substring(c+1),10)):c=e.length;let f=e.slice(0,c);if(f.toLowerCase()==="localhost")n="localhost";else if(f.split(".").length<=2)n=f;else{let h=e.indexOf(".");i=e.substring(0,h).toLowerCase(),n=e.substring(h+1),s=i}"ns"in m&&(s=m.ns)}return{host:e,port:l,domain:n,subdomain:i,secure:o,scheme:a,pathString:r,namespace:s}};var _k="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",tj=(function(){let t=0,e=[];return function(n){let i=n===t;t=n;let r,s=new Array(8);for(r=7;r>=0;r--)s[r]=_k.charAt(n%64),n=Math.floor(n/64);L(n===0,"Cannot push at time == 0");let o=s.join("");if(i){for(r=11;r>=0&&e[r]===63;r--)e[r]=0;e[r]++}else for(r=0;r<12;r++)e[r]=Math.floor(Math.random()*64);for(r=0;r<12;r++)o+=_k.charAt(e[r]);return L(o.length===20,"nextPushId: Length should be 20."),o}})();var hf=class{constructor(e,n,i,r){this.eventType=e,this.eventRegistration=n,this.snapshot=i,this.prevName=r}getPath(){let e=this.snapshot.ref;return this.eventType==="value"?e._path:e.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+kt(this.snapshot.exportVal())}},gf=class{constructor(e,n,i){this.eventRegistration=e,this.error=n,this.path=i}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}};var wu=class{constructor(e,n){this.snapshotCallback=e,this.cancelCallback=n}onValue(e,n){this.snapshotCallback.call(null,e,n)}onCancel(e){return L(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,e)}get hasCancelCallback(){return!!this.cancelCallback}matches(e){return this.snapshotCallback===e.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===e.snapshotCallback.userCallback&&this.snapshotCallback.context===e.snapshotCallback.context}};var _f=class{constructor(e,n){this._repo=e,this._path=n}cancel(){let e=new zt;return Wq(this._repo,this._path,e.wrapCallback(()=>{})),e.promise}remove(){oi("OnDisconnect.remove",this._path);let e=new zt;return gk(this._repo,this._path,null,e.wrapCallback(()=>{})),e.promise}set(e){oi("OnDisconnect.set",this._path),Er("OnDisconnect.set",e,this._path,!1);let n=new zt;return gk(this._repo,this._path,e,n.wrapCallback(()=>{})),n.promise}setWithPriority(e,n){oi("OnDisconnect.setWithPriority",this._path),Er("OnDisconnect.setWithPriority",e,this._path,!1),C0("OnDisconnect.setWithPriority",n,!1);let i=new zt;return Vq(this._repo,this._path,e,n,i.wrapCallback(()=>{})),i.promise}update(e){oi("OnDisconnect.update",this._path),fR("OnDisconnect.update",e,this._path,!1);let n=new zt;return zq(this._repo,this._path,e,n.wrapCallback(()=>{})),n.promise}};var kn=class t{constructor(e,n,i,r){this._repo=e,this._path=n,this._queryParams=i,this._orderByCalled=r}get key(){return Re(this._path)?null:a0(this._path)}get ref(){return new li(this._repo,this._path)}get _queryIdentifier(){let e=ik(this._queryParams),n=s0(e);return n==="{}"?"default":n}get _queryObject(){return ik(this._queryParams)}isEqual(e){if(e=bn(e),!(e instanceof t))return!1;let n=this._repo===e._repo,i=l0(this._path,e._path),r=this._queryIdentifier===e._queryIdentifier;return n&&i&&r}toJSON(){return this.toString()}toString(){return this._repo.toString()+lH(this._path)}};function Df(t,e){if(t._orderByCalled===!0)throw new Error(e+": You can't combine multiple orderBy calls.")}function Ms(t){let e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===br){let i="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",r="Query: When ordering by key, the argument passed to startAt(), startAfter(), endAt(), endBefore(), or equalTo() must be a string.";if(t.hasStart()){if(t.getIndexStartName()!==As)throw new Error(i);if(typeof e!="string")throw new Error(r)}if(t.hasEnd()){if(t.getIndexEndName()!==$r)throw new Error(i);if(typeof n!="string")throw new Error(r)}}else if(t.getIndex()===pt){if(e!=null&&!Cu(e)||n!=null&&!Cu(n))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), startAfter() endAt(), endBefore(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(L(t.getIndex()instanceof gu||t.getIndex()===p0,"unknown index type."),e!=null&&typeof e=="object"||n!=null&&typeof n=="object")throw new Error("Query: First argument passed to startAt(), startAfter(), endAt(), endBefore(), or equalTo() cannot be an object.")}function Lf(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), startAfter(), endAt(), endBefore(), and limit(). Use limitToFirst() or limitToLast() instead.")}var li=class t extends kn{constructor(e,n){super(e,n,new vu,!1)}get parent(){let e=Hk(this._path);return e===null?null:new t(this._repo,e)}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}},cl=class t{constructor(e,n,i){this._node=e,this.ref=n,this._index=i}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(e){let n=new Ye(e),i=Ns(this.ref,e);return new t(this._node.getChild(n),i,pt)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(e){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(i,r)=>e(new t(r,Ns(this.ref,i),pt)))}hasChild(e){let n=new Ye(e);return!this._node.getChild(n).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}};function R0(t,e){return t=bn(t),t._checkNotDeleted("ref"),e!==void 0?Ns(t._root,e):t._root}function O0(t,e){t=bn(t),t._checkNotDeleted("refFromURL");let n=Wb(e,t._repo.repoInfo_.nodeAdmin);hR("refFromURL",n);let i=n.repoInfo;return!t._repo.repoInfo_.isCustomHost()&&i.host!==t._repo.repoInfo_.host&&vr("refFromURL: Host name does not match the current database: (found "+i.host+" but expected "+t._repo.repoInfo_.host+")"),R0(t,n.path.toString())}function Ns(t,e){return t=bn(t),ke(t._path)===null?Lq("child","path",e,!1):ml("child","path",e,!1),new li(t._repo,yt(t._path,e))}function IR(t,e){t=bn(t),oi("push",t._path),Er("push",e,t._path,!0);let n=bR(t._repo),i=tj(n),r=Ns(t,i),s=Ns(t,i),o;return e!=null?o=Ff(s,e).then(()=>s):o=Promise.resolve(s),r.then=o.then.bind(o),r.catch=o.then.bind(o,void 0),r}function CR(t){return oi("remove",t._path),Ff(t,null)}function Ff(t,e){t=bn(t),oi("set",t._path),Er("set",e,t._path,!1);let n=new zt;return x0(t._repo,t._path,e,null,n.wrapCallback(()=>{})),n.promise}function wR(t,e){t=bn(t),oi("setPriority",t._path),C0("setPriority",e,!1);let n=new zt;return x0(t._repo,yt(t._path,".priority"),e,null,n.wrapCallback(()=>{})),n.promise}function xR(t,e,n){if(oi("setWithPriority",t._path),Er("setWithPriority",e,t._path,!1),C0("setWithPriority",n,!1),t.key===".length"||t.key===".keys")throw"setWithPriority failed: "+t.key+" is a read-only object.";let i=new zt;return x0(t._repo,t._path,e,n,i.wrapCallback(()=>{})),i.promise}function AR(t,e){fR("update",e,t._path,!1);let n=new zt;return jq(t._repo,t._path,e,n.wrapCallback(()=>{})),n.promise}function kR(t){t=bn(t);let e=new wu(()=>{}),n=new xu(e);return qq(t._repo,t,n).then(i=>new cl(i,new li(t._repo,t._path),t._queryParams.getIndex()))}var xu=class t{constructor(e){this.callbackContext=e}respondsTo(e){return e==="value"}createEvent(e,n){let i=n._queryParams.getIndex();return new hf("value",this,new cl(e.snapshotNode,new li(n._repo,n._path),i))}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,null)}createCancelEvent(e,n){return this.callbackContext.hasCancelCallback?new gf(this,e,n):null}matches(e){return e instanceof t?!e.callbackContext||!this.callbackContext?!0:e.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}},yf=class t{constructor(e,n){this.eventType=e,this.callbackContext=n}respondsTo(e){let n=e==="children_added"?"child_added":e;return n=n==="children_removed"?"child_removed":n,this.eventType===n}createCancelEvent(e,n){return this.callbackContext.hasCancelCallback?new gf(this,e,n):null}createEvent(e,n){L(e.childName!=null,"Child events should have a childName.");let i=Ns(new li(n._repo,n._path),e.childName),r=n._queryParams.getIndex();return new hf(e.type,this,new cl(e.snapshotNode,i,r),e.prevName)}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,e.prevName)}matches(e){return e instanceof t?this.eventType===e.eventType&&(!this.callbackContext||!e.callbackContext||this.callbackContext.matches(e.callbackContext)):!1}hasAnyCallback(){return!!this.callbackContext}};function Lu(t,e,n,i,r){let s;if(typeof i=="object"&&(s=void 0,r=i),typeof i=="function"&&(s=i),r&&r.onlyOnce){let l=n,c=(u,p)=>{Gb(t._repo,t,a),l(u,p)};c.userCallback=n.userCallback,c.context=n.context,n=c}let o=new wu(n,s||void 0),a=e==="value"?new xu(o):new yf(e,o);return Yq(t._repo,t,a),()=>Gb(t._repo,t,a)}function Uf(t,e,n,i){return Lu(t,"value",e,n,i)}function N0(t,e,n,i){return Lu(t,"child_added",e,n,i)}function M0(t,e,n,i){return Lu(t,"child_changed",e,n,i)}function P0(t,e,n,i){return Lu(t,"child_moved",e,n,i)}function D0(t,e,n,i){return Lu(t,"child_removed",e,n,i)}function L0(t,e,n){let i=null,r=n?new wu(n):null;e==="value"?i=new xu(r):e&&(i=new yf(e,r)),Gb(t._repo,t,i)}var ci=class{},bf=class extends ci{constructor(e,n){super(),this._value=e,this._key=n,this.type="endAt"}_apply(e){Er("endAt",this._value,e._path,!0);let n=vb(e._queryParams,this._value,this._key);if(Lf(n),Ms(n),e._queryParams.hasEnd())throw new Error("endAt: Starting point was already set 
3(by another call to endAt, endBefore or equalTo).");return new kn(e._repo,e._path,n,e._orderByCalled)}};function RR(t,e){return Pu("endAt","key",e,!0),new bf(t,e)}var Vb=class extends ci{constructor(e,n){super(),this._value=e,this._key=n,this.type="endBefore"}_apply(e){Er("endBefore",this._value,e._path,!1);let n=xH(e._queryParams,this._value,this._key);if(Lf(n),Ms(n),e._queryParams.hasEnd())throw new Error("endBefore: Starting point was already set (by another call to endAt, endBefore or equalTo).");return new kn(e._repo,e._path,n,e._orderByCalled)}};function OR(t,e){return Pu("endBefore","key",e,!0),new Vb(t,e)}var vf=class extends ci{constructor(e,n){super(),this._value=e,this._key=n,this.type="startAt"}_apply(e){Er("startAt",this._value,e._path,!0);let n=bb(e._queryParams,this._value,this._key);if(Lf(n),Ms(n),e._queryParams.hasStart())throw new Error("startAt: Starting point was already set (by another call to startAt, startBefore or equalTo).");return new kn(e._repo,e._path,n,e._orderByCalled)}};function NR(t=null,e){return Pu("startAt","key",e,!0),new vf(t,e)}var zb=class extends ci{constructor(e,n){super(),this._value=e,this._key=n,this.type="startAfter"}_apply(e){Er("startAfter",this._value,e._path,!1);let n=wH(e._queryParams,this._value,this._key);if(Lf(n),Ms(n),e._queryParams.hasStart())throw new Error("startAfter: Starting point was already set (by another call to startAt, startAfter, or equalTo).");return new kn(e._repo,e._path,n,e._orderByCalled)}};function MR(t,e){return Pu("startAfter","key",e,!0),new zb(t,e)}var Yb=class extends ci{constructor(e){super(),this._limit=e,this.type="limitToFirst"}_apply(e){if(e._queryParams.hasLimit())throw new Error("limitToFirst: Limit was already set (by another call to limitToFirst or limitToLast).");return new kn(e._repo,e._path,IH(e._queryParams,this._limit),e._orderByCalled)}};function PR(t){if(typeof t!="number"||Math.floor(t)!==t||t<=0)throw new Error("limitToFirst: First argument must be a positive integer.");return new Yb(t)}var $b=class extends ci{constructor(e){super(),this._limit=e,this.type="limitToLast"}_apply(e){if(e._queryParams.hasLimit())throw new Error("limitToLast: Limit was already set (by another call to limitToFirst or limitToLast).");return new kn(e._repo,e._path,CH(e._queryParams,this._limit),e._orderByCalled)}};function DR(t){if(typeof t!="number"||Math.floor(t)!==t||t<=0)throw new Error("limitToLast: First argument must be a positive integer.");return new $b(t)}var Kb=class extends ci{constructor(e){super(),this._path=e,this.type="orderByChild"}_apply(e){Df(e,"orderByChild");let n=new Ye(this._path);if(Re(n))throw new Error("orderByChild: cannot pass in empty path. Use orderByValue() instead.");let i=new gu(n),r=Ef(e._queryParams,i);return Ms(r),new kn(e._repo,e._path,r,!0)}};function LR(t){if(t==="$key")throw new Error('orderByChild: "$key" is invalid.  Use orderByKey() instead.');if(t==="$priority")throw new Error('orderByChild: "$priority" is invalid.  Use orderByPriority() instead.');if(t==="$value")throw new Error('orderByChild: "$value" is invalid.  Use orderByValue() instead.');return ml("orderByChild","path",t,!1),new Kb(t)}var Qb=class extends ci{constructor(){super(...arguments),this.type="orderByKey"}_apply(e){Df(e,"orderByKey");let n=Ef(e._queryParams,br);return Ms(n),new kn(e._repo,e._path,n,!0)}};function FR(){return new Qb}var Xb=class extends ci{constructor(){super(...arguments),this.type="orderByPriority"}_apply(e){Df(e,"orderByPriority");let n=Ef(e._queryParams,pt);return Ms(n),new kn(e._repo,e._path,n,!0)}};function UR(){return new Xb}var Jb=class extends ci{constructor(){super(...arguments),this.type="orderByValue"}_apply(e){Df(e,"orderByValue");let n=Ef(e._queryParams,p0);return Ms(n),new kn(e._repo,e._path,n,!0)}};function BR(){return new Jb}var Zb=class extends ci{constructor(e,n){super(),this._value=e,this._key=n,this.type="equalTo"}_apply(e){if(Er("equalTo",this._value,e._path,!1),e._queryParams.hasStart())throw new Error("equalTo: Starting point was already set (by another call to startAt/startAfter or equalTo).");if(e._queryParams.hasEnd())throw new Error("equalTo: Ending point was already set 
3(by another call to endAt/endBefore or equalTo).");return new bf(this._value,this._key)._apply(new vf(this._value,this._key)._apply(e))}};function HR(t,e){return Pu("equalTo","key",e,!0),new Zb(t,e)}function Ni(t,...e){let n=bn(t);for(let i of e)n=i._apply(n);return n}lq(li);mq(li);var nj="FIREBASE_DATABASE_EMULATOR_HOST",e0={},ij=!1;function rj(t,e,n,i){let r=e.lastIndexOf(":"),s=e.substring(0,r),o=Zf(s);t.repoInfo_=new Km(e,o,t.repoInfo_.namespace,t.repoInfo_.webSocketOnly,t.repoInfo_.nodeAdmin,t.repoInfo_.persistenceKey,t.repoInfo_.includeNamespaceInQueryParams,!0,n),i&&(t.authTokenProvider_=i)}function F0(t,e,n,i,r){let s=i||t.options.databaseURL;s===void 0&&(t.options.projectId||vr("Can't determine Firebase Database URL. Be sure to include  a Project ID when calling firebase.initializeApp()."),Qt("Using default host for project ",t.options.projectId),s="".concat(t.options.projectId,"-default-rtdb.firebaseio.com"));let o=Wb(s,r),a=o.repoInfo,l,c;typeof process<"u"&&process.env&&(c=process.env[nj]),c?(l=!0,s="http://".concat(c,"?ns=").concat(a.namespace),o=Wb(s,r),a=o.repoInfo):l=!o.repoInfo.secure;let u=r&&l?new uu(uu.OWNER):new rb(t.name,t.options,e);hR("Invalid Firebase Database URL",o),Re(o.path)||vr("Database URL must point to the root of a Firebase Database (not including a child path).");let p=oj(a,t,u,new ib(t,n));return new t0(p,t)}function sj(t,e){let n=e0[e];(!n||n[t.key]!==t)&&vr("Database ".concat(e,"(").concat(t.repoInfo_,") has already been deleted.")),vR(t),delete n[t.key]}function oj(t,e,n,i){let r=e0[e.name];r||(r={},e0[e.name]=r);let s=r[t.toURLString()];return s&&vr("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),s=new jb(t,ij,n,i),r[t.toURLString()]=s,s}var t0=class{constructor(e,n){this._repoInternal=e,this.app=n,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(Bq(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new li(this._repo,ze())),this._rootInternal}_delete(){return this._rootInternal!==null&&(sj(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){this._rootInternal===null&&vr("Cannot call "+e+" on a deleted database.")}};function qR(){Bk.IS_TRANSPORT_INITIALIZED&&gn("Transport has already been initialized. Please call this function before calling ref or setting up a listener")}function jR(){qR(),fu.forceDisallow()}function GR(){qR(),Za.forceDisallow(),fu.forceAllow()}function WR(t,e,n,i={}){t=bn(t),t._checkNotDeleted("useEmulator");let r="".concat(e,":").concat(n),s=t._repoInternal;if(t._instanceStarted){if(r===t._repoInternal.repoInfo_.host&&tS(i,s.repoInfo_.emulatorOptions))return;vr("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let o;if(s.repoInfo_.nodeAdmin)i.mockUserToken&&vr('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),o=new uu(uu.OWNER);else if(i.mockUserToken){let a=typeof i.mockUserToken=="string"?i.mockUserToken:$v(i.mockUserToken,t.app.options.projectId);o=new uu(a)}Zf(e)&&(Yv(e),Kv("Database",!0)),rj(s,r,i,o)}function VR(t){t=bn(t),t._checkNotDeleted("goOffline"),vR(t._repo)}function zR(t){t=bn(t),t._checkNotDeleted("goOnline"),$q(t._repo)}function YR(t,e){Sk(t,e)}function aj(t){r0(aS),Tl(new Cr("database",(e,{instanceIdentifier:n})=>{let i=e.getProvider("app").getImmediate(),r=e.getProvider("auth-internal"),s=e.getProvider("app-check-internal");return F0(i,r,s,n)},"PUBLIC").setMultipleInstances(!0)),Yo(HA,qA,t),Yo(HA,qA,"esm2017")}var lj={".sv":"timestamp"};function $R(){return lj}function KR(t){return{".sv":{increment:t}}}var n0=class{constructor(e,n){this.committed=e,this.snapshot=n}toJSON(){return{committed:this.committed,snapshot:this.snapshot.toJSON()}}};function QR(t,e,n){var i;if(t=bn(t),oi("Reference.transaction",t._path),t.key===".length"||t.key===".keys")throw"Reference.transaction failed: "+t.key+" is a read-only object.";let r=(i=n==null?void 0:n.applyLocally)!==null&&i!==void 0?i:!0,s=new zt,o=(l,c,u)=>{let p=null;l?s.reject(l):(p=new cl(u,new li(t._repo,t._path),pt),s.resolve(new n0(c,p)))},a=Uf(t,()=>{});return Kq(t._repo,t._path,e,o,a,r),s.promise}c0.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)};c0.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};aj();var cj="@firebase/database-compat",uj="2.0.11";var pj=new zo("@firebase/database-compat"),XR=function(t){let e="FIREBASE WARNING: "+t;pj.warn(e)};var dj=function(t,e,n,i){if(!(i&&n===void 0)&&typeof n!="boolean")throw new Error(Dn(t,e)+"must be a boolean.")},mj=function(t,e,n){if(!(n&&e===void 0))switch(e){case"value":case"child_added":case"child_removed":case"child_changed":case"child_moved":break;default:throw new Error(Dn(t,"eventType")+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}};var U0=class{constructor(e){this._delegate=e}cancel(e){ae("OnDisconnect.cancel",0,1,arguments.length),Ft("OnDisconnect.cancel","onComplete",e,!0);let n=this._delegate.cancel();return e&&n.then(()=>e(null),i=>e(i)),n}remove(e){ae("OnDisconnect.remove",0,1,arguments.length),Ft("OnDisconnect.remove","onComplete",e,!0);let n=this._delegate.remove();return e&&n.then(()=>e(null),i=>e(i)),n}set(e,n){ae("OnDisconnect.set",1,2,arguments.length),Ft("OnDisconnect.set","onComplete",n,!0);let i=this._delegate.set(e);return n&&i.then(()=>n(null),r=>n(r)),i}setWithPriority(e,n,i){ae("OnDisconnect.setWithPriority",2,3,arguments.length),Ft("OnDisconnect.setWithPriority","onComplete",i,!0);
3let r=this._delegate.setWithPriority(e,n);return i&&r.then(()=>i(null),s=>i(s)),r}update(e,n){if(ae("OnDisconnect.update",1,2,arguments.length),Array.isArray(e)){let r={};for(let s=0;s<e.length;++s)r[""+s]=e[s];e=r,XR("Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}Ft("OnDisconnect.update","onComplete",n,!0);let i=this._delegate.update(e);return n&&i.then(()=>n(null),r=>n(r)),i}};var B0=class{constructor(e,n){this.committed=e,this.snapshot=n}toJSON(){return ae("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}}};var Mo=class t{constructor(e,n){this._database=e,this._delegate=n}val(){return ae("DataSnapshot.val",0,0,arguments.length),this._delegate.val()}exportVal(){return ae("DataSnapshot.exportVal",0,0,arguments.length),this._delegate.exportVal()}toJSON(){return ae("DataSnapshot.toJSON",0,1,arguments.length),this._delegate.toJSON()}exists(){return ae("DataSnapshot.exists",0,0,arguments.length),this._delegate.exists()}child(e){return ae("DataSnapshot.child",0,1,arguments.length),e=String(e),ml("DataSnapshot.child","path",e,!1),new t(this._database,this._delegate.child(e))}hasChild(e){return ae("DataSnapshot.hasChild",1,1,arguments.length),ml("DataSnapshot.hasChild","path",e,!1),this._delegate.hasChild(e)}getPriority(){return ae("DataSnapshot.getPriority",0,0,arguments.length),this._delegate.priority}forEach(e){return ae("DataSnapshot.forEach",1,1,arguments.length),Ft("DataSnapshot.forEach","action",e,!1),this._delegate.forEach(n=>e(new t(this._database,n)))}hasChildren(){return ae("DataSnapshot.hasChildren",0,0,arguments.length),this._delegate.hasChildren()}get key(){return this._delegate.key}numChildren(){return ae("DataSnapshot.numChildren",0,0,arguments.length),this._delegate.size}getRef(){return ae("DataSnapshot.ref",0,0,arguments.length),new Kr(this._database,this._delegate.ref)}get ref(){return this.getRef()}},Bf=class t{constructor(e,n){this.database=e,this._delegate=n}on(e,n,i,r){var s;ae("Query.on",2,4,arguments.length),Ft("Query.on","callback",n,!1);let o=t.getCancelAndContextArgs_("Query.on",i,r),a=(c,u)=>{n.call(o.context,new Mo(this.database,c),u)};a.userCallback=n,a.context=o.context;let l=(s=o.cancel)===null||s===void 0?void 0:s.bind(o.context);switch(e){case"value":return Uf(this._delegate,a,l),n;case"child_added":return N0(this._delegate,a,l),n;case"child_removed":return D0(this._delegate,a,l),n;case"child_changed":return M0(this._delegate,a,l),n;case"child_moved":return P0(this._delegate,a,l),n;default:throw new Error(Dn("Query.on","eventType")+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}}off(e,n,i){if(ae("Query.off",0,3,arguments.length),mj("Query.off",e,!0),Ft("Query.off","callback",n,!0),th("Query.off","context",i,!0),n){let r=()=>{};r.userCallback=n,r.context=i,L0(this._delegate,e,r)}else L0(this._delegate,e)}get(){return kR(this._delegate).then(e=>new Mo(this.database,e))}once(e,n,i,r){ae("Query.once",1,4,arguments.length),Ft("Query.once","callback",n,!0);let s=t.getCancelAndContextArgs_("Query.once",i,r),o=new zt,a=(c,u)=>{let p=new Mo(this.database,c);n&&n.call(s.context,p,u),o.resolve(p)};a.userCallback=n,a.context=s.context;let l=c=>{s.cancel&&s.cancel.call(s.context,c),o.reject(c)};switch(e){case"value":Uf(this._delegate,a,l,{onlyOnce:!0});break;case"child_added":N0(this._delegate,a,l,{onlyOnce:!0});break;case"child_removed":D0(this._delegate,a,l,{onlyOnce:!0});break;case"child_changed":M0(this._delegate,a,l,{onlyOnce:!0});break;case"child_moved":P0(this._delegate,a,l,{onlyOnce:!0});break;default:throw new Error(Dn("Query.once","eventType")+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}return o.promise}limitToFirst(e){return ae("Query.limitToFirst",1,1,arguments.length),new t(this.database,Ni(this._delegate,PR(e)))}limitToLast(e){return ae("Query.limitToLast",1,1,arguments.length),new t(this.database,Ni(this._delegate,DR(e)))}orderByChild(e){return ae("Query.orderByChild",1,1,arguments.length),new t(this.database,Ni(this._delegate,LR(e)))}orderByKey(){return ae("Query.orderByKey",0,0,arguments.length),new t(this.database,Ni(this._delegate,FR()))}orderByPriority(){return ae("Query.orderByPriority",0,0,arguments.length),new t(this.database,Ni(this._delegate,UR()))}orderByValue(){return ae("Query.orderByValue",0,0,arguments.length),new t(this.database,Ni(this._delegate,BR())
3)}startAt(e=null,n){return ae("Query.startAt",0,2,arguments.length),new t(this.database,Ni(this._delegate,NR(e,n)))}startAfter(e=null,n){return ae("Query.startAfter",0,2,arguments.length),new t(this.database,Ni(this._delegate,MR(e,n)))}endAt(e=null,n){return ae("Query.endAt",0,2,arguments.length),new t(this.database,Ni(this._delegate,RR(e,n)))}endBefore(e=null,n){return ae("Query.endBefore",0,2,arguments.length),new t(this.database,Ni(this._delegate,OR(e,n)))}equalTo(e,n){return ae("Query.equalTo",1,2,arguments.length),new t(this.database,Ni(this._delegate,HR(e,n)))}toString(){return ae("Query.toString",0,0,arguments.length),this._delegate.toString()}toJSON(){return ae("Query.toJSON",0,1,arguments.length),this._delegate.toJSON()}isEqual(e){if(ae("Query.isEqual",1,1,arguments.length),!(e instanceof t)){let n="Query.isEqual failed: First argument must be an instance of firebase.database.Query.";throw new Error(n)}return this._delegate.isEqual(e._delegate)}static getCancelAndContextArgs_(e,n,i){let r={cancel:void 0,context:void 0};if(n&&i)r.cancel=n,Ft(e,"cancel",r.cancel,!0),r.context=i,th(e,"context",r.context,!0);else if(n)if(typeof n=="object"&&n!==null)r.context=n;else if(typeof n=="function")r.cancel=n;else throw new Error(Dn(e,"cancelOrContext")+" must either be a cancel callback or a context object.");return r}get ref(){return new Kr(this.database,new li(this._delegate._repo,this._delegate._path))}},Kr=class t extends Bf{constructor(e,n){super(e,new kn(n._repo,n._path,new vu,!1)),this.database=e,this._delegate=n}getKey(){return ae("Reference.key",0,0,arguments.length),this._delegate.key}child(e){return ae("Reference.child",1,1,arguments.length),typeof e=="number"&&(e=String(e)),new t(this.database,Ns(this._delegate,e))}getParent(){ae("Reference.parent",0,0,arguments.length);let e=this._delegate.parent;return e?new t(this.database,e):null}getRoot(){return ae("Reference.root",0,0,arguments.length),new t(this.database,this._delegate.root)}set(e,n){ae("Reference.set",1,2,arguments.length),Ft("Reference.set","onComplete",n,!0);let i=Ff(this._delegate,e);return n&&i.then(()=>n(null),r=>n(r)),i}update(e,n){if(ae("Reference.update",1,2,arguments.length),Array.isArray(e)){let r={};for(let s=0;s<e.length;++s)r[""+s]=e[s];e=r,XR("Passing an Array to Firebase.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}oi("Reference.update",this._delegate._path),Ft("Reference.update","onComplete",n,!0);let i=AR(this._delegate,e);return n&&i.then(()=>n(null),r=>n(r)),i}setWithPriority(e,n,i){ae("Reference.setWithPriority",2,3,arguments.length),Ft("Reference.setWithPriority","onComplete",i,!0);let r=xR(this._delegate,e,n);return i&&r.then(()=>i(null),s=>i(s)),r}remove(e){ae("Reference.remove",0,1,arguments.length),Ft("Reference.remove","onComplete",e,!0);let n=CR(this._delegate);return e&&n.then(()=>e(null),i=>e(i)),n}transaction(e,n,i){ae("Reference.transaction",1,3,arguments.length),Ft("Reference.transaction","transactionUpdate",e,!1),Ft("Reference.transaction","onComplete",n,!0),dj("Reference.transaction","applyLocally",i,!0);let r=QR(this._delegate,e,{applyLocally:i}).then(s=>new B0(s.committed,new Mo(this.database,s.snapshot)));return n&&r.then(s=>n(null,s.committed,s.snapshot),s=>n(s,!1,null)),r}
3setPriority(e,n){ae("Reference.setPriority",1,2,arguments.length),Ft("Reference.setPriority","onComplete",n,!0);let i=wR(this._delegate,e);return n&&i.then(()=>n(null),r=>n(r)),i}push(e,n){ae("Reference.push",0,2,arguments.length),Ft("Reference.push","onComplete",n,!0);let i=IR(this._delegate,e),r=i.then(o=>new t(this.database,o));n&&r.then(()=>n(null),o=>n(o));let s=new t(this.database,i);return s.then=r.then.bind(r),s.catch=r.catch.bind(r,void 0),s}onDisconnect(){return oi("Reference.onDisconnect",this._delegate._path),new U0(new _f(this._delegate._repo,this._delegate._path))}get key(){return this.getKey()}get parent(){return this.getParent()}get root(){return this.getRoot()}};var Po=class{constructor(e,n){this._delegate=e,this.app=n,this.INTERNAL={delete:()=>this._delegate._delete(),forceWebSockets:jR,forceLongPolling:GR}}useEmulator(e,n,i={}){WR(this._delegate,e,n,i)}ref(e){if(ae("database.ref",0,1,arguments.length),e instanceof Kr){let n=O0(this._delegate,e.toString());return new Kr(this,n)}else{let n=R0(this._delegate,e);return new Kr(this,n)}}refFromURL(e){ae("database.refFromURL",1,1,arguments.length);let i=O0(this._delegate,e);return new Kr(this,i)}goOffline(){return ae("database.goOffline",0,0,arguments.length),VR(this._delegate)}goOnline(){return ae("database.goOnline",0,0,arguments.length),zR(this._delegate)}};Po.ServerValue={TIMESTAMP:$R(),increment:t=>KR(t)};function fj({app:t,url:e,version:n,customAuthImpl:i,customAppCheckImpl:r,namespace:s,nodeAdmin:o=!1}){r0(n);let a=new nh("database-standalone"),l=new op("auth-internal",a);l.setComponent(new Cr("auth-internal",()=>i,"PRIVATE"));let c;return r&&(c=new op("app-check-internal",a),c.setComponent(new Cr("app-check-internal",()=>r,"PRIVATE"))),{instance:new Po(F0(t,l,c,e,o),t),namespace:s}}var hj=Object.freeze({__proto__:null,initStandalone:fj});var gj=Po.ServerValue;function _j(t){t.INTERNAL.registerComponent(new Cr("database-compat",(e,{instanceIdentifier:n})=>{let i=e.getProvider("app-compat").getImmediate(),r=e.getProvider("database").getImmediate({identifier:n});return new Po(r,i)},"PUBLIC").setServiceProps({Reference:Kr,Query:Bf,Database:Po,DataSnapshot:Mo,enableLogging:YR,INTERNAL:hj,ServerValue:gj}).setMultipleInstances(!0)),t.registerVersion(cj,uj)}_j(Bn);function Fu(t,e,n="on",i=W0){return new Nn(r=>{let s=null;return s=t[n](e,(o,a)=>{i.schedule(()=>{r.next({snapshot:o,prevKey:a})}),n==="once"&&i.schedule(()=>r.complete())},o=>{i.schedule(()=>r.error(o))}),n==="on"?{unsubscribe(){s!=null&&t.off(e,s)}}:{unsubscribe(){}}}).pipe(De(r=>{let{snapshot:s,prevKey:o}=r,a=null;return s.exists()&&(a=s.key),{type:e,payload:s,prevKey:o,key:a}}),nv())}function yj(t){return typeof t=="string"}function bj(t){return typeof t.exportVal=="function"}function nO(t){return t==null}function iO(t){return typeof t.set=="function"}function JR(t,e){return iO(e)?e:t.ref(e)}function rO(t,e){if(yj(t))return e.stringCase();if(iO(t))return e.firebaseCase();if(bj(t))return e.snapshotCase();throw new Error("Expects a string, snapshot, or reference. Got: ".concat(typeof t))}function sO(t){return(nO(t)||t.length===0)&&(t=["child_added","child_removed","child_changed","child_moved"]),t}function oO(t,e,n){e=sO(e);let i=e.map(r=>Fu(t,r,"on",n));return _l(...i)}function vj(t,e,n){let i=oO(t,e).pipe(Yf((r,s)=>[...r,s],[]));return Ej(t,i,n)}function Sj(t,e){return Fu(t,"value","on",e).pipe(De(n=>{let i;return n.payload.forEach(r=>(i=r.key,!1)),{data:n,lastKeyToLoad:i}}))}function Ej(t,e,n){return Sj(t,n).pipe(sv(e),De(([r,s])=>{let o=r.lastKeyToLoad,a=s.map(l=>l.key);return{actions:s,lastKeyToLoad:o,loadedKeys:a}}),iv(r=>r.loadedKeys.indexOf(r.lastKeyToLoad)===-1),De(r=>r.actions))}function ZR(t,e){return function(i,r){return rO(i,{stringCase:()=>t.child(i)[e](r),firebaseCase:()=>i[e](r),snapshotCase:()=>i.ref[e](r)})}}function Tj(t){return function(n){return n?rO(n,{stringCase:()=>t.child(n).remove(),firebaseCase:()=>n.remove(),snapshotCase:()=>n.ref.remove()}):t.remove()}}function Ij(t,e,n){return Fu(t,"value","once",n).pipe(Le(i=>{let r=[pe(i)];return e.forEach(s=>r.push(Fu(t,s,"on",n))),_l(...r).pipe(Yf(wj,[]))}),Bu())}function aO(t,e){let n=t.length;for(let i=0;i<n;i++)if(t[i].payload.key===e)return i;return-1}function Cj(t,e){if(nO(e))return 0;{let n=aO(t,e);return n===-1?t.length:n+1}}function wj(t,e){var a;let{payload:n,prevKey:i,key:r}=e,s=aO(t,r),o=Cj(t,i);switch(e.type){case"value":if((a=e.payload)!=null&&a.exists()){let l=null;
3e.payload.forEach(c=>{let u={payload:c,type:"value",prevKey:l,key:c.key};return l=c.key,t=[...t,u],!1})}return t;case"child_added":if(s>-1){let l=t[s-1];((l==null?void 0:l.key)||null)!==i&&(t=t.filter(c=>c.payload.key!==n.key),t.splice(o,0,e))}else{if(i==null)return[e,...t];t=t.slice(),t.splice(o,0,e)}return t;case"child_removed":return t.filter(l=>l.payload.key!==n.key);case"child_changed":return t.map(l=>l.payload.key===r?e:l);case"child_moved":if(s>-1){let l=t.splice(s,1)[0];return t=t.slice(),t.splice(o,0,l),t}return t;default:return t}}function eO(t,e,n){return e=sO(e),Ij(t,e,n)}function xj(t,e,n){let i=e.schedulers.outsideAngular,r=T(Gt).run(()=>t.ref);return{query:t,update:ZR(r,"update"),set:ZR(r,"set"),push:s=>r.push(s),remove:Tj(r),snapshotChanges(s){return eO(t,s,i).pipe(wr(n))},stateChanges(s){return oO(t,s,i).pipe(wr(n))},auditTrail(s){return vj(t,s,i).pipe(wr(n))},valueChanges(s,o){return eO(t,s,i).pipe(De(l=>l.map(c=>o&&o.idField?D(g({},c.payload.val()),{[o.idField]:c.key}):c.payload.val())),wr(n))}}}function tO(t,e){return function(){return Fu(t,"value","on",e)}}function Aj(t,e,n){return{query:t,snapshotChanges(){return tO(t,e.schedulers.outsideAngular)().pipe(wr(n))},update(i){return t.ref.update(i)},set(i){return t.ref.set(i)},remove(){return t.ref.remove()},valueChanges(){return tO(t,e.schedulers.outsideAngular)().pipe(wr(n),De(r=>r.payload.exists()?r.payload.val():null))}}}var kj=new gt("angularfire2.realtimeDatabaseURL"),Rj=new gt("angularfire2.database.use-emulator"),Oj=(()=>{let e=class e{constructor(i,r,s,o,a,l,c,u,p,m,f,h,_,v,I){d(this,"schedulers");d(this,"database");d(this,"injector",T(qu));this.schedulers=l;let N=c,j=oa(i,a,r);u&&Wy(j,a,p,f,h,_,m,v),this.database=aa("".concat(j.name,".database.").concat(s),"AngularFireDatabase",j.name,()=>{let P=a.runOutsideAngular(()=>j.database(s||void 0));return N&&P.useEmulator(...N),P},[N])}list(i,r){let s=T(Gt).runOutsideAngular(()=>JR(this.database,i)),o=s;return r&&(o=r(s)),xj(o,this,this.injector)}object(i){let r=T(Gt).runOutsideAngular(()=>JR(this.database,i));return Aj(r,this,this.injector)}createPushId(){return T(Gt).runOutsideAngular(()=>this.database.ref()).push().key}};d(e,"\u0275fac",function(r){return new(r||e)(ue(as),ue(sa,8),ue(kj,8),ue(Fs),ue(Gt),ue(Gs),ue(Rj,8),ue(Vy,8),ue(Uy,8),ue(By,8),ue(Hy,8),ue(qy,8),ue(jy,8),ue(Gy,8),ue(Xa,8))}),d(e,"\u0275prov",vt({token:e,factory:e.\u0275fac,providedIn:"any"}));let t=e;return t})(),lO=(()=>{let e=class e{constructor(){Bn.registerVersion("angularfire",js.full,"rtdb-compat")}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275mod",Ir({type:e})),d(e,"\u0275inj",Tr({providers:[Oj]}));let t=e;return t})();var Nj=new gt("angularfire2.messaging.vapid-key"),Mj=new gt("angularfire2.messaging.service-worker-registeration"),Pj=(()=>{let e=class e{constructor(i,r,s,o,a,l,c){d(this,"requestPermission");d(this,"getToken");d(this,"tokenChanges");d(this,"messages");d(this,"requestToken");d(this,"deleteToken");let u=c,p=pe(void 0).pipe(Qn(a.outsideAngular),Mn(a.insideAngular),Le(pS),Le(h=>h?import("./chunk-U4FAYCPG.js"):V0),De(()=>oa(i,o,r)),Le(h=>aa("".concat(h.name,".messaging"),"AngularFireMessaging",h.name,()=>pe(h.messaging()),[])),bl({bufferSize:1,refCount:!1}));this.requestPermission=p.pipe(Qn(a.outsideAngular),Mn(a.insideAngular),Le(()=>Notification.requestPermission())),this.getToken=p.pipe(Qn(a.outsideAngular),Mn(a.insideAngular),Le(h=>k(this,null,function*(){if(Notification.permission==="granted"){let _=u?yield u:null;return yield h.getToken({vapidKey:l,serviceWorkerRegistration:_})}else return null})));let m=new Nn(h=>{navigator.permissions.query({name:"notifications"}).then(_=>{_.onchange=()=>h.next()})}),f=p.pipe(Qn(a.outsideAngular),Mn(a.insideAngular),Fo(m),Fo(this.getToken));return this.tokenChanges=p.pipe(Qn(a.outsideAngular),Mn(a.insideAngular),Le(()=>$0(this.getToken,f))),this.messages=p.pipe(Qn(a.outsideAngular),Mn(a.insideAngular),Le(h=>new Nn(_=>h.onMessage(_)))),this.requestToken=p.pipe(Qn(a.outsideAngular),Mn(a.insideAngular),Le(()=>this.requestPermission),qt(()=>pe(null)),Y0(()=>this.tokenChanges)),this.deleteToken=()=>p.pipe(Qn(a.outsideAngular),Mn(a.insideAngular),Le(h=>h.deleteToken()),Q0(!1)),td(this,p,o)}};d(e,"\u0275fac",function(r){return new(r||e)(ue(as),ue(sa,8),ue(Fs),ue(Gt),ue(Gs),ue(Nj,8),ue(Mj,8))}),d(e,"\u0275prov",vt({token:e,factory:e.\u0275fac,providedIn:"any"}));let t=e;return t})(),cO=(()=>{let e=class e{constructor(){Bn.registerVersion("angularfire",js.full,"fcm-compat")}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275mod",Ir({type:e})),d(e,"\u0275inj",Tr({providers:[Pj]}));let t=e;return t})();var Hf=t=>{let e=t.getCookieItem(Zu),n=t.getDocument.getElementsByTagName("html")[0];n&&(e?e==="light"?(n.classList.remove("dark"),n.classList.add(e)):(n.classList.remove("light"),n.classList.add(e)):n.classList.add("light"))};var H0=(()=>{let e=class e{constructor(){d(this,"bottomSheetRef",T(hp,{optional:!0}));d(this,"dialogRef",T(gi,{optional:!0}))}choose(i){var r,s;(r=this.bottomSheetRef)==null||r.dismiss(i),(s=this.dialogRef)==null||s.close(i)}download(){this.choose("download")}copyLink(){this.choose("copy")}sendToChat(){this.choose("chat")}};d(e,"\u0275fac",function(r){return new(r||e)}
3),d(e,"\u0275cmp",be({type:e,selectors:[["beh-share-content-dialog"]],decls:17,vars:0,consts:[[1,"w-full","flex","flex-wrap"],[1,"w-full","p-6","border-b","border-[#CED3D7]","justify-center"],[1,"font-medium","text-sm","text-gray-800","text-center"],[1,"w-full","flex","flex-wrap","justify-around","py-6"],[1,"w-1/3","flex","flex-wrap","justify-center","cursor-pointer",3,"click"],[1,"w-10","h-10","flex","items-center","justify-center","icon","arrow-download-filled","text-xl","bg-[#EDEDED]","dark:bg-gray-700","rounded-full","text-center"],[1,"w-full","font-regular","text-xs","text-gray-800","text-center","mt-2"],[1,"w-10","h-10","flex","items-center","justify-center","icon","link-regular","text-gray-800","text-xl","bg-[#EDEDED]","dark:bg-gray-700","rounded-full","text-center"],[1,"w-10","h-10","flex","items-center","justify-center","icon","send-regular","-rotate-[28deg]","text-gray-800","text-xl","bg-[#EDEDED]","dark:bg-gray-700","rounded-full","text-center"]],template:function(r,s){r&1&&(F(0,"section",0)(1,"header",1)(2,"p",2),E(3,"\u0627\u0634\u062A\u0631\u0627\u06A9\u200C\u06AF\u0630\u0627\u0631\u06CC"),W()(),F(4,"div",3)(5,"div",4),pi("click",function(){return s.download()}),qe(6,"span",5),F(7,"p",6),E(8,"\u0630\u062E\u06CC\u0631\u0647 \u062F\u0631 \u06AF\u0627\u0644\u0631\u06CC"),W()(),F(9,"div",4),pi("click",function(){return s.copyLink()}),qe(10,"span",7),F(11,"p",6),E(12,"\u06A9\u067E\u06CC\u200C\u06A9\u0631\u062F\u0646 \u0644\u06CC\u0646\u06A9"),W()(),F(13,"div",4),pi("click",function(){return s.sendToChat()}),qe(14,"span",8),F(15,"p",6),E(16,"\u0627\u0631\u0633\u0627\u0644 \u062F\u0631 \u067E\u06CC\u0627\u0645\u200C\u0647\u0627"),W()()()())},encapsulation:2}));let t=e;return t})();var Dj=["screenshot"],Lj=t=>({"background-image":t});function Fj(t,e){t&1&&Xr(0)}function Uj(t,e){if(t&1&&Fe(0,Fj,1,0,"ng-container",7),t&2){let n=w();x("ngComponentOutlet",n.component)("ngComponentOutletInjector",n.componentInjector)}}function Bj(t,e){t&1&&(b(0,"div",4),M(1,"div",8),S())}var uO=(()=>{let e=class e extends Fn{constructor(){super(...arguments);d(this,"data",T(Ut));d(this,"parentInjector",T(Ls));d(this,"dialogRef",T(gi));d(this,"_bottomSheet",T($o));d(this,"imageDownloaderService",T(PE));d(this,"_localRepository",T(Qe));d(this,"sendToChatService",T(RE));d(this,"matDialog",T(_i));d(this,"bookAggrigatorService",T(DE));d(this,"customerAggrigatorService",T(ES));d(this,"statisticsAggrigatorService",T(nE));d(this,"pageContentResolvers",T(Wm));d(this,"loading",!0);d(this,"content",null);d(this,"component",null);d(this,"componentInjector");d(this,"screenshot");d(this,"quoteImageSrc","")}ngOnInit(){this.resolveContent().pipe(jt(this.unsubscribe$)).subscribe(r=>{if(!r){this.snackbarService.openSnackbar(Xn.error,"\u0645\u062D\u062A\u0648\u0627\u06CC \u0645\u0648\u0631\u062F \u0646\u0638\u0631 \u06CC\u0627\u0641\u062A \u0646\u0634\u062F"),this.dialogRef.close();return}if(this.isContentRestricted(r)){this.snackbarService.openSnackbar(Xn.warning,"\u0627\u0645\u06A9\u0627\u0646 \u0627\u0634\u062A\u0631\u0627\u06A9 \u06AF\u0630\u0627\u0631\u06CC \u0648\u062C\u0648\u062F \u0646\u062F\u0627\u0631\u062F."),this.dialogRef.close();return}this.content=r,this.component=TA[this.data.type],this.componentInjector=Ls.create({providers:[{provide:Ut,useValue:r}],parent:this.parentInjector}),this.quoteImageSrc=this.data.type===ve.Quote&&(r!=null&&r.backgroundId)?"".concat(ln.ImageUrl,"/quotesharebackgrounds/").concat(r.backgroundId,".jpg"):"",this.loading=!1})}isContentRestricted(r){switch(this.data.type){case ve.Book:return!!r.isRestricted;case ve.Review:case ve.Quote:case ve.Post:case ve.BookList:return!!r.hasLimitedVisibility;default:return!1}}resolveContent(){var s,o;if(!((s=this.data)!=null&&s.id)&&((o=this.data)==null?void 0:o.type)!==ve.Donation)return pe(null);let r=this.data.id;switch(this.data.type){case ve.Book:return this.bookAggrigatorService.getBookById(r).pipe(De(a=>a.hasError?null:a.result),qt(()=>pe(null)));case ve.Profile:return(this.currentUser?this.customerAggrigatorService.getCustomer(r):this.customerAggrigatorService.getGuestCustomer(r)).pipe(Le(a=>a.hasError||!a.result?pe(null):this.statisticsAggrigatorService.getGuestProfileStatistics(r).pipe(De(l=>g(g({},a.result),l.hasError?{}:l.result)),qt(()=>pe(a.result)))),qt(()=>pe(null)));case ve.Review:case ve.Quote:case ve.Post:case ve.BookList:{let a=this.pageContentResolvers[this.data.type];return a?a(r):pe(null)}case ve.Donation:return pe({});default:return pe(null)}}share(){if(this.loading)return;(this._localRepository.IsInMobile?this._bottomSheet.open(H0,{data:null}).afterDismissed():this.matDialog.open(H0,{width:"360px",maxWidth:"92vw",panelClass:"basic-dialog",autoFocus:!1,data:null}).afterClosed()).subscribe(s=>{s=="download"?this.download():s=="copy"?this.copyLink():s=="chat"&&this.sendToChat()})}sendToChat(){var o;let r=this.sharedObjectType(),s=(o=this.data)==null?void 0:o.id;if(!r||!s){this.snackbarService.openSnackbar(Xn.error,"\u0627\u06CC\u0646 \u0645\u062D\u062A\u0648\u0627 \u0642\u0627\u0628\u0644 \u0627\u0631\u0633\u0627\u0644 \u062F\u0631 \u067E\u06CC\u0627\u0645\u200C\u0647\u0627 \u0646\u06CC\u0633\u062A");return}this.dialogRef.close(),this.sendToChatService.open(r,s)}sharedObjectType(){var r;return(r=IA[this.data.type])!=null?r:null}download(){return k(this,null,function*(){if(!this.screenshot)return;let r=this.screenshot.nativeElement;yield this.prepareImg(r),yield new Promise(s=>setTimeout(s,300)),HE(r,{backgroundColor:"#EEF6F1"}).then(s=>{let o=document.createElement("a");o.href=s,o.download="screenshot.png",o.click()}).catch(s=>{console.error("\u0628\u0627 \u062E\u0637\u0627 \u0645\u0648\u0627\u062C\u0647 \u0634\u062F:",s.message,s)})})}prepareImg(r){return k(this,null,function*(){let s=Array.from(r.querySelectorAll("img"));for(let o of s)if(!o.src.startsWith("data:"))try{let a=yield this.imageDownloaderService.getBase64ImageFromUrl(o.src);
3if(typeof a=="string"&&a.startsWith("data:application/json;base64,")){let l=a.replace("data:application/json;base64,",""),u=JSON.parse(atob(l)).contents;o.src=u}}catch(a){console.error("Error during image conversion:",a)}})}copyLink(){var r,s,o;if(this._localRepository.IsInBrowser){let a=(r=this.data)==null?void 0:r.id,l=(s=this.content)==null?void 0:s.uniqeName,c;switch(this.data.type){case ve.Review:c="reviews/".concat(a);break;case ve.Quote:c="quote/".concat(a);break;case ve.Post:c="post/".concat(a);break;case ve.BookList:c="booklist/".concat(a);break;case ve.Book:c="books/".concat(a);break;case ve.Profile:c="profile/".concat(l!=null?l:a),(o=this.content)!=null&&o.userIsPublisher&&(c+="?isPublisher=true");break;case ve.Donation:c="donate/pre";break;default:c=""}let u="".concat(ln.SiteUrl,"/").concat(c);navigator.clipboard?navigator.clipboard.writeText(u).then(()=>{this.snackbarService.openSnackbar(Xn.success,"\u0644\u06CC\u0646\u06A9 \u0628\u0627 \u0645\u0648\u0641\u0642\u06CC\u062A \u06A9\u067E\u06CC \u0634\u062F.")}).catch(()=>{this.fallbackCopy(u)}):this.fallbackCopy(u)}}fallbackCopy(r){let s=document.createElement("textarea");s.value=r,s.style.position="fixed",s.style.left="-9999px",document.body.appendChild(s),s.focus(),s.select();try{if(document.execCommand("copy"))this.snackbarService.openSnackbar(Xn.success,"\u0644\u06CC\u0646\u06A9 \u0628\u0627 \u0645\u0648\u0641\u0642\u06CC\u062A \u06A9\u067E\u06CC \u0634\u062F.");else throw new Error}catch{this.snackbarService.openSnackbar(Xn.error,"\u06A9\u067E\u06CC \u0644\u06CC\u0646\u06A9 \u0628\u0627 \u062E\u0637\u0627 \u0645\u0648\u0627\u062C\u0647 \u0634\u062F.")}finally{document.body.removeChild(s)}}};d(e,"\u0275fac",(()=>{let r;return function(o){return(r||(r=Uo(e)))(o||e)}})()),d(e,"\u0275cmp",be({type:e,selectors:[["beh-share-container-dialog"]],viewQuery:function(s,o){if(s&1&&Ho(Dj,5),s&2){let a;qo(a=jo())&&(o.screenshot=a.first)}},features:[Pn],decls:9,vars:5,consts:[["screenshot",""],[1,"w-full","h-full","flex","flex-col","justify-between","items-center","py-6","overflow-auto","bg-cover","bg-green-10","dark:bg-green-1000",3,"ngStyle"],[1,"w-full","icon","text-base","dismiss-regular","text-gray-800","text-end","pl-5","z-40",3,"click"],[1,"flex-grow","w-full","max-w-[390px]","mx-auto","block","content-center","justify-center","items-start","px-14"],[1,"w-full","flex","justify-center","items-center"],[1,"w-full","max-w-[390px]","mx-auto","px-5"],[1,"w-full","justify-center","btn-xs","btn-green-flat","rounded-lg",3,"click","disabled"],[4,"ngComponentOutlet","ngComponentOutletInjector"],[1,"loader"]],template:function(s,o){if(s&1){let a=ge();b(0,"section",1)(1,"span",2),ee("click",function(){return J(a),Z(o.dialogRef.close())}),S(),b(2,"div",3,0),se(4,Uj,1,2,"ng-container")(5,Bj,2,0,"div",4),S(),b(6,"div",5)(7,"button",6),ee("click",function(){return J(a),Z(o.share())}),E(8,"\u0627\u0634\u062A\u0631\u0627\u06A9\u200C\u06AF\u0630\u0627\u0631\u06CC"),S()()()}s&2&&(x("ngStyle",rt(3,Lj,o.quoteImageSrc?"url("+o.quoteImageSrc+")":"none")),y(4),oe(o.component?4:o.loading?5:-1),y(3),x("disabled",o.loading))},dependencies:[Jr,Iv,Ku],styles:[".loader[_ngcontent-%COMP%]{width:15px;aspect-ratio:1;border-radius:50%;animation:_ngcontent-%COMP%_l5 1s infinite linear alternate}@keyframes _ngcontent-%COMP%_l5{0%{box-shadow:20px 0 #2bae66,-20px 0 #b1eccb;background:#2bae66}33%{box-shadow:20px 0 #2bae66,-20px 0 #b1eccb;background:#b1eccb}66%{box-shadow:20px 0 #b1eccb,-20px 0 #2bae66;background:#b1eccb}to{box-shadow:20px 0 #b1eccb,-20px 0 #2bae66;background:#2bae66}}"]}));let t=e;return t})();var q0=new gt("initializer");function Hj(t,e){if(t&1){let n=ge();F(0,"p",0),E(1," \u062F\u0627\u0646\u0644\u0648\u062F \u0627\u067E\u0644\u06CC\u06A9\u06CC\u0634\u0646 "),F(2,"span",1),E(3," \u0628\u0647\u062E\u0648\u0627\u0646 "),W()(),F(4,"div",2)(5,"div",3)(6,"button",4),pi("click",function(){J(n);let r=w();return Z(r.installPwa())}),E(7," \u0648\u0628 \u0627\u067E\u0644\u06CC\u06A9\u06CC\u0634\u0646 "),W()(),F(8,"div",5)(9,"a",6),E(10," \u0627\u067E\u0644\u06CC\u06A9\u06CC\u0634\u0646 \u0627\u0646\u062F\u0631\u0648\u06CC\u062F "),W()()()}}function qj(t,e){if(t&1){let n=ge();F(0,"p",7),E(1," \u0648\u0628 \u0627\u067E\u0644\u06CC\u06A9\u06CC\u0634\u0646 "),F(2,"span",8),E(3," \u0628\u0647\u062E\u0648\u0627\u0646 "),W(),E(4," \u0631\u0627 \u0628\u0647 \u0635\u0641\u062D\u06C0 \u0627\u0635\u0644\u06CC \u0645\u0648\u0628\u0627\u06CC\u0644 \u062E\u0648\u062F \u0627\u0636\u0627\u0641\u0647 \u06A9\u0646\u06CC\u062F.\n"),W(),F(5,"div",9)(6,"div",3)(7,"ul")(8,"li",10),E(9," \u062F\u0631 \u0646\u0648\u0627\u0631 \u067E\u0627\u06CC\u06CC\u0646 \u062F\u06A9\u0645\u06C0 "),F(10,"span",11),E(11," Share "),W(),E(12," \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F. "),W(),F(13,"li",10),E(14," \u062F\u0631 \u0645\u0646\u0648\u06CC \u0628\u0627\u0632 \u0634\u062F\u0647 \u06AF\u0632\u06CC\u0646\u06C0 "),F(15,"span",11),E(16," Add to home screen "),W(),E(17," \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F. "),W(),F(18,"li",10),E(19," \u062F\u0631 \u0645\u0631\u062D\u0644\u06C0 \u0628\u0639\u062F \u062F\u0631 \u0642\u0633\u0645\u062A \u0628\u0627\u0644\u0627 \u0631\u0648\u06CC "),F(20,"span",11),E(21," Add "),W(),E(22," \u06A9\u0644\u06CC\u06A9 \u06A9\u0646\u06CC\u062F. "),W()()(),F(23,"div",12)(24,"button",13),pi("click",function(){J(n);let r=w();return Z(r.close())}),E(25," \u0645\u062A\u0648\u062C\u0647 \u0634\u062F\u0645! "),W()()()}}var j0=(()=>{let e=class e{constructor(){d(this,"_localRepository",T(Qe));d(this,"_bottomSheetRef",T(hp));d(this,"_data",T(xS));d(this,"isAndroid",!1)}ngOnInit(){var i;((i=this._data)==null?void 0:i.mobileType)==1?this.isAndroid=!0:this.isAndroid=!1}installPwa(){var i,r;
3(r=(i=this._data)==null?void 0:i.promptEvent)==null||r.prompt(),this.close()}close(){this._localRepository.IsInBrowser&&this._localRepository.setLocalItem("PWA",Date.now().toString()),this._bottomSheetRef.dismiss()}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275cmp",be({type:e,selectors:[["app-prompt-bottomsheet"]],decls:2,vars:1,consts:[[1,"text-sm","text-gray-900","text-center"],[1,"text-green-500"],[1,"w-full","flex","flex-wrap","mt-3"],[1,"w-full"],[1,"text-sm","btn-green-outline","rounded-lg","p-2","w-full","!outline-none",3,"click"],[1,"w-full","mt-3"],["href","https://s3.ir-thr-at1.arvanstorage.com/top-readers-publishers/apks/latest-native-app.apk","download","behkhaan",1,"text-sm","bg-green-500","text-white","p-2","w-full","rounded-lg","flex","justify-center"],[1,"text-sm","text-gray-900"],[1,"text-green-500","text-sm","font-medium"],[1,"w-full","flex","mt-4","flex-wrap"],[1,"text-sm","my-2","text-gray-900"],[1,"text-gray-900","text-sm","font-medium"],[1,"w-full","mt-4"],[1,"text-sm","bg-green-500","text-white","rounded-lg","p-2","w-full","!outline-none",3,"click"]],template:function(r,s){r&1&&se(0,Hj,11,0)(1,qj,26,0),r&2&&oe(s.isAndroid?0:1)},dependencies:[Jr,es],encapsulation:2}));let t=e;return t})();var pO=(()=>{let e=class e{constructor(){d(this,"platform",T(IS));d(this,"updates",T(Vh));d(this,"_bottomSheet",T($o));d(this,"doc",T(ju));d(this,"_localRepository",T(Qe));d(this,"appStateService",T(Qo));d(this,"nowMilliseconds",0);d(this,"promptEvent");d(this,"objectMilliseconds",0);d(this,"showInstalPrompt",!1);let i=this.updates,r=this.doc;i.unrecoverable.subscribe(()=>{this._localRepository.IsInBrowser&&r.location.reload()})}StartPWA(){this.updates.isEnabled&&(this.updates.versionUpdates.pipe(an(o=>o.type==="VERSION_READY"),De(o=>({type:"UPDATE_AVAILABLE",current:o.currentVersion,available:o.latestVersion}))).subscribe(o=>{o.type==="UPDATE_AVAILABLE"&&(this.appStateService.updateAvailible$=!0)}),this.updates.checkForUpdate()),this.nowMilliseconds=new Date().getTime();let i=+this._localRepository.getLocalItem("PWA"),r=new Date(i).toString(),s=new Date(Date.parse(r));if(this.objectMilliseconds=s.getTime(),this._localRepository.IsInBrowser){let o=this.nowMilliseconds-this.objectMilliseconds,a=Math.floor(o/1e3/60),l=Math.floor(a/60);this.showInstalPrompt=l>0,this.showInstalPrompt&&(this.platform.ANDROID&&this.doc.defaultView.addEventListener("beforeinstallprompt",c=>{c.preventDefault(),this.promptEvent=c,this._bottomSheet.open(j0,{data:{mobileType:1,promptEvent:this.promptEvent},panelClass:"basic-bottomsheet"}).afterDismissed().subscribe(()=>{this._localRepository.IsInBrowser&&this._localRepository.setLocalItem("PWA",Date.now().toString())})}),this.platform.IOS&&("standalone"in this.doc.defaultView.navigator&&this.doc.defaultView.navigator.standalone||this._bottomSheet.open(j0,{data:{mobileType:2,promptEvent:this.promptEvent},panelClass:"basic-bottomsheet"}).afterDismissed().subscribe(()=>{this._localRepository.IsInBrowser&&this._localRepository.setLocalItem("PWA",Date.now().toString())})))}}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",vt({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();var qf=class{constructor(){d(this,"pwaService",T(pO));d(this,"fcmService",T(ap));d(this,"userStateService",T(hi));d(this,"repo",T(Qe))}initialize(){return this.repo.IsInBrowser&&(this.pwaService.StartPWA(),this.repo.removeLocalItem(Fv),this.repo.removeLocalItem(Uv),this.repo.removeLocalItem(Bv)),Hf(this.repo),this.userStateService.initializeUserState().pipe(yn(1))}};var dO=(()=>{let e=class e{constructor(){d(this,"retry",new Xi)}retryInitialization(){this.retry.emit()}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275cmp",be({type:e,selectors:[["beh-initialization-error"]],outputs:{retry:"retry"},decls:7,vars:0,consts:[[1,"h-full","w-full","flex","flex-wrap","justify-center","content-center","dark:bg-gray-900"],[1,"w-full","mb-4","text-base","text-center","text-gray-900"],[1,"btn-green-flat","w-[124px]","h-10","flex","items-center",3,"click"],[1,"icon","arrow-clockwise-filled","text-base","ml-2"],[1,"text-sm"]],template:function(r,s){r&1&&(F(0,"div",0)(1,"p",1),E(2,"\u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC \u0628\u0627 \u062E\u0637\u0627 \u0645\u0648\u0627\u062C\u0647 \u0634\u062F"),W(),F(3,"button",2),pi("click",function(){return s.retryInitialization()}),qe(4,"span",3),F(5,"span",4),E(6,"\u062A\u0644\u0627\u0634 \u0645\u062C\u062F\u062F"),W()()())},encapsulation:2}));let t=e;return t})();var mO=(()=>{let e=class e{};d(e,"\u0275fac",function(r){return new(r||e)}
3),d(e,"\u0275cmp",be({type:e,selectors:[["app-loading"]],decls:2,vars:0,consts:[[1,"top-0","w-screen","h-screen","overflow-hidden","flex","flex-wrap","justify-center","content-center","z-[999999]","bg-white","bg-opacity-70","fixed"],[1,"loader"]],template:function(r,s){r&1&&(F(0,"div",0),qe(1,"div",1),W())},styles:[".loader[_ngcontent-%COMP%]{width:15px;aspect-ratio:1;border-radius:50%;animation:_ngcontent-%COMP%_l5 1s infinite linear alternate}@keyframes _ngcontent-%COMP%_l5{0%{box-shadow:20px 0 #2bae66,-20px 0 #b1eccb;background:#2bae66}33%{box-shadow:20px 0 #2bae66,-20px 0 #b1eccb;background:#b1eccb}66%{box-shadow:20px 0 #b1eccb,-20px 0 #2bae66;background:#b1eccb}to{box-shadow:20px 0 #b1eccb,-20px 0 #2bae66;background:#2bae66}}"]}));let t=e;return t})();var fO=(()=>{let e=class e{constructor(){d(this,"widgetId","68qmu3");d(this,"repo",T(Qe));d(this,"userState",T(hi));d(this,"imagePipe",T(lt))}loadGoftino(){this.repo.IsInBrowser&&new Promise((i,r)=>{let s=this.repo.getDocument.createElement("script"),o="https://www.goftino.com/widget/".concat(this.widgetId),a=localStorage.getItem("goftino_".concat(this.widgetId));s.src=a?"".concat(o,"?o=").concat(a):o,s.async=!0,s.onload=()=>i(window.Goftino),s.onerror=r,this.repo.getDocument.head.appendChild(s)}).then(()=>{window.addEventListener("goftino_ready",()=>{this.setWidget(),this.setUserIdInGoftino(),this.setUserInGoftino()})})}setWidget(){Goftino.setWidget({hasIcon:!1})}setUserIdInGoftino(){let i=this.userState.userDataSnapshot;i!=null&&i.id&&Goftino.setUserId(i.id)}setUserInGoftino(){let i=this.userState.userDataSnapshot,r=[];i!=null&&i.id&&(i.roleNames&&(typeof i.roleNames=="string"?r=i.roleNames.split(",").map(s=>s.trim()):r=i.roleNames),i.hasPro&&r.push("HasPro"),Goftino.setUser({email:i.email,name:i.firstName+"(".concat(i==null?void 0:i.uniqeName,")"),phone:i.phoneNumber,tags:r,avatar:this.imagePipe.transform(i==null?void 0:i.id,_t.userAvatar,i.hasPhoto),forceUpdate:!0}))}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",vt({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();var jj=()=>[import("./chunk-TS72MBZA.js").then(t=>t.PullToRefresh)];function Gj(t,e){t&1&&M(0,"app-loading")}function Wj(t,e){if(t&1){let n=ge();b(0,"beh-pull-to-refresh",0),ee("refresh",function(){J(n);let r=w(2);return Z(r.reloadPage())}),S()}}function Vj(t,e){if(t&1&&(M(0,"router-outlet"),gv(1,Wj,1,0),_v(2,1,jj)),t&2){let n=w();y(2),yv(n.Repository.IsIOS||n.Repository.IsSafari)}}function zj(t,e){if(t&1){let n=ge();b(0,"beh-initialization-error",1),ee("retry",function(){J(n);let r=w();return Z(r.retryInitialization())}),S()}}var hO=(()=>{let e=class e extends Fn{constructor(){super(...arguments);d(this,"_router",T(Yt));d(this,"_localRepository",T(Qe));d(this,"_headerActionListGeneratorService",T(BE));d(this,"shareContentService",T(FE));d(this,"initializer",T(q0));d(this,"signalHubService",T(vp));d(this,"fcmService",T(ap));d(this,"transferState",T(dv));d(this,"appState","loading");d(this,"dialog",T(_i));d(this,"goftinoLoader",T(fO));d(this,"refreshContentService",T(cE))}ngOnInit(){this.initializeApplication().pipe(Ze(()=>this.loadGoftino()),yl(()=>this.initializeFCM()),yl(()=>this.listenToFcmMessages())).subscribe(),this.appStateService.theme.pipe(jt(this.unsubscribe$)).subscribe(()=>Hf(this._localRepository)),this.openSharedContentDialog().pipe(jt(this.unsubscribe$)).subscribe(),this.toggleGoftinoVisibility()}onVisibilityChange(){document.hidden||(this.signalHubService.ensureConnected(),this.refreshContentService.refreshContent())}onFocus(){this.Repository.IsIOS&&this.Repository.IsSafari&&this.Repository.IsInMobile&&(this.signalHubService.ensureConnected(),this.refreshContentService.refreshContent())}initializeApplication(){return this.Repository.IsInBrowser&&(this.appState=this.transferState.get(uh,"loading")),this.initializer.initialize().pipe(Ze(()=>{this.setInitializationState("initialized"),this.Repository.setLocalItem(qv,Date.now().toString()),this._headerActionListGeneratorService.generate()}),qt(r=>(console.log(r),this.setInitializationState("error"),pe(null))))}initializeFCM(){return this.fcmService.initialize()}listenToFcmMessages(){return this.fcmService.listenToFcmMessages()}loadGoftino(){this.goftinoLoader.loadGoftino()}toggleGoftinoVisibility(){if(!this.Repository.IsInBrowser)return;let r=this.Repository.getDocument.body;this._router.events.pipe(an(s=>s instanceof Ws),rv(null),jt(this.unsubscribe$)).subscribe(()=>{let s=this._router.url.split("?")[0].split("#")[0],o=s.startsWith(Et.message),a=s==="/"||s==="/feeds",l=o||this.Repository.IsInMobile&&!a;r.classList.toggle("hide-goftino",l)})}setInitializationState(r){this.appState=r,this.Repository.IsInBrowser||this.transferState.set(uh,r)}retryInitialization(){this.appState="loading",this.initializeApplication().subscribe()}onGlobalClick(r){var s,o,a,l;if(((s=r==null?void 0:r.target)==null?void 0:s.classList[0])=="mention-link"&&((a=(o=r==null?void 0:r.target)==null?void 0:o.innerText)!=null&&a.includes("@"))){if(((l=r==null?void 0:r.target)==null?void 0:l.innerText)==null)return;let c=r.target.innerText.slice(1).trim();c&&this._router.navigate([Et.profile,c])}}openSharedContentDialog(){return this.shareContentService.sharedContent.pipe(an(r=>!!r),Ze(r=>{this.dialog.open(uO,{panelClass:"share-dialog",data:r})}))}reloadPage(){this.Repository.IsInBrowser&&window.location.reload()}};d(e,"\u0275fac",(()=>{let r;return function(o){return(r||(r=Uo(e)))(o||e)}}
3)()),d(e,"\u0275cmp",be({type:e,selectors:[["app-root"]],hostBindings:function(s,o){s&1&&ee("visibilitychange",function(){return o.onVisibilityChange()},Qf)("focus",function(){return o.onFocus()},mv)("mousedown",function(l){return o.onGlobalClick(l)},Qf)},features:[Sv([{provide:q0,useClass:qf}]),Pn],decls:3,vars:1,consts:[[3,"refresh"],[3,"retry"]],template:function(s,o){s&1&&se(0,Gj,1,0,"app-loading")(1,Vj,4,1)(2,zj,1,0,"beh-initialization-error"),s&2&&oe(o.appState==="loading"?0:o.appState==="initialized"?1:2)},dependencies:[up,Ln,BA,lO,cO,dO,mO],encapsulation:2,data:{animation:[Xp]}}));let t=e;return t})();var gO="10.4.0";ln.production&&void 0;var $j=atob(ln.sentryDsn),Kj=ln.production?"production":ln.staging?"staging":"development";sA({dsn:$j,sendDefaultPii:!0,environment:Kj,release:gO,integrations:[Sy(),qd(),N_(),cA()],tracePropagationTargets:["localhost",/^https:\/\/behkhaan\.ir\/api/],replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,tracesSampleRate:1});kv(hO,wA).catch(t=>console.error(t));
4
5//# debugId=7cacaf6c-b41a-5f6f-aa2a-e1e0e117448f

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