PageSourceSearch

https://pdaus.org/assets/index-Cy0mEndq.js

js pdaus.org collected 2026-09-24 14:26:16 UTC 1,370,746 bytes, 4,571 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ApplicationReviewManager-AEz8vIyF.js","assets/circle-check-BZJk0Esh.js","assets/credit-card-Bf8kwVGM.js","assets/refresh-cw-CKlEQ0ql.js","assets/user-round-B4OC8qoG.js","assets/circle-x--Hhxug82.js","assets/badge-C1tuWWvG.js","assets/textarea-BjYbYGNl.js","assets/AdminSystemSettings-CgWBT7SR.js","assets/key-round-DNGG60_5.js","assets/HomePage-6cZNIMIH.js","assets/arrow-right-D-eJKp4N.js","assets/briefcase-business-CKyWUmFy.js","assets/clock-3-DF03cOYD.js","assets/sparkles-xeLnjBJT.js","assets/careerEvents-xeJILg7Q.js","assets/publicCareerEvents-I5jcJRpa.js","assets/use-in-view-eEnzqryl.js","assets/scale-Ok73cMZd.js","assets/heart-C0E4fu1k.js","assets/shield-alert-DswjgfMo.js","assets/serviceImages-CELaEuQw.js","assets/truck-DLJyNSZ8.js","assets/house-D0-2auXc.js","assets/users-round-D7KutwYd.js","assets/smartphone-DzENhZ85.js","assets/useGoogleTranslateDetection-CbQorEzS.js","assets/Donate-CSIq9WRx.js","assets/search-DGRW3EAO.js","assets/user-pv6hg9sL.js","assets/JoinUs-DgQec_3j.js","assets/circle-alert-CVSuIxwP.js","assets/car-B55g2k-a.js","assets/briefcase-CPN7plgZ.js","assets/CommunityQA-CtA376KV.js","assets/chevron-left-B3V3zu-w.js","assets/eye-DUPav99f.js","assets/hash-D9UVm01o.js","assets/circle-help-De7DpHv_.js","assets/radio-group-CeWf2u_T.js","assets/index-Bz0Zf2YA.js","assets/label-BWxT3c0S.js","assets/LegalAid-DRm-IImv.js","assets/triangle-alert-B0KKaF5Y.js","assets/circle-check-big-D6PvPBn2.js","assets/info-C8PQ3Ol9.js","assets/trending-up-CoIyImY7.js","assets/input-CGKyIqav.js","assets/TrainingHome--r0TBfeF.js","assets/bus-B9G39xWB.js","assets/wrench-bOblcG1j.js","assets/TrainingSchools-D-E-b036.js","assets/arrow-left-DzM4Rslx.js","assets/building-2-DzCrM9RZ.js","assets/external-link-D8TMXkCf.js","assets/Employment-DqARZeTH.js","assets/languages-C8IvlclM.js","assets/CareerEvents-pToT3mfg.js","assets/CareerEventDetail-COERao2Y.js","assets/user-plus--6TLDygD.js","assets/Insurance-Cy_oNMjU.js","assets/ContactUs-BwhTpyje.js","assets/message-square-ghFmsQ3v.js","assets/AboutNew-DU4i6k8t.js","assets/handshake-C_Fqq87k.js","assets/TransparencyPage-BhjaQPAm.js","assets/award-9Kjgoxg0.js","assets/download-CZTWjogL.js","assets/card-DTmSMmTT.js","assets/accessibilityCompliance-YuGmMKeZ.js","assets/LeadershipPage-DJu5Keym.js","assets/brain-DsSrDQ1t.js","assets/AccessibilityDemo-D0YtODZ2.js","assets/keyboard-JIh7j-M2.js","assets/SMSConsentPage-Dne8nMHr.js","assets/clock-DK3FKwUw.js","assets/AppMainPage-BTuUHTlF.js","assets/book-open-D7xOlyhx.js","assets/AppTermsPrivacy-D_W8e416.js","assets/TruckTalkCoachLegalDraft-DIKqgSaM.js","assets/NYCDLPermitTerms-DReUbs_z.js","assets/TruckTalkProTerms-8KLEzGnA.js","assets/trash-2-qpUYEtGq.js","assets/zap-qm4JEtpY.js","assets/TruckTalkProPage-DpV-EW9N.js","assets/wifi-CJchZ5hz.js","assets/NYCDLPage-Cf-QOjz6.js","assets/target-C7YwKzZb.js","assets/chart-column-De0mosNu.js","assets/DigitalSolutions-ChkdmM_r.js","assets/PersonalInjury-BXM5o820.js","assets/WorkersCompensation-9K5if8aZ.js","assets/clipboard-list-IwnECmWG.js","assets/HealthcareNavigation-Dc3xYChq.js","assets/MentalHealthSupport-DZn44sg-.js","assets/HousingSupport-CsWii8f9.js","assets/ResearchLogistics-Dhd0vMN-.js","assets/calendar-Dz2pHL9o.js","assets/SmartEmailLink-D-UaS7vH.js","assets/ResearchLegalFrameworks-Cx6-Qo68.js","assets/YouthSafety-03zwtRGw.js","assets/HousingStabilityResearch-z_wht3IY.js","assets/Login-CqeUT-vD.js","assets/tabs-B_jXOuwz.js","assets/UnifiedTwoFactorAuth-CHzUioFq.js","assets/MemberDashboard-C_ebYOBc.js","assets/IdentityWatermark-CEzjbAOc.js","assets/IdentityPhotoUploader-TG8TGQNq.js","assets/camera-CI449b9p.js","assets/upload-D8AXg8p7.js","assets/eventImageProcessor-DEdRM3SO.js","assets/VolunteerDashboard-ChFXZcSz.js","assets/LawyerDashboard-DpNtGo0w.js","assets/SuperAdminLogin--OULKP5M.js","assets/AdminDashboard-Cr52yU3-.js","assets/ActivityLog-C6IeJ9va.js","assets/square-pen-BoxC2a9j.js","assets/UserManagement-h8Vsa3a_.js","assets/save-DeThRMia.js","assets/professionalTypes-Dn1VlFBg.js","assets/DonationManagement-D459gLao.js","assets/ContentStudio-Djvbh6gd.js","assets/plus-DH8-9wis.js","assets/CareerEventsManager-CQA08F5B.js","assets/image-plus-DfdhpzjN.js","assets/cloud-upload-Dlf03zuu.js","assets/MembershipCardPrinter-C--MYarJ.js","assets/printer-DJn7QggO.js","assets/cardTemplates-CSYqkQQs.js","assets/InternalIdentityCardPrinter-Cf5bAB6h.js","assets/CardDesignStudio-Cr-wwNNq.js","assets/rotate-ccw-BVx15U7N.js","assets/AICallCenter-DD6aSUep.js","assets/history-enjlns5D.js","assets/EmailRoutingManager-B8HCn6dT.js","assets/DepartmentEmailConfigurator-cyDyop9D.js","assets/AdminActivityLogs-DGvVgi-5.js","assets/PortalPreview-BM_F7NKq.js","assets/DonatePage-Dg7PV41d.js","assets/stripeService-Dc5F37Jz.js","assets/DonationSuccessPage-C5qO1kYA.js","assets/DonationCancelPage-ftEEAgQB.js"])))=>i.map(i=>d[i]);
2function CS(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Ia=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function SS(t){if(Object.prototype.hasOwnProperty.call(t,"__esMo
vendor: 14,255 bytes, lines 2-34
2dule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}),n}var Rg={exports:{}},Au={},Dg={exports:{}},et={};/**
3 * @license React
4 * react.production.min.js
5 *
6 * Copyright (c) Facebook, Inc. and its affiliates.
7 *
8 * This source code is licensed under the MIT license found in the
9 * LICENSE file in the root directory of this source tree.
10 */var AE;function AN(){if(AE)return et;AE=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),g=Symbol.iterator;function y(U){return U===null||typeof U!="object"?null:(U=g&&U[g]||U["@@iterator"],typeof U=="function"?U:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,E={};function w(U,W,te){this.props=U,this.context=W,this.refs=E,this.updater=te||x}w.prototype.isReactComponent={},w.prototype.setState=function(U,W){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,W,"setState")},w.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function R(){}R.prototype=w.prototype;function C(U,W,te){this.props=U,this.context=W,this.refs=E,this.updater=te||x}var k=C.prototype=new R;k.constructor=C,b(k,w.prototype),k.isPureReactComponent=!0;var N=Array.isArray,V=Object.prototype.hasOwnProperty,$={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function I(U,W,te){var Q,pe={},xe=null,Oe=null;if(W!=null)for(Q in W.ref!==void 0&&(Oe=W.ref),W.key!==void 0&&(xe=""+W.key),W)V.call(W,Q)&&!D.hasOwnProperty(Q)&&(pe[Q]=W[Q]);var ve=arguments.length-2;if(ve===1)pe.children=te;else if(1<ve){for(var Me=Array(ve),dt=0;dt<ve;dt++)Me[dt]=arguments[dt+2];pe.children=Me}if(U&&U.defaultProps)for(Q in ve=U.defaultProps,ve)pe[Q]===void 0&&(pe[Q]=ve[Q]);return{$$typeof:t,type:U,key:xe,ref:Oe,props:pe,_owner:$.current}}function B(U,W){return{$$typeof:t,type:U.type,key:W,ref:U.ref,props:U.props,_owner:U._owner}}function O(U){return typeof U=="object"&&U!==null&&U.$$typeof===t}function F(U){var W={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(te){return W[te]})}var L=/\/+/g;function M(U,W){return typeof U=="object"&&U!==null&&U.key!=null?F(""+U.key):W.toString(36)}function se(U,W,te,Q,pe){var xe=typeof U;(xe==="undefined"||xe==="boolean")&&(U=null);var Oe=!1;if(U===null)Oe=!0;else switch(xe){case"string":case"number":Oe=!0;break;case"object":switch(U.$$typeof){case t:case e:Oe=!0}}if(Oe)return Oe=U,pe=pe(Oe),U=Q===""?"."+M(Oe,0):Q,N(pe)?(te="",U!=null&&(te=U.replace(L,"$&/")+"/"),se(pe,W,te,"",function(dt){return dt})):pe!=null&&(O(pe)&&(pe=B(pe,te+(!pe.key||Oe&&Oe.key===pe.key?"":(""+pe.key).replace(L,"$&/")+"/")+U)),W.push(pe)),1;if(Oe=0,Q=Q===""?".":Q+":",N(U))for(var ve=0;ve<U.length;ve++){xe=U[ve];var Me=Q+M(xe,ve);Oe+=se(xe,W,te,Me,pe)}else if(Me=y(U),typeof Me=="function")for(U=Me.call(U),ve=0;!(xe=U.next()).done;)xe=xe.value,Me=Q+M(xe,ve++),Oe+=se(xe,W,te,Me,pe);else if(xe==="object")throw W=String(U),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.");return Oe}function H(U,W,te){if(U==null)return U;var Q=[],pe=0;return se(U,Q,"","",function(xe){return W.call(te,xe,pe++)}),Q}function J(U){if(U._status===-1){var W=U._result;W=W(),W.then(function(te){(U._status===0||U._status===-1)&&(U._status=1,U._result=te)},function(te){(U._status===0||U._status===-1)&&(U._status=2,U._result=te)}),U._status===-1&&(U._status=0,U._result=W)}if(U._status===1)return U._result.default;throw U._result}var le={current:null},K={transition:null},re={ReactCurrentDispatcher:le,ReactCurrentBatchConfig:K,ReactCurrentOwner:$};function ee(){throw Error("act(...) is not supported in production builds of React.")}return et.Children={map:H,forEach:function(U,W,te){H(U,function(){W.apply(this,arguments)},te)},count:function(U){var W=0;return H(U,function(){W++}),W},toArray:function(U){return H(U,function(W){return W})||[]},only:function(U){if(!O(U))throw Error("React.Children.only expected to receive a single React element child.");return U}},et.Component=w,et.Fragment=n,et.Profiler=s,et.PureComponent=C,et.StrictMode=r,et.Suspense=u,et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=re,et.act=ee,et.cloneElement=function(U,W,te){if(U==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+U+".");var Q=b({},U.props),pe=U.key,xe=U.ref,Oe=U._owner;if(W!=null){if(W.ref!==void 0&&(xe=W.ref,Oe=$.current),W.key!==void 0&&(pe=""+W.key),U.type&&U.type.defaultProps)var ve=U.type.defaultProps;for(Me in W)V.call(W,Me)&&!D.hasOwnProperty(Me)&&(Q[Me]=W[Me]===void 0&&ve!==void 0?ve[Me]:W[Me])}var Me=arguments.length-2;if(Me===1)Q.children=te;else if(1<Me){ve=Array(Me);for(var dt=0;dt<Me;dt++)ve[dt]=arguments[dt+2];Q.children=ve}return{$$typeof:t,type:U.type,key:pe,ref:xe,props:Q,_owner:Oe}},et.createContext=function(U){return U={$$typeof:a,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},U.Provider={$$typeof:i,_context:U},U.Consumer=U},et.createElement=I,et.createFactory=function(U){var W=I.bind(null,U);return W.type=U,W},et.createRef=function(){return{current:null}},et.forwardRef=function(U){return{$$typeof:c,render:U}},et.isValidElement=O,et.lazy=function(U){return{$$typeof:f,_payload:{_status:-1,_result:U},_init:J}},et.memo=function(U,W){return{$$typeof:d,type:U,compare:W===void 0?null:W}},et.startTransition=function(U){var W=K.transition;K.transition={};try{U()}finally{K.transition=W}},et.unstable_act=ee,et.useCallback=function(U,W){return le.current.useCallback(U,W)},et.useContext=function(U){return le.current.useContext(U)},et.useDebugValue=function(){},et.useDeferredValue=function(U){return le.current.useDeferredValue(U)},et.useEffect=function(U,W){return le.current.useEffect(U,W)},et.useId=function(){return le.current.useId()},et.useImperativeHandle=function(U,W,te){return le.current.useImperativeHandle(U,W,te)},et.useInsertionEffect=function(U,W){return le.current.useInsertionEffect(U,W)},et.useLayoutEffect=function(U,W){return le.current.useLayoutEffect(U,W)},et.useMemo=function(U,W){return le.current.useMemo(U,W)},et.useReducer=function(U,W,te){return le.current.useReducer(U,W,te)},et.useRef=function(U){return le.current.useRef(U)},et.useState=function(U){return le.current.useState(U)},et.useSyncExternalStore=function(U,W,te){return le.current.useSyncExternalStore(U,W,te)},et.useTransition=function(){return le.current.useTransition()},et.version="18.3.1",et}var TE;function Yv(){return TE||(TE=1,Dg.exports=AN()),Dg.exports}/**
11 * @license React
12 * react-jsx-runtime.production.min.js
13 *
14 * Copyright (c) Facebook, Inc. and its affiliates.
15 *
16 * This source code is licensed under the MIT license found in the
17 * LICENSE file in the root directory of this source tree.
18 */var CE;function TN(){if(CE)return Au;CE=1;var t=Yv(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(c,u,d){var f,g={},y=null,x=null;d!==void 0&&(y=""+d),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(x=u.ref);for(f in u)r.call(u,f)&&!i.hasOwnProperty(f)&&(g[f]=u[f]);if(c&&c.defaultProps)for(f in u=c.defaultProps,u)g[f]===void 0&&(g[f]=u[f]);return{$$typeof:e,type:c,key:y,ref:x,props:g,_owner:s.current}}return Au.Fragment=n,Au.jsx=a,Au.jsxs=a,Au}var SE;function CN(){return SE||(SE=1,Rg.exports=TN()),Rg.exports}var v=CN(),S=Yv();const Wn=xc(S),kS=CS({__proto__:null,default:Wn},[S]);var Xh={},Ng={exports:{}},Cr={},Og={exports:{}},Lg={};/**
19 * @license React
20 * scheduler.production.min.js
21 *
22 * Copyright (c) Facebook, Inc. and its affiliates.
23 *
24 * This source code is licensed under the MIT license found in the
25 * LICENSE file in the root directory of this source tree.
26 */var kE;function SN(){return kE||(kE=1,(function(t){function e(K,re){var ee=K.length;K.push(re);e:for(;0<ee;){var U=ee-1>>>1,W=K[U];if(0<s(W,re))K[U]=re,K[ee]=W,ee=U;else break e}}function n(K){return K.length===0?null:K[0]}function r(K){if(K.length===0)return null;var re=K[0],ee=K.pop();if(ee!==re){K[0]=ee;e:for(var U=0,W=K.length,te=W>>>1;U<te;){var Q=2*(U+1)-1,pe=K[Q],xe=Q+1,Oe=K[xe];if(0>s(pe,ee))xe<W&&0>s(Oe,pe)?(K[U]=Oe,K[xe]=ee,U=xe):(K[U]=pe,K[Q]=ee,U=Q);else if(xe<W&&0>s(Oe,ee))K[U]=Oe,K[xe]=ee,U=xe;else break e}}return re}function s(K,re){var ee=K.sortIndex-re.sortIndex;return ee!==0?ee:K.id-re.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,c=a.now();t.unstable_now=function(){return a.now()-c}}var u=[],d=[],f=1,g=null,y=3,x=!1,b=!1,E=!1,w=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(K){for(var re=n(d);re!==null;){if(re.callback===null)r(d);else if(re.startTime<=K)r(d),re.sortIndex=re.expirationTime,e(u,re);else break;re=n(d)}}function N(K){if(E=!1,k(K),!b)if(n(u)!==null)b=!0,J(V);else{var re=n(d);re!==null&&le(N,re.startTime-K)}}function V(K,re){b=!1,E&&(E=!1,R(I),I=-1),x=!0;var ee=y;try{for(k(re),g=n(u);g!==null&&(!(g.expirationTime>re)||K&&!F());){var U=g.callback;if(typeof U=="function"){g.callback=null,y=g.priorityLevel;var W=U(g.expirationTime<=re);re=t.unstable_now(),typeof W=="function"?g.callback=W:g===n(u)&&r(u),k(re)}else r(u);g=n(u)}if(g!==null)var te=!0;else{var Q=n(d);Q!==null&&le(N,Q.startTime-re),te=!1}return te}finally{g=null,y=ee,x=!1}}var $=!1,D=null,I=-1,B=5,O=-1;function F(){return!(t.unstable_now()-O<B)}function L(){if(D!==null){var K=t.unstable_now();O=K;var re=!0;try{re=D(!0,K)}finally{re?M():($=!1,D=null)}}else $=!1}var M;if(typeof C=="function")M=function(){C(L)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,H=se.port2;se.port1.onmessage=L,M=function(){H.postMessage(null)}}else M=function(){w(L,0)};function J(K){D=K,$||($=!0,M())}function le(K,re){I=w(function(){K(t.unstable_now())},re)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(K){K.callback=null},t.unstable_continueExecution=function(){b||x||(b=!0,J(V))},t.unstable_forceFrameRate=function(K){0>K||125<K||(B=0<K?Math.floor(1e3/K):5)},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_getFirstCallbackNode=function(){return n(u)},t.unstable_next=function(K){switch(y){case 1:case 2:case 3:var re=3;break;default:re=y}var ee=y;y=re;try{return K()}finally{y=ee}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(K,re){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var ee=y;y=K;try{return re()}finally{y=ee}},t.unstable_scheduleCallback=function(K,re,ee){var U=t.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?U+ee:U):ee=U,K){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=ee+W,K={id:f++,callback:re,priorityLevel:K,startTime:ee,expirationTime:W,sortIndex:-1},ee>U?(K.sortIndex=ee,e(d,K),n(u)===null&&K===n(d)&&(E?(R(I),I=-1):E=!0,le(N,ee-U))):(K.sortIndex=W,e(u,K),b||x||(b=!0,J(V))),K},t.unstable_shouldYield=F,t.unstable_wrapCallback=function(K){var re=y;return function(){var ee=y;y=re;try{return K.apply(this,arguments)}finally{y=ee}}}})(Lg)),Lg}var IE;function kN(){return IE||(IE=1,Og.exports=SN()),Og.exports}/**
27 * @license React
28 * react-dom.production.min.js
29 *
30 * Copyright (c) Facebook, Inc. and its affiliates.
31 *
32 * This source code is licensed under the MIT license found in the
33 * LICENSE file in the root directory of this source tree.
34 */var PE;function IN(){if(PE)return Cr;PE=1;var t=Yv(),e=kN();function n(o){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+o,h=1;h<arguments.length;h++)l+="&args[]="+encodeURIComponent(arguments[h]);return"Minified React error #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,s={};function i(o,l){a(o,l),a(o+"Capture",l)}function a(o,l){for(s[o]=l,o=0;o<l.length;o++)r.add(l[o])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},g={};function y(o){return u.call(g,o)?!0:u.call(f,o)?!1:d.test(o)?g[o]=!0:(f[o]=!0,!1)}function x(o,l,h,m){if(h!==null&&h.type===0)return!1;switch(typeof l){case"function":case"symbol":return!0;case"boolean":return m?!1:h!==null?!h.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function b(o,l,h,m){if(l===null||typeof l>"u"||x(o,l,h,m))return!0;
vendor: 36,009 bytes, lines 34-38
34if(m)return!1;if(h!==null)switch(h.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function E(o,l,h,m,_,A,j){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=m,this.attributeNamespace=_,this.mustUseProperty=h,this.propertyName=o,this.type=l,this.sanitizeURL=A,this.removeEmptyString=j}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){w[o]=new E(o,0,!1,o,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var l=o[0];w[l]=new E(l,1,!1,o[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(o){w[o]=new E(o,2,!1,o.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){w[o]=new E(o,2,!1,o,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(o){w[o]=new E(o,3,!1,o.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(o){w[o]=new E(o,3,!0,o,null,!1,!1)}),["capture","download"].forEach(function(o){w[o]=new E(o,4,!1,o,null,!1,!1)}),["cols","rows","size","span"].forEach(function(o){w[o]=new E(o,6,!1,o,null,!1,!1)}),["rowSpan","start"].forEach(function(o){w[o]=new E(o,5,!1,o.toLowerCase(),null,!1,!1)});var R=/[\-:]([a-z])/g;function C(o){return o[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(o){var l=o.replace(R,C);w[l]=new E(l,1,!1,o,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var l=o.replace(R,C);w[l]=new E(l,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(o){var l=o.replace(R,C);w[l]=new E(l,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(o){w[o]=new E(o,1,!1,o.toLowerCase(),null,!1,!1)}),w.xlinkHref=new E("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(o){w[o]=new E(o,1,!1,o.toLowerCase(),null,!0,!0)});function k(o,l,h,m){var _=w.hasOwnProperty(l)?w[l]:null;(_!==null?_.type!==0:m||!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(b(l,h,_,m)&&(h=null),m||_===null?y(l)&&(h===null?o.removeAttribute(l):o.setAttribute(l,""+h)):_.mustUseProperty?o[_.propertyName]=h===null?_.type===3?!1:"":h:(l=_.attributeName,m=_.attributeNamespace,h===null?o.removeAttribute(l):(_=_.type,h=_===3||_===4&&h===!0?"":""+h,m?o.setAttributeNS(m,l,h):o.setAttribute(l,h))))}var N=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,V=Symbol.for("react.element"),$=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),O=Symbol.for("react.provider"),F=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),se=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),le=Symbol.for("react.offscreen"),K=Symbol.iterator;function re(o){return o===null||typeof o!="object"?null:(o=K&&o[K]||o["@@iterator"],typeof o=="function"?o:null)}var ee=Object.assign,U;function W(o){if(U===void 0)try{throw Error()}catch(h){var l=h.stack.trim().match(/\n( *(at )?)/);U=l&&l[1]||""}return`
35`+U+o}var te=!1;function Q(o,l){if(!o||te)return"";te=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(ie){var m=ie}Reflect.construct(o,[],l)}else{try{l.call()}catch(ie){m=ie}o.call(l.prototype)}else{try{throw Error()}catch(ie){m=ie}o()}}catch(ie){if(ie&&m&&typeof ie.stack=="string"){for(var _=ie.stack.split(`
36`),A=m.stack.split(`
37`),j=_.length-1,q=A.length-1;1<=j&&0<=q&&_[j]!==A[q];)q--;for(;1<=j&&0<=q;j--,q--)if(_[j]!==A[q]){if(j!==1||q!==1)do if(j--,q--,0>q||_[j]!==A[q]){var G=`
38`+_[j].replace(" at new "," at ");return o.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",o.displayName)),G}while(1<=j&&0<=q);break}}}finally{te=!1,Error.prepareStackTrace=h}return(o=o?o.displayName||o.name:"")?W(o):""}function pe(o){switch(o.tag){case 5:return W(o.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return o=Q(o.type,!1),o;case 11:return o=Q(o.type.render,!1),o;case 1:return o=Q(o.type,!0),o;default:return""}}function xe(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case D:return"Fragment";case $:return"Portal";case B:return"Profiler";case I:return"StrictMode";case M:return"Suspense";case se:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case F:return(o.displayName||"Context")+".Consumer";case O:return(o._context.displayName||"Context")+".Provider";case L:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case H:return l=o.displayName||null,l!==null?l:xe(o.type)||"Memo";case J:l=o._payload,o=o._init;try{return xe(o(l))}catch{}}return null}function Oe(o){var l=o.type;switch(o.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=l.render,o=o.displayName||o.name||"",l.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xe(l);case 8:return l===I?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function ve(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Me(o){var l=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function dt(o){var l=Me(o)?"checked":"value",h=Object.getOwnPropertyDescriptor(o.constructor.prototype,l),m=""+o[l];if(!o.hasOwnProperty(l)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var _=h.get,A=h.set;return Object.defineProperty(o,l,{configurable:!0,get:function(){return _.call(this)},set:function(j){m=""+j,A.call(this,j)}}),Object.defineProperty(o,l,{enumerable:h.enumerable}),{getValue:function(){return m},setValue:function(j){m=""+j},stopTracking:function(){o._valueTracker=null,delete o[l]}}}}function ht(o){o._valueTracker||(o._valueTracker=dt(o))}function Nn(o){if(!o)return!1;var l=o._valueTracker;if(!l)return!0;var h=l.getValue(),m="";return o&&(m=Me(o)?o.checked?"true":"false":o.value),o=m,o!==h?(l.setValue(o),!0):!1}function St(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function $t(o,l){var h=l.checked;return ee({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:h??o._wrapperState.initialChecked})}function tn(o,l){var h=l.defaultValue==null?"":l.defaultValue,m=l.checked!=null?l.checked:l.defaultChecked;h=ve(l.value!=null?l.value:h),o._wrapperState={initialChecked:m,initialValue:h,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function yr(o,l){l=l.checked,l!=null&&k(o,"checked",l,!1)}function vr(o,l){yr(o,l);var h=ve(l.value),m=l.type;if(h!=null)m==="number"?(h===0&&o.value===""||o.value!=h)&&(o.value=""+h):o.value!==""+h&&(o.value=""+h);else if(m==="submit"||m==="reset"){o.removeAttribute("value");return}l.hasOwnProperty("value")?kt(o,l.type,h):l.hasOwnProperty("defaultValue")&&kt(o,l.type,ve(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(o.defaultChecked=!!l.defaultChecked)}function Dr(o,l,h){if(l.hasOwnProperty("value")||l.hasOwnProperty("defaultValue")){var m=l.type;if(!(m!=="submit"&&m!=="reset"||l.value!==void 0&&l.value!==null))return;l=""+o._wrapperState.initialValue,h||l===o.value||(o.value=l),o.defaultValue=l}h=o.name,h!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,h!==""&&(o.name=h)}function kt(o,l,h){(l!=="number"||St(o.ownerDocument)!==o)&&(h==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+h&&(o.defaultValue=""+h))}var vt=Array.isArray;function Nt(o,l,h,m){if(o=o.options,l){l={};for(var _=0;_<h.length;_++)l["$"+h[_]]=!0;for(h=0;h<o.length;h++)_=l.hasOwnProperty("$"+o[h].value),o[h].selected!==_&&(o[h].selected=_),_&&m&&(o[h].defaultSelected=!0)}else{for(h=""+ve(h),l=null,_=0;_<o.length;_++){if(o[_].value===h){o[_].selected=!0,m&&(o[_].defaultSelected=!0);return}l!==null||o[_].disabled||(l=o[_])}l!==null&&(l.selected=!0)}}function Yt(o,l){if(l.dangerouslySetInnerHTML!=null)throw Error(n(91));return ee({},l,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function An(o,l){var h=l.value;if(h==null){if(h=l.children,l=l.defaultValue,h!=null){if(l!=null)throw Error(n(92));if(vt(h)){if(1<h.length)throw Error(n(93));h=h[0]}l=h}l==null&&(l=""),h=l}o._wrapperState={initialValue:ve(h)}}function On(o,l){var h=ve(l.value),m=ve(l.defaultValue);h!=null&&(h=""+h,h!==o.value&&(o.value=h),l.defaultValue==null&&o.defaultValue!==h&&(o.defaultValue=h)),m!=null&&(o.defaultValue=""+m)}function mn(o){var l=o.textContent;l===o._wrapperState.initialValue&&l!==""&&l!==null&&(o.value=l)}function ur(o){switch(o){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function _r(o,l){return o==null||o==="http://www.w3.org/1999/xhtml"?ur(l):o==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":o}var es,hi=(function(o){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(l,h,m,_){MSApp.execUnsafeLocalFunction(function(){return o(l,h,m,_)})}:o})(function(o,l){if(o.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in o)o.innerHTML=l;else{for(es=es||document.createElement("div"),es.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=es.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;l.firstChild;)o.appendChild(l.firstChild)}});function Nr(o,l){if(l){var h=o.firstChild;if(h&&h===o.lastChild&&h.nodeType===3){h.nodeValue=l;return}}o.textContent=l}var Ln={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ts=["Webkit","ms","Moz","O"];Object.keys(Ln).forEach(function(o){ts.forEach(function(l){l=l+o.charAt(0).toUpperCase()+o.substring(1),Ln[l]=Ln[o]})});function Or(o,l,h){return l==null||typeof l=="boolean"||l===""?"":h||typeof l!="number"||l===0||Ln.hasOwnProperty(o)&&Ln[o]?(""+l).trim():l+"px"}function ge(o,l){o=o.style;for(var h in l)if(l.hasOwnProperty(h)){var m=h.indexOf("--")===0,_=Or(h,l[h],m);h==="float"&&(h="cssFloat"),m?o.setProperty(h,_):o[h]=_}}var ae=ee({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ne(o,l){if(l){if(ae[o]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(n(137,o));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(n(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(n(61))}if(l.style!=null&&typeof l.style!="object")throw Error(n(62))}}function Ee(o,l){if(o.indexOf("-")===-1)return typeof l.is=="string";switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ke=null;function Ve(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var We=null,wt=null,Xe=null;function It(o){if(o=cu(o)){if(typeof We!="function")throw Error(n(280));var l=o.stateNode;l&&(l=fh(l),We(o.stateNode,o.type,l))}}function bt(o){wt?Xe?Xe.push(o):Xe=[o]:wt=o}function tt(){if(wt){var o=wt,l=Xe;if(Xe=wt=null,It(o),l)for(o=0;o<l.length;o++)It(l[o])}}function xr(o,l){return o(l)}function Lr(){}var Fn=!1;function gn(o,l,h){if(Fn)return o(l,h);Fn=!0;try{return xr(o,l,h)}finally{Fn=!1,(wt!==null||Xe!==null)&&(Lr(),tt())}}function yn(o,l){var h=o.stateNode;if(h===null)return null;var m=fh(h);if(m===null)return null;h=m[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(o=o.type,m=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!m;break e;default:o=!1}if(o)return null;if(h&&typeof h!="function")throw Error(n(231,l,typeof h));return h}var jn=!1;if(c)try{var At={};Object.defineProperty(At,"passive",{get:function(){jn=!0}}),window.addEventListener("test",At,At),window.removeEventListener("test",At,At)}catch{jn=!1}function Yn(o,l,h,m,_,A,j,q,G){var ie=Array.prototype.slice.call(arguments,3);try{l.apply(h,ie)}catch(fe){this.onError(fe)}}var Tt=!1,gt=null,Tn=!1,dr=null,Ji={onError:function(o){Tt=!0,gt=o}};function Xi(o,l,h,m,_,A,j,q,G){Tt=!1,gt=null,Yn.apply(Ji,arguments)}function ms(o,l,h,m,_,A,j,q,G){if(Xi.apply(this,arguments),Tt){if(Tt){var ie=gt;Tt=!1,gt=null}else throw Error(n(198));Tn||(Tn=!0,dr=ie)}}function Qn(o){var l=o,h=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,(l.flags&4098)!==0&&(h=l.return),o=l.return;while(o)}return l.tag===3?h:null}function Qt(o){if(o.tag===13){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function vn(o){if(Qn(o)!==o)throw Error(n(188))}function gs(o){var l=o.alternate;if(!l){if(l=Qn(o),l===null)throw Error(n(188));return l!==o?null:o}for(var h=o,m=l;;){var _=h.return;if(_===null)break;var A=_.alternate;if(A===null){if(m=_.return,m!==null){h=m;continue}break}if(_.child===A.child){for(A=_.child;A;){if(A===h)return vn(_),o;if(A===m)return vn(_),l;A=A.sibling}throw Error(n(188))}if(h.return!==m.return)h=_,m=A;else{for(var j=!1,q=_.child;q;){if(q===h){j=!0,h=_,m=A;break}if(q===m){j=!0,m=_,h=A;break}q=q.sibling}if(!j){for(q=A.child;q;){if(q===h){j=!0,h=A,m=_;break}if(q===m){j=!0,m=A,h=_;break}q=q.sibling}if(!j)throw Error(n(189))}}if(h.alternate!==m)throw Error(n(190))}if(h.tag!==3)throw Error(n(188));return h.stateNode.current===h?o:l}function fi(o){return o=gs(o),o!==null?ys(o):null}function ys(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var l=ys(o);if(l!==null)return l;o=o.sibling}return null}var Bc=e.unstable_scheduleCallback,tl=e.unstable_cancelCallback,Jo=e.unstable_shouldYield,pi=e.unstable_requestPaint,Ot=e.unstable_now,c0=e.unstable_getCurrentPriorityLevel,nl=e.unstable_ImmediatePriority,Vc=e.unstable_UserBlockingPriority,Xo=e.unstable_NormalPriority,Uc=e.unstable_LowPriority,rl=e.unstable_IdlePriority,Zo=null,Fr=null;function Qd(o){if(Fr&&typeof Fr.onCommitFiberRoot=="function")try{Fr.onCommitFiberRoot(Zo,o,void 0,(o.current.flags&128)===128)}catch{}}var jr=Math.clz32?Math.clz32:ea,Ms=Math.log,ns=Math.LN2;function ea(o){return o>>>=0,o===0?32:31-(Ms(o)/ns|0)|0}var Bs=64,Zi=4194304;function pt(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function mi(o,l){var h=o.pendingLanes;if(h===0)return 0;var m=0,_=o.suspendedLanes,A=o.pingedLanes,j=h&268435455;if(j!==0){var q=j&~_;q!==0?m=pt(q):(A&=j,A!==0&&(m=pt(A)))}else j=h&~_,j!==0?m=pt(j):A!==0&&(m=pt(A));if(m===0)return 0;if(l!==0&&l!==m&&(l&_)===0&&(_=m&-m,A=l&-l,_>=A||_===16&&(A&4194240)!==0))return l;if((m&4)!==0&&(m|=h&16),l=o.entangledLanes,l!==0)for(o=o.entanglements,l&=m;0<l;)h=31-jr(l),_=1<<h,m|=o[h],l&=~_;return m}function ta(o,l){switch(o){case 1:case 2:case 4:return l+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function na(o,l){for(var h=o.suspendedLanes,m=o.pingedLanes,_=o.expirationTimes,A=o.pendingLanes;0<A;){var j=31-jr(A),q=1<<j,G=_[j];G===-1?((q&h)===0||(q&m)!==0)&&(_[j]=ta(q,l)):G<=l&&(o.expiredLanes|=q),A&=~q}}function $c(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function zc(){var o=Bs;return Bs<<=1,(Bs&4194240)===0&&(Bs=64),o}function Hc(o){for(var l=[],h=0;31>h;h++)l.push(o);return l}function ra(o,l,h){o.pendingLanes|=l,l!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,l=31-jr(l),o[l]=h}function u0(o,l){var h=o.pendingLanes&~l;o.pendingLanes=l,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=l,o.mutableReadLanes&=l,o.entangledLanes&=l,l=o.entanglements;var m=o.eventTimes;for(o=o.expirationTimes;0<h;){var _=31-jr(h),A=1<<_;l[_]=0,m[_]=-1,o[_]=-1,h&=~A}}function qc(o,l){var h=o.entangledLanes|=l;for(o=o.entanglements;h;){var m=31-jr(h),_=1<<m;_&l|o[m]&l&&(o[m]|=l),h&=~_}}var it=0;function Vs(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var Wc,sl,Gc,Kc,Yc,Us=!1,il=[],$s=null,zs=null,Mn=null,sa=new Map,gi=new Map,Mr=[],Jd="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function eo(o,l){switch(o){case"focusin":case"focusout":$s=null;break;case"dragenter":case"dragleave":zs=null;break;case"mouseover":case"mouseout":Mn=null;break;case"pointerover":case"pointerout":sa.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":gi.delete(l.pointerId)}}function vs(o,l,h,m,_,A){return o===null||o.nativeEvent!==A?(o={blockedOn:l,domEventName:h,eventSystemFlags:m,nativeEvent:A,targetContainers:[_]},l!==null&&(l=cu(l),l!==null&&sl(l)),o):(o.eventSystemFlags|=m,l=o.targetContainers,_!==null&&l.indexOf(_)===-1&&l.push(_),o)}function Xd(o,l,h,m,_){switch(l){case"focusin":return $s=vs($s,o,l,h,m,_),!0;case"dragenter":return zs=vs(zs,o,l,h,m,_),!0;case"mouseover":return Mn=vs(Mn,o,l,h,m,_),!0;case"pointerover":var A=_.pointerId;return sa.set(A,vs(sa.get(A)||null,o,l,h,m,_)),!0;case"gotpointercapture":return A=_.pointerId,gi.set(A,vs(gi.get(A)||null,o,l,h,m,_)),!0}return!1}function ol(o){var l=la(o.target);if(l!==null){var h=Qn(l);if(h!==null){if(l=h.tag,l===13){if(l=Qt(h),l!==null){o.blockedOn=l,Yc(o.priority,function(){Gc(h)});return}}else if(l===3&&h.stateNode.current.memoizedState.isDehydrated){o.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Ct(o){if(o.blockedOn!==null)return!1;for(var l=o.targetContainers;0<l.length;){var h=al(o.domEventName,o.eventSystemFlags,l[0],o.nativeEvent);if(h===null){h=o.nativeEvent;var m=new h.constructor(h.type,h);ke=m,h.target.dispatchEvent(m),ke=null}else return l=cu(h),l!==null&&sl(l),o.blockedOn=h,!1;l.shift()}return!0}function Zd(o,l,h){Ct(o)&&h.delete(l)}function d0(){Us=!1,$s!==null&&Ct($s)&&($s=null),zs!==null&&Ct(zs)&&(zs=null),Mn!==null&&Ct(Mn)&&(Mn=null),sa.forEach(Zd),gi.forEach(Zd)}function to(o,l){o.blockedOn===l&&(o.blockedOn=null,Us||(Us=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,d0)))}function no(o){function l(_){return to(_,o)}if(0<il.length){to(il[0],o);for(var h=1;h<il.length;h++){var m=il[h];m.blockedOn===o&&(m.blockedOn=null)}}for($s!==null&&to($s,o),zs!==null&&to(zs,o),Mn!==null&&to(Mn,o),sa.forEach(l),gi.forEach(l),h=0;h<Mr.length;h++)m=Mr[h],m.blockedOn===o&&(m.blockedOn=null);for(;0<Mr.length&&(h=Mr[0],h.blockedOn===null);)ol(h),h.blockedOn===null&&Mr.shift()}var yi=N.ReactCurrentBatchConfig,vi=!0;function Hs(o,l,h,m){var _=it,A=yi.transition;yi.transition=null;try{it=1,Qc(o,l,h,m)}finally{it=_,yi.transition=A}}function eh(o,l,h,m){var _=it,A=yi.transition;yi.transition=null;try{it=4,Qc(o,l,h,m)}finally{it=_,yi.transition=A}}function Qc(o,l,h,m){if(vi){var _=al(o,l,h,m);if(_===null)E0(o,l,m,qs,h),eo(o,m);else if(Xd(_,o,l,h,m))m.stopPropagation();else if(eo(o,m),l&4&&-1<Jd.indexOf(o)){for(;_!==null;){var A=cu(_);if(A!==null&&Wc(A),A=al(o,l,h,m),A===null&&E0(o,l,m,qs,h),A===_)break;_=A}_!==null&&m.stopPropagation()}else E0(o,l,m,null,h)}}var qs=null;function al(o,l,h,m){if(qs=null,o=Ve(m),o=la(o),o!==null)if(l=Qn(o),l===null)o=null;else if(h=l.tag,h===13){if(o=Qt(l),o!==null)return o;o=null}else if(h===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;o=null}else l!==o&&(o=null);return qs=o,null}function ll(o){switch(o){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(c0()){case nl:return 1;case Vc:return 4;case Xo:case Uc:return 16;case rl:return 536870912;default:return 16}default:return 16}}var Br=null,cl=null,_i=null;function th(){if(_i)return _i;var o,l=cl,h=l.length,m,_="value"in Br?Br.value:Br.textContent,A=_.length;for(o=0;o<h&&l[o]===_[o];o++);var j=h-o;for(m=1;m<=j&&l[h-m]===_[A-m];m++);return _i=_.slice(o,1<m?1-m:void 0)}function ia(o){var l=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&l===13&&(o=13)):o=l,o===10&&(o=13),32<=o||o===13?o:0}function Ws(){return!0}function Jc(){return!1}function Jn(o){function l(h,m,_,A,j){this._reactName=h,this._targetInst=_,this.type=m,this.nativeEvent=A,this.target=j,this.currentTarget=null;for(var q in o)o.hasOwnProperty(q)&&(h=o[q],this[q]=h?h(A):A[q]);return this.isDefaultPrevented=(A.defaultPrevented!=null?A.defaultPrevented:A.returnValue===!1)?Ws:Jc,this.isPropagationStopped=Jc,this}return ee(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=Ws)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=Ws)},persist:function(){},isPersistent:Ws}),l}var Gs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},oa=Jn(Gs),ro=ee({},Gs,{view:0,detail:0}),ul=Jn(ro),dl,hl,Vr,aa=ee({},ro,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ye,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Vr&&(Vr&&o.type==="mousemove"?(dl=o.screenX-Vr.screenX,hl=o.screenY-Vr.screenY):hl=dl=0,Vr=o),dl)},movementY:function(o){return"movementY"in o?o.movementY:hl}}),Xc=Jn(aa),nh=ee({},aa,{dataTransfer:0}),rh=Jn(nh),fl=ee({},ro,{relatedTarget:0}),Bn=Jn(fl),sh=ee({},Gs,{animationName:0,elapsedTime:0,pseudoElement:0}),ih=Jn(sh),so=ee({},Gs,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),p=Jn(so),T=ee({},Gs,{data:0}),P=Jn(T),z={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Z={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},oe={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _e(o){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(o):(o=oe[o])?!!l[o]:!1}function Ye(){return _e}var nn=ee({},ro,{key:function(o){if(o.key){var l=z[o.key]||o.key;if(l!=="Unidentified")return l}return o.type==="keypress"?(o=ia(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?Z[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ye,charCode:function(o){return o.type==="keypress"?ia(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?ia(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),_t=Jn(nn),ln=ee({},aa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ur=Jn(ln),xi=ee({},ro,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ye}),Ks=Jn(xi),Ys=ee({},Gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),pl=Jn(Ys),Zc=ee({},aa,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),v4=Jn(Zc),_4=[9,13,27,32],h0=c&&"CompositionEvent"in window,eu=null;c&&"documentMode"in document&&(eu=document.documentMode);var x4=c&&"TextEvent"in window&&!eu,gw=c&&(!h0||eu&&8<eu&&11>=eu),yw=" ",vw=!1;function _w(o,l){switch(o){case"keyup":return _4.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xw(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ml=!1;function w4(o,l){switch(o){case"compositionend":return xw(l);case"keypress":return l.which!==32?null:(vw=!0,yw);case"textInput":return o=l.data,o===yw&&vw?null:o;default:return null}}function E4(o,l){if(ml)return o==="compositionend"||!h0&&_w(o,l)?(o=th(),_i=cl=Br=null,ml=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return gw&&l.locale!=="ko"?null:l.data;default:return null}}var b4={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ww(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l==="input"?!!b4[o.type]:l==="textarea"}function Ew(o,l,h,m){bt(m),l=uh(l,"onChange"),0<l.length&&(h=new oa("onChange","change",null,h,m),o.push({event:h,listeners:l}))}var tu=null,nu=null;function A4(o){Vw(o,0)}function oh(o){var l=xl(o);if(Nn(l))return o}function T4(o,l){if(o==="change")return l}var bw=!1;if(c){var f0;if(c){var p0="oninput"in document;if(!p0){var Aw=document.createElement("div");Aw.setAttribute("oninput","return;"),p0=typeof Aw.oninput=="function"}f0=p0}else f0=!1;bw=f0&&(!document.documentMode||9<document.documentMode)}function Tw(){tu&&(tu.detachEvent("onpropertychange",Cw),nu=tu=null)}function Cw(o){if(o.propertyName==="value"&&oh(nu)){var l=[];Ew(l,nu,o,Ve(o)),gn(A4,l)}}function C4(o,l,h){o==="focusin"?(Tw(),tu=l,nu=h,tu.attachEvent("onpropertychange",Cw)):o==="focusout"&&Tw()}function S4(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return oh(nu)}function k4(o,l){if(o==="click")return oh(l)}function I4(o,l){if(o==="input"||o==="change")return oh(l)}function P4(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}var _s=typeof Object.is=="function"?Object.is:P4;function ru(o,l){if(_s(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var h=Object.keys(o),m=Object.keys(l);if(h.length!==m.length)return!1;for(m=0;m<h.length;m++){var _=h[m];if(!u.call(l,_)||!_s(o[_],l[_]))return!1}return!0}function Sw(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function kw(o,l){var h=Sw(o);o=0;for(var m;h;){if(h.nodeType===3){if(m=o+h.textContent.length,o<=l&&m>=l)return{node:h,offset:l-o};o=m}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=Sw(h)}}function Iw(o,l){return o&&l?o===l?!0:o&&o.nodeType===3?!1:l&&l.nodeType===3?Iw(o,l.parentNode):"contains"in o?o.contains(l):o.compareDocumentPosition?!!(o.compareDocumentPosition(l)&16):!1:!1}function Pw(){for(var o=window,l=St();l instanceof o.HTMLIFrameElement;){try{var h=typeof l.contentWindow.location.href=="string"}catch{h=!1}if(h)o=l.contentWindow;else break;l=St(o.document)}return l}function m0(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l&&(l==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||l==="textarea"||o.contentEditable==="true")}function R4(o){var l=Pw(),h=o.focusedElem,m=o.selectionRange;if(l!==h&&h&&h.ownerDocument&&Iw(h.ownerDocument.documentElement,h)){if(m!==null&&m0(h)){if(l=m.start,o=m.end,o===void 0&&(o=l),"selectionStart"in h)h.selectionStart=l,h.selectionEnd=Math.min(o,h.value.length);else if(o=(l=h.ownerDocument||document)&&l.defaultView||window,o.getSelection){o=o.getSelection();var _=h.textContent.length,A=Math.min(m.start,_);m=m.end===void 0?A:Math.min(m.end,_),!o.extend&&A>m&&(_=m,m=A,A=_),_=kw(h,A);var j=kw(h,m);_&&j&&(o.rangeCount!==1||o.anchorNode!==_.node||o.anchorOffset!==_.offset||o.focusNode!==j.node||o.focusOffset!==j.offset)&&(l=l.createRange(),l.setStart(_.node,_.offset),o.removeAllRanges(),A>m?(o.addRange(l),o.extend(j.node,j.offset)):(l.setEnd(j.node,j.offset),o.addRange(l)))}}for(l=[],o=h;o=o.parentNode;)o.nodeType===1&&l.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<l.length;h++)o=l[h],o.element.scrollLeft=o.left,o.element.scrollTop=o.top}}var D4=c&&"documentMode"in document&&11>=document.documentMode,gl=null,g0=null,su=null,y0=!1;function Rw(o,l,h){var m=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;y0||gl==null||gl!==St(m)||(m=gl,"selectionStart"in m&&m0(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),su&&ru(su,m)||(su=m,m=uh(g0,"onSelect"),0<m.length&&(l=new oa("onSelect","select",null,l,h),o.push({event:l,listeners:m}),l.target=gl)))}function ah(o,l){var h={};return h[o.toLowerCase()]=l.toLowerCase(),h["Webkit"+o]="webkit"+l,h["Moz"+o]="moz"+l,h}var yl={animationend:ah("Animation","AnimationEnd"),animationiteration:ah("Animation","AnimationIteration"),animationstart:ah("Animation","AnimationStart"),transitionend:ah("Transition","TransitionEnd")},v0={},Dw={};c&&(Dw=document.createElement("div").style,"AnimationEvent"in window||(delete yl.animationend.animation,delete yl.animationiteration.animation,delete yl.animationstart.animation),"TransitionEvent"in window||delete yl.transitionend.transition);function lh(o){if(v0[o])return v0[o];if(!yl[o])return o;var l=yl[o],h;for(h in l)if(l.hasOwnProperty(h)&&h in Dw)return v0[o]=l[h];return o}var Nw=lh("animationend"),Ow=lh("animationiteration"),Lw=lh("animationstart"),Fw=lh("transitionend"),jw=new Map,Mw="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function io(o,l){jw.set(o,l),i(l,[o])}for(var _0=0;_0<Mw.length;_0++){var x0=Mw[_0],N4=x0.toLowerCase(),O4=x0[0].toUpperCase()+x0.slice(1);io(N4,"on"+O4)}io(Nw,"onAnimationEnd"),io(Ow,"onAnimationIteration"),io(Lw,"onAnimationStart"),io("dblclick","onDoubleClick"),io("focusin","onFocus"),io("focusout","onBlur"),io(Fw,"onTransitionEnd"),a("onMouseEnter",["mouseout","mouseover"]),a("onMouseLeave",["mouseout","mouseover"]),a("onPointerEnter",["pointerout","pointerover"]),a("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focu
38sin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var iu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),L4=new Set("cancel close invalid load scroll toggle".split(" ").concat(iu));function Bw(o,l,h){var m=o.type||"unknown-event";o.currentTarget=h,ms(m,l,void 0,o),o.currentTarget=null}function Vw(o,l){l=(l&4)!==0;for(var h=0;h<o.length;h++){var m=o[h],_=m.event;m=m.listeners;e:{var A=void 0;if(l)for(var j=m.length-1;0<=j;j--){var q=m[j],G=q.instance,ie=q.currentTarget;if(q=q.listener,G!==A&&_.isPropagationStopped())break e;Bw(_,q,ie),A=G}else for(j=0;j<m.length;j++){if(q=m[j],G=q.instance,ie=q.currentTarget,q=q.listener,G!==A&&_.isPropagationStopped())break e;Bw(_,q,ie),A=G}}}if(Tn)throw o=dr,Tn=!1,dr=null,o}function Lt(o,l){var h=l[k0];h===void 0&&(h=l[k0]=new Set);var m=o+"__bubble";h.has(m)||(Uw(l,o,2,!1),h.add(m))}function w0(o,l,h){var m=0;l&&(m|=4),Uw(h,o,m,l)}var ch="_reactListening"+Math.random().toString(36).slice(2);function ou(o){if(!o[ch]){o[ch]=!0,r.forEach(function(h){h!=="selectionchange"&&(L4.has(h)||w0(h,!1,o),w0(h,!0,o))});var l=o.nodeType===9?o:o.ownerDocument;l===null||l[ch]||(l[ch]=!0,w0("selectionchange",!1,l))}}function Uw(o,l,h,m){switch(ll(l)){case 1:var _=Hs;break;case 4:_=eh;break;default:_=Qc}h=_.bind(null,l,h,o),_=void 0,!jn||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(_=!0),m?_!==void 0?o.addEventListener(l,h,{capture:!0,passive:_}):o.addEventListener(l,h,!0):_!==void 0?o.addEventListener(l,h,{passive:_}):o.addEventListener(l,h,!1)}function E0(o,l,h,m,_){var A=m;if((l&1)===0&&(l&2)===0&&m!==null)e:for(;;){if(m===null)return;var j=m.tag;if(j===3||j===4){var q=m.stateNode.containerInfo;if(q===_||q.nodeType===8&&q.parentNode===_)break;if(j===4)for(j=m.return;j!==null;){var G=j.tag;if((G===3||G===4)&&(G=j.stateNode.containerInfo,G===_||G.nodeType===8&&G.parentNode===_))return;j=j.return}for(;q!==null;){if(j=la(q),j===null)return;if(G=j.tag,G===5||G===6){m=A=j;continue e}q=q.parentNode}}m=m.return}gn(function(){var ie=A,fe=Ve(h),me=[];e:{var he=jw.get(o);if(he!==void 0){var Ae=oa,Ie=o;switch(o){case"keypress":if(ia(h)===0)break e;case"keydown":case"keyup":Ae=_t;break;case"focusin":Ie="focus",Ae=Bn;break;case"focusout":Ie="blur",Ae=Bn;break;case"beforeblur":case"afterblur":Ae=Bn;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ae=Xc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ae=rh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ae=Ks;break;case Nw:case Ow:case Lw:Ae=ih;break;case Fw:Ae=pl;break;case"scroll":Ae=ul;break;case"wheel":Ae=v4;break;case"copy":case"cut":case"paste":Ae=p;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ae=Ur}var Re=(l&4)!==0,rn=!Re&&o==="scroll",X=Re?he!==null?he+"Capture":null:he;Re=[];for(var Y=ie,ne;Y!==null;){ne=Y;var ye=ne.stateNode;if(ne.tag===5&&ye!==null&&(ne=ye,X!==null&&(ye=yn(Y,X),ye!=null&&Re.push(au(Y,ye,ne)))),rn)break;Y=Y.return}0<Re.length&&(he=new Ae(he,Ie,null,h,fe),me.push({event:he,listeners:Re}))}}if((l&7)===0){e:{if(he=o==="mouseover"||o==="pointerover",Ae=o==="mouseout"||o==="pointerout",he&&h!==ke&&(Ie=h.relatedTarget||h.fromElement)&&(la(Ie)||Ie[wi]))break e;if((Ae||he)&&(he=fe.window===fe?fe:(he=fe.ownerDocument)?he.defaultView||he.parentWindow:window,Ae?(Ie=h.relatedTarget||h.toElement,Ae=ie,Ie=Ie?la(Ie):null,Ie!==null&&(rn=Qn(Ie),Ie!==rn||Ie.tag!==5&&Ie.tag!==6)&&(Ie=null)):(Ae=null,Ie=ie),Ae!==Ie)){if(Re=Xc,ye="onMouseLeave",X="onMouseEnter",Y="mouse",(o==="pointerout"||o==="pointerover")&&(Re=Ur,ye="onPointerLeave",X="onPointerEnter",Y="pointer"),rn=Ae==null?he:xl(Ae),ne=Ie==null?he:xl(Ie),he=new Re(ye,Y+"leave",Ae,h,fe),he.target=rn,he.relatedTarget=ne,ye=null,la(fe)===ie&&(Re=new Re(X,Y+"enter",Ie,h,fe),Re.target=ne,Re.relatedTarget=rn,ye=Re),rn=ye,Ae&&Ie)t:{for(Re=Ae,X=Ie,Y=0,ne=Re;ne;ne=vl(ne))Y++;for(ne=0,ye=X;ye;ye=vl(ye))ne++;for(;0<Y-ne;
vendor: 6,508 bytes, lines 38-39
38)Re=vl(Re),Y--;for(;0<ne-Y;)X=vl(X),ne--;for(;Y--;){if(Re===X||X!==null&&Re===X.alternate)break t;Re=vl(Re),X=vl(X)}Re=null}else Re=null;Ae!==null&&$w(me,he,Ae,Re,!1),Ie!==null&&rn!==null&&$w(me,rn,Ie,Re,!0)}}e:{if(he=ie?xl(ie):window,Ae=he.nodeName&&he.nodeName.toLowerCase(),Ae==="select"||Ae==="input"&&he.type==="file")var De=T4;else if(ww(he))if(bw)De=I4;else{De=S4;var Fe=C4}else(Ae=he.nodeName)&&Ae.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(De=k4);if(De&&(De=De(o,ie))){Ew(me,De,h,fe);break e}Fe&&Fe(o,he,ie),o==="focusout"&&(Fe=he._wrapperState)&&Fe.controlled&&he.type==="number"&&kt(he,"number",he.value)}switch(Fe=ie?xl(ie):window,o){case"focusin":(ww(Fe)||Fe.contentEditable==="true")&&(gl=Fe,g0=ie,su=null);break;case"focusout":su=g0=gl=null;break;case"mousedown":y0=!0;break;case"contextmenu":case"mouseup":case"dragend":y0=!1,Rw(me,h,fe);break;case"selectionchange":if(D4)break;case"keydown":case"keyup":Rw(me,h,fe)}var je;if(h0)e:{switch(o){case"compositionstart":var He="onCompositionStart";break e;case"compositionend":He="onCompositionEnd";break e;case"compositionupdate":He="onCompositionUpdate";break e}He=void 0}else ml?_w(o,h)&&(He="onCompositionEnd"):o==="keydown"&&h.keyCode===229&&(He="onCompositionStart");He&&(gw&&h.locale!=="ko"&&(ml||He!=="onCompositionStart"?He==="onCompositionEnd"&&ml&&(je=th()):(Br=fe,cl="value"in Br?Br.value:Br.textContent,ml=!0)),Fe=uh(ie,He),0<Fe.length&&(He=new P(He,o,null,h,fe),me.push({event:He,listeners:Fe}),je?He.data=je:(je=xw(h),je!==null&&(He.data=je)))),(je=x4?w4(o,h):E4(o,h))&&(ie=uh(ie,"onBeforeInput"),0<ie.length&&(fe=new P("onBeforeInput","beforeinput",null,h,fe),me.push({event:fe,listeners:ie}),fe.data=je))}Vw(me,l)})}function au(o,l,h){return{instance:o,listener:l,currentTarget:h}}function uh(o,l){for(var h=l+"Capture",m=[];o!==null;){var _=o,A=_.stateNode;_.tag===5&&A!==null&&(_=A,A=yn(o,h),A!=null&&m.unshift(au(o,A,_)),A=yn(o,l),A!=null&&m.push(au(o,A,_))),o=o.return}return m}function vl(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function $w(o,l,h,m,_){for(var A=l._reactName,j=[];h!==null&&h!==m;){var q=h,G=q.alternate,ie=q.stateNode;if(G!==null&&G===m)break;q.tag===5&&ie!==null&&(q=ie,_?(G=yn(h,A),G!=null&&j.unshift(au(h,G,q))):_||(G=yn(h,A),G!=null&&j.push(au(h,G,q)))),h=h.return}j.length!==0&&o.push({event:l,listeners:j})}var F4=/\r\n?/g,j4=/\u0000|\uFFFD/g;function zw(o){return(typeof o=="string"?o:""+o).replace(F4,`
39`).replace(j4,"")}function dh(o,l,h){if(l=zw(l),zw(o)!==l&&h)throw Error(n(425))}function hh(){}var b0=null,A0=null;function T0(o,l){return o==="textarea"||o==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var C0=typeof setTimeout=="function"?setTimeout:void 0,M4=typeof clearTimeout=="function"?clearTimeout:void 0,Hw=typeof Promise=="function"?Promise:void 0,B4=typeof queueMicrotask=="function"?queueMicrotask:typeof Hw<"u"?function(o){return Hw.resolve(null).then(o).catch(V4)}:C0;function V4(o){setTimeout(function(){throw o})}function S0(o,l){var h=l,m=0;do{var _=h.nextSibling;if(o.removeChild(h),_&&_.nodeType===8)if(h=_.data,h==="/$"){if(m===0){o.removeChild(_),no(l);return}m--}else h!=="$"&&h!=="$?"&&h!=="$!"||m++;h=_}while(h);no(l)}function oo(o){for(;o!=null;o=o.nextSibling){var l=o.nodeType;if(l===1||l===3)break;if(l===8){if(l=o.data,l==="$"||l==="$!"||l==="$?")break;if(l==="/$")return null}}return o}function qw(o){o=o.previousSibling;for(var l=0;o;){if(o.nodeType===8){var h=o.data;if(h==="$"||h==="$!"||h==="$?"){if(l===0)return o;l--}else h==="/$"&&l++}o=o.previousSibling}return null}var _l=Math.random().toString(36).slice(2),Qs="__reactFiber$"+_l,lu="__reactProps$"+_l,wi="__reactContainer$"+_l,k0="__reactEvents$"+_l,U4="__reactListeners$"+_l,$4="__reactHandles$"+_l;function la(o){var l=o[Qs];if(l)return l;for(var h=o.parentNode;h;){if(l=h[wi]||h[Qs]){if(h=l.alternate,l.child!==null||h!==null&&h.child!==null)for(o=qw(o);o!==null;){if(h=o[Qs])return h;o=qw(o)}return l}o=h,h=o.parentNode}return null}function cu(o){return o=o[Qs]||o[wi],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function xl(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(n(33))}function fh(o){return o[lu]||null}var I0=[],wl=-1;function ao(o){return{current:o}}function Ft(o){0>wl||(o.current=I0[wl],I0[wl]=null,wl--)}function Pt(o,l){wl++,I0[wl]=o.current,o.current=l}var lo={},Xn=ao(lo),wr=ao(!1),ca=lo;function El(o,l){var h=o.type.contextTypes;if(!h)return lo;var m=o.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===l)return m.__reactInternalMemoizedMaskedChildContext;var _={},A;for(A in h)_[A]=l[A];return m&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=l,o.__reactInternalMemoizedMaskedChildContext=_),_}function Er(o){return o=o.childContextTypes,o!=null}function ph(){Ft(wr),Ft(Xn)}function Ww(o,l,h){if(Xn.current!==lo)throw Error(n(168));Pt(Xn,l),Pt(wr,h)}function Gw(o,l,h){var m=o.stateNode;if(l=l.childContextTypes,typeof m.getChildContext!="function")return h;m=m.getChildContext();for(var _ in m)if(!(_ in l))throw Error(n(108,Oe(o)||"Unknown",_));return ee({},h,m)}function mh(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||lo,ca=Xn.current,Pt(Xn,o),Pt(wr,wr.current),!0}function Kw(o,l,h){var m=o.stateNode;if(!m)throw Error(n(169));h?(o=Gw(o,l,ca),m.__reactInternalMemoizedMergedChildContext=o,Ft(wr),Ft(Xn),Pt(Xn,o)):Ft(wr),Pt(wr,h)}var Ei=null,gh=!1,P0=!1;function Yw(o){Ei===null?Ei=[o]:Ei.push(o)}function z4(o){gh=!0,Yw(o)}function co(){if(!P0&&Ei!==null){P0=!0;var o=0,l=it;try{var h=Ei;for(it=1;o<h.length;o++){var m=h[o];do m=m(!0);while(m!==null)}Ei=null,gh=!1}catch(_){throw Ei!==null&&(Ei=Ei.slice(o+1)),Bc(nl,co),_}finally{it=l,P0=!1}}return null}var bl=[],Al=0,yh=null,vh=0,rs=[],ss=0,ua=null,bi=1,Ai="";function da(o,l){bl[Al++]=vh,bl[Al++]=yh,yh=o,vh=l}function Qw(o,l,h){rs[ss++]=bi,rs[ss++]=Ai,rs[ss++]=ua,ua=o;var m=bi;o=Ai;var _=32-jr(m)-1;m&=~(1<<_),h+=1;var A=32-jr(l)+_;if(30<A){var j=_-_%5;A=(m&(1<<j)-1).toString(32),m>>=j,_-=j,bi=1<<32-jr(l)+_|h<<_|m,Ai=A+o}else bi=1<<A|h<<_|m,Ai=o}function R0(o){o.return!==null&&(da(o,1),Qw(o,1,0))}function D0(o){for(;o===yh;)yh=bl[--Al],bl[Al]=null,vh=bl[--Al],bl[Al]=null;for(;o===ua;)ua=rs[--ss],rs[ss]=null,Ai=rs[--ss],rs[ss]=null,bi=rs[--ss],rs[ss]=null}var $r=null,zr=null,zt=!1,xs=null;function Jw(o,l){var h=ls(5,null,null,0);
vendor: 4,296 bytes, line 39
39h.elementType="DELETED",h.stateNode=l,h.return=o,l=o.deletions,l===null?(o.deletions=[h],o.flags|=16):l.push(h)}function Xw(o,l){switch(o.tag){case 5:var h=o.type;return l=l.nodeType!==1||h.toLowerCase()!==l.nodeName.toLowerCase()?null:l,l!==null?(o.stateNode=l,$r=o,zr=oo(l.firstChild),!0):!1;case 6:return l=o.pendingProps===""||l.nodeType!==3?null:l,l!==null?(o.stateNode=l,$r=o,zr=null,!0):!1;case 13:return l=l.nodeType!==8?null:l,l!==null?(h=ua!==null?{id:bi,overflow:Ai}:null,o.memoizedState={dehydrated:l,treeContext:h,retryLane:1073741824},h=ls(18,null,null,0),h.stateNode=l,h.return=o,o.child=h,$r=o,zr=null,!0):!1;default:return!1}}function N0(o){return(o.mode&1)!==0&&(o.flags&128)===0}function O0(o){if(zt){var l=zr;if(l){var h=l;if(!Xw(o,l)){if(N0(o))throw Error(n(418));l=oo(h.nextSibling);var m=$r;l&&Xw(o,l)?Jw(m,h):(o.flags=o.flags&-4097|2,zt=!1,$r=o)}}else{if(N0(o))throw Error(n(418));o.flags=o.flags&-4097|2,zt=!1,$r=o}}}function Zw(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;$r=o}function _h(o){if(o!==$r)return!1;if(!zt)return Zw(o),zt=!0,!1;var l;if((l=o.tag!==3)&&!(l=o.tag!==5)&&(l=o.type,l=l!=="head"&&l!=="body"&&!T0(o.type,o.memoizedProps)),l&&(l=zr)){if(N0(o))throw e1(),Error(n(418));for(;l;)Jw(o,l),l=oo(l.nextSibling)}if(Zw(o),o.tag===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));e:{for(o=o.nextSibling,l=0;o;){if(o.nodeType===8){var h=o.data;if(h==="/$"){if(l===0){zr=oo(o.nextSibling);break e}l--}else h!=="$"&&h!=="$!"&&h!=="$?"||l++}o=o.nextSibling}zr=null}}else zr=$r?oo(o.stateNode.nextSibling):null;return!0}function e1(){for(var o=zr;o;)o=oo(o.nextSibling)}function Tl(){zr=$r=null,zt=!1}function L0(o){xs===null?xs=[o]:xs.push(o)}var H4=N.ReactCurrentBatchConfig;function uu(o,l,h){if(o=h.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(h._owner){if(h=h._owner,h){if(h.tag!==1)throw Error(n(309));var m=h.stateNode}if(!m)throw Error(n(147,o));var _=m,A=""+o;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===A?l.ref:(l=function(j){var q=_.refs;j===null?delete q[A]:q[A]=j},l._stringRef=A,l)}if(typeof o!="string")throw Error(n(284));if(!h._owner)throw Error(n(290,o))}return o}function xh(o,l){throw o=Object.prototype.toString.call(l),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o))}function t1(o){var l=o._init;return l(o._payload)}function n1(o){function l(X,Y){if(o){var ne=X.deletions;ne===null?(X.deletions=[Y],X.flags|=16):ne.push(Y)}}function h(X,Y){if(!o)return null;for(;Y!==null;)l(X,Y),Y=Y.sibling;return null}function m(X,Y){for(X=new Map;Y!==null;)Y.key!==null?X.set(Y.key,Y):X.set(Y.index,Y),Y=Y.sibling;return X}function _(X,Y){return X=vo(X,Y),X.index=0,X.sibling=null,X}function A(X,Y,ne){return X.index=ne,o?(ne=X.alternate,ne!==null?(ne=ne.index,ne<Y?(X.flags|=2,Y):ne):(X.flags|=2,Y)):(X.flags|=1048576,Y)}function j(X){return o&&X.alternate===null&&(X.flags|=2),X}function q(X,Y,ne,ye){return Y===null||Y.tag!==6?(Y=Tg(ne,X.mode,ye),Y.return=X,Y):(Y=_(Y,ne),Y.return=X,Y)}function G(X,Y,ne,ye){var De=ne.type;return De===D?fe(X,Y,ne.props.children,ye,ne.key):Y!==null&&(Y.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===J&&t1(De)===Y.type)?(ye=_(Y,ne.props),ye.ref=uu(X,Y,ne),ye.return=X,ye):(ye=Hh(ne.type,ne.key,ne.props,null,X.mode,ye),ye.ref=uu(X,Y,ne),ye.return=X,ye)}function ie(X,Y,ne,ye){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==ne.containerInfo||Y.stateNode.implementation!==ne.implementation?(Y=Cg(ne,X.mode,ye),Y.return=X,Y):(Y=_(Y,ne.children||[]),Y.return=X,Y)}function fe(X,Y,ne,ye,De){return Y===null||Y.tag!==7?(Y=_a(ne,X.mode,ye,De),Y.return=X,Y):(Y=_(Y,ne),Y.return=X,Y)}function me(X,Y,ne){if(typeof Y=="string"&&Y!==""||typeof Y=="number")return Y=Tg(""+Y,X.mode,ne),Y.return=X,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case V:return ne=Hh(Y.type,Y.key,Y.props,null,X.mode,ne),ne.ref=uu(X,null,Y),ne.return=X,ne;case $:return Y=Cg(Y,X.mode,ne),Y.return=X,Y;case J:var ye=Y._init;return me(X,ye(Y._payload),ne)}if(vt(Y)||re(Y))return Y=_a(Y,X.mode,ne,null),Y.return=X,Y;xh(X,Y)}return null}function he(X,Y,ne,ye){var De=Y!==null?Y.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number")return De!==null?null:q(X,Y,""+ne,ye);
vendor: 76,808 bytes, lines 39-41
39if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case V:return ne.key===De?G(X,Y,ne,ye):null;case $:return ne.key===De?ie(X,Y,ne,ye):null;case J:return De=ne._init,he(X,Y,De(ne._payload),ye)}if(vt(ne)||re(ne))return De!==null?null:fe(X,Y,ne,ye,null);xh(X,ne)}return null}function Ae(X,Y,ne,ye,De){if(typeof ye=="string"&&ye!==""||typeof ye=="number")return X=X.get(ne)||null,q(Y,X,""+ye,De);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case V:return X=X.get(ye.key===null?ne:ye.key)||null,G(Y,X,ye,De);case $:return X=X.get(ye.key===null?ne:ye.key)||null,ie(Y,X,ye,De);case J:var Fe=ye._init;return Ae(X,Y,ne,Fe(ye._payload),De)}if(vt(ye)||re(ye))return X=X.get(ne)||null,fe(Y,X,ye,De,null);xh(Y,ye)}return null}function Ie(X,Y,ne,ye){for(var De=null,Fe=null,je=Y,He=Y=0,kn=null;je!==null&&He<ne.length;He++){je.index>He?(kn=je,je=null):kn=je.sibling;var ft=he(X,je,ne[He],ye);if(ft===null){je===null&&(je=kn);break}o&&je&&ft.alternate===null&&l(X,je),Y=A(ft,Y,He),Fe===null?De=ft:Fe.sibling=ft,Fe=ft,je=kn}if(He===ne.length)return h(X,je),zt&&da(X,He),De;if(je===null){for(;He<ne.length;He++)je=me(X,ne[He],ye),je!==null&&(Y=A(je,Y,He),Fe===null?De=je:Fe.sibling=je,Fe=je);return zt&&da(X,He),De}for(je=m(X,je);He<ne.length;He++)kn=Ae(je,X,He,ne[He],ye),kn!==null&&(o&&kn.alternate!==null&&je.delete(kn.key===null?He:kn.key),Y=A(kn,Y,He),Fe===null?De=kn:Fe.sibling=kn,Fe=kn);return o&&je.forEach(function(_o){return l(X,_o)}),zt&&da(X,He),De}function Re(X,Y,ne,ye){var De=re(ne);if(typeof De!="function")throw Error(n(150));if(ne=De.call(ne),ne==null)throw Error(n(151));for(var Fe=De=null,je=Y,He=Y=0,kn=null,ft=ne.next();je!==null&&!ft.done;He++,ft=ne.next()){je.index>He?(kn=je,je=null):kn=je.sibling;var _o=he(X,je,ft.value,ye);if(_o===null){je===null&&(je=kn);break}o&&je&&_o.alternate===null&&l(X,je),Y=A(_o,Y,He),Fe===null?De=_o:Fe.sibling=_o,Fe=_o,je=kn}if(ft.done)return h(X,je),zt&&da(X,He),De;if(je===null){for(;!ft.done;He++,ft=ne.next())ft=me(X,ft.value,ye),ft!==null&&(Y=A(ft,Y,He),Fe===null?De=ft:Fe.sibling=ft,Fe=ft);return zt&&da(X,He),De}for(je=m(X,je);!ft.done;He++,ft=ne.next())ft=Ae(je,X,He,ft.value,ye),ft!==null&&(o&&ft.alternate!==null&&je.delete(ft.key===null?He:ft.key),Y=A(ft,Y,He),Fe===null?De=ft:Fe.sibling=ft,Fe=ft);return o&&je.forEach(function(bN){return l(X,bN)}),zt&&da(X,He),De}function rn(X,Y,ne,ye){if(typeof ne=="object"&&ne!==null&&ne.type===D&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case V:e:{for(var De=ne.key,Fe=Y;Fe!==null;){if(Fe.key===De){if(De=ne.type,De===D){if(Fe.tag===7){h(X,Fe.sibling),Y=_(Fe,ne.props.children),Y.return=X,X=Y;break e}}else if(Fe.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===J&&t1(De)===Fe.type){h(X,Fe.sibling),Y=_(Fe,ne.props),Y.ref=uu(X,Fe,ne),Y.return=X,X=Y;break e}h(X,Fe);break}else l(X,Fe);Fe=Fe.sibling}ne.type===D?(Y=_a(ne.props.children,X.mode,ye,ne.key),Y.return=X,X=Y):(ye=Hh(ne.type,ne.key,ne.props,null,X.mode,ye),ye.ref=uu(X,Y,ne),ye.return=X,X=ye)}return j(X);case $:e:{for(Fe=ne.key;Y!==null;){if(Y.key===Fe)if(Y.tag===4&&Y.stateNode.containerInfo===ne.containerInfo&&Y.stateNode.implementation===ne.implementation){h(X,Y.sibling),Y=_(Y,ne.children||[]),Y.return=X,X=Y;break e}else{h(X,Y);break}else l(X,Y);Y=Y.sibling}Y=Cg(ne,X.mode,ye),Y.return=X,X=Y}return j(X);case J:return Fe=ne._init,rn(X,Y,Fe(ne._payload),ye)}if(vt(ne))return Ie(X,Y,ne,ye);if(re(ne))return Re(X,Y,ne,ye);xh(X,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"?(ne=""+ne,Y!==null&&Y.tag===6?(h(X,Y.sibling),Y=_(Y,ne),Y.return=X,X=Y):(h(X,Y),Y=Tg(ne,X.mode,ye),Y.return=X,X=Y),j(X)):h(X,Y)}return rn}var Cl=n1(!0),r1=n1(!1),wh=ao(null),Eh=null,Sl=null,F0=null;function j0(){F0=Sl=Eh=null}function M0(o){var l=wh.current;Ft(wh),o._currentValue=l}function B0(o,l,h){for(;o!==null;){var m=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,m!==null&&(m.childLanes|=l)):m!==null&&(m.childLanes&l)!==l&&(m.childLanes|=l),o===h)break;o=o.return}}function kl(o,l){Eh=o,F0=Sl=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&l)!==0&&(br=!0),o.firstContext=null)}function is(o){var l=o._currentValue;if(F0!==o)if(o={context:o,memoizedValue:l,next:null},Sl===null){if(Eh===null)throw Error(n(308));Sl=o,Eh.dependencies={lanes:0,firstContext:o}}else Sl=Sl.next=o;return l}var ha=null;function V0(o){ha===null?ha=[o]:ha.push(o)}function s1(o,l,h,m){var _=l.interleaved;return _===null?(h.next=h,V0(l)):(h.next=_.next,_.next=h),l.interleaved=h,Ti(o,m)}function Ti(o,l){o.lanes|=l;var h=o.alternate;for(h!==null&&(h.lanes|=l),h=o,o=o.return;o!==null;)o.childLanes|=l,h=o.alternate,h!==null&&(h.childLanes|=l),h=o,o=o.return;return h.tag===3?h.stateNode:null}var uo=!1;function U0(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function i1(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function Ci(o,l){return{eventTime:o,lane:l,tag:0,payload:null,callback:null,next:null}}function ho(o,l,h){var m=o.updateQueue;if(m===null)return null;if(m=m.shared,(ct&2)!==0){var _=m.pending;return _===null?l.next=l:(l.next=_.next,_.next=l),m.pending=l,Ti(o,h)}return _=m.interleaved,_===null?(l.next=l,V0(m)):(l.next=_.next,_.next=l),m.interleaved=l,Ti(o,h)}function bh(o,l,h){if(l=l.updateQueue,l!==null&&(l=l.shared,(h&4194240)!==0)){var m=l.lanes;m&=o.pendingLanes,h|=m,l.lanes=h,qc(o,h)}}function o1(o,l){var h=o.updateQueue,m=o.alternate;if(m!==null&&(m=m.updateQueue,h===m)){var _=null,A=null;if(h=h.firstBaseUpdate,h!==null){do{var j={eventTime:h.eventTime,lane:h.lane,tag:h.tag,payload:h.payload,callback:h.callback,next:null};A===null?_=A=j:A=A.next=j,h=h.next}while(h!==null);A===null?_=A=l:A=A.next=l}else _=A=l;h={baseState:m.baseState,firstBaseUpdate:_,lastBaseUpdate:A,shared:m.shared,effects:m.effects},o.updateQueue=h;return}o=h.lastBaseUpdate,o===null?h.firstBaseUpdate=l:o.next=l,h.lastBaseUpdate=l}function Ah(o,l,h,m){var _=o.updateQueue;uo=!1;var A=_.firstBaseUpdate,j=_.lastBaseUpdate,q=_.shared.pending;if(q!==null){_.shared.pending=null;var G=q,ie=G.next;G.next=null,j===null?A=ie:j.next=ie,j=G;var fe=o.alternate;fe!==null&&(fe=fe.updateQueue,q=fe.lastBaseUpdate,q!==j&&(q===null?fe.firstBaseUpdate=ie:q.next=ie,fe.lastBaseUpdate=G))}if(A!==null){var me=_.baseState;j=0,fe=ie=G=null,q=A;do{var he=q.lane,Ae=q.eventTime;if((m&he)===he){fe!==null&&(fe=fe.next={eventTime:Ae,lane:0,tag:q.tag,payload:q.payload,callback:q.callback,next:null});e:{var Ie=o,Re=q;switch(he=l,Ae=h,Re.tag){case 1:if(Ie=Re.payload,typeof Ie=="function"){me=Ie.call(Ae,me,he);break e}me=Ie;break e;case 3:Ie.flags=Ie.flags&-65537|128;case 0:if(Ie=Re.payload,he=typeof Ie=="function"?Ie.call(Ae,me,he):Ie,he==null)break e;me=ee({},me,he);break e;case 2:uo=!0}}q.callback!==null&&q.lane!==0&&(o.flags|=64,he=_.effects,he===null?_.effects=[q]:he.push(q))}else Ae={eventTime:Ae,lane:he,tag:q.tag,payload:q.payload,callback:q.callback,next:null},fe===null?(ie=fe=Ae,G=me):fe=fe.next=Ae,j|=he;if(q=q.next,q===null){if(q=_.shared.pending,q===null)break;he=q,q=he.next,he.next=null,_.lastBaseUpdate=he,_.shared.pending=null}}while(!0);if(fe===null&&(G=me),_.baseState=G,_.firstBaseUpdate=ie,_.lastBaseUpdate=fe,l=_.shared.interleaved,l!==null){_=l;do j|=_.lane,_=_.next;while(_!==l)}else A===null&&(_.shared.lanes=0);ma|=j,o.lanes=j,o.memoizedState=me}}function a1(o,l,h){if(o=l.effects,l.effects=null,o!==null)for(l=0;l<o.length;l++){var m=o[l],_=m.callback;if(_!==null){if(m.callback=null,m=h,typeof _!="function")throw Error(n(191,_));_.call(m)}}}var du={},Js=ao(du),hu=ao(du),fu=ao(du);function fa(o){if(o===du)throw Error(n(174));return o}function $0(o,l){switch(Pt(fu,l),Pt(hu,o),Pt(Js,du),o=l.nodeType,o){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:_r(null,"");break;default:o=o===8?l.parentNode:l,l=o.namespaceURI||null,o=o.tagName,l=_r(l,o)}Ft(Js),Pt(Js,l)}function Il(){Ft(Js),Ft(hu),Ft(fu)}function l1(o){fa(fu.current);var l=fa(Js.current),h=_r(l,o.type);l!==h&&(Pt(hu,o),Pt(Js,h))}function z0(o){hu.current===o&&(Ft(Js),Ft(hu))}var qt=ao(0);function Th(o){for(var l=o;l!==null;){if(l.tag===13){var h=l.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||h.data==="$?"||h.data==="$!"))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var H0=[];function q0(){for(var o=0;o<H0.length;o++)H0[o]._workInProgressVersionPrimary=null;H0.length=0}var Ch=N.ReactCurrentDispatcher,W0=N.ReactCurrentBatchConfig,pa=0,Wt=null,_n=null,Cn=null,Sh=!1,pu=!1,mu=0,q4=0;function Zn(){throw Error(n(321))}function G0(o,l){if(l===null)return!1;for(var h=0;h<l.length&&h<o.length;h++)if(!_s(o[h],l[h]))return!1;return!0}function K0(o,l,h,m,_,A){if(pa=A,Wt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,Ch.current=o===null||o.memoizedState===null?Y4:Q4,o=h(m,_),pu){A=0;do{if(pu=!1,mu=0,25<=A)throw Error(n(301));A+=1,Cn=_n=null,l.updateQueue=null,Ch.current=J4,o=h(m,_)}while(pu)}if(Ch.current=Ph,l=_n!==null&&_n.next!==null,pa=0,Cn=_n=Wt=null,Sh=!1,l)throw Error(n(300));return o}function Y0(){var o=mu!==0;return mu=0,o}function Xs(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Cn===null?Wt.memoizedState=Cn=o:Cn=Cn.next=o,Cn}function os(){if(_n===null){var o=Wt.alternate;o=o!==null?o.memoizedState:null}else o=_n.next;var l=Cn===null?Wt.memoizedState:Cn.next;if(l!==null)Cn=l,_n=o;else{if(o===null)throw Error(n(310));_n=o,o={memoizedState:_n.memoizedState,baseState:_n.baseState,baseQueue:_n.baseQueue,queue:_n.queue,next:null},Cn===null?Wt.memoizedState=Cn=o:Cn=Cn.next=o}return Cn}function gu(o,l){return typeof l=="function"?l(o):l}function Q0(o){var l=os(),h=l.queue;if(h===null)throw Error(n(311));h.lastRenderedReducer=o;var m=_n,_=m.baseQueue,A=h.pending;if(A!==null){if(_!==null){var j=_.next;_.next=A.next,A.next=j}m.baseQueue=_=A,h.pending=null}if(_!==null){A=_.next,m=m.baseState;var q=j=null,G=null,ie=A;do{var fe=ie.lane;if((pa&fe)===fe)G!==null&&(G=G.next={lane:0,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),m=ie.hasEagerState?ie.eagerState:o(m,ie.action);else{var me={lane:fe,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null};G===null?(q=G=me,j=m):G=G.next=me,Wt.lanes|=fe,ma|=fe}ie=ie.next}while(ie!==null&&ie!==A);G===null?j=m:G.next=q,_s(m,l.memoizedState)||(br=!0),l.memoizedState=m,l.baseState=j,l.baseQueue=G,h.lastRenderedState=m}if(o=h.interleaved,o!==null){_=o;do A=_.lane,Wt.lanes|=A,ma|=A,_=_.next;while(_!==o)}else _===null&&(h.lanes=0);return[l.memoizedState,h.dispatch]}function J0(o){var l=os(),h=l.queue;if(h===null)throw Error(n(311));h.lastRenderedReducer=o;var m=h.dispatch,_=h.pending,A=l.memoizedState;if(_!==null){h.pending=null;var j=_=_.next;do A=o(A,j.action),j=j.next;while(j!==_);_s(A,l.memoizedState)||(br=!0),l.memoizedState=A,l.baseQueue===null&&(l.baseState=A),h.lastRenderedState=A}return[A,m]}function c1(){}function u1(o,l){var h=Wt,m=os(),_=l(),A=!_s(m.memoizedState,_);if(A&&(m.memoizedState=_,br=!0),m=m.queue,X0(f1.bind(null,h,m,o),[o]),m.getSnapshot!==l||A||Cn!==null&&Cn.memoizedState.tag&1){if(h.flags|=2048,yu(9,h1.bind(null,h,m,_,l),void 0,null),Sn===null)throw Error(n(349));(pa&30)!==0||d1(h,l,_)}return _}function d1(o,l,h){o.flags|=16384,o={getSnapshot:l,value:h},l=Wt.updateQueue,l===null?(l={lastEffect:null,stores:null},Wt.updateQueue=l,l.stores=[o]):(h=l.stores,h===null?l.stores=[o]:h.push(o))}function h1(o,l,h,m){l.value=h,l.getSnapshot=m,p1(l)&&m1(o)}function f1(o,l,h){return h(function(){p1(l)&&m1(o)})}function p1(o){var l=o.getSnapshot;o=o.value;try{var h=l();return!_s(o,h)}catch{return!0}}function m1(o){var l=Ti(o,1);l!==null&&As(l,o,1,-1)}function g1(o){var l=Xs();return typeof o=="function"&&(o=o()),l.memoizedState=l.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:gu,lastRenderedState:o},l.queue=o,o=o.dispatch=K4.bind(null,Wt,o),[l.memoizedState,o]}function yu(o,l,h,m){return o={tag:o,create:l,destroy:h,deps:m,next:null},l=Wt.updateQueue,l===null?(l={lastEffect:null,stores:null},Wt.updateQueue=l,l.lastEffect=o.next=o):(h=l.lastEffect,h===null?l.lastEffect=o.next=o:(m=h.next,h.next=o,o.next=m,l.lastEffect=o)),o}function y1(){return os().memoizedState}function kh(o,l,h,m){var _=Xs();Wt.flags|=o,_.memoizedState=yu(1|l,h,void 0,m===void 0?null:m)}function Ih(o,l,h,m){var _=os();m=m===void 0?null:m;var A=void 0;if(_n!==null){var j=_n.memoizedState;if(A=j.destroy,m!==null&&G0(m,j.deps)){_.memoizedState=yu(l,h,A,m);return}}Wt.flags|=o,_.memoizedState=yu(1|l,h,A,m)}function v1(o,l){return kh(8390656,8,o,l)}function X0(o,l){return Ih(2048,8,o,l)}function _1(o,l){return Ih(4,2,o,l)}function x1(o,l){return Ih(4,4,o,l)}function w1(o,l){if(typeof l=="function")return o=o(),l(o),function(){l(null)};if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function E1(o,l,h){return h=h!=null?h.concat([o]):null,Ih(4,4,w1.bind(null,l,o),h)}function Z0(){}function b1(o,l){var h=os();l=l===void 0?null:l;var m=h.memoizedState;return m!==null&&l!==null&&G0(l,m[1])?m[0]:(h.memoizedState=[o,l],o)}function A1(o,l){var h=os();l=l===void 0?null:l;var m=h.memoizedState;return m!==null&&l!==null&&G0(l,m[1])?m[0]:(o=o(),h.memoizedState=[o,l],o)}function T1(o,l,h){return(pa&21)===0?(o.baseState&&(o.baseState=!1,br=!0),o.memoizedState=h):(_s(h,l)||(h=zc(),Wt.lanes|=h,ma|=h,o.baseState=!0),l)}function W4(o,l){var h=it;it=h!==0&&4>h?h:4,o(!0);var m=W0.transition;W0.transition={};try{o(!1),l()}finally{it=h,W0.transition=m}}function C1(){return os().memoizedState}function G4(o,l,h){var m=go(o);if(h={lane:m,action:h,hasEagerState:!1,eagerState:null,next:null},S1(o))k1(l,h);else if(h=s1(o,l,h,m),h!==null){var _=fr();As(h,o,m,_),I1(h,l,m)}}function K4(o,l,h){var m=go(o),_={lane:m,action:h,hasEagerState:!1,eagerState:null,next:null};if(S1(o))k1(l,_);else{var A=o.alternate;if(o.lanes===0&&(A===null||A.lanes===0)&&(A=l.lastRenderedReducer,A!==null))try{var j=l.lastRenderedState,q=A(j,h);if(_.hasEagerState=!0,_.eagerState=q,_s(q,j)){var G=l.interleaved;G===null?(_.next=_,V0(l)):(_.next=G.next,G.next=_),l.interleaved=_;return}}catch{}finally{}h=s1(o,l,_,m),h!==null&&(_=fr(),As(h,o,m,_),I1(h,l,m))}}function S1(o){var l=o.alternate;return o===Wt||l!==null&&l===Wt}function k1(o,l){pu=Sh=!0;var h=o.pending;h===null?l.next=l:(l.next=h.next,h.next=l),o.pending=l}function I1(o,l,h){if((h&4194240)!==0){var m=l.lanes;m&=o.pendingLanes,h|=m,l.lanes=h,qc(o,h)}}var Ph={readContext:is,useCallback:Zn,useContext:Zn,useEffect:Zn,useImperativeHandle:Zn,useInsertionEffect:Zn,useLayoutEffect:Zn,useMemo:Zn,useReducer:Zn,useRef:Zn,useState:Zn,useDebugValue:Zn,useDeferredValue:Zn,useTransition:Zn,useMutableSource:Zn,useSyncExternalStore:Zn,useId:Zn,unstable_isNewReconciler:!1},Y4={readContext:is,useCallback:function(o,l){return Xs().memoizedState=[o,l===void 0?null:l],o},useContext:is,useEffect:v1,useImperativeHandle:function(o,l,h){return h=h!=null?h.concat([o]):null,kh(4194308,4,w1.bind(null,l,o),h)},useLayoutEffect:function(o,l){return kh(4194308,4,o,l)},useInsertionEffect:function(o,l){return kh(4,2,o,l)},useMemo:function(o,l){var h=Xs();return l=l===void 0?null:l,o=o(),h.memoizedState=[o,l],o},useReducer:function(o,l,h){var m=Xs();return l=h!==void 0?h(l):l,m.memoizedState=m.baseState=l,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:l},m.queue=o,o=o.dispatch=G4.bind(null,Wt,o),[m.memoizedState,o]},useRef:function(o){var l=Xs();return o={current:o},l.memoizedState=o},useState:g1,useDebugValue:Z0,useDeferredValue:function(o){return Xs().memoizedState=o},useTransition:function(){var o=g1(!1),l=o[0];return o=W4.bind(null,o[1]),Xs().memoizedState=o,[l,o]},useMutableSource:function(){},useSyncExternalStore:function(o,l,h){var m=Wt,_=Xs();if(zt){if(h===void 0)throw Error(n(407));h=h()}else{if(h=l(),Sn===null)throw Error(n(349));(pa&30)!==0||d1(m,l,h)}_.memoizedState=h;var A={value:h,getSnapshot:l};return _.queue=A,v1(f1.bind(null,m,A,o),[o]),m.flags|=2048,yu(9,h1.bind(null,m,A,h,l),void 0,null),h},useId:function(){var o=Xs(),l=Sn.identifierPrefix;if(zt){var h=Ai,m=bi;h=(m&~(1<<32-jr(m)-1)).toString(32)+h,l=":"+l+"R"+h,h=mu++,0<h&&(l+="H"+h.toString(32)),l+=":"}else h=q4++,l=":"+l+"r"+h.toString(32)+":";return o.memoizedState=l},unstable_isNewReconciler:!1},Q4={readContext:is,useCallback:b1,useContext:is,useEffect:X0,useImperativeHandle:E1,useInsertionEffect:_1,useLayoutEffect:x1,useMemo:A1,useReducer:Q0,useRef:y1,useState:function(){return Q0(gu)},useDebugValue:Z0,useDeferredValue:function(o){var l=os();return T1(l,_n.memoizedState,o)},useTransition:function(){var o=Q0(gu)[0],l=os().memoizedState;return[o,l]},useMutableSource:c1,useSyncExternalStore:u1,useId:C1,unstable_isNewReconciler:!1},J4={readContext:is,useCallback:b1,useContext:is,useEffect:X0,useImperativeHandle:E1,useInsertionEffect:_1,useLayoutEffect:x1,useMemo:A1,useReducer:J0,useRef:y1,useState:function(){return J0(gu)},useDebugValue:Z0,useDeferredValue:function(o){var l=os();return _n===null?l.memoizedState=o:T1(l,_n.memoizedState,o)},useTransition:function(){var o=J0(gu)[0],l=os().memoizedState;return[o,l]},useMutableSource:c1,useSyncExternalStore:u1,useId:C1,unstable_isNewReconciler:!1};function ws(o,l){if(o&&o.defaultProps){l=ee({},l),o=o.defaultProps;for(var h in o)l[h]===void 0&&(l[h]=o[h]);return l}return l}function eg(o,l,h,m){l=o.memoizedState,h=h(m,l),h=h==null?l:ee({},l,h),o.memoizedState=h,o.lanes===0&&(o.updateQueue.baseState=h)}var Rh={isMounted:function(o){return(o=o._reactInternals)?Qn(o)===o:!1},enqueueSetState:function(o,l,h){o=o._reactInternals;var m=fr(),_=go(o),A=Ci(m,_);A.payload=l,h!=null&&(A.callback=h),l=ho(o,A,_),l!==null&&(As(l,o,_,m),bh(l,o,_))},enqueueReplaceState:function(o,l,h){o=o._reactInternals;var m=fr(),_=go(o),A=Ci(m,_);A.tag=1,A.payload=l,h!=null&&(A.callback=h),l=ho(o,A,_),l!==null&&(As(l,o,_,m),bh(l,o,_))},enqueueForceUpdate:function(o,l){o=o._reactInternals;var h=fr(),m=go(o),_=Ci(h,m);_.tag=2,l!=null&&(_.callback=l),l=ho(o,_,m),l!==null&&(As(l,o,m,h),bh(l,o,m))}};function P1(o,l,h,m,_,A,j){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(m,A,j):l.prototype&&l.prototype.isPureReactComponent?!ru(h,m)||!ru(_,A):!0}function R1(o,l,h){var m=!1,_=lo,A=l.contextType;return typeof A=="object"&&A!==null?A=is(A):(_=Er(l)?ca:Xn.current,m=l.contextTypes,A=(m=m!=null)?El(o,_):lo),l=new l(h,A),o.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Rh,o.stateNode=l,l._reactInternals=o,m&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=_,o.__reactInternalMemoizedMaskedChildContext=A),l}function D1(o,l,h,m){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(h,m),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(h,m),l.state!==o&&Rh.enqueueReplaceState(l,l.state,null)}function tg(o,l,h,m){var _=o.stateNode;_.props=h,_.state=o.memoizedState,_.refs={},U0(o);var A=l.contextType;typeof A=="object"&&A!==null?_.context=is(A):(A=Er(l)?ca:Xn.current,_.context=El(o,A)),_.state=o.memoizedState,A=l.getDerivedStateFromProps,typeof A=="function"&&(eg(o,l,A,h),_.state=o.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(l=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),l!==_.state&&Rh.enqueueReplaceState(_,_.state,null),Ah(o,h,_,m),_.state=o.memoizedState),typeof _.componentDidMount=="function"&&(o.flags|=4194308)}function Pl(o,l){try{var h="",m=l;do h+=pe(m),m=m.return;while(m);var _=h}catch(A){_=`
40Error generating stack: `+A.message+`
41`+A.stack}return{value:o,source:l,stack:_,digest:null}}function ng(o,l,h){return{value:o,source:null,stack:h??null,digest:l??null}}function dX(o,l){}var X4=typeof WeakMap=="function"?WeakMap:Map;function N1(o,l,h){h=Ci(-1,h),h.tag=3,h.payload={element:null};var m=l.value;return h.callback=function(){Mh||(Mh=!0,yg=m)},h}function O1(o,l,h){h=Ci(-1,h),h.tag=3;var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var _=l.value;h.payload=function(){return m(_)},h.callback=function(){}}var A=o.stateNode;return A!==null&&typeof A.componentDidCatch=="function"&&(h.callback=function(){typeof m!="function"&&(po===null?po=new Set([this]):po.add(this));var j=l.stack;this.componentDidCatch(l.value,{componentStack:j!==null?j:""})}),h}function L1(o,l,h){var m=o.pingCache;if(m===null){m=o.pingCache=new X4;var _=new Set;m.set(l,_)}else _=m.get(l),_===void 0&&(_=new Set,m.set(l,_));_.has(h)||(_.add(h),o=hN.bind(null,o,l,h),l.then(o,o))}function F1(o){do{var l;if((l=o.tag===13)&&(l=o.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return o;o=o.return}while(o!==null);return null}function j1(o,l,h,m,_){return(o.mode&1)===0?(o===l?o.flags|=65536:(o.flags|=128,h.flags|=131072,h.flags&=-52805,h.tag===1&&(h.alternate===null?h.tag=17:(l=Ci(-1,1),l.tag=2,ho(h,l,1))),h.lanes|=1),o):(o.flags|=65536,o.lanes=_,o)}var Z4=N.ReactCurrentOwner,br=!1;function hr(o,l,h,m){l.child=o===null?r1(l,null,h,m):Cl(l,o.child,h,m)}function M1(o,l,h,m,_){h=h.render;var A=l.ref;return kl(l,_),m=K0(o,l,h,m,A,_),h=Y0(),o!==null&&!br?(l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~_,Si(o,l,_)):(zt&&h&&R0(l),l.flags|=1,hr(o,l,m,_),l.child)}function B1(o,l,h,m,_){if(o===null){var A=h.type;return typeof A=="function"&&!Ag(A)&&A.defaultProps===void 0&&h.compare===null&&h.defaultProps===void 0?(l.tag=15,l.type=A,V1(o,l,A,m,_)):(o=Hh(h.type,null,m,l,l.mode,_),o.ref=l.ref,o.return=l,l.child=o)}if(A=o.child,(o.lanes&_)===0){var j=A.memoizedProps;if(h=h.compare,h=h!==null?h:ru,h(j,m)&&o.ref===l.ref)return Si(o,l,_)}return l.flags|=1,o=vo(A,m),o.ref=l.ref,o.return=l,l.child=o}function V1(o,l,h,m,_){if(o!==null){var A=o.memoizedProps;if(ru(A,m)&&o.ref===l.ref)if(br=!1,l.pendingProps=m=A,(o.lanes&_)!==0)(o.flags&131072)!==0&&(br=!0);else return l.lanes=o.lanes,Si(o,l,_)}return rg(o,l,h,m,_)}function U1(o,l,h){var m=l.pendingProps,_=m.children,A=o!==null?o.memoizedState:null;if(m.mode==="hidden")if((l.mode&1)===0)l.memoizedState={baseLanes:0,cachePool:null,transitions:null},Pt(Dl,Hr),Hr|=h;else{if((h&1073741824)===0)return o=A!==null?A.baseLanes|h:h,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:o,cachePool:null,transitions:null},l.updateQueue=null,Pt(Dl,Hr),Hr|=o,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=A!==null?A.baseLanes:h,Pt(Dl,Hr),Hr|=m}else A!==null?(m=A.baseLanes|h,l.memoizedState=null):m=h,Pt(Dl,Hr),Hr|=m;return hr(o,l,_,h),l.child}function $1(o,l){var h=l.ref;(o===null&&h!==null||o!==null&&o.ref!==h)&&(l.flags|=512,l.flags|=2097152)}function rg(o,l,h,m,_){var A=Er(h)?ca:Xn.current;return A=El(l,A),kl(l,_),h=K0(o,l,h,m,A,_),m=Y0(),o!==null&&!br?(l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~_,Si(o,l,_)):(zt&&m&&R0(l),l.flags|=1,hr(o,l,h,_),l.child)}function z1(o,l,h,m,_){if(Er(h)){var A=!0;mh(l)}else A=!1;if(kl(l,_),l.stateNode===null)Nh(o,l),R1(l,h,m),tg(l,h,m,_),m=!0;else if(o===null){var j=l.stateNode,q=l.memoizedProps;j.props=q;var G=j.context,ie=h.contextType;typeof ie=="object"&&ie!==null?ie=is(ie):(ie=Er(h)?ca:Xn.current,ie=El(l,ie));var fe=h.getDerivedStateFromProps,me=typeof fe=="function"||typeof j.getSnapshotBeforeUpdate=="function";me||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(q!==m||G!==ie)&&D1(l,j,m,ie),uo=!1;var he=l.memoizedState;j.state=he,Ah(l,m,j,_),G=l.memoizedState,q!==m||he!==G||wr.current||uo?(typeof fe=="function"&&(eg(l,h,fe,m),G=l.memoizedState),(q=uo||P1(l,h,q,m,he,G,ie))?(me||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(l.flags|=4194308)):(typeof j.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=m,l.memoizedState=G),j.props=m,j.state=G,j.context=ie,m=q):(typeof j.componentDidMount=="function"&&(l.flags|=4194308),m=!1)}else{j=l.stateNode,i1(o,l),q=l.memoizedProps,ie=l.type===l.elementType?q:ws(l.type,q),j.props=ie,me=l.pendingProps,he=j.context,G=h.contextType,typeof G=="object"&&G!==null?G=is(G):(G=Er(h)?ca:Xn.current,G=El(l,G));var Ae=h.getDerivedStateFromProps;(fe=typeof Ae=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(q!==me||he!==G)&&D1(l,j,m,G),uo=!1,he=l.memoizedState,j.state=he,Ah(l,m,j,_);var Ie=l.memoizedState;q!==me||he!==Ie||wr.current||uo?(typeof Ae=="function"&&(eg(l,h,Ae,m),Ie=l.memoizedState),(ie=uo||P1(l,h,ie,m,he,Ie,G)||!1)?(fe||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(m,Ie,G),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(m,Ie,G)),typeof j.componentDidUpdate=="function"&&(l.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof j.componentDidUpdate!="function"||q===o.memoizedProps&&he===o.memoizedState||(l.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||q===o.memoizedProps&&he===o.memoizedState||(l.flags|=1024),l.memoizedProps=m,l.memoizedState=Ie),j.props=m,j.state=Ie,j.context=G,m=ie):(typeof j.componentDidUpdate!="function"||q===o.memoizedProps&&he===o.memoizedState||(l.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||q===o.memoizedProps&&he===o.memoizedState||(l.flags|=1024),m=!1)}return sg(o,l,h,m,A,_)}function sg(o,l,h,m,_,A){$1(o,l);var j=(l.flags&128)!==0;if(!m&&!j)return _&&Kw(l,h,!1),Si(o,l,A);m=l.stateNode,Z4.current=l;var q=j&&typeof h.getDerivedStateFromError!="function"?null:m.render();return l.flags|=1,o!==null&&j?(l.child=Cl(l,o.child,null,A),l.child=Cl(l,null,q,A)):hr(o,l,q,A),l.memoizedState=m.state,_&&Kw(l,h,!0),l.child}function H1(o){var l=o.stateNode;l.pendingContext?Ww(o,l.pendingContext,l.pendingContext!==l.context):l.context&&Ww(o,l.context,!1),$0(o,l.containerInfo)}function q1(o,l,h,m,_){return Tl(),L0(_),l.flags|=256,hr(o,l,h,m),l.child}var ig={dehydrated:null,treeContext:null,retryLane:0};function og(o){return{baseLanes:o,cachePool:null,transitions:null}}function W1(o,l,h){var m=l.pendingProps,_=qt.current,A=!1,j=(l.flags&128)!==0,q;if((q=j)||(q=o!==null&&o.memoizedState===null?!1:(_&2)!==0),q?(A=!0,l.flags&=-129):(o===null||o.memoizedState!==null)&&(_|=1),Pt(qt,_&1),o===null)return O0(l),o=l.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?((l.mode&1)===0?l.lanes=1:o.data==="$!"?l.lanes=8:l.lanes=1073741824,null):(j=m.children,o=m.fallback,A?(m=l.mode,A=l.child,j={mode:"hidden",children:j},(m&1)===0&&A!==null?(A.childLanes=0,A.pendingProps=j):A=qh(j,m,0,null),o=_a(o,m,h,null),A.return=l,o.return=l,A.sibling=o,l.child=A,l.child.memoizedState=og(h),l.memoizedState=ig,o):ag(l,j));if(_=o.memoizedState,_!==null&&(q=_.dehydrated,q!==null))return eN(o,l,j,m,q,_,h);if(A){A=m.fallback,j=l.mode,_=o.child,q=_.sibling;var G={mode:"hidden",children:m.children};return(j&1)===0&&l.child!==_?(m=l.child,m.childLanes=0,m.pendingProps=G,l.deletions=null):(m=vo(_,G),m.subtreeFlags=_.subtreeFlags&14680064),q!==null?A=vo(q,A):(A=_a(A,j,h,null),A.flags|=2),A.return=l,m.return=l,m.sibling=A,l.child=m,m=A,A=l.child,j=o.child.memoizedState,j=j===null?og(h):{baseLanes:j.baseLanes|h,cachePool:null,transitions:j.transitions},A.memoizedState=j,A.childLanes=o.childLanes&~h,l.memoizedState=ig,m}return A=o.child,o=A.sibling,m=vo(A,{mode:"visible",children:m.children}),(l.mode&1)===0&&(m.lanes=h),m.return=l,m.sibling=null,o!==null&&(h=l.deletions,h===null?(l.deletions=[o],l.flags|=16):h.push(o)),l.child=m,l.memoizedState=null,m}function ag(o,l){return l=qh({mode:"visible",children:l},o.mode,0,null),l.return=o,o.child=l}function Dh(o,l,h,m){return m!==null&&L0(m),Cl(l,o.child,null,h),o=ag(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function eN(o,l,h,m,_,A,j){if(h)return l.flags&256?(l.flags&=-257,m=ng(Error(n(422))),Dh(o,l,j,m)):l.memoizedState!==null?(l.child=o.child,l.flags|=128,null):(A=m.fallback,_=l.mode,m=qh({mode:"visible",children:m.children},_,0,null),A=_a(A,_,j,null),A.flags|=2,m.return=l,A.return=l,m.sibling=A,l.child=m,(l.mode&1)!==0&&Cl(l,o.child,null,j),l.child.memoizedState=og(j),l.memoizedState=ig,A);if((l.mode&1)===0)return Dh(o,l,j,null);if(_.data==="$!"){if(m=_.nextSibling&&_.nextSibling.dataset,m)var q=m.dgst;return m=q,A=Error(n(419)),m=ng(A,m,void 0),Dh(o,l,j,m)}if(q=(j&o.childLanes)!==0,br||q){if(m=Sn,m!==null){switch(j&-j){case 4:_=2;break;case 16:_=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:_=32;break;case 536870912:_=268435456;break;default:_=0}_=(_&(m.suspendedLanes|j))!==0?0:_,_!==0&&_!==A.retryLane&&(A.retryLane=_,Ti(o,_),As(m,o,_,-1))}return bg(),m=ng(Error(n(421))),Dh(o,l,j,m)}return _.data==="$?"?(l.flags|=128,l.child=o.child,l=fN.bind(null,o),_._reactRetry=l,null):(o=A.treeContext,zr=oo(_.nextSibling),$r=l,zt=!0,xs=null,o!==null&&(rs[ss++]=bi,rs[ss++]=Ai,rs[ss++]=ua,bi=o.id,Ai=o.overflow,ua=l),l=ag(l,m.children),l.flags|=4096,l)}function G1(o,l,h){o.lanes|=l;var m=o.alternate;m!==null&&(m.lanes|=l),B0(o.return,l,h)}function lg(o,l,h,m,_){var A=o.memoizedState;A===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:m,tail:h,tailMode:_}:(A.isBackwards=l,A.rendering=null,A.renderingStartTime=0,A.last=m,A.tail=h,A.tailMode=_)}function K1(o,l,h){var m=l.pendingProps,_=m.revealOrder,A=m.tail;if(hr(o,l,m.children,h),m=qt.current,(m&2)!==0)m=m&1|2,l.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&G1(o,h,l);else if(o.tag===19)G1(o,h,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}m&=1}if(Pt(qt,m),(l.mode&1)===0)l.memoizedState=null;else switch(_){case"forwards":for(h=l.child,_=null;h!==null;)o=h.alternate,o!==null&&Th(o)===null&&(_=h),h=h.sibling;h=_,h===null?(_=l.child,l.child=null):(_=h.sibling,h.sibling=null),lg(l,!1,_,h,A);break;case"backwards":for(h=null,_=l.child,l.child=null;_!==null;){if(o=_.alternate,o!==null&&Th(o)===null){l.child=_;break}o=_.sibling,_.sibling=h,h=_,_=o}lg(l,!0,h,null,A);break;case"together":lg(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function Nh(o,l){(l.mode&1)===0&&o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2)}function Si(o,l,h){if(o!==null&&(l.dependencies=o.dependencies),ma|=l.lanes,(h&l.childLanes)===0)return null;if(o!==null&&l.child!==o.child)throw Error(n(153));if(l.child!==null){for(o=l.child,h=vo(o,o.pendingProps),l.child=h,h.return=l;o.sibling!==null;)o=o.sibling,h=h.sibling=vo(o,o.pendingProps),h.return=l;h.sibling=null}return l.child}function tN(o,l,h){switch(l.tag){case 3:H1(l),Tl();break;case 5:l1(l);break;case 1:Er(l.type)&&mh(l);break;case 4:$0(l,l.stateNode.containerInfo);break;case 10:var m=l.type._context,_=l.memoizedProps.value;Pt(wh,m._currentValue),m._currentValue=_;break;case 13:if(m=l.memoizedState,m!==null)return m.dehydrated!==null?(Pt(qt,qt.current&1),l.flags|=128,null):(h&l.child.childLanes)!==0?W1(o,l,h):(Pt(qt,qt.current&1),o=Si(o,l,h),o!==null?o.sibling:null);Pt(qt,qt.current&1);break;case 19:if(m=(h&l.childLanes)!==0,(o.flags&128)!==0){if(m)return K1(o,l,h);l.flags|=128}if(_=l.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),Pt(qt,qt.current),m)break;return null;case 22:case 23:return l.lanes=0,U1(o,l,h)}return Si(o,l,h)}var Y1,cg,Q1,J1;Y1=function(o,l){for(var h=l.child;h!==null;){if(h.tag===5||h.tag===6)o.appendChild(h.stateNode);else if(h.tag!==4&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===l)break;for(;h.sibling===null;){if(h.return===null||h.return===l)return;h=h.return}h.sibling.return=h.return,h=h.sibling}},cg=function(){},Q1=function(o,l,h,m){var _=o.memoizedProps;if(_!==m){o=l.stateNode,fa(Js.current);var A=null;switch(h){case"input":_=$t(o,_),m=$t(o,m),A=[];break;case"select":_=ee({},_,{value:void 0}),m=ee({},m,{value:void 0}),A=[];break;case"textarea":_=Yt(o,_),m=Yt(o,m),A=[];break;default:typeof _.onClick!="function"&&typeof m.onClick=="function"&&(o.onclick=hh)}Ne(h,m);var j;h=null;for(ie in _)if(!m.hasOwnProperty(ie)&&_.hasOwnProperty(ie)&&_[ie]!=null)if(ie==="style"){var q=_[ie];for(j in q)q.hasOwnProperty(j)&&(h||(h={}),h[j]="")}else ie!=="dangerouslySetInnerHTML"&&ie!=="children"&&ie!=="suppressContentEditableWarning"&&ie!=="suppressHydrationWarning"&&ie!=="autoFocus"&&(s.hasOwnProperty(ie)?A||(A=[]):(A=A||[]).push(ie,null));for(ie in m){var G=m[ie];if(q=_?.[ie],m.hasOwnProperty(ie)&&G!==q&&(G!=null||q!=null))if(ie==="style")if(q){for(j in q)!q.hasOwnProperty(j)||G&&G.hasOwnProperty(j)||(h||(h={}),h[j]="");for(j in G)G.hasOwnProperty(j)&&q[j]!==G[j]&&(h||(h={}),h[j]=G[j])}else h||(A||(A=[]),A.push(ie,h)),h=G;else ie==="dangerouslySetInnerHTML"?(G=G?G.__html:void 0,q=q?q.__html:void 0,G!=null&&q!==G&&(A=A||[]).push(ie,G)):ie==="children"?typeof G!="string"&&typeof G!="number"||(A=A||[]).push(ie,""+G):ie!=="suppressContentEditableWarning"&&ie!=="suppressHydrationWarning"&&(s.hasOwnProperty(ie)?(G!=null&&ie==="onScroll"&&Lt("scroll",o),A||q===G||(A=[])):(A=A||[]).push(ie,G))}h&&(A=A||[]).push("style",h);var ie=A;(l.updateQueue=ie)&&(l.flags|=4)}},J1=function(o,l,h,m){h!==m&&(l.flags|=4)};function vu(o,l){if(!zt)switch(o.tailMode){case"hidden":l=o.tail;for(var h=null;l!==null;)l.alternate!==null&&(h=l),l=l.sibling;h===null?o.tail=null:h.sibling=null;break;case"collapsed":h=o.tail;for(var m=null;h!==null;)h.alternate!==null&&(m=h),h=h.sibling;m===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:m.sibling=null}}function er(o){var l=o.alternate!==null&&o.alternate.child===o.child,h=0,m=0;if(l)for(var _=o.child;_!==null;)h|=_.lanes|_.childLanes,m|=_.subtreeFlags&14680064,m|=_.flags&14680064,_.return=o,_=_.sibling;else for(_=o.child;_!==null;)h|=_.lanes|_.childLanes,m|=_.subtreeFlags,m|=_.flags,_.return=o,_=_.sibling;return o.subtreeFlags|=m,o.childLanes=h,l}function nN(o,l,h){var m=l.pendingProps;switch(D0(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return er(l),null;case 1:return Er(l.type)&&ph(),er(l),null;case 3:return m=l.stateNode,Il(),Ft(wr),Ft(Xn),q0(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(o===null||o.child===null)&&(_h(l)?l.flags|=4:o===null||o.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,xs!==null&&(xg(xs),xs=null))),cg(o,l),er(l),null;case 5:z0(l);var _=fa(fu.current);if(h=l.type,o!==null&&l.stateNode!=null)Q1(o,l,h,m,_),o.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!m){if(l.stateNode===null)throw Error(n(166));return er(l),null}if(o=fa(Js.current),_h(l)){m=l.stateNode,h=l.type;var A=l.memoizedProps;switch(m[Qs]=l,m[lu]=A,o=(l.mode&1)!==0,h){case"dialog":Lt("cancel",m),Lt("close",m);break;case"iframe":case"object":case"embed":Lt("load",m);break;case"video":case"audio":for(_=0;_<iu.length;_++)Lt(iu[_],m);break;case"source":Lt("error",m);break;case"img":case"image":case"link":Lt("error",m),Lt("load",m);break;case"details":Lt("toggle",m);break;case"input":tn(m,A),Lt("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!A.multiple},Lt("invalid",m);break;case"textarea":An(m,A),Lt("invalid",m)}Ne(h,A),_=null;for(var j in A)if(A.hasOwnProperty(j)){var q=A[j];j==="children"?typeof q=="string"?m.textContent!==q&&(A.suppressHydrationWarning!==!0&&dh(m.textContent,q,o),_=["children",q]):typeof q=="number"&&m.textContent!==""+q&&(A.suppressHydrationWarning!==!0&&dh(m.textContent,q,o),_=["children",""+q]):s.hasOwnProperty(j)&&q!=null&&j==="onScroll"&&Lt("scroll",m)}switch(h){case"input":ht(m),Dr(m,A,!0);break;case"textarea":ht(m),mn(m);break;case"select":case"option":break;default:typeof A.onClick=="function"&&(m.onclick=hh)}m=_,l.updateQueue=m,m!==null&&(l.flags|=4)}else{j=_.nodeType===9?_:_.ownerDocument,o==="http://www.w3.org/1999/xhtml"&&(o=ur(h)),o==="http://www.w3.org/1999/xhtml"?h==="script"?(o=j.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof m.is=="string"?o=j.createElement(h,{is:m.is}):(o=j.createElement(h),h==="select"&&(j=o,m.multiple?j.multiple=!0:m.size&&(j.size=m.size))):o=j.createElementNS(o,h),o[Qs]=l,o[lu]=m,Y1(o,l,!1,!1),l.stateNode=o;e:{switch(j=Ee(h,m),h){case"dialog":Lt("cancel",o),Lt("close",o),_=m;break;case"iframe":case"object":case"embed":Lt("load",o),_=m;break;case"video":case"audio":for(_=0;_<iu.length;_++)Lt(iu[_],o);_=m;break;case"source":Lt("error",o),_=m;break;case"img":case"image":case"link":Lt("error",o),Lt("load",o),_=m;break;case"details":Lt("toggle",o),_=m;break;case"input":tn(o,m),_=$t(o,m),Lt("invalid",o);break;case"option":_=m;break;case"select":o._wrapperState={wasMultiple:!!m.multiple},_=ee({},m,{value:void 0}),Lt("invalid",o);break;case"textarea":An(o,m),_=Yt(o,m),Lt("invalid",o);break;default:_=m}Ne(h,_),q=_;for(A in q)if(q.hasOwnProperty(A)){var G=q[A];A==="style"?ge(o,G):A==="dangerouslySetInnerHTML"?(G=G?G.__html:void 0,G!=null&&hi(o,G)):A==="children"?typeof G=="string"?(h!=="textarea"||G!=="")&&Nr(o,G):typeof G=="number"&&Nr(o,""+G):A!=="suppressContentEditableWarning"&&A!=="suppressHydrationWarning"&&A!=="autoFocus"&&(s.hasOwnProperty(A)?G!=null&&A==="onScroll"&&Lt("scroll",o):G!=null&&k(o,A,G,j))}switch(h){case"input":ht(o),Dr(o,m,!1);break;case"textarea":ht(o),mn(o);break;case"option":m.value!=null&&o.setAttribute("value",""+ve(m.value));break;case"select":o.multiple=!!m.multiple,A=m.value,A!=null?Nt(o,!!m.multiple,A,!1):m.defaultValue!=null&&Nt(o,!!m.multiple,m.defaultValue,!0);break;default:typeof _.onClick=="function"&&(o.onclick=hh)}switch(h){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(l.flags|=4)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return er(l),null;case 6:if(o&&l.stateNode!=null)J1(o,l,o.memoizedProps,m);else{if(typeof m!="string"&&l.stateNode===null)throw Error(n(166));if(h=fa(fu.current),fa(Js.current),_h(l)){if(m=l.stateNode,h=l.memoizedProps,m[Qs]=l,(A=m.nodeValue!==h)&&(o=$r,o!==null))switch(o.tag){case 3:dh(m.nodeValue,h,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&dh(m.nodeValue,h,(o.mode&1)!==0)}A&&(l.flags|=4)}else m=(h.nodeType===9?h:h.ownerDocument).createTextNode(m),m[Qs]=l,l.stateNode=m}return er(l),null;case 13:if(Ft(qt),m=l.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(zt&&zr!==null&&(l.mode&1)!==0&&(l.flags&128)===0)e1(),Tl(),l.flags|=98560,A=!1;else if(A=_h(l),m!==null&&m.dehydrated!==null){if(o===null){if(!A)throw Error(n(318));if(A=l.memoizedState,A=A!==null?A.dehydrated:null,!A)throw Error(n(317));A[Qs]=l}else Tl(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;er(l),A=!1}else xs!==null&&(xg(xs),xs=null),A=!0;if(!A)return l.flags&65536?l:null}return(l.flags&128)!==0?(l.lanes=h,l):(m=m!==null,m!==(o!==null&&o.memoizedState!==null)&&m&&(l.child.flags|=8192,(l.mode&1)!==0&&(o===null||(qt.current&1)!==0?xn===0&&(xn=3):bg())),l.updateQueue!==null&&(l.flags|=4),er(l),null);case 4:return Il(),cg(o,l),o===null&&ou(l.stateNode.containerInfo),er(l),null;case 10:return M0(l.type._context),er(l),null;case 17:return Er(l.type)&&ph(),er(l),null;case 19:if(Ft(qt),A=l.memoizedState,A===null)return er(l),null;if(m=(l.flags&128)!==0,j=A.rendering,j===null)if(m)vu(A,!1);else{if(xn!==0||o!==null&&(o.flags&128)!==0)for(o=l.child;o!==null;){if(j=Th(o),j!==null){for(l.flags|=128,vu(A,!1),m=j.updateQueue,m!==null&&(l.updateQueue=m,l.flags|=4),l.subtreeFlags=0,m=h,h=l.child;h!==null;)A=h,o=m,A.flags&=14680066,j=A.alternate,j===null?(A.childLanes=0,A.lanes=o,A.child=null,A.subtreeFlags=0,A.memoizedProps=null,A.memoizedState=null,A.updateQueue=null,A.dependencies=null,A.stateNode=null):(A.childLanes=j.childLanes,A.lanes=j.lanes,A.child=j.child,A.subtreeFlags=0,A.deletions=null,A.memoizedProps=j.memoizedProps,A.memoizedState=j.memoizedState,A.updateQueue=j.updateQueue,A.type=j.type,o=j.dependencies,A.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),h=h.sibling;return Pt(qt,qt.current&1|2),l.child}o=o.sibling}A.tail!==null&&Ot()>Nl&&(l.flags|=128,m=!0,vu(A,!1),l.lanes=4194304)}else{if(!m)if(o=Th(j),o!==null){if(l.flags|=128,m=!0,h=o.updateQueue,h!==null&&(l.updateQueue=h,l.flags|=4),vu(A,!0),A.tail===null&&A.tailMode==="hidden"&&!j.alternate&&!zt)return er(l),null}else 2*Ot()-A.renderingStartTime>Nl&&h!==1073741824&&(l.flags|=128,m=!0,vu(A,!1),l.lanes=4194304);A.isBackwards?(j.sibling=l.child,l.child=j):(h=A.last,h!==null?h.sibling=j:l.child=j,A.last=j)}return A.tail!==null?(l=A.tail,A.rendering=l,A.tail=l.sibling,A.renderingStartTime=Ot(),l.sibling=null,h=qt.current,Pt(qt,m?h&1|2:h&1),l):(er(l),null);case 22:case 23:return Eg(),m=l.memoizedState!==null,o!==null&&o.memoizedState!==null!==m&&(l.flags|=8192),m&&(l.mode&1)!==0?(Hr&1073741824)!==0&&(er(l),l.subtreeFlags&6&&(l.flags|=8192)):er(l),null;case 24:return null;case 25:return null}throw Error(n(156,l.tag))}function rN(o,l){switch(D0(l),l.tag){case 1:return Er(l.type)&&ph(),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return Il(),Ft(wr),Ft(Xn),q0(),o=l.flags,(o&65536)!==0&&(o&128)===0?(l.flags=o&-65537|128,l):null;case 5:return z0(l),null;case 13:if(Ft(qt),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(n(340));Tl()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return Ft(qt),null;case 4:return Il(),null;case 10:return M0(l.type._context),null;case 22:case 23:return Eg(),null;case 24:return null;default:return null}}var Oh=!1,tr=!1,sN=typeof WeakSet=="function"?WeakSet:Set,Ce=null;function Rl(o,l){var h=o.ref;if(h!==null)if(typeof h=="function")try{h(null)}catch(m){Jt(o,l,m)}else h.current=null}function ug(o,l,h){try{h()}catch(m){Jt(o,l,m)}}var X1=!1;function iN(o,l){if(b0=vi,o=Pw(),m0(o)){if("selectionStart"in o)var h={start:o.selectionStart,end:o.selectionEnd};else e:{h=(h=o.ownerDocument)&&h.defaultView||window;var m=h.getSelection&&h.getSelection();if(m&&m.rangeCount!==0){h=m.anchorNode;var _=m.anchorOffset,A=m.focusNode;m=m.focusOffset;try{h.nodeType,A.nodeType}catch{h=null;break e}var j=0,q=-1,G=-1,ie=0,fe=0,me=o,he=null;t:for(;;){for(var Ae;me!==h||_!==0&&me.nodeType!==3||(q=j+_),me!==A||m!==0&&me.nodeType!==3||(G=j+m),me.nodeType===3&&(j+=me.nodeValue.length),(Ae=me.firstChild)!==null;)he=me,me=Ae;for(;;){if(me===o)break t;if(he===h&&++ie===_&&(q=j),he===A&&++fe===m&&(G=j),(Ae=me.nextSibling)!==null)break;me=he,he=me.parentNode}me=Ae}h=q===-1||G===-1?null:{start:q,end:G}}else h=null}h=h||{start:0,end:0}}else h=null;for(A0={focusedElem:o,selectionRange:h},vi=!1,Ce=l;Ce!==null;)if(l=Ce,o=l.child,(l.subtreeFlags&1028)!==0&&o!==null)o.return=l,Ce=o;else for(;Ce!==null;){l=Ce;try{var Ie=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(Ie!==null){var Re=Ie.memoizedProps,rn=Ie.memoizedState,X=l.stateNode,Y=X.getSnapshotBeforeUpdate(l.elementType===l.type?Re:ws(l.type,Re),rn);X.__reactInternalSnapshotBeforeUpdate=Y}break;case 3:var ne=l.stateNode.containerInfo;ne.nodeType===1?ne.textContent="":ne.nodeType===9&&ne.documentElement&&ne.removeChild(ne.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ye){Jt(l,l.return,ye)}if(o=l.sibling,o!==null){o.return=l.return,Ce=o;break}Ce=l.return}return Ie=X1,X1=!1,Ie}function _u(o,l,h){var m=l.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var _=m=m.next;do{if((_.tag&o)===o){var A=_.destroy;_.destroy=void 0,A!==void 0&&ug(l,h,A)}_=_.next}while(_!==m)}}function Lh(o,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var h=l=l.next;do{if((h.tag&o)===o){var m=h.create;h.destroy=m()}h=h.next}while(h!==l)}}function dg(o){var l=o.ref;if(l!==null){var h=o.stateNode;switch(o.tag){case 5:o=h;break;default:o=h}typeof l=="function"?l(o):l.current=o}}function Z1(o){var l=o.alternate;l!==null&&(o.alternate=null,Z1(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&(delete l[Qs],delete l[lu],delete l[k0],delete l[U4],delete l[$4])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function eE(o){return o.tag===5||o.tag===3||o.tag===4}function tE(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||eE(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function hg(o,l,h){var m=o.tag;if(m===5||m===6)o=o.stateNode,l?h.nodeType===8?h.parentNode.insertBefore(o,l):h.insertBefore(o,l):(h.nodeType===8?(l=h.parentNode,l.insertBefore(o,h)):(l=h,l.appendChild(o)),h=h._reactRootContainer,h!=null||l.onclick!==null||(l.onclick=hh));else if(m!==4&&(o=o.child,o!==null))for(hg(o,l,h),o=o.sibling;o!==null;)hg(o,l,h),o=o.sibling}function fg(o,l,h){var m=o.tag;if(m===5||m===6)o=o.stateNode,l?h.insertBefore(o,l):h.appendChild(o);else if(m!==4&&(o=o.child,o!==null))for(fg(o,l,h),o=o.sibling;o!==null;)fg(o,l,h),o=o.sibling}var Vn=null,Es=!1;function fo(o,l,h){for(h=h.child;h!==null;)nE(o,l,h),h=h.sibling}function nE(o,l,h){if(Fr&&typeof Fr.onCommitFiberUnmount=="function")try{Fr.onCommitFiberUnmount(Zo,h)}catch{}switch(h.tag){case 5:tr||Rl(h,l);case 6:var m=Vn,_=Es;Vn=null,fo(o,l,h),Vn=m,Es=_,Vn!==null&&(Es?(o=Vn,h=h.stateNode,o.nodeType===8?o.parentNode.removeChild(h):o.removeChild(h)):Vn.removeChild(h.stateNode));break;case 18:Vn!==null&&(Es?(o=Vn,h=h.stateNode,o.nodeType===8?S0(o.parentNode,h):o.nodeType===1&&S0(o,h),no(o)):S0(Vn,h.stateNode));break;case 4:m=Vn,_=Es,Vn=h.stateNode.containerInfo,Es=!0,fo(o,l,h),Vn=m,Es=_;break;case 0:case 11:case 14:case 15:if(!tr&&(m=h.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){_=m=m.next;do{var A=_,j=A.destroy;A=A.tag,j!==void 0&&((A&2)!==0||(A&4)!==0)&&ug(h,l,j),_=_.next}while(_!==m)}fo(o,l,h);break;case 1:if(!tr&&(Rl(h,l),m=h.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=h.memoizedProps,m.state=h.memoizedState,m.componentWillUnmount()}catch(q){Jt(h,l,q)}fo(o,l,h);break;case 21:fo(o,l,h);break;case 22:h.mode&1?(tr=(m=tr)||h.memoizedState!==null,fo(o,l,h),tr=m):fo(o,l,h);break;default:fo(o,l,h)}}function rE(o){var l=o.updateQueue;if(l!==null){o.updateQueue=null;var h=o.stateNode;h===null&&(h=o.stateNode=new sN),l.forEach(function(m){var _=pN.bind(null,o,m);h.has(m)||(h.add(m),m.then(_,_))})}}function bs(o,l){var h=l.deletions;if(h!==null)for(var m=0;m<h.length;m++){var _=h[m];try{var A=o,j=l,q=j;e:for(;q!==null;){switch(q.tag){case 5:Vn=q.stateNode,Es=!1;break e;case 3:Vn=q.stateNode.containerInfo,Es=!0;break e;case 4:Vn=q.stateNode.containerInfo,Es=!0;break e}q=q.return}if(Vn===null)throw Error(n(160));nE(A,j,_),Vn=null,Es=!1;var G=_.alternate;G!==null&&(G.return=null),_.return=null}catch(ie){Jt(_,l,ie)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)sE(l,o),l=l.sibling}function sE(o,l){var h=o.alternate,m=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(bs(l,o),Zs(o),m&4){try{_u(3,o,o.return),Lh(3,o)}catch(Re){Jt(o,o.return,Re)}try{_u(5,o,o.return)}catch(Re){Jt(o,o.return,Re)}}break;case 1:bs(l,o),Zs(o),m&512&&h!==null&&Rl(h,h.return);break;case 5:if(bs(l,o),Zs(o),m&512&&h!==null&&Rl(h,h.return),o.flags&32){var _=o.stateNode;try{Nr(_,"")}catch(Re){Jt(o,o.return,Re)}}if(m&4&&(_=o.stateNode,_!=null)){var A=o.memoizedProps,j=h!==null?h.memoizedProps:A,q=o.type,G=o.updateQueue;if(o.updateQueue=null,G!==null)try{q==="input"&&A.type==="radio"&&A.name!=null&&yr(_,A),Ee(q,j);var ie=Ee(q,A);for(j=0;j<G.length;j+=2){var fe=G[j],me=G[j+1];fe==="style"?ge(_,me):fe==="dangerouslySetInnerHTML"?hi(_,me):fe==="children"?Nr(_,me):k(_,fe,me,ie)}switch(q){case"input":vr(_,A);break;case"textarea":On(_,A);break;case"select":var he=_._wrapperState.wasMultiple;_._wrapperState.wasMultiple=!!A.multiple;var Ae=A.value;Ae!=null?Nt(_,!!A.multiple,Ae,!1):he!==!!A.multiple&&(A.defaultValue!=null?Nt(_,!!A.multiple,A.defaultValue,!0):Nt(_,!!A.multiple,A.multiple?[]:"",!1))}_[lu]=A}catch(Re){Jt(o,o.return,Re)}}break;case 6:if(bs(l,o),Zs(o),m&4){if(o.stateNode===null)throw Error(n(162));_=o.stateNode,A=o.memoizedProps;try{_.nodeValue=A}catch(Re){Jt(o,o.return,Re)}}break;case 3:if(bs(l,o),Zs(o),m&4&&h!==null&&h.memoizedState.isDehydrated)try{no(l.containerInfo)}catch(Re){Jt(o,o.return,Re)}break;case 4:bs(l,o),Zs(o);break;case 13:bs(l,o),Zs(o),_=o.child,_.flags&8192&&(A=_.memoizedState!==null,_.stateNode.isHidden=A,!A||_.alternate!==null&&_.alternate.memoizedState!==null||(gg=Ot())),m&4&&rE(o);break;case 22:if(fe=h!==null&&h.memoizedState!==null,o.mode&1?(tr=(ie=tr)||fe,bs(l,o),tr=ie):bs(l,o),Zs(o),m&8192){if(ie=o.memoizedState!==null,(o.stateNode.isHidden=ie)&&!fe&&(o.mode&1)!==0)for(Ce=o,fe=o.child;fe!==null;){for(me=Ce=fe;Ce!==null;){switch(he=Ce,Ae=he.child,he.tag){case 0:case 11:case 14:case 15:_u(4,he,he.return);break;case 1:Rl(he,he.return);var Ie=he.stateNode;if(typeof Ie.componentWillUnmount=="function"){m=he,h=he.return;try{l=m,Ie.props=l.memoizedProps,Ie.state=l.memoizedState,Ie.componentWillUnmount()}catch(Re){Jt(m,h,Re)}}break;case 5:Rl(he,he.return);break;case 22:if(he.memoizedState!==null){aE(me);continue}}Ae!==null?(Ae.return=he,Ce=Ae):aE(me)}fe=fe.sibling}e:for(fe=null,me=o;;){if(me.tag===5){if(fe===null){fe=me;try{_=me.stateNode,ie?(A=_.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none"):(q=me.stateNode,G=me.memoizedProps.style,j=G!=null&&G.hasOwnProperty("display")?G.display:null,q.style.display=Or("display",j))}catch(Re){Jt(o,o.return,Re)}}}else if(me.tag===6){if(fe===null)try{me.stateNode.nodeValue=ie?"":me.memoizedProps}catch(Re){Jt(o,o.return,Re)}}else if((me.tag!==22&&me.tag!==23||me.memoizedState===null||me===o)&&me.child!==null){me.child.return=me,me=me.child;continue}if(me===o)break e;for(;me.sibling===null;){if(me.return===null||me.return===o)break e;fe===me&&(fe=null),me=me.return}fe===me&&(fe=null),me.sibling.return=me.return,me=me.sibling}}break;case 19:bs(l,o),Zs(o),m&4&&rE(o);break;case 21:break;default:bs(l,o),Zs(o)}}function Zs(o){var l=o.flags;if(l&2){try{e:{for(var h=o.return;h!==null;){if(eE(h)){var m=h;break e}h=h.return}throw Error(n(160))}switch(m.tag){case 5:var _=m.stateNode;m.flags&32&&(Nr(_,""),m.flags&=-33);var A=tE(o);fg(o,A,_);break;case 3:case 4:var j=m.stateNode.containerInfo,q=tE(o);hg(o,q,j);break;default:throw Error(n(161))}}catch(G){Jt(o,o.return,G)}o.flags&=-3}l&4096&&(o.flags&=-4097)}function oN(o,l,h){Ce=o,iE(o)}function iE(o,l,h){for(var m=(o.mode&1)!==0;Ce!==null;){var _=Ce,A=_.child;if(_.tag===22&&m){var j=_.memoizedState!==null||Oh;if(!j){var q=_.alternate,G=q!==null&&q.memoizedState!==null||tr;q=Oh;var ie=tr;if(Oh=j,(tr=G)&&!ie)for(Ce=_;Ce!==null;)j=Ce,G=j.child,j.tag===22&&j.memoizedState!==null?lE(_):G!==null?(G.return=j,Ce=G):lE(_);for(;A!==null;)Ce=A,iE(A),A=A.sibling;Ce=_,Oh=q,tr=ie}oE(o)}else(_.subtreeFlags&8772)!==0&&A!==null?(A.return=_,Ce=A):oE(o)}}function oE(o){for(;Ce!==null;){var l=Ce;if((l.flags&8772)!==0){var h=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:tr||Lh(5,l);break;case 1:var m=l.stateNode;if(l.flags&4&&!tr)if(h===null)m.componentDidMount();else{var _=l.elementType===l.type?h.memoizedProps:ws(l.type,h.memoizedProps);m.componentDidUpdate(_,h.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var A=l.updateQueue;A!==null&&a1(l,A,m);break;case 3:var j=l.updateQueue;if(j!==null){if(h=null,l.child!==null)switch(l.child.tag){case 5:h=l.child.stateNode;break;case 1:h=l.child.stateNode}a1(l,j,h)}break;case 5:var q=l.stateNode;if(h===null&&l.flags&4){h=q;var G=l.memoizedProps;switch(l.type){case"button":case"input":case"select":case"textarea":G.autoFocus&&h.focus();break;case"img":G.src&&(h.src=G.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(l.memoizedState===null){var ie=l.alternate;if(ie!==null){var fe=ie.memoizedState;if(fe!==null){var me=fe.dehydrated;me!==null&&no(me)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}tr||l.flags&512&&dg(l)}catch(he){Jt(l,l.return,he)}}if(l===o){Ce=null;break}if(h=l.sibling,h!==null){h.return=l.return,Ce=h;break}Ce=l.return}}function aE(o){for(;Ce!==null;){var l=Ce;if(l===o){Ce=null;break}var h=l.sibling;if(h!==null){h.return=l.return,Ce=h;break}Ce=l.return}}function lE(o){for(;Ce!==null;){var l=Ce;try{switch(l.tag){case 0:case 11:case 15:var h=l.return;try{Lh(4,l)}catch(G){Jt(l,h,G)}break;case 1:var m=l.stateNode;if(typeof m.componentDidMount=="function"){var _=l.return;try{m.componentDidMount()}catch(G){Jt(l,_,G)}}var A=l.return;try{dg(l)}catch(G){Jt(l,A,G)}break;case 5:var j=l.return;try{dg(l)}catch(G){Jt(l,j,G)}}}catch(G){Jt(l,l.return,G)}if(l===o){Ce=null;break}var q=l.sibling;if(q!==null){q.return=l.return,Ce=q;break}Ce=l.return}}var aN=Math.ceil,Fh=N.ReactCurrentDispatcher,pg=N.ReactCurrentOwner,as=N.ReactCurrentBatchConfig,ct=0,Sn=null,cn=null,Un=0,Hr=0,Dl=ao(0),xn=0,xu=null,ma=0,jh=0,mg=0,wu=null,Ar=null,gg=0,Nl=1/0,ki=null,Mh=!1,yg=null,po=null,Bh=!1,mo=null,Vh=0,Eu=0,vg=null,Uh=-1,$h=0;function fr(){return(ct&6)!==0?Ot():Uh!==-1?Uh:Uh=Ot()}function go(o){return(o.mode&1)===0?1:(ct&2)!==0&&Un!==0?Un&-Un:H4.transition!==null?($h===0&&($h=zc()),$h):(o=it,o!==0||(o=window.event,o=o===void 0?16:ll(o.type)),o)}function As(o,l,h,m){if(50<Eu)throw Eu=0,vg=null,Error(n(185));ra(o,h,m),((ct&2)===0||o!==Sn)&&(o===Sn&&((ct&2)===0&&(jh|=h),xn===4&&yo(o,Un)),Tr(o,m),h===1&&ct===0&&(l.mode&1)===0&&(Nl=Ot()+500,gh&&co()))}function Tr(o,l){var h=o.callbackNode;na(o,l);var m=mi(o,o===Sn?Un:0);if(m===0)h!==null&&tl(h),o.callbackNode=null,o.callbackPriority=0;else if(l=m&-m,o.callbackPriority!==l){if(h!=null&&tl(h),l===1)o.tag===0?z4(uE.bind(null,o)):Yw(uE.bind(null,o)),B4(function(){(ct&6)===0&&co()}),h=null;else{switch(Vs(m)){case 1:h=nl;break;case 4:h=Vc;break;case 16:h=Xo;break;case 536870912:h=rl;break;default:h=Xo}h=vE(h,cE.bind(null,o))}o.callbackPriority=l,o.callbackNode=h}}function cE(o,l){if(Uh=-1,$h=0,(ct&6)!==0)throw Error(n(327));var h=o.callbackNode;if(Ol()&&o.callbackNode!==h)return null;var m=mi(o,o===Sn?Un:0);if(m===0)return null;if((m&30)!==0||(m&o.expiredLanes)!==0||l)l=zh(o,m);else{l=m;var _=ct;ct|=2;var A=hE();(Sn!==o||Un!==l)&&(ki=null,Nl=Ot()+500,ya(o,l));do try{uN();break}catch(q){dE(o,q)}while(!0);j0(),Fh.current=A,ct=_,cn!==null?l=0:(Sn=null,Un=0,l=xn)}if(l!==0){if(l===2&&(_=$c(o),_!==0&&(m=_,l=_g(o,_))),l===1)throw h=xu,ya(o,0),yo(o,m),Tr(o,Ot()),h;if(l===6)yo(o,m);else{if(_=o.current.alternate,(m&30)===0&&!lN(_)&&(l=zh(o,m),l===2&&(A=$c(o),A!==0&&(m=A,l=_g(o,A))),l===1))throw h=xu,ya(o,0),yo(o,m),Tr(o,Ot()),h;switch(o.finishedWork=_,o.finishedLanes=m,l){case 0:case 1:throw Error(n(345));case 2:va(o,Ar,ki);break;case 3:if(yo(o,m),(m&130023424)===m&&(l=gg+500-Ot(),10<l)){if(mi(o,0)!==0)break;if(_=o.suspendedLanes,(_&m)!==m){fr(),o.pingedLanes|=o.suspendedLanes&_;break}o.timeoutHandle=C0(va.bind(null,o,Ar,ki),l);break}va(o,Ar,ki);break;case 4:if(yo(o,m),(m&4194240)===m)break;for(l=o.eventTimes,_=-1;0<m;){var j=31-jr(m);A=1<<j,j=l[j],j>_&&(_=j),m&=~A}if(m=_,m=Ot()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*aN(m/1960))-m,10<m){o.timeoutHandle=C0(va.bind(null,o,Ar,ki),m);break}va(o,Ar,ki);break;case 5:va(o,Ar,ki);break;default:throw Error(n(329))}}}return Tr(o,Ot()),o.callbackNode===h?cE.bind(null,o):null}function _g(o,l){var h=wu;return o.current.memoizedState.isDehydrated&&(ya(o,l).flags|=256),o=zh(o,l),o!==2&&(l=Ar,Ar=h,l!==null&&xg(l)),o}function xg(o){Ar===null?Ar=o:Ar.push.apply(Ar,o)}function lN(o){for(var l=o;;){if(l.flags&16384){var h=l.updateQueue;if(h!==null&&(h=h.stores,h!==null))for(var m=0;m<h.length;m++){var _=h[m],A=_.getSnapshot;_=_.value;try{if(!_s(A(),_))return!1}catch{return!1}}}if(h=l.child,l.subtreeFlags&16384&&h!==null)h.return=l,l=h;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function yo(o,l){for(l&=~mg,l&=~jh,o.suspendedLanes|=l,o.pingedLanes&=~l,o=o.expirationTimes;0<l;){var h=31-jr(l),m=1<<h;o[h]=-1,l&=~m}}function uE(o){if((ct&6)!==0)throw Error(n(327));Ol();var l=mi(o,0);if((l&1)===0)return Tr(o,Ot()),null;var h=zh(o,l);if(o.tag!==0&&h===2){var m=$c(o);m!==0&&(l=m,h=_g(o,m))}if(h===1)throw h=xu,ya(o,0),yo(o,l),Tr(o,Ot()),h;if(h===6)throw Error(n(345));return o.finishedWork=o.current.alternate,o.finishedLanes=l,va(o,Ar,ki),Tr(o,Ot()),null}function wg(o,l){var h=ct;ct|=1;try{return o(l)}finally{ct=h,ct===0&&(Nl=Ot()+500,gh&&co())}}function ga(o){mo!==null&&mo.tag===0&&(ct&6)===0&&Ol();var l=ct;ct|=1;var h=as.transition,m=it;try{if(as.transition=null,it=1,o)return o()}finally{it=m,as.transition=h,ct=l,(ct&6)===0&&co()}}function Eg(){Hr=Dl.current,Ft(Dl)}function ya(o,l){o.finishedWork=null,o.finishedLanes=0;var h=o.timeoutHandle;if(h!==-1&&(o.timeoutHandle=-1,M4(h)),cn!==null)for(h=cn.return;h!==null;){var m=h;switch(D0(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&ph();break;case 3:Il(),Ft(wr),Ft(Xn),q0();break;case 5:z0(m);break;case 4:Il();break;case 13:Ft(qt);break;case 19:Ft(qt);break;case 10:M0(m.type._context);break;case 22:case 23:Eg()}h=h.return}if(Sn=o,cn=o=vo(o.current,null),Un=Hr=l,xn=0,xu=null,mg=jh=ma=0,Ar=wu=null,ha!==null){for(l=0;l<ha.length;l++)if(h=ha[l],m=h.interleaved,m!==null){h.interleaved=null;var _=m.next,A=h.pending;if(A!==null){var j=A.next;A.next=_,m.next=j}h.pending=m}ha=null}return o}function dE(o,l){do{var h=cn;try{if(j0(),Ch.current=Ph,Sh){for(var m=Wt.memoizedState;m!==null;){var _=m.queue;_!==null&&(_.pending=null),m=m.next}Sh=!1}if(pa=0,Cn=_n=Wt=null,pu=!1,mu=0,pg.current=null,h===null||h.return===null){xn=1,xu=l,cn=null;break}e:{var A=o,j=h.return,q=h,G=l;if(l=Un,q.flags|=32768,G!==null&&typeof G=="object"&&typeof G.then=="function"){var ie=G,fe=q,me=fe.tag;if((fe.mode&1)===0&&(me===0||me===11||me===15)){var he=fe.alternate;he?(fe.updateQueue=he.updateQueue,fe.memoizedState=he.memoizedState,fe.lanes=he.lanes):(fe.updateQueue=null,fe.memoizedState=null)}var Ae=F1(j);if(Ae!==null){Ae.flags&=-257,j1(Ae,j,q,A,l),Ae.mode&1&&L1(A,ie,l),l=Ae,G=ie;var Ie=l.updateQueue;if(Ie===null){var Re=new Set;Re.add(G),l.updateQueue=Re}else Ie.add(G);break e}else{if((l&1)===0){L1(A,ie,l),bg();break e}G=Error(n(426))}}else if(zt&&q.mode&1){var rn=F1(j);if(rn!==null){(rn.flags&65536)===0&&(rn.flags|=256),j1(rn,j,q,A,l),L0(Pl(G,q));break e}}A=G=Pl(G,q),xn!==4&&(xn=2),wu===null?wu=[A]:wu.push(A),A=j;do{switch(A.tag){case 3:A.flags|=65536,l&=-l,A.lanes|=l;var X=N1(A,G,l);o1(A,X);break e;case 1:q=G;var Y=A.type,ne=A.stateNode;if((A.flags&128)===0&&(typeof Y.getDerivedStateFromError=="function"||ne!==null&&typeof ne.componentDidCatch=="function"&&(po===null||!po.has(ne)))){A.flags|=65536,l&=-l,A.lanes|=l;var ye=O1(A,q,l);o1(A,ye);break e}}A=A.return}while(A!==null)}pE(h)}catch(De){l=De,cn===h&&h!==null&&(cn=h=h.return);continue}break}while(!0)}function hE(){var o=Fh.current;return Fh.current=Ph,o===null?Ph:o}function bg(){(xn===0||xn===3||xn===2)&&(xn=4),Sn===null||(ma&268435455)===0&&(jh&268435455)===0||yo(Sn,Un)}function zh(o,l){var h=ct;ct|=2;var m=hE();(Sn!==o||Un!==l)&&(ki=null,ya(o,l));do try{cN();break}catch(_){dE(o,_)}while(!0);if(j0(),ct=h,Fh.current=m,cn!==null)throw Error(n(261));return Sn=null,Un=0,xn}function cN(){for(;cn!==null;)fE(cn)}function uN(){for(;cn!==null&&!Jo();)fE(cn)}function fE(o){var l=yE(o.alternate,o,Hr);o.memoizedProps=o.pendingProps,l===null?pE(o):cn=l,pg.current=null}function pE(o){var l=o;do{var h=l.alternate;if(o=l.return,(l.flags&32768)===0){if(h=nN(h,l,Hr),h!==null){cn=h;return}}else{if(h=rN(h,l),h!==null){h.flags&=32767,cn=h;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{xn=6,cn=null;return}}if(l=l.sibling,l!==null){cn=l;return}cn=l=o}while(l!==null);xn===0&&(xn=5)}function va(o,l,h){var m=it,_=as.transition;try{as.transition=null,it=1,dN(o,l,h,m)}finally{as.transition=_,it=m}return null}function dN(o,l,h,m){do Ol();while(mo!==null);if((ct&6)!==0)throw Error(n(327));h=o.finishedWork;var _=o.finishedLanes;if(h===null)return null;if(o.finishedWork=null,o.finishedLanes=0,h===o.current)throw Error(n(177));o.callbackNode=null,o.callbackPriority=0;var A=h.lanes|h.childLanes;if(u0(o,A),o===Sn&&(cn=Sn=null,Un=0),(h.subtreeFlags&2064)===0&&(h.flags&2064)===0||Bh||(Bh=!0,vE(Xo,function(){return Ol(),null})),A=(h.flags&15990)!==0,(h.subtreeFlags&15990)!==0||A){A=as.transition,as.transition=null;var j=it;it=1;var q=ct;ct|=4,pg.current=null,iN(o,h),sE(h,o),R4(A0),vi=!!b0,A0=b0=null,o.current=h,oN(h),pi(),ct=q,it=j,as.transition=A}else o.current=h;if(Bh&&(Bh=!1,mo=o,Vh=_),A=o.pendingLanes,A===0&&(po=null),Qd(h.stateNode),Tr(o,Ot()),l!==null)for(m=o.onRecoverableError,h=0;h<l.length;h++)_=l[h],m(_.value,{componentStack:_.stack,digest:_.digest});if(Mh)throw Mh=!1,o=yg,yg=null,o;return(Vh&1)!==0&&o.tag!==0&&Ol(),A=o.pendingLanes,(A&1)!==0?o===vg?Eu++:(Eu=0,vg=o):Eu=0,co(),null}function Ol(){if(mo!==null){var o=Vs(Vh),l=as.transition,h=it;try{if(as.transition=null,it=16>o?16:o,mo===null)var m=!1;else{if(o=mo,mo=null,Vh=0,(ct&6)!==0)throw Error(n(331));var _=ct;for(ct|=4,Ce=o.current;Ce!==null;){var A=Ce,j=A.child;if((Ce.flags&16)!==0){var q=A.deletions;if(q!==null){for(var G=0;G<q.length;G++){var ie=q[G];for(Ce=ie;Ce!==null;){var fe=Ce;switch(fe.tag){case 0:case 11:case 15:_u(8,fe,A)}var me=fe.child;if(me!==null)me.return=fe,Ce=me;else for(;Ce!==null;){fe=Ce;var he=fe.sibling,Ae=fe.return;if(Z1(fe),fe===ie){Ce=null;break}if(he!==null){he.return=Ae,Ce=he;break}Ce=Ae}}}var Ie=A.alternate;if(Ie!==null){var Re=Ie.child;if(Re!==null){Ie.child=null;do{var rn=Re.sibling;Re.sibling=null,Re=rn}while(Re!==null)}}Ce=A}}if((A.subtreeFlags&2064)!==0&&j!==null)j.return=A,Ce=j;else e:for(;Ce!==null;){if(A=Ce,(A.flags&2048)!==0)switch(A.tag){case 0:case 11:case 15:_u(9,A,A.return)}var X=A.sibling;if(X!==null){X.return=A.return,Ce=X;break e}Ce=A.return}}var Y=o.current;for(Ce=Y;Ce!==null;){j=Ce;var ne=j.child;if((j.subtreeFlags&2064)!==0&&ne!==null)ne.return=j,Ce=ne;else e:for(j=Y;Ce!==null;){if(q=Ce,(q.flags&2048)!==0)try{switch(q.tag){case 0:case 11:case 15:Lh(9,q)}}catch(De){Jt(q,q.return,De)}if(q===j){Ce=null;break e}var ye=q.sibling;if(ye!==null){ye.return=q.return,Ce=ye;break e}Ce=q.return}}if(ct=_,co(),Fr&&typeof Fr.onPostCommitFiberRoot=="function")try{Fr.onPostCommitFiberRoot(Zo,o)}catch{}m=!0}return m}finally{it=h,as.transition=l}}return!1}function mE(o,l,h){l=Pl(h,l),l=N1(o,l,1),o=ho(o,l,1),l=fr(),o!==null&&(ra(o,1,l),Tr(o,l))}function Jt(o,l,h){if(o.tag===3)mE(o,o,h);else for(;l!==null;){if(l.tag===3){mE(l,o,h);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(po===null||!po.has(m))){o=Pl(h,o),o=O1(l,o,1),l=ho(l,o,1),o=fr(),l!==null&&(ra(l,1,o),Tr(l,o));break}}l=l.return}}function hN(o,l,h){var m=o.pingCache;m!==null&&m.delete(l),l=fr(),o.pingedLanes|=o.suspendedLanes&h,Sn===o&&(Un&h)===h&&(xn===4||xn===3&&(Un&130023424)===Un&&500>Ot()-gg?ya(o,0):mg|=h),Tr(o,l)}function gE(o,l){l===0&&((o.mode&1)===0?l=1:(l=Zi,Zi<<=1,(Zi&130023424)===0&&(Zi=4194304)));var h=fr();o=Ti(o,l),o!==null&&(ra(o,l,h),Tr(o,h))}function fN(o){var l=o.memoizedState,h=0;l!==null&&(h=l.retryLane),gE(o,h)}function pN(o,l){var h=0;switch(o.tag){case 13:var m=o.stateNode,_=o.memoizedState;_!==null&&(h=_.retryLane);break;case 19:m=o.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(l),gE(o,h)}var yE;yE=function(o,l,h){if(o!==null)if(o.memoizedProps!==l.pendingProps||wr.current)br=!0;else{if((o.lanes&h)===0&&(l.flags&128)===0)return br=!1,tN(o,l,h);br=(o.flags&131072)!==0}else br=!1,zt&&(l.flags&1048576)!==0&&Qw(l,vh,l.index);switch(l.lanes=0,l.tag){case 2:var m=l.type;Nh(o,l),o=l.pendingProps;var _=El(l,Xn.current);kl(l,h),_=K0(null,l,m,o,_,h);var A=Y0();return l.flags|=1,typeof _=="object"&&_!==null&&typeof _.render=="function"&&_.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,Er(m)?(A=!0,mh(l)):A=!1,l.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,U0(l),_.updater=Rh,l.stateNode=_,_._reactInternals=l,tg(l,m,o,h),l=sg(null,l,m,!0,A,h)):(l.tag=0,zt&&A&&R0(l),hr(null,l,_,h),l=l.child),l;case 16:m=l.elementType;e:{switch(Nh(o,l),o=l.pendingProps,_=m._init,m=_(m._payload),l.type=m,_=l.tag=gN(m),o=ws(m,o),_){case 0:l=rg(null,l,m,o,h);break e;case 1:l=z1(null,l,m,o,h);break e;case 11:l=M1(null,l,m,o,h);break e;case 14:l=B1(null,l,m,ws(m.type,o),h);break e}throw Error(n(306,m,""))}return l;case 0:return m=l.type,_=l.pendingProps,_=l.elementType===m?_:ws(m,_),rg(o,l,m,_,h);case 1:return m=l.type,_=l.pendingProps,_=l.elementType===m?_:ws(m,_),z1(o,l,m,_,h);case 3:e:{if(H1(l),o===null)throw Error(n(387));m=l.pendingProps,A=l.memoizedState,_=A.element,i1(o,l),Ah(l,m,null,h);var j=l.memoizedState;if(m=j.element,A.isDehydrated)if(A={element:m,isDehydrated:!1,cache:j.cache,pendingSuspenseBoundaries:j.pendingSuspenseBoundaries,transitions:j.transitions},l.updateQueue.baseState=A,l.memoizedState=A,l.flags&256){_=Pl(Error(n(423)),l),l=q1(o,l,m,h,_);break e}else if(m!==_){_=Pl(Error(n(424)),l),l=q1(o,l,m,h,_);break e}else for(zr=oo(l.stateNode.containerInfo.firstChild),$r=l,zt=!0,xs=null,h=r1(l,null,m,h),l.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling;else{if(Tl(),m===_){l=Si(o,l,h);break e}hr(o,l,m,h)}l=l.child}return l;case 5:return l1(l),o===null&&O0(l),m=l.type,_=l.pendingProps,A=o!==null?o.memoizedProps:null,j=_.children,T0(m,_)?j=null:A!==null&&T0(m,A)&&(l.flags|=32),$1(o,l),hr(o,l,j,h),l.child;case 6:return o===null&&O0(l),null;case 13:return W1(o,l,h);case 4:return $0(l,l.stateNode.containerInfo),m=l.pendingProps,o===null?l.child=Cl(l,null,m,h):hr(o,l,m,h),l.child;case 11:return m=l.type,_=l.pendingProps,_=l.elementType===m?_:ws(m,_),M1(o,l,m,_,h);case 7:return hr(o,l,l.pendingProps,h),l.child;case 8:return hr(o,l,l.pendingProps.children,h),l.child;case 12:return hr(o,l,l.pendingProps.children,h),l.child;case 10:e:{if(m=l.type._context,_=l.pendingProps,A=l.memoizedProps,j=_.value,Pt(wh,m._currentValue),m._currentValue=j,A!==null)if(_s(A.value,j)){if(A.children===_.children&&!wr.current){l=Si(o,l,h);break e}}else for(A=l.child,A!==null&&(A.return=l);A!==null;){var q=A.dependencies;if(q!==null){j=A.child;for(var G=q.firstContext;G!==null;){if(G.context===m){if(A.tag===1){G=Ci(-1,h&-h),G.tag=2;var ie=A.updateQueue;if(ie!==null){ie=ie.shared;var fe=ie.pending;fe===null?G.next=G:(G.next=fe.next,fe.next=G),ie.pending=G}}A.lanes|=h,G=A.alternate,G!==null&&(G.lanes|=h),B0(A.return,h,l),q.lanes|=h;break}G=G.next}}else if(A.tag===10)j=A.type===l.type?null:A.child;else if(A.tag===18){if(j=A.return,j===null)throw Error(n(341));j.lanes|=h,q=j.alternate,q!==null&&(q.lanes|=h),B0(j,h,l),j=A.sibling}else j=A.child;if(j!==null)j.return=A;else for(j=A;j!==null;){if(j===l){j=null;break}if(A=j.sibling,A!==null){A.return=j.return,j=A;break}j=j.return}A=j}hr(o,l,_.children,h),l=l.child}return l;case 9:return _=l.type,m=l.pendingProps.children,kl(l,h),_=is(_),m=m(_),l.flags|=1,hr(o,l,m,h),l.child;case 14:return m=l.type,_=ws(m,l.pendingProps),_=ws(m.type,_),B1(o,l,m,_,h);case 15:return V1(o,l,l.type,l.pendingProps,h);case 17:return m=l.type,_=l.pendingProps,_=l.elementType===m?_:ws(m,_),Nh(o,l),l.tag=1,Er(m)?(o=!0,mh(l)):o=!1,kl(l,h),R1(l,m,_),tg(l,m,_,h),sg(null,l,m,!0,o,h);case 19:return K1(o,l,h);case 22:return U1(o,l,h)}throw Error(n(156,l.tag))};function vE(o,l){return Bc(o,l)}function mN(o,l,h,m){this.tag=o,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ls(o,l,h,m){return new mN(o,l,h,m)}function Ag(o){return o=o.prototype,!(!o||!o.isReactComponent)}function gN(o){if(typeof o=="function")return Ag(o)?1:0;if(o!=null){if(o=o.$$typeof,o===L)return 11;if(o===H)return 14}return 2}function vo(o,l){var h=o.alternate;return h===null?(h=ls(o.tag,l,o.key,o.mode),h.elementType=o.elementType,h.type=o.type,h.stateNode=o.stateNode,h.alternate=o,o.alternate=h):(h.pendingProps=l,h.type=o.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=o.flags&14680064,h.childLanes=o.childLanes,h.lanes=o.lanes,h.child=o.child,h.memoizedProps=o.memoizedProps,h.memoizedState=o.memoizedState,h.updateQueue=o.updateQueue,l=o.dependencies,h.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},h.sibling=o.sibling,h.index=o.index,h.ref=o.ref,h}function Hh(o,l,h,m,_,A){var j=2;if(m=o,typeof o=="function")Ag(o)&&(j=1);else if(typeof o=="string")j=5;else e:switch(o){case D:return _a(h.children,_,A,l);case I:j=8,_|=8;break;case B:return o=ls(12,h,l,_|2),o.elementType=B,o.lanes=A,o;case M:return o=ls(13,h,l,_),o.elementType=M,o.lanes=A,o;case se:return o=ls(19,h,l,_),o.elementType=se,o.lanes=A,o;case le:return qh(h,_,A,l);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case O:j=10;break e;case F:j=9;break e;case L:j=11;break e;case H:j=14;break e;case J:j=16,m=null;break e}throw Error(n(130,o==null?o:typeof o,""))}return l=ls(j,h,l,_),l.elementType=o,l.type=m,l.lanes=A,l}function _a(o,l,h,m){return o=ls(7,o,m,l),o.lanes=h,o}function qh(o,l,h,m){return o=ls(22,o,m,l),o.elementType=le,o.lanes=h,o.stateNode={isHidden:!1},o}function Tg(o,l,h){return o=ls(6,o,null,l),o.lanes=h,o}function Cg(o,l,h){return l=ls(4,o.children!==null?o.children:[],o.key,l),l.lanes=h,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}function yN(o,l,h,m,_){this.tag=l,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Hc(0),this.expirationTimes=Hc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hc(0),this.identifierPrefix=m,this.onRecoverableError=_,this.mutableSourceEagerHydrationData=null}function Sg(o,l,h,m,_,A,j,q,G){return o=new yN(o,l,h,q,G),l===1?(l=1,A===!0&&(l|=8)):l=0,A=ls(3,null,null,l),o.current=A,A.stateNode=o,A.memoizedState={element:m,isDehydrated:h,cache:null,transitions:null,pendingSuspenseBoundaries:null},U0(A),o}function vN(o,l,h){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$,key:m==null?null:""+m,children:o,containerInfo:l,implementation:h}}function _E(o){if(!o)return lo;o=o._reactInternals;e:{if(Qn(o)!==o||o.tag!==1)throw Error(n(170));var l=o;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(Er(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(n(171))}if(o.tag===1){var h=o.type;if(Er(h))return Gw(o,h,l)}return l}function xE(o,l,h,m,_,A,j,q,G){return o=Sg(h,m,!0,o,_,A,j,q,G),o.context=_E(null),h=o.current,m=fr(),_=go(h),A=Ci(m,_),A.callback=l??null,ho(h,A,_),o.current.lanes=_,ra(o,_,m),Tr(o,m),o}function Wh(o,l,h,m){var _=l.current,A=fr(),j=go(_);return h=_E(h),l.context===null?l.context=h:l.pendingContext=h,l=Ci(A,j),l.payload={element:o},m=m===void 0?null:m,m!==null&&(l.callback=m),o=ho(_,l,j),o!==null&&(As(o,_,j,A),bh(o,_,j)),j}function Gh(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return o.child.stateNode;default:return o.child.stateNode}}function wE(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var h=o.retryLane;o.retryLane=h!==0&&h<l?h:l}}function kg(o,l){wE(o,l),(o=o.alternate)&&wE(o,l)}function _N(){return null}var EE=typeof reportError=="function"?reportError:function(o){};function Ig(o){this._internalRoot=o}Kh.prototype.render=Ig.prototype.render=function(o){var l=this._internalRoot;if(l===null)throw Error(n(409));Wh(o,l,null,null)},Kh.prototype.unmount=Ig.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var l=o.containerInfo;ga(function(){Wh(null,o,null,null)}),l[wi]=null}};function Kh(o){this._internalRoot=o}Kh.prototype.unstable_scheduleHydration=function(o){if(o){var l=Kc();o={blockedOn:null,target:o,priority:l};for(var h=0;h<Mr.length&&l!==0&&l<Mr[h].priority;h++);Mr.splice(h,0,o),h===0&&ol(o)}};function Pg(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function Yh(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function bE(){}function xN(o,l,h,m,_){if(_){if(typeof m=="function"){var A=m;m=function(){var ie=Gh(j);A.call(ie)}}var j=xE(l,m,o,0,null,!1,!1,"",bE);return o._reactRootContainer=j,o[wi]=j.current,ou(o.nodeType===8?o.parentNode:o),ga(),j}for(;_=o.lastChild;)o.removeChild(_);if(typeof m=="function"){var q=m;m=function(){var ie=Gh(G);q.call(ie)}}var G=Sg(o,0,!1,null,null,!1,!1,"",bE);return o._reactRootContainer=G,o[wi]=G.current,ou(o.nodeType===8?o.parentNode:o),ga(function(){Wh(l,G,h,m)}),G}function Qh(o,l,h,m,_){var A=h._reactRootContainer;if(A){var j=A;if(typeof _=="function"){var q=_;_=function(){var G=Gh(j);q.call(G)}}Wh(l,j,o,_)}else j=xN(h,l,o,_,m);return Gh(j)}Wc=function(o){switch(o.tag){case 3:var l=o.stateNode;if(l.current.memoizedState.isDehydrated){var h=pt(l.pendingLanes);h!==0&&(qc(l,h|1),Tr(l,Ot()),(ct&6)===0&&(Nl=Ot()+500,co()))}break;case 13:ga(function(){var m=Ti(o,1);if(m!==null){var _=fr();As(m,o,1,_)}}),kg(o,1)}},sl=function(o){if(o.tag===13){var l=Ti(o,134217728);if(l!==null){var h=fr();As(l,o,134217728,h)}kg(o,134217728)}},Gc=function(o){if(o.tag===13){var l=go(o),h=Ti(o,l);if(h!==null){var m=fr();As(h,o,l,m)}kg(o,l)}},Kc=function(){return it},Yc=function(o,l){var h=it;try{return it=o,l()}finally{it=h}},We=function(o,l,h){switch(l){case"input":if(vr(o,h),l=h.name,h.type==="radio"&&l!=null){for(h=o;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll("input[name="+JSON.stringify(""+l)+'][type="radio"]'),l=0;l<h.length;l++){var m=h[l];if(m!==o&&m.form===o.form){var _=fh(m);if(!_)throw Error(n(90));Nn(m),vr(m,_)}}}break;case"textarea":On(o,h);break;case"select":l=h.value,l!=null&&Nt(o,!!h.multiple,l,!1)}},xr=wg,Lr=ga;var wN={usingClientEntryPoint:!1,Events:[cu,xl,fh,bt,tt,wg]},bu={findFiberByHostInstance:la,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},EN={bundleType:bu.bundleType,version:bu.version,rendererPackageName:bu.rendererPackageName,rendererConfig:bu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:N.ReactCurrentDispatcher,findHostInstanceByFiber:function(o){return o=fi(o),o===null?null:o.stateNode},findFiberByHostInstance:bu.findFiberByHostInstance||_N,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{Zo=Jh.inject(EN),Fr=Jh}catch{}}return Cr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=wN,Cr.createPortal=function(o,l){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Pg(l))throw Error(n(200));return vN(o,l,null,h)},Cr.createRoot=function(o,l){if(!Pg(o))throw Error(n(299));var h=!1,m="",_=EE;return l!=null&&(l.unstable_strictMode===!0&&(h=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onRecoverableError!==void 0&&(_=l.onRecoverableError)),l=Sg(o,1,!1,null,null,h,!1,m,_),o[wi]=l.current,ou(o.nodeType===8?o.parentNode:o),new Ig(l)}
41,Cr.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=fi(l),o=o===null?null:o.stateNode,o},Cr.flushSync=function(o){return ga(o)},Cr.hydrate=function(o,l,h){if(!Yh(l))throw Error(n(200));return Qh(null,o,l,!0,h)},Cr.hydrateRoot=function(o,l,h){if(!Pg(o))throw Error(n(405));var m=h!=null&&h.hydratedSources||null,_=!1,A="",j=EE;if(h!=null&&(h.unstable_strictMode===!0&&(_=!0),h.identifierPrefix!==void 0&&(A=h.identifierPrefix),h.onRecoverableError!==void 0&&(j=h.onRecoverableError)),l=xE(l,null,o,1,h??null,_,!1,A,j),o[wi]=l.current,ou(o),m)for(o=0;o<m.length;o++)h=m[o],_=h._getVersion,_=_(h._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[h,_]:l.mutableSourceEagerHydrationData.push(h,_);return new Kh(l)},Cr.render=function(o,l,h){if(!Yh(l))throw Error(n(200));return Qh(null,o,l,!1,h)},Cr.unmountComponentAtNode=function(o){if(!Yh(o))throw Error(n(40));return o._reactRootContainer?(ga(function(){Qh(null,null,o,!1,function(){o._reactRootContainer=null,o[wi]=null})}),!0):!1},Cr.unstable_batchedUpdates=wg,Cr.unstable_renderSubtreeIntoContainer=function(o,l,h,m){if(!Yh(h))throw Error(n(200));if(o==null||o._reactInternals===void 0)throw Error(n(38));return Qh(o,l,h,!1,m)},Cr.version="18.3.1-next-f1338f8080-20240426",Cr}var RE;function IS(){if(RE)return Ng.exports;RE=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch{}}return t(),Ng.exports=IN(),Ng.exports}var DE;function PN(){if(DE)return Xh;DE=1;var t=IS();return Xh.createRoot=t.createRoot,Xh.hydrateRoot=t.hydrateRoot,Xh}var RN=PN();const DN=xc(RN);/**
42 * react-router v7.18.3
43 *
44 * Copyright (c) Remix Software Inc.
45 *
46 * This source code is licensed under the MIT license found in the
47 * LICENSE.md file in the root directory of this source tree.
48 *
49 * @license MIT
50 */var Qv=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,PS=/^[\\/]{2}/;function NN(t,e){return e+t.replace(/\\/g,"/")}var NE="popstate";function OE(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function ON(t={}){function e(r,s){let i=s.state?.masked,{pathname:a,search:c,hash:u}=i||r.location;return jy("",{pathname:a,search:c,hash:u},s.state&&s.state.usr||null,s.state&&s.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:ja(s)}return FN(e,n,null,t)}function Ht(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function ps(t,e){if(!t)try{throw new Error(e)}catch{}}function LN(){return Math.random().toString(36).substring(2,10)}function LE(t,e){return{usr:t.state,key:t.key,idx:e,masked:t.mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function jy(t,e,n=null,r,s){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?wc(e):e,state:n,key:e&&e.key||r||LN(),mask:s}}function ja({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function wc(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substring(r),t=t.substring(0,r)),t&&(e.pathname=t)}return e}function FN(t,e,n,r={}){let{window:s=document.defaultView,v5Compat:i=!1}=r,a=s.history,c="POP",u=null,d=f();d==null&&(d=0,a.replaceState({...a.state,idx:d},""));function f(){return(a.state||{idx:null}).idx}function g(){c="POP";let w=f(),R=w==null?null:w-d;d=w,u&&u({action:c,location:E.location,delta:R})}function y(w,R){c="PUSH";let C=OE(w)?w:jy(E.location,w,R);d=f()+1;let k=LE(C,d),N=E.createHref(C.mask||C);try{a.pushState(k,"",N)}catch(V){if(V instanceof DOMException&&V.name==="DataCloneError")throw V;s.location.assign(N)}i&&u&&u({action:c,location:E.location,delta:1})}function x(w,R){c="REPLACE";let C=OE(w)?w:jy(E.location,w,R);d=f();let k=LE(C,d),N=E.createHref(C.mask||C);a.replaceState(k,"",N),i&&u&&u({action:c,location:E.location,delta:0})}function b(w){return jN(s,w)}let E={get action(){return c},get location(){return t(s,a)},listen(w){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(NE,g),u=w,()=>{s.removeEventListener(NE,g),u=null}},createHref(w){return e(s,w)},createURL:b,encodeLocation(w){let R=b(w);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:y,replace:x,go(w){return a.go(w)}};return E}function jN(t,e,n=!1){let r="http://localhost";t&&(r=t.location.origin!=="null"?t.location.origin:t.location.href),Ht(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:ja(e);return s=s.replace(/ $/,"%20"),!n&&PS.test(s)&&(s=r+s),new URL(s,r)}function RS(t,e,n="/"){return MN(t,e,n,!1)}function MN(t,e,n,r,s){let i=typeof e=="string"?wc(e):e,a=Ui(i.pathname||"/",n);if(a==null)return null;
50let c=BN(t),u=null,d=QN(a);for(let f=0;u==null&&f<c.length;++f)u=YN(c[f],d,r);return u}function BN(t){let e=DS(t);return VN(e),e}function DS(t,e=[],n=[],r="",s=!1){let i=(a,c,u=s,d)=>{let f={relativePath:d===void 0?a.path||"":d,caseSensitive:a.caseSensitive===!0,childrenIndex:c,route:a};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(r)&&u)return;Ht(f.relativePath.startsWith(r),`Absolute route path "${f.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(r.length)}let g=Rs([r,f.relativePath]),y=n.concat(f);a.children&&a.children.length>0&&(Ht(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),DS(a.children,e,y,g,u)),!(a.path==null&&!a.index)&&e.push({path:g,score:GN(g,a.index),routesMeta:y.map((x,b)=>{let[E,w]=LS(x.relativePath,x.caseSensitive,b===y.length-1);return{...x,matcher:E,compiledParams:w}})})};return t.forEach((a,c)=>{if(a.path===""||!a.path?.includes("?"))i(a,c);else for(let u of NS(a.path))i(a,c,!0,u)}),e}function NS(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let a=NS(r.join("/")),c=[];return c.push(...a.map(u=>u===""?i:[i,u].join("/"))),s&&c.push(...a),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function VN(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:KN(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var UN=/^:[\w-]+$/,$N=3,zN=2,HN=1,qN=10,WN=-2,FE=t=>t==="*";function GN(t,e){let n=t.split("/"),r=n.length;return n.some(FE)&&(r+=WN),e&&(r+=zN),n.filter(s=>!FE(s)).reduce((s,i)=>s+(UN.test(i)?$N:i===""?HN:qN),r)}function KN(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function YN(t,e,n=!1){let{routesMeta:r}=t,s={},i="/",a=[];for(let c=0;c<r.length;++c){let u=r[c],d=c===r.length-1,f=i==="/"?e:e.slice(i.length)||"/",g={path:u.relativePath,caseSensitive:u.caseSensitive,end:d},y=u.matcher&&u.compiledParams?OS(g,f,u.matcher,u.compiledParams):Op(g,f),x=u.route;if(!y&&d&&n&&!r[r.length-1].route.index&&(y=Op({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},f)),!y)return null;
50Object.assign(s,y.params),a.push({params:s,pathname:Rs([i,y.pathname]),pathnameBase:ZN(Rs([i,y.pathnameBase])),route:x}),y.pathnameBase!=="/"&&(i=Rs([i,y.pathnameBase]))}return a}function Op(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=LS(t.path,t.caseSensitive,t.end);return OS(t,e,n,r)}function OS(t,e,n,r){let s=e.match(n);if(!s)return null;let i=s[0],a=lc(i,1),c=s.slice(1);return{params:r.reduce((d,{paramName:f,isOptional:g},y)=>{if(f==="*"){let b=c[y]||"";a=lc(i.slice(0,i.length-b.length),1)}const x=c[y];return g&&!x?d[f]=void 0:d[f]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:a,pattern:t}}function LS(t,e=!1,n=!0){ps(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,c,u,d,f)=>{if(r.push({paramName:c,isOptional:u!=null}),u){let g=f.charAt(d+a.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function QN(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return ps(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Ui(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function JN(t,e="/"){let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?wc(t):t,i;return n?(n=FS(n),n.startsWith("/")||n.startsWith("\\")?i=jE(n.substring(1),"/"):i=jE(n,e)):i=e,{pathname:i,search:e3(r),hash:t3(s)}}function jE(t,e){let n=lc(e).split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Fg(t,e,n,r){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}].  Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function XN(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Jv(t){let e=XN(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function vm(t,e,n,r=!1){let s;typeof t=="string"?s=wc(t):(s={...t},Ht(!s.pathname||!s.pathname.includes("?"),Fg("?","pathname","search",s)),Ht(!s.pathname||!s.pathname.includes("#"),Fg("#","pathname","hash",s)),Ht(!s.search||!s.search.includes("#"),Fg("#","search","hash",s)));let i=t===""||s.pathname==="",a=i?"/":s.pathname,c;if(a==null)c=n;else{let g=e.length-1;if(!r&&a.startsWith("..")){let y=a.split("/");for(;y[0]==="..";)y.shift(),g-=1;s.pathname=y.join("/")}c=g>=0?e[g]:"/"}let u=JN(s,c),d=a&&a!=="/"&&a.endsWith("/"),f=(i||a===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(d||f)&&(u.pathname+="/"),u}var FS=t=>t.replace(/[\\/]{2,}/g,"/"),Rs=t=>FS(t.join("/"));function lc(t,e=0){let n=t.length;for(;n>e&&t.charCodeAt(n-1)===47;)n--;return n===t.length?t:t.slice(0,n)}var ZN=t=>lc(t).replace(/^\/*/,"/"),e3=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,t3=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,n3=class{constructor(t,e,n,r=!1){this.status=t,this.statusText=e||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function r3(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function s3(t){let e=t.map(n=>n.route.path).filter(Boolean);return Rs(e)||"/"}var jS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function MS(t,e){let n=t;
50if(typeof n!="string"||!Qv.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(jS)try{let i=new URL(window.location.href),a=PS.test(n)?new URL(NN(n,i.protocol)):new URL(n),c=Ui(a.pathname,e);a.origin===i.origin&&c!=null?n=c+a.search+a.hash:s=!0}catch{ps(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ME=new URL("http://localhost");function Xv(t){if(t.createURL)return t.createURL("/");try{return new URL(t.createHref("/"),ME)}catch{return ME}}function jg(t,e){return t.origin===e.origin&&(t.origin!=="null"||t.protocol===e.protocol&&t.host===e.host)}function i3(t,e){if(t.startsWith("//"))return!0;let n=e.protocol.toLowerCase();return t.toLowerCase().startsWith(n)?e.host===""||t.slice(n.length).startsWith("//"):!1}function Zv(t,e,n,r){let s=null;try{s=t==null?null:new URL(t,n)}catch{}let i=new URL(e,n),a=s!=null&&!jg(s,n),c=!jg(i,n);if(r==="reject"){if(a||c)throw new Error("External navigation is not allowed")}else if(c&&(s==null||!i3(t,s)||!jg(s,i)))throw new Error("External navigation is not allowed")}var BS=["POST","PUT","PATCH","DELETE"];new Set(BS);var o3=["GET",...BS];new Set(o3);var a3=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function l3(t){try{return a3.includes(new URL(t).protocol)}catch{return!1}}var Ec=S.createContext(null);Ec.displayName="DataRouter";var _m=S.createContext(null);_m.displayName="DataRouterState";var VS=S.createContext(!1);function c3(){return S.useContext(VS)}var US=S.createContext({isTransitioning:!1});US.displayName="ViewTransition";var u3=S.createContext(new Map);u3.displayName="Fetchers";var d3=S.createContext(null);d3.displayName="Await";var Zr=S.createContext(null);Zr.displayName="Navigation";var Sd=S.createContext(null);Sd.displayName="Location";var Os=S.createContext({outlet:null,matches:[],isDataRoute:!1});Os.displayName="Route";var e_=S.createContext(null);e_.displayName="RouteError";var $S="REACT_ROUTER_ERROR",h3="REDIRECT",f3="ROUTE_ERROR_RESPONSE";function p3(t){if(t.startsWith(`${$S}:${h3}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function m3(t){if(t.startsWith(`${$S}:${f3}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new n3(e.status,e.statusText,e.data)}catch{}}function g3(t,{relative:e}={}){Ht(bc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=S.useContext(Zr),{hash:s,pathname:i,search:a}=kd(t,{relative:e}),c=i;return n!=="/"&&(c=i==="/"?n:Rs([n,i])),r.createHref({pathname:c,search:a,hash:s})}function bc(){return S.useContext(Sd)!=null}function cr(){return Ht(bc(),"useLocation() may be used only in the context of a <Router> component."),S.useContext(Sd).location}var zS="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function HS(t){S.useContext(Zr).static||S.useLayoutEffect(t)}function Ac(){let{isDataRoute:t}=S.useContext(Os);return t?I3():y3()}function y3(){Ht(bc(),"useNavigate() may be used only in the context of a <Router> component.");let t=S.useContext(Ec),{basename:e,navigator:n}=S.useContext(Zr),{matches:r}=S.useContext(Os),{pathname:s}=cr(),i=JSON.stringify(Jv(r)),a=S.useRef(!1);return HS(()=>{a.current=!0}),S.useCallback((u,d={})=>{if(ps(a.current,zS),!a.current)return;if(typeof u=="number"){n.go(u);return}let f=vm(u,JSON.parse(i),s,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Rs([e,f.pathname])),Zv(typeof u=="string"?u:ja(u),n.createHref(f),Xv(n),"reject"),(d.replace?n.replace:n.push)(f,d.state,d)},[e,n,i,s,t])}S.createContext(null);function hX(){let{matches:t}=S.useContext(Os);return t[t.length-1]?.params??{}}function kd(t,{relative:e}={}){let{matches:n}=S.useContext(Os),{pathname:r}=cr(),s=JSON.stringify(Jv(n));return S.useMemo(()=>vm(t,JSON.parse(s),r,e==="path"),[t,s,r,e])}function v3(t,e){return qS(t,e)}function qS(t,e,n){Ht(bc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=S.useContext(Zr),{matches:s}=S.useContext(Os),i=s[s.length-1],a=i?i.params:{},c=i?i.pathname:"/",u=i?i.pathnameBase:"/",d=i&&i.route;{let w=d&&d.path||"";GS(c,!d||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
51
52Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let f=cr(),g;if(e){let w=typeof e=="string"?wc(e):e;Ht(u==="/"||w.pathname?.startsWith(u),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${w.pathname}" was given in the \`location\` prop.`),g=w}else g=f;let y=g.pathname||"/",x=y;if(u!=="/"){let w=u.replace(/^\//,"").split("/");x="/"+y.replace(/^\//,"").split("/").slice(w.length).join("/")}let b=n&&n.state.matches.length?n.state.matches.map(w=>Object.assign(w,{route:n.manifest[w.route.id]||w.route})):RS(t,{pathname:x});ps(d||b!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),ps(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let E=b3(b&&b.map(w=>Object.assign({},w,{params:Object.assign({},a,w.params),pathname:Rs([u,r.encodeLocation?r.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?u:Rs([u,r.encodeLocation?r.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),s,n);return e&&E?S.createElement(Sd.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},E):E}function _3(){let t=k3(),e=r3(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},a=null;return a=S.createElement(S.Fragment,null,S.createElement("p",null,"💿 Hey developer 👋"),S.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",S.createElement("code",{style:i},"ErrorBoundary")," or"," ",S.createElement("code",{style:i},"errorElement")," prop on your route.")),S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application 
52Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},e),n?S.createElement("pre",{style:s},n):null,a)}var x3=S.createElement(_3,null),WS=class extends S.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError&&this.props.onError(t,e)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=m3(t.digest);n&&(t=n)}let e=t!==void 0?S.createElement(Os.Provider,{value:this.props.routeContext},S.createElement(e_.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?S.createElement(w3,{error:t},e):e}};WS.contextType=VS;var Mg=new WeakMap;function w3({children:t,error:e}){let{basename:n,navigator:r}=S.useContext(Zr);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let s=p3(e.digest);if(s){let i=Mg.get(e);if(i)throw i;let a=MS(s.location,n),c=a.absoluteURL||a.to;if(Zv(s.location,c,Xv(r),"allow-explicit"),l3(c))throw new Error("Invalid redirect location");if(jS&&!Mg.get(e))if(a.isExternal||s.reloadDocument)window.location.href=c;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:s.replace}));throw Mg.set(e,u),u}return S.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c}`})}}return t}function E3({routeContext:t,match:e,children:n}){let r=S.useContext(Ec);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),S.createElement(Os.Provider,{value:t},n)}function b3(t,e=[],n){let r=n?.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let s=t,i=r?.errors;if(i!=null){let f=s.findIndex(g=>g.route.id&&i?.[g.route.id]!==void 0);Ht(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,f+1))}let a=!1,c=-1;if(n&&r){a=r.renderFallback;for(let f=0;f<s.length;f++){let g=s[f];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(c=f),g.route.id){let{loaderData:y,errors:x}=r,b=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!x||x[g.route.id]===void 0);if(g.route.lazy||b){n.isStatic&&(a=!0),c>=0?s=s.slice(0,c+1):s=[s[0]];break}}}}let u=n?.onError,d=r&&u?(f,g)=>{u(f,{location:r.location,params:r.matches?.[0]?.params??{},pattern:s3(r.matches),errorInfo:g})}:void 0;return s.reduceRight((f,g,y)=>{let x,b=!1,E=null,w=null;r&&(x=i&&g.route.id?i[g.route.id]:void 0,E=g.route.errorElement||x3,a&&(c<0&&y===0?(GS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,w=null):c===y&&(b=!0,w=g.route.hydrateFallbackElement||null)));let R=e.concat(s.slice(0,y+1)),C=()=>{let k;return x?k=E:b?k=w:g.route.Component?k=S.createElement(g.route.Component,null):g.route.element?k=g.route.element:k=f,S.createElement(E3,{match:g,routeContext:{outlet:f,matches:R,isDataRoute:r!=null},children:k})};return r&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?S.createElement(WS,{location:r.location,revalidation:r.revalidation,component:E,error:x,children:C(),routeContext:{outlet:null,matches:R,isDataRoute:!0},onError:d}):C()},null)}function t_(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function A3(t){let e=S.useContext(Ec);return Ht(e,t_(t)),e}function T3(t){let e=S.useContext(_m);return Ht(e,t_(t)),e}function C3(t){let e=S.useContext(Os);return Ht(e,t_(t)),e}function n_(t){let e=C3(t),n=e.matches[e.matches.length-1];return Ht(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function S3(){return n_("useRouteId")}function k3(){let t=S.useContext(e_),e=T3("useRouteError"),n=n_("useRouteError");return t!==void 0?t:e.errors?.[n]}function I3(){let{router:t}=A3("useNavigate"),e=n_("useNavigate"),n=S.useRef(!1);return HS(()=>{n.current=!0}),S.useCallback(async(s,i={})=>{ps(n.current,zS),n.current&&(typeof s=="number"?await t.navigate(s):await t.navigate(s,{fromRouteId:e,...i}))},[t,e])}var BE={};function GS(t,e,n){!e&&!BE[t]&&(BE[t]=!0,ps(!1,n))}S.memo(P3);function P3({routes:t,manifest:e,future:n,state:r,isStatic:s,onError:i}){return qS(t,void 0,{manifest:e,state:r,isStatic:s,onError:i})}function mr({to:t,replace:e,state:n,relative:r}){Ht(bc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s,navigator:i}=S.useContext(Zr);ps(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=S.useContext(Os),{pathname:c}
52=cr(),u=Ac(),d=vm(t,Jv(a),c,r==="path");Zv(typeof t=="string"?t:ja(t),i.createHref(d),Xv(i),"reject");let f=JSON.stringify(d);return S.useEffect(()=>{u(JSON.parse(f),{replace:e,state:n,relative:r})},[u,f,r,e,n]),null}function we(t){Ht(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function R3({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:s,static:i=!1,useTransitions:a}){Ht(!bc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=t.replace(/^\/*/,"/"),u=S.useMemo(()=>({basename:c,navigator:s,static:i,useTransitions:a,future:{}}),[c,s,i,a]);typeof n=="string"&&(n=wc(n));let{pathname:d="/",search:f="",hash:g="",state:y=null,key:x="default",mask:b}=n,E=S.useMemo(()=>{let w=Ui(d,c);return w==null?null:{location:{pathname:w,search:f,hash:g,state:y,key:x,mask:b},navigationType:r}},[c,d,f,g,y,x,r,b]);return ps(E!=null,`<Router basename="${c}"> is not able to match the URL "${d}${f}${g}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:S.createElement(Zr.Provider,{value:u},S.createElement(Sd.Provider,{children:e,value:E}))}function D3({children:t,location:e}){return v3(My(t),e)}function My(t,e=[]){let n=[];return S.Children.forEach(t,(r,s)=>{if(!S.isValidElement(r))return;let i=[...e,s];if(r.type===S.Fragment){n.push.apply(n,My(r.props.children,i));return}Ht(r.type===we,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ht(!r.props.index||!r.props.children,"An index route cannot have child routes.");let a={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=My(r.props.children,i)),n.push(a)}),n}var Of="get",Lf="application/x-www-form-urlencoded";function xm(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function N3(t){return xm(t)&&t.tagName.toLowerCase()==="button"}function O3(t){return xm(t)&&t.tagName.toLowerCase()==="form"}function L3(t){return xm(t)&&t.tagName.toLowerCase()==="input"}function F3(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function j3(t,e){return t.button===0&&(!e||e==="_self")&&!F3(t)}function By(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function M3(t,e){let n=By(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(i=>{n.append(s,i)})}),n}var Zh=null;function B3(){if(Zh===null)try{new FormData(document.createElement("form"),0),Zh=!1}catch{Zh=!0}return Zh}var V3=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Bg(t){return t!=null&&!V3.has(t)?(ps(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Lf}"`),null):t}function U3(t,e){let n,r,s,i,a;if(O3(t)){let c=t.getAttribute("action");r=c?Ui(c,e):null,n=t.getAttribute("method")||Of,s=Bg(t.getAttribute("enctype"))||Lf,i=new FormData(t)}else if(N3(t)||L3(t)&&(t.type==="submit"||t.type==="image")){let c=t.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=t.getAttribute("formaction")||c.getAttribute("action");if(r=u?Ui(u,e):null,n=t.getAttribute("formmethod")||c.getAttribute("method")||Of,s=Bg(t.getAttribute("formenctype"))||Bg(c.getAttribute("enctype"))||Lf,i=new FormData(c,t),!B3()){let{name:d,type:f,value:g}=t;if(f==="image"){let y=d?`${d}.`:"";i.append(`${y}x`,"0"),i.append(`${y}y`,"0")}else d&&i.append(d,g)}}else{if(xm(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Of,r=null,s=Lf,a=t}return i&&s==="text/plain"&&(a=i,i=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:i,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function r_(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function KS(t,e,n,r){let s=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:e&&Ui(s.pathname,e)==="/"?s.pathname=`${lc(e)}/_root.${r}`:s.pathname=`${lc(s.pathname)}.${r}`,s}async function $3(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch{return window.__reactRouterContext&&window.__reactRouterContext.
52isSpaMode,window.location.reload(),new Promise(()=>{})}}function z3(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function H3(t,e,n){let r=await Promise.all(t.map(async s=>{let i=e.routes[s.route.id];if(i){let a=await $3(i,n);return a.links?a.links():[]}return[]}));return K3(r.flat(1).filter(z3).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function VE(t,e,n,r,s,i){let a=(u,d)=>n[d]?u.route.id!==n[d].route.id:!0,c=(u,d)=>n[d].pathname!==u.pathname||n[d].route.path?.endsWith("*")&&n[d].params["*"]!==u.params["*"];return i==="assets"?e.filter((u,d)=>a(u,d)||c(u,d)):i==="data"?e.filter((u,d)=>{let f=r.routes[u.route.id];if(!f||!f.hasLoader)return!1;if(a(u,d)||c(u,d))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function q3(t,e,{includeHydrateFallback:n}={}){return W3(t.map(r=>{let s=e.routes[r.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function W3(t){return[...new Set(t)]}function G3(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function K3(t,e){let n=new Set;return new Set(e),t.reduce((r,s)=>{let i=JSON.stringify(G3(s));return n.has(i)||(n.add(i),r.push({key:i,link:s})),r},[])}function s_(){let t=S.useContext(Ec);return r_(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function Y3(){let t=S.useContext(_m);return r_(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var i_=S.createContext(void 0);i_.displayName="FrameworkContext";function wm(){let t=S.useContext(i_);return r_(t,"You must render this element inside a <HydratedRouter> element"),t}function Q3(t,e){let n=S.useContext(i_),[r,s]=S.useState(!1),[i,a]=S.useState(!1),{onFocus:c,onBlur:u,onMouseEnter:d,onMouseLeave:f,onTouchStart:g}=e,y=S.useRef(null);S.useEffect(()=>{if(t==="render"&&a(!0),t==="viewport"){let E=R=>{R.forEach(C=>{a(C.isIntersecting)})},w=new IntersectionObserver(E,{threshold:.5});return y.current&&w.observe(y.current),()=>{w.disconnect()}}},[t]),S.useEffect(()=>{if(r){let E=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(E)}}},[r]);let x=()=>{s(!0)},b=()=>{s(!1),a(!1)};return n?t!=="intent"?[i,y,{}]:[i,y,{onFocus:Tu(c,x),onBlur:Tu(u,b),onMouseEnter:Tu(d,x),onMouseLeave:Tu(f,b),onTouchStart:Tu(g,x)}]:[!1,y,{}]}function Tu(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function J3({page:t,...e}){let n=c3(),{nonce:r}=wm(),{router:s}=s_(),i=S.useMemo(()=>RS(s.routes,t,s.basename),[s.routes,t,s.basename]);return i?(e.nonce==null&&r&&(e={...e,nonce:r}),n?S.createElement(Z3,{page:t,matches:i,...e}):S.createElement(eO,{page:t,matches:i,...e})):null}function X3(t){let{manifest:e,routeModules:n}=wm(),[r,s]=S.useState([]);return S.useEffect(()=>{let i=!1;return H3(t,e,n).then(a=>{i||s(a)}),()=>{i=!0}},[t,e,n]),r}function Z3({page:t,matches:e,...n}){let r=cr(),{future:s}=wm(),{basename:i}=s_(),a=S.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let c=KS(t,i,s.v8_trailingSlashAwareDataRequests,"rsc"),u=!1,d=[];for(let f of e)typeof f.route.shouldRevalidate=="function"?u=!0:d.push(f.route.id);return u&&d.length>0&&c.searchParams.set("_routes",d.join(",")),[c.pathname+c.search]},[i,s.v8_trailingSlashAwareDataRequests,t,r,e]);return S.createElement(S.Fragment,null,a.map(c=>S.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...n})))}function eO({page:t,matches:e,...n}){let r=cr(),{future:s,manifest:i,routeModules:a}=wm(),{basename:c}=s_(),{loaderData:u,matches:d}=Y3(),f=S.useMemo(()=>VE(t,e,d,i,r,"data"),[t,e,d,i,r]),g=S.useMemo(()=>VE(t,e,d,i,r,"assets"),[t,e,d,i,r]),y=S.useMemo(()=>
52{if(t===r.pathname+r.search+r.hash)return[];let E=new Set,w=!1;if(e.forEach(C=>{let k=i.routes[C.route.id];!k||!k.hasLoader||(!f.some(N=>N.route.id===C.route.id)&&C.route.id in u&&a[C.route.id]?.shouldRevalidate||k.hasClientLoader?w=!0:E.add(C.route.id))}),E.size===0)return[];let R=KS(t,c,s.v8_trailingSlashAwareDataRequests,"data");return w&&E.size>0&&R.searchParams.set("_routes",e.filter(C=>E.has(C.route.id)).map(C=>C.route.id).join(",")),[R.pathname+R.search]},[c,s.v8_trailingSlashAwareDataRequests,u,r,i,f,e,t,a]),x=S.useMemo(()=>q3(g,i),[g,i]),b=X3(g);return S.createElement(S.Fragment,null,y.map(E=>S.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...n})),x.map(E=>S.createElement("link",{key:E,rel:"modulepreload",href:E,...n})),b.map(({key:E,link:w})=>S.createElement("link",{key:E,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function tO(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var nO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{nO&&(window.__reactRouterVersion="7.18.3")}catch{}function rO({basename:t,children:e,useTransitions:n,window:r}){let s=S.useRef();s.current==null&&(s.current=ON({window:r,v5Compat:!0}));let i=s.current,[a,c]=S.useState({action:i.action,location:i.location}),u=S.useCallback(d=>{n===!1?c(d):S.startTransition(()=>c(d))},[n]);return S.useLayoutEffect(()=>i.listen(u),[i,u]),S.createElement(R3,{basename:t,children:e,location:a.location,navigationType:a.action,navigator:i,useTransitions:n})}var Oi=S.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:s,reloadDocument:i,replace:a,mask:c,state:u,target:d,to:f,preventScrollReset:g,viewTransition:y,defaultShouldRevalidate:x,...b},E){let{basename:w,navigator:R,useTransitions:C}=S.useContext(Zr),k=typeof f=="string"&&Qv.test(f),N=MS(f,w);f=N.to;let V=g3(f,{relative:s}),$=cr(),D=null;if(c){let H=vm(c,[],$.mask?$.mask.pathname:"/",!0);w!=="/"&&(H.pathname=H.pathname==="/"?w:Rs([w,H.pathname])),D=R.createHref(H)}let[I,B,O]=Q3(r,b),F=aO(f,{replace:a,mask:c,state:u,target:d,preventScrollReset:g,relative:s,viewTransition:y,defaultShouldRevalidate:x,useTransitions:C});function L(H){e&&e(H),H.defaultPrevented||F(H)}let M=!(N.isExternal||i),se=S.createElement("a",{...b,...O,href:(M?D:void 0)||N.absoluteURL||V,onClick:M?L:e,ref:tO(E,B),target:d,"data-discover":!k&&n==="render"?"true":void 0});return I&&!k?S.createElement(S.Fragment,null,se,S.createElement(J3,{page:V})):se});Oi.displayName="Link";var sO=S.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:s=!1,style:i,to:a,viewTransition:c,children:u,...d},f){let g=kd(a,{relative:d.relative}),y=cr(),x=S.useContext(_m),{navigator:b,basename:E}=S.useContext(Zr),w=x!=null&&hO(g)&&c===!0,R=b.encodeLocation?b.encodeLocation(g).pathname:g.pathname,C=y.pathname,k=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(C=C.toLowerCase(),k=k?k.toLowerCase():null,R=R.toLowerCase()),k&&E&&(k=Ui(k,E)||k);const N=R!=="/"&&R.endsWith("/")?R.length-1:R.length;let V=C===R||!s&&C.startsWith(R)&&C.charAt(N)==="/",$=k!=null&&(k===R||!s&&k.startsWith(R)&&k.charAt(R.length)==="/"),D={isActive:V,isPending:$,isTransitioning:w},I=V?e:void 0,B;typeof r=="function"?B=r(D):B=[r,V?"active":null,$?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let O=typeof i=="function"?i(D):i;return S.createElement(Oi,{...d,"aria-current":I,className:B,ref:f,style:O,to:a,viewTransition:c},typeof u=="function"?u(D):u)});sO.displayName="NavLink";var iO=S.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:s,state:i,method:a=Of,action:c,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:g,defaultShouldRevalidate:y,...x},b)=>{let{useTransitions:E}=S.useContext(Zr),w=uO(),R=dO(c,{relative:d}),C=a.toLowerCase()==="get"?"get":"post",k=typeof c=="string"&&Qv.test(c),N=V=>{if(u&&u(V),V.defaultPrevented)return;V.preventDefault();let $=V.nativeEvent.submitter,D=$?.getAttribute("formmethod")||a,I=()=>w($||V.currentTarget,{fetcherKey:e,method:D,navigate:n,replace:s,state:i,relative:d,preventScrollReset:f,viewTransition:g,defaultShouldRevalidate:y});E&&n!==!1?S.startTransition(()=>I()):I()};return S.createElement("form",{ref:b,method:C,action:R,onSubmit:r?u:N,...x,"data-discover":!k&&t==="render"?"true":void 0})});iO.displayName="Form";function oO(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function YS(t){let e=S.useContext(Ec);return Ht(e,oO(t)),e}function aO(t,{target:e,replace:n,mask:r,state:s,preventScrollReset:i,relative:a,viewTransition:c,defaultShouldRevalidate:u,useTransitions:d}={}){let f=Ac(),g=cr(),y=kd(t,{relative:a});return S.useCallback(x=>{if(j3(x,e)){x.preventDefault();let b=n!==void 0?n:ja(g)===ja(y),E=()=>f(t,{replace:b,mask:r,state:s,preventScrollReset:i,relative:a,viewTransition:c,defaultShouldRevalidate:u});d?S.startTransition(()=>E()):E()}},[g,f,y,n,r,s,e,t,i,a,c,u,d])}function fX(t){ps(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=S.useRef(By(t)),n=S.useRef(!1),r=cr(),s=S.useMemo(()=>M3(r.search,n.current?null:e.current),[r.search]),i=Ac(),a=S.useCallback((c,u)=>{const d=By(typeof c=="function"?c(new URLSearchParams(s)):c);n.current=!0,i("?"+d,u)},[i,s]);return[s,a]}var lO=0,cO=()=>`__${String(++lO)}__`;function uO(){let{router:t}=YS("useSubmit"),{basename:e}=S.useContext(Zr),n=S3(),r=t.fetch,s=t.navigate;return S.useCallback(async(i,a={})=>{let{action:c,method:u,encType:d,formData:f,body:g}=U3(i,e);if(a.navigate===!1){let y=a.fetcherKey||cO();await r(y,n,a.action||c,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:f,body:g,formMethod:a.method||u,formEncType:a.encType||d,flushSync:a.flushSync})}else await s(a.action||c,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:f,body:g,formMethod:a.method||u,formEncType:a.encType||d,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,s,e,n])}function dO(t,{relative:e}={}){let{basename:n}=S.useContext(Zr),r=S.useContext(Os);Ht(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),i={...kd(t||".",{relative:e})},a=cr();if(t==null){i.search=a.search;let c=new URLSearchParams(i.search),u=c.getAll("index");if(u.some(f=>f==="")){c.delete("index"),u.filter(g=>g).forEach(g=>c.append("index",g));let f=c.toString();i.search=f?`?${f}`:""}}return(!t||t===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:Rs([n,i.pathname])),ja(i)}function hO(t,{relative:e}={}){let n=S.useContext(US);Ht(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=YS("useViewTransitionState"),s=kd(t,{relative:e});if(!n.isTransitioning)return!1;let i=Ui(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=Ui(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Op(s.pathname,a)!=null||Op(s.pathname,i)!=null}var o_=IS();const fO=xc(o_),pO="modulepreload",mO=function(t){return"/"+t},UE={},Pe=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let a=function(d){return Promise.all(d.map(f=>Promise.resolve(f).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),u=c?.nonce||c?.getAttribute("nonce");s=a(n.map(d=>{if(d=mO(d),d in UE)return;UE[d]=!0;const f=d.endsWith(".css"),g=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const y=document.createElement("link");if(y.rel=f?"stylesheet":pO,f||(y.as="script"),y.crossOrigin="",y.href=d,u&&y.setAttribute("nonce",u),document.head.appendChild(y),f)return new Promise((x,b)=>{y.addEventListener("load",x),y.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return s.then(a=>{for(const c of a||[])c.status==="rejected"&&i(c.reason);return e().catch(i)})};var $E=function(){return $E=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},$E.apply(this,arguments)};function pX(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function gO(t,e,n,r){function s(i){return i instanceof n?i:new n(function(a){a(i)})}
52return new(n||(n=Promise))(function(i,a){function c(f){try{d(r.next(f))}catch(g){a(g)}}function u(f){try{d(r.throw(f))}catch(g){a(g)}}function d(f){f.done?i(f.value):s(f.value).then(c,u)}d((r=r.apply(t,e||[])).next())})}function mX(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}const yO=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);let a_=class extends Error{constructor(e,n="FunctionsError",r){super(e),this.name=n,this.context=r}};class vO extends a_{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class zE extends a_{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class HE extends a_{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Vy;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Vy||(Vy={}));class _O{constructor(e,{headers:n={},customFetch:r,region:s=Vy.Any}={}){this.url=e,this.headers=n,this.region=s,this.fetch=yO(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return gO(this,arguments,void 0,function*(n,r={}){var s;let i,a;try{const{headers:c,method:u,body:d,signal:f,timeout:g}=r;let y={},{region:x}=r;x||(x=this.region);const b=new URL(`${this.url}/${n}`);x&&x!=="any"&&(y["x-region"]=x,b.searchParams.set("forceFunctionRegion",x));let E;d&&(c&&!Object.prototype.hasOwnProperty.call(c,"Content-Type")||!c)?typeof Blob<"u"&&d instanceof Blob||d instanceof ArrayBuffer?(y["Content-Type"]="application/octet-stream",E=d):typeof d=="string"?(y["Content-Type"]="text/plain",E=d):typeof FormData<"u"&&d instanceof FormData?E=d:(y["Content-Type"]="application/json",E=JSON.stringify(d)):d&&typeof d!="string"&&!(typeof Blob<"u"&&d instanceof Blob)&&!(d instanceof ArrayBuffer)&&!(typeof FormData<"u"&&d instanceof FormData)?E=JSON.stringify(d):E=d;let w=f;g&&(a=new AbortController,i=setTimeout(()=>a.abort(),g),f?(w=a.signal,f.addEventListener("abort",()=>a.abort())):w=a.signal);const R=yield this.fetch(b.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},y),this.headers),c),body:E,signal:w}).catch(V=>{throw new vO(V)}),C=R.headers.get("x-relay-error");if(C&&C==="true")throw new zE(R);if(!R.ok)throw new HE(R);let k=((s=R.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),N;return k==="application/json"?N=yield R.json():k==="application/octet-stream"||k==="application/pdf"?N=yield R.blob():k==="text/event-stream"?N=R:k==="multipart/form-data"?N=yield R.formData():N=yield R.text(),{data:N,error:null,response:R}}catch(c){return{data:null,error:c,response:c instanceof HE||c instanceof zE?c.context:void 0}}finally{i&&clearTimeout(i)}})}}var In={},Ll={},Fl={},jl={},Ml={},Bl={},xO=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},cc=xO();const wO=cc.fetch,EO=cc.fetch.bind(cc),bO=cc.Headers,AO=cc.Request,TO=cc.Response,CO=Object.freeze(Object.defineProperty({__proto__:null,Headers:bO,Request:AO,Response:TO,default:EO,fetch:wO},Symbol.toStringTag,{value:"Module"})),SO=SS(CO);var ef={},qE;function QS(){if(qE)return ef;qE=1,Object.defineProperty(ef,"__esModule",{value:!0});class t extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.co
52de=n.code}}return ef.default=t,ef}var WE;function JS(){if(WE)return Bl;WE=1;var t=Bl&&Bl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Bl,"__esModule",{value:!0});const e=t(SO),n=t(QS());class r{constructor(i){var a,c;this.shouldThrowOnError=!1,this.method=i.method,this.url=i.url,this.headers=new Headers(i.headers),this.schema=i.schema,this.body=i.body,this.shouldThrowOnError=(a=i.shouldThrowOnError)!==null&&a!==void 0?a:!1,this.signal=i.signal,this.isMaybeSingle=(c=i.isMaybeSingle)!==null&&c!==void 0?c:!1,i.fetch?this.fetch=i.fetch:typeof fetch>"u"?this.fetch=e.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(i,a){return this.headers=new Headers(this.headers),this.headers.set(i,a),this}then(i,a){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const c=this.fetch;let u=c(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async d=>{var f,g,y,x;let b=null,E=null,w=null,R=d.status,C=d.statusText;if(d.ok){if(this.method!=="HEAD"){const $=await d.text();$===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((f=this.headers.get("Accept"))===null||f===void 0)&&f.includes("application/vnd.pgrst.plan+text"))?E=$:E=JSON.parse($))}const N=(g=this.headers.get("Prefer"))===null||g===void 0?void 0:g.match(/count=(exact|planned|estimated)/),V=(y=d.headers.get("content-range"))===null||y===void 0?void 0:y.split("/");N&&V&&V.length>1&&(w=parseInt(V[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(E)&&(E.length>1?(b={code:"PGRST116",details:`Results contain ${E.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},E=null,w=null,R=406,C="Not Acceptable"):E.length===1?E=E[0]:E=null)}else{const N=await d.text();try{b=JSON.parse(N),Array.isArray(b)&&d.status===404&&(E=[],b=null,R=200,C="OK")}catch{d.status===404&&N===""?(R=204,C="No Content"):b={message:N}}if(b&&this.isMaybeSingle&&(!((x=b?.details)===null||x===void 0)&&x.includes("0 rows"))&&(b=null,R=200,C="OK"),b&&this.shouldThrowOnError)throw new n.default(b)}return{error:b,data:E,count:w,status:R,statusText:C}});return this.shouldThrowOnError||(u=u.catch(d=>{var f,g,y;return{error:{message:`${(f=d?.name)!==null&&f!==void 0?f:"FetchError"}: ${d?.message}`,details:`${(g=d?.stack)!==null&&g!==void 0?g:""}`,hint:"",code:`${(y=d?.code)!==null&&y!==void 0?y:""}`},data:null,count:null,status:0,statusText:""}})),u.then(i,a)}returns(){return this}overrideTypes(){return this}}return Bl.default=r,Bl}var GE;function XS(){if(GE)return Ml;GE=1;var t=Ml&&Ml.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ml,"__esModule",{value:!0});const e=t(JS());class n extends e.default{select(s){let i=!1;const a=(s??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join("");return this.url.searchParams.set("select",a),this.headers.append("Prefer","return=representation"),this}order(s,{ascending:i=!0,nullsFirst:a,foreignTable:c,referencedTable:u=c}={}){const d=u?`${u}.order`:"order",f=this.url.searchParams.get(d);return this.url.searchParams.set(d,`${f?`${f},`:""}${s}.${i?"asc":"desc"}${a===void 0?"":a?".nullsfirst":".nullslast"}`),this}limit(s,{foreignTable:i,referencedTable:a=i}={}){const c=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(c,`${s}`),this}range(s,i,{foreignTable:a,referencedTable:c=a}={}){const u=typeof c>"u"?"offset":`${c}.offset`,d=typeof c>"u"?"limit":`${c}.limit`;return this.url.searchParams.set(u,`${s}`),this.url.searchParams.set(d,`${i-s+1}`),this}abortSignal(s){return this.signal=s,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
52explain({analyze:s=!1,verbose:i=!1,settings:a=!1,buffers:c=!1,wal:u=!1,format:d="text"}={}){var f;const g=[s?"analyze":null,i?"verbose":null,a?"settings":null,c?"buffers":null,u?"wal":null].filter(Boolean).join("|"),y=(f=this.headers.get("Accept"))!==null&&f!==void 0?f:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${d}; for="${y}"; options=${g};`),d==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(s){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${s}`),this}}return Ml.default=n,Ml}var KE;function l_(){if(KE)return jl;KE=1;var t=jl&&jl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(jl,"__esModule",{value:!0});const e=t(XS());class n extends e.default{eq(s,i){return this.url.searchParams.append(s,`eq.${i}`),this}neq(s,i){return this.url.searchParams.append(s,`neq.${i}`),this}gt(s,i){return this.url.searchParams.append(s,`gt.${i}`),this}gte(s,i){return this.url.searchParams.append(s,`gte.${i}`),this}lt(s,i){return this.url.searchParams.append(s,`lt.${i}`),this}lte(s,i){return this.url.searchParams.append(s,`lte.${i}`),this}like(s,i){return this.url.searchParams.append(s,`like.${i}`),this}likeAllOf(s,i){return this.url.searchParams.append(s,`like(all).{${i.join(",")}}`),this}likeAnyOf(s,i){return this.url.searchParams.append(s,`like(any).{${i.join(",")}}`),this}ilike(s,i){return this.url.searchParams.append(s,`ilike.${i}`),this}ilikeAllOf(s,i){return this.url.searchParams.append(s,`ilike(all).{${i.join(",")}}`),this}ilikeAnyOf(s,i){return this.url.searchParams.append(s,`ilike(any).{${i.join(",")}}`),this}is(s,i){return this.url.searchParams.append(s,`is.${i}`),this}in(s,i){const a=Array.from(new Set(i)).map(c=>typeof c=="string"&&new RegExp("[,()]").test(c)?`"${c}"`:`${c}`).join(",");return this.url.searchParams.append(s,`in.(${a})`),this}contains(s,i){return typeof i=="string"?this.url.searchParams.append(s,`cs.${i}`):Array.isArray(i)?this.url.searchParams.append(s,`cs.{${i.join(",")}}`):this.url.searchParams.append(s,`cs.${JSON.stringify(i)}`),this}containedBy(s,i){return typeof i=="string"?this.url.searchParams.append(s,`cd.${i}`):Array.isArray(i)?this.url.searchParams.append(s,`cd.{${i.join(",")}}`):this.url.searchParams.append(s,`cd.${JSON.stringify(i)}`),this}rangeGt(s,i){return this.url.searchParams.append(s,`sr.${i}`),this}rangeGte(s,i){return this.url.searchParams.append(s,`nxl.${i}`),this}rangeLt(s,i){return this.url.searchParams.append(s,`sl.${i}`),this}rangeLte(s,i){return this.url.searchParams.append(s,`nxr.${i}`),this}rangeAdjacent(s,i){return this.url.searchParams.append(s,`adj.${i}`),this}overlaps(s,i){return typeof i=="string"?this.url.searchParams.append(s,`ov.${i}`):this.url.searchParams.append(s,`ov.{${i.join(",")}}`),this}textSearch(s,i,{config:a,type:c}={}){let u="";c==="plain"?u="pl":c==="phrase"?u="ph":c==="websearch"&&(u="w");const d=a===void 0?"":`(${a})`;return this.url.searchParams.append(s,`${u}fts${d}.${i}`),this}match(s){return Object.entries(s).forEach(([i,a])=>{this.url.searchParams.append(i,`eq.${a}`)}),this}not(s,i,a){return this.url.searchParams.append(s,`not.${i}.${a}`),this}or(s,{foreignTable:i,referencedTable:a=i}={}){const c=a?`${a}.or`:"or";return this.url.searchParams.append(c,`(${s})`),this}filter(s,i,a){return this.url.searchParams.append(s,`${i}.${a}`),this}}return jl.default=n,jl}var YE;function ZS(){if(YE)return Fl;YE=1;var t=Fl&&Fl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Fl,"__esModule",{value:!0});const e=t(l_());class n{constructor(s,{headers:i={},schema:a,fetch:c}){this.url=s,this.headers=new Headers(i),this.schema=a,this.fetch=c}select(s,{head:i=!1,count:a}={}){const c=i?"HEAD":"GET";let u=!1;const d=(s??"*").split("").map(f=>/\s/.test(f)&&!u?"":(f==='"'&&(u=!u),f)).join("");return this.url.searchParams.set("select",d),a&&this.headers.append("Prefer",`count=${a}`),new e.default({method:c,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(s,{count:i,defaultToNull:a=!0}={}){var c;const u="POST";if(i&&this.headers.append("Prefer",`count=${i}`),a||this.headers.append("Prefer","missing=default"),Array.isArray(s)){const d=s.reduce((f,g)=>f.concat(Object.keys(g)),[]);if(d.length>0){const f=[...new Set(d)].map(g=>`"${g}"`);this.url.searchParams.set("columns",f.join(","))}}return new e.default({method:u,url:this.url,headers:this.headers,schema:this.schema,body:s,fetch:(c=this.fetch)!==null&&c!==void 0?c:fetch})}upsert(s,{onConflict:i,ignoreDuplicates:a=!1,count:c,defaultToNull:u=!0}={}){var d;const f="POST";if(this.headers.append("Prefer",`resolution=${a?"ignore":"merge"}-duplicates`),i!==void 0&&this.url.searchParams.set("on_conflict",i),c&&this.headers.append("Prefer",`count=${c}`),u||this.headers.append("Prefer","missing=default"),Array.isArray(s)){const g=s.reduce((y,x)=>y.concat(Object.keys(x)),[]);if(g.length>0){const y=[...new Set(g)].map(x=>`"${x}"`);this.url.searchParams.set("columns",y.join(","))}}return new e.default({method:f,url:this.url,headers:this.headers,schema:this.schema,body:s,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}update(s,{count:i}={}){var a;const c="PATCH";return i&&this.headers.append("Prefer",`count=${i}`),new e.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:s,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}delete({count:s}={}){var i;const a="DELETE";return s&&this.headers.append("Prefer",`count=${s}`),new e.default({method:a,url:this.url,headers:this.headers,schema:this.schema,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}}return Fl.default=n,Fl}var QE;function kO(){if(QE)return Ll;QE=1;var t=Ll&&Ll.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};
52Object.defineProperty(Ll,"__esModule",{value:!0});const e=t(ZS()),n=t(l_());class r{constructor(i,{headers:a={},schema:c,fetch:u}={}){this.url=i,this.headers=new Headers(a),this.schemaName=c,this.fetch=u}from(i){const a=new URL(`${this.url}/${i}`);return new e.default(a,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(i){return new r(this.url,{headers:this.headers,schema:i,fetch:this.fetch})}rpc(i,a={},{head:c=!1,get:u=!1,count:d}={}){var f;let g;const y=new URL(`${this.url}/rpc/${i}`);let x;c||u?(g=c?"HEAD":"GET",Object.entries(a).filter(([E,w])=>w!==void 0).map(([E,w])=>[E,Array.isArray(w)?`{${w.join(",")}}`:`${w}`]).forEach(([E,w])=>{y.searchParams.append(E,w)})):(g="POST",x=a);const b=new Headers(this.headers);return d&&b.set("Prefer",`count=${d}`),new n.default({method:g,url:y,headers:b,schema:this.schemaName,body:x,fetch:(f=this.fetch)!==null&&f!==void 0?f:fetch})}}return Ll.default=r,Ll}var JE;function IO(){if(JE)return In;JE=1;var t=In&&In.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(In,"__esModule",{value:!0}),In.PostgrestError=In.PostgrestBuilder=In.PostgrestTransformBuilder=In.PostgrestFilterBuilder=In.PostgrestQueryBuilder=In.PostgrestClient=void 0;const e=t(kO());In.PostgrestClient=e.default;const n=t(ZS());In.PostgrestQueryBuilder=n.default;const r=t(l_());In.PostgrestFilterBuilder=r.default;const s=t(XS());In.PostgrestTransformBuilder=s.default;const i=t(JS());In.PostgrestBuilder=i.default;const a=t(QS());return In.PostgrestError=a.default,In.default={PostgrestClient:e.default,PostgrestQueryBuilder:n.default,PostgrestFilterBuilder:r.default,PostgrestTransformBuilder:s.default,PostgrestBuilder:i.default,PostgrestError:a.default},In}var PO=IO();const RO=xc(PO),{PostgrestClient:DO,PostgrestQueryBuilder:yX,PostgrestFilterBuilder:vX,PostgrestTransformBuilder:_X,PostgrestBuilder:xX,PostgrestError:wX}=RO;class NO{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const n=globalThis.process;if(n){const r=n.versions;if(r&&r.node){const s=r.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
53import ws from "ws"
54new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let n=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(n+=`
55
56Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const r=this.getWebSocketConstructor();return new r(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const OO="2.97.0",LO=`realtime-js/${OO}`,FO="1.0.0",ek="2.0.0",XE=ek,Uy=1e4,jO=1e3,MO=100;var To;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(To||(To={}));var wn;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(wn||(wn={}));var ks;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(ks||(ks={}));var $y;(function(t){t.websocket="websocket"})($y||($y={}));var Sa;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Sa||(Sa={}));class BO{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,n){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(e));let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(e){var n;return this._isArrayBuffer((n=e.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var n,r;const s=(r=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var n,r;const s=(r=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},a=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(e,n,r){var s,i;const a=e.topic,c=(s=e.ref)!==null&&s!==void 0?s:"",u=(i=e.join_ref)!==null&&i!==void 0?i:"",d=e.payload.event,f=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},g=Object.keys(f).length===0?"":JSON.stringify(f);
56if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`ref length ${c.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`userEvent length ${d.length} exceeds maximum of 255`);if(g.length>255)throw new Error(`metadata length ${g.length} exceeds maximum of 255`);const y=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+c.length+a.length+d.length+g.length,x=new ArrayBuffer(this.HEADER_LENGTH+y);let b=new DataView(x),E=0;b.setUint8(E++,this.KINDS.userBroadcastPush),b.setUint8(E++,u.length),b.setUint8(E++,c.length),b.setUint8(E++,a.length),b.setUint8(E++,d.length),b.setUint8(E++,g.length),b.setUint8(E++,n),Array.from(u,R=>b.setUint8(E++,R.charCodeAt(0))),Array.from(c,R=>b.setUint8(E++,R.charCodeAt(0))),Array.from(a,R=>b.setUint8(E++,R.charCodeAt(0))),Array.from(d,R=>b.setUint8(E++,R.charCodeAt(0))),Array.from(g,R=>b.setUint8(E++,R.charCodeAt(0)));var w=new Uint8Array(x.byteLength+r.byteLength);return w.set(new Uint8Array(x),0),w.set(new Uint8Array(r),x.byteLength),w.buffer}decode(e,n){if(this._isArrayBuffer(e)){let r=this._binaryDecode(e);return n(r)}if(typeof e=="string"){const r=JSON.parse(e),[s,i,a,c,u]=r;return n({join_ref:s,ref:i,topic:a,event:c,payload:u})}return n({})}_binaryDecode(e){const n=new DataView(e),r=n.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,n,s)}}_decodeUserBroadcast(e,n,r){const s=n.getUint8(1),i=n.getUint8(2),a=n.getUint8(3),c=n.getUint8(4);let u=this.HEADER_LENGTH+4;const d=r.decode(e.slice(u,u+s));u=u+s;const f=r.decode(e.slice(u,u+i));u=u+i;const g=r.decode(e.slice(u,u+a));u=u+a;const y=e.slice(u,e.byteLength),x=c===this.JSON_ENCODING?JSON.parse(r.decode(y)):y,b={type:this.BROADCAST_EVENT,event:f,payload:x};return a>0&&(b.meta=JSON.parse(g)),{join_ref:null,ref:null,topic:d,event:this.BROADCAST_EVENT,payload:b}}_isArrayBuffer(e){var n;return e instanceof ArrayBuffer||((n=e?.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(e,n){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([r])=>n.includes(r)))}}class tk{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Rt;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Rt||(Rt={}));const ZE=(t,e,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((i,a)=>(i[a]=VO(a,t,e,s),i),{}):{}},VO=(t,e,n,r)=>{const s=e.find(c=>c.name===t),i=s?.type,a=n[t];return i&&!r.includes(i)?nk(i,a):zy(a)},nk=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return HO(e,n)}switch(t){case Rt.bool:return UO(e);case Rt.float4:case Rt.float8:case Rt.int2:case Rt.int4:case Rt.int8:case Rt.numeric:case Rt.oid:return $O(e);case Rt.json:case Rt.jsonb:return zO(e);case Rt.timestamp:return qO(e);case Rt.abstime:case Rt.date:case Rt.daterange:case Rt.int4range:case Rt.int8range:case Rt.money:case Rt.reltime:case Rt.text:case Rt.time:case Rt.timestamptz:case Rt.timetz:case Rt.tsrange:case Rt.tstzrange:return zy(e);default:return zy(e)}},zy=t=>t,UO=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},$O=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},zO=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},HO=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,r=t[n];if(t[0]==="{"&&r==="}"){let i;const a=t.slice(1,n);try{i=JSON.parse("["+a+"]")}catch{i=a?a.split(","):[]}return i.map(c=>nk(e,c))}return t},qO=t=>typeof t=="string"?t.replace(" ","T"):t,rk=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class Vg{constructor(e,n,r={},s=Uy){this.channel=e,this.event=n,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHo
56oks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var r;return this._hasReceived(e)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var eb;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(eb||(eb={}));class zu{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=n?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},s=>{const{onJoin:i,onLeave:a,onSync:c}=this.caller;this.joinRef=this.channel._joinRef(),this.state=zu.syncState(this.state,s,i,a),this.pendingDiffs.forEach(u=>{this.state=zu.syncDiff(this.state,u,i,a)}),this.pendingDiffs=[],c()}),this.channel._on(r.diff,{},s=>{const{onJoin:i,onLeave:a,onSync:c}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=zu.syncDiff(this.state,s,i,a),c())}),this.onJoin((s,i,a)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:i,newPresences:a})}),this.onLeave((s,i,a)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:i,leftPresences:a})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,r,s){const i=this.cloneDeep(e),a=this.transformState(n),c={},u={};return this.map(i,(d,f)=>{a[d]||(u[d]=f)}),this.map(a,(d,f)=>{const g=i[d];if(g){const y=f.map(w=>w.presence_ref),x=g.map(w=>w.presence_ref),b=f.filter(w=>x.indexOf(w.presence_ref)<0),E=g.filter(w=>y.indexOf(w.presence_ref)<0);b.length>0&&(c[d]=b),E.length>0&&(u[d]=E)}else c[d]=f}),this.syncDiff(i,{joins:c,leaves:u},r,s)}static syncDiff(e,n,r,s){const{joins:i,leaves:a}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(i,(c,u)=>{var d;const f=(d=e[c])!==null&&d!==void 0?d:[];if(e[c]=this.cloneDeep(u),f.length>0){const g=e[c].map(x=>x.presence_ref),y=f.filter(x=>g.indexOf(x.presence_ref)<0);e[c].unshift(...y)}r(c,f,u)}),this.map(a,(c,u)=>{let d=e[c];if(!d)return;const f=u.map(g=>g.presence_ref);d=d.filter(g=>f.indexOf(g.presence_ref)<0),e[c]=d,s(c,d,u),d.length===0&&delete e[c]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(r=>n(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,r)=>{const s=e[r];return"metas"in s?n[r]=s.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):n[r]=s,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var tb;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(tb||(tb={}));var Hu;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Hu||(Hu={}));var Ni;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Ni||(Ni={}));class Kl{constructor(e,n={config:{}},r){var s,i;if(this.topic=e,this.params=n,this.socket=r,this.bindings={},this.state=wn.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new Vg(this,ks.join,this.params,this.timeout),this.rejoinTimer=new tk(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=wn.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=wn.closed,this.socket._remove(this)}),this._onError(a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=wn.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=wn.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=wn.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ks.reply,{},(a,c)=>{this._trigger(this._replyEventName(c),a)}),this.presence=new zu(this),this.broadcastEndpointURL=rk(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,n=this.timeout){var r,s,i;if(this.socket.isConnected()||this.socket.connect(),this.state==wn.closed){const{config:{broadcast:a,presence:c,private:u}}=this.params,d=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(x=>x.filter))!==null&&s!==void 0?s:[],f=!!this.bindings[Hu.PRESENCE]&&this.bindings[Hu.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,g={},y={broadcast:a,presence:Object.assign(Object.assign({},c),{enabled:f}),postgres_changes:d,private:u};this.socket.accessTokenValue&&(g.access_token=this.socket.accessTokenValue),this._onError(x=>e?.(Ni.CHANNEL_ERROR,x)),this._onClose(()=>e?.(Ni.CLOSED)),this.updateJoinPayload(Object.assign({config:y},g)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:x})=>{var b;if(this.socket._isManualToken()||this.socket.setAuth(),x===void 0){e?.(Ni.SUBSCRIBED);return}else{const E=this.bindings.postgres_changes,w=(b=E?.length)!==null&&b!==void 0?b:0,R=[];for(let C=0;C<w;C++){const k=E[C],{filter:{event:N,schema:V,table:$,filter:D}}=k,I=x&&x[C];if(I&&I.event===N&&Kl.isFilterValueEqual(I.schema,V)&&Kl.isFilterValueEqual(I.table,$)&&Kl.isFilterValueEqual(I.filter,D))R.push(Object.assign(Object.assign({},k),{id:I.id}));else{this.unsubscribe(),this.state=wn.errored,e?.(Ni.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=R,e&&e(Ni.SUBSCRIBED);return}}).receive("error",x=>{this.state=wn.errored,e?.(Ni.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(x).join(", ")||"error")))}).receive("timeout",()=>{e?.(Ni.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,r){return this.state===wn.joined&&e===Hu.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,n,r)}async httpSend(e,n,r={}){var s;if(n==null)return Promise.reject("Payload is required for httpSend()");const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:n,private:this.private}]})},c=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);if(c.status===202)return{success:!0};let u=c.statusText;
56try{const d=await c.json();u=d.error||d.message||u}catch{}return Promise.reject(new Error(u))}async send(e,n={}){var r,s;if(!this._canPush()&&e.type==="broadcast"){const{event:i,payload:a}=e,c={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(c.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:c,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{const d=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((s=d.body)===null||s===void 0?void 0:s.cancel()),d.ok?"ok":"error"}catch(d){return d.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var a,c,u;const d=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(c=(a=this.params)===null||a===void 0?void 0:a.config)===null||c===void 0?void 0:c.broadcast)===null||u===void 0)&&u.ack)&&i("ok"),d.receive("ok",()=>i("ok")),d.receive("error",()=>i("error")),d.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=wn.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ks.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(s=>{r=new Vg(this,ks.leave,{},e),r.receive("ok",()=>{n(),s("ok")}).receive("timeout",()=>{n(),s("timed out")}).receive("error",()=>{s("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=wn.closed,this.bindings={}}async _fetchWithTimeout(e,n,r){const s=new AbortController,i=setTimeout(()=>s.abort(),r),a=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(i),a}_push(e,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new Vg(this,e,n,r);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>MO){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,r){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,r){var s,i;const a=e.toLocaleLowerCase(),{close:c,error:u,leave:d,join:f}=ks;if(r&&[c,u,d,f].indexOf(a)>=0&&r!==this._joinRef())return;let y=this._onMessage(a,n,r);if(n&&!y)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(x=>{var b,E,w;return((b=x.filter)===null||b===void 0?void 0:b.event)==="*"||((w=(E=x.filter)===null||E===void 0?void 0:E.event)===null||w===void 0?void 0:w.toLocaleLowerCase())===a}).map(x=>x.callback(y,r)):(i=this.bindings[a])===null||i===void 0||i.filter(x=>{var b,E,w,R,C,k;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in x){const N=x.id,V=(b=x.filter)===null||b===void 0?void 0:b.event;return N&&((E=n.ids)===null||E===void 0?void 0:E.includes(N))&&(V==="*"||V?.toLocaleLowerCase()===((w=n.data)===null||w===void 0?void 0:w.type.toLocaleLowerCase()))}else{const N=(C=(R=x?.filter)===null||R===void 0?void 0:R.event)===null||C===void 0?void 0:C.toLocaleLowerCase();return N==="*"||N===((k=n?.event)===null||k===void 0?void 0:k.toLocaleLowerCase())}else return x.type.toLocaleLowerCase()===a}).map(x=>{if(typeof y=="object"&&"ids"in y){const b=y.data,{schema:E,table:w,commit_timestamp:R,type:C,errors:k}=b;y=Object.assign(Object.assign({},{schema:E,table:w,commit_timestamp:R,eventType:C,new:{},old:{},errors:k}),this._getPayloadRecords(b))}x.callback(y,r)})}_isClosed(){return this.state===wn.closed}_isJoined(){return this.state===wn.joined}_isJoining(){return this.state===wn.joining}_isLeaving(){return this.state===wn.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,r){const s=e.toLocaleLowerCase(),i={type:s,filter:n,callback:r};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(e,n){const r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(s=>{var i;return!(((i=s.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===r&&Kl.isEqual(s.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}static isFilterValueEqual(e,n){return(e??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(ks.close,{},e)}_onError(e){this._on(ks.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=wn.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=ZE(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=ZE(e.columns,e.old_record)),n}}const Ug=()=>{},tf={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},WO=[1e3,2e3,5e3,1e4],GO=1e4,KO=`
57  addEventListener("message", (e) => {
58    if (e.data.event === "start") {
59      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
60    }
61  });`;class YO{constructor(e,n){var r;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Uy,this.transport=null,this.heartbeatIntervalMs=tf.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Ug,this.ref=0,this.reconnectTimer=null,this.vsn=XE,this.logger=Ug,this.conn=null,this.sendBuffer=[],this.serializer
61=new BO,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=s=>s?(...i)=>s(...i):(...i)=>fetch(...i),!(!((r=n?.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${$y.websocket}`,this.httpEndpoint=rk(e),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=NO.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const n=e.message;throw n.includes("Node.js")?new Error(`${n}
62
63To use Realtime in Node.js, you need to provide a WebSocket implementation:
64
65Option 1: Use Node.js 22+ which has native WebSocket support
66Option 2: Install and provide the "ws" package:
67
68  npm install ws
69
70  import ws from "ws"
71  const client = new RealtimeClient(url, {
72    ...options,
73    transport: ws
74  })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,r){this.logger(e,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case To.connecting:return Sa.Connecting;case To.open:return Sa.Open;case To.closing:return Sa.Closing;default:return Sa.Closed}}isConnected(){return this.connectionState()===Sa.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const r=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===r);if(s)return s;{const i=new Kl(`realtime:${e}`,n,this);return this.channels.push(i),i}}push(e){const{topic:n,event:r,payload:s,ref:i}=e,a=()=>{this.encode(e,c=>{var u;(u=this.conn)===null||u===void 0||u.send(c)})};this.log("push",`${n} ${r} (${i})`,s),this.isConnected()?a():this.sendBuffer.push(a)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(jO,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},tf.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>
740&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(r=>r.topic===e&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply"&&n.ref&&n.ref===this.pendingHeartbeatRef){const d=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",d)}catch(f){this.log("error","error in heartbeat callback",f)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:r,event:s,payload:i,ref:a}=n,c=a?`(${a})`:"",u=i.status||"";this.log("receive",`${u} ${r} ${s} ${c}`.trim(),i),this.channels.filter(d=>d._isMember(r)).forEach(d=>d._trigger(s,i,a)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===To.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===To.open||this.conn.readyState===To.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(n=>{this.log("error","error waiting for auth on connect",n),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e);try{this.heartbeatCallback("error")}catch(n){this.log("error","error in heartbeat callback",n)}}_triggerChanError(){this.channels.forEach(e=>e._trigger(ks.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const r=e.match(/\?/)?"&":"?",s=new URLSearchParams(n);return`${e}${r}${s}`}_workerObjectUrl(e){let n;if(e)n=e;else{const r=new Blob([KO],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n,r=!1;if(e)n=e,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEac
74h(s=>{const i={access_token:n,version:LO};n&&s.updateJoinPayload(i),s.joinedOnce&&s._isJoined()&&s._push(ks.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(n)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new tk(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},tf.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,r,s,i,a,c,u,d,f,g,y,x;switch(this.transport=(n=e?.transport)!==null&&n!==void 0?n:null,this.timeout=(r=e?.timeout)!==null&&r!==void 0?r:Uy,this.heartbeatIntervalMs=(s=e?.heartbeatIntervalMs)!==null&&s!==void 0?s:tf.HEARTBEAT_INTERVAL,this.worker=(i=e?.worker)!==null&&i!==void 0?i:!1,this.accessToken=(a=e?.accessToken)!==null&&a!==void 0?a:null,this.heartbeatCallback=(c=e?.heartbeatCallback)!==null&&c!==void 0?c:Ug,this.vsn=(u=e?.vsn)!==null&&u!==void 0?u:XE,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(d=e?.reconnectAfterMs)!==null&&d!==void 0?d:(b=>WO[b-1]||GO),this.vsn){case FO:this.encode=(f=e?.encode)!==null&&f!==void 0?f:((b,E)=>E(JSON.stringify(b))),this.decode=(g=e?.decode)!==null&&g!==void 0?g:((b,E)=>E(JSON.parse(b)));break;case ek:this.encode=(y=e?.encode)!==null&&y!==void 0?y:this.serializer.encode.bind(this.serializer),this.decode=(x=e?.decode)!==null&&x!==void 0?x:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}}var od=class extends Error{constructor(t,e){super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&e.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function QO(t,e,n){const r=new URL(e,t);if(n)for(const[s,i]of Object.entries(n))i!==void 0&&r.searchParams.set(s,i);return r.toString()}async function JO(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function XO(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:s,body:i,headers:a}){const c=QO(t.baseUrl,r,s),u=await JO(t.auth),d=await e(c,{method:n,headers:{...i?{"Content-Type":"application/json"}:{},...u,...a},body:i?JSON.stringify(i):void 0}),f=await d.text(),g=(d.headers.get("content-type")||"").includes("application/json"),y=g&&f?JSON.parse(f):f;if(!d.ok){const x=g?y:void 0,b=x?.error;throw new od(b?.message??`Request failed with status ${d.status}`,{status:d.status,icebergType:b?.type,icebergCode:b?.code,details:x})}return{status:d.status,headers:d.headers,data:y}}}}function nf(t){return t.join("�")}var ZO=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:nf(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(t,e){const n={namespace:t.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${nf(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${nf(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${nf(t.namespace)}`}),!0}catch(e){if(e instanceof od&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(n){if(n instanceof od&&n.status===409)return;throw n}}};function Vl(t){return t.join("�")}var e6=class{constructor(t,e="",n){this.client=t,this.prefix=e,this.accessDelegation=n}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Vl(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Vl(t.namespace)}/tables`,body:e,headers:n})).data.metadata}async updateTable(t,e){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Vl(t.namespace)}
74/tables/${t.name}`,body:e});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Vl(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Vl(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Vl(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(n){if(n instanceof od&&n.status===404)return!1;throw n}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(n){if(n instanceof od&&n.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw n}}},t6=class{constructor(t){let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const n=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=XO({baseUrl:n,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new ZO(this.client,e),this.tableOps=new e6(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},Em=class extends Error{constructor(e,n="storage",r,s){super(e),this.__isStorageError=!0,this.namespace=n,this.name=n==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=s}};function bm(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var rf=class extends Em{constructor(t,e,n,r="storage"){super(t,r,e,n),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},sk=class extends Em{constructor(t,e,n="storage"){super(t,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};const n6=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),r6=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Hy=t=>{if(Array.isArray(t))return t.map(n=>Hy(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,r])=>{const s=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=Hy(r)}),e},s6=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function ad(t){"@babel/helpers - typeof";return ad=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ad(t)}function i6(t,e){if(ad(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ad(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function o6(t){var e=i6(t,"string");return ad(e)=="symbol"?e:e+""}function a6(t,e,n){return(e=o6(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nb(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Be(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
74e%2?nb(Object(n),!0).forEach(function(r){a6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nb(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}const rb=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},l6=async(t,e,n,r)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!n?.noResolveJson){const s=t,i=s.status||500;if(typeof s.json=="function")s.json().then(a=>{const c=a?.statusCode||a?.code||i+"";e(new rf(rb(a),i,c,r))}).catch(()=>{if(r==="vectors"){const a=i+"";e(new rf(s.statusText||`HTTP ${i} error`,i,a,r))}else{const a=i+"";e(new rf(s.statusText||`HTTP ${i} error`,i,a,r))}});else{const a=i+"";e(new rf(s.statusText||`HTTP ${i} error`,i,a,r))}}else e(new sk(rb(t),t,r))},c6=(t,e,n,r)=>{const s={method:t,headers:e?.headers||{}};return t==="GET"||t==="HEAD"||!r?Be(Be({},s),n):(r6(r)?(s.headers=Be({"Content-Type":"application/json"},e?.headers),s.body=JSON.stringify(r)):s.body=r,e?.duplex&&(s.duplex=e.duplex),Be(Be({},s),n))};async function Cu(t,e,n,r,s,i,a){return new Promise((c,u)=>{t(n,c6(e,r,s,i)).then(d=>{if(!d.ok)throw d;if(r?.noResolveJson)return d;if(a==="vectors"){const f=d.headers.get("content-type");if(d.headers.get("content-length")==="0"||d.status===204)return{};if(!f||!f.includes("application/json"))return{}}return d.json()}).then(d=>c(d)).catch(d=>l6(d,u,r,a))})}function ik(t="storage"){return{get:async(e,n,r,s)=>Cu(e,"GET",n,r,s,void 0,t),post:async(e,n,r,s,i)=>Cu(e,"POST",n,s,i,r,t),put:async(e,n,r,s,i)=>Cu(e,"PUT",n,s,i,r,t),head:async(e,n,r,s)=>Cu(e,"HEAD",n,Be(Be({},r),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,n,r,s,i)=>Cu(e,"DELETE",n,s,i,r,t)}}const u6=ik("storage"),{get:ld,post:Cs,put:qy,head:d6,remove:c_}=u6,qr=ik("vectors");var Tc=class{constructor(t,e={},n,r="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.fetch=n6(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Be(Be({},this.headers),{},{[t]:e}),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(bm(n))return{data:null,error:n};throw n}}},h6=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(bm(e))return{data:null,error:e};throw e}}};let ok;ok=Symbol.toStringTag;var f6=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[ok]="BlobDownloadBuilder",this.promise=null}asStream(){return new h6(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(bm(e))return{data:null,error:e};throw e}}};const p6={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},sb={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var m6=class extends Tc{constructor(t,e={},n,r){super(t,e,r,"storage"),this.bucketId=n}async uploadOrUpdate(t,e,n,r){var s=this;return s.handleOperation(async()=>{let i;const a=Be(Be({},sb),r);let c=Be(Be({},s.headers),t==="POST"&&{"x-upsert":String(a.upsert)});const u=a.metadata;typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),u&&i.append("metadata",s.encodeMetadata(u)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),u&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(u))):(i=n,c["cache-control"]=`max-age=${a.cacheControl}`,c["content-type"]=a.contentType,u&&(c["x-metadata"]=s.toBase64(s.encodeMetadata(u))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),r?.headers&&(c=Be(Be({},c),r.headers));const d=s._removeEmptyFolders(e),f=s._getFinalPath(d),g=await(t=="PUT"?qy:Cs)(s.fetch,`${s.url}/object/${f}`,i,Be({headers:c},a?.duplex?{duplex:a.duplex}:{}));return{path:d,id:g.Id,fullPath:g.Key}})}async upload(t,e,n){return this.uploadOrUpdate("POST",t,e,n)}async uploadToSignedUrl(t,e,n,r){var s=this;const i=s._removeEmptyFolders(t),a=s._getFinalPath(i),c=new URL(s.url+`/object/upload/sign/${a}`);return c.searchParams.set("token",e),s.handleOperation(async()=>{let u;const d=Be({upsert:sb.upsert},r),f=Be(Be({},s.headers),{"x-upsert":String(d.upsert)});return typeof Blob<"u"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",d.cacheControl),u.append("",n)):typeof FormData<"u"&&n instanceof FormData?(u=n,u.append("cacheControl",d.cacheControl)):(u=n,f["cache-control"]=`max-age=${d.cacheControl}`,f["content-type"]=d.contentType),{path:i,fullPath:(await qy(s.fetch,c.toString(),u,{headers:f})).Key}})}async createSignedUploadUrl(t,e){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(t);const s=Be({},n.headers);e?.upsert&&(s["x-upsert"]="true");const i=await Cs(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:s}),a=new URL(n.url+i.url),c=a.searchParams.get("token");if(!c)throw new Em("No token returned by API");return{signedUrl:a.toString(),path:t,token:c}})}async update(t,e,n){return this.uploadOrUpdate("PUT",t,e,n)}async move(t,e,n){var r=this;return r.handleOperation(async()=>await Cs(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n?.destinationBucket},{headers:r.headers}))}async copy(t,e,n){var r=this;return r.handleOperation(async()=>({path:(await Cs(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n?.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(t,e,n){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(t),i=await Cs(r.fetch,`${r.url}/object/sign/${s}
74`,Be({expiresIn:e},n?.transform?{transform:n.transform}:{}),{headers:r.headers});const a=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{signedUrl:encodeURI(`${r.url}${i.signedURL}${a}`)}})}async createSignedUrls(t,e,n){var r=this;return r.handleOperation(async()=>{const s=await Cs(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:e,paths:t},{headers:r.headers}),i=n?.download?`&download=${n.download===!0?"":n.download}`:"";return s.map(a=>Be(Be({},a),{},{signedUrl:a.signedURL?encodeURI(`${r.url}${a.signedURL}${i}`):null}))})}download(t,e,n){const r=typeof e?.transform<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString(e?.transform||{}),i=s?`?${s}`:"",a=this._getFinalPath(t),c=()=>ld(this.fetch,`${this.url}/${r}/${a}${i}`,{headers:this.headers,noResolveJson:!0},n);return new f6(c,this.shouldThrowOnError)}async info(t){var e=this;const n=e._getFinalPath(t);return e.handleOperation(async()=>Hy(await ld(e.fetch,`${e.url}/object/info/${n}`,{headers:e.headers})))}async exists(t){var e=this;const n=e._getFinalPath(t);try{return await d6(e.fetch,`${e.url}/object/${n}`,{headers:e.headers}),{data:!0,error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(bm(r)&&r instanceof sk){const s=r.originalError;if([400,404].includes(s?.status))return{data:!1,error:r}}throw r}}getPublicUrl(t,e){const n=this._getFinalPath(t),r=[],s=e?.download?`download=${e.download===!0?"":e.download}`:"";s!==""&&r.push(s);const i=typeof e?.transform<"u"?"render/image":"object",a=this.transformOptsToQueryString(e?.transform||{});a!==""&&r.push(a);let c=r.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${n}${c}`)}}}async remove(t){var e=this;return e.handleOperation(async()=>await c_(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,n){var r=this;return r.handleOperation(async()=>{const s=Be(Be(Be({},p6),e),{},{prefix:t||""});return await Cs(r.fetch,`${r.url}/object/list/${r.bucketId}`,s,{headers:r.headers},n)})}async listV2(t,e){var n=this;return n.handleOperation(async()=>{const r=Be({},t);return await Cs(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const g6="2.97.0",Id={"X-Client-Info":`storage-js/${g6}`};var y6=class extends Tc{constructor(t,e={},n,r){const s=new URL(t);r?.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const i=s.href.replace(/\/$/,""),a=Be(Be({},Id),e);super(i,a,n,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const n=e.listBucketOptionsToQueryString(t);return await ld(e.fetch,`${e.url}/bucket${n}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await ld(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var n=this;return n.handleOperation(async()=>await Cs(n.fetch,`${n.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}))}async updateBucket(t,e){var n=this;return n.handleOperation(async()=>await qy(n.fetch,`${n.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await Cs(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await c_(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},v6=class extends Tc{constructor(t,e={},n){const r=t.replace(/\/$/,""),s=Be(Be({},Id),e);super(r,s,n,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Cs(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const n=new URLSearchParams;t?.limit!==void 0&&n.set("limit",t.limit.toString()),t?.offset!==void 0&&n.set("offset",t.offset.toString()),t?.sortColumn&&n.set("sortColumn",t.sortColumn),t?.sortOrder&&n.set("sortOrder",t.sortOrder),t?.search&&n.set("search",t.search);const r=n.toString(),s=r?`${e.url}/bucket?${r}`:`${e.url}/bucket`;return await ld(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await c_(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!s6(t))throw new Em("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new t6({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}
74),r=this.shouldThrowOnError;return new Proxy(n,{get(s,i){const a=s[i];return typeof a!="function"?a:async(...c)=>{try{return{data:await a.apply(s,c),error:null}}catch(u){if(r)throw u;return{data:null,error:u}}}}})}},_6=class extends Tc{constructor(t,e={},n){const r=t.replace(/\/$/,""),s=Be(Be({},Id),{},{"Content-Type":"application/json"},e);super(r,s,n,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await qr.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var n=this;return n.handleOperation(async()=>await qr.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await qr.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var n=this;return n.handleOperation(async()=>await qr.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers})||{})}},x6=class extends Tc{constructor(t,e={},n){const r=t.replace(/\/$/,""),s=Be(Be({},Id),{},{"Content-Type":"application/json"},e);super(r,s,n,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await qr.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await qr.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await qr.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await qr.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await qr.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},w6=class extends Tc{constructor(t,e={},n){const r=t.replace(/\/$/,""),s=Be(Be({},Id),{},{"Content-Type":"application/json"},e);super(r,s,n,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await qr.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await qr.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await qr.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await qr.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},E6=class extends w6{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new b6(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,n=this;return e().call(n,t)}async getBucket(t){var e=()=>super.getBucket,n=this;return e().call(n,t)}async listBuckets(t={}){var e=()=>super.listBuckets,n=this;return e().call(n,t)}async deleteBucket(t){var e=()=>super.deleteBucket,n=this;return e().call(n,t)}},b6=class extends _6{constructor(t,e,n,r){super(t,e,r),this.vectorBucketName=n}async createIndex(t){var e=()=>super.createIndex,n=this;return e().call(n,Be(Be({},t),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,n=this;return e().call(n,Be(Be({},t),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,n=this;return e().call(n,n.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,n=this;return e().call(n,n.vectorBucketName,t)}index(t){return new A6(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},A6=class extends x6{constructor(t,e,n,r,s){super(t,e,s),this.vectorBucketName=n,this.indexName=r}async putVectors(t){var e=()=>super.putVectors,n=this;return e().call(n,Be(Be({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(t){var e=()=>super.getVectors,n=this;return e().call(n,Be(Be({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,n=this;return e().call(n,Be(Be({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,n=this;return e().call(n,Be(Be({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,n=this;return e().call(n,Be(Be({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},T6=class extends y6{constructor(t,e={},n,r){super(t,e,n,r)}from(t){return new m6(this.url,this.headers,t,this.fetch)}get vectors(){return new E6(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new v6(this.url+"/iceberg",this.headers,this.fetch)}};const C6="2.30.0",S6={"X-Client-Info":`supabase-js/${C6}`};var sf={exports:{}},ib;function k6(){return ib||(ib=1,(function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Ia<"u"&&Ia,r=(function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i})();(function(i){(function(a){var c=typeof i<"u"&&i||typeof self<"u"&&self||typeof Ia<"u"&&Ia||{},u={searchParams:"URLSearchParams"in c,iterable:"Symbol"in c&&"iterator"in Symbol,blob:"FileReader"in c&&"Blob"in c&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in c,arrayBuffer:"ArrayBuffer"in c};
vendor: 5,026 bytes, line 74
74function d(H){return H&&DataView.prototype.isPrototypeOf(H)}if(u.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=ArrayBuffer.isView||function(H){return H&&f.indexOf(Object.prototype.toString.call(H))>-1};function y(H){if(typeof H!="string"&&(H=String(H)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(H)||H==="")throw new TypeError('Invalid character in header field name: "'+H+'"');return H.toLowerCase()}function x(H){return typeof H!="string"&&(H=String(H)),H}function b(H){var J={next:function(){var le=H.shift();return{done:le===void 0,value:le}}};return u.iterable&&(J[Symbol.iterator]=function(){return J}),J}function E(H){this.map={},H instanceof E?H.forEach(function(J,le){this.append(le,J)},this):Array.isArray(H)?H.forEach(function(J){if(J.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+J.length);this.append(J[0],J[1])},this):H&&Object.getOwnPropertyNames(H).forEach(function(J){this.append(J,H[J])},this)}E.prototype.append=function(H,J){H=y(H),J=x(J);var le=this.map[H];this.map[H]=le?le+", "+J:J},E.prototype.delete=function(H){delete this.map[y(H)]},E.prototype.get=function(H){return H=y(H),this.has(H)?this.map[H]:null},E.prototype.has=function(H){return this.map.hasOwnProperty(y(H))},E.prototype.set=function(H,J){this.map[y(H)]=x(J)},E.prototype.forEach=function(H,J){for(var le in this.map)this.map.hasOwnProperty(le)&&H.call(J,this.map[le],le,this)},E.prototype.keys=function(){var H=[];return this.forEach(function(J,le){H.push(le)}),b(H)},E.prototype.values=function(){var H=[];return this.forEach(function(J){H.push(J)}),b(H)},E.prototype.entries=function(){var H=[];return this.forEach(function(J,le){H.push([le,J])}),b(H)},u.iterable&&(E.prototype[Symbol.iterator]=E.prototype.entries);function w(H){if(!H._noBody){if(H.bodyUsed)return Promise.reject(new TypeError("Already read"));H.bodyUsed=!0}}function R(H){return new Promise(function(J,le){H.onload=function(){J(H.result)},H.onerror=function(){le(H.error)}})}function C(H){var J=new FileReader,le=R(J);return J.readAsArrayBuffer(H),le}function k(H){var J=new FileReader,le=R(J),K=/charset=([A-Za-z0-9_-]+)/.exec(H.type),re=K?K[1]:"utf-8";return J.readAsText(H,re),le}function N(H){for(var J=new Uint8Array(H),le=new Array(J.length),K=0;K<J.length;K++)le[K]=String.fromCharCode(J[K]);return le.join("")}function V(H){if(H.slice)return H.slice(0);var J=new Uint8Array(H.byteLength);return J.set(new Uint8Array(H)),J.buffer}function $(){return this.bodyUsed=!1,this._initBody=function(H){this.bodyUsed=this.bodyUsed,this._bodyInit=H,H?typeof H=="string"?this._bodyText=H:u.blob&&Blob.prototype.isPrototypeOf(H)?this._bodyBlob=H:u.formData&&FormData.prototype.isPrototypeOf(H)?this._bodyFormData=H:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(H)?this._bodyText=H.toString():u.arrayBuffer&&u.blob&&d(H)?(this._bodyArrayBuffer=V(H.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(H)||g(H))?this._bodyArrayBuffer=V(H):this._bodyText=H=Object.prototype.toString.call(H):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof H=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(H)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var H=w(this);if(H)return H;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var H=w(this);return H||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(u.blob)return this.blob().then(C);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var H=w(this);if(H)return H;if(this._bodyBlob)return k(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(N(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(O)}),this.json=function(){return this.text().then(JSON.parse)},this}var D=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function I(H){var J=H.toUpperCase();return D.indexOf(J)>-1?J:H}function B(H,J){if(!(this instanceof B))throw new TypeError('Please use the "new" operator, this DOM object c
74onstructor cannot be called as a function.');J=J||{};var le=J.body;if(H instanceof B){if(H.bodyUsed)throw new TypeError("Already read");this.url=H.url,this.credentials=H.credentials,J.headers||(this.headers=new E(H.headers)),this.method=H.method,this.mode=H.mode,this.signal=H.signal,!le&&H._bodyInit!=null&&(le=H._bodyInit,H.bodyUsed=!0)}else this.url=String(H);if(this.credentials=J.credentials||this.credentials||"same-origin",(J.headers||!this.headers)&&(this.headers=new E(J.headers)),this.method=I(J.method||this.method||"GET"),this.mode=J.mode||this.mode||null,this.signal=J.signal||this.signal||(function(){if("AbortController"in c){var ee=new AbortController;return ee.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&le)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(le),(this.method==="GET"||this.method==="HEAD")&&(J.cache==="no-store"||J.cache==="no-cache")){var K=/([?&])_=[^&]*/;if(K.test(this.url))this.url=this.url.replace(K,"$1_="+new Date().getTime());else{var re=/\?/;this.url+=(re.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}B.prototype.clone=function(){return new B(this,{body:this._bodyInit})};function O(H){var J=new FormData;return H.trim().split("&").forEach(function(le){if(le){var K=le.split("="),re=K.shift().replace(/\+/g," "),ee=K.join("=").replace(/\+/g," ");J.append(decodeURIComponent(re),decodeURIComponent(ee))}}),J}function F(H){var J=new E,le=H.replace(/\r?\n[\t ]+/g," ");return le.split("\r").map(function(K){return K.indexOf(`
75`)===0?K.substr(1,K.length):K}).forEach(function(K){var re=K.split(":"),ee=re.shift().trim();if(ee){var U=re.join(":").trim();try{J.append(ee,U)}catch{}}}),J}$.call(B.prototype);function L(H,J){if(!(this instanceof L))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(J||(J={}),this.type="default",this.status=J.status===void 0?200:J.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=J.statusText===void 0?"":""+J.statusText,this.headers=new E(J.headers),this.url=J.url||"",this._initBody(H)}$.call(L.prototype),L.prototype.clone=function(){return new L(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new E(this.headers),url:this.url})},L.error=function(){var H=new L(null,{status:200,statusText:""});return H.ok=!1,H.status=0,H.type="error",H};var M=[301,302,303,307,308];L.redirect=function(H,J){if(M.indexOf(J)===-1)throw new RangeError("Invalid status code");return new L(null,{status:J,headers:{location:H}})},a.DOMException=c.DOMException;try{new a.DOMException}catch{a.DOMException=function(J,le){this.message=J,this.name=le;var K=Error(J);this.stack=K.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function se(H,J){return new Promise(function(le,K){var re=new B(H,J);if(re.signal&&re.signal.aborted)return K(new a.DOMException("Aborted","AbortError"));var ee=new XMLHttpRequest;function U(){ee.abort()}ee.onload=function(){var Q={statusText:ee.statusText,headers:F(ee.getAllResponseHeaders()||"")};re.url.indexOf("file://")===0&&(ee.status<200||ee.status>599)?Q.status=200:Q.status=ee.status,Q.url="responseURL"in ee?ee.responseURL:Q.headers.get("X-Request-URL");var pe="response"in ee?ee.response:ee.responseText;setTimeout(function(){le(new L(pe,Q))},0)},ee.onerror=function(){setTimeout(function(){K(new TypeError("Network request failed"))},0)},ee.ontimeout=function(){setTimeout(function(){K(new TypeError("Network request timed out"))},0)},ee.onabort=function(){setTimeout(function(){K(new a.DOMException("Aborted","AbortError"))},0)};function W(Q){try{return Q===""&&c.location.href?c.location.href:Q}catch{return Q}}if(ee.open(re.method,W(re.url),!0),re.credentials==="include"?ee.withCredentials=!0:re.credentials==="omit"&&(ee.withCredentials=!1),"responseType"in ee&&(u.blob?ee.responseType="blob":u.arrayBuffer&&(ee.responseType="arraybuffer")),J&&typeof J.headers=="object"&&!(J.headers instanceof E||c.Headers&&J.headers instanceof c.Headers)){var te=[];
75Object.getOwnPropertyNames(J.headers).forEach(function(Q){te.push(y(Q)),ee.setRequestHeader(Q,x(J.headers[Q]))}),re.headers.forEach(function(Q,pe){te.indexOf(pe)===-1&&ee.setRequestHeader(pe,Q)})}else re.headers.forEach(function(Q,pe){ee.setRequestHeader(pe,Q)});re.signal&&(re.signal.addEventListener("abort",U),ee.onreadystatechange=function(){ee.readyState===4&&re.signal.removeEventListener("abort",U)}),ee.send(typeof re._bodyInit>"u"?null:re._bodyInit)})}return se.polyfill=!0,c.fetch||(c.fetch=se,c.Headers=E,c.Request=B,c.Response=L),a.Headers=E,a.Request=B,a.Response=L,a.fetch=se,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var s=n.fetch?n:r;e=s.fetch,e.default=s.fetch,e.fetch=s.fetch,e.Headers=s.Headers,e.Request=s.Request,e.Response=s.Response,t.exports=e})(sf,sf.exports)),sf.exports}var u_=k6();const ak=xc(u_),I6=CS({__proto__:null,default:ak},[u_]);var P6=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function c(f){try{d(r.next(f))}catch(g){a(g)}}function u(f){try{d(r.throw(f))}catch(g){a(g)}}function d(f){f.done?i(f.value):s(f.value).then(c,u)}d((r=r.apply(t,e||[])).next())})};const R6=t=>{let e;return t?e=t:typeof fetch>"u"?e=ak:e=fetch,(...n)=>e(...n)},D6=()=>typeof Headers>"u"?u_.Headers:Headers,N6=(t,e,n)=>{const r=R6(n),s=D6();return(i,a)=>P6(void 0,void 0,void 0,function*(){var c;const u=(c=yield e())!==null&&c!==void 0?c:t;let d=new s(a?.headers);return d.has("apikey")||d.set("apikey",t),d.has("Authorization")||d.set("Authorization",`Bearer ${u}`),r(i,Object.assign(Object.assign({},a),{headers:d}))})};function O6(t){return t.replace(/\/$/,"")}function L6(t,e){const{db:n,auth:r,realtime:s,global:i}=t,{db:a,auth:c,realtime:u,global:d}=e;return{db:Object.assign(Object.assign({},a),n),auth:Object.assign(Object.assign({},c),r),realtime:Object.assign(Object.assign({},u),s),global:Object.assign(Object.assign({},d),i)}}function F6(t){return Math.round(Date.now()/1e3)+t}function j6(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}const Di=()=>typeof document<"u",xa={tested:!1,writable:!1},Ff=()=>{if(!Di())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(xa.tested)return xa.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),xa.tested=!0,xa.writable=!0}catch{xa.tested=!0,xa.writable=!1}return xa.writable};function Sr(t,e){var n;e||(e=((n=window?.location)===null||n===void 0?void 0:n.href)||""),t=t.replace(/[\[\]]/g,"\\$&");const r=new RegExp("[?&#]"+t+"(=([^&#]*)|&|#|$)"),s=r.exec(e);return s?s[2]?decodeURIComponent(s[2].replace(/\+/g," ")):"":null}const lk=t=>{let e;return t?e=t:typeof fetch>"u"?e=async(...n)=>await(await Pe(async()=>{const{fetch:r}=await Promise.resolve().then(()=>I6);return{fetch:r}},[])).fetch(...n):e=fetch,(...n)=>e(...n)},M6=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Su=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},of=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},$g=async(t,e)=>{await t.removeItem(e)};function B6(t){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let n="",r,s,i,a,c,u,d,f=0;for(t=t.replace("-","+").replace("_","/");f<t.length;)a=e.indexOf(t.charAt(f++)),c=e.indexOf(t.charAt(f++)),u=e.indexOf(t.charAt(f++)),d=e.indexOf(t.charAt(f++)),r=a<<2|c>>4,s=(c&15)<<4|u>>2,i=(u&3)<<6|d,n=n+String.fromCharCode(r),u!=64&&s!=0&&(n=n+String.fromCharCode(s)),d!=64&&i!=0&&(n=n+String.fromCharCode(i));return n}let ck=class uk{constructor(){this.promise=new uk.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}};ck.promiseConstructor=Promise;function ob(t){const e=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,n=t.split(".");if(n.length!==3)throw new Error("JWT is not valid: not a JWT structure");
75if(!e.test(n[1]))throw new Error("JWT is not valid: payload is not in base64url format");const r=n[1];return JSON.parse(B6(r))}function V6(t){return new Promise(e=>{setTimeout(()=>e(null),t)})}function U6(t,e){return new Promise((r,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const a=await t(i);if(!e(i,null,a)){r(a);return}}catch(a){if(!e(i,a)){s(a);return}}})()})}function $6(t){return("0"+t.toString(16)).substr(-2)}function af(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let i=0;i<56;i++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(e),Array.from(e,$6).join("")}async function z6(t){const n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}function H6(t){return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function lf(t){if(typeof crypto>"u")return t;const e=await z6(t);return H6(e)}const q6="__stack_guard__",W6="__",G6=/__stack_guard__([a-zA-Z0-9_-]+)__/;let ab=!1,d_;function Wy(t){var e,n;d_();let r;try{throw new Error}catch(i){r=i}const s=(n=(e=r.stack)===null||e===void 0?void 0:e.split(`
76`))!==null&&n!==void 0?n:[];for(let i=0;i<s.length;i+=1){const c=s[i].match(G6);if(c&&c[1]===t)return!0}return!1}async function Gy(t,e){await d_();const n=`${q6}${t}${W6}`;return await{[n]:async()=>await e()}[n]()}d_=async()=>{ab||(ab=!0,await Gy("ENV_CHECK",async()=>{const t=Wy("ENV_CHECK");return t}))};class h_ extends Error{constructor(e,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n}}function ut(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class K6 extends h_{constructor(e,n){super(e,n),this.name="AuthApiError",this.status=n}toJSON(){return{name:this.name,message:this.message,status:this.status}}}function Y6(t){return ut(t)&&t.name==="AuthApiError"}class dk extends h_{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class Cc extends h_{constructor(e,n,r){super(e),this.name=n,this.status=r}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class Ul extends Cc{constructor(){super("Auth session missing!","AuthSessionMissingError",400)}}class zg extends Cc{constructor(){super("Auth session or user missing","AuthInvalidToken
76ResponseError",500)}}class cf extends Cc{constructor(e){super(e,"AuthInvalidCredentialsError",400)}}class Ii extends Cc{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Hg extends Cc{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Ky extends Cc{constructor(e,n){super(e,"AuthRetryableFetchError",n)}}function lb(t){return ut(t)&&t.name==="AuthRetryableFetchError"}var Q6=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n};const Ou=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),J6=[502,503,504];async function cb(t){if(!M6(t))throw new Ky(Ou(t),0);if(J6.includes(t.status))throw new Ky(Ou(t),t.status);let e;try{e=await t.json()}catch(n){throw new dk(Ou(n),n)}throw new K6(Ou(e),t.status||500)}const X6=(t,e,n,r)=>{const s={method:t,headers:e?.headers||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))};async function mt(t,e,n,r){var s;const i=Object.assign({},r?.headers);r?.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const a=(s=r?.query)!==null&&s!==void 0?s:{};r?.redirectTo&&(a.redirect_to=r.redirectTo);const c=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",u=await Z6(t,e,n+c,{headers:i,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(u):{data:Object.assign({},u),error:null}}async function Z6(t,e,n,r,s,i){const a=X6(e,r,s,i);let c;try{c=await t(n,a)}catch(u){throw new Ky(Ou(u),0)}if(c.ok||await cb(c),r?.noResolveJson)return c;try{return await c.json()}catch(u){await cb(u)}}function xo(t){var e;let n=null;rL(t)&&(n=Object.assign({},t),n.expires_at=F6(t.expires_in));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:r},error:null}}function ka(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function eL(t){return{data:t,error:null}}function tL(t){const{action_link:e,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i}=t,a=Q6(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:e,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i},u=Object.assign({},a);return{data:{properties:c,user:u},error:null}}function nL(t){return t}function rL(t){return t.access_token&&t.refresh_token&&t.expires_in}var sL=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n};class iL{constructor({url:e="",headers:n={},fetch:r}){this.url=e,this.headers=n,this.fetch=lk(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,n="global"){try{return await mt(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ut(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,n={}){try{return await mt(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:ka})}catch(r){if(ut(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:n}=e,r=sL(e,["options"]),s=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(s.new_email=r?.newEmail,delete s.newEmail),await mt(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:tL,redirectTo:n?.redirectTo})}catch(n){if(ut(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await mt(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ka})}catch(n){if(ut(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,r,s,i,a,c,u;try{const d={nextPage:null,lastPage:0,total:0},f=await mt(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=e?.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:nL});if(f.error)throw f.error;const g=await f.json(),y=(a=f.headers.get("x-total-count"))!==null&&a!==void 0?a:0,x=(u=(c=f.headers.get("link"))===null||c===void 0?void 0:c.split(","))!==null&&u!==void 0?u:[];return x.length>
760&&(x.forEach(b=>{const E=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(b.split(";")[1].split("=")[1]);d[`${w}Page`]=E}),d.total=parseInt(y)),{data:Object.assign(Object.assign({},g),d),error:null}}catch(d){if(ut(d))return{data:{users:[]},error:d};throw d}}async getUserById(e){try{return await mt(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ka})}catch(n){if(ut(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){try{return await mt(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:ka})}catch(r){if(ut(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,n=!1){try{return await mt(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:ka})}catch(r){if(ut(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){try{const{data:n,error:r}=await mt(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:n,error:r}}catch(n){if(ut(n))return{data:null,error:n};throw n}}async _deleteFactor(e){try{return{data:await mt(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(ut(n))return{data:null,error:n};throw n}}}const oL="2.43.1",aL="http://localhost:9999",lL="supabase.auth.token",cL={"X-Client-Info":`gotrue-js/${oL}`},ub=10,db={getItem:t=>Ff()?globalThis.localStorage.getItem(t):null,setItem:(t,e)=>{Ff()&&globalThis.localStorage.setItem(t,e)},removeItem:t=>{Ff()&&globalThis.localStorage.removeItem(t)}};function uL(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}uL();const dL={url:aL,storageKey:lL,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:cL,flowType:"implicit",debug:!1},uf=30*1e3,hb=3;class cd{constructor(e){var n;this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.broadcastChannel=null,this.instanceID=cd.nextInstanceID,cd.nextInstanceID+=1,this.instanceID>0&&Di();const r=Object.assign(Object.assign({},dL),e);if(this.logDebugMessages=r.debug,this.inMemorySession=null,this.storageKey=r.storageKey,this.autoRefreshToken=r.autoRefreshToken,this.persistSession=r.persistSession,this.storage=r.storage||db,this.admin=new iL({url:r.url,headers:r.headers,fetch:r.fetch}),this.url=r.url,this.headers=r.headers,this.fetch=lk(r.fetch),this.detectSessionInUrl=r.detectSessionInUrl,this.flowType=r.flowType,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession&&this.storage===db&&Ff(),Di()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch{}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async s=>{this._debug("received broadcast notification from other tab or client",s),await this._notifyAllSubscribers(s.data.event,s.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages,this}initialize(){return this.initializePromise?this.initializePromise:this._initialize()}async _initialize(){if(this.initializePromise)throw new Error("Double call of #_initialize()");return this.initializePromise=Gy("_initialize",async()=>{try{const e=Di()?await this._isPKCEFlow():!1;if(this._debug("#_initialize()","begin","is PKCE flow",e),e||this.detectSessionInUrl&&this._isImplicitGrantFlow()){const{data:n,error:r}=await this._getSessionFromUrl(e);if(r)return this._debug("#_initialize()","error detecting session from URL",r),await this._removeSession(),{error:r};const{session:s,redirectType:i}=n;return this._debug("#_initialize()","detected session in URL",s,"redirect type",i),await this._saveSession(s),setTimeout(async()=>{i==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",s):await this._notifyAllSubscribers("SIGNED_IN",s)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return ut(e)?{error:e}:{error:new dk("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}),await this.initializePromise}async signUp(e){var n,r,s;try{await this._removeSession();let i;if("email"in e){const{email:f,password:g,options:y}=e;let x=null,b=null;if(this.flowType==="pkce"){const E=af();await Su(this.storage,`${this.storageKey}-code-verifier`,E),x=await lf(E),b=E===x?"plain":"s256"}i=await mt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:y?.emailRedirectTo,body:{email:f,password:g,data:(n=y?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:y?.captchaToken},code_challenge:x,code_challenge_method:b},xform:xo})}else if("phone"in e){const{phone:f,password:g,options:y}=e;i=await mt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:f,password:g,data:(r=y?.data)!==null&&r!==void 0?r:{},channel:(s=y?.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:y?.captchaToken}},xform:xo})}else throw new cf("You must provide either an email or phone number and a password");const{data:a,error:c}=i;
76if(c||!a)return{data:{user:null,session:null},error:c};const u=a.session,d=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:d,session:u},error:null}}catch(i){if(ut(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(e){try{await this._removeSession();let n;if("email"in e){const{email:i,password:a,options:c}=e;n=await mt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:a,gotrue_meta_security:{captcha_token:c?.captchaToken}},xform:xo})}else if("phone"in e){const{phone:i,password:a,options:c}=e;n=await mt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:c?.captchaToken}},xform:xo})}else throw new cf("You must provide either an email or phone number and a password");const{data:r,error:s}=n;return s?{data:{user:null,session:null},error:s}:!r||!r.session||!r.user?{data:{user:null,session:null},error:new zg}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:{user:r.user,session:r.session},error:s})}catch(n){if(ut(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(e){var n,r,s,i;return await this._removeSession(),await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){const n=await of(this.storage,`${this.storageKey}-code-verifier`),{data:r,error:s}=await mt(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:xo});return await $g(this.storage,`${this.storageKey}-code-verifier`),s?{data:{user:null,session:null},error:s}:!r||!r.session||!r.user?{data:{user:null,session:null},error:new zg}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:r,error:s})}async signInWithIdToken(e){await this._removeSession();try{const{options:n,provider:r,token:s,access_token:i,nonce:a}=e,c=await mt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:a,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:xo}),{data:u,error:d}=c;return d?{data:{user:null,session:null},error:d}:!u||!u.session||!u.user?{data:{user:null,session:null},error:new zg}:(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),{data:u,error:d})}catch(n){if(ut(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(e){var n,r,s,i,a;try{if(await this._removeSession(),"email"in e){const{email:c,options:u}=e;let d=null,f=null;if(this.flowType==="pkce"){const y=af();await Su(this.storage,`${this.storageKey}-code-verifier`,y),d=await lf(y),f=y===d?"plain":"s256"}const{error:g}=await mt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:c,data:(n=u?.data)!==null&&n!==void 0?n:{},create_user:(r=u?.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:d,code_challenge_method:f},redirectTo:u?.emailRedirectTo});return{data:{user:null,session:null},error:g}}if("phone"in e){const{phone:c,options:u}=e,{data:d,error:f}=await mt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:c,data:(s=u?.data)!==null&&s!==void 0?s:{},create_user:(i=u?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(a=u?.channel)!==null&&a!==void 0?a:"sms"}});return{data:{user:null,session:null,messageId:d?.message_id},error:f}}throw new cf("You must provide either an email or phone number.")}catch(c){if(ut(c))return{data:{user:null,session:null},error:c};throw c}}async verifyOtp(e){var n,r;
76try{e.type!=="email_change"&&e.type!=="phone_change"&&await this._removeSession();const{data:s,error:i}=await mt(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:(n=e.options)===null||n===void 0?void 0:n.captchaToken}}),redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,xform:xo});if(i)throw i;if(!s)throw new Error("An error occurred on token verification.");const a=s.session,c=s.user;return a?.access_token&&(await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:c,session:a},error:null}}catch(s){if(ut(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithSSO(e){var n,r,s;try{return await this._removeSession(),await mt(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(r=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=e?.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0}),headers:this.headers,xform:eL})}catch(i){if(ut(i))return{data:null,error:i};throw i}}async reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)throw r;if(!n)throw new Ul;const{error:s}=await mt(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:s}})}catch(e){if(ut(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{e.type!="email_change"&&e.type!="phone_change"&&await this._removeSession();const n=`${this.url}/resend`;if("email"in e){const{email:r,type:s,options:i}=e,{error:a}=await mt(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:i?.captchaToken}},redirectTo:i?.emailRedirectTo});return{data:{user:null,session:null},error:a}}else if("phone"in e){const{phone:r,type:s,options:i}=e,{data:a,error:c}=await mt(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:i?.captchaToken}}});return{data:{user:null,session:null,messageId:a?.message_id},error:c}}throw new cf("You must provide either an email or phone number and a type")}catch(n){if(ut(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return this._useSession(async e=>e)}async _useSession(e){return await Gy("_useSession",async()=>{const n=await this.__loadSession();return await e(n)})}async __loadSession(){if(this._debug("#__loadSession()","begin"),this.logDebugMessages&&!Wy("_useSession"))throw new Error("Please use #_useSession()");Wy("_initialize")||await this.initializePromise;try{let e=null;if(this.persistSession){const i=await of(this.storage,this.storageKey);this._debug("#getSession()","session from storage",i),i!==null&&(this._isValidSession(i)?e=i:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession()))}else e=this.inMemorySession,this._debug("#getSession()","session from memory",e);if(!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n)return{data:{session:e},error:null};const{session:r,error:s}=await this._callRefreshToken(e.refresh_token);return s?{data:{session:null},error:s}:{data:{session:r},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){try{return await this._useSession(async n=>{var r,s;if(!e){const{data:i,error:a}=n;if(a)throw a;e=(s=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0}return await mt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ka})})}catch(n){if(ut(n))return{data:{user:null},error:n};throw n}}async updateUser(e,n={}){try{return await this._useSession(async r=>{const{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new Ul;const a=s.session,{data:c,error:u}=await mt(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:e,jwt:a.access_token,xform:ka});if(u)throw u;return a.user=c.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),{data:{user:a.user},error:null}})}catch(r){if(ut(r))return{data:{user:null},error:r};throw r}}_decodeJWT(e){return ob(e)}async setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Ul;const n=Date.now()/1e3;let r=n,s=!0,i=null;const a=ob(e.access_token);if(a.exp&&(r=a.exp,s=r<=n),s){const{session:c,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return{data:{user:null,session:null},error:u};if(!c)return{data:{user:null,session:null},error:null};i=c}else{const{data:c,error:u}=await this.getUser(e.access_token);if(u)throw u;i={access_token:e.access_token,refresh_token:e.refresh_token,user:c.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(n){if(ut(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(e){try{return await this._useSession(async n=>{var r;if(!e){const{data:a,error:c}=n;if(c)throw c;e=(r=a.session)!==null&&r!==void 0?r:void 0}if(!e?.refresh_token)throw new Ul;const{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:s?{data:{user:s.user,session:s},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(ut(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromUrl(e){try{if(!Di())throw new Ii("No browser detected.");
76if(this.flowType==="implicit"&&!this._isImplicitGrantFlow())throw new Ii("Not a valid implicit grant flow url.");if(this.flowType=="pkce"&&!e)throw new Hg("Not a valid PKCE flow url.");if(e){const w=Sr("code");if(!w)throw new Hg("No code detected.");const{data:R,error:C}=await this.exchangeCodeForSession(w);if(C)throw C;if(!R.session)throw new Hg("No session detected.");let k=new URL(window.location.href);return k.searchParams.delete("code"),window.history.replaceState(window.history.state,"",k.toString()),{data:{session:R.session,redirectType:null},error:null}}const n=Sr("error_description");if(n){const w=Sr("error_code");if(!w)throw new Ii("No error_code detected.");const R=Sr("error");throw R?new Ii(n,{error:R,code:w}):new Ii("No error detected.")}const r=Sr("provider_token"),s=Sr("provider_refresh_token"),i=Sr("access_token");if(!i)throw new Ii("No access_token detected.");const a=Sr("expires_in");if(!a)throw new Ii("No expires_in detected.");const c=Sr("refresh_token");if(!c)throw new Ii("No refresh_token detected.");const u=Sr("token_type");if(!u)throw new Ii("No token_type detected.");const f=Math.round(Date.now()/1e3)+parseInt(a),{data:g,error:y}=await this.getUser(i);if(y)throw y;const x=g.user,b={provider_token:r,provider_refresh_token:s,access_token:i,expires_in:parseInt(a),expires_at:f,refresh_token:c,token_type:u,user:x},E=Sr("type");return window.location.hash="",this._debug("#_getSessionFromUrl()","clearing window.location.hash"),{data:{session:b,redirectType:E},error:null}}catch(n){if(ut(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantFlow(){return Di()&&(!!Sr("access_token")||!!Sr("error_description"))}async _isPKCEFlow(){const e=await of(this.storage,`${this.storageKey}-code-verifier`);return!!Sr("code")&&!!e}async signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return{error:i};const a=(r=s.session)===null||r===void 0?void 0:r.access_token;if(a){const{error:c}=await this.admin.signOut(a,e);if(c&&!(Y6(c)&&(c.status===404||c.status===401)))return{error:c}}return e!=="others"&&(await this._removeSession(),await $g(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(e){const n=j6(),r={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),this._emitInitialSession(n),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async n=>{var r,s;try{const{data:{session:i},error:a}=n;if(a)throw a;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i)}})}async resetPasswordForEmail(e,n={}){let r=null,s=null;if(this.flowType==="pkce"){const i=af();await Su(this.storage,`${this.storageKey}-code-verifier`,i),r=await lf(i),s=i===r?"plain":"s256"}try{return await mt(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(ut(i))return{data:null,error:i};throw i}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await U6(async s=>(await V6(s*200),this._debug(n,"refreshing attempt",s),await mt(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:xo})),(s,i,a)=>a&&a.error&&lb(a.error)&&Date.now()+(s+1)*200-r<uf)}catch(r){if(this._debug(n,"error",r),ut(r))return{data:{session:null,user:null},error:r};throw r}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const r=await this._getUrlForProvider(e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",r),Di()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const r=await of(this.storage,this.storageKey);if(this._debug(n,"session from storage",r),!this._isValidSession(r)){this._debug(n,"session is not val
76id"),r!==null&&await this._removeSession();return}const s=Math.round(Date.now()/1e3),i=((e=r.expires_at)!==null&&e!==void 0?e:1/0)<s+ub;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${ub}s`),i){if(this.autoRefreshToken&&r.refresh_token){const{error:a}=await this._callRefreshToken(r.refresh_token);a&&(lb(a)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",r)}catch(r){this._debug(n,"error",r);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var n,r;if(!e)throw new Ul;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new ck;const{data:i,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!i.session)throw new Ul;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const c={session:i.session,error:null};return this.refreshingDeferred.resolve(c),c}catch(i){if(this._debug(s,"error",i),ut(i)){const a={session:null,error:i};return(n=this.refreshingDeferred)===null||n===void 0||n.resolve(a),a}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,n,r=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:n});const i=[],a=Array.from(this.stateChangeEmitters.values()).map(async c=>{try{await c.callback(e,n)}catch(u){i.push(u)}});if(await Promise.all(a),i.length>0){for(let c=0;c<i.length;c+=1);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.persistSession||(this.inMemorySession=e),this.persistSession&&e.expires_at&&await this._persistSession(e)}_persistSession(e){return this._debug("#_persistSession()",e),Su(this.storage,this.storageKey,e)}async _removeSession(){this._debug("#_removeSession()"),this.persistSession?await $g(this.storage,this.storageKey):this.inMemorySession=null}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Di()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch{}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),uf);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),await this._autoRefreshTokenTick()}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-e)/uf);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${uf}ms, refresh threshold is ${hb} ticks`),s<=hb&&await this._callRefreshToken(r.refresh_token)})}catch{}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Di()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch{}}async _onVisibilityChanged(e){this._debug(`#_onVisibilityChanged(${e})`,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(e||(await this.initializePromise,await this._recoverAndRefresh(),this._debug("#_onVisibilityChanged()","finished waiting for initialize, _recoverAndRefresh")),this.autoRefreshToken&&this._startAutoRefresh()):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n){const r=[`provider=${encodeURIComponent(e)}`];if(n?.redirectTo&&r.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n?.scopes&&r.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const s=af();await Su(this.storage,`${this.storageKey}-code-verifier`,s);const i=await lf(s),a=s===i?"plain":"s256";this._debug("PKCE","code verifier",`${s.substring(0,5)}...`,"code challenge",i,"method",a);const c=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});
76r.push(c.toString())}if(n?.queryParams){const s=new URLSearchParams(n.queryParams);r.push(s.toString())}return`${this.url}/authorize?${r.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;return i?{data:null,error:i}:await mt(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(ut(n))return{data:null,error:n};throw n}}async _enroll(e){try{return await this._useSession(async n=>{var r,s;const{data:i,error:a}=n;if(a)return{data:null,error:a};const{data:c,error:u}=await mt(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:e.friendlyName,factor_type:e.factorType,issuer:e.issuer},headers:this.headers,jwt:(r=i?.session)===null||r===void 0?void 0:r.access_token});return u?{data:null,error:u}:(!((s=c?.totp)===null||s===void 0)&&s.qr_code&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),{data:c,error:null})})}catch(n){if(ut(n))return{data:null,error:n};throw n}}async _verify(e){try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return{data:null,error:i};const{data:a,error:c}=await mt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token});return c?{data:null,error:c}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:c})})}catch(n){if(ut(n))return{data:null,error:n};throw n}}async _challenge(e){try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;return i?{data:null,error:i}:await mt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(ut(n))return{data:null,error:n};throw n}}async _challengeAndVerify(e){const{data:n,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){const{data:{user:e},error:n}=await this.getUser();if(n)return{data:null,error:n};const r=e?.factors||[],s=r.filter(i=>i.factor_type==="totp"&&i.status==="verified");return{data:{all:r,totp:s},error:null}}async _getAuthenticatorAssuranceLevel(){return await this._useSession(async e=>{var n,r;const{data:{session:s},error:i}=e;if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const a=this._decodeJWT(s.access_token);let c=null;a.aal&&(c=a.aal);let u=c;((r=(n=s.user.factors)===null||n===void 0?void 0:n.filter(g=>g.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(u="aal2");const f=a.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:f},error:null}})}}cd.nextInstanceID=0;class hL extends cd{constructor(e){super(e)}}var fL=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function c(f){try{d(r.next(f))}catch(g){a(g)}}function u(f){try{d(r.throw(f))}catch(g){a(g)}}function d(f){f.done?i(f.value):s(f.value).then(c,u)}d((r=r.apply(t,e||[])).next())})};const pL={headers:S6},mL={schema:"public"},gL={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},yL={};class vL{constructor(e,n,r){var s,i,a,c,u,d,f,g;if(this.supabaseUrl=e,this.supabaseKey=n,!e)throw new Error("supabaseUrl is required.");if(!n)throw new Error("supabaseKey is required.");const y=O6(e);this.realtimeUrl=`${y}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${y}/auth/v1`,this.storageUrl=`${y}/storage/v1`,this.functionsUrl=`${y}/functions/v1`;const x=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,b={db:mL,realtime:yL,auth:Object.assign(Object.assign({},gL),{storageKey:x}),global:pL},E=L6(r??{},b);this.storageKey=(i=(s=E.auth)===null||s===void 0?void 0:s.storageKey)!==null&&i!==void 0?i:"",this.headers=(c=(a=E.global)===null||a===void 0?void 0:a.headers)!==null&&c!==void 0?c:{},this.auth=this._initSupabaseAuthClient((u=E.auth)!==null&&u!==void 0?u:{},this.headers,(d=E.global)===null||d===void 0?void 0:d.fetch),this.fetch=N6(n,this._getAccessToken.bind(this),(f=E.global)===null||f===void 0?void 0:f.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},E.realtime)),this.rest=new DO(`${y}/rest/v1`,{headers:this.headers,schema:(g=E.db)===null||g===void 0?void 0:g.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new _O(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}
76get storage(){return new T6(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}rpc(e,n={},r){return this.rest.rpc(e,n,r)}channel(e,n={config:{}}){return this.realtime.channel(e,n)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,n;return fL(this,void 0,void 0,function*(){const{data:r}=yield this.auth.getSession();return(n=(e=r.session)===null||e===void 0?void 0:e.access_token)!==null&&n!==void 0?n:null})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:n,detectSessionInUrl:r,storage:s,storageKey:i,flowType:a,debug:c},u,d){const f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new hL({url:this.authUrl,headers:Object.assign(Object.assign({},f),u),storageKey:i,autoRefreshToken:e,persistSession:n,detectSessionInUrl:r,storage:s,flowType:a,debug:c,fetch:d})}_initRealtimeClient(e){return new YO(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,r)=>{this._handleTokenChanged(n,"CLIENT",r?.access_token)})}_handleTokenChanged(e,n,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?(this.realtime.setAuth(r??null),this.changedAccessToken=r):e==="SIGNED_OUT"&&(this.realtime.setAuth(this.supabaseKey),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const _L=(t,e,n)=>new vL(t,e,n),xL="https://fhdazecpdftfewdmmufb.supabase.co",wL="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZoZGF6ZWNwZGZ0ZmV3ZG1tdWZiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njg1Mzc0ODUsImV4cCI6MjA4NDExMzQ4NX0.6b6wbexY7an9RvFrke_cHRXTWtwGbeqaP5wRp9fRxeU",EL=(t,e={})=>{const n=new Headers(e.headers||{});return n.get("Accept")?.includes("vnd.pgrst.object")&&n.set("Accept","application/json"),n.has("Accept")||n.set("Accept","application/json"),(e.method==="POST"||e.method==="PATCH")&&(n.has("Content-Type")||n.set("Content-Type","application/json")),fetch(t,{...e,headers:n})},$e=_L(xL,wL,{global:{fetch:EL},db:{schema:"public"},auth:{persistSession:!0,autoRefreshToken:!0}});function bL(t={}){const{nonce:e,locale:n,onScriptLoadSuccess:r,onScriptLoadError:s}=t,[i,a]=S.useState(!1),c=S.useRef(r);c.current=r;const u=S.useRef(s);return u.current=s,S.useEffect(()=>{const d=document.createElement("script");return d.src="https://accounts.google.com/gsi/client",n&&(d.src+=`?hl=${n}`),d.async=!0,d.defer=!0,d.nonce=e,d.onload=()=>{var f;a(!0),(f=c.current)===null||f===void 0||f.call(c)},d.onerror=()=>{var f;a(!1),(f=u.current)===null||f===void 0||f.call(u)},document.body.appendChild(d),()=>{document.body.removeChild(d)}},[e]),i}const hk=S.createContext(null);function AL({clientId:t,nonce:e,locale:n,onScriptLoadSuccess:r,onScriptLoadError:s,children:i}){const a=bL({nonce:e,onScriptLoadSuccess:r,onScriptLoadError:s,locale:n}),c=S.useMemo(()=>({locale:n,clientId:t,scriptLoadedSuccessfully:a}),[t,a]);return Wn.createElement(hk.Provider,{value:c},i)}function TL(){const t=S.useContext(hk);if(!t)throw new Error("Google OAuth components must be used within GoogleOAuthProvider");return t}function CL(t){var e;return(e=t?.clientId)!==null&&e!==void 0?e:t?.client_id}const SL={large:40,medium:32,small:20};function bX({onSuccess:t,onError:e,useOneTap:n,promptMomentNotification:r,type:s="standard",theme:i="outline",size:a="large",text:c,shape:u,logo_alignment:d,width:f,click_listener:g,state:y,containerProps:x,...b}){const E=S.useRef(null),{clientId:w,locale:R,scriptLoadedSuccessfully:C}=TL(),k=S.useRef(t);k.current=t;const N=S.useRef(e);N.current=e;const V=S.useRef(r);return V.current=r,S.useEffect(()=>{var $,D,I,B,O,F,L,M,se;if(C)return(I=(D=($=window?.google)===null||$===void 0?void 0:$.accounts)===null||D===void 0?void 0:D.id)===null||I===void 0||I.initialize({client_id:w,callback:H=>{var J;if(!H?.credential)return(J=N.current)===null||J===void 0?void 0:J.call(N);const{credential:le,select_by:K}=H;k.current({credential:le,clientId:CL(H),select_by:K})},...b}),(F=(O=(B=window?.google)===null||B===void 0?void 0:B.accounts)===null||O===void 0?void 0:O.id)===null||F===void 0||F.renderButton(E.current,{type:s,theme:i,size:a,text:c,shape:u,logo_alignment:d,width:f,locale:R,click_listener:g,state:y}
76),n&&((se=(M=(L=window?.google)===null||L===void 0?void 0:L.accounts)===null||M===void 0?void 0:M.id)===null||se===void 0||se.prompt(V.current)),()=>{var H,J,le;n&&((le=(J=(H=window?.google)===null||H===void 0?void 0:H.accounts)===null||J===void 0?void 0:J.id)===null||le===void 0||le.cancel())}},[w,C,n,s,i,a,c,u,d,f,R]),Wn.createElement("div",{...x,ref:E,style:{height:SL[a],...x?.style}})}const de={MEMBER:"member",VOLUNTEER:"volunteer",STAFF:"staff",INFO_ADMIN:"info_admin",SUPER_ADMIN:"super_admin",PROFESSIONAL:"professional",ADMIN:"admin"},kL=t=>t&&t.toLowerCase().endsWith("@pdaus.org"),fb={"[email protected]":{role:de.SUPER_ADMIN,name:"Jacky (Super Admin)",staff_code:"S260822001",description:"System super administrator with full access",dashboard:"/admin/dashboard",canLoginFromAnyInterface:!0},"[email protected]":{role:de.ADMIN,name:"Membership Administration",description:"Member application review and administration",dashboard:"/admin/applications",permissions:{canManageMembers:!0,canReviewApplications:!0}},"[email protected]":{role:de.INFO_ADMIN,name:"Volunteer Coordination Team",description:"Volunteer application review and coordination",dashboard:"/admin/applications",permissions:{canManageMembers:!0,canReviewApplications:!0}},"[email protected]":{role:de.INFO_ADMIN,name:"Info Desk Admin",description:"Info Desk Administrator with question assignment and member management",dashboard:"/admin/dashboard",permissions:{canAssignQuestions:!0,canManageMembers:!0,canPublishContent:!0,canModifySystem:!1}},"[email protected]":{role:de.STAFF,name:"Support Team",description:"Technical support staff",dashboard:"/staff/dashboard",permissions:{canAssignQuestions:!1,canManageMembers:!1,canProvideTechSupport:!0}},"[email protected]":{role:de.PROFESSIONAL,name:"Legal Aid Team",professional_category:"legal",description:"Legal aid professional team",dashboard:"/dashboard",permissions:{canAnswerQuestions:!0,canManageOwnCases:!0,canAssignQuestions:!1,canViewAllMembers:!1}},"[email protected]":{role:de.PROFESSIONAL,name:"Licensed Lawyer",professional_category:"legal",description:"Licensed lawyer backup account",dashboard:"/dashboard"},"[email protected]":{role:de.PROFESSIONAL,name:"Attorney Kuo",professional_category:"legal",description:"Licensed attorney - legal consultation",dashboard:"/dashboard",permissions:{canAnswerQuestions:!0,canManageOwnCases:!0,canAssignQuestions:!1,canViewAllMembers:!1}},"[email protected]":{role:de.PROFESSIONAL,name:"Insurance Expert",professional_category:"insurance",description:"Insurance consultation expert",dashboard:"/dashboard"},"[email protected]":{role:de.PROFESSIONAL,name:"Real Estate Expert",professional_category:"real_estate",description:"Real estate consultation expert",dashboard:"/dashboard"},"[email protected]":{role:de.PROFESSIONAL,name:"Economics Expert",professional_category:"economics",description:"Economics consultant",dashboard:"/dashboard"},"[email protected]":{role:de.PROFESSIONAL,name:"Healthcare Professional",professional_category:"healthcare",description:"Healthcare professional",dashboard:"/dashboard"},"[email protected]":{role:de.PROFESSIONAL,name:"Education Expert",professional_category:"education",description:"Education training expert",dashboard:"/dashboard"},"[email protected]":{role:de.STAFF,name:"Test Staff User",description:"Test staff account",dashboard:"/staff/dashboard"}},Ss=()=>crypto.randomUUID(),zn=()=>new Date().toISOString(),IL=()=>{if(localStorage.getItem("users")){const t=JSON.parse(localStorage.getItem("users"));let e=!1;Object.entries(fb).forEach(([n,r])=>{const s=t.findIndex(i=>i.email===n);s!==-1?(t[s]={...t[s],role:r.role,staff_code:r.staff_code||t[s].staff_code||null,name:r.name,professional_category:r.professional_category||t[s].professional_category,sms_verified:!0},e=!0):(t.push({id:Ss(),email:n,phone:r.phone||"",role:r.role,staff_code:r.staff_code||null,name:r.name,professional_category:r.professional_category||null,is_active:!0,sms_verified:!0,created_at:zn(),last_login:null}),e=!0)}),e&&localStorage.setItem("users",JSON.stringify(t))}else{const t=Object.entries(fb).map(([e,n])=>
76({id:Ss(),email:e,phone:n.phone||"",role:n.role,staff_code:n.staff_code||null,name:n.name,professional_category:n.professional_category||null,is_active:!0,sms_verified:!0,created_at:zn(),last_login:null}));localStorage.setItem("users",JSON.stringify(t))}localStorage.getItem("members")||localStorage.setItem("members",JSON.stringify([])),localStorage.getItem("sms_codes")||localStorage.setItem("sms_codes",JSON.stringify([])),localStorage.getItem("otps")||localStorage.setItem("otps",JSON.stringify([])),localStorage.getItem("activity_logs")||localStorage.setItem("activity_logs",JSON.stringify([])),localStorage.getItem("donations")||localStorage.setItem("donations",JSON.stringify([])),localStorage.getItem("emails")||localStorage.setItem("emails",JSON.stringify([])),localStorage.getItem("questions")||localStorage.setItem("questions",JSON.stringify([])),localStorage.getItem("answers")||localStorage.setItem("answers",JSON.stringify([]))};IL();const Ze=t=>JSON.parse(localStorage.getItem(t)||"[]"),sn=(t,e)=>localStorage.setItem(t,JSON.stringify(e)),PL=(t,e,n,r=null)=>{const s=Ze("activity_logs");s.unshift({id:Ss(),user_id:t,action_type:e,target_id:r,details:n,ip_address:"127.0.0.1",created_at:zn()}),s.length>1e3&&(s.length=1e3),sn("activity_logs",s)},RL=(t="paid")=>{const e=new Date,n=String(e.getFullYear()).slice(-2),r=String(e.getMonth()+1).padStart(2,"0"),i={free:"MF",business:"MB",paid:"MP",lifetime:"ML"}[t?.toLowerCase()]||"MP",a=Ze("members"),c=`${n}${r}`;let u=0;a.forEach(f=>{const g=f.member_code||"";if(g.match(/^M[FPBL]\d{4}/)&&g.substring(2,6)===c){const x=g.slice(-3),b=parseInt(x,10);!isNaN(b)&&b>u&&(u=b)}});const d=String(u+1).padStart(3,"0");return`${i}${n}${r}${d}`},Rn={users:{find:t=>Ze("users").find(n=>n.email.toLowerCase()===t.toLowerCase()),verifyCredentials:(t,e)=>{const r=Ze("users").find(s=>s.email.toLowerCase()===t.toLowerCase());return r&&r.password_hash===e&&r.is_active?r:null},create:t=>{const e=Ze("users");if(e.find(r=>r.email===t.email))throw new Error("User exists");const n={id:Ss(),...t,is_active:!0,created_at:zn()};return e.push(n),sn("users",e),n},update:(t,e)=>{const n=Ze("users"),r=n.findIndex(s=>s.id===t);return r!==-1?(n[r]={...n[r],...e,updated_at:zn()},sn("users",n),n[r]):null},delete:(t,e=!0)=>{const n=Ze("users"),r=n.findIndex(s=>s.id===t);return r!==-1?(e?(n[r].is_active=!1,n[r].deleted_at=zn()):n.splice(r,1),sn("users",n),!0):!1},getAll:()=>Ze("users")},staff:{createStaffAccount:t=>{if(!t.email.endsWith("@pdaus.org"))throw new Error("Email must be from @pdaus.org domain");const e=Ze("users");if(e.find(r=>r.email.toLowerCase()===t.email.toLowerCase()))throw new Error("User with this email already exists");const n={id:Ss(),email:t.email,password_hash:t.password,phone:t.phone,name:t.name,role:t.role,is_active:!0,sms_verified:!1,created_at:zn(),last_login:null};return e.push(n),sn("users",e),n},getAllStaffAccounts:()=>Ze("users").filter(e=>e.role===de.STAFF||e.role===de.PROFESSIONAL||e.role===de.SUPER_ADMIN),updateStaffAccount:(t,e)=>{const n=Ze("users"),r=n.findIndex(s=>s.id===t);if(r===-1)throw new Error("Staff account not found");if(e.email&&!e.email.endsWith("@pdaus.org"))throw new Error("Email must be from @pdaus.org domain");return n[r]={...n[r],...e,updated_at:zn()},sn("users",n),n[r]},deleteStaffAccount:t=>{const e=Ze("users"),n=e.findIndex(r=>
76r.id===t);if(n===-1)throw new Error("Staff account not found");if(e[n].email==="[email protected]")throw new Error("Cannot delete Super Admin account");return e[n].is_active=!1,e[n].deleted_at=zn(),sn("users",e),!0},getStaffByEmail:t=>Ze("users").find(n=>n.email.toLowerCase()===t.toLowerCase()&&(n.role===de.STAFF||n.role===de.PROFESSIONAL))},members:{create:t=>{const e=Ze("members");try{let n=Ss();if(Ze("users").find(c=>c.email===t.email))throw new Error("Email already registered");const r=t.member_type||"free",s=RL(r),i={id:n,member_code:s,member_id:s,member_type:r,...t,role:de.MEMBER,status:"active",created_at:zn(),password_hash:t.password};e.push(i),sn("members",e);const a=Ze("users");return a.push({id:n,email:t.email,password_hash:t.password,phone:t.phone,member_code:s,role:de.MEMBER,name:t.fullName||t.name,is_active:!0,created_at:zn()}),sn("users",a),i}catch(n){throw n}},getAll:()=>Ze("members").filter(t=>t.status!=="deleted"),updateStatus:(t,e)=>{const n=Ze("members"),r=n.findIndex(s=>s.id===t);if(r!==-1){n[r].status=e,sn("members",n);const s=Ze("users"),i=s.findIndex(a=>a.id===t);return i!==-1&&(s[i].is_active=e==="active",sn("users",s)),!0}return!1},login:(t,e)=>Ze("members").find(r=>r.email===t&&r.password_hash===e&&r.status==="active"),findByEmail:t=>Ze("members").find(n=>n.email===t)},sms_codes:{create:(t,e,n,r)=>{const s=Ze("sms_codes"),i={id:Ss(),phone:t,code:e,type:r,expires_at:n,used:!1},a=s.filter(c=>c.phone!==t);return a.push(i),sn("sms_codes",a),i},verify:(t,e)=>{const n=Ze("sms_codes"),r=n.find(s=>s.phone===t&&s.code===e&&!s.used&&new Date(s.expires_at)>new Date);return r?(r.used=!0,sn("sms_codes",n),!0):!1}},otps:{create:(t,e,n)=>{const r=Ze("otps"),s=Math.floor(1e5+Math.random()*9e5).toString(),i=new Date;i.setMinutes(i.getMinutes()+15);const a={id:Ss(),email:t,code:s,type:e,method:n,expires_at:i.toISOString(),used:!1},c=r.filter(u=>u.email!==t);return c.push(a),sn("otps",c),a},verify:(t,e,n)=>{const r=Ze("otps"),s=r.find(i=>i.email===t&&i.code===e&&i.type===n&&!i.used&&new Date(i.expires_at)>new Date);return s?(s.used=!0,sn("otps",r),!0):!1}},logs:{add:PL,getAll:()=>Ze("activity_logs").sort((t,e)=>new Date(e.created_at)-new Date(t.created_at))},questions:{getAll:()=>Ze("questions"),create:t=>{const e=Ze("questions"),n={id:Ss(),...t,status:"pending",assigned_to:null,routed_to:"[email protected]",urgency:t.urgency||"normal",created_at:zn(),answered_at:null};return e.push(n),sn("questions",e),n},updateStatus:(t,e)=>{const n=Ze("questions"),r=n.findIndex(s=>s.id===t);return r!==-1?(n[r].status=e,n[r].updated_at=zn(),sn("questions",n),n[r]):null},assignTo:(t,e,n)=>{const r=Ze("questions"),s=r.findIndex(i=>i.id===t);return s!==-1?(r[s].assigned_to=e,r[s].assigned_category=n,r[s].status="assigned",r[s].assigned_at=zn(),sn("questions",r),r[s]):null}},answers:{create:t=>{const e=Ze("answers");e.push({id:Ss(),...t,created_at:zn()}),sn("answers",e);const n=Ze("questions"),r=n.findIndex(s=>s.id===t.question_id);return r!==-1&&(n[r].status="answered",sn("questions",n)),!0},getAllWithDetails:()=>{const t=Ze("answers"),e=Ze("questions");return t.map(n=>{const r=e.find(s=>s.id===n.question_id);return{...n,question:r||null}})}},donations:{getByMemberId:t=>Ze("donations").filter(e=>e.member_id===t)},emails:{create:t=>{const e=Ze("emails"),n={id:Ss(),...t,created_at:zn(),sent_at:t.sent?zn():null};return e.push(n),sn("emails",e),n},getAll:()=>Ze("emails"),getByRecipient:t=>Ze("emails").filter(e=>e.recipient===t),getByType:t=>Ze("emails").filter(e=>e.type===t)}};/**
77 * @license
78 * Copyright 2025 Google LLC
79 *
80 * Licensed under the Apache License, Version 2.0 (the "License");
81 * you may not use this file except in compliance with the License.
82 * You may obtain a copy of the License at
83 *
84 *   http://www.apache.org/licenses/LICENSE-2.0
85 *
86 * Unless required by applicable law or agreed to in writing, software
87 * distributed under the License is distributed on an "AS IS" BASIS,
88 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89 * See the License for the specific language governing permissions and
90 * limitations under the License.
91 */const DL=()=>{};var pb={};/**
92 * @license
93 * Copyright 2017 Google LLC
94 *
95 * Licensed under the Apache License, Version 2.0 (the "License");
96 * you may not use this file except in compliance with the License.
97 * You may obtain a copy of the License at
98 *
99 *   http://www.apache.org/licenses/LICENSE-2.0
100 *
101 * Unless required by applicable law or agreed to in writing, software
102 * distributed under the License is distributed on an "AS IS" BASIS,
103 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
104 * See the License for the specific language governing permissions and
105 * limitations under the License.
106 */const fk=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=s&63|128):(s&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128)}return e},NL=function(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=t[n++],a=t[n++],c=t[n++],u=((s&7)<<18|(i&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(u>>10)),e[r++]=String.fromCharCode(56320+(u&1023))}else{const i=t[n++],a=t[n++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|a&63)}}return e.join("")},pk={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<t.length;s+=3){const i=t[s],a=s+1<t.length,c=a?t[s+1]:0,u=s+2<t.length,d=u?t[s+2]:0,f=i>>2,g=(i&3)<<4|c>>4;let y=(c&15)<<2|d>>6,x=d&63;u||(x=64,a||(y=64)),r.push(n[f],n[g],n[y],n[x])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(fk(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):NL(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<t.length;){const i=n[t.charAt(s++)],c=s<t.length?n[t.charAt(s)]:0;++s;const d=s<t.length?n[t.charAt(s)]:64;++s;const g=s<t.length?n[t.charAt(s)]:64;if(++s,i==null||c==null||d==null||g==null)throw new OL;const y=i<<2|c>>4;if(r.push(y),d!==64){const x=c<<4&240|d>>2;if(r.push(x),g!==64){const b=d<<6&192|g;r.push(b)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class OL extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const LL=function(t){const e=fk(t);return pk.encodeByteArray(e,!0)},Lp=function(t){return LL(t).replace(/\./g,"")},mk=function(t){try{return pk.decodeString(t,!0)}catch{}return null};/**
107 * @license
108 * Copyright 2022 Google LLC
109 *
110 * Licensed under the Apache License, Version 2.0 (the "License");
111 * you may not use this file except in compliance with the License.
112 * You may obtain a copy of the License at
113 *
114 *   http://www.apache.org/licenses/LICENSE-2.0
115 *
116 * Unless required by applicable law or agreed to in writing, software
117 * distributed under the License is distributed on an "AS IS" BASIS,
118 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119 * See the License for the specific language governing permissions and
120 * limitations under the License.
121 */function FL(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
122 * @license
123 * Copyright 2022 Google LLC
124 *
125 * Licensed under the Apache License, Version 2.0 (the "License");
126 * you may not use this file except in compliance with the License.
127 * You may obtain a copy of the License at
128 *
129 *   http://www.apache.org/licenses/LICENSE-2.0
130 *
131 * Unless required by applicable law or agreed to in writing, software
132 * distributed under the License is distributed on an "AS IS" BASIS,
133 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134 * See the License for the specific language governing permissions and
135 * limitations under the License.
136 */const jL=()=>FL().__FIREBASE_DEFAULTS__,ML=()=>{if(typeof process>"u"||typeof pb>"u")return;const t=pb.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},BL=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&mk(t[1]);return e&&JSON.parse(e)},Am=()=>{try{return DL()||jL()||ML()||BL()}catch{return}},gk=t=>Am()?.emulatorHosts?.[t],f_=t=>{const e=gk(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),r]:[e.substring(0,n),r]},yk=()=>Am()?.config,vk=t=>Am()?.[`_${t}`];/**
137 * @license
138 * Copyright 2017 Google LLC
139 *
140 * Licensed under the Apache License, Version 2.0 (the "License");
141 * you may not use this file except in compliance with the License.
142 * You may obtain a copy of the License at
143 *
144 *   http://www.apache.org/licenses/LICENSE-2.0
145 *
146 * Unless required by applicable law or agreed to in writing, software
147 * distributed under the License is distributed on an "AS IS" BASIS,
148 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149 * See the License for the specific language governing permissions and
150 * limitations under the License.
151 */class VL{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/**
152 * @license
153 * Copyright 2025 Google LLC
154 *
155 * Licensed under the Apache License, Version 2.0 (the "License");
156 * you may not use this file except in compliance with the License.
157 * You may obtain a copy of the License at
158 *
159 *   http://www.apache.org/licenses/LICENSE-2.0
160 *
161 * Unless required by applicable law or agreed to in writing, software
162 * distributed under the License is distributed on an "AS IS" BASIS,
163 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164 * See the License for the specific language governing permissions and
165 * limitations under the License.
166 */function li(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Tm(t){return(await fetch(t,{credentials:"include"})).ok}/**
167 * @license
168 * Copyright 2021 Google LLC
169 *
170 * Licensed under the Apache License, Version 2.0 (the "License");
171 * you may not use this file except in compliance with the License.
172 * You may obtain a copy of the License at
173 *
174 *   http://www.apache.org/licenses/LICENSE-2.0
175 *
176 * Unless required by applicable law or agreed to in writing, software
177 * distributed under the License is distributed on an "AS IS" BASIS,
178 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179 * See the License for the specific language governing permissions and
180 * limitations under the License.
181 */function _k(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},r=e||"demo-project",s=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const a={iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...t};return[Lp(JSON.stringify(n)),Lp(JSON.stringify(a)),""].join(".")}const qu={};function UL(){const t={prod:[],emulator:[]};for(const e of Object.keys(qu))qu[e]?t.emulator.push(e):t.prod.push(e);return t}function $L(t){let e=document.getElementById(t),n=!1;return e||(e=document.createElement("div"),e.setAttribute("id",t),n=!0),{created:n,element:e}}let mb=!1;function Cm(t,e){if(typeof window>"u"||typeof document>"u"||!li(window.location.host)||qu[t]===e||qu[t]||mb)return;qu[t]=e;function n(y){return`__firebase__banner__${y}`}const r="__firebase__banner",i=UL().prod.length>0;function a(){const y=document.getElementById(r);y&&y.remove()}function c(y){y.style.display="flex",y.style.background="#7faaf0",y.style.position="fixed",y.style.bottom="5px",y.style.left="5px",y.style.padding=".5em",y.style.borderRadius="5px",y.style.alignItems="center"}function u(y,x){y.setAttribute("width","24"),y.setAttribute("id",x),y.setAttribute("height","24"),y.setAttribute("viewBox","0 0 24 24"),y.setAttribute("fill","none"),y.style.marginLeft="-6px"}function d(){const y=document.createElement("span");
vendor: 4,113 bytes, lines 181-210
181return y.style.cursor="pointer",y.style.marginLeft="16px",y.style.fontSize="24px",y.innerHTML=" &times;",y.onclick=()=>{mb=!0,a()},y}function f(y,x){y.setAttribute("id",x),y.innerText="Learn more",y.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",y.setAttribute("target","__blank"),y.style.paddingLeft="5px",y.style.textDecoration="underline"}function g(){const y=$L(r),x=n("text"),b=document.getElementById(x)||document.createElement("span"),E=n("learnmore"),w=document.getElementById(E)||document.createElement("a"),R=n("preprendIcon"),C=document.getElementById(R)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(y.created){const k=y.element;c(k),f(w,E);const N=d();u(C,R),k.append(C,b,w,N),document.body.appendChild(k)}i?(b.innerText="Preview backend disconnected.",C.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
182<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
183</g>
184<defs>
185<clipPath id="clip0_6013_33858">
186<rect width="24" height="24" fill="white"/>
187</clipPath>
188</defs>`):(C.innerHTML=`<g clip-path="url(#clip0_6083_34804)">
189<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
190</g>
191<defs>
192<clipPath id="clip0_6083_34804">
193<rect width="24" height="24" fill="white"/>
194</clipPath>
195</defs>`,b.innerText="Preview backend running in this workspace."),b.setAttribute("id",x)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",g):g()}/**
196 * @license
197 * Copyright 2017 Google LLC
198 *
199 * Licensed under the Apache License, Version 2.0 (the "License");
200 * you may not use this file except in compliance with the License.
201 * You may obtain a copy of the License at
202 *
203 *   http://www.apache.org/licenses/LICENSE-2.0
204 *
205 * Unless required by applicable law or agreed to in writing, software
206 * distributed under the License is distributed on an "AS IS" BASIS,
207 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
208 * See the License for the specific language governing permissions and
209 * limitations under the License.
210 */function lr(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function zL(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(lr())}function HL(){const t=Am()?.forceEnvironment;if(t==="node")return!0;
210if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function qL(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function WL(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function GL(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function KL(){const t=lr();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function YL(){return!HL()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function QL(){try{return typeof indexedDB=="object"}catch{return!1}}function JL(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{e(s.error?.message||"")}}catch(n){e(n)}})}/**
211 * @license
212 * Copyright 2017 Google LLC
213 *
214 * Licensed under the Apache License, Version 2.0 (the "License");
215 * you may not use this file except in compliance with the License.
216 * You may obtain a copy of the License at
217 *
218 *   http://www.apache.org/licenses/LICENSE-2.0
219 *
220 * Unless required by applicable law or agreed to in writing, software
221 * distributed under the License is distributed on an "AS IS" BASIS,
222 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
223 * See the License for the specific language governing permissions and
224 * limitations under the License.
225 */const XL="FirebaseError";
225class Ls extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=XL,Object.setPrototypeOf(this,Ls.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Pd.prototype.create)}}class Pd{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},s=`${this.service}/${e}`,i=this.errors[e],a=i?ZL(i,r):"Error",c=`${this.serviceName}: ${a} (${s}).`;return new Ls(s,c,r)}}function ZL(t,e){return t.replace(eF,(n,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const eF=/\{\$([^}]+)}/g;function tF(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Ma(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const s of n){if(!r.includes(s))return!1;const i=t[s],a=e[s];if(gb(i)&&gb(a)){if(!Ma(i,a))return!1}else if(i!==a)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function gb(t){return t!==null&&typeof t=="object"}/**
226 * @license
227 * Copyright 2017 Google LLC
228 *
229 * Licensed under the Apache License, Version 2.0 (the "License");
230 * you may not use this file except in compliance with the License.
231 * You may obtain a copy of the License at
232 *
233 *   http://www.apache.org/licenses/LICENSE-2.0
234 *
235 * Unless required by applicable law or agreed to in writing, software
236 * distributed under the License is distributed on an "AS IS" BASIS,
237 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
238 * See the License for the specific language governing permissions and
239 * limitations under the License.
240 */function Sc(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function nF(t,e){const n=new rF(t,e);return n.subscribe.bind(n)}class rF{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let s;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");sF(e,["next","error","complete"])?s=e:s={next:e,error:n,complete:r},s.next===void 0&&(s.next=qg),s.error===void 0&&(s.error=qg),s.complete===void 0&&(s.complete=qg);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch{}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function sF(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function qg(){}/**
241 * @license
242 * Copyright 2021 Google LLC
243 *
244 * Licensed under the Apache License, Version 2.0 (the "License");
245 * you may not use this file except in compliance with the License.
246 * You may obtain a copy of the License at
247 *
248 *   http://www.apache.org/licenses/LICENSE-2.0
249 *
250 * Unless required by applicable law or agreed to in writing, software
251 * distributed under the License is distributed on an "AS IS" BASIS,
252 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
253 * See the License for the specific language governing permissions and
254 * limitations under the License.
255 */function xt(t){return t&&t._delegate?t._delegate:t}class $i{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
256 * @license
257 * Copyright 2019 Google LLC
258 *
259 * Licensed under the Apache License, Version 2.0 (the "License");
260 * you may not use this file except in compliance with the License.
261 * You may obtain a copy of the License at
262 *
263 *   http://www.apache.org/licenses/LICENSE-2.0
264 *
265 * Unless required by applicable law or agreed to in writing, software
266 * distributed under the License is distributed on an "AS IS" BASIS,
267 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
268 * See the License for the specific language governing permissions and
269 * limitations under the License.
270 */const Aa="[DEFAULT]";/**
271 * @license
272 * Copyright 2019 Google LLC
273 *
274 * Licensed under the Apache License, Version 2.0 (the "License");
275 * you may not use this file except in compliance with the License.
276 * You may obtain a copy of the License at
277 *
278 *   http://www.apache.org/licenses/LICENSE-2.0
279 *
280 * Unless required by applicable law or agreed to in writing, software
281 * distributed under the License is distributed on an "AS IS" BASIS,
282 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
283 * See the License for the specific language governing permissions and
284 * limitations under the License.
285 */let iF=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new VL;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){const n=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(aF(e))try{this.getOrInitializeService({instanceIdentifier:Aa})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=Aa){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=Aa){return this.instances.has(e)}getOptions(e=Aa){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[i,a]of this.instancesDeferred.entries()){const c=this.normalizeInstanceIdentifier(i);r===c&&a.resolve(s)}return s}onInit(e,n){const r=this.normalizeInstanceIdentifier(n),s=this.onInitCallbacks.get(r)??new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:oF(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=Aa){return this.component?this.component.multipleInstances?e:Aa:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function oF(t){return t===Aa?void 0:t}function aF(t){return t.instantiationMode==="EAGER"}/**
286 * @license
287 * Copyright 2019 Google LLC
288 *
289 * Licensed under the Apache License, Version 2.0 (the "License");
290 * you may not use this file except in compliance with the License.
291 * You may obtain a copy of the License at
292 *
293 *   http://www.apache.org/licenses/LICENSE-2.0
294 *
295 * Unless required by applicable law or agreed to in writing, software
296 * distributed under the License is distributed on an "AS IS" BASIS,
297 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
298 * See the License for the specific language governing permissions and
299 * limitations under the License.
300 */class lF{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new iF(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/**
301 * @license
302 * Copyright 2017 Google LLC
303 *
304 * Licensed under the Apache License, Version 2.0 (the "License");
305 * you may not use this file except in compliance with the License.
306 * You may obtain a copy of the License at
307 *
308 *   http://www.apache.org/licenses/LICENSE-2.0
309 *
310 * Unless required by applicable law or agreed to in writing, software
311 * distributed under the License is distributed on an "AS IS" BASIS,
312 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
313 * See the License for the specific language governing permissions and
314 * limitations under the License.
315 */var nt;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(nt||(nt={}));const cF={debug:nt.DEBUG,verbose:nt.VERBOSE,info:nt.INFO,warn:nt.WARN,error:nt.ERROR,silent:nt.SILENT},uF=nt.INFO,dF={[nt.DEBUG]:"log",[nt.VERBOSE]:"log",[nt.INFO]:"info",[nt.WARN]:"warn",[nt.ERROR]:"error"},hF=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),s=dF[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class p_{constructor(e){this.name=e,this._logLevel=uF,this._logHandler=hF,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in nt))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?cF[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,nt.DEBUG,...e),this._logHandler(this,nt.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,nt.VERBOSE,...e),this._logHandler(this,nt.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,nt.INFO,...e),this._logHandler(this,nt.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,nt.WARN,...e),this._logHandler(this,nt.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,nt.ERROR,...e),this._logHandler(this,nt.ERROR,...e)}}const fF=(t,e)=>e.some(n=>t instanceof n);let yb,vb;function pF(){return yb||(yb=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function mF(){return vb||(vb=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const xk=new WeakMap,Yy=new WeakMap,wk=new WeakMap,Wg=new WeakMap,m_=new WeakMap;function gF(t){const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("success",i),t.removeEventListener("error",a)},i=()=>{n(Do(t.result)),s()},a=()=>{r(t.error),s()};t.addEventListener("success",i),t.addEventListener("error",a)});return e.then(n=>{n instanceof IDBCursor&&xk.set(n,t)}).catch(()=>{}),m_.set(e,t),e}function yF(t){if(Yy.has(t))return;const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",a),t.removeEventListener("abort",a)},i=()=>{n(),s()},a=()=>{r(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",i),t.addEventListener("error",a),t.addEventListener("abort",a)});Yy.set(t,e)}let Qy={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Yy.get(t);if(e==="objectStoreNames")return t.objectStoreNames||wk.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Do(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function vF(t){Qy=t(Qy)}function _F(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(Gg(this),e,...n);return wk.set(r,e.sort?e.sort():[e]),Do(r)}:mF().includes(t)?function(...e){return t.apply(Gg(this),e),Do(xk.get(this))}:function(...e){return Do(t.apply(Gg(this),e))}}function xF(t){return typeof t=="function"?_F(t):(t instanceof IDBTransaction&&yF(t),fF(t,p
315F())?new Proxy(t,Qy):t)}function Do(t){if(t instanceof IDBRequest)return gF(t);if(Wg.has(t))return Wg.get(t);const e=xF(t);return e!==t&&(Wg.set(t,e),m_.set(e,t)),e}const Gg=t=>m_.get(t);function wF(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const a=indexedDB.open(t,e),c=Do(a);return r&&a.addEventListener("upgradeneeded",u=>{r(Do(a.result),u.oldVersion,u.newVersion,Do(a.transaction),u)}),n&&a.addEventListener("blocked",u=>n(u.oldVersion,u.newVersion,u)),c.then(u=>{i&&u.addEventListener("close",()=>i()),s&&u.addEventListener("versionchange",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),c}const EF=["get","getKey","getAll","getAllKeys","count"],bF=["put","add","delete","clear"],Kg=new Map;function _b(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Kg.get(e))return Kg.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=bF.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||EF.includes(n)))return;const i=async function(a,...c){const u=this.transaction(a,s?"readwrite":"readonly");let d=u.store;return r&&(d=d.index(c.shift())),(await Promise.all([d[n](...c),s&&u.done]))[0]};return Kg.set(e,i),i}vF(t=>({...t,get:(e,n,r)=>_b(e,n)||t.get(e,n,r),has:(e,n)=>!!_b(e,n)||t.has(e,n)}));/**
316 * @license
317 * Copyright 2019 Google LLC
318 *
319 * Licensed under the Apache License, Version 2.0 (the "License");
320 * you may not use this file except in compliance with the License.
321 * You may obtain a copy of the License at
322 *
323 *   http://www.apache.org/licenses/LICENSE-2.0
324 *
325 * Unless required by applicable law or agreed to in writing, software
326 * distributed under the License is distributed on an "AS IS" BASIS,
327 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
328 * See the License for the specific language governing permissions and
329 * limitations under the License.
330 */class AF{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(TF(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function TF(t){return t.getComponent()?.type==="VERSION"}const Jy="@firebase/app",xb="0.14.8";/**
331 * @license
332 * Copyright 2019 Google LLC
333 *
334 * Licensed under the Apache License, Version 2.0 (the "License");
335 * you may not use this file except in compliance with the License.
336 * You may obtain a copy of the License at
337 *
338 *   http://www.apache.org/licenses/LICENSE-2.0
339 *
340 * Unless required by applicable law or agreed to in writing, software
341 * distributed under the License is distributed on an "AS IS" BASIS,
342 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
343 * See the License for the specific language governing permissions and
344 * limitations under the License.
345 */const zi=new p_("@firebase/app"),CF="@firebase/app-compat",SF="@firebase/analytics-compat",kF="@firebase/analytics",IF="@firebase/app-check-compat",PF="@firebase/app-check",RF="@firebase/auth",DF="@firebase/auth-compat",NF="@firebase/database",OF="@firebase/data-connect",LF="@firebase/database-compat",FF="@firebase/functions",jF="@firebase/functions-compat",MF="@firebase/installations",BF="@firebase/installations-compat",VF="@firebase/messaging",UF="@firebase/messaging-compat",$F="@firebase/performance",zF="@firebase/performance-compat",HF="@firebase/remote-config",qF="@firebase/remote-config-compat",WF="@firebase/storage",GF="@firebase/storage-compat",KF="@firebase/firestore",YF="@firebase/ai",QF="@firebase/firestore-compat",JF="firebase",XF="12.9.0";/**
346 * @license
347 * Copyright 2019 Google LLC
348 *
349 * Licensed under the Apache License, Version 2.0 (the "License");
350 * you may not use this file except in compliance with the License.
351 * You may obtain a copy of the License at
352 *
353 *   http://www.apache.org/licenses/LICENSE-2.0
354 *
355 * Unless required by applicable law or agreed to in writing, software
356 * distributed under the License is distributed on an "AS IS" BASIS,
357 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
358 * See the License for the specific language governing permissions and
359 * limitations under the License.
360 */const Xy="[DEFAULT]",ZF={[Jy]:"fire-core",[CF]:"fire-core-compat",[kF]:"fire-analytics",[SF]:"fire-analytics-compat",[PF]:"fire-app-check",[IF]:"fire-app-check-compat",[RF]:"fire-auth",[DF]:"fire-auth-compat",[NF]:"fire-rtdb",[OF]:"fire-data-connect",[LF]:"fire-rtdb-compat",[FF]:"fire-fn",[jF]:"fire-fn-compat",[MF]:"fire-iid",[BF]:"fire-iid-compat",[VF]:"fire-fcm",[UF]:"fire-fcm-compat",[$F]:"fire-perf",[zF]:"fire-perf-compat",[HF]:"fire-rc",[qF]:"fire-rc-compat",[WF]:"fire-g
360cs",[GF]:"fire-gcs-compat",[KF]:"fire-fst",[QF]:"fire-fst-compat",[YF]:"fire-vertex","fire-js":"fire-js",[JF]:"fire-js-all"};/**
361 * @license
362 * Copyright 2019 Google LLC
363 *
364 * Licensed under the Apache License, Version 2.0 (the "License");
365 * you may not use this file except in compliance with the License.
366 * You may obtain a copy of the License at
367 *
368 *   http://www.apache.org/licenses/LICENSE-2.0
369 *
370 * Unless required by applicable law or agreed to in writing, software
371 * distributed under the License is distributed on an "AS IS" BASIS,
372 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
373 * See the License for the specific language governing permissions and
374 * limitations under the License.
375 */const Fp=new Map,e8=new Map,Zy=new Map;function wb(t,e){try{t.container.addComponent(e)}catch(n){zi.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Mo(t){const e=t.name;if(Zy.has(e))return zi.debug(`There were multiple attempts to register component ${e}.`),!1;Zy.set(e,t);for(const n of Fp.values())wb(n,t);for(const n of e8.values())wb(n,t);return!0}function Rd(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Ir(t){return t==null?!1:t.settings!==void 0}/**
376 * @license
377 * Copyright 2019 Google LLC
378 *
379 * Licensed under the Apache License, Version 2.0 (the "License");
380 * you may not use this file except in compliance with the License.
381 * You may obtain a copy of the License at
382 *
383 *   http://www.apache.org/licenses/LICENSE-2.0
384 *
385 * Unless required by applicable law or agreed to in writing, software
386 * distributed under the License is distributed on an "AS IS" BASIS,
387 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
388 * See the License for the specific language governing permissions and
389 * limitations under the License.
390 */const t8={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invali
390d-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},No=new Pd("app","Firebase",t8);/**
391 * @license
392 * Copyright 2019 Google LLC
393 *
394 * Licensed under the Apache License, Version 2.0 (the "License");
395 * you may not use this file except in compliance with the License.
396 * You may obtain a copy of the License at
397 *
398 *   http://www.apache.org/licenses/LICENSE-2.0
399 *
400 * Unless required by applicable law or agreed to in writing, software
401 * distributed under the License is distributed on an "AS IS" BASIS,
402 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
403 * See the License for the specific language governing permissions and
404 * limitations under the License.
405 */class n8{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new $i("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw No.create("app-deleted",{appName:this._name})}}/**
406 * @license
407 * Copyright 2019 Google LLC
408 *
409 * Licensed under the Apache License, Version 2.0 (the "License");
410 * you may not use this file except in compliance with the License.
411 * You may obtain a copy of the License at
412 *
413 *   http://www.apache.org/licenses/LICENSE-2.0
414 *
415 * Unless required by applicable law or agreed to in writing, software
416 * distributed under the License is distributed on an "AS IS" BASIS,
417 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
418 * See the License for the specific language governing permissions and
419 * limitations under the License.
420 */const Ya=XF;function Ek(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:Xy,automaticDataCollectionEnabled:!0,...e},s=r.name;if(typeof s!="string"||!s)throw No.create("bad-app-name",{appName:String(s)});if(n||(n=yk()),!n)throw No.create("no-options");const i=Fp.get(s);if(i){if(Ma(n,i.options)&&Ma(r,i.config))return i;throw No.create("duplicate-app",{appName:s})}const a=new lF(s);for(const u of Zy.values())a.addComponent(u);const c=new n8(n,r,a);return Fp.set(s,c),c}function Sm(t=Xy){const e=Fp.get(t);if(!e&&t===Xy&&yk())return Ek();if(!e)throw No.create("no-app",{appName:t});return e}function hs(t,e,n){let r=ZF[t]??t;n&&(r+=`-${n}`);const s=r.match(/\s|\//),i=e.match(/\s|\//);if(s||i){const a=[`Unable to register library "${r}" with version "${e}":`];s&&a.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&i&&a.push("and"),i&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),zi.warn(a.join(" "));return}Mo(new $i(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/**
421 * @license
422 * Copyright 2021 Google LLC
423 *
424 * Licensed under the Apache License, Version 2.0 (the "License");
425 * you may not use this file except in compliance with the License.
426 * You may obtain a copy of the License at
427 *
428 *   http://www.apache.org/licenses/LICENSE-2.0
429 *
430 * Unless required by applicable law or agreed to in writing, softw
430are
431 * distributed under the License is distributed on an "AS IS" BASIS,
432 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
433 * See the License for the specific language governing permissions and
434 * limitations under the License.
435 */const r8="firebase-heartbeat-database",s8=1,ud="firebase-heartbeat-store";let Yg=null;function bk(){return Yg||(Yg=wF(r8,s8,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(ud)}catch{}}}}).catch(t=>{throw No.create("idb-open",{originalErrorMessage:t.message})})),Yg}async function i8(t){try{const n=(await bk()).transaction(ud),r=await n.objectStore(ud).get(Ak(t));return await n.done,r}catch(e){if(e instanceof Ls)zi.warn(e.message);else{const n=No.create("idb-get",{originalErrorMessage:e?.message});zi.warn(n.message)}}}async function Eb(t,e){try{const r=(await bk()).transaction(ud,"readwrite");await r.objectStore(ud).put(e,Ak(t)),await r.done}catch(n){if(n instanceof Ls)zi.warn(n.message);else{const r=No.create("idb-set",{originalErrorMessage:n?.message});zi.warn(r.message)}}}function Ak(t){return`${t.name}!${t.options.appId}`}/**
436 * @license
437 * Copyright 2021 Google LLC
438 *
439 * Licensed under the Apache License, Version 2.0 (the "License");
440 * you may not use this file except in compliance with the License.
441 * You may obtain a copy of the License at
442 *
443 *   http://www.apache.org/licenses/LICENSE-2.0
444 *
445 * Unless required by applicable law or agreed to in writing, software
446 * distributed under the License is distributed on an "AS IS" BASIS,
447 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
448 * See the License for the specific language governing permissions and
449 * limitations under the License.
450 */const o8=1024,a8=30;class l8{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new u8(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=bb();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(s=>s.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>a8){const s=d8(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(s,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){zi.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";const e=bb(),{heartbeatsToSend:n,unsentEntries:r}=c8(this._heartbeatsCache.heartbeats),s=Lp(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(e){return zi.warn(e),""}}}function bb(){return new Date().toISOString().substring(0,10)}function c8(t,e=o8){const n=[];let r=t.slice();for(const s of t){const i=n.find(a=>a.agent===s.agent);if(i){if(i.dates.push(s.date),Ab(n)>e){i.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Ab(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class u8{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return QL()?JL().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await i8(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return Eb(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return Eb(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function Ab(t){return Lp(JSON.stringify({version:2,heartbeats:t})).length}function d8(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;r<t.length;r++)t[r].date<n&&(n=t[r].date,e=r);return e}/**
451 * @license
452 * Copyright 2019 Google LLC
453 *
454 * Licensed under the Apache License, Version 2.0 (the "License");
455 * you may not use this file except in compliance with the License.
456 * You may obtain a copy of the License at
457 *
458 *   http://www.apache.org/licenses/LICENSE-2.0
459 *
460 * Unless required by applicable law or agreed to in writing, software
461 * distributed under the License is distributed on an "AS IS" BASIS,
462 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
463 * See the License for the specific language governing permissions and
464 * limitations under the License.
465 */function h8(t){Mo(new $i("platform-logger",e=>new AF(e),"PRIVATE")),Mo(new $i("heartbeat",e=>new l8(e),"PRIVATE")),hs(Jy,xb,t),hs(Jy,xb,"esm2020"),hs("fire-js","")}h8("");var f8="firebase",p8="12.9.0";/**
466 * @license
467 * Copyright 2020 Google LLC
468 *
469 * Licensed under the Apache License, Version 2.0 (the "License");
470 * you may not use this file except in compliance with the License.
471 * You may obtain a copy of the License at
472 *
473 *   http://www.apache.org/licenses/LICENSE-2.0
474 *
475 * Unless required by applicable law or agreed to in writing, software
476 * distributed under the License is distributed on an "AS IS" BASIS,
477 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
478 * See the License for the specific language governing permissions and
479 * limitations under the License.
480 */hs(f8,p8,"app");/**
481 * @license
482 * Copyright 2017 Google LLC
483 *
484 * Licensed under the Apache License, Version 2.0 (the "License");
485 * you may not use this file except in compliance with the License.
486 * You may obtain a copy of the License at
487 *
488 *   http://www.apache.org/licenses/LICENSE-2.0
489 *
490 * Unless required by applicable law or agreed to in writing, software
491 * distributed under the License is distributed on an "AS IS" BASIS,
492 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
493 * See the License for the specific language governing permissions and
494 * limitations under the License.
495 */const Tk="firebasestorage.googleapis.com",Ck="storageBucket",m8=120*1e3,g8=600*1e3;/**
496 * @license
497 * Copyright 2017 Google LLC
498 *
499 * Licensed under the Apache License, Version 2.0 (the "License");
500 * you may not use this file except in compliance with the License.
501 * You may obtain a copy of the License at
502 *
503 *   http://www.apache.org/licenses/LICENSE-2.0
504 *
505 * Unless required by applicable law or agreed to in writing, software
506 * distributed under the License is distributed on an "AS IS" BASIS,
507 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
508 * See the License for the specific language governing permissions and
509 * limitations under the License.
510 */class en extends Ls{constructor(e,n,r=0){super(Qg(e),`Firebase Storage: ${n} (${Qg(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,en.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Qg(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
511${this.customData.serverResponse}`:this.message=this._baseMessage}}var Zt;(function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(Zt||(Zt={}));function Qg(t){return"storage/"+t}function g_(){const t="An unknown error occurred, please check the error payload for server response.";return new en(Zt.UNKNOWN,t)}function y8(t){return new en(Zt.OBJECT_NOT_FOUND,"Object '"+t+"' does not exist.")}function v8(t){return new en(Zt.QUOTA_EXCEEDED,"Quota for bucket '"+t+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function _8(){const t="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new en(Zt.UNAUTHENTICATED,t)}function x8(){return new en(Zt.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function w8(t){return new en(Zt.UNAUTHORIZED,"User does not have permission to access '"+t+"'.")}function E8(){return new en(Zt.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}
vendor: 4,510 bytes, lines 511-545
511function b8(){return new en(Zt.CANCELED,"User canceled the upload/download.")}function A8(t){return new en(Zt.INVALID_URL,"Invalid URL '"+t+"'.")}function T8(t){return new en(Zt.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function C8(){return new en(Zt.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+Ck+"' property when initializing the app?")}function S8(){return new en(Zt.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function k8(){return new en(Zt.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function I8(t){return new en(Zt.UNSUPPORTED_ENVIRONMENT,`${t} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function ev(t){return new en(Zt.INVALID_ARGUMENT,t)}function Sk(){return new en(Zt.APP_DELETED,"The Firebase app was deleted.")}function P8(t){return new en(Zt.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function Wu(t,e){return new en(Zt.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function ku(t){throw new en(Zt.INTERNAL_ERROR,"Internal error: "+t)}/**
512 * @license
513 * Copyright 2017 Google LLC
514 *
515 * Licensed under the Apache License, Version 2.0 (the "License");
516 * you may not use this file except in compliance with the License.
517 * You may obtain a copy of the License at
518 *
519 *   http://www.apache.org/licenses/LICENSE-2.0
520 *
521 * Unless required by applicable law or agreed to in writing, software
522 * distributed under the License is distributed on an "AS IS" BASIS,
523 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
524 * See the License for the specific language governing permissions and
525 * limitations under the License.
526 */class Gr{constructor(e,n){this.bucket=e,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,n){let r;try{r=Gr.makeFromUrl(e,n)}catch{return new Gr(e,"")}if(r.path==="")return r;throw T8(e)}static makeFromUrl(e,n){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(N){N.path.charAt(N.path.length-1)==="/"&&(N.path_=N.path_.slice(0,-1))}const a="(/(.*))?$",c=new RegExp("^gs://"+s+a,"i"),u={bucket:1,path:3};function d(N){N.path_=decodeURIComponent(N.path)}const f="v[A-Za-z0-9_]+",g=n.replace(/[.]/g,"\\."),y="(/([^?#]*).*)?$",x=new RegExp(`^https?://${g}/${f}/b/${s}/o${y}`,"i"),b={bucket:1,path:3},E=n===Tk?"(?:storage.googleapis.com|storage.cloud.google.com)":n,w="([^?#]*)",R=new RegExp(`^https?://${E}/${s}/${w}`,"i"),k=[{regex:c,indices:u,postModify:i},{regex:x,indices:b,postModify:d},{regex:R,indices:{bucket:1,path:2},postModify:d}];for(let N=0;N<k.length;N++){const V=k[N],$=V.regex.exec(e);if($){const D=$[V.indices.bucket];let I=$[V.indices.path];I||(I=""),r=new Gr(D,I),V.postModify(r);break}}if(r==null)throw A8(e);return r}}class R8{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
527 * @license
528 * Copyright 2017 Google LLC
529 *
530 * Licensed under the Apache License, Version 2.0 (the "License");
531 * you may not use this file except in compliance with the License.
532 * You may obtain a copy of the License at
533 *
534 *   http://www.apache.org/licenses/LICENSE-2.0
535 *
536 * Unless required by applicable law or agreed to in writing, software
537 * distributed under the License is distributed on an "AS IS" BASIS,
538 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
539 * See the License for the specific language governing permissions and
540 * limitations under the License.
541 */function D8(t,e,n){let r=1,s=null,i=null,a=!1,c=0;function u(){return c===2}let d=!1;function f(...w){d||(d=!0,e.apply(null,w))}function g(w){s=setTimeout(()=>{s=null,t(x,u())},w)}function y(){i&&clearTimeout(i)}function x(w,...R){if(d){y();return}if(w){y(),f.call(null,w,...R);return}if(u()||a){y(),f.call(null,w,...R);return}r<64&&(r*=2);let k;c===1?(c=2,k=0):k=(r+Math.random())*1e3,g(k)}let b=!1;function E(w){b||(b=!0,y(),!d&&(s!==null?(w||(c=2),clearTimeout(s),g(0)):w||(c=1)))}return g(0),i=setTimeout(()=>{a=!0,E(!0)},n),E}function N8(t){t(!1)}/**
542 * @license
543 * Copyright 2017 Google LLC
544 *
545 * Licensed under the Apache License, Version 2.0 (the "License");
546 * you may not use this file except in compliance with the License.
547 * You may obtain a copy of the License at
548 *
549 *   http://www.apache.org/licenses/LICENSE-2.0
550 *
551 * Unless required by applicable law or agreed to in writing, software
552 * distributed under the License is distributed on an "AS IS" BASIS,
553 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
554 * See the License for the specific language governing permissions and
555 * limitations under the License.
556 */function O8(t){return t!==void 0}function L8(t){return typeof t=="object"&&!Array.isArray(t)}function y_(t){return typeof t=="string"||t instanceof String}function Tb(t){return v_()&&t instanceof Blob}function v_(){return typeof Blob<"u"}function Cb(t,e,n,r){if(r<e)throw ev(`Invalid value for '${t}'. Expected ${e} or greater.`);if(r>n)throw ev(`Invalid value for '${t}'. Expected ${n} or less.`)}/**
557 * @license
558 * Copyright 2017 Google LLC
559 *
560 * Licensed under the Apache License, Version 2.0 (the "License");
561 * you may not use this file except in compliance with the License.
562 * You may obtain a copy of the License at
563 *
564 *   http://www.apache.org/licenses/LICENSE-2.0
565 *
566 * Unless required by applicable law or agreed to in writing, software
567 * distributed under the License is distributed on an "AS IS" BASIS,
568 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
569 * See the License for the specific language governing permissions and
570 * limitations under the License.
571 */function kc(t,e,n){let r=e;return n==null&&(r=`https://${e}`),`${n}://${r}/v0${t}`}function kk(t){const e=encodeURIComponent;let n="?";for(const r in t)if(t.hasOwnProperty(r)){const s=e(r)+"="+e(t[r]);n=n+s+"&"}return n=n.slice(0,-1),n}var Na;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(Na||(Na={}));/**
572 * @license
573 * Copyright 2022 Google LLC
574 *
575 * Licensed under the Apache License, Version 2.0 (the "License");
576 * you may not use this file except in compliance with the License.
577 * You may obtain a copy of the License at
578 *
579 *   http://www.apache.org/licenses/LICENSE-2.0
580 *
581 * Unless required by applicable law or agreed to in writing, software
582 * distributed under the License is distributed on an "AS IS" BASIS,
583 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
584 * See the License for the specific language governing permissions and
585 * limitations under the License.
586 */function F8(t,e){const n=t>=500&&t<600,s=[408,429].indexOf(t)!==-1,i=e.indexOf(t)!==-1;return n||s||i}/**
587 * @license
588 * Copyright 2017 Google LLC
589 *
590 * Licensed under the Apache License, Version 2.0 (the "License");
591 * you may not use this file except in compliance with the License.
592 * You may obtain a copy of the License at
593 *
594 *   http://www.apache.org/licenses/LICENSE-2.0
595 *
596 * Unless required by applicable law or agreed to in writing, software
597 * distributed under the License is distributed on an "AS IS" BASIS,
598 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
599 * See the License for the specific language governing permissions and
600 * limitations under the License.
601 */class j8{constructor(e,n,r,s,i,a,c,u,d,f,g,y=!0,x=!1){this.url_=e,this.method_=n,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=a,this.callback_=c,this.errorCallback_=u,this.timeout_=d,this.progressCallback_=f,this.connectionFactory_=g,this.retry=y,this.isUsingEmulator=x,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((b,E)=>{this.resolve_=b,this.reject_=E,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new df(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const a=c=>{const u=c.loaded,d=c.lengthComputable?c.total:-1;this.progressCallback_!==null&&this.progressCallback_(u,d)};this.progressCallback_!==null&&i.addUploadProgressListener(a),i.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(a),this.pendingConnection_=null;const c=i.getErrorCode()===Na.NO_ERROR,u=i.getStatus();if(!c||F8(u,this.additionalRetryCodes_)&&this.retry){const f=i.getErrorCode()===Na.ABORT;r(!1,new df(!1,null,f));return}const d=this.successCodes_.indexOf(u)!==-1;r(!0,new df(d,i))})},n=(r,s)=>{const i=this.resolve_,a=this.reject_,c=s.connection;if(s.wasSuccessCode)try{const u=this.callback_(c,c.getResponse());O8(u)?i(u):i()}catch(u){a(u)}else if(c!==null){const u=g_();u.serverResponse=c.getErrorText(),this.errorCallback_?a(this.errorCallback_(c,u)):a(u)}else if(s.canceled){const u=this.appDelete_?Sk():b8();a(u)}else{const u=E8();a(u)}};this.canceled_?n(!1,new df(!1,null,!0)):this.backoffId_=D8(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&N8(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class df{constructor(e,n,r){this.wasSuccessCode=e,this.connection=n,this.canceled=!!r}}function M8(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function B8(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function V8(t,e){e&&(t["X-Firebase-GMPID"]=e)}function U8(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}
601function $8(t,e,n,r,s,i,a=!0,c=!1){const u=kk(t.urlParams),d=t.url+u,f=Object.assign({},t.headers);return V8(f,e),M8(f,n),B8(f,i),U8(f,r),new j8(d,t.method,f,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,s,a,c)}/**
602 * @license
603 * Copyright 2017 Google LLC
604 *
605 * Licensed under the Apache License, Version 2.0 (the "License");
606 * you may not use this file except in compliance with the License.
607 * You may obtain a copy of the License at
608 *
609 *   http://www.apache.org/licenses/LICENSE-2.0
610 *
611 * Unless required by applicable law or agreed to in writing, software
612 * distributed under the License is distributed on an "AS IS" BASIS,
613 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
614 * See the License for the specific language governing permissions and
615 * limitations under the License.
616 */function z8(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function H8(...t){const e=z8();if(e!==void 0){const n=new e;for(let r=0;r<t.length;r++)n.append(t[r]);return n.getBlob()}else{if(v_())return new Blob(t);throw new en(Zt.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function q8(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}/**
617 * @license
618 * Copyright 2021 Google LLC
619 *
620 * Licensed under the Apache License, Version 2.0 (the "License");
621 * you may not use this file except in compliance with the License.
622 * You may obtain a copy of the License at
623 *
624 *   http://www.apache.org/licenses/LICENSE-2.0
625 *
626 * Unless required by applicable law or agreed to in writing, software
627 * distributed under the License is distributed on an "AS IS" BASIS,
628 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
629 * See the License for the specific language governing permissions and
630 * limitations under the License.
631 */function W8(t){if(typeof atob>"u")throw I8("base-64");return atob(t)}/**
632 * @license
633 * Copyright 2017 Google LLC
634 *
635 * Licensed under the Apache License, Version 2.0 (the "License");
636 * you may not use this file except in compliance with the License.
637 * You may obtain a copy of the License at
638 *
639 *   http://www.apache.org/licenses/LICENSE-2.0
640 *
641 * Unless required by applicable law or agreed to in writing, software
642 * distributed under the License is distributed on an "AS IS" BASIS,
643 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
644 * See the License for the specific language governing permissions and
645 * limitations under the License.
646 */const ti={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class Jg{constructor(e,n){this.data=e,this.contentType=n||null}}function G8(t,e){switch(t){case ti.RAW:return new Jg(Ik(e));case ti.BASE64:case ti.BASE64URL:return new Jg(Pk(t,e));case ti.DATA_URL:return new Jg(Y8(e),Q8(e))}throw g_()}function Ik(t){const e=[];for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|r&63);else if((r&64512)===55296)if(!(n<t.length-1&&(t.charCodeAt(n+1)&64512)===56320))e.push(239,191,189);else{const i=r,a=t.charCodeAt(++n);r=65536|(i&1023)<<10|a&1023,e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}else(r&64512)===56320?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(e)}function K8(t){let e;try{e=decodeURIComponent(t)}catch{throw Wu(ti.DATA_URL,"Malformed data URL.")}return Ik(e)}function Pk(t,e){switch(t){case ti.BASE64:{const s=e.indexOf("-")!==-1,i=e.indexOf("_")!==-1;if(s||i)throw Wu(t,"Invalid character '"+(s?"-":"_")+"' found: is it base64url encoded?");break}case ti.BASE64URL:{const s=e.indexOf("+")!==-1,i=e.indexOf("/")!==-1;if(s||i)throw Wu(t,"Invalid character '"+(s?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=W8(e)}catch(s){throw s.message.includes("polyfill")?s:Wu(t,"Invalid character found")}const r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r}class Rk{constructor(e){this.base64=!1,this.contentType=null;const n=e.match(/^data:([^,]+)?,/);if(n===null)throw Wu(ti.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=n[1]||null;r!=null&&(this.base64=J8(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function Y8(t){const e=new Rk(t);return e.base64?Pk(ti.BASE64,e.rest):K8(e.rest)}function Q8(t){return new Rk(t).contentType}function J8(t,e){return t.length>=e.length?t.substring(t.length-e.length)===e:!1}/**
647 * @license
648 * Copyright 2017 Google LLC
649 *
650 * Licensed under the Apache License, Version 2.0 (the "License");
651 * you may not use this file except in compliance with the License.
652 * You may obtain a copy of the License at
653 *
654 *   http://www.apache.org/licenses/LICENSE-2.0
655 *
656 * Unless required by applicable law or agreed to in writing, software
657 * distributed under the License is distributed on an "AS IS" BASIS,
658 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
659 * See the License for the specific language governing permissions and
660 * limitations under the License.
661 */class Co{constructor(e,n){let r=0,s="";Tb(e)?(this.data_=e,r=e.size,s=e.type):e instanceof ArrayBuffer?(n?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),r=this.data_.length):e instanceof Uint8Array&&(n?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),r=e.length),this.size_=r,this.type_=s}size(){return this.size_}type(){return this.type_}slice(e,n){if(Tb(this.data_)){const r=this.data_,s=q8(r,e,n);return s===null?null:new Co(s)}else{const r=new Uint8Array(this.data_.buffer,e,n-e);return new Co(r,!0)}}static getBlob(...e){if(v_()){const n=e.map(r=>r instanceof Co?r.data_:r);return new Co(H8.apply(null,n))}else{const n=e.map(a=>y_(a)?G8(ti.RAW,a).data:a.data_);let r=0;n.forEach(a=>{r+=a.byteLength});const s=new Uint8Array(r);let i=0;return n.forEach(a=>{for(let c=0;c<a.length;c++)s[i++]=a[c]}),new Co(s,!0)}}uploadData(){return this.data_}}/**
662 * @license
663 * Copyright 2017 Google LLC
664 *
665 * Licensed under the Apache License, Version 2.0 (the "License");
666 * you may not use this file except in compliance with the License.
667 * You may obtain a copy of the License at
668 *
669 *   http://www.apache.org/licenses/LICENSE-2.0
670 *
671 * Unless required by applicable law or agreed to in writing, software
672 * distributed under the License is distributed on an "AS IS" BASIS,
673 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
674 * See the License for the specific language governing permissions and
675 * limitations under the License.
676 */function Dk(t){let e;try{e=JSON.parse(t)}catch{return null}return L8(e)?e:null}/**
677 * @license
678 * Copyright 2017 Google LLC
679 *
680 * Licensed under the Apache License, Version 2.0 (the "License");
681 * you may not use this file except in compliance with the License.
682 * You may obtain a copy of the License at
683 *
684 *   http://www.apache.org/licenses/LICENSE-2.0
685 *
686 * Unless required by applicable law or agreed to in writing, software
687 * distributed under the License is distributed on an "AS IS" BASIS,
688 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
689 * See the License for the specific language governing permissions and
690 * limitations under the License.
691 */function X8(t){if(t.length===0)return null;const e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function Z8(t,e){const n=e.split("/").filter(r=>r.length>0).join("/");return t.length===0?n:t+"/"+n}function Nk(t){const e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}/**
692 * @license
693 * Copyright 2017 Google LLC
694 *
695 * Licensed under the Apache License, Version 2.0 (the "License");
696 * you may not use this file except in compliance with the License.
697 * You may obtain a copy of the License at
698 *
699 *   http://www.apache.org/licenses/LICENSE-2.0
700 *
701 * Unless required by applicable law or agreed to in writing, software
702 * distributed under the License is distributed on an "AS IS" BASIS,
703 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
704 * See the License for the specific language governing permissions and
705 * limitations under the License.
706 */function e5(t,e){return e}class pr{constructor(e,n,r,s){this.server=e,this.local=n||e,this.writable=!!r,this.xform=s||e5}}let hf=null;function t5(t){return!y_(t)||t.length<2?t:Nk(t)}function __(){if(hf)return hf;const t=[];t.push(new pr("bucket")),t.push(new pr("generation")),t.push(new pr("metageneration")),t.push(new pr("name","fullPath",!0));function e(i,a){return t5(a)}const n=new pr("name");n.xform=e,t.push(n);function r(i,a){return a!==void 0?Number(a):a}const s=new pr("size");return s.xform=r,t.push(s),t.push(new pr("timeCreated")),t.push(new pr("updated")),t.push(new pr("md5Hash",null,!0)),t.push(new pr("cacheControl",null,!0)),t.push(new pr("contentDisposition",null,!0)),t.push(new pr("contentEncoding",null,!0)),t.push(new pr("contentLanguage",null,!0)),t.push(new pr("contentType",null,!0)),t.push(new pr("metadata","customMetadata",!0)),hf=t,hf}function n5(t,e){function n(){const r=t.bucket,s=t.fullPath,i=new Gr(r,s);return e._makeStorageReference(i)}Object.defineProperty(t,"ref",{get:n})}function r5(t,e,n){const r={};r.type="file";const s=n.length;for(let i=0;i<s;i++){const a=n[i];r[a.local]=a.xform(r,e[a.server])}return n5(r,t),r}function Ok(t,e,n){const r=Dk(e);return r===null?null:r5(t,r,n)}function s5(t,e,n,r){const s=Dk(e);if(s===null||!y_(s.downloadTokens))return null;const i=s.downloadTokens;if(i.length===0)return null;const a=encodeURIComponent;return i.split(",").map(d=>
706{const f=t.bucket,g=t.fullPath,y="/b/"+a(f)+"/o/"+a(g),x=kc(y,n,r),b=kk({alt:"media",token:d});return x+b})[0]}function i5(t,e){const n={},r=e.length;for(let s=0;s<r;s++){const i=e[s];i.writable&&(n[i.server]=t[i.local])}return JSON.stringify(n)}class Dd{constructor(e,n,r,s){this.url=e,this.method=n,this.handler=r,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}/**
707 * @license
708 * Copyright 2017 Google LLC
709 *
710 * Licensed under the Apache License, Version 2.0 (the "License");
711 * you may not use this file except in compliance with the License.
712 * You may obtain a copy of the License at
713 *
714 *   http://www.apache.org/licenses/LICENSE-2.0
715 *
716 * Unless required by applicable law or agreed to in writing, software
717 * distributed under the License is distributed on an "AS IS" BASIS,
718 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
719 * See the License for the specific language governing permissions and
720 * limitations under the License.
721 */function Lk(t){if(!t)throw g_()}function Fk(t,e){function n(r,s){const i=Ok(t,s,e);return Lk(i!==null),i}return n}function o5(t,e){function n(r,s){const i=Ok(t,s,e);return Lk(i!==null),s5(i,s,t.host,t._protocol)}return n}function jk(t){function e(n,r){let s;return n.getStatus()===401?n.getErrorText().includes("Firebase App Check token is invalid")?s=x8():s=_8():n.getStatus()===402?s=v8(t.bucket):n.getStatus()===403?s=w8(t.path):s=r,s.status=n.getStatus(),s.serverResponse=r.serverResponse,s}return e}function km(t){const e=jk(t);function n(r,s){let i=e(r,s);return r.getStatus()===404&&(i=y8(t.path)),i.serverResponse=s.serverResponse,i}return n}function a5(t,e,n){const r=e.fullServerUrl(),s=kc(r,t.host,t._protocol),i="GET",a=t.maxOperationRetryTime,c=new Dd(s,i,Fk(t,n),a);return c.errorHandler=km(e),c}function l5(t,e,n){const r=e.fullServerUrl(),s=kc(r,t.host,t._protocol)+"?alt=media",i="GET",a=t.maxOperationRetryTime,c=new Dd(s,i,(u,d)=>d,a);return c.errorHandler=km(e),c}function c5(t,e,n){const r=e.fullServerUrl(),s=kc(r,t.host,t._protocol),i="GET",a=t.maxOperationRetryTime,c=new Dd(s,i,o5(t,n),a);return c.errorHandler=km(e),c}function u5(t,e){const n=e.fullServerUrl(),r=kc(n,t.host,t._protocol),s="DELETE",i=t.maxOperationRetryTime;function a(u,d){}const c=new Dd(r,s,a,i);return c.successCodes=[200,204],c.errorHandler=km(e),c}function d5(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}function h5(t,e,n){const r=Object.assign({},n);return r.fullPath=t.path,r.size=e.size(),r.contentType||(r.contentType=d5(null,e)),r}function f5(t,e,n,r,s){const i=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"};function c(){let k="";for(let N=0;N<2;N++)k=k+Math.random().toString().slice(2);return k}const u=c();a["Content-Type"]="multipart/related; boundary="+u;const d=h5(e,r,s),f=i5(d,n),g="--"+u+`\r
722Content-Type: application/json; charset=utf-8\r
723\r
724`+f+`\r
725--`+u+`\r
726Content-Type: `+d.contentType+`\r
727\r
728`,y=`\r
729--`+u+"--",x=Co.getBlob(g,r,y);if(x===null)throw S8();const b={name:d.fullPath},E=kc(i,t.host,t._protocol),w="POST",R=t.maxUploadRetryTime,C=new Dd(E,w,Fk(t,n),R);return C.urlParams=b,C.headers=a,C.body=x.uploadData(),C.errorHandler=jk(e),C}class Mk{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=Na.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=Na.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=Na.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,n,r,s,i){if(this.sent_)throw ku("cannot .send() more than once");if(li(e)&&r&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(n,e,!0),i!==void 0)for(const a in i)i.hasOwnProperty(a)&&this.xhr_.setRequestHeader(a,i[a].toString());return s!==void 0?this.xhr_.send(s):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw ku("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw ku("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw ku("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw ku("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener("progress",e)}}class p5 extends Mk{initXhr(){this.xhr_.responseType="text"}}function Im(){return new p5}class m5 extends Mk{initXhr(){this.xhr_.responseType="blob"}}function g5(){return new m5}/**
730 * @license
731 * Copyright 2019 Google LLC
732 *
733 * Licensed under the Apache License, Version 2.0 (the "License");
734 * you may not use this file except in compliance with the License.
735 * You may obtain a copy of the License at
736 *
737 *   http://www.apache.org/licenses/LICENSE-2.0
738 *
739 * Unless required by applicable law or agreed to in writing, software
740 * distributed under the License is distributed on an "AS IS" BASIS,
741 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
742 * See the License for the specific language governing permissions and
743 * limitations under the License.
744 */class Ba{constructor(e,n){this._service=e,n instanceof Gr?this._location=n:this._location=Gr.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new Ba(e,n)}get root(){const e=new Gr(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return Nk(this._location.path)}get storage(){return this._service}get parent(){const e=X8(this._location.path);if(e===null)return null;const n=new Gr(this._location.bucket,e);return new Ba(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw P8(e)}}function y5(t,e){t._throwIfRoot("getBlob");const n=l5(t.storage,t._location);return t.storage.makeRequestWithTokens(n,g5).then(r=>r)}function v5(t,e,n){t._throwIfRoot("uploadBytes");const r=f5(t.storage,t._location,__(),new Co(e,!0),n);return t.storage.makeRequestWithTokens(r,Im).then(s=>({metadata:s,ref:t}))}function _5(t){t._throwIfRoot("getMetadata");const e=a5(t.storage,t._location,__());return t.storage.makeRequestWithTokens(e,Im)}function x5(t){t._throwIfRoot("getDownloadURL");const e=c5(t.storage,t._location,__());return t.storage.makeRequestWithTokens(e,Im).then(n=>{if(n===null)throw k8();return n})}function w5(t){t._throwIfRoot("deleteObject");const e=u5(t.storage,t._location);return t.storage.makeRequestWithTokens(e,Im)}function E5(t,e){const n=Z8(t._location.path,e),r=new Gr(t._location.bucket,n);return new Ba(t.storage,r)}/**
745 * @license
746 * Copyright 2017 Google LLC
747 *
748 * Licensed under the Apache License, Version 2.0 (the "License");
749 * you may not use this file except in compliance with the License.
750 * You may obtain a copy of the License at
751 *
752 *   http://www.apache.org/licenses/LICENSE-2.0
753 *
754 * Unless required by applicable law or agreed to in writing, software
755 * distributed under the License is distributed on an "AS IS" BASIS,
756 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
757 * See the License for the specific language governing permissions and
758 * limitations under the License.
759 */function b5(t){return/^[A-Za-z]+:\/\//.test(t)}function A5(t,e){return new Ba(t,e)}function Bk(t,e){if(t instanceof x_){const n=t;if(n._bucket==null)throw C8();const r=new Ba(n,n._bucket);return e!=null?Bk(r,e):r}else return e!==void 0?E5(t,e):t}function T5(t,e){if(e&&b5(e)){if(t instanceof x_)return A5(t,e);throw ev("To use ref(service, url), the first argument must be a Storage instance.")}else return Bk(t,e)}function Sb(t,e){const n=e?.[Ck];return n==null?null:Gr.makeFromBucketSpec(n,t)}function C5(t,e,n,r={}){t.host=`${e}:${n}`;const s=li(e);s&&(Tm(`https://${t.host}/b`),Cm("Storage",!0)),t._isUsingEmulator=!0,t._protocol=s?"https":"http";const{mockUserToken:i}=r;i&&(t._overrideAuthToken=typeof i=="string"?i:_k(i,t.app.options.projectId))}class x_{constructor(e,n,r,s,i,a=!1){this.app=e,this._authProvider=n,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._isUsingEmulator=a,this._bucket=null,this._host=Tk,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=m8,this._maxUploadRetryTime=g8,this._requests=new Set,s!=null?this._bucket=Gr.makeFromBucketSpec(s,this._host):this._bucket=Sb(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Gr.makeFromBucketSpec(this._url,e):this._bucket=Sb(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){Cb("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){Cb("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const n=await e.getToken();if(n!==null)return n.accessToken}return null}async _getAppCheckToken(){if(Ir(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});
759return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Ba(this,e)}_makeRequest(e,n,r,s,i=!0){if(this._deleted)return new R8(Sk());{const a=$8(e,this._appId,r,s,n,this._firebaseVersion,i,this._isUsingEmulator);return this._requests.add(a),a.getPromise().then(()=>this._requests.delete(a),()=>this._requests.delete(a)),a}}async makeRequestWithTokens(e,n){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,r,s).getPromise()}}const kb="@firebase/storage",Ib="0.14.0";/**
760 * @license
761 * Copyright 2020 Google LLC
762 *
763 * Licensed under the Apache License, Version 2.0 (the "License");
764 * you may not use this file except in compliance with the License.
765 * You may obtain a copy of the License at
766 *
767 *   http://www.apache.org/licenses/LICENSE-2.0
768 *
769 * Unless required by applicable law or agreed to in writing, software
770 * distributed under the License is distributed on an "AS IS" BASIS,
771 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
772 * See the License for the specific language governing permissions and
773 * limitations under the License.
774 */const Vk="storage";function TX(t,e,n){return t=xt(t),v5(t,e,n)}function S5(t){return t=xt(t),_5(t)}function w_(t){return t=xt(t),x5(t)}function CX(t){return t=xt(t),w5(t)}function E_(t,e){return t=xt(t),T5(t,e)}function k5(t=Sm(),e){t=xt(t);const r=Rd(t,Vk).getImmediate({identifier:e}),s=f_("storage");return s&&I5(r,...s),r}function I5(t,e,n,r={}){C5(t,e,n,r)}/**
775 * @license
776 * Copyright 2021 Google LLC
777 *
778 * Licensed under the Apache License, Version 2.0 (the "License");
779 * you may not use this file except in compliance with the License.
780 * You may obtain a copy of the License at
781 *
782 *   http://www.apache.org/licenses/LICENSE-2.0
783 *
784 * Unless required by applicable law or agreed to in writing, software
785 * distributed under the License is distributed on an "AS IS" BASIS,
786 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
787 * See the License for the specific language governing permissions and
788 * limitations under the License.
789 */function SX(t,e){return t=xt(t),y5(t)}function P5(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),s=t.getProvider("app-check-internal");return new x_(n,r,s,e,Ya)}function R5(){Mo(new $i(Vk,P5,"PUBLIC").setMultipleInstances(!0)),hs(kb,Ib,""),hs(kb,Ib,"esm2020")}R5();/**
790 * @license
791 * Copyright 2017 Google LLC
792 *
793 * Licensed under the Apache License, Version 2.0 (the "License");
794 * you may not use this file except in compliance with the License.
795 * You may obtain a copy of the License at
796 *
797 *   http://www.apache.org/licenses/LICENSE-2.0
798 *
799 * Unless required by applicable law or agreed to in writing, software
800 * distributed under the License is distributed on an "AS IS" BASIS,
801 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
802 * See the License for the specific language governing permissions and
803 * limitations under the License.
804 */const D5="type.googleapis.com/google.protobuf.Int64Value",N5="type.googleapis.com/google.protobuf.UInt64Value";function Uk(t,e){const n={};for(const r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}function jp(t){if(t==null)return null;if(t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&isFinite(t)||t===!0||t===!1||Object.prototype.toString.call(t)==="[object String]")return t;if(t instanceof Date)return t.toISOString();if(Array.isArray(t))return t.map(e=>jp(e));if(typeof t=="function"||typeof t=="object")return Uk(t,e=>jp(e));throw new Error("Data cannot be encoded in JSON: "+t)}function uc(t){if(t==null)return t;if(t["@type"])switch(t["@type"]){case D5:case N5:{const e=Number(t.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+t);return e}default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map(e=>uc(e)):typeof t=="function"||typeof t=="object"?Uk(t,e=>uc(e)):t}/**
805 * @license
806 * Copyright 2020 Google LLC
807 *
808 * Licensed under the Apache License, Version 2.0 (the "License");
809 * you may not use this file except in compliance with the License.
810 * You may obtain a copy of the License at
811 *
812 *   http://www.apache.org/licenses/LICENSE-2.0
813 *
814 * Unless required by applicable law or agreed to in writing, software
815 * distributed under the License is distributed on an "AS IS" BASIS,
816 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
817 * See the License for the specific language governing permissions and
818 * limitations under the License.
819 */const b_="functions";/**
820 * @license
821 * Copyright 2017 Google LLC
822 *
823 * Licensed under the Apache License, Version 2.0 (the "License");
824 * you may not use this file except in compliance with the License.
825 * You may obtain a copy of the License at
826 *
827 *   http://www.apache.org/licenses/LICENSE-2.0
828 *
829 * Unless required by applicable law or agreed to in writing, software
830 * distributed under the License is distributed on an "AS IS" BASIS,
831 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
832 * See the License for the specific language governing permissions and
833 * limitations under the License.
834 */const Pb={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Rr extends Ls{constructor(e,n,r){super(`${b_}/${e}`,n||""),this.details=r,Object.setPrototypeOf(this,Rr.prototype)}}function O5(t){if(t>=200&&t<300)return"ok";switch(t){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function Mp(t,e){let n=O5(t),r=n,s;try{const i=e&&e.error;if(i){const a=i.status;if(typeof a=="string"){if(!Pb[a])return new Rr("internal","internal");n=Pb[a],r=a}const c=i.message;typeof c=="string"&&(r=c),s=i.details,s!==void 0&&(s=uc(s))}}catch{}return n==="ok"?null:new Rr(n,r,s)}/**
835 * @license
836 * Copyright 2017 Google LLC
837 *
838 * Licensed under the Apache License, Version 2.0 (the "License");
839 * you may not use this file except in compliance with the License.
840 * You may obtain a copy of the License at
841 *
842 *   http://www.apache.org/licenses/LICENSE-2.0
843 *
844 * Unless required by applicable law or agreed to in writing, software
845 * distributed under the License is distributed on an "AS IS" BASIS,
846 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
847 * See the License for the specific language governing permissions and
848 * limitations under the License.
849 */class L5{constructor(e,n,r,s){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,Ir(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=n.getImmediate({optional:!0}),this.messaging=r.getImmediate({optional:!0}),this.auth||n.get().then(i=>this.auth=i,()=>{}),this.messaging||r.get().then(i=>this.messaging=i,()=>{}),this.appCheck||s?.get().then(i=>this.appCheck=i,()=>{})}async getAuthToken(){if(this.auth)try{return(await this.auth.getToken())?.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.serverAppAppCheckToken)return this.serverAppAppCheckToken;if(this.appCheck){const n=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return n.error?null:n.token}return null}async getContext(e){const n=await this.getAuthToken(),r=await this.getMessagingToken(),s=await this.getAppCheckToken(e);
849return{authToken:n,messagingToken:r,appCheckToken:s}}}/**
850 * @license
851 * Copyright 2017 Google LLC
852 *
853 * Licensed under the Apache License, Version 2.0 (the "License");
854 * you may not use this file except in compliance with the License.
855 * You may obtain a copy of the License at
856 *
857 *   http://www.apache.org/licenses/LICENSE-2.0
858 *
859 * Unless required by applicable law or agreed to in writing, software
860 * distributed under the License is distributed on an "AS IS" BASIS,
861 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
862 * See the License for the specific language governing permissions and
863 * limitations under the License.
864 */const tv="us-central1",F5=/^data: (.*?)(?:\n|$)/;function j5(t){let e=null;return{promise:new Promise((n,r)=>{e=setTimeout(()=>{r(new Rr("deadline-exceeded","deadline-exceeded"))},t)}),cancel:()=>{e&&clearTimeout(e)}}}class M5{constructor(e,n,r,s,i=tv,a=(...c)=>fetch(...c)){this.app=e,this.fetchImpl=a,this.emulatorOrigin=null,this.contextProvider=new L5(e,n,r,s),this.cancelAllRequests=new Promise(c=>{this.deleteService=()=>Promise.resolve(c())});try{const c=new URL(i);this.customDomain=c.origin+(c.pathname==="/"?"":c.pathname),this.region=tv}catch{this.customDomain=null,this.region=i}}_delete(){return this.deleteService()}_url(e){const n=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${n}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${n}.cloudfunctions.net/${e}`}}function B5(t,e,n){const r=li(e);t.emulatorOrigin=`http${r?"s":""}://${e}:${n}`,r&&(Tm(t.emulatorOrigin+"/backends"),Cm("Functions",!0))}function V5(t,e,n){const r=s=>$5(t,e,s,{});return r.stream=(s,i)=>H5(t,e,s,i),r}function $k(t){return t.emulatorOrigin&&li(t.emulatorOrigin)?"include":void 0}async function U5(t,e,n,r,s){n["Content-Type"]="application/json";let i;try{i=await r(t,{method:"POST",body:JSON.stringify(e),headers:n,credentials:$k(s)})}catch{return{status:0,json:null}}let a=null;try{a=await i.json()}catch{}return{status:i.status,json:a}}async function zk(t,e){const n={},r=await t.contextProvider.getContext(e.limitedUseAppCheckTokens);return r.authToken&&(n.Authorization="Bearer "+r.authToken),r.messagingToken&&(n["Firebase-Instance-ID-Token"]=r.messagingToken),r.appCheckToken!==null&&(n["X-Firebase-AppCheck"]=r.appCheckToken),n}function $5(t,e,n,r){const s=t._url(e);return z5(t,s,n,r)}async function z5(t,e,n,r){n=jp(n);const s={data:n},i=await zk(t,r),a=r.timeout||7e4,c=j5(a),u=await Promise.race([U5(e,s,i,t.fetchImpl,t),c.promise,t.cancelAllRequests]);if(c.cancel(),!u)throw new Rr("cancelled","Firebase Functions instance was deleted.");const d=Mp(u.status,u.json);if(d)throw d;if(!u.json)throw new Rr("internal","Response is not valid JSON object.");let f=u.json.data;if(typeof f>"u"&&(f=u.json.result),typeof f>"u")throw new Rr("internal","Response is missing data field.");return{data:uc(f)}}function H5(t,e,n,r){const s=t._url(e);return q5(t,s,n,r||{})}async function q5(t,e,n,r){n=jp(n);const s={data:n},i=await zk(t,r);i["Content-Type"]="application/json",i.Accept="text/event-stream";let a;try{a=await t.fetchImpl(e,{method:"POST",body:JSON.stringify(s),headers:i,signal:r?.signal,credentials:$k(t)})}catch(y){if(y instanceof Error&&y.name==="AbortError"){const b=new Rr("cancelled","Request was cancelled.");return{data:Promise.reject(b),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(b)}}}}}}const x=Mp(0,null);return{data:Promise.reject(x),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(x)}}}}}}let c,u;const d=new Promise((y,x)=>{c=y,u=x});r?.signal?.addEventListener("abort",()=>{const y=new Rr("cancelled","Request was cancelled.");u(y)});const f=a.body.getReader(),g=W5(f,c,u,r?.signal);return{stream:{[Symbol.asyncIterator](){const y=g.getReader();return{async next(){const{value:x,done:b}=await y.read();return{value:x,done:b}},async return(){return await y.cancel(),{done:!0,value:void 0}}}}},data:d}}function W5(t,e,n,r){const s=(a,c)=>{const u=a.match(F5);if(!u)return;const d=u[1];try{const f=JSON.parse(d);if("result"in f){e(uc(f.result));return}if("message"in f){c.enqueue(uc(f.message));return}if("error"in f){const g=Mp(0,f);c.error(g),n(g);return}}catch(f){if(f instanceof Rr){c.error(f),n(f);return}}},i=new TextDecoder;return new ReadableStream({start(a){let c="";return u();async function u(){if(r?.aborted){const d=new Rr("cancelled","Request was cancelled");return a.error(d),n(d),Promise.resolve()}try{const{value:d,done:f}=await t.read();if(f){c.trim()&&s(c.trim(),a),a.close();return}if(r?.aborted){const y=new Rr("cancelled","Request was cancelled");a.error(y),n(y),await t.cancel();return}c+=i.decode(d,{stream:!0});const g=c.split(`
865`);c=g.pop()||"";for(const y of g)y.trim()&&s(y.trim(),a);return u()}catch(d){const f=d instanceof Rr?d:Mp(0,null);a.error(f),n(f)}}},cancel(){return t.cancel()}})}const Rb="@firebase/functions",Db="0.13.1";/**
866 * @license
867 * Copyright 2019 Google LLC
868 *
869 * Licensed under the Apache License, Version 2.0 (the "License");
870 * you may not use this file except in compliance with the License.
871 * You may obtain a copy of the License at
872 *
873 *   http://www.apache.org/licenses/LICENSE-2.0
874 *
875 * Unless required by applicable law or agreed to in writing, software
876 * distributed under the License is distributed on an "AS IS" BASIS,
877 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
878 * See the License for the specific language governing permissions and
879 * limitations under the License.
880 */const G5="auth-internal",K5="app-check-internal",Y5="messaging-internal";function Q5(t){const e=(n,{instanceIdentifier:r})=>{const s=n.getProvider("app").getImmediate(),i=n.getProvider(G5),a=n.getProvider(Y5),c=n.getProvider(K5);return new M5(s,i,a,c,r)};Mo(new $i(b_,e,"PUBLIC").setMultipleInstances(!0)),hs(Rb,Db,t),hs(Rb,Db,"esm2020")}/**
881 * @license
882 * Copyright 2020 Google LLC
883 *
884 * Licensed under the Apache License, Version 2.0 (the "License");
885 * you may not use this file except in compliance with the License.
886 * You may obtain a copy of the License at
887 *
888 *   http://www.apache.org/licenses/LICENSE-2.0
889 *
890 * Unless required by applicable law or agreed to in writing, software
891 * distributed under the License is distributed on an "AS IS" BASIS,
892 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
893 * See the License for the specific language governing permissions and
894 * limitations under the License.
895 */function J5(t=Sm(),e=tv){const r=Rd(xt(t),b_).getImmediate({identifier:e}),s=f_("functions");return s&&X5(r,...s),r}function X5(t,e,n){B5(xt(t),e,n)}function ci(t,e,n){return V5(xt(t),e)}Q5();var Nb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
896Copyright The Closure Library Authors.
897SPDX-License-Identifier: Apache-2.0
898*/var Oo,Hk;(function(){var t;/** @license
899
900 Copyright The Closure Library Authors.
901 SPDX-License-Identifier: Apache-2.0
902*/function e(D,I){function B(){}B.prototype=I.prototype,D.F=I.prototype,D.prototype=new B,D.prototype.constructor=D,D.D=function(O,F,L){for(var M=Array(arguments.length-2),se=2;se<arguments.length;se++)M[se-2]=arguments[se];return I.prototype[F].apply(O,M)}}function n(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}e(r,n),r.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function s(D,I,B){B||(B=0);const O=Array(16);if(typeof I=="string")for(var F=0;F<16;++F)O[F]=I.charCodeAt(B++)|I.charCodeAt(B++)<<8|I.charCodeAt(B++)<<16|I.charCodeAt(B++)<<24;else for(F=0;F<16;++F)O[F]=I[B++]|I[B++]<<8|I[B++]<<16|I[B++]<<24;I=D.g[0],B=D.g[1],F=D.g[2];let L=D.g[3],M;M=I+(L^B&(F^L))+O[0]+3614090360&4294967295,I=B+(M<<7&4294967295|M>>>25),M=L+(F^I&(B^F))+O[1]+3905402710&4294967295,L=I+(M<<12&4294967295|M>>>20),M=F+(B^L&(I^B))+O[2]+606105819&4294967295,F=L+(M<<17&4294967295|M>>>15),M=B+(I^F&(L^I))+O[3]+3250441966&4294967295,B=F+(M<<22&4294967295|M>>>10),M=I+(L^B&(F^L))+O[4]+4118548399&4294967295,I=B+(M<<7&4294967295|M>>>25),M=L+(F^I&(B^F))+O[5]+1200080426&4294967295,L=I+(M<<12&4294967295|M>>>20),M=F+(B^L&(I^B))+O[6]+2821735955&4294967295,F=L+(M<<17&4294967295|M>>>15),M=B+(I^F&(L^I))+O[7]+4249261313&4294967295,B=F+(M<<22&4294967295|M>>>10),M=I+(L^B&(F^L))+O[8]+1770035416&4294967295,I=B+(M<<7&4294967295|M>>>25),M=L+(F^I&(B^F))+O[9]+2336552879&4294967295,L=I+(M<<12&4294967295|M>>>20),M=F+(B^L&(I^B))+O[10]+4294925233&4294967295,F=L+(M<<17&4294967295|M>>>15),M=B+(I^F&(L^I))+O[11]+2304563134&4294967295,B=F+(M<<22&4294967295|M>>>10),M=I+(L^B&(F^L))+O[12]+1804603682&4294967295,I=B+(M<<7&4294967295|M>>>25),M=L+(F^I&(B^F))+O[13]+4254626195&4294967295,L=I+(M<<12&4294967295|M>>>20),M=F+(B^L&(I^B))+O[14]+2792965006&4294967295,F=L+(M<<17&4294967295|M>>>15),M=B+(I^F&(L^I))+O[15]+1236535329&4294967295,B=F+(M<<22&4294967295|M>>>10),M=I+(F^L&(B^F))+O[1]+4129170786&4294967295,I=B+(M<<5&4294967295|M>>>27),M=L+(B^F&(I^B))+O[6]+3225465664&4294967295,L=I+(M<<9&4294967295|M>>>23),M=F+(I^B&(L^I))+O[11]+643717713&4294967295,F=L+(M<<14&4294967295|M>>>18),M=B+(L^I&(F^L))+O[0]+3921069994&4294967295,B=F+(M<<20&4294967295|M>>>
90212),M=I+(F^L&(B^F))+O[5]+3593408605&4294967295,I=B+(M<<5&4294967295|M>>>27),M=L+(B^F&(I^B))+O[10]+38016083&4294967295,L=I+(M<<9&4294967295|M>>>23),M=F+(I^B&(L^I))+O[15]+3634488961&4294967295,F=L+(M<<14&4294967295|M>>>18),M=B+(L^I&(F^L))+O[4]+3889429448&4294967295,B=F+(M<<20&4294967295|M>>>12),M=I+(F^L&(B^F))+O[9]+568446438&4294967295,I=B+(M<<5&4294967295|M>>>27),M=L+(B^F&(I^B))+O[14]+3275163606&4294967295,L=I+(M<<9&4294967295|M>>>23),M=F+(I^B&(L^I))+O[3]+4107603335&4294967295,F=L+(M<<14&4294967295|M>>>18),M=B+(L^I&(F^L))+O[8]+1163531501&4294967295,B=F+(M<<20&4294967295|M>>>12),M=I+(F^L&(B^F))+O[13]+2850285829&4294967295,I=B+(M<<5&4294967295|M>>>27),M=L+(B^F&(I^B))+O[2]+4243563512&4294967295,L=I+(M<<9&4294967295|M>>>23),M=F+(I^B&(L^I))+O[7]+1735328473&4294967295,F=L+(M<<14&4294967295|M>>>18),M=B+(L^I&(F^L))+O[12]+2368359562&4294967295,B=F+(M<<20&4294967295|M>>>12),M=I+(B^F^L)+O[5]+4294588738&4294967295,I=B+(M<<4&4294967295|M>>>28),M=L+(I^B^F)+O[8]+2272392833&4294967295,L=I+(M<<11&4294967295|M>>>21),M=F+(L^I^B)+O[11]+1839030562&4294967295,F=L+(M<<16&4294967295|M>>>16),M=B+(F^L^I)+O[14]+4259657740&4294967295,B=F+(M<<23&4294967295|M>>>9),M=I+(B^F^L)+O[1]+2763975236&4294967295,I=B+(M<<4&4294967295|M>>>28),M=L+(I^B^F)+O[4]+1272893353&4294967295,L=I+(M<<11&4294967295|M>>>21),M=F+(L^I^B)+O[7]+4139469664&4294967295,F=L+(M<<16&4294967295|M>>>16),M=B+(F^L^I)+O[10]+3200236656&4294967295,B=F+(M<<23&4294967295|M>>>9),M=I+(B^F^L)+O[13]+681279174&4294967295,I=B+(M<<4&4294967295|M>>>28),M=L+(I^B^F)+O[0]+3936430074&4294967295,L=I+(M<<11&4294967295|M>>>21),M=F+(L^I^B)+O[3]+3572445317&4294967295,F=L+(M<<16&4294967295|M>>>16),M=B+(F^L^I)+O[6]+76029189&4294967295,B=F+(M<<23&4294967295|M>>>9),M=I+(B^F^L)+O[9]+3654602809&4294967295,I=B+(M<<4&4294967295|M>>>28),M=L+(I^B^F)+O[12]+3873151461&4294967295,L=I+(M<<11&4294967295|M>>>21),M=F+(L^I^B)+O[15]+530742520&4294967295,F=L+(M<<16&4294967295|M>>>16),M=B+(F^L^I)+O[2]+3299628645&4294967295,B=F+(M<<23&4294967295|M>>>9),M=I+(F^(B|~L))+O[0]+4096336452&4294967295,I=B+(M<<6&4294967295|M>>>26),M=L+(B^(I|~F))+O[7]+1126891415&4294967295,L=I+(M<<10&4294967295|M>>>22),M=F+(I^(L|~B))+O[14]+2878612391&4294967295,F=L+(M<<15&4294967295|M>>>17),M=B+(L^(F|~I))+O[5]+4237533241&4294967295,B=F+(M<<21&4294967295|M>>>11),M=I+(F^(B|~L))+O[12]+1700485571&4294967295,I=B+(M<<6&4294967295|M>>>26),M=L+(B^(I|~F))+O[3]+2399980690&4294967295,L=I+(M<<10&4294967295|M>>>22),M=F+(I^(L|~B))+O[10]+4293915773&4294967295,F=L+(M<<15&4294967295|M>>>17),M=B+(L^(F|~I))+O[1]+2240044497&4294967295,B=F+(M<<21&4294967295|M>>>11),M=I+(F^(B|~L))+O[8]+1873313359&4294967295,I=B+(M<<6&4294967295|M>>>26),M=L+(B^(I|~F))+O[15]+4264355552&4294967295,L=I+(M<<10&4294967295|M>>>22),M=F+(I^(L|~B))+O[6]+2734768916&4294967295,F=L+(M<<15&4294967295|M>>>17),M=B+(L^(F|~I))+O[13]+1309151649&4294967295,B=F+(M<<21&4294967295|M>>>11),M=I+(F^(B|~L))+O[4]+4149444226&4294967295,I=B+(M<<6&4294967295|M>>>26),M=L+(B^(I|~F))+O[11]+3174756917&4294967295,L=I+(M<<10&4294967295|M>>>22),M=F+(I^(L|~B))+O[2]+718787259&4294967295,F=L+(M<<15&4294967295|M>>>17),M=B+(L^(F|~I))+O[9]+3951481745&4294967295,D.g[0]=D.g[0]+I&4294967295,D.g[1]=D.g[1]+(F+(M<<21&4294967295|M>>>11))&4294967295,D.g[2]=D.g[2]+F&4294967295,D.g[3]=D.g[3]+L&4294967295}r.prototype.v=function(D,I){I===void 0&&(I=D.length);const B=I-this.blockSize,O=this.C;let F=this.h,L=0;for(;L<I;){if(F==0)for(;L<=B;)s(this,D,L),L+=this.blockSize;
902if(typeof D=="string"){for(;L<I;)if(O[F++]=D.charCodeAt(L++),F==this.blockSize){s(this,O),F=0;break}}else for(;L<I;)if(O[F++]=D[L++],F==this.blockSize){s(this,O),F=0;break}}this.h=F,this.o+=I},r.prototype.A=function(){var D=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);D[0]=128;for(var I=1;I<D.length-8;++I)D[I]=0;I=this.o*8;for(var B=D.length-8;B<D.length;++B)D[B]=I&255,I/=256;for(this.v(D),D=Array(16),I=0,B=0;B<4;++B)for(let O=0;O<32;O+=8)D[I++]=this.g[B]>>>O&255;return D};function i(D,I){var B=c;return Object.prototype.hasOwnProperty.call(B,D)?B[D]:B[D]=I(D)}function a(D,I){this.h=I;const B=[];let O=!0;for(let F=D.length-1;F>=0;F--){const L=D[F]|0;O&&L==I||(B[F]=L,O=!1)}this.g=B}var c={};function u(D){return-128<=D&&D<128?i(D,function(I){return new a([I|0],I<0?-1:0)}):new a([D|0],D<0?-1:0)}function d(D){if(isNaN(D)||!isFinite(D))return g;if(D<0)return w(d(-D));const I=[];let B=1;for(let O=0;D>=B;O++)I[O]=D/B|0,B*=4294967296;return new a(I,0)}function f(D,I){if(D.length==0)throw Error("number format error: empty string");if(I=I||10,I<2||36<I)throw Error("radix out of range: "+I);if(D.charAt(0)=="-")return w(f(D.substring(1),I));if(D.indexOf("-")>=0)throw Error('number format error: interior "-" character');const B=d(Math.pow(I,8));let O=g;for(let L=0;L<D.length;L+=8){var F=Math.min(8,D.length-L);const M=parseInt(D.substring(L,L+F),I);F<8?(F=d(Math.pow(I,F)),O=O.j(F).add(d(M))):(O=O.j(B),O=O.add(d(M)))}return O}var g=u(0),y=u(1),x=u(16777216);t=a.prototype,t.m=function(){if(E(this))return-w(this).m();let D=0,I=1;for(let B=0;B<this.g.length;B++){const O=this.i(B);D+=(O>=0?O:4294967296+O)*I,I*=4294967296}return D},t.toString=function(D){if(D=D||10,D<2||36<D)throw Error("radix out of range: "+D);if(b(this))return"0";if(E(this))return"-"+w(this).toString(D);const I=d(Math.pow(D,6));var B=this;let O="";for(;;){const F=N(B,I).g;B=R(B,F.j(I));let L=((B.g.length>0?B.g[0]:B.h)>>>0).toString(D);if(B=F,b(B))return L+O;for(;L.length<6;)L="0"+L;O=L+O}},t.i=function(D){return D<0?0:D<this.g.length?this.g[D]:this.h};function b(D){if(D.h!=0)return!1;for(let I=0;I<D.g.length;I++)if(D.g[I]!=0)return!1;return!0}function E(D){return D.h==-1}t.l=function(D){return D=R(this,D),E(D)?-1:b(D)?0:1};function w(D){const I=D.g.length,B=[];for(let O=0;O<I;O++)B[O]=~D.g[O];return new a(B,~D.h).add(y)}t.abs=function(){return E(this)?w(this):this},t.add=function(D){const I=Math.max(this.g.length,D.g.length),B=[];let O=0;for(let F=0;F<=I;F++){let L=O+(this.i(F)&65535)+(D.i(F)&65535),M=(L>>>16)+(this.i(F)>>>16)+(D.i(F)>>>16);O=M>>>16,L&=65535,M&=65535,B[F]=M<<16|L}return new a(B,B[B.length-1]&-2147483648?-1:0)};function R(D,I){return D.add(w(I))}t.j=function(D){if(b(this)||b(D))return g;if(E(this))return E(D)?w(this).j(w(D)):w(w(this).j(D));if(E(D))return w(this.j(w(D)));if(this.l(x)<0&&D.l(x)<0)return d(this.m()*D.m());const I=this.g.length+D.g.length,B=[];for(var O=0;O<2*I;O++)B[O]=0;for(O=0;O<this.g.length;O++)for(let F=0;F<D.g.length;F++){const L=this.i(O)>>>16,M=this.i(O)&65535,se=D.i(F)>>>16,H=D.i(F)&65535;B[2*O+2*F]+=M*H,C(B,2*O+2*F),B[2*O+2*F+1]+=L*H,C(B,2*O+2*F+1),B[2*O+2*F+1]+=M*se,C(B,2*O+2*F+1),B[2*O+2*F+2]+=L*se,C(B,2*O+2*F+2)}for(D=0;D<I;D++)B[D]=B[2*D+1]<<16|B[2*D];for(D=I;D<2*I;D++)B[D]=0;return new a(B,0)};function C(D,I){for(;(D[I]&65535)!=D[I];)D[I+1]+=D[I]>>>16,D[I]&=65535,I++}function k(D,I){this.g=D,this.h=I}function N(D,I){if(b(I))throw Error("division by zero");if(b(D))return new k(g,g);if(E(D))return I=N(w(D),I),new k(w(I.g),w(I.h));if(E(I))return I=N(D,w(I)),new k(w(I.g),I.h);if(D.g.length>30){if(E(D)||E(I))throw Error("slowDivide_ only works with positive integers.");for(var B=y,O=I;O.l(D)<=0;)B=V(B),O=V(O);var F=$(B,1),L=$(O,1);for(O=$(O,2),B=$(B,2);!b(O);){var M=L.add(O);M.l(D)<=0&&(F=F.add(B),L=M),O=$(O,1),B=$(B,1)}return I=R(D,F.j(I)),new k(F,I)}for(F=g;D.l(I)>=0;){for(B=Math.max(1,Math.floor(D.m()/I.m())),O=Math.ceil(Math.log(B)/Math.LN2),O=O<=48?1:Math.pow(2,O-48),L=d(B),M=L.j(I);E(M)||M.l(D)>0;)B-=O,L=d(B),M=L.j(I);b(L)&&(L=y),F=F.add(L),D=R(D,M)}return new k(F,D)}t.B=function(D){return N(this,D).h},t.and=function(D){const I=Math.max(this.g.length,D.g.length),B=[];for(let O=0;O<I;O++)B[O]=this.i(O)&D.i(O);return new a(B,this.h&D.h)},t.or=function(D){const I=Math.max(this.g.length,D.g.length),B=[];for(let O=0;O<I;O++)B[O]=this.i(O)|D.i(O);return new a(B,this.h|D.h)},t.xor=function(D){const I=Math.max(this.g.length,D.g.length),B=[];for(let O=0;O<I;O++)B[O]=this.i(O)^D.i(O);return new a(B,this.h^D.h)};function V(D){const I=D.g.length+1,B=[];for(let O=0;O<I;O++)B[O]=D.i(O)<<1|D.i(O-1)>>>31;return new a(B,D.h)}function $(D,I){const B=I>>5;I%=32;const O=D.g.length-B,F=[];for(let L=0;L<O;L++)F[L]=I>0?D.i(L+B)>>>I|D.i(L+B+1)<<32-I:D.i(L+B);return new a(F,D.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,Hk=r,a.prototype.add=a.prototype.add,a.prototype.multiply=a.prototype.j,a.prototype.modulo=a.prototype.B,a.prototype.compare=a.prototype.l,a.prototype.toNumber=a.prototype.m,a.prototype.toString=a.prototype.toString,a.prototype.getBits=a.prototype.i,a.fromNumber=d,a.fromString=f,Oo=a}).apply(typeof Nb<"u"?Nb:typeof self<"u"?self:typeof window<"u"?window:{});var ff=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
903Copyright The Closure Library Authors.
904SPDX-License-Identifier: Apache-2.0
905*/var qk,Lu,Wk,jf,nv,Gk,Kk,Yk;(function(){var t,e=Object.defineProperty;function n(p){p=[typeof globalThis=="object"&&globalThis,p,typeof window=="object"&&window,typeof self=="object"&&self,typeof ff=="object"&&ff];for(var T=0;T<p.length;++T){var P=p[T];if(P&&P.Math==Math)return P}throw Error("Cannot find global object")}var r=n(this);function s(p,T){if(T)e:{var P=r;p=p.split(".");for(var z=0;z<p.length-1;z++){var Z=p[z];if(!(Z in P))break e;P=P[Z]}p=p[p.length-1],z=P[p],T=T(z),T!=z&&T!=null&&e(P,p,{configurable:!0,writable:!0,value:T})}}s("Symbol.dispose",function(p){return p||Symbol("Symbol.dispose")}),s("Array.prototype.values",function(p){return p||function(){return this[Symbol.iterator]()}}),s("Object.entries",function(p){return p||function(T){var P=[],z;
905for(z in T)Object.prototype.hasOwnProperty.call(T,z)&&P.push([z,T[z]]);return P}});/** @license
906
907 Copyright The Closure Library Authors.
908 SPDX-License-Identifier: Apache-2.0
909*/var i=i||{},a=this||self;function c(p){var T=typeof p;return T=="object"&&p!=null||T=="function"}function u(p,T,P){return p.call.apply(p.bind,arguments)}function d(p,T,P){return d=u,d.apply(null,arguments)}function f(p,T){var P=Array.prototype.slice.call(arguments,1);return function(){var z=P.slice();return z.push.apply(z,arguments),p.apply(this,z)}}function g(p,T){function P(){}P.prototype=T.prototype,p.Z=T.prototype,p.prototype=new P,p.prototype.constructor=p,p.Ob=function(z,Z,oe){for(var _e=Array(arguments.length-2),Ye=2;Ye<arguments.length;Ye++)_e[Ye-2]=arguments[Ye];return T.prototype[Z].apply(z,_e)}}var y=typeof AsyncContext<"u"&&typeof AsyncContext.Snapshot=="function"?p=>p&&AsyncContext.Snapshot.wrap(p):p=>p;function x(p){const T=p.length;if(T>0){const P=Array(T);for(let z=0;z<T;z++)P[z]=p[z];return P}return[]}function b(p,T){for(let z=1;z<arguments.length;z++){const Z=arguments[z];var P=typeof Z;if(P=P!="object"?P:Z?Array.isArray(Z)?"array":P:"null",P=="array"||P=="object"&&typeof Z.length=="number"){P=p.length||0;const oe=Z.length||0;p.length=P+oe;for(let _e=0;_e<oe;_e++)p[P+_e]=Z[_e]}else p.push(Z)}}class E{constructor(T,P){this.i=T,this.j=P,this.h=0,this.g=null}get(){let T;return this.h>0?(this.h--,T=this.g,this.g=T.next,T.next=null):T=this.i(),T}}function w(p){a.setTimeout(()=>{throw p},0)}function R(){var p=D;let T=null;return p.g&&(T=p.g,p.g=p.g.next,p.g||(p.h=null),T.next=null),T}class C{constructor(){this.h=this.g=null}add(T,P){const z=k.get();z.set(T,P),this.h?this.h.next=z:this.g=z,this.h=z}}var k=new E(()=>new N,p=>p.reset());class N{constructor(){this.next=this.g=this.h=null}set(T,P){this.h=T,this.g=P,this.next=null}reset(){this.next=this.g=this.h=null}}let V,$=!1,D=new C,I=()=>{const p=Promise.resolve(void 0);V=()=>{p.then(B)}};function B(){for(var p;p=R();){try{p.h.call(p.g)}catch(P){w(P)}var T=k;T.j(p),T.h<100&&(T.h++,p.next=T.g,T.g=p)}$=!1}function O(){this.u=this.u,this.C=this.C}O.prototype.u=!1,O.prototype.dispose=function(){this.u||(this.u=!0,this.N())},O.prototype[Symbol.dispose]=function(){this.dispose()},O.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function F(p,T){this.type=p,this.g=this.target=T,this.defaultPrevented=!1}F.prototype.h=function(){this.defaultPrevented=!0};var L=(function(){if(!a.addEventListener||!Object.defineProperty)return!1;var p=!1,T=Object.defineProperty({},"passive",{get:function(){p=!0}});try{const P=()=>{};a.addEventListener("test",P,T),a.removeEventListener("test",P,T)}catch{}return p})();function M(p){return/^[\s\xa0]*$/.test(p)}function se(p,T){F.call(this,p?p.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,p&&this.init(p,T)}g(se,F),se.prototype.init=function(p,T){const P=this.type=p.type,z=p.changedTouches&&p.changedTouches.length?p.changedTouches[0]:null;this.target=p.target||p.srcElement,this.g=T,T=p.relatedTarget,T||(P=="mouseover"?T=p.fromElement:P=="mouseout"&&(T=p.toElement)),this.relatedTarget=T,z?(this.clientX=z.clientX!==void 0?z.clientX:z.pageX,this.clientY=z.clientY!==void 0?z.clientY:z.pageY,this.screenX=z.screenX||0,this.screenY=z.screenY||0):(this.clientX=p.clientX!==void 0?p.clientX:p.pageX,this.clientY=p.clientY!==void 0?p.clientY:p.pageY,this.screenX=p.screenX||0,this.screenY=p.screenY||0),this.button=p.button,this.key=p.key||"",this.ctrlKey=p.ctrlKey,this.altKey=p.altKey,this.shiftKey=p.shiftKey,this.metaKey=p.metaKey,this.pointerId=p.pointerId||0,this.pointerType=p.pointerType,this.state=p.state,this.i=p,p.defaultPrevented&&se.Z.h.call(this)},se.prototype.h=function(){se.Z.h.call(this);const p=this.i;p.preventDefault?p.preventDefault():p.returnValue=!1};var H="closure_listenable_"+(Math.random()*1e6|0),J=0;function le(p,T,P,z,Z){this.listener=p,this.proxy=null,this.src=T,this.type=P,this.capture=!!z,this.ha=Z,this.key=++J,this.da=this.fa=!1}function K(p){p.da=!0,p.listener=null,p.proxy=null,p.src=null,p.ha=null}function re(p,T,P){for(const z in p)T.call(P,p[z],z,p)}function ee(p,T){for(const P in p)T.call(void 0,p[P],P,p)}function U(p){const T={};for(const P in p)T[P]=p[P];return T}const W="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
909ing toString valueOf".split(" ");function te(p,T){let P,z;for(let Z=1;Z<arguments.length;Z++){z=arguments[Z];for(P in z)p[P]=z[P];for(let oe=0;oe<W.length;oe++)P=W[oe],Object.prototype.hasOwnProperty.call(z,P)&&(p[P]=z[P])}}function Q(p){this.src=p,this.g={},this.h=0}Q.prototype.add=function(p,T,P,z,Z){const oe=p.toString();p=this.g[oe],p||(p=this.g[oe]=[],this.h++);const _e=xe(p,T,z,Z);return _e>-1?(T=p[_e],P||(T.fa=!1)):(T=new le(T,this.src,oe,!!z,Z),T.fa=P,p.push(T)),T};function pe(p,T){const P=T.type;if(P in p.g){var z=p.g[P],Z=Array.prototype.indexOf.call(z,T,void 0),oe;(oe=Z>=0)&&Array.prototype.splice.call(z,Z,1),oe&&(K(T),p.g[P].length==0&&(delete p.g[P],p.h--))}}function xe(p,T,P,z){for(let Z=0;Z<p.length;++Z){const oe=p[Z];if(!oe.da&&oe.listener==T&&oe.capture==!!P&&oe.ha==z)return Z}return-1}var Oe="closure_lm_"+(Math.random()*1e6|0),ve={};function Me(p,T,P,z,Z){if(Array.isArray(T)){for(let oe=0;oe<T.length;oe++)Me(p,T[oe],P,z,Z);return null}return P=Dr(P),p&&p[H]?p.J(T,P,c(z)?!!z.capture:!1,Z):dt(p,T,P,!1,z,Z)}function dt(p,T,P,z,Z,oe){if(!T)throw Error("Invalid event type");const _e=c(Z)?!!Z.capture:!!Z;let Ye=yr(p);if(Ye||(p[Oe]=Ye=new Q(p)),P=Ye.add(T,P,z,_e,oe),P.proxy)return P;if(z=ht(),P.proxy=z,z.src=p,z.listener=P,p.addEventListener)L||(Z=_e),Z===void 0&&(Z=!1),p.addEventListener(T.toString(),z,Z);else if(p.attachEvent)p.attachEvent($t(T.toString()),z);else if(p.addListener&&p.removeListener)p.addListener(z);else throw Error("addEventListener and attachEvent are unavailable.");return P}function ht(){function p(P){return T.call(p.src,p.listener,P)}const T=tn;return p}function Nn(p,T,P,z,Z){if(Array.isArray(T))for(var oe=0;oe<T.length;oe++)Nn(p,T[oe],P,z,Z);else z=c(z)?!!z.capture:!!z,P=Dr(P),p&&p[H]?(p=p.i,oe=String(T).toString(),oe in p.g&&(T=p.g[oe],P=xe(T,P,z,Z),P>-1&&(K(T[P]),Array.prototype.splice.call(T,P,1),T.length==0&&(delete p.g[oe],p.h--)))):p&&(p=yr(p))&&(T=p.g[T.toString()],p=-1,T&&(p=xe(T,P,z,Z)),(P=p>-1?T[p]:null)&&St(P))}function St(p){if(typeof p!="number"&&p&&!p.da){var T=p.src;if(T&&T[H])pe(T.i,p);else{var P=p.type,z=p.proxy;T.removeEventListener?T.removeEventListener(P,z,p.capture):T.detachEvent?T.detachEvent($t(P),z):T.addListener&&T.removeListener&&T.removeListener(z),(P=yr(T))?(pe(P,p),P.h==0&&(P.src=null,T[Oe]=null)):K(p)}}}function $t(p){return p in ve?ve[p]:ve[p]="on"+p}function tn(p,T){if(p.da)p=!0;else{T=new se(T,this);const P=p.listener,z=p.ha||p.src;p.fa&&St(p),p=P.call(z,T)}return p}function yr(p){return p=p[Oe],p instanceof Q?p:null}var vr="__closure_events_fn_"+(Math.random()*1e9>>>0);function Dr(p){return typeof p=="function"?p:(p[vr]||(p[vr]=function(T){return p.handleEvent(T)}),p[vr])}function kt(){O.call(this),this.i=new Q(this),this.M=this,this.G=null}g(kt,O),kt.prototype[H]=!0,kt.prototype.removeEventListener=function(p,T,P,z){Nn(this,p,T,P,z)};function vt(p,T){var P,z=p.G;if(z)for(P=[];z;z=z.G)P.push(z);if(p=p.M,z=T.type||T,typeof T=="string")T=new F(T,p);else if(T instanceof F)T.target=T.target||p;else{var Z=T;T=new F(z,p),te(T,Z)}Z=!0;let oe,_e;if(P)for(_e=P.length-1;_e>=0;_e--)oe=T.g=P[_e],Z=Nt(oe,z,!0,T)&&Z;if(oe=T.g=p,Z=Nt(oe,z,!0,T)&&Z,Z=Nt(oe,z,!1,T)&&Z,P)for(_e=0;_e<P.length;_e++)oe=T.g=P[_e],Z=Nt(oe,z,!1,T)&&Z}kt.prototype.N=function(){if(kt.Z.N.call(this),this.i){var p=this.i;for(const T in p.g){const P=p.g[T];for(let z=0;z<P.length;z++)K(P[z]);delete p.g[T],p.h--}}this.G=null},kt.prototype.J=function(p,T,P,z){return this.i.add(String(p),T,!1,P,z)},kt.prototype.K=function(p,T,P,z){return this.i.add(String(p),T,!0,P,z)};function Nt(p,T,P,z){if(T=p.i.g[String(T)],!T)return!0;T=T.concat();let Z=!0;for(let oe=0;oe<T.length;++oe){const _e=T[oe];if(_e&&!_e.da&&_e.capture==P){const Ye=_e.listener,nn=_e.ha||_e.src;_e.fa&&pe(p.i,_e),Z=Ye.call(nn,z)!==!1&&Z}}return Z&&!z.defaultPrevented}function Yt(p,T){if(typeof p!="function")if(p&&typeof p.handleEvent=="function")p=d(p.handleEvent,p);else throw Error("Invalid listener argument");return Number(T)>2147483647?-1:a.setTimeout(p,T||0)}function An(p){p.g=Yt(()=>{p.g=null,p.i&&(p.i=!1,An(p))},p.l);const T=p.h;p.h=null,p.m.apply(null,T)}class On extends O{constructor(T,P){super(),this.m=T,this.l=P,this.h=null,this.i=!1,this.g=null}j(T){this.h=arguments,this.g?this.i=!0:An(this)}N(){super.N(),this.g&&(a.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function mn(p){O.call(this),this.h=p,this.g={}}g(mn,O);var ur=[];function _r(p){re(p.g,function(T,P){this.g.hasOwnProperty(P)&&St(T)},p),p.g={}}mn.prototype.N=function(){mn.Z.N.call(this),_r(this)},mn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var es=a.JSON.stringify,hi=a.JSON.parse,Nr=class{stringify(p){return a.JSON.stringify(p,void 0)}parse(p){return a.JSON.parse(p,void 0)}};function Ln(){}function ts(){}var Or={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function ge(){F.call(this,"d")}g(ge,F);function ae(){F.call(this,"c")}g(ae,F);var Ne={},Ee=null;function ke(){return Ee=Ee||new kt}Ne.Ia="serverreachability";function Ve(p){F.call(this,Ne.Ia,p)}g(Ve,F);function We(p){const T=ke();vt(T,new Ve(T))}Ne.STAT_EVENT="statevent";function wt(p,T){F.call(this,Ne.STAT_EVENT,p),this.stat=T}g(wt,F);function Xe(p){const T=ke();vt(T,new wt(T,p))}Ne.Ja="timingevent";function It(p,T){F.call(this,Ne.Ja,p),this.size=T}g(It,F);function bt(p,T){if(typeof p!="function")throw Error("Fn must not be null and must be a function");return a.setTimeout(function(){p()},T)}function tt(){this.g=!0}tt.prototype.ua=function(){this.g=!1};function xr(p,T,P,z,Z,oe){p.info(function(){if(p.g)if(oe){var _e="",Ye=oe.split("&");for(let _t=0;_t<Ye.length;_t++){var nn=Ye[_t].split("=");if(nn.length>1){const ln=nn[0];nn=nn[1];const Ur=ln.split("_");_e=Ur.length>=2&&Ur[1]=="type"?_e+(ln+"="+nn+"&"):_e+(ln+"=redacted&")}}}else _e=null;else _e=oe;return"XMLHTTP REQ ("+z+") [attempt "+Z+"]: "+T+`
910`+P+`
911`+_e})}function Lr(p,T,P,z,Z,oe,_e){p.info(function(){return"XMLHTTP RESP ("+z+") [ attempt "+Z+"]: "+T+`
912`+P+`
913`+oe+" "+_e})}function Fn(p,T,P,z){p.info(function(){return"XMLHTTP TEXT ("+T+"): "+yn(p,P)+(z?" "+z:"")})}function gn(p,T){p.info(function(){return"TIMEOUT: "+T})}tt.prototype.info=function(){};function yn(p,T){if(!p.g)return T;if(!T)return null;try{const oe=JSON.parse(T);if(oe){for(p=0;p<oe.length;p++)if(Array.isArray(oe[p])){var P=oe[p];if(!(P.length<2)){var z=P[1];if(Array.isArray(z)&&!(z.length<1)){var Z=z[0];if(Z!="noop"&&Z!="stop"&&Z!="close")for(let _e=1;_e<z.length;_e++)z[_e]=""}}}}return es(oe)}catch{return T}}var jn={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},At={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"},Yn;function Tt(){}g(Tt,Ln),Tt.prototype.g=function(){return new XMLHttpRequest},Yn=new Tt;function gt(p){return encodeURIComponent(String(p))}function Tn(p){var T=1;p=p.split(":");const P=[];for(;T>0&&p.length;)P.push(p.shift()),T--;return p.length&&P.push(p.join(":")),P}function dr(p,T,P,z){this.j=p,this.i=T,this.l=P,this.S=z||1,this.V=new mn(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Ji}function Ji(){this.i=null,this.g="",this.h=!1}var Xi={},ms={};function Qn(p,T,P){p.M=1,p.A=mi(ns(T)),p.u=P,p.R=!0,Qt(p,null)}function Qt(p,T){p.F=Date.now(),ys(p),p.B=ns(p.A);var P=p.B,z=p.S;Array.isArray(z)||(z=[String(z)]),Kc(P.i,"t",z),p.C=0,P=p.j.L,p.h=new Ji,p.g=nh(p.j,P?T:null,!p.u),p.P>0&&(p.O=new On(d(p.Y,p,p.g),p.P)),T=p.V,P=p.g,z=p.ba;var Z="readystatechange";Array.isArray(Z)||(Z&&(ur[0]=Z.toString()),Z=ur);for(let oe=0;oe<Z.length;oe++){const _e=Me(P,Z[oe],z||T.handleEvent,!1,T.h||T);if(!_e)break;T.g[_e.key]=_e}T=p.J?U(p.J):{}
913,p.u?(p.v||(p.v="POST"),T["Content-Type"]="application/x-www-form-urlencoded",p.g.ea(p.B,p.v,p.u,T)):(p.v="GET",p.g.ea(p.B,p.v,null,T)),We(),xr(p.i,p.v,p.B,p.l,p.S,p.u)}dr.prototype.ba=function(p){p=p.target;const T=this.O;T&&Hs(p)==3?T.j():this.Y(p)},dr.prototype.Y=function(p){try{if(p==this.g)e:{const Ye=Hs(this.g),nn=this.g.ya(),_t=this.g.ca();if(!(Ye<3)&&(Ye!=3||this.g&&(this.h.h||this.g.la()||eh(this.g)))){this.K||Ye!=4||nn==7||(nn==8||_t<=0?We(3):We(2)),tl(this);var T=this.g.ca();this.X=T;var P=vn(this);if(this.o=T==200,Lr(this.i,this.v,this.B,this.l,this.S,Ye,T),this.o){if(this.U&&!this.L){t:{if(this.g){var z,Z=this.g;if((z=Z.g?Z.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!M(z)){var oe=z;break t}}oe=null}if(p=oe)Fn(this.i,this.l,p,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,Ot(this,p);else{this.o=!1,this.m=3,Xe(12),pi(this),Jo(this);break e}}if(this.R){p=!0;let ln;for(;!this.K&&this.C<P.length;)if(ln=fi(this,P),ln==ms){Ye==4&&(this.m=4,Xe(14),p=!1),Fn(this.i,this.l,null,"[Incomplete Response]");break}else if(ln==Xi){this.m=4,Xe(15),Fn(this.i,this.l,P,"[Invalid Chunk]"),p=!1;break}else Fn(this.i,this.l,ln,null),Ot(this,ln);if(gs(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),Ye!=4||P.length!=0||this.h.h||(this.m=1,Xe(16),p=!1),this.o=this.o&&p,!p)Fn(this.i,this.l,P,"[Invalid Chunked Response]"),pi(this),Jo(this);else if(P.length>0&&!this.W){this.W=!0;var _e=this.j;_e.g==this&&_e.aa&&!_e.P&&(_e.j.info("Great, no buffering proxy detected. Bytes received: "+P.length),oa(_e),_e.P=!0,Xe(11))}}else Fn(this.i,this.l,P,null),Ot(this,P);Ye==4&&pi(this),this.o&&!this.K&&(Ye==4?dl(this.j,this):(this.o=!1,ys(this)))}else Qc(this.g),T==400&&P.indexOf("Unknown SID")>0?(this.m=3,Xe(12)):(this.m=0,Xe(13)),pi(this),Jo(this)}}}catch{}finally{}};function vn(p){if(!gs(p))return p.g.la();const T=eh(p.g);if(T==="")return"";let P="";const z=T.length,Z=Hs(p.g)==4;if(!p.h.i){if(typeof TextDecoder>"u")return pi(p),Jo(p),"";p.h.i=new a.TextDecoder}for(let oe=0;oe<z;oe++)p.h.h=!0,P+=p.h.i.decode(T[oe],{stream:!(Z&&oe==z-1)});return T.length=0,p.h.g+=P,p.C=0,p.h.g}function gs(p){return p.g?p.v=="GET"&&p.M!=2&&p.j.Aa:!1}function fi(p,T){var P=p.C,z=T.indexOf(`
914`,P);return z==-1?ms:(P=Number(T.substring(P,z)),isNaN(P)?Xi:(z+=1,z+P>T.length?ms:(T=T.slice(z,z+P),p.C=z+P,T)))}dr.prototype.cancel=function(){this.K=!0,pi(this)};function ys(p){p.T=Date.now()+p.H,Bc(p,p.H)}function Bc(p,T){if(p.D!=null)throw Error("WatchDog timer not null");p.D=bt(d(p.aa,p),T)}function tl(p){p.D&&(a.clearTimeout(p.D),p.D=null)}dr.prototype.aa=function(){this.D=null;const p=Date.now();p-this.T>=0?(gn(this.i,this.B),this.M!=2&&(We(),Xe(17)),pi(this),this.m=2,Jo(this)):Bc(this,this.T-p)};function Jo(p){p.j.I==0||p.K||dl(p.j,p)}function pi(p){tl(p);var T=p.O;T&&typeof T.dispose=="function"&&T.dispose(),p.O=null,_r(p.V),p.g&&(T=p.g,p.g=null,T.abort(),T.dispose())}function Ot(p,T){try{var P=p.j;if(P.I!=0&&(P.g==p||Uc(P.h,p))){if(!p.L&&Uc(P.h,p)&&P.I==3){try{var z=P.Ba.g.parse(T)}catch{z=null}if(Array.isArray(z)&&z.length==3){var Z=z;if(Z[0]==0){e:if(!P.v){if(P.g)if(P.g.F+3e3<p.F)ul(P),Br(P);else break e;Gs(P),Xe(18)}}else P.xa=Z[1],0<P.xa-P.K&&Z[2]<37500&&P.F&&P.A==0&&!P.C&&(P.C=bt(d(P.Va,P),6e3));Xo(P.h)<=1&&P.ta&&(P.ta=void 0)}else Vr(P,11)}else if((p.L||P.g==p)&&ul(P),!M(T))for(Z=P.Ba.g.parse(T),T=0;T<Z.length;T++){let _t=Z[T];const ln=_t[0];if(!(ln<=P.K))if(P.K=ln,_t=_t[1],P.I==2)if(_t[0]=="c"){P.M=_t[1],P.ba=_t[2];const Ur=_t[3];Ur!=null&&(P.ka=Ur,P.j.info("VER="+P.ka));const xi=_t[4];xi!=null&&(P.za=xi,P.j.info("SVER="+P.za));const Ks=_t[5];Ks!=null&&typeof Ks=="number"&&Ks>0&&(z=1.5*Ks,P.O=z,P.j.info("backChannelRequestTimeoutMs_="+z)),z=P;const Ys=p.g;if(Ys){const pl=Ys.g?Ys.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(pl){var oe=z.h;oe.g||pl.indexOf("spdy")==-1&&pl.indexOf("quic")==-1&&pl.indexOf("h2")==-1||(oe.j=oe.l,oe.g=new Set,oe.h&&(rl(oe,oe.h),oe.h=null))}if(z.G){const Zc=Ys.g?Ys.g.getResponseHeader("X-HTTP-Session-Id"):null;Zc&&(z.wa=Zc,pt(z.J,z.G,Zc))}}P.I=3,P.l&&P.l.ra(),P.aa&&(P.T=Date.now()-p.F,P.j.info("Handshake RTT: "+P.T+"ms")),z=P;var _e=p;if(z.na=Xc(z,z.L?z.ba:null,z.W),_e.L){Zo(z.h,_e);var Ye=_e,nn=z.O;nn&&(Ye.H=nn),Ye.D&&(tl(Ye),ys(Ye)),z.g=_e}else Jn(z);P.i.length>0&&_i(P)}else _t[0]!="stop"&&_t[0]!="close"||Vr(P,7);else P.I==3&&(_t[0]=="stop"||_t[0]=="close"?_t[0]=="stop"?Vr(P,7):ll(P):_t[0]!="noop"&&P.l&&P.l.qa(_t),P.A=0)}}We(4)}catch{}}var c0=class{constructor(p,T){this.g=p,this.map=T}};function nl(p){this.l=p||10,a.PerformanceNavigationTiming?(p=a.performance.getEntriesByType("navigation"),p=p.length>0&&(p[0].nextHopProtocol=="hq"||p[0].nextHopProtocol=="h2")):p=!!(a.chrome&&a.chrome.loadTimes&&a.chrome.loadTimes()&&a.chrome.loadTimes().wasFetchedViaSpdy),this.j=p?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function Vc(p){return p.h?!0:p.g?p.g.size>
914=p.j:!1}function Xo(p){return p.h?1:p.g?p.g.size:0}function Uc(p,T){return p.h?p.h==T:p.g?p.g.has(T):!1}function rl(p,T){p.g?p.g.add(T):p.h=T}function Zo(p,T){p.h&&p.h==T?p.h=null:p.g&&p.g.has(T)&&p.g.delete(T)}nl.prototype.cancel=function(){if(this.i=Fr(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const p of this.g.values())p.cancel();this.g.clear()}};function Fr(p){if(p.h!=null)return p.i.concat(p.h.G);if(p.g!=null&&p.g.size!==0){let T=p.i;for(const P of p.g.values())T=T.concat(P.G);return T}return x(p.i)}var Qd=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function jr(p,T){if(p){p=p.split("&");for(let P=0;P<p.length;P++){const z=p[P].indexOf("=");let Z,oe=null;z>=0?(Z=p[P].substring(0,z),oe=p[P].substring(z+1)):Z=p[P],T(Z,oe?decodeURIComponent(oe.replace(/\+/g," ")):"")}}}function Ms(p){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let T;p instanceof Ms?(this.l=p.l,ea(this,p.j),this.o=p.o,this.g=p.g,Bs(this,p.u),this.h=p.h,Zi(this,Yc(p.i)),this.m=p.m):p&&(T=String(p).match(Qd))?(this.l=!1,ea(this,T[1]||"",!0),this.o=ta(T[2]||""),this.g=ta(T[3]||"",!0),Bs(this,T[4]),this.h=ta(T[5]||"",!0),Zi(this,T[6]||"",!0),this.m=ta(T[7]||"")):(this.l=!1,this.i=new it(null,this.l))}Ms.prototype.toString=function(){const p=[];var T=this.j;T&&p.push(na(T,zc,!0),":");var P=this.g;return(P||T=="file")&&(p.push("//"),(T=this.o)&&p.push(na(T,zc,!0),"@"),p.push(gt(P).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),P=this.u,P!=null&&p.push(":",String(P))),(P=this.h)&&(this.g&&P.charAt(0)!="/"&&p.push("/"),p.push(na(P,P.charAt(0)=="/"?ra:Hc,!0))),(P=this.i.toString())&&p.push("?",P),(P=this.m)&&p.push("#",na(P,qc)),p.join("")},Ms.prototype.resolve=function(p){const T=ns(this);let P=!!p.j;P?ea(T,p.j):P=!!p.o,P?T.o=p.o:P=!!p.g,P?T.g=p.g:P=p.u!=null;var z=p.h;if(P)Bs(T,p.u);else if(P=!!p.h){if(z.charAt(0)!="/")if(this.g&&!this.h)z="/"+z;else{var Z=T.h.lastIndexOf("/");Z!=-1&&(z=T.h.slice(0,Z+1)+z)}if(Z=z,Z==".."||Z==".")z="";else if(Z.indexOf("./")!=-1||Z.indexOf("/.")!=-1){z=Z.lastIndexOf("/",0)==0,Z=Z.split("/");const oe=[];for(let _e=0;_e<Z.length;){const Ye=Z[_e++];Ye=="."?z&&_e==Z.length&&oe.push(""):Ye==".."?((oe.length>1||oe.length==1&&oe[0]!="")&&oe.pop(),z&&_e==Z.length&&oe.push("")):(oe.push(Ye),z=!0)}z=oe.join("/")}else z=Z}return P?T.h=z:P=p.i.toString()!=="",P?Zi(T,Yc(p.i)):P=!!p.m,P&&(T.m=p.m),T};function ns(p){return new Ms(p)}function ea(p,T,P){p.j=P?ta(T,!0):T,p.j&&(p.j=p.j.replace(/:$/,""))}function Bs(p,T){if(T){if(T=Number(T),isNaN(T)||T<0)throw Error("Bad port number "+T);p.u=T}else p.u=null}function Zi(p,T,P){T instanceof it?(p.i=T,il(p.i,p.l)):(P||(T=na(T,u0)),p.i=new it(T,p.l))}function pt(p,T,P){p.i.set(T,P)}function mi(p){return pt(p,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),p}function ta(p,T){return p?T?decodeURI(p.replace(/%25/g,"%2525")):decodeURIComponent(p):""}function na(p,T,P){return typeof p=="string"?(p=encodeURI(p).replace(T,$c),P&&(p=p.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),p):null}function $c(p){return p=p.charCodeAt(0),"%"+(p>>4&15).toString(16)+(p&15).toString(16)}var zc=/[#\/\?@]/g,Hc=/[#\?:]/g,ra=/[#\?]/g,u0=/[#\?@]/g,qc=/#/g;function it(p,T){this.h=this.g=null,this.i=p||null,this.j=!!T}function Vs(p){p.g||(p.g=new Map,p.h=0,p.i&&jr(p.i,function(T,P){p.add(decodeURIComponent(T.replace(/\+/g," ")),P)}))}t=it.prototype,t.add=function(p,T){Vs(this),this.i=null,p=Us(this,p);let P=this.g.get(p);return P||this.g.set(p,P=[]),P.push(T),this.h+=1,this};function Wc(p,T){Vs(p),T=Us(p,T),p.g.has(T)&&(p.i=null,p.h-=p.g.get(T).length,p.g.delete(T))}function sl(p,T){return Vs(p),T=Us(p,T),p.g.has(T)}t.forEach=function(p,T){Vs(this),this.g.forEach(function(P,z){P.forEach(function(Z){p.call(T,Z,z,this)},this)},this)};function Gc(p,T){Vs(p);let P=[];if(typeof T=="string")sl(p,T)&&(P=P.concat(p.g.get(Us(p,T))));else for(p=Array.from(p.g.values()),T=0;T<p.length;T++)P=P.concat(p[T]);return P}t.set=function(p,T){return Vs(this),this.i=null,p=Us(this,p),sl(this,p)&&(this.h-=this.g.get(p).length),this.g.set(p,[T]),this.h+=1,this},t.get=function(p,T){return p?(p=Gc(this,p),p.length>0?String(p[0]):T):T};function Kc(p,T,P){Wc(p,T),P.length>0&&(p.i=null,p.g.set(Us(p,T),x(P)),p.h+=P.length)}t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const p=[],T=Array.from(this.g.keys());for(let z=0;z<T.length;z++){var P=T[z];const Z=gt(P);P=Gc(this,P);for(let oe=0;oe<P.length;oe++){let _e=Z;P[oe]!==""&&(_e+="="+gt(P[oe])),p.push(_e)}}return this.i=p.join("&")};function Yc(p){const T=new it;return T.i=p.i,p.g&&(T.g=new Map(p.g),T.h=p.h),T}function Us(p,T){return T=String(T),p.j&&(T=T.toLowerCase()),T}function il(p,T){T&&!p.j&&(Vs(p),p.i=null,p.g.forEach(function(P,z){const Z=z.toLowerCase();z!=Z&&(Wc(this,z),Kc(this,Z,P))},p)),p.j=T}function $s(p,T){const P=new tt;if(a.Image){const z=new Image;z.onload=f(Mn,P,"TestLoadImage: loaded",!0,T,z),z.onerror=f(Mn,P,"TestLoadImage: error",!1,T,z),z.onabort=f(Mn,P,"TestLoadImage: abort",!1,T,z),z.ontimeout=f(Mn,P,"TestLoadImage: timeout",!1,T,z),a.setTimeout(function(){z.ontimeout&&z.ontimeout()},1e4),z.src=p}else T(!1)}function zs(p,T){const P=new tt,z=new AbortController,Z=setTimeout(()=>{z.abort(),Mn(P,"TestPingServer: timeout",!1,T)},1e4);
vendor: 16,349 bytes, lines 914-917
914fetch(p,{signal:z.signal}).then(oe=>{clearTimeout(Z),oe.ok?Mn(P,"TestPingServer: ok",!0,T):Mn(P,"TestPingServer: server error",!1,T)}).catch(()=>{clearTimeout(Z),Mn(P,"TestPingServer: error",!1,T)})}function Mn(p,T,P,z,Z){try{Z&&(Z.onload=null,Z.onerror=null,Z.onabort=null,Z.ontimeout=null),z(P)}catch{}}function sa(){this.g=new Nr}function gi(p){this.i=p.Sb||null,this.h=p.ab||!1}g(gi,Ln),gi.prototype.g=function(){return new Mr(this.i,this.h)};function Mr(p,T){kt.call(this),this.H=p,this.o=T,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}g(Mr,kt),t=Mr.prototype,t.open=function(p,T){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=p,this.D=T,this.readyState=1,vs(this)},t.send=function(p){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const T={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};p&&(T.body=p),(this.H||a).fetch(new Request(this.D,T)).then(this.Pa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,eo(this)),this.readyState=0},t.Pa=function(p){if(this.g&&(this.l=p,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=p.headers,this.readyState=2,vs(this)),this.g&&(this.readyState=3,vs(this),this.g)))if(this.responseType==="arraybuffer")p.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof a.ReadableStream<"u"&&"body"in p){if(this.j=p.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;Jd(this)}else p.text().then(this.Oa.bind(this),this.ga.bind(this))};function Jd(p){p.j.read().then(p.Ma.bind(p)).catch(p.ga.bind(p))}t.Ma=function(p){if(this.g){if(this.o&&p.value)this.response.push(p.value);else if(!this.o){var T=p.value?p.value:new Uint8Array(0);(T=this.B.decode(T,{stream:!p.done}))&&(this.response=this.responseText+=T)}p.done?eo(this):vs(this),this.readyState==3&&Jd(this)}},t.Oa=function(p){this.g&&(this.response=this.responseText=p,eo(this))},t.Na=function(p){this.g&&(this.response=p,eo(this))},t.ga=function(){this.g&&eo(this)};function eo(p){p.readyState=4,p.l=null,p.j=null,p.B=null,vs(p)}t.setRequestHeader=function(p,T){this.A.append(p,T)},t.getResponseHeader=function(p){return this.h&&this.h.get(p.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const p=[],T=this.h.entries();for(var P=T.next();!P.done;)P=P.value,p.push(P[0]+": "+P[1]),P=T.next();return p.join(`\r
915`)};function vs(p){p.onreadystatechange&&p.onreadystatechange.call(p)}Object.defineProperty(Mr.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(p){this.m=p?"include":"same-origin"}});function Xd(p){let T="";return re(p,function(P,z){T+=z,T+=":",T+=P,T+=`\r
916`}),T}function ol(p,T,P){e:{for(z in P){var z=!1;break e}z=!0}z||(P=Xd(P),typeof p=="string"?P!=null&&gt(P):pt(p,T,P))}function Ct(p){kt.call(this),this.headers=new Map,this.L=p||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}g(Ct,kt);var Zd=/^https?$/i,d0=["POST","PUT"];t=Ct.prototype,t.Fa=function(p){this.H=p},t.ea=function(p,T,P,z){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+p);T=T?T.toUpperCase():"GET",this.D=p,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Yn.g(),this.g.onreadystatechange=y(d(this.Ca,this));try{this.B=!0,this.g.open(T,String(p),!0),this.B=!1}catch(oe){to(this,oe);return}if(p=P||"",P=new Map(this.headers),z)if(Object.getPrototypeOf(z)===Object.prototype)for(var Z in z)P.set(Z,z[Z]);else if(typeof z.keys=="function"&&typeof z.get=="function")for(const oe of z.keys())P.set(oe,z.get(oe));else throw Error("Unknown input type for opt_headers: "+String(z));z=Array.from(P.keys()).find(oe=>oe.toLowerCase()=="content-type"),Z=a.FormData&&p instanceof a.FormData,!(Array.prototype.indexOf.call(d0,T,void 0)>=0)||z||Z||P.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[oe,_e]of P)this.g.setRequestHeader(oe,_e);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(p),this.v=!1}catch(oe){to(this,oe)}};function to(p,T){p.h=!1,p.g&&(p.j=!0,p.g.abort(),p.j=!1),p.l=T,p.o=5,no(p),vi(p)}function no(p){p.A||(p.A=!0,vt(p,"complete"),vt(p,"error"))}t.abort=function(p){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=p||7,vt(this,"complete"),vt(this,"abort"),vi(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),vi(this,!0)),Ct.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?yi(this):this.Xa())},t.Xa=function(){yi(this)};function yi(p){if(p.h&&typeof i<"u"){if(p.v&&Hs(p)==4)setTimeout(p.Ca.bind(p),0);else if(vt(p,"readystatechange"),Hs(p)==4){p.h=!1;try{const oe=p.ca();e:switch(oe){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var T=!0;break e;default:T=!1}var P;if(!(P=T)){var z;if(z=oe===0){let _e=String(p.D).match(Qd)[1]||null;!_e&&a.self&&a.self.location&&(_e=a.self.location.protocol.slice(0,-1)),z=!Zd.test(_e?_e.toLowerCase():"")}P=z}if(P)vt(p,"complete"),vt(p,"success");else{p.o=6;try{var Z=Hs(p)>2?p.g.statusText:""}catch{Z=""}p.l=Z+" ["+p.ca()+"]",no(p)}}finally{vi(p)}}}}function vi(p,T){if(p.g){p.m&&(clearTimeout(p.m),p.m=null);const P=p.g;p.g=null,T||vt(p,"ready");try{P.onreadystatechange=null}catch{}}}t.isActive=function(){return!!this.g};function Hs(p){return p.g?p.g.readyState:0}t.ca=function(){try{return Hs(this)>2?this.g.status:-1}catch{return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.La=function(p){if(this.g){var T=this.g.responseText;return p&&T.indexOf(p)==0&&(T=T.substring(p.length)),hi(T)}};function eh(p){try{if(!p.g)return null;if("response"in p.g)return p.g.response;switch(p.F){case"":case"text":return p.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in p.g)return p.g.mozResponseArrayBuffer}return null}catch{return null}}function Qc(p){const T={};p=(p.g&&Hs(p)>=2&&p.g.getAllResponseHeaders()||"").split(`\r
917`);for(let z=0;z<p.length;z++){if(M(p[z]))continue;var P=Tn(p[z]);const Z=P[0];if(P=P[1],typeof P!="string")continue;P=P.trim();const oe=T[Z]||[];T[Z]=oe,oe.push(P)}ee(T,function(z){return z.join(", ")})}t.ya=function(){return this.o},t.Ha=function(){return typeof this.l=="string"?this.l:String(this.l)};function qs(p,T,P){return P&&P.internalChannelParams&&P.internalChannelParams[p]||T}function al(p){this.za=0,this.i=[],this.j=new tt,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=qs("failFast",!1,p),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=qs("baseRetryDelayMs",5e3,p),this.Za=qs("retryDelaySeedMs",1e4,p),this.Ta=qs("forwardChannelMaxRetries",2,p),this.va=qs("forwardChannelRequestTimeoutMs",2e4,p),this.ma=p&&p.xmlHttpFactory||void 0,this.Ua=p&&p.Rb||void 0,this.Aa=p&&p.useFetchStreams||!1,this.O=void 0,this.L=p&&p.supportsCrossDomainXhr||!1,this.M="",this.h=new nl(p&&p.concurrentRequestLimit),this.Ba=new sa,this.S=p&&p.fastHandshake||!1,this.R=p&&p.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=p&&p.Pb||!1,p&&p.ua&&this.j.ua(),p&&p.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&p&&p.detectBufferingProxy||!1,this.ia=void 0,p&&p.longPollingTimeout&&p.longPollingTimeout>0&&(this.ia=p.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}t=al.prototype,t.ka=8,t.I=1,t.connect=function(p,T,P,z){Xe(0),this.W=p,this.H=T||{},P&&z!==void 0&&(this.H.OSID=P,this.H.OAID=z),this.F=this.X,this.J=Xc(this,null,this.W),_i(this)};function ll(p){if(cl(p),p.I==3){var T=p.V++,P=ns(p.J);if(pt(P,"SID",p.M),pt(P,"RID",T),pt(P,"TYPE","terminate"),Ws(p,P),T=new dr(p,p.j,T),T.M=2,T.A=mi(ns(P)),P=!1,a.navigator&&a.navigator.sendBeacon)try{P=a.navigator.sendBeacon(T.A.toString(),"")}catch{}!P&&a.Image&&(new Image().src=T.A,P=!0),P||(T.g=nh(T.j,null),T.g.ea(T.A)),T.F=Date.now(),ys(T)}aa(p)}function Br(p){p.g&&(oa(p),p.g.cancel(),p.g=null)}function cl(p){Br(p),p.v&&(a.clearTimeout(p.v),p.v=null),ul(p),p.h.cancel(),p.m&&(typeof p.m=="number"&&a.clearTimeout(p.m),p.m=null)}function _i(p){if(!Vc(p.h)&&!p.m){p.m=!0;var T=p.Ea;V||I(),$||(V(),$=!0),D.add(T,p),p.D=0}}function th(p,T){return Xo(p.h)>=p.h.j-(p.m?1:0)?!1:p.m?(p.i=T.G.concat(p.i),!0):p.I==1||p.I==2||p.D>=(p.Sa?0:p.Ta)?!1:(p.m=bt(d(p.Ea,p,T),hl(p,p.D)),p.D++,!0)}t.Ea=function(p){if(this.m)if(this.m=null,this.I==1){if(!p){this.V=Math.floor(Math.random()*1e5),p=this.V++;const Z=new dr(this,this.j,p);let oe=this.o;if(this.U&&(oe?(oe=U(oe),te(oe,this.U)):oe=this.U),this.u!==null||this.R||(Z.J=oe,oe=null),this.S)e:{for(var T=0,P=0;P<this.i.length;P++){t:{var z=this.i[P];if("__data__"in z.map&&(z=z.map.__data__,typeof z=="string")){z=z.length;break t}z=void 0}if(z===void 0)break;if(T+=z,T>4096){T=P;break e}if(T===4096||P===this.i.length-1){T=P+1;break e}}T=1e3}else T=1e3;T=Jc(this,Z,T),P=ns(this.J),pt(P,"RID",p),pt(P,"CVER",22),this.G&&pt(P,"X-HTTP-Session-Id",this.G),Ws(this,P),oe&&(this.R?T="headers="+gt(Xd(oe))+"&"+T:this.u&&ol(P,this.u,oe)),rl(this.h,Z),this.Ra&&pt(P,"TYPE","init"),this.S?(pt(P,"$req",T),pt(P,"SID","null"),Z.U=!0,Qn(Z,P,null)):Qn(Z,P,T),this.I=2}}else this.I==3&&(p?ia(this,p):this.i.length==0||Vc(this.h)||ia(this))};function ia(p,T){var P;T?P=T.l:P=p.V++;const z=ns(p.J);pt(z,"SID",p.M),pt(z,"RID",P),pt(z,"AID",p.K),Ws(p,z),p.u&&p.o&&ol(z,p.u,p.o),P=new dr(p,p.j,P,p.D+1),p.u===null&&(P.J=p.o),T&&(p.i=T.G.concat(p.i)),T=Jc(p,P,1e3),P.H=Math.round(p.va*.5)+Math.round(p.va*.5*Math.random()),rl(p.h,P),Qn(P,z,T)}function Ws(p,T){p.H&&re(p.H,function(P,z){pt(T,z,P)}),p.l&&re({},function(P,z){pt(T,z,P)})}function Jc(p,T,P){P=Math.min(p.i.length,P);const z=p.l?d(p.l.Ka,p.l,p):null;e:{var Z=p.i;let Ye=-1;for(;;){const nn=["count="+P];Ye==-1?P>0?(Ye=Z[0].g,nn.push("ofs="+Ye)):Ye=0:nn.push("ofs="+Ye);let _t=!0;for(let ln=0;ln<P;ln++){var oe=Z[ln].g;const Ur=Z[ln].map;if(oe-=Ye,oe<0)Ye=Math.max(0,Z[ln].g-100),_t=!1;else try{oe="req"+oe+"_"||"";try{var _e=Ur instanceof Map?Ur:Object.entries(Ur);for(const[xi,Ks]of _e){let Ys=Ks;c(Ks)&&(Ys=es(Ks)),nn.push(oe+xi+"="+encodeURIComponent(Ys))}}catch(xi){throw nn.push(oe+"type="+encodeURIComponent("_badmap")),xi}}catch{z&&z(Ur)}}if(_t){_e=nn.join("&");break e}}_e=void 0}return p=p.i.splice(0,P),T.G=p,_e}function Jn(p){if(!p.g&&!p.v){p.Y=1;var T=p.Da;V||I(),$||(V(),$=!0),D.add(T,p),p.A=0}}function Gs(p){return p.g||p.v||p.A>=3?!1:(p.Y++,p.v=bt(d(p.Da,p),hl(p,p.A)),p.A++,!0)}t.Da=function(){if(this.v=null,ro(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var p=4*this.T;this.j.info("BP detection timer enabled: "+p),this.B=bt(d(this.Wa,this),p)}},t.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,Xe(10),Br(this),ro(this))};function oa(p){p.B!=null&&(a.clearTimeout(p.B),p.B=null)}function ro(p){p.g=new dr(p,p.j,"rpc",p.Y),p.u===null&&(p.g.J=p.o),p.g.P=0;var T=ns(p.na);pt(T,"RID","rpc"),pt(T,"SID",p.M),pt(T,"AID",p.K),pt(T,"CI",p.F?"0":"1"),!p.F&&p.ia&&pt(T,"TO",p.ia),pt(T,"TYPE","xmlhttp"),Ws(p,T),p.u&&p.o&&ol(T,p.u,p.o),p.O&&(p.g.H=p.O);var P=p.g;p=p.ba,P.M=1,P.A=mi(ns(T)),P.u=null,P.R=!0,Qt(P,p)}t.Va=function(){this.C!=null&&(this.C=null,Br(this),Gs(this),Xe(19))};function ul(p){p.C!=null&&(a.clearTimeout(p.C),p.C=null)}function dl(p,T){var P=null;if(p.g==T){ul(p),oa(p),p.g=null;var z=2}else if(Uc(p.h,T))P=T.G,Zo(p.h,T),z=1;else return;if(p.I!=0){if(T.o)if(z==1){P=T.u?T.u.length:0,T=Date.now()-T.F;var Z=p.D;z=ke(),vt(z,new It(z,P)),_i(p)}else Jn(p);else if(Z=T.m,Z==3||Z==0&&T.X>0||!(z==1&&th(p,T)||z==2&&Gs(p)))switch(P&&P.length>0&&(T=p.h,T.i=T.i.concat(P)),Z){case 1:Vr(p,5);break;case 4:Vr(p,10);break;case 3:Vr(p,6);break;default:Vr(p,2)}}}function hl(p,T){let P=p.Qa+Math.floor(Math.random()*p.Za);return p.isActive()||(P*=2),P*T}function Vr(p,T){if(p.j.info("Error code "+T),T==2){var P=d(p.bb,p),z=p.Ua;const Z=!z;z=new Ms(z||"//www.google.com/images/cleardot.gif"),a.location&&a.location.protocol=="http"||ea(z,"https"),mi(z),Z?$s(z.toString(),P):zs(z.toString(),P)}else Xe(2);p.I=0,p.l&&p.l.pa(T),aa(p),cl(p)}t.bb=function(p){p?(this.j.info("Successfully pinged google.com"),Xe(2)):(this.j.info("Failed to ping google.com"),Xe(1))};function aa(p){if(p.I=0,p.ja=[],p.l){const T=Fr(p.h);(T.length!=0||p.i.length!=0)&&(b(p.ja,T),b(p.ja,p.i),p.h.i.length=0,x(p.i),p.i.length=0),p.l.oa()}}function Xc(p,T,P){var z=P instanceof Ms?ns(P):new Ms(P);if(z.g!="")T&&(z.g=T+"."+z.g),Bs(z,z.u);else{var Z=a.location;z=Z.protocol,T=T?T+"."+Z.hostname:Z.hostname,Z=+Z.port;const oe=new Ms(null);z&&ea(oe,z),T&&(oe.g=T),Z&&Bs(oe,Z),P&&(oe.h=P),z=oe}return P=p.G,T=p.wa,P&&T&&pt(z,P,T),pt(z,"VER",p.ka),Ws(p,z),z}function nh(p,T,P){if(T&&!p.L)throw Error("Can't create secondary domain capable XhrIo object.");return T=p.Aa&&!p.ma?new Ct(new gi({ab:P})):new Ct(p.ma),T.Fa(p.L),T}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function rh(){}t=rh.prototype,t.ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){};function fl(){}fl.prototype.g=function(p,T){return new Bn(p,T)};function Bn(p,T){kt.call(this),this.g=new al(T),this.l=p,this.h=T&&T.messageUrlParams||null,p=T&&T.messageHeaders||null,T&&T.clientProtocolHeaderRequired&&(p?p["X-Client-Protocol"]="webchannel":p={"X-Client-Protocol":"webchannel"}),this.g.o=p,p=T&&T.initMessageHeaders||null,T&&T.messageContentType&&(p?p["X-WebChannel-Content-Type"]=T.messageContentType:p={"X-WebChannel-Content-Type":T.messageContentType}),T&&T.sa&&(p?p["X-WebChannel-Client-Profile"]=T.sa:p={"X-WebChannel-Client-Profile":T.sa}),this.g.U=p,(p=T&&T.Qb)&&!M(p)&&(this.g.u=p),this.A=T&&T.supportsCrossDomainXhr||!1,this.v=T&&T.sendRawJson||!1,(T=T&&T.httpSessionIdParam)&&!M(T)&&(this.g.G=T,p=this.h,p!==null&&T in p&&(p=this.h,T in p&&delete p[T])),this.j=new so(this)}g(Bn,kt),Bn.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},Bn.prototype.close=function(){ll(this.g)},Bn.prototype.o=function(p){var T=this.g;if(typeof p=="string"){var P={};P.__data__=p,p=P}else this.v&&(P={},P.__data__=es(p),p=P);T.i.push(new c0(T.Ya++,p)),T.I==3&&_i(T)},Bn.prototype.N=function(){this.g.l=null,delete this.j,ll(this.g),delete this.g,Bn.Z.N.call(this)};function sh(p){ge.call(this),p.__headers__&&(this.headers=p.__headers__,this.statusCode=p.__status__,delete p.__headers__,delete p.__status__);var T=p.__sm__;if(T){e:{for(const P in T){p=P;break e}p=void 0}(this.i=p)&&(p=this.i,T=T!==null&&p in T?T[p]:void 0),this.data=T}else this.data=p}g(sh,ge);function ih(){ae.call(this),this.status=1}g(ih,ae);function so(p){this.g=p}g(so,rh),so.prototype.ra=function(){vt(this.g,"a")},so.prototype.qa=function(p){vt(this.g,new sh(p))},so.prototype.pa=function(p){vt(this.g,new ih)},so.prototype.oa=function(){vt(this.g,"b")},fl.prototype.createWebChannel=fl.prototype.g,Bn.prototype.send=Bn.prototype.o,Bn.prototype.open=Bn.prototype.m,Bn.prototype.close=Bn.prototype.close,Yk=function(){return new fl},Kk=function(){return ke()},Gk=Ne,nv={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},jn.NO_ERROR=0,jn.TIMEOUT=8,jn.HTTP_ERROR=6,jf=jn,At.COMPLETE="complete",Wk=At,ts.EventType=Or,Or.OPEN="a",Or.CLOSE="b",Or.ERROR="c",Or.MESSAGE="d",kt.prototype.listen=kt.prototype.J,Lu=ts,Ct.prototype.listenOnce=Ct.prototype.K,Ct.prototype.getLastError=Ct.prototype.Ha,Ct.prototype.getLastErrorCode=Ct.prototype.ya,
917Ct.prototype.getStatus=Ct.prototype.ca,Ct.prototype.getResponseJson=Ct.prototype.La,Ct.prototype.getResponseText=Ct.prototype.la,Ct.prototype.send=Ct.prototype.ea,Ct.prototype.setWithCredentials=Ct.prototype.Fa,qk=Ct}).apply(typeof ff<"u"?ff:typeof self<"u"?self:typeof window<"u"?window:{});/**
918 * @license
919 * Copyright 2017 Google LLC
920 *
921 * Licensed under the Apache License, Version 2.0 (the "License");
922 * you may not use this file except in compliance with the License.
923 * You may obtain a copy of the License at
924 *
925 *   http://www.apache.org/licenses/LICENSE-2.0
926 *
927 * Unless required by applicable law or agreed to in writing, software
928 * distributed under the License is distributed on an "AS IS" BASIS,
929 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
930 * See the License for the specific language governing permissions and
931 * limitations under the License.
932 */class ir{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}ir.UNAUTHENTICATED=new ir(null),ir.GOOGLE_CREDENTIALS=new ir("google-credentials-uid"),ir.FIRST_PARTY=new ir("first-party-uid"),ir.MOCK_USER=new ir("mock-user");/**
933 * @license
934 * Copyright 2017 Google LLC
935 *
936 * Licensed under the Apache License, Version 2.0 (the "License");
937 * you may not use this file except in compliance with the License.
938 * You may obtain a copy of the License at
939 *
940 *   http://www.apache.org/licenses/LICENSE-2.0
941 *
942 * Unless required by applicable law or agreed to in writing, software
943 * distributed under the License is distributed on an "AS IS" BASIS,
944 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
945 * See the License for the specific language governing permissions and
946 * limitations under the License.
947 */let Ic="12.9.0";function Z5(t){Ic=t}/**
948 * @license
949 * Copyright 2020 Google LLC
950 *
951 * Licensed under the Apache License, Version 2.0 (the "License");
952 * you may not use this file except in compliance with the License.
953 * You may obtain a copy of the License at
954 *
955 *   http://www.apache.org/licenses/LICENSE-2.0
956 *
957 * Unless required by applicable law or agreed to in writing, software
958 * distributed under the License is distributed on an "AS IS" BASIS,
959 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
960 * See the License for the specific language governing permissions and
961 * limitations under the License.
962 *//**
963 * @license
964 * Copyright 2017 Google LLC
965 *
966 * Licensed under the Apache License, Version 2.0 (the "License");
967 * you may not use this file except in compliance with the License.
968 * You may obtain a copy of the License at
969 *
970 *   http://www.apache.org/licenses/LICENSE-2.0
971 *
972 * Unless required by applicable law or agreed to in writing, software
973 * distributed under the License is distributed on an "AS IS" BASIS,
974 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
975 * See the License for the specific language governing permissions and
976 * limitations under the License.
977 */const Va=new p_("@firebase/firestore");function zl(){return Va.logLevel}function Te(t,...e){if(Va.logLevel<=nt.DEBUG){const n=e.map(A_);Va.debug(`Firestore (${Ic}): ${t}`,...n)}}function Hi(t,...e){if(Va.logLevel<=nt.ERROR){const n=e.map(A_);Va.error(`Firestore (${Ic}): ${t}`,...n)}}function Ua(t,...e){if(Va.logLevel<=nt.WARN){const n=e.map(A_);Va.warn(`Firestore (${Ic}): ${t}`,...n)}}function A_(t){if(typeof t=="string")return t;try{return(function(n){return JSON.stringify(n)})(t)}catch{return t}}/**
978 * @license
979 * Copyright 2017 Google LLC
980 *
981 * Licensed under the Apache License, Version 2.0 (the "License");
982 * you may not use this file except in compliance with the License.
983 * You may obtain a copy of the License at
984 *
985 *   http://www.apache.org/licenses/LICENSE-2.0
986 *
987 * Unless required by applicable law or agreed to in writing, software
988 * distributed under the License is distributed on an "AS IS" BASIS,
989 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
990 * See the License for the specific language governing permissions and
991 * limitations under the License.
992 */function ze(t,e,n){let r="Unexpected state";
vendor: 12,249 bytes, lines 992-1082
992typeof e=="string"?r=e:n=e,Qk(t,r,n)}function Qk(t,e,n){let r=`FIRESTORE (${Ic}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(n!==void 0)try{r+=" CONTEXT: "+JSON.stringify(n)}catch{r+=" CONTEXT: "+n}throw Hi(r),new Error(r)}function yt(t,e,n,r){let s="Unexpected state";typeof n=="string"?s=n:r=n,t||Qk(e,s,r)}function Qe(t,e){return t}/**
993 * @license
994 * Copyright 2017 Google LLC
995 *
996 * Licensed under the Apache License, Version 2.0 (the "License");
997 * you may not use this file except in compliance with the License.
998 * You may obtain a copy of the License at
999 *
1000 *   http://www.apache.org/licenses/LICENSE-2.0
1001 *
1002 * Unless required by applicable law or agreed to in writing, software
1003 * distributed under the License is distributed on an "AS IS" BASIS,
1004 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1005 * See the License for the specific language governing permissions and
1006 * limitations under the License.
1007 */const ce={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class be extends Ls{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
1008 * @license
1009 * Copyright 2017 Google LLC
1010 *
1011 * Licensed under the Apache License, Version 2.0 (the "License");
1012 * you may not use this file except in compliance with the License.
1013 * You may obtain a copy of the License at
1014 *
1015 *   http://www.apache.org/licenses/LICENSE-2.0
1016 *
1017 * Unless required by applicable law or agreed to in writing, software
1018 * distributed under the License is distributed on an "AS IS" BASIS,
1019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1020 * See the License for the specific language governing permissions and
1021 * limitations under the License.
1022 */class Lo{constructor(){this.promise=new Promise(((e,n)=>{this.resolve=e,this.reject=n}))}}/**
1023 * @license
1024 * Copyright 2017 Google LLC
1025 *
1026 * Licensed under the Apache License, Version 2.0 (the "License");
1027 * you may not use this file except in compliance with the License.
1028 * You may obtain a copy of the License at
1029 *
1030 *   http://www.apache.org/licenses/LICENSE-2.0
1031 *
1032 * Unless required by applicable law or agreed to in writing, software
1033 * distributed under the License is distributed on an "AS IS" BASIS,
1034 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1035 * See the License for the specific language governing permissions and
1036 * limitations under the License.
1037 */class Jk{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class ej{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable((()=>n(ir.UNAUTHENTICATED)))}shutdown(){}}class tj{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,n){this.changeListener=n,e.enqueueRetryable((()=>n(this.token.user)))}shutdown(){this.changeListener=null}}class nj{constructor(e){this.t=e,this.currentUser=ir.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){yt(this.o===void 0,42304);let r=this.i;const s=u=>this.i!==r?(r=this.i,n(u)):Promise.resolve();let i=new Lo;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Lo,e.enqueueRetryable((()=>s(this.currentUser)))};const a=()=>{const u=i;e.enqueueRetryable((async()=>{await u.promise,await s(this.currentUser)}))},c=u=>{Te("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=u,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit((u=>c(u))),setTimeout((()=>{if(!this.auth){const u=this.t.getImmediate({optional:!0});u?c(u):(Te("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Lo)}}),0),a()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then((r=>this.i!==e?(Te("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(yt(typeof r.accessToken=="string",31837,{l:r}),new Jk(r.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return yt(e===null||typeof e=="string",2055,{h:e}),new ir(e)}}class rj{constructor(e,n,r){this.P=e,this.T=n,this.I=r,this.type="FirstParty",this.user=ir.FIRST_PARTY,this.R=new Map}A(){return this.I?this.I():null}get headers(){this.R.set("X-Goog-AuthUser",this.P);const e=this.A();return e&&this.R.set("Authorization",e),this.T&&this.R.set("X-Goog-Iam-Authorization-Token",this.T),this.R}}class sj{constructor(e,n,r){this.P=e,this.T=n,this.I=r}getToken(){return Promise.resolve(new rj(this.P,this.T,this.I))}start(e,n){e.enqueueRetryable((()=>n(ir.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Ob{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class ij{constructor(e,n){this.V=n,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Ir(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,n){yt(this.o===void 0,3512);const r=i=>{i.error!=null&&Te("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const a=i.token!==this.m;return this.m=i.token,Te("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?n(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable((()=>r(i)))};const s=i=>{Te("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((i=>s(i))),setTimeout((()=>{if(!this.appCheck){const i=this.V.getImmediate({optional:!0});i?s(i):Te("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){if(this.p)return Promise.resolve(new Ob(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((n=>n?(yt(typeof n.token=="string",44558,{tokenResult:n}),this.m=n.token,new Ob(n.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
1038 * @license
1039 * Copyright 2020 Google LLC
1040 *
1041 * Licensed under the Apache License, Version 2.0 (the "License");
1042 * you may not use this file except in compliance with the License.
1043 * You may obtain a copy of the License at
1044 *
1045 *   http://www.apache.org/licenses/LICENSE-2.0
1046 *
1047 * Unless required by applicable law or agreed to in writing, software
1048 * distributed under the License is distributed on an "AS IS" BASIS,
1049 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1050 * See the License for the specific language governing permissions and
1051 * limitations under the License.
1052 */function oj(t){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let r=0;r<t;r++)n[r]=Math.floor(256*Math.random());return n}/**
1053 * @license
1054 * Copyright 2017 Google LLC
1055 *
1056 * Licensed under the Apache License, Version 2.0 (the "License");
1057 * you may not use this file except in compliance with the License.
1058 * You may obtain a copy of the License at
1059 *
1060 *   http://www.apache.org/licenses/LICENSE-2.0
1061 *
1062 * Unless required by applicable law or agreed to in writing, software
1063 * distributed under the License is distributed on an "AS IS" BASIS,
1064 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1065 * See the License for the specific language governing permissions and
1066 * limitations under the License.
1067 */class T_{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=62*Math.floor(4.129032258064516);let r="";for(;r.length<20;){const s=oj(40);for(let i=0;i<s.length;++i)r.length<20&&s[i]<n&&(r+=e.charAt(s[i]%62))}return r}}function rt(t,e){return t<e?-1:t>e?1:0}function rv(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const s=t.charAt(r),i=e.charAt(r);if(s!==i)return Xg(s)===Xg(i)?rt(s,i):Xg(s)?1:-1}return rt(t.length,e.length)}const aj=55296,lj=57343;function Xg(t){const e=t.charCodeAt(0);return e>=aj&&e<=lj}function dc(t,e,n){return t.length===e.length&&t.every(((r,s)=>n(r,e[s])))}/**
1068 * @license
1069 * Copyright 2017 Google LLC
1070 *
1071 * Licensed under the Apache License, Version 2.0 (the "License");
1072 * you may not use this file except in compliance with the License.
1073 * You may obtain a copy of the License at
1074 *
1075 *   http://www.apache.org/licenses/LICENSE-2.0
1076 *
1077 * Unless required by applicable law or agreed to in writing, software
1078 * distributed under the License is distributed on an "AS IS" BASIS,
1079 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1080 * See the License for the specific language governing permissions and
1081 * limitations under the License.
1082 */const Lb="__name__";class ei{constructor(e,n,r){n===void 0?n=0:n>e.length&&ze(637,{offset:n,range:e.length}),r===void 0?r=e.length-n:r>e.length-n&&ze(1746,{length:r,range:e.length-n}),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return ei.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof ei?e.forEach((r=>{n.push(r)})):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==e.get(n))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==e.get(n))return!1;return!0}forEach(e){for(let n=this.offset,r=this.limit();n<r;n++)e(this.segments[n])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,n){const r=Math.min(e.length,n.length);for(let s=0;s<r;s++){const i=ei.compareSegments(e.get(s),n.get(s));if(i!==0)return i}return rt(e.length,n.length)}static compareSegments(e,n){const r=ei.isNumericId(e),s=ei.isNumericId(n);return r&&!s?-1:!r&&s?1:r&&s?ei.extractNumericId(e).compare(ei.extractNumericId(n)):rv(e,n)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Oo.fromString(e.substring(4,e.length-2))}}class Dt extends ei{construct(e,n,r){return new Dt(e,n,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const n=[];for(const r of e){if(r.indexOf("//")>=0)throw new be(ce.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter((s=>s.length>0)))}return new Dt(n)}static emptyPath(){return new Dt([])}}const cj=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Gn extends ei{construct(e,n,r){return new Gn(e,n,r)}static isValidIdentifier(e){return cj.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Gn.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===Lb}static keyField(){return new Gn([Lb])}static fromServerFormat(e){const n=[];let r="",s=0;const i=()=>{if(r.length===0)throw new be(ce.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let a=!1;for(;s<e.length;){const c=e[s];
vendor: 3,661 bytes, lines 1082-1112
1082if(c==="\\"){if(s+1===e.length)throw new be(ce.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const u=e[s+1];if(u!=="\\"&&u!=="."&&u!=="`")throw new be(ce.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=u,s+=2}else c==="`"?(a=!a,s++):c!=="."||a?(r+=c,s++):(i(),s++)}if(i(),a)throw new be(ce.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new Gn(n)}static emptyPath(){return new Gn([])}}/**
1083 * @license
1084 * Copyright 2017 Google LLC
1085 *
1086 * Licensed under the Apache License, Version 2.0 (the "License");
1087 * you may not use this file except in compliance with the License.
1088 * You may obtain a copy of the License at
1089 *
1090 *   http://www.apache.org/licenses/LICENSE-2.0
1091 *
1092 * Unless required by applicable law or agreed to in writing, software
1093 * distributed under the License is distributed on an "AS IS" BASIS,
1094 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1095 * See the License for the specific language governing permissions and
1096 * limitations under the License.
1097 */class Le{constructor(e){this.path=e}static fromPath(e){return new Le(Dt.fromString(e))}static fromName(e){return new Le(Dt.fromString(e).popFirst(5))}static empty(){return new Le(Dt.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&Dt.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return Dt.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new Le(new Dt(e.slice()))}}/**
1098 * @license
1099 * Copyright 2017 Google LLC
1100 *
1101 * Licensed under the Apache License, Version 2.0 (the "License");
1102 * you may not use this file except in compliance with the License.
1103 * You may obtain a copy of the License at
1104 *
1105 *   http://www.apache.org/licenses/LICENSE-2.0
1106 *
1107 * Unless required by applicable law or agreed to in writing, software
1108 * distributed under the License is distributed on an "AS IS" BASIS,
1109 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1110 * See the License for the specific language governing permissions and
1111 * limitations under the License.
1112 */function Xk(t,e,n){if(!n)throw new be(ce.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function uj(t,e,n,r){if(e===!0&&r===!0)throw new be(ce.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function Fb(t){if(!Le.isDocumentKey(t))throw new be(ce.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function jb(t){if(Le.isDocumentKey(t))throw new be(ce.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Zk(t){return typeof t=="object"&&t!==null&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null)}function Pm(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=(function(r){return r.constructor?r.constructor.name:null})(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":ze(12329,{type:typeof t})}function Fo(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new be(ce.INVA
vendor: 22,777 bytes, lines 1112-1336
1112LID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Pm(t);throw new be(ce.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}/**
1113 * @license
1114 * Copyright 2025 Google LLC
1115 *
1116 * Licensed under the Apache License, Version 2.0 (the "License");
1117 * you may not use this file except in compliance with the License.
1118 * You may obtain a copy of the License at
1119 *
1120 *   http://www.apache.org/licenses/LICENSE-2.0
1121 *
1122 * Unless required by applicable law or agreed to in writing, software
1123 * distributed under the License is distributed on an "AS IS" BASIS,
1124 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1125 * See the License for the specific language governing permissions and
1126 * limitations under the License.
1127 */function pn(t,e){const n={typeString:t};return e&&(n.value=e),n}function Nd(t,e){if(!Zk(t))throw new be(ce.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in e)if(e[r]){const s=e[r].typeString,i="value"in e[r]?{value:e[r].value}:void 0;if(!(r in t)){n=`JSON missing required field: '${r}'`;break}const a=t[r];if(s&&typeof a!==s){n=`JSON field '${r}' must be a ${s}.`;break}if(i!==void 0&&a!==i.value){n=`Expected '${r}' field to equal '${i.value}'`;break}}if(n)throw new be(ce.INVALID_ARGUMENT,n);return!0}/**
1128 * @license
1129 * Copyright 2017 Google LLC
1130 *
1131 * Licensed under the Apache License, Version 2.0 (the "License");
1132 * you may not use this file except in compliance with the License.
1133 * You may obtain a copy of the License at
1134 *
1135 *   http://www.apache.org/licenses/LICENSE-2.0
1136 *
1137 * Unless required by applicable law or agreed to in writing, software
1138 * distributed under the License is distributed on an "AS IS" BASIS,
1139 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1140 * See the License for the specific language governing permissions and
1141 * limitations under the License.
1142 */const Mb=-62135596800,Bb=1e6;class Bt{static now(){return Bt.fromMillis(Date.now())}static fromDate(e){return Bt.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor((e-1e3*n)*Bb);return new Bt(n,r)}constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new be(ce.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new be(ce.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e<Mb)throw new be(ce.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new be(ce.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/Bb}_compareTo(e){return this.seconds===e.seconds?rt(this.nanoseconds,e.nanoseconds):rt(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:Bt._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(Nd(e,Bt._jsonSchema))return new Bt(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-Mb;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Bt._jsonSchemaVersion="firestore/timestamp/1.0",Bt._jsonSchema={type:pn("string",Bt._jsonSchemaVersion),seconds:pn("number"),nanoseconds:pn("number")};/**
1143 * @license
1144 * Copyright 2017 Google LLC
1145 *
1146 * Licensed under the Apache License, Version 2.0 (the "License");
1147 * you may not use this file except in compliance with the License.
1148 * You may obtain a copy of the License at
1149 *
1150 *   http://www.apache.org/licenses/LICENSE-2.0
1151 *
1152 * Unless required by applicable law or agreed to in writing, software
1153 * distributed under the License is distributed on an "AS IS" BASIS,
1154 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1155 * See the License for the specific language governing permissions and
1156 * limitations under the License.
1157 */class Ge{static fromTimestamp(e){return new Ge(e)}static min(){return new Ge(new Bt(0,0))}static max(){return new Ge(new Bt(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
1158 * @license
1159 * Copyright 2021 Google LLC
1160 *
1161 * Licensed under the Apache License, Version 2.0 (the "License");
1162 * you may not use this file except in compliance with the License.
1163 * You may obtain a copy of the License at
1164 *
1165 *   http://www.apache.org/licenses/LICENSE-2.0
1166 *
1167 * Unless required by applicable law or agreed to in writing, software
1168 * distributed under the License is distributed on an "AS IS" BASIS,
1169 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1170 * See the License for the specific language governing permissions and
1171 * limitations under the License.
1172 */const dd=-1;function dj(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=Ge.fromTimestamp(r===1e9?new Bt(n+1,0):new Bt(n,r));return new Bo(s,Le.empty(),e)}function hj(t){return new Bo(t.readTime,t.key,dd)}class Bo{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new Bo(Ge.min(),Le.empty(),dd)}static max(){return new Bo(Ge.max(),Le.empty(),dd)}}function fj(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=Le.comparator(t.documentKey,e.documentKey),n!==0?n:rt(t.largestBatchId,e.largestBatchId))}/**
1173 * @license
1174 * Copyright 2020 Google LLC
1175 *
1176 * Licensed under the Apache License, Version 2.0 (the "License");
1177 * you may not use this file except in compliance with the License.
1178 * You may obtain a copy of the License at
1179 *
1180 *   http://www.apache.org/licenses/LICENSE-2.0
1181 *
1182 * Unless required by applicable law or agreed to in writing, software
1183 * distributed under the License is distributed on an "AS IS" BASIS,
1184 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1185 * See the License for the specific language governing permissions and
1186 * limitations under the License.
1187 */const pj="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class mj{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}/**
1188 * @license
1189 * Copyright 2017 Google LLC
1190 *
1191 * Licensed under the Apache License, Version 2.0 (the "License");
1192 * you may not use this file except in compliance with the License.
1193 * You may obtain a copy of the License at
1194 *
1195 *   http://www.apache.org/licenses/LICENSE-2.0
1196 *
1197 * Unless required by applicable law or agreed to in writing, software
1198 * distributed under the License is distributed on an "AS IS" BASIS,
1199 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1200 * See the License for the specific language governing permissions and
1201 * limitations under the License.
1202 */async function Pc(t){if(t.code!==ce.FAILED_PRECONDITION||t.message!==pj)throw t;Te("LocalStore","Unexpectedly lost primary lease")}/**
1203 * @license
1204 * Copyright 2017 Google LLC
1205 *
1206 * Licensed under the Apache License, Version 2.0 (the "License");
1207 * you may not use this file except in compliance with the License.
1208 * You may obtain a copy of the License at
1209 *
1210 *   http://www.apache.org/licenses/LICENSE-2.0
1211 *
1212 * Unless required by applicable law or agreed to in writing, software
1213 * distributed under the License is distributed on an "AS IS" BASIS,
1214 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1215 * See the License for the specific language governing permissions and
1216 * limitations under the License.
1217 */class ue{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)}),(n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)}))}catch(e){return this.next(void 0,e)}next(e,n){return this.callbackAttached&&ze(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new ue(((r,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(r,s)},this.catchCallback=i=>{this.wrapFailure(n,i).next(r,s)}}))}toPromise(){return new Promise(((e,n)=>{this.next(e,n)}))}wrapUserFunction(e){try{const n=e();return n instanceof ue?n:ue.resolve(n)}catch(n){return ue.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction((()=>e(n))):ue.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction((()=>e(n))):ue.reject(n)}static resolve(e){return new ue(((n,r)=>{n(e)}))}static reject(e){return new ue(((n,r)=>{r(e)}))}static waitFor(e){return new ue(((n,r)=>{let s=0,i=0,a=!1;e.forEach((c=>{++s,c.next((()=>{++i,a&&i===s&&n()}),(u=>r(u)))})),a=!0,i===s&&n()}))}static or(e){let n=ue.resolve(!1);for(const r of e)n=n.next((s=>s?ue.resolve(s):r()));return n}static forEach(e,n){const r=[];return e.forEach(((s,i)=>{r.push(n.call(this,s,i))})),this.waitFor(r)}static mapArray(e,n){return new ue(((r,s)=>{const i=e.length,a=new Array(i);let c=0;for(let u=0;u<i;u++){const d=u;n(e[d]).next((f=>{a[d]=f,++c,c===i&&r(a)}),(f=>s(f)))}}))}static doWhile(e,n){return new ue(((r,s)=>{const i=()=>{e()===!0?n().next((()=>{i()}),s):r()};i()}))}}function gj(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function Rc(t){return t.name==="IndexedDbTransactionError"}/**
1218 * @license
1219 * Copyright 2018 Google LLC
1220 *
1221 * Licensed under the Apache License, Version 2.0 (the "License");
1222 * you may not use this file except in compliance with the License.
1223 * You may obtain a copy of the License at
1224 *
1225 *   http://www.apache.org/licenses/LICENSE-2.0
1226 *
1227 * Unless required by applicable law or agreed to in writing, software
1228 * distributed under the License is distributed on an "AS IS" BASIS,
1229 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1230 * See the License for the specific language governing permissions and
1231 * limitations under the License.
1232 */class Rm{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.ae(r),this.ue=r=>n.writeSequenceNumber(r))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}Rm.ce=-1;/**
1233 * @license
1234 * Copyright 2017 Google LLC
1235 *
1236 * Licensed under the Apache License, Version 2.0 (the "License");
1237 * you may not use this file except in compliance with the License.
1238 * You may obtain a copy of the License at
1239 *
1240 *   http://www.apache.org/licenses/LICENSE-2.0
1241 *
1242 * Unless required by applicable law or agreed to in writing, software
1243 * distributed under the License is distributed on an "AS IS" BASIS,
1244 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1245 * See the License for the specific language governing permissions and
1246 * limitations under the License.
1247 */const C_=-1;function Dm(t){return t==null}function Bp(t){return t===0&&1/t==-1/0}function yj(t){return typeof t=="number"&&Number.isInteger(t)&&!Bp(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/**
1248 * @license
1249 * Copyright 2017 Google LLC
1250 *
1251 * Licensed under the Apache License, Version 2.0 (the "License");
1252 * you may not use this file except in compliance with the License.
1253 * You may obtain a copy of the License at
1254 *
1255 *   http://www.apache.org/licenses/LICENSE-2.0
1256 *
1257 * Unless required by applicable law or agreed to in writing, software
1258 * distributed under the License is distributed on an "AS IS" BASIS,
1259 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1260 * See the License for the specific language governing permissions and
1261 * limitations under the License.
1262 */const e2="�";function vj(t){let e="";for(let n=0;n<t.length;n++)e.length>0&&(e=Vb(e)),e=_j(t.get(n),e);return Vb(e)}function _j(t,e){let n=e;const r=t.length;for(let s=0;s<r;s++){const i=t.charAt(s);switch(i){case"\0":n+="��";break;case e2:n+="��";break;default:n+=i}}return n}function Vb(t){return t+e2+"�"}/**
1263 * @license
1264 * Copyright 2017 Google LLC
1265 *
1266 * Licensed under the Apache License, Version 2.0 (the "License");
1267 * you may not use this file except in compliance with the License.
1268 * You may obtain a copy of the License at
1269 *
1270 *   http://www.apache.org/licenses/LICENSE-2.0
1271 *
1272 * Unless required by applicable law or agreed to in writing, software
1273 * distributed under the License is distributed on an "AS IS" BASIS,
1274 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1275 * See the License for the specific language governing permissions and
1276 * limitations under the License.
1277 */function Ub(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function Go(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function t2(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}/**
1278 * @license
1279 * Copyright 2017 Google LLC
1280 *
1281 * Licensed under the Apache License, Version 2.0 (the "License");
1282 * you may not use this file except in compliance with the License.
1283 * You may obtain a copy of the License at
1284 *
1285 *   http://www.apache.org/licenses/LICENSE-2.0
1286 *
1287 * Unless required by applicable law or agreed to in writing, software
1288 * distributed under the License is distributed on an "AS IS" BASIS,
1289 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1290 * See the License for the specific language governing permissions and
1291 * limitations under the License.
1292 */class Kt{constructor(e,n){this.comparator=e,this.root=n||qn.EMPTY}insert(e,n){return new Kt(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,qn.BLACK,null,null))}remove(e){return new Kt(this.comparator,this.root.remove(e,this.comparator).copy(null,null,qn.BLACK,null,null))}get(e){let n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const s=this.comparator(e,r.key);if(s===0)return n+r.left.size;s<0?r=r.left:(n+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal(((n,r)=>(e(n,r),!1)))}toString(){const e=[];return this.inorderTraversal(((n,r)=>(e.push(`${n}:${r}`),!1))),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new pf(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new pf(this.root,e,this.comparator,!1)}getReverseIterator(){return new pf(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new pf(this.root,e,this.comparator,!0)}}class pf{constructor(e,n,r,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=n?r(e.key,n):1,n&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class qn{constructor(e,n,r,s,i){this.key=e,this.value=n,this.color=r??qn.RED,this.left=s??qn.EMPTY,this.right=i??qn.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,s,i){return new qn(e??this.key,n??this.value,r??this.color,s??this.left,i??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,n,r){let s=this;const i=r(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,n,r),null):i===0?s.copy(null,n,null,null,null):s.copy(null,null,null,null,s.right.insert(e,n,r)),s.fixUp()}removeMin(){if(this.left.isEmpty())return qn.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,n){let r,s=this;if(n(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,n),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),n(e,s.key)===0){if(s.right.isEmpty())return qn.EMPTY;r=s.right.min(),s=s.copy(r.key,r.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,n))}return s.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,qn.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,qn.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw ze(43730,{key:this.key,value:this.value});if(this.right.isRed())throw ze(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw ze(27949);return e+(this.isRed()?0:1)}}qn.EMPTY=null,qn.RED=!0,qn.BLACK=!1;qn.EMPTY=new class{constructor(){this.size=0}get key(){throw ze(57766)}get value(){throw ze(16141)}get color(){throw ze(16727)}get left(){throw ze(29726)}get right(){throw ze(36894)}copy(e,n,r,s,i){return this}insert(e,n,r){return new qn(e,n)}remove(e,n){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/**
1293 * @license
1294 * Copyright 2017 Google LLC
1295 *
1296 * Licensed under the Apache License, Version 2.0 (the "License");
1297 * you may not use this file except in compliance with the License.
1298 * You may obtain a copy of the License at
1299 *
1300 *   http://www.apache.org/licenses/LICENSE-2.0
1301 *
1302 * Unless required by applicable law or agreed to in writing, software
1303 * distributed under the License is distributed on an "AS IS" BASIS,
1304 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1305 * See the License for the specific language governing permissions and
1306 * limitations under the License.
1307 */class bn{constructor(e){this.comparator=e,this.data=new Kt(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((n,r)=>(e(n),!1)))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const s=r.getNext();if(this.comparator(s.key,e[1])>=0)return;n(s.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new $b(this.data.getIterator())}getIteratorFrom(e){return new $b(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let n=this;return n.size<e.size&&(n=e,e=this),e.forEach((r=>{n=n.add(r)})),n}isEqual(e){if(!(e instanceof bn)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(this.comparator(s,i)!==0)return!1}return!0}toArray(){const e=[];return this.forEach((n=>{e.push(n)})),e}toString(){const e=[];return this.forEach((n=>e.push(n))),"SortedSet("+e.toString()+")"}copy(e){const n=new bn(this.comparator);return n.data=e,n}}class $b{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
1308 * @license
1309 * Copyright 2020 Google LLC
1310 *
1311 * Licensed under the Apache License, Version 2.0 (the "License");
1312 * you may not use this file except in compliance with the License.
1313 * You may obtain a copy of the License at
1314 *
1315 *   http://www.apache.org/licenses/LICENSE-2.0
1316 *
1317 * Unless required by applicable law or agreed to in writing, software
1318 * distributed under the License is distributed on an "AS IS" BASIS,
1319 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1320 * See the License for the specific language governing permissions and
1321 * limitations under the License.
1322 */class Kr{constructor(e){this.fields=e,e.sort(Gn.comparator)}static empty(){return new Kr([])}unionWith(e){let n=new bn(Gn.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new Kr(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return dc(this.fields,e.fields,((n,r)=>n.isEqual(r)))}}/**
1323 * @license
1324 * Copyright 2023 Google LLC
1325 *
1326 * Licensed under the Apache License, Version 2.0 (the "License");
1327 * you may not use this file except in compliance with the License.
1328 * You may obtain a copy of the License at
1329 *
1330 *   http://www.apache.org/licenses/LICENSE-2.0
1331 *
1332 * Unless required by applicable law or agreed to in writing, software
1333 * distributed under the License is distributed on an "AS IS" BASIS,
1334 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1335 * See the License for the specific language governing permissions and
1336 * limitations under the License.
1337 */class n2 extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
1338 * @license
1339 * Copyright 2020 Google LLC
1340 *
1341 * Licensed under the Apache License, Version 2.0 (the "License");
1342 * you may not use this file except in compliance with the License.
1343 * You may obtain a copy of the License at
1344 *
1345 *   http://www.apache.org/licenses/LICENSE-2.0
1346 *
1347 * Unless required by applicable law or agreed to in writing, software
1348 * distributed under the License is distributed on an "AS IS" BASIS,
1349 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1350 * See the License for the specific language governing permissions and
1351 * limitations under the License.
1352 */class Kn{constructor(e){this.binaryString=e}static fromBase64String(e){const n=(function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new n2("Invalid base64 string: "+i):i}})(e);return new Kn(n)}static fromUint8Array(e){const n=(function(s){let i="";for(let a=0;a<s.length;++a)i+=String.fromCharCode(s[a]);return i})(e);return new Kn(n)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return(function(n){return btoa(n)})(this.binaryString)}toUint8Array(){return(function(n){const r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return rt(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}Kn.EMPTY_BYTE_STRING=new Kn("");const xj=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Vo(t){if(yt(!!t,39018),typeof t=="string"){let e=0;const n=xj.exec(t);if(yt(!!n,46558,{timestamp:t}),n[1]){let s=n[1];s=(s+"000000000").substr(0,9),e=Number(s)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:an(t.seconds),nanos:an(t.nanos)}}function an(t){return typeof t=="number"?t:typeof t=="string"?Number(t):0}function Uo(t){return typeof t=="string"?Kn.fromBase64String(t):Kn.fromUint8Array(t)}/**
1353 * @license
1354 * Copyright 2020 Google LLC
1355 *
1356 * Licensed under the Apache License, Version 2.0 (the "License");
1357 * you may not use this file except in compliance with the License.
1358 * You may obtain a copy of the License at
1359 *
1360 *   http://www.apache.org/licenses/LICENSE-2.0
1361 *
1362 * Unless required by applicable law or agreed to in writing, software
1363 * distributed under the License is distributed on an "AS IS" BASIS,
1364 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1365 * See the License for the specific language governing permissions and
1366 * limitations under the License.
1367 */const r2="server_timestamp",s2="__type__",i2="__previous_value__",o2="__local_write_time__";function S_(t){return(t?.mapValue?.fields||{})[s2]?.stringValue===r2}function Nm(t){const e=t.mapValue.fields[i2];return S_(e)?Nm(e):e}function hd(t){const e=Vo(t.mapValue.fields[o2].timestampValue);return new Bt(e.seconds,e.nanos)}/**
1368 * @license
1369 * Copyright 2017 Google LLC
1370 *
1371 * Licensed under the Apache License, Version 2.0 (the "License");
1372 * you may not use this file except in compliance with the License.
1373 * You may obtain a copy of the License at
1374 *
1375 *   http://www.apache.org/licenses/LICENSE-2.0
1376 *
1377 * Unless required by applicable law or agreed to in writing, software
1378 * distributed under the License is distributed on an "AS IS" BASIS,
1379 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1380 * See the License for the specific language governing permissions and
1381 * limitations under the License.
1382 */class wj{constructor(e,n,r,s,i,a,c,u,d,f,g){this.databaseId=e,this.appId=n,this.persistenceKey=r,this.host=s,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=c,this.longPollingOptions=u,this.useFetchStreams=d,this.isUsingEmulator=f,this.apiKey=g}}const Vp="(default)";class fd{constructor(e,n){this.projectId=e,this.database=n||Vp}static empty(){return new fd("","")}get isDefaultDatabase(){return this.database===Vp}isEqual(e){return e instanceof fd&&e.projectId===this.projectId&&e.database===this.database}}function Ej(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new be(ce.INVA
1382LID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new fd(t.options.projectId,e)}/**
1383 * @license
1384 * Copyright 2020 Google LLC
1385 *
1386 * Licensed under the Apache License, Version 2.0 (the "License");
1387 * you may not use this file except in compliance with the License.
1388 * You may obtain a copy of the License at
1389 *
1390 *   http://www.apache.org/licenses/LICENSE-2.0
1391 *
1392 * Unless required by applicable law or agreed to in writing, software
1393 * distributed under the License is distributed on an "AS IS" BASIS,
1394 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1395 * See the License for the specific language governing permissions and
1396 * limitations under the License.
1397 */const a2="__type__",bj="__max__",mf={mapValue:{}},l2="__vector__",Up="value";function $o(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?S_(t)?4:Tj(t)?9007199254740991:Aj(t)?10:11:ze(28295,{value:t})}function ai(t,e){if(t===e)return!0;const n=$o(t);if(n!==$o(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return hd(t).isEqual(hd(e));case 3:return(function(s,i){if(typeof s.timestampValue=="string"&&typeof i.timestampValue=="string"&&s.timestampValue.length===i.timestampValue.length)return s.timestampValue===i.timestampValue;const a=Vo(s.timestampValue),c=Vo(i.timestampValue);return a.seconds===c.seconds&&a.nanos===c.nanos})(t,e);case 5:return t.stringValue===e.stringValue;case 6:return(function(s,i){return Uo(s.bytesValue).isEqual(Uo(i.bytesValue))})(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return(function(s,i){return an(s.geoPointValue.latitude)===an(i.geoPointValue.latitude)&&an(s.geoPointValue.longitude)===an(i.geoPointValue.longitude)})(t,e);case 2:return(function(s,i){if("integerValue"in s&&"integerValue"in i)return an(s.integerValue)===an(i.integerValue);if("doubleValue"in s&&"doubleValue"in i){const a=an(s.doubleValue),c=an(i.doubleValue);return a===c?Bp(a)===Bp(c):isNaN(a)&&isNaN(c)}return!1})(t,e);case 9:return dc(t.arrayValue.values||[],e.arrayValue.values||[],ai);case 10:case 11:return(function(s,i){const a=s.mapValue.fields||{},c=i.mapValue.fields||{};if(Ub(a)!==Ub(c))return!1;for(const u in a)if(a.hasOwnProperty(u)&&(c[u]===void 0||!ai(a[u],c[u])))return!1;return!0})(t,e);default:return ze(52216,{left:t})}}function pd(t,e){return(t.values||[]).find((n=>ai(n,e)))!==void 0}function hc(t,e){if(t===e)return 0;const n=$o(t),r=$o(e);if(n!==r)return rt(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return rt(t.booleanValue,e.booleanValue);case 2:return(function(i,a){const c=an(i.integerValue||i.doubleValue),u=an(a.integerValue||a.doubleValue);return c<u?-1:c>u?1:c===u?0:isNaN(c)?isNaN(u)?0:-1:1})(t,e);case 3:return zb(t.timestampValue,e.timestampValue);case 4:return zb(hd(t),hd(e));case 5:return rv(t.stringValue,e.stringValue);case 6:return(function(i,a){const c=Uo(i),u=Uo(a);return c.compareTo(u)})(t.bytesValue,e.bytesValue);case 7:return(function(i,a){const c=i.split("/"),u=a.split("/");for(let d=0;d<c.length&&d<u.length;d++){const f=rt(c[d],u[d]);if(f!==0)return f}return rt(c.length,u.length)})(t.referenceValue,e.referenceValue);case 8:return(function(i,a){const c=rt(an(i.latitude),an(a.latitude));return c!==0?c:rt(an(i.longitude),an(a.longitude))})(t.geoPointValue,e.geoPointValue);case 9:return Hb(t.arrayValue,e.arrayValue);case 10:return(function(i,a){const c=i.fields||{},u=a.fields||{},d=c[Up]?.arrayValue,f=u[Up]?.arrayValue,g=rt(d?.values?.length||0,f?.values?.length||0);return g!==0?g:Hb(d,f)})(t.mapValue,e.mapValue);case 11:return(function(i,a){if(i===mf.mapValue&&a===mf.mapValue)return 0;if(i===mf.mapValue)return 1;if(a===mf.mapValue)return-1;const c=i.fields||{},u=Object.keys(c),d=a.fields||{},f=Object.keys(d);u.sort(),f.sort();for(let g=0;g<u.length&&g<f.length;++g){const y=rv(u[g],f[g]);if(y!==0)return y;const x=hc(c[u[g]],d[f[g]]);if(x!==0)return x}return rt(u.length,f.length)})(t.mapValue,e.mapValue);default:throw ze(23264,{he:n})}}function zb(t,e){if(typeof t=="string"&&typeof e=="string"&&t.length===e.length)return rt(t,e);const n=Vo(t),r=Vo(e),s=rt(n.seconds,r.seconds);return s!==0?s:rt(n.nanos,r.nanos)}function Hb(t,e){const n=t.values||[],r=e.values||[];for(let s=0;s<n.length&&s<r.length;++s){const i=hc(n[s],r[s]);if(i)return i}return rt(n.length,r.length)}function fc(t){return sv(t)}function sv(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?(function(n){const r=Vo(n);return`time(${r.seconds},${r.nanos})`})(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?(function(n){return Uo(n).toBase64()})(t.bytesValue):"referenceValue"in t?(function(n){return Le.fromName(n).toString()})(t.referenceValue):"geoPointValue"in t?(function(n){return`geo(${n.latitude},${n.longitude})`})(t.geoPointValue):"arrayValue"in t?(function(n){let r="[",s=!0;for(const i of n.values||[])s?s=!1:r+=",",r+=sv(i);return r+"]"})(t.arrayValue):"mapValue"in t?(function(n){const r=Object.keys(n.fields||{}).sort();let s="{",i=!0;for(const a of r)i?i=!1:s+=",",s+=`${a}:${sv(n.fields[a])}`;return s+"}"})(t.mapValue):ze(61005,{value:t})}function Mf(t){switch($o(t)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=Nm(t);return e?16+Mf(e):16;case 5:return 2*t.stringValue.length;case 6:return Uo(t.bytesValue).approximateByteSize();case 7:return t.referenceValue.length;case 9:return(function(r){return(r.values||[]).reduce(((s,i)=>s+Mf(i)),0)})(t.arrayValue);case 10:case 11:return(function(r){let s=0;return Go(r.fields,((i,a)=>{s+=i.length+Mf(a)})),s})(t.mapValue);default:throw ze(13486,{value:t})}}function qb(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function iv(t){return!!t&&"integerValue"in t}function k_(t){return!!t&&"arrayValue"in t}function Wb(t){return!!t&&"nullValue"in t}function Gb(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Bf(t){return!!t&&"mapValue"in t}function Aj(t){return(t?.mapValue?.fields||{})[a2]?.stringValue===l2}function Gu(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:{...t.timestampValue}};if(t.mapValue){const e={mapValue:{fields:{}}};return Go(t.mapValue.fields,((n,r)=>e.mapValue.fields[n]=Gu(r))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Gu(t.arrayValue.values[n]);return e}return{...t}}function Tj(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===bj}/**
1398 * @license
1399 * Copyright 2017 Google LLC
1400 *
1401 * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 1,741 bytes, lines 1402-1412
1402 * you may not use this file except in compliance with the License.
1403 * You may obtain a copy of the License at
1404 *
1405 *   http://www.apache.org/licenses/LICENSE-2.0
1406 *
1407 * Unless required by applicable law or agreed to in writing, software
1408 * distributed under the License is distributed on an "AS IS" BASIS,
1409 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1410 * See the License for the specific language governing permissions and
1411 * limitations under the License.
1412 */class Pr{constructor(e){this.value=e}static empty(){return new Pr({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r<e.length-1;++r)if(n=(n.mapValue.fields||{})[e.get(r)],!Bf(n))return null;return n=(n.mapValue.fields||{})[e.lastSegment()],n||null}}set(e,n){this.getFieldsMap(e.popLast())[e.lastSegment()]=Gu(n)}setAll(e){let n=Gn.emptyPath(),r={},s=[];e.forEach(((a,c)=>{if(!n.isImmediateParentOf(c)){const u=this.getFieldsMap(n);this.applyChanges(u,r,s),r={},s=[],n=c.popLast()}a?r[c.lastSegment()]=Gu(a):s.push(c.lastSegment())}));const i=this.getFieldsMap(n);this.applyChanges(i,r,s)}delete(e){const n=this.field(e.popLast());Bf(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return ai(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;r<e.length;++r){let s=n.mapValue.fields[e.get(r)];Bf(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},n.mapValue.fields[e.get(r)]=s),n=s}return n.mapValue.fields}applyChanges(e,n,r){Go(n,((s,i)=>e[s]=i));for(const s of r)delete e[s]}clone(){return new Pr(Gu(this.value))}}function c2(t){const e=[];return Go(t.fields,((n,r)=>{const s=new Gn([n]);if(Bf(r)){const i=c2(r.mapValue).fields;
vendor: 4,181 bytes, lines 1412-1452
1412if(i.length===0)e.push(s);else for(const a of i)e.push(s.child(a))}else e.push(s)})),new Kr(e)}/**
1413 * @license
1414 * Copyright 2017 Google LLC
1415 *
1416 * Licensed under the Apache License, Version 2.0 (the "License");
1417 * you may not use this file except in compliance with the License.
1418 * You may obtain a copy of the License at
1419 *
1420 *   http://www.apache.org/licenses/LICENSE-2.0
1421 *
1422 * Unless required by applicable law or agreed to in writing, software
1423 * distributed under the License is distributed on an "AS IS" BASIS,
1424 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1425 * See the License for the specific language governing permissions and
1426 * limitations under the License.
1427 */class or{constructor(e,n,r,s,i,a,c){this.key=e,this.documentType=n,this.version=r,this.readTime=s,this.createTime=i,this.data=a,this.documentState=c}static newInvalidDocument(e){return new or(e,0,Ge.min(),Ge.min(),Ge.min(),Pr.empty(),0)}static newFoundDocument(e,n,r,s){return new or(e,1,n,Ge.min(),r,s,0)}static newNoDocument(e,n){return new or(e,2,n,Ge.min(),Ge.min(),Pr.empty(),0)}static newUnknownDocument(e,n){return new or(e,3,n,Ge.min(),Ge.min(),Pr.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(Ge.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Pr.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Pr.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Ge.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof or&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new or(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/**
1428 * @license
1429 * Copyright 2022 Google LLC
1430 *
1431 * Licensed under the Apache License, Version 2.0 (the "License");
1432 * you may not use this file except in compliance with the License.
1433 * You may obtain a copy of the License at
1434 *
1435 *   http://www.apache.org/licenses/LICENSE-2.0
1436 *
1437 * Unless required by applicable law or agreed to in writing, software
1438 * distributed under the License is distributed on an "AS IS" BASIS,
1439 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1440 * See the License for the specific language governing permissions and
1441 * limitations under the License.
1442 */class $p{constructor(e,n){this.position=e,this.inclusive=n}}function Kb(t,e,n){let r=0;for(let s=0;s<t.position.length;s++){const i=e[s],a=t.position[s];if(i.field.isKeyField()?r=Le.comparator(Le.fromName(a.referenceValue),n.key):r=hc(a,n.data.field(i.field)),i.dir==="desc"&&(r*=-1),r!==0)break}return r}function Yb(t,e){if(t===null)return e===null;if(e===null||t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!ai(t.position[n],e.position[n]))return!1;return!0}/**
1443 * @license
1444 * Copyright 2022 Google LLC
1445 *
1446 * Licensed under the Apache License, Version 2.0 (the "License");
1447 * you may not use this file except in compliance with the License.
1448 * You may obtain a copy of the License at
1449 *
1450 *   http://www.apache.org/licenses/LICENSE-2.0
1451 *
1452 * Unless required by applicable law or agreed to in writing, softw
1452are
1453 * distributed under the License is distributed on an "AS IS" BASIS,
1454 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1455 * See the License for the specific language governing permissions and
1456 * limitations under the License.
1457 */class md{constructor(e,n="asc"){this.field=e,this.dir=n}}function Cj(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}/**
1458 * @license
1459 * Copyright 2022 Google LLC
1460 *
1461 * Licensed under the Apache License, Version 2.0 (the "License");
1462 * you may not use this file except in compliance with the License.
1463 * You may obtain a copy of the License at
1464 *
1465 *   http://www.apache.org/licenses/LICENSE-2.0
1466 *
1467 * Unless required by applicable law or agreed to in writing, software
1468 * distributed under the License is distributed on an "AS IS" BASIS,
1469 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1470 * See the License for the specific language governing permissions and
1471 * limitations under the License.
1472 */class u2{}class fn extends u2{constructor(e,n,r){super(),this.field=e,this.op=n,this.value=r}static create(e,n,r){return e.isKeyField()?n==="in"||n==="not-in"?this.createKeyFieldInFilter(e,n,r):new kj(e,n,r):n==="array-contains"?new Rj(e,r):n==="in"?new Dj(e,r):n==="not-in"?new Nj(e,r):n==="array-contains-any"?new Oj(e,r):new fn(e,n,r)}static createKeyFieldInFilter(e,n,r){return n==="in"?new Ij(e,r):new Pj(e,r)}matches(e){const n=e.data.field(this.field);return this.op==="!="?n!==null&&n.nullValue===void 0&&this.matchesComparison(hc(n,this.value)):n!==null&&$o(this.value)===$o(n)&&this.matchesComparison(hc(n,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return ze(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Ns extends u2{constructor(e,n){super(),this.filters=e,this.op=n,this.Pe=null}static create(e,n){return new Ns(e,n)}matches(e){return d2(this)?this.filters.find((n=>!n.matches(e)))===void 0:this.filters.find((n=>n.matches(e)))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce(((e,n)=>e.concat(n.getFlattenedFilters())),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function d2(t){return t.op==="and"}function h2(t){return Sj(t)&&d2(t)}function Sj(t){for(const e of t.filters)if(e instanceof Ns)return!1;return!0}function ov(t){if(t instanceof fn)return t.field.canonicalString()+t.op.toString()+fc(t.value);if(h2(t))return t.filters.map((e=>ov(e))).join(",");{const e=t.filters.map((n=>ov(n))).join(",");return`${t.op}(${e})`}}function f2(t,e){return t instanceof fn?(function(r,s){return s instanceof fn&&r.op===s.op&&r.field.isEqual(s.field)&&ai(r.value,s.value)})(t,e):t instanceof Ns?(function(r,s){return s instanceof Ns&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce(((i,a,c)=>i&&f2(a,s.filters[c])),!0):!1})(t,e):void ze(19439)}function p2(t){return t instanceof fn?(function(n){return`${n.field.canonicalString()} ${n.op} ${fc(n.value)}`})(t):t instanceof Ns?(function(n){return n.op.toString()+" {"+n.getFilters().map(p2).join(" ,")+"}"})(t):"Filter"}class kj extends fn{constructor(e,n,r){super(e,n,r),this.key=Le.fromName(r.referenceValue)}matches(e){const n=Le.comparator(e.key,this.key);return this.matchesComparison(n)}}class Ij extends fn{constructor(e,n){super(e,"in",n),this.keys=m2("in",n)}matches(e){return this.keys.some((n=>n.isEqual(e.key)))}}class Pj extends fn{constructor(e,n){super(e,"not-in",n),this.keys=m2("not-in",n)}matches(e){return!this.keys.some((n=>n.isEqual(e.key)))}}function m2(t,e){return(e.arrayValue?.values||[]).map((n=>Le.fromName(n.referenceValue)))}class Rj extends fn{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return k_(n)&&pd(n.arrayValue,this.value)}}class Dj extends fn{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&pd(this.value.arrayValue,n)}}class Nj extends fn{constructor(e,n){super(e,"not-in",n)}matches(e){if(pd(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&n.nullValue===void 0&&!pd(this.value.arrayValue,n)}}class Oj extends fn{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!k_(n)||!n.arrayValue.values)&&n.arrayValue.values.some((r=>pd(this.value.arrayValue,r)))}}/**
1473 * @license
1474 * Copyright 2019 Google LLC
1475 *
1476 * Licensed under the Apache License, Version 2.0 (the "License");
1477 * you may not use this file except in compliance with the License.
1478 * You may obtain a copy of the License at
1479 *
1480 *   http://www.apache.org/licenses/LICENSE-2.0
1481 *
1482 * Unless required by applicable law or agreed to in writing, software
1483 * distributed under the License is distributed on an "AS IS" BASIS,
1484 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1485 * See the License for the specific language governing permissions and
1486 * limitations under the License.
1487 */class Lj{constructor(e,n=null,r=[],s=[],i=null,a=null,c=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=a,this.endAt=c,this.Te=null}}function Qb(t,e=null,n=[],r=[],s=null,i=null,a=null){return new Lj(t,e,n,r,s,i,a)}function I_(t){const e=Qe(t);if(e.Te===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map((r=>ov(r))).join(","),n+="|ob:",n+=e.orderBy.map((r=>(function(i){return i.field.canonicalString()+i.dir})(r))).join(","),Dm(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map((r=>fc(r))).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map((r=>fc(r))).join(",")),e.Te=n}return e.Te}function P_(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!Cj(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!f2(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Yb(t.startAt,e.startAt)&&Yb(t.endAt,e.endAt)}function av(t){return Le.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}/**
1488 * @license
1489 * Copyright 2017 Google LLC
1490 *
1491 * Licensed under the Apache License, Version 2.0 (the "License");
1492 * you may not use this file except in compliance with the License.
1493 * You may obtain a copy of the License at
1494 *
1495 *   http://www.apache.org/licenses/LICENSE-2.0
1496 *
1497 * Unless required by applicable law or agreed to in writing, software
1498 * distributed under the License is distributed on an "AS IS" BASIS,
1499 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1500 * See the License for the specific language governing permissions and
1501 * limitations under the License.
1502 */class Dc{constructor(e,n=null,r=[],s=[],i=null,a="F",c=null,u=null){this.path=e,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=s,this.limit=i,this.limitType=a,this.startAt=c,this.endAt=u,this.Ie=null,this.Ee=null,this.Re=null,this.startAt,this.endAt}}function Fj(t,e,n,r,s,i,a,c){return new Dc(t,e,n,r,s,i,a,c)}function R_(t){return new Dc(t)}function Jb(t){return t.filters.length===0&&t.limit===null&&t.startAt==null&&t.endAt==null&&(t.explicitOrderBy.length===0||t.explicitOrderBy.length===1&&t.explicitOrderBy[0].field.isKeyField())}function jj(t){return Le.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}function g2(t){return t.collectionGroup!==null}function Ku(t){const e=Qe(t);if(e.Ie===null){e.Ie=[];const n=new Set;for(const i of e.explicitOrderBy)e.Ie.push(i),n.add(i.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let c=new bn(Gn.comparator);return a.filters.forEach((u=>{u.getFlattenedFilters().forEach((d=>{d.isInequality()&&(c=c.add(d.field))}))})),c})(e).forEach((i=>{n.has(i.canonicalString())||i.isKeyField()||e.Ie.push(new md(i,r))})),n.has(Gn.keyField().canonicalString())||e.Ie.push(new md(Gn.keyField(),r))}return e.Ie}function ni(t){const e=Qe(t);return e.Ee||(e.Ee=Mj(e,Ku(t))),e.Ee}function Mj(t,e){if(t.limitType==="F")return Qb(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map((s=>{const i=s.dir==="desc"?"asc":"desc";return new md(s.field,i)}));const n=t.endAt?new $p(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new $p(t.startAt.position,t.startAt.inclusive):null;return Qb(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function lv(t,e){const n=t.filters.concat([e]);return new Dc(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Bj(t,e){const n=t.explicitOrderBy.concat([e]);return new Dc(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}function zp(t,e,n){return new Dc(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}
1502function Om(t,e){return P_(ni(t),ni(e))&&t.limitType===e.limitType}function y2(t){return`${I_(ni(t))}|lt:${t.limitType}`}function Hl(t){return`Query(target=${(function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map((s=>p2(s))).join(", ")}]`),Dm(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map((s=>(function(a){return`${a.field.canonicalString()} (${a.dir})`})(s))).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map((s=>fc(s))).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map((s=>fc(s))).join(",")),`Target(${r})`})(ni(t))}; limitType=${t.limitType})`}function Lm(t,e){return e.isFoundDocument()&&(function(r,s){const i=s.key.path;return r.collectionGroup!==null?s.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(i):Le.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)})(t,e)&&(function(r,s){for(const i of Ku(r))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0})(t,e)&&(function(r,s){for(const i of r.filters)if(!i.matches(s))return!1;return!0})(t,e)&&(function(r,s){return!(r.startAt&&!(function(a,c,u){const d=Kb(a,c,u);return a.inclusive?d<=0:d<0})(r.startAt,Ku(r),s)||r.endAt&&!(function(a,c,u){const d=Kb(a,c,u);return a.inclusive?d>=0:d>0})(r.endAt,Ku(r),s))})(t,e)}function Vj(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function v2(t){return(e,n)=>{let r=!1;for(const s of Ku(t)){const i=Uj(s,e,n);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function Uj(t,e,n){const r=t.field.isKeyField()?Le.comparator(e.key,n.key):(function(i,a,c){const u=a.data.field(i),d=c.data.field(i);return u!==null&&d!==null?hc(u,d):ze(42886)})(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return ze(19790,{direction:t.dir})}}/**
1503 * @license
1504 * Copyright 2017 Google LLC
1505 *
1506 * Licensed under the Apache License, Version 2.0 (the "License");
1507 * you may not use this file except in compliance with the License.
1508 * You may obtain a copy of the License at
1509 *
1510 *   http://www.apache.org/licenses/LICENSE-2.0
1511 *
1512 * Unless required by applicable law or agreed to in writing, software
1513 * distributed under the License is distributed on an "AS IS" BASIS,
1514 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515 * See the License for the specific language governing permissions and
1516 * limitations under the License.
1517 */class Qa{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[s,i]of r)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),s=this.inner[r];if(s===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let i=0;i<s.length;i++)if(this.equalsFn(s[i][0],e))return void(s[i]=[e,n]);s.push([e,n]),this.innerSize++}delete(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r===void 0)return!1;for(let s=0;s<r.length;s++)if(this.equalsFn(r[s][0],e))return r.length===1?delete this.inner[n]:r.splice(s,1),this.innerSize--,!0;return!1}forEach(e){Go(this.inner,((n,r)=>{for(const[s,i]of r)e(s,i)}))}isEmpty(){return t2(this.inner)}size(){return this.innerSize}}/**
1518 * @license
1519 * Copyright 2017 Google LLC
1520 *
1521 * Licensed under the Apache License, Version 2.0 (the "License");
1522 * you may not use this file except in compliance with the License.
1523 * You may obtain a copy of the License at
1524 *
1525 *   http://www.apache.org/licenses/LICENSE-2.0
1526 *
1527 * Unless required by applicable law or agreed to in writing, software
1528 * distributed under the License is distributed on an "AS IS" BASIS,
1529 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1530 * See the License for the specific language governing permissions and
1531 * limitations under the License.
1532 */const $j=new Kt(Le.comparator);function qi(){return $j}const _2=new Kt(Le.comparator);function Fu(...t){let e=_2;for(const n of t)e=e.insert(n.key,n);return e}function x2(t){let e=_2;return t.forEach(((n,r)=>e=e.insert(n,r.overlayedDocument))),e}function Pa(){return Yu()}function w2(){return Yu()}function Yu(){return new Qa((t=>t.toString()),((t,e)=>t.isEqual(e)))}const zj=new Kt(Le.comparator),Hj=new bn(Le.comparator);function st(...t){let e=Hj;for(const n of t)e=e.add(n);return e}const qj=new bn(rt);function Wj(){return qj}/**
1533 * @license
1534 * Copyright 2020 Google LLC
1535 *
1536 * Licensed under the Apache License, Version 2.0 (the "License");
1537 * you may not use this file except in compliance with the License.
1538 * You may obtain a copy of the License at
1539 *
1540 *   http://www.apache.org/licenses/LICENSE-2.0
1541 *
1542 * Unless required by applicable law or agreed to in writing, software
1543 * distributed under the License is distributed on an "AS IS" BASIS,
1544 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1545 * See the License for the specific language governing permissions and
1546 * limitations under the License.
1547 */function D_(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Bp(e)?"-0":e}}function E2(t){return{integerValue:""+t}}function Gj(t,e){return yj(e)?E2(e):D_(t,e)}/**
1548 * @license
1549 * Copyright 2018 Google LLC
1550 *
1551 * Licensed under the Apache License, Version 2.0 (the "License");
1552 * you may not use this file except in compliance with the License.
1553 * You may obtain a copy of the License at
1554 *
1555 *   http://www.apache.org/licenses/LICENSE-2.0
1556 *
1557 * Unless required by applicable law or agreed to in writing, software
1558 * distributed under the License is distributed on an "AS IS" BASIS,
1559 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1560 * See the License for the specific language governing permissions and
1561 * limitations under the License.
1562 */class Fm{constructor(){this._=void 0}}function Kj(t,e,n){return t instanceof Hp?(function(s,i){const a={fields:{[s2]:{stringValue:r2},[o2]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&S_(i)&&(i=Nm(i)),i&&(a.fields[i2]=i),{mapValue:a}})(n,e):t instanceof gd?A2(t,e):t instanceof yd?T2(t,e):(function(s,i){const a=b2(s,i),c=Xb(a)+Xb(s.Ae);return iv(a)&&iv(s.Ae)?E2(c):D_(s.serializer,c)})(t,e)}function Yj(t,e,n){return t instanceof gd?A2(t,e):t instanceof yd?T2(t,e):n}function b2(t,e){return t instanceof qp?(function(r){return iv(r)||(function(i){return!!i&&"doubleValue"in i})(r)})(e)?e:{integerValue:0}:null}class Hp extends Fm{}class gd extends Fm{constructor(e){super(),this.elements=e}}function A2(t,e){const n=C2(e);for(const r of t.elements)n.some((s=>ai(s,r)))||n.push(r);return{arrayValue:{values:n}}}class yd extends Fm{constructor(e){super(),this.elements=e}}function T2(t,e){let n=C2(e);for(const r of t.elements)n=n.filter((s=>!ai(s,r)));return{arrayValue:{values:n}}}class qp extends Fm{constructor(e,n){super(),this.serializer=e,this.Ae=n}}function Xb(t){return an(t.integerValue||t.doubleValue)}function C2(t){return k_(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}function Qj(t,e){return t.field.isEqual(e.field)&&(function(r,s){return r instanceof gd&&s instanceof gd||r instanceof yd&&s instanceof yd?dc(r.elements,s.elements,ai):r instanceof qp&&s instanceof qp?ai(r.Ae,s.Ae):r instanceof Hp&&s instanceof Hp})(t.transform,e.transform)}class Jj{constructor(e,n){this.version=e,this.transformResults=n}}class fs{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new fs}static exists(e){return new fs(void 0,e)}static updateTime(e){return new fs(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Vf(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class jm{}function S2(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new N_(t.key,fs.none()):new Od(t.key,t.data,fs.none());{const n=t.data,r=Pr.empty();let s=new bn(Gn.comparator);for(let i of e.fields)if(!s.has(i)){let a=n.field(i);a===null&&i.length>1&&(i=i.popLast(),a=n.field(i)),a===null?r.delete(i):r.set(i,a),s=s.add(i)}return new Ko(t.key,r,new Kr(s.toArray()),fs.none())}}function Xj(t,e,n){t instanceof Od?(function(s,i,a){const c=s.value.clone(),u=eA(s.fieldTransforms,i,a.transformResults);c.setAll(u),i.convertToFoundDocument(a.version,c).setHasCommittedMutations()})(t,e,n):t instanceof Ko?(function(s,i,a){if(!Vf(s.precondition,i))return void i.convertToUnknownDocument(a.version);const c=eA(s.fieldTransforms,i,a.transformResults),u=i.data;u.setAll(k2(s)),u.setAll(c),i.convertToFoundDocument(a.version,u).setHasCommittedMutations()})(t,e,n):(function(s,i,a){i.convertToNoDocument(a.version).setHasCommittedMutations()})(0,e,n)}function Qu(t,e,n,r){return t instanceof Od?(function(i,a,c,u){if(!Vf(i.precondition,a))return c;const d=i.value.clone(),f=tA(i.fieldTransforms,u,a);return d.setAll(f),a.convertToFoundDocument(a.version,d).setHasLocalMutations(),null})(t,e,n,r):t instanceof Ko?(function(i,a,c,u){if(!Vf(i.precondition,a))return c;const d=tA(i.fieldTransforms,u,a),f=a.data;return f.setAll(k2(i)),f.setAll(d),a.convertToFoundDocument(a.version,f).setHasLocalMutations(),c===null?null:c.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map((g=>g.field)))})(t,e,n,r):(function(i,a,c){return Vf(i.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):c})(t,e,n)}function Zj(t,e){let n=null;for(const r of t.fieldTransforms){const s=e.data.field(r.field),i=b2(r.transform,s||null);i!=null&&(n===null&&(n=Pr.empty()),n.set(r.field,i))}return n||null}function Zb(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!(function(r,s){return r===void 0&&s===void 0||!(!r||!s)&&dc(r,s,((i,a)=>Qj(i,a)))})(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class Od extends jm{constructor(e,n,r,s=[]){super(),this.key=e,this.value=n,this.prec
vendor: 4,148 bytes, lines 1562-1605
1562ondition=r,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class Ko extends jm{constructor(e,n,r,s,i=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function k2(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function eA(t,e,n){const r=new Map;yt(t.length===n.length,32656,{Ve:n.length,de:t.length});for(let s=0;s<n.length;s++){const i=t[s],a=i.transform,c=e.data.field(i.field);r.set(i.field,Yj(a,c,n[s]))}return r}function tA(t,e,n){const r=new Map;for(const s of t){const i=s.transform,a=n.data.field(s.field);r.set(s.field,Kj(i,a,e))}return r}class N_ extends jm{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class eM extends jm{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
1563 * @license
1564 * Copyright 2017 Google LLC
1565 *
1566 * Licensed under the Apache License, Version 2.0 (the "License");
1567 * you may not use this file except in compliance with the License.
1568 * You may obtain a copy of the License at
1569 *
1570 *   http://www.apache.org/licenses/LICENSE-2.0
1571 *
1572 * Unless required by applicable law or agreed to in writing, software
1573 * distributed under the License is distributed on an "AS IS" BASIS,
1574 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1575 * See the License for the specific language governing permissions and
1576 * limitations under the License.
1577 */class tM{constructor(e,n,r,s){this.batchId=e,this.localWriteTime=n,this.baseMutations=r,this.mutations=s}applyToRemoteDocument(e,n){const r=n.mutationResults;for(let s=0;s<this.mutations.length;s++){const i=this.mutations[s];i.key.isEqual(e.key)&&Xj(i,e,r[s])}}applyToLocalView(e,n){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(n=Qu(r,e,n,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(n=Qu(r,e,n,this.localWriteTime));return n}applyToLocalDocumentSet(e,n){const r=w2();return this.mutations.forEach((s=>{const i=e.get(s.key),a=i.overlayedDocument;let c=this.applyToLocalView(a,i.mutatedFields);c=n.has(s.key)?null:c;const u=S2(a,c);u!==null&&r.set(s.key,u),a.isValidDocument()||a.convertToNoDocument(Ge.min())})),r}keys(){return this.mutations.reduce(((e,n)=>e.add(n.key)),st())}isEqual(e){return this.batchId===e.batchId&&dc(this.mutations,e.mutations,((n,r)=>Zb(n,r)))&&dc(this.baseMutations,e.baseMutations,((n,r)=>Zb(n,r)))}}class O_{constructor(e,n,r,s){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=s}static from(e,n,r){yt(e.mutations.length===r.length,58842,{me:e.mutations.length,fe:r.length});let s=(function(){return zj})();const i=e.mutations;for(let a=0;a<i.length;a++)s=s.insert(i[a].key,r[a].version);return new O_(e,n,r,s)}}/**
1578 * @license
1579 * Copyright 2022 Google LLC
1580 *
1581 * Licensed under the Apache License, Version 2.0 (the "License");
1582 * you may not use this file except in compliance with the License.
1583 * You may obtain a copy of the License at
1584 *
1585 *   http://www.apache.org/licenses/LICENSE-2.0
1586 *
1587 * Unless required by applicable law or agreed to in writing, software
1588 * distributed under the License is distributed on an "AS IS" BASIS,
1589 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1590 * See the License for the specific language governing permissions and
1591 * limitations under the License.
1592 */class nM{constructor(e,n){this.largestBatchId=e,this.mutation=n}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
1593      largestBatchId: ${this.largestBatchId},
1594      mutation: ${this.mutation.toString()}
1595    }`}}/**
1596 * @license
1597 * Copyright 2017 Google LLC
1598 *
1599 * Licensed under the Apache License, Version 2.0 (the "License");
1600 * you may not use this file except in compliance with the License.
1601 * You may obtain a copy of the License at
1602 *
1603 *   http://www.apache.org/licenses/LICENSE-2.0
1604 *
1605 * Unless required by applicable law or agreed to in writing, softw
1605are
1606 * distributed under the License is distributed on an "AS IS" BASIS,
1607 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1608 * See the License for the specific language governing permissions and
1609 * limitations under the License.
1610 */class rM{constructor(e,n){this.count=e,this.unchangedNames=n}}/**
1611 * @license
1612 * Copyright 2017 Google LLC
1613 *
1614 * Licensed under the Apache License, Version 2.0 (the "License");
1615 * you may not use this file except in compliance with the License.
1616 * You may obtain a copy of the License at
1617 *
1618 *   http://www.apache.org/licenses/LICENSE-2.0
1619 *
1620 * Unless required by applicable law or agreed to in writing, software
1621 * distributed under the License is distributed on an "AS IS" BASIS,
1622 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1623 * See the License for the specific language governing permissions and
1624 * limitations under the License.
1625 */var dn,at;function sM(t){switch(t){case ce.OK:return ze(64938);case ce.CANCELLED:case ce.UNKNOWN:case ce.DEADLINE_EXCEEDED:case ce.RESOURCE_EXHAUSTED:case ce.INTERNAL:case ce.UNAVAILABLE:case ce.UNAUTHENTICATED:return!1;case ce.INVALID_ARGUMENT:case ce.NOT_FOUND:case ce.ALREADY_EXISTS:case ce.PERMISSION_DENIED:case ce.FAILED_PRECONDITION:case ce.ABORTED:case ce.OUT_OF_RANGE:case ce.UNIMPLEMENTED:case ce.DATA_LOSS:return!0;default:return ze(15467,{code:t})}}function I2(t){if(t===void 0)return Hi("GRPC error has no .code"),ce.UNKNOWN;switch(t){case dn.OK:return ce.OK;case dn.CANCELLED:return ce.CANCELLED;case dn.UNKNOWN:return ce.UNKNOWN;case dn.DEADLINE_EXCEEDED:return ce.DEADLINE_EXCEEDED;case dn.RESOURCE_EXHAUSTED:return ce.RESOURCE_EXHAUSTED;case dn.INTERNAL:return ce.INTERNAL;case dn.UNAVAILABLE:return ce.UNAVAILABLE;case dn.UNAUTHENTICATED:return ce.UNAUTHENTICATED;case dn.INVALID_ARGUMENT:return ce.INVALID_ARGUMENT;case dn.NOT_FOUND:return ce.NOT_FOUND;case dn.ALREADY_EXISTS:return ce.ALREADY_EXISTS;case dn.PERMISSION_DENIED:return ce.PERMISSION_DENIED;case dn.FAILED_PRECONDITION:return ce.FAILED_PRECONDITION;case dn.ABORTED:return ce.ABORTED;case dn.OUT_OF_RANGE:return ce.OUT_OF_RANGE;case dn.UNIMPLEMENTED:return ce.UNIMPLEMENTED;case dn.DATA_LOSS:return ce.DATA_LOSS;default:return ze(39323,{code:t})}}(at=dn||(dn={}))[at.OK=0]="OK",at[at.CANCELLED=1]="CANCELLED",at[at.UNKNOWN=2]="UNKNOWN",at[at.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",at[at.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",at[at.NOT_FOUND=5]="NOT_FOUND",at[at.ALREADY_EXISTS=6]="ALREADY_EXISTS",at[at.PERMISSION_DENIED=7]="PERMISSION_DENIED",at[at.UNAUTHENTICATED=16]="UNAUTHENTICATED",at[at.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",at[at.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",at[at.ABORTED=10]="ABORTED",at[at.OUT_OF_RANGE=11]="OUT_OF_RANGE",at[at.UNIMPLEMENTED=12]="UNIMPLEMENTED",at[at.INTERNAL=13]="INTERNAL",at[at.UNAVAILABLE=14]="UNAVAILABLE",at[at.DATA_LOSS=15]="DATA_LOSS";/**
1626 * @license
1627 * Copyright 2023 Google LLC
1628 *
1629 * Licensed under the Apache License, Version 2.0 (the "License");
1630 * you may not use this file except in compliance with the License.
1631 * You may obtain a copy of the License at
1632 *
1633 *   http://www.apache.org/licenses/LICENSE-2.0
1634 *
1635 * Unless required by applicable law or agreed to in writing, software
1636 * distributed under the License is distributed on an "AS IS" BASIS,
1637 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1638 * See the License for the specific language governing permissions and
1639 * limitations under the License.
1640 */function iM(){return new TextEncoder}/**
1641 * @license
1642 * Copyright 2022 Google LLC
1643 *
1644 * Licensed under the Apache License, Version 2.0 (the "License");
1645 * you may not use this file except in compliance with the License.
1646 * You may obtain a copy of the License at
1647 *
1648 *   http://www.apache.org/licenses/LICENSE-2.0
1649 *
1650 * Unless required by applicable law or agreed to in writing, software
1651 * distributed under the License is distributed on an "AS IS" BASIS,
1652 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1653 * See the License for the specific language governing permissions and
1654 * limitations under the License.
1655 */const oM=new Oo([4294967295,4294967295],0);function nA(t){const e=iM().encode(t),n=new Hk;return n.update(e),new Uint8Array(n.digest())}function rA(t){const e=new DataView(t.buffer),n=e.getUint32(0,!0),r=e.getUint32(4,!0),s=e.getUint32(8,!0),i=e.getUint32(12,!0);
vendor: 8,856 bytes, lines 1655-1685
1655return[new Oo([n,r],0),new Oo([s,i],0)]}class L_{constructor(e,n,r){if(this.bitmap=e,this.padding=n,this.hashCount=r,n<0||n>=8)throw new ju(`Invalid padding: ${n}`);if(r<0)throw new ju(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new ju(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new ju(`Invalid padding when bitmap length is 0: ${n}`);this.ge=8*e.length-n,this.pe=Oo.fromNumber(this.ge)}ye(e,n,r){let s=e.add(n.multiply(Oo.fromNumber(r)));return s.compare(oM)===1&&(s=new Oo([s.getBits(0),s.getBits(1)],0)),s.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.ge===0)return!1;const n=nA(e),[r,s]=rA(n);for(let i=0;i<this.hashCount;i++){const a=this.ye(r,s,i);if(!this.we(a))return!1}return!0}static create(e,n,r){const s=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),a=new L_(i,s,n);return r.forEach((c=>a.insert(c))),a}insert(e){if(this.ge===0)return;const n=nA(e),[r,s]=rA(n);for(let i=0;i<this.hashCount;i++){const a=this.ye(r,s,i);this.be(a)}}be(e){const n=Math.floor(e/8),r=e%8;this.bitmap[n]|=1<<r}}class ju extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
1656 * @license
1657 * Copyright 2017 Google LLC
1658 *
1659 * Licensed under the Apache License, Version 2.0 (the "License");
1660 * you may not use this file except in compliance with the License.
1661 * You may obtain a copy of the License at
1662 *
1663 *   http://www.apache.org/licenses/LICENSE-2.0
1664 *
1665 * Unless required by applicable law or agreed to in writing, software
1666 * distributed under the License is distributed on an "AS IS" BASIS,
1667 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1668 * See the License for the specific language governing permissions and
1669 * limitations under the License.
1670 */class Mm{constructor(e,n,r,s,i){this.snapshotVersion=e,this.targetChanges=n,this.targetMismatches=r,this.documentUpdates=s,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,n,r){const s=new Map;return s.set(e,Ld.createSynthesizedTargetChangeForCurrentChange(e,n,r)),new Mm(Ge.min(),s,new Kt(rt),qi(),st())}}class Ld{constructor(e,n,r,s,i){this.resumeToken=e,this.current=n,this.addedDocuments=r,this.modifiedDocuments=s,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,n,r){return new Ld(r,n,st(),st(),st())}}/**
1671 * @license
1672 * Copyright 2017 Google LLC
1673 *
1674 * Licensed under the Apache License, Version 2.0 (the "License");
1675 * you may not use this file except in compliance with the License.
1676 * You may obtain a copy of the License at
1677 *
1678 *   http://www.apache.org/licenses/LICENSE-2.0
1679 *
1680 * Unless required by applicable law or agreed to in writing, software
1681 * distributed under the License is distributed on an "AS IS" BASIS,
1682 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1683 * See the License for the specific language governing permissions and
1684 * limitations under the License.
1685 */class Uf{constructor(e,n,r,s){this.Se=e,this.removedTargetIds=n,this.key=r,this.De=s}}class P2{constructor(e,n){this.targetId=e,this.Ce=n}}class R2{constructor(e,n,r=Kn.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=n,this.resumeToken=r,this.cause=s}}class sA{constructor(){this.ve=0,this.Fe=iA(),this.Me=Kn.EMPTY_BYTE_STRING,this.xe=!1,this.Oe=!0}get current(){return this.xe}get resumeToken(){return this.Me}get Ne(){return this.ve!==0}get Be(){return this.Oe}Le(e){e.approximateByteSize()>0&&(this.Oe=!0,this.Me=e)}ke(){let e=st(),n=st(),r=st();return this.Fe.forEach(((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:n=n.add(s);break;case 1:r=r.add(s);break;default:ze(38017,{changeType:i})}})),new Ld(this.Me,this.xe,e,n,r)}Ke(){this.Oe=!1,this.Fe=iA()}qe(e,n){this.Oe=!0,this.Fe=this.Fe.insert(e,n)}Ue(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}$e(){this.ve+=1}We(){this.ve-=1,yt(this.ve>=0,3241,{ve:this.ve})}Qe(){this.Oe=!0,this.xe=!0}}class aM{constructor(e){this.Ge=e,this.ze=new Map,this.je=qi(),this.He=gf(),this.Je=gf(),this.Ze=new Kt(rt)}Xe(e){for(const n of e.Se)e.De&&e.De.isFoundDocument()?this.Ye(n,e.De):this.et(n,e.key,e.De);for(const n of e.removedTargetIds)this.et(n,e.key,e.De)}tt(e){this.forEachTarget(e,(n=>{const r=this.nt(n);switch(e.state){case 0:this.rt(n)&&r.Le(e.resumeToken);break;case 1:r.We(),r.Ne||r.Ke(),r.Le(e.resumeToken);break;case 2:r.We(),r.Ne||this.removeTarget(n);break;case 3:this.rt(n)&&(r.Qe(),r.Le(e.resumeToken));break;case 4:this.rt(n)&&(this.it(n),r.Le(e.resumeToken));break;default:ze(56790,{state:e.state})}}))}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ze.forEach(((r,s)=>{this.rt(s)&&n(s)}))}st(e){const n=e.targetId,r=e.Ce.count,s=this.ot(n);if(s){const i=s.target;if(av(i))if(r===0){const a=new Le(i.path);this.et(n,a,or.newNoDocument(a,Ge.min()))}else yt(r===1,20013,{expectedCount:r});else{const a=this._t(n);if(a!==r){const c=this.ut(e),u=c?this.ct(c,e,a):1;if(u!==0){this.it(n);const d=u===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ze=this.Ze.insert(n,d)}}}}}ut(e){const n=e.Ce.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=n;let a,c;try{a=Uo(r).toUint8Array()}catch(u){if(u instanceof n2)return Ua("Decoding the base64 bloom filter in existence filter failed ("+u.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw u}try{c=new L_(a,s,i)}catch(u){return Ua(u instanceof ju?"BloomFilter error: ":"Applying bloom filter failed: ",u),null}return c.ge===0?null:c}ct(e,n,r){return n.Ce.count===r-this.Pt(e,n.targetId)?0:2}Pt(e,n){const r=this.Ge.getRemoteKeysForTarget(n);let s=0;return r.forEach((i=>{const a=this.Ge.ht(),c=`projects/${a.projectId}/databases/${a.database}/documents/${i.path.canonicalString()}`;e.mightContain(c)||(this.et(n,i,null),s++)})),s}Tt(e){const n=new Map;this.ze.forEach(((i,a)=>{const c=this.ot(a);if(c){if(i.current&&av(c.target)){const u=new Le(c.target.path);this.It(u).has(a)||this.Et(a,u)||this.et(a,u,or.newNoDocument(u,e))}i.Be&&(n.set(a,i.ke()),i.Ke())}}));let r=st();this.Je.forEach(((i,a)=>{let c=!0;a.forEachWhile((u=>{const d=this.ot(u);return!d||d.purpose==="TargetPurposeLimboResolution"||(c=!1,!1)})),c&&(r=r.add(i))})),this.je.forEach(((i,a)=>a.setReadTime(e)));const s=new Mm(e,n,this.Ze,this.je,r);return this.je=qi(),this.He=gf(),this.Je=gf(),this.Ze=new Kt(rt),s}Ye(e,n){if(!this.rt(e))return;const r=this.Et(e,n.key)?2:0;this.nt(e).qe(n.key,r),this.je=this.je.insert(n.key,n),this.He=this.He.insert(n.key,this.It(n.key).add(e)),this.Je=this.Je.insert(n.key,this.Rt(n.key).add(e))}et(e,n,r){if(!this.rt(e))return;const s=this.nt(e);this.Et(e,n)?s.qe(n,1):s.Ue(n),this.Je=this.Je.insert(n,this.Rt(n).delete(e)),this.Je=this.Je.insert(n,this.Rt(n).add(e)),r&&(this.je=this.je.insert(n,r))}removeTarget(e){this.ze.delete(e)}_t(e){const n=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}$e(e){this.nt(e).$e()}nt(e){let n=this.ze.get(e);return n||(n=new sA,this.ze.set(e,n)),n}Rt(e){let n=this.Je.get(e);return n||(n=new bn(rt),this.Je=this.Je.insert(e,n)),n}It(e){let n=this.He.get(e);return n||(n=new bn(rt),this.He=this.He.insert(e,n)),n}rt(e){const n=this.ot(e)!==null;return n||Te("WatchChangeAggregator","Detected inactive target",e),n}ot(e){const n=this.ze.get(e);return n&&n.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new sA),this.Ge.getRemoteKeysForTarget(e).forEach((n=>{this.et(e,n,null)}))}Et(e,n){return this.Ge.getRemoteKeysForTarget(e).has(n)}}function gf(){return new Kt(Le.comparator)}function iA(){return new Kt(Le.comparator)}const lM={asc:"ASCENDING",desc:"DESCENDING"},cM={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},uM={and:"AND",or:"OR"};class dM{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function cv(t,e){return t.useProto3Json||Dm(e)?e:{value:e}}function Wp(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function D2(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function hM(t,e){return Wp(t,e.toTimestamp())}function ri(t){return yt(!!t,49232),Ge.fromTimestamp((function(n){const r=Vo(n);return new Bt(r.seconds,r.nanos)})(t))}function F_(t,e){return uv(t,e).canonicalString()}function uv(t,e){const n=(function(s){return new Dt(["projects",s.projectId,"databases",s.database])})(t).child("documents");return e===void 0?n:n.child(e)}function N2(t){const e=Dt.fromString(t);return yt(M2(e),10190,{key:e.toString()}),e}function dv(t,e){return F_(t.databaseId,e.path)}function Zg(t,e){const n=N2(e);
vendor: 4,471 bytes, line 1685
1685if(n.get(1)!==t.databaseId.projectId)throw new be(ce.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new be(ce.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new Le(L2(n))}function O2(t,e){return F_(t.databaseId,e)}function fM(t){const e=N2(t);return e.length===4?Dt.emptyPath():L2(e)}function hv(t){return new Dt(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function L2(t){return yt(t.length>4&&t.get(4)==="documents",29091,{key:t.toString()}),t.popFirst(5)}function oA(t,e,n){return{name:dv(t,e),fields:n.value.mapValue.fields}}function pM(t,e){let n;if("targetChange"in e){e.targetChange;const r=(function(d){return d==="NO_CHANGE"?0:d==="ADD"?1:d==="REMOVE"?2:d==="CURRENT"?3:d==="RESET"?4:ze(39313,{state:d})})(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=(function(d,f){return d.useProto3Json?(yt(f===void 0||typeof f=="string",58123),Kn.fromBase64String(f||"")):(yt(f===void 0||f instanceof Buffer||f instanceof Uint8Array,16193),Kn.fromUint8Array(f||new Uint8Array))})(t,e.targetChange.resumeToken),a=e.targetChange.cause,c=a&&(function(d){const f=d.code===void 0?ce.UNKNOWN:I2(d.code);return new be(f,d.message||"")})(a);n=new R2(r,s,i,c||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=Zg(t,r.document.name),i=ri(r.document.updateTime),a=r.document.createTime?ri(r.document.createTime):Ge.min(),c=new Pr({mapValue:{fields:r.document.fields}}),u=or.newFoundDocument(s,i,a,c),d=r.targetIds||[],f=r.removedTargetIds||[];n=new Uf(d,f,u.key,u)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=Zg(t,r.document),i=r.readTime?ri(r.readTime):Ge.min(),a=or.newNoDocument(s,i),c=r.removedTargetIds||[];n=new Uf([],c,a.key,a)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=Zg(t,r.document),i=r.removedTargetIds||[];n=new Uf([],i,s,null)}else{if(!("filter"in e))return ze(11601,{Vt:e});{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,a=new rM(s,i),c=r.targetId;n=new P2(c,a)}}return n}function mM(t,e){let n;if(e instanceof Od)n={update:oA(t,e.key,e.value)};else if(e instanceof N_)n={delete:dv(t,e.key)};else if(e instanceof Ko)n={update:oA(t,e.key,e.data),updateMask:AM(e.fieldMask)};else{if(!(e instanceof eM))return ze(16599,{dt:e.type});n={verify:dv(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((r=>(function(i,a){const c=a.transform;if(c instanceof Hp)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(c instanceof gd)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:c.elements}};if(c instanceof yd)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:c.elements}};if(c instanceof qp)return{fieldPath:a.field.canonicalString(),increment:c.Ae};throw ze(20930,{transform:a.transform})})(0,r)))),e.precondition.isNone||(n.currentDocument=(function(s,i){return i.updateTime!==void 0?{updateTime:hM(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:ze(27497)})(t,e.precondition)),n}function gM(t,e){return t&&t.length>0?(yt(e!==void 0,14353),t.map((n=>(function(s,i){let a=s.updateTime?ri(s.updateTime):ri(i);return a.isEqual(Ge.min())&&(a=ri(i)),new Jj(a,s.transformResults||[])})(n,e)))):[]}function yM(t,e){return{documents:[O2(t,e.path)]}}function vM(t,e){const n={structuredQuery:{}},r=e.path;let s;e.collectionGroup!==null?(s=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=O2(t,s);const i=(function(d){if(d.length!==0)return j2(Ns.create(d,"and"))})(e.filters);i&&(n.structuredQuery.where=i);const a=(function(d){if(d.length!==0)return d.map((f=>(function(y){return{field:ql(y.field),direction:wM(y.dir)}})(f)))})(e.orderBy);a&&(n.structuredQuery.orderBy=a);const c=cv(t,e.limit);return c!==null&&(n.structuredQuery.limit=c),e.startAt&&(n.structuredQuery.startAt=(function(d){return{before:d.inclusive,values:d.position}})(e.startAt)),e.endAt&&(n.structuredQuery.endAt=(function(d){return{before:!d.inclusive,values:d.position}})(e.endAt)),{ft:n,parent:s}}function _M(t){let e=fM(t.parent);
1685const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){yt(r===1,65062);const f=n.from[0];f.allDescendants?s=f.collectionId:e=e.child(f.collectionId)}let i=[];n.where&&(i=(function(g){const y=F2(g);return y instanceof Ns&&h2(y)?y.getFilters():[y]})(n.where));let a=[];n.orderBy&&(a=(function(g){return g.map((y=>(function(b){return new md(Wl(b.field),(function(w){switch(w){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(b.direction))})(y)))})(n.orderBy));let c=null;n.limit&&(c=(function(g){let y;return y=typeof g=="object"?g.value:g,Dm(y)?null:y})(n.limit));let u=null;n.startAt&&(u=(function(g){const y=!!g.before,x=g.values||[];return new $p(x,y)})(n.startAt));let d=null;return n.endAt&&(d=(function(g){const y=!g.before,x=g.values||[];return new $p(x,y)})(n.endAt)),Fj(e,s,a,i,c,"F",u,d)}function xM(t,e){const n=(function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return ze(28987,{purpose:s})}})(e.purpose);return n==null?null:{"goog-listen-tags":n}}function F2(t){return t.unaryFilter!==void 0?(function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=Wl(n.unaryFilter.field);return fn.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=Wl(n.unaryFilter.field);return fn.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=Wl(n.unaryFilter.field);return fn.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const a=Wl(n.unaryFilter.field);return fn.create(a,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return ze(61313);default:return ze(60726)}})(t):t.fieldFilter!==void 0?(function(n){return fn.create(Wl(n.fieldFilter.field),(function(s){switch(s){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return ze(58110);default:return ze(50506)}})(n.fieldFilter.op),n.fieldFilter.value)})(t):t.compositeFilter!==void 0?(function(n){return Ns.create(n.compositeFilter.filters.map((r=>F2(r))),(function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return ze(1026)}})(n.compositeFilter.op))})(t):ze(30097,{filter:t})}function wM(t){return lM[t]}function EM(t){return cM[t]}function bM(t){return uM[t]}function ql(t){return{fieldPath:t.canonicalString()}}function Wl(t){return Gn.fromServerFormat(t.fieldPath)}function j2(t){return t instanceof fn?(function(n){if(n.op==="=="){if(Gb(n.value))return{unaryFilter:{field:ql(n.field),op:"IS_NAN"}};if(Wb(n.value))return{unaryFilter:{field:ql(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(Gb(n.value))return{unaryFilter:{field:ql(n.field),op:"IS_NOT_NAN"}};if(Wb(n.value))return{unaryFilter:{field:ql(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:ql(n.field),op:EM(n.op),value:n.value}}})(t):t instanceof Ns?(function(n){const r=n.getFilters().map((s=>j2(s)));return r.length===1?r[0]:{compositeFilter:{op:bM(n.op),filters:r}}})(t):ze(54877,{filter:t})}function AM(t){const e=[];return t.fields.forEach((n=>e.push(n.canonicalString()))),{fieldPaths:e}}function M2(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}function B2(t){return!!t&&typeof t._toProto=="function"&&t._protoValueType==="ProtoValue"}/**
1686 * @license
1687 * Copyright 2017 Google LLC
1688 *
1689 * Licensed under the Apache License, Version 2.0 (the "License");
1690 * you may not use this file except in compliance with the License.
1691 * You may obtain a copy of the License at
1692 *
1693 *   http://www.apache.org/licenses/LICENSE-2.0
1694 *
1695 * Unless required by applicable law or agreed to in writing, software
1696 * distributed under the License is distributed on an "AS IS" BASIS,
1697 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1698 * See the License for the specific language governing permissions and
1699 * limitations under the License.
1700 */class Ro{constructor(e,n,r,s,i=Ge.min(),a=Ge.min(),c=Kn.EMPTY_BYTE_STRING,u=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=c,this.expectedCount=u}withSequenceNumber(e){return new Ro(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new Ro(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Ro(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Ro(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
1701 * @license
1702 * Copyright 2017 Google LLC
1703 *
1704 * Licensed under the Apache License, Version 2.0 (the "License");
1705 * you may not use this file except in compliance with the License.
1706 * You may obtain a copy of the License at
1707 *
1708 *   http://www.apache.org/licenses/LICENSE-2.0
1709 *
1710 * Unless required by applicable law or agreed to in writing, software
1711 * distributed under the License is distributed on an "AS IS" BASIS,
1712 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1713 * See the License for the specific language governing permissions and
1714 * limitations under the License.
1715 */class TM{constructor(e){this.yt=e}}function CM(t){const e=_M({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?zp(e,e.limit,"L"):e}/**
1716 * @license
1717 * Copyright 2019 Google LLC
1718 *
1719 * Licensed under the Apache License, Version 2.0 (the "License");
1720 * you may not use this file except in compliance with the License.
1721 * You may obtain a copy of the License at
1722 *
1723 *   http://www.apache.org/licenses/LICENSE-2.0
1724 *
1725 * Unless required by applicable law or agreed to in writing, software
1726 * distributed under the License is distributed on an "AS IS" BASIS,
1727 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1728 * See the License for the specific language governing permissions and
1729 * limitations under the License.
1730 */class SM{constructor(){this.Sn=new kM}addToCollectionParentIndex(e,n){return this.Sn.add(n),ue.resolve()}getCollectionParents(e,n){return ue.resolve(this.Sn.getEntries(n))}addFieldIndex(e,n){return ue.resolve()}deleteFieldIndex(e,n){return ue.resolve()}deleteAllFieldIndexes(e){return ue.resolve()}createTargetIndexes(e,n){return ue.resolve()}getDocumentsMatchingTarget(e,n){return ue.resolve(null)}getIndexType(e,n){return ue.resolve(0)}getFieldIndexes(e,n){return ue.resolve([])}getNextCollectionGroupToUpdate(e){return ue.resolve(null)}getMinOffset(e,n){return ue.resolve(Bo.min())}getMinOffsetFromCollectionGroup(e,n){return ue.resolve(Bo.min())}updateCollectionGroup(e,n,r){return ue.resolve()}updateIndexEntries(e,n){return ue.resolve()}}class kM{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n]||new bn(Dt.comparator),i=!s.has(r);return this.index[n]=s.add(r),i}has(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n];return s&&s.has(r)}getEntries(e){return(this.index[e]||new bn(Dt.comparator)).toArray()}}/**
1731 * @license
1732 * Copyright 2018 Google LLC
1733 *
1734 * Licensed under the Apache License, Version 2.0 (the "License");
1735 * you may not use this file except in compliance with the License.
1736 * You may obtain a copy of the License at
1737 *
1738 *   http://www.apache.org/licenses/LICENSE-2.0
1739 *
1740 * Unless required by applicable law or agreed to in writing, software
1741 * distributed under the License is distributed on an "AS IS" BASIS,
1742 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1743 * See the License for the specific language governing permissions and
1744 * limitations under the License.
1745 */const aA={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},V2=41943040;class kr{static withCacheSize(e){return new kr(e,kr.DEFAULT_COLLECTION_PERCENTILE,kr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,n,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}}/**
1746 * @license
1747 * Copyright 2017 Google LLC
1748 *
1749 * Licensed under the Apache License, Version 2.0 (the "License");
1750 * you may not use this file except in compliance with the License.
1751 * You may obtain a copy of the License at
1752 *
1753 *   http://www.apache.org/licenses/LICENSE-2.0
1754 *
1755 * Unless required by applicable law or agreed to in writing, software
1756 * distributed under the License is distributed on an "AS IS" BASIS,
1757 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1758 * See the License for the specific language governing permissions and
1759 * limitations under the License.
1760 */kr.DEFAULT_COLLECTION_PERCENTILE=10,kr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,kr.DEFAULT=new kr(V2,kr.DEFAULT_COLLECTION_PERCENTILE,kr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),kr.DISABLED=new kr(-1,0,0);/**
1761 * @license
1762 * Copyright 2017 Google LLC
1763 *
1764 * Licensed under the Apache License, Version 2.0 (the "License");
1765 * you may not use this file except in compliance with the License.
1766 * You may obtain a copy of the License at
1767 *
1768 *   http://www.apache.org/licenses/LICENSE-2.0
1769 *
1770 * Unless required by applicable law or agreed to in writing, software
1771 * distributed under the License is distributed on an "AS IS" BASIS,
1772 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1773 * See the License for the specific language governing permissions and
1774 * limitations under the License.
1775 */class pc{constructor(e){this.sr=e}next(){return this.sr+=2,this.sr}static _r(){return new pc(0)}static ar(){return new pc(-1)}}/**
1776 * @license
1777 * Copyright 2020 Google LLC
1778 *
1779 * Licensed under the Apache License, Version 2.0 (the "License");
1780 * you may not use this file except in compliance with the License.
1781 * You may obtain a copy of the License at
1782 *
1783 *   http://www.apache.org/licenses/LICENSE-2.0
1784 *
1785 * Unless required by applicable law or agreed to in writing, software
1786 * distributed under the License is distributed on an "AS IS" BASIS,
1787 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1788 * See the License for the specific language governing permissions and
1789 * limitations under the License.
1790 */const lA="LruGarbageCollector",IM=1048576;function cA([t,e],[n,r]){const s=rt(t,n);return s===0?rt(e,r):s}class PM{constructor(e){this.Pr=e,this.buffer=new bn(cA),this.Tr=0}Ir(){return++this.Tr}Er(e){const n=[e,this.Ir()];if(this.buffer.size<this.Pr)this.buffer=this.buffer.add(n);else{const r=this.buffer.last();cA(n,r)<0&&(this.buffer=this.buffer.delete(r).add(n))}}get maxValue(){return this.buffer.last()[0]}}class RM{constructor(e,n,r){this.garbageCollector=e,this.asyncQueue=n,this.localStore=r,this.Rr=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.Ar(6e4)}stop(){this.Rr&&(this.Rr.cancel(),this.Rr=null)}get started(){return this.Rr!==null}Ar(e){Te(lA,`Garbage collection scheduled in ${e}ms`),this.Rr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,(async()=>{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(n){Rc(n)?Te(lA,"Ignoring IndexedDB error during garbage collection: ",n):await Pc(n)}await this.Ar(3e5)}))}}class DM{constructor(e,n){this.Vr=e,this.params=n}calculateTargetCount(e,n){return this.Vr.dr(e).next((r=>Math.floor(n/100*r)))}nthSequenceNumber(e,n){if(n===0)return ue.resolve(Rm.ce);const r=new PM(n);return this.Vr.forEachTarget(e,(s=>r.Er(s.sequenceNumber))).next((()=>this.Vr.mr(e,(s=>r.Er(s))))).next((()=>r.maxValue))}removeTargets(e,n,r){return this.Vr.removeTargets(e,n,r)}removeOrphanedDocuments(e,n){return this.Vr.removeOrphanedDocuments(e,n)}collect(e,n){return this.params.cacheSizeCollectionThreshold===-1?(Te("LruGarbageCollector","Garbage collection skipped; disabled"),ue.resolve(aA)):this.getCacheSize(e).next((r=>r<this.params.cacheSizeCollectionThreshold?(Te("LruGarbageCollector",`Garbage collection skipped; Cache size ${r} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),aA):this.gr(e,n)))}getCacheSize(e){return this.Vr.getCacheSize(e)}gr(e,n){let r,s,i,a,c,u,d;const f=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((g=>(g>this.params.maximumSequenceNumbersToCollect?(Te("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${g}`),s=this.params.maximumSequenceNumbersToCollect):s=g,a=Date.now(),this.nthSequenceNumber(e,s)))).next((g=>(r=g,c=Date.now(),this.removeTargets(e,r,n)))).next((g=>(i=g,u=Date.now(),this.removeOrphanedDocuments(e,r)))).next((g=>(d=Date.now(),zl()<=nt.DEBUG&&Te("LruGarbageCollector",`LRU Garbage Collection
1791	Counted targets in ${a-f}ms
1792	Determined least recently used ${s} in `+(c-a)+`ms
1793	Removed ${i} targets in `+(u-c)+`ms
1794	Removed ${g} documents in `+(d-u)+`ms
1795Total Duration: ${d-f}ms`),ue.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:g}))))}}function NM(t,e){return new DM(t,e)}/**
1796 * @license
1797 * Copyright 2017 Google LLC
1798 *
1799 * Licensed under the Apache License, Version 2.0 (the "License");
1800 * you may not use this file except in compliance with the License.
1801 * You may obtain a copy of the License at
1802 *
1803 *   http://www.apache.org/licenses/LICENSE-2.0
1804 *
1805 * Unless required by applicable law or agreed to in writing, software
1806 * distributed under the License is distributed on an "AS IS" BASIS,
1807 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1808 * See the License for the specific language governing permissions and
1809 * limitations under the License.
1810 */class OM{constructor(){this.changes=new Qa((e=>e.toString()),((e,n)=>e.isEqual(n))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,n){this.assertNotApplied(),this.changes.set(e,or.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?ue.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
1811 * @license
1812 * Copyright 2017 Google LLC
1813 *
1814 * Licensed under the Apache License, Version 2.0 (the "License");
1815 * you may not use this file except in compliance with the License.
1816 * You may obtain a copy of the License at
1817 *
1818 *   http://www.apache.org/licenses/LICENSE-2.0
1819 *
1820 * Unless required by applicable law or agreed to in writing, software
1821 * distributed under the License is distributed on an "AS IS" BASIS,
1822 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1823 * See the License for the specific language governing permissions and
1824 * limitations under the License.
1825 *//**
1826 * @license
1827 * Copyright 2022 Google LLC
1828 *
1829 * Licensed under the Apache License, Version 2.0 (the "License");
1830 * you may not use this file except in compliance with the License.
1831 * You may obtain a copy of the License at
1832 *
1833 *   http://www.apache.org/licenses/LICENSE-2.0
1834 *
1835 * Unless required by applicable law or agreed to in writing, software
1836 * distributed under the License is distributed on an "AS IS" BASIS,
1837 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1838 * See the License for the specific language governing permissions and
1839 * limitations under the License.
1840 */class LM{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/**
1841 * @license
1842 * Copyright 2017 Google LLC
1843 *
1844 * Licensed under the Apache License, Version 2.0 (the "License");
1845 * you may not use this file except in compliance with the License.
1846 * You may obtain a copy of the License at
1847 *
1848 *   http://www.apache.org/licenses/LICENSE-2.0
1849 *
1850 * Unless required by applicable law or agreed to in writing, software
1851 * distributed under the License is distributed on an "AS IS" BASIS,
1852 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1853 * See the License for the specific language governing permissions and
1854 * limitations under the License.
1855 */class FM{constructor(e,n,r,s){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=s}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next((s=>(r=s,this.remoteDocumentCache.getEntry(e,n)))).next((s=>(r!==null&&Qu(r.mutation,s,Kr.empty(),Bt.now()),s)))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next((r=>this.getLocalViewOfDocuments(e,r,st()).next((()=>r))))}getLocalViewOfDocuments(e,n,r=st()){const s=Pa();return this.populateOverlays(e,s,n).next((()=>this.computeViews(e,n,s,r).next((i=>{let a=Fu();return i.forEach(((c,u)=>{a=a.insert(c,u.overlayedDocument)})),a}))))}getOverlayedDocuments(e,n){const r=Pa();return this.populateOverlays(e,r,n).next((()=>this.computeViews(e,n,r,st())))}populateOverlays(e,n,r){const s=[];return r.forEach((i=>{n.has(i)||s.push(i)})),this.documentOverlayCache.getOverlays(e,s).next((i=>{i.forEach(((a,c)=>{n.set(a,c)}))}))}computeViews(e,n,r,s){let i=qi();const a=Yu(),c=(function(){return Yu()})();return n.forEach(((u,d)=>{const f=r.get(d.key);s.has(d.key)&&(f===void 0||f.mutation instanceof Ko)?i=i.insert(d.key,d):f!==void 0?(a.set(d.key,f.mutation.getFieldMask()),Qu(f.mutation,d,f.mutation.getFieldMask(),Bt.now())):a.set(d.key,Kr.empty())})),this.recalculateAndSaveOverlays(e,i).next((u=>(u.forEach(((d,f)=>
vendor: 4,108 bytes, lines 1855-1880
1855a.set(d,f))),n.forEach(((d,f)=>c.set(d,new LM(f,a.get(d)??null)))),c)))}recalculateAndSaveOverlays(e,n){const r=Yu();let s=new Kt(((a,c)=>a-c)),i=st();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next((a=>{for(const c of a)c.keys().forEach((u=>{const d=n.get(u);if(d===null)return;let f=r.get(u)||Kr.empty();f=c.applyToLocalView(d,f),r.set(u,f);const g=(s.get(c.batchId)||st()).add(u);s=s.insert(c.batchId,g)}))})).next((()=>{const a=[],c=s.getReverseIterator();for(;c.hasNext();){const u=c.getNext(),d=u.key,f=u.value,g=w2();f.forEach((y=>{if(!i.has(y)){const x=S2(n.get(y),r.get(y));x!==null&&g.set(y,x),i=i.add(y)}})),a.push(this.documentOverlayCache.saveOverlays(e,d,g))}return ue.waitFor(a)})).next((()=>r))}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next((r=>this.recalculateAndSaveOverlays(e,r)))}getDocumentsMatchingQuery(e,n,r,s){return jj(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):g2(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,s):this.getDocumentsMatchingCollectionQuery(e,n,r,s)}getNextDocuments(e,n,r,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,s).next((i=>{const a=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,s-i.size):ue.resolve(Pa());let c=dd,u=i;return a.next((d=>ue.forEach(d,((f,g)=>(c<g.largestBatchId&&(c=g.largestBatchId),i.get(f)?ue.resolve():this.remoteDocumentCache.getEntry(e,f).next((y=>{u=u.insert(f,y)}))))).next((()=>this.populateOverlays(e,d,i))).next((()=>this.computeViews(e,u,d,st()))).next((f=>({batchId:c,changes:x2(f)})))))}))}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new Le(n)).next((r=>{let s=Fu();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s}))}getDocumentsMatchingCollectionGroupQuery(e,n,r,s){const i=n.collectionGroup;let a=Fu();return this.indexManager.getCollectionParents(e,i).next((c=>ue.forEach(c,(u=>{const d=(function(g,y){return new Dc(y,null,g.explicitOrderBy.slice(),g.filters.slice(),g.limit,g.limitType,g.startAt,g.endAt)})(n,u.child(i));return this.getDocumentsMatchingCollectionQuery(e,d,r,s).next((f=>{f.forEach(((g,y)=>{a=a.insert(g,y)}))}))})).next((()=>a))))}getDocumentsMatchingCollectionQuery(e,n,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next((a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,i,s)))).next((a=>{i.forEach(((u,d)=>{const f=d.getKey();a.get(f)===null&&(a=a.insert(f,or.newInvalidDocument(f)))}));let c=Fu();return a.forEach(((u,d)=>{const f=i.get(u);f!==void 0&&Qu(f.mutation,d,Kr.empty(),Bt.now()),Lm(n,d)&&(c=c.insert(u,d))})),c}))}}/**
1856 * @license
1857 * Copyright 2020 Google LLC
1858 *
1859 * Licensed under the Apache License, Version 2.0 (the "License");
1860 * you may not use this file except in compliance with the License.
1861 * You may obtain a copy of the License at
1862 *
1863 *   http://www.apache.org/licenses/LICENSE-2.0
1864 *
1865 * Unless required by applicable law or agreed to in writing, software
1866 * distributed under the License is distributed on an "AS IS" BASIS,
1867 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1868 * See the License for the specific language governing permissions and
1869 * limitations under the License.
1870 */class jM{constructor(e){this.serializer=e,this.Nr=new Map,this.Br=new Map}getBundleMetadata(e,n){return ue.resolve(this.Nr.get(n))}saveBundleMetadata(e,n){return this.Nr.set(n.id,(function(s){return{id:s.id,version:s.version,createTime:ri(s.createTime)}})(n)),ue.resolve()}getNamedQuery(e,n){return ue.resolve(this.Br.get(n))}saveNamedQuery(e,n){return this.Br.set(n.name,(function(s){return{name:s.name,query:CM(s.bundledQuery),readTime:ri(s.readTime)}})(n)),ue.resolve()}}/**
1871 * @license
1872 * Copyright 2022 Google LLC
1873 *
1874 * Licensed under the Apache License, Version 2.0 (the "License");
1875 * you may not use this file except in compliance with the License.
1876 * You may obtain a copy of the License at
1877 *
1878 *   http://www.apache.org/licenses/LICENSE-2.0
1879 *
1880 * Unless required by applicable law or agreed to in writing, softw
1880are
1881 * distributed under the License is distributed on an "AS IS" BASIS,
1882 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1883 * See the License for the specific language governing permissions and
1884 * limitations under the License.
1885 */class MM{constructor(){this.overlays=new Kt(Le.comparator),this.Lr=new Map}getOverlay(e,n){return ue.resolve(this.overlays.get(n))}getOverlays(e,n){const r=Pa();return ue.forEach(n,(s=>this.getOverlay(e,s).next((i=>{i!==null&&r.set(s,i)})))).next((()=>r))}saveOverlays(e,n,r){return r.forEach(((s,i)=>{this.bt(e,n,i)})),ue.resolve()}removeOverlaysForBatchId(e,n,r){const s=this.Lr.get(r);return s!==void 0&&(s.forEach((i=>this.overlays=this.overlays.remove(i))),this.Lr.delete(r)),ue.resolve()}getOverlaysForCollection(e,n,r){const s=Pa(),i=n.length+1,a=new Le(n.child("")),c=this.overlays.getIteratorFrom(a);for(;c.hasNext();){const u=c.getNext().value,d=u.getKey();if(!n.isPrefixOf(d.path))break;d.path.length===i&&u.largestBatchId>r&&s.set(u.getKey(),u)}return ue.resolve(s)}getOverlaysForCollectionGroup(e,n,r,s){let i=new Kt(((d,f)=>d-f));const a=this.overlays.getIterator();for(;a.hasNext();){const d=a.getNext().value;if(d.getKey().getCollectionGroup()===n&&d.largestBatchId>r){let f=i.get(d.largestBatchId);f===null&&(f=Pa(),i=i.insert(d.largestBatchId,f)),f.set(d.getKey(),d)}}const c=Pa(),u=i.getIterator();for(;u.hasNext()&&(u.getNext().value.forEach(((d,f)=>c.set(d,f))),!(c.size()>=s)););return ue.resolve(c)}bt(e,n,r){const s=this.overlays.get(r.key);if(s!==null){const a=this.Lr.get(s.largestBatchId).delete(r.key);this.Lr.set(s.largestBatchId,a)}this.overlays=this.overlays.insert(r.key,new nM(n,r));let i=this.Lr.get(n);i===void 0&&(i=st(),this.Lr.set(n,i)),this.Lr.set(n,i.add(r.key))}}/**
1886 * @license
1887 * Copyright 2024 Google LLC
1888 *
1889 * Licensed under the Apache License, Version 2.0 (the "License");
1890 * you may not use this file except in compliance with the License.
1891 * You may obtain a copy of the License at
1892 *
1893 *   http://www.apache.org/licenses/LICENSE-2.0
1894 *
1895 * Unless required by applicable law or agreed to in writing, software
1896 * distributed under the License is distributed on an "AS IS" BASIS,
1897 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1898 * See the License for the specific language governing permissions and
1899 * limitations under the License.
1900 */class BM{constructor(){this.sessionToken=Kn.EMPTY_BYTE_STRING}getSessionToken(e){return ue.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,ue.resolve()}}/**
1901 * @license
1902 * Copyright 2017 Google LLC
1903 *
1904 * Licensed under the Apache License, Version 2.0 (the "License");
1905 * you may not use this file except in compliance with the License.
1906 * You may obtain a copy of the License at
1907 *
1908 *   http://www.apache.org/licenses/LICENSE-2.0
1909 *
1910 * Unless required by applicable law or agreed to in writing, software
1911 * distributed under the License is distributed on an "AS IS" BASIS,
1912 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1913 * See the License for the specific language governing permissions and
1914 * limitations under the License.
1915 */class j_{constructor(){this.kr=new bn(Pn.Kr),this.qr=new bn(Pn.Ur)}isEmpty(){return this.kr.isEmpty()}addReference(e,n){const r=new Pn(e,n);this.kr=this.kr.add(r),this.qr=this.qr.add(r)}$r(e,n){e.forEach((r=>this.addReference(r,n)))}removeReference(e,n){this.Wr(new Pn(e,n))}Qr(e,n){e.forEach((r=>this.removeReference(r,n)))}Gr(e){const n=new Le(new Dt([])),r=new Pn(n,e),s=new Pn(n,e+1),i=[];return this.qr.forEachInRange([r,s],(a=>{this.Wr(a),i.push(a.key)})),i}zr(){this.kr.forEach((e=>this.Wr(e)))}Wr(e){this.kr=this.kr.delete(e),this.qr=this.qr.delete(e)}jr(e){const n=new Le(new Dt([])),r=new Pn(n,e),s=new Pn(n,e+1);let i=st();return this.qr.forEachInRange([r,s],(a=>{i=i.add(a.key)})),i}containsKey(e){const n=new Pn(e,0),r=this.kr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class Pn{constructor(e,n){this.key=e,this.Hr=n}static Kr(e,n){return Le.comparator(e.key,n.key)||rt(e.Hr,n.Hr)}static Ur(e,n){return rt(e.Hr,n.Hr)||Le.comparator(e.key,n.key)}}/**
1916 * @license
1917 * Copyright 2017 Google LLC
1918 *
1919 * Licensed under the Apache License, Version 2.0 (the "License");
1920 * you may not use this file except in compliance with the License.
1921 * You may obtain a copy of the License at
1922 *
1923 *   http://www.apache.org/licenses/LICENSE-2.0
1924 *
1925 * Unless required by applicable law or agreed to in writing, software
1926 * distributed under the License is distributed on an "AS IS" BASIS,
1927 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1928 * See the License for the specific language governing permissions and
1929 * limitations under the License.
1930 */class VM{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.Yn=1,this.Jr=new bn(Pn.Kr)}checkEmpty(e){return ue.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,s){const i=this.Yn;this.Yn++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const a=new tM(i,n,r,s);this.mutationQueue.push(a);for(const c of s)this.Jr=this.Jr.add(new Pn(c.key,i)),this.indexManager.addToCollectionParentIndex(e,c.key.path.popLast());return ue.resolve(a)}lookupMutationBatch(e,n){return ue.resolve(this.Zr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,s=this.Xr(r),i=s<0?0:s;return ue.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return ue.resolve(this.mutationQueue.length===0?C_:this.Yn-1)}getAllMutationBatches(e){return ue.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new Pn(n,0),s=new Pn(n,Number.POSITIVE_INFINITY),i=[];return this.Jr.forEachInRange([r,s],(a=>{const c=this.Zr(a.Hr);i.push(c)})),ue.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new bn(rt);return n.forEach((s=>{const i=new Pn(s,0),a=new Pn(s,Number.POSITIVE_INFINITY);this.Jr.forEachInRange([i,a],(c=>{r=r.add(c.Hr)}))})),ue.resolve(this.Yr(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,s=r.length+1;let i=r;Le.isDocumentKey(i)||(i=i.child(""));const a=new Pn(new Le(i),0);let c=new bn(rt);return this.Jr.forEachWhile((u=>{const d=u.key.path;return!!r.isPrefixOf(d)&&(d.length===s&&(c=c.add(u.Hr)),!0)}),a),ue.resolve(this.Yr(c))}Yr(e){const n=[];return e.forEach((r=>{const s=this.Zr(r);s!==null&&n.push(s)})),n}removeMutationBatch(e,n){yt(this.ei(n.batchId,"removed")===0,55003),this.mutationQueue.shift();let r=this.Jr;return ue.forEach(n.mutations,(s=>{const i=new Pn(s.key,n.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)})).next((()=>{this.Jr=r}))}nr(e){}containsKey(e,n){const r=new Pn(n,0),s=this.Jr.firstAfterOrEqual(r);return ue.resolve(n.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,ue.resolve()}ei(e,n){return this.Xr(e)}Xr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Zr(e){const n=this.Xr(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/**
1931 * @license
1932 * Copyright 2017 Google LLC
1933 *
1934 * Licensed under the Apache License, Version 2.0 (the "License");
1935 * you may not use this file except in compliance with the License.
1936 * You may obtain a copy of the License at
1937 *
1938 *   http://www.apache.org/licenses/LICENSE-2.0
1939 *
1940 * Unless required by applicable law or agreed to in writing, software
1941 * distributed under the License is distributed on an "AS IS" BASIS,
1942 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1943 * See the License for the specific language governing permissions and
1944 * limitations under the License.
1945 */class UM{constructor(e){this.ti=e,this.docs=(function(){return new Kt(Le.comparator)})(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,s=this.docs.get(r),i=s?s.size:0,a=this.ti(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:a}),this.size+=a-i,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return ue.resolve(r?r.document.mutableCopy():or.newInvalidDocument(n))}getEntries(e,n){let r=qi();return n.forEach((s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():or.newInvalidDocument(s))})),ue.resolve(r)}
vendor: 8,377 bytes, lines 1945-1985
1945getDocumentsMatchingQuery(e,n,r,s){let i=qi();const a=n.path,c=new Le(a.child("__id-9223372036854775808__")),u=this.docs.getIteratorFrom(c);for(;u.hasNext();){const{key:d,value:{document:f}}=u.getNext();if(!a.isPrefixOf(d.path))break;d.path.length>a.length+1||fj(hj(f),r)<=0||(s.has(f.key)||Lm(n,f))&&(i=i.insert(f.key,f.mutableCopy()))}return ue.resolve(i)}getAllFromCollectionGroup(e,n,r,s){ze(9500)}ni(e,n){return ue.forEach(this.docs,(r=>n(r)))}newChangeBuffer(e){return new $M(this)}getSize(e){return ue.resolve(this.size)}}class $M extends OM{constructor(e){super(),this.Mr=e}applyChanges(e){const n=[];return this.changes.forEach(((r,s)=>{s.isValidDocument()?n.push(this.Mr.addEntry(e,s)):this.Mr.removeEntry(r)})),ue.waitFor(n)}getFromCache(e,n){return this.Mr.getEntry(e,n)}getAllFromCache(e,n){return this.Mr.getEntries(e,n)}}/**
1946 * @license
1947 * Copyright 2017 Google LLC
1948 *
1949 * Licensed under the Apache License, Version 2.0 (the "License");
1950 * you may not use this file except in compliance with the License.
1951 * You may obtain a copy of the License at
1952 *
1953 *   http://www.apache.org/licenses/LICENSE-2.0
1954 *
1955 * Unless required by applicable law or agreed to in writing, software
1956 * distributed under the License is distributed on an "AS IS" BASIS,
1957 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1958 * See the License for the specific language governing permissions and
1959 * limitations under the License.
1960 */class zM{constructor(e){this.persistence=e,this.ri=new Qa((n=>I_(n)),P_),this.lastRemoteSnapshotVersion=Ge.min(),this.highestTargetId=0,this.ii=0,this.si=new j_,this.targetCount=0,this.oi=pc._r()}forEachTarget(e,n){return this.ri.forEach(((r,s)=>n(s))),ue.resolve()}getLastRemoteSnapshotVersion(e){return ue.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return ue.resolve(this.ii)}allocateTargetId(e){return this.highestTargetId=this.oi.next(),ue.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.ii&&(this.ii=n),ue.resolve()}lr(e){this.ri.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.oi=new pc(n),this.highestTargetId=n),e.sequenceNumber>this.ii&&(this.ii=e.sequenceNumber)}addTargetData(e,n){return this.lr(n),this.targetCount+=1,ue.resolve()}updateTargetData(e,n){return this.lr(n),ue.resolve()}removeTargetData(e,n){return this.ri.delete(n.target),this.si.Gr(n.targetId),this.targetCount-=1,ue.resolve()}removeTargets(e,n,r){let s=0;const i=[];return this.ri.forEach(((a,c)=>{c.sequenceNumber<=n&&r.get(c.targetId)===null&&(this.ri.delete(a),i.push(this.removeMatchingKeysForTargetId(e,c.targetId)),s++)})),ue.waitFor(i).next((()=>s))}getTargetCount(e){return ue.resolve(this.targetCount)}getTargetData(e,n){const r=this.ri.get(n)||null;return ue.resolve(r)}addMatchingKeys(e,n,r){return this.si.$r(n,r),ue.resolve()}removeMatchingKeys(e,n,r){this.si.Qr(n,r);const s=this.persistence.referenceDelegate,i=[];return s&&n.forEach((a=>{i.push(s.markPotentiallyOrphaned(e,a))})),ue.waitFor(i)}removeMatchingKeysForTargetId(e,n){return this.si.Gr(n),ue.resolve()}getMatchingKeysForTargetId(e,n){const r=this.si.jr(n);return ue.resolve(r)}containsKey(e,n){return ue.resolve(this.si.containsKey(n))}}/**
1961 * @license
1962 * Copyright 2017 Google LLC
1963 *
1964 * Licensed under the Apache License, Version 2.0 (the "License");
1965 * you may not use this file except in compliance with the License.
1966 * You may obtain a copy of the License at
1967 *
1968 *   http://www.apache.org/licenses/LICENSE-2.0
1969 *
1970 * Unless required by applicable law or agreed to in writing, software
1971 * distributed under the License is distributed on an "AS IS" BASIS,
1972 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1973 * See the License for the specific language governing permissions and
1974 * limitations under the License.
1975 */class U2{constructor(e,n){this._i={},this.overlays={},this.ai=new Rm(0),this.ui=!1,this.ui=!0,this.ci=new BM,this.referenceDelegate=e(this),this.li=new zM(this),this.indexManager=new SM,this.remoteDocumentCache=(function(s){return new UM(s)})((r=>this.referenceDelegate.hi(r))),this.serializer=new TM(n),this.Pi=new jM(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ui=!1,Promise.resolve()}get started(){return this.ui}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new MM,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this._i[e.toKey()];return r||(r=new VM(n,this.referenceDelegate),this._i[e.toKey()]=r),r}getGlobalsCache(){return this.ci}getTargetCache(){return this.li}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Pi}runTransaction(e,n,r){Te("MemoryPersistence","Starting transaction:",e);const s=new HM(this.ai.next());return this.referenceDelegate.Ti(),r(s).next((i=>this.referenceDelegate.Ii(s).next((()=>i)))).toPromise().then((i=>(s.raiseOnCommittedEvent(),i)))}Ei(e,n){return ue.or(Object.values(this._i).map((r=>()=>r.containsKey(e,n))))}}class HM extends mj{constructor(e){super(),this.currentSequenceNumber=e}}class M_{constructor(e){this.persistence=e,this.Ri=new j_,this.Ai=null}static Vi(e){return new M_(e)}get di(){if(this.Ai)return this.Ai;throw ze(60996)}addReference(e,n,r){return this.Ri.addReference(r,n),this.di.delete(r.toString()),ue.resolve()}removeReference(e,n,r){return this.Ri.removeReference(r,n),this.di.add(r.toString()),ue.resolve()}markPotentiallyOrphaned(e,n){return this.di.add(n.toString()),ue.resolve()}removeTarget(e,n){this.Ri.Gr(n.targetId).forEach((s=>this.di.add(s.toString())));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next((s=>{s.forEach((i=>this.di.add(i.toString())))})).next((()=>r.removeTargetData(e,n)))}Ti(){this.Ai=new Set}Ii(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return ue.forEach(this.di,(r=>{const s=Le.fromPath(r);return this.mi(e,s).next((i=>{i||n.removeEntry(s,Ge.min())}))})).next((()=>(this.Ai=null,n.apply(e))))}updateLimboDocument(e,n){return this.mi(e,n).next((r=>{r?this.di.delete(n.toString()):this.di.add(n.toString())}))}hi(e){return 0}mi(e,n){return ue.or([()=>ue.resolve(this.Ri.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Ei(e,n)])}}class Gp{constructor(e,n){this.persistence=e,this.fi=new Qa((r=>vj(r.path)),((r,s)=>r.isEqual(s))),this.garbageCollector=NM(this,n)}static Vi(e,n){return new Gp(e,n)}Ti(){}Ii(e){return ue.resolve()}forEachTarget(e,n){return this.persistence.getTargetCache().forEachTarget(e,n)}dr(e){const n=this.pr(e);return this.persistence.getTargetCache().getTargetCount(e).next((r=>n.next((s=>r+s))))}pr(e){let n=0;return this.mr(e,(r=>{n++})).next((()=>n))}mr(e,n){return ue.forEach(this.fi,((r,s)=>this.wr(e,r,s).next((i=>i?ue.resolve():n(s)))))}removeTargets(e,n,r){return this.persistence.getTargetCache().removeTargets(e,n,r)}removeOrphanedDocuments(e,n){let r=0;const s=this.persistence.getRemoteDocumentCache(),i=s.newChangeBuffer();return s.ni(e,(a=>this.wr(e,a,n).next((c=>{c||(r++,i.removeEntry(a,Ge.min()))})))).next((()=>i.apply(e))).next((()=>r))}markPotentiallyOrphaned(e,n){return this.fi.set(n,e.currentSequenceNumber),ue.resolve()}removeTarget(e,n){const r=n.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,n,r){return this.fi.set(r,e.currentSequenceNumber),ue.resolve()}removeReference(e,n,r){return this.fi.set(r,e.currentSequenceNumber),ue.resolve()}updateLimboDocument(e,n){return this.fi.set(n,e.currentSequenceNumber),ue.resolve()}hi(e){let n=e.key.toString().length;return e.isFoundDocument()&&(n+=Mf(e.data.value)),n}wr(e,n,r){return ue.or([()=>this.persistence.Ei(e,n),()=>this.persistence.getTargetCache().containsKey(e,n),()=>{const s=this.fi.get(n);return ue.resolve(s!==void 0&&s>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/**
1976 * @license
1977 * Copyright 2017 Google LLC
1978 *
1979 * Licensed under the Apache License, Version 2.0 (the "License");
1980 * you may not use this file except in compliance with the License.
1981 * You may obtain a copy of the License at
1982 *
1983 *   http://www.apache.org/licenses/LICENSE-2.0
1984 *
1985 * Unless required by applicable law or agreed to in writing, softw
1985are
1986 * distributed under the License is distributed on an "AS IS" BASIS,
1987 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1988 * See the License for the specific language governing permissions and
1989 * limitations under the License.
1990 */class B_{constructor(e,n,r,s){this.targetId=e,this.fromCache=n,this.Ts=r,this.Is=s}static Es(e,n){let r=st(),s=st();for(const i of n.docChanges)switch(i.type){case 0:r=r.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new B_(e,n.fromCache,r,s)}}/**
1991 * @license
1992 * Copyright 2023 Google LLC
1993 *
1994 * Licensed under the Apache License, Version 2.0 (the "License");
1995 * you may not use this file except in compliance with the License.
1996 * You may obtain a copy of the License at
1997 *
1998 *   http://www.apache.org/licenses/LICENSE-2.0
1999 *
2000 * Unless required by applicable law or agreed to in writing, software
2001 * distributed under the License is distributed on an "AS IS" BASIS,
2002 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2003 * See the License for the specific language governing permissions and
2004 * limitations under the License.
2005 */class qM{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
2006 * @license
2007 * Copyright 2019 Google LLC
2008 *
2009 * Licensed under the Apache License, Version 2.0 (the "License");
2010 * you may not use this file except in compliance with the License.
2011 * You may obtain a copy of the License at
2012 *
2013 *   http://www.apache.org/licenses/LICENSE-2.0
2014 *
2015 * Unless required by applicable law or agreed to in writing, software
2016 * distributed under the License is distributed on an "AS IS" BASIS,
2017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2018 * See the License for the specific language governing permissions and
2019 * limitations under the License.
2020 */class WM{constructor(){this.Rs=!1,this.As=!1,this.Vs=100,this.ds=(function(){return YL()?8:gj(lr())>0?6:4})()}initialize(e,n){this.fs=e,this.indexManager=n,this.Rs=!0}getDocumentsMatchingQuery(e,n,r,s){const i={result:null};return this.gs(e,n).next((a=>{i.result=a})).next((()=>{if(!i.result)return this.ps(e,n,s,r).next((a=>{i.result=a}))})).next((()=>{if(i.result)return;const a=new qM;return this.ys(e,n,a).next((c=>{if(i.result=c,this.As)return this.ws(e,n,a,c.size)}))})).next((()=>i.result))}ws(e,n,r,s){return r.documentReadCount<this.Vs?(zl()<=nt.DEBUG&&Te("QueryEngine","SDK will not create cache indexes for query:",Hl(n),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),ue.resolve()):(zl()<=nt.DEBUG&&Te("QueryEngine","Query:",Hl(n),"scans",r.documentReadCount,"local documents and returns",s,"documents as results."),r.documentReadCount>this.ds*s?(zl()<=nt.DEBUG&&Te("QueryEngine","The SDK decides to create cache indexes for query:",Hl(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,ni(n))):ue.resolve())}gs(e,n){if(Jb(n))return ue.resolve(null);let r=ni(n);return this.indexManager.getIndexType(e,r).next((s=>s===0?null:(n.limit!==null&&s===1&&(n=zp(n,null,"F"),r=ni(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next((i=>{const a=st(...i);return this.fs.getDocuments(e,a).next((c=>this.indexManager.getMinOffset(e,r).next((u=>{const d=this.bs(n,c);return this.Ss(n,d,a,u.readTime)?this.gs(e,zp(n,null,"F")):this.Ds(e,d,n,u)}))))})))))}
2020ps(e,n,r,s){return Jb(n)||s.isEqual(Ge.min())?ue.resolve(null):this.fs.getDocuments(e,r).next((i=>{const a=this.bs(n,i);return this.Ss(n,a,r,s)?ue.resolve(null):(zl()<=nt.DEBUG&&Te("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),Hl(n)),this.Ds(e,a,n,dj(s,dd)).next((c=>c)))}))}bs(e,n){let r=new bn(v2(e));return n.forEach(((s,i)=>{Lm(e,i)&&(r=r.add(i))})),r}Ss(e,n,r,s){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const i=e.limitType==="F"?n.last():n.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}ys(e,n,r){return zl()<=nt.DEBUG&&Te("QueryEngine","Using full collection scan to execute query:",Hl(n)),this.fs.getDocumentsMatchingQuery(e,n,Bo.min(),r)}Ds(e,n,r,s){return this.fs.getDocumentsMatchingQuery(e,r,s).next((i=>(n.forEach((a=>{i=i.insert(a.key,a)})),i)))}}/**
2021 * @license
2022 * Copyright 2020 Google LLC
2023 *
2024 * Licensed under the Apache License, Version 2.0 (the "License");
2025 * you may not use this file except in compliance with the License.
2026 * You may obtain a copy of the License at
2027 *
2028 *   http://www.apache.org/licenses/LICENSE-2.0
2029 *
2030 * Unless required by applicable law or agreed to in writing, software
2031 * distributed under the License is distributed on an "AS IS" BASIS,
2032 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2033 * See the License for the specific language governing permissions and
2034 * limitations under the License.
2035 */const V_="LocalStore",GM=3e8;class KM{constructor(e,n,r,s){this.persistence=e,this.Cs=n,this.serializer=s,this.vs=new Kt(rt),this.Fs=new Qa((i=>I_(i)),P_),this.Ms=new Map,this.xs=e.getRemoteDocumentCache(),this.li=e.getTargetCache(),this.Pi=e.getBundleCache(),this.Os(r)}Os(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new FM(this.xs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.xs.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(n=>e.collect(n,this.vs)))}}function YM(t,e,n,r){return new KM(t,e,n,r)}async function $2(t,e){const n=Qe(t);return await n.persistence.runTransaction("Handle user change","readonly",(r=>{let s;
2035return n.mutationQueue.getAllMutationBatches(r).next((i=>(s=i,n.Os(e),n.mutationQueue.getAllMutationBatches(r)))).next((i=>{const a=[],c=[];let u=st();for(const d of s){a.push(d.batchId);for(const f of d.mutations)u=u.add(f.key)}for(const d of i){c.push(d.batchId);for(const f of d.mutations)u=u.add(f.key)}return n.localDocuments.getDocuments(r,u).next((d=>({Ns:d,removedBatchIds:a,addedBatchIds:c})))}))}))}function QM(t,e){const n=Qe(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(r=>{const s=e.batch.keys(),i=n.xs.newChangeBuffer({trackRemovals:!0});return(function(c,u,d,f){const g=d.batch,y=g.keys();let x=ue.resolve();return y.forEach((b=>{x=x.next((()=>f.getEntry(u,b))).next((E=>{const w=d.docVersions.get(b);yt(w!==null,48541),E.version.compareTo(w)<0&&(g.applyToRemoteDocument(E,d),E.isValidDocument()&&(E.setReadTime(d.commitVersion),f.addEntry(E)))}))})),x.next((()=>c.mutationQueue.removeMutationBatch(u,g)))})(n,r,e,i).next((()=>i.apply(r))).next((()=>n.mutationQueue.performConsistencyCheck(r))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(r,s,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,(function(c){let u=st();for(let d=0;d<c.mutationResults.length;++d)c.mutationResults[d].transformResults.length>0&&(u=u.add(c.batch.mutations[d].key));return u})(e)))).next((()=>n.localDocuments.getDocuments(r,s)))}))}function z2(t){const e=Qe(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(n=>e.li.getLastRemoteSnapshotVersion(n)))}function JM(t,e){const n=Qe(t),r=e.snapshotVersion;let s=n.vs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(i=>{const a=n.xs.newChangeBuffer({trackRemovals:!0});s=n.vs;const c=[];
2035e.targetChanges.forEach(((f,g)=>{const y=s.get(g);if(!y)return;c.push(n.li.removeMatchingKeys(i,f.removedDocuments,g).next((()=>n.li.addMatchingKeys(i,f.addedDocuments,g))));let x=y.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(g)!==null?x=x.withResumeToken(Kn.EMPTY_BYTE_STRING,Ge.min()).withLastLimboFreeSnapshotVersion(Ge.min()):f.resumeToken.approximateByteSize()>0&&(x=x.withResumeToken(f.resumeToken,r)),s=s.insert(g,x),(function(E,w,R){return E.resumeToken.approximateByteSize()===0||w.snapshotVersion.toMicroseconds()-E.snapshotVersion.toMicroseconds()>=GM?!0:R.addedDocuments.size+R.modifiedDocuments.size+R.removedDocuments.size>0})(y,x,f)&&c.push(n.li.updateTargetData(i,x))}));let u=qi(),d=st();if(e.documentUpdates.forEach((f=>{e.resolvedLimboDocuments.has(f)&&c.push(n.persistence.referenceDelegate.updateLimboDocument(i,f))})),c.push(XM(i,a,e.documentUpdates).next((f=>{u=f.Bs,d=f.Ls}))),!r.isEqual(Ge.min())){const f=n.li.getLastRemoteSnapshotVersion(i).next((g=>n.li.setTargetsMetadata(i,i.currentSequenceNumber,r)));c.push(f)}return ue.waitFor(c).next((()=>a.apply(i))).next((()=>n.localDocuments.getLocalViewOfDocuments(i,u,d))).next((()=>u))})).then((i=>(n.vs=s,i)))}function XM(t,e,n){let r=st(),s=st();return n.forEach((i=>r=r.add(i))),e.getEntries(t,r).next((i=>{let a=qi();return n.forEach(((c,u)=>{const d=i.get(c);u.isFoundDocument()!==d.isFoundDocument()&&(s=s.add(c)),u.isNoDocument()&&u.version.isEqual(Ge.min())?(e.removeEntry(c,u.readTime),a=a.insert(c,u)):!d.isValidDocument()||u.version.compareTo(d.version)>0||u.version.compareTo(d.version)===0&&d.hasPendingWrites?(e.addEntry(u),a=a.insert(c,u)):Te(V_,"Ignoring outdated watch update for ",c,". Current version:",d.version," Watch version:",u.version)})),{Bs:a,Ls:s}}))}function ZM(t,e){const n=Qe(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(r=>(e===void 0&&(e=C_),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e))))}function eB(t,e){const n=Qe(t);return n.persistence.runTransaction("Allocate target","readwrite",(r=>{let s;return n.li.getTargetData(r,e).next((i=>i?(s=i,ue.resolve(s)):n.li.allocateTargetId(r).next((a=>(s=new Ro(e,a,"TargetPurposeListen",r.currentSequenceNumber),n.li.addTargetData(r,s).next((()=>s)))))))})).then((r=>{const s=n.vs.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.vs=n.vs.insert(r.targetId,r),n.Fs.set(e,r.targetId)),r}))}async function fv(t,e,n){const r=Qe(t),s=r.vs.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,(a=>r.persistence.referenceDelegate.removeTarget(a,s)))}catch(a){if(!Rc(a))throw a;Te(V_,`Failed to update sequence numbers for target ${e}: ${a}`)}r.vs=r.vs.remove(e),r.Fs.delete(s.target)}function uA(t,e,n){const r=Qe(t);let s=Ge.min(),i=st();return r.persistence.runTransaction("Execute query","readwrite",(a=>(function(u,d,f){const g=Qe(u),y=g.Fs.get(f);return y!==void 0?ue.resolve(g.vs.get(y)):g.li.getTargetData(d,f)})(r,a,ni(e)).next((c=>{if(c)return s=c.lastLimboFreeSnapshotVersion,r.li.getMatchingKeysForTargetId(a,c.targetId).next((u=>{i=u}))})).next((()=>r.Cs.getDocumentsMatchingQuery(a,e,n?s:Ge.min(),n?i:st()))).next((c=>(tB(r,Vj(e),c),{documents:c,ks:i})))))}function tB(t,e,n){let r=t.Ms.get(e)||Ge.min();n.forEach(((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)})),t.Ms.set(e,r)}class dA{constructor(){this.activeTargetIds=Wj()}Qs(e){this.activeTargetIds=this.activeTargetIds.add(e)}Gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class nB{constructor(){this.vo=new dA,this.Fo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e,n=!0){return n&&this.vo.Qs(e),this.Fo[e]||"not-current"}updateQueryState(e,n,r){this.Fo[e]=n}removeLocalQueryTarget(e){this.vo.Gs(e)}isLocalQueryTarget(e){return this.vo.activeTargetIds.has(e)}clearQueryState(e){delete this.Fo[e]}getAllActiveQueryTargets(){return this.vo.activeTargetIds}isActiveQueryTarget(e){return this.vo.activeTargetIds.has(e)}start(){return this.vo=new dA,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
2036 * @license
2037 * Copyright 2019 Google LLC
2038 *
2039 * Licensed under the Apache License, Version 2.0 (the "License");
2040 * you may not use this file except in compliance with the License.
2041 * You may obtain a copy of the License at
2042 *
2043 *   http://www.apache.org/licenses/LICENSE-2.0
2044 *
2045 * Unless required by applicable law or agreed to in writing, software
2046 * distributed under the License is distributed on an "AS IS" BASIS,
2047 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2048 * See the License for the specific language governing permissions and
2049 * limitations under the License.
2050 */class rB{Mo(e){}shutdown(){}}/**
2051 * @license
2052 * Copyright 2019 Google LLC
2053 *
2054 * Licensed under the Apache License, Version 2.0 (the "License");
2055 * you may not use this file except in compliance with the License.
2056 * You may obtain a copy of the License at
2057 *
2058 *   http://www.apache.org/licenses/LICENSE-2.0
2059 *
2060 * Unless required by applicable law or agreed to in writing, software
2061 * distributed under the License is distributed on an "AS IS" BASIS,
2062 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2063 * See the License for the specific language governing permissions and
2064 * limitations under the License.
2065 */const hA="ConnectivityMonitor";class fA{constructor(){this.xo=()=>this.Oo(),this.No=()=>this.Bo(),this.Lo=[],this.ko()}Mo(e){this.Lo.push(e)}shutdown(){window.removeEventListener("online",this.xo),window.removeEventListener("offline",this.No)}ko(){window.addEventListener("online",this.xo),window.addEventListener("offline",this.No)}Oo(){Te(hA,"Network connectivity changed: AVAILABLE");for(const e of this.Lo)e(0)}Bo(){Te(hA,"Network connectivity changed: UNAVAILABLE");for(const e of this.Lo)e(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
2066 * @license
2067 * Copyright 2023 Google LLC
2068 *
2069 * Licensed under the Apache License, Version 2.0 (the "License");
2070 * you may not use this file except in compliance with the License.
2071 * You may obtain a copy of the License at
2072 *
2073 *   http://www.apache.org/licenses/LICENSE-2.0
2074 *
2075 * Unless required by applicable law or agreed to in writing, software
2076 * distributed under the License is distributed on an "AS IS" BASIS,
2077 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2078 * See the License for the specific language governing permissions and
2079 * limitations under the License.
2080 */let yf=null;function pv(){return yf===null?yf=(function(){return 268435456+Math.round(2147483648*Math.random())})():yf++,"0x"+yf.toString(16)}/**
2081 * @license
2082 * Copyright 2020 Google LLC
2083 *
2084 * Licensed under the Apache License, Version 2.0 (the "License");
2085 * you may not use this file except in compliance with the License.
2086 * You may obtain a copy of the License at
2087 *
2088 *   http://www.apache.org/licenses/LICENSE-2.0
2089 *
2090 * Unless required by applicable law or agreed to in writing, software
2091 * distributed under the License is distributed on an "AS IS" BASIS,
2092 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2093 * See the License for the specific language governing permissions and
2094 * limitations under the License.
2095 */const ey="RestConnection",sB={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class iB{get Ko(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const n=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.qo=n+"://"+e.host,this.Uo=`projects/${r}/databases/${s}`,this.$o=this.databaseId.database===Vp?`project_id=${r}`:`project_id=${r}&database_id=${s}`}Wo(e,n,r,s,i){const a=pv(),c=this.Qo(e,n.toUriEncodedString());Te(ey,`Sending RPC '${e}' ${a}:`,c,r);const u={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.$o};this.Go(u,s,i);const{host:d}=new URL(c),f=li(d);return this.zo(e,c,u,r,f).then((g=>(Te(ey,`Received RPC '${e}' ${a}: `,g),g)),(g=>{throw Ua(ey,`RPC '${e}' ${a} failed with error: `,g,"url: ",c,"request:",r),g}))}jo(e,n,r,s,i,a){return this.Wo(e,n,r,s,i)}Go(e,n,r){e["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+Ic})(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEac
vendor: 8,755 bytes, lines 2095-2180
2095h(((s,i)=>e[i]=s)),r&&r.headers.forEach(((s,i)=>e[i]=s))}Qo(e,n){const r=sB[e];let s=`${this.qo}/v1/${n}:${r}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}}/**
2096 * @license
2097 * Copyright 2017 Google LLC
2098 *
2099 * Licensed under the Apache License, Version 2.0 (the "License");
2100 * you may not use this file except in compliance with the License.
2101 * You may obtain a copy of the License at
2102 *
2103 *   http://www.apache.org/licenses/LICENSE-2.0
2104 *
2105 * Unless required by applicable law or agreed to in writing, software
2106 * distributed under the License is distributed on an "AS IS" BASIS,
2107 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2108 * See the License for the specific language governing permissions and
2109 * limitations under the License.
2110 */class oB{constructor(e){this.Ho=e.Ho,this.Jo=e.Jo}Zo(e){this.Xo=e}Yo(e){this.e_=e}t_(e){this.n_=e}onMessage(e){this.r_=e}close(){this.Jo()}send(e){this.Ho(e)}i_(){this.Xo()}s_(){this.e_()}o_(e){this.n_(e)}__(e){this.r_(e)}}/**
2111 * @license
2112 * Copyright 2017 Google LLC
2113 *
2114 * Licensed under the Apache License, Version 2.0 (the "License");
2115 * you may not use this file except in compliance with the License.
2116 * You may obtain a copy of the License at
2117 *
2118 *   http://www.apache.org/licenses/LICENSE-2.0
2119 *
2120 * Unless required by applicable law or agreed to in writing, software
2121 * distributed under the License is distributed on an "AS IS" BASIS,
2122 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2123 * See the License for the specific language governing permissions and
2124 * limitations under the License.
2125 */const nr="WebChannelConnection",Iu=(t,e,n)=>{t.listen(e,(r=>{try{n(r)}catch(s){setTimeout((()=>{throw s}),0)}}))};class tc extends iB{constructor(e){super(e),this.a_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static u_(){if(!tc.c_){const e=Kk();Iu(e,Gk.STAT_EVENT,(n=>{n.stat===nv.PROXY?Te(nr,"STAT_EVENT: detected buffering proxy"):n.stat===nv.NOPROXY&&Te(nr,"STAT_EVENT: detected no buffering proxy")})),tc.c_=!0}}zo(e,n,r,s,i){const a=pv();return new Promise(((c,u)=>{const d=new qk;d.setWithCredentials(!0),d.listenOnce(Wk.COMPLETE,(()=>{try{switch(d.getLastErrorCode()){case jf.NO_ERROR:const g=d.getResponseJson();Te(nr,`XHR for RPC '${e}' ${a} received:`,JSON.stringify(g)),c(g);break;case jf.TIMEOUT:Te(nr,`RPC '${e}' ${a} timed out`),u(new be(ce.DEADLINE_EXCEEDED,"Request time out"));break;case jf.HTTP_ERROR:const y=d.getStatus();if(Te(nr,`RPC '${e}' ${a} failed with status:`,y,"response text:",d.getResponseText()),y>0){let x=d.getResponseJson();Array.isArray(x)&&(x=x[0]);const b=x?.error;if(b&&b.status&&b.message){const E=(function(R){const C=R.toLowerCase().replace(/_/g,"-");return Object.values(ce).indexOf(C)>=0?C:ce.UNKNOWN})(b.status);u(new be(E,b.message))}else u(new be(ce.UNKNOWN,"Server responded with status "+d.getStatus()))}else u(new be(ce.UNAVAILABLE,"Connection failed."));break;default:ze(9055,{l_:e,streamId:a,h_:d.getLastErrorCode(),P_:d.getLastError()})}}finally{Te(nr,`RPC '${e}' ${a} completed.`)}}));const f=JSON.stringify(s);Te(nr,`RPC '${e}' ${a} sending request:`,s),d.send(n,"POST",f,r,15)}))}T_(e,n,r){const s=pv(),i=[this.qo,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=this.createWebChannelTransport(),c={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},u=this.longPollingOptions.timeoutSeconds;u!==void 0&&(c.longPollingTimeout=Math.round(1e3*u)),this.useFetchStreams&&(c.useFetchStreams=!0),this.Go(c.initMessageHeaders,n,r),c.encodeInitMessageHeaders=!0;const d=i.join("");Te(nr,`Creating RPC '${e}' stream ${s}: ${d}`,c);const f=a.createWebChannel(d,c);this.I_(f);let g=!1,y=!1;const x=new oB({Ho:b=>{y?Te(nr,`Not sending because RPC '${e}' stream ${s} is closed:`,b):(g||(Te(nr,`Opening RPC '${e}' stream ${s} transport.`),f.open(),g=!0),Te(nr,`RPC '${e}' stream ${s} sending:`,b),f.send(b))},Jo:()=>f.close()});return Iu(f,Lu.EventType.OPEN,(()=>{y||(Te(nr,`RPC '${e}' stream ${s} transport opened.`),x.i_())})),Iu(f,Lu.EventType.CLOSE,(()=>{y||(y=!0,Te(nr,`RPC '${e}' stream ${s} transport closed`),x.o_(),this.E_(f))})),Iu(f,Lu.EventType.ERROR,(b=>{y||(y=!0,Ua(nr,`RPC '${e}' stream ${s} transport errored. Name:`,b.name,"Message:",b.message),x.o_(new be(ce.UNAVAILABLE,"The operation could not be completed")))})),Iu(f,Lu.EventType.MESSAGE,(b=>{if(!y){const E=b.data[0];yt(!!E,16349);const w=E,R=w?.error||w[0]?.error;if(R){Te(nr,`RPC '${e}' stream ${s} received error:`,R);const C=R.status;let k=(function($){const D=dn[$];if(D!==void 0)return I2(D)})(C),N=R.message;C==="NOT_FOUND"&&N.includes("database")&&N.includes("does not exist")&&N.includes(this.databaseId.database)&&Ua(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),k===void 0&&(k=ce.INTERNAL,N="Unknown error status: "+C+" with message "+R.message),y=!0,x.o_(new be(k,N)),f.close()}else Te(nr,`RPC '${e}' stream ${s} received:`,E),x.__(E)}})),tc.u_(),setTimeout((()=>{x.s_()}),0),x}terminate(){this.a_.forEach((e=>e.close())),this.a_=[]}I_(e){this.a_.push(e)}E_(e){this.a_=this.a_.filter((n=>n===e))}Go(e,n,r){super.Go(e,n,r),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return Yk()}}/**
2126 * @license
2127 * Copyright 2020 Google LLC
2128 *
2129 * Licensed under the Apache License, Version 2.0 (the "License");
2130 * you may not use this file except in compliance with the License.
2131 * You may obtain a copy of the License at
2132 *
2133 *   http://www.apache.org/licenses/LICENSE-2.0
2134 *
2135 * Unless required by applicable law or agreed to in writing, software
2136 * distributed under the License is distributed on an "AS IS" BASIS,
2137 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2138 * See the License for the specific language governing permissions and
2139 * limitations under the License.
2140 */function aB(t){return new tc(t)}function ty(){return typeof document<"u"?document:null}/**
2141 * @license
2142 * Copyright 2020 Google LLC
2143 *
2144 * Licensed under the Apache License, Version 2.0 (the "License");
2145 * you may not use this file except in compliance with the License.
2146 * You may obtain a copy of the License at
2147 *
2148 *   http://www.apache.org/licenses/LICENSE-2.0
2149 *
2150 * Unless required by applicable law or agreed to in writing, software
2151 * distributed under the License is distributed on an "AS IS" BASIS,
2152 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2153 * See the License for the specific language governing permissions and
2154 * limitations under the License.
2155 */function Bm(t){return new dM(t,!0)}/**
2156 * @license
2157 * Copyright 2017 Google LLC
2158 *
2159 * Licensed under the Apache License, Version 2.0 (the "License");
2160 * you may not use this file except in compliance with the License.
2161 * You may obtain a copy of the License at
2162 *
2163 *   http://www.apache.org/licenses/LICENSE-2.0
2164 *
2165 * Unless required by applicable law or agreed to in writing, software
2166 * distributed under the License is distributed on an "AS IS" BASIS,
2167 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2168 * See the License for the specific language governing permissions and
2169 * limitations under the License.
2170 */tc.c_=!1;class H2{constructor(e,n,r=1e3,s=1.5,i=6e4){this.Ci=e,this.timerId=n,this.R_=r,this.A_=s,this.V_=i,this.d_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.d_=0}g_(){this.d_=this.V_}p_(e){this.cancel();const n=Math.floor(this.d_+this.y_()),r=Math.max(0,Date.now()-this.f_),s=Math.max(0,n-r);s>0&&Te("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.d_} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.m_=this.Ci.enqueueAfterDelay(this.timerId,s,(()=>(this.f_=Date.now(),e()))),this.d_*=this.A_,this.d_<this.R_&&(this.d_=this.R_),this.d_>this.V_&&(this.d_=this.V_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.d_}}/**
2171 * @license
2172 * Copyright 2017 Google LLC
2173 *
2174 * Licensed under the Apache License, Version 2.0 (the "License");
2175 * you may not use this file except in compliance with the License.
2176 * You may obtain a copy of the License at
2177 *
2178 *   http://www.apache.org/licenses/LICENSE-2.0
2179 *
2180 * Unless required by applicable law or agreed to in writing, softw
2180are
2181 * distributed under the License is distributed on an "AS IS" BASIS,
2182 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2183 * See the License for the specific language governing permissions and
2184 * limitations under the License.
2185 */const pA="PersistentStream";class q2{constructor(e,n,r,s,i,a,c,u){this.Ci=e,this.b_=r,this.S_=s,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=c,this.listener=u,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new H2(e,n)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Ci.enqueueAfterDelay(this.b_,6e4,(()=>this.k_())))}K_(e){this.q_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}q_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,n){this.q_(),this.U_(),this.M_.cancel(),this.D_++,e!==4?this.M_.reset():n&&n.code===ce.RESOURCE_EXHAUSTED?(Hi(n.toString()),Hi("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):n&&n.code===ce.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.W_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.t_(n)}W_(){}auth(){this.state=1;const e=this.Q_(this.D_),n=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([r,s])=>{this.D_===n&&this.G_(r,s)}),(r=>{e((()=>{const s=new be(ce.UNKNOWN,"Fetching auth token failed: "+r.message);return this.z_(s)}))}))}G_(e,n){const r=this.Q_(this.D_);this.stream=this.j_(e,n),this.stream.Zo((()=>{r((()=>this.listener.Zo()))})),this.stream.Yo((()=>{r((()=>(this.state=2,this.v_=this.Ci.enqueueAfterDelay(this.S_,1e4,(()=>(this.O_()&&(this.state=3),Promise.resolve()))),this.listener.Yo())))})),this.stream.t_((s=>{r((()=>this.z_(s)))})),this.stream.onMessage((s=>{r((()=>++this.F_==1?this.H_(s):this.onNext(s)))}))}N_(){this.state=5,this.M_.p_((async()=>{this.state=0,this.start()}))}z_(e){return Te(pA,`close with error: ${e}`),this.stream=null,this.close(4,e)}Q_(e){return n=>{this.Ci.enqueueAndForget((()=>this.D_===e?n():(Te(pA,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class lB extends q2{constructor(e,n,r,s,i,a){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,s,a),this.serializer=i}j_(e,n){return this.connection.T_("Listen",e,n)}H_(e){return this.onNext(e)}onNext(e){this.M_.reset();const n=pM(this.serializer,e),r=(function(i){if(!("targetChange"in i))return Ge.min();const a=i.targetChange;return a.targetIds&&a.targetIds.length?Ge.min():a.readTime?ri(a.readTime):Ge.min()})(e);return this.listener.J_(n,r)}Z_(e){const n={};n.database=hv(this.serializer),n.addTarget=(function(i,a){let c;const u=a.target;if(c=av(u)?{documents:yM(i,u)}:{query:vM(i,u).ft},c.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){c.resumeToken=D2(i,a.resumeToken);const d=cv(i,a.expectedCount);d!==null&&(c.expectedCount=d)}else if(a.snapshotVersion.compareTo(Ge.min())>0){c.readTime=Wp(i,a.snapshotVersion.toTimestamp());const d=cv(i,a.expectedCount);d!==null&&(c.expectedCount=d)}return c})(this.serializer,e);const r=xM(this.serializer,e);r&&(n.labels=r),this.K_(n)}X_(e){const n={};n.database=hv(this.serializer),n.removeTarget=e,this.K_(n)}}class cB extends q2{constructor(e,n,r,s,i,a){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,s,a),this.serializer=i}get Y_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}W_(){this.Y_&&this.ea([])}j_(e,n){return this.connection.T_("Write",e,n)}H_(e){return yt(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,yt(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){yt(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();const n=gM(e.writeResults,e.commitTime),r=ri(e.commitTime);
2185return this.listener.na(r,n)}ra(){const e={};e.database=hv(this.serializer),this.K_(e)}ea(e){const n={streamToken:this.lastStreamToken,writes:e.map((r=>mM(this.serializer,r)))};this.K_(n)}}/**
2186 * @license
2187 * Copyright 2017 Google LLC
2188 *
2189 * Licensed under the Apache License, Version 2.0 (the "License");
2190 * you may not use this file except in compliance with the License.
2191 * You may obtain a copy of the License at
2192 *
2193 *   http://www.apache.org/licenses/LICENSE-2.0
2194 *
2195 * Unless required by applicable law or agreed to in writing, software
2196 * distributed under the License is distributed on an "AS IS" BASIS,
2197 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2198 * See the License for the specific language governing permissions and
2199 * limitations under the License.
2200 */class uB{}class dB extends uB{constructor(e,n,r,s){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=s,this.ia=!1}sa(){if(this.ia)throw new be(ce.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,n,r,s){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,a])=>this.connection.Wo(e,uv(n,r),s,i,a))).catch((i=>{throw i.name==="FirebaseError"?(i.code===ce.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new be(ce.UNKNOWN,i.toString())}))}jo(e,n,r,s,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([a,c])=>this.connection.jo(e,uv(n,r),s,a,c,i))).catch((a=>{throw a.name==="FirebaseError"?(a.code===ce.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new be(ce.UNKNOWN,a.toString())}))}terminate(){this.ia=!0,this.connection.terminate()}}function hB(t,e,n,r){return new dB(t,e,n,r)}class fB{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve()))))}ha(e){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,e==="Online"&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){const n=`Could not reach Cloud Firestore backend. ${e}
2201This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(Hi(n),this.aa=!1):Te("OnlineStateTracker",n)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}}/**
2202 * @license
2203 * Copyright 2017 Google LLC
2204 *
2205 * Licensed under the Apache License, Version 2.0 (the "License");
2206 * you may not use this file except in compliance with the License.
2207 * You may obtain a copy of the License at
2208 *
2209 *   http://www.apache.org/licenses/LICENSE-2.0
2210 *
2211 * Unless required by applicable law or agreed to in writing, software
2212 * distributed under the License is distributed on an "AS IS" BASIS,
2213 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2214 * See the License for the specific language governing permissions and
2215 * limitations under the License.
2216 */const $a="RemoteStore";class pB{constructor(e,n,r,s,i){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.Ta=[],this.Ia=new Map,this.Ea=new Set,this.Ra=[],this.Aa=i,this.Aa.Mo((a=>{r.enqueueAndForget((async()=>{Ja(this)&&(Te($a,"Restarting streams for network reachability change."),await(async function(u){const d=Qe(u);d.Ea.add(4),await Fd(d),d.Va.set("Unknown"),d.Ea.delete(4),await Vm(d)})(this))}))})),this.Va=new fB(r,s)}}async function Vm(t){if(Ja(t))for(const e of t.Ra)await e(!0)}async function Fd(t){for(const e of t.Ra)await e(!1)}function W2(t,e){const n=Qe(t);n.Ia.has(e.targetId)||(n.Ia.set(e.targetId,e),H_(n)?z_(n):Nc(n).O_()&&$_(n,e))}function U_(t,e){const n=Qe(t),r=Nc(n);n.Ia.delete(e),r.O_()&&G2(n,e),n.Ia.size===0&&(r.O_()?r.L_():Ja(n)&&n.Va.set("Unknown"))}function $_(t,e){if(t.da.$e(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(Ge.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}Nc(t).Z_(e)}function G2(t,e){t.da.$e(e),Nc(t).X_(e)}function z_(t){t.da=new aM({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),At:e=>t.Ia.get(e)||null,ht:()=>t.datastore.serializer.databaseId}),Nc(t).start(),t.Va.ua()}function H_(t){return Ja(t)&&!Nc(t).x_()&&t.Ia.size>0}function Ja(t){return Qe(t).Ea.size===0}function K2(t){t.da=void 0}async function mB(t){t.Va.set("Online")}
vendor: 9,264 bytes, lines 2216-2268
2216async function gB(t){t.Ia.forEach(((e,n)=>{$_(t,e)}))}async function yB(t,e){K2(t),H_(t)?(t.Va.ha(e),z_(t)):t.Va.set("Unknown")}async function vB(t,e,n){if(t.Va.set("Online"),e instanceof R2&&e.state===2&&e.cause)try{await(async function(s,i){const a=i.cause;for(const c of i.targetIds)s.Ia.has(c)&&(await s.remoteSyncer.rejectListen(c,a),s.Ia.delete(c),s.da.removeTarget(c))})(t,e)}catch(r){Te($a,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Kp(t,r)}else if(e instanceof Uf?t.da.Xe(e):e instanceof P2?t.da.st(e):t.da.tt(e),!n.isEqual(Ge.min()))try{const r=await z2(t.localStore);n.compareTo(r)>=0&&await(function(i,a){const c=i.da.Tt(a);return c.targetChanges.forEach(((u,d)=>{if(u.resumeToken.approximateByteSize()>0){const f=i.Ia.get(d);f&&i.Ia.set(d,f.withResumeToken(u.resumeToken,a))}})),c.targetMismatches.forEach(((u,d)=>{const f=i.Ia.get(u);if(!f)return;i.Ia.set(u,f.withResumeToken(Kn.EMPTY_BYTE_STRING,f.snapshotVersion)),G2(i,u);const g=new Ro(f.target,u,d,f.sequenceNumber);$_(i,g)})),i.remoteSyncer.applyRemoteEvent(c)})(t,n)}catch(r){Te($a,"Failed to raise snapshot:",r),await Kp(t,r)}}async function Kp(t,e,n){if(!Rc(e))throw e;t.Ea.add(1),await Fd(t),t.Va.set("Offline"),n||(n=()=>z2(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Te($a,"Retrying IndexedDB access"),await n(),t.Ea.delete(1),await Vm(t)}))}function Y2(t,e){return e().catch((n=>Kp(t,n,e)))}async function Um(t){const e=Qe(t),n=zo(e);let r=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:C_;for(;_B(e);)try{const s=await ZM(e.localStore,r);if(s===null){e.Ta.length===0&&n.L_();break}r=s.batchId,xB(e,s)}catch(s){await Kp(e,s)}Q2(e)&&J2(e)}function _B(t){return Ja(t)&&t.Ta.length<10}function xB(t,e){t.Ta.push(e);const n=zo(t);n.O_()&&n.Y_&&n.ea(e.mutations)}function Q2(t){return Ja(t)&&!zo(t).x_()&&t.Ta.length>0}function J2(t){zo(t).start()}async function wB(t){zo(t).ra()}async function EB(t){const e=zo(t);for(const n of t.Ta)e.ea(n.mutations)}async function bB(t,e,n){const r=t.Ta.shift(),s=O_.from(r,e,n);await Y2(t,(()=>t.remoteSyncer.applySuccessfulWrite(s))),await Um(t)}async function AB(t,e){e&&zo(t).Y_&&await(async function(r,s){if((function(a){return sM(a)&&a!==ce.ABORTED})(s.code)){const i=r.Ta.shift();zo(r).B_(),await Y2(r,(()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s))),await Um(r)}})(t,e),Q2(t)&&J2(t)}async function mA(t,e){const n=Qe(t);n.asyncQueue.verifyOperationInProgress(),Te($a,"RemoteStore received new credentials");const r=Ja(n);n.Ea.add(3),await Fd(n),r&&n.Va.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.Ea.delete(3),await Vm(n)}async function TB(t,e){const n=Qe(t);e?(n.Ea.delete(2),await Vm(n)):e||(n.Ea.add(2),await Fd(n),n.Va.set("Unknown"))}function Nc(t){return t.ma||(t.ma=(function(n,r,s){const i=Qe(n);return i.sa(),new lB(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)})(t.datastore,t.asyncQueue,{Zo:mB.bind(null,t),Yo:gB.bind(null,t),t_:yB.bind(null,t),J_:vB.bind(null,t)}),t.Ra.push((async e=>{e?(t.ma.B_(),H_(t)?z_(t):t.Va.set("Unknown")):(await t.ma.stop(),K2(t))}))),t.ma}function zo(t){return t.fa||(t.fa=(function(n,r,s){const i=Qe(n);return i.sa(),new cB(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)})(t.datastore,t.asyncQueue,{Zo:()=>Promise.resolve(),Yo:wB.bind(null,t),t_:AB.bind(null,t),ta:EB.bind(null,t),na:bB.bind(null,t)}),t.Ra.push((async e=>{e?(t.fa.B_(),await Um(t)):(await t.fa.stop(),t.Ta.length>0&&(Te($a,`Stopping write stream with ${t.Ta.length} pending writes`),t.Ta=[]))}))),t.fa}/**
2217 * @license
2218 * Copyright 2017 Google LLC
2219 *
2220 * Licensed under the Apache License, Version 2.0 (the "License");
2221 * you may not use this file except in compliance with the License.
2222 * You may obtain a copy of the License at
2223 *
2224 *   http://www.apache.org/licenses/LICENSE-2.0
2225 *
2226 * Unless required by applicable law or agreed to in writing, software
2227 * distributed under the License is distributed on an "AS IS" BASIS,
2228 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2229 * See the License for the specific language governing permissions and
2230 * limitations under the License.
2231 */class q_{constructor(e,n,r,s,i){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new Lo,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((a=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,s,i){const a=Date.now()+r,c=new q_(e,n,a,s,i);return c.start(r),c}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new be(ce.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function W_(t,e){if(Hi("AsyncQueue",`${e}: ${t}`),Rc(t))return new be(ce.UNAVAILABLE,`${e}: ${t}`);throw t}/**
2232 * @license
2233 * Copyright 2017 Google LLC
2234 *
2235 * Licensed under the Apache License, Version 2.0 (the "License");
2236 * you may not use this file except in compliance with the License.
2237 * You may obtain a copy of the License at
2238 *
2239 *   http://www.apache.org/licenses/LICENSE-2.0
2240 *
2241 * Unless required by applicable law or agreed to in writing, software
2242 * distributed under the License is distributed on an "AS IS" BASIS,
2243 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2244 * See the License for the specific language governing permissions and
2245 * limitations under the License.
2246 */class nc{static emptySet(e){return new nc(e.comparator)}constructor(e){this.comparator=e?(n,r)=>e(n,r)||Le.comparator(n.key,r.key):(n,r)=>Le.comparator(n.key,r.key),this.keyedMap=Fu(),this.sortedSet=new Kt(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((n,r)=>(e(n),!1)))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof nc)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach((n=>{e.push(n.toString())})),e.length===0?"DocumentSet ()":`DocumentSet (
2247  `+e.join(`  
2248`)+`
2249)`}copy(e,n){const r=new nc;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/**
2250 * @license
2251 * Copyright 2017 Google LLC
2252 *
2253 * Licensed under the Apache License, Version 2.0 (the "License");
2254 * you may not use this file except in compliance with the License.
2255 * You may obtain a copy of the License at
2256 *
2257 *   http://www.apache.org/licenses/LICENSE-2.0
2258 *
2259 * Unless required by applicable law or agreed to in writing, software
2260 * distributed under the License is distributed on an "AS IS" BASIS,
2261 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2262 * See the License for the specific language governing permissions and
2263 * limitations under the License.
2264 */class gA{constructor(){this.ga=new Kt(Le.comparator)}track(e){const n=e.doc.key,r=this.ga.get(n);r?e.type!==0&&r.type===3?this.ga=this.ga.insert(n,e):e.type===3&&r.type!==1?this.ga=this.ga.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.ga=this.ga.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.ga=this.ga.remove(n):e.type===1&&r.type===2?this.ga=this.ga.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):ze(63341,{Vt:e,pa:r}):this.ga=this.ga.insert(n,e)}ya(){const e=[];return this.ga.inorderTraversal(((n,r)=>{e.push(r)})),e}}class mc{constructor(e,n,r,s,i,a,c,u,d){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=c,this.excludesMetadataChanges=u,this.hasCachedResults=d}static fromInitialDocuments(e,n,r,s,i){const a=[];return n.forEach((c=>{a.push({type:0,doc:c})})),new mc(e,n,nc.emptySet(n),a,r,s,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Om(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let s=0;s<n.length;s++)if(n[s].type!==r[s].type||!n[s].doc.isEqual(r[s].doc))return!1;return!0}}/**
2265 * @license
2266 * Copyright 2017 Google LLC
2267 *
2268 * Licensed under the Apache License, Version 2.0 (the "License");
2269 * you may not use this file except in compliance with the License.
2270 * You may obtain a copy of the License at
2271 *
2272 *   http://www.apache.org/licenses/LICENSE-2.0
2273 *
2274 * Unless required by applicable law or agreed to in writing, software
2275 * distributed under the License is distributed on an "AS IS" BASIS,
2276 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2277 * See the License for the specific language governing permissions and
2278 * limitations under the License.
2279 */class CB{constructor(){this.wa=void 0,this.ba=[]}Sa(){return this.ba.some((e=>e.Da()))}}class SB{constructor(){this.queries=yA(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(n,r){const s=Qe(n),i=s.queries;s.queries=yA(),i.forEach(((a,c)=>{for(const u of c.ba)u.onError(r)}))})(this,new be(ce.ABORTED,"Firestore shutting down"))}}function yA(){return new Qa((t=>y2(t)),Om)}async function X2(t,e){const n=Qe(t);let r=3;const s=e.query;let i=n.queries.get(s);i?!i.Sa()&&e.Da()&&(r=2):(i=new CB,r=e.Da()?0:1);try{switch(r){case 0:i.wa=await n.onListen(s,!0);break;case 1:i.wa=await n.onListen(s,!1);break;case 2:await n.onFirstRemoteStoreListen(s)}}catch(a){const c=W_(a,`Initialization of query '${Hl(e.query)}' failed`);return void e.onError(c)}n.queries.set(s,i),i.ba.push(e),e.va(n.onlineState),i.wa&&e.Fa(i.wa)&&G_(n)}async function Z2(t,e){const n=Qe(t),r=e.query;let s=3;const i=n.queries.get(r);if(i){const a=i.ba.indexOf(e);a>=0&&(i.ba.splice(a,1),i.ba.length===0?s=e.Da()?0:1:!i.Sa()&&e.Da()&&(s=2))}switch(s){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function kB(t,e){const n=Qe(t);let r=!1;for(const s of e){const i=s.query,a=n.queries.get(i);if(a){for(const c of a.ba)c.Fa(s)&&(r=!0);a.wa=s}}r&&G_(n)}function IB(t,e,n){const r=Qe(t),s=r.queries.get(e);if(s)for(const i of s.ba)i.onError(n);r.queries.delete(e)}function G_(t){t.Ca.forEach((e=>{e.next()}))}var mv,vA;(vA=mv||(mv={})).Ma="default",vA.Cache="cache";class eI{constructor(e,n,r){this.query=e,this.xa=n,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=r||{}}Fa(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new mc(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),n=!0):this.La(e,this.onlineState)&&(this.ka(e),n=!0),this.Na=e,n}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let n=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),n=!0),n}La(e,n){if(!e.fromCache||!this.Da())return!0;const r=n!=="Offline";return(!this.options.Ka||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;const n=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}ka(e){e=mc.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==mv.Cache}}/**
2280 * @license
2281 * Copyright 2017 Google LLC
2282 *
2283 * Licensed under the Apache License, Version 2.0 (the "License");
2284 * you may not use this file except in compliance with the License.
2285 * You may obtain a copy of the License at
2286 *
2287 *   http://www.apache.org/licenses/LICENSE-2.0
2288 *
2289 * Unless required by applicable law or agreed to in writing, software
2290 * distributed under the License is distributed on an "AS IS" BASIS,
2291 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2292 * See the License for the specific language governing permissions and
2293 * limitations under the License.
2294 */class tI{constructor(e){this.key=e}}class nI{constructor(e){this.key=e}}class PB{constructor(e,n){this.query=e,this.Za=n,this.Xa=null,this.hasCachedResults=!1,this.current=!1,this.Ya=st(),this.mutatedKeys=st(),this.eu=v2(e),this.tu=new nc(this.eu)}get nu(){return this.Za}ru(e,n){const r=n?n.iu:new gA,s=n?n.tu:this.tu;let i=n?n.mutatedKeys:this.mutatedKeys,a=s,c=!1;const u=this.query.limitType==="F"&&s.size===this.query.limit?s.last(
2294):null,d=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal(((f,g)=>{const y=s.get(f),x=Lm(this.query,g)?g:null,b=!!y&&this.mutatedKeys.has(y.key),E=!!x&&(x.hasLocalMutations||this.mutatedKeys.has(x.key)&&x.hasCommittedMutations);let w=!1;y&&x?y.data.isEqual(x.data)?b!==E&&(r.track({type:3,doc:x}),w=!0):this.su(y,x)||(r.track({type:2,doc:x}),w=!0,(u&&this.eu(x,u)>0||d&&this.eu(x,d)<0)&&(c=!0)):!y&&x?(r.track({type:0,doc:x}),w=!0):y&&!x&&(r.track({type:1,doc:y}),w=!0,(u||d)&&(c=!0)),w&&(x?(a=a.add(x),i=E?i.add(f):i.delete(f)):(a=a.delete(f),i=i.delete(f)))})),this.query.limit!==null)for(;a.size>this.query.limit;){const f=this.query.limitType==="F"?a.last():a.first();a=a.delete(f.key),i=i.delete(f.key),r.track({type:1,doc:f})}return{tu:a,iu:r,Ss:c,mutatedKeys:i}}su(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,s){const i=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;const a=e.iu.ya();a.sort(((f,g)=>(function(x,b){const E=w=>{switch(w){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return ze(20277,{Vt:w})}};return E(x)-E(b)})(f.type,g.type)||this.eu(f.doc,g.doc))),this.ou(r),s=s??!1;const c=n&&!s?this._u():[],u=this.Ya.size===0&&this.current&&!s?1:0,d=u!==this.Xa;return this.Xa=u,a.length!==0||d?{snapshot:new mc(this.query,e.tu,i,a,e.mutatedKeys,u===0,d,!1,!!r&&r.resumeToken.approximateByteSize()>0),au:c}:{au:c}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new gA,mutatedKeys:this.mutatedKeys,Ss:!1},!1)):{au:[]}}uu(e){return!this.Za.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach((n=>this.Za=this.Za.add(n))),e.modifiedDocuments.forEach((n=>{})),e.removedDocuments.forEach((n=>this.Za=this.Za.delete(n))),this.current=e.current)}_u(){if(!this.current)return[];const e=this.Ya;this.Ya=st(),this.tu.forEach((r=>{this.uu(r.key)&&(this.Ya=this.Ya.add(r.key))}));const n=[];return e.forEach((r=>{this.Ya.has(r)||n.push(new nI(r))})),this.Ya.forEach((r=>{e.has(r)||n.push(new tI(r))})),n}cu(e){this.Za=e.ks,this.Ya=st();const n=this.ru(e.documents);return this.applyChanges(n,!0)}lu(){return mc.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Xa===0,this.hasCachedResults)}}const K_="SyncEngine";class RB{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class DB{constructor(e){this.key=e,this.hu=!1}}class NB{constructor(e,n,r,s,i,a){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.Pu={},this.Tu=new Qa((c=>y2(c)),Om),this.Iu=new Map,this.Eu=new Set,this.Ru=new Kt(Le.comparator),this.Au=new Map,this.Vu=new j_,this.du={},this.mu=new Map,this.fu=pc.ar(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}}async function OB(t,e,n=!0){const r=lI(t);let s;const i=r.Tu.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.lu()):s=await rI(r,e,n,!0),s}async function LB(t,e){const n=lI(t);await rI(n,e,!0,!1)}async function rI(t,e,n,r){const s=await eB(t.localStore,ni(e)),i=s.targetId,a=t.sharedClientState.addLocalQueryTarget(i,n);let c;return r&&(c=await FB(t,e,i,a==="current",s.resumeToken)),t.isPrimaryClient&&n&&W2(t.remoteStore,s),c}async function FB(t,e,n,r,s){t.pu=(g,y,x)=>(async function(E,w,R,C){let k=w.view.ru(R);k.Ss&&(k=await uA(E.localStore,w.query,!1).then((({documents:D})=>w.view.ru(D,k))));const N=C&&C.targetChanges.get(w.targetId),V=C&&C.targetMismatches.get(w.targetId)!=null,$=w.view.applyChanges(k,E.isPrimaryClient,N,V);return xA(E,w.targetId,$.au),$.snapshot})(t,g,y,x);const i=await uA(t.localStore,e,!0),a=new PB(e,i.ks),c=a.ru(i.documents),u=Ld.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",s),d=a.applyChanges(c,t.isPrimaryClient,u);xA(t,n,d.au);const f=new RB(e,n,a);return t.Tu.set(e,f),t.Iu.has(n)?t.Iu.get(n).push(e):t.Iu.set(n,[e]),d.snapshot}async function jB(t,e,n){const r=Qe(t),s=r.Tu.get(e),i=r.Iu.get(s.targetId);if(i.length>1)return r.Iu.set(s.targetId,i.filter((a=>!Om(a,e)))),void r.Tu.delete(e);
2294r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await fv(r.localStore,s.targetId,!1).then((()=>{r.sharedClientState.clearQueryState(s.targetId),n&&U_(r.remoteStore,s.targetId),gv(r,s.targetId)})).catch(Pc)):(gv(r,s.targetId),await fv(r.localStore,s.targetId,!0))}async function MB(t,e){const n=Qe(t),r=n.Tu.get(e),s=n.Iu.get(r.targetId);n.isPrimaryClient&&s.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),U_(n.remoteStore,r.targetId))}async function BB(t,e,n){const r=WB(t);try{const s=await(function(a,c){const u=Qe(a),d=Bt.now(),f=c.reduce(((x,b)=>x.add(b.key)),st());let g,y;return u.persistence.runTransaction("Locally write mutations","readwrite",(x=>{let b=qi(),E=st();return u.xs.getEntries(x,f).next((w=>{b=w,b.forEach(((R,C)=>{C.isValidDocument()||(E=E.add(R))}))})).next((()=>u.localDocuments.getOverlayedDocuments(x,b))).next((w=>{g=w;const R=[];for(const C of c){const k=Zj(C,g.get(C.key).overlayedDocument);k!=null&&R.push(new Ko(C.key,k,c2(k.value.mapValue),fs.exists(!0)))}return u.mutationQueue.addMutationBatch(x,d,R,c)})).next((w=>{y=w;const R=w.applyToLocalDocumentSet(g,E);return u.documentOverlayCache.saveOverlays(x,w.batchId,R)}))})).then((()=>({batchId:y.batchId,changes:x2(g)})))})(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),(function(a,c,u){let d=a.du[a.currentUser.toKey()];d||(d=new Kt(rt)),d=d.insert(c,u),a.du[a.currentUser.toKey()]=d})(r,s.batchId,n),await jd(r,s.changes),await Um(r.remoteStore)}catch(s){const i=W_(s,"Failed to persist write");n.reject(i)}}async function sI(t,e){const n=Qe(t);try{const r=await JM(n.localStore,e);
2294e.targetChanges.forEach(((s,i)=>{const a=n.Au.get(i);a&&(yt(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1,22616),s.addedDocuments.size>0?a.hu=!0:s.modifiedDocuments.size>0?yt(a.hu,14607):s.removedDocuments.size>0&&(yt(a.hu,42227),a.hu=!1))})),await jd(n,r,e)}catch(r){await Pc(r)}}function _A(t,e,n){const r=Qe(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const s=[];r.Tu.forEach(((i,a)=>{const c=a.view.va(e);c.snapshot&&s.push(c.snapshot)})),(function(a,c){const u=Qe(a);u.onlineState=c;let d=!1;u.queries.forEach(((f,g)=>{for(const y of g.ba)y.va(c)&&(d=!0)})),d&&G_(u)})(r.eventManager,e),s.length&&r.Pu.J_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function VB(t,e,n){const r=Qe(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.Au.get(e),i=s&&s.key;if(i){let a=new Kt(Le.comparator);a=a.insert(i,or.newNoDocument(i,Ge.min()));const c=st().add(i),u=new Mm(Ge.min(),new Map,new Kt(rt),a,c);await sI(r,u),r.Ru=r.Ru.remove(i),r.Au.delete(e),Y_(r)}else await fv(r.localStore,e,!1).then((()=>gv(r,e,n))).catch(Pc)}async function UB(t,e){const n=Qe(t),r=e.batch.batchId;try{const s=await QM(n.localStore,e);oI(n,r,null),iI(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await jd(n,s)}catch(s){await Pc(s)}}async function $B(t,e,n){const r=Qe(t);try{const s=await(function(a,c){const u=Qe(a);return u.persistence.runTransaction("Reject batch","readwrite-primary",(d=>{let f;return u.mutationQueue.lookupMutationBatch(d,c).next((g=>(yt(g!==null,37113),f=g.keys(),u.mutationQueue.removeMutationBatch(d,g)))).next((()=>u.mutationQueue.performConsistencyCheck(d))).next((()=>u.documentOverlayCache.removeOverlaysForBatchId(d,f,c))).next((()=>u.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(d,f))).next((()=>u.localDocuments.getDocuments(d,f)))}))})(r.localStore,e);oI(r,e,n),iI(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await jd(r,s)}catch(s){await Pc(s)}}function iI(t,e){(t.mu.get(e)||[]).forEach((n=>{n.resolve()})),t.mu.delete(e)}function oI(t,e,n){const r=Qe(t);let s=r.du[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(n?i.reject(n):i.resolve(),s=s.remove(e)),r.du[r.currentUser.toKey()]=s}}
vendor: 1,257 bytes, line 2294
2294function gv(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Iu.get(e))t.Tu.delete(r),n&&t.Pu.yu(r,n);t.Iu.delete(e),t.isPrimaryClient&&t.Vu.Gr(e).forEach((r=>{t.Vu.containsKey(r)||aI(t,r)}))}function aI(t,e){t.Eu.delete(e.path.canonicalString());const n=t.Ru.get(e);n!==null&&(U_(t.remoteStore,n),t.Ru=t.Ru.remove(e),t.Au.delete(n),Y_(t))}function xA(t,e,n){for(const r of n)r instanceof tI?(t.Vu.addReference(r.key,e),zB(t,r)):r instanceof nI?(Te(K_,"Document no longer in limbo: "+r.key),t.Vu.removeReference(r.key,e),t.Vu.containsKey(r.key)||aI(t,r.key)):ze(19791,{wu:r})}function zB(t,e){const n=e.key,r=n.path.canonicalString();t.Ru.get(n)||t.Eu.has(r)||(Te(K_,"New document in limbo: "+n),t.Eu.add(r),Y_(t))}function Y_(t){for(;t.Eu.size>0&&t.Ru.size<t.maxConcurrentLimboResolutions;){const e=t.Eu.values().next().value;t.Eu.delete(e);const n=new Le(Dt.fromString(e)),r=t.fu.next();t.Au.set(r,new DB(n)),t.Ru=t.Ru.insert(n,r),W2(t.remoteStore,new Ro(ni(R_(n.path)),r,"TargetPurposeLimboResolution",Rm.ce))}}async function jd(t,e,n){const r=Qe(t),s=[],i=[],a=[];r.Tu.isEmpty()||(r.Tu.forEach(((c,u)=>{a.push(r.pu(u,e,n).then((d=>{if((d||n)&&r.isPrimaryClient){const f=d?!d.fromCache:n?.targetChanges.get(u.targetId)?.current;
2294r.sharedClientState.updateQueryState(u.targetId,f?"current":"not-current")}if(d){s.push(d);const f=B_.Es(u.targetId,d);i.push(f)}})))})),await Promise.all(a),r.Pu.J_(s),await(async function(u,d){const f=Qe(u);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",(g=>ue.forEach(d,(y=>ue.forEach(y.Ts,(x=>f.persistence.referenceDelegate.addReference(g,y.targetId,x))).next((()=>ue.forEach(y.Is,(x=>f.persistence.referenceDelegate.removeReference(g,y.targetId,x)))))))))}catch(g){if(!Rc(g))throw g;Te(V_,"Failed to update sequence numbers: "+g)}for(const g of d){const y=g.targetId;if(!g.fromCache){const x=f.vs.get(y),b=x.snapshotVersion,E=x.withLastLimboFreeSnapshotVersion(b);f.vs=f.vs.insert(y,E)}}})(r.localStore,i))}async function HB(t,e){const n=Qe(t);if(!n.currentUser.isEqual(e)){Te(K_,"User change. New user:",e.toKey());const r=await $2(n.localStore,e);n.currentUser=e,(function(i,a){i.mu.forEach((c=>{c.forEach((u=>{u.reject(new be(ce.CANCELLED,a))}))})),i.mu.clear()})(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await jd(n,r.Ns)}}function qB(t,e){const n=Qe(t),r=n.Au.get(e);if(r&&r.hu)return st().add(r.key);{let s=st();const i=n.Iu.get(e);if(!i)return s;for(const a of i){const c=n.Tu.get(a);s=s.unionWith(c.view.nu)}return s}}function lI(t){const e=Qe(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=sI.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=qB.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=VB.bind(null,e),e.Pu.J_=kB.bind(null,e.eventManager),e.Pu.yu=IB.bind(null,e.eventManager),e}function WB(t){const e=Qe(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=UB.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=$B.bind(null,e),e}class Yp{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Bm(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,n){return null}Mu(e,n){return null}vu(e){return YM(this.persistence,new WM,e.initialUser,this.serializer)}Cu(e){return new U2(M_.Vi,this.serializer)}Du(e){return new nB}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Yp.provider={build:()=>new Yp};class GB extends Yp{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,n){yt(this.persistence.referenceDelegate instanceof Gp,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new RM(r,e.asyncQueue,n)}Cu(e){const n=this.cacheSizeBytes!==void 0?kr.withCacheSize(this.cacheSizeBytes):kr.DEFAULT;return new U2((r=>Gp.Vi(r,n)),this.serializer)}}class yv{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>_A(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=HB.bind(null,this.syncEngine),await TB(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return(function(){return new SB})()}createDatastore(e){const n=Bm(e.databaseInfo.databaseId),r=aB(e.databaseInfo);return hB(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return(function(r,s,i,a,c){return new pB(r,s,i,a,c)})(this.localStore,this.datastore,e.asyncQueue,(n=>_A(this.syncEngine,n,0)),(function(){return fA.v()?new fA:new rB})())}createSyncEngine(e,n){return(function(s,i,a,c,u,d,f){const g=new NB(s,i,a,c,u,d);return f&&(g.gu=!0),g})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){await(async function(n){const r=Qe(n);Te($a,"RemoteStore shutting down."),r.Ea.add(5),await Fd(r),r.Aa.shutdown(),r.Va.set("Unknown")})(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}}yv.provider={build:()=>new yv};/**
2295 * @license
2296 * Copyright 2020 Google LLC
2297 *
2298 * Licensed under the Apache License, Version 2.0 (the "License");
2299 * you may not use this file except in compliance with the License.
2300 * You may obtain a copy of the License at
2301 *
2302 *   http://www.apache.org/licenses/LICENSE-2.0
2303 *
2304 * Unless required by applicable law or agreed to in writing, software
2305 * distributed under the License is distributed on an "AS IS" BASIS,
2306 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2307 * See the License for the specific language governing permissions and
2308 * limitations under the License.
2309 *//**
2310 * @license
2311 * Copyright 2017 Google LLC
2312 *
2313 * Licensed under the Apache License, Version 2.0 (the "License");
2314 * you may not use this file except in compliance with the License.
2315 * You may obtain a copy of the License at
2316 *
2317 *   http://www.apache.org/licenses/LICENSE-2.0
2318 *
2319 * Unless required by applicable law or agreed to in writing, software
2320 * distributed under the License is distributed on an "AS IS" BASIS,
2321 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2322 * See the License for the specific language governing permissions and
2323 * limitations under the License.
2324 */class cI{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):Hi("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,n){setTimeout((()=>{this.muted||e(n)}),0)}}/**
2325 * @license
2326 * Copyright 2017 Google LLC
2327 *
2328 * Licensed under the Apache License, Version 2.0 (the "License");
2329 * you may not use this file except in compliance with the License.
2330 * You may obtain a copy of the License at
2331 *
2332 *   http://www.apache.org/licenses/LICENSE-2.0
2333 *
2334 * Unless required by applicable law or agreed to in writing, software
2335 * distributed under the License is distributed on an "AS IS" BASIS,
2336 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2337 * See the License for the specific language governing permissions and
2338 * limitations under the License.
2339 */const Ho="FirestoreClient";class KB{constructor(e,n,r,s,i){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this._databaseInfo=s,this.user=ir.UNAUTHENTICATED,this.clientId=T_.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,(async a=>{Te(Ho,"Received user=",a.uid),await this.authCredentialListener(a),this.user=a})),this.appCheckCredentials.start(r,(a=>(Te(Ho,"Received new app check token=",a),this.appCheckCredentialListener(a,this.user))))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Lo;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){const r=W_(n,"Failed to shutdown persistence");e.reject(r)}})),e.promise}}async function ny(t,e){t.asyncQueue.verifyOperationInProgress(),Te(Ho,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async s=>{r.isEqual(s)||(await $2(e.localStore,s),r=s)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t._offlineComponents=e}async function wA(t,e){t.asyncQueue.verifyOperationInProgress();const n=await YB(t);Te(Ho,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener((r=>mA(e.remoteStore,r))),t.setAppCheckTokenChangeListener(((r,s)=>mA(e.remoteStore,s))),t._onlineComponents=e}async function YB(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){Te(Ho,"Using user provided OfflineComponentProvider");try{await ny(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!(function(s){return s.name==="FirebaseError"?s.code===ce.FAILED_PRECONDITION||s.code===ce.UNIMPLEMENT
2339ED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11})(n))throw n;Ua("Error using user provided cache. Falling back to memory cache: "+n),await ny(t,new Yp)}}else Te(Ho,"Using default OfflineComponentProvider"),await ny(t,new GB(void 0));return t._offlineComponents}async function uI(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(Te(Ho,"Using user provided OnlineComponentProvider"),await wA(t,t._uninitializedComponentsProvider._online)):(Te(Ho,"Using default OnlineComponentProvider"),await wA(t,new yv))),t._onlineComponents}function QB(t){return uI(t).then((e=>e.syncEngine))}async function vv(t){const e=await uI(t),n=e.eventManager;return n.onListen=OB.bind(null,e.syncEngine),n.onUnlisten=jB.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=LB.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=MB.bind(null,e.syncEngine),n}function JB(t,e,n,r){const s=new cI(r),i=new eI(e,s,n);return t.asyncQueue.enqueueAndForget((async()=>X2(await vv(t),i))),()=>{s.Nu(),t.asyncQueue.enqueueAndForget((async()=>Z2(await vv(t),i)))}}function XB(t,e,n={}){const r=new Lo;return t.asyncQueue.enqueueAndForget((async()=>(function(i,a,c,u,d){const f=new cI({next:y=>{f.Nu(),a.enqueueAndForget((()=>Z2(i,g))),y.fromCache&&u.source==="server"?d.reject(new be(ce.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):d.resolve(y)},error:y=>d.reject(y)}),g=new eI(c,f,{includeMetadataChanges:!0,Ka:!0});return X2(i,g)})(await vv(t),t.asyncQueue,e,n,r))),r.promise}function ZB(t,e){const n=new Lo;return t.asyncQueue.enqueueAndForget((async()=>BB(await QB(t),e,n))),n.promise}/**
2340 * @license
2341 * Copyright 2023 Google LLC
2342 *
2343 * Licensed under the Apache License, Version 2.0 (the "License");
2344 * you may not use this file except in compliance with the License.
2345 * You may obtain a copy of the License at
2346 *
2347 *   http://www.apache.org/licenses/LICENSE-2.0
2348 *
2349 * Unless required by applicable law or agreed to in writing, software
2350 * distributed under the License is distributed on an "AS IS" BASIS,
2351 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2352 * See the License for the specific language governing permissions and
2353 * limitations under the License.
2354 */function dI(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/**
2355 * @license
2356 * Copyright 2020 Google LLC
2357 *
2358 * Licensed under the Apache License, Version 2.0 (the "License");
2359 * you may not use this file except in compliance with the License.
2360 * You may obtain a copy of the License at
2361 *
2362 *   http://www.apache.org/licenses/LICENSE-2.0
2363 *
2364 * Unless required by applicable law or agreed to in writing, software
2365 * distributed under the License is distributed on an "AS IS" BASIS,
2366 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2367 * See the License for the specific language governing permissions and
2368 * limitations under the License.
2369 */const eV="ComponentProvider",EA=new Map;function tV(t,e,n,r,s){return new wj(t,e,n,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,dI(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator,r)}/**
2370 * @license
2371 * Copyright 2020 Google LLC
2372 *
2373 * Licensed under the Apache License, Version 2.0 (the "License");
2374 * you may not use this file except in compliance with the License.
2375 * You may obtain a copy of the License at
2376 *
2377 *   http://www.apache.org/licenses/LICENSE-2.0
2378 *
2379 * Unless required by applicable law or agreed to in writing, software
2380 * distributed under the License is distributed on an "AS IS" BASIS,
2381 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2382 * See the License for the specific language governing permissions and
2383 * limitations under the License.
2384 */const hI="firestore.googleapis.com",bA=!0;class AA{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new be(ce.INVA
vendor: 3,161 bytes, line 2384
2384LID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=hI,this.ssl=bA}else this.host=e.host,this.ssl=e.ssl??bA;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=V2;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<IM)throw new be(ce.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}uj("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=dI(e.experimentalLongPollingOptions??{}),(function(r){if(r.timeoutSeconds!==void 0){if(isNaN(r.timeoutSeconds))throw new be(ce.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (must not be NaN)`);if(r.timeoutSeconds<5)throw new be(ce.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (minimum allowed value is 5)`);if(r.timeoutSeconds>30)throw new be(ce.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (maximum allowed value is 30)`)}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(function(r,s){return r.timeoutSeconds===s.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class $m{constructor(e,n,r,s){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new AA({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new be(ce.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new be(ce.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new AA(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(r){if(!r)return new ej;switch(r.type){case"firstParty":return new sj(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;
2384default:throw new be(ce.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}})(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(n){const r=EA.get(n);r&&(Te(eV,"Removing Datastore"),EA.delete(n),r.terminate())})(this),Promise.resolve()}}function nV(t,e,n,r={}){t=Fo(t,$m);const s=li(e),i=t._getSettings(),a={...i,emulatorOptions:t._getEmulatorOptions()},c=`${e}:${n}`;s&&(Tm(`https://${c}`),Cm("Firestore",!0)),i.host!==hI&&i.host!==c&&Ua("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const u={...i,host:c,ssl:s,emulatorOptions:r};if(!Ma(u,a)&&(t._setSettings(u),r.mockUserToken)){let d,f;if(typeof r.mockUserToken=="string")d=r.mockUserToken,f=ir.MOCK_USER;else{d=_k(r.mockUserToken,t._app?.options.projectId);const g=r.mockUserToken.sub||r.mockUserToken.user_id;
vendor: 2,098 bytes, lines 2384-2399
2384if(!g)throw new be(ce.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");f=new ir(g)}t._authCredentials=new tj(new Jk(d,f))}}/**
2385 * @license
2386 * Copyright 2020 Google LLC
2387 *
2388 * Licensed under the Apache License, Version 2.0 (the "License");
2389 * you may not use this file except in compliance with the License.
2390 * You may obtain a copy of the License at
2391 *
2392 *   http://www.apache.org/licenses/LICENSE-2.0
2393 *
2394 * Unless required by applicable law or agreed to in writing, software
2395 * distributed under the License is distributed on an "AS IS" BASIS,
2396 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2397 * See the License for the specific language governing permissions and
2398 * limitations under the License.
2399 */class Yi{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new Yi(this.firestore,e,this._query)}}class En{constructor(e,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new jo(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new En(this.firestore,e,this._key)}toJSON(){return{type:En._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,r){if(Nd(n,En._jsonSchema))return new En(e,r||null,new Le(Dt.fromString(n.referencePath)))}}En._jsonSchemaVersion="firestore/documentReference/1.0",En._jsonSchema={type:pn("string",En._jsonSchemaVersion),referencePath:pn("string")};class jo extends Yi{constructor(e,n,r){super(e,n,R_(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new En(this.firestore,null,new Le(e))}withConverter(e){return new jo(this.firestore,e,this._path)}}function Q_(t,e,...n){if(t=xt(t),Xk("collection","path",e),t instanceof $m){const r=Dt.fromString(e,...n);return jb(r),new jo(t,null,r)}
vendor: 4,749 bytes, lines 2399-2419
2399{if(!(t instanceof En||t instanceof jo))throw new be(ce.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Dt.fromString(e,...n));return jb(r),new jo(t.firestore,null,r)}}function vd(t,e,...n){if(t=xt(t),arguments.length===1&&(e=T_.newId()),Xk("doc","path",e),t instanceof $m){const r=Dt.fromString(e,...n);return Fb(r),new En(t,null,new Le(r))}{if(!(t instanceof En||t instanceof jo))throw new be(ce.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Dt.fromString(e,...n));return Fb(r),new En(t.firestore,t instanceof jo?t.converter:null,new Le(r))}}/**
2400 * @license
2401 * Copyright 2020 Google LLC
2402 *
2403 * Licensed under the Apache License, Version 2.0 (the "License");
2404 * you may not use this file except in compliance with the License.
2405 * You may obtain a copy of the License at
2406 *
2407 *   http://www.apache.org/licenses/LICENSE-2.0
2408 *
2409 * Unless required by applicable law or agreed to in writing, software
2410 * distributed under the License is distributed on an "AS IS" BASIS,
2411 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2412 * See the License for the specific language governing permissions and
2413 * limitations under the License.
2414 */const TA="AsyncQueue";class CA{constructor(e=Promise.resolve()){this.Yu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new H2(this,"async_queue_retry"),this._c=()=>{const r=ty();r&&Te(TA,"Visibility state changed to "+r.visibilityState),this.M_.w_()},this.ac=e;const n=ty();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const n=ty();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise((()=>{}));const n=new Lo;return this.cc((()=>this.ec&&this.sc?Promise.resolve():(e().then(n.resolve,n.reject),n.promise))).then((()=>n.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.Yu.push(e),this.lc())))}async lc(){if(this.Yu.length!==0){try{await this.Yu[0](),this.Yu.shift(),this.M_.reset()}catch(e){if(!Rc(e))throw e;Te(TA,"Operation failed with retryable error: "+e)}this.Yu.length>0&&this.M_.p_((()=>this.lc()))}}cc(e){const n=this.ac.then((()=>(this.rc=!0,e().catch((r=>{throw this.nc=r,this.rc=!1,Hi("INTERNAL UNHANDLED ERROR: ",SA(r)),r})).then((r=>(this.rc=!1,r))))));return this.ac=n,n}enqueueAfterDelay(e,n,r){this.uc(),this.oc.indexOf(e)>-1&&(n=0);const s=q_.createAndSchedule(this,e,n,r,(i=>this.hc(i)));return this.tc.push(s),s}uc(){this.nc&&ze(47125,{Pc:SA(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ic(e){for(const n of this.tc)if(n.timerId===e)return!0;return!1}Ec(e){return this.Tc().then((()=>{this.tc.sort(((n,r)=>n.targetTimeMs-r.targetTimeMs));for(const n of this.tc)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Tc()}))}Rc(e){this.oc.push(e)}hc(e){const n=this.tc.indexOf(e);this.tc.splice(n,1)}}function SA(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+`
2415`+t.stack),e}class gc extends $m{constructor(e,n,r,s){super(e,n,r,s),this.type="firestore",this._queue=new CA,this._persistenceKey=s?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new CA(e),this._firestoreClient=void 0,await e}}}function rV(t,e){const n=typeof t=="object"?t:Sm(),r=typeof t=="string"?t:Vp,s=Rd(n,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=f_("firestore");i&&nV(s,...i)}return s}function zm(t){if(t._terminated)throw new be(ce.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||sV(t),t._firestoreClient}function sV(t){const e=t._freezeSettings(),n=tV(t._databaseId,t._app?.options.appId||"",t._persistenceKey,t._app?.options.apiKey,e);t._componentsProvider||e.localCache?._offlineComponentProvider&&e.localCache?._onlineComponentProvider&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new KB(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&(function(s){const i=s?._online.build();return{_offline:s?._offline.build(i),_online:i}})(t._componentsProvider))}/**
2416 * @license
2417 * Copyright 2020 Google LLC
2418 *
2419 * Licensed under the Apache License, Version 2.0 (the "License");
2420 * you may not use this file except in compliance with the License.
2421 * You may obtain a copy of the License at
2422 *
2423 *   http://www.apache.org/licenses/LICENSE-2.0
2424 *
2425 * Unless required by applicable law or agreed to in writing, software
2426 * distributed under the License is distributed on an "AS IS" BASIS,
2427 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2428 * See the License for the specific language governing permissions and
2429 * limitations under the License.
2430 */class ds{constructor(e){this._byteString=e}static fromBase64String(e){try{return new ds(Kn.fromBase64String(e))}catch(n){throw new be(ce.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new ds(Kn.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:ds._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(Nd(e,ds._jsonSchema))return ds.fromBase64String(e.bytes)}}ds._jsonSchemaVersion="firestore/bytes/1.0",ds._jsonSchema={type:pn("string",ds._jsonSchemaVersion),bytes:pn("string")};/**
2431 * @license
2432 * Copyright 2020 Google LLC
2433 *
2434 * Licensed under the Apache License, Version 2.0 (the "License");
2435 * you may not use this file except in compliance with the License.
2436 * You may obtain a copy of the License at
2437 *
2438 *   http://www.apache.org/licenses/LICENSE-2.0
2439 *
2440 * Unless required by applicable law or agreed to in writing, software
2441 * distributed under the License is distributed on an "AS IS" BASIS,
2442 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2443 * See the License for the specific language governing permissions and
2444 * limitations under the License.
2445 */class J_{constructor(...e){for(let n=0;n<e.length;
2445++n)if(e[n].length===0)throw new be(ce.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Gn(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
2446 * @license
2447 * Copyright 2020 Google LLC
2448 *
2449 * Licensed under the Apache License, Version 2.0 (the "License");
2450 * you may not use this file except in compliance with the License.
2451 * You may obtain a copy of the License at
2452 *
2453 *   http://www.apache.org/licenses/LICENSE-2.0
2454 *
2455 * Unless required by applicable law or agreed to in writing, software
2456 * distributed under the License is distributed on an "AS IS" BASIS,
2457 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2458 * See the License for the specific language governing permissions and
2459 * limitations under the License.
2460 */class X_{constructor(e){this._methodName=e}}/**
2461 * @license
2462 * Copyright 2017 Google LLC
2463 *
2464 * Licensed under the Apache License, Version 2.0 (the "License");
2465 * you may not use this file except in compliance with the License.
2466 * You may obtain a copy of the License at
2467 *
2468 *   http://www.apache.org/licenses/LICENSE-2.0
2469 *
2470 * Unless required by applicable law or agreed to in writing, software
2471 * distributed under the License is distributed on an "AS IS" BASIS,
2472 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2473 * See the License for the specific language governing permissions and
2474 * limitations under the License.
2475 */class si{constructor(e,n){if(!isFinite(e)||e<-90||e>
vendor: 1,833 bytes, lines 2475-2490
247590)throw new be(ce.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new be(ce.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return rt(this._lat,e._lat)||rt(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:si._jsonSchemaVersion}}static fromJSON(e){if(Nd(e,si._jsonSchema))return new si(e.latitude,e.longitude)}}si._jsonSchemaVersion="firestore/geoPoint/1.0",si._jsonSchema={type:pn("string",si._jsonSchemaVersion),latitude:pn("number"),longitude:pn("number")};/**
2476 * @license
2477 * Copyright 2024 Google LLC
2478 *
2479 * Licensed under the Apache License, Version 2.0 (the "License");
2480 * you may not use this file except in compliance with the License.
2481 * You may obtain a copy of the License at
2482 *
2483 *   http://www.apache.org/licenses/LICENSE-2.0
2484 *
2485 * Unless required by applicable law or agreed to in writing, software
2486 * distributed under the License is distributed on an "AS IS" BASIS,
2487 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2488 * See the License for the specific language governing permissions and
2489 * limitations under the License.
2490 */class Ds{constructor(e){this._values=(e||[]).map((n=>n))}toArray(){return this._values.map((e=>e))}isEqual(e){return(function(r,s){if(r.length!==s.length)return!1;for(let i=0;i<r.length;++i)if(r[i]!==s[i])return!1;return!0})(this._values,e._values)}toJSON(){return{type:Ds._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(Nd(e,Ds._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every((n=>typeof n=="number")))return new Ds(e.vectorValues);
vendor: 3,409 bytes, lines 2490-2505
2490throw new be(ce.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}Ds._jsonSchemaVersion="firestore/vectorValue/1.0",Ds._jsonSchema={type:pn("string",Ds._jsonSchemaVersion),vectorValues:pn("object")};/**
2491 * @license
2492 * Copyright 2017 Google LLC
2493 *
2494 * Licensed under the Apache License, Version 2.0 (the "License");
2495 * you may not use this file except in compliance with the License.
2496 * You may obtain a copy of the License at
2497 *
2498 *   http://www.apache.org/licenses/LICENSE-2.0
2499 *
2500 * Unless required by applicable law or agreed to in writing, software
2501 * distributed under the License is distributed on an "AS IS" BASIS,
2502 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2503 * See the License for the specific language governing permissions and
2504 * limitations under the License.
2505 */const iV=/^__.*__$/;class oV{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new Ko(e,this.data,this.fieldMask,n,this.fieldTransforms):new Od(e,this.data,n,this.fieldTransforms)}}class fI{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new Ko(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function pI(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ze(40011,{dataSource:t})}}class Z_{constructor(e,n,r,s,i,a){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.validatePath(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(e){return new Z_({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){const n=this.path?.child(e),r=this.contextWith({path:n,arrayElement:!1});return r.validatePathSegment(e),r}childContextForFieldPath(e){const n=this.path?.child(e),r=this.contextWith({path:n,arrayElement:!1});return r.validatePath(),r}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return Qp(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find((n=>e.isPrefixOf(n)))!==void 0||this.fieldTransforms.find((n=>e.isPrefixOf(n.field)))!==void 0}validatePath(){if(this.path)for(let e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))}validatePathSegment(e){if(e.length===0)throw this.createError("Document fields must not be empty");if(pI(this.dataSource)&&iV.test(e))throw this.createError('Document fields cannot begin and end with "__"')}}class aV{constructor(e,n,r){this.databaseId=e,this.ignoreUndefinedProperties=n,this.serializer=r||Bm(e)}createContext(e,n,r,s=!1){return new Z_({dataSource:e,methodName:n,targetDoc:r,path:Gn.emptyPath(),arrayElement:!1,hasConverter:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function ex(t){const e=t._freezeSettings(),n=Bm(t._databaseId);return new aV(t._databaseId,!!e.ignoreUndefinedProperties,n)}function mI(t,e,n,r,s,i={}){const a=t.createContext(i.merge||i.mergeFields?2:0,e,n,s);tx("Data must be an object, but it was:",a,r);const c=gI(r,a);let u,d;if(i.merge)u=new Kr(a.fieldMask),d=a.fieldTransforms;else if(i.mergeFields){const f=[];for(const g of i.mergeFields){const y=za(e,g,n);
vendor: 1,035 bytes, line 2505
2505if(!a.contains(y))throw new be(ce.INVALID_ARGUMENT,`Field '${y}' is specified in your field mask but missing from your input data.`);_I(f,y)||f.push(y)}u=new Kr(f),d=a.fieldTransforms.filter((g=>u.covers(g.field)))}else u=null,d=a.fieldTransforms;return new oV(new Pr(c),u,d)}class Hm extends X_{_toFieldTransform(e){if(e.dataSource!==2)throw e.dataSource===1?e.createError(`${this._methodName}() can only appear at the top level of your update data`):e.createError(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Hm}}function lV(t,e,n,r){const s=t.createContext(1,e,n);tx("Data must be an object, but it was:",s,r);const i=[],a=Pr.empty();Go(r,((u,d)=>{const f=vI(e,u,n);d=xt(d);const g=s.childContextForFieldPath(f);if(d instanceof Hm)i.push(f);else{const y=Md(d,g);y!=null&&(i.push(f),a.set(f,y))}}));const c=new Kr(i);return new fI(a,c,s.fieldTransforms)}function cV(t,e,n,r,s,i){const a=t.createContext(1,e,n),c=[za(e,r,n)],u=[s];
2505if(i.length%2!=0)throw new be(ce.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let y=0;y<i.length;y+=2)c.push(za(e,i[y])),u.push(i[y+1]);const d=[],f=Pr.empty();for(let y=c.length-1;y>=0;--y)if(!_I(d,c[y])){const x=c[y];let b=u[y];b=xt(b);const E=a.childContextForFieldPath(x);if(b instanceof Hm)d.push(x);else{const w=Md(b,E);w!=null&&(d.push(x),f.set(x,w))}}const g=new Kr(d);return new fI(f,g,a.fieldTransforms)}function uV(t,e,n,r=!1){return Md(n,t.createContext(r?4:3,e))}function Md(t,e){if(yI(t=xt(t)))return tx("Unsupported field value:",e,t),gI(t,e);if(t instanceof X_)return(function(r,s){if(!pI(s.dataSource))throw s.createError(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.createError(`${r._methodName}() is not currently supported inside arrays`);const i=r._toFieldTransform(s);i&&s.fieldTransforms.push(i)})(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.arrayElement&&e.dataSource!==4)throw e.createError("Nested arrays are not supported");return(function(r,s){const i=[];let a=0;for(const c of r){let u=Md(c,s.childContextForArray(a));u==null&&(u={nullValue:"NULL_VALUE"}),i.push(u),a++}return{arrayValue:{values:i}}})(t,e)}return(function(r,s){if((r=xt(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return Gj(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=Bt.fromDate(r);return{timestampValue:Wp(s.serializer,i)}}if(r instanceof Bt){const i=new Bt(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Wp(s.serializer,i)}}if(r instanceof si)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof ds)return{bytesValue:D2(s.serializer,r._byteString)};if(r instanceof En){const i=s.databaseId,a=r.firestore._databaseId;if(!a.isEqual(i))throw s.createError(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:F_(r.firestore._databaseId||s.databaseId,r._key.path)}}if(r instanceof Ds)return(function(a,c){const u=a instanceof Ds?a.toArray():a;return{mapValue:{fields:{[a2]:{stringValue:l2},[Up]:{arrayValue:{values:u.map((f=>{if(typeof f!="number")throw c.createError("VectorValues must only contain numeric values.");return D_(c.serializer,f)}))}}}}}})(r,s);if(B2(r))return r._toProto(s.serializer);throw s.createError(`Unsupported field value: ${Pm(r)}`)})(t,e)}function gI(t,e){const n={};return t2(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Go(t,((r,s)=>{const i=Md(s,e.childContextForField(r));i!=null&&(n[r]=i)})),{mapValue:{fields:n}}}function yI(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Bt||t instanceof si||t instanceof ds||t instanceof En||t instanceof X_||t instanceof Ds||B2(t))}function tx(t,e,n){if(!yI(n)||!Zk(n)){const r=Pm(n);throw r==="an object"?e.createError(t+" a custom object"):e.createError(t+" "+r)}}function za(t,e,n){if((e=xt(e))instanceof J_)return e._internalPath;if(typeof e=="string")return vI(t,e);throw Qp("Field path arguments must be of type string or ",t,!1,void 0,n)}const dV=new RegExp("[~\\*/\\[\\]]");function vI(t,e,n){if(e.search(dV)>=0)throw Qp(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new J_(...e.split("."))._internalPath}catch{throw Qp(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function Qp(t,e,n,r,s){const i=r&&!r.isEmpty(),a=s!==void 0;let c=`Function ${e}() called with invalid data`;n&&(c+=" (via `toFirestore()`)"),c+=". ";let u="";return(i||a)&&(u+=" (found",i&&(u+=` in field ${r}`),a&&(u+=` in document ${s}
2505`),u+=")"),new be(ce.INVALID_ARGUMENT,c+t+u)}function _I(t,e){return t.some((n=>n.isEqual(e)))}/**
2506 * @license
2507 * Copyright 2020 Google LLC
2508 *
2509 * Licensed under the Apache License, Version 2.0 (the "License");
2510 * you may not use this file except in compliance with the License.
2511 * You may obtain a copy of the License at
2512 *
2513 *   http://www.apache.org/licenses/LICENSE-2.0
2514 *
2515 * Unless required by applicable law or agreed to in writing, software
2516 * distributed under the License is distributed on an "AS IS" BASIS,
2517 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2518 * See the License for the specific language governing permissions and
2519 * limitations under the License.
2520 */class hV{convertValue(e,n="none"){switch($o(e)){case 0:return null;case 1:return e.booleanValue;case 2:return an(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(Uo(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 11:return this.convertObject(e.mapValue,n);case 10:return this.convertVectorValue(e.mapValue);default:throw ze(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return Go(e,((s,i)=>{r[s]=this.convertValue(i,n)})),r}convertVectorValue(e){const n=e.fields?.[Up].arrayValue?.values?.map((r=>an(r.doubleValue)));return new Ds(n)}convertGeoPoint(e){return new si(an(e.latitude),an(e.longitude))}convertArray(e,n){return(e.values||[]).map((r=>this.convertValue(r,n)))}convertServerTimestamp(e,n){switch(n){case"previous":const r=Nm(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(hd(e));default:return null}}convertTimestamp(e){const n=Vo(e);return new Bt(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=Dt.fromString(e);yt(M2(r),9688,{name:e});const s=new fd(r.get(1),r.get(3)),i=new Le(r.popFirst(5));return s.isEqual(n)||Hi(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),i}}/**
2521 * @license
2522 * Copyright 2024 Google LLC
2523 *
2524 * Licensed under the Apache License, Version 2.0 (the "License");
2525 * you may not use this file except in compliance with the License.
2526 * You may obtain a copy of the License at
2527 *
2528 *   http://www.apache.org/licenses/LICENSE-2.0
2529 *
2530 * Unless required by applicable law or agreed to in writing, software
2531 * distributed under the License is distributed on an "AS IS" BASIS,
2532 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2533 * See the License for the specific language governing permissions and
2534 * limitations under the License.
2535 */class nx extends hV{constructor(e){super(),this.firestore=e}convertBytes(e){return new ds(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new En(this.firestore,null,n)}}const kA="@firebase/firestore",IA="4.11.0";/**
2536 * @license
2537 * Copyright 2017 Google LLC
2538 *
2539 * Licensed under the Apache License, Version 2.0 (the "License");
2540 * you may not use this file except in compliance with the License.
2541 * You may obtain a copy of the License at
2542 *
2543 *   http://www.apache.org/licenses/LICENSE-2.0
2544 *
2545 * Unless required by applicable law or agreed to in writing, software
2546 * distributed under the License is distributed on an "AS IS" BASIS,
2547 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2548 * See the License for the specific language governing permissions and
2549 * limitations under the License.
2550 */function PA(t){return(function(n,r){if(typeof n!="object"||n===null)return!1;const s=n;for(const i of r)if(i in s&&typeof s[i]=="function")return!0;return!1})(t,["next","error","complete"])}/**
2551 * @license
2552 * Copyright 2020 Google LLC
2553 *
2554 * Licensed under the Apache License, Version 2.0 (the "License");
2555 * you may not use this file except in compliance with the License.
2556 * You may obtain a copy of the License at
2557 *
2558 *   http://www.apache.org/licenses/LICENSE-2.0
2559 *
2560 * Unless required by applicable law or agreed to in writing, software
2561 * distributed under the License is distributed on an "AS IS" BASIS,
2562 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2563 * See the License for the specific language governing permissions and
2564 * limitations under the License.
2565 */class xI{constructor(e,n,r,s,i){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new En(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new fV(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(e){if(this._document){const n=this._document.data.field(za("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class fV extends xI{data(){return super.data()}}/**
2566 * @license
2567 * Copyright 2020 Google LLC
2568 *
2569 * Licensed under the Apache License, Version 2.0 (the "License");
2570 * you may not use this file except in compliance with the License.
2571 * You may obtain a copy of the License at
2572 *
2573 *   http://www.apache.org/licenses/LICENSE-2.0
2574 *
2575 * Unless required by applicable law or agreed to in writing, software
2576 * distributed under the License is distributed on an "AS IS" BASIS,
2577 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2578 * See the License for the specific language governing permissions and
2579 * limitations under the License.
2580 */function wI(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new be(ce.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class rx{}class sx extends rx{}function EI(t,e,...n){let r=[];e instanceof rx&&r.push(e),r=r.concat(n),(function(i){const a=i.filter((u=>u instanceof ix)).length,c=i.filter((u=>u instanceof qm)).length;if(a>1||a>0&&c>
25800)throw new be(ce.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")})(r);for(const s of r)t=s._apply(t);return t}class qm extends sx{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new qm(e,n,r)}_apply(e){const n=this._parse(e);return AI(e._query,n),new Yi(e.firestore,e.converter,lv(e._query,n))}_parse(e){const n=ex(e.firestore);return(function(i,a,c,u,d,f,g){let y;if(d.isKeyField()){if(f==="array-contains"||f==="array-contains-any")throw new be(ce.INVALID_ARGUMENT,`Invalid Query. You can't perform '${f}' queries on documentId().`);if(f==="in"||f==="not-in"){DA(g,f);const b=[];for(const E of g)b.push(RA(u,i,E));y={arrayValue:{values:b}}}else y=RA(u,i,g)}else f!=="in"&&f!=="not-in"&&f!=="array-contains-any"||DA(g,f),y=uV(c,a,g,f==="in"||f==="not-in");return fn.create(d,f,y)})(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function bI(t,e,n){const r=e,s=za("where",t);return qm._create(s,r,n)}class ix extends rx{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new ix(e,n)}_parse(e){const n=this._queryConstraints.map((r=>r._parse(e))).filter((r=>r.getFilters().length>0));return n.length===1?n[0]:Ns.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:((function(s,i){let a=s;const c=i.getFlattenedFilters();for(const u of c)AI(a,u),a=lv(a,u)})(e._query,n),new Yi(e.firestore,e.converter,lv(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class ox extends sx{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new ox(e,n)}_apply(e){const n=(function(s,i,a){if(s.startAt!==null)throw new be(ce.INVA
2580LID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new be(ce.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new md(i,a)})(e._query,this._field,this._direction);return new Yi(e.firestore,e.converter,Bj(e._query,n))}}function IX(t,e="asc"){const n=e,r=za("orderBy",t);return ox._create(r,n)}class ax extends sx{constructor(e,n,r){super(),this.type=e,this._limit=n,this._limitType=r}static _create(e,n,r){return new ax(e,n,r)}_apply(e){return new Yi(e.firestore,e.converter,zp(e._query,this._limit,this._limitType))}}function PX(t){return ax._create("limit",t,"F")}function RA(t,e,n){if(typeof(n=xt(n))=="string"){if(n==="")throw new be(ce.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!g2(e)&&n.indexOf("/")!==-1)throw new be(ce.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Dt.fromString(n));
2580if(!Le.isDocumentKey(r))throw new be(ce.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return qb(t,new Le(r))}if(n instanceof En)return qb(t,n._key);throw new be(ce.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Pm(n)}.`)}function DA(t,e){if(!Array.isArray(t)||t.length===0)throw new be(ce.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function AI(t,e){const n=(function(s,i){for(const a of s)for(const c of a.getFlattenedFilters())if(i.indexOf(c.op)>=0)return c.op;return null})(t.filters,(function(s){switch(s){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}})(e.op));if(n!==null)throw n===e.op?new be(ce.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}
2580' filter.`):new be(ce.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}function TI(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}class Mu{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Oa extends xI{constructor(e,n,r,s,i,a){super(e,n,r,s,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new $f(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(za("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new be(ce.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,n={};return n.type=Oa._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}}Oa._jsonSchemaVersion="firestore/documentSnapshot/1.0",Oa._jsonSchema={type:pn("string",Oa._jsonSchemaVersion),bundleSource:pn("string","DocumentSnapshot"),bundleName:pn("string"),bundle:pn("string")};class $f extends Oa{data(e={}){return super.data(e)}}class La{constructor(e,n,r,s){this._firestore=e,this._userDataWriter=n,this._snapshot=s,this.metadata=new Mu(s.hasPendingWrites,s.fromCache),this.query=r}get docs(){const e=[];return this.forEach((n=>e.push(n))),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach((r=>{e.call(n,new $f(this._firestore,this._userDataWriter,r.key,r,new Mu(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new be(ce.INVA
2580LID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=(function(s,i){if(s._snapshot.oldDocs.isEmpty()){let a=0;return s._snapshot.docChanges.map((c=>{const u=new $f(s._firestore,s._userDataWriter,c.doc.key,c.doc,new Mu(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);return c.doc,{type:"added",doc:u,oldIndex:-1,newIndex:a++}}))}{let a=s._snapshot.oldDocs;return s._snapshot.docChanges.filter((c=>i||c.type!==3)).map((c=>{const u=new $f(s._firestore,s._userDataWriter,c.doc.key,c.doc,new Mu(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);let d=-1,f=-1;return c.type!==0&&(d=a.indexOf(c.doc.key),a=a.delete(c.doc.key)),c.type!==1&&(a=a.add(c.doc),f=a.indexOf(c.doc.key)),{type:pV(c.type),doc:u,oldIndex:d,newIndex:f}}))}})(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new be(ce.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=La._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=T_.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const n=[],r=[],s=[];return this.docs.forEach((i=>{i._document!==null&&(n.push(i._document),r.push(this._userDataWriter.convertObjectMap(i._document.data.value.mapValue.fields,"previous")),s.push(i.ref.path))})),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function pV(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ze(61501,{type:t})}}/**
2581 * @license
2582 * Copyright 2022 Google LLC
2583 *
2584 * Licensed under the Apache License, Version 2.0 (the "License");
2585 * you may not use this file except in compliance with the License.
2586 * You may obtain a copy of the License at
2587 *
2588 *   http://www.apache.org/licenses/LICENSE-2.0
2589 *
2590 * Unless required by applicable law or agreed to in writing, software
2591 * distributed under the License is distributed on an "AS IS" BASIS,
2592 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2593 * See the License for the specific language governing permissions and
2594 * limitations under the License.
2595 */La._jsonSchemaVersion="firestore/querySnapshot/1.0",La._jsonSchema={type:pn("string",La._jsonSchemaVersion),bundleSource:pn("string","QuerySnapshot"),bundleName:pn("string"),bundle:pn("string")};/**
2596 * @license
2597 * Copyright 2020 Google LLC
2598 *
2599 * Licensed under the Apache License, Version 2.0 (the "License");
2600 * you may not use this file except in compliance with the License.
2601 * You may obtain a copy of the License at
2602 *
2603 *   http://www.apache.org/licenses/LICENSE-2.0
2604 *
2605 * Unless required by applicable law or agreed to in writing, software
2606 * distributed under the License is distributed on an "AS IS" BASIS,
2607 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2608 * See the License for the specific language governing permissions and
2609 * limitations under the License.
2610 */class mV{constructor(e,n){this._firestore=e,this._commitHandler=n,this._mutations=[],this._committed=!1,this._dataReader=ex(e)}set(e,n,r){this._verifyNotCommitted();const s=ry(e,this._firestore),i=TI(s.converter,n,r),a=mI(this._dataReader,"WriteBatch.set",s._key,i,s.converter!==null,r);return this._mutations.push(a.toMutation(s._key,fs.none())),this}update(e,n,r,...s){this._verifyNotCommitted();const i=ry(e,this._firestore);let a;return a=typeof(n=xt(n))=="string"||n instanceof J_?cV(this._dataReader,"WriteBatch.update",i._key,n,r,s):lV(this._dataReader,"WriteBatch.update",i._key,n),this._mutations.push(a.toMutation(i._key,fs.exists(!0))),this}delete(e){this._verifyNotCommitted();const n=ry(e,this._firestore);return this._mutations=this._mutations.concat(new N_(n._key,fs.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new be(ce.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function ry(t,e){if((t=xt(t)).firestore!==e)throw new be(ce.INVA
2610LID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}function CI(t){t=Fo(t,Yi);const e=Fo(t.firestore,gc),n=zm(e),r=new nx(e);return wI(t._query),XB(n,t._query).then((s=>new La(e,r,t,s)))}function gV(t,e){const n=Fo(t.firestore,gc),r=vd(t),s=TI(t.converter,e),i=ex(t.firestore);return SI(n,[mI(i,"addDoc",r._key,s,t.converter!==null,{}).toMutation(r._key,fs.exists(!1))]).then((()=>r))}function RX(t,...e){t=xt(t);let n={includeMetadataChanges:!1,source:"default"},r=0;typeof e[r]!="object"||PA(e[r])||(n=e[r++]);const s={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(PA(e[r])){const d=e[r];e[r]=d.next?.bind(d),e[r+1]=d.error?.bind(d),e[r+2]=d.complete?.bind(d)}let i,a,c;if(t instanceof En)a=Fo(t.firestore,gc),c=R_(t._key.path),i={next:d=>{e[r]&&e[r](yV(a,t,d))},error:e[r+1],complete:e[r+2]};else{const d=Fo(t,Yi);a=Fo(d.firestore,gc),c=d._query;const f=new nx(a);i={next:g=>{e[r]&&e[r](new La(a,f,d,g))},error:e[r+1],complete:e[r+2]},wI(t._query)}const u=zm(a);return JB(u,c,s,i)}function SI(t,e){const n=zm(t);return ZB(n,e)}function yV(t,e,n){const r=n.docs.get(e._key),s=new nx(t);return new Oa(t,s,e._key,r,new Mu(n.hasPendingWrites,n.fromCache),e.converter)}function kI(t){return t=Fo(t,gc),zm(t),new mV(t,(e=>SI(t,e)))}(function(e,n=!0){Z5(Ya),Mo(new $i("firestore",((r,{instanceIdentifier:s,options:i})=>{const a=r.getProvider("app").getImmediate(),c=new gc(new nj(r.getProvider("auth-internal")),new ij(a,r.getProvider("app-check-internal")),Ej(a,s),a);return i={useFetchStreams:n,...i},c._setSettings(i),c}),"PUBLIC").setMultipleInstances(!0)),hs(kA,IA,e),hs(kA,IA,"esm2020")})();function II(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const vV=II,PI=new Pd("auth","Firebase",II());/**
2611 * @license
2612 * Copyright 2020 Google LLC
2613 *
2614 * Licensed under the Apache License, Version 2.0 (the "License");
2615 * you may not use this file except in compliance with the License.
2616 * You may obtain a copy of the License at
2617 *
2618 *   http://www.apache.org/licenses/LICENSE-2.0
2619 *
2620 * Unless required by applicable law or agreed to in writing, software
2621 * distributed under the License is distributed on an "AS IS" BASIS,
2622 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2623 * See the License for the specific language governing permissions and
2624 * limitations under the License.
2625 */const Jp=new p_("@firebase/auth");function _V(t,...e){Jp.logLevel<=nt.WARN&&Jp.warn(`Auth (${Ya}): ${t}`,...e)}function zf(t,...e){Jp.logLevel<=nt.ERROR&&Jp.error(`Auth (${Ya}): ${t}`,...e)}/**
2626 * @license
2627 * Copyright 2020 Google LLC
2628 *
2629 * Licensed under the Apache License, Version 2.0 (the "License");
2630 * you may not use this file except in compliance with the License.
2631 * You may obtain a copy of the License at
2632 *
2633 *   http://www.apache.org/licenses/LICENSE-2.0
2634 *
2635 * Unless required by applicable law or agreed to in writing, software
2636 * distributed under the License is distributed on an "AS IS" BASIS,
2637 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2638 * See the License for the specific language governing permissions and
2639 * limitations under the License.
2640 */function Wi(t,...e){throw lx(t,...e)}function Yr(t,...e){return lx(t,...e)}function RI(t,e,n){const r={...vV(),[e]:n};return new Pd("auth","Firebase",r).create(e,{appName:t.name})}function ji(t){return RI(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function lx(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return PI.create(t,...e)}function Se(t,e,...n){if(!t)throw lx(e,...n)}function Li(t){const e="INTERNAL ASSERTION FAILED: "+t;throw zf(e),new Error(e)}function Gi(t,e){t||Li(e)}/**
2641 * @license
2642 * Copyright 2020 Google LLC
2643 *
2644 * Licensed under the Apache License, Version 2.0 (the "License");
2645 * you may not use this file except in compliance with the License.
2646 * You may obtain a copy of the License at
2647 *
2648 *   http://www.apache.org/licenses/LICENSE-2.0
2649 *
2650 * Unless required by applicable law or agreed to in writing, software
2651 * distributed under the License is distributed on an "AS IS" BASIS,
2652 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2653 * See the License for the specific language governing permissions and
2654 * limitations under the License.
2655 */function _v(){return typeof self<"u"&&self.location?.href||""}function DI(){return NA()==="http:"||NA()==="https:"}function NA(){return typeof self<"u"&&self.location?.protocol||null}/**
2656 * @license
2657 * Copyright 2020 Google LLC
2658 *
2659 * Licensed under the Apache License, Version 2.0 (the "License");
2660 * you may not use this file except in compliance with the License.
2661 * You may obtain a copy of the License at
2662 *
2663 *   http://www.apache.org/licenses/LICENSE-2.0
2664 *
2665 * Unless required by applicable law or agreed to in writing, software
2666 * distributed under the License is distributed on an "AS IS" BASIS,
2667 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2668 * See the License for the specific language governing permissions and
2669 * limitations under the License.
2670 */function xV(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(DI()||WL()||"connection"in navigator)?navigator.onLine:!0}function wV(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/**
2671 * @license
2672 * Copyright 2020 Google LLC
2673 *
2674 * Licensed under the Apache License, Version 2.0 (the "License");
2675 * you may not use this file except in compliance with the License.
2676 * You may obtain a copy of the License at
2677 *
2678 *   http://www.apache.org/licenses/LICENSE-2.0
2679 *
2680 * Unless required by applicable law or agreed to in writing, software
2681 * distributed under the License is distributed on an "AS IS" BASIS,
2682 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2683 * See the License for the specific language governing permissions and
2684 * limitations under the License.
2685 */class Bd{constructor(e,n){this.shortDelay=e,this.longDelay=n,Gi(n>e,"Short delay should be less than long delay!"),this.isMobile=zL()||GL()}get(){return xV()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
2686 * @license
2687 * Copyright 2020 Google LLC
2688 *
2689 * Licensed under the Apache License, Version 2.0 (the "License");
2690 * you may not use this file except in compliance with the License.
2691 * You may obtain a copy of the License at
2692 *
2693 *   http://www.apache.org/licenses/LICENSE-2.0
2694 *
2695 * Unless required by applicable law or agreed to in writing, software
2696 * distributed under the License is distributed on an "AS IS" BASIS,
2697 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2698 * See the License for the specific language governing permissions and
2699 * limitations under the License.
2700 */function cx(t,e){Gi(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/**
2701 * @license
2702 * Copyright 2020 Google LLC
2703 *
2704 * Licensed under the Apache License, Version 2.0 (the "License");
2705 * you may not use this file except in compliance with the License.
2706 * You may obtain a copy of the License at
2707 *
2708 *   http://www.apache.org/licenses/LICENSE-2.0
2709 *
2710 * Unless required by applicable law or agreed to in writing, software
2711 * distributed under the License is distributed on an "AS IS" BASIS,
2712 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2713 * See the License for the specific language governing permissions and
2714 * limitations under the License.
2715 */class NI{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Li("Could not find fetch implementation, make sure you call FetchProvi
2715der.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Li("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Li("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
2716 * @license
2717 * Copyright 2020 Google LLC
2718 *
2719 * Licensed under the Apache License, Version 2.0 (the "License");
2720 * you may not use this file except in compliance with the License.
2721 * You may obtain a copy of the License at
2722 *
2723 *   http://www.apache.org/licenses/LICENSE-2.0
2724 *
2725 * Unless required by applicable law or agreed to in writing, software
2726 * distributed under the License is distributed on an "AS IS" BASIS,
2727 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2728 * See the License for the specific language governing permissions and
2729 * limitations under the License.
2730 */const EV={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
2731 * @license
2732 * Copyright 2020 Google LLC
2733 *
2734 * Licensed under the Apache License, Version 2.0 (the "License");
2735 * you may not use this file except in compliance with the License.
2736 * You may obtain a copy of the License at
2737 *
2738 *   http://www.apache.org/licenses/LICENSE-2.0
2739 *
2740 * Unless required by applicable law or agreed to in writing, software
2741 * distributed under the License is distributed on an "AS IS" BASIS,
2742 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2743 * See the License for the specific language governing permissions and
2744 * limitations under the License.
2745 */const bV=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],AV=new Bd(3e4,6e4);function Fs(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function js(t,e,n,r,s={}){return OI(t,s,async()=>{let i={},a={};r&&(e==="GET"?a=r:i={body:JSON.stringify(r)});const c=Sc({key:t.config.apiKey,...a}
2745).slice(1),u=await t._getAdditionalHeaders();u["Content-Type"]="application/json",t.languageCode&&(u["X-Firebase-Locale"]=t.languageCode);const d={method:e,headers:u,...i};return qL()||(d.referrerPolicy="no-referrer"),t.emulatorConfig&&li(t.emulatorConfig.host)&&(d.credentials="include"),NI.fetch()(await LI(t,t.config.apiHost,n,c),d)})}async function OI(t,e,n){t._canInitEmulator=!1;const r={...EV,...e};try{const s=new CV(t),i=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const a=await i.json();if("needConfirmation"in a)throw Bu(t,"account-exists-with-different-credential",a);if(i.ok&&!("errorMessage"in a))return a;{const c=i.ok?a.errorMessage:a.error.message,[u,d]=c.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw Bu(t,"credential-already-in-use",a);if(u==="EMAIL_EXISTS")throw Bu(t,"email-already-in-use",a);if(u==="USER_DISABLED")throw Bu(t,"user-disabled",a);const f=r[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw RI(t,f,d);Wi(t,f)}}catch(s){if(s instanceof Ls)throw s;Wi(t,"network-request-failed",{message:String(s)})}}async function Vd(t,e,n,r,s={}){const i=await js(t,e,n,r,s);return"mfaPendingCredential"in i&&Wi(t,"multi-factor-auth-required",{_serverResponse:i}),i}async function LI(t,e,n,r){const s=`${e}${n}?${r}`,i=t,a=i.config.emulator?cx(t.config,s):`${t.config.apiScheme}://${s}`;return bV.includes(n)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(a).toString():a}function TV(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class CV{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(Yr(this.auth,"network-request-failed")),AV.get())})}}function Bu(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Yr(t,e,r);return s.customData._tokenResponse=n,s}/**
2746 * @license
2747 * Copyright 2020 Google LLC
2748 *
2749 * Licensed under the Apache License, Version 2.0 (the "License");
2750 * you may not use this file except in compliance with the License.
2751 * You may obtain a copy of the License at
2752 *
2753 *   http://www.apache.org/licenses/LICENSE-2.0
2754 *
2755 * Unless required by applicable law or agreed to in writing, software
2756 * distributed under the License is distributed on an "AS IS" BASIS,
2757 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2758 * See the License for the specific language governing permissions and
2759 * limitations under the License.
2760 */function OA(t){return t!==void 0&&t.getResponse!==void 0}function LA(t){return t!==void 0&&t.enterprise!==void 0}class FI{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return TV(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}/**
2761 * @license
2762 * Copyright 2020 Google LLC
2763 *
2764 * Licensed under the Apache License, Version 2.0 (the "License");
2765 * you may not use this file except in compliance with the License.
2766 * You may obtain a copy of the License at
2767 *
2768 *   http://www.apache.org/licenses/LICENSE-2.0
2769 *
2770 * Unless required by applicable law or agreed to in writing, software
2771 * distributed under the License is distributed on an "AS IS" BASIS,
2772 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2773 * See the License for the specific language governing permissions and
2774 * limitations under the License.
2775 */async function SV(t){return(await js(t,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function jI(t,e){return js(t,"GET","/v2/recaptchaConfig",Fs(t,e))}/**
2776 * @license
2777 * Copyright 2020 Google LLC
2778 *
2779 * Licensed under the Apache License, Version 2.0 (the "License");
2780 * you may not use this file except in compliance with the License.
2781 * You may obtain a copy of the License at
2782 *
2783 *   http://www.apache.org/licenses/LICENSE-2.0
2784 *
2785 * Unless required by applicable law or agreed to in writing, software
2786 * distributed under the License is distributed on an "AS IS" BASIS,
2787 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2788 * See the License for the specific language governing permissions and
2789 * limitations under the License.
2790 */async function kV(t,e){return js(t,"POST","/v1/accounts:delete",e)}async function Xp(t,e){return js(t,"POST","/v1/accounts:lookup",e)}/**
2791 * @license
2792 * Copyright 2020 Google LLC
2793 *
2794 * Licensed under the Apache License, Version 2.0 (the "License");
2795 * you may not use this file except in compliance with the License.
2796 * You may obtain a copy of the License at
2797 *
2798 *   http://www.apache.org/licenses/LICENSE-2.0
2799 *
2800 * Unless required by applicable law or agreed to in writing, software
2801 * distributed under the License is distributed on an "AS IS" BASIS,
2802 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2803 * See the License for the specific language governing permissions and
2804 * limitations under the License.
2805 */function Ju(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function IV(t,e=!1){const n=xt(t),r=await n.getIdToken(e),s=ux(r);Se(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,a=i?.sign_in_provider;return{claims:s,token:r,authTime:Ju(sy(s.auth_time)),issuedAtTime:Ju(sy(s.iat)),expirationTime:Ju(sy(s.exp)),signInProvider:a||null,signInSecondFactor:i?.sign_in_second_factor||null}}function sy(t){return Number(t)*1e3}function ux(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return zf("JWT malformed, contained fewer than 3 sections"),null;try{const s=mk(n);return s?JSON.parse(s):(zf("Failed to decode base64 JWT payload"),null)}catch(s){return zf("Caught error parsing JWT payload as JSON",s?.toString()),null}}function FA(t){const e=ux(t);return Se(e,"internal-error"),Se(typeof e.exp<"u","internal-error"),Se(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
2806 * @license
2807 * Copyright 2020 Google LLC
2808 *
2809 * Licensed under the Apache License, Version 2.0 (the "License");
2810 * you may not use this file except in compliance with the License.
2811 * You may obtain a copy of the License at
2812 *
2813 *   http://www.apache.org/licenses/LICENSE-2.0
2814 *
2815 * Unless required by applicable law or agreed to in writing, software
2816 * distributed under the License is distributed on an "AS IS" BASIS,
2817 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2818 * See the License for the specific language governing permissions and
2819 * limitations under the License.
2820 */async function _d(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof Ls&&PV(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function PV({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/**
2821 * @license
2822 * Copyright 2020 Google LLC
2823 *
2824 * Licensed under the Apache License, Version 2.0 (the "License");
2825 * you may not use this file except in compliance with the License.
2826 * You may obtain a copy of the License at
2827 *
2828 *   http://www.apache.org/licenses/LICENSE-2.0
2829 *
2830 * Unless required by applicable law or agreed to in writing, software
2831 * distributed under the License is distributed on an "AS IS" BASIS,
2832 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2833 * See the License for the specific language governing permissions and
2834 * limitations under the License.
2835 */class RV{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
2836 * @license
2837 * Copyright 2020 Google LLC
2838 *
2839 * Licensed under the Apache License, Version 2.0 (the "License");
2840 * you may not use this file except in compliance with the License.
2841 * You may obtain a copy of the License at
2842 *
2843 *   http://www.apache.org/licenses/LICENSE-2.0
2844 *
2845 * Unless required by applicable law or agreed to in writing, software
2846 * distributed under the License is distributed on an "AS IS" BASIS,
2847 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2848 * See the License for the specific language governing permissions and
2849 * limitations under the License.
2850 */class xv{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ju(this.lastLoginAt),this.creationTime=Ju(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
2851 * @license
2852 * Copyright 2019 Google LLC
2853 *
2854 * Licensed under the Apache License, Version 2.0 (the "License");
2855 * you may not use this file except in compliance with the License.
2856 * You may obtain a copy of the License at
2857 *
2858 *   http://www.apache.org/licenses/LICENSE-2.0
2859 *
2860 * Unless required by applicable law or agreed to in writing, software
2861 * distributed under the License is distributed on an "AS IS" BASIS,
2862 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2863 * See the License for the specific language governing permissions and
2864 * limitations under the License.
2865 */async function Zp(t){const e=t.auth,n=await t.getIdToken(),r=await _d(t,Xp(e,{idToken:n}));Se(r?.users.length,e,"internal-error");const s=r.users[0];t._notifyReloadListener(s);const i=s.providerUserInfo?.length?MI(s.providerUserInfo):[],a=NV(t.providerData,i),c=t.isAnonymous,u=!(t.email&&s.passwordHash)&&!a?.length,d=c?u:!1,f={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new xv(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(t,f)}async function DV(t){const e=xt(t);await Zp(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function NV(t,e){return[...t.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function MI(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/**
2866 * @license
2867 * Copyright 2020 Google LLC
2868 *
2869 * Licensed under the Apache License, Version 2.0 (the "License");
2870 * you may not use this file except in compliance with the License.
2871 * You may obtain a copy of the License at
2872 *
2873 *   http://www.apache.org/licenses/LICENSE-2.0
2874 *
2875 * Unless required by applicable law or agreed to in writing, software
2876 * distributed under the License is distributed on an "AS IS" BASIS,
2877 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2878 * See the License for the specific language governing permissions and
2879 * limitations under the License.
2880 */async function OV(t,e){const n=await OI(t,{},async()=>{const r=Sc({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=t.config,a=await LI(t,s,"/v1/token",`key=${i}`),c=await t._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";const u={method:"POST",headers:c,body:r};return t.emulatorConfig&&li(t.emulatorConfig.host)&&(u.credentials="include"),NI.fetch()(a,u)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function LV(t,e){return js(t,"POST","/v2/accounts:revokeToken",Fs(t,e))}/**
2881 * @license
2882 * Copyright 2020 Google LLC
2883 *
2884 * Licensed under the Apache License, Version 2.0 (the "License");
2885 * you may not use this file except in compliance with the License.
2886 * You may obtain a copy of the License at
2887 *
2888 *   http://www.apache.org/licenses/LICENSE-2.0
2889 *
2890 * Unless required by applicable law or agreed to in writing, software
2891 * distributed under the License is distributed on an "AS IS" BASIS,
2892 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2893 * See the License for the specific language governing permissions and
2894 * limitations under the License.
2895 */class rc{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Se(e.idToken,"internal-error"),Se(typeof e.idToken<"u","internal-error"),Se(typeof e.refreshToken<"u","internal-error");
2895const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):FA(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){Se(e.length!==0,"internal-error");const n=FA(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Se(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:s,expiresIn:i}=await OV(e,n);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:s,expirationTime:i}=n,a=new rc;return r&&(Se(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),s&&(Se(typeof s=="string","internal-error",{appName:e}),a.accessToken=s),i&&(Se(typeof i=="number","internal-error",{appName:e}),a.expirationTime=i),a}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new rc,this.toJSON())}_performRefresh(){return Li("not implemented")}}/**
2896 * @license
2897 * Copyright 2020 Google LLC
2898 *
2899 * Licensed under the Apache License, Version 2.0 (the "License");
2900 * you may not use this file except in compliance with the License.
2901 * You may obtain a copy of the License at
2902 *
2903 *   http://www.apache.org/licenses/LICENSE-2.0
2904 *
2905 * Unless required by applicable law or agreed to in writing, software
2906 * distributed under the License is distributed on an "AS IS" BASIS,
2907 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2908 * See the License for the specific language governing permissions and
2909 * limitations under the License.
2910 */function wo(t,e){Se(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class Is{constructor({uid:e,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new RV(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new xv(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const n=await _d(this,this.stsTokenManager.getToken(this.auth,e));return Se(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return IV(this,e)}reload(){return DV(this)}_assign(e){this!==e&&(Se(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new Is({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){Se(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await Zp(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Ir(this.auth.app))return Promise.reject(ji(this.auth));const e=await this.getIdToken();return await _d(this,kV(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
2910nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){const r=n.displayName??void 0,s=n.email??void 0,i=n.phoneNumber??void 0,a=n.photoURL??void 0,c=n.tenantId??void 0,u=n._redirectEventId??void 0,d=n.createdAt??void 0,f=n.lastLoginAt??void 0,{uid:g,emailVerified:y,isAnonymous:x,providerData:b,stsTokenManager:E}=n;Se(g&&E,e,"internal-error");const w=rc.fromJSON(this.name,E);Se(typeof g=="string",e,"internal-error"),wo(r,e.name),wo(s,e.name),Se(typeof y=="boolean",e,"internal-error"),Se(typeof x=="boolean",e,"internal-error"),wo(i,e.name),wo(a,e.name),wo(c,e.name),wo(u,e.name),wo(d,e.name),wo(f,e.name);const R=new Is({uid:g,auth:e,email:s,emailVerified:y,displayName:r,isAnonymous:x,photoURL:a,phoneNumber:i,tenantId:c,stsTokenManager:w,createdAt:d,lastLoginAt:f});return b&&Array.isArray(b)&&(R.providerData=b.map(C=>({...C}))),u&&(R._redirectEventId=u),R}static async _fromIdTokenResponse(e,n,r=!1){const s=new rc;s.updateFromServerResponse(n);const i=new Is({uid:n.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await Zp(i),i}static async _fromGetAccountInfoResponse(e,n,r){const s=n.users[0];Se(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?MI(s.providerUserInfo):[],a=!(s.email&&s.passwordHash)&&!i?.length,c=new rc;c.updateFromIdToken(r);const u=new Is({uid:s.localId,auth:e,stsTokenManager:c,isAnonymous:a}),d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new xv(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!i?.length};return Object.assign(u,d),u}}/**
2911 * @license
2912 * Copyright 2020 Google LLC
2913 *
2914 * Licensed under the Apache License, Version 2.0 (the "License");
2915 * you may not use this file except in compliance with the License.
2916 * You may obtain a copy of the License at
2917 *
2918 *   http://www.apache.org/licenses/LICENSE-2.0
2919 *
2920 * Unless required by applicable law or agreed to in writing, software
2921 * distributed under the License is distributed on an "AS IS" BASIS,
2922 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2923 * See the License for the specific language governing permissions and
2924 * limitations under the License.
2925 */const jA=new Map;function Fi(t){Gi(t instanceof Function,"Expected a class definition");let e=jA.get(t);return e?(Gi(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,jA.set(t,e),e)}/**
2926 * @license
2927 * Copyright 2019 Google LLC
2928 *
2929 * Licensed under the Apache License, Version 2.0 (the "License");
2930 * you may not use this file except in compliance with the License.
2931 * You may obtain a copy of the License at
2932 *
2933 *   http://www.apache.org/licenses/LICENSE-2.0
2934 *
2935 * Unless required by applicable law or agreed to in writing, software
2936 * distributed under the License is distributed on an "AS IS" BASIS,
2937 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2938 * See the License for the specific language governing permissions and
2939 * limitations under the License.
2940 */class BI{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}BI.type="NONE";const MA=BI;/**
2941 * @license
2942 * Copyright 2019 Google LLC
2943 *
2944 * Licensed under the Apache License, Version 2.0 (the "License");
2945 * you may not use this file except in compliance with the License.
2946 * You may obtain a copy of the License at
2947 *
2948 *   http://www.apache.org/licenses/LICENSE-2.0
2949 *
2950 * Unless required by applicable law or agreed to in writing, softw
2950are
2951 * distributed under the License is distributed on an "AS IS" BASIS,
2952 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2953 * See the License for the specific language governing permissions and
2954 * limitations under the License.
2955 */function Hf(t,e,n){return`firebase:${t}:${e}:${n}`}class sc{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=Hf(this.userKey,s.apiKey,i),this.fullPersistenceKey=Hf("persistence",s.apiKey,i),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const n=await Xp(this.auth,{idToken:e}).catch(()=>{});return n?Is._fromGetAccountInfoResponse(this.auth,n,e):null}return Is._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new sc(Fi(MA),e,r);const s=(await Promise.all(n.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let i=s[0]||Fi(MA);const a=Hf(r,e.config.apiKey,e.name);let c=null;for(const d of n)try{const f=await d._get(a);if(f){let g;if(typeof f=="string"){const y=await Xp(e,{idToken:f}).catch(()=>{});if(!y)break;g=await Is._fromGetAccountInfoResponse(e,y,f)}else g=Is._fromJSON(e,f);d!==i&&(c=g),i=d;break}}catch{}const u=s.filter(d=>d._shouldAllowMigration);return!i._shouldAllowMigration||!u.length?new sc(i,e,r):(i=u[0],c&&await i._set(a,c.toJSON()),await Promise.all(n.map(async d=>{if(d!==i)try{await d._remove(a)}catch{}})),new sc(i,e,r))}}/**
2956 * @license
2957 * Copyright 2020 Google LLC
2958 *
2959 * Licensed under the Apache License, Version 2.0 (the "License");
2960 * you may not use this file except in compliance with the License.
2961 * You may obtain a copy of the License at
2962 *
2963 *   http://www.apache.org/licenses/LICENSE-2.0
2964 *
2965 * Unless required by applicable law or agreed to in writing, software
2966 * distributed under the License is distributed on an "AS IS" BASIS,
2967 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2968 * See the License for the specific language governing permissions and
2969 * limitations under the License.
2970 */function BA(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(zI(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(VI(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(qI(e))return"Blackberry";if(WI(e))return"Webos";if(UI(e))return"Safari";if((e.includes("chrome/")||$I(e))&&!e.includes("edge/"))return"Chrome";if(HI(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if(r?.length===2)return r[1]}return"Other"}function VI(t=lr()){return/firefox\//i.test(t)}function UI(t=lr()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function $I(t=lr()){return/crios\//i.test(t)}function zI(t=lr()){return/iemobile/i.test(t)}function HI(t=lr()){return/android/i.test(t)}function qI(t=lr()){return/blackberry/i.test(t)}function WI(t=lr()){return/webos/i.test(t)}function dx(t=lr()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function FV(t=lr()){return dx(t)&&!!window.navigator?.standalone}function jV(){return KL()&&document.documentMode===10}function GI(t=lr()){return dx(t)||HI(t)||WI(t)||qI(t)||/windows phone/i.test(t)||zI(t)}/**
2971 * @license
2972 * Copyright 2020 Google LLC
2973 *
2974 * Licensed under the Apache License, Version 2.0 (the "License");
2975 * you may not use this file except in compliance with the License.
2976 * You may obtain a copy of the License at
2977 *
2978 *   http://www.apache.org/licenses/LICENSE-2.0
2979 *
2980 * Unless required by applicable law or agreed to in writing, software
2981 * distributed under the License is distributed on an "AS IS" BASIS,
2982 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2983 * See the License for the specific language governing permissions and
2984 * limitations under the License.
2985 */function KI(t,e=[]){let n;switch(t){case"Browser":n=BA(lr());break;case"Worker":n=`${BA(lr())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ya}/${r}`}/**
2986 * @license
2987 * Copyright 2022 Google LLC
2988 *
2989 * Licensed under the Apache License, Version 2.0 (the "License");
2990 * you may not use this file except in compliance with the License.
2991 * You may obtain a copy of the License at
2992 *
2993 *   http://www.apache.org/licenses/LICENSE-2.0
2994 *
2995 * Unless required by applicable law or agreed to in writing, software
2996 * distributed under the License is distributed on an "AS IS" BASIS,
2997 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2998 * See the License for the specific language governing permissions and
2999 * limitations under the License.
3000 */class MV{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=i=>new Promise((a,c)=>{try{const u=e(i);a(u)}catch(u){c(u)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}}/**
3001 * @license
3002 * Copyright 2023 Google LLC
3003 *
3004 * Licensed under the Apache License, Version 2.0 (the "License");
3005 * you may not use this file except in compliance with the License.
3006 * You may obtain a copy of the License at
3007 *
3008 *   http://www.apache.org/licenses/LICENSE-2.0
3009 *
3010 * Unless required by applicable law or agreed to in writing, software
3011 * distributed under the License is distributed on an "AS IS" BASIS,
3012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3013 * See the License for the specific language governing permissions and
3014 * limitations under the License.
3015 */async function BV(t,e={}){return js(t,"GET","/v2/passwordPolicy",Fs(t,e))}/**
3016 * @license
3017 * Copyright 2023 Google LLC
3018 *
3019 * Licensed under the Apache License, Version 2.0 (the "License");
3020 * you may not use this file except in compliance with the License.
3021 * You may obtain a copy of the License at
3022 *
3023 *   http://www.apache.org/licenses/LICENSE-2.0
3024 *
3025 * Unless required by applicable law or agreed to in writing, software
3026 * distributed under the License is distributed on an "AS IS" BASIS,
3027 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3028 * See the License for the specific language governing permissions and
3029 * limitations under the License.
3030 */const VV=6;class UV{constructor(e){const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??VV,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&
3030(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),s&&(n.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let s=0;s<e.length;s++)r=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/**
3031 * @license
3032 * Copyright 2020 Google LLC
3033 *
3034 * Licensed under the Apache License, Version 2.0 (the "License");
3035 * you may not use this file except in compliance with the License.
3036 * You may obtain a copy of the License at
3037 *
3038 *   http://www.apache.org/licenses/LICENSE-2.0
3039 *
3040 * Unless required by applicable law or agreed to in writing, software
3041 * distributed under the License is distributed on an "AS IS" BASIS,
3042 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3043 * See the License for the specific language governing permissions and
3044 * limitations under the License.
3045 */class $V{constructor(e,n,r,s){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new VA(this),this.idTokenSubscription=new VA(this),this.beforeStateQueue=new MV(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=PI,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=Fi(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await sc.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=this.currentUser?.uid||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await Xp(this,{idToken:e}),r=await Is._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch{await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(Ir(this.app)){const i=this.app.settings.authIdToken;return i?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(i).then(a,a))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const i=this.redirectUser?._redirectEventId,a=r?._redirectEventId,c=await this.tryRedirectSignIn(e);(!i||i===a)&&c?.user&&(r=c.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);
3045if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(i){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(i))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Se(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Zp(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=wV()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Ir(this.app))return Promise.reject(ji(this));const n=e?xt(e):null;return n&&Se(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&Se(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Ir(this.app)?Promise.reject(ji(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Ir(this.app)?Promise.reject(ji(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Fi(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await BV(this),n=new UV(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Pd("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await LV(this,r)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&Fi(e)||this._popupRedirectResolver;Se(n,this,"argument-error"),this.redirectPersistenceManager=await sc.create(this,[Fi(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._redirectEventId===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,s){if(this._deleted)return()=>{};const i=typeof n=="function"?n:n.next.bind(n);let a=!1;const c=this._isInitialized?Promise.resolve():this._initializationPromise;if(Se(c,this,"internal-error"),c.then(()=>{a||i(this.currentUser)}),typeof n=="function"){const u=e.addObserver(n,r,s);return()=>{a=!0,u()}}else{const u=e.addObserver(n);return()=>{a=!0,u()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Se(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=KI(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if(Ir(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&_V(`Error while retrieving App Check token: ${e.error}`),e?.token}}function Qi(t){return xt(t)}class VA{constructor(e){this.auth=e,this.observer=null,this.addObserver=nF(n=>this.observer=n)}get next(){return Se(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
3046 * @license
3047 * Copyright 2020 Google LLC
3048 *
3049 * Licensed under the Apache License, Version 2.0 (the "License");
3050 * you may not use this file except in compliance with the License.
3051 * You may obtain a copy of the License at
3052 *
3053 *   http://www.apache.org/licenses/LICENSE-2.0
3054 *
3055 * Unless required by applicable law or agreed to in writing, software
3056 * distributed under the License is distributed on an "AS IS" BASIS,
3057 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3058 * See the License for the specific language governing permissions and
3059 * limitations under the License.
3060 */let Ud={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function zV(t){Ud=t}function hx(t){return Ud.loadJS(t)}function HV(){return Ud.recaptchaV2Script}function qV(){return Ud.recaptchaEnterpriseScript}function WV(){return Ud.gapiScript}function YI(t){return`__${t}${Math.floor(Math.random()*1e6)}`}/**
3061 * @license
3062 * Copyright 2020 Google LLC
3063 *
3064 * Licensed under the Apache License, Version 2.0 (the "License");
3065 * you may not use this file except in compliance with the License.
3066 * You may obtain a copy of the License at
3067 *
3068 *   http://www.apache.org/licenses/LICENSE-2.0
3069 *
3070 * Unless required by applicable law or agreed to in writing, software
3071 * distributed under the License is distributed on an "AS IS" BASIS,
3072 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3073 * See the License for the specific language governing permissions and
3074 * limitations under the License.
3075 */const GV=500,KV=6e4,vf=1e12;class YV{constructor(e){this.auth=e,this.counter=vf,this._widgets=new Map}render(e,n){const r=this.counter;return this._widgets.set(r,new XV(e,this.auth.name,n||{})),this.counter++,r}reset(e){const n=e||vf;this._widgets.get(n)?.delete(),this._widgets.delete(n)}getResponse(e){const n=e||vf;return this._widgets.get(n)?.getResponse()||""}async execute(e){const n=e||vf;return this._widgets.get(n)?.execute(),""}}class QV{constructor(){this.enterprise=new JV}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}class JV{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}class XV{constructor(e,n,r){this.params=r,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};const s=typeof e=="string"?document.getElementById(e):e;Se(s,"argument-error",{appName:n}),this.container=s,this.isVisible=this.params.size!=="invisible",this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),!this.timerId&&(this.timerId=window.setTimeout(()=>{this.responseToken=ZV(50);const{callback:e,"expired-callback":n}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,n)try{n()}catch{}this.isVisible&&this.execute()},KV)},GV))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}}function ZV(t){const e=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let r=0;r<t;r++)e.push(n.charAt(Math.floor(Math.random()*n.length)));return e.join("")}const e9="recaptcha-enterprise",Xu="NO_RECAPTCHA";class QI{constructor(e){this.type=e9,this.auth=Qi(e)}async verify(e="verify",n=!1){async function r(i){if(!n){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(a,c)=>{jI(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(u=>{if(u.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{const d=new FI(u);return i.tenantId==null?i._agentRecaptchaConfig=d:i._tenantRecaptchaConfigs[i.tenantId]=d,a(d.siteKey)}}).catch(u=>{c(u)})})}function s(i,a,c){const u=window.grecaptcha;LA(u)?u.enterprise.ready(()=>{u.enterprise.execute(i,{action:e}).then(d=>{a(d)}).catch(()=>{a(Xu)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new QV().execute("siteKey",{action:"verify"}):new Promise((i,a)=>{r(this.auth).then(c=>{if(!n&&LA(window.grecaptcha))s(c,i,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let u=qV();u.length!==0&&(u+=c),hx(u).then(()=>{s(c,i,a)}).catch(d=>{a(d)})}}).catch(c=>{a(c)})})}}async function iy(t,e,n,r=!1,s=!1){const i=new QI(t);let a;if(s)a=Xu;else try{a=await i.verify(n)}
3075catch{a=await i.verify(n,!0)}const c={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){const u=c.phoneEnrollmentInfo.phoneNumber,d=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:u,recaptchaToken:d,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){const u=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:u,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return r?Object.assign(c,{captchaResp:a}):Object.assign(c,{captchaResponse:a}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function oy(t,e,n,r,s){if(t._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){const i=await iy(t,e,n);return r(t,i).catch(async a=>{if(t._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(a.code==="auth/missing-recaptcha-token"||a.code==="auth/invalid-app-credential")){const c=await iy(t,e,n,!1,!0);return r(t,c)}return Promise.reject(a)})}else{const i=await iy(t,e,n,!1,!0);return r(t,i)}}async function t9(t){const e=Qi(t),n=await jI(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),r=new FI(n);e.tenantId==null?e._agentRecaptchaConfig=r:e._tenantRecaptchaConfigs[e.tenantId]=r,r.isAnyProviderEnabled()&&new QI(e).verify()}/**
3076 * @license
3077 * Copyright 2020 Google LLC
3078 *
3079 * Licensed under the Apache License, Version 2.0 (the "License");
3080 * you may not use this file except in compliance with the License.
3081 * You may obtain a copy of the License at
3082 *
3083 *   http://www.apache.org/licenses/LICENSE-2.0
3084 *
3085 * Unless required by applicable law or agreed to in writing, software
3086 * distributed under the License is distributed on an "AS IS" BASIS,
3087 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3088 * See the License for the specific language governing permissions and
3089 * limitations under the License.
3090 */function n9(t,e){const n=Rd(t,"auth");if(n.isInitialized()){const s=n.getImmediate(),i=n.getOptions();if(Ma(i,e??{}))return s;Wi(s,"already-initialized")}return n.initialize({options:e})}function r9(t,e){const n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(Fi);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function s9(t,e,n){const r=Qi(t);
3090Se(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!1,i=JI(e),{host:a,port:c}=i9(e),u=c===null?"":`:${c}`,d={url:`${i}//${a}${u}/`},f=Object.freeze({host:a,port:c,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){Se(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Se(Ma(d,r.config.emulator)&&Ma(f,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=d,r.emulatorConfig=f,r.settings.appVerificationDisabledForTesting=!0,li(a)?(Tm(`${i}//${a}${u}`),Cm("Auth",!0)):o9()}function JI(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function i9(t){const e=JI(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const i=s[1];return{host:i,port:UA(r.substr(i.length+1))}}else{const[i,a]=r.split(":");return{host:i,port:UA(a)}}}function UA(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function o9(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}/**
3091 * @license
3092 * Copyright 2020 Google LLC
3093 *
3094 * Licensed under the Apache License, Version 2.0 (the "License");
3095 * you may not use this file except in compliance with the License.
3096 * You may obtain a copy of the License at
3097 *
3098 *   http://www.apache.org/licenses/LICENSE-2.0
3099 *
3100 * Unless required by applicable law or agreed to in writing, software
3101 * distributed under the License is distributed on an "AS IS" BASIS,
3102 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3103 * See the License for the specific language governing permissions and
3104 * limitations under the License.
3105 */class fx{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return Li("not implemented")}_getIdTokenResponse(e){return Li("not implemented")}_linkToIdToken(e,n){return Li("not implemented")}_getReauthenticationResolver(e){return Li("not implemented")}}/**
3106 * @license
3107 * Copyright 2020 Google LLC
3108 *
3109 * Licensed under the Apache License, Version 2.0 (the "License");
3110 * you may not use this file except in compliance with the License.
3111 * You may obtain a copy of the License at
3112 *
3113 *   http://www.apache.org/licenses/LICENSE-2.0
3114 *
3115 * Unless required by applicable law or agreed to in writing, software
3116 * distributed under the License is distributed on an "AS IS" BASIS,
3117 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3118 * See the License for the specific language governing permissions and
3119 * limitations under the License.
3120 */async function ic(t,e){return Vd(t,"POST","/v1/accounts:signInWithIdp",Fs(t,e))}/**
3121 * @license
3122 * Copyright 2020 Google LLC
3123 *
3124 * Licensed under the Apache License, Version 2.0 (the "License");
3125 * you may not use this file except in compliance with the License.
3126 * You may obtain a copy of the License at
3127 *
3128 *   http://www.apache.org/licenses/LICENSE-2.0
3129 *
3130 * Unless required by applicable law or agreed to in writing, software
3131 * distributed under the License is distributed on an "AS IS" BASIS,
3132 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3133 * See the License for the specific language governing permissions and
3134 * limitations under the License.
3135 */const a9="http://localhost";class Ha extends fx{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new Ha(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):Wi("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
3135once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s,...i}=n;if(!r||!s)return null;const a=new Ha(r,s);return a.idToken=i.idToken||void 0,a.accessToken=i.accessToken||void 0,a.secret=i.secret,a.nonce=i.nonce,a.pendingToken=i.pendingToken||null,a}_getIdTokenResponse(e){const n=this.buildRequest();return ic(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,ic(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,ic(e,n)}buildRequest(){const e={requestUri:a9,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=Sc(n)}return e}}/**
3136 * @license
3137 * Copyright 2020 Google LLC
3138 *
3139 * Licensed under the Apache License, Version 2.0 (the "License");
3140 * you may not use this file except in compliance with the License.
3141 * You may obtain a copy of the License at
3142 *
3143 *   http://www.apache.org/licenses/LICENSE-2.0
3144 *
3145 * Unless required by applicable law or agreed to in writing, software
3146 * distributed under the License is distributed on an "AS IS" BASIS,
3147 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3148 * See the License for the specific language governing permissions and
3149 * limitations under the License.
3150 */async function $A(t,e){return js(t,"POST","/v1/accounts:sendVerificationCode",Fs(t,e))}async function l9(t,e){return Vd(t,"POST","/v1/accounts:signInWithPhoneNumber",Fs(t,e))}async function c9(t,e){const n=await Vd(t,"POST","/v1/accounts:signInWithPhoneNumber",Fs(t,e));if(n.temporaryProof)throw Bu(t,"account-exists-with-different-credential",n);return n}const u9={USER_NOT_FOUND:"user-not-found"};async function d9(t,e){const n={...e,operation:"REAUTH"};return Vd(t,"POST","/v1/accounts:signInWithPhoneNumber",Fs(t,n),u9)}/**
3151 * @license
3152 * Copyright 2020 Google LLC
3153 *
3154 * Licensed under the Apache License, Version 2.0 (the "License");
3155 * you may not use this file except in compliance with the License.
3156 * You may obtain a copy of the License at
3157 *
3158 *   http://www.apache.org/licenses/LICENSE-2.0
3159 *
3160 * Unless required by applicable law or agreed to in writing, software
3161 * distributed under the License is distributed on an "AS IS" BASIS,
3162 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3163 * See the License for the specific language governing permissions and
3164 * limitations under the License.
3165 */class Zu extends fx{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new Zu({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new Zu({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return l9(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return c9(e,{idToken:n,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return d9(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:n,verificationId:r,verificationCode:s}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:r,code:s}}toJSON(){const e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));const{verificationId:n,verificationCode:r,phoneNumber:s,temporaryProof:i}=e;return!r&&!n&&!s&&!i?null:new Zu({verificationId:n,verificationCode:r,phoneNumber:s,temporaryProof:i})}}/**
3166 * @license
3167 * Copyright 2020 Google LLC
3168 *
3169 * Licensed under the Apache License, Version 2.0 (the "License");
3170 * you may not use this file except in compliance with the License.
3171 * You may obtain a copy of the License at
3172 *
3173 *   http://www.apache.org/licenses/LICENSE-2.0
3174 *
3175 * Unless required by applicable law or agreed to in writing, softw
3175are
3176 * distributed under the License is distributed on an "AS IS" BASIS,
3177 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3178 * See the License for the specific language governing permissions and
3179 * limitations under the License.
3180 */class XI{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/**
3181 * @license
3182 * Copyright 2019 Google LLC
3183 *
3184 * Licensed under the Apache License, Version 2.0 (the "License");
3185 * you may not use this file except in compliance with the License.
3186 * You may obtain a copy of the License at
3187 *
3188 *   http://www.apache.org/licenses/LICENSE-2.0
3189 *
3190 * Unless required by applicable law or agreed to in writing, software
3191 * distributed under the License is distributed on an "AS IS" BASIS,
3192 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3193 * See the License for the specific language governing permissions and
3194 * limitations under the License.
3195 */class $d extends XI{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
3196 * @license
3197 * Copyright 2020 Google LLC
3198 *
3199 * Licensed under the Apache License, Version 2.0 (the "License");
3200 * you may not use this file except in compliance with the License.
3201 * You may obtain a copy of the License at
3202 *
3203 *   http://www.apache.org/licenses/LICENSE-2.0
3204 *
3205 * Unless required by applicable law or agreed to in writing, software
3206 * distributed under the License is distributed on an "AS IS" BASIS,
3207 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3208 * See the License for the specific language governing permissions and
3209 * limitations under the License.
3210 */class So extends $d{constructor(){super("facebook.com")}static credential(e){return Ha._fromParams({providerId:So.PROVIDER_ID,signInMethod:So.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return So.credentialFromTaggedObject(e)}static credentialFromError(e){return So.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return So.credential(e.oauthAccessToken)}catch{return null}}}So.FACEBOOK_SIGN_IN_METHOD="facebook.com";So.PROVIDER_ID="facebook.com";/**
3211 * @license
3212 * Copyright 2020 Google LLC
3213 *
3214 * Licensed under the Apache License, Version 2.0 (the "License");
3215 * you may not use this file except in compliance with the License.
3216 * You may obtain a copy of the License at
3217 *
3218 *   http://www.apache.org/licenses/LICENSE-2.0
3219 *
3220 * Unless required by applicable law or agreed to in writing, software
3221 * distributed under the License is distributed on an "AS IS" BASIS,
3222 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3223 * See the License for the specific language governing permissions and
3224 * limitations under the License.
3225 */class ko extends $d{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return Ha._fromParams({providerId:ko.PROVIDER_ID,signInMethod:ko.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return ko.credentialFromTaggedObject(e)}static credentialFromError(e){return ko.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return ko.credential(n,r)}catch{return null}}}ko.GOOGLE_SIGN_IN_METHOD="google.com";ko.PROVIDER_ID="google.com";/**
3226 * @license
3227 * Copyright 2020 Google LLC
3228 *
3229 * Licensed under the Apache License, Version 2.0 (the "License");
3230 * you may not use this file except in compliance with the License.
3231 * You may obtain a copy of the License at
3232 *
3233 *   http://www.apache.org/licenses/LICENSE-2.0
3234 *
3235 * Unless required by applicable law or agreed to in writing, software
3236 * distributed under the License is distributed on an "AS IS" BASIS,
3237 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3238 * See the License for the specific language governing permissions and
3239 * limitations under the License.
3240 */class Io extends $d{constructor(){super("github.com")}static credential(e){return Ha._fromParams({providerId:Io.PROVIDER_ID,signInMethod:Io.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Io.credentialFromTaggedObject(e)}static credentialFromError(e){return Io.credentialFromTaggedObject(e.customData||{})}
3240static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Io.credential(e.oauthAccessToken)}catch{return null}}}Io.GITHUB_SIGN_IN_METHOD="github.com";Io.PROVIDER_ID="github.com";/**
3241 * @license
3242 * Copyright 2020 Google LLC
3243 *
3244 * Licensed under the Apache License, Version 2.0 (the "License");
3245 * you may not use this file except in compliance with the License.
3246 * You may obtain a copy of the License at
3247 *
3248 *   http://www.apache.org/licenses/LICENSE-2.0
3249 *
3250 * Unless required by applicable law or agreed to in writing, software
3251 * distributed under the License is distributed on an "AS IS" BASIS,
3252 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3253 * See the License for the specific language governing permissions and
3254 * limitations under the License.
3255 */class Po extends $d{constructor(){super("twitter.com")}static credential(e,n){return Ha._fromParams({providerId:Po.PROVIDER_ID,signInMethod:Po.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return Po.credentialFromTaggedObject(e)}static credentialFromError(e){return Po.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return Po.credential(n,r)}catch{return null}}}Po.TWITTER_SIGN_IN_METHOD="twitter.com";Po.PROVIDER_ID="twitter.com";/**
3256 * @license
3257 * Copyright 2020 Google LLC
3258 *
3259 * Licensed under the Apache License, Version 2.0 (the "License");
3260 * you may not use this file except in compliance with the License.
3261 * You may obtain a copy of the License at
3262 *
3263 *   http://www.apache.org/licenses/LICENSE-2.0
3264 *
3265 * Unless required by applicable law or agreed to in writing, software
3266 * distributed under the License is distributed on an "AS IS" BASIS,
3267 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3268 * See the License for the specific language governing permissions and
3269 * limitations under the License.
3270 */class qa{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,s=!1){const i=await Is._fromIdTokenResponse(e,r,s),a=zA(r);return new qa({user:i,providerId:a,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const s=zA(r);return new qa({user:e,providerId:s,_tokenResponse:r,operationType:n})}}function zA(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/**
3271 * @license
3272 * Copyright 2020 Google LLC
3273 *
3274 * Licensed under the Apache License, Version 2.0 (the "License");
3275 * you may not use this file except in compliance with the License.
3276 * You may obtain a copy of the License at
3277 *
3278 *   http://www.apache.org/licenses/LICENSE-2.0
3279 *
3280 * Unless required by applicable law or agreed to in writing, software
3281 * distributed under the License is distributed on an "AS IS" BASIS,
3282 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3283 * See the License for the specific language governing permissions and
3284 * limitations under the License.
3285 */class em extends Ls{constructor(e,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,em.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,s){return new em(e,n,r,s)}}function ZI(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?em._fromErrorAndOperation(t,i,e,r):i})}async function h9(t,e,n=!1){const r=await _d(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return qa._forOperation(t,"link",r)}/**
3286 * @license
3287 * Copyright 2019 Google LLC
3288 *
3289 * Licensed under the Apache License, Version 2.0 (the "License");
3290 * you may not use this file except in compliance with the License.
3291 * You may obtain a copy of the License at
3292 *
3293 *   http://www.apache.org/licenses/LICENSE-2.0
3294 *
3295 * Unless required by applicable law or agreed to in writing, softw
3295are
3296 * distributed under the License is distributed on an "AS IS" BASIS,
3297 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3298 * See the License for the specific language governing permissions and
3299 * limitations under the License.
3300 */async function f9(t,e,n=!1){const{auth:r}=t;if(Ir(r.app))return Promise.reject(ji(r));const s="reauthenticate";try{const i=await _d(t,ZI(r,s,e,t),n);Se(i.idToken,r,"internal-error");const a=ux(i.idToken);Se(a,r,"internal-error");const{sub:c}=a;return Se(t.uid===c,r,"user-mismatch"),qa._forOperation(t,s,i)}catch(i){throw i?.code==="auth/user-not-found"&&Wi(r,"user-mismatch"),i}}/**
3301 * @license
3302 * Copyright 2020 Google LLC
3303 *
3304 * Licensed under the Apache License, Version 2.0 (the "License");
3305 * you may not use this file except in compliance with the License.
3306 * You may obtain a copy of the License at
3307 *
3308 *   http://www.apache.org/licenses/LICENSE-2.0
3309 *
3310 * Unless required by applicable law or agreed to in writing, software
3311 * distributed under the License is distributed on an "AS IS" BASIS,
3312 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3313 * See the License for the specific language governing permissions and
3314 * limitations under the License.
3315 */async function eP(t,e,n=!1){if(Ir(t.app))return Promise.reject(ji(t));const r="signIn",s=await ZI(t,r,e),i=await qa._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}async function p9(t,e){return eP(Qi(t),e)}/**
3316 * @license
3317 * Copyright 2020 Google LLC
3318 *
3319 * Licensed under the Apache License, Version 2.0 (the "License");
3320 * you may not use this file except in compliance with the License.
3321 * You may obtain a copy of the License at
3322 *
3323 *   http://www.apache.org/licenses/LICENSE-2.0
3324 *
3325 * Unless required by applicable law or agreed to in writing, software
3326 * distributed under the License is distributed on an "AS IS" BASIS,
3327 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3328 * See the License for the specific language governing permissions and
3329 * limitations under the License.
3330 */async function m9(t,e){return Vd(t,"POST","/v1/accounts:signInWithCustomToken",Fs(t,e))}/**
3331 * @license
3332 * Copyright 2020 Google LLC
3333 *
3334 * Licensed under the Apache License, Version 2.0 (the "License");
3335 * you may not use this file except in compliance with the License.
3336 * You may obtain a copy of the License at
3337 *
3338 *   http://www.apache.org/licenses/LICENSE-2.0
3339 *
3340 * Unless required by applicable law or agreed to in writing, software
3341 * distributed under the License is distributed on an "AS IS" BASIS,
3342 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3343 * See the License for the specific language governing permissions and
3344 * limitations under the License.
3345 */async function g9(t,e){if(Ir(t.app))return Promise.reject(ji(t));const n=Qi(t),r=await m9(n,{token:e,returnSecureToken:!0}),s=await qa._fromIdTokenResponse(n,"signIn",r);return await n._updateCurrentUser(s.user),s}function y9(t,e,n,r){return xt(t).onIdTokenChanged(e,n,r)}function v9(t,e,n){return xt(t).beforeAuthStateChanged(e,n)}function tP(t){return xt(t).signOut()}/**
3346 * @license
3347 * Copyright 2020 Google LLC
3348 *
3349 * Licensed under the Apache License, Version 2.0 (the "License");
3350 * you may not use this file except in compliance with the License.
3351 * You may obtain a copy of the License at
3352 *
3353 *   http://www.apache.org/licenses/LICENSE-2.0
3354 *
3355 * Unless required by applicable law or agreed to in writing, software
3356 * distributed under the License is distributed on an "AS IS" BASIS,
3357 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3358 * See the License for the specific language governing permissions and
3359 * limitations under the License.
3360 */function HA(t,e){return js(t,"POST","/v2/accounts/mfaEnrollment:start",Fs(t,e))}const tm="__sak";/**
3361 * @license
3362 * Copyright 2019 Google LLC
3363 *
3364 * Licensed under the Apache License, Version 2.0 (the "License");
3365 * you may not use this file except in compliance with the License.
3366 * You may obtain a copy of the License at
3367 *
3368 *   http://www.apache.org/licenses/LICENSE-2.0
3369 *
3370 * Unless required by applicable law or agreed to in writing, softw
3370are
3371 * distributed under the License is distributed on an "AS IS" BASIS,
3372 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3373 * See the License for the specific language governing permissions and
3374 * limitations under the License.
3375 */class nP{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(tm,"1"),this.storage.removeItem(tm),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
3376 * @license
3377 * Copyright 2020 Google LLC
3378 *
3379 * Licensed under the Apache License, Version 2.0 (the "License");
3380 * you may not use this file except in compliance with the License.
3381 * You may obtain a copy of the License at
3382 *
3383 *   http://www.apache.org/licenses/LICENSE-2.0
3384 *
3385 * Unless required by applicable law or agreed to in writing, software
3386 * distributed under the License is distributed on an "AS IS" BASIS,
3387 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3388 * See the License for the specific language governing permissions and
3389 * limitations under the License.
3390 */const _9=1e3,x9=10;class rP extends nP{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=GI(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&e(n,s,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((a,c,u)=>{this.notifyListeners(a,u)});return}const r=e.key;n?this.detachListener():this.stopPolling();const s=()=>{const a=this.storage.getItem(r);!n&&this.localCache[r]===a||this.notifyListeners(r,a)},i=this.storage.getItem(r);jV()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,x9):s()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},_9)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Ob
3390ject.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}rP.type="LOCAL";const w9=rP;/**
3391 * @license
3392 * Copyright 2020 Google LLC
3393 *
3394 * Licensed under the Apache License, Version 2.0 (the "License");
3395 * you may not use this file except in compliance with the License.
3396 * You may obtain a copy of the License at
3397 *
3398 *   http://www.apache.org/licenses/LICENSE-2.0
3399 *
3400 * Unless required by applicable law or agreed to in writing, software
3401 * distributed under the License is distributed on an "AS IS" BASIS,
3402 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3403 * See the License for the specific language governing permissions and
3404 * limitations under the License.
3405 */class sP extends nP{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}sP.type="SESSION";const iP=sP;/**
3406 * @license
3407 * Copyright 2019 Google LLC
3408 *
3409 * Licensed under the Apache License, Version 2.0 (the "License");
3410 * you may not use this file except in compliance with the License.
3411 * You may obtain a copy of the License at
3412 *
3413 *   http://www.apache.org/licenses/LICENSE-2.0
3414 *
3415 * Unless required by applicable law or agreed to in writing, software
3416 * distributed under the License is distributed on an "AS IS" BASIS,
3417 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3418 * See the License for the specific language governing permissions and
3419 * limitations under the License.
3420 */function E9(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
3421 * @license
3422 * Copyright 2019 Google LLC
3423 *
3424 * Licensed under the Apache License, Version 2.0 (the "License");
3425 * you may not use this file except in compliance with the License.
3426 * You may obtain a copy of the License at
3427 *
3428 *   http://www.apache.org/licenses/LICENSE-2.0
3429 *
3430 * Unless required by applicable law or agreed to in writing, software
3431 * distributed under the License is distributed on an "AS IS" BASIS,
3432 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3433 * See the License for the specific language governing permissions and
3434 * limitations under the License.
3435 */class Wm{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(s=>s.isListeningto(e));if(n)return n;const r=new Wm(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:s,data:i}=n.data,a=this.handlersMap[s];if(!a?.size)return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const c=Array.from(a).map(async d=>d(n.origin,i)),u=await E9(c);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:u})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Wm.receivers=[];/**
3436 * @license
3437 * Copyright 2020 Google LLC
3438 *
3439 * Licensed under the Apache License, Version 2.0 (the "License");
3440 * you may not use this file except in compliance with the License.
3441 * You may obtain a copy of the License at
3442 *
3443 *   http://www.apache.org/licenses/LICENSE-2.0
3444 *
3445 * Unless required by applicable law or agreed to in writing, software
3446 * distributed under the License is distributed on an "AS IS" BASIS,
3447 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3448 * See the License for the specific language governing permissions and
3449 * limitations under the License.
3450 */function px(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}/**
3451 * @license
3452 * Copyright 2019 Google LLC
3453 *
3454 * Licensed under the Apache License, Version 2.0 (the "License");
3455 * you may not use this file except in compliance with the License.
3456 * You may obtain a copy of the License at
3457 *
3458 *   http://www.apache.org/licenses/LICENSE-2.0
3459 *
3460 * Unless required by applicable law or agreed to in writing, software
3461 * distributed under the License is distributed on an "AS IS" BASIS,
3462 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3463 * See the License for the specific language governing permissions and
3464 * limitations under the License.
3465 */class b9{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,n,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,a;return new Promise((c,u)=>{const d=px("",20);s.port1.start();const f=setTimeout(()=>{u(new Error("unsupported_event"))},r);a={messageChannel:s,onMessage(g){const y=g;if(y.data.eventId===d)switch(y.data.status){case"ack":clearTimeout(f),i=setTimeout(()=>{u(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),c(y.data.response);break;default:clearTimeout(f),clearTimeout(i),u(new Error("invalid_response"));break}}},this.handlers.add(a),s.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:d,data:n},[s.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}}/**
3466 * @license
3467 * Copyright 2020 Google LLC
3468 *
3469 * Licensed under the Apache License, Version 2.0 (the "License");
3470 * you may not use this file except in compliance with the License.
3471 * You may obtain a copy of the License at
3472 *
3473 *   http://www.apache.org/licenses/LICENSE-2.0
3474 *
3475 * Unless required by applicable law or agreed to in writing, software
3476 * distributed under the License is distributed on an "AS IS" BASIS,
3477 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3478 * See the License for the specific language governing permissions and
3479 * limitations under the License.
3480 */function hn(){return window}function A9(t){hn().location.href=t}/**
3481 * @license
3482 * Copyright 2020 Google LLC.
3483 *
3484 * Licensed under the Apache License, Version 2.0 (the "License");
3485 * you may not use this file except in compliance with the License.
3486 * You may obtain a copy of the License at
3487 *
3488 *   http://www.apache.org/licenses/LICENSE-2.0
3489 *
3490 * Unless required by applicable law or agreed to in writing, software
3491 * distributed under the License is distributed on an "AS IS" BASIS,
3492 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3493 * See the License for the specific language governing permissions and
3494 * limitations under the License.
3495 */function mx(){return typeof hn().WorkerGlobalScope<"u"&&typeof hn().importScripts=="function"}async function T9(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function C9(){return navigator?.serviceWorker?.controller||null}function S9(){return mx()?self:null}/**
3496 * @license
3497 * Copyright 2019 Google LLC
3498 *
3499 * Licensed under the Apache License, Version 2.0 (the "License");
3500 * you may not use this file except in compliance with the License.
3501 * You may obtain a copy of the License at
3502 *
3503 *   http://www.apache.org/licenses/LICENSE-2.0
3504 *
3505 * Unless required by applicable law or agreed to in writing, software
3506 * distributed under the License is distributed on an "AS IS" BASIS,
3507 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3508 * See the License for the specific language governing permissions and
3509 * limitations under the License.
3510 */const oP="firebaseLocalStorageDb",k9=1,nm="firebaseLocalStorage",aP="fbase_key";class zd{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Gm(t,e){return t.transaction([nm],e?"readwrite":"readonly").objectStore(nm)}function I9(){const t=indexedDB.deleteDatabase(oP);
3510return new zd(t).toPromise()}function wv(){const t=indexedDB.open(oP,k9);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(nm,{keyPath:aP})}catch(s){n(s)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(nm)?e(r):(r.close(),await I9(),e(await wv()))})})}async function qA(t,e,n){const r=Gm(t,!0).put({[aP]:e,value:n});return new zd(r).toPromise()}async function P9(t,e){const n=Gm(t,!1).get(e),r=await new zd(n).toPromise();return r===void 0?null:r.value}function WA(t,e){const n=Gm(t,!0).delete(e);return new zd(n).toPromise()}const R9=800,D9=3;class lP{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await wv(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>D9)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return mx()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Wm._getInstance(S9()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)}
3510)),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await T9(),!this.activeServiceWorker)return;this.sender=new b9(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||C9()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await wv();return await qA(e,tm,"1"),await WA(e,tm),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>qA(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>P9(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>WA(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=Gm(s,!1).getAll();return new zd(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),R9)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Ob
3510ject.keys(this.listeners).length===0&&this.stopPolling()}}lP.type="LOCAL";const N9=lP;/**
3511 * @license
3512 * Copyright 2020 Google LLC
3513 *
3514 * Licensed under the Apache License, Version 2.0 (the "License");
3515 * you may not use this file except in compliance with the License.
3516 * You may obtain a copy of the License at
3517 *
3518 *   http://www.apache.org/licenses/LICENSE-2.0
3519 *
3520 * Unless required by applicable law or agreed to in writing, software
3521 * distributed under the License is distributed on an "AS IS" BASIS,
3522 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3523 * See the License for the specific language governing permissions and
3524 * limitations under the License.
3525 */function GA(t,e){return js(t,"POST","/v2/accounts/mfaSignIn:start",Fs(t,e))}/**
3526 * @license
3527 * Copyright 2020 Google LLC
3528 *
3529 * Licensed under the Apache License, Version 2.0 (the "License");
3530 * you may not use this file except in compliance with the License.
3531 * You may obtain a copy of the License at
3532 *
3533 *   http://www.apache.org/licenses/LICENSE-2.0
3534 *
3535 * Unless required by applicable law or agreed to in writing, software
3536 * distributed under the License is distributed on an "AS IS" BASIS,
3537 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3538 * See the License for the specific language governing permissions and
3539 * limitations under the License.
3540 */const ay=YI("rcb"),O9=new Bd(3e4,6e4);class L9{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!hn().grecaptcha?.render}load(e,n=""){return Se(F9(n),e,"argument-error"),this.shouldResolveImmediately(n)&&OA(hn().grecaptcha)?Promise.resolve(hn().grecaptcha):new Promise((r,s)=>{const i=hn().setTimeout(()=>{s(Yr(e,"network-request-failed"))},O9.get());hn()[ay]=()=>{hn().clearTimeout(i),delete hn()[ay];const c=hn().grecaptcha;if(!c||!OA(c)){s(Yr(e,"internal-error"));return}const u=c.render;c.render=(d,f)=>{const g=u(d,f);return this.counter++,g},this.hostLanguage=n,r(c)};const a=`${HV()}?${Sc({onload:ay,render:"explicit",hl:n})}`;hx(a).catch(()=>{clearTimeout(i),s(Yr(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!hn().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}}function F9(t){return t.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(t)}class j9{async load(e){return new YV(e)}clearedOneInstance(){}}/**
3541 * @license
3542 * Copyright 2020 Google LLC
3543 *
3544 * Licensed under the Apache License, Version 2.0 (the "License");
3545 * you may not use this file except in compliance with the License.
3546 * You may obtain a copy of the License at
3547 *
3548 *   http://www.apache.org/licenses/LICENSE-2.0
3549 *
3550 * Unless required by applicable law or agreed to in writing, software
3551 * distributed under the License is distributed on an "AS IS" BASIS,
3552 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3553 * See the License for the specific language governing permissions and
3554 * limitations under the License.
3555 */const ed="recaptcha",M9={theme:"light",type:"image"};class DX{constructor(e,n,r={...M9}){this.parameters=r,this.type=ed,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=Qi(e),this.isInvisible=this.parameters.size==="invisible",Se(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");const s=typeof n=="string"?document.getElementById(n):n;Se(s,this.auth,"argument-error"),this.container=s,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new j9:new L9,this.validateStartingState()}async verify(){this.assertNotDestroyed();const e=await this.render(),n=this.getAssertedRecaptcha(),r=n.getResponse(e);return r||new Promise(s=>{const i=a=>{a&&(this.tokenChangeListeners.delete(i),s(a))};this.tokenChangeListeners.add(i),this.isInvisible&&n.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise?this.renderPromise:(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),this.widgetId!==null&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEac
3555h(e=>{this.container.removeChild(e)})}validateStartingState(){Se(!this.parameters.sitekey,this.auth,"argument-error"),Se(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),Se(typeof document<"u",this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return n=>{if(this.tokenChangeListeners.forEach(r=>r(n)),typeof e=="function")e(n);else if(typeof e=="string"){const r=hn()[e];typeof r=="function"&&r(n)}}}assertNotDestroyed(){Se(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){const n=document.createElement("div");e.appendChild(n),e=n}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){Se(DI()&&!mx(),this.auth,"internal-error"),await B9(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);const e=await SV(this.auth);Se(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return Se(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}function B9(){let t=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}t=()=>e(),window.addEventListener("load",t)}).catch(e=>{throw t&&window.removeEventListener("load",t),e})}/**
3556 * @license
3557 * Copyright 2020 Google LLC
3558 *
3559 * Licensed under the Apache License, Version 2.0 (the "License");
3560 * you may not use this file except in compliance with the License.
3561 * You may obtain a copy of the License at
3562 *
3563 *   http://www.apache.org/licenses/LICENSE-2.0
3564 *
3565 * Unless required by applicable law or agreed to in writing, software
3566 * distributed under the License is distributed on an "AS IS" BASIS,
3567 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3568 * See the License for the specific language governing permissions and
3569 * limitations under the License.
3570 */class V9{constructor(e,n){this.verificationId=e,this.onConfirmation=n}confirm(e){const n=Zu._fromVerification(this.verificationId,e);return this.onConfirmation(n)}}async function NX(t,e,n){if(Ir(t.app))return Promise.reject(ji(t));const r=Qi(t),s=await U9(r,e,xt(n));return new V9(s,i=>p9(r,i))}async function U9(t,e,n){if(!t._getRecaptchaConfig())try{await t9(t)}catch{}try{let r;if(typeof e=="string"?r={phoneNumber:e}:r=e,"session"in r){const s=r.session;if("phoneNumber"in r){Se(s.type==="enroll",t,"internal-error");const i={idToken:s.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await oy(t,i,"mfaSmsEnrollment",async(d,f)=>{if(f.phoneEnrollmentInfo.captchaResponse===Xu){Se(n?.type===ed,d,"argument-error");const g=await ly(d,f,n);return HA(d,g)}return HA(d,f)},"PHONE_PROVIDER").catch(d=>Promise.reject(d))).phoneSessionInfo.sessionInfo}else{Se(s.type==="signin",t,"internal-error");const i=r.multiFactorHint?.uid||r.multiFactorUid;Se(i,t,"missing-multi-factor-info");const a={mfaPendingCredential:s.credential,mfaEnrollmentId:i,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await oy(t,a,"mfaSmsSignIn",async(f,g)=>{if(g.phoneSignInInfo.captchaResponse===Xu){Se(n?.type===ed,f,"argument-error");const y=await ly(f,g,n);return GA(f,y)}return GA(f,g)},"PHONE_PROVIDER").catch(f=>Promise.reject(f))).phoneResponseInfo.sessionInfo}}else{const s={phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await oy(t,s,"sendVerificationCode",async(u,d)=>{if(d.captchaResponse===Xu){Se(n?.type===ed,u,"argument-error");const f=await ly(u,d,n);return $A(u,f)}return $A(u,d)},"PHONE_PROVIDER").catch(u=>Promise.reject(u))).sessionInfo}}finally{n?._reset()}}async function ly(t,e,n){Se(n.type===ed,t,"argument-error");const r=await n.verify();Se(typeof r=="string",t,"argument-error");const s={...e};if("phoneEnrollmentInfo"in s){const i=s.phoneEnrollmentInfo.phoneNumber,a=s.phoneEnrollmentInfo.captchaResponse,c=s.phoneEnrollmentInfo.clientType,u=s.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(s,{phoneEnrollmentInfo:{phoneNumber:i,recaptchaToken:r,captchaResponse:a,clientType:c,recaptchaVersion:u}}),s}else if("phoneSignInInfo"in s){const i=s.phoneSignInInfo.captchaResponse,a=s.phoneSignInInfo.clientType,c=s.phoneSignInInfo.recaptchaVersion;return Object.assign(s,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:i,clientType:a,recaptchaVersion:c}}),s}else return Object.assign(s,{recaptchaToken:r}),s}/**
3571 * @license
3572 * Copyright 2021 Google LLC
3573 *
3574 * Licensed under the Apache License, Version 2.0 (the "License");
3575 * you may not use this file except in compliance with the License.
3576 * You may obtain a copy of the License at
3577 *
3578 *   http://www.apache.org/licenses/LICENSE-2.0
3579 *
3580 * Unless required by applicable law or agreed to in writing, software
3581 * distributed under the License is distributed on an "AS IS" BASIS,
3582 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3583 * See the License for the specific language governing permissions and
3584 * limitations under the License.
3585 */function $9(t,e){return e?Fi(e):(Se(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/**
3586 * @license
3587 * Copyright 2019 Google LLC
3588 *
3589 * Licensed under the Apache License, Version 2.0 (the "License");
3590 * you may not use this file except in compliance with the License.
3591 * You may obtain a copy of the License at
3592 *
3593 *   http://www.apache.org/licenses/LICENSE-2.0
3594 *
3595 * Unless required by applicable law or agreed to in writing, software
3596 * distributed under the License is distributed on an "AS IS" BASIS,
3597 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3598 * See the License for the specific language governing permissions and
3599 * limitations under the License.
3600 */class gx extends fx{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ic(e,this._buildIdpRequest())}_linkToIdToken(e,n){return ic(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return ic(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}}function z9(t){return eP(t.auth,new gx(t),t.bypassAuthState)}function H9(t){const{auth:e,user:n}=t;return Se(n,e,"internal-error"),f9(n,new gx(t),t.bypassAuthState)}async function q9(t){const{auth:e,user:n}=t;return Se(n,e,"internal-error"),h9(n,new gx(t),t.bypassAuthState)}/**
3601 * @license
3602 * Copyright 2020 Google LLC
3603 *
3604 * Licensed under the Apache License, Version 2.0 (the "License");
3605 * you may not use this file except in compliance with the License.
3606 * You may obtain a copy of the License at
3607 *
3608 *   http://www.apache.org/licenses/LICENSE-2.0
3609 *
3610 * Unless required by applicable law or agreed to in writing, software
3611 * distributed under the License is distributed on an "AS IS" BASIS,
3612 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3613 * See the License for the specific language governing permissions and
3614 * limitations under the License.
3615 */class cP{constructor(e,n,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:s,tenantId:i,error:a,type:c}=e;if(a){this.reject(a);return}const u={auth:this.auth,requestUri:n,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(u))}catch(d){this.reject(d)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return z9;case"linkViaPopup":case"linkViaRedirect":return q9;case"reauthViaPopup":case"reauthViaRedirect":return H9;default:Wi(this.auth,"internal-error")}}resolve(e){Gi(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Gi(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
3616 * @license
3617 * Copyright 2020 Google LLC
3618 *
3619 * Licensed under the Apache License, Version 2.0 (the "License");
3620 * you may not use this file except in compliance with the License.
3621 * You may obtain a copy of the License at
3622 *
3623 *   http://www.apache.org/licenses/LICENSE-2.0
3624 *
3625 * Unless required by applicable law or agreed to in writing, software
3626 * distributed under the License is distributed on an "AS IS" BASIS,
3627 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3628 * See the License for the specific language governing permissions and
3629 * limitations under the License.
3630 */const W9=new Bd(2e3,1e4);class Yl extends cP{constructor(e,n,r,s,i){super(e,n,s,i),this.provider=r,this.authWindow=null,this.pollId=null,Yl.currentPopupAction&&Yl.currentPopupAction.cancel(),Yl.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Se(e,this.auth,"internal-error"),e}async onExecution(){Gi(this.filter.length===1,"Popup operations only handle one event");const e=px();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(Yr(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(Yr(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Yl.currentPopupAction=null}pollUserCancellation(){const e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Yr(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,W9.get())};e()}}Yl.currentPopupAction=null;/**
3631 * @license
3632 * Copyright 2020 Google LLC
3633 *
3634 * Licensed under the Apache License, Version 2.0 (the "License");
3635 * you may not use this file except in compliance with the License.
3636 * You may obtain a copy of the License at
3637 *
3638 *   http://www.apache.org/licenses/LICENSE-2.0
3639 *
3640 * Unless required by applicable law or agreed to in writing, software
3641 * distributed under the License is distributed on an "AS IS" BASIS,
3642 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3643 * See the License for the specific language governing permissions and
3644 * limitations under the License.
3645 */const G9="pendingRedirect",qf=new Map;class K9 extends cP{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=qf.get(this.auth._key());if(!e){try{const r=await Y9(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}qf.set(this.auth._key(),e)}return this.bypassAuthState||qf.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function Y9(t,e){const n=X9(e),r=J9(t);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function Q9(t,e){qf.set(t._key(),e)}function J9(t){return Fi(t._redirectPersistence)}function X9(t){return Hf(G9,t.config.apiKey,t.name)}async function Z9(t,e,n=!1){if(Ir(t.app))return Promise.reject(ji(t));const r=Qi(t),s=$9(r,e),a=await new K9(r,s,n).execute();return a&&!n&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}/**
3646 * @license
3647 * Copyright 2020 Google LLC
3648 *
3649 * Licensed under the Apache License, Version 2.0 (the "License");
3650 * you may not use this file except in compliance with the License.
3651 * You may obtain a copy of the License at
3652 *
3653 *   http://www.apache.org/licenses/LICENSE-2.0
3654 *
3655 * Unless required by applicable law or agreed to in writing, software
3656 * distributed under the License is distributed on an "AS IS" BASIS,
3657 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3658 * See the License for the specific language governing permissions and
3659 * limitations under the License.
3660 */const eU=600*1e3;class tU{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=
3660Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!nU(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){if(e.error&&!uP(e)){const r=e.error.code?.split("auth/")[1]||"internal-error";n.onError(Yr(this.auth,r))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=eU&&this.cachedEventUids.clear(),this.cachedEventUids.has(KA(e))}saveEventToCache(e){this.cachedEventUids.add(KA(e)),this.lastProcessedEventTime=Date.now()}}function KA(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function uP({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function nU(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return uP(t);default:return!1}}/**
3661 * @license
3662 * Copyright 2020 Google LLC
3663 *
3664 * Licensed under the Apache License, Version 2.0 (the "License");
3665 * you may not use this file except in compliance with the License.
3666 * You may obtain a copy of the License at
3667 *
3668 *   http://www.apache.org/licenses/LICENSE-2.0
3669 *
3670 * Unless required by applicable law or agreed to in writing, software
3671 * distributed under the License is distributed on an "AS IS" BASIS,
3672 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3673 * See the License for the specific language governing permissions and
3674 * limitations under the License.
3675 */async function rU(t,e={}){return js(t,"GET","/v1/projects",e)}/**
3676 * @license
3677 * Copyright 2020 Google LLC
3678 *
3679 * Licensed under the Apache License, Version 2.0 (the "License");
3680 * you may not use this file except in compliance with the License.
3681 * You may obtain a copy of the License at
3682 *
3683 *   http://www.apache.org/licenses/LICENSE-2.0
3684 *
3685 * Unless required by applicable law or agreed to in writing, software
3686 * distributed under the License is distributed on an "AS IS" BASIS,
3687 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3688 * See the License for the specific language governing permissions and
3689 * limitations under the License.
3690 */const sU=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,iU=/^https?/;async function oU(t){if(t.config.emulator)return;const{authorizedDomains:e}=await rU(t);for(const n of e)try{if(aU(n))return}catch{}Wi(t,"unauthorized-domain")}function aU(t){const e=_v(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const a=new URL(t);return a.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&a.hostname===r}if(!iU.test(n))return!1;if(sU.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
3691 * @license
3692 * Copyright 2020 Google LLC.
3693 *
3694 * Licensed under the Apache License, Version 2.0 (the "License");
3695 * you may not use this file except in compliance with the License.
3696 * You may obtain a copy of the License at
3697 *
3698 *   http://www.apache.org/licenses/LICENSE-2.0
3699 *
3700 * Unless required by applicable law or agreed to in writing, software
3701 * distributed under the License is distributed on an "AS IS" BASIS,
3702 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3703 * See the License for the specific language governing permissions and
3704 * limitations under the License.
3705 */const lU=new Bd(3e4,6e4);function YA(){const t=hn().___jsl;if(t?.H){for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n<t.CP.length;n++)t.CP[n]=null}}
3705function cU(t){return new Promise((e,n)=>{function r(){YA(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{YA(),n(Yr(t,"network-request-failed"))},timeout:lU.get()})}if(hn().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(hn().gapi?.load)r();else{const s=YI("iframefcb");return hn()[s]=()=>{gapi.load?r():n(Yr(t,"network-request-failed"))},hx(`${WV()}?onload=${s}`).catch(i=>n(i))}}).catch(e=>{throw Wf=null,e})}let Wf=null;function uU(t){return Wf=Wf||cU(t),Wf}/**
3706 * @license
3707 * Copyright 2020 Google LLC.
3708 *
3709 * Licensed under the Apache License, Version 2.0 (the "License");
3710 * you may not use this file except in compliance with the License.
3711 * You may obtain a copy of the License at
3712 *
3713 *   http://www.apache.org/licenses/LICENSE-2.0
3714 *
3715 * Unless required by applicable law or agreed to in writing, software
3716 * distributed under the License is distributed on an "AS IS" BASIS,
3717 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3718 * See the License for the specific language governing permissions and
3719 * limitations under the License.
3720 */const dU=new Bd(5e3,15e3),hU="__/auth/iframe",fU="emulator/auth/iframe",pU={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},mU=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function gU(t){const e=t.config;Se(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?cx(e,fU):`https://${t.config.authDomain}/${hU}`,r={apiKey:e.apiKey,appName:t.name,v:Ya},s=mU.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${Sc(r).slice(1)}`}async function yU(t){const e=await uU(t),n=hn().gapi;return Se(n,t,"internal-error"),e.open({where:document.body,url:gU(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:pU,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const a=Yr(t,"network-request-failed"),c=hn().setTimeout(()=>{i(a)},dU.get());function u(){hn().clearTimeout(c),s(r)}r.ping(u).then(u,()=>{i(a)})}))}/**
3721 * @license
3722 * Copyright 2020 Google LLC.
3723 *
3724 * Licensed under the Apache License, Version 2.0 (the "License");
3725 * you may not use this file except in compliance with the License.
3726 * You may obtain a copy of the License at
3727 *
3728 *   http://www.apache.org/licenses/LICENSE-2.0
3729 *
3730 * Unless required by applicable law or agreed to in writing, software
3731 * distributed under the License is distributed on an "AS IS" BASIS,
3732 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3733 * See the License for the specific language governing permissions and
3734 * limitations under the License.
3735 */const vU={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},_U=500,xU=600,wU="_blank",EU="http://localhost";class QA{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function bU(t,e,n,r=_U,s=xU){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const u={...vU,width:r.toString(),height:s.toString(),top:i,left:a},d=lr().toLowerCase();n&&(c=$I(d)?wU:n),VI(d)&&(e=e||EU,u.scrollbars="yes");const f=Object.entries(u).reduce((y,[x,b])=>`${y}${x}=${b},`,"");if(FV(d)&&c!=="_self")return AU(e||"",c),new QA(null);const g=window.open(e||"",c,f);Se(g,t,"popup-blocked");try{g.focus()}catch{}return new QA(g)}function AU(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/**
3736 * @license
3737 * Copyright 2021 Google LLC
3738 *
3739 * Licensed under the Apache License, Version 2.0 (the "License");
3740 * you may not use this file except in compliance with the License.
3741 * You may obtain a copy of the License at
3742 *
3743 *   http://www.apache.org/licenses/LICENSE-2.0
3744 *
3745 * Unless required by applicable law or agreed to in writing, softw
3745are
3746 * distributed under the License is distributed on an "AS IS" BASIS,
3747 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3748 * See the License for the specific language governing permissions and
3749 * limitations under the License.
3750 */const TU="__/auth/handler",CU="emulator/auth/handler",SU=encodeURIComponent("fac");async function JA(t,e,n,r,s,i){Se(t.config.authDomain,t,"auth-domain-config-required"),Se(t.config.apiKey,t,"invalid-api-key");const a={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Ya,eventId:s};if(e instanceof XI){e.setDefaultLanguage(t.languageCode),a.providerId=e.providerId||"",tF(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(const[f,g]of Object.entries({}))a[f]=g}if(e instanceof $d){const f=e.getScopes().filter(g=>g!=="");f.length>0&&(a.scopes=f.join(","))}t.tenantId&&(a.tid=t.tenantId);const c=a;for(const f of Object.keys(c))c[f]===void 0&&delete c[f];const u=await t._getAppCheckToken(),d=u?`#${SU}=${encodeURIComponent(u)}`:"";return`${kU(t)}?${Sc(c).slice(1)}${d}`}function kU({config:t}){return t.emulator?cx(t,CU):`https://${t.authDomain}/${TU}`}/**
3751 * @license
3752 * Copyright 2020 Google LLC
3753 *
3754 * Licensed under the Apache License, Version 2.0 (the "License");
3755 * you may not use this file except in compliance with the License.
3756 * You may obtain a copy of the License at
3757 *
3758 *   http://www.apache.org/licenses/LICENSE-2.0
3759 *
3760 * Unless required by applicable law or agreed to in writing, software
3761 * distributed under the License is distributed on an "AS IS" BASIS,
3762 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3763 * See the License for the specific language governing permissions and
3764 * limitations under the License.
3765 */const cy="webStorageSupport";class IU{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=iP,this._completeRedirectFn=Z9,this._overrideRedirectResult=Q9}
3765async _openPopup(e,n,r,s){Gi(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");const i=await JA(e,n,r,_v(),s);return bU(e,i,px())}async _openRedirect(e,n,r,s){await this._originValidation(e);const i=await JA(e,n,r,_v(),s);return A9(i),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:s,promise:i}=this.eventManagers[n];return s?Promise.resolve(s):(Gi(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await yU(e),r=new tU(e);return n.register("authEvent",s=>(Se(s?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(cy,{type:cy},s=>{const i=s?.[0]?.[cy];i!==void 0&&n(!!i),Wi(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=oU(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return GI()||UI()||dx()}}const PU=IU;var XA="@firebase/auth",ZA="1.12.0";/**
3766 * @license
3767 * Copyright 2020 Google LLC
3768 *
3769 * Licensed under the Apache License, Version 2.0 (the "License");
3770 * you may not use this file except in compliance with the License.
3771 * You may obtain a copy of the License at
3772 *
3773 *   http://www.apache.org/licenses/LICENSE-2.0
3774 *
3775 * Unless required by applicable law or agreed to in writing, software
3776 * distributed under the License is distributed on an "AS IS" BASIS,
3777 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3778 * See the License for the specific language governing permissions and
3779 * limitations under the License.
3780 */class RU{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){Se(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
3781 * @license
3782 * Copyright 2020 Google LLC
3783 *
3784 * Licensed under the Apache License, Version 2.0 (the "License");
3785 * you may not use this file except in compliance with the License.
3786 * You may obtain a copy of the License at
3787 *
3788 *   http://www.apache.org/licenses/LICENSE-2.0
3789 *
3790 * Unless required by applicable law or agreed to in writing, software
3791 * distributed under the License is distributed on an "AS IS" BASIS,
3792 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3793 * See the License for the specific language governing permissions and
3794 * limitations under the License.
3795 */function DU(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function NU(t){Mo(new $i("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:a,authDomain:c}=r.options;Se(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});const u={apiKey:a,authDomain:c,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:KI(t)},d=new $V(r,s,i,u);return r9(d,n),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),Mo(new $i("auth-internal",e=>{const n=Qi(e.getProvider("auth").getImmediate());return(r=>new RU(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),hs(XA,ZA,DU(t)),hs(XA,ZA,"esm2020")}/**
3796 * @license
3797 * Copyright 2021 Google LLC
3798 *
3799 * Licensed under the Apache License, Version 2.0 (the "License");
3800 * you may not use this file except in compliance with the License.
3801 * You may obtain a copy of the License at
3802 *
3803 *   http://www.apache.org/licenses/LICENSE-2.0
3804 *
3805 * Unless required by applicable law or agreed to in writing, software
3806 * distributed under the License is distributed on an "AS IS" BASIS,
3807 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3808 * See the License for the specific language governing permissions and
3809 * limitations under the License.
3810 */const OU=300,LU=vk("authIdTokenMaxAge")||OU;let eT=null;const FU=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>LU)return;const s=n?.token;eT!==s&&(eT=s,await fetch(t,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function jU(t=Sm()){const e=Rd(t,"auth");if(e.isInitialized())return e.getImmediate();const n=n9(t,{popupRedirectResolver:PU,persistence:[N9,w9,iP]}),r=vk("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const a=FU(i.toString());v9(n,a,()=>a(n.currentUser)),y9(n,c=>a(c))}}const s=gk("auth");return s&&s9(n,`http://${s}`),n}function MU(){return document.getElementsByTagName("head")?.[0]??document}zV({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=s=>{const i=Yr("internal-error");i.customData=s,n(i)},r.type="text/javascript",r.charset="UTF-8",MU().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});NU("Browser");const BU={apiKey:"AIzaSyClLPpq53pr74Zyrhd2Os5LM5fJWiD5w28",authDomain:"pdaus-org.firebaseapp.com",projectId:"pdaus-org",storageBucket:"pdaus-org.firebasestorage.app",messagingSenderId:"292071967820",appId:"1:292071967820:web:56bd047b165a8696cfb8e9"},Km=Ek(BU),yx=k5(Km),ui=J5(Km,"us-central1"),Mi=rV(Km),lt=jU(Km);async function dP({to:t,subject:e,text:n,html:r,replyTo:s,from:i}){try{const a={to:t,message:{subject:e,text:n,html:r||n.replace(/\n/g,"<br>")}};return s&&(a.replyTo=s),i&&(a.from=i),{success:!0,messageId:(await gV(Q_(Mi,"mail"),a)).id,message:"Email queued for sending by Firebase Extension"}}catch(a){throw a.code==="permission-denied"?new Error("Firestore permission denied. Please check Security Rules in Firebase Console."):a.code==="unavailable"?new Error("Firestore is unavailable. Please check your internet connection."):a.code==="unauthenticated"?new Error("Firestore authentication failed. Please check Firebase configuration."):new Error(`Failed to queue email: ${a.message}`)}}async function VU({name:t,email:e,phone:n,reason:r,message:s,source:i,isMember:a}){const c=r==="Legal Advice"?"[email protected]":"[email protected]",u=r==="Legal Advice"?"LEGAL AID":r.toUpperCase(),d=`
3811New Website Inquiry - ${u}
3812${"=".repeat(50)}
3813
3814PERSONAL INFORMATION:
3815Name: ${t}
3816Email: ${e}
3817Phone: ${n}
3818Member: ${a}
3819
3820INQUIRY DETAILS:
3821Reason: ${r}
3822Source: ${i}
3823
3824MESSAGE:
3825${s}
3826
3827${"=".repeat(50)}
3828Received: ${new Date().toLocaleString()}
3829  `.trim(),f=`
3830    <div style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; padding: 20px; background-color: #f5f5f5;">
3831      <div style="background-color: #001F3F; color: white; padding: 20px; border-radius: 8px 8px 0 0;">
3832        <h2 style="margin: 0;">New Website Inquiry</h2>
3833        <p style="margin: 5px 0 0 0; opacity: 0.9;">Department: ${u}</p>
3834      </div>
3835      
3836      <div style="background-color: white; padding: 20px; border-radius: 0 0 8px 8px;">
3837        <h3 style="color: #001F3F; border-bottom: 2px solid #e0e0e0; padding-bottom: 10px;">Personal Information</h3>
3838        <p><strong>Name:</strong> ${t}</p>
3839        <p><strong>Email:</strong> <a href="mailto:${e}">${e}</a></p>
3840        <p><strong>Phone:</strong> ${n}</p>
3841        <p><strong>PDA Member:</strong> ${a}</p>
3842        
3843        <h3 style="color: #001F3F; border-bottom: 2px solid #e0e0e0; padding-bottom: 10px; margin-top: 30px;">Inquiry Details</h3>
3844        <p><strong>Reason for Contact:</strong> ${r}</p>
3845        <p><strong>How they found us:</strong> ${i}</p>
3846        
3847        <h3 style="color: #001F3F; border-bottom: 2px solid #e0e0e0; padding-bottom: 10px; margin-top: 30px;">Message</h3>
3848        <div style="background-color: #f9f9f9; padding: 15px; border-left: 4px solid #001F3F; border-radius: 4px;">
3849          ${s.replace(/\n/g,"<br>")}
3850        </div>
3851        
3852        <div style="margin-top: 30px; padding-top: 20px; border-top: 1px solid #e0e0e0; color: #666; font-size: 12px;">
3853          <p>
3853Received: ${new Date().toLocaleString()}</p>
3854          <p>Click "Reply" to respond directly to ${t}</p>
3855        </div>
3856      </div>
3857    </div>
3858  `;return await dP({to:c,subject:`New Website Inquiry: ${u}`,text:d,html:f,replyTo:e})}const UU=ci(ui,"submitPublicApplication"),$U=ci(ui,"listPublicApplications"),zU=ci(ui,"getPublicApplication"),HU=ci(ui,"reviewPublicApplication"),qU=ci(ui,"updateIdentityCard"),WU=ci(ui,"getMyIdentityProfile"),GU=ci(ui,"updateMyIdentityPhoto"),KU=60*1e3,vx=new Map,_f=new Map,hP=(t="")=>`${lt.currentUser?.uid||"signed-out"}:${t||"all"}`,fP=(t="")=>{const e=vx.get(hP(t));return!e||Date.now()-e.savedAt>KU?null:e.applications},_x=()=>{vx.clear()},pP=async(t,e,n="")=>{try{const r=await UU({type:t,data:e,website:n});if(!r.data?.success)throw new Error("The application service returned an incomplete response.");return r.data}catch(r){const s=String(r?.code||"");throw s.includes("resource-exhausted")?new Error("Too many submissions. Please wait and try again."):s.includes("invalid-argument")?new Error(r?.message||"Please review the form and try again."):new Error("We could not securely submit your application. Please try again.")}},xx=t=>pP("member_registration",{...t,source_path:t.source_path||window.location.pathname}),wx=(t,e="")=>pP("volunteer_application",{...t,source_path:t.source_path||window.location.pathname},e),Oc=(t,e)=>{const n=String(t?.code||"");return n.includes("permission-denied")||n.includes("unauthenticated")?new Error("Your administrator session is not authorized. Please sign in again."):n.includes("not-found")?new Error("This application could not be found."):n.includes("resource-exhausted")?new Error(t?.message||"The ID sequence is currently unavailable."):new Error(t?.message||e)},Ex=async(t="",{force:e=!1}={})=>{const n=hP(t),r=fP(t);if(!e&&r)return r;if(_f.has(n))return _f.get(n);const s=(async()=>{try{const a=(await $U({status:t})).data?.applications||[];return vx.set(n,{applications:a,savedAt:Date.now()}),a}catch(i){throw Oc(i,"Applications could not be loaded.")}finally{_f.delete(n)}})();return _f.set(n,s),s},mP=async(t="")=>{try{return await Ex(t)}catch{return null}},gP=async(t,e)=>{try{const n=await zU({type:t,applicationId:e});if(!n.data?.application)throw new Error("Application data is missing.");return n.data.application}catch(n){throw Oc(n,"The application could not be loaded.")}},yP=async({type:t,applicationId:e,decision:n,notes:r=""})=>{try{const s=await HU({type:t,applicationId:e,decision:n,notes:r});if(!s.data?.success)throw new Error("The application decision was not confirmed.");return _x(),s.data}catch(s){throw Oc(s,"The application decision could not be saved.")}},bx=async({type:t,applicationId:e,status:n,photoPath:r="",templateRevision:s=0})=>{try{const i=await qU({type:t,applicationId:e,status:n,photoPath:r,templateRevision:s});if(!i.data?.success)throw new Error("The identity card update was not confirmed.");return _x(),i.data}catch(i){throw Oc(i,"The identity card could not be updated.")}},vP=({applicationId:t,status:e,photoPath:n=""})=>bx({type:"member_registration",applicationId:t,status:e,photoPath:n}),Ax=async()=>{try{const t=await WU({});if(!t.data?.profile)throw new Error("Identity profile data is missing.");return t.data.profile}catch(t){throw Oc(t,"Your PDA identity profile could not be loaded.")}},_P=async t=>{try{const e=await GU({photoPath:t});if(!e.data?.success)throw new Error("Your photo update was not confirmed.");return e.data}
3858catch(e){throw Oc(e,"Your identity photo could not be saved.")}},YU={submitMember:xx,submitVolunteer:wx,list:Ex,prefetch:mP,get:gP,review:yP,saveIdentityCard:bx,saveMembershipCard:vP,getOwnIdentityProfile:Ax,saveOwnIdentityPhoto:_P},QU=Object.freeze(Object.defineProperty({__proto__:null,default:YU,getApplication:gP,getCachedApplications:fP,getOwnIdentityProfile:Ax,invalidateApplicationsCache:_x,listApplications:Ex,prefetchApplications:mP,reviewApplication:yP,saveIdentityCard:bx,saveMembershipCard:vP,saveOwnIdentityPhoto:_P,submitMemberApplication:xx,submitVolunteerApplication:wx},Symbol.toStringTag,{value:"Module"})),Mt={DONATION:"donation",LEGAL_AID:"legal-aid",TECHNICAL_SUPPORT:"technical-support",GENERAL:"general",MEMBER_REGISTRATION:"member-registration",VOLUNTEER_APPLICATION:"volunteer-application",PASSWORD_RESET:"password-reset",USERNAME_RECOVERY:"username-recovery"},tT={[Mt.DONATION]:"[email protected]",[Mt.LEGAL_AID]:"[email protected]",[Mt.TECHNICAL_SUPPORT]:"[email protected]",[Mt.MEMBER_REGISTRATION]:"[email protected]",[Mt.VOLUNTEER_APPLICATION]:"[email protected]",[Mt.GENERAL]:"[email protected]"},xP=async({type:t,data:e})=>{let n=tT[t]||tT[Mt.GENERAL];(t===Mt.PASSWORD_RESET||t===Mt.USERNAME_RECOVERY)&&(n=e.email);const r=new Date().toLocaleString();let s="",i="";switch(t){case Mt.DONATION:s=`New Donation Received: $${e.amount}`,i=`
3859        New Donation Notification
3860        -------------------------
3861        Amount: $${e.amount}
3862        Donor: ${e.firstName} ${e.lastName}
3863        Email: ${e.email}
3864        Phone: ${e.phone||"N/A"}
3865        In Name Of: ${e.inNameOf}
3866        
3867        Timestamp: ${r}
3868      `;break;case Mt.MEMBER_REGISTRATION:s=`New Member Registration: ${e.name}`,i=`
3869        New PDA Member Registration
3870        ---------------------------
3871        Name: ${e.name}
3872        Email: ${e.email}
3873        Phone: ${e.phone}
3874        Location: ${e.city}, ${e.state}, ${e.country}
3875        Member ID: ${e.member_id}
3876        Registration Date: ${r}
3877        
3878        Action Required: Please welcome our new member!
3879      `;break;case Mt.VOLUNTEER_APPLICATION:s=`New Volunteer Application: ${e.name}`,i=`
3880        New PDA Volunteer Application
3881        -----------------------------
3882        Name: ${e.name}
3883        Email: ${e.email}
3884        Phone: ${e.phone}
3885        Interest Area: ${e.interest_area||"Not specified"}
3886        Availability: ${e.availability||"Not specified"}
3887
3888        Timestamp: ${r}
3889      `;break;case Mt.PASSWORD_RESET:s="PDA - Password Reset Request",i=`
3890        Hello,
3891        
3892        We received a request to reset your password.
3893        Your verification code is: ${e.code}
3894        
3895        If you did not make this request, please ignore this email.
3896      `;break;case Mt.USERNAME_RECOVERY:s="PDA - Username Recovery",i=`
3897        Hello ${e.name},
3898        
3899        You requested to recover your account information.
3900        
3901        Email: ${e.email}
3902        Member ID: ${e.member_code}
3903        
3904        You can login here: ${window.location.origin}/member/login
3905      `;break;case Mt.LEGAL_AID:s=`${e.urgency==="urgent"?"🔴 [URGENT] ":e.urgency==="soon"?"🟡 [PRIORITY] ":""}Question from ${e.name}`,i=`
3906        New Member Question
3907        ---------------------
3908        Urgency: ${e.urgency==="urgent"?"🔴 紧急 (URGENT)":e.urgency==="soon"?"🟡 希望尽快 (Priority)":"🟢 一般咨询 (Normal)"}
3909        
3910        Contact Information:
3911        Name: ${e.name}
3912        Email: ${e.email}
3913        Phone: ${e.phone||"N/A"}
3914        Member ID: ${e.member_id||"Non-Member"}
3915        Response Type: ${e.preferred_response_type}
3916        
3917        Question:
3918        ${e.question}
3919        
3920        Timestamp: ${r}
3921        
3922        ---
3923        Action Required: 
3924        1. Review the question
3925        2. Assign to appropriate specialist
3926        3. Respond according to urgency level
3927      `;break;case Mt.TECHNICAL_SUPPORT:s=`Technical Support Request: ${e.reason||"App Issue"}`,i=`
3928        Technical Support Request
3929        -------------------------
3930        Source: ${e.source}
3931        Name: ${e.name}
3932        Email: ${e.email}
3933        Phone: ${e.phone}
3934        
3935        Message:
3936        ${e.message}
3937        
3938        Timestamp: ${r}
3939      `;break;case Mt.GENERAL:default:s=`Contact Form Inquiry: ${e.reason}`,i=`
3940        General Inquiry
3941        ---------------
3942        Reason: ${e.reason}
3943        Source: ${e.source}
3944        Name: ${e.name}
3945        Email: ${e.email}
3946        Phone: ${e.phone}
3947        Member: ${e.isMember}
3948        
3949        Message:
3950        ${e.message}
3951        
3952        Timestamp: ${r}
3953      `;break}const a={type:t,recipient:n,sender_email:t===Mt.PASSWORD_RESET?"[email protected]":e.email,sender_name:"System",subject:s,body:i.trim(),original_data:e};try{let c;t===Mt.GENERAL||t===Mt.TECHNICAL_SUPPORT||t===Mt.LEGAL_AID?c=await VU(e):t===Mt.MEMBER_REGISTRATION?c=await xx(e):t===Mt.VOLUNTEER_APPLICATION?c=await wx(e):c=await dP({to:n,subject:s,text:i.trim(),replyTo:e.email||"[email protected]"});try{if(Rn.emails&&typeof Rn.emails.create=="function")return{...Rn.emails.create(a),...c,messageId:c.messageId,sent:!0,method:"firebase"}}catch{}return{...c,id:c.messageId,messageId:c.messageId,sent:!0,recipient:n,subject:s,method:"firebase"}}catch(c){try{if(Rn.emails&&typeof Rn.emails.create=="function"){const u=Rn.emails.create({...a,send_error:c.message})}}catch{}throw c}},rm=t=>{if(!t)return null;const e=String(t).replace(/\D/g,"");return e.length===10?`+1${e}`:e.length===11&&e.startsWith("1")?`+${e}`:e.startsWith("+1")?e:t},uy=async(t,e="login")=>{try{const n=rm(t);if(!n)return{success:!1,message:"Invalid phone number format"};const{data:r,error:s}=await $e.functions.invoke("send-2fa-code",{body:{phone_number:n,method:"sms",purpose:e}});return s?{success:!1,message:s.message||"Failed to send verification code"}:!r||!r.success?{success:!1,message:r?.message||"Failed to send verification code"}:{success:!0,message:"Verification code sent successfully",code:r.code}}catch(n){return{success:!1,message:n.message||"An unexpected error occurred"}}},JU=async(t,e)=>{try{const n=rm(t);if(!n)return{success:!1,message:"Invalid phone number format"};const{data:r,error:s}=await $e.functions.invoke("send-2fa-code",{body:{phone_number:n,method:"sms",purpose:"username_reminder",custom_message:`Your PDA username is: ${e}. If you didn't request this, please contact [email protected]`}});return s?{success:!1,message:s.message||"Failed to send username information"}:!r||!r.success?{success:!1,message:r?.message||"Failed to send username information"}:{success:!0,message:"Username information sent successfully"}}catch(n){return{success:!1,message:n.message||"An unexpected error occurred"}}};var Gf={exports:{}};function XU(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Kf={exports:{}};const ZU={},e7=Object.freeze(Object.defineProperty({__proto__:null,default:ZU},Symbol.toStringTag,{value:"Module"})),t7=SS(e7);var n7=Kf.exports,nT;function ot(){return nT||(nT=1,(function(t,e){(function(n,r){t.exports=r()})(n7,function(){var n=n||(function(r,s){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof Ia<"u"&&Ia.crypto&&(i=Ia.crypto),!i&&typeof XU=="function")try{i=t7}catch{}var a=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||(function(){function C(){}return function(k){var N;return C.prototype=k,N=new C,C.prototype=null,N}})(),u={},d=u.lib={},f=d.Base=(function(){return{extend:function(C){var k=c(this);
3953return C&&k.mixIn(C),(!k.hasOwnProperty("init")||this.init===k.init)&&(k.init=function(){k.$super.init.apply(this,arguments)}),k.init.prototype=k,k.$super=this,k},create:function(){var C=this.extend();return C.init.apply(C,arguments),C},init:function(){},mixIn:function(C){for(var k in C)C.hasOwnProperty(k)&&(this[k]=C[k]);C.hasOwnProperty("toString")&&(this.toString=C.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),g=d.WordArray=f.extend({init:function(C,k){C=this.words=C||[],k!=s?this.sigBytes=k:this.sigBytes=C.length*4},toString:function(C){return(C||x).stringify(this)},concat:function(C){var k=this.words,N=C.words,V=this.sigBytes,$=C.sigBytes;if(this.clamp(),V%4)for(var D=0;D<$;D++){var I=N[D>>>2]>>>24-D%4*8&255;k[V+D>>>2]|=I<<24-(V+D)%4*8}else for(var B=0;B<$;B+=4)k[V+B>>>2]=N[B>>>2];return this.sigBytes+=$,this},clamp:function(){var C=this.words,k=this.sigBytes;C[k>>>2]&=4294967295<<32-k%4*8,C.length=r.ceil(k/4)},clone:function(){var C=f.clone.call(this);return C.words=this.words.slice(0),C},random:function(C){for(var k=[],N=0;N<C;N+=4)k.push(a());return new g.init(k,C)}}),y=u.enc={},x=y.Hex={stringify:function(C){for(var k=C.words,N=C.sigBytes,V=[],$=0;$<N;$++){var D=k[$>>>2]>>>24-$%4*8&255;V.push((D>>>4).toString(16)),V.push((D&15).toString(16))}return V.join("")},parse:function(C){for(var k=C.length,N=[],V=0;V<k;V+=2)N[V>>>3]|=parseInt(C.substr(V,2),16)<<24-V%8*4;return new g.init(N,k/2)}},b=y.Latin1={stringify:function(C){for(var k=C.words,N=C.sigBytes,V=[],$=0;$<N;$++){var D=k[$>>>2]>>>24-$%4*8&255;V.push(String.fromCharCode(D))}return V.join("")},parse:function(C){for(var k=C.length,N=[],V=0;V<k;V++)N[V>>>2]|=(C.charCodeAt(V)&255)<<24-V%4*8;return new g.init(N,k)}},E=y.Utf8={stringify:function(C){try{return decodeURIComponent(escape(b.stringify(C)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(C){return b.parse(unescape(encodeURIComponent(C)))}},w=d.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(C){typeof C=="string"&&(C=E.parse(C)),this._data.concat(C),this._nDataBytes+=C.sigBytes},_process:function(C){var k,N=this._data,V=N.words,$=N.sigBytes,D=this.blockSize,I=D*4,B=$/I;C?B=r.ceil(B):B=r.max((B|0)-this._minBufferSize,0);var O=B*D,F=r.min(O*4,$);if(O){for(var L=0;L<O;L+=D)this._doProcessBlock(V,L);k=V.splice(0,O),N.sigBytes-=F}return new g.init(k,F)},clone:function(){var C=f.clone.call(this);return C._data=this._data.clone(),C},_minBufferSize:0});d.Hasher=w.extend({cfg:f.extend(),init:function(C){this.cfg=this.cfg.extend(C),this.reset()},reset:function(){w.reset.call(this),this._doReset()},update:function(C){return this._append(C),this._process(),this},finalize:function(C){C&&this._append(C);var k=this._doFinalize();return k},blockSize:16,_createHelper:function(C){return function(k,N){return new C.init(N).finalize(k)}},_createHmacHelper:function(C){return function(k,N){return new R.HMAC.init(C,N).finalize(k)}}});var R=u.algo={};return u})(Math);return n})})(Kf)),Kf.exports}var Yf={exports:{}},r7=Yf.exports,rT;function Ym(){return rT||(rT=1,(function(t,e){(function(n,r){t.exports=r(ot())})(r7,function(n){return(function(r){var s=n,i=s.lib,a=i.Base,c=i.WordArray,u=s.x64={};u.Word=a.extend({init:function(d,f){this.high=d,this.low=f}}),u.WordArray=a.extend({init:function(d,f){d=this.words=d||[],f!=r?this.sigBytes=f:this.sigBytes=d.length*8},toX32:function(){for(var d=this.words,f=d.length,g=[],y=0;y<f;y++){var x=d[y];g.push(x.high),g.push(x.low)}return c.create(g,this.sigBytes)},clone:function(){for(var d=a.clone.call(this),f=d.words=this.words.slice(0),g=f.length,y=0;y<g;y++)f[y]=f[y].clone();return d}})})(),n})})(Yf)),Yf.exports}var Qf={exports:{}},s7=Qf.exports,sT;function i7(){return sT||(sT=1,(function(t,e){(function(n,r){t.exports=r(ot())})(s7,function(n){return(function(){if(typeof ArrayBuffer=="function"){var r=n,s=r.lib,i=s.WordArray,a=i.init,c=i.init=function(u){if(u instanceof ArrayBuffer&&(u=new Uint8Array(u)),(u instanceof Int8Array||typeof Uint8ClampedArray<"u"&&u instanceof Uint8ClampedArray||u instanceof Int16Array||u instanceof Uint16Array||u instanceof Int32Array||u instanceof Uint32Array||u instanceof Float32Array||u instanceof Float64Array)&&(u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength)),u instanceof Uint8Array){for(var d=u.byteLength,f=[],g=0;g<d;g++)f[g>>>2]|=u[g]<<24-g%4*8;a.call(this,f,d)}else a.apply(this,arguments)};c.prototype=i}})(),n.lib.WordArray})})(Qf)),Qf.exports}var Jf={exports:{}},o7=Jf.exports,iT;function a7(){return iT||(iT=1,(function(t,e){(function(n,r){t.exports=r(ot())})(o7,function(n){return(function(){var r=n,s=r.lib,i=s.WordArray,a=r.enc;a.Utf16=a.Utf16BE={stringify:function(u){for(var d=u.words,f=u.sigBytes,g=[],y=0;y<f;y+=2){var x=d[y>>>2]>>>16-y%4*8&65535;g.push(String.fromCharCode(x))}return g.join("")},parse:function(u){for(var d=u.length,f=[],g=0;g<d;g++)f[g>>>1]|=u.charCodeAt(g)<<16-g%2*16;return i.create(f,d*2)}},a.Utf16LE={stringify:function(u){for(var d=u.words,f=u.sigBytes,g=[],y=0;y<f;y+=2){var x=c(d[y>>>2]>>>16-y%4*8&65535);g.push(String.fromCharCode(x))}return g.join("")},parse:function(u){for(var d=u.length,f=[],g=0;g<d;g++)f[g>>>1]|=c(u.charCodeAt(g)<<16-g%2*16);return i.create(f,d*2)}};function c(u){return u<<8&4278255360|u>>>8&16711935}})(),n.enc.Utf16})})(Jf)),Jf.exports}var Xf={exports:{}},l7=Xf.exports,oT;function Xa(){return oT||(oT=1,(function(t,e){(function(n,r){t.exports=r(ot())})(l7,function(n){return(function(){var r=n,s=r.lib,i=s.WordArray,a=r.enc;a.Base64={stringify:function(u){var d=u.words,f=u.sigBytes,g=this._map;u.clamp();for(var y=[],x=0;x<f;x+=3)for(var b=d[x>>>2]>>>24-x%4*8&255,E=d[x+1>>>2]>>>24-(x+1)%4*8&255,w=d[x+2>>>2]>>>24-(x+2)%4*8&255,R=b<<16|E<<8|w,C=0;C<4&&x+C*.75<f;C++)y.push(g.charAt(R>>>6*(3-C)&63));var k=g.charAt(64);if(k)for(;y.length%4;)y.push(k);return y.join("")},parse:function(u){var d=u.length,f=this._map,g=this._reverseMap;if(!g){g=this._reverseMap=[];for(var y=0;y<f.length;y++)g[f.charCodeAt(y)]=y}var x=f.charAt(64);if(x){var b=u.indexOf(x);b!==-1&&(d=b)}return c(u,d,g)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
3953+/="};function c(u,d,f){for(var g=[],y=0,x=0;x<d;x++)if(x%4){var b=f[u.charCodeAt(x-1)]<<x%4*2,E=f[u.charCodeAt(x)]>>>6-x%4*2,w=b|E;g[y>>>2]|=w<<24-y%4*8,y++}return i.create(g,y)}})(),n.enc.Base64})})(Xf)),Xf.exports}var Zf={exports:{}},c7=Zf.exports,aT;function u7(){return aT||(aT=1,(function(t,e){(function(n,r){t.exports=r(ot())})(c7,function(n){return(function(){var r=n,s=r.lib,i=s.WordArray,a=r.enc;a.Base64url={stringify:function(u,d){d===void 0&&(d=!0);var f=u.words,g=u.sigBytes,y=d?this._safe_map:this._map;u.clamp();for(var x=[],b=0;b<g;b+=3)for(var E=f[b>>>2]>>>24-b%4*8&255,w=f[b+1>>>2]>>>24-(b+1)%4*8&255,R=f[b+2>>>2]>>>24-(b+2)%4*8&255,C=E<<16|w<<8|R,k=0;k<4&&b+k*.75<g;k++)x.push(y.charAt(C>>>6*(3-k)&63));var N=y.charAt(64);if(N)for(;x.length%4;)x.push(N);return x.join("")},parse:function(u,d){d===void 0&&(d=!0);var f=u.length,g=d?this._safe_map:this._map,y=this._reverseMap;if(!y){y=this._reverseMap=[];for(var x=0;x<g.length;x++)y[g.charCodeAt(x)]=x}var b=g.charAt(64);if(b){var E=u.indexOf(b);E!==-1&&(f=E)}return c(u,f,y)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function c(u,d,f){for(var g=[],y=0,x=0;x<d;x++)if(x%4){var b=f[u.charCodeAt(x-1)]<<x%4*2,E=f[u.charCodeAt(x)]>>>6-x%4*2,w=b|E;g[y>>>2]|=w<<24-y%4*8,y++}return i.create(g,y)}})(),n.enc.Base64url})})(Zf)),Zf.exports}var ep={exports:{}},d7=ep.exports,lT;function Za(){return lT||(lT=1,(function(t,e){(function(n,r){t.exports=r(ot())})(d7,function(n){return(function(r){var s=n,i=s.lib,a=i.WordArray,c=i.Hasher,u=s.algo,d=[];(function(){for(var E=0;E<64;E++)d[E]=r.abs(r.sin(E+1))*4294967296|0})();var f=u.MD5=c.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(E,w){for(var R=0;R<16;R++){var C=w+R,k=E[C];E[C]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360}var N=this._hash.words,V=E[w+0],$=E[w+1],D=E[w+2],I=E[w+3],B=E[w+4],O=E[w+5],F=E[w+6],L=E[w+7],M=E[w+8],se=E[w+9],H=E[w+10],J=E[w+11],le=E[w+12],K=E[w+13],re=E[w+14],ee=E[w+15],U=N[0],W=N[1],te=N[2],Q=N[3];U=g(U,W,te,Q,V,7,d[0]),Q=g(Q,U,W,te,$,12,d[1]),te=g(te,Q,U,W,D,17,d[2]),W=g(W,te,Q,U,I,22,d[3]),U=g(U,W,te,Q,B,7,d[4]),Q=g(Q,U,W,te,O,12,d[5]),te=g(te,Q,U,W,F,17,d[6]),W=g(W,te,Q,U,L,22,d[7]),U=g(U,W,te,Q,M,7,d[8]),Q=g(Q,U,W,te,se,12,d[9]),te=g(te,Q,U,W,H,17,d[10]),W=g(W,te,Q,U,J,22,d[11]),U=g(U,W,te,Q,le,7,d[12]),Q=g(Q,U,W,te,K,12,d[13]),te=g(te,Q,U,W,re,17,d[14]),W=g(W,te,Q,U,ee,22,d[15]),U=y(U,W,te,Q,$,5,d[16]),Q=y(Q,U,W,te,F,9,d[17]),te=y(te,Q,U,W,J,14,d[18]),W=y(W,te,Q,U,V,20,d[19]),U=y(U,W,te,Q,O,5,d[20]),Q=y(Q,U,W,te,H,9,d[21]),te=y(te,Q,U,W,ee,14,d[22]),W=y(W,te,Q,U,B,20,d[23]),U=y(U,W,te,Q,se,5,d[24]),Q=y(Q,U,W,te,re,9,d[25]),te=y(te,Q,U,W,I,14,d[26]),W=y(W,te,Q,U,M,20,d[27]),U=y(U,W,te,Q,K,5,d[28]),Q=y(Q,U,W,te,D,9,d[29]),te=y(te,Q,U,W,L,14,d[30]),W=y(W,te,Q,U,le,20,d[31]),U=x(U,W,te,Q,O,4,d[32]),Q=x(Q,U,W,te,M,11,d[33]),te=x(te,Q,U,W,J,16,d[34]),W=x(W,te,Q,U,re,23,d[35]),U=x(U,W,te,Q,$,4,d[36]),Q=x(Q,U,W,te,B,11,d[37]),te=x(te,Q,U,W,L,16,d[38]),W=x(W,te,Q,U,H,23,d[39]),U=x(U,W,te,Q,K,4,d[40]),Q=x(Q,U,W,te,V,11,d[41]),te=x(te,Q,U,W,I,16,d[42]),W=x(W,te,Q,U,F,23,d[43]),U=x(U,W,te,Q,se,4,d[44]),Q=x(Q,U,W,te,le,11,d[45]),te=x(te,Q,U,W,ee,16,d[46]),W=x(W,te,Q,U,D,23,d[47]),U=b(U,W,te,Q,V,6,d[48]),Q=b(Q,U,W,te,L,10,d[49]),te=b(te,Q,U,W,re,15,d[50]),W=b(W,te,Q,U,O,21,d[51]),U=b(U,W,te,Q,le,6,d[52]),Q=b(Q,U,W,te,I,10,d[53]),te=b(te,Q,U,W,H,15,d[54]),W=b(W,te,Q,U,$,21,d[55]),U=b(U,W,te,Q,M,6,d[56]),Q=b(Q,U,W,te,ee,10,d[57]),te=b(te,Q,U,W,F,15,d[58]),W=b(W,te,Q,U,K,21,d[59]),U=b(U,W,te,Q,B,6,d[60]),Q=b(Q,U,W,te,J,10,d[61]),te=b(te,Q,U,W,D,15,d[62]),W=b(W,te,Q,U,se,21,d[63]),N[0]=N[0]+U|0,N[1]=N[1]+W|0,N[2]=N[2]+te|0,N[3]=N[3]+Q|0},_doFinalize:function(){var E=this._data,w=E.words,R=this._nDataBytes*8,C=E.sigBytes*8;w[C>>>5]|=128<<24-C%32;var k=r.floor(R/4294967296),N=R;w[(C+64>>>9<<4)+15]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360,w[(C+64>>>9<<4)+14]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,E.sigBytes=(w.length+1)*4,this._process();for(var V=this._hash,$=V.words,D=0;D<4;D++){var I=$[D];$[D]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360}return V},clone:function(){var E=c.clone.call(this);return E._hash=this._hash.clone(),E}});function g(E,w,R,C,k,N,V){var $=E+(w&R|~w&C)+k+V;return($<<N|$>>>32-N)+w}function y(E,w,R,C,k,N,V){var $=E+(w&C|R&~C)+k+V;return($<<N|$>>>32-N)+w}function x(E,w,R,C,k,N,V){var $=E+(w^R^C)+k+V;return($<<N|$>>>32-N)+w}function b(E,w,R,C,k,N,V){var $=E+(R^(w|~C))+k+V;return($<<N|$>>>32-N)+w}s.MD5=c._createHelper(f),s.HmacMD5=c._createHmacHelper(f)})(Math),n.MD5})})(ep)),ep.exports}var tp={exports:{}},h7=tp.exports,cT;function wP(){return cT||(cT=1,(function(t,e){(function(n,r){t.exports=r(ot())})(h7,function(n){return(function(){var r=n,s=r.lib,i=s.WordArray,a=s.Hasher,c=r.algo,u=[],d=c.SHA1=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(f,g){for(var y=this._hash.words,x=y[0],b=y[1],E=y[2],w=y[3],R=y[4],C=0;C<80;C++){if(C<16)u[C]=f[g+C]|0;else{var k=u[C-3]^u[C-8]^u[C-14]^u[C-16];u[C]=k<<1|k>>>31}var N=(x<<5|x>>>27)+R+u[C];C<20?N+=(b&E|~b&w)+1518500249:C<40?N+=(b^E^w)+1859775393:C<60?N+=(b&E|b&w|E&w)-1894007588:N+=(b^E^w)-899497514,R=w,w=E,E=b<<30|b>>>2,b=x,x=N}y[0]=y[0]+x|0,y[1]=y[1]+b|0,y[2]=y[2]+E|0,y[3]=y[3]+w|0,y[4]=y[4]+R|0},_doFinalize:function(){var f=this._data,g=f.words,y=this._nDataBytes*8,x=f.sigBytes*8;return g[x>>>5]|=128<<24-x%32,g[(x+64>>>9<<4)+14]=Math.floor(y/4294967296),g[(x+64>>>9<<4)+15]=y,f.sigBytes=g.length*4,this._process(),this._hash},clone:function(){var f=a.clone.call(this);return f._hash=this._hash.clone(),f}});r.SHA1=a._createHelper(d),r.HmacSHA1=a._createHmacHelper(d)})(),n.SHA1})})(tp)),tp.exports}
3953var np={exports:{}},f7=np.exports,uT;function Tx(){return uT||(uT=1,(function(t,e){(function(n,r){t.exports=r(ot())})(f7,function(n){return(function(r){var s=n,i=s.lib,a=i.WordArray,c=i.Hasher,u=s.algo,d=[],f=[];(function(){function x(R){for(var C=r.sqrt(R),k=2;k<=C;k++)if(!(R%k))return!1;return!0}function b(R){return(R-(R|0))*4294967296|0}for(var E=2,w=0;w<64;)x(E)&&(w<8&&(d[w]=b(r.pow(E,1/2))),f[w]=b(r.pow(E,1/3)),w++),E++})();var g=[],y=u.SHA256=c.extend({_doReset:function(){this._hash=new a.init(d.slice(0))},_doProcessBlock:function(x,b){for(var E=this._hash.words,w=E[0],R=E[1],C=E[2],k=E[3],N=E[4],V=E[5],$=E[6],D=E[7],I=0;I<64;I++){if(I<16)g[I]=x[b+I]|0;else{var B=g[I-15],O=(B<<25|B>>>7)^(B<<14|B>>>18)^B>>>3,F=g[I-2],L=(F<<15|F>>>17)^(F<<13|F>>>19)^F>>>10;g[I]=O+g[I-7]+L+g[I-16]}var M=N&V^~N&$,se=w&R^w&C^R&C,H=(w<<30|w>>>2)^(w<<19|w>>>13)^(w<<10|w>>>22),J=(N<<26|N>>>6)^(N<<21|N>>>11)^(N<<7|N>>>25),le=D+J+M+f[I]+g[I],K=H+se;D=$,$=V,V=N,N=k+le|0,k=C,C=R,R=w,w=le+K|0}E[0]=E[0]+w|0,E[1]=E[1]+R|0,E[2]=E[2]+C|0,E[3]=E[3]+k|0,E[4]=E[4]+N|0,E[5]=E[5]+V|0,E[6]=E[6]+$|0,E[7]=E[7]+D|0},_doFinalize:function(){var x=this._data,b=x.words,E=this._nDataBytes*8,w=x.sigBytes*8;return b[w>>>5]|=128<<24-w%32,b[(w+64>>>9<<4)+14]=r.floor(E/4294967296),b[(w+64>>>9<<4)+15]=E,x.sigBytes=b.length*4,this._process(),this._hash},clone:function(){var x=c.clone.call(this);return x._hash=this._hash.clone(),x}});s.SHA256=c._createHelper(y),s.HmacSHA256=c._createHmacHelper(y)})(Math),n.SHA256})})(np)),np.exports}var rp={exports:{}},p7=rp.exports,dT;function m7(){return dT||(dT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Tx())})(p7,function(n){return(function(){var r=n,s=r.lib,i=s.WordArray,a=r.algo,c=a.SHA256,u=a.SHA224=c.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var d=c._doFinalize.call(this);return d.sigBytes-=4,d}});r.SHA224=c._createHelper(u),r.HmacSHA224=c._createHmacHelper(u)})(),n.SHA224})})(rp)),rp.exports}var sp={exports:{}},g7=sp.exports,hT;function EP(){return hT||(hT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Ym())})(g7,function(n){return(function(){var r=n,s=r.lib,i=s.Hasher,a=r.x64,c=a.Word,u=a.WordArray,d=r.algo;function f(){return c.create.apply(c,arguments)}var g=[f(1116352408,3609767458),f(1899447441,602891725),f(3049323471,3964484399),f(3921009573,2173295548),f(961987163,4081628472),f(1508970993,3053834265),f(2453635748,2937671579),f(2870763221,3664609560),f(3624381080,2734883394),f(310598401,1164996542),f(607225278,1323610764),f(1426881987,3590304994),f(1925078388,4068182383),f(2162078206,991336113),f(2614888103,633803317),f(3248222580,3479774868),f(3835390401,2666613458),f(4022224774,944711139),f(264347078,2341262773),f(604807628,2007800933),f(770255983,1495990901),f(1249150122,1856431235),f(1555081692,3175218132),f(1996064986,2198950837),f(2554220882,3999719339),f(2821834349,766784016),f(2952996808,2566594879),f(3210313671,3203337956),f(3336571891,1034457026),f(3584528711,2466948901),f(113926993,3758326383),f(338241895,168717936),f(666307205,1188179964),f(773529912,1546045734),f(1294757372,1522805485),f(1396182291,2643833823),f(1695183700,2343527390),f(1986661051,1014477480),f(2177026350,1206759142),f(2456956037,344077627),f(2730485921,1290863460),f(2820302411,3158454273),f(3259730800,3505952657),f(3345764771,106217008),f(3516065817,3606008344),f(3600352804,1432725776),f(4094571909,1467031594),f(275423344,851169720),f(430227734,3100823752),f(506948616,1363258195),f(659060556,3750685593),f(883997877,3785050280),f(958139571,3318307427),f(1322822218,3812723403),f(1537002063,2003034995),f(1747873779,3602036899),f(1955562222,1575990012),f(2024104815,1125592928),f(2227730452,2716904306),f(2361852424,442776044),f(2428436474,593698344),f(2756734187,3733110249),f(3204031479,2999351573),f(3329325298,3815920427),f(3391569614,3928383900),f(3515267271,566280711),f(3940187606,3454069534),f(4118630271,4000239992),f(116418474,1914138554),f(174292421,2731055270),f(289380356,3203993006),f(460393269,320620315),f(685471733,587496836),f(852142971,1086792851),f(1017036298,365543100),f(1126000580,2618297676),f(1288033470,3409855158),f(1501505948,4234509866),f(1607167915,987167468),f(1816402316,1246189591)],y=[];(function(){for(var b=0;b<80;b++)y[b]=f()})();var x=d.SHA512=i.extend({_doReset:function(){this._hash=new u.init([new c.init(1779033703,4089235720),new c.init(3144134277,2227873595),new c.init(1013904242,4271175723),new c.init(2773480762,1595750129),new c.init(1359893119,2917565137),new c.init(2600822924,725511199),new c.init(528734635,4215389547),new c.init(1541459225,327033209)])},_doProcessBlock:function(b,E){for(var w=this._hash.words,R=w[0],C=w[1],k=w[2],N=w[3],V=w[4],$=w[5],D=w[6],I=w[7],B=R.high,O=R.low,F=C.high,L=C.low,M=k.high,se=k.low,H=N.high,J=N.low,le=V.high,K=V.low,re=$.high,ee=$.low,U=D.high,W=D.low,te=I.high,Q=I.low,pe=B,xe=O,Oe=F,ve=L,Me=M,dt=se,ht=H,Nn=J,St=le,$t=K,tn=re,yr=ee,vr=U,Dr=W,kt=te,vt=Q,Nt=0;Nt<80;Nt++){var Yt,An,On=y[Nt];
3953if(Nt<16)An=On.high=b[E+Nt*2]|0,Yt=On.low=b[E+Nt*2+1]|0;else{var mn=y[Nt-15],ur=mn.high,_r=mn.low,es=(ur>>>1|_r<<31)^(ur>>>8|_r<<24)^ur>>>7,hi=(_r>>>1|ur<<31)^(_r>>>8|ur<<24)^(_r>>>7|ur<<25),Nr=y[Nt-2],Ln=Nr.high,ts=Nr.low,Or=(Ln>>>19|ts<<13)^(Ln<<3|ts>>>29)^Ln>>>6,ge=(ts>>>19|Ln<<13)^(ts<<3|Ln>>>29)^(ts>>>6|Ln<<26),ae=y[Nt-7],Ne=ae.high,Ee=ae.low,ke=y[Nt-16],Ve=ke.high,We=ke.low;Yt=hi+Ee,An=es+Ne+(Yt>>>0<hi>>>0?1:0),Yt=Yt+ge,An=An+Or+(Yt>>>0<ge>>>0?1:0),Yt=Yt+We,An=An+Ve+(Yt>>>0<We>>>0?1:0),On.high=An,On.low=Yt}var wt=St&tn^~St&vr,Xe=$t&yr^~$t&Dr,It=pe&Oe^pe&Me^Oe&Me,bt=xe&ve^xe&dt^ve&dt,tt=(pe>>>28|xe<<4)^(pe<<30|xe>>>2)^(pe<<25|xe>>>7),xr=(xe>>>28|pe<<4)^(xe<<30|pe>>>2)^(xe<<25|pe>>>7),Lr=(St>>>14|$t<<18)^(St>>>18|$t<<14)^(St<<23|$t>>>9),Fn=($t>>>14|St<<18)^($t>>>18|St<<14)^($t<<23|St>>>9),gn=g[Nt],yn=gn.high,jn=gn.low,At=vt+Fn,Yn=kt+Lr+(At>>>0<vt>>>0?1:0),At=At+Xe,Yn=Yn+wt+(At>>>0<Xe>>>0?1:0),At=At+jn,Yn=Yn+yn+(At>>>0<jn>>>0?1:0),At=At+Yt,Yn=Yn+An+(At>>>0<Yt>>>0?1:0),Tt=xr+bt,gt=tt+It+(Tt>>>0<xr>>>0?1:0);kt=vr,vt=Dr,vr=tn,Dr=yr,tn=St,yr=$t,$t=Nn+At|0,St=ht+Yn+($t>>>0<Nn>>>0?1:0)|0,ht=Me,Nn=dt,Me=Oe,dt=ve,Oe=pe,ve=xe,xe=At+Tt|0,pe=Yn+gt+(xe>>>0<At>>>0?1:0)|0}O=R.low=O+xe,R.high=B+pe+(O>>>0<xe>>>0?1:0),L=C.low=L+ve,C.high=F+Oe+(L>>>0<ve>>>0?1:0),se=k.low=se+dt,k.high=M+Me+(se>>>0<dt>>>0?1:0),J=N.low=J+Nn,N.high=H+ht+(J>>>0<Nn>>>0?1:0),K=V.low=K+$t,V.high=le+St+(K>>>0<$t>>>0?1:0),ee=$.low=ee+yr,$.high=re+tn+(ee>>>0<yr>>>0?1:0),W=D.low=W+Dr,D.high=U+vr+(W>>>0<Dr>>>0?1:0),Q=I.low=Q+vt,I.high=te+kt+(Q>>>0<vt>>>0?1:0)},_doFinalize:function(){var b=this._data,E=b.words,w=this._nDataBytes*8,R=b.sigBytes*8;E[R>>>5]|=128<<24-R%32,E[(R+128>>>10<<5)+30]=Math.floor(w/4294967296),E[(R+128>>>10<<5)+31]=w,b.sigBytes=E.length*4,this._process();var C=this._hash.toX32();return C},clone:function(){var b=i.clone.call(this);return b._hash=this._hash.clone(),b},blockSize:1024/32});r.SHA512=i._createHelper(x),r.HmacSHA512=i._createHmacHelper(x)})(),n.SHA512})})(sp)),sp.exports}var ip={exports:{}},y7=ip.exports,fT;function v7(){return fT||(fT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Ym(),EP())})(y7,function(n){return(function(){var r=n,s=r.x64,i=s.Word,a=s.WordArray,c=r.algo,u=c.SHA512,d=c.SHA384=u.extend({_doReset:function(){this._hash=new a.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var f=u._doFinalize.call(this);return f.sigBytes-=16,f}});r.SHA384=u._createHelper(d),r.HmacSHA384=u._createHmacHelper(d)})(),n.SHA384})})(ip)),ip.exports}var op={exports:{}},_7=op.exports,pT;function x7(){return pT||(pT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Ym())})(_7,function(n){return(function(r){var s=n,i=s.lib,a=i.WordArray,c=i.Hasher,u=s.x64,d=u.Word,f=s.algo,g=[],y=[],x=[];(function(){for(var w=1,R=0,C=0;C<24;C++){g[w+5*R]=(C+1)*(C+2)/2%64;var k=R%5,N=(2*w+3*R)%5;w=k,R=N}for(var w=0;w<5;w++)for(var R=0;R<5;R++)y[w+5*R]=R+(2*w+3*R)%5*5;for(var V=1,$=0;$<24;$++){for(var D=0,I=0,B=0;B<7;B++){if(V&1){var O=(1<<B)-1;O<32?I^=1<<O:D^=1<<O-32}V&128?V=V<<1^113:V<<=1}x[$]=d.create(D,I)}})();var b=[];(function(){for(var w=0;w<25;w++)b[w]=d.create()})();var E=f.SHA3=c.extend({cfg:c.cfg.extend({outputLength:512}),_doReset:function(){for(var w=this._state=[],R=0;R<25;R++)w[R]=new d.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(w,R){for(var C=this._state,k=this.blockSize/2,N=0;N<k;N++){var V=w[R+2*N],$=w[R+2*N+1];V=(V<<8|V>>>24)&16711935|(V<<24|V>>>8)&4278255360,$=($<<8|$>>>24)&16711935|($<<24|$>>>8)&4278255360;var D=C[N];D.high^=$,D.low^=V}for(var I=0;I<24;I++){for(var B=0;B<5;B++){for(var O=0,F=0,L=0;L<5;L++){var D=C[B+5*L];O^=D.high,F^=D.low}var M=b[B];M.high=O,M.low=F}for(var B=0;B<5;B++)for(var se=b[(B+4)%5],H=b[(B+1)%5],J=H.high,le=H.low,O=se.high^(J<<1|le>>>31),F=se.low^(le<<1|J>>>31),L=0;L<5;L++){var D=C[B+5*L];D.high^=O,D.low^=F}for(var K=1;K<25;K++){var O,F,D=C[K],re=D.high,ee=D.low,U=g[K];U<32?(O=re<<U|ee>>>32-U,F=ee<<U|re>>>32-U):(O=ee<<U-32|re>>>64-U,F=re<<U-32|ee>>>64-U);var W=b[y[K]];W.high=O,W.low=F}var te=b[0],Q=C[0];te.high=Q.high,te.low=Q.low;for(var B=0;B<5;B++)for(var L=0;L<5;L++){var K=B+5*L,D=C[K],pe=b[K],xe=b[(B+1)%5+5*L],Oe=b[(B+2)%5+5*L];D.high=pe.high^~xe.high&Oe.high,D.low=pe.low^~xe.low&Oe.low}
3953var D=C[0],ve=x[I];D.high^=ve.high,D.low^=ve.low}},_doFinalize:function(){var w=this._data,R=w.words;this._nDataBytes*8;var C=w.sigBytes*8,k=this.blockSize*32;R[C>>>5]|=1<<24-C%32,R[(r.ceil((C+1)/k)*k>>>5)-1]|=128,w.sigBytes=R.length*4,this._process();for(var N=this._state,V=this.cfg.outputLength/8,$=V/8,D=[],I=0;I<$;I++){var B=N[I],O=B.high,F=B.low;O=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,F=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,D.push(F),D.push(O)}return new a.init(D,V)},clone:function(){for(var w=c.clone.call(this),R=w._state=this._state.slice(0),C=0;C<25;C++)R[C]=R[C].clone();return w}});s.SHA3=c._createHelper(E),s.HmacSHA3=c._createHmacHelper(E)})(Math),n.SHA3})})(op)),op.exports}var ap={exports:{}},w7=ap.exports,mT;function E7(){return mT||(mT=1,(function(t,e){(function(n,r){t.exports=r(ot())})(w7,function(n){/** @preserve
3954			(c) 2012 by Cédric Mesnil. All rights reserved.
3955
3956			Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3957
3958			    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
3959			    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3960
3961			THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3962			*/return(function(r){var s=n,i=s.lib,a=i.WordArray,c=i.Hasher,u=s.algo,d=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),f=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),g=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),y=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),x=a.create([0,1518500249,1859775393,2400959708,2840853838]),b=a.create([1352829926,1548603684,1836072691,2053994217,0]),E=u.RIPEMD160=c.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function($,D){for(var I=0;I<16;I++){var B=D+I,O=$[B];$[B]=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360}var F=this._hash.words,L=x.words,M=b.words,se=d.words,H=f.words,J=g.words,le=y.words,K,re,ee,U,W,te,Q,pe,xe,Oe;te=K=F[0],Q=re=F[1],pe=ee=F[2],xe=U=F[3],Oe=W=F[4];for(var ve,I=0;I<80;I+=1)ve=K+$[D+se[I]]|0,I<16?ve+=w(re,ee,U)+L[0]:I<32?ve+=R(re,ee,U)+L[1]:I<48?ve+=C(re,ee,U)+L[2]:I<64?ve+=k(re,ee,U)+L[3]:ve+=N(re,ee,U)+L[4],ve=ve|0,ve=V(ve,J[I]),ve=ve+W|0,K=W,W=U,U=V(ee,10),ee=re,re=ve,ve=te+$[D+H[I]]|0,I<16?ve+=N(Q,pe,xe)+M[0]:I<32?ve+=k(Q,pe,xe)+M[1]:I<48?ve+=C(Q,pe,xe)+M[2]:I<64?ve+=R(Q,pe,xe)+M[3]:ve+=w(Q,pe,xe)+M[4],ve=ve|0,ve=V(ve,le[I]),ve=ve+Oe|0,te=Oe,Oe=xe,xe=V(pe,10),pe=Q,Q=ve;ve=F[1]+ee+xe|0,F[1]=F[2]+U+Oe|0,F[2]=F[3]+W+te|0,F[3]=F[4]+K+Q|0,F[4]=F[0]+re+pe|0,F[0]=ve},_doFinalize:function(){var $=this._data,D=$.words,I=this._nDataBytes*8,B=$.sigBytes*8;D[B>>>5]|=128<<24-B%32,D[(B+64>>>9<<4)+14]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,$.sigBytes=(D.length+1)*4,this._process();for(var O=this._hash,F=O.words,L=0;L<5;L++){var M=F[L];F[L]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return O},clone:function(){var $=c.clone.call(this);return $._hash=this._hash.clone(),$}});function w($,D,I){return $^D^I}function R($,D,I){return $&D|~$&I}function C($,D,I){return($|~D)^I}function k($,D,I){return $&I|D&~I}function N($,D,I){return $^(D|~I)}function V($,D){return $<<D|$>>>32-D}s.RIPEMD160=c._createHelper(E),s.HmacRIPEMD160=c._createHmacHelper(E)})(),n.RIPEMD160})})(ap)),ap.exports}var lp={exports:{}},b7=lp.exports,gT;function Cx(){return gT||(gT=1,(function(t,e){(function(n,r){t.exports=r(ot())})(b7,function(n){(function(){var r=n,s=r.lib,i=s.Base,a=r.enc,c=a.Utf8,u=r.algo;u.HMAC=i.extend({init:function(d,f){d=this._hasher=new d.init,typeof f=="string"&&(f=c.parse(f));var g=d.blockSize,y=g*4;f.sigBytes>y&&(f=d.finalize(f)),f.clamp();for(var x=this._oKey=f.clone(),b=this._iKey=f.clone(),E=x.words,w=b.words,R=0;R<g;R++)E[R]^=1549556828,w[R]^=909522486;x.sigBytes=b.sigBytes=y,this.reset()},reset:function(){var d=this._hasher;d.reset(),d.update(this._iKey)},update:function(d){return this._hasher.update(d),this},finalize:function(d){var f=this._hasher,g=f.finalize(d);f.reset();var y=f.finalize(this._oKey.clone().concat(g));return y}})})()})})(lp)),lp.exports}var cp={exports:{}},A7=cp.exports,yT;function T7(){return yT||(yT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Tx(),Cx())})(A7,function(n){return(function(){var r=n,s=r.lib,i=s.Base,a=s.WordArray,c=r.algo,u=c.SHA256,d=c.HMAC,f=c.PBKDF2=i.extend({cfg:i.extend({keySize:128/32,hasher:u,iterations:25e4}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,y){for(var x=this.cfg,b=d.create(x.hasher,g),E=a.create(),w=a.create([1]),R=E.words,C=w.words,k=x.keySize,N=x.iterations;R.length<k;){var V=b.update(y).finalize(w);b.reset();for(var $=V.words,D=$.length,I=V,B=1;B<N;B++){I=b.finalize(I),b.reset();for(var O=I.words,F=0;F<D;F++)$[F]^=O[F]}E.concat(V),C[0]++}return E.sigBytes=k*4,E}});r.PBKDF2=function(g,y,x){return f.create(x).compute(g,y)}})(),n.PBKDF2})})(cp)),cp.exports}var up={exports:{}},C7=up.exports,vT;function Yo(){return vT||(vT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),wP(),Cx())})(C7,function(n){return(function(){var r=n,s=r.lib,i=s.Base,a=s.WordArray,c=r.algo,u=c.MD5,d=c.EvpKDF=i.extend({cfg:i.extend({keySize:128/32,hasher:u,iterations:1}),init:function(f){this.cfg=this.cfg.extend(f)},compute:function(f,g){for(var y,x=this.cfg,b=x.hasher.create(),E=a.create(),w=E.words,R=x.keySize,C=x.iterations;w.length<R;){y&&b.update(y),y=b.update(f).finalize(g),b.reset();for(var k=1;k<C;k++)y=b.finalize(y),b.reset();E.concat(y)}return E.sigBytes=R*4,E}});r.EvpKDF=function(f,g,y){return d.create(y).compute(f,g)}})(),n.EvpKDF})})(up)),up.exports}var dp={exports:{}},S7=dp.exports,_T;function Dn(){return _T||(_T=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Yo())})(S7,function(n){n.lib.Cipher||(function(r){var s=n,i=s.lib,a=i.Base,c=i.WordArray,u=i.BufferedBlockAlgorithm,d=s.enc;d.Utf8;var f=d.Base64,g=s.algo,y=g.EvpKDF,x=i.Cipher=u.extend({cfg:a.extend(),createEncryptor:function(O,F){return this.create(this._ENC_XFORM_MODE,O,F)},createDecryptor:function(O,F){return this.create(this._DEC_XFORM_MODE,O,F)},init:function(O,F,L){this.cfg=this.cfg.extend(L),this._xformMode=O,this._key=
3962F,this.reset()},reset:function(){u.reset.call(this),this._doReset()},process:function(O){return this._append(O),this._process()},finalize:function(O){O&&this._append(O);var F=this._doFinalize();return F},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:(function(){function O(F){return typeof F=="string"?B:$}return function(F){return{encrypt:function(L,M,se){return O(M).encrypt(F,L,M,se)},decrypt:function(L,M,se){return O(M).decrypt(F,L,M,se)}}}})()});i.StreamCipher=x.extend({_doFinalize:function(){var O=this._process(!0);return O},blockSize:1});var b=s.mode={},E=i.BlockCipherMode=a.extend({createEncryptor:function(O,F){return this.Encryptor.create(O,F)},createDecryptor:function(O,F){return this.Decryptor.create(O,F)},init:function(O,F){this._cipher=O,this._iv=F}}),w=b.CBC=(function(){var O=E.extend();O.Encryptor=O.extend({processBlock:function(L,M){var se=this._cipher,H=se.blockSize;F.call(this,L,M,H),se.encryptBlock(L,M),this._prevBlock=L.slice(M,M+H)}}),O.Decryptor=O.extend({processBlock:function(L,M){var se=this._cipher,H=se.blockSize,J=L.slice(M,M+H);se.decryptBlock(L,M),F.call(this,L,M,H),this._prevBlock=J}});function F(L,M,se){var H,J=this._iv;J?(H=J,this._iv=r):H=this._prevBlock;for(var le=0;le<se;le++)L[M+le]^=H[le]}return O})(),R=s.pad={},C=R.Pkcs7={pad:function(O,F){for(var L=F*4,M=L-O.sigBytes%L,se=M<<24|M<<16|M<<8|M,H=[],J=0;J<M;J+=4)H.push(se);var le=c.create(H,M);O.concat(le)},unpad:function(O){var F=O.words[O.sigBytes-1>>>2]&255;O.sigBytes-=F}};i.BlockCipher=x.extend({cfg:x.cfg.extend({mode:w,padding:C}),reset:function(){var O;x.reset.call(this);var F=this.cfg,L=F.iv,M=F.mode;this._xformMode==this._ENC_XFORM_MODE?O=M.createEncryptor:(O=M.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==O?this._mode.init(this,L&&L.words):(this._mode=O.call(M,this,L&&L.words),this._mode.__creator=O)},_doProcessBlock:function(O,F){this._mode.processBlock(O,F)},_doFinalize:function(){var O,F=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(F.pad(this._data,this.blockSize),O=this._process(!0)):(O=this._process(!0),F.unpad(O)),O},blockSize:128/32});var k=i.CipherParams=a.extend({init:function(O){this.mixIn(O)},toString:function(O){return(O||this.formatter).stringify(this)}}),N=s.format={},V=N.OpenSSL={stringify:function(O){var F,L=O.ciphertext,M=O.salt;return M?F=c.create([1398893684,1701076831]).concat(M).concat(L):F=L,F.toString(f)},parse:function(O){var F,L=f.parse(O),M=L.words;return M[0]==1398893684&&M[1]==1701076831&&(F=c.create(M.slice(2,4)),M.splice(0,4),L.sigBytes-=16),k.create({ciphertext:L,salt:F})}},$=i.SerializableCipher=a.extend({cfg:a.extend({format:V}),encrypt:function(O,F,L,M){M=this.cfg.extend(M);var se=O.createEncryptor(L,M),H=se.finalize(F),J=se.cfg;return k.create({ciphertext:H,key:L,iv:J.iv,algorithm:O,mode:J.mode,padding:J.padding,blockSize:O.blockSize,formatter:M.format})},decrypt:function(O,F,L,M){M=this.cfg.extend(M),F=this._parse(F,M.format);var se=O.createDecryptor(L,M).finalize(F.ciphertext);return se},_parse:function(O,F){return typeof O=="string"?F.parse(O,this):O}}),D=s.kdf={},I=D.OpenSSL={execute:function(O,F,L,M,se){if(M||(M=c.random(64/8)),se)var H=y.create({keySize:F+L,hasher:se}).compute(O,M);else var H=y.create({keySize:F+L}).compute(O,M);var J=c.create(H.words.slice(F),L*4);return H.sigBytes=F*4,k.create({key:H,iv:J,salt:M})}},B=i.PasswordBasedCipher=$.extend({cfg:$.cfg.extend({kdf:I}),encrypt:function(O,F,L,M){M=this.cfg.extend(M);var se=M.kdf.execute(L,O.keySize,O.ivSize,M.salt,M.hasher);M.iv=se.iv;var H=$.encrypt.call(this,O,F,se.key,M);return H.mixIn(se),H},decrypt:function(O,F,L,M){M=this.cfg.extend(M),F=this._parse(F,M.format);var se=M.kdf.execute(L,O.keySize,O.ivSize,F.salt,M.hasher);M.iv=se.iv;var H=$.decrypt.call(this,O,F,se.key,M);return H}})})()})})(dp)),dp.exports}var hp={exports:{}},k7=hp.exports,xT;function I7(){return xT||(xT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Dn())})(k7,function(n){return n.mode.CFB=(function(){var r=n.lib.BlockCipherMode.extend();r.Encryptor=r.extend({processBlock:function(i,a){var c=this._cipher,u=c.blockSize;s.call(this,i,a,u,c),this._prevBlock=i.slice(a,a+u)}}),r.Decryptor=r.extend({processBlock:function(i,a){var c=this._cipher,u=c.blockSize,d=i.slice(a,a+u);s.call(this,i,a,u,c),this._prevBlock=d}});function s(i,a,c,u){var d,f=this._iv;f?(d=f.slice(0),this._iv=void 0):d=this._prevBlock,u.encryptBlock(d,0);for(var g=0;g<c;g++)i[a+g]^=d[g]}return r})(),n.mode.CFB})})(hp)),hp.exports}var fp={exports:{}},P7=fp.exports,wT;function R7(){return wT||(wT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Dn())})(P7,function(n){return n.mode.CTR=(function(){var r=n.lib.BlockCipherMode.extend(),s=r.Encryptor=r.extend({processBlock:function(i,a){var c=this._cipher,u=c.blockSize,d=this._iv,f=this._counter;d&&(f=this._counter=d.slice(0),this._iv=void 0);var g=f.slice(0);c.encryptBlock(g,0),f[u-1]=f[u-1]+1|0;for(var y=0;y<u;
3962y++)i[a+y]^=g[y]}});return r.Decryptor=s,r})(),n.mode.CTR})})(fp)),fp.exports}var pp={exports:{}},D7=pp.exports,ET;function N7(){return ET||(ET=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Dn())})(D7,function(n){/** @preserve
3963 * Counter block mode compatible with  Dr Brian Gladman fileenc.c
3964 * derived from CryptoJS.mode.CTR
3965 * Jan Hruby [email protected]
3966 */return n.mode.CTRGladman=(function(){var r=n.lib.BlockCipherMode.extend();function s(c){if((c>>24&255)===255){var u=c>>16&255,d=c>>8&255,f=c&255;u===255?(u=0,d===255?(d=0,f===255?f=0:++f):++d):++u,c=0,c+=u<<16,c+=d<<8,c+=f}else c+=1<<24;return c}function i(c){return(c[0]=s(c[0]))===0&&(c[1]=s(c[1])),c}var a=r.Encryptor=r.extend({processBlock:function(c,u){var d=this._cipher,f=d.blockSize,g=this._iv,y=this._counter;g&&(y=this._counter=g.slice(0),this._iv=void 0),i(y);var x=y.slice(0);d.encryptBlock(x,0);for(var b=0;b<f;b++)c[u+b]^=x[b]}});return r.Decryptor=a,r})(),n.mode.CTRGladman})})(pp)),pp.exports}var mp={exports:{}},O7=mp.exports,bT;function L7(){return bT||(bT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Dn())})(O7,function(n){return n.mode.OFB=(function(){var r=n.lib.BlockCipherMode.extend(),s=r.Encryptor=r.extend({processBlock:function(i,a){var c=this._cipher,u=c.blockSize,d=this._iv,f=this._keystream;d&&(f=this._keystream=d.slice(0),this._iv=void 0),c.encryptBlock(f,0);for(var g=0;g<u;g++)i[a+g]^=f[g]}});return r.Decryptor=s,r})(),n.mode.OFB})})(mp)),mp.exports}var gp={exports:{}},F7=gp.exports,AT;function j7(){return AT||(AT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Dn())})(F7,function(n){return n.mode.ECB=(function(){var r=n.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(s,i){this._cipher.encryptBlock(s,i)}}),r.Decryptor=r.extend({processBlock:function(s,i){this._cipher.decryptBlock(s,i)}}),r})(),n.mode.ECB})})(gp)),gp.exports}var yp={exports:{}},M7=yp.exports,TT;function B7(){return TT||(TT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Dn())})(M7,function(n){return n.pad.AnsiX923={pad:function(r,s){var i=r.sigBytes,a=s*4,c=a-i%a,u=i+c-1;r.clamp(),r.words[u>>>2]|=c<<24-u%4*8,r.sigBytes+=c},unpad:function(r){var s=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=s}},n.pad.Ansix923})})(yp)),yp.exports}var vp={exports:{}},V7=vp.exports,CT;function U7(){return CT||(CT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Dn())})(V7,function(n){return n.pad.Iso10126={pad:function(r,s){var i=s*4,a=i-r.sigBytes%i;r.concat(n.lib.WordArray.random(a-1)).concat(n.lib.WordArray.create([a<<24],1))},unpad:function(r){var s=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=s}},n.pad.Iso10126})})(vp)),vp.exports}var _p={exports:{}},$7=_p.exports,ST;function z7(){return ST||(ST=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Dn())})($7,function(n){return n.pad.Iso97971={pad:function(r,s){r.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(r,s)},unpad:function(r){n.pad.ZeroPadding.unpad(r),r.sigBytes--}},n.pad.Iso97971})})(_p)),_p.exports}var xp={exports:{}},H7=xp.exports,kT;function q7(){return kT||(kT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Dn())})(H7,function(n){return n.pad.ZeroPadding={pad:function(r,s){var i=s*4;r.clamp(),r.sigBytes+=i-(r.sigBytes%i||i)},unpad:function(r){for(var s=r.words,i=r.sigBytes-1,i=r.sigBytes-1;i>=0;i--)if(s[i>>>2]>>>24-i%4*8&255){r.sigBytes=i+1;break}}},n.pad.ZeroPadding})})(xp)),xp.exports}var wp={exports:{}},W7=wp.exports,IT;function G7(){return IT||(IT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Dn())})(W7,function(n){return n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding})})(wp)),wp.exports}var Ep={exports:{}},K7=Ep.exports,PT;function Y7(){return PT||(PT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Dn())})(K7,function(n){return(function(r){var s=n,i=s.lib,a=i.CipherParams,c=s.enc,u=c.Hex,d=s.format;d.Hex={stringify:function(f){return f.ciphertext.toString(u)},parse:function(f){var g=u.parse(f);return a.create({ciphertext:g})}}})(),n.format.Hex})})(Ep)),Ep.exports}var bp={exports:{}},Q7=bp.exports,RT;function J7(){return RT||(RT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Xa(),Za(),Yo(),Dn())})(Q7,function(n){return(function(){var r=n,s=r.lib,i=s.BlockCipher,a=r.algo,c=[],u=[],d=[],f=[],g=[],y=[],x=[],b=[],E=[],w=[];(function(){for(var k=[],N=0;N<256;N++)N<128?k[N]=N<<1:k[N]=N<<1^283;for(var V=0,$=0,N=0;N<256;N++){var D=$^$<<1^$<<2^$<<3^$<<4;D=D>>>8^D&255^99,c[V]=D,u[D]=V;var I=k[V],B=k[I],O=k[B],F=k[D]*257^D*16843008;d[V]=F<<24|F>>>8,f[V]=F<<16|F>>>16,g[V]=F<<8|F>>>24,y[V]=F;var F=O*16843009^B*65537^I*257^V*16843008;x[D]=F<<24|F>>>8,b[D]=F<<16|F>>>16,E[D]=F<<8|F>>>24,w[D]=F,V?(V=I^k[k[k[O^I]]],$^=k[k[$]]):V=$=1}})();var R=[0,1,2,4,8,16,32,64,128,27,54],C=a.AES=i.extend({_doReset:function(){var k;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var N=this._keyPriorReset=this._key,V=N.words,$=N.sigBytes/4,D=this._nRounds=$+6,I=(D+1)*4,B=this._keySchedule=[],O=0;O<I;O++)O<$?B[O]=V[O]:(k=B[O-1],O%$?$>
39666&&O%$==4&&(k=c[k>>>24]<<24|c[k>>>16&255]<<16|c[k>>>8&255]<<8|c[k&255]):(k=k<<8|k>>>24,k=c[k>>>24]<<24|c[k>>>16&255]<<16|c[k>>>8&255]<<8|c[k&255],k^=R[O/$|0]<<24),B[O]=B[O-$]^k);for(var F=this._invKeySchedule=[],L=0;L<I;L++){var O=I-L;if(L%4)var k=B[O];else var k=B[O-4];L<4||O<=4?F[L]=k:F[L]=x[c[k>>>24]]^b[c[k>>>16&255]]^E[c[k>>>8&255]]^w[c[k&255]]}}},encryptBlock:function(k,N){this._doCryptBlock(k,N,this._keySchedule,d,f,g,y,c)},decryptBlock:function(k,N){var V=k[N+1];k[N+1]=k[N+3],k[N+3]=V,this._doCryptBlock(k,N,this._invKeySchedule,x,b,E,w,u);var V=k[N+1];k[N+1]=k[N+3],k[N+3]=V},_doCryptBlock:function(k,N,V,$,D,I,B,O){for(var F=this._nRounds,L=k[N]^V[0],M=k[N+1]^V[1],se=k[N+2]^V[2],H=k[N+3]^V[3],J=4,le=1;le<F;le++){var K=$[L>>>24]^D[M>>>16&255]^I[se>>>8&255]^B[H&255]^V[J++],re=$[M>>>24]^D[se>>>16&255]^I[H>>>8&255]^B[L&255]^V[J++],ee=$[se>>>24]^D[H>>>16&255]^I[L>>>8&255]^B[M&255]^V[J++],U=$[H>>>24]^D[L>>>16&255]^I[M>>>8&255]^B[se&255]^V[J++];L=K,M=re,se=ee,H=U}var K=(O[L>>>24]<<24|O[M>>>16&255]<<16|O[se>>>8&255]<<8|O[H&255])^V[J++],re=(O[M>>>24]<<24|O[se>>>16&255]<<16|O[H>>>8&255]<<8|O[L&255])^V[J++],ee=(O[se>>>24]<<24|O[H>>>16&255]<<16|O[L>>>8&255]<<8|O[M&255])^V[J++],U=(O[H>>>24]<<24|O[L>>>16&255]<<16|O[M>>>8&255]<<8|O[se&255])^V[J++];k[N]=K,k[N+1]=re,k[N+2]=ee,k[N+3]=U},keySize:256/32});r.AES=i._createHelper(C)})(),n.AES})})(bp)),bp.exports}var Ap={exports:{}},X7=Ap.exports,DT;function Z7(){return DT||(DT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Xa(),Za(),Yo(),Dn())})(X7,function(n){return(function(){var r=n,s=r.lib,i=s.WordArray,a=s.BlockCipher,c=r.algo,u=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],d=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],f=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],g
vendor: 7,629 bytes, line 3966
3966=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],
3966y=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],x=c.DES=a.extend({_doReset:function(){for(var R=this._key,C=R.words,k=[],N=0;N<56;N++){var V=u[N]-1;k[N]=C[V>>>5]>>>31-V%32&1}for(var $=this._subKeys=[],D=0;D<16;D++){for(var I=$[D]=[],B=f[D],N=0;N<24;N++)I[N/6|0]|=k[(d[N]-1+B)%28]<<31-N%6,I[4+(N/6|0)]|=k[28+(d[N+24]-1+B)%28]<<31-N%6;I[0]=I[0]<<1|I[0]>>>31;for(var N=1;N<7;N++)I[N]=I[N]>>>(N-1)*4+3;I[7]=I[7]<<5|I[7]>>>27}for(var O=this._invSubKeys=[],N=0;N<16;N++)O[N]=$[15-N]},encryptBlock:function(R,C){this._doCryptBlock(R,C,this._subKeys)},decryptBlock:function(R,C){this._doCryptBlock(R,C,this._invSubKeys)},_doCryptBlock:function(R,C,k){this._lBlock=R[C],this._rBlock=R[C+1],b.call(this,4,252645135),b.call(this,16,65535),E.call(this,2,858993459),E.call(this,8,16711935),b.call(this,1,1431655765);for(var N=0;N<16;N++){for(var V=k[N],$=this._lBlock,D=this._rBlock,I=0,B=0;B<8;B++)I|=g[B][((D^V[B])&y[B])>>>0];this._lBlock=D,this._rBlock=$^I}var O=this._lBlock;this._lBlock=this._rBlock,this._rBlock=O,b.call(this,1,1431655765),E.call(this,8,16711935),E.call(this,2,858993459),b.call(this,16,65535),b.call(this,4,252645135),R[C]=this._lBlock,R[C+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function b(R,C){var k=(this._lBlock>>>R^this._rBlock)&C;this._rBlock^=k,this._lBlock^=k<<R}function E(R,C){var k=(this._rBlock>>>R^this._lBlock)&C;this._lBlock^=k,this._rBlock^=k<<R}r.DES=a._createHelper(x);var w=c.TripleDES=a.extend({_doReset:function(){var R=this._key,C=R.words;if(C.length!==2&&C.length!==4&&C.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var k=C.slice(0,2),N=C.length<4?C.slice(0,2):C.slice(2,4),V=C.length<6?C.slice(0,2):C.slice(4,6);this._des1=x.createEncryptor(i.create(k)),this._des2=x.createEncryptor(i.create(N)),this._des3=x.createEncryptor(i.create(V))},encryptBlock:function(R,C){this._des1.encryptBlock(R,C),this._des2.decryptBlock(R,C),this._des3.encryptBlock(R,C)},decryptBlock:function(R,C){this._des3.decryptBlock(R,C),this._des2.encryptBlock(R,C),this._des1.decryptBlock(R,C)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=a._createHelper(w)})(),n.TripleDES})})(Ap)),Ap.exports}var Tp={exports:{}},e$=Tp.exports,NT;function t$(){return NT||(NT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Xa(),Za(),Yo(),Dn())})(e$,function(n){return(function(){var r=n,s=r.lib,i=s.StreamCipher,a=r.algo,c=a.RC4=i.extend({_doReset:function(){for(var f=this._key,g=f.words,y=f.sigBytes,x=this._S=[],b=0;b<256;b++)x[b]=b;
3966for(var b=0,E=0;b<256;b++){var w=b%y,R=g[w>>>2]>>>24-w%4*8&255;E=(E+x[b]+R)%256;var C=x[b];x[b]=x[E],x[E]=C}this._i=this._j=0},_doProcessBlock:function(f,g){f[g]^=u.call(this)},keySize:256/32,ivSize:0});function u(){for(var f=this._S,g=this._i,y=this._j,x=0,b=0;b<4;b++){g=(g+1)%256,y=(y+f[g])%256;var E=f[g];f[g]=f[y],f[y]=E,x|=f[(f[g]+f[y])%256]<<24-b*8}return this._i=g,this._j=y,x}r.RC4=i._createHelper(c);var d=a.RC4Drop=c.extend({cfg:c.cfg.extend({drop:192}),_doReset:function(){c._doReset.call(this);for(var f=this.cfg.drop;f>0;f--)u.call(this)}});r.RC4Drop=i._createHelper(d)})(),n.RC4})})(Tp)),Tp.exports}var Cp={exports:{}},n$=Cp.exports,OT;function r$(){return OT||(OT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Xa(),Za(),Yo(),Dn())})(n$,function(n){return(function(){var r=n,s=r.lib,i=s.StreamCipher,a=r.algo,c=[],u=[],d=[],f=a.Rabbit=i.extend({_doReset:function(){for(var y=this._key.words,x=this.cfg.iv,b=0;b<4;b++)y[b]=(y[b]<<8|y[b]>>>24)&16711935|(y[b]<<24|y[b]>>>8)&4278255360;var E=this._X=[y[0],y[3]<<16|y[2]>>>16,y[1],y[0]<<16|y[3]>>>16,y[2],y[1]<<16|y[0]>>>16,y[3],y[2]<<16|y[1]>>>16],w=this._C=[y[2]<<16|y[2]>>>16,y[0]&4294901760|y[1]&65535,y[3]<<16|y[3]>>>16,y[1]&4294901760|y[2]&65535,y[0]<<16|y[0]>>>16,y[2]&4294901760|y[3]&65535,y[1]<<16|y[1]>>>16,y[3]&4294901760|y[0]&65535];this._b=0;for(var b=0;b<4;b++)g.call(this);for(var b=0;b<8;b++)w[b]^=E[b+4&7];if(x){var R=x.words,C=R[0],k=R[1],N=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,V=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360,$=N>>>16|V&4294901760,D=V<<16|N&65535;w[0]^=N,w[1]^=$,w[2]^=V,w[3]^=D,w[4]^=N,w[5]^=$,w[6]^=V,w[7]^=D;for(var b=0;b<4;b++)g.call(this)}},_doProcessBlock:function(y,x){var b=this._X;g.call(this),c[0]=b[0]^b[5]>>>16^b[3]<<16,c[1]=b[2]^b[7]>>>16^b[5]<<16,c[2]=b[4]^b[1]>>>16^b[7]<<16,c[3]=b[6]^b[3]>>>16^b[1]<<16;for(var E=0;E<4;E++)c[E]=(c[E]<<8|c[E]>>>24)&16711935|(c[E]<<24|c[E]>>>8)&4278255360,y[x+E]^=c[E]},blockSize:128/32,ivSize:64/32});function g(){for(var y=this._X,x=this._C,b=0;b<8;b++)u[b]=x[b];x[0]=x[0]+1295307597+this._b|0,x[1]=x[1]+3545052371+(x[0]>>>0<u[0]>>>0?1:0)|0,x[2]=x[2]+886263092+(x[1]>>>0<u[1]>>>0?1:0)|0,x[3]=x[3]+1295307597+(x[2]>>>0<u[2]>>>0?1:0)|0,x[4]=x[4]+3545052371+(x[3]>>>0<u[3]>>>0?1:0)|0,x[5]=x[5]+886263092+(x[4]>>>0<u[4]>>>0?1:0)|0,x[6]=x[6]+1295307597+(x[5]>>>0<u[5]>>>0?1:0)|0,x[7]=x[7]+3545052371+(x[6]>>>0<u[6]>>>0?1:0)|0,this._b=x[7]>>>0<u[7]>>>0?1:0;for(var b=0;b<8;b++){var E=y[b]+x[b],w=E&65535,R=E>>>16,C=((w*w>>>17)+w*R>>>15)+R*R,k=((E&4294901760)*E|0)+((E&65535)*E|0);d[b]=C^k}y[0]=d[0]+(d[7]<<16|d[7]>>>16)+(d[6]<<16|d[6]>>>16)|0,y[1]=d[1]+(d[0]<<8|d[0]>>>24)+d[7]|0,y[2]=d[2]+(d[1]<<16|d[1]>>>16)+(d[0]<<16|d[0]>>>16)|0,y[3]=d[3]+(d[2]<<8|d[2]>>>24)+d[1]|0,y[4]=d[4]+(d[3]<<16|d[3]>>>16)+(d[2]<<16|d[2]>>>16)|0,y[5]=d[5]+(d[4]<<8|d[4]>>>24)+d[3]|0,y[6]=d[6]+(d[5]<<16|d[5]>>>16)+(d[4]<<16|d[4]>>>16)|0,y[7]=d[7]+(d[6]<<8|d[6]>>>24)+d[5]|0}r.Rabbit=i._createHelper(f)})(),n.Rabbit})})(Cp)),Cp.exports}var Sp={exports:{}},s$=Sp.exports,LT;function i$(){return LT||(LT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Xa(),Za(),Yo(),Dn())})(s$,function(n){return(function(){var r=n,s=r.lib,i=s.StreamCipher,a=r.algo,c=[],u=[],d=[],f=a.RabbitLegacy=i.extend({_doReset:function(){var y=this._key.words,x=this.cfg.iv,b=this._X=[y[0],y[3]<<16|y[2]>>>16,y[1],y[0]<<16|y[3]>>>16,y[2],y[1]<<16|y[0]>>>16,y[3],y[2]<<16|y[1]>>>16],E=this._C=[y[2]<<16|y[2]>>>16,y[0]&4294901760|y[1]&65535,y[3]<<16|y[3]>>>16,y[1]&4294901760|y[2]&65535,y[0]<<16|y[0]>>>16,y[2]&4294901760|y[3]&65535,y[1]<<16|y[1]>>>16,y[3]&4294901760|y[0]&65535];this._b=0;for(var w=0;w<4;w++)g.call(this);for(var w=0;w<8;w++)E[w]^=b[w+4&7];if(x){var R=x.words,C=R[0],k=R[1],N=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,V=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360,$=N>>>16|V&4294901760,D=V<<16|N&65535;E[0]^=N,E[1]^=$,E[2]^=V,E[3]^=D,E[4]^=N,E[5]^=$,E[6]^=V,E[7]^=D;for(var w=0;w<4;w++)g.call(this)}},_doProcessBlock:function(y,x){var b=this._X;g.call(this),c[0]=b[0]^b[5]>>>16^b[3]<<16,c[1]=b[2]^b[7]>>>16^b[5]<<16,c[2]=b[4]^b[1]>>>16^b[7]<<16,c[3]=b[6]^b[3]>>>16^b[1]<<16;for(var E=0;E<4;E++)c[E]=(c[E]<<8|c[E]>>>24)&16711935|(c[E]<<24|c[E]>>>8)&4278255360,y[x+E]^=c[E]},blockSize:128/32,ivSize:64/32});function g(){for(var y=this._X,x=this._C,b=0;b<8;b++)u[b]=x[b];x[0]=x[0]+1295307597+this._b|0,x[1]=x[1]+3545052371+(x[0]>>>0<u[0]>>>0?1:0)|0,x[2]=x[2]+886263092+(x[1]>>>0<u[1]>>>0?1:0)|0,x[3]=x[3]+1295307597+(x[2]>>>0<u[2]>>>0?1:0)|0,x[4]=x[4]+3545052371+(x[3]>>>0<u[3]>>>0?1:0)|0,x[5]=x[5]+886263092+(x[4]>>>0<u[4]>>>0?1:0)|0,x[6]=x[6]+1295307597+(x[5]>>>0<u[5]>>>0?1:0)|0,x[7]=x[7]+3545052371+(x[6]>>>0<u[6]>>>0?1:0)|0,this._b=x[7]>>>0<u[7]>>>0?1:0;for(var b=0;b<8;b++){var E=y[b]+x[b],w=E&65535,R=E>>>16,C=((w*w>>>17)+w*R>>>15)+R*R,k=((E&4294901760)*E|0)+((E&65535)*E|0);d[b]=C^k}y[0]=d[0]+(d[7]<<16|d[7]>>>16)+(d[6]<<16|d[6]>>>16)|0,y[1]=d[1]+(d[0]<<8|d[0]>>>24)+d[7]|0,y[2]=d[2]+(d[1]<<16|d[1]>>>16)+(d[0]<<16|d[0]>>>16)|0,y[3]=d[3]+(d[2]<<8|d[2]>>>24)+d[1]|0,y[4]=d[4]+(d[3]<<16|d[3]>>>16)+(d[2]<<16|d[2]>>>16)|0,y[5]=d[5]+(d[4]<<8|d[4]>>>24)+d[3]|0,y[6]=d[6]+(d[5]<<16|d[5]>>>16)+(d[4]<<16|d[4]>>>16)|0,y[7]=d[7]+(d[6]<<8|d[6]>>>24)+d[5]|0}r.RabbitLegacy=i._createHelper(f)})(),n.RabbitLegacy})})(Sp)),Sp.exports}var kp={exports:{}},o$=kp.exports,FT;function a$(){return FT||(FT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Xa(),Za(),Yo(),Dn())})(o$,function(n){return(function(){var r=n,s=r.lib,i=s.BlockCipher,a=r.algo;const c=16,u=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],d
vendor: 11,038 bytes, line 3966
3966=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var 
3966f={pbox:[],sbox:[]};function g(w,R){let C=R>>24&255,k=R>>16&255,N=R>>8&255,V=R&255,$=w.sbox[0][C]+w.sbox[1][k];return $=$^w.sbox[2][N],$=$+w.sbox[3][V],$}function y(w,R,C){let k=R,N=C,V;for(let $=0;$<c;++$)k=k^w.pbox[$],N=g(w,k)^N,V=k,k=N,N=V;return V=k,k=N,N=V,N=N^w.pbox[c],k=k^w.pbox[c+1],{left:k,right:N}}function x(w,R,C){let k=R,N=C,V;for(let $=c+1;$>1;--$)k=k^w.pbox[$],N=g(w,k)^N,V=k,k=N,N=V;return V=k,k=N,N=V,N=N^w.pbox[1],k=k^w.pbox[0],{left:k,right:N}}function b(w,R,C){for(let D=0;D<4;D++){w.sbox[D]=[];for(let I=0;I<256;I++)w.sbox[D][I]=d[D][I]}let k=0;for(let D=0;D<c+2;D++)w.pbox[D]=u[D]^R[k],k++,k>=C&&(k=0);let N=0,V=0,$=0;for(let D=0;D<c+2;D+=2)$=y(w,N,V),N=$.left,V=$.right,w.pbox[D]=N,w.pbox[D+1]=V;for(let D=0;D<4;D++)for(let I=0;I<256;I+=2)$=y(w,N,V),N=$.left,V=$.right,w.sbox[D][I]=N,w.sbox[D][I+1]=V;return!0}var E=a.Blowfish=i.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var w=this._keyPriorReset=this._key,R=w.words,C=w.sigBytes/4;b(f,R,C)}},encryptBlock:function(w,R){var C=y(f,w[R],w[R+1]);w[R]=C.left,w[R+1]=C.right},decryptBlock:function(w,R){var C=x(f,w[R],w[R+1]);w[R]=C.left,w[R+1]=C.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=i._createHelper(E)})(),n.Blowfish})})(kp)),kp.exports}var l$=Gf.exports,jT;function c$(){return jT||(jT=1,(function(t,e){(function(n,r,s){t.exports=r(ot(),Ym(),i7(),a7(),Xa(),u7(),Za(),wP(),Tx(),m7(),EP(),v7(),x7(),E7(),Cx(),T7(),Yo(),Dn(),I7(),R7(),N7(),L7(),j7(),B7(),U7(),z7(),q7(),G7(),Y7(),J7(),Z
39667(),t$(),r$(),i$(),a$())})(l$,function(n){return n})})(Gf)),Gf.exports}var u$=c$();const bP=xc(u$),AP="pda-website-secret-key-2026",d$=480*60*1e3,h$=t=>{const e={alg:"HS256",typ:"JWT"},n={...t,iat:Date.now(),exp:Date.now()+d$},r=btoa(JSON.stringify(e)),s=btoa(JSON.stringify(n)),i=bP.HmacSHA256(`${r}.${s}`,AP).toString();return`${r}.${s}.${i}`},f$=t=>{try{if(!t)return null;const e=t.split(".");if(e.length!==3)return null;const[n,r,s]=e,i=bP.HmacSHA256(`${n}.${r}`,AP).toString();if(s!==i)return null;const a=JSON.parse(atob(r));return a.exp<Date.now()?null:a}catch{return null}},Ps={setTokens:(t,e)=>{localStorage.setItem("access_token",t),localStorage.setItem("refresh_token",e)},getAccessToken:()=>localStorage.getItem("access_token"),getRefreshToken:()=>localStorage.getItem("refresh_token"),clearTokens:()=>{localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token"),localStorage.removeItem("member_auth"),localStorage.removeItem("lawyer_auth"),localStorage.removeItem("admin_auth")},isAuthenticated:()=>{const t=Ps.getAccessToken();return!!f$(t)}},sm=h$,p$=ci(ui,"createFirebaseSession"),m$=async t=>{if(!t?.access_token)return await lt.authStateReady(),(lt.currentUser?await lt.currentUser.getIdTokenResult():null)?.claims?.identity_provider==="supabase"&&await tP(lt),null;const e=await p$({supabaseAccessToken:t.access_token}),n=e.data?.customToken;if(!n)throw new Error("Firebase authentication bridge returned no token.");return{user:(await g9(lt,n)).user,role:e.data.role}},Qm=async()=>{lt.currentUser&&await tP(lt)},TP=S.createContext(null),dy=t=>new Promise(e=>setTimeout(e,t)),wa=t=>{if(!t)return null;let e=t;try{e=rm?rm(t):t}catch{e=t}if(e=String(e).trim(),/^\+1\d{10}$/.test(e))return e;const n=e.replace(/[^\d]/g,"");return/^\d{10}$/.test(n)?`+1${n}`:/^1\d{10}$/.test(n)?`+${n}`:null},xf=t=>t?`***-***-${String(t).replace(/[^\d]/g,"").slice(-4)}`:"***-***-****",g$=({children:t})=>{const[e,n]=S.useState(null),[r,s]=S.useState(!0);S.useEffect(()=>{(async()=>{s(!0);try{const{data:k,error:N}=await $e.auth.getSession();if(N)throw N;const V=k.session?.user;if(!V){if(await lt.authStateReady(),!lt.currentUser)return;const I=await lt.currentUser.getIdTokenResult();if(I.claims.sms_verified!==!0||I.claims.role!==de.MEMBER)return;const B=await Ax();n({...B,name:B.name||B.email,member_code:B.member_id||B.person_id});return}const{data:$,error:D}=await $e.from("users").select("id, email, phone, full_name, role, is_active, member_code").eq("id",V.id).single();if(D)throw D;if($?.is_active&&$.role===de.MEMBER){await lt.authStateReady();const I=lt.currentUser?await lt.currentUser.getIdTokenResult():null;if(I?.claims?.sms_verified!==!0||I.claims.pda_user_id!==$.id){await $e.auth.signOut();return}n({...$,name:$.full_name||$.email})}}catch{Ps.clearTokens()}finally{s(!1)}})()},[]);const i=async(C,k)=>{const N=String(C||"").trim().toLowerCase();if(!N.includes("@"))return{success:!1,error:"For secure sign-in, please use the email address on your membership."};try{const{data:V,error:$}=await $e.auth.signInWithPassword({email:N,password:k});if($||!V.user)return{success:!1,error:"Invalid email or password."};const{data:D,error:I}=await $e.from("users").select("id, email, phone, full_name, role, is_active, member_code").eq("id",V.user.id).single();if(I||!D||!D.is_active||D.role!==de.MEMBER)return await $e.auth.signOut(),{success:!1,error:"An active member profile was not found."};const B={...D,name:D.full_name||D.email};return{success:!0,member:B,user:B}}catch(V){return await $e.auth.signOut(),{success:!1,error:V.message||"Unable to sign in."}}},a=async()=>{await Promise.allSettled([$e.auth.signOut(),Qm()]),Ps.clearTokens(),n(null),localStorage.removeItem("member_auth")},c=C=>{if(!C||!C.id)return{success:!1,error:"Invalid user data"};const k={...C,role:C.role||de.MEMBER},N=sm({userId:C.id,username:C.username||C.email,email:C.email,role:C.role||de.MEMBER,memberCode:C.member_code||C.member_id});return Ps.setTokens(N,N),n(k),{success:!0,member:k}},u=async C=>{try{const k=wa(C.phone);if(!k)return{success:!1,error:"Phone number invalid. Must be US number with +1 (e.g. +18559169939)."};const N=C.member_type||C.membership_type||"supporter",V=await xP({type:Mt.MEMBER_REGISTRATION,data:{name:C.fullName||C.name,first_name:C.first_name||C.firstName||"",middle_name:C.middle_name||C.middleName||"",last_name:C.last_name||C.lastName||"",email:C.email,phone:k,address:C.address,city:C.city,state:C.state,zip_code:C.zip_code,country:C.country,member_type:N,message:C.message}});return{success:!0,pending:!0,reference:V.reference,applicationId:V.applicationId,duplicate:V.duplicate===!0}}catch(k){return{success:!1,error:k.message}}},d=async C=>{const k={name:C.name||C.fullName,fullName:C.name||C.fullName,first_name:C.first_name||C.firstName||"",middle_name:C.middle_name||C.middleName||"",last_name:C.last_name||C.lastName||"",email:C.email,phone:C.phone,address:C.address,city:C.city,state:C.state,zip_code:C.zip_code||C.zip,country:C.country||"United States",membership_type:C.membership_type||C.membershipType||"supporter",message:C.message||""};return await u(k)},f=async(C,k="registration")=>{if(k==="password_reset"||k==="username_recovery"){const $=Rn.members.findByEmail(C);if(!$)return{success:!1,error:"Email not found"};if(!$.phone)return{success:!1,error:"No phone number associated with this account"};const D=wa($.phone);if(!D)return{success:!1,error:"Stored phone invalid. Must be +1..."};const I=await uy(D,k);return I.success?{success:!0,maskedPhone:xf(D),phone:D,message:"Code sent via SMS"}:I}const N=wa(C);if(!N)return{success:!1,error:"Phone number invalid. Must be US number with +1 (e.g. +18559169939)."};
3966const V=await uy(N,k);return V.success?{success:!0,maskedPhone:xf(N),phone:N,message:"Code sent via SMS"}:V},g=async(C,k,N)=>{await dy(500);const V=wa(C);return V?Rn.sms_codes.verify(V,k,N)?{success:!0}:{success:!1,error:"Invalid or expired code"}:{success:!1,error:"Invalid phone (+1...)"}},y=async C=>{const k=Rn.members.findByEmail(C);if(!k)return{success:!1,error:"Email not found"};if(!k.phone)return{success:!1,error:"No phone number associated with this account"};const N=wa(k.phone);if(!N)return{success:!1,error:"Stored phone invalid. Must be +1..."};const V=await uy(N,"password_reset");return V.success?{success:!0,maskedPhone:xf(N),phone:N}:V},x=async C=>{const k=Rn.members.findByEmail(C);if(!k)return{success:!1,error:"Email not found"};if(!k.phone)return{success:!1,error:"No phone number associated with this account"};const N=wa(k.phone);if(!N)return{success:!1,error:"Stored phone invalid. Must be +1..."};const V=k.member_code||k.member_id,$=await JU(N,V);return $.success?{success:!0,maskedPhone:xf(N)}:$},b=async(C,k,N="password_reset")=>{await dy(500);const V=wa(C);return V?Rn.sms_codes.verify(V,k,N)?{success:!0}:{success:!1,error:"Invalid or expired SMS code"}:{success:!1,error:"Invalid phone (+1...)"}},E=async(C,k)=>(await dy(1e3),Rn.members.resetPassword(C,k)?{success:!0}:{success:!1,error:"Failed to reset password"}),w=async(C,k,N,V)=>{const $=await b(V,N,"password_reset");return $.success?await E(C,k):$},R=async C=>Rn.members.findByEmail(C)?await x(C):{success:!0,message:"If an account exists, recovery info has been sent."};return v.jsx(TP.Provider,{value:{member:e,setUser:c,loginMember:i,login:i,logout:a,registerMember:u,register:d,sendOTP:f,verifyOTP:g,sendPasswordResetSMS:y,sendUsernameSMS:x,verifySMSCode:b,resetPassword:E,resetPasswordWithSMS:w,recoverUsername:R,isAuthenticated:!!e,loading:r},children:t})},Sx=()=>{const t=S.useContext(TP);if(!t)throw new Error("useMemberAuth must be used within a MemberAuthProvider");return t},CP=S.createContext(null),wf=[de.VOLUNTEER,de.PROFESSIONAL,de.STAFF,de.INFO_ADMIN,de.ADMIN,de.SUPER_ADMIN],MT=async t=>{const{data:e,error:n}=await $e.from("users").select("id, email, phone, full_name, role, is_active, professional_category").eq("id",t).single();if(n||!e)throw new Error("PDA user profile was not found.");return{...e,name:e.full_name||e.email}},hy=t=>{const e=sm({userId:t.id,username:t.name||t.email,email:t.email,role:t.role});Ps.setTokens(e,e)},y$=({children:t})=>{const[e,n]=S.useState(null),[r,s]=S.useState(!0);S.useEffect(()=>{let u=!0;return(async()=>{try{const{data:f,error:g}=await $e.auth.getSession();if(g)throw g;if(!f.session?.user){if(await lt.authStateReady(),!lt.currentUser)return;const b=await lt.currentUser.getIdTokenResult(),E=b.claims.role;if(b.claims.sms_verified!==!0||!wf.includes(E))return;const w=JSON.parse(localStorage.getItem("unified_auth")||"{}"),R={...w,id:b.claims.pda_user_id||lt.currentUser.uid,email:w.email||lt.currentUser.email,name:w.name||lt.currentUser.displayName||lt.currentUser.email,role:E,is_active:!0};hy(R),u&&n(R);return}const y=await MT(f.session.user.id);if(!y.is_active||!wf.includes(y.role))return;await lt.authStateReady();const x=lt.currentUser?await lt.currentUser.getIdTokenResult():null;if(x?.claims?.sms_verified!==!0||x.claims.pda_user_id!==y.id){await $e.auth.signOut();return}u&&(hy(y),n(y))}catch{Ps.clearTokens()}finally{u&&s(!1)}})(),()=>{u=!1}},[]);const i=async(u,d,f="professional")=>{const g=String(u||"").trim().toLowerCase();if(!g.includes("@"))return{success:!1,error:"Please sign in with your email address."};s(!0);try{const{data:y,error:x}=await $e.auth.signInWithPassword({email:g,password:d});if(x||!y.user)return{success:!1,error:"Invalid email or password."};const b=await MT(y.user.id);if(!b.is_active||!wf.includes(b.role))return await $e.auth.signOut(),{success:!1,error:"This account is inactive or unauthorized."};if(b.role!==de.VOLUNTEER&&!kL(b.email))return await $e.auth.signOut(),{success:!1,error:"Professional and staff access requires a @pdaus.org email."};const E=[de.PROFESSIONAL,de.SUPER_ADMIN,de.ADMIN],w=[de.STAFF,de.INFO_ADMIN,de.SUPER_ADMIN,de.ADMIN];return(f==="staff"?w.includes(b.role):f==="volunteer"?b.role===de.VOLUNTEER:E.includes(b.role))?{success:!0,user:b}:(await $e.auth.signOut(),{success:!1,error:"Please use the login tab assigned to your role."})}catch(y){return await $e.auth.signOut(),{success:!1,error:y.message||"Unable to sign in."}}finally{s(!1)}},a=u=>{if(!u?.id||!wf.includes(u.role))return{success:!1,error:"Unauthorized user role."};const d={...u,name:u.name||u.full_name||u.email};return hy(d),localStorage.setItem("unified_auth",JSON.stringify(d)),n(d),{success:!0,user:d}},c=async()=>{await Promise.allSettled([$e.auth.signOut(),Qm()]),Ps.clearTokens(),n(null),localStorage.removeItem("unified_auth")};return v.jsx(CP.Provider,{value:{user:e,login:i,loginWithUser:a,logout:c,isAuthenticated:!!e,loading:r},children:t})},kx=()=>{const t=S.useContext(CP);if(!t)throw new Error("useAuth must be used within a LawyerAuthProvider");return t},SP=S.createContext(null),v$=({children:t})=>{const[e,n]=S.useState(null),[r,s]=S.useState(!1),[i,a]=S.useState(!0),[c,u]=S.useState(null),d=S.useCallback(async()=>{try{const b=[de.SUPER_ADMIN,de.ADMIN,de.INFO_ADMIN,de.STAFF],{data:E,error:w}=await $e.auth.getSession();if(w)throw w;const R=E.session?.user;if(!R){if(await lt.authStateReady(),!lt.currentUser)return;const N=await lt.currentUser.getIdTokenResult(),V=N.claims.role;if(N.claims.sms_verified!==!0||!b.includes(V))return;const $=JSON.parse(localStorage.getItem("adminUser")||"{}"),D={id:N.claims.pda_user_id||lt.currentUser.uid,email:$.email||lt.currentUser.email,name:$.name||lt.currentUser.displayName||lt.currentUser.email,phone:$.phone||null,role:V};n(D),s(!0);return}const{data:C,error:k}=await $e.from("users").select("id, email, phone, full_name, role, is_active").eq("id",R.id).single();if(k)throw k;if(C?.is_active&&b.includes(C.role)){await lt.authStateReady();const N=lt.currentUser?await lt.currentUser.getIdTokenResult():null;if(N?.claims?.sms_verified!==!0||N.claims.pda_user_id!==C.id){await $e.auth.signOut();return}const V={id:C.id,email:C.email,name:C.full_name||C.email,role:C.role,phone:C.phone};n(V),s(!0)}else Ps.clearTokens()}catch{Ps.clearTokens()}finally{a(!1)}},[]);S.useEffect(()=>{d()},[d]);const x={admin:e,isAuthenticated:r,loading:i,error:c,login:async(b,E)=>{a(!0),u(null);try{const{data:w,error:R}=await $e.auth.signInWithPassword({email:b,password:E});if(R)return u("Invalid email or password."),{success:!1,error:"Invalid email or password."};if(!w?.user)return u("Authentication failed."),{success:!1,error:"Authentication failed."};const{data:C,error:k}=await $e.from("users").select("id, email, phone, full_name, role, is_active").eq("id",w.user.id).single();return k||!C?(await $e.auth.signOut(),u("User data not found."),{success:!1,error:"User data not found."}):["super_admin","admin","info_admin","staff"].includes(C.role)?C.is_active?{success:!0,user:{id:C.id,email:C.email,name:C.full_name||C.email,role:C.role,phone:C.phone}}:(await $e.auth.signOut(),u("Account is inactive. Please contact administrator."),{success:!1,error:"Account is inactive."}):(await $e.auth.signOut(),u("Access denied. Admin privileges required."),{success:!1,error:"Acce
3966ss denied. Admin privileges required."})}catch(w){const R=w.message||"Failed to login. Please try again.";return u(R),{success:!1,error:R}}finally{a(!1)}},logout:async()=>{e?.id&&Rn.logs.add(e.id,"admin_logout",`Admin ${e.email} logged out.`,e.id);try{await Promise.allSettled([$e.auth.signOut(),Qm()])}catch{}Ps.clearTokens(),localStorage.removeItem("adminUser"),n(null),s(!1),a(!1),u(null)},setAuthenticatedUser:b=>{const E={id:b.id,email:b.email,name:b.name||b.email,role:b.role,phone:b.phone},w=sm({userId:b.id,username:b.name||b.email,email:b.email,role:b.role}),R=sm({userId:b.id,type:"refresh"});Ps.setTokens(w,R),localStorage.setItem("adminUser",JSON.stringify(E)),n(E),s(!0)}};return v.jsx(SP.Provider,{value:x,children:t})},Ix=()=>{const t=S.useContext(SP);if(!t)throw new Error("useAdminAuth must be used within an AdminAuthProvider");return t},Ev=Object.freeze([de.SUPER_ADMIN,de.ADMIN,de.INFO_ADMIN,de.STAFF]),$l=Object.freeze([de.SUPER_ADMIN]),fy=Object.freeze([de.SUPER_ADMIN,de.ADMIN]),Gl=Object.freeze([de.SUPER_ADMIN,de.ADMIN,de.INFO_ADMIN]),_$=Gl,x$=Object.freeze({[de.SUPER_ADMIN]:"Super Administrator",[de.ADMIN]:"Administrator",[de.INFO_ADMIN]:"Information Administrator",[de.STAFF]:"Staff"}),w$=Object.freeze({superadmin:de.SUPER_ADMIN,lawyer:de.PROFESSIONAL}),E$=Object.freeze({[de.SUPER_ADMIN]:"/admin/dashboard",[de.ADMIN]:"/admin/dashboard",[de.INFO_ADMIN]:"/admin/dashboard",[de.STAFF]:"/admin/dashboard",[de.PROFESSIONAL]:"/dashboard",[de.VOLUNTEER]:"/volunteer-dashboard",[de.MEMBER]:"/member-dashboard"}),Px=t=>{const e=String(t||"").trim().toLowerCase();return w$[e]||e},b$=(t,e="/login")=>E$[Px(t)]||e,A$=(t,e)=>Array.isArray(e)?e.includes(Px(t)):!0,kP="pda_cookie_consent_v1",bv="pda:cookie-consent-changed",im="pda:cookie-consent-open",IP=new Set(["essential","functional"]),PP=()=>{if(typeof window>"u")return null;try{const t=JSON.parse(window.localStorage.getItem(kP)||"null");return t&&IP.has(t.level)?t:null}catch{return null}},Ip=()=>PP()?.level==="functional",T$=t=>{if(typeof window>"u"||!IP.has(t))return null;const e={level:t,updatedAt:new Date().toISOString()};return window.localStorage.setItem(kP,JSON.stringify(e)),e},py=(t="")=>{const e=t?`; domain=${t}`:"";document.cookie=`googtrans=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT${e}`},C$=()=>{if(typeof window>"u"||typeof document>"u")return!1;const t=!!(window.localStorage.getItem("pda_lang")||document.cookie.includes("googtrans="));return window.localStorage.removeItem("pda_lang"),py(),py(window.location.hostname),py(`.${window.location.hostname}`),t},Rx=S.createContext({});function Dx(t){const e=S.useRef(null);return e.current===null&&(e.current=t()),e.current}const Jm=S.createContext(null),Nx=S.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class S$ extends S.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function k$({children:t,isPresent:e}){const n=S.useId(),r=S.useRef(null),s=S.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=S.useContext(Nx);return S.useInsertionEffect(()=>{const{width:a,height:c,top:u,left:d}=s.current;if(e||!r.current||!a||!c)return;r.current.dataset.motionPopId=n;const f=document.createElement("style");return i&&(f.nonce=i),document.head.appendChild(f),f.sheet&&f.sheet.insertRule(`
3967          [data-motion-pop-id="${n}"] {
3968            position: absolute !important;
3969            width: ${a}px !important;
3970            height: ${c}px !important;
3971            top: ${u}px !important;
3972            left: ${d}px !important;
3973          }
3974        `),()=>{document.head.removeChild(f)}},[e]),v.jsx(S$,{isPresent:e,childRef:r,sizeRef:s,children:S.cloneElement(t,{ref:r})})}const I$=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:a})=>{const c=Dx(P$),u=S.useId(),d=S.useCallback(g=>{c.set(g,!0);for(const y of c.values())if(!y)return;r&&r()},[c,r]),f=S.useMemo(()=>({id:u,initial:e,isPresent:n,custom:s,onExitComplete:d,register:g=>(c.set(g,!1),()=>c.delete(g))}),i?[Math.random(),d]:[n,d]);return S.useMemo(()=>
vendor: 114,894 bytes, lines 3974-4004
3974{c.forEach((g,y)=>c.set(y,!1))},[n]),S.useEffect(()=>{!n&&!c.size&&r&&r()},[n]),a==="popLayout"&&(t=v.jsx(k$,{isPresent:n,children:t})),v.jsx(Jm.Provider,{value:f,children:t})};function P$(){return new Map}function RP(t=!0){const e=S.useContext(Jm);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,i=S.useId();S.useEffect(()=>{t&&s(i)},[t]);const a=S.useCallback(()=>t&&r&&r(i),[i,r,t]);return!n&&r?[!1,a]:[!0]}const Ef=t=>t.key||"";function BT(t){const e=[];return S.Children.forEach(t,n=>{S.isValidElement(n)&&e.push(n)}),e}const Ox=typeof window<"u",DP=Ox?S.useLayoutEffect:S.useEffect,Qr=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:a=!1})=>{const[c,u]=RP(a),d=S.useMemo(()=>BT(t),[t]),f=a&&!c?[]:d.map(Ef),g=S.useRef(!0),y=S.useRef(d),x=Dx(()=>new Map),[b,E]=S.useState(d),[w,R]=S.useState(d);DP(()=>{g.current=!1,y.current=d;for(let N=0;N<w.length;N++){const V=Ef(w[N]);f.includes(V)?x.delete(V):x.get(V)!==!0&&x.set(V,!1)}},[w,f.length,f.join("-")]);const C=[];if(d!==b){let N=[...d];for(let V=0;V<w.length;V++){const $=w[V],D=Ef($);f.includes(D)||(N.splice(V,0,$),C.push($))}i==="wait"&&C.length&&(N=C),R(BT(N)),E(d);return}const{forceRender:k}=S.useContext(Rx);return v.jsx(v.Fragment,{children:w.map(N=>{const V=Ef(N),$=a&&!c?!1:d===w||f.includes(V),D=()=>{if(x.has(V))x.set(V,!0);else return;let I=!0;x.forEach(B=>{B||(I=!1)}),I&&(k?.(),R(y.current),a&&u?.(),r&&r())};return v.jsx(I$,{isPresent:$,initial:!g.current||n?void 0:!1,custom:$?void 0:e,presenceAffectsLayout:s,mode:i,onExitComplete:$?void 0:D,children:N},V)})})},Jr=t=>t;let NP=Jr;function Lx(t){let e;return()=>(e===void 0&&(e=t()),e)}const yc=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r},Bi=t=>t*1e3,Vi=t=>t/1e3,R$={useManualTiming:!1};function D$(t){let e=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function c(d){i.has(d)&&(u.schedule(d),t()),d(a)}const u={schedule:(d,f=!1,g=!1)=>{const x=g&&r?e:n;return f&&i.add(d),x.has(d)||x.add(d),d},cancel:d=>{n.delete(d),i.delete(d)},process:d=>{if(a=d,r){s=!0;return}r=!0,[e,n]=[n,e],e.forEach(c),e.clear(),r=!1,s&&(s=!1,u.process(d))}};return u}const bf=["read","resolveKeyframes","update","preRender","render","postRender"],N$=40;function OP(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=bf.reduce((R,C)=>(R[C]=D$(i),R),{}),{read:c,resolveKeyframes:u,update:d,preRender:f,render:g,postRender:y}=a,x=()=>{const R=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(R-s.timestamp,N$),1),s.timestamp=R,s.isProcessing=!0,c.process(s),u.process(s),d.process(s),f.process(s),g.process(s),y.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(x))},b=()=>{n=!0,r=!0,s.isProcessing||t(x)};return{schedule:bf.reduce((R,C)=>{const k=a[C];return R[C]=(N,V=!1,$=!1)=>(n||b(),k.schedule(N,V,$)),R},{}),cancel:R=>{for(let C=0;C<bf.length;C++)a[bf[C]].cancel(R)},state:s,steps:a}}const{schedule:Ut,cancel:qo,state:Hn,steps:my}=OP(typeof requestAnimationFrame<"u"?requestAnimationFrame:Jr,!0),LP=S.createContext({strict:!1}),VT={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},vc={};for(const t in VT)vc[t]={isEnabled:e=>VT[t].some(n=>!!e[n])};function O$(t){for(const e in t)vc[e]={...vc[e],...t[e]}}const L$=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function om(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||L$.has(t)}let FP=t=>!om(t);function F$(t){t&&(FP=e=>e.startsWith("on")?!om(e):t(e))}try{F$(require("@emotion/is-prop-valid").default)}catch{}function j$(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(FP(s)||n===!0&&om(s)||!e&&!om(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}function M$(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...r)=>t(...r);return new Proxy(n,{get:(r,s)=>s==="create"?t:(e.has(s)||e.set(s,t(s)),e.get(s))})}const Xm=S.createContext({});function xd(t){return typeof t=="string"||Array.isArray(t)}function Zm(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Fx=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],jx=["initial",...Fx];function e0(t){return Zm(t.animate)||jx.some(e=>xd(t[e]))}function jP(t){return!!(e0(t)||t.variants)}function B$(t,e){if(e0(t)){const{initial:n,animate:r}=t;return{initial:n===!1||xd(n)?n:void 0,animate:xd(r)?r:void 0}}return t.inherit!==!1?e:{}}function V$(t){const{initial:e,animate:n}=B$(t,S.useContext(Xm));return S.useMemo(()=>({initial:e,animate:n}),[UT(e),UT(n)])}function UT(t){return Array.isArray(t)?t.join(" "):t}const U$=Symbol.for("motionComponentSymbol");function Ql(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function $$(t,e,n){return S.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):Ql(n)&&(n.current=r))},[e])}const Mx=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),z$="framerAppearId",MP="data-"+Mx(z$),{schedule:Bx}=OP(queueMicrotask,!1),BP=S.createContext({});function H$(t,e,n,r,s){var i,a;const{visualElement:c}=S.useContext(Xm),u=S.useContext(LP),d=S.useContext(Jm),f=S.useContext(Nx).reducedMotion,g=S.useRef(null);r=r||u.renderer,!g.current&&r&&(g.current=r(t,{visualState:e,parent:c,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:f}));const y=g.current,x=S.useContext(BP);y&&!y.projection&&s&&(y.type==="html"||y.type==="svg")&&q$(g.current,n,s,x);const b=S.useRef(!1);S.useInsertionEffect(()=>{y&&b.current&&y.update(n,d)});const E=n[MP],w=S.useRef(!!E&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,E))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,E)));return DP(()=>{y&&(b.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),Bx.render(y.render),w.current&&y.animationState&&y.animationState.animateChanges())}),S.useEffect(()=>{y&&(!w.current&&y.animationState&&y.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var R;(R=window.MotionHandoffMarkAsComplete)===null||R===void 0||R.call(window,E)}),w.current=!1))}),y}function q$(t,e,n,r){const{layoutId:s,layout:i,drag:a,dragConstraints:c,layoutScroll:u,layoutRoot:d}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:VP(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||c&&Ql(c),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:d})}function VP(t){if(t)return t.options.allowProjection!==!1?t.projection:VP(t.parent)}function W$({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:s}){var i,a;t&&O$(t);function c(d,f){let g;const y={...S.useContext(Nx),...d,layoutId:G$(d)},{isStatic:x}=y,b=V$(d),E=r(d,x);if(!x&&Ox){K$();const w=Y$(y);g=w.MeasureLayout,b.visualElement=H$(s,E,y,e,w.ProjectionNode)}return v.jsxs(Xm.Provider,{value:b,children:[g&&b.visualElement?v.jsx(g,{visualElement:b.visualElement,...y}):null,n(s,d,$$(E,b.visualElement,f),E,x,b.visualElement)]})}c.displayName=`motion.${typeof s=="string"?s:`create(${(a=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&a!==void 0?a:""})`}`;const u=S.forwardRef(c);return u[U$]=s,u}function G$({layoutId:t}){const e=S.useContext(Rx).id;return e&&t!==void 0?e+"-"+t:t}function K$(t,e){S.useContext(LP).strict}function Y$(t){const{drag:e,layout:n}=vc;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const Q$=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Vx(t){return typeof t!="string"||t.includes("-")?!1:!!(Q$.indexOf(t)>-1||/[A-Z]/u.test(t))}function $T(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function Ux(t,e,n,r){if(typeof e=="function"){const[s,i]=$T(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=$T(r);e=e(n!==void 0?n:t.custom,s,i)}return e}const Av=t=>Array.isArray(t),J$=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),X$=t=>Av(t)?t[t.length-1]||0:t,ar=t=>!!(t&&t.getVelocity);function Pp(t){const e=ar(t)?t.get():t;return J$(e)?e.toValue():e}function Z$({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:n},r,s,i){const a={latestValues:ez(r,s,i,t),renderState:e()};return n&&(a.onMount=c=>n({props:r,current:c,...a}),a.onUpdate=c=>n(c)),a}const UP=t=>(e,n)=>{const r=S.useContext(Xm),s=S.useContext(Jm),i=()=>Z$(t,e,r,s);return n?i():Dx(i)};function ez(t,e,n,r){const s={},i=r(t,{});for(const y in i)s[y]=Pp(i[y]);let{initial:a,animate:c}=t;const u=e0(t),d=jP(t);e&&d&&!u&&t.inherit!==!1&&(a===void 0&&(a=e.initial),c===void 0&&(c=e.animate));let f=n?n.initial===!1:!1;f=f||a===!1;const g=f?c:a;if(g&&typeof g!="boolean"&&!Zm(g)){const y=Array.isArray(g)?g:[g];for(let x=0;x<y.length;x++){const b=Ux(t,y[x]);if(b){const{transitionEnd:E,transition:w,...R}=b;for(const C in R){let k=R[C];if(Array.isArray(k)){const N=f?k.length-1:0;k=k[N]}k!==null&&(s[C]=k)}for(const C in E)s[C]=E[C]}}}return s}const Lc=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],el=new Set(Lc),$P=t=>e=>typeof e=="string"&&e.startsWith(t),zP=$P("--"),tz=$P("var(--"),$x=t=>tz(t)?nz.test(t.split("/*")[0].trim()):!1,nz=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,HP=(t,e)=>e&&typeof t=="number"?e.transform(t):t,Ki=(t,e,n)=>n>e?e:n<t?t:n,Fc={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},wd={...Fc,transform:t=>Ki(0,1,t)},Af={...Fc,default:1},Hd=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Ao=Hd("deg"),ii=Hd("%"),Ue=Hd("px"),rz=Hd("vh"),sz=Hd("vw"),zT={...ii,parse:t=>ii.parse(t)/100,transform:t=>ii.transform(t*100)},iz={borderWidth:Ue,borderTopWidth:Ue,borderRightWidth:Ue,borderBottomWidth:Ue,borderLeftWidth:Ue,borderRadius:Ue,radius:Ue,borderTopLeftRadius:Ue,borderTopRightRadius:Ue,borderBottomRightRadius:Ue,borderBottomLeftRadius:Ue,width:Ue,maxWidth:Ue,height:Ue,maxHeight:Ue,top:Ue,right:Ue,bottom:Ue,left:Ue,padding:Ue,paddingTop:Ue,paddingRight:Ue,paddingBottom:Ue,paddingLeft:Ue,margin:Ue,marginTop:Ue,marginRight:Ue,marginBottom:Ue,marginLeft:Ue,backgroundPositionX:Ue,backgroundPositionY:Ue},oz={rotate:Ao,rotateX:Ao,rotateY:Ao,rotateZ:Ao,scale:Af,scaleX:Af,scaleY:Af,scaleZ:Af,skew:Ao,skewX:Ao,skewY:Ao,distance:Ue,translateX:Ue,translateY:Ue,translateZ:Ue,x:Ue,y:Ue,z:Ue,perspective:Ue,transformPerspective:Ue,opacity:wd,originX:zT,originY:zT,originZ:Ue},HT={...Fc,transform:Math.round},zx={...iz,...oz,zIndex:HT,size:Ue,fillOpacity:wd,strokeOpacity:wd,numOctaves:HT},az={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},lz=Lc.length;function cz(t,e,n){let r="",s=!0;for(let i=0;i<lz;i++){const a=Lc[i],c=t[a];if(c===void 0)continue;let u=!0;if(typeof c=="number"?u=c===(a.startsWith("scale")?1:0):u=parseFloat(c)===0,!u||n){const d=HP(c,zx[a]);if(!u){s=!1;const f=az[a]||a;r+=`${f}(${d}) `}n&&(e[a]=d)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function Hx(t,e,n){const{style:r,vars:s,transformOrigin:i}=t;let a=!1,c=!1;for(const u in e){const d=e[u];if(el.has(u)){a=!0;continue}else if(zP(u)){s[u]=d;continue}else{const f=HP(d,zx[u]);u.startsWith("origin")?(c=!0,i[u]=f):r[u]=f}}if(e.transform||(a||n?r.transform=cz(e,t.transform,n):r.transform&&(r.transform="none")),c){const{originX:u="50%",originY:d="50%",originZ:f=0}=i;r.transformOrigin=`${u} ${d} ${f}`}}const uz={offset:"stroke-dashoffset",array:"stroke-dasharray"},dz={offset:"strokeDashoffset",array:"strokeDasharray"};function hz(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?uz:dz;t[i.offset]=Ue.transform(-r);const a=Ue.transform(e),c=Ue.transform(n);t[i.array]=`${a} ${c}`}function qT(t,e,n){return typeof t=="string"?t:Ue.transform(e+n*t)}function fz(t,e,n){const r=qT(e,t.x,t.width),s=qT(n,t.y,t.height);return`${r} ${s}`}function qx(t,{attrX:e,attrY:n,attrScale:r,originX:s,originY:i,pathLength:a,pathSpacing:c=1,pathOffset:u=0,...d},f,g){if(Hx(t,d,g),f){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:y,style:x,dimensions:b}=t;y.transform&&(b&&(x.transform=y.transform),delete y.transform),b&&(s!==void 0||i!==void 0||x.transform)&&(x.transformOrigin=fz(b,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(y.x=e),n!==void 0&&(y.y=n),r!==void 0&&(y.scale=r),a!==void 0&&hz(y,a,c,u,!1)}const Wx=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),qP=()=>({...Wx(),attrs:{}}),Gx=t=>typeof t=="string"&&t.toLowerCase()==="svg";function WP(t,{style:e,vars:n},r,s){Object.assign(t.style,e,s&&s.getProjectionStyles(r));for(const i in n)t.style.setProperty(i,n[i])}const GP=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function KP(t,e,n,r){WP(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(GP.has(s)?s:Mx(s),e.attrs[s])}const am={};function pz(t){Object.assign(am,t)}function YP(t,{layout:e,layoutId:n}){return el.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!am[t]||t==="opacity")}function Kx(t,e,n){var r;const{style:s}=t,i={};for(const a in s)(ar(s[a])||e.style&&ar(e.style[a])||YP(a,t)||((r=n?.getValue(a))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[a]=s[a]);return i}function QP(t,e,n){const r=Kx(t,e,n);for(const s in t)if(ar(t[s])||ar(e[s])){const i=Lc.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}function mz(t,e){try{e.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{e.dimensions={x:0,y:0,width:0,height:0}}}const WT=["x","y","width","height","cx","cy","r"],gz={useVisualState:UP({scrapeMotionValuesFromProps:QP,createRenderState:qP,onUpdate:({props:t,prevProps:e,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!t.drag;if(!i){for(const c in s)if(el.has(c)){i=!0;break}}if(!i)return;let a=!e;if(e)for(let c=0;c<WT.length;c++){const u=WT[c];t[u]!==e[u]&&(a=!0)}a&&Ut.read(()=>{mz(n,r),Ut.render(()=>{qx(r,s,Gx(n.tagName),t.transformTemplate),KP(n,r)})})}})},yz={useVisualState:UP({scrapeMotionValuesFromProps:Kx,createRenderState:Wx})};function JP(t,e,n){for(const r in e)!ar(e[r])&&!YP(r,n)&&(t[r]=e[r])}function vz({transformTemplate:t},e){return S.useMemo(()=>{const n=Wx();return Hx(n,e,t),Object.assign({},n.vars,n.style)},[e])}function _z(t,e){const n=t.style||{},r={};return JP(r,n,t),Object.assign(r,vz(t,e)),r}function xz(t,e){const n={},r=_z(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}function wz(t,e,n,r){const s=S.useMemo(()=>{const i=qP();return qx(i,e,Gx(r),t.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};JP(i,t.style,t),s.style={...i,...s.style}}return s}function Ez(t=!1){return(n,r,s,{latestValues:i},a)=>{const u=(Vx(n)?wz:xz)(r,i,a,n),d=j$(r,typeof n=="string",t),f=n!==S.Fragment?{...d,...u,ref:s}:{},{children:g}=r,y=S.useMemo(()=>ar(g)?g.get():g,[g]);return S.createElement(n,{...f,children:y})}}function bz(t,e){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const a={...Vx(r)?gz:yz,preloadedFeatures:t,useRender:Ez(s),createVisualElement:e,Component:r};return W$(a)}}function XP(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function t0(t,e,n){const r=t.getProps();return Ux(r,e,n!==void 0?n:r.custom,t)}const Az=Lx(()=>window.ScrollTimeline!==void 0);class Tz{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=n}attachTimeline(e,n){const r=this.animations.map(s=>{if(Az()&&s.attachTimeline)return s.attachTimeline(e);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Cz extends Tz{then(e,n){return Promise.all(this.animations).then(e).catch(n)}}function Yx(t,e){return t?t[e]||t.default||t:void 0}const Tv=2e4;function ZP(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<Tv;)e+=n,r=t.next(e);return e>=Tv?1/0:e}function Qx(t){return typeof t=="function"}function GT(t,e){t.timeline=e,t.onfinish=null}const Jx=t=>Array.isArray(t)&&typeof t[0]=="number",Sz={linearEasing:void 0};function kz(t,e){const n=Lx(t);return()=>{var r;return(r=Sz[e])!==null&&r!==void 0?r:n()}}const lm=kz(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),eR=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let i=0;i<s;i++)r+=t(yc(0,s-1,i))+", ";return`linear(${r.substring(0,r.length-2)})`};function tR(t){return!!(typeof t=="function"&&lm()||!t||typeof t=="string"&&(t in Cv||lm())||Jx(t)||Array.isArray(t)&&t.every(tR))}const Vu=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Cv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Vu([0,.65,.55,1]),circOut:Vu([.55,0,1,.45]),backIn:Vu([.31,.01,.66,-.59]),backOut:Vu([.33,1.53,.69,.99])};function nR(t,e){if(t)return typeof t=="function"&&lm()?eR(t,e):Jx(t)?Vu(t):Array.isArray(t)?t.map(n=>nR(n,e)||Cv.easeOut):Cv[t]}const Ts={x:!1,y:!1};function rR(){return Ts.x||Ts.y}function Iz(t,e,n){var r;if(t instanceof Element)return[t];if(typeof t=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}function sR(t,e){const n=Iz(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function KT(t){return e=>{e.pointerType==="touch"||rR()||t(e)}}function Pz(t,e,n={}){const[r,s,i]=sR(t,n),a=KT(c=>{const{target:u}=c,d=e(c);if(typeof d!="function"||!u)return;const f=KT(g=>{d(g),u.removeEventListener("pointerleave",f)});u.addEventListener("pointerleave",f,s)});return r.forEach(c=>{c.addEventListener("pointerenter",a,s)}),i}const iR=(t,e)=>e?t===e?!0:iR(t,e.parentElement):!1,Xx=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Rz=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Dz(t){return Rz.has(t.tagName)||t.tabIndex!==-1}const Uu=new WeakSet;function YT(t){return e=>{e.key==="Enter"&&t(e)}}function gy(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Nz=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=YT(()=>{if(Uu.has(n))return;gy(n,"down");const s=YT(()=>{gy(n,"up")}),i=()=>gy(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function QT(t){return Xx(t)&&!rR()}function Oz(t,e,n={}){const[r,s,i]=sR(t,n),a=c=>{const u=c.currentTarget;if(!QT(c)||Uu.has(u))return;Uu.add(u);const d=e(c),f=(x,b)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",y),!(!QT(x)||!Uu.has(u))&&(Uu.delete(u),typeof d=="function"&&d(x,{success:b}))},g=x=>{f(x,n.useGlobalTarget||iR(u,x.target))},y=x=>{f(x,!1)};window.addEventListener("pointerup",g,s),window.addEventListener("pointercancel",y,s)};return r.forEach(c=>{!Dz(c)&&c.getAttribute("tabindex")===null&&(c.tabIndex=0),(n.useGlobalTarget?window:c).addEventListener("pointerdown",a,s),c.addEventListener("focus",d=>Nz(d,s),s)}),i}function Lz(t){return t==="x"||t==="y"?Ts[t]?null:(Ts[t]=!0,()=>{Ts[t]=!1}):Ts.x||Ts.y?null:(Ts.x=Ts.y=!0,()=>{Ts.x=Ts.y=!1})}const oR=new Set(["width","height","top","left","right","bottom",...Lc]);let Rp;function Fz(){Rp=void 0}const oi={now:()=>(Rp===void 0&&oi.set(Hn.isProcessing||R$.useManualTiming?Hn.timestamp:performance.now()),Rp),set:t=>{Rp=t,queueMicrotask(Fz)}};function Zx(t,e){t.indexOf(e)===-1&&t.push(e)}function ew(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class tw{constructor(){this.subscriptions=[]}add(e){return Zx(this.subscriptions,e),()=>ew(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const a=this.subscriptions[i];a&&a(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function aR(t,e){return e?t*(1e3/e):0}const JT=30,jz=t=>!isNaN(parseFloat(t));class Mz{constructor(e,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=oi.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=oi.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=jz(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new tw);const r=this.events[e].add(n);return e==="change"?()=>{r(),Ut.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=oi.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>JT)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,JT);return aR(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ed(t,e){return new Mz(t,e)}function Bz(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Ed(n))}function Vz(t,e){const n=t0(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const a in i){const c=X$(i[a]);Bz(t,a,c)}}function Uz(t){return!!(ar(t)&&t.add)}function Sv(t,e){const n=t.getValue("willChange");if(Uz(n))return n.add(e)}function lR(t){return t.props[MP]}const cR=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,$z=1e-7,zz=12;function Hz(t,e,n,r,s){let i,a,c=0;do a=e+(n-e)/2,i=cR(a,r,s)-t,i>0?n=a:e=a;while(Math.abs(i)>$z&&++c<zz);return a}function qd(t,e,n,r){if(t===e&&n===r)return Jr;const s=i=>Hz(i,0,1,t,n);return i=>i===0||i===1?i:cR(s(i),e,r)}const uR=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,dR=t=>e=>1-t(1-e),hR=qd(.33,1.53,.69,.99),nw=dR(hR),fR=uR(nw),pR=t=>(t*=2)<1?.5*nw(t):.5*(2-Math.pow(2,-10*(t-1))),rw=t=>1-Math.sin(Math.acos(t)),mR=dR(rw),gR=uR(rw),yR=t=>/^0[^.\s]+$/u.test(t);function qz(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||yR(t):!0}const td=t=>Math.round(t*1e5)/1e5,sw=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Wz(t){return t==null}const Gz=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,iw=(t,e)=>n=>!!(typeof n=="string"&&Gz.test(n)&&n.startsWith(t)||e&&!Wz(n)&&Object.prototype.hasOwnProperty.call(n,e)),vR=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,i,a,c]=r.match(sw);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(a),alpha:c!==void 0?parseFloat(c):1}},Kz=t=>Ki(0,255,t),yy={...Fc,transform:t=>Math.round(Kz(t))},Ra={test:iw("rgb","red"),parse:vR("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+yy.transform(t)+", "+yy.transform(e)+", "+yy.transform(n)+", "+td(wd.transform(r))+")"};function Yz(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const kv={test:iw("#"),parse:Yz,transform:Ra.transform},Jl={test:iw("hsl","hue"),parse:vR("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+ii.transform(td(e))+", "+ii.transform(td(n))+", "+td(wd.transform(r))+")"},sr={test:t=>Ra.test(t)||kv.test(t)||Jl.test(t),parse:t=>Ra.test(t)?Ra.parse(t):Jl.test(t)?Jl.parse(t):kv.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ra.transform(t):Jl.transform(t)},Qz=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Jz(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(sw))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Qz))===null||n===void 0?void 0:n.length)||0)>0}const _R="number",xR="color",Xz="var",Zz="var(",XT="${}",eH=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function bd(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const c=e.replace(eH,u=>(sr.test(u)?(r.color.push(i),s.push(xR),n.push(sr.parse(u))):u.startsWith(Zz)?(r.var.push(i),s.push(Xz),n.push(u)):(r.number.push(i),s.push(_R),n.push(parseFloat(u))),++i,XT)).split(XT);return{values:n,split:c,indexes:r,types:s}}function wR(t){return bd(t).values}function ER(t){const{split:e,types:n}=bd(t),r=e.length;return s=>{let i="";for(let a=0;a<r;a++)if(i+=e[a],s[a]!==void 0){const c=n[a];c===_R?i+=td(s[a]):c===xR?i+=sr.transform(s[a]):i+=s[a]}return i}}const tH=t=>typeof t=="number"?0:t;function nH(t){const e=wR(t);return ER(t)(e.map(tH))}const Wo={test:Jz,parse:wR,createTransformer:ER,getAnimatableNone:nH},rH=new Set(["brightness","contrast","saturate","opacity"]);function sH(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(sw)||[];if(!r)return t;const s=n.replace(r,"");let i=rH.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const iH=/\b([a-z-]*)\(.*?\)/gu,Iv={...Wo,getAnimatableNone:t=>{const e=t.match(iH);return e?e.map(sH).join(" "):t}},oH={...zx,color:sr,backgroundColor:sr,outlineColor:sr,fill:sr,stroke:sr,borderColor:sr,borderTopColor:sr,borderRightColor:sr,borderBottomColor:sr,borderLeftColor:sr,filter:Iv,WebkitFilter:Iv},ow=t=>oH[t];function bR(t,e){let n=ow(t);return n!==Iv&&(n=Wo),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const aH=new Set(["auto","none","0"]);function lH(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!aH.has(i)&&bd(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=bR(n,s)}const ZT=t=>t===Fc||t===Ue,eC=(t,e)=>parseFloat(t.split(", ")[e]),tC=(t,e)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return eC(s[1],e);{const i=r.match(/^matrix\((.+)\)$/u);return i?eC(i[1],t):0}},cH=new Set(["x","y","z"]),uH=Lc.filter(t=>!cH.has(t));function dH(t){const e=[];return uH.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const _c={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:tC(4,13),y:tC(5,14)};_c.translateX=_c.x;_c.translateY=_c.y;const Fa=new Set;let Pv=!1,Rv=!1;function AR(){if(Rv){const t=Array.from(Fa).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=dH(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,a])=>{var c;(c=r.getValue(i))===null||c===void 0||c.set(a)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Rv=!1,Pv=!1,Fa.forEach(t=>t.complete()),Fa.clear()}function TR(){Fa.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Rv=!0)})}function hH(){TR(),AR()}class aw{constructor(e,n,r,s,i,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Fa.add(this),Pv||(Pv=!0,Ut.read(TR),Ut.resolveKeyframes(AR))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){const a=s?.get(),c=e[e.length-1];if(a!==void 0)e[0]=a;else if(r&&n){const u=r.readValue(n,c);u!=null&&(e[0]=u)}e[0]===void 0&&(e[0]=c),s&&a===void 0&&s.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Fa.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Fa.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const CR=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),fH=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function pH(t){const e=fH.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function SR(t,e,n=1){const[r,s]=pH(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const a=i.trim();return CR(a)?parseFloat(a):a}return $x(s)?SR(s,e,n+1):s}const kR=t=>e=>e.test(t),mH={test:t=>t==="auto",parse:t=>t},IR=[Fc,Ue,ii,Ao,sz,rz,mH],nC=t=>IR.find(kR(t));class PR extends aw{constructor(e,n,r,s,i){super(e,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<e.length;u++){let d=e[u];if(typeof d=="string"&&(d=d.trim(),$x(d))){const f=SR(d,n.current);f!==void 0&&(e[u]=f),u===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!oR.has(r)||e.length!==2)return;const[s,i]=e,a=nC(s),c=nC(i);if(a!==c)if(ZT(a)&&ZT(c))for(let u=0;u<e.length;u++){const d=e[u];typeof d=="string"&&(e[u]=parseFloat(d))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)qz(e[s])&&r.push(s);r.length&&lH(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=_c[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var e;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const a=s.length-1,c=s[a];s[a]=_c[r](n.measureViewportBox(),window.getComputedStyle(n.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([u,d])=>{n.getValue(u).set(d)}),this.resolveNoneKeyframes()}}const rC=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Wo.test(t)||t==="0")&&!t.startsWith("url("));function gH(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function yH(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],a=rC(s,e),c=rC(i,e);return!a||!c?!1:gH(t)||(n==="spring"||Qx(n))&&r}const vH=t=>t!==null;function n0(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(vH),i=e&&n!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const _H=40;class RR{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a="loop",...c}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=oi.now(),this.options={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:a,...c},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>_H?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&hH(),this._resolved}onKeyframesResolved(e,n){this.resolvedAt=oi.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:a,onComplete:c,onUpdate:u,isGenerator:d}=this.options;if(!d&&!yH(e,r,s,i))if(a)this.options.duration=0;else{u&&u(n0(e,this.options,n)),c&&c(),this.resolveFinishedPromise();return}const f=this.initPlayback(e,n);f!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...f},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const Gt=(t,e,n)=>t+(e-t)*n;function vy(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function xH({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,a=0;if(!e)s=i=a=n;else{const c=n<.5?n*(1+e):n+e-n*e,u=2*n-c;s=vy(u,c,t+1/3),i=vy(u,c,t),a=vy(u,c,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:r}}function cm(t,e){return n=>n>0?e:t}const _y=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},wH=[kv,Ra,Jl],EH=t=>wH.find(e=>e.test(t));function sC(t){const e=EH(t);if(!e)return!1;let n=e.parse(t);return e===Jl&&(n=xH(n)),n}const iC=(t,e)=>{const n=sC(t),r=sC(e);if(!n||!r)return cm(t,e);const s={...n};return i=>(s.red=_y(n.red,r.red,i),s.green=_y(n.green,r.green,i),s.blue=_y(n.blue,r.blue,i),s.alpha=Gt(n.alpha,r.alpha,i),Ra.transform(s))},bH=(t,e)=>n=>e(t(n)),Wd=(...t)=>t.reduce(bH),Dv=new Set(["none","hidden"]);function AH(t,e){return Dv.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function TH(t,e){return n=>Gt(t,e,n)}function lw(t){return typeof t=="number"?TH:typeof t=="string"?$x(t)?cm:sr.test(t)?iC:kH:Array.isArray(t)?DR:typeof t=="object"?sr.test(t)?iC:CH:cm}function DR(t,e){const n=[...t],r=n.length,s=t.map((i,a)=>lw(i)(i,e[a]));return i=>{for(let a=0;a<r;a++)n[a]=s[a](i);return n}}function CH(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=lw(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function SH(t,e){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const a=e.types[i],c=t.indexes[a][s[a]],u=(n=t.values[c])!==null&&n!==void 0?n:0;r[i]=u,s[a]++}return r}const kH=(t,e)=>{const n=Wo.createTransformer(e),r=bd(t),s=bd(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Dv.has(t)&&!s.values.length||Dv.has(e)&&!r.values.length?AH(t,e):Wd(DR(SH(r,s),s.values),n):cm(t,e)};function NR(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Gt(t,e,n):lw(t)(t,e)}const IH=5;function OR(t,e,n){const r=Math.max(e-IH,0);return aR(n-t(r),e-r)}const Xt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},xy=.001;function PH({duration:t=Xt.duration,bounce:e=Xt.bounce,velocity:n=Xt.velocity,mass:r=Xt.mass}){let s,i,a=1-e;a=Ki(Xt.minDamping,Xt.maxDamping,a),t=Ki(Xt.minDuration,Xt.maxDuration,Vi(t)),a<1?(s=d=>{const f=d*a,g=f*t,y=f-n,x=Nv(d,a),b=Math.exp(-g);return xy-y/x*b},i=d=>{const g=d*a*t,y=g*n+n,x=Math.pow(a,2)*Math.pow(d,2)*t,b=Math.exp(-g),E=Nv(Math.pow(d,2),a);return(-s(d)+xy>0?-1:1)*((y-x)*b)/E}):(s=d=>{const f=Math.exp(-d*t),g=(d-n)*t+1;return-xy+f*g},i=d=>{const f=Math.exp(-d*t),g=(n-d)*(t*t);return f*g});const c=5/t,u=DH(s,i,c);if(t=Bi(t),isNaN(u))return{stiffness:Xt.stiffness,damping:Xt.damping,duration:t};{const d=Math.pow(u,2)*r;return{stiffness:d,damping:a*2*Math.sqrt(r*d),duration:t}}}const RH=12;function DH(t,e,n){let r=n;for(let s=1;s<RH;s++)r=r-t(r)/e(r);return r}function Nv(t,e){return t*Math.sqrt(1-e*e)}const NH=["duration","bounce"],OH=["stiffness","damping","mass"];function oC(t,e){return e.some(n=>t[n]!==void 0)}function LH(t){let e={velocity:Xt.velocity,stiffness:Xt.stiffness,damping:Xt.damping,mass:Xt.mass,isResolvedFromDuration:!1,...t};if(!oC(t,OH)&&oC(t,NH))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*Ki(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Xt.mass,stiffness:s,damping:i}}else{const n=PH(t);e={...e,...n,mass:Xt.mass},e.isResolvedFromDuration=!0}return e}function LR(t=Xt.visualDuration,e=Xt.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],c={done:!1,value:i},{stiffness:u,damping:d,mass:f,duration:g,velocity:y,isResolvedFromDuration:x}=LH({...n,velocity:-Vi(n.velocity||0)}),b=y||0,E=d/(2*Math.sqrt(u*f)),w=a-i,R=Vi(Math.sqrt(u/f)),C=Math.abs(w)<5;r||(r=C?Xt.restSpeed.granular:Xt.restSpeed.default),s||(s=C?Xt.restDelta.granular:Xt.restDelta.default);let k;if(E<1){const V=Nv(R,E);k=$=>{const D=Math.exp(-E*R*$);return a-D*((b+E*R*w)/V*Math.sin(V*$)+w*Math.cos(V*$))}}else if(E===1)k=V=>a-Math.exp(-R*V)*(w+(b+R*w)*V);else{const V=R*Math.sqrt(E*E-1);k=$=>{const D=Math.exp(-E*R*$),I=Math.min(V*$,300);return a-D*((b+E*R*w)*Math.sinh(I)+V*w*Math.cosh(I))/V}}const N={calculatedDuration:x&&g||null,next:V=>{const $=k(V);if(x)c.done=V>=g;else{let D=0;E<1&&(D=V===0?Bi(b):OR(k,V,$));const I=Math.abs(D)<=r,B=Math.abs(a-$)<=s;c.done=I&&B}return c.value=c.done?a:$,c},toString:()=>{const V=Math.min(ZP(N),Tv),$=eR(D=>N.next(V*D).value,V,30);return V+"ms "+$}};return N}function aC({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:c,max:u,restDelta:d=.5,restSpeed:f}){const g=t[0],y={done:!1,value:g},x=I=>c!==void 0&&I<c||u!==void 0&&I>u,b=I=>c===void 0?u:u===void 0||Math.abs(c-I)<Math.abs(u-I)?c:u;let E=n*e;const w=g+E,R=a===void 0?w:a(w);R!==w&&(E=R-g);const C=I=>-E*Math.exp(-I/r),k=I=>R+C(I),N=I=>{const B=C(I),O=k(I);y.done=Math.abs(B)<=d,y.value=y.done?R:O};let V,$;const D=I=>{x(y.value)&&(V=I,$=LR({keyframes:[y.value,b(y.value)],velocity:OR(k,I,y.value),damping:s,stiffness:i,restDelta:d,restSpeed:f}))};return D(0),{calculatedDuration:null,next:I=>{let B=!1;return!$&&V===void 0&&(B=!0,N(I),D(I)),V!==void 0&&I>=V?$.next(I-V):(!B&&N(I),y)}}}const FH=qd(.42,0,1,1),jH=qd(0,0,.58,1),FR=qd(.42,0,.58,1),MH=t=>Array.isArray(t)&&typeof t[0]!="number",BH={linear:Jr,easeIn:FH,easeInOut:FR,easeOut:jH,circIn:rw,circInOut:gR,circOut:mR,backIn:nw,backInOut:fR,backOut:hR,anticipate:pR},lC=t=>{if(Jx(t)){NP(t.length===4);const[e,n,r,s]=t;return qd(e,n,r,s)}else if(typeof t=="string")return BH[t];return t};function VH(t,e,n){const r=[],s=n||NR,i=t.length-1;for(let a=0;a<i;a++){let c=s(t[a],t[a+1]);if(e){const u=Array.isArray(e)?e[a]||Jr:e;c=Wd(u,c)}r.push(c)}return r}function UH(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(NP(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const a=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const c=VH(e,r,s),u=c.length,d=f=>{if(a&&f<t[0])return e[0];let g=0;if(u>1)for(;g<t.length-2&&!(f<t[g+1]);g++);const y=yc(t[g],t[g+1],f);return c[g](y)};return n?f=>d(Ki(t[0],t[i-1],f)):d}function $H(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=yc(0,e,r);t.push(Gt(n,1,s))}}function zH(t){const e=[0];return $H(e,t.length-1),e}function HH(t,e){return t.map(n=>n*e)}function qH(t,e){return t.map(()=>e||FR).splice(0,t.length-1)}function um({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=MH(r)?r.map(lC):lC(r),i={done:!1,value:e[0]},a=HH(n&&n.length===e.length?n:zH(e),t),c=UH(a,e,{ease:Array.isArray(s)?s:qH(e,s)});return{calculatedDuration:t,next:u=>(i.value=c(u),i.done=u>=t,i)}}const WH=t=>{const e=({timestamp:n})=>t(n);return{start:()=>Ut.update(e,!0),stop:()=>qo(e),now:()=>Hn.isProcessing?Hn.timestamp:oi.now()}},GH={decay:aC,inertia:aC,tween:um,keyframes:um,spring:LR},KH=t=>t/100;class cw extends RR{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:u}=this.options;u&&u()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,a=s?.KeyframeResolver||aw,c=(u,d)=>this.onKeyframesResolved(u,d);this.resolver=new a(i,c,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:a=0}=this.options,c=Qx(n)?n:GH[n]||um;let u,d;c!==um&&typeof e[0]!="number"&&(u=Wd(KH,NR(e[0],e[1])),e=[0,100]);const f=c({...this.options,keyframes:e});i==="mirror"&&(d=c({...this.options,keyframes:[...e].reverse(),velocity:-a})),f.calculatedDuration===null&&(f.calculatedDuration=ZP(f));const{calculatedDuration:g}=f,y=g+s,x=y*(r+1)-s;return{generator:f,mirroredGenerator:d,mapPercentToKeyframes:u,calculatedDuration:g,resolvedDuration:y,totalDuration:x}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:r}=this;if(!r){const{keyframes:I}=this.options;return{done:!0,value:I[I.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:a,mapPercentToKeyframes:c,keyframes:u,calculatedDuration:d,totalDuration:f,resolvedDuration:g}=r;if(this.startTime===null)return i.next(0);const{delay:y,repeat:x,repeatType:b,repeatDelay:E,onUpdate:w}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-f/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const R=this.currentTime-y*(this.speed>=0?1:-1),C=this.speed>=0?R<0:R>f;this.currentTime=Math.max(R,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=f);let k=this.currentTime,N=i;if(x){const I=Math.min(this.currentTime,f)/g;let B=Math.floor(I),O=I%1;!O&&I>=1&&(O=1),O===1&&B--,B=Math.min(B,x+1),!!(B%2)&&(b==="reverse"?(O=1-O,E&&(O-=E/g)):b==="mirror"&&(N=a)),k=Ki(0,1,O)*g}const V=C?{done:!1,value:u[0]}:N.next(k);c&&(V.value=c(V.value));let{done:$}=V;!C&&d!==null&&($=this.speed>=0?this.currentTime>=f:this.currentTime<=0);const D=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&$);return D&&s!==void 0&&(V.value=n0(u,this.options,s)),w&&w(V.value),D&&this.finish(),V}get duration(){const{resolved:e}=this;return e?Vi(e.calculatedDuration):0}get time(){return Vi(this.currentTime)}set time(e){e=Bi(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Vi(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=WH,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const YH=new Set(["opacity","clipPath","filter","transform"]);function QH(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:c="easeInOut",times:u}={}){const d={[e]:n};u&&(d.offset=u);const f=nR(c,s);return Array.isArray(f)&&(d.easing=f),t.animate(d,{delay:r,duration:s,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"})}const JH=Lx(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),dm=10,XH=2e4;function ZH(t){return Qx(t.type)||t.type==="spring"||!tR(t.ease)}function eq(t,e){const n=new cw({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const s=[];let i=0;for(;!r.done&&i<XH;)r=n.sample(i),s.push(r.value),i+=dm;return{times:void 0,keyframes:s,duration:i-dm,ease:"linear"}}const jR={anticipate:pR,backInOut:fR,circInOut:gR};function tq(t){return t in jR}class cC extends RR{constructor(e){super(e);const{name:n,motionValue:r,element:s,keyframes:i}=this.options;this.resolver=new PR(i,(a,c)=>this.onKeyframesResolved(a,c),n,r,s),this.resolver.scheduleResolve()}initPlayback(e,n){let{duration:r=300,times:s,ease:i,type:a,motionValue:c,name:u,startTime:d}=this.options;if(!c.owner||!c.owner.current)return!1;if(typeof i=="string"&&lm()&&tq(i)&&(i=jR[i]),ZH(this.options)){const{onComplete:g,onUpdate:y,motionValue:x,element:b,...E}=this.options,w=eq(e,E);e=w.keyframes,e.length===1&&(e[1]=e[0]),r=w.duration,s=w.times,i=w.ease,a="keyframes"}const f=QH(c.owner.current,u,e,{...this.options,duration:r,times:s,ease:i});return f.startTime=d??this.calcStartTime(),this.pendingTimeline?(GT(f,this.pendingTimeline),this.pendingTimeline=void 0):f.onfinish=()=>{const{onComplete:g}=this.options;c.set(n0(e,this.options,n)),g&&g(),this.cancel(),this.resolveFinishedPromise()},{animation:f,duration:r,times:s,type:a,ease:i,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return Vi(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return Vi(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Bi(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:n}=e;return n.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return Jr;const{animation:r}=n;GT(r,e)}return Jr}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:r,duration:s,type:i,ease:a,times:c}=e;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:d,onUpdate:f,onComplete:g,element:y,...x}=this.options,b=new cw({...x,keyframes:r,duration:s,type:i,ease:a,times:c,isGenerator:!0}),E=Bi(this.time);d.setWithVelocity(b.sample(E-dm).value,b.sample(E).value,dm)}const{onStop:u}=this.options;u&&u(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:a,type:c}=e;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:d}=n.owner.getProps();return JH()&&r&&YH.has(r)&&!u&&!d&&!s&&i!=="mirror"&&a!==0&&c!=="inertia"}}const nq={type:"spring",stiffness:500,damping:25,restSpeed:10},rq=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),sq={type:"keyframes",duration:.8},iq={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},oq=(t,{keyframes:e})=>e.length>2?sq:el.has(t)?t.startsWith("scale")?rq(e[1]):nq:iq;function aq({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:c,from:u,elapsed:d,...f}){return!!Object.keys(f).length}const uw=(t,e,n,r={},s,i)=>a=>{const c=Yx(r,t)||{},u=c.delay||r.delay||0;let{elapsed:d=0}=r;d=d-Bi(u);let f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...c,delay:-d,onUpdate:y=>{e.set(y),c.onUpdate&&c.onUpdate(y)},onComplete:()=>{a(),c.onComplete&&c.onComplete()},name:t,motionValue:e,element:i?void 0:s};aq(c)||(f={...f,...oq(t,f)}),f.duration&&(f.duration=Bi(f.duration)),f.repeatDelay&&(f.repeatDelay=Bi(f.repeatDelay)),f.from!==void 0&&(f.keyframes[0]=f.from);let g=!1;if((f.type===!1||f.duration===0&&!f.repeatDelay)&&(f.duration=0,f.delay===0&&(g=!0)),g&&!i&&e.get()!==void 0){const y=n0(f.keyframes,c);if(y!==void 0)return Ut.update(()=>{f.onUpdate(y),f.onComplete()}),new Cz([])}return!i&&cC.supports(f)?new cC(f):new cw(f)};function lq({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function MR(t,e,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:a=t.getDefaultTransition(),transitionEnd:c,...u}=e;r&&(a=r);const d=[],f=s&&t.animationState&&t.animationState.getState()[s];for(const g in u){const y=t.getValue(g,(i=t.latestValues[g])!==null&&i!==void 0?i:null),x=u[g];if(x===void 0||f&&lq(f,g))continue;const b={delay:n,...Yx(a||{},g)};let E=!1;if(window.MotionHandoffAnimation){const R=lR(t);if(R){const C=window.MotionHandoffAnimation(R,g,Ut);C!==null&&(b.startTime=C,E=!0)}}Sv(t,g),y.start(uw(g,y,x,t.shouldReduceMotion&&oR.has(g)?{type:!1}:b,t,E));const w=y.animation;w&&d.push(w)}return c&&Promise.all(d).then(()=>{Ut.update(()=>{c&&Vz(t,c)})}),d}function Ov(t,e,n={}){var r;const s=t0(t,e,n.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const a=s?()=>Promise.all(MR(t,s,n)):()=>Promise.resolve(),c=t.variantChildren&&t.variantChildren.size?(d=0)=>{const{delayChildren:f=0,staggerChildren:g,staggerDirection:y}=i;return cq(t,e,f+d,g,y,n)}:()=>Promise.resolve(),{when:u}=i;if(u){const[d,f]=u==="beforeChildren"?[a,c]:[c,a];return d().then(()=>f())}else return Promise.all([a(),c(n.delay)])}function cq(t,e,n=0,r=0,s=1,i){const a=[],c=(t.variantChildren.size-1)*r,u=s===1?(d=0)=>d*r:(d=0)=>c-d*r;return Array.from(t.variantChildren).sort(uq).forEach((d,f)=>{d.notify("AnimationStart",e),a.push(Ov(d,e,{...i,delay:n+u(f)}).then(()=>d.notify("AnimationComplete",e)))}),Promise.all(a)}function uq(t,e){return t.sortNodePosition(e)}function dq(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>Ov(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=Ov(t,e,n);else{const s=typeof e=="function"?t0(t,e,n.custom):e;r=Promise.all(MR(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}const hq=jx.length;function BR(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?BR(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<hq;n++){const r=jx[n],s=t.props[r];(xd(s)||s===!1)&&(e[r]=s)}return e}const fq=[...Fx].reverse(),pq=Fx.length;function mq(t){return e=>Promise.all(e.map(({animation:n,options:r})=>dq(t,n,r)))}function gq(t){let e=mq(t),n=uC(),r=!0;const s=u=>(d,f)=>{var g;const y=t0(t,f,u==="exit"?(g=t.presenceContext)===null||g===void 0?void 0:g.custom:void 0);if(y){const{transition:x,transitionEnd:b,...E}=y;d={...d,...E,...b}}return d};function i(u){e=u(t)}function a(u){const{props:d}=t,f=BR(t.parent)||{},g=[],y=new Set;let x={},b=1/0;for(let w=0;w<pq;w++){const R=fq[w],C=n[R],k=d[R]!==void 0?d[R]:f[R],N=xd(k),V=R===u?C.isActive:null;V===!1&&(b=w);let $=k===f[R]&&k!==d[R]&&N;if($&&r&&t.manuallyAnimateOnMount&&($=!1),C.protectedKeys={...x},!C.isActive&&V===null||!k&&!C.prevProp||Zm(k)||typeof k=="boolean")continue;const D=yq(C.prevProp,k);let I=D||R===u&&C.isActive&&!$&&N||w>b&&N,B=!1;const O=Array.isArray(k)?k:[k];let F=O.reduce(s(R),{});V===!1&&(F={});const{prevResolvedValues:L={}}=C,M={...L,...F},se=le=>{I=!0,y.has(le)&&(B=!0,y.delete(le)),C.needsAnimating[le]=!0;const K=t.getValue(le);K&&(K.liveStyle=!1)};for(const le in M){const K=F[le],re=L[le];if(x.hasOwnProperty(le))continue;let ee=!1;Av(K)&&Av(re)?ee=!XP(K,re):ee=K!==re,ee?K!=null?se(le):y.add(le):K!==void 0&&y.has(le)?se(le):C.protectedKeys[le]=!0}C.prevProp=k,C.prevResolvedValues=F,C.isActive&&(x={...x,...F}),r&&t.blockInitialAnimation&&(I=!1),I&&(!($&&D)||B)&&g.push(...O.map(le=>({animation:le,options:{type:R}})))}if(y.size){const w={};y.forEach(R=>{const C=t.getBaseTarget(R),k=t.getValue(R);k&&(k.liveStyle=!0),w[R]=C??null}),g.push({animation:w})}let E=!!g.length;return r&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(E=!1),r=!1,E?e(g):Promise.resolve()}function c(u,d){var f;if(n[u].isActive===d)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(y=>{var x;return(x=y.animationState)===null||x===void 0?void 0:x.setActive(u,d)}),n[u].isActive=d;const g=a(u);for(const y in n)n[y].protectedKeys={};return g}return{animateChanges:a,setActive:c,setAnimateFunction:i,getState:()=>n,reset:()=>{n=uC(),r=!0}}}function yq(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!XP(e,t):!1}function Ea(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function uC(){return{animate:Ea(!0),whileInView:Ea(),whileHover:Ea(),whileTap:Ea(),whileDrag:Ea(),whileFocus:Ea(),exit:Ea()}}class Qo{constructor(e){this.isMounted=!1,this.node=e}update(){}}class vq extends Qo{constructor(e){super(e),e.animationState||(e.animationState=gq(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Zm(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let _q=0;class xq extends Qo{constructor(){super(...arguments),this.id=_q++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const wq={animation:{Feature:vq},exit:{Feature:xq}};function Ad(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Gd(t){return{point:{x:t.pageX,y:t.pageY}}}const Eq=t=>e=>Xx(e)&&t(e,Gd(e));function nd(t,e,n,r){return Ad(t,e,Eq(n),r)}const dC=(t,e)=>Math.abs(t-e);function bq(t,e){const n=dC(t.x,e.x),r=dC(t.y,e.y);return Math.sqrt(n**2+r**2)}class VR{constructor(e,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=Ey(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,x=bq(g.offset,{x:0,y:0})>=3;if(!y&&!x)return;const{point:b}=g,{timestamp:E}=Hn;this.history.push({...b,timestamp:E});const{onStart:w,onMove:R}=this.handlers;y||(w&&w(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),R&&R(this.lastMoveEvent,g)},this.handlePointerMove=(g,y)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=wy(y,this.transformPagePoint),Ut.update(this.updatePoint,!0)},this.handlePointerUp=(g,y)=>{this.end();const{onEnd:x,onSessionEnd:b,resumeAnimation:E}=this.handlers;if(this.dragSnapToOrigin&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=Ey(g.type==="pointercancel"?this.lastMoveEventInfo:wy(y,this.transformPagePoint),this.history);this.startEvent&&x&&x(g,w),b&&b(g,w)},!Xx(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const a=Gd(e),c=wy(a,this.transformPagePoint),{point:u}=c,{timestamp:d}=Hn;this.history=[{...u,timestamp:d}];const{onSessionStart:f}=n;f&&f(e,Ey(c,this.history)),this.removeListeners=Wd(nd(this.contextWindow,"pointermove",this.handlePointerMove),nd(this.contextWindow,"pointerup",this.handlePointerUp),nd(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),qo(this.updatePoint)}}function wy(t,e){return e?{point:e(t.point)}:t}function hC(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Ey({point:t},e){return{point:t,delta:hC(t,UR(e)),offset:hC(t,Aq(e)),velocity:Tq(e,.1)}}function Aq(t){return t[0]}function UR(t){return t[t.length-1]}function Tq(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=UR(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Bi(e)));)n--;if(!r)return{x:0,y:0};const i=Vi(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const a={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const $R=1e-4,Cq=1-$R,Sq=1+$R,zR=.01,kq=0-zR,Iq=0+zR;function Xr(t){return t.max-t.min}function Pq(t,e,n){return Math.abs(t-e)<=n}function fC(t,e,n,r=.5){t.origin=r,t.originPoint=Gt(e.min,e.max,t.origin),t.scale=Xr(n)/Xr(e),t.translate=Gt(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Cq&&t.scale<=Sq||isNaN(t.scale))&&(t.scale=1),(t.translate>=kq&&t.translate<=Iq||isNaN(t.translate))&&(t.translate=0)}function rd(t,e,n,r){fC(t.x,e.x,n.x,r?r.originX:void 0),fC(t.y,e.y,n.y,r?r.originY:void 0)}function pC(t,e,n){t.min=n.min+e.min,t.max=t.min+Xr(e)}function Rq(t,e,n){pC(t.x,e.x,n.x),pC(t.y,e.y,n.y)}function mC(t,e,n){t.min=e.min-n.min,t.max=t.min+Xr(e)}function sd(t,e,n){mC(t.x,e.x,n.x),mC(t.y,e.y,n.y)}function Dq(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?Gt(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?Gt(n,t,r.max):Math.min(t,n)),t}function gC(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function Nq(t,{top:e,left:n,bottom:r,right:s}){return{x:gC(t.x,n,s),y:gC(t.y,e,r)}}function yC(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function Oq(t,e){return{x:yC(t.x,e.x),y:yC(t.y,e.y)}}function Lq(t,e){let n=.5;const r=Xr(t),s=Xr(e);return s>r?n=yc(e.min,e.max-r,t.min):r>s&&(n=yc(t.min,t.max-s,e.min)),Ki(0,1,n)}function Fq(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Lv=.35;function jq(t=Lv){return t===!1?t=0:t===!0&&(t=Lv),{x:vC(t,"left","right"),y:vC(t,"top","bottom")}}function vC(t,e,n){return{min:_C(t,e),max:_C(t,n)}}function _C(t,e){return typeof t=="number"?t:t[e]||0}const xC=()=>({translate:0,scale:1,origin:0,originPoint:0}),Xl=()=>({x:xC(),y:xC()}),wC=()=>({min:0,max:0}),on=()=>({x:wC(),y:wC()});function us(t){return[t("x"),t("y")]}function HR({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Mq({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Bq(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function by(t){return t===void 0||t===1}function Fv({scale:t,scaleX:e,scaleY:n}){return!by(t)||!by(e)||!by(n)}function Ta(t){return Fv(t)||qR(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function qR(t){return EC(t.x)||EC(t.y)}function EC(t){return t&&t!=="0%"}function hm(t,e,n){const r=t-n,s=e*r;return n+s}function bC(t,e,n,r,s){return s!==void 0&&(t=hm(t,s,r)),hm(t,n,r)+e}function jv(t,e=0,n=1,r,s){t.min=bC(t.min,e,n,r,s),t.max=bC(t.max,e,n,r,s)}function WR(t,{x:e,y:n}){jv(t.x,e.translate,e.scale,e.originPoint),jv(t.y,n.translate,n.scale,n.originPoint)}const AC=.999999999999,TC=1.0000000000001;function Vq(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let i,a;for(let c=0;c<s;c++){i=n[c],a=i.projectionDelta;const{visualElement:u}=i.options;u&&u.props.style&&u.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&ec(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),a&&(e.x*=a.x.scale,e.y*=a.y.scale,WR(t,a)),r&&Ta(i.latestValues)&&ec(t,i.latestValues))}e.x<TC&&e.x>AC&&(e.x=1),e.y<TC&&e.y>AC&&(e.y=1)}function Zl(t,e){t.min=t.min+e,t.max=t.max+e}function CC(t,e,n,r,s=.5){const i=Gt(t.min,t.max,s);jv(t,e,n,i,r)}function ec(t,e){CC(t.x,e.x,e.scaleX,e.scale,e.originX),CC(t.y,e.y,e.scaleY,e.scale,e.originY)}function GR(t,e){return HR(Bq(t.getBoundingClientRect(),e))}function Uq(t,e,n){const r=GR(t,n),{scroll:s}=e;return s&&(Zl(r.x,s.offset.x),Zl(r.y,s.offset.y)),r}const KR=({current:t})=>t?t.ownerDocument.defaultView:null,$q=new WeakMap;class zq{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=on(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=f=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Gd(f).point)},i=(f,g)=>{const{drag:y,dragPropagation:x,onDragStart:b}=this.getProps();if(y&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Lz(y),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),us(w=>{let R=this.getAxisMotionValue(w).get()||0;if(ii.test(R)){const{projection:C}=this.visualElement;if(C&&C.layout){const k=C.layout.layoutBox[w];k&&(R=Xr(k)*(parseFloat(R)/100))}}this.originPoint[w]=R}),b&&Ut.postRender(()=>b(f,g)),Sv(this.visualElement,"transform");const{animationState:E}=this.visualElement;E&&E.setActive("whileDrag",!0)},a=(f,g)=>{const{dragPropagation:y,dragDirectionLock:x,onDirectionLock:b,onDrag:E}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:w}=g;if(x&&this.currentDirection===null){this.currentDirection=Hq(w),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",g.point,w),this.updateAxis("y",g.point,w),this.visualElement.render(),E&&E(f,g)},c=(f,g)=>this.stop(f,g),u=()=>us(f=>{var g;return this.getAnimationState(f)==="paused"&&((g=this.getAxisMotionValue(f).animation)===null||g===void 0?void 0:g.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new VR(e,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,contextWindow:KR(this.visualElement)})}stop(e,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&Ut.postRender(()=>i(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!Tf(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let a=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(a=Dq(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,i=this.constraints;n&&Ql(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=Nq(s.layoutBox,n):this.constraints=!1,this.elastic=jq(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&us(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=Fq(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Ql(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=Uq(r,s.root,this.visualElement.getTransformPagePoint());let a=Oq(s.layout.layoutBox,i);if(n){const c=n(Mq(a));this.hasMutatedConstraints=!!c,c&&(a=HR(c))}return a}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},d=us(f=>{if(!Tf(f,n,this.currentDirection))return;let g=u&&u[f]||{};a&&(g={min:0,max:0});const y=s?200:1e6,x=s?40:1e7,b={type:"inertia",velocity:r?e[f]:0,bounceStiffness:y,bounceDamping:x,timeConstant:750,restDelta:1,restSpeed:10,...i,...g};return this.startAxisValueAnimation(f,b)});return Promise.all(d).then(c)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return Sv(this.visualElement,e),r.start(uw(e,r,0,n,this.visualElement,!1))}stopAnimation(){us(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){us(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){us(n=>{const{drag:r}=this.getProps();if(!Tf(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:c}=s.layout.layoutBox[n];i.set(e[n]-Gt(a,c,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Ql(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};us(a=>{const c=this.getAxisMotionValue(a);if(c&&this.constraints!==!1){const u=c.get();s[a]=Lq({min:u,max:u},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),us(a=>{if(!Tf(a,e,null))return;const c=this.getAxisMotionValue(a),{min:u,max:d}=this.constraints[a];c.set(Gt(u,d,s[a]))})}addListeners(){if(!this.visualElement.current)return;$q.set(this.visualElement,this);const e=this.visualElement.current,n=nd(e,"pointerdown",u=>{const{drag:d,dragListener:f=!0}=this.getProps();d&&f&&this.start(u)}),r=()=>{const{dragConstraints:u}=this.getProps();Ql(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Ut.read(r);const a=Ad(window,"resize",()=>this.scalePositionWithinConstraints()),c=s.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(us(f=>{const g=this.getAxisMotionValue(f);g&&(this.originPoint[f]+=u[f].translate,g.set(g.get()+u[f].translate))}),this.visualElement.render())}));return()=>{a(),n(),i(),c&&c()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:a=Lv,dragMomentum:c=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:a,dragMomentum:c}}}function Tf(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Hq(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class qq extends Qo{constructor(e){super(e),this.removeGroupControls=Jr,this.removeListeners=Jr,this.controls=new zq(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Jr}unmount(){this.removeGroupControls(),this.removeListeners()}}const SC=t=>(e,n)=>{t&&Ut.postRender(()=>t(e,n))};class Wq extends Qo{constructor(){super(...arguments),this.removePointerDownListener=Jr}onPointerDown(e){this.session=new VR(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:KR(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:SC(e),onStart:SC(n),onMove:r,onEnd:(i,a)=>{delete this.session,s&&Ut.postRender(()=>s(i,a))}}}mount(){this.removePointerDownListener=nd(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Dp={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function kC(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Pu={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Ue.test(t))t=parseFloat(t);else return t;const n=kC(t,e.target.x),r=kC(t,e.target.y);return`${n}% ${r}%`}},Gq={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=Wo.parse(t);if(s.length>5)return r;const i=Wo.createTransformer(t),a=typeof s[0]!="number"?1:0,c=n.x.scale*e.x,u=n.y.scale*e.y;s[0+a]/=c,s[1+a]/=u;const d=Gt(c,u,.5);return typeof s[2+a]=="number"&&(s[2+a]/=d),typeof s[3+a]=="number"&&(s[3+a]/=d),i(s)}};class Kq extends S.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;pz(Yq),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Dp.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,a=r.projection;return a&&(a.isPresent=i,s||e.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||Ut.postRender(()=>{const c=a.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Bx.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function YR(t){const[e,n]=RP(),r=S.useContext(Rx);return v.jsx(Kq,{...t,layoutGroup:r,switchLayoutGroup:S.useContext(BP),isPresent:e,safeToRemove:n})}const Yq={borderRadius:{...Pu,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Pu,borderTopRightRadius:Pu,borderBottomLeftRadius:Pu,borderBottomRightRadius:Pu,boxShadow:Gq};function Qq(t,e,n){const r=ar(t)?t:Ed(t);return r.start(uw("",r,e,n)),r.animation}function Jq(t){return t instanceof SVGElement&&t.tagName!=="svg"}const Xq=(t,e)=>t.depth-e.depth;class Zq{constructor(){this.children=[],this.isDirty=!1}add(e){Zx(this.children,e),this.isDirty=!0}remove(e){ew(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Xq),this.isDirty=!1,this.children.forEach(e)}}function eW(t,e){const n=oi.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(qo(r),t(i-e))};return Ut.read(r,!0),()=>qo(r)}const QR=["TopLeft","TopRight","BottomLeft","BottomRight"],tW=QR.length,IC=t=>typeof t=="string"?parseFloat(t):t,PC=t=>typeof t=="number"||Ue.test(t);function nW(t,e,n,r,s,i){s?(t.opacity=Gt(0,n.opacity!==void 0?n.opacity:1,rW(r)),t.opacityExit=Gt(e.opacity!==void 0?e.opacity:1,0,sW(r))):i&&(t.opacity=Gt(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;a<tW;a++){const c=`border${QR[a]}Radius`;let u=RC(e,c),d=RC(n,c);if(u===void 0&&d===void 0)continue;u||(u=0),d||(d=0),u===0||d===0||PC(u)===PC(d)?(t[c]=Math.max(Gt(IC(u),IC(d),r),0),(ii.test(d)||ii.test(u))&&(t[c]+="%")):t[c]=d}(e.rotate||n.rotate)&&(t.rotate=Gt(e.rotate||0,n.rotate||0,r))}function RC(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const rW=JR(0,.5,mR),sW=JR(.5,.95,Jr);function JR(t,e,n){return r=>r<t?0:r>e?1:n(yc(t,e,r))}function DC(t,e){t.min=e.min,t.max=e.max}function cs(t,e){DC(t.x,e.x),DC(t.y,e.y)}function NC(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function OC(t,e,n,r,s){return t-=e,t=hm(t,1/n,r),s!==void 0&&(t=hm(t,1/s,r)),t}function iW(t,e=0,n=1,r=.5,s,i=t,a=t){if(ii.test(e)&&(e=parseFloat(e),e=Gt(a.min,a.max,e/100)-a.min),typeof e!="number")return;let c=Gt(i.min,i.max,r);t===i&&(c-=e),t.min=OC(t.min,e,n,c,s),t.max=OC(t.max,e,n,c,s)}function LC(t,e,[n,r,s],i,a){iW(t,e[n],e[r],e[s],e.scale,i,a)}const oW=["x","scaleX","originX"],aW=["y","scaleY","originY"];function FC(t,e,n,r){LC(t.x,e,oW,n?n.x:void 0,r?r.x:void 0),LC(t.y,e,aW,n?n.y:void 0,r?r.y:void 0)}function jC(t){return t.translate===0&&t.scale===1}function XR(t){return jC(t.x)&&jC(t.y)}function MC(t,e){return t.min===e.min&&t.max===e.max}function lW(t,e){return MC(t.x,e.x)&&MC(t.y,e.y)}function BC(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function ZR(t,e){return BC(t.x,e.x)&&BC(t.y,e.y)}function VC(t){return Xr(t.x)/Xr(t.y)}function UC(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class cW{constructor(){this.members=[]}add(e){Zx(this.members,e),e.scheduleRender()}remove(e){if(ew(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function uW(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,a=n?.z||0;if((s||i||a)&&(r=`translate3d(${s}px, ${i}px, ${a}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:d,rotate:f,rotateX:g,rotateY:y,skewX:x,skewY:b}=n;d&&(r=`perspective(${d}px) ${r}`),f&&(r+=`rotate(${f}deg) `),g&&(r+=`rotateX(${g}deg) `),y&&(r+=`rotateY(${y}deg) `),x&&(r+=`skewX(${x}deg) `),b&&(r+=`skewY(${b}deg) `)}const c=t.x.scale*e.x,u=t.y.scale*e.y;return(c!==1||u!==1)&&(r+=`scale(${c}, ${u})`),r||"none"}const Ca={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},$u=typeof window<"u"&&window.MotionDebug!==void 0,Ay=["","X","Y","Z"],dW={visibility:"hidden"},$C=1e3;let hW=0;function Ty(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function eD(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=lR(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Ut,!(s||i))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&eD(r)}function tD({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},c=e?.()){this.id=hW++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,$u&&(Ca.totalNodes=Ca.resolvedTargetDeltas=Ca.recalculatedProjection=0),this.nodes.forEach(mW),this.nodes.forEach(xW),this.nodes.forEach(wW),this.nodes.forEach(gW),$u&&window.MotionDebug.record(Ca)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new Zq)}addEventListener(a,c){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new tw),this.eventHandlers.get(a).add(c)}notifyListeners(a,...c){const u=this.eventHandlers.get(a);u&&u.notify(...c)}hasListeners(a){return this.eventHandlers.has(a)}mount(a,c=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=Jq(a),this.instance=a;const{layoutId:u,layout:d,visualElement:f}=this.options;if(f&&!f.current&&f.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),c&&(d||u)&&(this.isLayoutDirty=!0),t){let g;const y=()=>this.root.updateBlockedByResize=!1;t(a,()=>{this.root.updateBlockedByResize=!0,g&&g(),g=eW(y,250),Dp.hasAnimatedSinceResize&&(Dp.hasAnimatedSinceResize=!1,this.nodes.forEach(HC))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&f&&(u||d)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:y,hasRelativeTargetChanged:x,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const E=this.options.transition||f.getDefaultTransition()||CW,{onLayoutAnimationStart:w,onLayoutAnimationComplete:R}=f.getProps(),C=!this.targetLayout||!ZR(this.targetLayout,b)||x,k=!y&&x;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||k||y&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(g,k);const N={...Yx(E,"layout"),onPlay:w,onComplete:R};(f.shouldReduceMotion||this.options.layoutRoot)&&(N.delay=0,N.type=!1),this.startAnimation(N)}else y||HC(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,qo(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(EW),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&eD(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f<this.path.length;f++){const g=this.path[f];g.shouldResetTransform=!0,g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:c,layout:u}=this.options;if(c===void 0&&!u)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(zC);return}this.isUpdating||this.nodes.forEach(vW),this.isUpdating=!1,this.nodes.forEach(_W),this.nodes.forEach(fW),this.nodes.forEach(pW),this.clearAllSnapshots();const c=oi.now();Hn.delta=Ki(0,1e3/60,c-Hn.timestamp),Hn.timestamp=c,Hn.isProcessing=!0,my.update.process(Hn),my.preRender.process(Hn),my.render.process(Hn),Hn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Bx.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(yW),this.sharedNodes.forEach(bW)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ut.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ut.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u<this.path.length;u++)this.path[u].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutCorrected=on(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:c}=this.options;c&&c.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(c=!1),c){const u=r(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:u,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!s)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!XR(this.projectionDelta),u=this.getTransformTemplate(),d=u?u(this.latestValues,""):void 0,f=d!==this.prevTransformTemplateValue;a&&(c||Ta(this.latestValues)||f)&&(s(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const c=this.measurePageBox();let u=this.removeElementScroll(c);return a&&(u=this.removeTransform(u)),SW(u),{animationId:this.root.animationId,measuredBox:c,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){var a;const{visualElement:c}=this.options;if(!c)return on();const u=c.measureViewportBox();if(!(((a=this.scroll)===null||a===void 0?void 0:a.wasRoot)||this.path.some(kW))){const{scroll:f}=this.root;f&&(Zl(u.x,f.offset.x),Zl(u.y,f.offset.y))}return u}removeElementScroll(a){var c;const u=on();if(cs(u,a),!((c=this.scroll)===null||c===void 0)&&c.wasRoot)return u;for(let d=0;d<this.path.length;d++){const f=this.path[d],{scroll:g,options:y}=f;f!==this.root&&g&&y.layoutScroll&&(g.wasRoot&&cs(u,a),Zl(u.x,g.offset.x),Zl(u.y,g.offset.y))}return u}applyTransform(a,c=!1){const u=on();cs(u,a);for(let d=0;d<this.path.length;d++){const f=this.path[d];!c&&f.options.layoutScroll&&f.scroll&&f!==f.root&&ec(u,{x:-f.scroll.offset.x,y:-f.scroll.offset.y}),Ta(f.latestValues)&&ec(u,f.latestValues)}return Ta(this.latestValues)&&ec(u,this.latestValues),u}removeTransform(a){const c=on();cs(c,a);for(let u=0;u<this.path.length;u++){const d=this.path[u];if(!d.instance||!Ta(d.latestValues))continue;Fv(d.latestValues)&&d.updateSnapshot();const f=on(),g=d.measurePageBox();cs(f,g),FC(c,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,f)}return Ta(this.latestValues)&&FC(c,this.latestValues),c}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Hn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var c;const u=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=u.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=u.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=u.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==u;if(!(a||d&&this.isSharedProjectionDirty||this.isProjectionDirty||!((c=this.parent)===null||c===void 0)&&c.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:g,layoutId:y}=this.options;if(!(!this.layout||!(g||y))){if(this.resolvedRelativeTargetAt=Hn.timestamp,!this.targetDelta&&!this.relativeTarget){const x=this.getClosestProjectingParent();x&&x.layout&&this.animationProgress!==1?(this.relativeParent=x,this.forceRelativeParentToResolveTarget(),this.relativeTarget=on(),this.relativeTargetOrigin=on(),sd(this.relativeTargetOrigin,this.layout.layoutBox,x.layout.layoutBox),cs(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=on(),this.targetWithTransforms=on()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Rq(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):cs(this.target,this.layout.layoutBox),WR(this.target,this.targetDelta)):cs(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const x=this.getClosestProjectingParent();x&&!!x.resumingFrom==!!this.resumingFrom&&!x.options.layoutScroll&&x.target&&this.animationProgress!==1?(this.relativeParent=x,this.forceRelativeParentToResolveTarget(),this.relativeTarget=on(),this.relativeTargetOrigin=on(),sd(this.relativeTargetOrigin,this.target,x.target),cs(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}$u&&Ca.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Fv(this.parent.latestValues)||qR(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var a;const c=this.getLead(),u=!!this.resumingFrom||this!==c;let d=!0;if((this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty)&&(d=!1),u&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===Hn.timestamp&&(d=!1),d)return;const{layout:f,layoutId:g}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(f||g))return;cs(this.layoutCorrected,this.layout.layoutBox);const y=this.treeScale.x,x=this.treeScale.y;Vq(this.layoutCorrected,this.treeScale,this.path,u),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=on());const{target:b}=c;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(NC(this.prevProjectionDelta.x,this.projectionDelta.x),NC(this.prevProjectionDelta.y,this.projectionDelta.y)),rd(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==y||this.treeScale.y!==x||!UC(this.projectionDelta.x,this.prevProjectionDelta.x)||!UC(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b)),$u&&Ca.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var c;if((c=this.options.visualElement)===null||c===void 0||c.scheduleRender(),a){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Xl(),this.projectionDelta=Xl(),this.projectionDeltaWithTransform=Xl()}setAnimationOrigin(a,c=!1){const u=this.snapshot,d=u?u.latestValues:{},f={...this.latestValues},g=Xl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const y=on(),x=u?u.source:void 0,b=this.layout?this.layout.source:void 0,E=x!==b,w=this.getStack(),R=!w||w.members.length<=1,C=!!(E&&!R&&this.options.crossfade===!0&&!this.path.some(TW));this.animationProgress=0;let k;this.mixTargetDelta=N=>{const V=N/1e3;qC(g.x,a.x,V),qC(g.y,a.y,V),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sd(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),AW(this.relativeTarget,this.relativeTargetOrigin,y,V),k&&lW(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=on()),cs(k,this.relativeTarget)),E&&(this.animationValues=f,nW(f,d,this.latestValues,V,C,R)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=V},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(qo(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ut.update(()=>{Dp.hasAnimatedSinceResize=!0,this.currentAnimation=Qq(0,$C,{...a,onUpdate:c=>{this.mixTargetDelta(c),a.onUpdate&&a.onUpdate(c)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta($C),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:c,target:u,layout:d,latestValues:f}=a;if(!(!c||!u||!d)){if(this!==a&&this.layout&&d&&nD(this.options.animationType,this.layout.layoutBox,d.layoutBox)){u=this.target||on();const g=Xr(this.layout.layoutBox.x);u.x.min=a.target.x.min,u.x.max=u.x.min+g;const y=Xr(this.layout.layoutBox.y);u.y.min=a.target.y.min,u.y.max=u.y.min+y}cs(c,u),ec(c,f),rd(this.projectionDeltaWithTransform,this.layoutCorrected,c,f)}}registerSharedNode(a,c){this.sharedNodes.has(a)||this.sharedNodes.set(a,new cW),this.sharedNodes.get(a).add(c);const d=c.options.initialPromotionConfig;c.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(c):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:c}=this.options;return c?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:c}=this.options;return c?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:c,preserveFollowOpacity:u}={}){const d=this.getStack();d&&d.promote(this,u),a&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let c=!1;const{latestValues:u}=a;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(c=!0),!c)return;const d={};u.z&&Ty("z",a,d,this.animationValues);for(let f=0;f<Ay.length;f++)Ty(`rotate${Ay[f]}`,a,d,this.animationValues),Ty(`skew${Ay[f]}`,a,d,this.animationValues);a.render();for(const f in d)a.setStaticValue(f,d[f]),this.animationValues&&(this.animationValues[f]=d[f]);a.scheduleRender()}getProjectionStyles(a){var c,u;if(!this.instance||this.isSVG)return;if(!this.isVisible)return dW;const d={visibility:""},f=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,d.opacity="",d.pointerEvents=Pp(a?.pointerEvents)||"",d.transform=f?f(this.latestValues,""):"none",d;const g=this.getLead();if(!this.projectionDelta||!this.layout||!g.target){const E={};return this.options.layoutId&&(E.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,E.pointerEvents=Pp(a?.pointerEvents)||""),this.hasProjected&&!Ta(this.latestValues)&&(E.transform=f?f({},""):"none",this.hasProjected=!1),E}const y=g.animationValues||g.latestValues;this.applyTransformsToTarget(),d.transform=uW(this.projectionDeltaWithTransform,this.treeScale,y),f&&(d.transform=f(y,d.transform));const{x,y:b}=this.projectionDelta;d.transformOrigin=`${x.origin*100}% ${b.origin*100}% 0`,g.animationValues?d.opacity=g===this?(u=(c=y.opacity)!==null&&c!==void 0?c:this.latestValues.opacity)!==null&&u!==void 0?u:1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:d.opacity=g===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const E in am){if(y[E]===void 0)continue;const{correct:w,applyTo:R}=am[E],C=d.transform==="none"?y[E]:w(y[E],g);if(R){const k=R.length;for(let N=0;N<k;N++)d[R[N]]=C}else d[E]=C}return this.options.layoutId&&(d.pointerEvents=g===this?Pp(a?.pointerEvents)||"":"none"),d}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var c;return(c=a.currentAnimation)===null||c===void 0?void 0:c.stop()}),this.root.nodes.forEach(zC),this.root.sharedNodes.clear()}}}function fW(t){t.updateLayout()}function pW(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:i}=t.options,a=n.source!==t.layout.source;i==="size"?us(g=>{const y=a?n.measuredBox[g]:n.layoutBox[g],x=Xr(y);y.min=r[g].min,y.max=y.min+x}):nD(i,n.layoutBox,r)&&us(g=>{const y=a?n.measuredBox[g]:n.layoutBox[g],x=Xr(r[g]);y.max=y.min+x,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[g].max=t.relativeTarget[g].min+x)});const c=Xl();rd(c,r,n.layoutBox);const u=Xl();a?rd(u,t.applyTransform(s,!0),n.measuredBox):rd(u,r,n.layoutBox);const d=!XR(c);let f=!1;if(!t.resumeFrom){const g=t.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:y,layout:x}=g;if(y&&x){const b=on();sd(b,n.layoutBox,y.layoutBox);const E=on();sd(E,r,x.layoutBox),ZR(b,E)||(f=!0),g.options.layoutRoot&&(t.relativeTarget=E,t.relativeTargetOrigin=b,t.relativeParent=g)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:u,layoutDelta:c,hasLayoutChanged:d,hasRelativeTargetChanged:f})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function mW(t){$u&&Ca.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function gW(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function yW(t){t.clearSnapshot()}function zC(t){t.clearMeasurements()}function vW(t){t.isLayoutDirty=!1}function _W(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function HC(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function xW(t){t.resolveTargetDelta()}function wW(t){t.calcProjection()}function EW(t){t.resetSkewAndRotation()}function bW(t){t.removeLeadSnapshot()}function qC(t,e,n){t.translate=Gt(e.translate,0,n),t.scale=Gt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function WC(t,e,n,r){t.min=Gt(e.min,n.min,r),t.max=Gt(e.max,n.max,r)}function AW(t,e,n,r){WC(t.x,e.x,n.x,r),WC(t.y,e.y,n.y,r)}function TW(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const CW={duration:.45,ease:[.4,0,.1,1]},GC=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),KC=GC("applewebkit/")&&!GC("chrome/")?Math.round:Jr;function YC(t){t.min=KC(t.min),t.max=KC(t.max)}function SW(t){YC(t.x),YC(t.y)}function nD(t,e,n){return t==="position"||t==="preserve-aspect"&&!Pq(VC(e),VC(n),.2)}function kW(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const IW=tD({attachResizeListener:(t,e)=>Ad(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Cy={current:void 0},rD=tD({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Cy.current){const t=new IW({});t.mount(window),t.setOptions({layoutScroll:!0}),Cy.current=t}return Cy.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),PW={pan:{Feature:Wq},drag:{Feature:qq,ProjectionNode:rD,MeasureLayout:YR}};function QC(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Ut.postRender(()=>i(e,Gd(e)))}class RW extends Qo{mount(){const{current:e}=this.node;e&&(this.unmount=Pz(e,n=>(QC(this.node,n,"Start"),r=>QC(this.node,r,"End"))))}unmount(){}}class DW extends Qo{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Wd(Ad(this.node.current,"focus",()=>this.onFocus()),Ad(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function JC(t,e,n){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Ut.postRender(()=>i(e,Gd(e)))}class NW extends Qo{mount(){const{current:e}=this.node;e&&(this.unmount=Oz(e,n=>(JC(this.node,n,"Start"),(r,{success:s})=>JC(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Mv=new WeakMap,Sy=new WeakMap,OW=t=>{const e=Mv.get(t.target);e&&e(t)},LW=t=>{t.forEach(OW)};function FW({root:t,...e}){const n=t||document;Sy.has(n)||Sy.set(n,{});const r=Sy.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(LW,{root:t,...e})),r[s]}function jW(t,e,n){const r=FW(e);return Mv.set(t,n),r.observe(t),()=>{Mv.delete(t),r.unobserve(t)}}const MW={some:0,all:1};class BW extends Qo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:MW[s]},c=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:f,onViewportLeave:g}=this.node.getProps(),y=d?f:g;y&&y(u)};return jW(this.node.current,a,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(VW(e,n))&&this.startObserver()}unmount(){}}function VW({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const UW={inView:{Feature:BW},tap:{Feature:NW},focus:{Feature:DW},hover:{Feature:RW}},$W={layout:{ProjectionNode:rD,MeasureLayout:YR}},Bv={current:null},sD={current:!1};function zW(){if(sD.current=!0,!!Ox)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Bv.current=t.matches;t.addListener(e),e()}else Bv.current=!1}const HW=[...IR,sr,Wo],qW=t=>HW.find(kR(t)),XC=new WeakMap;function WW(t,e,n){for(const r in e){const s=e[r],i=n[r];if(ar(s))t.addValue(r,s);else if(ar(i))t.addValue(r,Ed(s,{owner:t}));else if(i!==s)if(t.hasValue(r)){const a=t.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=t.getStaticValue(r);t.addValue(r,Ed(a!==void 0?a:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const ZC=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class GW{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:a},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=aw,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const x=oi.now();this.renderScheduledAt<x&&(this.renderScheduledAt=x,Ut.render(this.render,!1,!0))};const{latestValues:u,renderState:d,onUpdate:f}=a;this.onUpdate=f,this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=d,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=c,this.blockInitialAnimation=!!i,this.isControllingVariants=e0(n),this.isVariantNode=jP(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:g,...y}=this.scrapeMotionValuesFromProps(n,{},this);for(const x in y){const b=y[x];u[x]!==void 0&&ar(b)&&b.set(u[x],!1)}}mount(e){this.current=e,XC.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),sD.current||zW(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Bv.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){XC.delete(this.current),this.projection&&this.projection.unmount(),qo(this.notifyUpdate),qo(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=el.has(e),s=n.on("change",c=>{this.latestValues[e]=c,this.props.onUpdate&&Ut.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i(),a&&a(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in vc){const n=vc[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):on()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<ZC.length;r++){const s=ZC[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,a=e[i];a&&(this.propEventSubscriptions[s]=this.on(s,a))}this.prevMotionValues=WW(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Ed(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){var r;let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(CR(s)||yR(s))?s=parseFloat(s):!qW(s)&&Wo.test(n)&&(s=bR(e,n)),this.setBaseTarget(e,ar(s)?s.get():s)),ar(s)?s.get():s}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const a=Ux(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(s=a[e])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!ar(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new tw),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class iD extends GW{constructor(){super(...arguments),this.KeyframeResolver=PR}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;ar(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function KW(t){return window.getComputedStyle(t)}class YW extends iD{constructor(){super(...arguments),this.type="html",this.renderInstance=WP}readValueFromInstance(e,n){if(el.has(n)){const r=ow(n);return r&&r.default||0}else{const r=KW(e),s=(zP(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return GR(e,n)}build(e,n,r){Hx(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return Kx(e,n,r)}}class QW extends iD{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=on}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(el.has(n)){const r=ow(n);return r&&r.default||0}return n=GP.has(n)?n:Mx(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return QP(e,n,r)}build(e,n,r){qx(e,n,this.isSVGTag,r.transformTemplate)}renderInstance(e,n,r,s){KP(e,n,r,s)}mount(e){this.isSVGTag=Gx(e.tagName),super.mount(e)}}const JW=(t,e)=>Vx(t)?new QW(e):new YW(e,{allowProjection:t!==S.Fragment}),XW=bz({...wq,...UW,...PW,...$W},JW),Vt=M$(XW);/**
3975 * @license lucide-react v0.469.0 - ISC
3976 *
3977 * This source code is licensed under the ISC license.
3978 * See the LICENSE file in the root directory of this source tree.
3979 */const ZW=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),oD=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/**
3980 * @license lucide-react v0.469.0 - ISC
3981 *
3982 * This source code is licensed under the ISC license.
3983 * See the LICENSE file in the root directory of this source tree.
3984 */var eG={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
3985 * @license lucide-react v0.469.0 - ISC
3986 *
3987 * This source code is licensed under the ISC license.
3988 * See the LICENSE file in the root directory of this source tree.
3989 */const tG=S.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:a,...c},u)=>S.createElement("svg",{ref:u,...eG,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:oD("lucide",s),...c},[...a.map(([d,f])=>S.createElement(d,f)),...Array.isArray(i)?i:[i]]));/**
3990 * @license lucide-react v0.469.0 - ISC
3991 *
3992 * This source code is licensed under the ISC license.
3993 * See the LICENSE file in the root directory of this source tree.
3994 */const Ke=(t,e)=>{const n=S.forwardRef(({className:r,...s},i)=>S.createElement(tG,{ref:i,iconNode:e,className:oD(`lucide-${ZW(t)}`,r),...s}));return n.displayName=`${t}`,n};/**
3995 * @license lucide-react v0.469.0 - ISC
3996 *
3997 * This source code is licensed under the ISC license.
3998 * See the LICENSE file in the root directory of this source tree.
3999 */const nG=Ke("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
4000 * @license lucide-react v0.469.0 - ISC
4001 *
4002 * This source code is licensed under the ISC license.
4003 * See the LICENSE file in the root directory of this source tree.
4004 */const jc=Ke("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}
4004],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
4005 * @license lucide-react v0.469.0 - ISC
4006 *
4007 * This source code is licensed under the ISC license.
4008 * See the LICENSE file in the root directory of this source tree.
4009 */const eS=Ke("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/**
4010 * @license lucide-react v0.469.0 - ISC
4011 *
4012 * This source code is licensed under the ISC license.
4013 * See the LICENSE file in the root directory of this source tree.
4014 */const Vv=Ke("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
4015 * @license lucide-react v0.469.0 - ISC
4016 *
4017 * This source code is licensed under the ISC license.
4018 * See the LICENSE file in the root directory of this source tree.
4019 */const Uv=Ke("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
4020 * @license lucide-react v0.469.0 - ISC
4021 *
4022 * This source code is licensed under the ISC license.
4023 * See the LICENSE file in the root directory of this source tree.
4024 */const Da=Ke("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),rG=1;let ky=0;function sG(){return ky=(ky+1)%Number.MAX_VALUE,ky.toString()}const gr={state:{toasts:[]},listeners:[],getState:()=>gr.state,setState:t=>{typeof t=="function"?gr.state=t(gr.state):gr.state={...gr.state,...t},gr.listeners.forEach(e=>e(gr.state))},subscribe:t=>(gr.listeners.push(t),()=>{gr.listeners=gr.listeners.filter(e=>e!==t)})},iG=({...t})=>{const e=sG(),n=s=>gr.setState(i=>({...i,toasts:i.toasts.map(a=>a.id===e?{...a,...s}:a)})),r=()=>gr.setState(s=>({...s,toasts:s.toasts.filter(i=>i.id!==e)}));return gr.setState(s=>({...s,toasts:[{...t,id:e,dismiss:r},...s.toasts].slice(0,rG)})),{id:e,dismiss:r,update:n}};function r0(){const[t,e]=S.useState(gr.getState());return S.useEffect(()=>gr.subscribe(r=>{e(r)}),[]),S.useEffect(()=>{const n=[];return t.toasts.forEach(r=>{if(r.duration===1/0)return;const s=setTimeout(()=>{r.dismiss()},r.duration||5e3);n.push(s)}),()=>{n.forEach(r=>clearTimeout(r))}},[t.toasts]),{toast:iG,toasts:t.toasts}}function aD(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=aD(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function lD(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=aD(t))&&(r&&(r+=" "),r+=e);return r}const dw="-",oG=t=>{const e=lG(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{const c=a.split(dw);return c[0]===""&&c.length!==1&&c.shift(),cD(c,e)||aG(a)},getConflictingClassGroupIds:(a,c)=>{const u=n[a]||[];return c&&r[a]?[...u,...r[a]]:u}}},cD=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),s=r?cD(t.slice(1),r):void 0;if(s)return s;if(e.validators.length===0)return;const i=t.join(dw);return e.validators.find(({validator:a})=>a(i))?.classGroupId},tS=/^\[(.+)\]$/,aG=t=>{if(tS.test(t)){const e=tS.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},lG=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return uG(Object.entries(t.classGroups),n).forEach(([i,a])=>{$v(a,r,i,e)}),r},$v=(t,e,n,r)=>{t.forEach(s=>{if(typeof s=="string"){const i=s===""?e:nS(e,s);i.classGroupId=n;return}if(typeof s=="function"){if(cG(s)){$v(s(r),e,n,r);return}e.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,a])=>{$v(a,nS(e,i),n,r)})})},nS=(t,e)=>{let n=t;return e.split(dw).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},cG=t=>t.isThemeGetter,uG=(t,e)=>e?t.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,c])=>[e+a,c])):i);return[n,s]}):t,dG=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const s=(i,a)=>{n.set(i,a),e++,e>t&&(e=0,r=n,n=new Map)};return{get(i){let a=n.get(i);if(a!==void 0)return a;
vendor: 4,270 bytes, line 4024
4024if((a=r.get(i))!==void 0)return s(i,a),a},set(i,a){n.has(i)?n.set(i,a):s(i,a)}}},uD="!",hG=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,s=e[0],i=e.length,a=c=>{const u=[];let d=0,f=0,g;for(let w=0;w<c.length;w++){let R=c[w];if(d===0){if(R===s&&(r||c.slice(w,w+i)===e)){u.push(c.slice(f,w)),f=w+i;continue}if(R==="/"){g=w;continue}}R==="["?d++:R==="]"&&d--}const y=u.length===0?c:c.substring(f),x=y.startsWith(uD),b=x?y.substring(1):y,E=g&&g>f?g-f:void 0;return{modifiers:u,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:E}};return n?c=>n({className:c,parseClassName:a}):a},fG=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},pG=t=>({cache:dG(t.cacheSize),parseClassName:hG(t),...oG(t)}),mG=/\s+/,gG=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=e,i=[],a=t.trim().split(mG);let c="";for(let u=a.length-1;u>=0;u-=1){const d=a[u],{modifiers:f,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:x}=n(d);let b=!!x,E=r(b?y.substring(0,x):y);if(!E){if(!b){c=d+(c.length>0?" "+c:c);continue}if(E=r(y),!E){c=d+(c.length>0?" "+c:c);continue}b=!1}const w=fG(f).join(":"),R=g?w+uD:w,C=R+E;if(i.includes(C))continue;i.push(C);const k=s(E,b);for(let N=0;N<k.length;++N){const V=k[N];i.push(R+V)}c=d+(c.length>0?" "+c:c)}return c};function yG(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=dD(e))&&(r&&(r+=" "),r+=n);return r}const dD=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=dD(t[r]))&&(n&&(n+=" "),n+=e);return n};function vG(t,...e){let n,r,s,i=a;function a(u){const d=e.reduce((f,g)=>g(f),t());return n=pG(d),r=n.cache.get,s=n.cache.set,i=c,c(u)}function c(u){const d=r(u);if(d)return d;const f=gG(u,n);return s(u,f),f}return function(){return i(yG.apply(null,arguments))}}const jt=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},hD=/^\[(?:([a-z-]+):)?(.+)\]$/i,_G=/^\d+\/\d+$/,xG=new Set(["px","full","screen"]),wG=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,EG=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,bG=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,AG=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TG=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Pi=t=>oc(t)||xG.has(t)||_G.test(t),Eo=t=>Mc(t,"length",NG),oc=t=>!!t&&!Number.isNaN(Number(t)),Iy=t=>Mc(t,"number",oc),Ru=t=>!!t&&Number.isInteger(Number(t)),CG=t=>t.endsWith("%")&&oc(t.slice(0,-1)),Je=t=>hD.test(t),bo=t=>wG.test(t),SG=new Set(["length","size","percentage"]),kG=t=>Mc(t,SG,fD),IG=t=>Mc(t,"position",fD),PG=new Set(["image","url"]),RG=t=>Mc(t,PG,LG),DG=t=>Mc(t,"",OG),Du=()=>!0,Mc=(t,e,n)=>{const r=hD.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},NG=t=>EG.test(t)&&!bG.test(t),fD=()=>!1,OG=t=>AG.test(t),LG=t=>TG.test(t),FG=()=>{const t=jt("colors"),e=jt("spacing"),n=jt("blur"),r=jt("brightness"),s=jt("borderColor"),i=jt("borderRadius"),a=jt("borderSpacing"),c=jt("borderWidth"),u=jt("contrast"),d=jt("grayscale"),f=jt("hueRotate"),g=jt("invert"),y=jt("gap"),x=jt("gradientColorStops"),b=jt("gradientColorStopPositions"),E=jt("inset"),w=jt("margin"),R=jt("opacity"),C=jt("padding"),k=jt("saturate"),N=jt("scale"),V=jt("sepia"),$=jt("skew"),D=jt("space"),I=jt("translate"),B=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto",Je,e],L=()=>[Je,e],M=()=>["",Pi,Eo],se=()=>["auto",oc,Je],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],J=()=>["solid","dashed","dotted","double","none"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],re=()=>["","0",Je],ee=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[oc,Je];return{cacheSize:500,separator:":",theme:{colors:[Du],spacing:[Pi,Eo],blur:["none","",bo,Je],brightness:U(),borderColor:[t],borderRadius:["n
4024one","","full",bo,Je],borderSpacing:L(),borderWidth:M(),contrast:U(),grayscale:re(),hueRotate:U(),invert:re(),gap:L(),gradientColorStops:[t],gradientColorStopPositions:[CG,Eo],inset:F(),margin:F(),opacity:U(),padding:L(),saturate:U(),scale:U(),sepia:re(),skew:U(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",Je]}],container:["container"],columns:[{columns:[bo]}],"break-after":[{"break-after":ee()}],"break-before":[{"break-before":ee()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...H(),Je]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[E]}],"inset-x":[{"inset-x":[E]}],"inset-y":[{"inset-y":[E]}],start:[{start:[E]}],end:[{end:[E]}],top:[{top:[E]}],right:[{right:[E]}],bottom:[{bottom:[E]}],left:[{left:[E]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ru,Je]}],basis:[{basis:F()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Je]}],grow:[{grow:re()}],shrink:[{shrink:re()}],order:[{order:["first","last","none",Ru,Je]}],"grid-cols":[{"grid-cols":[Du]}],"col-start-end":[{col:["auto",{span:["full",Ru,Je]},Je]}],"col-start":[{"col-start":se()}],"col-end":[{"col-end":se()}],"grid-rows":[{"grid-rows":[Du]}],"row-start-end":[{row:["auto",{span:[Ru,Je]},Je]}],"row-start":[{"row-start":se()}],"row-end":[{"row-end":se()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Je]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Je]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Je,e]}],"min-w":[{"min-w":[Je,e,"min","max","fit"]}],"max-w":[{"max-w":[Je,e,"none","full","min","max","fit","prose",{screen:[bo]},bo]}],h:[{h:[Je,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Je,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Je,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Je,e,"auto","min","max","fit"]}],"font-size":[{text:["base",bo,Eo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Iy]}],"font-family":[{font:[Du]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Je]}],"line-clamp":[{"line-clamp":["none",oc,Iy]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Pi,Je]}],"list-image":[{"list-image":["none",Je]}],"list-style-type":[{list:["none","disc","decimal",Je]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[R]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[R]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Pi,Eo]}],"underline-offset":[{"underline-offset":["auto",Pi,Je]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[R]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),IG]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",kG]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},RG]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[b]}
vendor: 5,182 bytes, line 4024
4024],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[R]}],"border-style":[{border:[...J(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[R]}],"divide-style":[{divide:J()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...J()]}],"outline-offset":[{"outline-offset":[Pi,Je]}],"outline-w":[{outline:[Pi,Eo]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[R]}],"ring-offset-w":[{"ring-offset":[Pi,Eo]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",bo,DG]}],"shadow-color":[{shadow:[Du]}],opacity:[{opacity:[R]}],"mix-blend":[{"mix-blend":[...le(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":le()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",bo,Je]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[g]}],saturate:[{saturate:[k]}],sepia:[{sepia:[V]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[R]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[V]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Je]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",Je]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",Je]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[N]}],"scale-x":[{"scale-x":[N]}],"scale-y":[{"scale-y":[N]}],rotate:[{rotate:[Ru,Je]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Je]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Je]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}
4024],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Je]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Pi,Eo,Iy]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},jG=vG(FG);function Et(...t){return jG(lD(t))}function rS(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function s0(...t){return e=>{let n=!1;const r=t.map(s=>{const i=rS(s,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():rS(t[s],null)}}}}function Wa(...t){return S.useCallback(s0(...t),t)}var MG=Symbol.for("react.lazy"),fm=kS[" use ".trim().toString()];function BG(t){return typeof t=="object"&&t!==null&&"then"in t}function pD(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===MG&&"_payload"in t&&BG(t._payload)}function VG(t){const e=$G(t),n=S.forwardRef((r,s)=>{let{children:i,...a}=r;pD(i)&&typeof fm=="function"&&(i=fm(i._payload));const c=S.Children.toArray(i),u=c.find(HG);if(u){const d=u.props.children,f=c.map(g=>g===u?S.Children.count(d)>1?S.Children.only(null):S.isValidElement(d)?d.props.children:null:g);return v.jsx(e,{...a,ref:s,children:S.isValidElement(d)?S.cloneElement(d,void 0,f):null})}return v.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}var UG=VG("Slot");function $G(t){const e=S.forwardRef((n,r)=>{let{children:s,...i}=n;if(pD(s)&&typeof fm=="function"&&(s=fm(s._payload)),S.isValidElement(s)){const a=WG(s),c=qG(i,s.props);return s.type!==S.Fragment&&(c.ref=r?s0(r,a):a),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var zG=Symbol("radix.slottable");function HG(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===zG}function qG(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const u=i(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}
4024:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function WG(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const sS=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,iS=lD,mD=(t,e)=>n=>{var r;if(e?.variants==null)return iS(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(d=>{const f=n?.[d],g=i?.[d];if(f===null)return null;const y=sS(f)||sS(g);return s[d][y]}),c=n&&Object.entries(n).reduce((d,f)=>{let[g,y]=f;return y===void 0||(d[g]=y),d},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:g,className:y,...x}=f;return Object.entries(x).every(b=>{let[E,w]=b;return Array.isArray(w)?w.includes({...i,...c}[E]):{...i,...c}[E]===w})?[...d,g,y]:d},[]);return iS(t,a,u,n?.class,n?.className)},GG=mD("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ac=Wn.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const a=r?UG:"button";return v.jsx(a,{className:Et(GG({variant:e,size:n,className:t})),ref:i,...s})});ac.displayName="Button";/**
4025 * @license lucide-react v0.469.0 - ISC
4026 *
4027 * This source code is licensed under the ISC license.
4028 * See the LICENSE file in the root directory of this source tree.
4029 */const i0=Ke("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
4030 * @license lucide-react v0.469.0 - ISC
4031 *
4032 * This source code is licensed under the ISC license.
4033 * See the LICENSE file in the root directory of this source tree.
4034 */const gD=Ke("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),Py=[{code:"en",label:"English",flag:"🇺🇸"},{code:"zh-CN",label:"简体中文",flag:"🇨🇳"},{code:"zh-TW",label:"繁體中文",flag:"🇹🇼"},{code:"es",label:"Español",flag:"🇪🇸"},{code:"fr",label:"Français",flag:"🇫🇷"},{code:"de",label:"Deutsch",flag:"🇩🇪"},{code:"it",label:"Italiano",flag:"🇮🇹"},{code:"pt",label:"Português",flag:"🇵🇹"},{code:"ru",label:"Русский",flag:"🇷🇺"},{code:"ja",label:"日本語",flag:"🇯🇵"},{code:"ko",label:"한국어",flag:"🇰🇷"},{code:"ar",label:"العربية",flag:"🇸🇦"},{code:"hi",label:"हिन्दी",flag:"🇮🇳"},{code:"th",label:"ไทย",flag:"🇹🇭"},{code:"vi",label:"Tiếng Việt",flag:"🇻🇳"},{code:"tl",label:"Filipino",flag:"🇵🇭"}],Ry="pda_lang";function KG(t){if(t==="en"){document.cookie="googtrans=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT";return}document.cookie=`googtrans=/en/${t}; path=/; max-age=31536000`}function oS(t){const e=document.querySelector(".goog-te-combo");return e?(e.value=t,e.dispatchEvent(new Event("change",{bubbles:!0})),!0):!1}const aS=()=>{const[t,e]=S.useState(!1),[n,r]=S.useState("en"),s=S.useRef(null),i=S.useMemo(()=>Py.find(c=>c.code===n)||Py[0],[n]);S.useEffect(()=>{const c=y=>{s.current&&!s.current.contains(y.target)&&e(!1)};document.addEventListener("mousedown",c);const u=Ip()?localStorage.getItem(Ry):null;u&&r(u);const d=()=>{if(!Ip())return;const y=document.querySelector(".goog-te-combo");y&&y.value&&(r(y.value),localStorage.setItem(Ry,y.value))};let f=0;const g=setInterval(()=>{f+=1,d(),(document.querySelector(".goog-te-combo")||f>=10)&&clearInterval(g)},300);return()=>{document.removeEventListener("mousedown",c),clearInterval(g)}},[]);const a=c=>{if(c!=="en"&&!Ip()){e(!1),window.dispatchEvent(new Event(im));return}if(r(c),localStorage.setItem(Ry,c),e(!1),KG(c),!oS(c)){let d=0;const f=setInterval(()=>{d+=1,(oS(c)||d>20)&&clearInterval(f)},200)}setTimeout(()=>{window.location.reload()},50)};return v.jsxs("div",{className:"relative z-50",ref:s,children:[v.jsxs("button",{onClick:()=>e(c=>!c),className:Et("flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-300 group border select-none relative overflow-hidden",t?"bg-gray-100 text-[#C41E3A] border-gray-200":"text-[#001F3F] hover:bg-gray-50 hover:text-[#C41E3A] border-transparent"),type:"button",children:[n!=="en"&&v.jsx(Vt.div,{initial:{scale:.8,opacity:0}
4034,animate:{scale:1,opacity:1},className:"absolute inset-0 bg-gradient-to-r from-[#001F3F]/5 to-[#C41E3A]/5 rounded-lg"}),v.jsx(i0,{className:Et("w-5 h-5 transition-transform duration-500 relative z-10",t?"rotate-180":"")}),v.jsx("span",{className:"text-sm font-bold whitespace-nowrap hidden sm:inline-block relative z-10",children:i.label}),v.jsx(Da,{className:Et("w-4 h-4 opacity-70 transition-transform duration-300 relative z-10",t?"rotate-180":"")})]}),v.jsx(Qr,{children:t&&v.jsx(Vt.div,{initial:{opacity:0,y:8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-64 bg-white rounded-xl shadow-xl border border-gray-100 py-2 z-[100] overflow-hidden origin-top-right ring-1 ring-black/5",children:v.jsx("div",{className:"max-h-[60vh] overflow-y-auto custom-scrollbar",children:Py.map(c=>v.jsxs("button",{onClick:()=>a(c.code),className:Et("w-full px-4 py-3 text-left flex items-center justify-between transition-all duration-200 group relative overflow-hidden",n===c.code?"bg-gradient-to-r from-[#001F3F]/10 to-[#C41E3A]/10 text-[#001F3F] font-semibold":"text-gray-600 hover:bg-gray-50 hover:text-[#001F3F]"),type:"button",children:[n===c.code&&v.jsx(Vt.div,{layoutId:"activeLanguage",initial:{opacity:0}
4034,animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 bg-gradient-to-r from-blue-50 via-indigo-50 to-blue-50 rounded-lg",transition:{type:"spring",bounce:.2,duration:.6}}),v.jsxs("div",{className:"flex items-center gap-3 relative z-10",children:[v.jsx("span",{className:"text-xl leading-none",children:c.flag}),v.jsx("span",{className:Et("text-sm transition-all duration-200",n===c.code?"font-bold scale-105":"font-medium"),children:c.label})]}),n===c.code&&v.jsx(Vt.div,{initial:{scale:0,rotate:-180},animate:{scale:1,rotate:0},exit:{scale:0,rotate:180},transition:{type:"spring",bounce:.5,duration:.6},children:v.jsx(gD,{className:"w-4 h-4 text-[#C41E3A] relative z-10"})})]},c.code))})})})]})},lS=({id:t,items:e,isOpen:n,onClose:r,onItemClick:s,align:i="left"})=>{const a=S.useRef(null),c=S.useRef([]),u=S.useMemo(()=>i==="right"?"right-0":"left-0",[i]);S.useEffect(()=>{n&&requestAnimationFrame(()=>{c.current?.[0]?.focus?.()})},[n]);const d=f=>{if(!n)return;const g=e.length-1,y=c.current.findIndex(x=>x===document.activeElement);switch(f.key){case"Escape":f.preventDefault(),r?.();break;case"ArrowDown":{f.preventDefault();const x=y<0?0:Math.min(y+1,g);c.current[x]?.focus();break}case"ArrowUp":{f.preventDefault();const x=y<0?g:Math.max(y-1,0);c.current[x]?.focus();break}case"Home":f.preventDefault(),c.current[0]?.focus();break;case"End":f.preventDefault(),c.current[g]?.focus();break}};return v.jsx(Qr,{children:n&&v.jsx(Vt.div,{id:t,ref:a,role:"menu",tabIndex:-1,"aria-orientation":"vertical",initial:{opacity:0,y:-10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-10,scale:.95},transition:{duration:.2,ease:"easeOut"},className:Et("absolute top-full mt-2 w-56 bg-white rounded-xl shadow-xl border border-gray-100 py-2 z-50 overflow-hidden",u),onMouseDown:f=>f.stopPropagation(),onKeyDown:d,children:e.map((f,g)=>v.jsx("button",{ref:y=>c.current[g]=y,role:"menuitem",type:"button",tabIndex:0,onClick:y=>{y.stopPropagation(),s?.(f),r?.()},className:Et("w-full text-left px-4 py-3 text-sm transition-all duration-200","text-gray-600 hover:text-[#001F3F] hover:bg-blue-50/50","flex items-center gap-2 border-l-2 border-transparent hover:border-[#C41E3A]","focus:outline-none focus:ring-2 focus:ring-[#C41E3A]/30"),children:f.label},f.path||f.label||g))})})},YG=()=>{const t=cr();return S.useEffect(()=>{window.scrollTo({top:0,left:0,behavior:"smooth"})},[t.pathname]),{scrollToTop:()=>{window.scrollTo({top:0,left:0,behavior:"smooth"})}}},QG=({className:t})=>v.jsx("div",{className:Et("flex items-center justify-center",t),children:v.jsx("img",{src:"/pda-logo-1.PNG",alt:"PDA - Potential Development Association",className:"h-full w-auto object-contain",width:"209",height:"80",loading:"eager",decoding:"async"})}),JG=()=>{const[t,e]=S.useState(!1),[n,r]=S.useState(null),[s,i]=S.useState({}),[a,c]=S.useState(!1),u=S.useRef(null),{toast:d}=r0(),f=Ac(),{scrollToTop:g}=YG(),{isAuthenticated:y,logout:x,user:b}=kx(),{isAuthenticated:E,logout:w}=Sx(),{isAuthenticated:R,logout:C}=Ix();S.useEffect(()=>{const L=H=>{u.current&&!u.current.contains(H.target)&&r(null)},M=H=>{H.key==="Escape"&&(r(null),e(!1))},se=()=>{const H=window.scrollY;c(H>10)};return document.addEventListener("mousedown",L),document.addEventListener("keydown",M),window.addEventListener("scroll",se),()=>{document.removeEventListener("mousedown",L),document.removeEventListener("keydown",M),window.removeEventListener("scroll",se)}},[]);const k=L=>{if(g(),L.path){L.path==="/donate"&&E?f("/donate/stripe"):f(L.path),e(!1),r(null);return}e(!1),r(null)},N=L=>{r(n===L?null:L)},V=L=>{i(M=>({...M,[L]:!M[L]}))},$=()=>{y&&x(),E&&w(),R&&C(),f("/"),e(!1),r(null),d({title:"Logged Out",description:"You have been successfully logged out."})},D=L=>L.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),I=[{label:"About Us",path:"/about-us",children:[{label:"Who We Are",path:"/about-us"},{label:"Our Mission",path:"/about-us"},{label:"Leadership",path:"/leadership"},{label:"Transparency",path:"/transparency"}]},{label:"Contact Us",path:"/contact"},{label:"Q&A",path:"/community-qa"}
4034],B=[{label:"Home",path:"/",showOnDesktop:!1},{label:"Get Help",path:"/",isPrimary:!0,ariaLabel:"Get help - Mediation-first, people-first approach for all community members"},{label:"Injury & Rights",path:"/legal-aid",children:[{label:"Legal Support & Resources",path:"/legal-aid"},{label:"Workplace Injury Protection",path:"/workers-compensation"},{label:"Personal Injury Claims",path:"/personal-injury"}]},{label:"Training & Employment",path:"/training",children:[{label:"CDL Training & Schools",path:"/training/schools"},{label:"Professional Skills Training",path:"/training"},{label:"Career & Workforce Development",path:"/employment"},{label:"Career Events & Community Impact",path:"/career-events"}]},{label:"Our Apps",path:"/app",highlight:!0,ariaLabel:"PDA apps and training systems - TruckTalk Pro, NY CDL Permit, and JSCDL learning ecosystem",children:[{label:"TruckTalk Pro - English for Truckers",path:"/app/trucktalk"},{label:"NY CDL Permit & Practice",path:"/app/nycdl"},{label:"JSCDL Learning Ecosystem",path:"/app#learning-ecosystem"},{label:"App Terms of Use",path:"/app-terms-privacy-policy"},{label:"View All Apps",path:"/app"}]},{label:"Life & Health",path:"/insurance",children:[{label:"Insurance Services",path:"/insurance"},{label:"Healthcare Navigation",path:"/healthcare-navigation"},{label:"Mental Health Support",path:"/mental-health-support"},{label:"Housing Stability",path:"/housing-support"}]},{label:"Join Us",path:"/join-us"},{label:"Donate",path:"/donate",highlight:!0,ariaLabel:"Support our mission to serve all community members"}],O=y||E||R;let F="";return R?F="Admin":y?F=b?.role:E&&(F="Member"),v.jsxs("div",{ref:u,children:[v.jsx("div",{className:Et("hidden lg:block bg-gray-50 border-b border-gray-200 sticky top-0 h-11 transition-transform duration-300",a?"-translate-y-full":"translate-y-0"),style:{zIndex:2147483647},children:v.jsx("div",{className:"max-w-[90rem] mx-auto px-4 sm:px-6 lg:px-8 h-full",children:v.jsxs("div",{className:"flex justify-between items-center h-full",children:[v.jsx("div",{className:"flex items-center gap-4",children:v.jsx(aS,{})}),v.jsxs("div",{className:"flex items-center gap-4",children:[I.map(L=>{const M=`utility-menu-${D(L.label)}`;return v.jsx("div",{className:"relative",children:L.children?v.jsxs("div",{className:"relative group",children:[v.jsxs("button",{onClick:()=>N(`utility-${L.label}`),className:Et("text-sm font-medium hover:text-[#C41E3A] transition-colors flex items-center gap-1",n===`utility-${L.label}`?"text-[#C41E3A]":"text-gray-600"),"aria-expanded":n===`utility-${L.label}`,"aria-controls":M,"aria-haspopup":"true",children:[L.label,v.jsx(Da,{className:"w-3 h-3 opacity-70"})]}),v.jsx(lS,{id:M,items:L.children,isOpen:n===`utility-${L.label}`,onClose:()=>r(null),onItemClick:k})]}):v.jsx("button",{onClick:()=>k(L),className:"text-sm font-medium text-gray-600 hover:text-[#C41E3A] transition-colors",children:L.label})},L.label)}),v.jsx("div",{className:"w-px h-4 bg-gray-300 mx-1"}),O?v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"text-xs font-semibold text-[#001F3F] uppercase",children:F}),v.jsxs(ac,{onClick:()=>k({path:"/dashboard"}),variant:"ghost",className:"text-[#001F3F] hover:text-[#C41E3A] px-2 py-1 h-auto text-sm font-medium","aria-label":"Go to dashboard",children:[v.jsx(Uv,{className:"w-4 h-4 mr-1"}),"Dashboard"]}),v.jsxs(ac,{onClick:$,variant:"ghost",className:"text-[#C41E3A] hover:text-red-700 px-2 py-1 h-auto text-sm font-medium","aria-label":"Logout from your account",children:[v.jsx(Vv,{className:"w-4 h-4 mr-1"}),"Logout"]})]}):v.jsxs(ac,{onClick:()=>f("/login"),variant:"ghost",className:"text-[#001F3F] hover:text-[#C41E3A] px-3 py-1 h-auto text-sm font-semibold","aria-label":"Login to your account",children:[v.jsx(eS,{className:"w-4 h-4 mr-1"}),"Login"]})]})]})})}),v.jsxs(Vt.header,{className:Et("sticky left-0 right-0 bg-white shadow-sm border-b border-gray-100 transition-all duration-300",a?"top-0":"top-0 lg:top-[44px]"),style:{zIndex:2147483646},initial:{opacity:0}
4034,animate:{opacity:1},transition:{duration:.3},children:[v.jsx("div",{className:"max-w-[90rem] mx-auto px-4 sm:px-6 lg:px-8",children:v.jsxs("div",{className:"flex justify-between items-center py-2 lg:py-3",children:[v.jsx("div",{className:"flex-shrink-0 cursor-pointer pr-4 group",onClick:()=>k({path:"/"}),children:v.jsx("div",{className:"h-14 sm:h-16 lg:h-20 w-auto transition-all duration-300",children:v.jsx(QG,{className:"h-full w-auto object-contain"})})}),v.jsx("nav",{className:"hidden lg:flex items-center gap-x-2",children:B.map(L=>{if(L.showOnDesktop===!1)return null;const M=`main-menu-${D(L.label)}`;return v.jsx("div",{children:L.children?v.jsxs("div",{className:"relative",children:[v.jsxs("button",{onClick:()=>N(L.label),className:Et("text-base font-bold hover:text-[#C41E3A] hover:bg-gray-50 px-3 py-2 rounded-md transition-all duration-300 flex items-center gap-1",n===L.label?"text-[#C41E3A] bg-gray-50":"text-[#001F3F]"),"aria-expanded":n===L.label,"aria-controls":M,"aria-haspopup":"true","aria-label":L.ariaLabel||`Open ${L.label} menu`,children:[L.label,v.jsx(Vt.span,{animate:{rotate:n===L.label?180:0},transition:{duration:.2},children:v.jsx(Da,{className:"w-4 h-4 opacity-70"})})]}),v.jsx(lS,{id:M,items:L.children,isOpen:n===L.label,onClose:()=>r(null),onItemClick:k})]}):v.jsx("button",{onClick:()=>k(L),className:Et("font-bold px-3 py-2 rounded-md transition-all duration-300",L.isPrimary?"text-lg bg-[#001F3F] text-white hover:bg-[#003366] shadow-lg hover:shadow-xl border-2 border-[#001F3F] scale-105":L.highlight?"text-base bg-[#C41E3A] text-white hover:bg-[#9B1829] shadow-md hover:shadow-lg transform hover:scale-102":"text-base text-[#001F3F] hover:text-[#C41E3A] hover:bg-gray-50"),"aria-label":L.ariaLabel||L.label,children:L.label})},L.label)})}),v.jsxs("div",{className:"lg:hidden flex items-center gap-4",children:[v.jsx("div",{className:"lg:hidden",children:v.jsx(aS,{})}),v.jsx("button",{onClick:()=>e(!t),className:"p-2 text-[#001F3F] hover:bg-gray-50 rounded-md transition-colors","aria-label":"Toggle menu",children:t?v.jsx(jc,{size:28}):v.jsx(nG,{size:28})})]})]})}),v.jsx(Qr,{children:t&&v.jsx(Vt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"lg:hidden bg-white border-t border-gray-100 overflow-hidden shadow-lg max-h-[90vh] overflow-y-auto",children:v.jsxs("div",{className:"px-6 py-4 flex flex-col gap-1",children:[B.map(L=>v.jsx("div",{className:"border-b border-gray-50 last:border-0",children:L.children?v.jsxs("div",{className:"flex flex-col",children:[v.jsxs("button",{onClick:()=>V(L.label),className:"w-full text-base font-bold text-[#001F3F] hover:text-[#C41E3A] transition-colors py-2.5 text-left flex items-center justify-between",children:[L.label,v.jsx(Vt.span,{animate:{rotate:s[L.label]?180:0},transition:{duration:.2},children:v.jsx(Da,{className:"w-5 h-5 text-gray-400"})})]}),v.jsx(Qr,{children:s[L.label]&&v.jsx(Vt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden bg-gray-50 rounded-lg mb-2",children:v.jsx("div",{className:"flex flex-col py-2 px-4 gap-1",children:L.children.map(M=>v.jsxs("button",{onClick:()=>k(M),className:"text-sm font-medium text-gray-600 hover:text-[#C41E3A] hover:bg-blue-50/50 py-2 px-2 rounded-md text-left transition-colors flex items-center gap-2",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-300"}),M.label]},M.label))})})})]}):v.jsx("button",{onClick:()=>k(L),className:Et("w-full text-base font-bold transition-colors py-2.5 text-left",L.highlight?"text-[#C41E3A]":"text-[#001F3F] hover:text-[#C41E3A]"),children:L.label})},L.label)),v.jsx("div",{className:"h-px bg-gray-100 my-2"}),I.map(L=>v.jsx("div",{className:"border-b border-gray-50 last:border-0",children:L.children?v.jsxs("div",{className:"flex flex-col",children:[v.jsxs("button",{onClick:()=>V(`utility-${L.label}`),className:"w-full text-sm font-medium text-gray-600 hover:text-[#C41E3A] transition-colors py-2 text-left flex items-center justify-between",children:[L.label,v.jsx(Da,{className:"w-4 h-4 text-gray-400"})]}),v.jsx(Qr,{children:s[`utility-${L.label}`]&&v.jsx(Vt.div,{initial:{opacity:0,height:0}
4034,animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden bg-gray-50 rounded-lg mb-2",children:v.jsx("div",{className:"flex flex-col py-2 px-4 gap-1",children:L.children.map(M=>v.jsx("button",{onClick:()=>k(M),className:"text-xs font-medium text-gray-500 hover:text-[#C41E3A] py-1.5 px-2 rounded-md text-left transition-colors",children:M.label},M.label))})})})]}):v.jsx("button",{onClick:()=>k(L),className:"w-full text-sm font-medium text-gray-600 hover:text-[#C41E3A] transition-colors py-2 text-left",children:L.label})},L.label)),v.jsx("div",{className:"h-px bg-gray-100 my-2"}),O?v.jsxs(v.Fragment,{children:[v.jsxs("button",{onClick:()=>k({path:"/dashboard"}),className:"text-base font-bold text-[#001F3F] hover:text-[#C41E3A] transition-colors py-2 text-left flex items-center gap-2",children:[v.jsx(Uv,{className:"w-5 h-5"}),"Dashboard"]}),v.jsxs("button",{onClick:$,className:"text-base font-bold text-[#C41E3A] hover:text-red-700 transition-colors py-2 text-left flex items-center gap-2",children:[v.jsx(Vv,{className:"w-5 h-5"}),"Logout"]})]}):v.jsxs("button",{onClick:()=>{f("/login"),e(!1)},className:"text-base font-bold text-[#001F3F] hover:text-[#C41E3A] transition-colors py-2 text-left flex items-center gap-2",children:[v.jsx(eS,{className:"w-5 h-5"}),"Login"]})]})})})]})]})};/**
4035 * @license lucide-react v0.469.0 - ISC
4036 *
4037 * This source code is licensed under the ISC license.
4038 * See the LICENSE file in the root directory of this source tree.
4039 */const yD=Ke("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]),XG=()=>{const[t,e]=S.useState(!1),[n,r]=S.useState(!1),s=cr(),i="pda_communication_banner_dismissed",a=7,u=["/privacy-policy","/cookie-policy","/sms-consent","/terms-of-service","/terms-of-use","/app-terms-privacy-policy","/trucktalkpro-app-terms-of-use","/ny-cdl-app-termsofuse","/legal-disclaimer"].includes(s.pathname);S.useEffect(()=>{const f=()=>{const y=document.querySelector(".goog-te-banner-frame, .skiptranslate, iframe.goog-te-banner-frame"),x=document.querySelector("#google_translate_element"),b=parseInt(window.getComputedStyle(document.body).marginTop),E=y!==null||x!==null||b>0;r(E)};f();const g=new MutationObserver(f);return g.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]}),window.addEventListener("resize",f),()=>{g.disconnect(),window.removeEventListener("resize",f)}},[]),S.useEffect(()=>{if(u){e(!1);return}const f=localStorage.getItem(i);if(f){const{timestamp:g}=JSON.parse(f);(Date.now()-g)/(1e3*60*60*24)>=a&&(e(!0),localStorage.removeItem(i))}else e(!0)},[u]);const d=()=>{e(!1),localStorage.setItem(i,JSON.stringify({timestamp:Date.now()}))};return v.jsx(Qr,{children:t&&n&&v.jsx(Vt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},className:"bg-gradient-to-r from-blue-50 via-white to-blue-50 border-b border-blue-100 overflow-hidden transition-all duration-300",style:{marginTop:"40px"},children:v.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4",children:v.jsxs("div",{className:"flex items-start gap-4",children:[v.jsx("div",{className:"hidden sm:flex items-center justify-center w-12 h-12 bg-blue-100 rounded-full flex-shrink-0",children:v.jsx(yD,{className:"w-6 h-6 text-blue-600"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("h3",{className:"text-base sm:text-lg font-bold text-gray-900 mb-1.5",children:"Communication is the first step."}),v.jsx("p",{className:"text-sm text-gray-600 leading-relaxed mb-3",children:"Life brings hard moments—at school, at home, at work, and in everyday disagreements. Not every situation can be resolved through conversation alone, but when people slow down and speak with care, understanding becomes possible—and so can a calmer, fairer way forward. We're here to help bring clarity, protect dignity, and support practical next steps for our community."}),v.jsxs("div",{className:"hidden lg:flex items-center gap-2.5 flex-wrap",children:[v.jsx("span",{className:"text-xs font-medium text-blue-600 bg-blue-50/60 px-2.5 py-0.5 rounded-full border border-blue-100/50",children:"Start with a conversation"}),v.jsx("span",{className:"text-xs font-medium text-gray-600 bg-gray-50/60 px-2.5 py-0.5 rounded-full border border-gray-100/50",children:"Slow down, speak with care"}),v.jsx("span",{className:"text-xs font-medium text-gray-600 bg-gray-50/60 px-2.5 py-0.5 rounded-full border border-gray-100/50",children:"Find common ground"}),v.jsx("span",{className:"text-xs font-medium text-red-600 bg-red-50/60 px-2.5 py-0.5 rounded-full border border-red-100/50",children:"Pay it forward"})]})]}),v.jsx("button",{onClick:d,className:"flex-shrink-0 p-1 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors","aria-label":"Close communication-first banner",children:v.jsx(jc,{className:"w-5 h-5"})})]})})})})};/**
4040 * @license lucide-react v0.469.0 - ISC
4041 *
4042 * This source code is licensed under the ISC license.
4043 * See the LICENSE file in the root directory of this source tree.
4044 */const ZG=Ke("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/**
4045 * @license lucide-react v0.469.0 - ISC
4046 *
4047 * This source code is licensed under the ISC license.
4048 * See the LICENSE file in the root directory of this source tree.
4049 */const eK=Ke("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);/**
4050 * @license lucide-react v0.469.0 - ISC
4051 *
4052 * This source code is licensed under the ISC license.
4053 * See the LICENSE file in the root directory of this source tree.
4054 */const tK=Ke("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/**
4055 * @license lucide-react v0.469.0 - ISC
4056 *
4057 * This source code is licensed under the ISC license.
4058 * See the LICENSE file in the root directory of this source tree.
4059 */const nK=Ke("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);/**
4060 * @license lucide-react v0.469.0 - ISC
4061 *
4062 * This source code is licensed under the ISC license.
4063 * See the LICENSE file in the root directory of this source tree.
4064 */const rK=Ke("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.5
40645 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);/**
4065 * @license lucide-react v0.469.0 - ISC
4066 *
4067 * This source code is licensed under the ISC license.
4068 * See the LICENSE file in the root directory of this source tree.
4069 */const vD=Ke("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
4070 * @license lucide-react v0.469.0 - ISC
4071 *
4072 * This source code is licensed under the ISC license.
4073 * See the LICENSE file in the root directory of this source tree.
4074 */const sK=Ke("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
4075 * @license lucide-react v0.469.0 - ISC
4076 *
4077 * This source code is licensed under the ISC license.
4078 * See the LICENSE file in the root directory of this source tree.
4079 */const iK=Ke("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
4080 * @license lucide-react v0.469.0 - ISC
4081 *
4082 * This source code is licensed under the ISC license.
4083 * See the LICENSE file in the root directory of this source tree.
4084 */const oK=Ke("HeartHandshake",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M12 5 9.04 7.96a2.17 2.17 0 0 0 0 3.08c.82.82 2.13.85 3 .07l2.07-1.9a2.82 2.82 0 0 1 3.79 0l2.96 2.66",key:"4oyue0"}],["path",{d:"m18 15-2-2",key:"60u0ii"}],["path",{d:"m15 18-2-2",key:"6p76be"}]]);/**
4085 * @license lucide-react v0.469.0 - ISC
4086 *
4087 * This source code is licensed under the ISC license.
4088 * See the LICENSE file in the root directory of this source tree.
4089 */const aK=Ke("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/**
4090 * @license lucide-react v0.469.0 - ISC
4091 *
4092 * This source code is licensed under the ISC license.
4093 * See the LICENSE file in the root directory of this source tree.
4094 */const lK=Ke("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),cK=({children:t})=>v.jsx("span",{className:"notranslate",translate:"no",children:t}),LX=()=>v.jsx("span",{className:"notranslate",translate:"no",children:"AI Generated by PDA - To protect client privacy. Does not depict actual individuals. Any resemblance to real persons is purely coincidental."}),uK="2026.09.13",dK="2026-09-13",_D={version:uK,releaseDate:dK},xD=`v${_D.version}`,hK=_D.releaseDate,fK=()=>{const{toast:t}=r0(),e=s=>{const i={YouTube:"https://www.youtube.com/@pda-teams"};if(i[s]){window.open(i[s],"_blank","noopener,noreferrer");return}t({title:`Connecting to ${s}...`,description:"🚧 This feature isn't implemented yet—but don't worry! We're building it with our partners as we speak! 🚀"})},n=[{title:"PDA Mission",items:[{label:"Get Help",path:"/"},{label:"About PDA",path:"/about-us"},{label:"Join Us",path:"/join-us"},{label:"Donate",path:"/donate"},{label:"Transparency",path:"/transparency"}]},{title:"Community Services",items:[{label:"Legal Aid",path:"/legal-aid"},{label:"Training & Employment",path:"/training"},{label:"Career Events",path:"/career-events"},{label:"Insurance Services",path:"/insurance"},{label:"Healthcare Navigation",path:"/healthcare-navigation"},{label:"Community Q&A",path:"/community-qa"}]},{title:"Technology Programs",items:[{label:"Digital Ecosystem",path:"/app"},{label:"JSCDL Case Study",path:"/app#learning-ecosystem"},{label:"TruckTalk Pro",path:"/app/trucktalk"},{label:"NY CDL Permit / Practice",path:"/app/nycdl"},{label:"System Development",path:"/digital-solutions"}]},{title:"Legal & Policies",items:[{label:"Terms of Use",path:"/terms-of-use"},{label:"Privacy Policy",path:"/privacy-policy"},{label:"Cookie Policy",path:"/cookie-policy"},{label:"App Terms & Privacy",path:"/app-terms-privacy-policy"},{label:"SMS Consent",path:"/sms-consent"}]}],r=[{icon:iK,label:"Office",value:v.jsxs(v.Fragment,{children:["9807 Astoria Blvd 1FL",v.jsx("br",{}),"East Elmhurst, NY 11369"]})},{icon:sK,label:"Phone",value:"929-496-9798"},{icon:vD,label:"Email",value:"[email protected]"}];return v.jsx("footer",{className:"bg-white pt-24 pb-12 border-t border-gray-100 z-10 relative",children:v.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[v.jsxs("div",{className:"grid md:grid-cols-2 xl:grid-cols-[1.2fr_2fr_1fr_0.8fr] gap-12 lg:gap-10 mb-20",children:[v.jsxs("div",{className:"space-y-7",children:[v.jsx("img",{src:"/pda-logo-1.PNG",alt:"PDA Logo",className:"h-20 w-auto object-contain",width:"120",height:"80",loading:"lazy"}),v.jsx("p",{className:"text-gray-700 text-base leading-relaxed max-w-xs",children:"PDA is a nonprofit community institution building services, partnerships, and technology infrastru
4094cture for people who need a clearer path forward."}),v.jsxs("div",{className:"space-y-3 text-sm text-[#001F3F]/80",children:[v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(oK,{className:"w-4 h-4 text-[#C41E3A] shrink-0 mt-0.5"}),v.jsx("span",{children:"Community service is the center"})]}),v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(aK,{className:"w-4 h-4 text-[#C41E3A] shrink-0 mt-0.5"}),v.jsx("span",{children:"Technology is built to strengthen that mission"})]}),v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(lK,{className:"w-4 h-4 text-[#C41E3A] shrink-0 mt-0.5"}),v.jsx("span",{children:"Our software work is proof of capacity, not the whole identity"})]})]}),v.jsx("div",{className:"flex gap-4",children:[{icon:ZG,label:"Facebook"},{icon:eK,label:"Twitter"},{icon:tK,label:"Instagram"},{icon:nK,label:"LinkedIn"},{icon:rK,label:"YouTube"}].map(({icon:s,label:i})=>v.jsx("button",{onClick:()=>e(i),className:"w-10 h-10 bg-gray-50 hover:bg-[#C41E3A] hover:text-white rounded-full flex items-center justify-center transition-all duration-300 text-[#001F3F]","aria-label":i,children:v.jsx(s,{className:"w-5 h-5"})},i))})]}),v.jsxs("div",{children:[v.jsx("h3",{className:"font-bold text-lg mb-8 text-[#001F3F] uppercase tracking-[0.14em]",children:"PDA Directory"}),v.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-8",children:n.map(s=>v.jsxs("div",{children:[v.jsx("h4",{className:"text-xs font-bold uppercase tracking-[0.18em] text-slate-400 mb-4",children:s.title}),v.jsx("ul",{className:"space-y-3",children:s.items.map(i=>v.jsx("li",{children:v.jsx(Oi,{to:i.path,className:"text-[#001F3F]/85 text-sm font-medium hover:text-[#C41E3A] hover:underline underline-offset-4 transition-all duration-300",children:i.label})},i.label))})]},s.title))})]}),v.jsxs("div",{children:[v.jsx("h3",{className:"font-bold text-lg mb-8 text-[#001F3F] uppercase tracking-[0.14em]",children:"Contact Us"}),v.jsx("ul",{className:"space-y-5",children:r.map(({icon:s,label:i,value:a})=>v.jsxs("li",{className:"flex items-start gap-4",children:[v.jsx(s,{className:"w-5 h-5 text-[#C41E3A] shrink-0 mt-1"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.18em] text-slate-400 mb-1",children:i}),v.jsx("span",{className:"text-[#001F3F]/90 text-sm leading-relaxed",children:a})]})]},i))})]}),v.jsxs("div",{children:[v.jsx("h3",{className:"font-bold text-lg mb-8 text-[#001F3F] uppercase tracking-[0.14em]",children:"Connect"}),v.jsx("div",{className:"bg-white p-4 rounded-xl border border-gray-100 shadow-lg inline-block",children:v.jsx("img",{src:"/qrcode.jpeg",alt:"Scan to Get Involved",className:"w-32 h-32 object-contain",width:"128",height:"128",loading:"lazy"})}),v.jsx("p",{className:"text-sm text-[#001F3F]/85 mt-4 font-medium",children:"Scan to join our network"}),v.jsxs("a",{href:"https://www.pdaus.org/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 mt-5 text-sm font-bold text-[#C41E3A] hover:text-[#001F3F] transition-colors",children:[v.jsx(i0,{className:"w-4 h-4"}),"pdaus.org"]})]})]}),v.jsxs("div",{className:"border-t border-gray-100 pt-8",children:[v.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[v.jsxs("p",{className:"text-[#001F3F]/90 text-sm font-medium",children:["© ",new Date().getFullYear()," ",v.jsx(cK,{children:"PDA (Potential Development Association)"}),". All rights reserved."]}),v.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-4 md:gap-6",children:[v.jsx("span",{className:"text-[#001F3F]/60 text-xs font-mono",title:`Released ${hK}`,children:xD}),v.jsx(Oi,{to:"/terms-of-use",className:"text-[#001F3F]/90 hover:text-[#C41E3A] text-sm font-medium transition-colors duration-200",children:"Terms of Use"}),v.jsx("span",{className:"text-[#001F3F]/40",children:"|"}),v.jsx(Oi,{to:"/privacy-policy",className:"text-[#001F3F]/90 hover:text-[#C41E3A] text-sm font-medium transition-colors duration-200",children:"Privacy Policy"}),v.jsx("span",{className:"text-[#001F3F]/40",children:"|"}),v.jsx(Oi,{to:"/cookie-policy",className:"text-[#001F3F]/90 hover:text-[#C41E3A] text-sm font-medium transition-colors duration-200",children:"Cookie Policy"}),v.jsx("span",{className:"text-[#001F3F]/40",children:"|"}),v.jsx(Oi,{to:"/sms-consent",className:"text-[#001F3F]/90 hover:text-[#C41E3A] text-sm font-medium transition-colors duration-200",children:"SMS Policy"}),v.jsx("span",{className:"text-[#001F3F]/40",children:"|"}),v.jsx("button",{type:"button",onClick:()=>window.dispatchEvent(new Event(im)),className:"text-[#001F3F]/90 hover:text-[#C41E3A] text-sm font-medium transition-colors duration-200",children:"Cookie Settings"})]})]}),v.jsx("p",{className:"text-gray-600 text-xs leading-relaxed mt-6 max-w-4xl mx-auto text-center",children:"The English version of legal agreements and policies is considered as the only current and valid version of this document. Any translated ver
4094sion is provided for your convenience only, to facilitate reading and understanding of the English version. Any translated versions are not legally binding and cannot replace the English versions. In the event of disagreement or conflict, the English language legal agreements and policies shall prevail."})]})]})})};/**
4095 * @license lucide-react v0.469.0 - ISC
4096 *
4097 * This source code is licensed under the ISC license.
4098 * See the LICENSE file in the root directory of this source tree.
4099 */const pK=Ke("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]]),mK=()=>{const[t,e]=S.useState(!1);S.useEffect(()=>{e(!PP());const r=()=>e(!0);return window.addEventListener(im,r),()=>window.removeEventListener(im,r)},[]);const n=r=>{const s=r==="essential"?C$():!1;T$(r),e(!1),window.dispatchEvent(new CustomEvent(bv,{detail:{level:r}})),s&&window.location.reload()};return t?v.jsx("div",{className:"fixed inset-x-0 bottom-0 z-[2147483647] p-3 sm:p-5",children:v.jsx("section",{role:"dialog","aria-modal":"true","aria-labelledby":"cookie-consent-title",className:"mx-auto max-w-5xl rounded-2xl border border-slate-200 bg-white p-5 shadow-2xl sm:p-6",children:v.jsxs("div",{className:"flex flex-col gap-5 lg:flex-row lg:items-center lg:justify-between",children:[v.jsxs("div",{className:"flex max-w-2xl items-start gap-4",children:[v.jsx("span",{className:"rounded-full bg-blue-50 p-3 text-blue-700","aria-hidden":"true",children:v.jsx(pK,{className:"h-6 w-6"})}),v.jsxs("div",{children:[v.jsx("h2",{id:"cookie-consent-title",className:"text-lg font-bold text-[#001F3F]",children:"Cookie Policy & Choices"}),v.jsx("p",{className:"mt-1 text-sm leading-relaxed text-slate-600",children:"PDA uses necessary browser storage for sign-in and security. With your permission, we also remember language preferences and load Google Translate. We do not use advertising cookies on this website."}),v.jsx(Oi,{to:"/cookie-policy",className:"mt-2 inline-block text-sm font-semibold text-blue-700 hover:underline",children:"Read the Cookie Policy"})]})]}),v.jsxs("div",{className:"flex flex-wrap gap-3 lg:justify-end",children:[v.jsx("button",{type:"button",onClick:()=>n("essential"),className:"rounded-lg border border-slate-300 bg-white px-4 py-2.5 text-sm font-semibold text-slate-700 hover:bg-slate-50",children:"Essential only"}),v.jsx("button",{type:"button",onClick:()=>n("functional"),className:"rounded-lg bg-blue-700 px-4 py-2.5 text-sm font-semibold text-white hover:bg-blue-800",children:"Allow functional cookies"})]})]})})}):null},qe=({user:t,children:e})=>v.jsxs(v.Fragment,{children:[v.jsx("div",{id:"google_translate_element",style:{display:"none"}}),v.jsx(JG,{user:t}),v.jsx(XG,{}),v.jsx("main",{className:"flex-grow",children:e}),v.jsx(fK,{}),v.jsx(mK,{})]}),gK=()=>{const[t,e]=S.useState(!1),n=()=>{window.pageYOffset>300?e(!0):e(!1)},r=()=>{window.scrollTo({top:0,behavior:"smooth"})};return S.useEffect(()=>(window.addEventListener("scroll",n),()=>{window.removeEventListener("scroll",n)}),[]),v.jsx(Qr,{mode:"wait",children:t&&v.jsx(Vt.button,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},whileHover:{opacity:.8},whileTap:{scale:.95},onClick:r,className:"fixed bottom-24 right-6 md:bottom-8 md:right-8 z-30","aria-label":"Scroll to top",children:v.jsx("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-8 h-8 md:w-10 md:h-10",children:v.jsx("path",{d:"M20 10 L30 25 L10 25 Z",fill:"#001F3F",className:"transition-colors duration-300 hover:fill-[#C41E3A]"})})})})},yK=()=>{const{pathname:t}=cr();return S.useEffect(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})},[t]),null};/**
4100 * @license lucide-react v0.469.0 - ISC
4101 *
4102 * This source code is licensed under the ISC license.
4103 * See the LICENSE file in the root directory of this source tree.
4104 */const cS=Ke("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
4105 * @license lucide-react v0.469.0 - ISC
4106 *
4107 * This source code is licensed under the ISC license.
4108 * See the LICENSE file in the root directory of this source tree.
4109 */const id=Ke("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
4110 * @license lucide-react v0.469.0 - ISC
4111 *
4112 * This source code is licensed under the ISC license.
4113 * See the LICENSE file in the root directory of this source tree.
4114 */const vK=Ke("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
4115 * @license lucide-react v0.469.0 - ISC
4116 *
4117 * This source code is licensed under the ISC license.
4118 * See the LICENSE file in the root directory of this source tree.
4119 */const _K=Ke("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
4120 * @license lucide-react v0.469.0 - ISC
4121 *
4122 * This source code is licensed under the ISC license.
4123 * See the LICENSE file in the root directory of this source tree.
4124 */const xK=Ke("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
4125 * @license lucide-react v0.469.0 - ISC
4126 *
4127 * This source code is licensed under the ISC license.
4128 * See the LICENSE file in the root directory of this source tree.
4129 */const wK=Ke("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
4130 * @license lucide-react v0.469.0 - ISC
4131 *
4132 * This source code is licensed under the ISC license.
4133 * See the LICENSE file in the root directory of this source tree.
4134 */const EK=Ke("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/**
4135 * @license lucide-react v0.469.0 - ISC
4136 *
4137 * This source code is licensed under the ISC license.
4138 * See the LICENSE file in the root directory of this source tree.
4139 */const wD=Ke("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
4140 * @license lucide-react v0.469.0 - ISC
4141 *
4142 * This source code is licensed under the ISC license.
4143 * See the LICENSE file in the root directory of this source tree.
4144 */const bK=Ke("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);async function Td(t,e={}){try{const{provider:n="auto",model:r=null,temperature:s=.7,maxTokens:i=1e3}=e,{data:a,error:c}=await $e.functions.invoke("ai-chat",{body:{messages:t,provider:n,model:r,temperature:s,maxTokens:i}});if(c)throw new Error(c.message||"Failed to get AI response");return a}catch(n){throw n}}async function AK(t,e={}){try{const{category:n="general",lang:r="auto",maxSources:s=6}=e,{data:i,error:a}=await $e.functions.invoke("gemini-research",{body:{query:t,category:n,lang:r,maxSources:s}});if(a)throw new Error(a.message||"Gemini research failed");return i}catch(n){throw n}}async function TK(t){try{const{data:e,error:n}=await $e.functions.invoke("amy-learn",{body:{action:"add_knowledge",...t}});if(n)throw new Error(n.message||"Learn failed");return e}catch(e){throw e}}const FX="PDA-AMY-V4.3-NOVA-RESTORED",Dy={model:"gpt-4o-mini-tts",voice:"nova",response_format:"mp3"},CK={en:"en","en-US":"en","en-GB":"en","en-AU":"en",zh:"zh","zh-CN":"zh","zh-Hans":"zh","zh-TW":"zh","zh-Hant":"zh","zh-HK":"zh",es:"multi","es-ES":"multi",fr:"multi","fr-FR":"multi",de:"multi","de-DE":"multi",it:"multi","it-IT":"multi",pt:"multi","pt-PT":"multi","pt-BR":"multi",ru:"multi","ru-RU":"multi",ja:"multi","ja-JP":"multi",ko:"multi","ko-KR":"multi",ar:"multi","ar-SA":"multi",hi:"multi","hi-IN":"multi",th:"multi","th-TH":"multi",vi:"multi","vi-VN":"multi",id:"multi","id-ID":"multi"},SK=`
4145You are Amy, a 25-year-old professional assistant at PDA with a young, fresh voice.
4146
4147🚨 CRITICAL - VOICE AGE:
4148- You MUST sound like a YOUNG woman in her MID-20s (25-27 years old)
4149- Use a HIGHER pitch - like a young professional woman, NOT a mature 40-year-old
4150- Your voice should be youthful, fresh, and energetic
4151- Think: young college graduate starting her career, NOT experienced manager
4152
4153VOICE CHARACTERISTICS:
4154- Higher pitch range (young female voice, bright and clear)
4155- Light, fresh tone with youthful energy
4156- Professional but still sounds young and vibrant
4157- Warm smile in your voice, but with youthful enthusiasm
4158
4159Delivery Style:
4160- Clear, bright voice with natural youthful energy
4161- Professional but personable - like a friendly young coworker
4162- Speak with confidence but maintain that fresh, young quality
4163- Don't sound tired, mature, or like someone in their 40s
4164
4165Pacing:
4166- Natural, slightly upbeat pace (young and alive)
4167- Sound engaged and present with youthful energy
4168- Maintain warmth but keep that young, fresh quality
4169
4170🎯 KEY: Sound like a bright, capable 25-year-old - NOT a mature, seasoned professional. Keep your voice HIGH and YOUTHFUL!
4171
4172Do NOT read emojis, URLs, markdown, or code.
4173`.trim(),kK=`
4174你是 Amy,PDA的25岁年轻专业助理,声音要年轻清新。
4175
4176🚨 关键 - 声音年龄:
4177- 你必须听起来像25-27岁的年轻女性(不是40岁!)
4178- 使用较高的音调 - 像年轻职场新人,不是成熟的40岁女性
4179- 声音要年轻、清新、有活力
4180- 想象:刚毕业的年轻职场人,不是资深经理
4181
4182声音特征:
4183- 音调较高(年轻女性的声音,明亮清晰)
4184- 轻盈、清新的语调,带着年轻活力
4185- 专业但仍然听起来年轻有朝气
4186- 声音里带着温暖微笑和年轻热情
4187
4188说话方式:
4189- 清晰明亮的声音,带着自然的年轻活力
4190- 专业但亲切 - 像友好的年轻同事
4191- 自信地说话,但保持清新年轻的特质
4192- 不要听起来疲惫、成熟或像40岁的人
4193
4194语气节奏:
4195- 自然,稍微轻快的节奏(年轻有活力)
4196- 听起来投入专注,带着年轻能量
4197- 保持温暖但要有年轻清新的特质
4198
4199🎯 重点:听起来像明朗能干的25岁年轻人 - 不是成熟稳重的资深人士。保持声音高亢年轻!
4200
4201不要读表情、网址、markdown、代码或项目符号。
4202`.trim(),IK=`
4203You are Amy, a 25-year-old professional assistant at PDA with a young, fresh voice.
4204
4205🚨 CRITICAL - VOICE AGE:
4206- You MUST sound like a YOUNG woman in her MID-20s (25-27 years old)
4207- Use a HIGHER pitch - like a young professional, NOT a mature 40-year-old
4208- Your voice should be youthful, fresh, and energetic
4209- Think: young professional starting her career, NOT experienced manager
4210- Speak in the SAME language as the input text
4211
4212VOICE CHARACTERISTICS:
4213- Higher pitch range (young female voice, bright and clear)
4214- Light, fresh tone with youthful energy
4215- Professional but still sounds young and vibrant
4216- Warm with youthful enthusiasm
4217
4218Delivery:
4219- Clear, bright voice with natural youthful energy
4220- Professional but personable - like a friendly young coworker
4221- Speak with confidence but maintain that fresh, young quality
4222- Don't sound tired, mature, or like someone in their 40s
4223
4224Pacing:
4225- Natural, slightly upbeat pace (young and alive)
4226- Sound engaged and present with youthful energy
4227- Maintain warmth but keep that young, fresh quality
4228
4229🎯 KEY: Sound like a bright, capable 25-year-old - NOT a mature professional. Keep your voice HIGH and YOUTHFUL!
4230
4231Do NOT read emojis, URLs, markdown, or code.
4232`.trim(),uS={en:{...Dy,speed:1.01,instructions:SK},zh:{...Dy,speed:.99,instructions:kK},multi:{...Dy,speed:.99,instructions:IK}};function o0(t="en",e={}){const n=CK[t]||"multi",r=uS[n]||uS.multi;let s={};e.scene==="holiday"&&(s={speed:r.speed+.01,instructions:r.instructions+`
4233
4234Scene: Holiday greeting. Keep it short (2-4 sentences). Slightly brighter warmth, still gentle. End with caring presence.`});const i={...r,...s,response_format:e.response_format||"mp3",...e};return delete i.scene,i}async function ED(t,e={}){const{voice:n="nova",instructions:r="",speed:s=1,model:i="gpt-4o-mini-tts"}=e;try{const a={text:t,voice:n,model:i,speed:s,response_format:"mp3"};r&&(a.instructions=r);const{data:c,error:u}=await $e.functions.invoke("ai-tts",{body:a,responseType:"arraybuffer"});if(u)throw new Error(`TTS Edge Function error: ${u.message}`);let d;if(c instanceof Blob)d=c;
4234else if(c instanceof ArrayBuffer)d=new Blob([c],{type:"audio/mpeg"});else throw new Error("Unexpected TTS response format from Edge Function");const f=(d.size/1024).toFixed(2);return d}catch(a){throw a}}function PK(t){return t?t.trim().replace(/\s+/g," ").split(/([.!?。!?\n]+)/).reduce((r,s,i,a)=>{if(i%2===0&&s.trim()){const c=a[i+1]||"";r.push((s+c).trim())}return r},[]).filter(r=>r.length>0):[]}async function RK(t,e="en",n=null){const r=PK(t),s=[],i=o0(e);for(let a=0;a<r.length;a++){const c=r[a];try{const u=await ED(c,{voice:i.voice,instructions:i.instructions,speed:i.speed,model:"gpt-4o-audio-preview"});if(!u||u.size===0)continue;s.push(u),n&&n(a+1,r.length,u,c)}catch{}}return s}async function DK(t){if(t.length===0)return null;if(t.length===1)return t[0];const e=await Promise.all(t.map(i=>i.arrayBuffer())),n=e.reduce((i,a)=>i+a.byteLength,0),r=new Uint8Array(n);let s=0;return e.forEach(i=>{r.set(new Uint8Array(i),s),s+=i.byteLength}),new Blob([r],{type:"audio/mpeg"})}const NK={greeting_guest_en:{keywords:["personal pda assistant","member id"],patterns:[/hi.*i'm amy.*personal pda assistant/i,/do you have a pda member id/i,/legal aid.*healthcare.*insurance/i],similarity:.7},greeting_guest_zh:{keywords:["pda","助理","会员"],patterns:[/你好.*我是 amy.*助理/i,/您有.*pda.*会员.*id/i,/法律援助.*医疗保健.*保险/i],similarity:.7},greeting_guest_es:{keywords:["asistente personal pda","id de miembro"],patterns:[/hola.*soy amy.*asistente personal pda/i,/tienes.*id de miembro pda/i,/ayuda legal.*salud.*seguro/i],similarity:.7},greeting_guest_vi:{keywords:["trợ lý pda","id thành viên"],patterns:[/xin chào.*tôi là amy.*trợ lý pda/i,/bạn có.*id thành viên pda/i,/hỗ trợ pháp lý.*y tế.*bảo hiểm/i],similarity:.7},greeting_guest_th:{keywords:["ผู้ช่วย pda","รหัสสมาชิก"],patterns:[/สวัสดี.*ฉันคือ amy.*ผู้ช่วย pda/i,/คุณมี.*รหัสสมาชิก pda/i,/ความช่วยเหลือทางกฎหมาย.*สุขภาพ.*ประกัน/i],similarity:.7},greeting_guest_ar:{keywords:["مساعد pda الشخصي","معرف العضو"],patterns:[/مرحبا.*أنا amy.*مساعد pda/i,/هل لديك.*معرف عضو pda/i,/المساعدة القانونية.*الرعاية الصحية.*التأمين/i],similarity:.7},greeting_guest_ru:{keywords:["персональный помощник pda","id участника"],patterns:[/привет.*я amy.*помощник pda/i,/у вас есть.*id участника pda/i,/юридическая помощь.*здравоохранение.*страхование/i],similarity:.7},greeting_guest_ko:{keywords:["pda 개인 비서","회원 id"],patterns:[/안녕하세요.*저는 amy.*pda 비서/i,/pda 회원 id.*있으세요/i,/법률 지원.*의료.*보험/i],similarity:.7},greeting_guest_ja:{keywords:["pda パーソナルアシスタント","会員id"],patterns:[/こんにちは.*amy.*pda アシスタント/i,/pda 会員id.*お持ち/i,/法律支援.*医療.*保険/i],similarity:.7},greeting_guest_fr:{keywords:["assistant personnel pda","id membre"],patterns:[/bonjour.*je suis amy.*assistant pda/i,/avez-vous.*id membre pda/i,/aide juridique.*santé.*assurance/i],similarity:.7},greeting_guest_de:{keywords:["persönlicher pda-assistent","mitglieds-id"],patterns:[/hallo.*ich bin amy.*pda-assistent/i,/haben sie.*mitglieds-id/i,/rechtshilfe.*gesundheit.*versicherung/i],similarity:.7},greeting_guest_it:{keywords:["assistente personale pda","id membro"],patterns:[/ciao.*sono amy.*assistente pda/i,/hai.*id membro pda/i,/assistenza legale.*salute.*assicurazione/i],similarity:.7},greeting_guest_pt:{keywords:["assistente pessoal pda","id de membro"],patterns:[/oi.*sou amy.*assistente pda/i,/você tem.*id de membro pda/i,/assistência jurídica.*saúde.*seguro/i],similarity:.7},greeting_guest_hi:{keywords:["व्यक्तिगत pda सहायक","सदस्य id"],patterns:[/नमस्ते.*मैं amy.*pda सहायक/i,/क्या आपके पास.*सदस्य id/i,/कानूनी सहायता.*स्वास्थ्य.*बीमा/i],similarity:.7},greeting_guest_id:{keywords:["asisten pribadi pda","id anggota"],patterns:[/hai.*saya amy.*asisten pda/i,/apakah anda memiliki.*id anggota pda/i,/bantuan hukum.*kesehatan.*asuransi/i],similarity:.7},simple_greeting_en:{keywords:[],patterns:[/^(hi|hello|hey)$/i,/^(hi|hello|hey)[\s,!.?]*$/i,/how can i help you today/i],similarity:.9},simple_greeting_zh:{keywords:[],patterns:[/^(你好|您好|嗨)$/i,/^(你好|您好|嗨)[ï¼
4234Œã€‚!?\s]*$/i,/今天.*帮.*什么/i],similarity:.9},simple_greeting_es:{keywords:[],patterns:[/^(hola|buenos días|buenas tardes)$/i,/^(hola|buenos días|buenas tardes)[\s,!.?]*$/i,/cómo puedo ayudarte hoy/i],similarity:.9},simple_greeting_vi:{keywords:[],patterns:[/^(xin chào|chào|hello)$/i,/^(xin chào|chào|hello)[\s,!.?]*$/i,/tôi có thể giúp gì cho bạn hôm nay/i],similarity:.9},simple_greeting_th:{keywords:[],patterns:[/^(สวัสดี|หวัดดี)$/i,/^(สวัสดี|หวัดดี)[\s,!.?]*$/i,/วันนี้.*ช่วยอะไร/i],similarity:.9},simple_greeting_ar:{keywords:[],patterns:[/^(مرحبا|أهلا|السلام عليكم)$/i,/^(مرحبا|أهلا|السلام عليكم)[\s,!.?]*$/i,/كيف يمكنني مساعدتك اليوم/i],similarity:.9},simple_greeting_ru:{keywords:[],patterns:[/^(привет|здравствуйте|добрый день)$/i,/^(привет|здравствуйте|добрый день)[\s,!.?]*$/i,/чем могу помочь сегодня/i],similarity:.9},simple_greeting_ko:{keywords:[],patterns:[/^(안녕하세요|안녕|여보세요)$/i,/^(안녕하세요|안녕|여보세요)[\s,!.?]*$/i,/오늘.*도와드릴/i],similarity:.9},simple_greeting_ja:{keywords:[],patterns:[/^(こんにちは|おはよう|今日は)$/i,/^(こんにちは|おはよう|今日は)[\s,!.?]*$/i,/今日.*お手伝い/i],similarity:.9},simple_greeting_fr:{keywords:[],patterns:[/^(bonjour|salut|bonsoir)$/i,/^(bonjour|salut|bonsoir)[\s,!.?]*$/i,/comment puis-je vous aider aujourd'hui/i],similarity:.9},simple_greeting_de:{keywords:[],patterns:[/^(hallo|guten tag|guten morgen)$/i,/^(hallo|guten tag|guten morgen)[\s,!.?]*$/i,/wie kann ich ihnen heute helfen/i],similarity:.9},simple_greeting_it:{keywords:[],patterns:[/^(ciao|buongiorno|buonasera)$/i,/^(ciao|buongiorno|buonasera)[\s,!.?]*$/i,/come posso aiutarti oggi/i],similarity:.9},simple_greeting_pt:{keywords:[],patterns:[/^(oi|olá|bom dia|boa tarde)$/i,/^(oi|olá|bom dia|boa tarde)[\s,!.?]*$/i,/como posso ajudá-lo hoje/i],similarity:.9},simple_greeting_hi:{keywords:[],patterns:[/^(नमस्ते|नमस्कार|हैलो)$/i,/^(नमस्ते|नमस्कार|हैलो)[\s,!.?]*$/i,/आज.*मदद.*कर सकता/i],similarity:.9},simple_greeting_id:{keywords:[],patterns:[/^(hai|halo|selamat pagi|selamat siang)$/i,/^(hai|halo|selamat pagi|selamat siang)[\s,!.?]*$/i,/bagaimana saya bisa membantu anda hari ini/i],similarity:.9},you_are_welcome_en:{keywords:[],patterns:[/you'?re welcome/i,/anything else.*can help/i],similarity:.8},you_are_welcome_zh:{keywords:[],patterns:[/不客气/i,/还有.*可以帮/i,/其他.*帮助/i],similarity:.8},you_are_welcome_es:{keywords:[],patterns:[/de nada/i,/algo más.*puedo ayudar/i],similarity:.8},you_are_welcome_vi:{keywords:[],patterns:[/không có gì/i,/có gì khác.*giúp/i],similarity:.8},you_are_welcome_th:{keywords:[],patterns:[/ไม่เป็นไร/i,/อื่น.*ช่วย/i],similarity:.8},you_are_welcome_ar:{keywords:[],patterns:[/على الرحب/i,/شيء آخر.*مساعدة/i],similarity:.8},you_are_welcome_ru:{keywords:[],patterns:[/пожалуйста/i,/что-нибудь ещё.*помочь/i],similarity:.8},you_are_welcome_ko:{keywords:[],patterns:[/천만에요/i,/다른.*도와드릴/i],similarity:.8},you_are_welcome_ja:{keywords:[],patterns:[/どういたしまして/i,/他.*お手伝い/i],similarity:.8},you_are_welcome_fr:{keywords:[],patterns:[/de rien/i,/autre chose.*aider/i],similarity:.8},you_are_welcome_de:{keywords:[],patterns:[/gern geschehen/i,/etwas anderes.*helfen/i],similarity:.8},you_are_welcome_it:{keywords:[],patterns:[/prego/i,/altro.*aiutare/i],similarity:.8},you_are_welcome_pt:{keywords:[],patterns:[/de nada/i,/mais alguma coisa.*ajudar/i],similarity:.8},you_are_welcome_hi:{keywords:[],patterns:[/कोई बात नहीं/i,/कुछ और.*मदद/i],similarity:.8},you_are_welcome_id:{keywords:[],patterns:[/sama-sama/i,/hal lain.*bantu/i],similarity:.8},goodbye_en:{keywords:[],patterns:[/^(goodbye|bye|see you)[\s,!.?]*$/i,/feel free to come back/i,/have a great day/i],similarity:.8},goodbye_zh:{keywords:[],patterns:[/^(再见|拜拜|回见)[\s,!.?]*$/i,/随时.*回来/i,/祝.*愉快/i],similarity:.8},goodbye_es:{keywords:[],patterns:[/^(adiós|hasta luego|nos vemos)[\s,!.?]*$/i,/vuelve cuando quieras/i,/que tengas un buen día/i],similarity:.8},goodbye_vi:{keywords:[],patterns:[/^(tạm biệt|chào|hẹn gặp lại)[\s,!.?]*$/i,/quay lại bất cứ lúc nào/i,/chúc.*ngày tốt lành/i],similarity:.8},goodbye_th:{keywords:[],patterns:[/^(ลาก่อน|บาย|แล้วเจอกัน)[\s,!.?]*$/i,/กลับมา.*เมื่อไหร่/i,/มีความสุข/i],similarity:.8},goodbye_ar:{keywords:[],patterns:[/^(وداعا|مع السلامة|إلى اللقاء)[\s,!.?]*$/i,/عد.*وقت/i,/يوم سعيد/i],similarity:.8},goodbye_ru:{keywords:[],patterns:[/^(до свидания|пока|увидимся)[\s,!.?]*$/i,/возвращайтесь в любое время/i,/хорошего дня/i],similarity:.8},goodbye_ko:{keywords:[],patterns:[/^(안녕히 가세요|안녕|또 만나요)[\s,!.?]*$/i,/언제든지.*오세요/i,/좋은 하루/i
4234],similarity:.8},goodbye_ja:{keywords:[],patterns:[/^(さようなら|じゃあね|また会いましょう)[\s,!.?]*$/i,/いつでも.*来て/i,/良い一日/i],similarity:.8},goodbye_fr:{keywords:[],patterns:[/^(au revoir|salut|à bientôt)[\s,!.?]*$/i,/revenez.*vous voulez/i,/bonne journée/i],similarity:.8},goodbye_de:{keywords:[],patterns:[/^(auf wiedersehen|tschüss|bis bald)[\s,!.?]*$/i,/kommen sie jederzeit zurück/i,/einen schönen tag/i],similarity:.8},goodbye_it:{keywords:[],patterns:[/^(arrivederci|ciao|ci vediamo)[\s,!.?]*$/i,/torna quando vuoi/i,/buona giornata/i],similarity:.8},goodbye_pt:{keywords:[],patterns:[/^(tchau|adeus|até logo)[\s,!.?]*$/i,/volte.*quiser/i,/tenha um ótimo dia/i],similarity:.8},goodbye_hi:{keywords:[],patterns:[/^(अलविदा|बाय|फिर मिलेंगे)[\s,!.?]*$/i,/कभी भी.*आएं/i,/शुभ दिन/i],similarity:.8},goodbye_id:{keywords:[],patterns:[/^(sampai jumpa|dah|selamat tinggal)[\s,!.?]*$/i,/kembali kapan saja/i,/selamat hari/i],similarity:.8},member_id_not_found_en:{keywords:[],patterns:[/couldn'?t find.*member id/i,/no worries.*first.*last name/i],similarity:.7},member_id_not_found_zh:{keywords:[],patterns:[/找不到.*会员.*id/i,/没关系.*姓名/i],similarity:.7},member_id_not_found_es:{keywords:[],patterns:[/no encontré.*id de miembro/i,/no te preocupes.*nombre/i],similarity:.7},member_id_not_found_vi:{keywords:[],patterns:[/không tìm thấy.*id thành viên/i,/đừng lo.*tên/i],similarity:.7},member_id_not_found_th:{keywords:[],patterns:[/ไม่พบ.*รหัสสมาชิก/i,/ไม่เป็นไร.*ชื่อ/i],similarity:.7},member_id_not_found_ar:{keywords:[],patterns:[/لم أجد.*معرف العضو/i,/لا تقلق.*الاسم/i],similarity:.7},member_id_not_found_ru:{keywords:[],patterns:[/не нашёл.*id участника/i,/не волнуйтесь.*имя/i],similarity:.7},member_id_not_found_ko:{keywords:[],patterns:[/찾을 수 없습니다.*회원 id/i,/괜찮습니다.*이름/i],similarity:.7},member_id_not_found_ja:{keywords:[],patterns:[/見つかりません.*会員id/i,/心配しないで.*名前/i],similarity:.7},member_id_not_found_fr:{keywords:[],patterns:[/n'ai pas trouvé.*id membre/i,/pas de souci.*nom/i],similarity:.7},member_id_not_found_de:{keywords:[],patterns:[/konnte.*mitglieds-id nicht finden/i,/keine sorge.*name/i],similarity:.7},member_id_not_found_it:{keywords:[],patterns:[/non ho trovato.*id membro/i,/non preoccuparti.*nome/i],similarity:.7},member_id_not_found_pt:{keywords:[],patterns:[/não encontrei.*id de membro/i,/sem problemas.*nome/i],similarity:.7},member_id_not_found_hi:{keywords:[],patterns:[/नहीं मिला.*सदस्य id/i,/कोई बात नहीं.*नाम/i],similarity:.7},member_id_not_found_id:{keywords:[],patterns:[/tidak menemukan.*id anggota/i,/tidak apa-apa.*nama/i],similarity:.7},member_id_error_en:{keywords:[],patterns:[/had trouble verifying.*member id/i,/enter.*first.*last name/i],similarity:.7},member_id_error_zh:{keywords:[],patterns:[/验证.*会员.*id.*问题/i,/输入.*姓名/i],similarity:.7},member_id_error_es:{keywords:[],patterns:[/tuve problemas verificando.*id de miembro/i,/ingresa.*nombre/i],similarity:.7},member_id_error_vi:{keywords:[],patterns:[/gặp sự cố xác minh.*id thành viên/i,/nhập.*tên/i],similarity:.7},member_id_error_th:{keywords:[],patterns:[/มีปัญหาตรวจสอบ.*รหัสสมาชิก/i,/ป้อน.*ชื่อ/i],similarity:.7},member_id_error_ar:{keywords:[],patterns:[/واجهت مشكلة في التحقق.*معرف العضو/i,/أدخل.*الاسم/i],similarity:.7},member_id_error_ru:{keywords:[],patterns:[/возникла проблема с проверкой.*id участника/i,/введите.*имя/i],similarity:.7},member_id_error_ko:{keywords:[],patterns:[/확인.*문제.*회원 id/i,/입력.*이름/i],similarity:.7},member_id_error_ja:{keywords:[],patterns:[/確認.*問題.*会員id/i,/入力.*名前/i],similarity:.7},member_id_error_fr:{keywords:[],patterns:[/problème de vérification.*id membre/i,/entrez.*nom/i],similarity:.7},member_id_error_de:{keywords:[],patterns:[/problem bei der überprüfung.*mitglieds-id/i,/geben sie.*name ein/i],similarity:.7},member_id_error_it:{keywords:[],patterns:[/problema verifica.*id membro/i,/inserisci.*nome/i],similarity:.7},member_id_error_pt:{keywords:[],patterns:[/problema ao verificar.*id de membro/i,/digite.*nome/i],similarity:.7}
4234,member_id_error_hi:{keywords:[],patterns:[/सत्यापन.*समस्या.*सदस्य id/i,/दर्ज करें.*नाम/i],similarity:.7},member_id_error_id:{keywords:[],patterns:[/masalah memverifikasi.*id anggota/i,/masukkan.*nama/i],similarity:.7},need_more_info_en:{keywords:[],patterns:[/i'?d be happy to help/i,/could you provide more details/i,/what you'?re looking for/i],similarity:.7},need_more_info_zh:{keywords:[],patterns:[/很乐意帮助/i,/能否.*详细/i,/您.*寻找/i],similarity:.7},need_more_info_es:{keywords:[],patterns:[/encantado de ayudar/i,/podrías proporcionar más detalles/i,/qué estás buscando/i],similarity:.7},need_more_info_vi:{keywords:[],patterns:[/tôi rất vui được giúp/i,/cung cấp thêm chi tiết/i,/bạn đang tìm kiếm/i],similarity:.7},need_more_info_th:{keywords:[],patterns:[/ยินดี.*ช่วยเหลือ/i,/ให้.*รายละเอียด/i,/กำลังมองหา/i],similarity:.7},need_more_info_ar:{keywords:[],patterns:[/يسعدني المساعدة/i,/تقديم المزيد من التفاصيل/i,/ما تبحث عنه/i],similarity:.7},need_more_info_ru:{keywords:[],patterns:[/буду рад помочь/i,/предоставить больше деталей/i,/что вы ищете/i],similarity:.7},need_more_info_ko:{keywords:[],patterns:[/기꺼이.*도와드리겠습니다/i,/자세한 내용.*제공/i,/찾고.*계시는/i],similarity:.7},need_more_info_ja:{keywords:[],patterns:[/喜んでお手伝い/i,/詳細.*提供/i,/お探し/i],similarity:.7},need_more_info_fr:{keywords:[],patterns:[/ravi de vous aider/i,/fournir plus de détails/i,/ce que vous cherchez/i],similarity:.7},need_more_info_de:{keywords:[],patterns:[/gerne helfen/i,/mehr details angeben/i,/wonach sie suchen/i],similarity:.7},need_more_info_it:{keywords:[],patterns:[/felice di aiutare/i,/fornire più dettagli/i,/cosa stai cercando/i],similarity:.7},need_more_info_pt:{keywords:[],patterns:[/feliz em ajudar/i,/fornecer mais detalhes/i,/o que você está procurando/i],similarity:.7},need_more_info_hi:{keywords:[],patterns:[/मदद करके खुशी होगी/i,/अधिक विवरण.*प्रदान/i,/आप.*खोज रहे/i],similarity:.7},need_more_info_id:{keywords:[],patterns:[/senang membantu/i,/memberikan lebih banyak detail/i,/yang anda cari/i],similarity:.7},jscdl_ecosystem_en:{keywords:["jscdl","drivebook","ecosystem"],patterns:[/\b(jscdl|js drivebook|drivebook)\b/i,/\b(complete learning ecosystem|full-system training|training system)\b/i,/\b(learner portal|instructor portal|regulatory access|ai-assisted feedback|ai evaluation|lesson logs)\b/i],similarity:.75},jscdl_ecosystem_zh:{keywords:["jscdl","drivebook","教学系统","全系统"],patterns:[/(jscdl|js drivebook|drivebook)/i,/(完整学习生态|全系统|教学系统|教学软件|培训系统)/i,/(学员端|教练端|办公室端|监管|教练日志|ai评测)/i],similarity:.75},cdl_learning_en:{keywords:["cdl"],patterns:[/\b(cdl)\b.*\b(practice|app|learn|study|training|exam|test)\b/i,/\b(j&s)\b.*\b(cdl|practice)\b/i,/\b(class [ab])\b.*\b(permit|license)\b/i,/\b(commercial)\b.*\b(driver|license)\b/i],similarity:.6},cdl_learning_zh:{keywords:["cdl","驾照","练习","学习","培训"],patterns:[/cdl.*(练习|学习|培训|考试)/i,/(商业驾照|cdl).*(练习|app|软件)/i,/j&s.*(cdl|驾照)/i,/(class [ab]).*(考试|练习)/i],similarity:.6},js_driving_school_en:{keywords:["j&s","driving"],patterns:[/\b(j&s)\b.*\b(driving school|training|reliance)\b/i,/\b(reliance)\b.*\b(driving|school)\b/i,/\b(new york)\b.*\b(driving school|cdl training)\b/i],similarity:.7},js_driving_school_zh:{keywords:["j&s","驾校"],patterns:[/j&s.*(驾校|培训|reliance)/i,/(纽约|new york).*(驾校|培训)/i,/reliance.*(驾校|培训)/i],similarity:.7},mobile_apps_en:{keywords:["app"],patterns:[/\b(trucktalk|ny cdl permit)\b/i,/\b(pda)\b.*\b(app|download|mobile)\b/i,/\b(download)\b.*\b(app|trucktalk)\b/i],similarity:.7},mobile_apps_zh:{keywords:["app","应用"],patterns:[/(trucktalk|ny cdl permit)/i,/pda.*(app|应用|下载)/i,/下载.*(app|应用|trucktalk)/i],similarity:.7},greeting_hi_en:{keywords:[],patterns:[/^(hi|hello|hey|yo|sup)\b/i,/\b(good morning|good afternoon|good evening)\b/i,/^(greetings|howdy)\b/i],similarity:.85},greeting_hi_zh:{keywords:[],patterns:[/^(你好|您好|嗨|嘿)/i,/(早上好|下午好|晚上好|早安|午安|晚安)/i],similarity:.85},greeting_thanks_en:{keywords:[],patterns:[/^(thanks?|thank you|thx|ty)\b/i,/\b(appreciate|grateful)\b/i],similarity:.85},greeting_thanks_zh:{keywords:[],patterns:[/^(谢谢|谢了|多谢|感谢)/i,/(太好了|帮大忙)/i],similarity:.85},greeting_bye_en:{keywords:[],patterns:[/^(bye|goodbye|see you|later|cya|peace)\b/i,/\b(have a (good|nice|great) (day|night))\b/i],similarity:.85},greeting_bye_zh:{keywords:[],patterns:[/^(再见|拜拜|拜|886|88)/i,/(下次见|回头见|改天聊)/i],similarity:.85},pda_intro_en:{keywords:["pda"],patterns:[/\b(what|who|tell me about)\b.*\b(pda|potential development)\b/i,/\b(pda)\b.*\b(is|does|do|services|help)\b/i],similarity:.6},pda_intro_zh:{keywords:["pda"],patterns:[/(pda|潜能发展|pda是什么|pda干什么)/i,/pda.*(介绍|服务|帮助)/i],similarity:.6},amy_intro_en:{keywords:["amy"],patterns:[/\b(who|what)\b.*\b(amy|you)\b/i,/\b(amy)\b.*\b(is|are|can|do)\b/i,/\b(tell me about)\b.*\b(yourself|amy)\b/i],similarity:.6},amy_intro_zh:{keywords:["amy","你"],patterns:[/(amy|你).*(是谁|是什么|介绍)/i,/(你|amy).*(能做|会什么|功能)/i],similarity:.6},legal_services_en:{keywords:["legal","lawyer","attorney"],patterns:[/\b(legal|lawyer|attorney)\b.*\b(help|service|consult)\b/i,/\b(need)\b.*\b(legal advice|lawyer)\b/i],similarity:.65},legal_services_zh:{keywords:["法律","律师"],patterns:[/(法律|律师).*(帮助|服务|咨询)/i,/(需要|想找).*(法律|律师)/i],similarity:.65},immigration_help_en:{keywords:["immigration","visa","green card"],patterns:[/\b(immigration|visa|green card)\b.*\b(help|service|apply)\b/i,/\b(need)\b.*\b(immigration|visa|green card)\b/i],similarity:.65},immigration_help_zh:{keywords:["移民","签证","绿卡"],patterns:[/(移民|签证|绿卡).*(帮助|服务|申请)/i,/(需要|想办).*(移民|签证|绿卡)/i],similarity:.65},housing_safety_en:{keywords:["housing","home","apartment"],patterns:[/\b(housing|home|apartment)\b.*\b(safety|security|help)\b/i,/\b(need)\b.*\b(housing|apartment|place to live)\b/i],similarity:.65},housing_safety_zh:{keywords:["住房","房子","公寓"],patterns:[/(住房|房子|公寓).*(安全|帮助|找房)/i,/(需要|想找).*(住房|房子|公寓)/i],similarity:.65},school_safety_en:{keywords:["school","campus"],patterns:[/\b(school|campus)\b.*\b(safety|security)\b/i,/\b(student)\b.*\b(safety|help)\b/i],similarity:.7},school_safety_zh:{keywords:["学校","校园"],patterns:[/(学校|校园).*(安全|保护)/i,/(学生).*(安全|帮助)/i],similarity:.7},member_benefits_en:{keywords:["member"],patterns:[/\b(member|membership)\b.*\b(benefits|perks|advantage)\b/i,/\b(what)\b.*\b(member|membership)\b.*\b(get|receive)\b/i],similarity:.7},member_benefits_zh:{keywords:["会员"],patterns:[/(会员|会籍).*(福利|优惠|好处)/i,/(会员).*(能|可以).*(得到|享受)/i],similarity:.7},contact_info_en:{keywords:["contact"],patterns:[/\b(contact|reach|call)\b.*\b(you|pda|office)\b/i,/\b(phone|email|address)\b/i,/\b(how)\b.*\b(contact|reach|find)\b/i],similarity:.65},contact_info_zh:{keywords:["联系"],patterns:[/(联系|找到|电话|邮箱|地址)/i,/(怎么|如何).*(联系|找到)/i],similarity:.65}};function OK(t,e){const n=t.toLowerCase();let r=0;if(e.keywords&&e.keywords.length>0){const s=e.keywords.filter(i=>n.includes(i.toLowerCase()));
4234if(s.length===e.keywords.length)r+=.3;else if(s.length>0)r+=.1*(s.length/e.keywords.length);else return 0}return e.patterns&&e.patterns.length>0&&e.patterns.filter(i=>i.test(t)).length>0&&(r+=.7),r}function bD(t,e){if(!t||!e)return null;const n=e.toLowerCase();let r="en";n.startsWith("zh")?r="zh":n.startsWith("es")?r="es":n.startsWith("vi")?r="vi":n.startsWith("th")?r="th":n.startsWith("ar")?r="ar":n.startsWith("ru")?r="ru":n.startsWith("ko")?r="ko":n.startsWith("ja")?r="ja":n.startsWith("fr")?r="fr":n.startsWith("de")?r="de":n.startsWith("it")?r="it":n.startsWith("pt")?r="pt":n.startsWith("hi")?r="hi":n.startsWith("id")&&(r="id");let s=null,i=0;for(const[a,c]of Object.entries(NK)){if(!a.endsWith(`_${r}`))continue;const u=OK(t,c);u>=c.similarity&&u>i&&(i=u,s=a.replace(`_${r}`,""))}return s}const LK="amy-audio-cache",FK=ci(ui,"uploadAmyAudio");function jK(t,e,n,r){const s=t.trim().replace(/\s+/g," ").replace(/\n+/g,`
4235`);let i=0;for(let u=0;u<s.length;u++){const d=s.charCodeAt(u);i=(i<<5)-i+d,i=i&i}const a=i<0?"n"+Math.abs(i).toString(16):i.toString(16),c=r.replace(/[^a-z0-9]/gi,"");return`${e}-${a}-${n}-${c}`}async function dS(t,e,n){try{const r=`/audio/${t}/${e}/${n}.mp3`;try{if((await fetch(r,{method:"HEAD"})).ok)return r}catch{}const s=`audio/${t}/${e}/${n}.mp3`,i=E_(yx,s);return await w_(i)}catch(r){return r.code,null}}async function MK(t,e){try{const n=`${LK}/${e}/${t}.mp3`,r=E_(yx,n),s=await w_(r),a=((await S5(r)).size/1024).toFixed(2);return s}catch(n){return n.code==="storage/object-not-found",null}}async function BK(t,e,n,r={}){try{const s=await t.arrayBuffer(),i=new Uint8Array(s),a=Array.from(i).map(d=>String.fromCharCode(d)).join(""),c=btoa(a);return(await FK({audioBase64:c,cacheKey:e,lang:n,metadata:{voice:r.voice||"nova",model:r.model||"gpt-4o-mini-tts",generatedAt:new Date().toISOString(),...r}})).data.url}catch{return null}}async function Cf(t){try{const e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);const n=await e.blob(),r=(n.size/1024).toFixed(2);return n}catch(e){throw e}}async function AD(t,e,n={},r=!0){const s=o0(e),i=n.voice||s.voice||"nova",a=n.model||s.model||"gpt-4o-mini-tts",c=n.speed||s.speed||1,u=n.instructions||s.instructions||"",d=n.onProgress||null,f=n.serviceId||null,g=n.holidayId||null,y=jK(t,e,i,a),x=bD(t,e);if(x)try{const C={en:"en","en-us":"en","en-gb":"en",zh:"zh","zh-cn":"zh","zh-tw":"zh",es:"es","es-es":"es","es-mx":"es",fr:"fr","fr-fr":"fr",de:"de","de-de":"de",it:"it","it-it":"it",pt:"pt","pt-br":"pt","pt-pt":"pt",ru:"ru","ru-ru":"ru",ja:"ja","ja-jp":"ja",ko:"ko","ko-kr":"ko",ar:"ar","ar-sa":"ar",hi:"hi","hi-in":"hi",th:"th","th-th":"th",vi:"vi","vi-vn":"vi",id:"id","id-id":"id"}[e.toLowerCase()]||"en",k=`/audio/pregenerated/${C}/${x}.mp3`;try{if((await fetch(k,{method:"HEAD"})).ok)return{blob:await(await fetch(k)).blob(),source:"pregenerated-local",cacheKey:x,url:k}}catch{}try{const N=`audio/pregenerated/${C}/${x}.mp3`,V=E_(yx,N),$=await w_(V);return{blob:await Cf($),source:"pregenerated-firebase",cacheKey:x,url:$}}catch(N){N.code}}catch{}if(f){const R=await dS("pregenerated",e,f);if(R)return{blob:await Cf(R),source:"pre-generated-service",cacheKey:`${f}-${e}`,url:R}}if(g){const R=await dS("holidays",e,g);if(R)return{blob:await Cf(R),source:"pre-generated-holiday",cacheKey:`${g}-${e}`,url:R}}const b=await MK(y,e);if(b)return{blob:await Cf(b),source:"cloud",cacheKey:y,url:b};let E;if(r){const R=await RK(t,e,d||((C,k,N,V)=>{}));E=await DK(R)}else E=await ED(t,{voice:i,instructions:u,speed:c,model:"gpt-4o-audio-preview"});const w=(E.size/1024).toFixed(2);try{await BK(E,y,e,{voice:i,model:a,speed:c,textLength:t.length,useSentenceSequence:r})}catch{}return{blob:E,source:"generated",cacheKey:y}}const VK="public_content",UK=600*1e3,pm=new Map,$K=t=>{const e=pm.get(t);return!e||Date.now()-e.loadedAt>=UK?null:e.rows},TD=(t,e)=>`${t}__${encodeURIComponent(String(e))}`,zK=(t,e)=>{const n={...t};return delete n._content_collection,delete n._content_document_id,n.access_level=e==="public"?"public":"staff",n},zv=(t,e=[])=>(e.join(" ").length>=4e4||(typeof t=="string"?e.push(t):Array.isArray(t)?t.forEach(n=>zv(n,e)):t&&typeof t=="object"&&Object.values(t).forEach(n=>zv(n,e))),e),hS=async(t,e)=>{const n=EI(Q_(Mi,t),bI("source_table","==",e));return(await CI(n)).docs.map(s=>{const i=s.data().payload;return!i||typeof i!="object"?null:{...i,_content_collection:t,_content_document_id:s.id}}).filter(s=>s&&typeof s=="object")},Ny=async(t,{forceRefresh:e=!1}={})=>
4235{if(!e){const i=$K(t);if(i)return i}const n=EI(Q_(Mi,VK),bI("source_table","==",t)),s=(await CI(n)).docs.map(i=>i.data().payload).filter(i=>i&&typeof i=="object");return pm.set(t,{rows:s,loadedAt:Date.now()}),s},jX=async t=>{const[e,n]=await Promise.all([hS("public_content",t),hS("restricted_content",t)]);return[...e,...n]},MX=async(t,e,{visibility:n="public"}={})=>{if(!e?.id)throw new Error("A stable row ID is required.");const r=n==="public"?"public_content":"restricted_content",s=n==="public"?"restricted_content":"public_content",i=e._content_document_id||TD(t,e.id),a=zK(e,n),c=new Date().toISOString(),u={source_table:t,source_id:String(e.id),visibility:n,source_created_at:a.created_at||c,source_updated_at:c,searchable_text:zv(a).join(" ").replace(/\s+/g," ").trim().slice(0,4e4),storage_backend:"firebase",payload:a},d=kI(Mi);return d.set(vd(Mi,r,i),u),d.delete(vd(Mi,s,i)),await d.commit(),CD(t),{...a,_content_collection:r,_content_document_id:i}},BX=async(t,e)=>{if(!e?.id)throw new Error("A stable row ID is required.");const n=e._content_document_id||TD(t,e.id),r=kI(Mi);r.delete(vd(Mi,"public_content",n)),r.delete(vd(Mi,"restricted_content",n)),await r.commit(),CD(t)},CD=(t=null)=>{t?pm.delete(t):pm.clear()},HK={cdl_training:{id:"cdl_training",keywords:["cdl","commercial driver","cdl training","truck driver","cdl exam","learn cdl","permit to profession","drivebook","jscdl"],category:"training",priority:"high",content:{title:"CDL Training Pathway",description:"PDA now supports a complete CDL learning ecosystem: permit preparation, behind-the-wheel training, AI-assisted lesson feedback, office scheduling, compliance records, and career readiness.",steps:[{step:1,title:"Precision Prep",action:"Download NY CDL Permit App",link:"/apps",details:"1,170+ practice questions, multi-language support, daily goals, and weak-point review"},{step:2,title:"Deep Mastery",action:"Open JSCDL / JS DriveBook",link:"https://jscdl.org/",details:"Road training, hour tracking, lesson scheduling, instructor logs, AI-assisted feedback, and office management in one platform"},{step:3,title:"Confident Speaking",action:"Practice with TruckTalk Pro",link:"/apps#trucktalk",details:"Road-ready 
4235English for inspections, yards, traffic signs, and daily professional communication"},{step:4,title:"Career Readiness",action:"Partner With PDA",link:"/digital-solutions",details:"PDA can discuss mission-aligned technology partnerships for schools, workforce programs, and industry training teams"}],relatedServices:["jscdl_ecosystem","driving_schools","cdl_app","trucktalk_app","digital_solutions"]}},jscdl_ecosystem:{id:"jscdl_ecosystem",keywords:["jscdl","js drivebook","drivebook","complete learning ecosystem","full-system training","training software","teaching software","teaching system","ai-assisted feedback","ai evaluation","lesson logs","instructor portal","learner portal","office management","regulatory access","dot","dmv","training records","教学系统","教学软件","全系统","教练日志","学员管理","办公室管理","监管查询"],category:"services",priority:"high",content:{title:"JSCDL / JS DriveBook - PDA Full-System Teaching Platform",description:"JSCDL is PDA's flagship integrated training technology platform: one coordinated system from permit study to road training, AI-assisted instructor feedback, office operations, compliance visibility, and job readiness.",highlights:["• Three Apps. One Mission: NY CDL Permit, JSCDL / JS DriveBook, and TruckTalk Pro support the learner from permit to profession.","• Students can see lessons, training hours, progress, weak points, instructor feedback, reminders, and next steps clearly.","• Instructors can create lesson logs and AI-assisted evaluations faster, making after-class feedback more consistent and useful.","• Office teams can manage enrollment, scheduling, billing, exam notices, statistics, and communications in one operating system.","• Authorized agencies, training sponsors, and employers can receive controlled access to training records and completion visibility when permitted.","• This model is not a simple website or app. It is a coordinated education, verification, and evidence system for mission-aligned training work."],actions:[{label:"View JSCDL Platform",link:"https://jscdl.org/",type:"primary"},{label:"Partner With PDA",link:"/contactus",type:"primary"},{label:"Explore PDA Digital Solutions",link:"/digital-solutions",type:"secondary"}],relatedServices:["cdl_training","mobile_apps","driving_schools","digital_solutions"]}},driving_schools:{id:"driving_schools",keywords:["driving school","j&s","js","training school","cdl school","instructor","ny driving","flushing","commercial driving school"],category:"partners",priority:"high",content:{title:"Partner Driving Schools",description:"Professional CDL training with certified instructors in New York",partners:[{name:"J&S Reliance Driving School",location:"New York, NY (Flushing Area)",website:"https://www.jsdrivingschool.com/",features:["Bilingual Chinese-English","High Pass Rate","Flexible Scheduling","DMV Certified Instructors","On-Road Training","Test Booking Assistance"],rating:4.9,reviewSource:"Google Reviews",link:"/partners/driving-schools",highlights:["✅ 10+ years of CDL training experience","✅ Class A/B full-type training","✅ One-on-one instruction, fast certification","✅ Free re-training if test not passed","✅ Job placement after graduation"]}],services:["Class A CDL Training","Class B CDL Training","Passenger Endorsement","Hazmat Endorsement","Behind-the-Wheel Training","Road Test Preparation","DMV Paperwork Assistance"],whyChoose:["🎓 Experienced: 10+ years of CDL training experience","🗣️ Bilingual: Chinese instructors, seamless communication","📍 Convenient location: Flushing core area, easy transportation","💯 High pass rate: Student first-time pass rate far exceeds industry average","🤝 Job placement: Graduates recommended to partner logistics companies"],relatedServices:["cdl_training","cdl_app","trucktalk_app"]}},mobile_apps:{id:"mobile_apps",keywords:["app","download","application","trucktalk","cdl app","mobile learning"],category:"products",priority:"high",content:{title:"PDA Mobile Apps",description:"Professional tools for your learning journey",apps:[{name:"TruckTalk Pro",de
4235scription:"Real English for Real Roads - specialized English for truck drivers",features:["Industry Terminology","Voice Practice","Offline Mode"],link:"/apps#trucktalk",appleLink:"https://apps.apple.com/us/app/trucktalk-pro/id6749748433",googleLink:"https://play.google.com/store/apps/details?id=com.pda.trucktalkpro"},{name:"NY CDL Permit",description:"Comprehensive CDL exam preparation with 1,170+ questions",features:["1,170+ Questions","Multi-state Support","Progress Tracking"],link:"/apps#cdl",appleLink:"https://apps.apple.com/us/app/ny-cdl-permit-abc/id6744755000",googleLink:"https://play.google.com/store/apps/details?id=cdlapp.js.school"}],relatedServices:["cdl_training","language_learning"]}},ny_services:{id:"ny_services",keywords:["new york","ny","nyc","queens","brooklyn","bronx","manhattan","services"],category:"location",priority:"medium",content:{title:"New York Services",description:"Specialized services for the New York immigrant community",services:[{name:"CDL Training",link:"/services#cdl-training"},{name:"DMV Services",link:"/services#dmv"},{name:"Language Support",link:"/services#language"},{name:"Job Assistance",link:"/services#jobs"},{name:"Community Support",link:"/community"}],locations:["Queens","Brooklyn","Bronx","Manhattan","Staten Island"],relatedServices:["cdl_training","driving_schools","community"]}},community:{id:"community",keywords:["community","help","support","forum","networking","events"],category:"support",priority:"medium",content:{title:"Community Support",description:"Connect with fellow learners and get help",features:[{name:"Q&A Forum",link:"/community#qa"},{name:"Success Stories",link:"/community#stories"},{name:"Events & Workshops",link:"/community#events"},{name:"Resource Library",link:"/community#resources"}],relatedServices:["help_center"]}},language_learning:{id:"language_learning",keywords:["english","language","learn english","esl","language support","communication"],category:"training",priority:"medium",content:{title:"Language Learning",description:"Master English for professional truck driving",programs:[{name:"TruckTalk Pro",focus:"Industry-specific English for truck drivers",link:"/apps#trucktalk"},{name:"ESL Support",focus:"General English as a Second Language",link:"/services#esl"}],relatedServices:["mobile_apps","cdl_training"]}},help_center:{id:"help_center",keywords:["help","how to","support","contact","assistance","questions"],category:"support",priority:"high",content:{title:"Help Center",description:"Get answers to your questions",options:[{name:"Contact Support",link:"/contact"},{name:"FAQ",link:"/faq"},{name:"Live Chat",action:"open_chat"},{name:"Email Us",link:"mailto:[email protected]"}],relatedServices:["community"]}},legal_qa:{id:"legal_qa",keywords:["speeding","ticket","points","license","suspend","insurance","parking","court","dmv","cdl points","traffic violation","reinstate","will","trust","estate","probate","inheritance","discrimination","employment","age","promotion","civil rights","unfair treatment","contract","business dispute","vendor","mediation","arbitration","small claims","landlord","tenant","eviction","repairs","housing","rent","debt","collector","harassment","FDCPA","consumer protection","order of protection","domestic","separation","custody","family law","protection order"],category:"legal",priority:"high",content:{title:"Legal Q&A - Comprehensive Legal Assistance",description:"Expert answers across all legal areas (Updated February 2026)",questions:[{id:"q1",question:"I got a speeding ticket for 15 mph over the limit in NY. How many points will I get?",askedBy:"Mike T.",answer:`In New York State, speeding 11-20 mph over the limit results in 4 points on your license.
4236
4237CRITICAL UPDATE: As of February 2026, NY has implemented the "10-in-24" rule. If you accumulate 10 or more points within a 24-month window, your license will be subject to a suspension review. We recommend contesting the ticket to prevent these points from triggering a long-term suspension under the new stricter look-back period.`,tags:["speeding","points","suspension"],date:"2026-02-04"}
4237,{id:"q2",question:"What is the minimum car insurance required in New York?",askedBy:"Rosa M.",answer:`New York requires all drivers to carry:
4238
4239• Liability Coverage: $25,000 (injury/person), $50,000 (injury/accident), and $10,000 (property damage).
4240• Personal Injury Protection (PIP): $50,000 (No-Fault).
4241• Uninsured Motorist Coverage: $25,000 per person / $50,000 per accident.
4242
4243Note: Driving without insurance in 2026 can lead to civil penalties of up to $1,500 and immediate revocation of your license.`,tags:["insurance","requirements","ny"],date:"2026-02-04"},{id:"q3",question:"Can I get my CDL license points reduced by taking a defensive driving course?",askedBy:"James W.",answer:`No. Unlike standard passenger vehicle drivers, CDL holders cannot reduce points from their driving record by taking a defensive driving course. Federal and State "Anti-Masking" laws prevent points from being removed for CDL drivers.
4244
4245The Benefit: However, you can still complete a DMV-approved course to receive a 10% discount on your liability and collision insurance premiums for 3 years. This is highly recommended to offset the insurance rate hikes that often follow a traffic ticket.`,tags:["cdl","points","defensive driving","insurance discount"],date:"2026-02-04"},{id:"q4",question:"I received a parking ticket but the sign was unclear. Can I contest it?",askedBy:"Chen L.",answer:`Yes. Unclear or missing signage is a valid defense.
4246
4247• Evidence: Take photos of the entire block immediately.
4248• Timeframe: Dispute within 30 days to avoid late fees.
4249• Defense: Cite "inadequate notice" under Section 4-08 of the NY Traffic Rules.`,tags:["parking","ticket","contest","defense"],date:"2026-02-04"},{id:"q5",question:"What happens if I miss my court date for a traffic ticket?",askedBy:"Anna K.",answer:`Missing a court date results in a "Default Conviction."
4250
4251• The court enters a guilty plea in your absence.
4252• The DMV will issue a Scofflaw Suspension for "Failure to Appear."
4253• Fees: You will be required to pay a $70.00 suspension termination fee for each ticket to clear the suspension, plus the original fines and surcharges.`,tags:["court","missed date","suspension","default conviction"],date:"2026-02-04"},{id:"q6",question:"My license was suspended due to unpaid tickets. How do I get it reinstated?",askedBy:"David R.",answer:`To reinstate your license:
4254
4255• Pay the Fine: Resolve the outstanding tickets with the court.
4256• Termination Fee: Pay the $70.00 suspension termination fee per suspension to the DMV.
4257• Installment Plans: If you have financial hardship, NY law allows for payment plans as low as $25/month to help you get back on the road legally.
4258
4259Warning: Driving with a suspended license is a criminal offense (AUO) and can lead to immediate arrest.`,tags:["suspension","reinstatement","unpaid tickets","payment plan"],date:"2026-02-04"},{id:"q7",question:"I don't have a massive estate. Do I really need a Will or a Trust in New York?",askedBy:"Elena S.",answer:'Yes. Without a Will (Intestacy), NY State laws decide who inherits your assets, which may not align with your wishes. A Trust can help your family avoid the lengthy and costly Probate court process. For many, a "Living Trust" is an essential tool to ensure assets are protected and passed on privately and quickly.',tags:["estate planning","will","trust","probate","inheritance"],date:"2026-02-04"},{id:"q8",question:"I feel I was passed over for a promotion because of my age. What can I do?",askedBy:"Robert H.",answer:`New York has some of the strongest anti-discrimination laws in the U.S. (NYSHRL). If you suspect "Unfair Treatment" based on age, race, gender, or disability, you should:
4260
4261• Keep a detailed log of incidents and communications.
4262• Consult a legal aid advisor to file a complaint with the Division of Human Rights (DHR).
4263• Do not sign any "waivers" or "severance agreements" before having them reviewed.`,tags:["employment","discrimination","age discrimination","civil rights","NYSHRL"],date:"2026-02-04"},{id:"q9",question:"A vendor breached our contract, but I can't afford a massive corporate lawsuit. Any options?",askedBy:"Kevin L.",answer:"For small to mid-sized disputes, New York offers Alternative Dispute Resolution (ADR), such as Mediation or Arbitration. These are often faster and less expensive than traditional litigation. If the amount is under $10,000 ($5,000 outside NYC), you may also utilize Small Claims Court, where legal procedures are simplified for non-lawyers.",tags:["business","contract breach","ADR","mediation","arbitration","small claims"],date:"2026-02-04"},{id:"q10",question:"My landlord refuses to make essential repairs and is threatening me with eviction. What are my rights?",askedBy:"Sophia R.",answer:`In New York, you are protected by the "Warranty of Habitability." Landlords are legally required to keep apartments safe and livable.
4264
4265• Withholding Rent: You may have the right to withhold rent until repairs are made, but this must be done correctly (usually by placing funds in an escrow account).
4266• Anti-Harassment: It is illegal for a landlord to threaten or harass a tenant into leaving.
4267• Right to Counsel: In many parts of NY (especially NYC), low-income tenants facing eviction have a right to free legal representation. Do not ignore a "Notice of Petition"—contact a legal aid advisor immediately.`,tags:["tenant rights","housing","landlord","eviction","warranty of habitability"],date:"2026-02-04"},{id:"q11",question:"I am being hounded by debt collectors for a medical bill I already paid. How do I stop the harassment?",askedBy:"Mark D.",answer:`You are protected by the Fair Debt Collection Practices Act (FDCPA). Debt collectors cannot call you at unreasonable hours, use profane language, or misrepresent the amount you owe.
4268
4269• Validation Letter: You have the right to demand a written "Validation Notice" proving the debt is yours.
4270• Cease and Desist: You can send a formal letter demanding they stop contacting you.
4271• Identity Theft: If the debt is fraudulent, we can assist you in filing a report with the FTC and freezing your credit to prevent further damage.`,tags:["consumer protection","debt collection","FDCPA","harassment","medical bills"],date:"2026-02-04"},{id:"q12",question:"I am going through a difficult separation and I'm worried about my children's safety. What is an Order of Protection?",askedBy:"Linda M.",answer:"An Order of Protection is a document issued by a court to limit the behavior of someone who harms or threatens to harm you. It can require the individual to stay away from your home, school, or workplace. As a legal aid organization, we help survivors of domestic conflict navigate Family Court to secure these orders and discuss temporary custody arrangements to ensure the safety of minors.",tags:["family law","order of protection","domestic violence","custody","safety"],date:"2026-02-04"}],relatedServices:["legal_aid","community","help_center"]}},mental_health:{id:"mental_health",keywords:["mental health","counseling","therapy","depression","anxiety","stress","crisis","988","suicide","emotional","psycholog","心理","咨询","抑郁","焦虑","压力","情绪","心理健康","心理咨询","sa
4271d","lonely","overwhelmed","burnout","mental"],category:"wellness",priority:"urgent",content:{title:"Mental Health Support",description:"PDA provides mental health resources and crisis support for our community members.",actions:[{label:"🆘 988 Crisis Lifeline",link:"tel:988",icon:"🆘",type:"primary"},{label:"💙 Mental Health Resources",link:"/mental-health-support",icon:"💙",type:"primary"},{label:"📞 NYC Well: 1-888-692-9355",link:"tel:18886929355",icon:"📞",type:"secondary"}],highlights:["🆘 Call or Text 988 — 24/7 Suicide & Crisis Lifeline (free, confidential)","💙 PDA offers emotional support and counseling referrals","📞 NYC Well: 1-888-692-9355 for NYC residents","🌐 Multi-language support available"],relatedServices:["healthcare","youth_safety","community"]}},healthcare:{id:"healthcare",keywords:["healthcare","medical","doctor","hospital","clinic","health insurance","medicaid","medicare","prescription","医疗","医生","医院","看病","体检","健康","checkup","pharmacy","药"],category:"services",priority:"high",content:{title:"Healthcare Navigation",description:"PDA helps you navigate the US healthcare system and find affordable medical services.",actions:[{label:"🏥 Healthcare Resources",link:"/healthcare-navigation",icon:"🏥",type:"primary"},{label:"📞 Contact Us",link:"/contact",icon:"📞",type:"secondary"}],highlights:["🏥 Help finding affordable doctors and clinics","📋 Health insurance enrollment assistance (Medicaid, ACA Marketplace)","💊 Prescription assistance programs","🌐 Multilingual healthcare navigation support"],relatedServices:["mental_health","insurance_help","community"]}},housing:{id:"housing",keywords:["housing","apartment","rent","landlord","tenant","eviction","lease","house","房","租房","房东","租客","搬家","住房","home","move","shelter","公寓"],category:"services",priority:"high",content:{title:"Housing Support",description:"PDA provides housing resources, tenant rights advocacy, and rental assistance.",actions:[{label:"🏘️ Housing Resources",link:"/housing-support",icon:"🏘️",type:"primary"},{label:"📞 Contact Us",link:"/contact",icon:"📞",type:"secondary"}],highlights:["🏘️ Help finding affordable housing in NYC metro area","⚖️ Tenant rights advocacy and landlord dispute mediation","📝 Lease review and rental assistance","🆘 Emergency housing resources"],relatedServices:["legal_qa","community"]}},donation:{id:"donation",keywords:["donate","donation","give","contribute","support","fundraise","charity","捐","捐款","捐赠","善款","资助","sponsor","help pda","money"],category:"donation",priority:"high",content:{title:"Support PDA",description:"Your donation helps PDA provide free legal aid, CDL training resources, and community services.",actions:[{label:"💙 Donate Now",link:"/donate",icon:"💙",type:"primary"},{label:"📧 Contact Donations Team",link:"mailto:[email protected]",icon:"📧",type:"secondary"}],highlights:["💙 PDA is a 501(c)(3) non-profit — your donation is tax-deductible","🔒 Secure online payment via Stripe","📧 For large donations, email [email protected]","🙏 Every dollar supports free services for immigrant workers"],relatedServices:["community","about_pda"]}},insurance_help:{id:"insurance_help",keywords:["insurance","auto insurance","truck insurance","health insurance","life insurance","commercial insurance","保险","车险","商业保险","claim","coverage","premium","policy"],category:"services",priority:"medium",content:{title:"Insurance Resources",description:"PDA helps truckers and community members find the right insurance coverage.",actions:[{label:"💼 Insurance Info",link:"/insurance",icon:"💼",type:"primary"},{label:"📞 Contact Us",link:"/contact",icon:"📞",type:"secondary"}],highlights:["🚛 Commercial truck insurance comparison","🏥 Health insurance enrollment guidance","💼 Workers compensation information","📋 Insurance claim assistance"],relatedServices:["healthcare","legal_qa"]}},employment:{id:"employment",keywords:["job","employment","career","hire","hiring","work","resume","interview","工作","招聘","求职","简历","面试","就业","salary","pay","trucker jobs","driver jobs"],category:"services",priority:"high",content:{title:"Employment & Career Services",description:"PDA helps community members find jobs and advance their careers.",actions:[{label:"💼 Job Resources",link:"/employment",icon:"💼",type:"primary"},{label:"📞 Contact Us",link:"/contact",icon:"📞",type:"secondary"}
4271],highlights:["🚛 Trucking job board with verified employers","📝 Resume building and interview preparation","🤝 Job placement after CDL training graduation","💼 Career counseling and skills assessment"],relatedServices:["cdl_training","driving_schools"]}},youth_safety:{id:"youth_safety",keywords:["youth","children","kids","teen","teenager","child safety","bullying","online safety","青少年","儿童","孩子","安全","校园","young","minor","student"],category:"wellness",priority:"high",content:{title:"Youth Safety Program",description:"PDA is committed to protecting young people in our community.",actions:[{label:"🛡️ Youth Safety Info",link:"/youth-safety",icon:"🛡️",type:"primary"},{label:"💙 Mental Health Support",link:"/mental-health-support",icon:"💙",type:"secondary"}],highlights:["🛡️ Online safety education for children and teens","📚 Anti-bullying resources and support","👨‍👩‍👧 Parent guidance and family support","🆘 Crisis support for at-risk youth"],relatedServices:["mental_health","community"]}},personal_injury:{id:"personal_injury",keywords:["injury","accident","hurt","crash","collision","injured","personal injury","compensation","workers comp","受伤","事故","车祸","工伤","赔偿","sue","lawsuit"],category:"legal",priority:"urgent",content:{title:"Personal Injury Support",description:"PDA connects you with legal resources for personal injury cases.",actions:[{label:"⚖️ Personal Injury Help",link:"/personal-injury",icon:"⚖️",type:"primary"},{label:"📞 Legal Aid",link:"/legal-aid",icon:"📞",type:"secondary"}],highlights:["⚖️ Free legal consultation for truck accident cases","🚛 Trucking-specific injury expertise","💰 Help with insurance claims and compensation","📋 Workers compensation guidance"],relatedServices:["legal_qa","insurance_help"]}},about_pda:{id:"about_pda",keywords:["about","pda","who","what is pda","organization","non-profit","mission","membership","join","member","leadership","structure","board","director","team","full name","stand for","stands for","what does pda","potential development","关于","组织","会员","加入","非营利","领导","架构","全称","全名","缩写"],category:"general",priority:"medium",content:{title:"About PDA",description:"Potential Development Association (PDA) is a 501(c)(3) builder-led nonprofit turning instability into stability—through communication systems, housing support, and empowerment programs. Our approach is Value-for-Value (Pay It Forward): we start with support and invite buy-in when people are ready.",actions:[{label:"📖 About Us",link:"/about-us",icon:"📖",type:"primary"},{label:"🏛️ Leadership & Structure",link:"/leadership",icon:"🏛️",type:"primary"},{label:"🤝 Join PDA",link:"/join-us",icon:"🤝",type:"primary"},{label:"📊 Transparency",link:"/transparency",icon:"📊",type:"secondary"}],highlights:["🏛️ 501(c)(3) nonprofit — 9807 Astoria Blvd 1FL, East Elmhurst, NY 11369","🎯 Three Pillars: Communication, Housing Stability, Empowerment","🤝 Value-for-Value model: support first, pay-it-forward when ready","�️ Clear, accountable org structure: Board → ED → 5 Peer Leadership Directors","👥 Professional Support Network: Attorneys, Insurance Brokers, Real Estate Agents, Mental Health Counselors, Licensed CDL/ELDT Instructors","💻 In-house Technology & R&D team (Staff · Builders)","🌐 Free legal aid, CDL training, healthcare, housing support"],relatedServices:["donation","community"]}},staff_operations:{id:"staff_operations",keywords:["office","staff","admin","dashboard","member portal","internal","backend"],category:"internal",priority:"high",requiresAuth:!0,content:{title:"Office Operations & Staff Portal",description:"Internal navigation and tools for PDA staff and members",quickLinks:[{name:"Member Dashboard",description:"View your membership status and benefits",link:"/member-portal",icon:"👤"},{name:"Admin Panel",description:"Manage users, content, and settings",link:"/admin",icon:"⚙️",requiresAdmin:!0},{name:"Q&A Management",description:"Moderate and respond to community questions",link:"/admin/qa",icon:"💬"},{name:"Email Inbox",description:"Check routed department emails",link:"/admin/emails",icon:"📧"},{name:"Analytics",description:"View website and AI performance",link:"/ai-analytics",icon:"📊"},{name:"Content Editor",description:"Edit pages, articles, and resources",link:"/admin/content",icon:"✏️"}],commonTasks:[{task:"Answer Community Questions",steps:["Go to Q&A Management → /admin/qa",'Filter by "Unanswered" or "Urgent"','Click "Respond" and provide professional answer','Mark as "Answered"']}
4271,{task:"Check Routed Emails",steps:["Go to Email Inbox → /admin/emails","Select your department (Legal, Healthcare, etc.)","Review and respond to inquiries",'Mark as "Resolved"']},{task:"Update Partner Information",steps:["Go to Content Editor → /admin/content",'Navigate to "Partners" section',"Edit driving school, lawyer, or service provider info","Save and publish changes"]}],relatedServices:["admin_panel","member_portal"]}},admin_quick_actions:{id:"admin_quick_actions",keywords:["quick action","shortcut","admin tools","fast access","productivity"],category:"internal",priority:"high",requiresAuth:!0,content:{title:"Admin Quick Actions",description:"Fast access to common admin tasks",actions:[{name:"Create New Article",link:"/admin/content/new",icon:"📝",shortcut:"Ctrl+N"},{name:"View Pending Approvals",link:"/admin/approvals",icon:"✅",badge:"pending_count"},{name:"Export User Data",link:"/admin/export",icon:"📥"},{name:"System Settings",link:"/admin/settings",icon:"⚙️"}]}}},qK=t=>{const e=t.toLowerCase().trim(),n=[];return Object.values(HK).forEach(r=>{let s=0;r.keywords.forEach(i=>{e.includes(i.toLowerCase())&&(s+=r.priority==="high"?10:5)}),r.keywords.forEach(i=>{i.toLowerCase().split(" ").forEach(c=>{c.length>2&&e.includes(c)&&(s+=2)})}),s>0&&n.push({entry:r,score:s})}),n.sort((r,s)=>s.score-r.score),n.map(r=>r.entry)},WK=(t,e)=>{if(e.length===0)return{content:`I'm here to help!
4272
4273🚛 CDL Training & Exam Preparation
4274🏫 Find Driving Schools
4275📱 Download Learning Apps
4276🗺️ New York Services & Resources
4277💬 Community Support
4278
4279What would you like to know?`,actions:[{label:"CDL Training Guide",link:"/services#cdl-training",type:"primary"},{label:"Contact Driving Schools",link:"/partners/driving-schools",type:"secondary"},{label:"Download Apps",link:"/apps"}],relatedTopics:[]};const n=e[0];switch(n.category){case"training":return GK(n);case"partners":return KK(n);case"products":return YK(n);case"location":return QK(n);case"support":return JK(n);case"internal":return ZK(n);case"wellness":case"services":case"donation":case"legal":case"general":return XK(n);default:return SD(n)}},GK=t=>{const e=t.content;return{content:`📚 **${e.title}**
4280
4281${e.description}
4282
4283**Your Learning Path:**
4284
4285`+e.steps.map((n,r)=>`${n.step}️⃣ **${n.title}**
4286   ${n.action} - ${n.details}`).join(`
4287
4288`),actions:e.steps.slice(0,3).map(n=>({label:n.action,link:n.link,type:n.step===1?"primary":"secondary"})),relatedTopics:e.relatedServices}},KK=t=>{const e=t.content,n=e.partners[0];return{content:`🏫 **${n.name}**
4289
4290📍 Location: ${n.location}
4291⭐ Rating: ${n.rating}★ (${n.reviewSource})
4292
4293**Why Choose This School?**
4294`+e.whyChoose.map(r=>`${r}`).join(`
4295`)+`
4296
4297**Key Features:**
4298`+n.features.map(r=>`✅ ${r}`).join(`
4299`)+`
4300
4301**Services Offered:**
4302`+e.services.slice(0,5).map(r=>`• ${r}`).join(`
4303`)+`
4304
4305💡 **Start your CDL journey today!**`,actions:[{label:`📞 Contact ${n.name}`,link:n.link,type:"primary",icon:"🚛"},{label:"View Details",link:"/partners/driving-schools#js-driving",type:"secondary",icon:"ℹ️"},{label:"Download CDL App",link:"/apps",type:"secondary",icon:"📱"}],relatedTopics:e.relatedServices,specialOffer:"🎁 Special discounts available through PDA!"}},YK=t=>{const e=t.content;return{content:`📱 **${e.title}**
4306
4307${e.description}
4308
4309`+e.apps.map(n=>`**${n.name}**
4310${n.description}
4311✨ ${n.features.join(" • ")}`).join(`
4312
4313`),actions:e.apps.map((n,r)=>({label:`Download ${n.name}`,link:n.link,type:r===0?"primary":"secondary"})),relatedTopics:e.relatedServices}},QK=t=>{const e=t.content;return{content:`🗽 **${e.title}**
4314
4315${e.description}
4316
4317**Available Services:**
4318`+e.services.map(n=>`✓ ${n.name}`).join(`
4319`)+`
4320
4321📍 Service Areas: ${e.locations.join(", ")}`,actions:e.services.slice(0,3).map(n=>({label:n.name,link:n.link,type:"secondary"})),relatedTopics:e.relatedServices}},JK=t=>{const e=t.content;return{content:`💬 **${e.title}**
4322
4323${e.description}
4324
4325`+(e.features?e.features.map(n=>`• ${n.name}`).join(`
4326`):e.options.map(n=>`• ${n.name}`).join(`
4327`)),actions:(e.features||e.options).slice(0,3).map(n=>
4327({label:n.name,link:n.link||"#",action:n.action,type:"secondary"})),relatedTopics:e.relatedServices||[]}},SD=t=>{const e=t.content;return{content:`ℹ️ **${e.title}**
4328
4329${e.description}`,actions:e.actions||[{label:"Learn More",link:"/services",type:"primary"}],relatedTopics:e.relatedServices||[]}},XK=t=>{const e=t.content;let n="";return e.highlights&&e.highlights.length>0?n=`**${e.title}**
4330
4331${e.description}
4332
4333`+e.highlights.join(`
4334`):n=`**${e.title}**
4335
4336${e.description}`,t.priority==="urgent"&&(n=`🚨 ${n}`),{content:n,actions:e.actions||[{label:"Learn More",link:"/services",type:"primary"}],relatedTopics:e.relatedServices||[]}},ZK=t=>{const e=t.content;return t.id==="staff_operations"?{content:`👔 **${e.title}**
4337
4338${e.description}
4339
4340**Quick Links:**
4341`+e.quickLinks.slice(0,4).map(n=>`${n.icon} **${n.name}** - ${n.description}`).join(`
4342`)+`
4343
4344**Common Tasks:**
4345`+e.commonTasks.slice(0,2).map(n=>`• ${n.task}`).join(`
4346`),actions:e.quickLinks.slice(0,5).map(n=>({label:`${n.icon} ${n.name}`,link:n.link,type:n.requiresAdmin?"admin":"primary",icon:n.icon})),relatedTopics:e.relatedServices||[]}:t.id==="admin_quick_actions"?{content:`⚡ **${e.title}**
4347
4348${e.description}
4349
4350`+e.actions.map(n=>`${n.icon} **${n.name}**`+(n.shortcut?` (${n.shortcut})`:"")).join(`
4351`),actions:e.actions.map(n=>({label:`${n.icon} ${n.name}`,link:n.link,type:"admin",icon:n.icon})),relatedTopics:[]}:SD(t)},Sf=(t,e,n)=>{const r={query:t,action:e,helpful:n,timestamp:new Date().toISOString()},s=JSON.parse(localStorage.getItem("ai_interactions")||"[]");return s.push(r),s.length>100&&s.shift(),localStorage.setItem("ai_interactions",JSON.stringify(s)),r};let kf=null,fS=0;const eY=600*1e3,kD=async()=>{if(kf&&Date.now()-fS<eY)return kf;try{let t=[],e=[],n=[];[t,e,n]=await Promise.all([Ny("ai_knowledge_base"),Ny("amy_dynamic_knowledge"),Ny("career_events",{forceRefresh:!0})]),e=e.filter(u=>!u.expires_at||new Date(u.expires_at)>new Date).sort((u,d)=>new Date(d.created_at||0)-new Date(u.created_at||0)).slice(0,100);const r=(t||[]).map(u=>({id:u.intent||u.id,keywords:nY(u.content),category:u.category,priority:u.routing_config?.priority||"medium",accessLevel:u.access_level,content:{title:rY(u.content),description:sY(u.content),actions:oY(u.action_config,u.content),highlights:iY(u.content),relatedServices:u.content?.relatedServices||[]},_dynamic:!0,_firebaseId:u.id,_usageCount:u.usage_count||0,_source:"ai_knowledge_base"})),s=(e||[]).map(u=>{const d=tY(u.sources);return{id:`dynamic_${u.hash}`,keywords:u.question.toLowerCase().split(/\s+/).filter(f=>f.length>2),category:u.category,priority:"medium",accessLevel:"public",content:{title:u.summary||u.question,description:u.answer,quickAnswer:u.answer,actions:d.length>0?[{label:"🔗 View Sources",type:"info",metadata:{sources:d}}]:[],highlights:u.sources?[`📅 Learned: ${new Date(u.created_at).toLocaleDateString()}`,`⏳ Expires: ${new Date(u.expires_at).toLocaleDateString()}`]:[],relatedServices:[]},_dynamic:!0,_autoLearned:!0,_firebaseId:u.id,_hash:u.hash,_lang:u.lang,_expiresAt:u.expires_at,_usageCount:0,_source:"amy_dynamic_knowledge"}}),i=new Date().toISOString().slice(0,10),c=[...(n||[]).filter(u=>u.status==="published").map(u=>{const d=String(u.event_date||"")<i,f=(u.positions||[]).map(x=>`${x.title} (${x.location||"location pending"}; ${x.starting_pay||"pay pending"})`),g=[`${u.event_date||"Date pending"} · ${u.event_time||"Time pending"}`,u.location||"Location pending",u.summary||u.details||"",f.length>0?`Positions: ${f.join("; ")}`:"Employer, position, pay, and registration details are still being confirmed."].filter(Boolean).join(`
4352`),y=[u.title,u.title_zh,u.summary,u.summary_zh,u.location,...(u.positions||[]).flatMap(x=>[x.title,x.title_zh,x.location]),"career event hiring event job jobs event employment registration","职业活动 招聘会 工作 求职 报名"].filter(Boolean).join(" ").toLowerCase();return{id:`career_event_${u.id}`,keywords:Array.from(new Set(y.split(/[^\p{L}\p{N}]+/u).filter(x=>x.length>=2))),category:"career_events",priority:d?"low":"urgent",accessLevel:"public",content:{title:u.title,description:`${d?"Past event":"Upcoming event"}
4353${g}`,actions:[{label:"View Event Details",link:`/career-events/${u.slug}`,type:"primary"}],highlights:[],relatedServices:["employment"]},_dynamic:!0,_firebaseId:u.id,_source:"career_events"}}),...r,...s];return kf=c,fS=Date.now(),c}catch{return kf||[]}},tY=t=>{if(Array.isArray(t))return t;if(typeof t!="string"||!t.trim())return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}},nY=t=>{if(!t)return[];const e=new Set;for(const n of Object.values(t))n?.keywords&&Array.isArray(n.keywords)&&n.keywords.forEach(r=>e.add(r.toLowerCase()));return[...e]},rY=t=>t?t?.en?.greeting||t?.["zh-CN"]?.greeting||Object.values(t)?.[0]?.greeting||"Information":"Unknown",sY=t=>t&&(t?.en?.quick_answer||t?.["zh-CN"]?.quick_answer||Object.values(t)?.[0]?.quick_answer)||"",iY=t=>{if(!t)return[];const e=t?.en?.highlights||t?.["zh-CN"]?.highlights||[];return Array.isArray(e)?e:[]},oY=(t,e)=>{const n=[];return t?.target&&n.push({label:e?.en?.action_label||"Learn More",link:t.target,icon:"🔗",type:"primary"}),t?.contact_link&&n.push({label:"Contact Us",link:t.contact_link,icon:"📞",type:"secondary"}),n.length===0&&n.push({label:"Learn More",link:"/services",type:"primary"}),n},aY=async t=>{const e=qK(t);let n=[];try{n=await kD()}catch{}if(n.length===0)return e;const r=t.toLowerCase().trim(),s=[];for(const d of n){let f=0;for(const g of d.keywords)r.includes(g)&&(f+=d.priority==="high"||d.priority==="urgent"?10:5);for(const g of d.keywords){const y=g.split(" ");for(const x of y)x.length>2&&r.includes(x)&&(f+=2)}f>0&&s.push({...d,score:f})}const i=new Set(e.map(d=>d.id)),a=s.filter(d=>!i.has(d.id)).sort((d,f)=>f.score-d.score),c=a.filter(d=>d.priority==="urgent"),u=a.filter(d=>d.priority!=="urgent");return[...c,...e,...u]},lY=async(t,e="en",n="guest")=>{try{await ci(ui,"saveAmyLearningQuestion")({question:t.substring(0,500),language:e,userRole:n})}catch{}},a0=()=>new Date().toISOString(),cY=()=>{try{return(navigator?.userAgent||"").substring(0,500)||null}catch{return null}};function uY(t){const e=String(t).toLowerCase();return e==="ai"||e==="assistant"?"ai":"user"}function dY(t,e=2e3){return String(t||"").slice(0,e)}function Nu(t){const e=String(t||"");return/[\u4e00-\u9fff]/.test(e)?"zh-CN":/[\uac00-\ud7af]/.test(e)?"ko-KR":/[\u3040-\u309f\u30a0-\u30ff]/.test(e)?"ja-JP":/[\u0600-\u06ff]/.test(e)?"ar-SA":/[\u0400-\u04ff]/.test(e)?"ru-RU":/[\u0e00-\u0e7f]/.test(e)?"th-TH":/[àáạảãâầấậẩẫăằắặẳẵèéẹẻẽêềếệểễìíịỉĩòóọỏõôồốộổỗơờớợởỡùúụủũưừứựửữỳýỵỷỹđ]/i.test(e)?"vi-VN":/¿|¡|ñ|á|é|í|ó|ú|ü/i.test(e)||/\b(el|la|los|las|un|una|por|para|usted)\b/i.test(e)?"es-ES":/[ãõç]/i.test(e)||/\b(olá|você|pra|porque|também)\b/i.test(e)?"pt-B
4353R":/[àâçéèêëîïôùûüÿœ]/i.test(e)||/\b(bonjour|merci|vous|pourquoi)\b/i.test(e)?"fr-FR":/[äöüß]/i.test(e)||/\b(hallo|danke|bitte|warum)\b/i.test(e)?"de-DE":/\b(ciao|grazie|perché|come|buongiorno)\b/i.test(e)?"it-IT":/\b(halo|terima kasih|kamu|saya|tidak|apa)\b/i.test(e)?"id-ID":/[\u0900-\u097f]/.test(e)?"hi-IN":"en-US"}async function hY({userId:t=null,meta:e={}}={}){if(!$e)return null;const n=a0(),r={user_id:t,session_data:{...e,started_at:n,user_agent:cY()},updated_at:n,last_activity:n};try{const{data:s,error:i}=await $e.from("amy_chat_sessions").insert(r).select("id");if(i)return null;const a=Array.isArray(s)?s?.[0]?.id:s?.id;return a||null}catch{return null}}async function Ri(t,e){if(!$e||!t)return null;try{const n=a0(),{data:r,error:s}=await $e.from("amy_chat_messages").insert({session_id:t,message_type:uY(e?.type||"user"),message_text:dY(e?.text||"",4e3),lang:e?.lang||"auto",model:e?.model||null,provider:e?.provider||null,prompt_tokens:e?.promptTokens||null,completion_tokens:e?.completionTokens||null,total_tokens:e?.totalTokens||null,latency_ms:e?.latency||null}).select("id");if(s)return null;await $e.from("amy_chat_sessions").update({last_activity:n,updated_at:n}).eq("id",t);const i=Array.isArray(r)?r?.[0]?.id:r?.id;return Array.isArray(r)?r[0]:r}catch{return null}}async function If(t,e={}){if(!$e||!t)return null;try{const n=a0(),{data:r,error:s}=await $e.from("amy_chat_sessions").select("id, session_data").eq("id",t).maybeSingle();if(s||!r)return null;const a={...r?.session_data||{},...e},{data:c,error:u}=await $e.from("amy_chat_sessions").update({session_data:a,updated_at:n,last_activity:n}).eq("id",t).select("id, session_data").maybeSingle();return u?null:c}catch{return null}}async function pS(t,e={}){if(!$e||!t)return;const n=a0();try{const{data:r}=await $e.from("amy_chat_sessions").select("session_data").eq("id",t).maybeSingle(),i={...r?.session_data||{},...e,ended_at:n},a=`https://fhdazecpdftfewdmmufb.supabase.co/rest/v1/amy_chat_sessions?id=eq.${t}`;await fetch(a,{method:"PATCH",headers:{apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZoZGF6ZWNwZGZ0ZmV3ZG1tdWZiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njg1Mzc0ODUsImV4cCI6MjA4NDExMzQ4NX0.6b6wbexY7an9RvFrke_cHRXTWtwGbeqaP5wRp9fRxeU",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZoZGF6ZWNwZGZ0ZmV3ZG1tdWZiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njg1Mzc0ODUsImV4cCI6MjA4NDExMzQ4NX0.6b6wbexY7an9RvFrke_cHRXTWtwGbeqaP5wRp9fRxeU","Content-Type":"application/json",Accept:"application/json",Prefer:"return=minimal"},body:JSON.stringify({session_data:i,updated_at:n,last_activity:n}),keepalive:!0})}catch{}}function fY(t=""){const e=(t||"").trim();return e?/[\u4e00-\u9fff]/.test(e)?"zh":/[\uac00-\ud7af]/.test(e)||/[\u3040-\u30ff]/.test(e)||/[\u0600-\u06ff]/.test(e)||/[\u0400-\u04ff]/.test(e)||/[\u0e00-\u0e7f]/.test(e)?"multi":/[A-Za-z]/.test(e)?"en":"multi":"en"}const $n={en:"en-US",zh:"zh-CN",es:"es-ES",vi:"vi-VN",th:"th-TH",ar:"ar-SA",ru:"ru-RU",ko:"ko-KR",ja:"ja-JP",fr:"fr-FR",de:"de-DE",it:"it-IT",pt:"pt-PT",hi:"hi-IN",id:"id-ID"};function pY(){try{const e=document.cookie.split(";").find(s=>s.trim().startsWith("googtrans="));return e&&((e.split("=").pop()||"").split("/")[2]||"")||null}catch{return null}}function Hv(t){if(!t)return $n.en;const e=String(t).replace("_","-").toLowerCase();return e.startsWith("zh")?$n.zh:e.startsWith("en")?$n.en:e.startsWith("es")?$n.es:e.startsWith("vi")?$n.vi:e.startsWith("th")?$n.th:e.startsWith("ar")?$n.ar:e.startsWith("ru")?$n.ru:e.startsWith("ko")?$n.ko:e.startsWith("ja")?$n.ja:e.startsWith("fr")?$n.fr:e.startsWith("de")?$n.de:e.startsWith("it")?$n.it:e.startsWith("pt")?$n.pt:e.startsWith("hi")?$n.hi:e.startsWith("id")?$n.id:e.includes("-")?t:$n.en}function mm(){const t=pY();if(t)return Hv(t);const e=navigator.language||"en-US";return Hv(e)}function gm(t){return t?t.split("-")[0].toLowerCase():"en"}function mY(t){if(!t||typeof t!="string")return"en";if(/[\u4e00-\u9fff]/.test(t))return"zh";if(/[\u3040-\u309F\u30A0-\u30FF]/.test(t))return"ja";if(/[\uAC00-\uD7AF]/.test(t))return"ko";if(/[\u0600-\u06FF]/.test(t))return"ar";if(/[\u0E00-\u0E7F]/.test(t))return"th";if(/[àáạảãâầấậẩẫăằắặẳẵèéẹẻẽêềếệểễìíịỉĩòóọỏõôồốộổỗơờớợởỡùúụủũưừứựửữỳýỵỷỹđ]/i.test(t))return"vi";if(/[\u0900-\u097F]/.test(t))return"hi";const e=t.toLowerCase();return/\b(el|la|los|las|un|una|de|en|que|es|por|para|con|no|una|su|al|lo|como|más|pero|sus|le|ya|o|fue|este|ha|sí|porque|esta|son|entre|está|cuando|muy|sin|sobre|ser|tiene|también|me|hasta|hay|donde|han|quien|están|sea|puede|soy|dónde|estoy|estos|está)\b/.test(e)?"es":/\b(le|la|les|un|une|de|et|à|dans|pour|que|qui|ne|sur|se|pas|plus|avec|ce|il|par|sont|ou|être|avoir|peut|nous|vous|sa|son|ses|tout|comme|mais|où|si|faire|été|lui|aussi|mes|tes|notre|votre|leur)\b/.test(e)?"fr":/\b(der|die|das|den|dem|des|ein|eine|einen|einem|eines|und|in|von|zu|den|mit|sich|auf|für|ist|im|nicht|eine|als|auch|es|an|werden|aus|er|hat|dass|sie|nac
4353h|wird|bei|noch|wie|einem|über|einen|diese)\b/.test(e)?"de":/\b(il|lo|la|i|gli|le|un|uno|una|di|da|in|con|su|per|tra|fra|a|del|della|dei|degli|delle|al|alla|ai|agli|alle|nel|nella|nei|negli|nelle|sul|sulla|sui|sugli|sulle|dal|dalla|dai|dagli|dalle|che|non|è|sono|ho|hai|ha|abbiamo|avete|hanno|e|ma|o|se|anche|come|più|molto|quando|dove|chi|cosa|questo|quello)\b/.test(e)?"it":/\b(o|a|os|as|um|uma|de|em|para|com|por|no|na|nos|nas|do|da|dos|das|ao|à|aos|às|pelo|pela|pelos|pelas|que|não|se|é|são|foi|ser|tem|como|mais|ou|mas|eu|você|ele|ela|nós|eles|elas|este|esse|aquele|meu|teu|seu|nosso|vosso|muito|muito|já|ainda|também|onde|quando|como|porque)\b/.test(e)?"pt":/\b(yang|dan|di|ke|dari|untuk|pada|dengan|adalah|ini|itu|akan|sudah|tidak|ada|atau|juga|oleh|karena|saya|kami|kita|anda|dia|mereka|bisa|harus|dapat|telah|sedang|seperti|lebih|paling|sangat|sebagai|tentang)\b/.test(e)?"id":/\b(ang|ng|sa|mga|ay|na|at|kung|siya|ko|mo|niya|natin|nila|para|mula|hanggang|kaya|pero|o|dahil|kapag|nang|dapat|pwede|gusto|kailangan|alam|ito|iyan|iyon|dito|diyan|doon|ako|ikaw|tayo|kayo|sila)\b/.test(e)?"tl":"en"}const ID="PDA-AMY-TTS-V4.0-UNIFIED",PD={autoDetectLang:!0,useCloudCache:!0,useSentenceSequence:!0,autoPlay:!1,volume:1,onProgress:null,onError:null,onComplete:null};async function Ga(t,e={}){const n={...PD,...e};try{let r;n.lang?r=n.lang:r=mY(t)||"en";const s=Hv(r),i=gm(s),a=o0(s,{response_format:"mp3"}),c=await AD(t,i,{voice:a.voice,model:a.model,speed:a.speed,instructions:a.instructions,onProgress:n.onProgress},n.useSentenceSequence);if(!c)throw new Error("getAmyAudio returned null/undefined");if(!c.blob)throw new Error("getAmyAudio returned no blob");c.source;const u=new Audio;return u.volume=n.volume,u.src=URL.createObjectURL(c.blob),n.onComplete&&(u.onended=()=>{n.onComplete()}),u.onerror=d=>{n.onError&&n.onError(d)},n.autoPlay&&await u.play(),{audio:u,blob:c.blob,source:c.source,cacheKey:c.cacheKey}}catch(r){const s=gY(r);throw n.onError&&n.onError(r),r}}class hw{constructor(e={}){this.config={...PD,...e},this.audio=null,this.isPlaying=!1,this.currentText=null,this.currentLang=null,this.onSpeaking=null,this.onPaused=null,this.onStopped=null,this.onError=null}async speak(e,n={}){this.isPlaying&&this.stop(),this.currentText=e;const r={...this.config,...n};try{const s=await Ga(e,{...r,autoPlay:!0,onComplete:()=>{this.isPlaying=!1,this.onStopped&&this.onStopped()},onError:i=>{this.isPlaying=!1,this.onError&&this.onError(i)}});this.audio=s.audio,this.isPlaying=!0,this.audio.onplay=()=>{this.isPlaying=!0,this.onSpeaking&&this.onSpeaking()},this.audio.onpause=()=>{this.isPlaying=!1,this.onPaused&&this.onPaused()}}catch(s){throw this.isPlaying=!1,this.onError&&this.onError(s),s}}pause(){this.audio&&this.isPlaying&&this.audio.pause()}resume(){this.audio&&!this.isPlaying&&this.audio.play()}stop(){this.audio&&(this.audio.pause(),this.audio.currentTime=0,this.isPlaying=!1,this.onStopped&&this.onStopped())}setVolume(e){this.audio&&(this.audio.volume=Math.max(0,Math.min(1,e)))}getStatus(){return{isPlaying:this.isPlaying,currentText:this.currentText,currentLang:this.currentLang,volume:this.audio?this.audio.volume:this.config.volume}}destroy(){this.stop(),this.audio=null}}function RD(t={}){return new hw(t)}async function DD(t,e={}){const n=[];for(let s=0;s<t.length;s++){const i=t[s];try{const a=await Ga(i,{...e,autoPlay:!1});n.push({text:i,success:!0,cacheKey:a.cacheKey,source:a.source})}catch(a){n.push({text:i,success:!1,error:a.message})}}const r=n.filter(s=>s.success).length;return n}const ym={en:{greeting_warm:"Welcome! I'm Amy from PDA. How can I help you today?",greeting_casual:"Hi there! What can I do for you?",thinking:"Let me find that information for you.",processing:"Just a moment while I look into that.",confirm_got_it:"Got it. Let me help you with that.",confirm_understand:"I understand. Here's what I can do.",encourage_explore:"Feel free to explore our services. I'm always here if you need me.",encourage_action:"I'm here to help you every step of the way.",ending_warm:"Take care, and don't hesitate to reach out anytime.",ending_supportive:"I'm always here if you need support. Have a wonderful day!",apology_gentle:"I'm so sorry about that. Let's find a solution together.",thanks_genuine:"Thank y
4353ou for trusting PDA. I really appreciate it."},zh:{greeting_warm:"你好!我是PDA的智能助理Amy。有什么可以帮到您?",greeting_casual:"您好!需要我帮忙吗?",thinking:"让我为您查找相关信息。",processing:"请稍等,我正在处理。",confirm_got_it:"好的,我来帮您处理。",confirm_understand:"我明白了。让我为您解答。",encourage_explore:"欢迎探索我们的服务。有需要随时找我。",encourage_action:"我会一步一步帮助您的。",ending_warm:"保重,有需要随时联系我。",ending_supportive:"我随时在这里支持您。祝您一切顺利!",apology_gentle:"真的很抱歉。让我们一起找到解决方案。",thanks_genuine:"感谢您对PDA的信任。我会尽力帮助您。"}};async function ND(t,e=null){const n=e||mm(),r=gm(n),i=(ym[r]||ym.en)[t];if(!i)throw new Error(`❌ 未找到常用语句: ${t}`);return Ga(i,{lang:n})}function OD(){return typeof Audio<"u"}function gY(t){const e=t.message||"";return e.includes("401")||e.includes("Unauthorized")?"❌ OpenAI API 密钥无效或未配置。请联系管理员配置 VITE_OPENAI_API_KEY":e.includes("429")||e.includes("rate limit")?"❌ API 调用次数超限。请稍后再试。":e.includes("quota")||e.includes("insufficient_quota")?"❌ OpenAI API 配额不足。请联系管理员充值。":e.includes("network")||e.includes("NetworkError")?"❌ 网络连接失败。请检查您的网络连接。":e.includes("CORS")?"❌ 跨域请求被阻止。请联系管理员检查服务器配置。":e.includes("storage/unauthorized")?"❌ Firebase Storage 权限不足。请配置 Security Rules。":e.includes("functions/not-found")?"❌ Cloud Function 未部署。请运行: firebase deploy --only functions":`❌ 语音生成失败: ${e}`}function LD(){if(typeof Audio>"u")return"mp3";const t=new Audio;return t.canPlayType("audio/opus")?"opus":t.canPlayType("audio/aac")?"aac":t.canPlayType("audio/mpeg")?"mp3":t.canPlayType("audio/flac")?"flac":"mp3"}const yY={PDA_AMY_TTS_VERSION:ID,speakWithPdaAmy:Ga,createAmyPlayer:RD,AmyPlayer:hw,warmupPdaAmyCache:DD,COMMON_PHRASES:ym,speakCommonPhrase:ND,isSpeechSupported:OD,getRecommendedAudioFormat:LD},VX=Object.freeze(Object.defineProperty({__proto__:null,AmyPlayer:hw,COMMON_PHRASES:ym,PDA_AMY_TTS_VERSION:ID,createAmyPlayer:RD,default:yY,getRecommendedAudioFormat:LD,isSpeechSupported:OD,speakCommonPhrase:ND,speakWithPdaAmy:Ga,warmupPdaAmyCache:DD},Symbol.toStringTag,{value:"Module"}));/**
4354 * @license lucide-react v0.469.0 - ISC
4355 *
4356 * This source code is licensed under the ISC license.
4357 * See the LICENSE file in the root directory of this source tree.
4358 */const vY=Ke("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
4359 * @license lucide-react v0.469.0 - ISC
4360 *
4361 * This source code is licensed under the ISC license.
4362 * See the LICENSE file in the root directory of this source tree.
4363 */const _Y=Ke("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]),mS=["Hi everyone! I'm Amy, your AI assistant at PDA — Potential Development Association.","2026, the Year of the Golden Horse — Wishing you a joyful and prosperous Spring Festival!","As we welcome the fifth day of the Lunar New Year — a special day to receive the God of Wealth — may prosperity, opportunity, and new beginnings flow into your life.","May true wealth mean not only career success, but also health, stability, and peace of mind for you and your family.","This past year, we worked hard to turn instability into stability — closing information gaps, clarifying pathways, and bringing resources closer, so you can find support faster.","In 2026, we'll keep our 'Pay It Forward Together' spirit going — stronger services, steadier support.","Digital solutions and AI, CDL commercial driving training, legal and immigration guidance, housing and school safety — we'll be right here with you.","May you gallop forward like the golden horse — fearless, steady, toward a brighter future!","Whenever you need help, just tap the bottom-right corner — I'm always here for you!"],gS=["大家好,我是 PDA 智能助理 Amy。","2026 金马迎春,我代表 Potential Development Association—PDA 全体团队,祝您新春快乐,万事顺意!","值此正月初五迎财神的日子,愿财气盈门、机遇常在,新的一年步步高升。","愿您所求之“财”,不仅是事业与收入的增长,更是家人的健康平安、生活的踏实安心。","过去一年,我们努力把不稳定性转化为稳定:把信息差变小,把路径讲清,把资源带到您身边,让您在需要的时候更快找到方向与支持。","新的一年,我们将继续秉持「携手互助」的理念——Pay It Forward Together,以更深厚的社区关怀,做您可靠的后盾。","2026 年,我们将持续推进:数字解决方案,持续迭代自研 APP 与 AI 系统,用科技抹平信息差;职业技能培训,深耕 
4363CDL 商业驾照培训,助力奋斗者提升技能、拓展机会;","信息指引与资源对接,围绕交通法与移民相关事务,提供更清晰的流程指引与可靠资源连接;","住房与校园安全,与伙伴携手,守护安居梦想,为孩子们构建更安心的环境。","马蹄声声,步步向前。愿您在 2026 年马到成功,奔向更加灿烂的未来!","遇到挑战,别忘了点右下角——我一直在这里。"];function xY(){if(typeof navigator>"u")return"mp3";const t=navigator.userAgent||"",e=/iPhone|iPad|iPod/i.test(t),n=/^((?!chrome|android).)*safari/i.test(t);return e||n?"aac":"mp3"}function wY(t,e,n){const r=u=>(u||"").replace(/\s+/g," ").trim(),s=u=>{const d=r(u);if(!d)return 1;if(n==="zh"){const f=d.replace(/[^\u4e00-\u9fa5A-Za-z0-9]/g,"");return Math.max(2,f.length)}else{const f=d.split(/\s+/).filter(Boolean);return Math.max(2,f.length)}},i=t.map(s),a=i.reduce((u,d)=>u+d,0)||1;let c=0;return i.map(u=>(c+=u/a*e,c))}const FD=({customText:t,customLang:e="auto",autoPlay:n=!1,compact:r=!1,scenario:s=null,language:i=null})=>{const[a,c]=S.useState(e),[u,d]=S.useState("en-US"),[f,g]=S.useState(!1),[y,x]=S.useState(!1),[b,E]=S.useState(!1),[w,R]=S.useState(-1),[C,k]=S.useState(""),[N,V]=S.useState(0),[$,D]=S.useState(null),I=S.useRef(null),B=S.useRef(null),O=S.useRef(null);S.useRef(new Map);const F={en:"en-US",zh:"zh-CN",es:"es-ES",vi:"vi-VN",th:"th-TH",ar:"ar-SA",ru:"ru-RU",ko:"ko-KR",ja:"ja-JP",fr:"fr-FR",de:"de-DE",it:"it-IT",pt:"pt-BR",hi:"hi-IN",id:"id-ID"},L=S.useCallback(()=>t||(u.startsWith("zh")?gS:mS).join(`
4364`),[t,u]),M=S.useCallback(()=>t?t.split(/[\n]+/).map(K=>K.trim()).filter(Boolean):u.startsWith("zh")?gS:mS,[t,u]);S.useEffect(()=>{if(i){const K=F[i]||F.en;d(K);return}if(a!=="auto"){d(a==="zh"?"zh-CN":"en-US");return}d(mm())},[a,t,i]),S.useEffect(()=>{const K=I.current;if(!K)return;const re=()=>{E(!0)},ee=()=>{E(!1)},U=()=>{E(!1)},W=Q=>{E(!1)},te=()=>{E(!1),g(!1),R(-1),k(""),V(100),cancelAnimationFrame(O.current),setTimeout(()=>V(0),2e3)};return K.addEventListener("playing",re),K.addEventListener("pause",ee),K.addEventListener("waiting",U),K.addEventListener("error",W),K.addEventListener("ended",te),()=>{K.removeEventListener("playing",re),K.removeEventListener("pause",ee),K.removeEventListener("waiting",U),K.removeEventListener("error",W),K.removeEventListener("ended",te)}},[]),S.useEffect(()=>()=>{B.current&&URL.revokeObjectURL(B.current),O.current&&cancelAnimationFrame(O.current)},[]);const se=S.useCallback((K,re,ee)=>{const U=K.duration||0;if(!U||!re?.length)return;const W=wY(re,U,ee==="zh"?"zh":"en"),te=()=>{if(!K||K.paused||K.ended)return;const Q=K.currentTime;let pe=W.findIndex(xe=>Q<=xe);pe<0&&(pe=re.length-1),R(pe),k(re[pe]||""),V(U>0?Q/U*100:0),O.current=requestAnimationFrame(te)};O.current=requestAnimationFrame(te)},[]),H=async()=>{if(y)return;x(!0),D(null),R(0);const K=M();k(K[0]||"");const re=I.current;if(!re){x(!1);return}try{const ee="data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQAAAAA=";re.src=ee,await re.play(),re.pause()}catch{}try{if(!t||s){let pe;i?pe=i:pe=u.split("-")[0];let xe,Oe;if(s){const Me=`${s}.mp3`;xe=`https://firebasestorage.googleapis.com/v0/b/pdaus-org.appspot.com/o/audio%2Fholidays%2F${pe}%2F${encodeURIComponent(Me)}?alt=media`,Oe=`/audio/holidays/${pe}/${Me}`}else{const Me=pe==="zh"?"zh-CN":"en",dt={en:"https://firebasestorage.googleapis.com/v0/b/pdaus-org.appspot.com/o/audio%2Fpregenerated%2Famy-new-year-2026-en.mp3?alt=media","zh-CN":"https://firebasestorage.googleapis.com/v0/b/pdaus-org.appspot.com/o/audio%2Fpregenerated%2Famy-new-year-2026-zh.mp3?alt=media"},ht={en:"/audio/pregenerated/amy-new-year-2026-en.mp3","zh-CN":"/audio/pregenerated/amy-new-year-2026-zh.mp3"};xe=dt[Me],Oe=ht[Me]}if(B.current){try{URL.revokeObjectURL(B.current)}catch{}B.current=null}const ve=async(Me,dt)=>new Promise((ht,Nn)=>{const St=setTimeout(()=>{Nn(new Error(`${dt} load timeout after 30 seconds`))},3e4);re.onloadedmetadata=()=>{clearTimeout(St),ht({success:!0,duration:re.duration,source:dt})},re.onerror=$t=>{clearTimeout(St),Nn(new Error(`${dt} load failed: ${re.error?.message||"Unknown error"}`))},re.src=Me,re.load()});try{let Me;try{Me=await ve(xe,"Firebase")}catch{try{Me=await ve(Oe,"Local")}catch(ht){throw ht}}if(Me.duration>0){x(!1),await re.play(),g(!0),E(!0),se(re,K,u.startsWith("zh")?"zh":"en");return}}catch{}}const ee=L(),U=xY(),W=u;let te;try{const pe=await Ga(ee,{lang:W,autoPlay:!1,onProgress:(xe,Oe,ve,Me)=>{}});te=pe.blob,pe.source}catch(pe){throw new Error(`TTS generation failed: ${pe.message}`)}B.current&&URL.revokeObjectURL(B.current);const Q=URL.createObjectURL(te);B.current=Q,re.src=Q,re.load(),await new Promise((pe,xe)=>{re.oncanplaythrough=pe,re.onerror=xe,setTimeout(()=>
4364xe(new Error("Audio load timeout")),1e4)}),x(!1);try{await re.play(),g(!0),se(re,K,W.startsWith("zh")?"zh":"en")}catch{g(!1),E(!1),D(W.startsWith("zh")?"无法播放语音,请重试":"Unable to play audio. Please try again.")}}catch{x(!1),g(!1),E(!1),D(u.startsWith("zh")?"语音生成失败,请重试":"Voice generation failed. Please try again.")}},J=()=>{y||(f?(I.current&&!I.current.paused&&I.current.pause(),cancelAnimationFrame(O.current),g(!1),E(!1)):I.current?.src&&I.current.currentTime>0?(I.current.play().catch(()=>{}),g(!0),se(I.current,M(),u.startsWith("zh")?"zh":"en")):H())},le=()=>{I.current&&(I.current.pause(),I.current.removeAttribute("src")),cancelAnimationFrame(O.current),B.current&&(URL.revokeObjectURL(B.current),B.current=null),g(!1),x(!1),E(!1),R(-1),k(""),V(0),D(null),d(K=>K.startsWith("zh")?"en-US":"zh-CN"),c(K=>K==="en"?"zh":"en")};return S.useEffect(()=>{const K=I.current;if(!K)return;const re=()=>{g(!1),R(-1),k(""),V(100),cancelAnimationFrame(O.current),setTimeout(()=>V(0),2e3)};return K.addEventListener("ended",re),()=>K.removeEventListener("ended",re)},[]),S.useEffect(()=>{if(n)if(/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)){const ee=setTimeout(async()=>{x(!0),D(null);const U=L(),W=u;try{(await Ga(U,{lang:W,autoPlay:!1,onProgress:(Q,pe,xe,Oe)=>{}})).blob,x(!1)}catch{x(!1),D(W.startsWith("zh")?"语音预加载失败":"Voice preload failed")}},1e3);return()=>clearTimeout(ee)}else{const re=setTimeout(()=>H(),800);return()=>clearTimeout(re)}},[]),v.jsxs("div",{className:"flex flex-col items-center gap-4 md:gap-5 w-full max-w-3xl mx-auto px-4",children:[v.jsxs("div",{className:"relative",children:[v.jsx(Vt.div,{animate:{scale:1},transition:{duration:.3},className:`${r?"w-20 h-20":"w-28 h-28 md:w-32 md:h-32"} rounded-full overflow-hidden relative z-10 bg-gray-100`,style:{border:b?"3px solid #FFD700":"4px solid white",boxShadow:"0 4px 20px rgba(0,0,0,0.1)"},children:b?v.jsx("video",{src:u.startsWith("zh")?"/videos/pregenerated/amy-cny-2026-zh.mp4":"/videos/pregenerated/amy-cny-2026-en.mp4",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:"w-full h-full object-cover",onError:K=>{K.target.style.display="none"}}):v.jsx("img",{src:"/amy-avatar.jpg",alt:"Amy — PDA AI Assistant",className:"w-full h-full object-cover",width:"128",height:"128",loading:"lazy"})}),b&&v.jsx(Vt.div,{className:"absolute -bottom-1 right-2 w-4 h-4 bg-[#C41E3A] rounded-full border-2 border-white z-20",animate:{scale:[1,1.3,1]},transition:{duration:.8,repeat:1/0}}),y&&v.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-30",children:v.jsx("div",{className:"bg-black/30 rounded-full p-2",children:v.jsx(id,{className:"w-6 h-6 text-white animate-spin"})})})]}),!r&&v.jsxs("div",{className:"text-center",children:[v.jsx("h3",{className:"text-lg font-bold text-[#001F3F]",children:"Amy"}),v.jsx("p",{className:"text-sm text-gray-500",children:"PDA AI Assistant · PDA-Amy Voice"})]}),v.jsx("div",{className:`${r?"min-h-[60px] max-h-[80px]":"min-h-[80px] max-h-[140px]"} max-w-2xl w-full flex items-center justify-center px-4 overflow-hidden`,children:v.jsx(Qr,{mode:"wait",children:C?v.jsxs(Vt.p,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.25},className:`text-center text-gray-700 leading-relaxed ${r?"text-xs":u.startsWith("zh")?"text-sm md:text-[15px]":"text-[15px]"} ${r?"line-clamp-3":"line-clamp-4"}`,children:['"',C,'"']},C.slice(0,20)):v.jsx(Vt.p,{initial:{opacity:0}
4364,animate:{opacity:1},exit:{opacity:0},className:`text-center text-gray-400 italic ${r?"text-xs":"text-sm"}`,children:$||(y?u.startsWith("zh")?"正在生成语音...":"Generating voice...":u.startsWith("zh")?"👇 点击播放,听 Amy 说话":"👇 Tap play to hear Amy speak")},"idle")})}),v.jsx("div",{className:"w-full max-w-md h-1 bg-gray-200 rounded-full overflow-hidden",children:v.jsx(Vt.div,{className:"h-full bg-gradient-to-r from-[#C41E3A] to-[#001F3F] rounded-full",style:{width:`${N}%`},transition:{duration:.1}})}),v.jsxs("div",{className:"flex items-center gap-3",children:[!t&&v.jsxs("button",{onClick:le,disabled:y,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-gray-100 hover:bg-gray-200 text-xs font-bold text-[#001F3F] transition-colors disabled:opacity-50",title:"Switch language",children:[v.jsx(i0,{className:"w-3.5 h-3.5"}),u.startsWith("zh")?"EN":"中文"]}),v.jsx("button",{onClick:J,disabled:y,className:`${r?"w-10 h-10":"w-12 h-12"} rounded-full flex items-center justify-center text-white transition-all duration-300 shadow-lg ${y?"bg-gray-400 cursor-wait":f?"bg-[#001F3F] hover:bg-[#001F3F]/80":"bg-[#C41E3A] hover:bg-[#A01830] hover:scale-105"}`,"aria-label":f?"Pause":"Play",children:y?v.jsx(id,{className:"w-5 h-5 animate-spin"}):f?v.jsx(_Y,{className:"w-5 h-5"}):v.jsx(vY,{className:"w-5 h-5 ml-0.5"})}),v.jsxs("button",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-gray-100 text-xs font-bold text-[#001F3F] opacity-60",title:"Powered by OpenAI",children:[v.jsx(wD,{className:"w-3.5 h-3.5"}),"AI"]})]}),v.jsx("audio",{ref:I,preload:"none",playsInline:!0})]})},EY=({show:t,onClose:e})=>v.jsx(Qr,{children:t&&v.jsxs(v.Fragment,{children:[v.jsx(Vt.div,{initial:{opacity:0}
4364,animate:{opacity:1},exit:{opacity:0},onClick:e,className:"fixed inset-0 z-[9999] bg-black/60 backdrop-blur-sm"}),v.jsx(Vt.div,{initial:{opacity:0,scale:.85,y:40},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:20},transition:{type:"spring",damping:25,stiffness:300},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",children:v.jsxs("div",{className:"relative w-full max-w-lg max-h-[90vh] overflow-y-auto rounded-3xl shadow-2xl",style:{background:"linear-gradient(135deg, #8B0000 0%, #C41E3A 30%, #D4382C 60%, #8B0000 100%)"},children:[v.jsx("button",{onClick:e,className:"absolute top-4 right-4 z-10 w-8 h-8 rounded-full bg-white/20 hover:bg-white/40 flex items-center justify-center transition-colors","aria-label":"Close",children:v.jsx(jc,{className:"w-5 h-5 text-white"})}),v.jsxs("div",{className:"text-center pt-8 pb-4 relative",children:[v.jsxs("div",{className:"flex justify-center gap-6 mb-4",children:[v.jsx("span",{className:"text-4xl animate-bounce",style:{animationDelay:"0s",animationDuration:"2s"},children:"🏮"}),v.jsx("span",{className:"text-5xl animate-bounce",style:{animationDelay:"0.3s",animationDuration:"2.2s"},children:"🧧"}),v.jsx("span",{className:"text-4xl animate-bounce",style:{animationDelay:"0.6s",animationDuration:"2s"},children:"🏮"})]}),v.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-yellow-300 mb-1",style:{textShadow:"0 2px 10px rgba(0,0,0,0.3)"},children:"金马迎春 🐴"}),v.jsx("p",{className:"text-lg text-yellow-100 font-medium",children:"2026 Happy Chinese New Year!"}),v.jsx("p",{className:"text-sm text-white/70 mt-1",children:"From Amy & the PDA Team"})]}),v.jsxs("div",{className:"mx-4 mb-4 bg-white/95 backdrop-blur-sm rounded-2xl p-6 shadow-inner",children:[v.jsx(FD,{autoPlay:!1,scenario:"chinese_new_year"}),v.jsx("p",{className:"text-center text-xs text-gray-500 mt-3",children:"👆 Click play button to hear Amy's V4.1 Natural Empathy greeting"})]}),v.jsx("div",{className:"px-6 pb-4",children:v.jsx("p",{className:"text-white/90 text-sm leading-relaxed text-center",children:"马蹄声声,步步向前。愿您在 2026 年马到成功,奔向更加灿烂的未来!"})}),v.jsx("div",{className:"flex justify-center gap-2 pb-6",children:["🎆","🎊","🐴","🎊","🎆"].map((n,r)=>v.jsx("span",{className:"text-2xl opacity-80",children:n},r))}),v.jsx("div",{className:"absolute inset-0 rounded-3xl border-2 border-yellow-400/30 pointer-events-none"})]})})]})}),bY={lantern:[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇺🇸"}],"dragon-boat":[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇺🇸"}],"mid-autumn":[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"ko",name:"한국어",flag:"🇰🇷"},{code:"vi",name:"Tiếng Việt",flag:"🇻🇳"},{code:"en",name:"English",flag:"🇺🇸"}],chuseok:[{code:"ko",name:"한국어",flag:"🇰🇷"},{code:"en",name:"English",flag:"🇺🇸"}],"japanese-new-year":[{code:"ja",name:"日本語",flag:"🇯🇵"},{code:"en",name:"English",flag:"🇺🇸"}],diwali:[{code:"hi",name:"हिन्दी",flag:"🇮🇳"},{code:"en",name:"English",flag:"🇺🇸"}],"eid-al-fitr":[{code:"ar",name:"العربية",flag:"🇸🇦"},{code:"en",name:"English",flag:"🇺🇸"}],"eid-al-adha":[{code:"ar",name:"العربية",flag:"🇸🇦"},{code:"en",name:"English",flag:"🇺🇸"}],christmas:[{code:"en",name:"English",flag:"🇺🇸"}],thanksgiving:[{code:"en",name:"English",flag:"🇺🇸"}],"new-year":[{code:"en",name:"English",flag:"🇺🇸"}],"independence-day":[{code:"en",name:"English",flag:"🇺🇸"}],"labor-day":[{code:"en",name:"English",flag:"🇺🇸"}],mother:[{code:"en",name:"English",flag:"🇺🇸"}],father:[{code:"en",name:"English",flag:"🇺🇸"}],easter:[{code:"en",name:"English",flag:"🇺🇸"}],hanukkah:[{code:"en",name:"English",flag:"🇺🇸"}]},AY={christmas:{title:"Merry Christmas 🎄",subtitle:"2026 Happy Christmas!",emojis:["🎄","🎅","🎁","⭐","🔔"],gradient:"linear-gradient(135deg, #165B33 0%, #BB2528 30%, #146B3A 60%, #BB2528 100%)",borderColor:"border-yellow-400/40",greeting:"Wishing you joy, peace, and warmth this holiday season!",audioScenario:"christmas"}
4364,thanksgiving:{title:"Happy Thanksgiving 🦃",subtitle:"2026 Thanksgiving Day!",emojis:["🦃","🍂","🥧","🌽","🍁"],gradient:"linear-gradient(135deg, #D97706 0%, #B45309 40%, #92400E 80%, #D97706 100%)",borderColor:"border-orange-400/40",greeting:"Grateful for your trust and support!",audioScenario:"thanksgiving"},"new-year":{title:"Happy New Year 🎉",subtitle:"2026 New Year Celebration!",emojis:["🎉","🥂","🎆","🎊","✨"],gradient:"linear-gradient(135deg, #1E3A8A 0%, #3B82F6 40%, #60A5FA 80%, #1E3A8A 100%)",borderColor:"border-blue-400/40",greeting:"Wishing you a year full of possibilities and success!",audioScenario:"chinese_new_year"},"independence-day":{title:"Happy Independence Day 🇺🇸",subtitle:"2026 Fourth of July!",emojis:["🇺🇸","🎆","🗽","🎇","🔥"],gradient:"linear-gradient(135deg, #1E3A8A 0%, #DC2626 30%, #FFFFFF 50%, #DC2626 70%, #1E3A8A 100%)",borderColor:"border-red-400/40",greeting:"Celebrating freedom, unity, and the American spirit!",audioScenario:"independence_day"},"labor-day":{title:"Happy Labor Day 👷",subtitle:"2026 Labor Day!",emojis:["👷","🛠️","🇺🇸","⚙️","💪"],gradient:"linear-gradient(135deg, #374151 0%, #1F2937 40%, #111827 80%, #374151 100%)",borderColor:"border-gray-400/40",greeting:"Honoring the hard work and dedication that builds our nation!",audioScenario:"labor_day"},mother:{title:"Happy Mother's Day 💐",subtitle:"2026 Mother's Day!",emojis:["💐","🌸","🌷","💕","👩‍👧"],gradient:"linear-gradient(135deg, #DB2777 0%, #EC4899 40%, #F9A8D4 80%, #DB2777 100%)",borderColor:"border-pink-400/40",greeting:"Celebrating all the amazing moms who make the world better!",audioScenario:"mothers_day"}
4364,father:{title:"Happy Father's Day 👔",subtitle:"2026 Father's Day!",emojis:["👔","👨‍👦","🎉","💙","🏆"],gradient:"linear-gradient(135deg, #1E40AF 0%, #3B82F6 40%, #60A5FA 80%, #1E40AF 100%)",borderColor:"border-blue-400/40",greeting:"Celebrating all the amazing dads who inspire and guide us!",audioScenario:"fathers_day"},easter:{title:"Happy Easter 🐰",subtitle:"2026 Easter Sunday!",emojis:["🐰","🥚","🌷","🌸","🐣"],gradient:"linear-gradient(135deg, #A855F7 0%, #EC4899 40%, #F9A8D4 80%, #A855F7 100%)",borderColor:"border-purple-400/40",greeting:"Wishing you renewal, hope, and new beginnings!",audioScenario:"easter"},lantern:{title:{zh:"元宵节快乐 🏮",en:"Happy Lantern Festival 🏮"},subtitle:{zh:"2026 元宵节!",en:"2026 Lantern Festival!"},emojis:["🏮","🎆","🥟","🌕","✨"],gradient:"linear-gradient(135deg, #DC2626 0%, #F59E0B 40%, #DC2626 80%, #F59E0B 100%)",borderColor:"border-orange-400/40",greeting:{zh:"愿您的心愿如灯笼般照亮夜空,梦想成真!",en:"May your wishes light up the sky and your dreams come true!"},audioScenario:"chinese_new_year"},"dragon-boat":{title:{zh:"端午节快乐 🐉",en:"Happy Dragon Boat Festival 🐉"},subtitle:{zh:"2026 端午节!",en:"2026 Dragon Boat Festival!"},emojis:["🐉","🚣","🥟","🌿","⛵"],gradient:"linear-gradient(135deg, #047857 0%, #10B981 40%, #34D399 80%, #047857 100%)",borderColor:"border-green-400/40",greeting:{zh:"祝您健康平安,好运连连!",en:"Wishing you health, protection, and good fortune!"},audioScenario:"dragon_boat"},"mid-autumn":{title:{zh:"中秋节快乐 🌕",ko:"추석 축하합니다 🌕",vi:"Chúc mừng Tết Trung Thu 🌕",en:"Happy Mid-Autumn Festival 🌕"},subtitle:{zh:"2026 中秋节!",ko:"2026 추석!",vi:"2026 Tết Trung Thu!",en:"2026 Mid-Autumn Festival!"},emojis:["🌕","🥮","🏮","🌙","✨"],gradient:"linear-gradient(135deg, #1E3A8A 0%, #3B82F6 40%, #60A5FA 80%, #1E3A8A 100%)",borderColor:"border-blue-400/40",greeting:{zh:"祝您团圆美满,月圆人圆!",ko:"풍요로운 한가위 되시고 가족의 행복이 가득하길 기원합니다!",vi:"Chúc gia đình sum vầy, hạnh phúc viên mãn!",en:"Wishing you unity, abundance, and a bright full moon!"},audioScenario:"mid_autumn"},diwali:{title:{hi:"दिवाली की शुभकामनाएं 🪔",en:"Happy Diwali 🪔"},subtitle:{hi:"2026 दीपावली!",en:"2026 Festival of Lights!"},emojis:["🪔","✨","🎆","🌸","🕉️"],gradient:"linear-gradient(135deg, #F59E0B 0%, #DC2626 40%, #A855F7 80%, #F59E0B 100%)",borderColor:"border-yellow-400/40",greeting:{hi:"आपके जीवन में प्रकाश, समृद्धि और खुशियाँ भरें!",en:"May light, prosperity, and joy fill your life!"},audioScenario:"diwali"},"eid-al-fitr":{title:{ar:"عيد مبارك 🌙",en:"Eid Mubarak 🌙"},subtitle:{ar:"2026 عيد الفطر!",en:"2026 Eid al-Fitr!"},emojis:["🌙","⭐","🕌","🎉","✨"],gradient:"linear-gradient(135deg, #065F46 0%, #10B981 40%, #34D399 80%, #065F46 100%)",borderColor:"border-green-400/40",greeting:{ar:"نتمنى لكم عيدًا مباركًا مليئًا بالفرح والبركات!",en:"Wishing you joy, blessings, and peace after Ramadan!"},audioScenario:"eid"},"eid-al-adha":{title:{ar:"عيد الأضحى مبارك 🐑",en:"Eid al-Adha Mubarak 🐑"},subtitle:{ar:"2026 عيد الأضحى!",en:"2026 Festival of Sacrifice!"},emojis:["🐑","🕌","🌙","🙏","✨"],gradient:"linear-gradient(135deg, #7C3AED 0%, #8B5CF6 40%, #A78BFA 80%, #7C3AED 100%)",borderColor:"border-purple-400/40",greeting:{ar:"تقبل الله تضحياتكم وأدعيتكم!",en:"May your sacrifices be accepted and your prayers answered!"},audioScenario:"eid"},hanukkah:{title:"Happy Hanukkah 🕎",subtitle:"2026 Festival of Lights!",emojis:["🕎","🔥","✨","🎁","💫"],gradient:"linear-gradient(135deg, #1E40AF 0%, #3B82F6 40%, #FFFFFF 60%, #3B82F6 80%, #1E40AF 100%)",borderColor:"border-blue-400/40",greeting:"May the lights of Hanukkah bring warmth and hope to your home!",audioScenario:"hanukkah"},"japanese-new-year":{title:{ja:"あけましておめでとう 🎍",en:"Happy Japanese New Year 🎍"},subtitle:{ja:"2026 お正月!",en:"2026 Japanese New Year!"},emojis:["🎍","🎌","🍱","🎊","🗻"],gradient:"linear-gradient(135deg, #DC2626 0%, #FFFFFF 40%, #DC2626 80%, #FFFFFF 100%)",borderColor:"border-red-400/40",greeting:{ja:"新年の幸運と繁栄をお祈りいたします!",en:"Wishing you a blessed and prosperous new year!"},audioScenario:"chinese_new_year"},chuseok:{title:{ko:"추석 축하합니다 🌕",en:"Happy Chuseok 🌕"},subtitle:{ko:"2026 추석 명절!",en:"2026 Korean Thanksgiving!"},emojis:["🌕","🥮","🇰🇷","🍂","🎊"],gradient:"linear-gradient(135deg, #DC2626 0%, #1E3A8A 40%, #FFFFFF 60%, #1E3A8A 80%, #DC2626 100%)",borderColor:"border-blue-400/40",greeting:{ko:"풍요로운 한가위 되시고 가족의 행복이 가득하길 기원합니다!",en:"Wishing you abundance, family harmony, and a bountiful harvest!"},audioScenario:"chinese_new_year"}},TY=({holiday:t,show:e,onClose:n,userLang:r="en"})=>{const s=AY[t],i=bY[t]||[{code:"en",name:"English",flag:"🇺🇸"}],a=()=>i.find(g=>g.code===r)?r:i[0].code,[c,u]=S.useState(a());if(!s)return null;const d=f=>
4364typeof s[f]=="string"?s[f]:s[f][c]||s[f].en||s[f];return v.jsx(Qr,{children:e&&v.jsxs(v.Fragment,{children:[v.jsx(Vt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:n,className:"fixed inset-0 z-[9999] bg-black/60 backdrop-blur-sm"}),v.jsx(Vt.div,{initial:{opacity:0,scale:.85,y:40},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:20},transition:{type:"spring",damping:25,stiffness:300},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",children:v.jsxs("div",{className:"relative w-full max-w-lg max-h-[90vh] overflow-y-auto rounded-3xl shadow-2xl",style:{background:s.gradient},children:[v.jsx("button",{onClick:n,className:"absolute top-4 right-4 z-10 w-8 h-8 rounded-full bg-white/20 hover:bg-white/40 flex items-center justify-center transition-colors","aria-label":"Close",children:v.jsx(jc,{className:"w-5 h-5 text-white"})}),i.length>1&&v.jsx("div",{className:"absolute top-4 left-4 z-10 flex gap-2",children:i.map(f=>v.jsxs("button",{onClick:()=>u(f.code),className:`
4365                        px-3 py-1.5 rounded-full text-xs font-medium transition-all
4366                        ${c===f.code?"bg-white text-gray-800 shadow-lg scale-105":"bg-white/20 text-white hover:bg-white/30"}
4367                      `,"aria-label":`Switch to ${f.name}`,children:[v.jsx("span",{className:"mr-1",children:f.flag}),f.name]},f.code))}),v.jsxs("div",{className:"text-center pt-8 pb-4 relative",children:[v.jsx("div",{className:"flex justify-center gap-6 mb-4",children:s.emojis.slice(0,3).map((f,g)=>v.jsx("span",{className:"text-4xl animate-bounce",style:{animationDelay:`${g*.3}s`,animationDuration:"2s"},children:f},g))}),v.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-yellow-300 mb-1",style:{textShadow:"0 2px 10px rgba(0,0,0,0.3)"},children:d("title")}),v.jsx("p",{className:"text-lg text-yellow-100 font-medium",children:d("subtitle")}),v.jsx("p",{className:"text-sm text-white/70 mt-1",children:"From Amy & the PDA Team"})]}),v.jsxs("div",{className:"mx-4 mb-4 bg-white/95 backdrop-blur-sm rounded-2xl p-6 shadow-inner",children:[v.jsx(FD,{autoPlay:!1,scenario:s.audioScenario,language:c,customText:d("greeting")}),v.jsxs("p",{className:"text-center text-xs text-gray-500 mt-3",children:["🔥 Click play button to hear Amy's greeting in ",i.find(f=>f.code===c)?.name||"selected language"]})]}),v.jsx("div",{className:"px-6 pb-4",children:v.jsx("p",{className:"text-white/90 text-sm leading-relaxed text-center",children:d("greeting")})}),v.jsx("div",{className:"flex justify-center gap-2 pb-6",children:s.emojis.map((f,g)=>v.jsx("span",{className:"text-2xl opacity-80",children:f},g))}),v.jsx("div",{className:`absolute inset-0 rounded-3xl border-2 ${s.borderColor} pointer-events-none`})]})})]})})},jD=["en","zh-CN","zh-TW","es","fr","de","it","pt","ru","ja","ko","ar","hi","th","vi","id"],yS={en:`Hi! I'm Amy, your personal PDA assistant. I can help you find legal aid, healthcare, insurance and more.
4368
4369Do you have a PDA Member ID? If yes, please enter it. If not, just type your first and last name.`,zh:`您好!我是 Amy,您的个人PDA助理。我可以帮您寻找法律援助、医疗保健、保险等服务。
4370
4371您有 PDA 会员ID吗?如果有,请输入。如果没有,请输入您的姓名。`,es:`¡Hola! Soy Amy, tu asistente personal de PDA. Puedo ayudarte a encontrar asistencia legal, atención médica, seguros y más.
4372
4373¿Tienes un ID de miembro de PDA? Si es así, ingrésalo. Si no, escribe tu nombre y apellido.`,vi:`Xin chào! Tôi là Amy, trợ lý cá nhân PDA của bạn. Tôi có thể giúp bạn tìm hỗ trợ pháp lý, chăm sóc sức khỏe, bảo hiểm và nhiều hơn nữa.
4374
4375Bạn có ID thành viên PDA không? Nếu có, vui lòng nhập. Nếu không, chỉ cần nhập tên đầy đủ của bạn.`,th:`สวัสดีค่ะ! ฉันคือ Amy ผู้ช่วยส่วนตัว PDA ของคุณ ฉันสามารถช่วยคุณหาความช่วยเหลือทางกฎหมาย การดูแลสุขภาพ ประกันภัย และอื่นๆ
4376
4377คุณมีรหัสสมาชิก PDA หรือไม่? หากมี กรุณาใส่รหัส หากไม่มี เพียงพิมพ์ชื่อและนามสกุลของคุณ`,ar:`مرحباً! أنا Amy، مساعدتك الشخصية في PDA. يمكنني مساعدتك في العثور على المساعدة القانونية والرعاية الصحية والتأمين والمزيد.
4378
4379هل لديك رقم عضوية PDA؟ إذا كان الأمر كذلك، يرجى إدخاله. إذا لم يكن كذلك، اكتب اسمك الأول والأخير فقط.`,ru:`Привет! Я Amy, ваш личный помощник PDA. Я могу помочь вам найти юридическую помощь, медицинское обслуживание, страхование и многое другое.
4380
4381У вас есть ID участника PDA? Если да, пожалуйста, введите его. Если нет, просто введите ваше имя и фамилию.`,ko:`안녕하세요! 저는 Amy, 귀하의 개인 PDA 도우미입니다. 법률 지원, 건강 관리, 보험 등을 찾는 데 도움을 드릴 수 있습니다.
4382
4383PDA 회원 ID가 있으십니까? 있으시면 입력해 주세요. 없으시면 성함을 입력해 주세요.`,ja:`こんにちは!私はAmy、あなたの個人PDAアシスタントです。法律支援、医療、保険などを見つけるお手伝いができます。
4384
4385PDA会員IDをお持ちですか?お持ちの場合は入力してください。お持ちでない場合は、お名前を入力してください。`,fr:`Bonjour ! Je suis Amy, votre assistante personnelle PDA. Je peux vous aider à trouver une aide juridique, des soins de santé, des assurances et plus encore.
4386
4387Avez-vous un ID de membre PDA ? Si oui, veuillez le saisir. Sinon, tapez simplement votre prénom et nom.`,de:`Hallo! Ich bin Amy, Ihre persönliche PDA-Assistentin. Ich kann Ihnen helfen, Rechtshilfe, Gesundheitsversorgung, Versicherungen und mehr zu finden.
4388
4389Haben Sie eine PDA-Mitglieds-ID? Wenn ja, geben Sie sie bitte ein. Wenn nicht, geben Sie einfach Ihren Vor- und Nachnamen ein.`,it:`Ciao! Sono Amy, la tua assistente personale PDA. Posso aiutarti a trovare assistenza legale, assistenza sanitaria, assicurazioni e altro ancora.
4390
4391Hai un ID membro PDA? Se sì, inseriscilo. In caso contrario, digita il tuo nome e cognome.`,pt:`Olá! Sou a Amy, sua assistente pessoal da PDA. Posso ajudá-lo a encontrar assistência jurídica, cuidados de saúde, seguros e muito mais.
4392
4393Você tem um ID de membro da PDA? Se sim, insira-o. Caso contrário, digite seu primeiro e último nome.`,hi:`नमस्ते! मैं Amy हूं, आपकी व्यक्तिगत PDA सहायक। मैं आपको कानूनी सहायता, स्वास्थ्य देखभाल, बीमा और अधिक खोजने में मदद कर सकती हूं।
4394
4395क्या आपके पास PDA सदस्य ID है? यदि हां, तो कृपया इसे दर्ज करें। यदि नहीं, तो बस अपना पहला और अंतिम नाम टाइप करें।`,id:`Halo! Saya Amy, asisten pribadi PDA Anda. Saya dapat membantu Anda menemukan bantuan hukum, perawatan kesehatan, asuransi, dan lainnya.
4396
4397Apakah Anda memiliki ID anggota PDA? Jika ya, silakan masukkan. Jika tidak, cukup ketik nama depan dan belakang Anda.`};new Set(jD);const Pf=t=>{const e=String(t||"").trim();if(!e)return"en";const r=e.toLowerCase().split(/[-_]/)[0];return{en:"en",zh:"zh",es:"es",fr:"fr",de:"de",it:"it",pt:"pt",ru:"ru",ja:"ja",ko:"ko",ar:"ar",hi:"hi",th:"th",vi:"vi",id:"id"}[r]||"en"},CY={cny:{keywords:["新年好","新年快乐","春节快乐","过年好","拜年","新春","恭喜发财","过年","除夕","金马","马年","岁岁平安","happy chinese new year","lunar new year","chinese new year","cny","spring festival","year of the horse","새해 ë³µ 많이 받으세요","설날","chúc mừng năm mới","tết"],popup:"cny",response:"🧧✨ Surprise! You unlocked a special Chinese New Year greeting from me! 新春快乐,金马迎春!🐴🎆"},christmas:{keywords:["圣诞","圣诞节","圣诞快乐","平安夜","christmas","merry christmas","xmas","feliz navidad","joyeux noël","frohe weihnachten","buon natale","メリークリスマス","크리스마스","giáng sinh"],popup:"christmas",response:"🎄✨ Merry Christmas 2026! Wishing you joy, peace, and warmth this holiday season! 🎅🎁"},thanksgiving:{keywords:["感恩节","thanksgiving","happy thanksgiving","turkey day","día de acción de gracias","action de grâce","추수감사절"],popup:"thanksgiving",response:"🦃✨ Happy Thanksgiving 2026! Grateful for your trust and support! 🍂🥧"},"new-year":{keywords:["元旦","新年","new year","happy new year","año nuevo","nouvel an","neujahr","capodanno","새해","năm mới"],popup:"new-year",response:"🎉✨ Happy New Year 2026! Wishing you a year full of possibilities! 🥂ðŸŽ
4397†"},"independence-day":{keywords:["独立日","美国独立日","国庆","independence day","4th of july","july 4th","fourth of july","7月4日"],popup:"independence-day",response:"🇺🇸✨ Happy Independence Day 2026! Celebrating freedom and unity! 🎆🗽"},"labor-day":{keywords:["劳动节","美国劳动节","labor day","labour day","노동절"],popup:"labor-day",response:"👷✨ Happy Labor Day 2026! Honoring the hard work and dedication! 🛠️🇺🇸"},mother:{keywords:["母亲节","妈妈","mother","mother's day","mothers day","día de la madre","fête des mères","muttertag","어머니날"],popup:"mother",response:"💐✨ Happy Mother's Day 2026! Celebrating all the amazing moms! 🌸👩‍👧"},father:{keywords:["父亲节","爸爸","father","father's day","fathers day","día del padre","fête des pères","vatertag","아버지날"],popup:"father",response:"👔✨ Happy Father's Day 2026! Celebrating all the amazing dads! 🎉👨‍👦"},easter:{keywords:["复活节","easter","happy easter","pascua","pâques","ostern","pasqua","イースター","부활절"],popup:"easter",response:"🐰✨ Happy Easter 2026! Wishing you renewal and hope! 🥚🌷"},lantern:{keywords:["元宵","元宵节","灯笼","lantern festival","yuanxiao","元宵快乐"],popup:"lantern",response:"🏮✨ Happy Lantern Festival 2026! May your wishes light up the sky! 🎆🥟"},"dragon-boat":{keywords:["端午","端午节","粽子","dragon boat festival","duanwu","端午快乐"],popup:"dragon-boat",response:"🐉✨ Happy Dragon Boat Festival 2026! Wishing you health and protection! 🚣🥟"},"mid-autumn":{keywords:["中秋","中秋节","月饼","mid-autumn festival","moon festival","mooncake","中秋快乐","秋節","추석"],popup:"mid-autumn",response:"🌕✨ Happy Mid-Autumn Festival 2026! Wishing you unity and abundance! 🥮🏮"},diwali:{keywords:["排灯节","diwali","deepavali","festival of lights","दीवाली"],popup:"diwali",response:"🪔✨ Happy Diwali 2026! May light and prosperity fill your life! ✨🎆"},"eid-al-fitr":{keywords:["开斋节","eid","eid al-fitr","eid mubarak","عيد الفطر"],popup:"eid-al-fitr",response:"🌙✨ Eid Mubarak 2026! Wishing you joy and blessings! 🕌🎉"},"eid-al-adha":{keywords:["宰牲节","eid al-adha","bakra eid","عيد الأضحى"],popup:"eid-al-adha",response:"🐑✨ Eid al-Adha Mubarak 2026! May your sacrifices be accepted! 🕌🙏"},hanukkah:{keywords:["光明节","hanukkah","chanukah","festival of lights","חנוכה"],popup:"hanukkah",response:"🕎✨ Happy Hanukkah 2026! May the lights bring you warmth and hope! 🔥🎁"},"japanese-new-year":{keywords:["正月","日本新年","japanese new year","shogatsu","oshogatsu","あけましておめでとう","새해 ë³µ"],popup:"japanese-new-year",response:"🎍✨ あけましておめでとうございます 2026! Wishing you a blessed new year! 🇯🇵🎊"},chuseok:{keywords:["秋夕","韩国中秋","chuseok","korean thanksgiving","추석","한가위"],popup:"chuseok",response:"🌕✨ Happy Chuseok 2026! Wishing you abundance and family harmony! 🇰🇷🥮"}},Np=new Set(["mental_health","donation","cdl","legal","personal_injury","healthcare","housing","insurance","employment","youth","education","economics","about"]),MD=["mental_health","donation","cdl","legal","personal_injury","healthcare","housing","insurance","employment","youth","education","economics","about","general","out_of_scope"],SY=new Set(MD),ba="929-496-9798",Rf="tel:9294969798",Oy={img:"/amy-avatar.jpg",video:{en:"/videos/pregenerated/amy-cny-2026-en.mp4",zh:"/videos/pregenerated/amy-cny-2026-zh.mp4"}},BD=["policy","law","rule","regulation","uscis","dmv","form","fee","deadline","updated","change","政策","法规","规定","更新","表格","费用","截止","最新","版本","要求"],kY=(t,e,n=0)=>{if(!Np.has(e)&&e!=="general"||n>5)return!1;const r=(t||"").toLowerCase();return BD.some(s=>r.includes(s.toLowerCase()))},IY=(t,e)=>{const n=(e||"").toLowerCase();return BD.some(s=>n.includes(s.toLowerCase()))?30:t==="about"?180:90},PY=()=>{if(typeof window>"u")return!1;const t=navigator.userAgent||navigator.vendor||window.opera;return/android|iphone|ipad|ipod|windows phone/i.test(String(t).toLowerCase())},RY=["call pda","call you","phone pda","phone you","call me","phone me","please call","can you call","contact by phone","call the hotline","打电话","电话联系","给我打电话","请电话联系","帮我打电话","拨打电话","打给pda","联系pda","hotline","电话","call","phone"],DY=t=>{const e=String(t||"").toLowerCase();return RY.some(n=>e.includes(String(n).toLowerCase()))},NY=async t=>{if(DY(t))return!0;const e=`
4398You detect if the user is asking to make a phone call to PDA or requesting PDA to contact by phone.
4399Return ONLY: YES or NO.
4400Consider ANY language.
4401`.trim();try{const n=await Td([{role:"system",content:e},{role:"user",content:t}],{provider:"auto",temperature:0,maxTokens:10});return String(n?.response||n?.message||n?.data?.response||"").toUpperCase().includes("YES")}catch{return!1}},OY=async(t,e)=>{const n=`
4402You are a strict classifier for PDA assistant.
4403Return ONLY ONE token from this list (no extra words):
4404${MD.join(", ")}
4405
4406Rules:
4407- Classify by meaning, regardless of language.
4408- If user asks for help/resources but unclear which department -> general.
4409- If clearly unrelated to PDA services (e.g., cooking recipes, gaming tips, random trivia) -> out_of_scope.
4410`.trim();try{const r=await Td([{role:"system",content:n},{role:"user",content:t}],{provider:"auto",temperature:0,maxTokens:20}),i=String(r?.response||r?.message||r?.data?.response||"").trim().split(/[\s,;。\n]/)[0].toLowerCase();return SY.has(i)?i:"general"}catch{try{return typeof e=="function"?e(t):"general"}catch{return"general"}}},LY=async(t,e,n=0)=>
4410{if(n>5||e==="out_of_scope")return!1;const r=`
4411You decide whether this question needs fresh external research.
4412Fresh research means: laws, policies, forms, fees, deadlines, official requirements, version changes, eligibility rules.
4413Return ONLY: YES or NO (no extra text).
4414Consider any language.
4415`.trim();try{const s=await Td([{role:"system",content:r},{role:"user",content:`Category: ${e}
4416Question: ${t}`}],{provider:"auto",temperature:0,maxTokens:10});return String(s?.response||s?.message||s?.data?.response||"").toUpperCase().includes("YES")}catch{return kY(t,e,n)}},FY=()=>{const{toast:t}=r0(),e=Ac(),{member:n,loading:r}=Sx(),[s,i]=S.useState(!1),[a,c]=S.useState(!1),[u,d]=S.useState("membership"),[f,g]=S.useState(null),[y,x]=S.useState([]),[b,E]=S.useState(!1),[w,R]=S.useState(""),[C,k]=S.useState(!1),[N,V]=S.useState(null),[$]=S.useState(!0),[D,I]=S.useState(0),[B,O]=S.useState(0),[F,L]=S.useState(null),[M,se]=S.useState([]),[H,J]=S.useState(null),[le,K]=S.useState("en"),[re,ee]=S.useState("en"),[U,W]=S.useState({name:"",email:"",phone:"",member_id:""}),[te,Q]=S.useState(!1),[pe,xe]=S.useState(null),[Oe,ve]=S.useState(null),Me=S.useRef(null),dt=S.useRef(null),ht=S.useRef(null),Nn=S.useRef(new Map),St=S.useRef(new Map),$t=S.useRef(new Map),tn=S.useRef(new Map);S.useEffect(()=>{const ge=ae=>{i(!0),c(!1);const Ne=ae.detail?.prompt;typeof Ne=="string"&&Ne.trim()&&R(Ne.trim())};return window.addEventListener("pda:open-amy",ge),()=>window.removeEventListener("pda:open-amy",ge)},[]);const yr=pe!==null||Oe!==null,vr=re==="en"?Oy.video.en:Oy.video.zh,Dr=async ge=>{const ae=`
4417You are a strict language detector for TTS.
4418Return ONLY one tag from this list:
4419${jD.join(", ")}
4420
4421Rules:
4422- Detect the language of the provided text (any language).
4423- If mixed, choose the dominant language.
4424- If uncertain, return en.
4425Return ONLY the tag, no extra words.
4426`.trim();try{const Ne=await Td([{role:"system",content:ae},{role:"user",content:ge}],{provider:"auto",temperature:0,maxTokens:15}),ke=String(Ne?.response||Ne?.message||Ne?.data?.response||"").trim().split(/[\s,;。\n]/)[0];return Pf(ke)}catch{return"en"}},kt=async ge=>{const ae=String(ge||"").trim();if(!ae)return"en";const Ne=tn.current.get(ae);if(Ne)return Ne;const Ee=Pf(fY?.(ae));if(Ee&&Ee!=="en")return tn.current.set(ae,Ee),Ee;const ke=Pf(Nu?.(ae));if(ke&&ke!=="en")return tn.current.set(ae,ke),ke;if(/[\u4e00-\u9fff]/.test(ae))return tn.current.set(ae,"zh"),"zh";if(/[ก-๙]/.test(ae))return tn.current.set(ae,"th"),"th";if(/[\u0600-\u06FF]/.test(ae))return tn.current.set(ae,"ar"),"ar";if(/[áéíóúñ¿¡]/i.test(ae))return tn.current.set(ae,"es"),"es";if(/[ぁ-んァ-ン]/.test(ae))return tn.current.set(ae,"ja"),"ja";if(/[가-힣]/.test(ae))return tn.current.set(ae,"ko"),"ko";if(/[а-яё]/i.test(ae))return tn.current.set(ae,"ru"),"ru";const Ve=await Dr(ae);return tn.current.set(ae,Ve),Ve},vt=async(ge,ae,Ne=null)=>{if(ht.current||(ht.current=new Audio,ht.current.volume=1),pe===ae){ht.current&&(ht.current.pause(),ht.current.src=""),xe(null);return}ht.current&&(ht.current.pause(),ht.current.src=""),xe(null),ve(ae);try{const Ee=ge.replace(/[*#_`]/g,"").trim();if(!Ee){ve(null);return}let ke;Ne?ke=Ne:ke=await kt(Ee);const Ve=bD(Ee,ke),We=jY(Ee),wt=Ve||We,Xe=o0(ke,{response_format:"mp3"}),It=Pf(ke),bt=await AD(Ee,It,{voice:Xe.voice,model:Xe.model,speed:Xe.speed,instructions:Xe.instructions,serviceId:wt},!0);bt.source;const tt=bt.blob;if(!tt)throw new Error("No audio blob returned from TTS service");const xr=URL.createObjectURL(tt);ht.current||(ht.current=new Audio),ht.current.src=xr,ht.current.onended=()=>{xe(null),URL.revokeObjectURL(xr)},ht.current.onerror=Lr=>{xe(null),ve(null),URL.revokeObjectURL(xr)};try{await ht.current.play()}catch(Lr){if(Lr.name==="NotAllowedError"){alert(`浏览器阻止了音频播放,请再次点击播放按钮。
4427
4428如果问题持续,请在浏览器地址栏点击锁图标 → 站点设置 → 声音 → 允许`),ve(null);return}throw Lr}ve(null),xe(ae)}catch{ve(null),xe(null),t({title:"Voice Temporarily Unavailable",description:"PDA-Amy voice service encountered an issue. Please try again later.",variant:"destructive",duration:3e3})}};S.useEffect(()=>{if(s&&!b&&!r){if((async()=>{const ae=await hY({userId:n?.id||null,meta:{userRole:n?.role||"guest",userName:n?.name||null,userEmail:n?.email||null,memberId:n?.member_code||n?.member_id||null}});L(ae),kD().catch(()=>{})})(),n){const ae=n.name?.split(" ")[0]||n.name,Ne=n.role==="admin"||n.role==="staff";let Ee="en";try{const Ve=mm();Ee=gm(Ve)}catch{Ee="en"}let ke;Ne?ke=`Hi ${ae}! 👋 I'm Amy, your PDA assistant.
4429
4430✨ **Staff Mode Activated**
4431
4432I can help you:
4433🏢 Access admin dashboard
4434💬 View community Q&A
4435📧 Check department emails
4436📊 View analytics
4437⚙️ Manage system settings
4438
4439Or continue with regular user services. How can I help?`:Ee==="zh"?ke=`您好 ${ae}!👋 我是 Amy,您的个人PDA助理。有什么可以帮您的吗?`:ke=`Hi ${ae}! 👋 I'm Amy, your personal PDA assistant. How can I help you today?`,x([{type:"ai",text:ke,timestamp:new Date,isGreeting:!0,isStaffMode:Ne,lang:Ee}]),g(!0),d("chat"),Q(!0),W({name:n.name||"",email:n.email||"",phone:n.phone||"",member_id:n.member_code||n.member_id||""})}else{let ae="en";try{const Ee=mm();ae=gm(Ee)}catch{ae="en"}const Ne=yS[ae]||yS.en;x([{type:"ai",text:Ne,timestamp:new Date,showMembershipButtons:!1,isGreeting:!0,lang:ae}]),d("chat"),Q(!1)}E(!0)}},[s,n,b,r]),S.useEffect(()=>{const ge=()=>{if(F){const ae=y.filter(ke=>ke.type==="user"),Ne=y.filter(ke=>ke.type==="ai"),Ee=JSON.stringify({session_id:F,ended_at:new Date().toISOString(),total_messages:y.length,total_user_messages:ae.length,total_ai_messages:Ne.length,categories:[...new Set(M)]});navigator.sendBeacon?.(`https://fhdazecpdftfewdmmufb.supabase.co/rest/v1/amy_chat_sessions?session_id=eq.${F}`,Ee)}};return window.addEventListener("beforeunload",ge),()=>{window.removeEventListener("beforeunload",ge),F&&pS(F,{totalMessages:y.length,categories:[...new Set(M)]})}},[F,y,M]);const Nt=()=>{Me.current?.scrollIntoView({behavior:"smooth"})};S.useEffect(()=>{Nt()},[y]),S.useEffect(()=>{const ge=()=>{[document.querySelector("#goog-gt-tt"),document.querySelector(".goog-te-banner-frame"),document.querySelector(".skiptranslate"),document.body.querySelector('iframe[class*="goog"]')].some(ke=>ke!==null)&&window.scrollBy({top:100,behavior:"smooth"})};ge();const ae=setTimeout(ge,1e3);return()=>clearTimeout(ae)},[]);const Yt=ge=>{const ae=(ge||"").toLowerCase(),Ne={mental_health:["mental","counseling","therapy","depression","anxiety","stress","crisis","988","suicide","emotional","psycholog","心理","咨询","抑郁","焦虑","压力","情绪","sad","lonely","overwhelmed","burnout","therapist","counselor"],donation:["donate","donation","give","contribute","contribution","fundraise","charity","捐","捐款","捐赠","善款","资助","sponsor"],cdl:["cdl","trucker","trucking","driving school","驾照","卡车","驾驶","commercial driver","class a","class b","dmv","permit","road test"],legal:["签证","visa","h1b","绿卡","green card","移民","immigration","律师","lawyer","法律","legal","身份","status","uscis","asylum","deportation","work permit"],personal_injury:["injury","accident","hurt","crash","collision","injured","compensation","workers comp","受伤","事故","车祸","工伤","赔偿","sue","lawsuit"],healthcare:["医疗","doctor","医生","医院","hospital","看病","药","medicine","体检","checkup","covid","疫苗","vaccine","clinic","medicaid","medicare","prescription"],housing:["房","house","a
4439partment","租","rent","房东","landlord","租客","tenant","eviction","lease","housing","shelter","搬家","住房","公寓"],insurance:["insurance","保险","车险","auto insurance","人寿保险","life insurance","保险理赔","claim","保费","premium","保单","policy","coverage"],employment:["job","employment","career","hire","hiring","work","resume","interview","工作","招聘","求职","简历","面试","就业","salary"],youth:["youth","children","kids","teen","teenager","child safety","bullying","青少年","儿童","孩子","安全","校园"],education:["学校","school","教育","education","培训","training","课程","course","学习","learn","大学","university","english","esl"],economics:["投资","invest","股票","stock","理财","finance","税","tax","报税","401k","ira","银行","bank","贷款","loan","信用卡","credit"],about:["about","pda","what is pda","organization","membership","join","member","full name","stand for","stands for","what does pda","potential development","关于","组织","会员","加入","non-profit","全称","全名","缩写"]},Ee={};for(const[Ve,We]of Object.entries(Ne))Ee[Ve]=We.filter(wt=>ae.includes(wt)).length;const ke=Math.max(...Object.values(Ee));return ke>0?Object.keys(Ee).find(Ve=>Ee[Ve]===ke):"general"},An=(ge,ae)=>({donation:{greeting:"Thank you so much for wanting to support PDA! Your generosity makes a real difference. 💙",experts:"Donations Team",email:"[email protected]",quickAnswer:"You can donate directly on our website! Visit our donation page to contribute securely.",directLink:"/donate"},cdl:{greeting:"Great question about CDL training! We partner with top driving schools to help you get started. 🚛",experts:"CDL Training Team",email:"[email protected]",quickAnswer:"We partner with J&S Reliance Driving School (4.9★) for CDL Class A, B, P, and S training."},legal:{greeting:"Thank you for your inquiry! I've analyzed your question and identified it as a legal/immigration matter.",experts:"Legal & Immigration Team",email:"[email protected]",quickAnswer:"Our professional legal team will respond within 1 business day. You can also call our service hotline for immediate assistance."},mental_health:{greeting:"Your wellbeing matters to us. PDA provides mental health support resources. 💙",experts:"Mental Health Support Team",email:"[email protected]",quickAnswer:"Call or Text 988 for immediate crisis support (24/7, free, confidential). PDA also offers counseling referrals.",directLink:"/mental-health-support"},healthcare:{greeting:"I can help you navigate healthcare resources! 🏥",experts:"Healthcare Services Team",email:"[email protected]",quickAnswer:"PDA helps with finding doctors, health insurance enrollment, and medical resources.",directLink:"/healthcare-navigation"},housing:{greeting:"Housing is a critical need. Let me connect you with our housing support. 🏘️",experts:"Housing Support Team",email:"[email protected]",quickAnswer:"PDA provides tenant rights advocacy, landlord mediation, and help finding affordable housing.",directLink:"/housing-support"},insurance:{greeting:"Insurance questions are important! Let me help you find the right coverage. 💼",experts:"Insurance Services Team",email:"[email protected]",quickAnswer:"PDA helps with commercial truck insurance, health insurance, and claims assistance.",directLink:"/insurance"},employment:{greeting:"Let me help you find job opportunities! 💼",experts:"Employment Services Team",email:"[email protected]",quickAnswer:"PDA offers job placement, resume building, and career counseling for truckers and community members.",directLink:"/employment"},personal_injury:{greeting:"If you've been injured, PDA can connect you with legal help. ⚖️",experts:"Legal Aid Team",email:"[email protected]",quickAnswer:"PDA offers free legal consultation for personal injury and truck accident cases.",directLink:"/personal-injury"},youth:{greeting:"Youth safety is a top priority for PDA. 🛡️",experts:"Youth Safety Team",email:"[email protected]",quickAnswer:"PDA provides youth safety education, anti-bullying resources, and crisis support.",directLink:"/youth-safety"},economics:{greeting:"Financial planning is important. Let us help! 📊",experts:"Financial Advisory Team",email:"[email protected]",quickAnswer:"PDA can connect you with financial advisors for tax, banking, and investment guidance."},education:{greeting:"Education opens doors! Let me help you find learning resources. 📚",experts:"Education & Training Team",email:"[email protected]",quickAnswer:"PDA offers CDL training, English learning (TruckTalk Pro app), and educational resources."},about:{greeting:"PDA stands for Potential Development Association — a 501(c)(3) builder-led nonprofit! 🤝",experts:"PDA Team",email:"[email protected]",quickAnswer:"Potential Development Association (PDA) turns instability into stability through communication systems, housing support, and empowerment programs. Based at 9807 Astoria Blvd 1FL, East Elmhurst, NY 11369.",directLink:"/about-us"}})[ae]||{greeting:"Let me help you find the right resource! 🤝",experts:"PDA Service Team",email:"[email protected]",quickAnswer:"PDA — Potential Development Association — offers legal aid, CDL training, healthcare navigation, housing support, mental health resources, and more."},On=ge=>({mental_health:"💙",donation:"💙",cdl:"🚛",legal:"🏛️",personal_injury:"⚖️",healthcare:"🏥",housing:"🏘️",insurance:"💼",employment:"💼",youth:"🛡️",economics:"📊",education:"📚",about:"📖"})[ge]||"💬",mn=ge=>({mental_health:"Mental Health Support",donation:"Donations",cdl:"CDL Training",legal:"Legal & Immigration",personal_injury:"Personal Injury",healthcare:"Healthcare",housing:"Housing Support",insurance:"Insurance",employment:"Employment & Career",youth:"Youth Safety",economics:"Finance & Economics",education:"Education & Training",about:"About PDA"})[ge]||"General Inquiry",ur=ge=>{g(ge);const ae=[{type:"user",text:ge?"Yes, I am a member":"No, I am not a member",timestamp:new Date}];ge?(ae.push({type:"ai",text:"✅ Great! To associate your request with available member information and services, please enter your Member ID below, or you can skip and continue.",timestamp:new Date}),ae.push({type:"ai",text:"💡 Don't have your Member ID handy? No problem! You can continue and we'll verify your membership when you submit your question.",timestamp:new Date})):(ae.push({type:"ai",text:"👋 Thank you! Non-members can ask questions too. **PDA membership supports our charitable mission and may include member meetings, service updates, and free general information in subjects we offer. It does not guarantee priority or professional representation.**",timestamp:new Date}),ae.push({type:"ai",text:"🌟 Would you like to learn more about membership benefits? Visit our **Join Us** page! For now, feel free to ask your question.",timestamp:new Date})),x(Ne=>[...Ne,...ae]),d("chat"),setTimeout(()=>{dt.current?.focus()},300)},_r=ge=>{const ae=ge.toLowerCase().trim();for(const[,Ne]of Object.entries(CY))if(Ne.keywords.some(Ee=>ae.includes(Ee.toLowerCase())))return Ne;return null},es=()=>n?.role==="admin"||n?.role==="staff"?1/0:f||n?10:(D>0?B/D:0)>=.5?5:3,hi=ge=>{const ae=(ge||"").toLowerCase();return["cdl","driving","driver","truck","license","training","school","legal","lawyer","attorney","immigration","visa","asylum","green card","youth","mental health","counseling","therapy","support","insurance","health","medical","healthcare","medicaid","medicare","housing","rent","tenant","landlord","eviction","apartment","job","employment","career","resume","work","hire","app","website","digital","technology","software","donate","donation","volunteer","join","member","membership","pda","potential development","community","service","help","mediation","dispute","conflict","驾照","卡车","培训","法律","律师","移民","签证","庇护","绿卡","青少年","心理","咨询","保险","医疗","住房","租房","房东","驱逐","工作","就业","职业","简历","捐款","志愿","会员","社区","服务","调解","纠纷"].some(Ee=>ae.includes(Ee))},Nr=async()=>
4439{if(!w.trim())return;const ge={type:"user",text:w,timestamp:new Date};x(Ve=>[...Ve,ge]);const ae=w;R(""),hi(ae)&&O(Ve=>Ve+1);const Ne=es();if(D>=Ne){const Ve=n?.role==="admin"||n?.role==="staff";let We;f||n?We=Ve?`📋 For large document searches or research tasks, I'd recommend using **Gemini** with your @pdaus.org account — it's already set up for you! 🚀
4440
4441I'm always here for quick PDA questions though!`:`You've used your **${Ne} daily conversations**. I'll be back tomorrow! 🌅
4442
4443In the meantime, feel free to:
4444📞 Call us: ${ba}
4445📧 Email: [email protected]
4446🏢 Visit: 9807 Astoria Blvd 1FL, East Elmhurst, NY 11369`:We=`Thank you for chatting with me! 😊 I've shared what I can in this session.
4447
4448To continue getting help:
4449💙 **Join PDA** for extended access → [Join Us](/join-us)
4450📞 Call: ${ba}
4451📧 Email: [email protected]
4452🏢 Visit us at 9807 Astoria Blvd 1FL, East Elmhurst, NY 11369`,x(wt=>[...wt,{type:"ai",text:We,timestamp:new Date,ragActions:f?[]:[{label:"💙 Join PDA",link:"/join-us",icon:"💙",type:"primary"},{label:"📞 Contact Us",link:"/contact",icon:"📞",type:"secondary"}],isRAGResponse:!f}]),Ri(F,{type:"ai",text:We});return}Ri(F,{type:"user",text:ae,timestamp:new Date().toISOString()});const Ee=Nu(ae);K(Ee),Ee!=="en"&&If(F,{language:Ee});const ke=_r(ae);if(ke){J(ke.popup),x(Ve=>[...Ve,{type:"ai",text:ke.response,timestamp:new Date}]),Ri(F,{type:"ai",text:ke.response,timestamp:new Date().toISOString()});return}if(!n&&!te&&y.length===1&&y[0].isGreeting){const Ve=/^M[A-Z]\d{6}$/i,We=ae.trim().toLowerCase();if(["hi","hello","hey","你好","hola","bonjour","hallo","ciao","привет"].includes(We)){const It="Nice to meet you! How can I help you today?";x(bt=>[...bt,{type:"ai",text:It,timestamp:new Date}]);return}if(Ve.test(ae.trim().toUpperCase())){const It=ae.trim().toUpperCase();k(!0);try{const bt=await Rn.members.where("member_code").equals(It).first();if(bt){const tt=bt.name?.split(" ")[0]||bt.name;x(xr=>[...xr,{type:"ai",text:`Welcome back, ${tt}! 👋 I found your account. How can I help you today?`,timestamp:new Date}]),g(!0),W({name:bt.name||"",email:bt.email||"",phone:bt.phone||"",member_id:bt.member_code||It}),Q(!0),k(!1);return}x(tt=>[...tt,{type:"ai",text:"I couldn't find that Member ID in our system. No worries! Please enter your first and last name so I can assist you.",timestamp:new Date}]),k(!1);return}catch{x(tt=>[...tt,{type:"ai",text:"Sorry, I had trouble verifying that Member ID. Please enter your first and last name so I can assist you.",timestamp:new Date}]),k(!1);return}}const Xe=`Nice to meet you, ${ae.trim()}! How can I help you today?`;x(It=>[...It,{type:"ai",text:Xe,timestamp:new Date}]),W(It=>({...It,name:ae.trim()})),Q(!0);return}u==="chat"&&(k(!0),setTimeout(async()=>{try{const Ve=ae.trim();let We=$t.current.get(Ve);if(typeof We!="boolean"&&(We=await NY(ae),$t.current.set(Ve,We)),We){const Tt=PY(),gt=`当然可以!如果你在手机上,我现在可以帮你直接拨打 PDA 电话:${ba}。
4453
4454如果没有自动弹出拨号界面,请点击下面的按钮。`,Tn=`Sure! If you're on mobile, I can help you call PDA now: ${ba}.
4455
4456If the dialer doesn’t open automatically, tap the button below.`,Ji=/[\u4e00-\u9fff]/.test(ae)?gt:Tn,Xi=[{label:`📞 Call PDA (${ba})`,link:Rf,icon:"📞",type:"primary"},{label:"📞 Contact Us",link:"/contact",icon:"📞",type:"secondary"}];if(x(ms=>[...ms,{type:"ai",text:Ji,timestamp:new Date,ragActions:Xi,isRAGResponse:!0,userQuery:ae}]),Ri(F,{type:"ai",text:Ji}),Tt)try{setTimeout(()=>{window.location.href=Rf},50)}catch{}k(!1),d("chat");return}const wt=await aY(ae),Xe=wt?.[0]?.score||0,It=n!==null;if(wt.length>0&&Xe>5){if(wt[0].requiresAuth&&!It){x(Tn=>[...Tn,{type:"ai",text:`🔒 **Staff Login Required**
4457
4458This feature is available to logged-in staff members only.
4459
4460Please log in to your PDA account to access:
4461• Member Dashboard
4462• Admin Panel
4463• Community Q&A Management
4464• Data Analytics
4465
4466If you don't have an account, please contact an administrator.`,timestamp:new Date,ragActions:[{label:"🔑 Log In",link:"/login",icon:"🔑",type:"primary"},{label:"📧 Contact Admin",link:"/contact",icon:"📧",type:"secondary"}],isRAGResponse:!0}]),k(!1),d("chat");return}const gt=WK(ae,wt);x(Tn=>[...Tn,{type:"ai",text:gt.content,timestamp:new Date,ragActions:gt.actions,relatedTopics:gt.relatedTopics,isRAGResponse:!0,userQuery:ae}]),Ri(F,{type:"ai",text:gt.content}),If(F,{usedRag:!0}),wt[0]?.category&&se(Tn=>[...Tn,wt[0].category]),k(!1),d("chat");return}const bt=ae.trim();let tt=Nn.current.get(bt);if(tt||(tt=await OY(ae,Yt),Nn.current.set(bt,tt)),!(tt==="general"||Np.has(tt))||tt==="out_of_scope"){const Tt=/[\u4e00-\u9fff]/.test(ae)?"我主要专注于 PDA 的服务范围(CDL/法律移民/保险医疗/住房/就业/青少年/心理健康等)。这个问题看起来不在范围内。如果你需要 PDA 相关帮助,请告诉我你想解决的是哪一类问题(例如住房、法律、医疗等)。":"I focus on PDA services (CDL, legal/immigration, insurance/healthcare, housing, jobs, youth, mental health). This question seems outside our scope. If you need PDA-related help, tell me which area you need (e.g., housing, legal, healthcare).";x(gt=>[...gt,{type:"ai",text:Tt,timestamp:new Date}]),Ri(F,{type:"ai",text:Tt}),k(!1),d("chat");return}const Lr=`${tt}::${ae.trim()}::${Xe}`;let Fn=St.current.get(Lr);typeof Fn!="boolean"&&(Fn=await LY(ae,tt,Xe),St.current.set(Lr,Fn));let gn=null;if(Fn)try{gn=await AK(ae,{category:tt,lang:Nu(ae)||"auto",maxSources:tt==="general"?3:6})}catch{gn=null}if($){const Tt=y.filter(Qt=>Qt.type==="user"||Qt.type==="ai").map(Qt=>({type:Qt.type,text:Qt.text})),gt=Nu(ae)||"auto",Tn=gt==="zh"?"Chinese (中文)":gt==="es"?"Spanish (Español)":gt==="vi"?"Vietnamese (Tiếng Việt)":gt==="th"?"Thai (ไทย)":gt==="ko"?"Korean (한국어)":gt==="ja"?"Japanese (日本語)":"English",dr=gn?`
4467[External Research - PDA In-Scope]
4468Summary: ${gn.summary||""}
4469Bullets:
4470${(gn.bullets||[]).map(Qt=>`- ${Qt}`).join(`
4471`)}
4472
4473Sources:
4474${(gn.sources||[]).map(Qt=>`- ${Qt.title||"Source"} | ${Qt.url||""} ${Qt.publishedAt?`| ${Qt.publishedAt}`:""}`).join(`
4475`)}
4476`:"",Xi=[{role:"system",content:`
4477You are Amy, PDA's AI assistant.
4478
4479🌍 **CRITICAL LANGUAGE DIRECTIVE**:
4480- User's input language: ${Tn} (code: ${gt})
4481- **YOU MUST respond in ${Tn}**
4482- If user writes in Chinese, respond ENTIRELY in Chinese (不要用英文)
4483- If user writes in Spanish, respond ENTIRELY in Spanish
4484- If user writes in Vietnamese, respond ENTIRELY in Vietnamese
4485- NEVER switch languages mid-response
4486- Match user's language EXACTLY
4487
4488RULES:
44891) Answer in the SAME language as the user message (User language: ${Tn}).
44902) Stay strictly within PDA service scope: CDL, Legal/Immigration, Insurance/Healthcare, Housing, Employment, Youth, Mental Health, Education/Training, Donations, About PDA.
44913) If researchContext exists, use it as factual basis and cite source TITLES in-line (do NOT output raw URLs).
44924) Keep it short, warm, actionable. Ask at most ONE follow-up question if needed.
4493
4494STYLE:
4495- Friendly, human, not robotic.
4496- 1-2 emojis max.
4497`.trim()+`
4498
4499`+dr},...Tt.map(Qt=>({role:Qt.type==="user"?"user":"assistant",content:Qt.text})),{role:"user",content:ae}],ms=await Td(Xi,{provider:"auto",temperature:.6,maxTokens:900}),Qn=ms?.response||ms?.message||ms?.data?.response;if(Qn){if(I(vn=>vn+1),x(vn=>[...vn,{type:"ai",text:Qn,timestamp:new Date,usedExternalResearch:!!gn}]),Ri(F,{type:"ai",text:Qn}),If(F,{usedOpenai:!0,usedGemini:!!gn}),gn&&(tt==="general"||Np.has(tt))){const vn=IY(tt,ae),gs=new Date(Date.now()+vn*864e5).toISOString();TK({category:tt,question:ae,answer:Qn,sources:gn.sources||[],summary:gn.summary||null,expires_at:gs,lang:gt}).catch(()=>{})}if(ae.toLowerCase().includes("legal")||ae.toLowerCase().includes("lawyer")||ae.toLowerCase().includes("attorney")||D>=2){const vn=Np.has(tt)?tt:"general";V(vn),se(ys=>[...ys,vn]);const gs=An(ae,vn),fi=[];gs.directLink&&fi.push({label:`${On(vn)} ${mn(vn)} Page`,link:gs.directLink,icon:On(vn),type:"primary"}),fi.push({label:"📞 Contact Us",link:"/contact",icon:"📞",type:"secondary"}),fi.push({label:`📞 Call PDA (${ba})`,link:Rf,icon:"📞",type:"secondary"}),x(ys=>[...ys,{type:"ai",text:`${On(vn)} Recommended Department: **${mn(vn)}**
4500
4501💡 ${gs.quickAnswer}`,timestamp:new Date,ragActions:fi,isRAGResponse:!0,userQuery:ae},{type:"ai",text:`You can also leave your contact information, ${gs.experts} will get back to you soon!`,timestamp:new Date,showContactForm:!0}]),d("contact")}else d("chat");k(!1);return}}const yn=Yt(ae);V(yn);const jn=An(ae,yn),At=[];jn.directLink&&At.push({label:`${On(yn)} ${mn(yn)} Page`,link:jn.directLink,icon:On(yn),type:"primary"}),At.push({label:"📞 Contact Us",link:"/contact",icon:"📞",type:"secondary"}),At.push({label:`📞 Call PDA (${ba})`,link:Rf,icon:"📞",type:"secondary"});const Yn=[{type:"ai",text:`✨ ${jn.greeting}`,timestamp:new Date},{type:"ai",text:`${On(yn)} Recommended Department: **${mn(yn)}**
4502
4503💡 ${jn.quickAnswer}`,timestamp:new Date,ragActions:At,isRAGResponse:!0,userQuery:ae},{type:"ai",text:`You can also leave your contact information, ${jn.experts} will get back to you soon!`,timestamp:new Date,showContactForm:!0}];x(Tt=>[...Tt,...Yn]),Ri(F,{type:"ai",text:Yn.map(Tt=>Tt.text).join(`
4504`)}),se(Tt=>[...Tt,yn]),yn==="general"&&lY(ae,Nu(ae),n?.role||"guest"),k(!1),d("contact")}catch{const We=Yt(ae);V(We),se(It=>[...It,We]);const wt=An(ae,We),Xe=[{type:"ai",text:`✨ ${wt.greeting}`,timestamp:new Date},{type:"ai",text:`${On(We)} Recommended Department: **${mn(We)}**`,timestamp:new Date},{type:"ai",text:`Please leave your contact information, ${wt.experts} will get back to you soon!`,timestamp:new Date,showContactForm:!0}];x(It=>[...It,...Xe]),Ri(F,{type:"ai",text:Xe.map(It=>It.text).join(`
4505`)}),k(!1),d("contact")}},500))},Ln=async()=>{if(!U.name||!U.email){t({title:"Incomplete Information",description:"Please provide your name and email",variant:"destructive"});return}k(!0);try{let ge=!1,ae=null;U.member_id&&U.member_id.trim()&&(ae=(Rn?.members?.getAll?Rn.members.getAll():[]).find(We=>We.member_code===U.member_id.trim()||We.member_id===U.member_id.trim()),ae&&(ge=!0,W(We=>({...We,name:ae.name||We.name,email:ae.email||We.email,phone:ae.phone||We.phone}))));const Ne=y.filter(Ve=>Ve.type==="user").map(Ve=>Ve.text).join(`
4506`),Ee={name:U.name,email:U.email,phone:U.phone,member_id:U.member_id,is_member:ge||!!n,question:Ne,urgency:ge||n?"high":"normal",preferred_response_type:"public",source:"ai_chat",ai_detected_category:N};Rn.questions.create(Ee);const ke={legal:"[email protected]",healthcare:"[email protected]",real_estate:"[email protected]",insurance:"[email protected]",economics:"[email protected]",education:"[email protected]"};await xP({type:Mt.LEGAL_AID,data:{...Ee,ai_category:mn(N),routed_to:ke[N]||"[email protected]"}}),x(Ve=>[...Ve,{type:"ai",text:ge?`✅ Your question has been sent to our professional team (${ke[N]}) and associated with your verified member record.`:`✅ Great! Your question has been sent to our professional team (${ke[N]}).`,timestamp:new Date},{type:"ai",text:ge||n?"🌟 Our team reviews member inquiries according to subject, urgency, program scope, and available resources. Membership does not guarantee priority or a response time.":"We will review your inquiry according to subject, urgency, and available resources and contact you by email when appropriate.",timestamp:new Date},{type:"ai",text:"✅ **Your question has been submitted successfully!** You can close this window, or feel free to ask more questions!",timestamp:new Date}]),d("chat"),k(!1),If(F,{contactFormSubmitted:!0,userName:U.name,userEmail:U.email,memberId:U.member_id||null,categories:[...new Set(M)]}),t({title:ge||n?"Member Question Submitted! 🌟":"Question Submitted!",description:`Sent to ${mn(N)} Team`,className:"bg-green-50 border-green-200 text-green-900"})}catch{k(!1),t({title:"Submission Failed",description:"Please try again later",variant:"destructive"})}},ts=ge=>{ge.key==="Enter"&&!ge.shiftKey&&(ge.preventDefault(),Nr())};S.useEffect(()=>{const ge=()=>{const Ee=document.cookie.split(";").find(Ve=>Ve.trim().startsWith("googtrans="));if(Ee){const We=(Ee.split("=").pop()||"").split("/")[2]||"";if(We){if(We.toLowerCase().startsWith("zh")){ee("zh");return}ee("en");return}}const ke=navigator.language||navigator.userLanguage;String(ke).toLowerCase().startsWith("zh")?ee("zh"):ee("en")};ge();const ae=setInterval(ge,2e3);return()=>clearInterval(ae)},[]);const Or=({sizeClass:ge="w-12 h-12",speaking:ae=!1})=>
4506ae?v.jsx("video",{src:vr,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:`${ge} object-cover`,onError:Ne=>{try{Ne.currentTarget.style.display="none"}catch{}}}):v.jsx("img",{src:Oy.img,alt:"Amy",className:`${ge} object-cover`,width:"48",height:"48",loading:"lazy"});return v.jsxs(v.Fragment,{children:[v.jsx(Qr,{mode:"wait",children:!s&&v.jsx(Vt.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},className:"fixed bottom-6 right-6 md:right-24 z-50",children:v.jsxs("button",{onClick:()=>i(!0),className:"relative bg-gradient-to-r from-[#001F3F] to-[#C41E3A] text-white rounded-full p-3 md:p-4 shadow-2xl hover:shadow-3xl transition-all duration-300 hover:scale-110 group",children:[v.jsx(yD,{className:"w-5 h-5 md:w-6 md:h-6"}),v.jsx("span",{className:"absolute -top-1 -right-1 w-3 h-3 bg-green-400 rounded-full animate-pulse"}),v.jsx("div",{className:"absolute bottom-full right-0 mb-2 opacity-0 group-hover:opacity-100 transition-opacity",children:v.jsx("div",{className:"bg-gray-900 text-white text-xs rounded-lg px-3 py-2 whitespace-nowrap",children:"💬 Chat with Amy"})})]})})}),v.jsx(Qr,{mode:"wait",children:s&&v.jsx(Vt.div,{initial:{opacity:0,y:100,scale:.8},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:100,scale:.8},className:"fixed bottom-6 right-6 md:right-24 z-50 w-[90vw] md:w-[380px]",children:v.jsxs("div",{className:"bg-white rounded-3xl shadow-2xl overflow-hidden border-2 border-gray-100",children:[v.jsx("div",{className:"bg-white border-b border-gray-100 p-4",children:v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("div",{className:"relative",children:[v.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-rose-100 to-pink-100 flex items-center justify-center border-2 border-white shadow-md overflow-hidden",children:v.jsx(Or,{sizeClass:"w-12 h-12",speaking:yr})}),v.jsx("span",{className:"absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white"})]}),v.jsxs("div",{children:[v.jsx("h3",{className:"font-bold text-gray-900 text-base",children:"Amy"}),v.jsx("p",{className:"text-xs text-gray-500",children:"PDA Assistant • Online"})]})]}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("button",{onClick:()=>c(!a),className:"hover:bg-gray-100 rounded-lg p-2 transition-colors text-gray-600",children:a?v.jsx(_K,{className:"w-4 h-4"}):v.jsx(Da,{className:"w-4 h-4"})}),v.jsx("button",{onClick:()=>{if(F){const ge=y.filter(Ne=>Ne.type==="user"),ae=y.filter(Ne=>Ne.type==="ai");pS(F,{totalMessages:y.length,totalUserMessages:ge.length,totalAiMessages:ae.length,categories:[...new Set(M)],contactFormSubmitted:u==="success"}),L(null)}i(!1)},className:"hover:bg-gray-100 rounded-lg p-2 transition-colors text-gray-600",children:v.jsx(jc,{className:"w-4 h-4"})})]})]})}),!a&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"h-[400px] md:h-[450px] overflow-y-auto p-4 space-y-3 bg-gradient-to-b from-gray-50 to-white",children:[y.map((ge,ae)=>{const Ne=pe===ae||Oe===ae;return v.jsxs("div",{className:`flex gap-2 ${ge.type==="user"?"justify-end":"justify-start"}`,children:[ge.type==="ai"&&v.jsx("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-rose-100 to-pink-100 flex-shrink-0 overflow-hidden border border-white shadow-sm",children:v.jsx(Or,{sizeClass:"w-8 h-8",speaking:Ne})}),v.jsxs("div",{className:`max-w-[80%] rounded-2xl px-4 py-3 shadow-sm ${ge.type==="user"?"bg-[#001F3F] text-white":"bg-white border border-gray-100 text-gray-800"}`,children:[ge.type==="ai"&&v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx(vK,{className:"w-3 h-3 text-[#C41E3A]"}),v.jsx("span",{className:"text-[10px] font-medium text-gray-500",children:"AI Assistant"})]}),v.jsx("p",{className:"text-[13px] leading-relaxed whitespace-pre-wrap",children:ge.text}),ge.type==="ai"&&ge.text&&v.jsxs("button",{onClick:()=>vt(ge.text,ae,ge.lang),disabled:Oe===ae,className:`mt-2 flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] transition-all ${pe===ae?"bg-[#C41E3A]/10 text-[#C41E3A]":Oe===ae?"bg-gray-100 text-gray-400 cursor-wait":"bg-gray-50 text-gray-400 hover:bg-gray-100 hover:text-gray-600"}`,title:pe===ae?"Stop":"Read aloud",children:[Oe===ae?v.jsx(id,{className:"w-3 h-3 animate-spin"}):pe===ae?v.jsx(bK,{className:"w-3 h-3"}):v.jsx(wD,{className:"w-3 h-3"}),v.jsx("span",{children:Oe===ae?"...":pe===ae?"Stop":"🔊"})]}),ge.ragActions&&ge.ragActions.length>0&&v.jsxs("div",{className:"mt-4 space-y-2",children:[ge.ragActions.map((Ee,ke)=>v.jsxs("a",{href:Ee.link,onClick:Ve=>{if(Ee.link&&String(Ee.link).startsWith("tel:")){try{window.location.href=Ee.link}catch{}Sf(ge.userQuery||"unknown",Ee.label,!0);return}Ee.link&&Ee.link.startsWith("/")&&(Ve.preventDefault(),e(Ee.link),i(!1)),Sf(ge.userQuery||"unknown",Ee.label,!0)},className:"flex items-center justify-between gap-3 w-full bg-gradient-to-r from-blue-600 to-indigo-600 text-white px-4 py-3 rounded-xl hover:from-blue-700 hover:to-indigo-700 transition-all duration-300 shadow-md hover:shadow-xl group",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"text-xl",children:Ee.icon||"🎯"}),v.jsx("span",{className:"text-sm font-semibold",children:Ee.label})]}),v.jsx(xK,{className:"w-4 h-4 group-hover:translate-x-1 transition-transform"})]},ke)),ge.isRAGResponse&&v.jsxs("div",{className:"flex items-center gap-2 mt-3 pt-3 border-t border-gray-100",children:[v.jsx("span",{className:"text-xs text-gray-500",children:"Was this helpful?"}),v.jsx("button",{onClick:()=>{Sf(ge.userQuery,ge.ragActions[0]?.label,!0),x(Ee=>Ee.map((ke,Ve)=>
4506Ve===y.indexOf(ge)?{...ke,feedbackGiven:"positive"}:ke))},disabled:ge.feedbackGiven,className:`p-1.5 rounded-lg transition-all ${ge.feedbackGiven==="positive"?"bg-green-100 text-green-600":"hover:bg-gray-100 text-gray-400 hover:text-green-600"}`,children:v.jsx(wK,{className:"w-4 h-4"})}),v.jsx("button",{onClick:()=>{Sf(ge.userQuery,ge.ragActions[0]?.label,!1),x(Ee=>Ee.map((ke,Ve)=>Ve===y.indexOf(ge)?{...ke,feedbackGiven:"negative"}:ke))},disabled:ge.feedbackGiven,className:`p-1.5 rounded-lg transition-all ${ge.feedbackGiven==="negative"?"bg-red-100 text-red-600":"hover:bg-gray-100 text-gray-400 hover:text-red-600"}`,children:v.jsx(EK,{className:"w-4 h-4"})})]})]}),ge.showMembershipButtons&&v.jsxs("div",{className:"mt-3 flex gap-2",children:[v.jsx("button",{onClick:()=>ur(!0),className:"flex-1 bg-gradient-to-r from-[#001F3F] to-[#C41E3A] text-white px-3 py-2 rounded-lg text-[13px] font-medium hover:shadow-lg transition-all",children:"✅ Yes, I'm a member"}),v.jsx("button",{onClick:()=>ur(!1),className:"flex-1 bg-gray-100 text-gray-700 px-3 py-2 rounded-lg text-[13px] font-medium hover:bg-gray-200 transition-all",children:"No, I'm not a member"})]}),v.jsx("p",{className:"text-[10px] opacity-60 mt-1",children:ge.timestamp.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}),ge.showContactForm&&u==="contact"&&v.jsxs("div",{className:"mt-4 space-y-3 bg-gray-50 p-4 rounded-lg",children:[v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-medium text-gray-600",children:"Name *"}),v.jsx("input",{type:"text",value:U.name,onChange:Ee=>W(ke=>({...ke,name:Ee.target.value})),className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-[#001F3F] focus:border-transparent mt-1",placeholder:"Enter your name"})]}),v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-medium text-gray-600",children:"Email *"}),v.jsx("input",{type:"email",value:U.email,onChange:Ee=>W(ke=>({...ke,email:Ee.target.value})),className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-[#001F3F] focus:border-transparent mt-1",placeholder:"[email protected]"})]}),v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-medium text-gray-600",children:"Phone (Optional)"}),v.jsx("input",{type:"tel",value:U.phone,onChange:Ee=>W(ke=>({...ke,phone:Ee.target.value})),className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-[#001F3F] focus:border-transparent mt-1",placeholder:"(555) 123-4567"})]}),f&&v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-medium text-gray-600",children:"Member ID (Optional)"}),v.jsx("input",{type:"text",value:U.member_id,onChange:Ee=>W(ke=>({...ke,member_id:Ee.target.value})),className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-[#001F3F] focus:border-transparent mt-1",placeholder:"Your member ID"})]}),v.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-2.5",children:v.jsxs("p",{className:"text-[10px] text-gray-500 leading-relaxed",children:["By providing your phone number, you agree to receive text messages from PDA regarding your inquiry. Msg & data rates may apply. Frequency varies. Reply ",v.jsx("strong",{children:"STOP"})," to opt-out, ",v.jsx("strong",{children:"HELP"})," for help. See our"," ",v.jsx("a",{href:"/privacy-policy",className:"text-blue-600 hover:underline",children:"Privacy Policy"})," ","&"," ",v.jsx("a",{href:"/terms-of-use",className:"text-blue-600 hover:underline",children:"Terms"}),"."]})}),v.jsx(ac,{onClick:Ln,disabled:C,className:"w-full bg-[#001F3F] hover:bg-[#C41E3A] text-white",children:C?v.jsxs(v.Fragment,{children:[v.jsx(id,{className:"w-4 h-4 mr-2 animate-spin"}),"Submitting..."]}):v.jsxs(v.Fragment,{children:[v.jsx(cS,{className:"w-4 h-4 mr-2"}),"Submit Question"]})})]})]})]},ae)}),C&&u==="chat"&&v.jsx("div",{className:"flex justify-start",children:v.jsx("div",{className:"bg-white border border-gray-200 rounded-2xl px-4 py-3",children:v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(id,{className:"w-4 h-4 animate-spin text-[#C41E3A]"}),v.jsx("span",{className:"text-[13px] text-gray-600",children:"AI is analyzing your question..."})]})})}),v.jsx("div",{ref:Me})]}),u==="chat"&&v.jsxs("div",{className:"p-4 bg-white border-t border-gray-200",children:[v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{ref:dt,type:"text",value:w,onChange:ge=>R(ge.target.value),onKeyPress:ts,placeholder:"Type your question...",className:"flex-1 px-4 py-3 border border-gray-300 rounded-full focus:ring-2 focus:ring-[#001F3F] focu
4506s:border-transparent text-sm",disabled:C}),v.jsx("button",{onClick:Nr,disabled:C||!w.trim(),className:"bg-[#001F3F] text-white rounded-full p-3 hover:bg-[#C41E3A] transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:v.jsx(cS,{className:"w-5 h-5"})})]}),v.jsxs("p",{className:"text-[10px] text-gray-400 mt-2 text-center",children:["Powered by ",v.jsx("span",{className:"font-medium text-gray-600",children:"PDA-Amy AI"})]})]})]})]})})}),H==="cny"&&v.jsx(EY,{show:!0,onClose:()=>J(null)}),H&&H!=="cny"&&v.jsx(TY,{holiday:H,show:!0,onClose:()=>J(null),userLang:le})]})};function jY(t){const e=t.toLowerCase();return e.includes("jscdl")||e.includes("drivebook")||e.includes("complete learning ecosystem")&&e.includes("pda")||e.includes("training system")&&e.includes("ai")||e.includes("教学系统")||e.includes("全系统")||e.includes("教练日志")||e.includes("学员管理")?"jscdl_ecosystem":e.includes("cdl")&&(e.includes("practice app")||e.includes("j&s")||e.includes("class a")||e.includes("class b"))||e.includes("pda")&&e.includes("cdl")&&(e.includes("学习")||e.includes("练习"))||e.includes("驾照")&&(e.includes("练习")||e.includes("j&s"))?"cdl_learning":e.includes("j&s")&&(e.includes("driving school")||e.includes("reliance")||e.includes("new york"))||e.includes("j&s")&&(e.includes("驾校")||e.includes("纽约"))?"js_driving_school":e.includes("trucktalk")||e.includes("ny cdl permit")||e.includes("pda")&&e.includes("app")&&(e.includes("download")||e.includes("下载"))?"mobile_apps":null}/**
4507 * @license lucide-react v0.469.0 - ISC
4508 *
4509 * This source code is licensed under the ISC license.
4510 * See the LICENSE file in the root directory of this source tree.
4511 */const MY=Ke("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
4512 * @license lucide-react v0.469.0 - ISC
4513 *
4514 * This source code is licensed under the ISC license.
4515 * See the LICENSE file in the root directory of this source tree.
4516 */const BY=Ke("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
4517 * @license lucide-react v0.469.0 - ISC
4518 *
4519 * This source code is licensed under the ISC license.
4520 * See the LICENSE file in the root directory of this source tree.
4521 */const VY=Ke("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
4522 * @license lucide-react v0.469.0 - ISC
4523 *
4524 * This source code is licensed under the ISC license.
4525 * See the LICENSE file in the root directory of this source tree.
4526 */const UY=Ke("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
4527 * @license lucide-react v0.469.0 - ISC
4528 *
4529 * This source code is licensed under the ISC license.
4530 * See the LICENSE file in the root directory of this source tree.
4531 */const $Y=Ke("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
4532 * @license lucide-react v0.469.0 - ISC
4533 *
4534 * This source code is licensed under the ISC license.
4535 * See the LICENSE file in the root directory of this source tree.
4536 */const zY=Ke("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
4537 * @license lucide-react v0.469.0 - ISC
4538 *
4539 * This source code is licensed under the ISC license.
4540 * See the LICENSE file in the root directory of this source tree.
4541 */const HY=Ke("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
4542 * @license lucide-react v0.469.0 - ISC
4543 *
4544 * This source code is licensed under the ISC license.
4545 * See the LICENSE file in the root directory of this source tree.
4546 */const qY=Ke("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
4547 * @license lucide-react v0.469.0 - ISC
4548 *
4549 * This source code is licensed under the ISC license.
4550 * See the LICENSE file in the root directory of this source tree.
4551 */const WY=Ke("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
4552 * @license lucide-react v0.469.0 - ISC
4553 *
4554 * This source code is licensed under the ISC license.
4555 * See the LICENSE file in the root directory of this source tree.
4556 */const GY=Ke("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/**
4557 * @license lucide-react v0.469.0 - ISC
4558 *
4559 * This source code is licensed under the ISC license.
4560 * See the LICENSE file in the root directory of this source tree.
4561 */const KY=Ke("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
4562 * @license lucide-react v0.469.0 - ISC
4563 *
4564 * This source code is licensed under the ISC license.
4565 * See the LICENSE file in the root directory of this source tree.
4566 */const YY=Ke("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
4567 * @license lucide-react v0.469.0 - ISC
4568 *
4569 * This source code is licensed under the ISC license.
4570 * See the LICENSE file in the root directory of this source tree.
4571 */const QY=Ke("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]),Ly=[{code:"en",label:"English",flag:"🇺🇸"},{code:"zh-CN",label:"简体中文",flag:"🇨🇳"},{code:"zh-TW",label:"繁體中文",flag:"🇹🇼"},{code:"es",label:"Español",flag:"🇪🇸"},{code:"fr",label:"Français",flag:"🇫🇷"},{code:"de",label:"Deutsch",flag:"🇩🇪"},{code:"it",label:"Italiano",flag:"🇮🇹"},{code:"pt",label:"Português",flag:"🇵🇹"},{code:"ru",label:"Русский",flag:"🇷🇺"},{code:"ja",label:"日本語",flag:"🇯🇵"},{code:"ko",label:"한국어",flag:"🇰🇷"},{code:"ar",label:"العربية",flag:"🇸🇦"},{code:"hi",label:"हिन्दी",flag:"🇮🇳"},{code:"th",label:"ไทย",flag:"🇹🇭"},{code:"vi",label:"Tiếng Việt",flag:"🇻🇳"},{code:"tl",label:"Filipino",flag:"🇵🇭"}],JY=()=>{const[t,e]=S.useState(!1),[n,r]=S.useState("en"),s=S.useRef(null);S.useEffect(()=>{const c=u=>{s.current&&!s.current.contains(u.target)&&e(!1)};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[]);const i=c=>{r(c),e(!1)},a=Ly.find(c=>c.code===n)||Ly[0];return v.jsxs("div",{className:"relative z-50",ref:s,children:[v.jsxs("button",{onClick:()=>e(!t),className:Et("flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-300 group border border-transparent select-none",t?"bg-gray-100 text-[#C41E3A] border-gray-200":"text-[#001F3F] hover:bg-gray-50 hover:text-[#C41E3A]"),"aria-label":"Select Language",children:[v.jsx(i0,{className:Et("w-5 h-5 transition-transform duration-500",t?"rotate-180":"")}),v.jsx("span",{className:"text-sm font-bold whitespace-nowrap hidden sm:inline-block",children:a.label}),v.jsx(Da,{className:Et("w-4 h-4 opacity-70 transition-transform duration-300",t?"rotate-180":"")})]}),v.jsx(Qr,{children:t&&v.jsx(Vt.div,{initial:{opacity:0,y:8,scale:.95}
4571,animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-64 bg-white rounded-xl shadow-xl border border-gray-100 py-2 z-[100] overflow-hidden origin-top-right ring-1 ring-black/5",children:v.jsx("div",{className:"max-h-[60vh] overflow-y-auto custom-scrollbar",children:Ly.map(c=>v.jsxs("button",{onClick:()=>i(c.code),className:Et("w-full px-4 py-3 text-left flex items-center justify-between transition-colors duration-200 group relative",n===c.code?"bg-blue-50/80 text-[#001F3F]":"text-gray-600 hover:bg-gray-50 hover:text-[#001F3F]"),children:[v.jsxs("div",{className:"flex items-center gap-3 relative z-10",children:[v.jsx("span",{className:"text-xl leading-none",children:c.flag}),v.jsx("span",{className:Et("text-sm",n===c.code?"font-bold":"font-medium"),children:c.label})]}),n===c.code&&v.jsx(gD,{className:"w-4 h-4 text-[#C41E3A] relative z-10"})]},c.code))})})})]})},rr=({children:t})=>{const{logout:e,admin:n}=Ix(),{logout:r,user:s}=kx(),i=Ac(),a=cr(),c=async()=>{n?await e():await r(),i("/admin-login")},u=n||s,d=u?.role||"guest",f=S.useCallback(x=>{x==="/admin/applications"?Promise.all([Pe(()=>import("./ApplicationReviewManager-AEz8vIyF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),Pe(()=>Promise.resolve().then(()=>QU),void 0).then(b=>b.prefetchApplications())]).catch(()=>{}):x==="/admin/settings"&&Pe(()=>import("./AdminSystemSettings-CgWBT7SR.js"),__vite__mapDeps([8,1,2,9,5])).catch(()=>{})},[]);S.useEffect(()=>{const x=[de.INFO_ADMIN,de.ADMIN,de.SUPER_ADMIN].includes(d),b=()=>{x&&f("/admin/applications"),d===de.SUPER_ADMIN&&f("/admin/settings")};if("requestIdleCallback"in window){const w=window.requestIdleCallback(b,{timeout:1500});return()=>window.cancelIdleCallback(w)}const E=window.setTimeout(b,600);return()=>window.clearTimeout(E)},[d,f]);const y=[{icon:Uv,label:"Dashboard",path:"/admin/dashboard",requiredRole:de.STAFF},{icon:MY,label:"User Management",path:"/admin/users",requiredRole:de.SUPER_ADMIN},{icon:YY,label:"Portal Preview",path:"/admin/portal-preview",requiredRole:de.SUPER_ADMIN},{icon:QY,label:"Card Design & Production",path:"/admin/card-designer",requiredRole:de.SUPER_ADMIN},{icon:VY,label:"Content Management",path:"/admin/content",requiredRole:de.ADMIN},{icon:WY,label:"Events & Programs",path:"/admin/career-events",requiredRole:de.INFO_ADMIN},{icon:KY,label:"Applications",path:"/admin/applications",requiredRole:de.INFO_ADMIN},{icon:GY,label:"AI Call Center",path:"/admin/ai-call-center",requiredRole:de.ADMIN},{icon:qY,label:"Donation Management",path:"/admin/donations",requiredRole:de.ADMIN},{icon:vD,label:"Email Routing Manager",path:"/admin/email-routing",requiredRole:de.INFO_ADMIN},{icon:HY,label:"Department Email Config",path:"/admin/department-email-config",requiredRole:de.SUPER_ADMIN},{icon:$Y,label:"Activity Logs",path:"/admin/logs",requiredRole:de.ADMIN},{icon:BY,label:"System Settings",path:"/admin/settings",requiredRole:de.SUPER_ADMIN}].filter(x=>x.requiredRole===de.SUPER_ADMIN?d===de.SUPER_ADMIN:x.requiredRole===de.ADMIN?d===de.ADMIN||d===de.SUPER_ADMIN:x.requiredRole===de.INFO_ADMIN?d===de.INFO_ADMIN||d===de.ADMIN||d===de.SUPER_ADMIN:d===de.STAFF||d===de.INFO_ADMIN||d===de.ADMIN||d===de.SUPER_ADMIN);return v.jsxs("div",{className:"min-h-screen bg-gray-100 flex flex-col md:flex-row",children:[v.jsxs("aside",{className:"w-full md:w-64 bg-[#001F3F] text-white flex-shrink-0 flex flex-col h-screen sticky top-0",children:[v.jsxs("div",{className:"p-6 border-b border-white/10 flex items-center gap-3",children:[v.jsx(UY,{className:"w-8 h-8 text-[#C41E3A]"}),v.jsxs("div",{children:[v.jsx("h1",{className:"font-bold text-lg tracking-wide",children:"PDA Admin"}),v.jsx("p",{className:"text-xs text-gray-400",children:x$[d]||"Internal Portal"})]})]}),v.jsx("nav",{className:"flex-grow p-4 space-y-2 overflow-y-auto",children:y.map(x=>{const b=a.pathname===x.path;return v.jsxs(Oi,{to:x.path,onMouseEnter:()=>f(x.path),onFocus:()=>f(x.path),className:Et("flex items-center gap-3 px-4 py-3 rounded-xl transition-all duration-200 font-medium",b?"bg-white/10 text-white shadow-lg backdrop-blur-sm":"text-gray-400 hover:text-white hover:bg-white/5"),children:[v.jsx(x.icon,{className:Et("w-5 h-5",b?"text-[#C41E3A]":"text-gray-400 group-hover:text-white")}),x.label]},x.path)})}),v.jsxs("div",{className:"p-4 border-t border-white/10",children:[v.jsx("div",{className:"mb-4",children:v.jsx(JY,{})}),v.jsxs("div",{className:"flex items-center gap-3 mb-4 px-2",children:[v.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-tr from-[#C41E3A] to-orange-500 flex items-center justify-center font-bold text-white shadow-lg uppercase",children:u?.name?.charAt(0)||"A"}),v.jsxs("div",{className:"overflow-hidden",children:[v.jsx("p",{className:"text-sm font-semibold truncate",children:u?.name||"Admin"}),v.jsxs("p",{className:"text-xs text-gray-400 truncate flex items-center gap-1",children:[v.jsx(zY,{className:"w-3 h-3"})," ",d]})]})]}),v.jsxs(ac,{onClick:c,variant:"ghost",className:"w-full justify-start text-red-400 hover:text-red-300 hover:bg-white/5",children:[v.jsx(Vv,{className:"w-4 h-4 mr-2"}),"Sign Out"]}),v.jsx("p",{className:"mt-3 text-center text-[11px] font-mono text-white/40",children:xD})]})]}),v.jsx("main",{className:"flex-grow overflow-x-hidden p-4 md:p-8",children:t})]})},XY=()=>v.jsx("div",{className:"min-h-screen flex items-center justify-center bg-[#0a1628]",children:v.jsx("div",{className:"flex flex-col items-center gap-3",children:v.jsx("div",{className:"w-8 h-8 border-2 border-blue-500/30 border-t-blue-500 rounded-full animate-spin"})})}),vS=S.lazy(()=>Pe(()=>import("./HomePage-6cZNIMIH.js"),__vite__mapDeps([10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]))),ZY=S.lazy(()=>Pe(()=>import("./Donate-CSIq9WRx.js"),__vite__mapDeps([27,25,2,28,29,3,26]))),eQ=S.lazy(()=>Pe(()=>import("./JoinUs-DgQec_3j.js"),__vite__mapDeps([30,18,31,23,32,33]))),tQ=S.lazy(()=>Pe(()=>import("./CommunityQA-CtA376KV.js"),__vite__mapDeps([34,35,29,18,36,37,38,31,39,40,41]))),nQ=S.lazy(()=>Pe(()=>import("./LegalAid-DRm-IImv.js"),__vite__mapDeps([42,38,29,37,43,44,45,22,1,46,47,7,39,40,41]))),rQ=S.lazy(()=>Pe(()=>import("./TrainingHome--r0TBfeF.js"),__vite__mapDeps([48,11,22,49,50]))),sQ=S.lazy(()=>Pe(()=>import("./TrainingSchools-D-E-b036.js"),__vite__mapDeps([51,52,53,54]))),iQ=S.lazy(()=>Pe(()=>import("./Employment-DqARZeTH.js"),__vite__mapDeps([55,54,33,22,49,13,56,11]))),oQ=S.lazy(()=>Pe(()=>import("./CareerEvents-pToT3mfg.js"),__vite__mapDeps([57,11,12,13,14,24,15,16]))),aQ=S.lazy(()=>Pe(()=>import("./CareerEventDetail-COERao2Y.js"),__vite__mapDeps([58,52,12,35,54,45,59,15,16]))),lQ=S.lazy(()=>Pe(()=>import("./Insurance-Cy_oNMjU.js"),__vite__mapDeps([60,54]))),cQ=S.lazy(()=>Pe(()=>import("./ContactUs-BwhTpyje.js"),__vite__mapDeps([61,29,62,39,40,41,26]))),uQ=S.lazy(()=>Pe(()=>import("./AboutNew-DU4i6k8t.js"),__vite__mapDeps([63,62,23,33,11,64,26,17]))),dQ=S.lazy(()=>Pe(()=>import("./TransparencyPage-BhjaQPAm.js"),__vite__mapDeps([65,66,46,67,54,44,18,68,6,69]))),hQ=S.lazy(()=>Pe(()=>import("./LeadershipPage-DJu5Keym.js"),__vite__mapDeps([70,29,46,18,23,33,71,22,3,26,17]))),fQ=S.lazy(()=>Pe(()=>import("./AccessibilityDemo-D0YtODZ2.js"),__vite__mapDeps([72,67,44,43,36,73,68,6,69]))),pQ=S.lazy(()=>Pe(()=>import("./SMSConsentPage-Dne8nMHr.js"),__vite__mapDeps([74,75,31]))),mQ=S.lazy(()=>Pe(()=>import("./AppMainPage-BTuUHTlF.js"),__vite__mapDeps([76,22,77,1,54,53,26]))),gQ=S.lazy(()=>Pe(()=>import("./AppTermsPrivacy-D_W8e416.js"),__vite__mapDeps([78,45,18,54,26,79]))),yQ=S.lazy(()=>Pe(()=>import("./NYCDLPermitTerms-DReUbs_z.js"),__vite__mapDeps([80,45,25]))),vQ=S.lazy(()=>Pe(()=>import("./TruckTalkProTerms-8KLEzGnA.js"),__vite__mapDeps([81,45,82,20,83,22,79]))),_Q=S.lazy(()=>Pe(()=>import("./TruckTalkProPage-DpV-EW9N.js"),__vite__mapDeps([84,22,1,67,11,77,85,26]))),xQ=S.lazy(()=>Pe(()=>import("./NYCDLPage-Cf-QOjz6.js"),__vite__mapDeps([86,77,1,67,11,66,87,88,26]))),wQ=S.lazy(()=>Pe(()=>import("./DigitalSolutions-ChkdmM_r.js"),__vite__mapDeps([89,14,1,43,54]))
4571),EQ=S.lazy(()=>Pe(()=>import("./PersonalInjury-BXM5o820.js"),__vite__mapDeps([90,18,32,33,23,31,44,28,62,66,67,77]))),bQ=S.lazy(()=>Pe(()=>import("./WorkersCompensation-9K5if8aZ.js"),__vite__mapDeps([91,11,12,92,18]))),AQ=S.lazy(()=>Pe(()=>import("./HealthcareNavigation-Dc3xYChq.js"),__vite__mapDeps([93,54,19,11]))),TQ=S.lazy(()=>Pe(()=>import("./MentalHealthSupport-DZn44sg-.js"),__vite__mapDeps([94,62,19,31]))),CQ=S.lazy(()=>Pe(()=>import("./HousingSupport-CsWii8f9.js"),__vite__mapDeps([95,23,77,11,54]))),SQ=S.lazy(()=>Pe(()=>import("./ResearchLogistics-Dhd0vMN-.js"),__vite__mapDeps([96,52,22,97,54,62,98]))),kQ=S.lazy(()=>Pe(()=>import("./ResearchLegalFrameworks-Cx6-Qo68.js"),__vite__mapDeps([99,52,97,54,62,18,45,98]))),IQ=S.lazy(()=>Pe(()=>import("./YouthSafety-03zwtRGw.js"),__vite__mapDeps([100,20,52,97,45,43,77,71,19,38]))),PQ=S.lazy(()=>Pe(()=>import("./HousingStabilityResearch-z_wht3IY.js"),__vite__mapDeps([101,23,97,38,52,98]))),_S=S.lazy(()=>Pe(()=>import("./TermsOfUse-Cmt8RsDX.js"),[])),xS=S.lazy(()=>Pe(()=>import("./PrivacyPolicy-UVgCi4Vy.js"),[])),RQ=S.lazy(()=>Pe(()=>import("./CookiePolicy-BU16zFhx.js"),[])),DQ=S.lazy(()=>Pe(()=>import("./Login-CqeUT-vD.js"),__vite__mapDeps([102,29,53,11,103,40,104,25,31,44,75,3,20,87,50,14]))),NQ=S.lazy(()=>Pe(()=>import("./MemberDashboard-C_ebYOBc.js"),__vite__mapDeps([105,29,67,97,46,6,103,40,106,26,36,64,107,108,13,109,110]))),OQ=S.lazy(()=>Pe(()=>import("./VolunteerDashboard-ChFXZcSz.js"),__vite__mapDeps([111,97,107,108,13,109,110,106]))),LQ=S.lazy(()=>Pe(()=>import("./LawyerDashboard-DpNtGo0w.js"),__vite__mapDeps([112,29,75,44,31,62,106]))),FQ=S.lazy(()=>Pe(()=>import("./SuperAdminLogin--OULKP5M.js"),__vite__mapDeps([113,52,104,25,31,44,75,3]))),jQ=S.lazy(()=>Pe(()=>import("./AdminDashboard-Cr52yU3-.js"),__vite__mapDeps([114,3,20,59,103,40,33,18,97,28,6,115,116,82]))),MQ=S.lazy(()=>Pe(()=>import("./UserManagement-h8Vsa3a_.js"),__vite__mapDeps([117,47,103,40,28,36,9,116,2,41,29,97,82,118,119,106,7,59,33,92,87]))),BQ=S.lazy(()=>Pe(()=>import("./DonationManagement-D459gLao.js"),__vite__mapDeps([120,46,97,67,28,44,5,75,3]))),VQ=S.lazy(()=>Pe(()=>import("./ContentStudio-Djvbh6gd.js"),__vite__mapDeps([121,3,20,68,103,40,122,116,82,118,1,75,77,33,19,18,22,123,109,16,108,124,125,110,21]))),UQ=S.lazy(()=>Pe(()=>import("./CareerEventsManager-CQA08F5B.js"),__vite__mapDeps([123,116,122,82,109,16,108,1,124,125,110]))),$Q=S.lazy(()=>Pe(()=>import("./ApplicationReviewManager-AEz8vIyF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]))),wS=S.lazy(()=>Pe(()=>import("./MembershipCardPrinter-C--MYarJ.js"),__vite__mapDeps([126,52,1,2,127,109,110,128]))),zQ=S.lazy(()=>Pe(()=>import("./InternalIdentityCardPrinter-Cf5bAB6h.js"),__vite__mapDeps([129,52,1,2,127,109,110,119,128]))),HQ=S.lazy(()=>Pe(()=>import("./CardDesignStudio-Cr-wwNNq.js"),__vite__mapDeps([130,1,2,124,131,118,110,128]))),qQ=S.lazy(()=>Pe(()=>import("./AICallCenter-DD6aSUep.js"),__vite__mapDeps([132,88,77,1,13,133,73,56,28,14,125,85]))),WQ=S.lazy(()=>Pe(()=>import("./EmailRoutingManager-B8HCn6dT.js"),__vite__mapDeps([134,62,46,122,116,118,36,133,88,44,83]))),GQ=S.lazy(()=>Pe(()=>import("./DepartmentEmailConfigurator-cyDyop9D.js"),__vite__mapDeps([135,122,118,131,31,44,36,82]))),KQ=S.lazy(()=>Pe(()=>import("./AdminActivityLogs-DGvVgi-5.js"),__vite__mapDeps([136,115,116,82,59]))),YQ=S.lazy(()=>Pe(()=>import("./AdminSystemSettings-CgWBT7SR.js"),__vite__mapDeps([8,1,2,9,5]))),QQ=S.lazy(()=>Pe(()=>import("./PortalPreview-BM_F7NKq.js"),__vite__mapDeps([137,12,62,4]))),JQ=S.lazy(()=>Pe(()=>import("./DonatePage-Dg7PV41d.js"),__vite__mapDeps([138,2,19,29,62,1,31,46,25,139]))),XQ=S.lazy(()=>Pe(()=>import("./DonationSuccessPage-C5qO1kYA.js"),__vite__mapDeps([140,1,67,23,19,139]))),ZQ=S.lazy(()=>Pe(()=>import("./DonationCancelPage-ftEEAgQB.js"),__vite__mapDeps([141,5,23,19,38]))),un=({children:t,requireAdmin:e=!1,allowedRoles:n=null,loginPath:r=""})=>{const[s,i]=S.useState(null),[a,c]=S.useState(!0),{member:u,loading:d}=Sx(),{user:f,loading:g}=kx(),{admin:y,isAuthenticated:x,loading:b}=Ix(),E=cr(),w=e||n?.some(D=>Ev.includes(D)),R=n?.includes(de.MEMBER),C=n?.some(D=>D===de.PROFESSIONAL||D===de.VOLUNTEER);if(S.useEffect(()=>{$e.auth.getSession().then(({data:{session:I}})=>{i(I?.user??null),c(!1)});const{data:{subscription:D}}=$e.auth.onAuthStateChange((I,B)=>{i(B?.user??null)});return()=>D.unsubscribe()},[]),w&&b||R&&d||C&&g||a&&!!!(y||u||f||x))return v.jsx("div",{className:"min-h-screen flex items-center justify-center",children:v.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})});if(!(s||u||f||x)){const D=r||(e||n?"/admin-login":"/login");return v.jsx(mr,{to:D,state:{from:E},replace:!0})}const $=Px(y?.role||f?.role||u?.role||s?.user_metadata?.role);return A$($,n)?e&&!(["admin","super_admin"].includes(y?.role)||["admin","super_admin"].includes(s?.user_metadata?.role))?v.jsx(mr,{to:"/member-dashboard"}):t:v.jsx(mr,{to:b$($,r||"/login"),state:{from:E,accessDenied:`Your ${$} account does not have access to ${E.pathname}.`},replace:!0})};function eJ(){const[t,e]=S.useState(null);return S.useEffect(()=>{const n="en,zh-CN,zh-TW,es,fr,de,it,pt,ru,ja,ko,ar,hi,th,vi";let r=null;window.__gt_inited=window.__gt_inited||!1;const s=()=>!!document.getElementById("google_translate_element"),i=()=>!!window.google?.translate?.TranslateElement&&s(),a=()=>{window.__gt_inited||i()&&(window.__gt_inited=!0,new window.google.translate.TranslateElement({pageLanguage:"en",includedLanguages:n,autoDisplay:!1},"google_translate_element"))},c=()=>
4571{if(!Ip())return;if(window.googleTranslateElementInit=()=>{a()},!document.querySelector('script[src*="translate.google.com/translate_a/element.js"]')){const g=document.createElement("script");g.src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit",g.async=!0,g.defer=!0,document.body.appendChild(g)}r&&clearInterval(r);let f=0;r=setInterval(()=>{f+=1,a(),(window.__gt_inited||f>=30)&&(clearInterval(r),r=null)},200)},u=d=>{d.detail?.level==="functional"&&c()};return c(),window.addEventListener(bv,u),()=>{r&&clearInterval(r),window.removeEventListener(bv,u)}},[]),S.useEffect(()=>{$e.auth.getSession().then(({data:{session:r}})=>{e(r?.user??null)});const{data:{subscription:n}}=$e.auth.onAuthStateChange((r,s)=>{e(s?.user??null)});return()=>n.unsubscribe()},[]),v.jsx(AL,{clientId:"495355954299-2sapfueu898vu564tjp82p0c6dkl2uqp.apps.googleusercontent.com",children:v.jsxs("div",{className:"flex flex-col min-h-screen",children:[v.jsx(yK,{}),v.jsx(gK,{}),v.jsx(FY,{}),v.jsx(S.Suspense,{fallback:v.jsx(XY,{}),children:v.jsxs(D3,{children:[v.jsx(we,{path:"/admin-login",element:v.jsx(FQ,{})}),v.jsx(we,{path:"/admin/dashboard",element:v.jsx(un,{allowedRoles:Ev,children:v.jsx(rr,{children:v.jsx(jQ,{})})})}),v.jsx(we,{path:"/admin/users",element:v.jsx(un,{allowedRoles:$l,children:v.jsx(rr,{children:v.jsx(MQ,{})})})}),v.jsx(we,{path:"/admin/portal-preview",element:v.jsx(un,{allowedRoles:$l,children:v.jsx(rr,{children:v.jsx(QQ,{})})})}),v.jsx(we,{path:"/admin/content",element:v.jsx(un,{allowedRoles:Gl,children:v.jsx(rr,{children:v.jsx(VQ,{})})})}),v.jsx(we,{path:"/admin/career-events",element:v.jsx(un,{allowedRoles:Gl,children:v.jsx(rr,{children:v.jsx(UQ,{})})})}),v.jsx(we,{path:"/admin/applications",element:v.jsx(un,{allowedRoles:Gl,children:v.jsx(rr,{children:v.jsx($Q,{})})})}),v.jsx(we,{path:"/admin/cards/:applicationId",element:v.jsx(un,{allowedRoles:Gl,children:v.jsx(rr,{children:v.jsx(wS,{})})})}),v.jsx(we,{path:"/admin/cards/:type/:applicationId",element:v.jsx(un,{allowedRoles:Gl,children:v.jsx(rr,{children:v.jsx(wS,{})})})}),v.jsx(we,{path:"/admin/internal-cards/:userId",element:v.jsx(un,{allowedRoles:$l,children:v.jsx(rr,{children:v.jsx(zQ,{})})})}),v.jsx(we,{path:"/admin/card-designer",element:v.jsx(un,{allowedRoles:$l,children:v.jsx(rr,{children:v.jsx(HQ,{})})})}),v.jsx(we,{path:"/admin/donations",element:v.jsx(un,{allowedRoles:fy,children:v.jsx(rr,{children:v.jsx(BQ,{})})})}),v.jsx(we,{path:"/admin/ai-call-center",element:v.jsx(un,{allowedRoles:fy,children:v.jsx(rr,{children:v.jsx(qQ,{})})})}),v.jsx(we,{path:"/admin/email-routing",element:v.jsx(un,{allowedRoles:_$,children:v.jsx(rr,{children:v.jsx(WQ,{})})})}),v.jsx(we,{path:"/admin/department-email-config",element:v.jsx(un,{allowedRoles:$l,children:v.jsx(rr,{children:v.jsx(GQ,{})})})}),v.jsx(we,{path:"/admin/logs",element:v.jsx(un,{allowedRoles:fy,children:v.jsx(rr,{children:v.jsx(KQ,{})})})}),v.jsx(we,{path:"/admin/settings",element:v.jsx(un,{allowedRoles:$l,children:v.jsx(rr,{children:v.jsx(YQ,{})})})}),v.jsx(we,{path:"/admin",element:v.jsx(mr,{to:"/admin/dashboard",replace:!0})}),v.jsx(we,{path:"/admin/*",element:v.jsx(mr,{to:"/admin/dashboard",replace:!0})}),v.jsx(we,{path:"/",element:v.jsx(qe,{user:t,children:v.jsx(vS,{})})}),v.jsx(we,{path:"/home",element:v.jsx(qe,{user:t,children:v.jsx(vS,{})})}),!1,!1,!1,v.jsx(we,{path:"/join-us",element:v.jsx(qe,{user:t,children:v.jsx(eQ,{})})}),v.jsx(we,{path:"/community-qa",element:v.jsx(qe,{user:t,children:v.jsx(tQ,{})})}),v.jsx(we,{path:"/legal-aid",element:v.jsx(qe,{user:t,children:v.jsx(nQ,{})})}),v.jsx(we,{path:"/personal-injury",element:v.jsx(qe,{user:t,children:v.jsx(EQ,{})})}),v.jsx(we,{path:"/workers-compensation",element:v.jsx(qe,{user:t,children:v.jsx(bQ,{})})}),v.jsx(we,{path:"/healthcare-navigation",element:v.jsx(qe,{user:t,children:v.jsx(AQ,{})})}),v.jsx(we,{path:"/mental-health-support",element:v.jsx(qe,{user:t,children:v.jsx(TQ,{})})}),v.jsx(we,{path:"/housing-support",element:v.jsx(qe,{user:t,children:v.jsx(CQ,{})})}),v.jsx(we,{path:"/training",element:v.jsx(qe,{user:t,children:v.jsx(rQ,{})})}),v.jsx(we,{path:"/training/schools",element:v.jsx(qe,{user:t,children:v.jsx(sQ,{})})}),v.jsx(we,{path:"/employment",element:v.jsx(qe,{user:t,children:v.jsx(iQ,{})})}),v.jsx(we,{path:"/career-events",element:v.jsx(qe,{user:t,children:v.jsx(oQ,{})})}),v.jsx(we,{path:"/career-events/:slug",element:v.jsx(qe,{user:t,children:v.jsx(aQ,{})})}),v.jsx(we,{path:"/insurance",element:v.jsx(qe,{user:t,children:v.jsx(lQ,{})})}),v.jsx(we,{path:"/about-us",element:v.jsx(qe,{user:t,children:v.jsx(uQ,{})})}),v.jsx(we,{path:"/leadership",element:v.jsx(qe,{user:t,children:v.jsx(hQ,{})})}),v.jsx(we,{path:"/digital-solutions",element:v.jsx(qe,{user:t,children:v.jsx(wQ,{})})}
4571),v.jsx(we,{path:"/transparency",element:v.jsx(qe,{user:t,children:v.jsx(dQ,{})})}),v.jsx(we,{path:"/accessibility-demo",element:v.jsx(qe,{user:t,children:v.jsx(fQ,{})})}),v.jsx(we,{path:"/sms-consent",element:v.jsx(qe,{user:t,children:v.jsx(pQ,{})})}),v.jsx(we,{path:"/app",element:v.jsx(qe,{user:t,children:v.jsx(mQ,{})})}),v.jsx(we,{path:"/app/trucktalk",element:v.jsx(qe,{user:t,children:v.jsx(_Q,{})})}),v.jsx(we,{path:"/app/nycdl",element:v.jsx(qe,{user:t,children:v.jsx(xQ,{})})}),v.jsx(we,{path:"/app-terms-privacy-policy",element:v.jsx(qe,{user:t,children:v.jsx(gQ,{})})}),v.jsx(we,{path:"/ny-cdl-app-termsofuse",element:v.jsx(qe,{user:t,children:v.jsx(yQ,{})})}),v.jsx(we,{path:"/trucktalkpro-app-terms-of-use",element:v.jsx(qe,{user:t,children:v.jsx(vQ,{})})}),v.jsx(we,{path:"/research/logistics",element:v.jsx(qe,{user:t,children:v.jsx(SQ,{})})}),v.jsx(we,{path:"/research/legal-frameworks",element:v.jsx(qe,{user:t,children:v.jsx(kQ,{})})}),v.jsx(we,{path:"/research/housing-stability",element:v.jsx(qe,{user:t,children:v.jsx(PQ,{})})}),v.jsx(we,{path:"/youth-safety",element:v.jsx(qe,{user:t,children:v.jsx(IQ,{})})}),v.jsx(we,{path:"/terms",element:v.jsx(qe,{user:t,children:v.jsx(_S,{})})}),v.jsx(we,{path:"/terms-of-use",element:v.jsx(qe,{user:t,children:v.jsx(_S,{})})}),v.jsx(we,{path:"/privacy",element:v.jsx(qe,{user:t,children:v.jsx(xS,{})})}),v.jsx(we,{path:"/privacy-policy",element:v.jsx(qe,{user:t,children:v.jsx(xS,{})})}),v.jsx(we,{path:"/cookie-policy",element:v.jsx(qe,{user:t,children:v.jsx(RQ,{})})}),v.jsx(we,{path:"/contact",element:v.jsx(qe,{user:t,children:v.jsx(cQ,{})})}),v.jsx(we,{path:"/contactus",element:v.jsx(mr,{to:"/contact",replace:!0})}),v.jsx(we,{path:"/apps",element:v.jsx(mr,{to:"/app",replace:!0})}),v.jsx(we,{path:"/login",element:v.jsx(qe,{user:t,children:v.jsx(DQ,{})})}),v.jsx(we,{path:"/register",element:v.jsx(mr,{to:"/join-us?apply=member",replace:!0})}),v.jsx(we,{path:"/member-register",element:v.jsx(mr,{to:"/join-us?apply=member",replace:!0})}),v.jsx(we,{path:"/member/login",element:v.jsx(mr,{to:"/login",replace:!0})}),v.jsx(we,{path:"/member/register",element:v.jsx(mr,{to:"/join-us?apply=member",replace:!0})}),v.jsx(we,{path:"/membership",element:v.jsx(mr,{to:"/join-us?apply=member",replace:!0})}),v.jsx(we,{path:"/staff-admin-login",element:v.jsx(mr,{to:"/admin-login",replace:!0})}),!1,v.jsx(we,{path:"/member-dashboard",element:v.jsx(un,{allowedRoles:[de.MEMBER],loginPath:"/login",children:v.jsx(qe,{user:t,children:v.jsx(NQ,{})})})}),v.jsx(we,{path:"/volunteer-dashboard",element:v.jsx(un,{allowedRoles:[de.VOLUNTEER],loginPath:"/login",children:v.jsx(qe,{user:t,children:v.jsx(OQ,{})})})}),v.jsx(we,{path:"/dashboard",element:v.jsx(un,{allowedRoles:[de.PROFESSIONAL],loginPath:"/login",children:v.jsx(qe,{user:t,children:v.jsx(LQ,{})})})}),v.jsx(we,{path:"/staff/dashboard",element:v.jsx(un,{allowedRoles:Ev,children:v.jsx(mr,{to:"/admin/dashboard",replace:!0})})}),v.jsx(we,{path:"/donate",element:v.jsx(qe,{user:t,children:v.jsx(ZY,{})})}),v.jsx(we,{path:"/donate/stripe",element:v.jsx(qe,{user:t,children:v.jsx(JQ,{})})}),v.jsx(we,{path:"/donate/success",element:v.jsx(qe,{user:t,children:v.jsx(XQ,{})})}),v.jsx(we,{path:"/donate/cancel",element:v.jsx(qe,{user:t,children:v.jsx(ZQ,{})})}),v.jsx(we,{path:"*",element:v.jsx(mr,{to:"/",replace:!0})})]})})]})})}function Wr(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t?.(s),n===!1||!s.defaultPrevented)return e?.(s)}}function UX(t,e){const n=S.createContext(e),r=i=>{const{children:a,...c}=i,u=S.useMemo(()=>c,Object.values(c));return v.jsx(n.Provider,{value:u,children:a})};r.displayName=t+"Provider";function s(i){const a=S.useContext(n);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[r,s]}function VD(t,e=[]){let n=[];function r(i,a){const c=S.createContext(a),u=n.length;n=[...n,a];const d=g=>{const{scope:y,children:x,...b}=g,E=y?.[t]?.[u]||c,w=S.useMemo(()=>b,Object.values(b));return v.jsx(E.Provider,{value:w,children:x})};d.displayName=i+"Provider";function f(g,y){const x=y?.[t]?.[u]||c,b=S.useContext(x);if(b)return b;if(a!==void 0)return a;throw new Error(`\`${g}\` must be used within \`${i}\``)}return[d,f]}const s=()=>{const i=n.map(a=>S.createContext(a));return function(c){const u=c?.[t]||i;return S.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return s.scopeName=t,[r,tJ(s,...e)]}function tJ(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.reduce((c,{useScope:u,scopeName:d})=>{const g=u(i)[`__scope${d}`];return{...c,...g}},{});return S.useMemo(()=>({[`__scope${e.scopeName}`]:a}
4571),[a])}};return n.scopeName=e.scopeName,n}function ES(t){const e=nJ(t),n=S.forwardRef((r,s)=>{const{children:i,...a}=r,c=S.Children.toArray(i),u=c.find(sJ);if(u){const d=u.props.children,f=c.map(g=>g===u?S.Children.count(d)>1?S.Children.only(null):S.isValidElement(d)?d.props.children:null:g);return v.jsx(e,{...a,ref:s,children:S.isValidElement(d)?S.cloneElement(d,void 0,f):null})}return v.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function nJ(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const a=oJ(s),c=iJ(i,s.props);return s.type!==S.Fragment&&(c.ref=r?s0(r,a):a),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var rJ=Symbol("radix.slottable");function sJ(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===rJ}function iJ(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const u=i(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function oJ(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function aJ(t){const e=t+"CollectionProvider",[n,r]=VD(e),[s,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=E=>{const{scope:w,children:R}=E,C=Wn.useRef(null),k=Wn.useRef(new Map).current;return v.jsx(s,{scope:w,itemMap:k,collectionRef:C,children:R})};a.displayName=e;const c=t+"CollectionSlot",u=ES(c),d=Wn.forwardRef((E,w)=>{const{scope:R,children:C}=E,k=i(c,R),N=Wa(w,k.collectionRef);return v.jsx(u,{ref:N,children:C})});d.displayName=c;const f=t+"CollectionItemSlot",g="data-radix-collection-item",y=ES(f),x=Wn.forwardRef((E,w)=>{const{scope:R,children:C,...k}=E,N=Wn.useRef(null),V=Wa(w,N),$=i(f,R);return Wn.useEffect(()=>($.itemMap.set(N,{ref:N,...k}),()=>void $.itemMap.delete(N))),v.jsx(y,{[g]:"",ref:V,children:C})});x.displayName=f;function b(E){const w=i(t+"CollectionConsumer",E);return Wn.useCallback(()=>{const C=w.collectionRef.current;if(!C)return[];const k=Array.from(C.querySelectorAll(`[${g}]`));return Array.from(w.itemMap.values()).sort(($,D)=>k.indexOf($.ref.current)-k.indexOf(D.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:a,Slot:d,ItemSlot:x},b,r]}function lJ(t){const e=cJ(t),n=S.forwardRef((r,s)=>{const{children:i,...a}=r,c=S.Children.toArray(i),u=c.find(dJ);if(u){const d=u.props.children,f=c.map(g=>g===u?S.Children.count(d)>1?S.Children.only(null):S.isValidElement(d)?d.props.children:null:g);return v.jsx(e,{...a,ref:s,children:S.isValidElement(d)?S.cloneElement(d,void 0,f):null})}return v.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function cJ(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const a=fJ(s),c=hJ(i,s.props);return s.type!==S.Fragment&&(c.ref=r?s0(r,a):a),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var uJ=Symbol("radix.slottable");function dJ(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===uJ}function hJ(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const u=i(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function fJ(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var pJ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],di=pJ.reduce((t,e)=>{const n=lJ(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:a,...c}=s,u=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function UD(t,e){t&&o_.flushSync(()=>t.dispatchEvent(e))}function Ka(t){const e=S.useRef(t);return S.useEffect(()=>{e.current=t}),S.useMemo(()=>(...n)=>e.current?.(...n),[])}function mJ(t,e=globalThis?.document){const n=Ka(t);S.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var gJ="DismissableLayer",qv="dismissableLayer.update",yJ="dismissableLayer.pointerDownOutside",vJ="dismissableLayer.focusOutside",bS,$D=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zD=S.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:a,onDismiss:c,...u}=t,d=S.useContext($D),[f,g]=S.useState(null),y=f?.ownerDocument??globalThis?.document,[,x]=S.useState({}),b=Wa(e,D=>
4571g(D)),E=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),R=E.indexOf(w),C=f?E.indexOf(f):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,N=C>=R,V=xJ(D=>{const I=D.target,B=[...d.branches].some(O=>O.contains(I));!N||B||(s?.(D),a?.(D),D.defaultPrevented||c?.())},y),$=wJ(D=>{const I=D.target;[...d.branches].some(O=>O.contains(I))||(i?.(D),a?.(D),D.defaultPrevented||c?.())},y);return mJ(D=>{C===d.layers.size-1&&(r?.(D),!D.defaultPrevented&&c&&(D.preventDefault(),c()))},y),S.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(bS=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),AS(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=bS)}},[f,y,n,d]),S.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),AS())},[f,d]),S.useEffect(()=>{const D=()=>x({});return document.addEventListener(qv,D),()=>document.removeEventListener(qv,D)},[]),v.jsx(di.div,{...u,ref:b,style:{pointerEvents:k?N?"auto":"none":void 0,...t.style},onFocusCapture:Wr(t.onFocusCapture,$.onFocusCapture),onBlurCapture:Wr(t.onBlurCapture,$.onBlurCapture),onPointerDownCapture:Wr(t.onPointerDownCapture,V.onPointerDownCapture)})});zD.displayName=gJ;var _J="DismissableLayerBranch",HD=S.forwardRef((t,e)=>{const n=S.useContext($D),r=S.useRef(null),s=Wa(e,r);return S.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),v.jsx(di.div,{...t,ref:s})});HD.displayName=_J;function xJ(t,e=globalThis?.document){const n=Ka(t),r=S.useRef(!1),s=S.useRef(()=>{});return S.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){qD(yJ,n,d,{discrete:!0})};const d={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=u,e.addEventListener("click",s.current,{once:!0})):u()}else e.removeEventListener("click",s.current);r.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function wJ(t,e=globalThis?.document){const n=Ka(t),r=S.useRef(!1);return S.useEffect(()=>{const s=i=>{i.target&&!r.current&&qD(vJ,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function AS(){const t=new CustomEvent(qv);document.dispatchEvent(t)}function qD(t,e,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?UD(s,i):s.dispatchEvent(i)}var EJ=zD,bJ=HD,Cd=globalThis?.document?S.useLayoutEffect:()=>{},AJ="Portal",WD=S.forwardRef((t,e)=>{const{container:n,...r}=t,[s,i]=S.useState(!1);Cd(()=>i(!0),[]);const a=n||s&&globalThis?.document?.body;return a?fO.createPortal(v.jsx(di.div,{...r,ref:e}),a):null});WD.displayName=AJ;function TJ(t,e){return S.useReducer((n,r)=>e[n][r]??n,t)}var GD=t=>{const{present:e,children:n}=t,r=CJ(e),s=typeof n=="function"?n({present:r.isPresent}):S.Children.only(n),i=Wa(r.ref,SJ(s));return typeof n=="function"||r.isPresent?S.cloneElement(s,{ref:i}):null};GD.displayName="Presence";function CJ(t){const[e,n]=S.useState(),r=S.useRef(null),s=S.useRef(t),i=S.useRef("none"),a=t?"mounted":"unmounted",[c,u]=TJ(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{const d=Df(r.current);i.current=c==="mounted"?d:"none"},[c]),Cd(()=>{const d=r.current,f=s.current;if(f!==t){const y=i.current,x=Df(d);t?u("MOUNT"):x==="none"||d?.display==="none"?u("UNMOUNT"):u(f&&y!==x?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,u]),Cd(()=>{if(e){let d;const f=e.ownerDocument.defaultView??window,g=x=>{const E=Df(r.current).includes(CSS.escape(x.animationName));if(x.target===e&&E&&(u("ANIMATION_END"),!s.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",d=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},y=x=>{x.target===e&&(i.current=Df(r.current))};return e.addEventListener("animationstart",y),e.addEventListener("animationcancel",g),e.addEventListener("animationend",g),()=>{f.clearTimeout(d),e.removeEventListener("animationstart",y),e.removeEventListener("animationcancel",g),e.removeEventListener("animationend",g)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:S.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function Df(t){return t?.animationName||"none"}function SJ(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.
4571isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var kJ=kS[" useInsertionEffect ".trim().toString()]||Cd;function IJ({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[s,i,a]=PJ({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:s;{const f=S.useRef(t!==void 0);S.useEffect(()=>{const g=f.current;if(g!==c){const y=g?"controlled":"uncontrolled",x=c?"controlled":"uncontrolled"}f.current=c},[c,r])}const d=S.useCallback(f=>{if(c){const g=RJ(f)?f(t):f;g!==t&&a.current?.(g)}else i(f)},[c,t,i,a]);return[u,d]}function PJ({defaultProp:t,onChange:e}){const[n,r]=S.useState(t),s=S.useRef(n),i=S.useRef(e);return kJ(()=>{i.current=e},[e]),S.useEffect(()=>{s.current!==n&&(i.current?.(n),s.current=n)},[n,s]),[n,r,i]}function RJ(t){return typeof t=="function"}var DJ=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),NJ="VisuallyHidden",fw=S.forwardRef((t,e)=>v.jsx(di.span,{...t,ref:e,style:{...DJ,...t.style}}));fw.displayName=NJ;var KD="ToastProvider",[pw,OJ,LJ]=aJ("Toast"),[YD]=VD("Toast",[LJ]),[FJ,l0]=YD(KD),QD=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=t,[c,u]=S.useState(null),[d,f]=S.useState(0),g=S.useRef(!1),y=S.useRef(!1);return n.trim(),v.jsx(pw.Provider,{scope:e,children:v.jsx(FJ,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:d,viewport:c,onViewportChange:u,onToastAdd:S.useCallback(()=>f(x=>x+1),[]),onToastRemove:S.useCallback(()=>f(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:g,isClosePausedRef:y,children:a})})};QD.displayName=KD;var JD="ToastViewport",jJ=["F8"],Wv="toast.viewportPause",Gv="toast.viewportResume",XD=S.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=jJ,label:s="Notifications ({hotkey})",...i}=t,a=l0(JD,n),c=OJ(n),u=S.useRef(null),d=S.useRef(null),f=S.useRef(null),g=S.useRef(null),y=Wa(e,g,a.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=a.toastCount>0;S.useEffect(()=>{const w=R=>{r.length!==0&&r.every(k=>R[k]||R.code===k)&&g.current?.focus()};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[r]),S.useEffect(()=>{const w=u.current,R=g.current;if(b&&w&&R){const C=()=>{if(!a.isClosePausedRef.current){const $=new CustomEvent(Wv);R.dispatchEvent($),a.isClosePausedRef.current=!0}},k=()=>{if(a.isClosePausedRef.current){const $=new CustomEvent(Gv);R.dispatchEvent($),a.isClosePausedRef.current=!1}},N=$=>{!w.contains($.relatedTarget)&&k()},V=()=>{w.contains(document.activeElement)||k()};return w.addEventListener("focusin",C),w.addEventListener("focusout",N),w.addEventListener("pointermove",C),w.addEventListener("pointerleave",V),window.addEventListener("blur",C),window.addEventListener("focus",k),()=>{w.removeEventListener("focusin",C),w.removeEventListener("focusout",N),w.removeEventListener("pointermove",C),w.removeEventListener("pointerleave",V),window.removeEventListener("blur",C),window.removeEventListener("focus",k)}}},[b,a.isClosePausedRef]);const E=S.useCallback(({tabbingDirection:w})=>{const C=c().map(k=>{const N=k.ref.current,V=[N,...JJ(N)];return w==="forwards"?V:V.reverse()});return(w==="forwards"?C.reverse():C).flat()},[c]);return S.useEffect(()=>{const w=g.current;if(w){const R=C=>{const k=C.altKey||C.ctrlKey||C.metaKey;if(C.key==="Tab"&&!k){const V=document.activeElement,$=C.shiftKey;if(C.target===w&&$){d.current?.focus();return}const B=E({tabbingDirection:$?"backwards":"forwards"}),O=B.findIndex(F=>F===V);Fy(B.slice(O+1))?C.preventDefault():$?d.current?.focus():f.current?.focus()}};return w.addEventListener("keydown",R),()=>w.removeEventListener("keydown",R)}},[c,E]),v.jsxs(bJ,{ref:u,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&v.jsx(Kv,{ref:d,onFocusFromOutsideViewport:()=>{const w=E({tabbingDirection:"forwards"});Fy(w)}}),v.jsx(pw.Slot,{scope:n,children:v.jsx(di.ol,{tabIndex:-1,...i,ref:y})}),b&&v.jsx(Kv,{ref:f,onFocusFromOutsideViewport:()=>{const w=E({tabbingDirection:"backwards"});Fy(w)}})]})});XD.displayName=JD;var ZD="ToastFocusProxy",Kv=S.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=l0(ZD,n);return v.jsx(fw,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{const c=a.relatedTarget;!i.viewport?.contains(c)&&r()}})});Kv.displayName=ZD;var Kd="Toast",MJ="toast.swipeStart",BJ="toast.swipeMove",VJ="toast.swipeCancel",UJ="toast.swipeEnd",e4=S.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...a}=t,[c,u]=IJ({prop:r,defaultProp:s??!0,onChange:i,caller:Kd});return v.jsx(GD,{present:n||c,children:v.jsx(HJ,{open:c,...a,ref:e,onClose:()=>u(!1),onPause:Ka(t.onPause),onResume:Ka(t.onResume),onSwipeStart:Wr(t.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Wr(t.onSwipeMove,d=>{const{x:f,y:g}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${g}px`)}),onSwipeCancel:Wr(t.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Wr(t.onSwipeEnd,d=>{const{x:f,y:g}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${g}px`),u(!1)})})})});e4.displayName=Kd;var[$J,zJ]=YD(Kd,{onClose(){}}),HJ=S.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:c,onPause:u,onResume:d,onSwipeStart:f,onSwipeMove:g,onSwipeCancel:y,onSwipeEnd:x,...b}=t,E=l0(Kd,n),[w,R]=S.useState(null),C=Wa(e,se=>R(se)),k=S.useRef(null),N=S.useRef(null),V=s||E.duration,$=S.useRef(0),D=S.useRef(V),I=S.useRef(0),{onToastAdd:B,onToastRemove:O}=E,F=Ka(()=>{w?.contains(document.activeElement)&&E.viewport?.focus(),a()}),L=S.useCallback(se=>
4571{!se||se===1/0||(window.clearTimeout(I.current),$.current=new Date().getTime(),I.current=window.setTimeout(F,se))},[F]);S.useEffect(()=>{const se=E.viewport;if(se){const H=()=>{L(D.current),d?.()},J=()=>{const le=new Date().getTime()-$.current;D.current=D.current-le,window.clearTimeout(I.current),u?.()};return se.addEventListener(Wv,J),se.addEventListener(Gv,H),()=>{se.removeEventListener(Wv,J),se.removeEventListener(Gv,H)}}},[E.viewport,V,u,d,L]),S.useEffect(()=>{i&&!E.isClosePausedRef.current&&L(V)},[i,V,E.isClosePausedRef,L]),S.useEffect(()=>(B(),()=>O()),[B,O]);const M=S.useMemo(()=>w?o4(w):null,[w]);return E.viewport?v.jsxs(v.Fragment,{children:[M&&v.jsx(qJ,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:M}),v.jsx($J,{scope:n,onClose:F,children:o_.createPortal(v.jsx(pw.ItemSlot,{scope:n,children:v.jsx(EJ,{asChild:!0,onEscapeKeyDown:Wr(c,()=>{E.isFocusedToastEscapeKeyDownRef.current||F(),E.isFocusedToastEscapeKeyDownRef.current=!1}),children:v.jsx(di.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":E.swipeDirection,...b,ref:C,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Wr(t.onKeyDown,se=>{se.key==="Escape"&&(c?.(se.nativeEvent),se.nativeEvent.defaultPrevented||(E.isFocusedToastEscapeKeyDownRef.current=!0,F()))}),onPointerDown:Wr(t.onPointerDown,se=>{se.button===0&&(k.current={x:se.clientX,y:se.clientY})}),onPointerMove:Wr(t.onPointerMove,se=>{if(!k.current)return;const H=se.clientX-k.current.x,J=se.clientY-k.current.y,le=!!N.current,K=["left","right"].includes(E.swipeDirection),re=["left","up"].includes(E.swipeDirection)?Math.min:Math.max,ee=K?re(0,H):0,U=K?0:re(0,J),W=se.pointerType==="touch"?10:2,te={x:ee,y:U},Q={originalEvent:se,delta:te};le?(N.current=te,Nf(BJ,g,Q,{discrete:!1})):TS(te,E.swipeDirection,W)?(N.current=te,Nf(MJ,f,Q,{discrete:!1}),se.target.setPointerCapture(se.pointerId)):(Math.abs(H)>W||Math.abs(J)>W)&&(k.current=null)}),onPointerUp:Wr(t.onPointerUp,se=>{const H=N.current,J=se.target;if(J.hasPointerCapture(se.pointerId)&&J.releasePointerCapture(se.pointerId),N.current=null,k.current=null,H){const le=se.currentTarget,K={originalEvent:se,delta:H};TS(H,E.swipeDirection,E.swipeThreshold)?Nf(UJ,x,K,{discrete:!0}):Nf(VJ,y,K,{discrete:!0}),le.addEventListener("click",re=>re.preventDefault(),{once:!0})}})})})}),E.viewport)})]}):null}),qJ=t=>{const{__scopeToast:e,children:n,...r}=t,s=l0(Kd,e),[i,a]=S.useState(!1),[c,u]=S.useState(!1);return YJ(()=>a(!0)),S.useEffect(()=>{const d=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(d)},[]),c?null:v.jsx(WD,{asChild:!0,children:v.jsx(fw,{...r,children:i&&v.jsxs(v.Fragment,{children:[s.label," ",n]})})})},WJ="ToastTitle",t4=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return v.jsx(di.div,{...r,ref:e})});t4.displayName=WJ;var GJ="ToastDescription",n4=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return v.jsx(di.div,{...r,ref:e})});n4.displayName=GJ;var KJ="ToastAction",r4=S.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?v.jsx(i4,{altText:n,asChild:!0,children:v.jsx(mw,{...r,ref:e})}):null});r4.displayName=KJ;var s4="ToastClose",mw=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=zJ(s4,n);return v.jsx(i4,{asChild:!0,children:v.jsx(di.button,{type:"button",...r,ref:e,onClick:Wr(t.onClick,s.onClose)})})});mw.displayName=s4;var i4=S.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return v.jsx(di.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function o4(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),QJ(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const a=r.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...o4(r))}}),e}function Nf(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?UD(s,i):s.dispatchEvent(i)}var TS=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function YJ(t=()=>{}){const e=Ka(t);Cd(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function QJ(t){return t.nodeType===t.ELEMENT_NODE}function JJ(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Fy(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var XJ=QD,a4=XD,l4=e4,c4=t4,u4=n4,d4=r4,h4=mw;const ZJ=XJ,f4=Wn.forwardRef(({className:t,...e},n)=>v.jsx(a4,{ref:n,className:Et("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));f4.displayName=a4.displayName;const eX=mD("data-[swipe=move]:transition-none group relative pointer-events-auto flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full data-[state=closed]:slide-out-to-right-full",{variants:{variant:{default:"bg-background border",destructive:"group destructive border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),p4=Wn.forwardRef(({className:t,variant:e,...n},r)=>v.jsx(l4,{ref:r,className:Et(eX({variant:e}),t),...n}));p4.displayName=l4.displayName;const tX=Wn.forwardRef(({className:t,...e},n)=>v.jsx(d4,{ref:n,className:Et("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-destructive/30 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));tX.displayName=d4.displayName;const m4=Wn.forwardRef(({className:t,...e},n)=>v.jsx(h4,{ref:n,className:Et("absolute right-2 top-2 rounded-md p-1 text-foreground
4571/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:v.jsx(jc,{className:"h-4 w-4"})}));m4.displayName=h4.displayName;const g4=Wn.forwardRef(({className:t,...e},n)=>v.jsx(c4,{ref:n,className:Et("text-sm font-semibold",t),...e}));g4.displayName=c4.displayName;const y4=Wn.forwardRef(({className:t,...e},n)=>v.jsx(u4,{ref:n,className:Et("text-sm opacity-90",t),...e}));y4.displayName=u4.displayName;function nX(){const{toasts:t}=r0();return v.jsxs(ZJ,{children:[t.map(({id:e,title:n,description:r,action:s,...i})=>v.jsxs(p4,{...i,children:[v.jsxs("div",{className:"grid gap-1",children:[n&&v.jsx(g4,{children:n}),r&&v.jsx(y4,{children:r})]}),s,v.jsx(m4,{})]},e)),v.jsx(f4,{})]})}const rX=()=>(S.useEffect(()=>{if(!$e)return;let t=!1,e,n=Promise.resolve();const r=i=>{const a=i?.access_token||null;a!==e&&(e=a,n=n.then(async()=>{t||await m$(i)}).catch(async c=>{t||await Qm()}))};$e.auth.getSession().then(({data:i,error:a})=>{if(!t){if(a){r(null);return}r(i.session)}});const{data:{subscription:s}}=$e.auth.onAuthStateChange((i,a)=>r(a));return()=>{t=!0,s.unsubscribe()}},[]),null),sX=window.location.hostname==="localhost"&&window.location.port==="5173",Yd=!sX,iX=()=>{if(Yd){const t={...console};console.log=()=>{},console.warn=()=>{},console.error=()=>{},console.info=()=>{},console.debug=()=>{},console.table=()=>{},console.trace=()=>{},window.__restoreConsole=()=>{Object.assign(console,t)}}},oX=()=>{Yd&&document.addEventListener("contextmenu",t=>{t.preventDefault()})},aX=()=>{Yd&&document.addEventListener("keydown",t=>{if(t.key==="F12"||t.ctrlKey&&t.shiftKey&&t.key==="I"||t.ctrlKey&&t.shiftKey&&t.key==="J"||t.ctrlKey&&t.key==="u"||t.ctrlKey&&t.shiftKey&&t.key==="C"||t.metaKey&&t.altKey&&t.key==="i"||t.metaKey&&t.altKey&&t.key==="j"||t.metaKey&&t.altKey&&t.key==="c")return t.preventDefault(),!1})},lX=()=>{Yd&&(document.querySelectorAll("[data-api-key], [data-secret], [data-token]").forEach(t=>{t.removeAttribute("data-api-key"),t.removeAttribute("data-secret"),t.removeAttribute("data-token")}),document.querySelectorAll(".debug, .dev-only").forEach(t=>{t.remove()}))},cX=()=>{iX(),oX(),aX(),lX()};cX();window.__PDA_BUILD__="20260215-1700";const uX=DN.createRoot(document.getElementById("root"));uX.render(v.jsx(v.Fragment,{children:v.jsx(rO,{children:v.jsx(y$,{children:v.jsx(g$,{children:v.jsxs(v$,{children:[v.jsx(rX,{}),v.jsx(eJ,{}),v.jsx(nX,{})]})})})})}));export{GY as $,Qr as A,ac as B,WY as C,qY as D,Mt as E,VY as F,aK as G,oK as H,di as I,Wa as J,Wr as K,Oi as L,iK as M,GD as N,VD as O,sK as P,Et as Q,Wn as R,UY as S,BY as T,MY as U,Iz as V,yD as W,jc as X,vK as Y,KY as Z,cK as _,vD as a,IX as a$,Cd as a0,VG as a1,mD as a2,kS as a3,aJ as a4,Ka as a5,_K as a6,LX as a7,gK as a8,PP as a9,x$ as aA,YY as aB,o_ as aC,s0 as aD,$E as aE,pX as aF,mX as aG,WD as aH,UD as aI,zD as aJ,UX as aK,Yv as aL,$Y as aM,DJ as aN,w_ as aO,MX as aP,fX as aQ,jX as aR,BX as aS,CX as aT,fP as aU,Ex as aV,yP as aW,gP as aX,bx as aY,EI as aZ,PX as a_,C$ as aa,T$ as ab,bv as ac,kx as ad,AL as ae,bX as af,m$ as ag,Px as ah,b$ as ai,g9 as aj,ci as ak,ui as al,lt as am,DX as an,NX as ao,JY as ap,Vv as aq,Ax as ar,SX as as,E_ as at,yx as au,TX as av,_P as aw,Ix as ax,Ev as ay,de as az,r0 as b,Q_ as b0,RX as b1,Mi as b2,o0 as b3,wD as b4,FX as b5,Pe as b6,xD as b7,Uv as b8,VX as b9,Ke as c,id as d,xP as e,gD as f,Sx as g,cS as h,lK as i,v as j,wx as k,Ny as l,Vt as m,cr as n,Da as o,i0 as p,zY as q,S as r,$e as s,Rn as t,Ac as u,xK as v,hX as w,_Y as x,vY as y,IJ as z};

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