var qU=Object.defineProperty;var KU=(_e,ve,Ce)=>ve in _e?qU(_e,ve,{enumerable:!0,configurable:!0,writable:!0,value:Ce}):_e[ve]=Ce;var Zn=(_e,ve,Ce)=>(KU(_e,typeof ve!="symbol"?ve+"":ve,Ce),Ce),b0=(_e,ve,Ce)=>{if(!ve.has(_e))throw TypeError("Cannot "+Ce)};var x=(_e,ve,Ce)=>(b0(_e,ve,"read from private field"),Ce?Ce.call(_e):ve.get(_e)),Q=(_e,ve,Ce)=>{if(ve.has(_e))throw TypeError("Cannot add the same private member more than once");ve instanceof WeakSet?ve.add(_e):ve.set(_e,Ce)},B=(_e,ve,Ce,er)=>(b0(_e,ve,"write to private field"),er?er.call(_e,Ce):ve.set(_e,Ce),Ce);var Ud=(_e,ve,Ce,er)=>({set _(Iu){B(_e,ve,Iu,Ce)},get _(){return x(_e,ve,er)}}),oe=(_e,ve,Ce)=>(b0(_e,ve,"access private method"),Ce);(function(){"use strict";var ds,mi,Uo,iC,$o,vi,jo,sC,fs,oC,zo,Bo,un,xt,hu,ps,Tn,Tr,aC,Qn,lC,qn,Rt,gs,Kn,Ai,uC,Ir,Cn,du,cC,De,yi,_i,Ho,Go,wi,Wo,Qo,hC,Ft,ce,fu,kt,ms,qo,Ei,Yn,pu,Ko,Yo,vs,ys,xi,Xo,_s,Su,gu,R0,mu,k0,vu,P0,yu,N0,_u,O0,wu,D0,Eu,M0,Fd,gC,dC,Si,Ii,Ut,Ar,Jo,$d,xu,L0,fC;function _e(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function ve(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ce={exports:{}},er={},Iu={exports:{}},ae={};/**
 * @license React
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ea=Symbol.for("react.element"),mC=Symbol.for("react.portal"),vC=Symbol.for("react.fragment"),yC=Symbol.for("react.strict_mode"),_C=Symbol.for("react.profiler"),wC=Symbol.for("react.provider"),EC=Symbol.for("react.context"),xC=Symbol.for("react.forward_ref"),SC=Symbol.for("react.suspense"),IC=Symbol.for("react.memo"),AC=Symbol.for("react.lazy"),V0=Symbol.iterator;function TC(t){return t===null||typeof t!="object"?null:(t=V0&&t[V0]||t["@@iterator"],typeof t=="function"?t:null)}var F0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},U0=Object.assign,$0={};function xs(t,e,n){this.props=t,this.context=e,this.refs=$0,this.updater=n||F0}xs.prototype.isReactComponent={},xs.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")},xs.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function j0(){}j0.prototype=xs.prototype;function jd(t,e,n){this.props=t,this.context=e,this.refs=$0,this.updater=n||F0}var zd=jd.prototype=new j0;zd.constructor=jd,U0(zd,xs.prototype),zd.isPureReactComponent=!0;var z0=Array.isArray,B0=Object.prototype.hasOwnProperty,Bd={current:null},H0={key:!0,ref:!0,__self:!0,__source:!0};function G0(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)B0.call(e,r)&&!H0.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),u=0;u<a;u++)l[u]=arguments[u+2];i.children=l}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:ea,type:t,key:s,ref:o,props:i,_owner:Bd.current}}function CC(t,e){return{$$typeof:ea,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Hd(t){return typeof t=="object"&&t!==null&&t.$$typeof===ea}function bC(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var W0=/\/+/g;function Gd(t,e){return typeof t=="object"&&t!==null&&t.key!=null?bC(""+t.key):e.toString(36)}function Au(t,e,n,r,i){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case ea:case mC:o=!0}}if(o)return o=t,i=i(o),t=r===""?"."+Gd(o,0):r,z0(i)?(n="",t!=null&&(n=t.replace(W0,"$&/")+"/"),Au(i,e,n,"",function(u){return u})):i!=null&&(Hd(i)&&(i=CC(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(W0,"$&/")+"/")+t)),e.push(i)),1;if(o=0,r=r===""?".":r+":",z0(t))for(var a=0;a<t.length;a++){s=t[a];var l=r+Gd(s,a);o+=Au(s,e,n,l,i)}else if(l=TC(t),typeof l=="function")for(t=l.call(t),a=0;!(s=t.next()).done;)s=s.value,l=r+Gd(s,a++),o+=Au(s,e,n,l,i);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Tu(t,e,n){if(t==null)return t;var r=[],i=0;return Au(t,r,"","",function(s){return e.call(n,s,i++)}),r}function RC(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var St={current:null},Cu={transition:null},kC={ReactCurrentDispatcher:St,ReactCurrentBatchConfig:Cu,ReactCurrentOwner:Bd};ae.Children={map:Tu,forEach:function(t,e,n){Tu(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Tu(t,function(){e++}),e},toArray:function(t){return Tu(t,function(e){return e})||[]},only:function(t){if(!Hd(t))throw Error("React.Children.only expected to receive a single React element child.");return t}},ae.Component=xs,ae.Fragment=vC,ae.Profiler=_C,ae.PureComponent=jd,ae.StrictMode=yC,ae.Suspense=SC,ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=kC,ae.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=U0({},t.props),i=t.key,s=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=Bd.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)B0.call(e,l)&&!H0.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var u=0;u<l;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:ea,type:t.type,key:i,ref:s,props:r,_owner:o}},ae.createContext=function(t){return t={$$typeof:EC,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:wC,_context:t},t.Consumer=t},ae.createElement=G0,ae.createFactory=function(t){var e=G0.bind(null,t);return e.type=t,e},ae.createRef=function(){return{current:null}},ae.forwardRef=function(t){return{$$typeof:xC,render:t}},ae.isValidElement=Hd,ae.lazy=function(t){return{$$typeof:AC,_payload:{_status:-1,_result:t},_init:RC}},ae.memo=function(t,e){return{$$typeof:IC,type:t,compare:e===void 0?null:e}},ae.startTransition=function(t){var e=Cu.transition;Cu.transition={};try{t()}finally{Cu.transition=e}},ae.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},ae.useCallback=function(t,e){return St.current.useCallback(t,e)},ae.useContext=function(t){return St.current.useContext(t)},ae.useDebugValue=function(){},ae.useDeferredValue=function(t){return St.current.useDeferredValue(t)},ae.useEffect=function(t,e){return St.current.useEffect(t,e)},ae.useId=function(){return St.current.useId()},ae.useImperativeHandle=function(t,e,n){return St.current.useImperativeHandle(t,e,n)},ae.useInsertionEffect=function(t,e){return St.current.useInsertionEffect(t,e)},ae.useLayoutEffect=function(t,e){return St.current.useLayoutEffect(t,e)},ae.useMemo=function(t,e){return St.current.useMemo(t,e)},ae.useReducer=function(t,e,n){return St.current.useReducer(t,e,n)},ae.useRef=function(t){return St.current.useRef(t)},ae.useState=function(t){return St.current.useState(t)},ae.useSyncExternalStore=function(t,e,n){return St.current.useSyncExternalStore(t,e,n)},ae.useTransition=function(){return St.current.useTransition()},ae.version="18.2.0",Iu.exports=ae;var S=Iu.exports;const Q0=ve(S),PC=_e({__proto__:null,default:Q0},[S]);/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var NC=S,OC=Symbol.for("react.element"),DC=Symbol.for("react.fragment"),MC=Object.prototype.hasOwnProperty,LC=NC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,VC={key:!0,ref:!0,__self:!0,__source:!0};function q0(t,e,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)MC.call(e,r)&&!VC.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:OC,type:t,key:s,ref:o,props:i,_owner:LC.current}}er.Fragment=DC,er.jsx=q0,er.jsxs=q0,Ce.exports=er;var p=Ce.exports,K0={exports:{}},jt={},Y0={exports:{}},X0={};/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(t){function e(D,W){var j=D.length;D.push(W);e:for(;0<j;){var se=j-1>>>1,pe=D[se];if(0<i(pe,W))D[se]=W,D[j]=pe,j=se;else break e}}function n(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var W=D[0],j=D.pop();if(j!==W){D[0]=j;e:for(var se=0,pe=D.length,Xt=pe>>>1;se<Xt;){var Xn=2*(se+1)-1,Zo=D[Xn],Jn=Xn+1,ws=D[Jn];if(0>i(Zo,j))Jn<pe&&0>i(ws,Zo)?(D[se]=ws,D[Jn]=j,se=Jn):(D[se]=Zo,D[Xn]=j,se=Xn);else if(Jn<pe&&0>i(ws,j))D[se]=ws,D[Jn]=j,se=Jn;else break e}}return W}function i(D,W){var j=D.sortIndex-W.sortIndex;return j!==0?j:D.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,h=null,d=3,f=!1,g=!1,m=!1,w=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate!="undefined"?setImmediate:null;typeof navigator!="undefined"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(D){for(var W=n(u);W!==null;){if(W.callback===null)r(u);else if(W.startTime<=D)r(u),W.sortIndex=W.expirationTime,e(l,W);else break;W=n(u)}}function E(D){if(m=!1,_(D),!g)if(n(l)!==null)g=!0,z(I);else{var W=n(u);W!==null&&X(E,W.startTime-D)}}function I(D,W){g=!1,m&&(m=!1,v(C),C=-1),f=!0;var j=d;try{for(_(W),h=n(l);h!==null&&(!(h.expirationTime>W)||D&&!P());){var se=h.callback;if(typeof se=="function"){h.callback=null,d=h.priorityLevel;var pe=se(h.expirationTime<=W);W=t.unstable_now(),typeof pe=="function"?h.callback=pe:h===n(l)&&r(l),_(W)}else r(l);h=n(l)}if(h!==null)var Xt=!0;else{var Xn=n(u);Xn!==null&&X(E,Xn.startTime-W),Xt=!1}return Xt}finally{h=null,d=j,f=!1}}var A=!1,T=null,C=-1,N=5,O=-1;function P(){return!(t.unstable_now()-O<N)}function b(){if(T!==null){var D=t.unstable_now();O=D;var W=!0;try{W=T(!0,D)}finally{W?L():(A=!1,T=null)}}else A=!1}var L;if(typeof y=="function")L=function(){y(b)};else if(typeof MessageChannel!="undefined"){var V=new MessageChannel,$=V.port2;V.port1.onmessage=b,L=function(){$.postMessage(null)}}else L=function(){w(b,0)};function z(D){T=D,A||(A=!0,L())}function X(D,W){C=w(function(){D(t.unstable_now())},W)}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(D){D.callback=null},t.unstable_continueExecution=function(){g||f||(g=!0,z(I))},t.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<D?Math.floor(1e3/D):5},t.unstable_getCurrentPriorityLevel=function(){return d},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(D){switch(d){case 1:case 2:case 3:var W=3;break;default:W=d}var j=d;d=W;try{return D()}finally{d=j}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(D,W){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var j=d;d=D;try{return W()}finally{d=j}},t.unstable_scheduleCallback=function(D,W,j){var se=t.unstable_now();switch(typeof j=="object"&&j!==null?(j=j.delay,j=typeof j=="number"&&0<j?se+j:se):j=se,D){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=j+pe,D={id:c++,callback:W,priorityLevel:D,startTime:j,expirationTime:pe,sortIndex:-1},j>se?(D.sortIndex=j,e(u,D),n(l)===null&&D===n(u)&&(m?(v(C),C=-1):m=!0,X(E,j-se))):(D.sortIndex=pe,e(l,D),g||f||(g=!0,z(I))),D},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(D){var W=d;return function(){var j=d;d=W;try{return D.apply(this,arguments)}finally{d=j}}}})(X0),Y0.exports=X0;var FC=Y0.exports;/**
 * @license React
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var J0=S,zt=FC;function M(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Z0=new Set,ta={};function Ti(t,e){Ss(t,e),Ss(t+"Capture",e)}function Ss(t,e){for(ta[t]=e,t=0;t<e.length;t++)Z0.add(e[t])}var tr=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),Wd=Object.prototype.hasOwnProperty,UC=/^[: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]*$/,ey={},ty={};function $C(t){return Wd.call(ty,t)?!0:Wd.call(ey,t)?!1:UC.test(t)?ty[t]=!0:(ey[t]=!0,!1)}function jC(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function zC(t,e,n,r){if(e===null||typeof e=="undefined"||jC(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function It(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Ze={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ze[t]=new It(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ze[e]=new It(e,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ze[t]=new It(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ze[t]=new It(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Ze[t]=new It(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){Ze[t]=new It(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){Ze[t]=new It(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){Ze[t]=new It(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){Ze[t]=new It(t,5,!1,t.toLowerCase(),null,!1,!1)});var Qd=/[\-:]([a-z])/g;function qd(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Qd,qd);Ze[e]=new It(e,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Qd,qd);Ze[e]=new It(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Qd,qd);Ze[e]=new It(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){Ze[t]=new It(t,1,!1,t.toLowerCase(),null,!1,!1)}),Ze.xlinkHref=new It("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){Ze[t]=new It(t,1,!1,t.toLowerCase(),null,!0,!0)});function Kd(t,e,n,r){var i=Ze.hasOwnProperty(e)?Ze[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(zC(e,n,i,r)&&(n=null),r||i===null?$C(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var nr=J0.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,bu=Symbol.for("react.element"),Is=Symbol.for("react.portal"),As=Symbol.for("react.fragment"),Yd=Symbol.for("react.strict_mode"),Xd=Symbol.for("react.profiler"),ny=Symbol.for("react.provider"),ry=Symbol.for("react.context"),Jd=Symbol.for("react.forward_ref"),Zd=Symbol.for("react.suspense"),ef=Symbol.for("react.suspense_list"),tf=Symbol.for("react.memo"),Cr=Symbol.for("react.lazy"),iy=Symbol.for("react.offscreen"),sy=Symbol.iterator;function na(t){return t===null||typeof t!="object"?null:(t=sy&&t[sy]||t["@@iterator"],typeof t=="function"?t:null)}var be=Object.assign,nf;function ra(t){if(nf===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);nf=e&&e[1]||""}return`
`+nf+t}var rf=!1;function sf(t,e){if(!t||rf)return"";rf=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var r=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){r=u}t.call(e.prototype)}else{try{throw Error()}catch(u){r=u}t()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var i=u.stack.split(`
`),s=r.stack.split(`
`),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var l=`
`+i[o].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{rf=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?ra(t):""}function BC(t){switch(t.tag){case 5:return ra(t.type);case 16:return ra("Lazy");case 13:return ra("Suspense");case 19:return ra("SuspenseList");case 0:case 2:case 15:return t=sf(t.type,!1),t;case 11:return t=sf(t.type.render,!1),t;case 1:return t=sf(t.type,!0),t;default:return""}}function of(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case As:return"Fragment";case Is:return"Portal";case Xd:return"Profiler";case Yd:return"StrictMode";case Zd:return"Suspense";case ef:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case ry:return(t.displayName||"Context")+".Consumer";case ny:return(t._context.displayName||"Context")+".Provider";case Jd:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case tf:return e=t.displayName||null,e!==null?e:of(t.type)||"Memo";case Cr:e=t._payload,t=t._init;try{return of(t(e))}catch{}}return null}function HC(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return of(e);case 8:return e===Yd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function br(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function oy(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function GC(t){var e=oy(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n!="undefined"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Ru(t){t._valueTracker||(t._valueTracker=GC(t))}function ay(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=oy(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function ku(t){if(t=t||(typeof document!="undefined"?document:void 0),typeof t=="undefined")return null;try{return t.activeElement||t.body}catch{return t.body}}function af(t,e){var n=e.checked;return be({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n!=null?n:t._wrapperState.initialChecked})}function ly(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=br(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function uy(t,e){e=e.checked,e!=null&&Kd(t,"checked",e,!1)}function lf(t,e){uy(t,e);var n=br(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?uf(t,e.type,n):e.hasOwnProperty("defaultValue")&&uf(t,e.type,br(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function cy(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function uf(t,e,n){(e!=="number"||ku(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var ia=Array.isArray;function Ts(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+br(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function cf(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(M(91));return be({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function hy(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(M(92));if(ia(n)){if(1<n.length)throw Error(M(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:br(n)}}function dy(t,e){var n=br(e.value),r=br(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function fy(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function py(t){switch(t){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 hf(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?py(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Pu,gy=function(t){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Pu=Pu||document.createElement("div"),Pu.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Pu.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function sa(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var oa={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},WC=["Webkit","ms","Moz","O"];Object.keys(oa).forEach(function(t){WC.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),oa[e]=oa[t]})});function my(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||oa.hasOwnProperty(t)&&oa[t]?(""+e).trim():e+"px"}function vy(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=my(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var QC=be({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 df(t,e){if(e){if(QC[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(M(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(M(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(M(61))}if(e.style!=null&&typeof e.style!="object")throw Error(M(62))}}function ff(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var pf=null;function gf(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var mf=null,Cs=null,bs=null;function yy(t){if(t=ba(t)){if(typeof mf!="function")throw Error(M(280));var e=t.stateNode;e&&(e=ec(e),mf(t.stateNode,t.type,e))}}function _y(t){Cs?bs?bs.push(t):bs=[t]:Cs=t}function wy(){if(Cs){var t=Cs,e=bs;if(bs=Cs=null,yy(t),e)for(t=0;t<e.length;t++)yy(e[t])}}function Ey(t,e){return t(e)}function xy(){}var vf=!1;function Sy(t,e,n){if(vf)return t(e,n);vf=!0;try{return Ey(t,e,n)}finally{vf=!1,(Cs!==null||bs!==null)&&(xy(),wy())}}function aa(t,e){var n=t.stateNode;if(n===null)return null;var r=ec(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(M(231,e,typeof n));return n}var yf=!1;if(tr)try{var la={};Object.defineProperty(la,"passive",{get:function(){yf=!0}}),window.addEventListener("test",la,la),window.removeEventListener("test",la,la)}catch{yf=!1}function qC(t,e,n,r,i,s,o,a,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(c){this.onError(c)}}var ua=!1,Nu=null,Ou=!1,_f=null,KC={onError:function(t){ua=!0,Nu=t}};function YC(t,e,n,r,i,s,o,a,l){ua=!1,Nu=null,qC.apply(KC,arguments)}function XC(t,e,n,r,i,s,o,a,l){if(YC.apply(this,arguments),ua){if(ua){var u=Nu;ua=!1,Nu=null}else throw Error(M(198));Ou||(Ou=!0,_f=u)}}function Ci(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function Iy(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Ay(t){if(Ci(t)!==t)throw Error(M(188))}function JC(t){var e=t.alternate;if(!e){if(e=Ci(t),e===null)throw Error(M(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return Ay(i),t;if(s===r)return Ay(i),e;s=s.sibling}throw Error(M(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o)throw Error(M(189))}}if(n.alternate!==r)throw Error(M(190))}if(n.tag!==3)throw Error(M(188));return n.stateNode.current===n?t:e}function Ty(t){return t=JC(t),t!==null?Cy(t):null}function Cy(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Cy(t);if(e!==null)return e;t=t.sibling}return null}var by=zt.unstable_scheduleCallback,Ry=zt.unstable_cancelCallback,ZC=zt.unstable_shouldYield,eb=zt.unstable_requestPaint,Me=zt.unstable_now,tb=zt.unstable_getCurrentPriorityLevel,wf=zt.unstable_ImmediatePriority,ky=zt.unstable_UserBlockingPriority,Du=zt.unstable_NormalPriority,nb=zt.unstable_LowPriority,Py=zt.unstable_IdlePriority,Mu=null,bn=null;function rb(t){if(bn&&typeof bn.onCommitFiberRoot=="function")try{bn.onCommitFiberRoot(Mu,t,void 0,(t.current.flags&128)===128)}catch{}}var cn=Math.clz32?Math.clz32:ob,ib=Math.log,sb=Math.LN2;function ob(t){return t>>>=0,t===0?32:31-(ib(t)/sb|0)|0}var Lu=64,Vu=4194304;function ca(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Fu(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=ca(a):(s&=o,s!==0&&(r=ca(s)))}else o=n&~i,o!==0?r=ca(o):s!==0&&(r=ca(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-cn(e),i=1<<n,r|=t[n],e&=~i;return r}function ab(t,e){switch(t){case 1:case 2:case 4:return e+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 e+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 lb(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var o=31-cn(s),a=1<<o,l=i[o];l===-1?(!(a&n)||a&r)&&(i[o]=ab(a,e)):l<=e&&(t.expiredLanes|=a),s&=~a}}function Ef(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Ny(){var t=Lu;return Lu<<=1,!(Lu&4194240)&&(Lu=64),t}function xf(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function ha(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-cn(e),t[e]=n}function ub(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-cn(n),s=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~s}}function Sf(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-cn(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var ge=0;function Oy(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Dy,If,My,Ly,Vy,Af=!1,Uu=[],Rr=null,kr=null,Pr=null,da=new Map,fa=new Map,Nr=[],cb="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 Fy(t,e){switch(t){case"focusin":case"focusout":Rr=null;break;case"dragenter":case"dragleave":kr=null;break;case"mouseover":case"mouseout":Pr=null;break;case"pointerover":case"pointerout":da.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":fa.delete(e.pointerId)}}function pa(t,e,n,r,i,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=ba(e),e!==null&&If(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function hb(t,e,n,r,i){switch(e){case"focusin":return Rr=pa(Rr,t,e,n,r,i),!0;case"dragenter":return kr=pa(kr,t,e,n,r,i),!0;case"mouseover":return Pr=pa(Pr,t,e,n,r,i),!0;case"pointerover":var s=i.pointerId;return da.set(s,pa(da.get(s)||null,t,e,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,fa.set(s,pa(fa.get(s)||null,t,e,n,r,i)),!0}return!1}function Uy(t){var e=bi(t.target);if(e!==null){var n=Ci(e);if(n!==null){if(e=n.tag,e===13){if(e=Iy(n),e!==null){t.blockedOn=e,Vy(t.priority,function(){My(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function $u(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Cf(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);pf=r,n.target.dispatchEvent(r),pf=null}else return e=ba(n),e!==null&&If(e),t.blockedOn=n,!1;e.shift()}return!0}function $y(t,e,n){$u(t)&&n.delete(e)}function db(){Af=!1,Rr!==null&&$u(Rr)&&(Rr=null),kr!==null&&$u(kr)&&(kr=null),Pr!==null&&$u(Pr)&&(Pr=null),da.forEach($y),fa.forEach($y)}function ga(t,e){t.blockedOn===e&&(t.blockedOn=null,Af||(Af=!0,zt.unstable_scheduleCallback(zt.unstable_NormalPriority,db)))}function ma(t){function e(i){return ga(i,t)}if(0<Uu.length){ga(Uu[0],t);for(var n=1;n<Uu.length;n++){var r=Uu[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Rr!==null&&ga(Rr,t),kr!==null&&ga(kr,t),Pr!==null&&ga(Pr,t),da.forEach(e),fa.forEach(e),n=0;n<Nr.length;n++)r=Nr[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Nr.length&&(n=Nr[0],n.blockedOn===null);)Uy(n),n.blockedOn===null&&Nr.shift()}var Rs=nr.ReactCurrentBatchConfig,ju=!0;function fb(t,e,n,r){var i=ge,s=Rs.transition;Rs.transition=null;try{ge=1,Tf(t,e,n,r)}finally{ge=i,Rs.transition=s}}function pb(t,e,n,r){var i=ge,s=Rs.transition;Rs.transition=null;try{ge=4,Tf(t,e,n,r)}finally{ge=i,Rs.transition=s}}function Tf(t,e,n,r){if(ju){var i=Cf(t,e,n,r);if(i===null)Hf(t,e,r,zu,n),Fy(t,r);else if(hb(i,t,e,n,r))r.stopPropagation();else if(Fy(t,r),e&4&&-1<cb.indexOf(t)){for(;i!==null;){var s=ba(i);if(s!==null&&Dy(s),s=Cf(t,e,n,r),s===null&&Hf(t,e,r,zu,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else Hf(t,e,r,null,n)}}var zu=null;function Cf(t,e,n,r){if(zu=null,t=gf(r),t=bi(t),t!==null)if(e=Ci(t),e===null)t=null;else if(n=e.tag,n===13){if(t=Iy(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return zu=t,null}function jy(t){switch(t){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(tb()){case wf:return 1;case ky:return 4;case Du:case nb:return 16;case Py:return 536870912;default:return 16}default:return 16}}var Or=null,bf=null,Bu=null;function zy(){if(Bu)return Bu;var t,e=bf,n=e.length,r,i="value"in Or?Or.value:Or.textContent,s=i.length;for(t=0;t<n&&e[t]===i[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===i[s-r];r++);return Bu=i.slice(t,1<r?1-r:void 0)}function Hu(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Gu(){return!0}function By(){return!1}function Bt(t){function e(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Gu:By,this.isPropagationStopped=By,this}return be(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Gu)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Gu)},persist:function(){},isPersistent:Gu}),e}var ks={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Rf=Bt(ks),va=be({},ks,{view:0,detail:0}),gb=Bt(va),kf,Pf,ya,Wu=be({},va,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Of,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ya&&(ya&&t.type==="mousemove"?(kf=t.screenX-ya.screenX,Pf=t.screenY-ya.screenY):Pf=kf=0,ya=t),kf)},movementY:function(t){return"movementY"in t?t.movementY:Pf}}),Hy=Bt(Wu),mb=be({},Wu,{dataTransfer:0}),vb=Bt(mb),yb=be({},va,{relatedTarget:0}),Nf=Bt(yb),_b=be({},ks,{animationName:0,elapsedTime:0,pseudoElement:0}),wb=Bt(_b),Eb=be({},ks,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),xb=Bt(Eb),Sb=be({},ks,{data:0}),Gy=Bt(Sb),Ib={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ab={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"},Tb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cb(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=Tb[t])?!!e[t]:!1}function Of(){return Cb}var bb=be({},va,{key:function(t){if(t.key){var e=Ib[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Hu(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Ab[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Of,charCode:function(t){return t.type==="keypress"?Hu(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Hu(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Rb=Bt(bb),kb=be({},Wu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wy=Bt(kb),Pb=be({},va,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Of}),Nb=Bt(Pb),Ob=be({},ks,{propertyName:0,elapsedTime:0,pseudoElement:0}),Db=Bt(Ob),Mb=be({},Wu,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Lb=Bt(Mb),Vb=[9,13,27,32],Df=tr&&"CompositionEvent"in window,_a=null;tr&&"documentMode"in document&&(_a=document.documentMode);var Fb=tr&&"TextEvent"in window&&!_a,Qy=tr&&(!Df||_a&&8<_a&&11>=_a),qy=" ",Ky=!1;function Yy(t,e){switch(t){case"keyup":return Vb.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xy(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ps=!1;function Ub(t,e){switch(t){case"compositionend":return Xy(e);case"keypress":return e.which!==32?null:(Ky=!0,qy);case"textInput":return t=e.data,t===qy&&Ky?null:t;default:return null}}function $b(t,e){if(Ps)return t==="compositionend"||!Df&&Yy(t,e)?(t=zy(),Bu=bf=Or=null,Ps=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Qy&&e.locale!=="ko"?null:e.data;default:return null}}var jb={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 Jy(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!jb[t.type]:e==="textarea"}function Zy(t,e,n,r){_y(r),e=Xu(e,"onChange"),0<e.length&&(n=new Rf("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var wa=null,Ea=null;function zb(t){v_(t,0)}function Qu(t){var e=Ls(t);if(ay(e))return t}function Bb(t,e){if(t==="change")return e}var e_=!1;if(tr){var Mf;if(tr){var Lf="oninput"in document;if(!Lf){var t_=document.createElement("div");t_.setAttribute("oninput","return;"),Lf=typeof t_.oninput=="function"}Mf=Lf}else Mf=!1;e_=Mf&&(!document.documentMode||9<document.documentMode)}function n_(){wa&&(wa.detachEvent("onpropertychange",r_),Ea=wa=null)}function r_(t){if(t.propertyName==="value"&&Qu(Ea)){var e=[];Zy(e,Ea,t,gf(t)),Sy(zb,e)}}function Hb(t,e,n){t==="focusin"?(n_(),wa=e,Ea=n,wa.attachEvent("onpropertychange",r_)):t==="focusout"&&n_()}function Gb(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Qu(Ea)}function Wb(t,e){if(t==="click")return Qu(e)}function Qb(t,e){if(t==="input"||t==="change")return Qu(e)}function qb(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var hn=typeof Object.is=="function"?Object.is:qb;function xa(t,e){if(hn(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Wd.call(e,i)||!hn(t[i],e[i]))return!1}return!0}function i_(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function s_(t,e){var n=i_(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=i_(n)}}function o_(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?o_(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function a_(){for(var t=window,e=ku();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=ku(t.document)}return e}function Vf(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Kb(t){var e=a_(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&o_(n.ownerDocument.documentElement,n)){if(r!==null&&Vf(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=s_(n,s);var o=s_(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Yb=tr&&"documentMode"in document&&11>=document.documentMode,Ns=null,Ff=null,Sa=null,Uf=!1;function l_(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Uf||Ns==null||Ns!==ku(r)||(r=Ns,"selectionStart"in r&&Vf(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Sa&&xa(Sa,r)||(Sa=r,r=Xu(Ff,"onSelect"),0<r.length&&(e=new Rf("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=Ns)))}function qu(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Os={animationend:qu("Animation","AnimationEnd"),animationiteration:qu("Animation","AnimationIteration"),animationstart:qu("Animation","AnimationStart"),transitionend:qu("Transition","TransitionEnd")},$f={},u_={};tr&&(u_=document.createElement("div").style,"AnimationEvent"in window||(delete Os.animationend.animation,delete Os.animationiteration.animation,delete Os.animationstart.animation),"TransitionEvent"in window||delete Os.transitionend.transition);function Ku(t){if($f[t])return $f[t];if(!Os[t])return t;var e=Os[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in u_)return $f[t]=e[n];return t}var c_=Ku("animationend"),h_=Ku("animationiteration"),d_=Ku("animationstart"),f_=Ku("transitionend"),p_=new Map,g_="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 Dr(t,e){p_.set(t,e),Ti(e,[t])}for(var jf=0;jf<g_.length;jf++){var zf=g_[jf],Xb=zf.toLowerCase(),Jb=zf[0].toUpperCase()+zf.slice(1);Dr(Xb,"on"+Jb)}Dr(c_,"onAnimationEnd"),Dr(h_,"onAnimationIteration"),Dr(d_,"onAnimationStart"),Dr("dblclick","onDoubleClick"),Dr("focusin","onFocus"),Dr("focusout","onBlur"),Dr(f_,"onTransitionEnd"),Ss("onMouseEnter",["mouseout","mouseover"]),Ss("onMouseLeave",["mouseout","mouseover"]),Ss("onPointerEnter",["pointerout","pointerover"]),Ss("onPointerLeave",["pointerout","pointerover"]),Ti("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ti("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ti("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ti("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ti("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ti("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ia="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(" "),Zb=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ia));function m_(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,XC(r,e,void 0,t),t.currentTarget=null}function v_(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,u=a.currentTarget;if(a=a.listener,l!==s&&i.isPropagationStopped())break e;m_(i,a,u),s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,u=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;m_(i,a,u),s=l}}}if(Ou)throw t=_f,Ou=!1,_f=null,t}function xe(t,e){var n=e[Yf];n===void 0&&(n=e[Yf]=new Set);var r=t+"__bubble";n.has(r)||(y_(e,t,2,!1),n.add(r))}function Bf(t,e,n){var r=0;e&&(r|=4),y_(n,t,r,e)}var Yu="_reactListening"+Math.random().toString(36).slice(2);function Aa(t){if(!t[Yu]){t[Yu]=!0,Z0.forEach(function(n){n!=="selectionchange"&&(Zb.has(n)||Bf(n,!1,t),Bf(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Yu]||(e[Yu]=!0,Bf("selectionchange",!1,e))}}function y_(t,e,n,r){switch(jy(e)){case 1:var i=fb;break;case 4:i=pb;break;default:i=Tf}n=i.bind(null,e,n,t),i=void 0,!yf||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function Hf(t,e,n,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;a!==null;){if(o=bi(a),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}a=a.parentNode}}r=r.return}Sy(function(){var u=s,c=gf(n),h=[];e:{var d=p_.get(t);if(d!==void 0){var f=Rf,g=t;switch(t){case"keypress":if(Hu(n)===0)break e;case"keydown":case"keyup":f=Rb;break;case"focusin":g="focus",f=Nf;break;case"focusout":g="blur",f=Nf;break;case"beforeblur":case"afterblur":f=Nf;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=Hy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=vb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=Nb;break;case c_:case h_:case d_:f=wb;break;case f_:f=Db;break;case"scroll":f=gb;break;case"wheel":f=Lb;break;case"copy":case"cut":case"paste":f=xb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=Wy}var m=(e&4)!==0,w=!m&&t==="scroll",v=m?d!==null?d+"Capture":null:d;m=[];for(var y=u,_;y!==null;){_=y;var E=_.stateNode;if(_.tag===5&&E!==null&&(_=E,v!==null&&(E=aa(y,v),E!=null&&m.push(Ta(y,E,_)))),w)break;y=y.return}0<m.length&&(d=new f(d,g,null,n,c),h.push({event:d,listeners:m}))}}if(!(e&7)){e:{if(d=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",d&&n!==pf&&(g=n.relatedTarget||n.fromElement)&&(bi(g)||g[rr]))break e;if((f||d)&&(d=c.window===c?c:(d=c.ownerDocument)?d.defaultView||d.parentWindow:window,f?(g=n.relatedTarget||n.toElement,f=u,g=g?bi(g):null,g!==null&&(w=Ci(g),g!==w||g.tag!==5&&g.tag!==6)&&(g=null)):(f=null,g=u),f!==g)){if(m=Hy,E="onMouseLeave",v="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(m=Wy,E="onPointerLeave",v="onPointerEnter",y="pointer"),w=f==null?d:Ls(f),_=g==null?d:Ls(g),d=new m(E,y+"leave",f,n,c),d.target=w,d.relatedTarget=_,E=null,bi(c)===u&&(m=new m(v,y+"enter",g,n,c),m.target=_,m.relatedTarget=w,E=m),w=E,f&&g)t:{for(m=f,v=g,y=0,_=m;_;_=Ds(_))y++;for(_=0,E=v;E;E=Ds(E))_++;for(;0<y-_;)m=Ds(m),y--;for(;0<_-y;)v=Ds(v),_--;for(;y--;){if(m===v||v!==null&&m===v.alternate)break t;m=Ds(m),v=Ds(v)}m=null}else m=null;f!==null&&__(h,d,f,m,!1),g!==null&&w!==null&&__(h,w,g,m,!0)}}e:{if(d=u?Ls(u):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var I=Bb;else if(Jy(d))if(e_)I=Qb;else{I=Gb;var A=Hb}else(f=d.nodeName)&&f.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(I=Wb);if(I&&(I=I(t,u))){Zy(h,I,n,c);break e}A&&A(t,d,u),t==="focusout"&&(A=d._wrapperState)&&A.controlled&&d.type==="number"&&uf(d,"number",d.value)}switch(A=u?Ls(u):window,t){case"focusin":(Jy(A)||A.contentEditable==="true")&&(Ns=A,Ff=u,Sa=null);break;case"focusout":Sa=Ff=Ns=null;break;case"mousedown":Uf=!0;break;case"contextmenu":case"mouseup":case"dragend":Uf=!1,l_(h,n,c);break;case"selectionchange":if(Yb)break;case"keydown":case"keyup":l_(h,n,c)}var T;if(Df)e:{switch(t){case"compositionstart":var C="onCompositionStart";break e;case"compositionend":C="onCompositionEnd";break e;case"compositionupdate":C="onCompositionUpdate";break e}C=void 0}else Ps?Yy(t,n)&&(C="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(C="onCompositionStart");C&&(Qy&&n.locale!=="ko"&&(Ps||C!=="onCompositionStart"?C==="onCompositionEnd"&&Ps&&(T=zy()):(Or=c,bf="value"in Or?Or.value:Or.textContent,Ps=!0)),A=Xu(u,C),0<A.length&&(C=new Gy(C,t,null,n,c),h.push({event:C,listeners:A}),T?C.data=T:(T=Xy(n),T!==null&&(C.data=T)))),(T=Fb?Ub(t,n):$b(t,n))&&(u=Xu(u,"onBeforeInput"),0<u.length&&(c=new Gy("onBeforeInput","beforeinput",null,n,c),h.push({event:c,listeners:u}),c.data=T))}v_(h,e)})}function Ta(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Xu(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=aa(t,n),s!=null&&r.unshift(Ta(t,s,i)),s=aa(t,e),s!=null&&r.push(Ta(t,s,i))),t=t.return}return r}function Ds(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function __(t,e,n,r,i){for(var s=e._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,u=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&u!==null&&(a=u,i?(l=aa(n,s),l!=null&&o.unshift(Ta(n,l,a))):i||(l=aa(n,s),l!=null&&o.push(Ta(n,l,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var eR=/\r\n?/g,tR=/\u0000|\uFFFD/g;function w_(t){return(typeof t=="string"?t:""+t).replace(eR,`
`).replace(tR,"")}function Ju(t,e,n){if(e=w_(e),w_(t)!==e&&n)throw Error(M(425))}function Zu(){}var Gf=null,Wf=null;function Qf(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var qf=typeof setTimeout=="function"?setTimeout:void 0,nR=typeof clearTimeout=="function"?clearTimeout:void 0,E_=typeof Promise=="function"?Promise:void 0,rR=typeof queueMicrotask=="function"?queueMicrotask:typeof E_!="undefined"?function(t){return E_.resolve(null).then(t).catch(iR)}:qf;function iR(t){setTimeout(function(){throw t})}function Kf(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),ma(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);ma(e)}function Mr(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function x_(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var Ms=Math.random().toString(36).slice(2),Rn="__reactFiber$"+Ms,Ca="__reactProps$"+Ms,rr="__reactContainer$"+Ms,Yf="__reactEvents$"+Ms,sR="__reactListeners$"+Ms,oR="__reactHandles$"+Ms;function bi(t){var e=t[Rn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[rr]||n[Rn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=x_(t);t!==null;){if(n=t[Rn])return n;t=x_(t)}return e}t=n,n=t.parentNode}return null}function ba(t){return t=t[Rn]||t[rr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Ls(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(M(33))}function ec(t){return t[Ca]||null}var Xf=[],Vs=-1;function Lr(t){return{current:t}}function Se(t){0>Vs||(t.current=Xf[Vs],Xf[Vs]=null,Vs--)}function we(t,e){Vs++,Xf[Vs]=t.current,t.current=e}var Vr={},lt=Lr(Vr),Pt=Lr(!1),Ri=Vr;function Fs(t,e){var n=t.type.contextTypes;if(!n)return Vr;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Nt(t){return t=t.childContextTypes,t!=null}function tc(){Se(Pt),Se(lt)}function S_(t,e,n){if(lt.current!==Vr)throw Error(M(168));we(lt,e),we(Pt,n)}function I_(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(M(108,HC(t)||"Unknown",i));return be({},n,r)}function nc(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Vr,Ri=lt.current,we(lt,t),we(Pt,Pt.current),!0}function A_(t,e,n){var r=t.stateNode;if(!r)throw Error(M(169));n?(t=I_(t,e,Ri),r.__reactInternalMemoizedMergedChildContext=t,Se(Pt),Se(lt),we(lt,t)):Se(Pt),we(Pt,n)}var ir=null,rc=!1,Jf=!1;function T_(t){ir===null?ir=[t]:ir.push(t)}function aR(t){rc=!0,T_(t)}function Fr(){if(!Jf&&ir!==null){Jf=!0;var t=0,e=ge;try{var n=ir;for(ge=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}ir=null,rc=!1}catch(i){throw ir!==null&&(ir=ir.slice(t+1)),by(wf,Fr),i}finally{ge=e,Jf=!1}}return null}var Us=[],$s=0,ic=null,sc=0,Jt=[],Zt=0,ki=null,sr=1,or="";function Pi(t,e){Us[$s++]=sc,Us[$s++]=ic,ic=t,sc=e}function C_(t,e,n){Jt[Zt++]=sr,Jt[Zt++]=or,Jt[Zt++]=ki,ki=t;var r=sr;t=or;var i=32-cn(r)-1;r&=~(1<<i),n+=1;var s=32-cn(e)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,sr=1<<32-cn(e)+i|n<<i|r,or=s+t}else sr=1<<s|n<<i|r,or=t}function Zf(t){t.return!==null&&(Pi(t,1),C_(t,1,0))}function ep(t){for(;t===ic;)ic=Us[--$s],Us[$s]=null,sc=Us[--$s],Us[$s]=null;for(;t===ki;)ki=Jt[--Zt],Jt[Zt]=null,or=Jt[--Zt],Jt[Zt]=null,sr=Jt[--Zt],Jt[Zt]=null}var Ht=null,Gt=null,Te=!1,dn=null;function b_(t,e){var n=rn(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function R_(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Ht=t,Gt=Mr(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Ht=t,Gt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=ki!==null?{id:sr,overflow:or}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=rn(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Ht=t,Gt=null,!0):!1;default:return!1}}function tp(t){return(t.mode&1)!==0&&(t.flags&128)===0}function np(t){if(Te){var e=Gt;if(e){var n=e;if(!R_(t,e)){if(tp(t))throw Error(M(418));e=Mr(n.nextSibling);var r=Ht;e&&R_(t,e)?b_(r,n):(t.flags=t.flags&-4097|2,Te=!1,Ht=t)}}else{if(tp(t))throw Error(M(418));t.flags=t.flags&-4097|2,Te=!1,Ht=t}}}function k_(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Ht=t}function oc(t){if(t!==Ht)return!1;if(!Te)return k_(t),Te=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Qf(t.type,t.memoizedProps)),e&&(e=Gt)){if(tp(t))throw P_(),Error(M(418));for(;e;)b_(t,e),e=Mr(e.nextSibling)}if(k_(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(M(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Gt=Mr(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Gt=null}}else Gt=Ht?Mr(t.stateNode.nextSibling):null;return!0}function P_(){for(var t=Gt;t;)t=Mr(t.nextSibling)}function js(){Gt=Ht=null,Te=!1}function rp(t){dn===null?dn=[t]:dn.push(t)}var lR=nr.ReactCurrentBatchConfig;function fn(t,e){if(t&&t.defaultProps){e=be({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}var ac=Lr(null),lc=null,zs=null,ip=null;function sp(){ip=zs=lc=null}function op(t){var e=ac.current;Se(ac),t._currentValue=e}function ap(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Bs(t,e){lc=t,ip=zs=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ot=!0),t.firstContext=null)}function en(t){var e=t._currentValue;if(ip!==t)if(t={context:t,memoizedValue:e,next:null},zs===null){if(lc===null)throw Error(M(308));zs=t,lc.dependencies={lanes:0,firstContext:t}}else zs=zs.next=t;return e}var Ni=null;function lp(t){Ni===null?Ni=[t]:Ni.push(t)}function N_(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,lp(e)):(n.next=i.next,i.next=n),e.interleaved=n,ar(t,r)}function ar(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Ur=!1;function up(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function O_(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function lr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function $r(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,de&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,ar(t,n)}return i=r.interleaved,i===null?(e.next=e,lp(r)):(e.next=i.next,i.next=e),r.interleaved=e,ar(t,n)}function uc(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Sf(t,n)}}function D_(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function cc(t,e,n,r){var i=t.updateQueue;Ur=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var c=t.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(s!==null){var h=i.baseState;o=0,c=u=l=null,a=s;do{var d=a.lane,f=a.eventTime;if((r&d)===d){c!==null&&(c=c.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=t,m=a;switch(d=e,f=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){h=g.call(f,h,d);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,d=typeof g=="function"?g.call(f,h,d):g,d==null)break e;h=be({},h,d);break e;case 2:Ur=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,d=i.effects,d===null?i.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=f,l=h):c=c.next=f,o|=d;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;d=a,a=d.next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}while(!0);if(c===null&&(l=h),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Mi|=o,t.lanes=o,t.memoizedState=h}}function M_(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(M(191,i));i.call(r)}}}var L_=new J0.Component().refs;function cp(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:be({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var hc={isMounted:function(t){return(t=t._reactInternals)?Ci(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Tt(),i=Hr(t),s=lr(r,i);s.payload=e,n!=null&&(s.callback=n),e=$r(t,s,i),e!==null&&(mn(e,t,i,r),uc(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Tt(),i=Hr(t),s=lr(r,i);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=$r(t,s,i),e!==null&&(mn(e,t,i,r),uc(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Tt(),r=Hr(t),i=lr(n,r);i.tag=2,e!=null&&(i.callback=e),e=$r(t,i,r),e!==null&&(mn(e,t,r,n),uc(e,t,r))}};function V_(t,e,n,r,i,s,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,s,o):e.prototype&&e.prototype.isPureReactComponent?!xa(n,r)||!xa(i,s):!0}function F_(t,e,n){var r=!1,i=Vr,s=e.contextType;return typeof s=="object"&&s!==null?s=en(s):(i=Nt(e)?Ri:lt.current,r=e.contextTypes,s=(r=r!=null)?Fs(t,i):Vr),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=hc,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=s),e}function U_(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&hc.enqueueReplaceState(e,e.state,null)}function hp(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs=L_,up(t);var s=e.contextType;typeof s=="object"&&s!==null?i.context=en(s):(s=Nt(e)?Ri:lt.current,i.context=Fs(t,s)),i.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(cp(t,e,s,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&hc.enqueueReplaceState(i,i.state,null),cc(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function Ra(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(M(309));var r=n.stateNode}if(!r)throw Error(M(147,t));var i=r,s=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=i.refs;a===L_&&(a=i.refs={}),o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof t!="string")throw Error(M(284));if(!n._owner)throw Error(M(290,t))}return t}function dc(t,e){throw t=Object.prototype.toString.call(e),Error(M(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function $_(t){var e=t._init;return e(t._payload)}function j_(t){function e(v,y){if(t){var _=v.deletions;_===null?(v.deletions=[y],v.flags|=16):_.push(y)}}function n(v,y){if(!t)return null;for(;y!==null;)e(v,y),y=y.sibling;return null}function r(v,y){for(v=new Map;y!==null;)y.key!==null?v.set(y.key,y):v.set(y.index,y),y=y.sibling;return v}function i(v,y){return v=Wr(v,y),v.index=0,v.sibling=null,v}function s(v,y,_){return v.index=_,t?(_=v.alternate,_!==null?(_=_.index,_<y?(v.flags|=2,y):_):(v.flags|=2,y)):(v.flags|=1048576,y)}function o(v){return t&&v.alternate===null&&(v.flags|=2),v}function a(v,y,_,E){return y===null||y.tag!==6?(y=qp(_,v.mode,E),y.return=v,y):(y=i(y,_),y.return=v,y)}function l(v,y,_,E){var I=_.type;return I===As?c(v,y,_.props.children,E,_.key):y!==null&&(y.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===Cr&&$_(I)===y.type)?(E=i(y,_.props),E.ref=Ra(v,y,_),E.return=v,E):(E=Pc(_.type,_.key,_.props,null,v.mode,E),E.ref=Ra(v,y,_),E.return=v,E)}function u(v,y,_,E){return y===null||y.tag!==4||y.stateNode.containerInfo!==_.containerInfo||y.stateNode.implementation!==_.implementation?(y=Kp(_,v.mode,E),y.return=v,y):(y=i(y,_.children||[]),y.return=v,y)}function c(v,y,_,E,I){return y===null||y.tag!==7?(y=Ui(_,v.mode,E,I),y.return=v,y):(y=i(y,_),y.return=v,y)}function h(v,y,_){if(typeof y=="string"&&y!==""||typeof y=="number")return y=qp(""+y,v.mode,_),y.return=v,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case bu:return _=Pc(y.type,y.key,y.props,null,v.mode,_),_.ref=Ra(v,null,y),_.return=v,_;case Is:return y=Kp(y,v.mode,_),y.return=v,y;case Cr:var E=y._init;return h(v,E(y._payload),_)}if(ia(y)||na(y))return y=Ui(y,v.mode,_,null),y.return=v,y;dc(v,y)}return null}function d(v,y,_,E){var I=y!==null?y.key:null;if(typeof _=="string"&&_!==""||typeof _=="number")return I!==null?null:a(v,y,""+_,E);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case bu:return _.key===I?l(v,y,_,E):null;case Is:return _.key===I?u(v,y,_,E):null;case Cr:return I=_._init,d(v,y,I(_._payload),E)}if(ia(_)||na(_))return I!==null?null:c(v,y,_,E,null);dc(v,_)}return null}function f(v,y,_,E,I){if(typeof E=="string"&&E!==""||typeof E=="number")return v=v.get(_)||null,a(y,v,""+E,I);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case bu:return v=v.get(E.key===null?_:E.key)||null,l(y,v,E,I);case Is:return v=v.get(E.key===null?_:E.key)||null,u(y,v,E,I);case Cr:var A=E._init;return f(v,y,_,A(E._payload),I)}if(ia(E)||na(E))return v=v.get(_)||null,c(y,v,E,I,null);dc(y,E)}return null}function g(v,y,_,E){for(var I=null,A=null,T=y,C=y=0,N=null;T!==null&&C<_.length;C++){T.index>C?(N=T,T=null):N=T.sibling;var O=d(v,T,_[C],E);if(O===null){T===null&&(T=N);break}t&&T&&O.alternate===null&&e(v,T),y=s(O,y,C),A===null?I=O:A.sibling=O,A=O,T=N}if(C===_.length)return n(v,T),Te&&Pi(v,C),I;if(T===null){for(;C<_.length;C++)T=h(v,_[C],E),T!==null&&(y=s(T,y,C),A===null?I=T:A.sibling=T,A=T);return Te&&Pi(v,C),I}for(T=r(v,T);C<_.length;C++)N=f(T,v,C,_[C],E),N!==null&&(t&&N.alternate!==null&&T.delete(N.key===null?C:N.key),y=s(N,y,C),A===null?I=N:A.sibling=N,A=N);return t&&T.forEach(function(P){return e(v,P)}),Te&&Pi(v,C),I}function m(v,y,_,E){var I=na(_);if(typeof I!="function")throw Error(M(150));if(_=I.call(_),_==null)throw Error(M(151));for(var A=I=null,T=y,C=y=0,N=null,O=_.next();T!==null&&!O.done;C++,O=_.next()){T.index>C?(N=T,T=null):N=T.sibling;var P=d(v,T,O.value,E);if(P===null){T===null&&(T=N);break}t&&T&&P.alternate===null&&e(v,T),y=s(P,y,C),A===null?I=P:A.sibling=P,A=P,T=N}if(O.done)return n(v,T),Te&&Pi(v,C),I;if(T===null){for(;!O.done;C++,O=_.next())O=h(v,O.value,E),O!==null&&(y=s(O,y,C),A===null?I=O:A.sibling=O,A=O);return Te&&Pi(v,C),I}for(T=r(v,T);!O.done;C++,O=_.next())O=f(T,v,C,O.value,E),O!==null&&(t&&O.alternate!==null&&T.delete(O.key===null?C:O.key),y=s(O,y,C),A===null?I=O:A.sibling=O,A=O);return t&&T.forEach(function(b){return e(v,b)}),Te&&Pi(v,C),I}function w(v,y,_,E){if(typeof _=="object"&&_!==null&&_.type===As&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case bu:e:{for(var I=_.key,A=y;A!==null;){if(A.key===I){if(I=_.type,I===As){if(A.tag===7){n(v,A.sibling),y=i(A,_.props.children),y.return=v,v=y;break e}}else if(A.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===Cr&&$_(I)===A.type){n(v,A.sibling),y=i(A,_.props),y.ref=Ra(v,A,_),y.return=v,v=y;break e}n(v,A);break}else e(v,A);A=A.sibling}_.type===As?(y=Ui(_.props.children,v.mode,E,_.key),y.return=v,v=y):(E=Pc(_.type,_.key,_.props,null,v.mode,E),E.ref=Ra(v,y,_),E.return=v,v=E)}return o(v);case Is:e:{for(A=_.key;y!==null;){if(y.key===A)if(y.tag===4&&y.stateNode.containerInfo===_.containerInfo&&y.stateNode.implementation===_.implementation){n(v,y.sibling),y=i(y,_.children||[]),y.return=v,v=y;break e}else{n(v,y);break}else e(v,y);y=y.sibling}y=Kp(_,v.mode,E),y.return=v,v=y}return o(v);case Cr:return A=_._init,w(v,y,A(_._payload),E)}if(ia(_))return g(v,y,_,E);if(na(_))return m(v,y,_,E);dc(v,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,y!==null&&y.tag===6?(n(v,y.sibling),y=i(y,_),y.return=v,v=y):(n(v,y),y=qp(_,v.mode,E),y.return=v,v=y),o(v)):n(v,y)}return w}var Hs=j_(!0),z_=j_(!1),ka={},kn=Lr(ka),Pa=Lr(ka),Na=Lr(ka);function Oi(t){if(t===ka)throw Error(M(174));return t}function dp(t,e){switch(we(Na,e),we(Pa,t),we(kn,ka),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:hf(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=hf(e,t)}Se(kn),we(kn,e)}function Gs(){Se(kn),Se(Pa),Se(Na)}function B_(t){Oi(Na.current);var e=Oi(kn.current),n=hf(e,t.type);e!==n&&(we(Pa,t),we(kn,n))}function fp(t){Pa.current===t&&(Se(kn),Se(Pa))}var Re=Lr(0);function fc(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var pp=[];function gp(){for(var t=0;t<pp.length;t++)pp[t]._workInProgressVersionPrimary=null;pp.length=0}var pc=nr.ReactCurrentDispatcher,mp=nr.ReactCurrentBatchConfig,Di=0,ke=null,je=null,Qe=null,gc=!1,Oa=!1,Da=0,uR=0;function ut(){throw Error(M(321))}function vp(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!hn(t[n],e[n]))return!1;return!0}function yp(t,e,n,r,i,s){if(Di=s,ke=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,pc.current=t===null||t.memoizedState===null?fR:pR,t=n(r,i),Oa){s=0;do{if(Oa=!1,Da=0,25<=s)throw Error(M(301));s+=1,Qe=je=null,e.updateQueue=null,pc.current=gR,t=n(r,i)}while(Oa)}if(pc.current=yc,e=je!==null&&je.next!==null,Di=0,Qe=je=ke=null,gc=!1,e)throw Error(M(300));return t}function _p(){var t=Da!==0;return Da=0,t}function Pn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qe===null?ke.memoizedState=Qe=t:Qe=Qe.next=t,Qe}function tn(){if(je===null){var t=ke.alternate;t=t!==null?t.memoizedState:null}else t=je.next;var e=Qe===null?ke.memoizedState:Qe.next;if(e!==null)Qe=e,je=t;else{if(t===null)throw Error(M(310));je=t,t={memoizedState:je.memoizedState,baseState:je.baseState,baseQueue:je.baseQueue,queue:je.queue,next:null},Qe===null?ke.memoizedState=Qe=t:Qe=Qe.next=t}return Qe}function Ma(t,e){return typeof e=="function"?e(t):e}function wp(t){var e=tn(),n=e.queue;if(n===null)throw Error(M(311));n.lastRenderedReducer=t;var r=je,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var a=o=null,l=null,u=s;do{var c=u.lane;if((Di&c)===c)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:t(r,u.action);else{var h={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=h,o=r):l=l.next=h,ke.lanes|=c,Mi|=c}u=u.next}while(u!==null&&u!==s);l===null?o=r:l.next=a,hn(r,e.memoizedState)||(Ot=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do s=i.lane,ke.lanes|=s,Mi|=s,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Ep(t){var e=tn(),n=e.queue;if(n===null)throw Error(M(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,s=e.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=t(s,o.action),o=o.next;while(o!==i);hn(s,e.memoizedState)||(Ot=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function H_(){}function G_(t,e){var n=ke,r=tn(),i=e(),s=!hn(r.memoizedState,i);if(s&&(r.memoizedState=i,Ot=!0),r=r.queue,xp(q_.bind(null,n,r,t),[t]),r.getSnapshot!==e||s||Qe!==null&&Qe.memoizedState.tag&1){if(n.flags|=2048,La(9,Q_.bind(null,n,r,i,e),void 0,null),qe===null)throw Error(M(349));Di&30||W_(n,e,i)}return i}function W_(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=ke.updateQueue,e===null?(e={lastEffect:null,stores:null},ke.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Q_(t,e,n,r){e.value=n,e.getSnapshot=r,K_(e)&&Y_(t)}function q_(t,e,n){return n(function(){K_(e)&&Y_(t)})}function K_(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!hn(t,n)}catch{return!0}}function Y_(t){var e=ar(t,1);e!==null&&mn(e,t,1,-1)}function X_(t){var e=Pn();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:t},e.queue=t,t=t.dispatch=dR.bind(null,ke,t),[e.memoizedState,t]}function La(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=ke.updateQueue,e===null?(e={lastEffect:null,stores:null},ke.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function J_(){return tn().memoizedState}function mc(t,e,n,r){var i=Pn();ke.flags|=t,i.memoizedState=La(1|e,n,void 0,r===void 0?null:r)}function vc(t,e,n,r){var i=tn();r=r===void 0?null:r;var s=void 0;if(je!==null){var o=je.memoizedState;if(s=o.destroy,r!==null&&vp(r,o.deps)){i.memoizedState=La(e,n,s,r);return}}ke.flags|=t,i.memoizedState=La(1|e,n,s,r)}function Z_(t,e){return mc(8390656,8,t,e)}function xp(t,e){return vc(2048,8,t,e)}function ew(t,e){return vc(4,2,t,e)}function tw(t,e){return vc(4,4,t,e)}function nw(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function rw(t,e,n){return n=n!=null?n.concat([t]):null,vc(4,4,nw.bind(null,e,t),n)}function Sp(){}function iw(t,e){var n=tn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&vp(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function sw(t,e){var n=tn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&vp(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function ow(t,e,n){return Di&21?(hn(n,e)||(n=Ny(),ke.lanes|=n,Mi|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Ot=!0),t.memoizedState=n)}function cR(t,e){var n=ge;ge=n!==0&&4>n?n:4,t(!0);var r=mp.transition;mp.transition={};try{t(!1),e()}finally{ge=n,mp.transition=r}}function aw(){return tn().memoizedState}function hR(t,e,n){var r=Hr(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},lw(t))uw(e,n);else if(n=N_(t,e,n,r),n!==null){var i=Tt();mn(n,t,r,i),cw(n,e,r)}}function dR(t,e,n){var r=Hr(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(lw(t))uw(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,hn(a,o)){var l=e.interleaved;l===null?(i.next=i,lp(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=N_(t,e,i,r),n!==null&&(i=Tt(),mn(n,t,r,i),cw(n,e,r))}}function lw(t){var e=t.alternate;return t===ke||e!==null&&e===ke}function uw(t,e){Oa=gc=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function cw(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Sf(t,n)}}var yc={readContext:en,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useInsertionEffect:ut,useLayoutEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useMutableSource:ut,useSyncExternalStore:ut,useId:ut,unstable_isNewReconciler:!1},fR={readContext:en,useCallback:function(t,e){return Pn().memoizedState=[t,e===void 0?null:e],t},useContext:en,useEffect:Z_,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,mc(4194308,4,nw.bind(null,e,t),n)},useLayoutEffect:function(t,e){return mc(4194308,4,t,e)},useInsertionEffect:function(t,e){return mc(4,2,t,e)},useMemo:function(t,e){var n=Pn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Pn();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=hR.bind(null,ke,t),[r.memoizedState,t]},useRef:function(t){var e=Pn();return t={current:t},e.memoizedState=t},useState:X_,useDebugValue:Sp,useDeferredValue:function(t){return Pn().memoizedState=t},useTransition:function(){var t=X_(!1),e=t[0];return t=cR.bind(null,t[1]),Pn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ke,i=Pn();if(Te){if(n===void 0)throw Error(M(407));n=n()}else{if(n=e(),qe===null)throw Error(M(349));Di&30||W_(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,Z_(q_.bind(null,r,s,t),[t]),r.flags|=2048,La(9,Q_.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=Pn(),e=qe.identifierPrefix;if(Te){var n=or,r=sr;n=(r&~(1<<32-cn(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Da++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=uR++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},pR={readContext:en,useCallback:iw,useContext:en,useEffect:xp,useImperativeHandle:rw,useInsertionEffect:ew,useLayoutEffect:tw,useMemo:sw,useReducer:wp,useRef:J_,useState:function(){return wp(Ma)},useDebugValue:Sp,useDeferredValue:function(t){var e=tn();return ow(e,je.memoizedState,t)},useTransition:function(){var t=wp(Ma)[0],e=tn().memoizedState;return[t,e]},useMutableSource:H_,useSyncExternalStore:G_,useId:aw,unstable_isNewReconciler:!1},gR={readContext:en,useCallback:iw,useContext:en,useEffect:xp,useImperativeHandle:rw,useInsertionEffect:ew,useLayoutEffect:tw,useMemo:sw,useReducer:Ep,useRef:J_,useState:function(){return Ep(Ma)},useDebugValue:Sp,useDeferredValue:function(t){var e=tn();return je===null?e.memoizedState=t:ow(e,je.memoizedState,t)},useTransition:function(){var t=Ep(Ma)[0],e=tn().memoizedState;return[t,e]},useMutableSource:H_,useSyncExternalStore:G_,useId:aw,unstable_isNewReconciler:!1};function Ws(t,e){try{var n="",r=e;do n+=BC(r),r=r.return;while(r);var i=n}catch(s){i=`
Error generating stack: `+s.message+`
`+s.stack}return{value:t,source:e,stack:i,digest:null}}function Ip(t,e,n){return{value:t,source:null,stack:n!=null?n:null,digest:e!=null?e:null}}function Ap(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var mR=typeof WeakMap=="function"?WeakMap:Map;function hw(t,e,n){n=lr(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Ac||(Ac=!0,$p=r),Ap(t,e)},n}function dw(t,e,n){n=lr(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){Ap(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Ap(t,e),typeof r!="function"&&(zr===null?zr=new Set([this]):zr.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function fw(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new mR;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=kR.bind(null,t,e,n),e.then(t,t))}function pw(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function gw(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=lr(-1,1),e.tag=2,$r(n,e,1))),n.lanes|=1),t)}var vR=nr.ReactCurrentOwner,Ot=!1;function At(t,e,n,r){e.child=t===null?z_(e,null,n,r):Hs(e,t.child,n,r)}function mw(t,e,n,r,i){n=n.render;var s=e.ref;return Bs(e,i),r=yp(t,e,n,r,s,i),n=_p(),t!==null&&!Ot?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,ur(t,e,i)):(Te&&n&&Zf(e),e.flags|=1,At(t,e,r,i),e.child)}function vw(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!Qp(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,yw(t,e,s,r,i)):(t=Pc(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:xa,n(o,r)&&t.ref===e.ref)return ur(t,e,i)}return e.flags|=1,t=Wr(s,r),t.ref=e.ref,t.return=e,e.child=t}function yw(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(xa(s,r)&&t.ref===e.ref)if(Ot=!1,e.pendingProps=r=s,(t.lanes&i)!==0)t.flags&131072&&(Ot=!0);else return e.lanes=t.lanes,ur(t,e,i)}return Tp(t,e,n,r,i)}function _w(t,e,n){var r=e.pendingProps,i=r.children,s=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},we(qs,Wt),Wt|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,we(qs,Wt),Wt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,we(qs,Wt),Wt|=r}else s!==null?(r=s.baseLanes|n,e.memoizedState=null):r=n,we(qs,Wt),Wt|=r;return At(t,e,i,n),e.child}function ww(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Tp(t,e,n,r,i){var s=Nt(n)?Ri:lt.current;return s=Fs(e,s),Bs(e,i),n=yp(t,e,n,r,s,i),r=_p(),t!==null&&!Ot?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,ur(t,e,i)):(Te&&r&&Zf(e),e.flags|=1,At(t,e,n,i),e.child)}function Ew(t,e,n,r,i){if(Nt(n)){var s=!0;nc(e)}else s=!1;if(Bs(e,i),e.stateNode===null)wc(t,e),F_(e,n,r),hp(e,n,r,i),r=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=en(u):(u=Nt(n)?Ri:lt.current,u=Fs(e,u));var c=n.getDerivedStateFromProps,h=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==u)&&U_(e,o,r,u),Ur=!1;var d=e.memoizedState;o.state=d,cc(e,r,o,i),l=e.memoizedState,a!==r||d!==l||Pt.current||Ur?(typeof c=="function"&&(cp(e,n,c,r),l=e.memoizedState),(a=Ur||V_(e,n,a,r,d,l,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),o.props=r,o.state=l,o.context=u,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,O_(t,e),a=e.memoizedProps,u=e.type===e.elementType?a:fn(e.type,a),o.props=u,h=e.pendingProps,d=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=en(l):(l=Nt(n)?Ri:lt.current,l=Fs(e,l));var f=n.getDerivedStateFromProps;(c=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||d!==l)&&U_(e,o,r,l),Ur=!1,d=e.memoizedState,o.state=d,cc(e,r,o,i);var g=e.memoizedState;a!==h||d!==g||Pt.current||Ur?(typeof f=="function"&&(cp(e,n,f,r),g=e.memoizedState),(u=Ur||V_(e,n,u,r,d,g,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=g),o.props=r,o.state=g,o.context=l,r=u):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),r=!1)}return Cp(t,e,n,r,s,i)}function Cp(t,e,n,r,i,s){ww(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&A_(e,n,!1),ur(t,e,s);r=e.stateNode,vR.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=Hs(e,t.child,null,s),e.child=Hs(e,null,a,s)):At(t,e,a,s),e.memoizedState=r.state,i&&A_(e,n,!0),e.child}function xw(t){var e=t.stateNode;e.pendingContext?S_(t,e.pendingContext,e.pendingContext!==e.context):e.context&&S_(t,e.context,!1),dp(t,e.containerInfo)}function Sw(t,e,n,r,i){return js(),rp(i),e.flags|=256,At(t,e,n,r),e.child}var bp={dehydrated:null,treeContext:null,retryLane:0};function Rp(t){return{baseLanes:t,cachePool:null,transitions:null}}function Iw(t,e,n){var r=e.pendingProps,i=Re.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),we(Re,i&1),t===null)return np(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,s?(r=e.mode,s=e.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Nc(o,r,0,null),t=Ui(t,r,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=Rp(n),e.memoizedState=bp,t):kp(e,o));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return yR(t,e,o,r,a,i,n);if(s){s=r.fallback,o=e.mode,i=t.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=Wr(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=Wr(a,s):(s=Ui(s,o,n,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,o=t.child.memoizedState,o=o===null?Rp(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~n,e.memoizedState=bp,r}return s=t.child,t=s.sibling,r=Wr(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function kp(t,e){return e=Nc({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function _c(t,e,n,r){return r!==null&&rp(r),Hs(e,t.child,null,n),t=kp(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function yR(t,e,n,r,i,s,o){if(n)return e.flags&256?(e.flags&=-257,r=Ip(Error(M(422))),_c(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=Nc({mode:"visible",children:r.children},i,0,null),s=Ui(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&Hs(e,t.child,null,o),e.child.memoizedState=Rp(o),e.memoizedState=bp,s);if(!(e.mode&1))return _c(t,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(M(419)),r=Ip(s,r,void 0),_c(t,e,o,r)}if(a=(o&t.childLanes)!==0,Ot||a){if(r=qe,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,ar(t,i),mn(r,t,i,-1))}return Wp(),r=Ip(Error(M(421))),_c(t,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=PR.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,Gt=Mr(i.nextSibling),Ht=e,Te=!0,dn=null,t!==null&&(Jt[Zt++]=sr,Jt[Zt++]=or,Jt[Zt++]=ki,sr=t.id,or=t.overflow,ki=e),e=kp(e,r.children),e.flags|=4096,e)}function Aw(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),ap(t.return,e,n)}function Pp(t,e,n,r,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function Tw(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(At(t,e,r.children,n),r=Re.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Aw(t,n,e);else if(t.tag===19)Aw(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(we(Re,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&fc(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),Pp(e,!1,i,n,s);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&fc(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}Pp(e,!0,n,null,s);break;case"together":Pp(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function wc(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function ur(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Mi|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(M(153));if(e.child!==null){for(t=e.child,n=Wr(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Wr(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function _R(t,e,n){switch(e.tag){case 3:xw(e),js();break;case 5:B_(e);break;case 1:Nt(e.type)&&nc(e);break;case 4:dp(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;we(ac,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(we(Re,Re.current&1),e.flags|=128,null):n&e.child.childLanes?Iw(t,e,n):(we(Re,Re.current&1),t=ur(t,e,n),t!==null?t.sibling:null);we(Re,Re.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return Tw(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),we(Re,Re.current),r)break;return null;case 22:case 23:return e.lanes=0,_w(t,e,n)}return ur(t,e,n)}var Cw,Np,bw,Rw;Cw=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Np=function(){},bw=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,Oi(kn.current);var s=null;switch(n){case"input":i=af(t,i),r=af(t,r),s=[];break;case"select":i=be({},i,{value:void 0}),r=be({},r,{value:void 0}),s=[];break;case"textarea":i=cf(t,i),r=cf(t,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Zu)}df(n,r);var o;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var a=i[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(ta.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(a=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(s||(s=[]),s.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(ta.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&xe("scroll",t),s||a===l||(s=[])):(s=s||[]).push(u,l))}n&&(s=s||[]).push("style",n);var u=s;(e.updateQueue=u)&&(e.flags|=4)}},Rw=function(t,e,n,r){n!==r&&(e.flags|=4)};function Va(t,e){if(!Te)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function ct(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function wR(t,e,n){var r=e.pendingProps;switch(ep(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(e),null;case 1:return Nt(e.type)&&tc(),ct(e),null;case 3:return r=e.stateNode,Gs(),Se(Pt),Se(lt),gp(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(oc(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,dn!==null&&(Bp(dn),dn=null))),Np(t,e),ct(e),null;case 5:fp(e);var i=Oi(Na.current);if(n=e.type,t!==null&&e.stateNode!=null)bw(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(M(166));return ct(e),null}if(t=Oi(kn.current),oc(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[Rn]=e,r[Ca]=s,t=(e.mode&1)!==0,n){case"dialog":xe("cancel",r),xe("close",r);break;case"iframe":case"object":case"embed":xe("load",r);break;case"video":case"audio":for(i=0;i<Ia.length;i++)xe(Ia[i],r);break;case"source":xe("error",r);break;case"img":case"image":case"link":xe("error",r),xe("load",r);break;case"details":xe("toggle",r);break;case"input":ly(r,s),xe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},xe("invalid",r);break;case"textarea":hy(r,s),xe("invalid",r)}df(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Ju(r.textContent,a,t),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Ju(r.textContent,a,t),i=["children",""+a]):ta.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&xe("scroll",r)}switch(n){case"input":Ru(r),cy(r,s,!0);break;case"textarea":Ru(r),fy(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Zu)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=py(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Rn]=e,t[Ca]=r,Cw(t,e,!1,!1),e.stateNode=t;e:{switch(o=ff(n,r),n){case"dialog":xe("cancel",t),xe("close",t),i=r;break;case"iframe":case"object":case"embed":xe("load",t),i=r;break;case"video":case"audio":for(i=0;i<Ia.length;i++)xe(Ia[i],t);i=r;break;case"source":xe("error",t),i=r;break;case"img":case"image":case"link":xe("error",t),xe("load",t),i=r;break;case"details":xe("toggle",t),i=r;break;case"input":ly(t,r),i=af(t,r),xe("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=be({},r,{value:void 0}),xe("invalid",t);break;case"textarea":hy(t,r),i=cf(t,r),xe("invalid",t);break;default:i=r}df(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?vy(t,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&gy(t,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&sa(t,l):typeof l=="number"&&sa(t,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(ta.hasOwnProperty(s)?l!=null&&s==="onScroll"&&xe("scroll",t):l!=null&&Kd(t,s,l,o))}switch(n){case"input":Ru(t),cy(t,r,!1);break;case"textarea":Ru(t),fy(t);break;case"option":r.value!=null&&t.setAttribute("value",""+br(r.value));break;case"select":t.multiple=!!r.multiple,s=r.value,s!=null?Ts(t,!!r.multiple,s,!1):r.defaultValue!=null&&Ts(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=Zu)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return ct(e),null;case 6:if(t&&e.stateNode!=null)Rw(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(M(166));if(n=Oi(Na.current),Oi(kn.current),oc(e)){if(r=e.stateNode,n=e.memoizedProps,r[Rn]=e,(s=r.nodeValue!==n)&&(t=Ht,t!==null))switch(t.tag){case 3:Ju(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Ju(r.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Rn]=e,e.stateNode=r}return ct(e),null;case 13:if(Se(Re),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Te&&Gt!==null&&e.mode&1&&!(e.flags&128))P_(),js(),e.flags|=98560,s=!1;else if(s=oc(e),r!==null&&r.dehydrated!==null){if(t===null){if(!s)throw Error(M(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(M(317));s[Rn]=e}else js(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;ct(e),s=!1}else dn!==null&&(Bp(dn),dn=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||Re.current&1?ze===0&&(ze=3):Wp())),e.updateQueue!==null&&(e.flags|=4),ct(e),null);case 4:return Gs(),Np(t,e),t===null&&Aa(e.stateNode.containerInfo),ct(e),null;case 10:return op(e.type._context),ct(e),null;case 17:return Nt(e.type)&&tc(),ct(e),null;case 19:if(Se(Re),s=e.memoizedState,s===null)return ct(e),null;if(r=(e.flags&128)!==0,o=s.rendering,o===null)if(r)Va(s,!1);else{if(ze!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=fc(t),o!==null){for(e.flags|=128,Va(s,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)s=n,t=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,t=o.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return we(Re,Re.current&1|2),e.child}t=t.sibling}s.tail!==null&&Me()>Ks&&(e.flags|=128,r=!0,Va(s,!1),e.lanes=4194304)}else{if(!r)if(t=fc(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Va(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Te)return ct(e),null}else 2*Me()-s.renderingStartTime>Ks&&n!==1073741824&&(e.flags|=128,r=!0,Va(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Me(),e.sibling=null,n=Re.current,we(Re,r?n&1|2:n&1),e):(ct(e),null);case 22:case 23:return Gp(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Wt&1073741824&&(ct(e),e.subtreeFlags&6&&(e.flags|=8192)):ct(e),null;case 24:return null;case 25:return null}throw Error(M(156,e.tag))}function ER(t,e){switch(ep(e),e.tag){case 1:return Nt(e.type)&&tc(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Gs(),Se(Pt),Se(lt),gp(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return fp(e),null;case 13:if(Se(Re),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(M(340));js()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Se(Re),null;case 4:return Gs(),null;case 10:return op(e.type._context),null;case 22:case 23:return Gp(),null;case 24:return null;default:return null}}var Ec=!1,ht=!1,xR=typeof WeakSet=="function"?WeakSet:Set,G=null;function Qs(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ne(t,e,r)}else n.current=null}function Op(t,e,n){try{n()}catch(r){Ne(t,e,r)}}var kw=!1;function SR(t,e){if(Gf=ju,t=a_(),Vf(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,c=0,h=t,d=null;t:for(;;){for(var f;h!==n||i!==0&&h.nodeType!==3||(a=o+i),h!==s||r!==0&&h.nodeType!==3||(l=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(f=h.firstChild)!==null;)d=h,h=f;for(;;){if(h===t)break t;if(d===n&&++u===i&&(a=o),d===s&&++c===r&&(l=o),(f=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=f}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Wf={focusedElem:t,selectionRange:n},ju=!1,G=e;G!==null;)if(e=G,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,G=t;else for(;G!==null;){e=G;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,w=g.memoizedState,v=e.stateNode,y=v.getSnapshotBeforeUpdate(e.elementType===e.type?m:fn(e.type,m),w);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(M(163))}}catch(E){Ne(e,e.return,E)}if(t=e.sibling,t!==null){t.return=e.return,G=t;break}G=e.return}return g=kw,kw=!1,g}function Fa(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&Op(e,n,s)}i=i.next}while(i!==r)}}function xc(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Dp(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function Pw(t){var e=t.alternate;e!==null&&(t.alternate=null,Pw(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Rn],delete e[Ca],delete e[Yf],delete e[sR],delete e[oR])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Nw(t){return t.tag===5||t.tag===3||t.tag===4}function Ow(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Nw(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Mp(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Zu));else if(r!==4&&(t=t.child,t!==null))for(Mp(t,e,n),t=t.sibling;t!==null;)Mp(t,e,n),t=t.sibling}function Lp(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Lp(t,e,n),t=t.sibling;t!==null;)Lp(t,e,n),t=t.sibling}var et=null,pn=!1;function jr(t,e,n){for(n=n.child;n!==null;)Dw(t,e,n),n=n.sibling}function Dw(t,e,n){if(bn&&typeof bn.onCommitFiberUnmount=="function")try{bn.onCommitFiberUnmount(Mu,n)}catch{}switch(n.tag){case 5:ht||Qs(n,e);case 6:var r=et,i=pn;et=null,jr(t,e,n),et=r,pn=i,et!==null&&(pn?(t=et,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):et.removeChild(n.stateNode));break;case 18:et!==null&&(pn?(t=et,n=n.stateNode,t.nodeType===8?Kf(t.parentNode,n):t.nodeType===1&&Kf(t,n),ma(t)):Kf(et,n.stateNode));break;case 4:r=et,i=pn,et=n.stateNode.containerInfo,pn=!0,jr(t,e,n),et=r,pn=i;break;case 0:case 11:case 14:case 15:if(!ht&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Op(n,e,o),i=i.next}while(i!==r)}jr(t,e,n);break;case 1:if(!ht&&(Qs(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Ne(n,e,a)}jr(t,e,n);break;case 21:jr(t,e,n);break;case 22:n.mode&1?(ht=(r=ht)||n.memoizedState!==null,jr(t,e,n),ht=r):jr(t,e,n);break;default:jr(t,e,n)}}function Mw(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new xR),e.forEach(function(r){var i=NR.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function gn(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:et=a.stateNode,pn=!1;break e;case 3:et=a.stateNode.containerInfo,pn=!0;break e;case 4:et=a.stateNode.containerInfo,pn=!0;break e}a=a.return}if(et===null)throw Error(M(160));Dw(s,o,i),et=null,pn=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(u){Ne(i,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Lw(e,t),e=e.sibling}function Lw(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(gn(e,t),Nn(t),r&4){try{Fa(3,t,t.return),xc(3,t)}catch(m){Ne(t,t.return,m)}try{Fa(5,t,t.return)}catch(m){Ne(t,t.return,m)}}break;case 1:gn(e,t),Nn(t),r&512&&n!==null&&Qs(n,n.return);break;case 5:if(gn(e,t),Nn(t),r&512&&n!==null&&Qs(n,n.return),t.flags&32){var i=t.stateNode;try{sa(i,"")}catch(m){Ne(t,t.return,m)}}if(r&4&&(i=t.stateNode,i!=null)){var s=t.memoizedProps,o=n!==null?n.memoizedProps:s,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&uy(i,s),ff(a,o);var u=ff(a,s);for(o=0;o<l.length;o+=2){var c=l[o],h=l[o+1];c==="style"?vy(i,h):c==="dangerouslySetInnerHTML"?gy(i,h):c==="children"?sa(i,h):Kd(i,c,h,u)}switch(a){case"input":lf(i,s);break;case"textarea":dy(i,s);break;case"select":var d=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var f=s.value;f!=null?Ts(i,!!s.multiple,f,!1):d!==!!s.multiple&&(s.defaultValue!=null?Ts(i,!!s.multiple,s.defaultValue,!0):Ts(i,!!s.multiple,s.multiple?[]:"",!1))}i[Ca]=s}catch(m){Ne(t,t.return,m)}}break;case 6:if(gn(e,t),Nn(t),r&4){if(t.stateNode===null)throw Error(M(162));i=t.stateNode,s=t.memoizedProps;try{i.nodeValue=s}catch(m){Ne(t,t.return,m)}}break;case 3:if(gn(e,t),Nn(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ma(e.containerInfo)}catch(m){Ne(t,t.return,m)}break;case 4:gn(e,t),Nn(t);break;case 13:gn(e,t),Nn(t),i=t.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Up=Me())),r&4&&Mw(t);break;case 22:if(c=n!==null&&n.memoizedState!==null,t.mode&1?(ht=(u=ht)||c,gn(e,t),ht=u):gn(e,t),Nn(t),r&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!c&&t.mode&1)for(G=t,c=t.child;c!==null;){for(h=G=c;G!==null;){switch(d=G,f=d.child,d.tag){case 0:case 11:case 14:case 15:Fa(4,d,d.return);break;case 1:Qs(d,d.return);var g=d.stateNode;if(typeof g.componentWillUnmount=="function"){r=d,n=d.return;try{e=r,g.props=e.memoizedProps,g.state=e.memoizedState,g.componentWillUnmount()}catch(m){Ne(r,n,m)}}break;case 5:Qs(d,d.return);break;case 22:if(d.memoizedState!==null){Uw(h);continue}}f!==null?(f.return=d,G=f):Uw(h)}c=c.sibling}e:for(c=null,h=t;;){if(h.tag===5){if(c===null){c=h;try{i=h.stateNode,u?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=h.stateNode,l=h.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=my("display",o))}catch(m){Ne(t,t.return,m)}}}else if(h.tag===6){if(c===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(m){Ne(t,t.return,m)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;c===h&&(c=null),h=h.return}c===h&&(c=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:gn(e,t),Nn(t),r&4&&Mw(t);break;case 21:break;default:gn(e,t),Nn(t)}}function Nn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(Nw(n)){var r=n;break e}n=n.return}throw Error(M(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(sa(i,""),r.flags&=-33);var s=Ow(t);Lp(t,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=Ow(t);Mp(t,a,o);break;default:throw Error(M(161))}}catch(l){Ne(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function IR(t,e,n){G=t,Vw(t)}function Vw(t,e,n){for(var r=(t.mode&1)!==0;G!==null;){var i=G,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Ec;if(!o){var a=i.alternate,l=a!==null&&a.memoizedState!==null||ht;a=Ec;var u=ht;if(Ec=o,(ht=l)&&!u)for(G=i;G!==null;)o=G,l=o.child,o.tag===22&&o.memoizedState!==null?$w(i):l!==null?(l.return=o,G=l):$w(i);for(;s!==null;)G=s,Vw(s),s=s.sibling;G=i,Ec=a,ht=u}Fw(t)}else i.subtreeFlags&8772&&s!==null?(s.return=i,G=s):Fw(t)}}function Fw(t){for(;G!==null;){var e=G;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:ht||xc(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!ht)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:fn(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&M_(e,s,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}M_(e,o,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var h=c.dehydrated;h!==null&&ma(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(M(163))}ht||e.flags&512&&Dp(e)}catch(d){Ne(e,e.return,d)}}if(e===t){G=null;break}if(n=e.sibling,n!==null){n.return=e.return,G=n;break}G=e.return}}function Uw(t){for(;G!==null;){var e=G;if(e===t){G=null;break}var n=e.sibling;if(n!==null){n.return=e.return,G=n;break}G=e.return}}function $w(t){for(;G!==null;){var e=G;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{xc(4,e)}catch(l){Ne(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){Ne(e,i,l)}}var s=e.return;try{Dp(e)}catch(l){Ne(e,s,l)}break;case 5:var o=e.return;try{Dp(e)}catch(l){Ne(e,o,l)}}}catch(l){Ne(e,e.return,l)}if(e===t){G=null;break}var a=e.sibling;if(a!==null){a.return=e.return,G=a;break}G=e.return}}var AR=Math.ceil,Sc=nr.ReactCurrentDispatcher,Vp=nr.ReactCurrentOwner,nn=nr.ReactCurrentBatchConfig,de=0,qe=null,Le=null,tt=0,Wt=0,qs=Lr(0),ze=0,Ua=null,Mi=0,Ic=0,Fp=0,$a=null,Dt=null,Up=0,Ks=1/0,cr=null,Ac=!1,$p=null,zr=null,Tc=!1,Br=null,Cc=0,ja=0,jp=null,bc=-1,Rc=0;function Tt(){return de&6?Me():bc!==-1?bc:bc=Me()}function Hr(t){return t.mode&1?de&2&&tt!==0?tt&-tt:lR.transition!==null?(Rc===0&&(Rc=Ny()),Rc):(t=ge,t!==0||(t=window.event,t=t===void 0?16:jy(t.type)),t):1}function mn(t,e,n,r){if(50<ja)throw ja=0,jp=null,Error(M(185));ha(t,n,r),(!(de&2)||t!==qe)&&(t===qe&&(!(de&2)&&(Ic|=n),ze===4&&Gr(t,tt)),Mt(t,r),n===1&&de===0&&!(e.mode&1)&&(Ks=Me()+500,rc&&Fr()))}function Mt(t,e){var n=t.callbackNode;lb(t,e);var r=Fu(t,t===qe?tt:0);if(r===0)n!==null&&Ry(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Ry(n),e===1)t.tag===0?aR(zw.bind(null,t)):T_(zw.bind(null,t)),rR(function(){!(de&6)&&Fr()}),n=null;else{switch(Oy(r)){case 1:n=wf;break;case 4:n=ky;break;case 16:n=Du;break;case 536870912:n=Py;break;default:n=Du}n=Yw(n,jw.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function jw(t,e){if(bc=-1,Rc=0,de&6)throw Error(M(327));var n=t.callbackNode;if(Ys()&&t.callbackNode!==n)return null;var r=Fu(t,t===qe?tt:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=kc(t,r);else{e=r;var i=de;de|=2;var s=Hw();(qe!==t||tt!==e)&&(cr=null,Ks=Me()+500,Vi(t,e));do try{bR();break}catch(a){Bw(t,a)}while(!0);sp(),Sc.current=s,de=i,Le!==null?e=0:(qe=null,tt=0,e=ze)}if(e!==0){if(e===2&&(i=Ef(t),i!==0&&(r=i,e=zp(t,i))),e===1)throw n=Ua,Vi(t,0),Gr(t,r),Mt(t,Me()),n;if(e===6)Gr(t,r);else{if(i=t.current.alternate,!(r&30)&&!TR(i)&&(e=kc(t,r),e===2&&(s=Ef(t),s!==0&&(r=s,e=zp(t,s))),e===1))throw n=Ua,Vi(t,0),Gr(t,r),Mt(t,Me()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(M(345));case 2:Fi(t,Dt,cr);break;case 3:if(Gr(t,r),(r&130023424)===r&&(e=Up+500-Me(),10<e)){if(Fu(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){Tt(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=qf(Fi.bind(null,t,Dt,cr),e);break}Fi(t,Dt,cr);break;case 4:if(Gr(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var o=31-cn(r);s=1<<o,o=e[o],o>i&&(i=o),r&=~s}if(r=i,r=Me()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*AR(r/1960))-r,10<r){t.timeoutHandle=qf(Fi.bind(null,t,Dt,cr),r);break}Fi(t,Dt,cr);break;case 5:Fi(t,Dt,cr);break;default:throw Error(M(329))}}}return Mt(t,Me()),t.callbackNode===n?jw.bind(null,t):null}function zp(t,e){var n=$a;return t.current.memoizedState.isDehydrated&&(Vi(t,e).flags|=256),t=kc(t,e),t!==2&&(e=Dt,Dt=n,e!==null&&Bp(e)),t}function Bp(t){Dt===null?Dt=t:Dt.push.apply(Dt,t)}function TR(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!hn(s(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Gr(t,e){for(e&=~Fp,e&=~Ic,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-cn(e),r=1<<n;t[n]=-1,e&=~r}}function zw(t){if(de&6)throw Error(M(327));Ys();var e=Fu(t,0);if(!(e&1))return Mt(t,Me()),null;var n=kc(t,e);if(t.tag!==0&&n===2){var r=Ef(t);r!==0&&(e=r,n=zp(t,r))}if(n===1)throw n=Ua,Vi(t,0),Gr(t,e),Mt(t,Me()),n;if(n===6)throw Error(M(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Fi(t,Dt,cr),Mt(t,Me()),null}function Hp(t,e){var n=de;de|=1;try{return t(e)}finally{de=n,de===0&&(Ks=Me()+500,rc&&Fr())}}function Li(t){Br!==null&&Br.tag===0&&!(de&6)&&Ys();var e=de;de|=1;var n=nn.transition,r=ge;try{if(nn.transition=null,ge=1,t)return t()}finally{ge=r,nn.transition=n,de=e,!(de&6)&&Fr()}}function Gp(){Wt=qs.current,Se(qs)}function Vi(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,nR(n)),Le!==null)for(n=Le.return;n!==null;){var r=n;switch(ep(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&tc();break;case 3:Gs(),Se(Pt),Se(lt),gp();break;case 5:fp(r);break;case 4:Gs();break;case 13:Se(Re);break;case 19:Se(Re);break;case 10:op(r.type._context);break;case 22:case 23:Gp()}n=n.return}if(qe=t,Le=t=Wr(t.current,null),tt=Wt=e,ze=0,Ua=null,Fp=Ic=Mi=0,Dt=$a=null,Ni!==null){for(e=0;e<Ni.length;e++)if(n=Ni[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}Ni=null}return t}function Bw(t,e){do{var n=Le;try{if(sp(),pc.current=yc,gc){for(var r=ke.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}gc=!1}if(Di=0,Qe=je=ke=null,Oa=!1,Da=0,Vp.current=null,n===null||n.return===null){ze=1,Ua=e,Le=null;break}e:{var s=t,o=n.return,a=n,l=e;if(e=tt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,c=a,h=c.tag;if(!(c.mode&1)&&(h===0||h===11||h===15)){var d=c.alternate;d?(c.updateQueue=d.updateQueue,c.memoizedState=d.memoizedState,c.lanes=d.lanes):(c.updateQueue=null,c.memoizedState=null)}var f=pw(o);if(f!==null){f.flags&=-257,gw(f,o,a,s,e),f.mode&1&&fw(s,u,e),e=f,l=u;var g=e.updateQueue;if(g===null){var m=new Set;m.add(l),e.updateQueue=m}else g.add(l);break e}else{if(!(e&1)){fw(s,u,e),Wp();break e}l=Error(M(426))}}else if(Te&&a.mode&1){var w=pw(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),gw(w,o,a,s,e),rp(Ws(l,a));break e}}s=l=Ws(l,a),ze!==4&&(ze=2),$a===null?$a=[s]:$a.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var v=hw(s,l,e);D_(s,v);break e;case 1:a=l;var y=s.type,_=s.stateNode;if(!(s.flags&128)&&(typeof y.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(zr===null||!zr.has(_)))){s.flags|=65536,e&=-e,s.lanes|=e;var E=dw(s,a,e);D_(s,E);break e}}s=s.return}while(s!==null)}Ww(n)}catch(I){e=I,Le===n&&n!==null&&(Le=n=n.return);continue}break}while(!0)}function Hw(){var t=Sc.current;return Sc.current=yc,t===null?yc:t}function Wp(){(ze===0||ze===3||ze===2)&&(ze=4),qe===null||!(Mi&268435455)&&!(Ic&268435455)||Gr(qe,tt)}function kc(t,e){var n=de;de|=2;var r=Hw();(qe!==t||tt!==e)&&(cr=null,Vi(t,e));do try{CR();break}catch(i){Bw(t,i)}while(!0);if(sp(),de=n,Sc.current=r,Le!==null)throw Error(M(261));return qe=null,tt=0,ze}function CR(){for(;Le!==null;)Gw(Le)}function bR(){for(;Le!==null&&!ZC();)Gw(Le)}function Gw(t){var e=Kw(t.alternate,t,Wt);t.memoizedProps=t.pendingProps,e===null?Ww(t):Le=e,Vp.current=null}function Ww(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=ER(n,e),n!==null){n.flags&=32767,Le=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{ze=6,Le=null;return}}else if(n=wR(n,e,Wt),n!==null){Le=n;return}if(e=e.sibling,e!==null){Le=e;return}Le=e=t}while(e!==null);ze===0&&(ze=5)}function Fi(t,e,n){var r=ge,i=nn.transition;try{nn.transition=null,ge=1,RR(t,e,n,r)}finally{nn.transition=i,ge=r}return null}function RR(t,e,n,r){do Ys();while(Br!==null);if(de&6)throw Error(M(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(M(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(ub(t,s),t===qe&&(Le=qe=null,tt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Tc||(Tc=!0,Yw(Du,function(){return Ys(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=nn.transition,nn.transition=null;var o=ge;ge=1;var a=de;de|=4,Vp.current=null,SR(t,n),Lw(n,t),Kb(Wf),ju=!!Gf,Wf=Gf=null,t.current=n,IR(n),eb(),de=a,ge=o,nn.transition=s}else t.current=n;if(Tc&&(Tc=!1,Br=t,Cc=i),s=t.pendingLanes,s===0&&(zr=null),rb(n.stateNode),Mt(t,Me()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Ac)throw Ac=!1,t=$p,$p=null,t;return Cc&1&&t.tag!==0&&Ys(),s=t.pendingLanes,s&1?t===jp?ja++:(ja=0,jp=t):ja=0,Fr(),null}function Ys(){if(Br!==null){var t=Oy(Cc),e=nn.transition,n=ge;try{if(nn.transition=null,ge=16>t?16:t,Br===null)var r=!1;else{if(t=Br,Br=null,Cc=0,de&6)throw Error(M(331));var i=de;for(de|=4,G=t.current;G!==null;){var s=G,o=s.child;if(G.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(G=u;G!==null;){var c=G;switch(c.tag){case 0:case 11:case 15:Fa(8,c,s)}var h=c.child;if(h!==null)h.return=c,G=h;else for(;G!==null;){c=G;var d=c.sibling,f=c.return;if(Pw(c),c===u){G=null;break}if(d!==null){d.return=f,G=d;break}G=f}}}var g=s.alternate;if(g!==null){var m=g.child;if(m!==null){g.child=null;do{var w=m.sibling;m.sibling=null,m=w}while(m!==null)}}G=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,G=o;else e:for(;G!==null;){if(s=G,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Fa(9,s,s.return)}var v=s.sibling;if(v!==null){v.return=s.return,G=v;break e}G=s.return}}var y=t.current;for(G=y;G!==null;){o=G;var _=o.child;if(o.subtreeFlags&2064&&_!==null)_.return=o,G=_;else e:for(o=y;G!==null;){if(a=G,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:xc(9,a)}}catch(I){Ne(a,a.return,I)}if(a===o){G=null;break e}var E=a.sibling;if(E!==null){E.return=a.return,G=E;break e}G=a.return}}if(de=i,Fr(),bn&&typeof bn.onPostCommitFiberRoot=="function")try{bn.onPostCommitFiberRoot(Mu,t)}catch{}r=!0}return r}finally{ge=n,nn.transition=e}}return!1}function Qw(t,e,n){e=Ws(n,e),e=hw(t,e,1),t=$r(t,e,1),e=Tt(),t!==null&&(ha(t,1,e),Mt(t,e))}function Ne(t,e,n){if(t.tag===3)Qw(t,t,n);else for(;e!==null;){if(e.tag===3){Qw(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(zr===null||!zr.has(r))){t=Ws(n,t),t=dw(e,t,1),e=$r(e,t,1),t=Tt(),e!==null&&(ha(e,1,t),Mt(e,t));break}}e=e.return}}function kR(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=Tt(),t.pingedLanes|=t.suspendedLanes&n,qe===t&&(tt&n)===n&&(ze===4||ze===3&&(tt&130023424)===tt&&500>Me()-Up?Vi(t,0):Fp|=n),Mt(t,e)}function qw(t,e){e===0&&(t.mode&1?(e=Vu,Vu<<=1,!(Vu&130023424)&&(Vu=4194304)):e=1);var n=Tt();t=ar(t,e),t!==null&&(ha(t,e,n),Mt(t,n))}function PR(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),qw(t,n)}function NR(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(M(314))}r!==null&&r.delete(e),qw(t,n)}var Kw;Kw=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Pt.current)Ot=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Ot=!1,_R(t,e,n);Ot=!!(t.flags&131072)}else Ot=!1,Te&&e.flags&1048576&&C_(e,sc,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;wc(t,e),t=e.pendingProps;var i=Fs(e,lt.current);Bs(e,n),i=yp(null,e,r,t,i,n);var s=_p();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Nt(r)?(s=!0,nc(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,up(e),i.updater=hc,e.stateNode=i,i._reactInternals=e,hp(e,r,t,n),e=Cp(null,e,r,!0,s,n)):(e.tag=0,Te&&s&&Zf(e),At(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(wc(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=DR(r),t=fn(r,t),i){case 0:e=Tp(null,e,r,t,n);break e;case 1:e=Ew(null,e,r,t,n);break e;case 11:e=mw(null,e,r,t,n);break e;case 14:e=vw(null,e,r,fn(r.type,t),n);break e}throw Error(M(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:fn(r,i),Tp(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:fn(r,i),Ew(t,e,r,i,n);case 3:e:{if(xw(e),t===null)throw Error(M(387));r=e.pendingProps,s=e.memoizedState,i=s.element,O_(t,e),cc(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Ws(Error(M(423)),e),e=Sw(t,e,r,n,i);break e}else if(r!==i){i=Ws(Error(M(424)),e),e=Sw(t,e,r,n,i);break e}else for(Gt=Mr(e.stateNode.containerInfo.firstChild),Ht=e,Te=!0,dn=null,n=z_(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(js(),r===i){e=ur(t,e,n);break e}At(t,e,r,n)}e=e.child}return e;case 5:return B_(e),t===null&&np(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,Qf(r,i)?o=null:s!==null&&Qf(r,s)&&(e.flags|=32),ww(t,e),At(t,e,o,n),e.child;case 6:return t===null&&np(e),null;case 13:return Iw(t,e,n);case 4:return dp(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Hs(e,null,r,n):At(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:fn(r,i),mw(t,e,r,i,n);case 7:return At(t,e,e.pendingProps,n),e.child;case 8:return At(t,e,e.pendingProps.children,n),e.child;case 12:return At(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,we(ac,r._currentValue),r._currentValue=o,s!==null)if(hn(s.value,o)){if(s.children===i.children&&!Pt.current){e=ur(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=lr(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),ap(s.return,n,e),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(M(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),ap(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}At(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Bs(e,n),i=en(i),r=r(i),e.flags|=1,At(t,e,r,n),e.child;case 14:return r=e.type,i=fn(r,e.pendingProps),i=fn(r.type,i),vw(t,e,r,i,n);case 15:return yw(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:fn(r,i),wc(t,e),e.tag=1,Nt(r)?(t=!0,nc(e)):t=!1,Bs(e,n),F_(e,r,i),hp(e,r,i,n),Cp(null,e,r,!0,t,n);case 19:return Tw(t,e,n);case 22:return _w(t,e,n)}throw Error(M(156,e.tag))};function Yw(t,e){return by(t,e)}function OR(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rn(t,e,n,r){return new OR(t,e,n,r)}function Qp(t){return t=t.prototype,!(!t||!t.isReactComponent)}function DR(t){if(typeof t=="function")return Qp(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Jd)return 11;if(t===tf)return 14}return 2}function Wr(t,e){var n=t.alternate;return n===null?(n=rn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Pc(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")Qp(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case As:return Ui(n.children,i,s,e);case Yd:o=8,i|=8;break;case Xd:return t=rn(12,n,e,i|2),t.elementType=Xd,t.lanes=s,t;case Zd:return t=rn(13,n,e,i),t.elementType=Zd,t.lanes=s,t;case ef:return t=rn(19,n,e,i),t.elementType=ef,t.lanes=s,t;case iy:return Nc(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ny:o=10;break e;case ry:o=9;break e;case Jd:o=11;break e;case tf:o=14;break e;case Cr:o=16,r=null;break e}throw Error(M(130,t==null?t:typeof t,""))}return e=rn(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function Ui(t,e,n,r){return t=rn(7,t,r,e),t.lanes=n,t}function Nc(t,e,n,r){return t=rn(22,t,r,e),t.elementType=iy,t.lanes=n,t.stateNode={isHidden:!1},t}function qp(t,e,n){return t=rn(6,t,null,e),t.lanes=n,t}function Kp(t,e,n){return e=rn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function MR(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=xf(0),this.expirationTimes=xf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Yp(t,e,n,r,i,s,o,a,l){return t=new MR(t,e,n,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=rn(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},up(s),t}function LR(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Is,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function Xw(t){if(!t)return Vr;t=t._reactInternals;e:{if(Ci(t)!==t||t.tag!==1)throw Error(M(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Nt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(M(171))}if(t.tag===1){var n=t.type;if(Nt(n))return I_(t,n,e)}return e}function Jw(t,e,n,r,i,s,o,a,l){return t=Yp(n,r,!0,t,i,s,o,a,l),t.context=Xw(null),n=t.current,r=Tt(),i=Hr(n),s=lr(r,i),s.callback=e!=null?e:null,$r(n,s,i),t.current.lanes=i,ha(t,i,r),Mt(t,r),t}function Oc(t,e,n,r){var i=e.current,s=Tt(),o=Hr(i);return n=Xw(n),e.context===null?e.context=n:e.pendingContext=n,e=lr(s,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=$r(i,e,o),t!==null&&(mn(t,i,o,s),uc(t,i,o)),o}function Dc(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Zw(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Xp(t,e){Zw(t,e),(t=t.alternate)&&Zw(t,e)}function VR(){return null}var eE=typeof reportError=="function"?reportError:function(t){console.error(t)};function Jp(t){this._internalRoot=t}Mc.prototype.render=Jp.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(M(409));Oc(t,e,null,null)},Mc.prototype.unmount=Jp.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Li(function(){Oc(null,t,null,null)}),e[rr]=null}};function Mc(t){this._internalRoot=t}Mc.prototype.unstable_scheduleHydration=function(t){if(t){var e=Ly();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Nr.length&&e!==0&&e<Nr[n].priority;n++);Nr.splice(n,0,t),n===0&&Uy(t)}};function Zp(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Lc(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function tE(){}function FR(t,e,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var u=Dc(o);s.call(u)}}var o=Jw(e,r,t,0,null,!1,!1,"",tE);return t._reactRootContainer=o,t[rr]=o.current,Aa(t.nodeType===8?t.parentNode:t),Li(),o}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var u=Dc(l);a.call(u)}}var l=Yp(t,0,!1,null,null,!1,!1,"",tE);return t._reactRootContainer=l,t[rr]=l.current,Aa(t.nodeType===8?t.parentNode:t),Li(function(){Oc(e,l,n,r)}),l}function Vc(t,e,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var l=Dc(o);a.call(l)}}Oc(e,o,t,i)}else o=FR(n,e,t,i,r);return Dc(o)}Dy=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=ca(e.pendingLanes);n!==0&&(Sf(e,n|1),Mt(e,Me()),!(de&6)&&(Ks=Me()+500,Fr()))}break;case 13:Li(function(){var r=ar(t,1);if(r!==null){var i=Tt();mn(r,t,1,i)}}),Xp(t,1)}},If=function(t){if(t.tag===13){var e=ar(t,134217728);if(e!==null){var n=Tt();mn(e,t,134217728,n)}Xp(t,134217728)}},My=function(t){if(t.tag===13){var e=Hr(t),n=ar(t,e);if(n!==null){var r=Tt();mn(n,t,e,r)}Xp(t,e)}},Ly=function(){return ge},Vy=function(t,e){var n=ge;try{return ge=t,e()}finally{ge=n}},mf=function(t,e,n){switch(e){case"input":if(lf(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=ec(r);if(!i)throw Error(M(90));ay(r),lf(r,i)}}}break;case"textarea":dy(t,n);break;case"select":e=n.value,e!=null&&Ts(t,!!n.multiple,e,!1)}},Ey=Hp,xy=Li;var UR={usingClientEntryPoint:!1,Events:[ba,Ls,ec,_y,wy,Hp]},za={findFiberByHostInstance:bi,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},$R={bundleType:za.bundleType,version:za.version,rendererPackageName:za.rendererPackageName,rendererConfig:za.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:nr.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Ty(t),t===null?null:t.stateNode},findFiberByHostInstance:za.findFiberByHostInstance||VR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var Fc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fc.isDisabled&&Fc.supportsFiber)try{Mu=Fc.inject($R),bn=Fc}catch{}}jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=UR,jt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Zp(e))throw Error(M(200));return LR(t,e,null,n)},jt.createRoot=function(t,e){if(!Zp(t))throw Error(M(299));var n=!1,r="",i=eE;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=Yp(t,1,!1,null,null,n,!1,r,i),t[rr]=e.current,Aa(t.nodeType===8?t.parentNode:t),new Jp(e)},jt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(M(188)):(t=Object.keys(t).join(","),Error(M(268,t)));return t=Ty(e),t=t===null?null:t.stateNode,t},jt.flushSync=function(t){return Li(t)},jt.hydrate=function(t,e,n){if(!Lc(e))throw Error(M(200));return Vc(null,t,e,!0,n)},jt.hydrateRoot=function(t,e,n){if(!Zp(t))throw Error(M(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=eE;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=Jw(e,null,t,1,n!=null?n:null,i,!1,s,o),t[rr]=e.current,Aa(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new Mc(e)},jt.render=function(t,e,n){if(!Lc(e))throw Error(M(200));return Vc(null,t,e,!1,n)},jt.unmountComponentAtNode=function(t){if(!Lc(t))throw Error(M(40));return t._reactRootContainer?(Li(function(){Vc(null,null,t,!1,function(){t._reactRootContainer=null,t[rr]=null})}),!0):!1},jt.unstable_batchedUpdates=Hp,jt.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Lc(n))throw Error(M(200));if(t==null||t._reactInternals===void 0)throw Error(M(38));return Vc(t,e,n,!1,r)},jt.version="18.2.0-next-9e3b772b8-20220608";function nE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(nE)}catch(t){console.error(t)}}nE(),K0.exports=jt;var rE=K0.exports,iE,sE=rE;iE=sE.createRoot,sE.hydrateRoot;/**
 * @remix-run/router v1.14.2
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function Uc(){return Uc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Uc.apply(this,arguments)}var Qr;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Qr||(Qr={}));function jR(t){t===void 0&&(t={});let{initialEntries:e=["/"],initialIndex:n,v5Compat:r=!1}=t,i;i=e.map((f,g)=>c(f,typeof f=="string"?null:f.state,g===0?"default":void 0));let s=l(n==null?i.length-1:n),o=Qr.Pop,a=null;function l(f){return Math.min(Math.max(f,0),i.length-1)}function u(){return i[s]}function c(f,g,m){g===void 0&&(g=null);let w=BR(i?u().pathname:"/",f,g,m);return $c(w.pathname.charAt(0)==="/","relative pathnames are not supported in memory history: "+JSON.stringify(f)),w}function h(f){return typeof f=="string"?f:eg(f)}return{get index(){return s},get action(){return o},get location(){return u()},createHref:h,createURL(f){return new URL(h(f),"http://localhost")},encodeLocation(f){let g=typeof f=="string"?$i(f):f;return{pathname:g.pathname||"",search:g.search||"",hash:g.hash||""}},push(f,g){o=Qr.Push;let m=c(f,g);s+=1,i.splice(s,i.length,m),r&&a&&a({action:o,location:m,delta:1})},replace(f,g){o=Qr.Replace;let m=c(f,g);i[s]=m,r&&a&&a({action:o,location:m,delta:0})},go(f){o=Qr.Pop;let g=l(s+f),m=i[g];s=g,a&&a({action:o,location:m,delta:f})},listen(f){return a=f,()=>{a=null}}}}function Be(t,e){if(t===!1||t===null||typeof t=="undefined")throw new Error(e)}function $c(t,e){if(!t){typeof console!="undefined"&&console.warn(e);try{throw new Error(e)}catch{}}}function zR(){return Math.random().toString(36).substr(2,8)}function BR(t,e,n,r){return n===void 0&&(n=null),Uc({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?$i(e):e,{state:n,key:e&&e.key||r||zR()})}function eg(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function $i(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}var oE;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(oE||(oE={}));function aE(t,e,n){n===void 0&&(n="/");let r=typeof e=="string"?$i(e):e,i=tg(r.pathname||"/",n);if(i==null)return null;let s=lE(t);HR(s);let o=null;for(let a=0;o==null&&a<s.length;++a)o=ZR(s[a],n2(i));return o}function lE(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(s,o,a)=>{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(Be(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=qr([r,l.relativePath]),c=n.concat(l);s.children&&s.children.length>0&&(Be(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),lE(s.children,e,c,u)),!(s.path==null&&!s.index)&&e.push({path:u,score:XR(u,s.index),routesMeta:c})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of uE(s.path))i(s,o,l)}),e}function uE(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=uE(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function HR(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:JR(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const GR=/^:[\w-]+$/,WR=3,QR=2,qR=1,KR=10,YR=-2,cE=t=>t==="*";function XR(t,e){let n=t.split("/"),r=n.length;return n.some(cE)&&(r+=YR),e&&(r+=QR),n.filter(i=>!cE(i)).reduce((i,s)=>i+(GR.test(s)?WR:s===""?qR:KR),r)}function JR(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function ZR(t,e){let{routesMeta:n}=t,r={},i="/",s=[];for(let o=0;o<n.length;++o){let a=n[o],l=o===n.length-1,u=i==="/"?e:e.slice(i.length)||"/",c=e2({path:a.relativePath,caseSensitive:a.caseSensitive,end:l},u);if(!c)return null;Object.assign(r,c.params);let h=a.route;s.push({params:r,pathname:qr([i,c.pathname]),pathnameBase:a2(qr([i,c.pathnameBase])),route:h}),c.pathnameBase!=="/"&&(i=qr([i,c.pathnameBase]))}return s}function e2(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=t2(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((u,c,h)=>{let{paramName:d,isOptional:f}=c;if(d==="*"){let m=a[h]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const g=a[h];return f&&!g?u[d]=void 0:u[d]=r2(g||"",d),u},{}),pathname:s,pathnameBase:o,pattern:t}}function t2(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),$c(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=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function n2(t){try{return decodeURI(t)}catch(e){return $c(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function r2(t,e){try{return decodeURIComponent(t)}catch(n){return $c(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+n+").")),t}}function tg(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 i2(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?$i(t):t;return{pathname:n?n.startsWith("/")?n:s2(n,e):e,search:l2(r),hash:u2(i)}}function s2(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function ng(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 o2(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function hE(t,e){let n=o2(t);return e?n.map((r,i)=>i===t.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function dE(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=$i(t):(i=Uc({},t),Be(!i.pathname||!i.pathname.includes("?"),ng("?","pathname","search",i)),Be(!i.pathname||!i.pathname.includes("#"),ng("#","pathname","hash",i)),Be(!i.search||!i.search.includes("#"),ng("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let h=e.length-1;if(!r&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),h-=1;i.pathname=d.join("/")}a=h>=0?e[h]:"/"}let l=i2(i,a),u=o&&o!=="/"&&o.endsWith("/"),c=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const qr=t=>t.join("/").replace(/\/\/+/g,"/"),a2=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),l2=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,u2=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function c2(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const fE=["post","put","patch","delete"];new Set(fE);const h2=["get",...fE];new Set(h2);/**
 * React Router v6.21.3
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function Ba(){return Ba=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ba.apply(this,arguments)}const rg=S.createContext(null),d2=S.createContext(null),ji=S.createContext(null),jc=S.createContext(null),Kr=S.createContext({outlet:null,matches:[],isDataRoute:!1}),pE=S.createContext(null);function f2(t,e){let{relative:n}=e===void 0?{}:e;Ha()||Be(!1);let{basename:r,navigator:i}=S.useContext(ji),{hash:s,pathname:o,search:a}=vE(t,{relative:n}),l=o;return r!=="/"&&(l=o==="/"?r:qr([r,o])),i.createHref({pathname:l,search:a,hash:s})}function Ha(){return S.useContext(jc)!=null}function Ga(){return Ha()||Be(!1),S.useContext(jc).location}function gE(t){S.useContext(ji).static||S.useLayoutEffect(t)}function mE(){let{isDataRoute:t}=S.useContext(Kr);return t?C2():p2()}function p2(){Ha()||Be(!1);let t=S.useContext(rg),{basename:e,future:n,navigator:r}=S.useContext(ji),{matches:i}=S.useContext(Kr),{pathname:s}=Ga(),o=JSON.stringify(hE(i,n.v7_relativeSplatPath)),a=S.useRef(!1);return gE(()=>{a.current=!0}),S.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let h=dE(u,JSON.parse(o),s,c.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:qr([e,h.pathname])),(c.replace?r.replace:r.push)(h,c.state,c)},[e,r,o,s,t])}function g2(){let{matches:t}=S.useContext(Kr),e=t[t.length-1];return e?e.params:{}}function vE(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=S.useContext(ji),{matches:i}=S.useContext(Kr),{pathname:s}=Ga(),o=JSON.stringify(hE(i,r.v7_relativeSplatPath));return S.useMemo(()=>dE(t,JSON.parse(o),s,n==="path"),[t,o,s,n])}function m2(t,e){return v2(t,e)}function v2(t,e,n,r){Ha()||Be(!1);let{navigator:i}=S.useContext(ji),{matches:s}=S.useContext(Kr),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=Ga(),c;if(e){var h;let w=typeof e=="string"?$i(e):e;l==="/"||(h=w.pathname)!=null&&h.startsWith(l)||Be(!1),c=w}else c=u;let d=c.pathname||"/",f=l==="/"?d:d.slice(l.length)||"/",g=aE(t,{pathname:f}),m=x2(g&&g.map(w=>Object.assign({},w,{params:Object.assign({},a,w.params),pathname:qr([l,i.encodeLocation?i.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?l:qr([l,i.encodeLocation?i.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),s,n,r);return e&&m?S.createElement(jc.Provider,{value:{location:Ba({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Qr.Pop}},m):m}function y2(){let t=T2(),e=c2(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},e),n?S.createElement("pre",{style:i},n):null,null)}const _2=S.createElement(y2,null);class w2 extends S.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?S.createElement(Kr.Provider,{value:this.props.routeContext},S.createElement(pE.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function E2(t){let{routeContext:e,match:n,children:r}=t,i=S.useContext(rg);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),S.createElement(Kr.Provider,{value:e},r)}function x2(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var s;if((s=n)!=null&&s.errors)t=n.matches;else return null}let o=t,a=(i=n)==null?void 0:i.errors;if(a!=null){let c=o.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id]));c>=0||Be(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c<o.length;c++){let h=o[c];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=c),h.route.id){let{loaderData:d,errors:f}=n,g=h.route.loader&&d[h.route.id]===void 0&&(!f||f[h.route.id]===void 0);if(h.route.lazy||g){l=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,h,d)=>{let f,g=!1,m=null,w=null;n&&(f=a&&h.route.id?a[h.route.id]:void 0,m=h.route.errorElement||_2,l&&(u<0&&d===0?(b2("route-fallback",!1),g=!0,w=null):u===d&&(g=!0,w=h.route.hydrateFallbackElement||null)));let v=e.concat(o.slice(0,d+1)),y=()=>{let _;return f?_=m:g?_=w:h.route.Component?_=S.createElement(h.route.Component,null):h.route.element?_=h.route.element:_=c,S.createElement(E2,{match:h,routeContext:{outlet:c,matches:v,isDataRoute:n!=null},children:_})};return n&&(h.route.ErrorBoundary||h.route.errorElement||d===0)?S.createElement(w2,{location:n.location,revalidation:n.revalidation,component:m,error:f,children:y(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):y()},null)}var yE=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(yE||{}),zc=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(zc||{});function S2(t){let e=S.useContext(rg);return e||Be(!1),e}function I2(t){let e=S.useContext(d2);return e||Be(!1),e}function A2(t){let e=S.useContext(Kr);return e||Be(!1),e}function _E(t){let e=A2(),n=e.matches[e.matches.length-1];return n.route.id||Be(!1),n.route.id}function T2(){var t;let e=S.useContext(pE),n=I2(zc.UseRouteError),r=_E(zc.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function C2(){let{router:t}=S2(yE.UseNavigateStable),e=_E(zc.UseNavigateStable),n=S.useRef(!1);return gE(()=>{n.current=!0}),S.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Ba({fromRouteId:e},s)))},[t,e])}const wE={};function b2(t,e,n){!e&&!wE[t]&&(wE[t]=!0)}const EE=PC["startTransition"];function R2(t){let{basename:e,children:n,initialEntries:r,initialIndex:i,future:s}=t,o=S.useRef();o.current==null&&(o.current=jR({initialEntries:r,initialIndex:i,v5Compat:!0}));let a=o.current,[l,u]=S.useState({action:a.action,location:a.location}),{v7_startTransition:c}=s||{},h=S.useCallback(d=>{c&&EE?EE(()=>u(d)):u(d)},[u,c]);return S.useLayoutEffect(()=>a.listen(h),[a,h]),S.createElement(k2,{basename:e,children:n,location:l.location,navigationType:l.action,navigator:a,future:s})}function Xs(t){Be(!1)}function k2(t){let{basename:e="/",children:n=null,location:r,navigationType:i=Qr.Pop,navigator:s,static:o=!1,future:a}=t;Ha()&&Be(!1);let l=e.replace(/^\/*/,"/"),u=S.useMemo(()=>({basename:l,navigator:s,static:o,future:Ba({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof r=="string"&&(r=$i(r));let{pathname:c="/",search:h="",hash:d="",state:f=null,key:g="default"}=r,m=S.useMemo(()=>{let w=tg(c,l);return w==null?null:{location:{pathname:w,search:h,hash:d,state:f,key:g},navigationType:i}},[l,c,h,d,f,g,i]);return m==null?null:S.createElement(ji.Provider,{value:u},S.createElement(jc.Provider,{children:n,value:m}))}function P2(t){let{children:e,location:n}=t;return m2(ig(e),n)}new Promise(()=>{});function ig(t,e){e===void 0&&(e=[]);let n=[];return S.Children.forEach(t,(r,i)=>{if(!S.isValidElement(r))return;let s=[...e,i];if(r.type===S.Fragment){n.push.apply(n,ig(r.props.children,s));return}r.type!==Xs&&Be(!1),!r.props.index||!r.props.children||Be(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=ig(r.props.children,s)),n.push(o)}),n}/**
 * React Router DOM v6.21.3
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function sg(){return sg=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},sg.apply(this,arguments)}function N2(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function O2(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function D2(t,e){return t.button===0&&(!e||e==="_self")&&!O2(t)}const M2=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],L2=typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement!="undefined",V2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,F2=S.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:a,target:l,to:u,preventScrollReset:c,unstable_viewTransition:h}=e,d=N2(e,M2),{basename:f}=S.useContext(ji),g,m=!1;if(typeof u=="string"&&V2.test(u)&&(g=u,L2))try{let _=new URL(window.location.href),E=u.startsWith("//")?new URL(_.protocol+u):new URL(u),I=tg(E.pathname,f);E.origin===_.origin&&I!=null?u=I+E.search+E.hash:m=!0}catch{}let w=f2(u,{relative:i}),v=U2(u,{replace:o,state:a,target:l,preventScrollReset:c,relative:i,unstable_viewTransition:h});function y(_){r&&r(_),_.defaultPrevented||v(_)}return S.createElement("a",sg({},d,{href:g||w,onClick:m||s?r:y,ref:n,target:l}))});var xE;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(xE||(xE={}));var SE;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(SE||(SE={}));function U2(t,e){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,unstable_viewTransition:a}=e===void 0?{}:e,l=mE(),u=Ga(),c=vE(t,{relative:o});return S.useCallback(h=>{if(D2(h,n)){h.preventDefault();let d=r!==void 0?r:eg(u)===eg(c);l(t,{replace:d,state:i,preventScrollReset:s,relative:o,unstable_viewTransition:a})}},[u,l,c,r,i,n,t,s,o,a])}var Js=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},zi=typeof window=="undefined"||"Deno"in globalThis;function sn(){}function $2(t,e){return typeof t=="function"?t(e):t}function og(t){return typeof t=="number"&&t>=0&&t!==1/0}function IE(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Zs(t,e){return typeof t=="function"?t(e):t}function vn(t,e){return typeof t=="function"?t(e):t}function AE(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==ag(o,e.options))return!1}else if(!Wa(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function TE(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(Bi(e.options.mutationKey)!==Bi(s))return!1}else if(!Wa(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function ag(t,e){return((e==null?void 0:e.queryKeyHashFn)||Bi)(t)}function Bi(t){return JSON.stringify(t,(e,n)=>lg(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Wa(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(n=>!Wa(t[n],e[n])):!1}function CE(t,e){if(t===e)return t;const n=bE(t)&&bE(e);if(n||lg(t)&&lg(e)){const r=n?t:Object.keys(t),i=r.length,s=n?e:Object.keys(e),o=s.length,a=n?[]:{};let l=0;for(let u=0;u<o;u++){const c=n?u:s[u];(!n&&r.includes(c)||n)&&t[c]===void 0&&e[c]===void 0?(a[c]=void 0,l++):(a[c]=CE(t[c],e[c]),a[c]===t[c]&&t[c]!==void 0&&l++)}return i===o&&l===i?t:a}return e}function Bc(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function bE(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function lg(t){if(!RE(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!RE(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function RE(t){return Object.prototype.toString.call(t)==="[object Object]"}function j2(t){return new Promise(e=>{setTimeout(e,t)})}function ug(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?CE(t,e):e}function z2(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function B2(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var cg=Symbol();function kE(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===cg?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var H2=(iC=class extends Js{constructor(){super();Q(this,ds,void 0);Q(this,mi,void 0);Q(this,Uo,void 0);B(this,Uo,e=>{if(!zi&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){x(this,mi)||this.setEventListener(x(this,Uo))}onUnsubscribe(){var e;this.hasListeners()||((e=x(this,mi))==null||e.call(this),B(this,mi,void 0))}setEventListener(e){var n;B(this,Uo,e),(n=x(this,mi))==null||n.call(this),B(this,mi,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){x(this,ds)!==e&&(B(this,ds,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof x(this,ds)=="boolean"?x(this,ds):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ds=new WeakMap,mi=new WeakMap,Uo=new WeakMap,iC),hg=new H2,G2=(sC=class extends Js{constructor(){super();Q(this,$o,!0);Q(this,vi,void 0);Q(this,jo,void 0);B(this,jo,e=>{if(!zi&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){x(this,vi)||this.setEventListener(x(this,jo))}onUnsubscribe(){var e;this.hasListeners()||((e=x(this,vi))==null||e.call(this),B(this,vi,void 0))}setEventListener(e){var n;B(this,jo,e),(n=x(this,vi))==null||n.call(this),B(this,vi,e(this.setOnline.bind(this)))}setOnline(e){x(this,$o)!==e&&(B(this,$o,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return x(this,$o)}},$o=new WeakMap,vi=new WeakMap,jo=new WeakMap,sC),Hc=new G2;function dg(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}function W2(t){return Math.min(1e3*2**t,3e4)}function PE(t){return(t!=null?t:"online")==="online"?Hc.isOnline():!0}var NE=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function fg(t){return t instanceof NE}function OE(t){let e=!1,n=0,r=!1,i;const s=dg(),o=m=>{var w;r||(d(new NE(m)),(w=t.abort)==null||w.call(t))},a=()=>{e=!0},l=()=>{e=!1},u=()=>hg.isFocused()&&(t.networkMode==="always"||Hc.isOnline())&&t.canRun(),c=()=>PE(t.networkMode)&&t.canRun(),h=m=>{var w;r||(r=!0,(w=t.onSuccess)==null||w.call(t,m),i==null||i(),s.resolve(m))},d=m=>{var w;r||(r=!0,(w=t.onError)==null||w.call(t,m),i==null||i(),s.reject(m))},f=()=>new Promise(m=>{var w;i=v=>{(r||u())&&m(v)},(w=t.onPause)==null||w.call(t)}).then(()=>{var m;i=void 0,r||(m=t.onContinue)==null||m.call(t)}),g=()=>{if(r)return;let m;const w=n===0?t.initialPromise:void 0;try{m=w!=null?w:t.fn()}catch(v){m=Promise.reject(v)}Promise.resolve(m).then(h).catch(v=>{var A,T,C;if(r)return;const y=(A=t.retry)!=null?A:zi?0:3,_=(T=t.retryDelay)!=null?T:W2,E=typeof _=="function"?_(n,v):_,I=y===!0||typeof y=="number"&&n<y||typeof y=="function"&&y(n,v);if(e||!I){d(v);return}n++,(C=t.onFail)==null||C.call(t,n,v),j2(E).then(()=>u()?void 0:f()).then(()=>{e?d(v):g()})})};return{promise:s,cancel:o,continue:()=>(i==null||i(),s),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?g():f().then(g),s)}}function Q2(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=a=>setTimeout(a,0);const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var He=Q2(),DE=(oC=class{constructor(){Q(this,fs,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),og(this.gcTime)&&B(this,fs,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t!=null?t:zi?1/0:5*60*1e3)}clearGcTimeout(){x(this,fs)&&(clearTimeout(x(this,fs)),B(this,fs,void 0))}},fs=new WeakMap,oC),q2=(aC=class extends DE{constructor(n){var r;super();Q(this,Tn);Q(this,zo,void 0);Q(this,Bo,void 0);Q(this,un,void 0);Q(this,xt,void 0);Q(this,hu,void 0);Q(this,ps,void 0);B(this,ps,!1),B(this,hu,n.defaultOptions),this.setOptions(n.options),this.observers=[],B(this,un,n.cache),this.queryKey=n.queryKey,this.queryHash=n.queryHash,B(this,zo,K2(this.options)),this.state=(r=n.state)!=null?r:x(this,zo),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var n;return(n=x(this,xt))==null?void 0:n.promise}setOptions(n){this.options={...x(this,hu),...n},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&x(this,un).remove(this)}setData(n,r){const i=ug(this.state.data,n,this.options);return oe(this,Tn,Tr).call(this,{data:i,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),i}setState(n,r){oe(this,Tn,Tr).call(this,{type:"setState",state:n,setStateOptions:r})}cancel(n){var i,s;const r=(i=x(this,xt))==null?void 0:i.promise;return(s=x(this,xt))==null||s.cancel(n),r?r.then(sn).catch(sn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(x(this,zo))}isActive(){return this.observers.some(n=>vn(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===cg||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(n=0){return this.state.isInvalidated||this.state.data===void 0||!IE(this.state.dataUpdatedAt,n)}onFocus(){var r;const n=this.observers.find(i=>i.shouldFetchOnWindowFocus());n==null||n.refetch({cancelRefetch:!1}),(r=x(this,xt))==null||r.continue()}onOnline(){var r;const n=this.observers.find(i=>i.shouldFetchOnReconnect());n==null||n.refetch({cancelRefetch:!1}),(r=x(this,xt))==null||r.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),x(this,un).notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){this.observers.includes(n)&&(this.observers=this.observers.filter(r=>r!==n),this.observers.length||(x(this,xt)&&(x(this,ps)?x(this,xt).cancel({revert:!0}):x(this,xt).cancelRetry()),this.scheduleGc()),x(this,un).notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||oe(this,Tn,Tr).call(this,{type:"invalidate"})}fetch(n,r){var u,c,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(x(this,xt))return x(this,xt).continueRetry(),x(this,xt).promise}if(n&&this.setOptions(n),!this.options.queryFn){const d=this.observers.find(f=>f.options.queryFn);d&&this.setOptions(d.options)}const i=new AbortController,s=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(B(this,ps,!0),i.signal)})},o=()=>{const d=kE(this.options,r),f={queryKey:this.queryKey,meta:this.meta};return s(f),B(this,ps,!1),this.options.persister?this.options.persister(d,f,this):d(f)},a={fetchOptions:r,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};s(a),(u=this.options.behavior)==null||u.onFetch(a,this),B(this,Bo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&oe(this,Tn,Tr).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta});const l=d=>{var f,g,m,w;fg(d)&&d.silent||oe(this,Tn,Tr).call(this,{type:"error",error:d}),fg(d)||((g=(f=x(this,un).config).onError)==null||g.call(f,d,this),(w=(m=x(this,un).config).onSettled)==null||w.call(m,this.state.data,d,this)),this.scheduleGc()};return B(this,xt,OE({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,abort:i.abort.bind(i),onSuccess:d=>{var f,g,m,w;if(d===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(d)}catch(v){l(v);return}(g=(f=x(this,un).config).onSuccess)==null||g.call(f,d,this),(w=(m=x(this,un).config).onSettled)==null||w.call(m,d,this.state.error,this),this.scheduleGc()},onError:l,onFail:(d,f)=>{oe(this,Tn,Tr).call(this,{type:"failed",failureCount:d,error:f})},onPause:()=>{oe(this,Tn,Tr).call(this,{type:"pause"})},onContinue:()=>{oe(this,Tn,Tr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),x(this,xt).start()}},zo=new WeakMap,Bo=new WeakMap,un=new WeakMap,xt=new WeakMap,hu=new WeakMap,ps=new WeakMap,Tn=new WeakSet,Tr=function(n){const r=i=>{var s,o;switch(n.type){case"failed":return{...i,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...ME(i.data,this.options),fetchMeta:(s=n.meta)!=null?s:null};case"success":return{...i,data:n.data,dataUpdateCount:i.dataUpdateCount+1,dataUpdatedAt:(o=n.dataUpdatedAt)!=null?o:Date.now(),error:null,isInvalidated:!1,status:"success",...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=n.error;return fg(a)&&a.revert&&x(this,Bo)?{...x(this,Bo),fetchStatus:"idle"}:{...i,error:a,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...n.state}}};this.state=r(this.state),He.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),x(this,un).notify({query:this,type:"updated",action:n})})},aC);function ME(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:PE(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function K2(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r!=null?r:Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Y2=(lC=class extends Js{constructor(e={}){super();Q(this,Qn,void 0);this.config=e,B(this,Qn,new Map)}build(e,n,r){var a;const i=n.queryKey,s=(a=n.queryHash)!=null?a:ag(i,n);let o=this.get(s);return o||(o=new q2({cache:this,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){x(this,Qn).has(e.queryHash)||(x(this,Qn).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=x(this,Qn).get(e.queryHash);n&&(e.destroy(),n===e&&x(this,Qn).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){He.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return x(this,Qn).get(e)}getAll(){return[...x(this,Qn).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>AE(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>AE(e,r)):n}notify(e){He.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){He.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){He.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Qn=new WeakMap,lC),X2=(uC=class extends DE{constructor(n){super();Q(this,Kn);Q(this,qn,void 0);Q(this,Rt,void 0);Q(this,gs,void 0);this.mutationId=n.mutationId,B(this,Rt,n.mutationCache),B(this,qn,[]),this.state=n.state||LE(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){x(this,qn).includes(n)||(x(this,qn).push(n),this.clearGcTimeout(),x(this,Rt).notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){B(this,qn,x(this,qn).filter(r=>r!==n)),this.scheduleGc(),x(this,Rt).notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){x(this,qn).length||(this.state.status==="pending"?this.scheduleGc():x(this,Rt).remove(this))}continue(){var n,r;return(r=(n=x(this,gs))==null?void 0:n.continue())!=null?r:this.execute(this.state.variables)}async execute(n){var s,o,a,l,u,c,h,d,f,g,m,w,v,y,_,E,I,A,T,C,N;B(this,gs,OE({fn:()=>this.options.mutationFn?this.options.mutationFn(n):Promise.reject(new Error("No mutationFn found")),onFail:(O,P)=>{oe(this,Kn,Ai).call(this,{type:"failed",failureCount:O,error:P})},onPause:()=>{oe(this,Kn,Ai).call(this,{type:"pause"})},onContinue:()=>{oe(this,Kn,Ai).call(this,{type:"continue"})},retry:(s=this.options.retry)!=null?s:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>x(this,Rt).canRun(this)}));const r=this.state.status==="pending",i=!x(this,gs).canStart();try{if(!r){oe(this,Kn,Ai).call(this,{type:"pending",variables:n,isPaused:i}),await((a=(o=x(this,Rt).config).onMutate)==null?void 0:a.call(o,n,this));const P=await((u=(l=this.options).onMutate)==null?void 0:u.call(l,n));P!==this.state.context&&oe(this,Kn,Ai).call(this,{type:"pending",context:P,variables:n,isPaused:i})}const O=await x(this,gs).start();return await((h=(c=x(this,Rt).config).onSuccess)==null?void 0:h.call(c,O,n,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,O,n,this.state.context)),await((m=(g=x(this,Rt).config).onSettled)==null?void 0:m.call(g,O,null,this.state.variables,this.state.context,this)),await((v=(w=this.options).onSettled)==null?void 0:v.call(w,O,null,n,this.state.context)),oe(this,Kn,Ai).call(this,{type:"success",data:O}),O}catch(O){try{throw await((_=(y=x(this,Rt).config).onError)==null?void 0:_.call(y,O,n,this.state.context,this)),await((I=(E=this.options).onError)==null?void 0:I.call(E,O,n,this.state.context)),await((T=(A=x(this,Rt).config).onSettled)==null?void 0:T.call(A,void 0,O,this.state.variables,this.state.context,this)),await((N=(C=this.options).onSettled)==null?void 0:N.call(C,void 0,O,n,this.state.context)),O}finally{oe(this,Kn,Ai).call(this,{type:"error",error:O})}}finally{x(this,Rt).runNext(this)}}},qn=new WeakMap,Rt=new WeakMap,gs=new WeakMap,Kn=new WeakSet,Ai=function(n){const r=i=>{switch(n.type){case"failed":return{...i,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...i,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:n.error,failureCount:i.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=r(this.state),He.batch(()=>{x(this,qn).forEach(i=>{i.onMutationUpdate(n)}),x(this,Rt).notify({mutation:this,type:"updated",action:n})})},uC);function LE(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var J2=(cC=class extends Js{constructor(e={}){super();Q(this,Ir,void 0);Q(this,Cn,void 0);Q(this,du,void 0);this.config=e,B(this,Ir,new Set),B(this,Cn,new Map),B(this,du,0)}build(e,n,r){const i=new X2({mutationCache:this,mutationId:++Ud(this,du)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){x(this,Ir).add(e);const n=Gc(e);if(typeof n=="string"){const r=x(this,Cn).get(n);r?r.push(e):x(this,Cn).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(x(this,Ir).delete(e)){const n=Gc(e);if(typeof n=="string"){const r=x(this,Cn).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&x(this,Cn).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Gc(e);if(typeof n=="string"){const r=x(this,Cn).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r,i;const n=Gc(e);if(typeof n=="string"){const s=(r=x(this,Cn).get(n))==null?void 0:r.find(o=>o!==e&&o.state.isPaused);return(i=s==null?void 0:s.continue())!=null?i:Promise.resolve()}else return Promise.resolve()}clear(){He.batch(()=>{x(this,Ir).forEach(e=>{this.notify({type:"removed",mutation:e})}),x(this,Ir).clear(),x(this,Cn).clear()})}getAll(){return Array.from(x(this,Ir))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>TE(n,r))}findAll(e={}){return this.getAll().filter(n=>TE(e,n))}notify(e){He.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return He.batch(()=>Promise.all(e.map(n=>n.continue().catch(sn))))}},Ir=new WeakMap,Cn=new WeakMap,du=new WeakMap,cC);function Gc(t){var e;return(e=t.options.scope)==null?void 0:e.id}function VE(t){return{onFetch:(e,n)=>{var c,h,d,f,g;const r=e.options,i=(d=(h=(c=e.fetchOptions)==null?void 0:c.meta)==null?void 0:h.fetchMore)==null?void 0:d.direction,s=((f=e.state.data)==null?void 0:f.pages)||[],o=((g=e.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{var _;let m=!1;const w=E=>{Object.defineProperty(E,"signal",{enumerable:!0,get:()=>(e.signal.aborted?m=!0:e.signal.addEventListener("abort",()=>{m=!0}),e.signal)})},v=kE(e.options,e.fetchOptions),y=async(E,I,A)=>{if(m)return Promise.reject();if(I==null&&E.pages.length)return Promise.resolve(E);const T={queryKey:e.queryKey,pageParam:I,direction:A?"backward":"forward",meta:e.options.meta};w(T);const C=await v(T),{maxPages:N}=e.options,O=A?B2:z2;return{pages:O(E.pages,C,N),pageParams:O(E.pageParams,I,N)}};if(i&&s.length){const E=i==="backward",I=E?Z2:FE,A={pages:s,pageParams:o},T=I(r,A);a=await y(A,T,E)}else{const E=t!=null?t:s.length;do{const I=l===0?(_=o[0])!=null?_:r.initialPageParam:FE(r,a);if(l>0&&I==null)break;a=await y(a,I),l++}while(l<E)}return a};e.options.persister?e.fetchFn=()=>{var m,w;return(w=(m=e.options).persister)==null?void 0:w.call(m,u,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function FE(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function Z2(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var ek=(hC=class{constructor(t={}){Q(this,De,void 0);Q(this,yi,void 0);Q(this,_i,void 0);Q(this,Ho,void 0);Q(this,Go,void 0);Q(this,wi,void 0);Q(this,Wo,void 0);Q(this,Qo,void 0);B(this,De,t.queryCache||new Y2),B(this,yi,t.mutationCache||new J2),B(this,_i,t.defaultOptions||{}),B(this,Ho,new Map),B(this,Go,new Map),B(this,wi,0)}mount(){Ud(this,wi)._++,x(this,wi)===1&&(B(this,Wo,hg.subscribe(async t=>{t&&(await this.resumePausedMutations(),x(this,De).onFocus())})),B(this,Qo,Hc.subscribe(async t=>{t&&(await this.resumePausedMutations(),x(this,De).onOnline())})))}unmount(){var t,e;Ud(this,wi)._--,x(this,wi)===0&&((t=x(this,Wo))==null||t.call(this),B(this,Wo,void 0),(e=x(this,Qo))==null||e.call(this),B(this,Qo,void 0))}isFetching(t){return x(this,De).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return x(this,yi).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=x(this,De).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=x(this,De).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(Zs(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return x(this,De).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=x(this,De).get(r.queryHash),s=i==null?void 0:i.state.data,o=$2(e,s);if(o!==void 0)return x(this,De).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return He.batch(()=>x(this,De).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=x(this,De).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=x(this,De);He.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=x(this,De),r={type:"active",...t};return He.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(r,e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=He.batch(()=>x(this,De).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(sn).catch(sn)}invalidateQueries(t,e={}){return He.batch(()=>{var r,i;if(x(this,De).findAll(t).forEach(s=>{s.invalidate()}),(t==null?void 0:t.refetchType)==="none")return Promise.resolve();const n={...t,type:(i=(r=t==null?void 0:t.refetchType)!=null?r:t==null?void 0:t.type)!=null?i:"active"};return this.refetchQueries(n,e)})}refetchQueries(t,e={}){var i;const n={...e,cancelRefetch:(i=e.cancelRefetch)!=null?i:!0},r=He.batch(()=>x(this,De).findAll(t).filter(s=>!s.isDisabled()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(sn)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(sn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=x(this,De).build(this,e);return n.isStaleByTime(Zs(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(sn).catch(sn)}fetchInfiniteQuery(t){return t.behavior=VE(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(sn).catch(sn)}ensureInfiniteQueryData(t){return t.behavior=VE(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Hc.isOnline()?x(this,yi).resumePausedMutations():Promise.resolve()}getQueryCache(){return x(this,De)}getMutationCache(){return x(this,yi)}getDefaultOptions(){return x(this,_i)}setDefaultOptions(t){B(this,_i,t)}setQueryDefaults(t,e){x(this,Ho).set(Bi(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...x(this,Ho).values()],n={};return e.forEach(r=>{Wa(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){x(this,Go).set(Bi(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...x(this,Go).values()];let n={};return e.forEach(r=>{Wa(t,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...x(this,_i).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=ag(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===cg&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...x(this,_i).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){x(this,De).clear(),x(this,yi).clear()}},De=new WeakMap,yi=new WeakMap,_i=new WeakMap,Ho=new WeakMap,Go=new WeakMap,wi=new WeakMap,Wo=new WeakMap,Qo=new WeakMap,hC),tk=(dC=class extends Js{constructor(e,n){super();Q(this,_s);Q(this,gu);Q(this,mu);Q(this,vu);Q(this,yu);Q(this,_u);Q(this,wu);Q(this,Eu);Q(this,Fd);Q(this,Ft,void 0);Q(this,ce,void 0);Q(this,fu,void 0);Q(this,kt,void 0);Q(this,ms,void 0);Q(this,qo,void 0);Q(this,Ei,void 0);Q(this,Yn,void 0);Q(this,pu,void 0);Q(this,Ko,void 0);Q(this,Yo,void 0);Q(this,vs,void 0);Q(this,ys,void 0);Q(this,xi,void 0);Q(this,Xo,new Set);this.options=n,B(this,Ft,e),B(this,Yn,null),B(this,Ei,dg()),this.options.experimental_prefetchInRender||x(this,Ei).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(x(this,ce).addObserver(this),UE(x(this,ce),this.options)?oe(this,_s,Su).call(this):this.updateResult(),oe(this,yu,N0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return pg(x(this,ce),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return pg(x(this,ce),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,oe(this,_u,O0).call(this),oe(this,wu,D0).call(this),x(this,ce).removeObserver(this)}setOptions(e,n){const r=this.options,i=x(this,ce);if(this.options=x(this,Ft).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof vn(this.options.enabled,x(this,ce))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");oe(this,Eu,M0).call(this),x(this,ce).setOptions(this.options),r._defaulted&&!Bc(this.options,r)&&x(this,Ft).getQueryCache().notify({type:"observerOptionsUpdated",query:x(this,ce),observer:this});const s=this.hasListeners();s&&$E(x(this,ce),i,this.options,r)&&oe(this,_s,Su).call(this),this.updateResult(n),s&&(x(this,ce)!==i||vn(this.options.enabled,x(this,ce))!==vn(r.enabled,x(this,ce))||Zs(this.options.staleTime,x(this,ce))!==Zs(r.staleTime,x(this,ce)))&&oe(this,gu,R0).call(this);const o=oe(this,mu,k0).call(this);s&&(x(this,ce)!==i||vn(this.options.enabled,x(this,ce))!==vn(r.enabled,x(this,ce))||o!==x(this,xi))&&oe(this,vu,P0).call(this,o)}getOptimisticResult(e){const n=x(this,Ft).getQueryCache().build(x(this,Ft),e),r=this.createResult(n,e);return rk(this,r)&&(B(this,kt,r),B(this,qo,this.options),B(this,ms,x(this,ce).state)),r}getCurrentResult(){return x(this,kt)}trackResult(e,n){const r={};return Object.keys(e).forEach(i=>{Object.defineProperty(r,i,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(i),n==null||n(i),e[i])})}),r}trackProp(e){x(this,Xo).add(e)}getCurrentQuery(){return x(this,ce)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=x(this,Ft).defaultQueryOptions(e),r=x(this,Ft).getQueryCache().build(x(this,Ft),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){var n;return oe(this,_s,Su).call(this,{...e,cancelRefetch:(n=e.cancelRefetch)!=null?n:!0}).then(()=>(this.updateResult(),x(this,kt)))}createResult(e,n){var C;const r=x(this,ce),i=this.options,s=x(this,kt),o=x(this,ms),a=x(this,qo),u=e!==r?e.state:x(this,fu),{state:c}=e;let h={...c},d=!1,f;if(n._optimisticResults){const N=this.hasListeners(),O=!N&&UE(e,n),P=N&&$E(e,r,n,i);(O||P)&&(h={...h,...ME(c.data,e.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:g,errorUpdatedAt:m,status:w}=h;if(n.select&&h.data!==void 0)if(s&&h.data===(o==null?void 0:o.data)&&n.select===x(this,pu))f=x(this,Ko);else try{B(this,pu,n.select),f=n.select(h.data),f=ug(s==null?void 0:s.data,f,n),B(this,Ko,f),B(this,Yn,null)}catch(N){B(this,Yn,N)}else f=h.data;if(n.placeholderData!==void 0&&f===void 0&&w==="pending"){let N;if(s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))N=s.data;else if(N=typeof n.placeholderData=="function"?n.placeholderData((C=x(this,Yo))==null?void 0:C.state.data,x(this,Yo)):n.placeholderData,n.select&&N!==void 0)try{N=n.select(N),B(this,Yn,null)}catch(O){B(this,Yn,O)}N!==void 0&&(w="success",f=ug(s==null?void 0:s.data,N,n),d=!0)}x(this,Yn)&&(g=x(this,Yn),f=x(this,Ko),m=Date.now(),w="error");const v=h.fetchStatus==="fetching",y=w==="pending",_=w==="error",E=y&&v,I=f!==void 0,T={status:w,fetchStatus:h.fetchStatus,isPending:y,isSuccess:w==="success",isError:_,isInitialLoading:E,isLoading:E,data:f,dataUpdatedAt:h.dataUpdatedAt,error:g,errorUpdatedAt:m,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:v,isRefetching:v&&!y,isLoadingError:_&&!I,isPaused:h.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:_&&I,isStale:gg(e,n),refetch:this.refetch,promise:x(this,Ei)};if(this.options.experimental_prefetchInRender){const N=b=>{T.status==="error"?b.reject(T.error):T.data!==void 0&&b.resolve(T.data)},O=()=>{const b=B(this,Ei,T.promise=dg());N(b)},P=x(this,Ei);switch(P.status){case"pending":e.queryHash===r.queryHash&&N(P);break;case"fulfilled":(T.status==="error"||T.data!==P.value)&&O();break;case"rejected":(T.status!=="error"||T.error!==P.reason)&&O();break}}return T}updateResult(e){const n=x(this,kt),r=this.createResult(x(this,ce),this.options);if(B(this,ms,x(this,ce).state),B(this,qo,this.options),x(this,ms).data!==void 0&&B(this,Yo,x(this,ce)),Bc(r,n))return;B(this,kt,r);const i={},s=()=>{if(!n)return!0;const{notifyOnChangeProps:o}=this.options,a=typeof o=="function"?o():o;if(a==="all"||!a&&!x(this,Xo).size)return!0;const l=new Set(a!=null?a:x(this,Xo));return this.options.throwOnError&&l.add("error"),Object.keys(x(this,kt)).some(u=>{const c=u;return x(this,kt)[c]!==n[c]&&l.has(c)})};(e==null?void 0:e.listeners)!==!1&&s()&&(i.listeners=!0),oe(this,Fd,gC).call(this,{...i,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&oe(this,yu,N0).call(this)}},Ft=new WeakMap,ce=new WeakMap,fu=new WeakMap,kt=new WeakMap,ms=new WeakMap,qo=new WeakMap,Ei=new WeakMap,Yn=new WeakMap,pu=new WeakMap,Ko=new WeakMap,Yo=new WeakMap,vs=new WeakMap,ys=new WeakMap,xi=new WeakMap,Xo=new WeakMap,_s=new WeakSet,Su=function(e){oe(this,Eu,M0).call(this);let n=x(this,ce).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(sn)),n},gu=new WeakSet,R0=function(){oe(this,_u,O0).call(this);const e=Zs(this.options.staleTime,x(this,ce));if(zi||x(this,kt).isStale||!og(e))return;const r=IE(x(this,kt).dataUpdatedAt,e)+1;B(this,vs,setTimeout(()=>{x(this,kt).isStale||this.updateResult()},r))},mu=new WeakSet,k0=function(){var e;return(e=typeof this.options.refetchInterval=="function"?this.options.refetchInterval(x(this,ce)):this.options.refetchInterval)!=null?e:!1},vu=new WeakSet,P0=function(e){oe(this,wu,D0).call(this),B(this,xi,e),!(zi||vn(this.options.enabled,x(this,ce))===!1||!og(x(this,xi))||x(this,xi)===0)&&B(this,ys,setInterval(()=>{(this.options.refetchIntervalInBackground||hg.isFocused())&&oe(this,_s,Su).call(this)},x(this,xi)))},yu=new WeakSet,N0=function(){oe(this,gu,R0).call(this),oe(this,vu,P0).call(this,oe(this,mu,k0).call(this))},_u=new WeakSet,O0=function(){x(this,vs)&&(clearTimeout(x(this,vs)),B(this,vs,void 0))},wu=new WeakSet,D0=function(){x(this,ys)&&(clearInterval(x(this,ys)),B(this,ys,void 0))},Eu=new WeakSet,M0=function(){const e=x(this,Ft).getQueryCache().build(x(this,Ft),this.options);if(e===x(this,ce))return;const n=x(this,ce);B(this,ce,e),B(this,fu,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},Fd=new WeakSet,gC=function(e){He.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(x(this,kt))}),x(this,Ft).getQueryCache().notify({query:x(this,ce),type:"observerResultsUpdated"})})},dC);function nk(t,e){return vn(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function UE(t,e){return nk(t,e)||t.state.data!==void 0&&pg(t,e,e.refetchOnMount)}function pg(t,e,n){if(vn(e.enabled,t)!==!1){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&gg(t,e)}return!1}function $E(t,e,n,r){return(t!==e||vn(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&gg(t,n)}function gg(t,e){return vn(e.enabled,t)!==!1&&t.isStaleByTime(Zs(e.staleTime,t))}function rk(t,e){return!Bc(t.getCurrentResult(),e)}var ik=(fC=class extends Js{constructor(e,n){super();Q(this,Jo);Q(this,xu);Q(this,Si,void 0);Q(this,Ii,void 0);Q(this,Ut,void 0);Q(this,Ar,void 0);B(this,Si,e),this.setOptions(n),this.bindMethods(),oe(this,Jo,$d).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var r;const n=this.options;this.options=x(this,Si).defaultMutationOptions(e),Bc(this.options,n)||x(this,Si).getMutationCache().notify({type:"observerOptionsUpdated",mutation:x(this,Ut),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Bi(n.mutationKey)!==Bi(this.options.mutationKey)?this.reset():((r=x(this,Ut))==null?void 0:r.state.status)==="pending"&&x(this,Ut).setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(e=x(this,Ut))==null||e.removeObserver(this)}onMutationUpdate(e){oe(this,Jo,$d).call(this),oe(this,xu,L0).call(this,e)}getCurrentResult(){return x(this,Ii)}reset(){var e;(e=x(this,Ut))==null||e.removeObserver(this),B(this,Ut,void 0),oe(this,Jo,$d).call(this),oe(this,xu,L0).call(this)}mutate(e,n){var r;return B(this,Ar,n),(r=x(this,Ut))==null||r.removeObserver(this),B(this,Ut,x(this,Si).getMutationCache().build(x(this,Si),this.options)),x(this,Ut).addObserver(this),x(this,Ut).execute(e)}},Si=new WeakMap,Ii=new WeakMap,Ut=new WeakMap,Ar=new WeakMap,Jo=new WeakSet,$d=function(){var n,r;const e=(r=(n=x(this,Ut))==null?void 0:n.state)!=null?r:LE();B(this,Ii,{...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset})},xu=new WeakSet,L0=function(e){He.batch(()=>{var n,r,i,s,o,a,l,u;if(x(this,Ar)&&this.hasListeners()){const c=x(this,Ii).variables,h=x(this,Ii).context;(e==null?void 0:e.type)==="success"?((r=(n=x(this,Ar)).onSuccess)==null||r.call(n,e.data,c,h),(s=(i=x(this,Ar)).onSettled)==null||s.call(i,e.data,null,c,h)):(e==null?void 0:e.type)==="error"&&((a=(o=x(this,Ar)).onError)==null||a.call(o,e.error,c,h),(u=(l=x(this,Ar)).onSettled)==null||u.call(l,void 0,e.error,c,h))}this.listeners.forEach(c=>{c(x(this,Ii))})})},fC),jE=S.createContext(void 0),mg=t=>{const e=S.useContext(jE);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},sk=({client:t,children:e})=>(S.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),p.jsx(jE.Provider,{value:t,children:e})),zE=S.createContext(!1),ok=()=>S.useContext(zE);zE.Provider;function ak(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var lk=S.createContext(ak()),uk=()=>S.useContext(lk);function BE(t,e){return typeof t=="function"?t(...e):!!t}function vg(){}var ck=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},hk=t=>{S.useEffect(()=>{t.clearReset()},[t])},dk=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||BE(n,[t.error,r])),fk=t=>{const e=t.staleTime;t.suspense&&(t.staleTime=typeof e=="function"?(...n)=>Math.max(e(...n),1e3):Math.max(e!=null?e:1e3,1e3),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3)))},pk=(t,e)=>t.isLoading&&t.isFetching&&!e,gk=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,HE=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function mk(t,e,n){var h,d,f,g,m;const r=mg(n),i=ok(),s=uk(),o=r.defaultQueryOptions(t);(d=(h=r.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||d.call(h,o),o._optimisticResults=i?"isRestoring":"optimistic",fk(o),ck(o,s),hk(s);const a=!r.getQueryCache().get(o.queryHash),[l]=S.useState(()=>new e(r,o)),u=l.getOptimisticResult(o),c=!i&&t.subscribed!==!1;if(S.useSyncExternalStore(S.useCallback(w=>{const v=c?l.subscribe(He.batchCalls(w)):vg;return l.updateResult(),v},[l,c]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),S.useEffect(()=>{l.setOptions(o,{listeners:!1})},[o,l]),gk(o,u))throw HE(o,l,s);if(dk({result:u,errorResetBoundary:s,throwOnError:o.throwOnError,query:r.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if((g=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||g.call(f,o,u),o.experimental_prefetchInRender&&!zi&&pk(u,i)){const w=a?HE(o,l,s):(m=r.getQueryCache().get(o.queryHash))==null?void 0:m.promise;w==null||w.catch(vg).finally(()=>{l.updateResult()})}return o.notifyOnChangeProps?u:l.trackResult(u)}function hr(t,e){return mk(t,tk,e)}function vk(t,e){const n=mg(e),[r]=S.useState(()=>new ik(n,t));S.useEffect(()=>{r.setOptions(t)},[r,t]);const i=S.useSyncExternalStore(S.useCallback(o=>r.subscribe(He.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=S.useCallback((o,a)=>{r.mutate(o,a).catch(vg)},[r]);if(i.error&&BE(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}var GE={};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const WE=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},yk=function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=t[n++],o=t[n++],a=t[n++],l=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},QE={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<t.length;i+=3){const s=t[i],o=i+1<t.length,a=o?t[i+1]:0,l=i+2<t.length,u=l?t[i+2]:0,c=s>>2,h=(s&3)<<4|a>>4;let d=(a&15)<<2|u>>6,f=u&63;l||(f=64,o||(d=64)),r.push(n[c],n[h],n[d],n[f])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(WE(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):yk(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<t.length;){const s=n[t.charAt(i++)],a=i<t.length?n[t.charAt(i)]:0;++i;const u=i<t.length?n[t.charAt(i)]:64;++i;const h=i<t.length?n[t.charAt(i)]:64;if(++i,s==null||a==null||u==null||h==null)throw new _k;const d=s<<2|a>>4;if(r.push(d),u!==64){const f=a<<4&240|u>>2;if(r.push(f),h!==64){const g=u<<6&192|h;r.push(g)}}}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 _k extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const wk=function(t){const e=WE(t);return QE.encodeByteArray(e,!0)},Wc=function(t){return wk(t).replace(/\./g,"")},qE=function(t){try{return QE.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Ek(){if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;throw new Error("Unable to locate global object.")}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const xk=()=>Ek().__FIREBASE_DEFAULTS__,Sk=()=>{if(typeof process=="undefined"||typeof GE=="undefined")return;const t=GE.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},Ik=()=>{if(typeof document=="undefined")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&qE(t[1]);return e&&JSON.parse(e)},Qc=()=>{try{return xk()||Sk()||Ik()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},KE=t=>{var e,n;return(n=(e=Qc())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[t]},YE=t=>{const e=KE(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]},XE=()=>{var t;return(t=Qc())===null||t===void 0?void 0:t.config},JE=t=>{var e;return(e=Qc())===null||e===void 0?void 0:e[`_${t}`]};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ak{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function ZE(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},r=e||"demo-project",i=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},t);return[Wc(JSON.stringify(n)),Wc(JSON.stringify(o)),""].join(".")}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Ve(){return typeof navigator!="undefined"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Tk(){return typeof window!="undefined"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Ve())}function Ck(){var t;const e=(t=Qc())===null||t===void 0?void 0:t.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function bk(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function Rk(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function kk(){const t=Ve();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function Pk(){return!Ck()&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function e1(){try{return typeof indexedDB=="object"}catch{return!1}}function Nk(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ok="FirebaseError";class On extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=Ok,Object.setPrototypeOf(this,On.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Qa.prototype.create)}}class Qa{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Dk(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new On(i,a,r)}}function Dk(t,e){return t.replace(Mk,(n,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const Mk=/\{\$([^}]+)}/g;function Lk(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function qc(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const s=t[i],o=e[i];if(t1(s)&&t1(o)){if(!qc(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function t1(t){return t!==null&&typeof t=="object"}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function qa(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Ka(t){const e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Ya(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function Vk(t,e){const n=new Fk(t,e);return n.subscribe.bind(n)}class Fk{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 i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");Uk(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=yg),i.error===void 0&&(i.error=yg),i.complete===void 0&&(i.complete=yg);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}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(r){typeof console!="undefined"&&console.error&&console.error(r)}})}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 Uk(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 yg(){}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function dt(t){return t&&t._delegate?t._delegate:t}let Yr=class{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Hi="[DEFAULT]";/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let $k=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 Ak;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),i=(n=e==null?void 0:e.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(zk(e))try{this.getOrInitializeService({instanceIdentifier:Hi})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(n);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=Hi){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=Hi){return this.instances.has(e)}getOptions(e=Hi){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[s,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,n){var r;const i=this.normalizeInstanceIdentifier(n),s=(r=this.onInitCallbacks.get(i))!==null&&r!==void 0?r:new Set;s.add(e),this.onInitCallbacks.set(i,s);const o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:jk(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=Hi){return this.component?this.component.multipleInstances?e:Hi:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function jk(t){return t===Hi?void 0:t}function zk(t){return t.instantiationMode==="EAGER"}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Bk{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 $k(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var ue;(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"})(ue||(ue={}));const Hk={debug:ue.DEBUG,verbose:ue.VERBOSE,info:ue.INFO,warn:ue.WARN,error:ue.ERROR,silent:ue.SILENT},Gk=ue.INFO,Wk={[ue.DEBUG]:"log",[ue.VERBOSE]:"log",[ue.INFO]:"info",[ue.WARN]:"warn",[ue.ERROR]:"error"},Qk=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),i=Wk[e];if(i)console[i](`[${r}]  ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class _g{constructor(e){this.name=e,this._logLevel=Gk,this._logHandler=Qk,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in ue))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Hk[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,ue.DEBUG,...e),this._logHandler(this,ue.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,ue.VERBOSE,...e),this._logHandler(this,ue.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,ue.INFO,...e),this._logHandler(this,ue.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,ue.WARN,...e),this._logHandler(this,ue.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,ue.ERROR,...e),this._logHandler(this,ue.ERROR,...e)}}const qk=(t,e)=>e.some(n=>t instanceof n);let n1,r1;function Kk(){return n1||(n1=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Yk(){return r1||(r1=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const i1=new WeakMap,wg=new WeakMap,s1=new WeakMap,Eg=new WeakMap,xg=new WeakMap;function Xk(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Xr(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&i1.set(n,t)}).catch(()=>{}),xg.set(e,t),e}function Jk(t){if(wg.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});wg.set(t,e)}let Sg={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return wg.get(t);if(e==="objectStoreNames")return t.objectStoreNames||s1.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Xr(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 Zk(t){Sg=t(Sg)}function eP(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(Ig(this),e,...n);return s1.set(r,e.sort?e.sort():[e]),Xr(r)}:Yk().includes(t)?function(...e){return t.apply(Ig(this),e),Xr(i1.get(this))}:function(...e){return Xr(t.apply(Ig(this),e))}}function tP(t){return typeof t=="function"?eP(t):(t instanceof IDBTransaction&&Jk(t),qk(t,Kk())?new Proxy(t,Sg):t)}function Xr(t){if(t instanceof IDBRequest)return Xk(t);if(Eg.has(t))return Eg.get(t);const e=tP(t);return e!==t&&(Eg.set(t,e),xg.set(e,t)),e}const Ig=t=>xg.get(t);function nP(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Xr(o);return r&&o.addEventListener("upgradeneeded",l=>{r(Xr(o.result),l.oldVersion,l.newVersion,Xr(o.transaction),l)}),n&&o.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const rP=["get","getKey","getAll","getAllKeys","count"],iP=["put","add","delete","clear"],Ag=new Map;function o1(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Ag.get(e))return Ag.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=iP.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||rP.includes(n)))return;const s=async function(o,...a){const l=this.transaction(o,i?"readwrite":"readonly");let u=l.store;return r&&(u=u.index(a.shift())),(await Promise.all([u[n](...a),i&&l.done]))[0]};return Ag.set(e,s),s}Zk(t=>({...t,get:(e,n,r)=>o1(e,n)||t.get(e,n,r),has:(e,n)=>!!o1(e,n)||t.has(e,n)}));/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class sP{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(oP(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function oP(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Tg="@firebase/app",a1="0.9.26";/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Gi=new _g("@firebase/app"),aP="@firebase/app-compat",lP="@firebase/analytics-compat",uP="@firebase/analytics",cP="@firebase/app-check-compat",hP="@firebase/app-check",dP="@firebase/auth",fP="@firebase/auth-compat",pP="@firebase/database",gP="@firebase/database-compat",mP="@firebase/functions",vP="@firebase/functions-compat",yP="@firebase/installations",_P="@firebase/installations-compat",wP="@firebase/messaging",EP="@firebase/messaging-compat",xP="@firebase/performance",SP="@firebase/performance-compat",IP="@firebase/remote-config",AP="@firebase/remote-config-compat",TP="@firebase/storage",CP="@firebase/storage-compat",bP="@firebase/firestore",RP="@firebase/firestore-compat",kP="firebase",PP="10.7.2";/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Cg="[DEFAULT]",NP={[Tg]:"fire-core",[aP]:"fire-core-compat",[uP]:"fire-analytics",[lP]:"fire-analytics-compat",[hP]:"fire-app-check",[cP]:"fire-app-check-compat",[dP]:"fire-auth",[fP]:"fire-auth-compat",[pP]:"fire-rtdb",[gP]:"fire-rtdb-compat",[mP]:"fire-fn",[vP]:"fire-fn-compat",[yP]:"fire-iid",[_P]:"fire-iid-compat",[wP]:"fire-fcm",[EP]:"fire-fcm-compat",[xP]:"fire-perf",[SP]:"fire-perf-compat",[IP]:"fire-rc",[AP]:"fire-rc-compat",[TP]:"fire-gcs",[CP]:"fire-gcs-compat",[bP]:"fire-fst",[RP]:"fire-fst-compat","fire-js":"fire-js",[kP]:"fire-js-all"};/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Kc=new Map,bg=new Map;function OP(t,e){try{t.container.addComponent(e)}catch(n){Gi.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Wi(t){const e=t.name;if(bg.has(e))return Gi.debug(`There were multiple attempts to register component ${e}.`),!1;bg.set(e,t);for(const n of Kc.values())OP(n,t);return!0}function Yc(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const DP={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."},Jr=new Qa("app","Firebase",DP);/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class MP{constructor(e,n,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Yr("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 Jr.create("app-deleted",{appName:this._name})}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Qi=PP;function l1(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r=Object.assign({name:Cg,automaticDataCollectionEnabled:!1},e),i=r.name;if(typeof i!="string"||!i)throw Jr.create("bad-app-name",{appName:String(i)});if(n||(n=XE()),!n)throw Jr.create("no-options");const s=Kc.get(i);if(s){if(qc(n,s.options)&&qc(r,s.config))return s;throw Jr.create("duplicate-app",{appName:i})}const o=new Bk(i);for(const l of bg.values())o.addComponent(l);const a=new MP(n,r,o);return Kc.set(i,a),a}function Rg(t=Cg){const e=Kc.get(t);if(!e&&t===Cg&&XE())return l1();if(!e)throw Jr.create("no-app",{appName:t});return e}function Dn(t,e,n){var r;let i=(r=NP[t])!==null&&r!==void 0?r:t;n&&(i+=`-${n}`);const s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Gi.warn(a.join(" "));return}Wi(new Yr(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const LP="firebase-heartbeat-database",VP=1,Xa="firebase-heartbeat-store";let kg=null;function u1(){return kg||(kg=nP(LP,VP,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(Xa)}catch(n){console.warn(n)}}}}).catch(t=>{throw Jr.create("idb-open",{originalErrorMessage:t.message})})),kg}async function FP(t){try{return await(await u1()).transaction(Xa).objectStore(Xa).get(h1(t))}catch(e){if(e instanceof On)Gi.warn(e.message);else{const n=Jr.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Gi.warn(n.message)}}}async function c1(t,e){try{const r=(await u1()).transaction(Xa,"readwrite");await r.objectStore(Xa).put(e,h1(t)),await r.done}catch(n){if(n instanceof On)Gi.warn(n.message);else{const r=Jr.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Gi.warn(r.message)}}}function h1(t){return`${t.name}!${t.options.appId}`}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const UP=1024,$P=30*24*60*60*1e3;class jP{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new BP(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;const i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=d1();if(!(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null))&&!(this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)))return this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{const a=new Date(o.date).valueOf();return Date.now()-a<=$P}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){var e;if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=d1(),{heartbeatsToSend:r,unsentEntries:i}=zP(this._heartbeatsCache.heartbeats),s=Wc(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}}function d1(){return new Date().toISOString().substring(0,10)}function zP(t,e=UP){const n=[];let r=t.slice();for(const i of t){const s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),f1(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),f1(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class BP{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return e1()?Nk().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await FP(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){const i=await this.read();return c1(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){const i=await this.read();return c1(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}}function f1(t){return Wc(JSON.stringify({version:2,heartbeats:t})).length}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function HP(t){Wi(new Yr("platform-logger",e=>new sP(e),"PRIVATE")),Wi(new Yr("heartbeat",e=>new jP(e),"PRIVATE")),Dn(Tg,a1,t),Dn(Tg,a1,"esm2017"),Dn("fire-js","")}HP("");var GP=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},F,Pg=Pg||{},ee=GP||self;function Xc(t){var e=typeof t;return e=e!="object"?e:t?Array.isArray(t)?"array":e:"null",e=="array"||e=="object"&&typeof t.length=="number"}function Ja(t){var e=typeof t;return e=="object"&&t!=null||e=="function"}function WP(t){return Object.prototype.hasOwnProperty.call(t,Ng)&&t[Ng]||(t[Ng]=++QP)}var Ng="closure_uid_"+(1e9*Math.random()>>>0),QP=0;function qP(t,e,n){return t.call.apply(t.bind,arguments)}function KP(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var i=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(i,r),t.apply(e,i)}}return function(){return t.apply(e,arguments)}}function ft(t,e,n){return Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?ft=qP:ft=KP,ft.apply(null,arguments)}function Jc(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var r=n.slice();return r.push.apply(r,arguments),t.apply(this,r)}}function Ke(t,e){function n(){}n.prototype=e.prototype,t.$=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.ac=function(r,i,s){for(var o=Array(arguments.length-2),a=2;a<arguments.length;a++)o[a-2]=arguments[a];return e.prototype[i].apply(r,o)}}function Zr(){this.s=this.s,this.o=this.o}var YP=0;Zr.prototype.s=!1,Zr.prototype.sa=function(){!this.s&&(this.s=!0,this.N(),YP!=0)&&WP(this)},Zr.prototype.N=function(){if(this.o)for(;this.o.length;)this.o.shift()()};const p1=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if(typeof t=="string")return typeof e!="string"||e.length!=1?-1:t.indexOf(e,0);for(let n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function Og(t){const e=t.length;if(0<e){const n=Array(e);for(let r=0;r<e;r++)n[r]=t[r];return n}return[]}function g1(t,e){for(let n=1;n<arguments.length;n++){const r=arguments[n];if(Xc(r)){const i=t.length||0,s=r.length||0;t.length=i+s;for(let o=0;o<s;o++)t[i+o]=r[o]}else t.push(r)}}function pt(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}pt.prototype.h=function(){this.defaultPrevented=!0};var XP=function(){if(!ee.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{const n=()=>{};ee.addEventListener("test",n,e),ee.removeEventListener("test",n,e)}catch{}return t}();function Za(t){return/^[\s\xa0]*$/.test(t)}function Zc(){var t=ee.navigator;return t&&(t=t.userAgent)?t:""}function Mn(t){return Zc().indexOf(t)!=-1}function Dg(t){return Dg[" "](t),t}Dg[" "]=function(){};function JP(t,e){var n=HN;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}var ZP=Mn("Opera"),eo=Mn("Trident")||Mn("MSIE"),m1=Mn("Edge"),Mg=m1||eo,v1=Mn("Gecko")&&!(Zc().toLowerCase().indexOf("webkit")!=-1&&!Mn("Edge"))&&!(Mn("Trident")||Mn("MSIE"))&&!Mn("Edge"),eN=Zc().toLowerCase().indexOf("webkit")!=-1&&!Mn("Edge");function y1(){var t=ee.document;return t?t.documentMode:void 0}var Lg;e:{var Vg="",Fg=function(){var t=Zc();if(v1)return/rv:([^\);]+)(\)|;)/.exec(t);if(m1)return/Edge\/([\d\.]+)/.exec(t);if(eo)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(t);if(eN)return/WebKit\/(\S+)/.exec(t);if(ZP)return/(?:Version)[ \/]?(\S+)/.exec(t)}();if(Fg&&(Vg=Fg?Fg[1]:""),eo){var Ug=y1();if(Ug!=null&&Ug>parseFloat(Vg)){Lg=String(Ug);break e}}Lg=Vg}var $g;if(ee.document&&eo){var _1=y1();$g=_1||parseInt(Lg,10)||void 0}else $g=void 0;var tN=$g;function el(t,e){if(pt.call(this,t?t.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,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(v1){e:{try{Dg(e.nodeName);var i=!0;break e}catch{}i=!1}i||(e=null)}}else n=="mouseover"?e=t.fromElement:n=="mouseout"&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=r.clientX!==void 0?r.clientX:r.pageX,this.clientY=r.clientY!==void 0?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=t.clientX!==void 0?t.clientX:t.pageX,this.clientY=t.clientY!==void 0?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType=typeof t.pointerType=="string"?t.pointerType:nN[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&el.$.h.call(this)}}Ke(el,pt);var nN={2:"touch",3:"pen",4:"mouse"};el.prototype.h=function(){el.$.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var tl="closure_listenable_"+(1e6*Math.random()|0),rN=0;function iN(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.la=i,this.key=++rN,this.fa=this.ia=!1}function eh(t){t.fa=!0,t.listener=null,t.proxy=null,t.src=null,t.la=null}function jg(t,e,n){for(const r in t)e.call(n,t[r],r,t)}function sN(t,e){for(const n in t)e.call(void 0,t[n],n,t)}function w1(t){const e={};for(const n in t)e[n]=t[n];return e}const E1="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function x1(t,e){let n,r;for(let i=1;i<arguments.length;i++){r=arguments[i];for(n in r)t[n]=r[n];for(let s=0;s<E1.length;s++)n=E1[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function th(t){this.src=t,this.g={},this.h=0}th.prototype.add=function(t,e,n,r,i){var s=t.toString();t=this.g[s],t||(t=this.g[s]=[],this.h++);var o=Bg(t,e,r,i);return-1<o?(e=t[o],n||(e.ia=!1)):(e=new iN(e,this.src,s,!!r,i),e.ia=n,t.push(e)),e};function zg(t,e){var n=e.type;if(n in t.g){var r=t.g[n],i=p1(r,e),s;(s=0<=i)&&Array.prototype.splice.call(r,i,1),s&&(eh(e),t.g[n].length==0&&(delete t.g[n],t.h--))}}function Bg(t,e,n,r){for(var i=0;i<t.length;++i){var s=t[i];if(!s.fa&&s.listener==e&&s.capture==!!n&&s.la==r)return i}return-1}var Hg="closure_lm_"+(1e6*Math.random()|0),Gg={};function S1(t,e,n,r,i){if(r&&r.once)return A1(t,e,n,r,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)S1(t,e[s],n,r,i);return null}return n=Kg(n),t&&t[tl]?t.O(e,n,Ja(r)?!!r.capture:!!r,i):I1(t,e,n,!1,r,i)}function I1(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=Ja(i)?!!i.capture:!!i,a=Qg(t);if(a||(t[Hg]=a=new th(t)),n=a.add(e,n,r,o,s),n.proxy)return n;if(r=oN(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)XP||(i=o),i===void 0&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(C1(e.toString()),r);else if(t.addListener&&t.removeListener)t.addListener(r);else throw Error("addEventListener and attachEvent are unavailable.");return n}function oN(){function t(n){return e.call(t.src,t.listener,n)}const e=aN;return t}function A1(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)A1(t,e[s],n,r,i);return null}return n=Kg(n),t&&t[tl]?t.P(e,n,Ja(r)?!!r.capture:!!r,i):I1(t,e,n,!0,r,i)}function T1(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)T1(t,e[s],n,r,i);else r=Ja(r)?!!r.capture:!!r,n=Kg(n),t&&t[tl]?(t=t.i,e=String(e).toString(),e in t.g&&(s=t.g[e],n=Bg(s,n,r,i),-1<n&&(eh(s[n]),Array.prototype.splice.call(s,n,1),s.length==0&&(delete t.g[e],t.h--)))):t&&(t=Qg(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Bg(e,n,r,i)),(n=-1<t?e[t]:null)&&Wg(n))}function Wg(t){if(typeof t!="number"&&t&&!t.fa){var e=t.src;if(e&&e[tl])zg(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(C1(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Qg(e))?(zg(n,t),n.h==0&&(n.src=null,e[Hg]=null)):eh(t)}}}function C1(t){return t in Gg?Gg[t]:Gg[t]="on"+t}function aN(t,e){if(t.fa)t=!0;else{e=new el(e,this);var n=t.listener,r=t.la||t.src;t.ia&&Wg(t),t=n.call(r,e)}return t}function Qg(t){return t=t[Hg],t instanceof th?t:null}var qg="__closure_events_fn_"+(1e9*Math.random()>>>0);function Kg(t){return typeof t=="function"?t:(t[qg]||(t[qg]=function(e){return t.handleEvent(e)}),t[qg])}function Ye(){Zr.call(this),this.i=new th(this),this.S=this,this.J=null}Ke(Ye,Zr),Ye.prototype[tl]=!0,Ye.prototype.removeEventListener=function(t,e,n,r){T1(this,t,e,n,r)};function nt(t,e){var n,r=t.J;if(r)for(n=[];r;r=r.J)n.push(r);if(t=t.S,r=e.type||e,typeof e=="string")e=new pt(e,t);else if(e instanceof pt)e.target=e.target||t;else{var i=e;e=new pt(r,t),x1(e,i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=nh(o,r,!0,e)&&i}if(o=e.g=t,i=nh(o,r,!0,e)&&i,i=nh(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)o=e.g=n[s],i=nh(o,r,!1,e)&&i}Ye.prototype.N=function(){if(Ye.$.N.call(this),this.i){var t=this.i,e;for(e in t.g){for(var n=t.g[e],r=0;r<n.length;r++)eh(n[r]);delete t.g[e],t.h--}}this.J=null},Ye.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Ye.prototype.P=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};function nh(t,e,n,r){if(e=t.i.g[String(e)],!e)return!0;e=e.concat();for(var i=!0,s=0;s<e.length;++s){var o=e[s];if(o&&!o.fa&&o.capture==n){var a=o.listener,l=o.la||o.src;o.ia&&zg(t.i,o),i=a.call(l,r)!==!1&&i}}return i&&!r.defaultPrevented}var Yg=ee.JSON.stringify;class lN{constructor(e,n){this.i=e,this.j=n,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}function uN(){var t=Xg;let e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}class cN{constructor(){this.h=this.g=null}add(e,n){const r=b1.get();r.set(e,n),this.h?this.h.next=r:this.g=r,this.h=r}}var b1=new lN(()=>new hN,t=>t.reset());class hN{constructor(){this.next=this.g=this.h=null}set(e,n){this.h=e,this.g=n,this.next=null}reset(){this.next=this.g=this.h=null}}function dN(t){var e=1;t=t.split(":");const n=[];for(;0<e&&t.length;)n.push(t.shift()),e--;return t.length&&n.push(t.join(":")),n}function fN(t){ee.setTimeout(()=>{throw t},0)}let nl,rl=!1,Xg=new cN,R1=()=>{const t=ee.Promise.resolve(void 0);nl=()=>{t.then(pN)}};var pN=()=>{for(var t;t=uN();){try{t.h.call(t.g)}catch(n){fN(n)}var e=b1;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}rl=!1};function rh(t,e){Ye.call(this),this.h=t||1,this.g=e||ee,this.j=ft(this.qb,this),this.l=Date.now()}Ke(rh,Ye),F=rh.prototype,F.ga=!1,F.T=null,F.qb=function(){if(this.ga){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.T=this.g.setTimeout(this.j,this.h-t):(this.T&&(this.g.clearTimeout(this.T),this.T=null),nt(this,"tick"),this.ga&&(Jg(this),this.start()))}},F.start=function(){this.ga=!0,this.T||(this.T=this.g.setTimeout(this.j,this.h),this.l=Date.now())};function Jg(t){t.ga=!1,t.T&&(t.g.clearTimeout(t.T),t.T=null)}F.N=function(){rh.$.N.call(this),Jg(this),delete this.g};function Zg(t,e,n){if(typeof t=="function")n&&(t=ft(t,n));else if(t&&typeof t.handleEvent=="function")t=ft(t.handleEvent,t);else throw Error("Invalid listener argument");return 2147483647<Number(e)?-1:ee.setTimeout(t,e||0)}function k1(t){t.g=Zg(()=>{t.g=null,t.i&&(t.i=!1,k1(t))},t.j);const e=t.h;t.h=null,t.m.apply(null,e)}class gN extends Zr{constructor(e,n){super(),this.m=e,this.j=n,this.h=null,this.i=!1,this.g=null}l(e){this.h=arguments,this.g?this.i=!0:k1(this)}N(){super.N(),this.g&&(ee.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function il(t){Zr.call(this),this.h=t,this.g={}}Ke(il,Zr);var P1=[];function N1(t,e,n,r){Array.isArray(n)||(n&&(P1[0]=n.toString()),n=P1);for(var i=0;i<n.length;i++){var s=S1(e,n[i],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function O1(t){jg(t.g,function(e,n){this.g.hasOwnProperty(n)&&Wg(e)},t),t.g={}}il.prototype.N=function(){il.$.N.call(this),O1(this)},il.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};function ih(){this.g=!0}ih.prototype.Ea=function(){this.g=!1};function mN(t,e,n,r,i,s){t.info(function(){if(t.g)if(s)for(var o="",a=s.split("&"),l=0;l<a.length;l++){var u=a[l].split("=");if(1<u.length){var c=u[0];u=u[1];var h=c.split("_");o=2<=h.length&&h[1]=="type"?o+(c+"="+u+"&"):o+(c+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+e+`
`+n+`
`+o})}function vN(t,e,n,r,i,s,o){t.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+`
`+n+`
`+s+" "+o})}function to(t,e,n,r){t.info(function(){return"XMLHTTP TEXT ("+e+"): "+_N(t,n)+(r?" "+r:"")})}function yN(t,e){t.info(function(){return"TIMEOUT: "+e})}ih.prototype.info=function(){};function _N(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n){for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if(s!="noop"&&s!="stop"&&s!="close")for(var o=1;o<i.length;o++)i[o]=""}}}}return Yg(n)}catch{return e}}var qi={},D1=null;function sh(){return D1=D1||new Ye}qi.Ta="serverreachability";function M1(t){pt.call(this,qi.Ta,t)}Ke(M1,pt);function sl(t){const e=sh();nt(e,new M1(e))}qi.STAT_EVENT="statevent";function L1(t,e){pt.call(this,qi.STAT_EVENT,t),this.stat=e}Ke(L1,pt);function Ct(t){const e=sh();nt(e,new L1(e,t))}qi.Ua="timingevent";function V1(t,e){pt.call(this,qi.Ua,t),this.size=e}Ke(V1,pt);function ol(t,e){if(typeof t!="function")throw Error("Fn must not be null and must be a function");return ee.setTimeout(function(){t()},e)}var oh={NO_ERROR:0,rb:1,Eb:2,Db:3,yb:4,Cb:5,Fb:6,Qa:7,TIMEOUT:8,Ib:9},F1={wb:"complete",Sb:"success",Ra:"error",Qa:"abort",Kb:"ready",Lb:"readystatechange",TIMEOUT:"timeout",Gb:"incrementaldata",Jb:"progress",zb:"downloadprogress",$b:"uploadprogress"};function em(){}em.prototype.h=null;function U1(t){return t.h||(t.h=t.i())}function $1(){}var al={OPEN:"a",vb:"b",Ra:"c",Hb:"d"};function tm(){pt.call(this,"d")}Ke(tm,pt);function nm(){pt.call(this,"c")}Ke(nm,pt);var rm;function ah(){}Ke(ah,em),ah.prototype.g=function(){return new XMLHttpRequest},ah.prototype.i=function(){return{}},rm=new ah;function ll(t,e,n,r){this.l=t,this.j=e,this.m=n,this.W=r||1,this.U=new il(this),this.P=wN,t=Mg?125:void 0,this.V=new rh(t),this.I=null,this.i=!1,this.u=this.B=this.A=this.L=this.G=this.Y=this.C=null,this.F=[],this.g=null,this.o=0,this.s=this.v=null,this.ca=-1,this.J=!1,this.O=0,this.M=null,this.ba=this.K=this.aa=this.S=!1,this.h=new j1}function j1(){this.i=null,this.g="",this.h=!1}var wN=45e3,z1={},im={};F=ll.prototype,F.setTimeout=function(t){this.P=t};function sm(t,e,n){t.L=1,t.A=hh(dr(e)),t.u=n,t.S=!0,B1(t,null)}function B1(t,e){t.G=Date.now(),ul(t),t.B=dr(t.A);var n=t.B,r=t.W;Array.isArray(r)||(r=[String(r)]),Z1(n.i,"t",r),t.o=0,n=t.l.J,t.h=new j1,t.g=Sx(t.l,n?e:null,!t.u),0<t.O&&(t.M=new gN(ft(t.Pa,t,t.g),t.O)),N1(t.U,t.g,"readystatechange",t.nb),e=t.I?w1(t.I):{},t.u?(t.v||(t.v="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.ha(t.B,t.v,t.u,e)):(t.v="GET",t.g.ha(t.B,t.v,null,e)),sl(),mN(t.j,t.v,t.B,t.m,t.W,t.u)}F.nb=function(t){t=t.target;const e=this.M;e&&Ln(t)==3?e.l():this.Pa(t)},F.Pa=function(t){try{if(t==this.g)e:{const c=Ln(this.g);var e=this.g.Ia();const h=this.g.da();if(!(3>c)&&(c!=3||Mg||this.g&&(this.h.h||this.g.ja()||hx(this.g)))){this.J||c!=4||e==7||(e==8||0>=h?sl(3):sl(2)),lh(this);var n=this.g.da();this.ca=n;t:if(H1(this)){var r=hx(this.g);t="";var i=r.length,s=Ln(this.g)==4;if(!this.h.i){if(typeof TextDecoder=="undefined"){Ki(this),cl(this);var o="";break t}this.h.i=new ee.TextDecoder}for(e=0;e<i;e++)this.h.h=!0,t+=this.h.i.decode(r[e],{stream:s&&e==i-1});r.length=0,this.h.g+=t,this.o=0,o=this.h.g}else o=this.g.ja();if(this.i=n==200,vN(this.j,this.v,this.B,this.m,this.W,c,n),this.i){if(this.aa&&!this.K){t:{if(this.g){var a,l=this.g;if((a=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Za(a)){var u=a;break t}}u=null}if(n=u)to(this.j,this.m,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,om(this,n);else{this.i=!1,this.s=3,Ct(12),Ki(this),cl(this);break e}}this.S?(G1(this,c,o),Mg&&this.i&&c==3&&(N1(this.U,this.V,"tick",this.mb),this.V.start())):(to(this.j,this.m,o,null),om(this,o)),c==4&&Ki(this),this.i&&!this.J&&(c==4?_x(this.l,this):(this.i=!1,ul(this)))}else jN(this.g),n==400&&0<o.indexOf("Unknown SID")?(this.s=3,Ct(12)):(this.s=0,Ct(13)),Ki(this),cl(this)}}}catch{}finally{}};function H1(t){return t.g?t.v=="GET"&&t.L!=2&&t.l.Ha:!1}function G1(t,e,n){let r=!0,i;for(;!t.J&&t.o<n.length;)if(i=EN(t,n),i==im){e==4&&(t.s=4,Ct(14),r=!1),to(t.j,t.m,null,"[Incomplete Response]");break}else if(i==z1){t.s=4,Ct(15),to(t.j,t.m,n,"[Invalid Chunk]"),r=!1;break}else to(t.j,t.m,i,null),om(t,i);H1(t)&&t.o!=0&&(t.h.g=t.h.g.slice(t.o),t.o=0),e!=4||n.length!=0||t.h.h||(t.s=1,Ct(16),r=!1),t.i=t.i&&r,r?0<n.length&&!t.ba&&(t.ba=!0,e=t.l,e.g==t&&e.ca&&!e.M&&(e.l.info("Great, no buffering proxy detected. Bytes received: "+n.length),fm(e),e.M=!0,Ct(11))):(to(t.j,t.m,n,"[Invalid Chunked Response]"),Ki(t),cl(t))}F.mb=function(){if(this.g){var t=Ln(this.g),e=this.g.ja();this.o<e.length&&(lh(this),G1(this,t,e),this.i&&t!=4&&ul(this))}};function EN(t,e){var n=t.o,r=e.indexOf(`
`,n);return r==-1?im:(n=Number(e.substring(n,r)),isNaN(n)?z1:(r+=1,r+n>e.length?im:(e=e.slice(r,r+n),t.o=r+n,e)))}F.cancel=function(){this.J=!0,Ki(this)};function ul(t){t.Y=Date.now()+t.P,W1(t,t.P)}function W1(t,e){if(t.C!=null)throw Error("WatchDog timer not null");t.C=ol(ft(t.lb,t),e)}function lh(t){t.C&&(ee.clearTimeout(t.C),t.C=null)}F.lb=function(){this.C=null;const t=Date.now();0<=t-this.Y?(yN(this.j,this.B),this.L!=2&&(sl(),Ct(17)),Ki(this),this.s=2,cl(this)):W1(this,this.Y-t)};function cl(t){t.l.H==0||t.J||_x(t.l,t)}function Ki(t){lh(t);var e=t.M;e&&typeof e.sa=="function"&&e.sa(),t.M=null,Jg(t.V),O1(t.U),t.g&&(e=t.g,t.g=null,e.abort(),e.sa())}function om(t,e){try{var n=t.l;if(n.H!=0&&(n.g==t||am(n.i,t))){if(!t.K&&am(n.i,t)&&n.H==3){try{var r=n.Ja.g.parse(e)}catch{r=null}if(Array.isArray(r)&&r.length==3){var i=r;if(i[0]==0){e:if(!n.u){if(n.g)if(n.g.G+3e3<t.G)yh(n),mh(n);else break e;dm(n),Ct(18)}}else n.Fa=i[1],0<n.Fa-n.V&&37500>i[2]&&n.G&&n.A==0&&!n.v&&(n.v=ol(ft(n.ib,n),6e3));if(1>=nx(n.i)&&n.oa){try{n.oa()}catch{}n.oa=void 0}}else Xi(n,11)}else if((t.K||n.g==t)&&yh(n),!Za(e))for(i=n.Ja.g.parse(e),e=0;e<i.length;e++){let u=i[e];if(n.V=u[0],u=u[1],n.H==2)if(u[0]=="c"){n.K=u[1],n.pa=u[2];const c=u[3];c!=null&&(n.ra=c,n.l.info("VER="+n.ra));const h=u[4];h!=null&&(n.Ga=h,n.l.info("SVER="+n.Ga));const d=u[5];d!=null&&typeof d=="number"&&0<d&&(r=1.5*d,n.L=r,n.l.info("backChannelRequestTimeoutMs_="+r)),r=n;const f=t.g;if(f){const g=f.g?f.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(g){var s=r.i;s.g||g.indexOf("spdy")==-1&&g.indexOf("quic")==-1&&g.indexOf("h2")==-1||(s.j=s.l,s.g=new Set,s.h&&(lm(s,s.h),s.h=null))}if(r.F){const m=f.g?f.g.getResponseHeader("X-HTTP-Session-Id"):null;m&&(r.Da=m,Ie(r.I,r.F,m))}}n.H=3,n.h&&n.h.Ba(),n.ca&&(n.S=Date.now()-t.G,n.l.info("Handshake RTT: "+n.S+"ms")),r=n;var o=t;if(r.wa=xx(r,r.J?r.pa:null,r.Y),o.K){rx(r.i,o);var a=o,l=r.L;l&&a.setTimeout(l),a.C&&(lh(a),ul(a)),r.g=o}else vx(r);0<n.j.length&&vh(n)}else u[0]!="stop"&&u[0]!="close"||Xi(n,7);else n.H==3&&(u[0]=="stop"||u[0]=="close"?u[0]=="stop"?Xi(n,7):hm(n):u[0]!="noop"&&n.h&&n.h.Aa(u),n.A=0)}}sl(4)}catch{}}function xN(t){if(t.Z&&typeof t.Z=="function")return t.Z();if(typeof Map!="undefined"&&t instanceof Map||typeof Set!="undefined"&&t instanceof Set)return Array.from(t.values());if(typeof t=="string")return t.split("");if(Xc(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}e=[],n=0;for(r in t)e[n++]=t[r];return e}function SN(t){if(t.ta&&typeof t.ta=="function")return t.ta();if(!t.Z||typeof t.Z!="function"){if(typeof Map!="undefined"&&t instanceof Map)return Array.from(t.keys());if(!(typeof Set!="undefined"&&t instanceof Set)){if(Xc(t)||typeof t=="string"){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}e=[],n=0;for(const r in t)e[n++]=r;return e}}}function Q1(t,e){if(t.forEach&&typeof t.forEach=="function")t.forEach(e,void 0);else if(Xc(t)||typeof t=="string")Array.prototype.forEach.call(t,e,void 0);else for(var n=SN(t),r=xN(t),i=r.length,s=0;s<i;s++)e.call(void 0,r[s],n&&n[s],t)}var q1=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function IN(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var s=t[n].substring(0,r);i=t[n].substring(r+1)}else s=t[n];e(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}function Yi(t){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Yi){this.h=t.h,uh(this,t.j),this.s=t.s,this.g=t.g,ch(this,t.m),this.l=t.l;var e=t.i,n=new fl;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),K1(this,n),this.o=t.o}else t&&(e=String(t).match(q1))?(this.h=!1,uh(this,e[1]||"",!0),this.s=hl(e[2]||""),this.g=hl(e[3]||"",!0),ch(this,e[4]),this.l=hl(e[5]||"",!0),K1(this,e[6]||"",!0),this.o=hl(e[7]||"")):(this.h=!1,this.i=new fl(null,this.h))}Yi.prototype.toString=function(){var t=[],e=this.j;e&&t.push(dl(e,Y1,!0),":");var n=this.g;return(n||e=="file")&&(t.push("//"),(e=this.s)&&t.push(dl(e,Y1,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),n=this.m,n!=null&&t.push(":",String(n))),(n=this.l)&&(this.g&&n.charAt(0)!="/"&&t.push("/"),t.push(dl(n,n.charAt(0)=="/"?CN:TN,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",dl(n,RN)),t.join("")};function dr(t){return new Yi(t)}function uh(t,e,n){t.j=n?hl(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function ch(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function K1(t,e,n){e instanceof fl?(t.i=e,kN(t.i,t.h)):(n||(e=dl(e,bN)),t.i=new fl(e,t.h))}function Ie(t,e,n){t.i.set(e,n)}function hh(t){return Ie(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function hl(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function dl(t,e,n){return typeof t=="string"?(t=encodeURI(t).replace(e,AN),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function AN(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(t&15).toString(16)}var Y1=/[#\/\?@]/g,TN=/[#\?:]/g,CN=/[#\?]/g,bN=/[#\?@]/g,RN=/#/g;function fl(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function ei(t){t.g||(t.g=new Map,t.h=0,t.i&&IN(t.i,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}F=fl.prototype,F.add=function(t,e){ei(this),this.i=null,t=no(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this};function X1(t,e){ei(t),e=no(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function J1(t,e){return ei(t),e=no(t,e),t.g.has(e)}F.forEach=function(t,e){ei(this),this.g.forEach(function(n,r){n.forEach(function(i){t.call(e,i,r,this)},this)},this)},F.ta=function(){ei(this);const t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[];for(let r=0;r<e.length;r++){const i=t[r];for(let s=0;s<i.length;s++)n.push(e[r])}return n},F.Z=function(t){ei(this);let e=[];if(typeof t=="string")J1(this,t)&&(e=e.concat(this.g.get(no(this,t))));else{t=Array.from(this.g.values());for(let n=0;n<t.length;n++)e=e.concat(t[n])}return e},F.set=function(t,e){return ei(this),this.i=null,t=no(this,t),J1(this,t)&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},F.get=function(t,e){return t?(t=this.Z(t),0<t.length?String(t[0]):e):e};function Z1(t,e,n){X1(t,e),0<n.length&&(t.i=null,t.g.set(no(t,e),Og(n)),t.h+=n.length)}F.toString=function(){if(this.i)return this.i;if(!this.g)return"";const t=[],e=Array.from(this.g.keys());for(var n=0;n<e.length;n++){var r=e[n];const s=encodeURIComponent(String(r)),o=this.Z(r);for(r=0;r<o.length;r++){var i=s;o[r]!==""&&(i+="="+encodeURIComponent(String(o[r]))),t.push(i)}}return this.i=t.join("&")};function no(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}function kN(t,e){e&&!t.j&&(ei(t),t.i=null,t.g.forEach(function(n,r){var i=r.toLowerCase();r!=i&&(X1(this,r),Z1(this,i,n))},t)),t.j=e}var PN=class{constructor(t,e){this.g=t,this.map=e}};function ex(t){this.l=t||NN,ee.PerformanceNavigationTiming?(t=ee.performance.getEntriesByType("navigation"),t=0<t.length&&(t[0].nextHopProtocol=="hq"||t[0].nextHopProtocol=="h2")):t=!!(ee.g&&ee.g.Ka&&ee.g.Ka()&&ee.g.Ka().dc),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var NN=10;function tx(t){return t.h?!0:t.g?t.g.size>=t.j:!1}function nx(t){return t.h?1:t.g?t.g.size:0}function am(t,e){return t.h?t.h==e:t.g?t.g.has(e):!1}function lm(t,e){t.g?t.g.add(e):t.h=e}function rx(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}ex.prototype.cancel=function(){if(this.i=ix(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const t of this.g.values())t.cancel();this.g.clear()}};function ix(t){if(t.h!=null)return t.i.concat(t.h.F);if(t.g!=null&&t.g.size!==0){let e=t.i;for(const n of t.g.values())e=e.concat(n.F);return e}return Og(t.i)}var ON=class{stringify(t){return ee.JSON.stringify(t,void 0)}parse(t){return ee.JSON.parse(t,void 0)}};function DN(){this.g=new ON}function MN(t,e,n){const r=n||"";try{Q1(t,function(i,s){let o=i;Ja(i)&&(o=Yg(i)),e.push(r+s+"="+encodeURIComponent(o))})}catch(i){throw e.push(r+"type="+encodeURIComponent("_badmap")),i}}function LN(t,e){const n=new ih;if(ee.Image){const r=new Image;r.onload=Jc(dh,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Jc(dh,n,r,"TestLoadImage: error",!1,e),r.onabort=Jc(dh,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Jc(dh,n,r,"TestLoadImage: timeout",!1,e),ee.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=t}else e(!1)}function dh(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch{}}function fh(t){this.l=t.ec||null,this.j=t.ob||!1}Ke(fh,em),fh.prototype.g=function(){return new ph(this.l,this.j)},fh.prototype.i=function(t){return function(){return t}}({});function ph(t,e){Ye.call(this),this.F=t,this.u=e,this.m=void 0,this.readyState=um,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}Ke(ph,Ye);var um=0;F=ph.prototype,F.open=function(t,e){if(this.readyState!=um)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,gl(this)},F.send=function(t){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.F||ee).fetch(new Request(this.B,e)).then(this.$a.bind(this),this.ka.bind(this))},F.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,pl(this)),this.readyState=um},F.$a=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,gl(this)),this.g&&(this.readyState=3,gl(this),this.g)))if(this.responseType==="arraybuffer")t.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if(typeof ee.ReadableStream!="undefined"&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;sx(this)}else t.text().then(this.Za.bind(this),this.ka.bind(this))};function sx(t){t.j.read().then(t.Xa.bind(t)).catch(t.ka.bind(t))}F.Xa=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?pl(this):gl(this),this.readyState==3&&sx(this)}},F.Za=function(t){this.g&&(this.response=this.responseText=t,pl(this))},F.Ya=function(t){this.g&&(this.response=t,pl(this))},F.ka=function(){this.g&&pl(this)};function pl(t){t.readyState=4,t.l=null,t.j=null,t.A=null,gl(t)}F.setRequestHeader=function(t,e){this.v.append(t,e)},F.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},F.getAllResponseHeaders=function(){if(!this.h)return"";const t=[],e=this.h.entries();for(var n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join(`\r
`)};function gl(t){t.onreadystatechange&&t.onreadystatechange.call(t)}Object.defineProperty(ph.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(t){this.m=t?"include":"same-origin"}});var VN=ee.JSON.parse;function Oe(t){Ye.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=ox,this.L=this.M=!1}Ke(Oe,Ye);var ox="",FN=/^https?$/i,UN=["POST","PUT"];F=Oe.prototype,F.Oa=function(t){this.M=t},F.ha=function(t,e,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+t);e=e?e.toUpperCase():"GET",this.I=t,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():rm.g(),this.C=this.u?U1(this.u):U1(rm),this.g.onreadystatechange=ft(this.La,this);try{this.G=!0,this.g.open(e,String(t),!0),this.G=!1}catch(s){ax(this,s);return}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else if(typeof r.keys=="function"&&typeof r.get=="function")for(const s of r.keys())n.set(s,r.get(s));else throw Error("Unknown input type for opt_headers: "+String(r));r=Array.from(n.keys()).find(s=>s.toLowerCase()=="content-type"),i=ee.FormData&&t instanceof ee.FormData,!(0<=p1(UN,e))||r||i||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[s,o]of n)this.g.setRequestHeader(s,o);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{cx(this),0<this.B&&((this.L=$N(this.g))?(this.g.timeout=this.B,this.g.ontimeout=ft(this.ua,this)):this.A=Zg(this.ua,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(s){ax(this,s)}};function $N(t){return eo&&typeof t.timeout=="number"&&t.ontimeout!==void 0}F.ua=function(){typeof Pg!="undefined"&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,nt(this,"timeout"),this.abort(8))};function ax(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,lx(t),gh(t)}function lx(t){t.F||(t.F=!0,nt(t,"complete"),nt(t,"error"))}F.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,nt(this,"complete"),nt(this,"abort"),gh(this))},F.N=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),gh(this,!0)),Oe.$.N.call(this)},F.La=function(){this.s||(this.G||this.v||this.l?ux(this):this.kb())},F.kb=function(){ux(this)};function ux(t){if(t.h&&typeof Pg!="undefined"&&(!t.C[1]||Ln(t)!=4||t.da()!=2)){if(t.v&&Ln(t)==4)Zg(t.La,0,t);else if(nt(t,"readystatechange"),Ln(t)==4){t.h=!1;try{const o=t.da();e:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break e;default:e=!1}var n;if(!(n=e)){var r;if(r=o===0){var i=String(t.I).match(q1)[1]||null;!i&&ee.self&&ee.self.location&&(i=ee.self.location.protocol.slice(0,-1)),r=!FN.test(i?i.toLowerCase():"")}n=r}if(n)nt(t,"complete"),nt(t,"success");else{t.m=6;try{var s=2<Ln(t)?t.g.statusText:""}catch{s=""}t.j=s+" ["+t.da()+"]",lx(t)}}finally{gh(t)}}}}function gh(t,e){if(t.g){cx(t);const n=t.g,r=t.C[0]?()=>{}:null;t.g=null,t.C=null,e||nt(t,"ready");try{n.onreadystatechange=r}catch{}}}function cx(t){t.g&&t.L&&(t.g.ontimeout=null),t.A&&(ee.clearTimeout(t.A),t.A=null)}F.isActive=function(){return!!this.g};function Ln(t){return t.g?t.g.readyState:0}F.da=function(){try{return 2<Ln(this)?this.g.status:-1}catch{return-1}},F.ja=function(){try{return this.g?this.g.responseText:""}catch{return""}},F.Wa=function(t){if(this.g){var e=this.g.responseText;return t&&e.indexOf(t)==0&&(e=e.substring(t.length)),VN(e)}};function hx(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.K){case ox:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch{return null}}function jN(t){const e={};t=(t.g&&2<=Ln(t)&&t.g.getAllResponseHeaders()||"").split(`\r
`);for(let r=0;r<t.length;r++){if(Za(t[r]))continue;var n=dN(t[r]);const i=n[0];if(n=n[1],typeof n!="string")continue;n=n.trim();const s=e[i]||[];e[i]=s,s.push(n)}sN(e,function(r){return r.join(", ")})}F.Ia=function(){return this.m},F.Sa=function(){return typeof this.j=="string"?this.j:String(this.j)};function dx(t){let e="";return jg(t,function(n,r){e+=r,e+=":",e+=n,e+=`\r
`}),e}function cm(t,e,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=dx(n),typeof t=="string"?n!=null&&encodeURIComponent(String(n)):Ie(t,e,n))}function ml(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function fx(t){this.Ga=0,this.j=[],this.l=new ih,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=ml("failFast",!1,t),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=ml("baseRetryDelayMs",5e3,t),this.hb=ml("retryDelaySeedMs",1e4,t),this.eb=ml("forwardChannelMaxRetries",2,t),this.xa=ml("forwardChannelRequestTimeoutMs",2e4,t),this.va=t&&t.xmlHttpFactory||void 0,this.Ha=t&&t.useFetchStreams||!1,this.L=void 0,this.J=t&&t.supportsCrossDomainXhr||!1,this.K="",this.i=new ex(t&&t.concurrentRequestLimit),this.Ja=new DN,this.P=t&&t.fastHandshake||!1,this.O=t&&t.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=t&&t.bc||!1,t&&t.Ea&&this.l.Ea(),t&&t.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&t&&t.detectBufferingProxy||!1,this.qa=void 0,t&&t.longPollingTimeout&&0<t.longPollingTimeout&&(this.qa=t.longPollingTimeout),this.oa=void 0,this.S=0,this.M=!1,this.ma=this.B=null}F=fx.prototype,F.ra=8,F.H=1;function hm(t){if(px(t),t.H==3){var e=t.W++,n=dr(t.I);if(Ie(n,"SID",t.K),Ie(n,"RID",e),Ie(n,"TYPE","terminate"),vl(t,n),e=new ll(t,t.l,e),e.L=2,e.A=hh(dr(n)),n=!1,ee.navigator&&ee.navigator.sendBeacon)try{n=ee.navigator.sendBeacon(e.A.toString(),"")}catch{}!n&&ee.Image&&(new Image().src=e.A,n=!0),n||(e.g=Sx(e.l,null),e.g.ha(e.A)),e.G=Date.now(),ul(e)}Ex(t)}function mh(t){t.g&&(fm(t),t.g.cancel(),t.g=null)}function px(t){mh(t),t.u&&(ee.clearTimeout(t.u),t.u=null),yh(t),t.i.cancel(),t.m&&(typeof t.m=="number"&&ee.clearTimeout(t.m),t.m=null)}function vh(t){if(!tx(t.i)&&!t.m){t.m=!0;var e=t.Na;nl||R1(),rl||(nl(),rl=!0),Xg.add(e,t),t.C=0}}function zN(t,e){return nx(t.i)>=t.i.j-(t.m?1:0)?!1:t.m?(t.j=e.F.concat(t.j),!0):t.H==1||t.H==2||t.C>=(t.cb?0:t.eb)?!1:(t.m=ol(ft(t.Na,t,e),wx(t,t.C)),t.C++,!0)}F.Na=function(t){if(this.m)if(this.m=null,this.H==1){if(!t){this.W=Math.floor(1e5*Math.random()),t=this.W++;const i=new ll(this,this.l,t);let s=this.s;if(this.U&&(s?(s=w1(s),x1(s,this.U)):s=this.U),this.o!==null||this.O||(i.I=s,s=null),this.P)e:{for(var e=0,n=0;n<this.j.length;n++){t:{var r=this.j[n];if("__data__"in r.map&&(r=r.map.__data__,typeof r=="string")){r=r.length;break t}r=void 0}if(r===void 0)break;if(e+=r,4096<e){e=n;break e}if(e===4096||n===this.j.length-1){e=n+1;break e}}e=1e3}else e=1e3;e=mx(this,i,e),n=dr(this.I),Ie(n,"RID",t),Ie(n,"CVER",22),this.F&&Ie(n,"X-HTTP-Session-Id",this.F),vl(this,n),s&&(this.O?e="headers="+encodeURIComponent(String(dx(s)))+"&"+e:this.o&&cm(n,this.o,s)),lm(this.i,i),this.bb&&Ie(n,"TYPE","init"),this.P?(Ie(n,"$req",e),Ie(n,"SID","null"),i.aa=!0,sm(i,n,null)):sm(i,n,e),this.H=2}}else this.H==3&&(t?gx(this,t):this.j.length==0||tx(this.i)||gx(this))};function gx(t,e){var n;e?n=e.m:n=t.W++;const r=dr(t.I);Ie(r,"SID",t.K),Ie(r,"RID",n),Ie(r,"AID",t.V),vl(t,r),t.o&&t.s&&cm(r,t.o,t.s),n=new ll(t,t.l,n,t.C+1),t.o===null&&(n.I=t.s),e&&(t.j=e.F.concat(t.j)),e=mx(t,n,1e3),n.setTimeout(Math.round(.5*t.xa)+Math.round(.5*t.xa*Math.random())),lm(t.i,n),sm(n,r,e)}function vl(t,e){t.na&&jg(t.na,function(n,r){Ie(e,r,n)}),t.h&&Q1({},function(n,r){Ie(e,r,n)})}function mx(t,e,n){n=Math.min(t.j.length,n);var r=t.h?ft(t.h.Va,t.h,t):null;e:{var i=t.j;let s=-1;for(;;){const o=["count="+n];s==-1?0<n?(s=i[0].g,o.push("ofs="+s)):s=0:o.push("ofs="+s);let a=!0;for(let l=0;l<n;l++){let u=i[l].g;const c=i[l].map;if(u-=s,0>u)s=Math.max(0,i[l].g-100),a=!1;else try{MN(c,o,"req"+u+"_")}catch{r&&r(c)}}if(a){r=o.join("&");break e}}}return t=t.j.splice(0,n),e.F=t,r}function vx(t){if(!t.g&&!t.u){t.ba=1;var e=t.Ma;nl||R1(),rl||(nl(),rl=!0),Xg.add(e,t),t.A=0}}function dm(t){return t.g||t.u||3<=t.A?!1:(t.ba++,t.u=ol(ft(t.Ma,t),wx(t,t.A)),t.A++,!0)}F.Ma=function(){if(this.u=null,yx(this),this.ca&&!(this.M||this.g==null||0>=this.S)){var t=2*this.S;this.l.info("BP detection timer enabled: "+t),this.B=ol(ft(this.jb,this),t)}},F.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,Ct(10),mh(this),yx(this))};function fm(t){t.B!=null&&(ee.clearTimeout(t.B),t.B=null)}function yx(t){t.g=new ll(t,t.l,"rpc",t.ba),t.o===null&&(t.g.I=t.s),t.g.O=0;var e=dr(t.wa);Ie(e,"RID","rpc"),Ie(e,"SID",t.K),Ie(e,"AID",t.V),Ie(e,"CI",t.G?"0":"1"),!t.G&&t.qa&&Ie(e,"TO",t.qa),Ie(e,"TYPE","xmlhttp"),vl(t,e),t.o&&t.s&&cm(e,t.o,t.s),t.L&&t.g.setTimeout(t.L);var n=t.g;t=t.pa,n.L=1,n.A=hh(dr(e)),n.u=null,n.S=!0,B1(n,t)}F.ib=function(){this.v!=null&&(this.v=null,mh(this),dm(this),Ct(19))};function yh(t){t.v!=null&&(ee.clearTimeout(t.v),t.v=null)}function _x(t,e){var n=null;if(t.g==e){yh(t),fm(t),t.g=null;var r=2}else if(am(t.i,e))n=e.F,rx(t.i,e),r=1;else return;if(t.H!=0){if(e.i)if(r==1){n=e.u?e.u.length:0,e=Date.now()-e.G;var i=t.C;r=sh(),nt(r,new V1(r,n)),vh(t)}else vx(t);else if(i=e.s,i==3||i==0&&0<e.ca||!(r==1&&zN(t,e)||r==2&&dm(t)))switch(n&&0<n.length&&(e=t.i,e.i=e.i.concat(n)),i){case 1:Xi(t,5);break;case 4:Xi(t,10);break;case 3:Xi(t,6);break;default:Xi(t,2)}}}function wx(t,e){let n=t.ab+Math.floor(Math.random()*t.hb);return t.isActive()||(n*=2),n*e}function Xi(t,e){if(t.l.info("Error code "+e),e==2){var n=null;t.h&&(n=null);var r=ft(t.pb,t);n||(n=new Yi("//www.google.com/images/cleardot.gif"),ee.location&&ee.location.protocol=="http"||uh(n,"https"),hh(n)),LN(n.toString(),r)}else Ct(2);t.H=0,t.h&&t.h.za(e),Ex(t),px(t)}F.pb=function(t){t?(this.l.info("Successfully pinged google.com"),Ct(2)):(this.l.info("Failed to ping google.com"),Ct(1))};function Ex(t){if(t.H=0,t.ma=[],t.h){const e=ix(t.i);(e.length!=0||t.j.length!=0)&&(g1(t.ma,e),g1(t.ma,t.j),t.i.i.length=0,Og(t.j),t.j.length=0),t.h.ya()}}function xx(t,e,n){var r=n instanceof Yi?dr(n):new Yi(n);if(r.g!="")e&&(r.g=e+"."+r.g),ch(r,r.m);else{var i=ee.location;r=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new Yi(null);r&&uh(s,r),e&&(s.g=e),i&&ch(s,i),n&&(s.l=n),r=s}return n=t.F,e=t.Da,n&&e&&Ie(r,n,e),Ie(r,"VER",t.ra),vl(t,r),r}function Sx(t,e,n){if(e&&!t.J)throw Error("Can't create secondary domain capable XhrIo object.");return e=t.Ha&&!t.va?new Oe(new fh({ob:n})):new Oe(t.va),e.Oa(t.J),e}F.isActive=function(){return!!this.h&&this.h.isActive(this)};function Ix(){}F=Ix.prototype,F.Ba=function(){},F.Aa=function(){},F.za=function(){},F.ya=function(){},F.isActive=function(){return!0},F.Va=function(){};function _h(){if(eo&&!(10<=Number(tN)))throw Error("Environmental error: no available transport.")}_h.prototype.g=function(t,e){return new Qt(t,e)};function Qt(t,e){Ye.call(this),this.g=new fx(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.Ca&&(t?t["X-WebChannel-Client-Profile"]=e.Ca:t={"X-WebChannel-Client-Profile":e.Ca}),this.g.U=t,(t=e&&e.cc)&&!Za(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Za(e)&&(this.g.F=e,t=this.h,t!==null&&e in t&&(t=this.h,e in t&&delete t[e])),this.j=new ro(this)}Ke(Qt,Ye),Qt.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var t=this.g,e=this.l,n=this.h||void 0;Ct(0),t.Y=e,t.na=n||{},t.G=t.aa,t.I=xx(t,null,t.Y),vh(t)},Qt.prototype.close=function(){hm(this.g)},Qt.prototype.u=function(t){var e=this.g;if(typeof t=="string"){var n={};n.__data__=t,t=n}else this.v&&(n={},n.__data__=Yg(t),t=n);e.j.push(new PN(e.fb++,t)),e.H==3&&vh(e)},Qt.prototype.N=function(){this.g.h=null,delete this.j,hm(this.g),delete this.g,Qt.$.N.call(this)};function Ax(t){tm.call(this),t.__headers__&&(this.headers=t.__headers__,this.statusCode=t.__status__,delete t.__headers__,delete t.__status__);var e=t.__sm__;if(e){e:{for(const n in e){t=n;break e}t=void 0}(this.i=t)&&(t=this.i,e=e!==null&&t in e?e[t]:void 0),this.data=e}else this.data=t}Ke(Ax,tm);function Tx(){nm.call(this),this.status=1}Ke(Tx,nm);function ro(t){this.g=t}Ke(ro,Ix),ro.prototype.Ba=function(){nt(this.g,"a")},ro.prototype.Aa=function(t){nt(this.g,new Ax(t))},ro.prototype.za=function(t){nt(this.g,new Tx)},ro.prototype.ya=function(){nt(this.g,"b")};function BN(){this.blockSize=-1}function yn(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.m=Array(this.blockSize),this.i=this.h=0,this.reset()}Ke(yn,BN),yn.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0};function pm(t,e,n){n||(n=0);var r=Array(16);if(typeof e=="string")for(var i=0;16>i;++i)r[i]=e.charCodeAt(n++)|e.charCodeAt(n++)<<8|e.charCodeAt(n++)<<16|e.charCodeAt(n++)<<24;else for(i=0;16>i;++i)r[i]=e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24;e=t.g[0],n=t.g[1],i=t.g[2];var s=t.g[3],o=e+(s^n&(i^s))+r[0]+3614090360&4294967295;e=n+(o<<7&4294967295|o>>>25),o=s+(i^e&(n^i))+r[1]+3905402710&4294967295,s=e+(o<<12&4294967295|o>>>20),o=i+(n^s&(e^n))+r[2]+606105819&4294967295,i=s+(o<<17&4294967295|o>>>15),o=n+(e^i&(s^e))+r[3]+3250441966&4294967295,n=i+(o<<22&4294967295|o>>>10),o=e+(s^n&(i^s))+r[4]+4118548399&4294967295,e=n+(o<<7&4294967295|o>>>25),o=s+(i^e&(n^i))+r[5]+1200080426&4294967295,s=e+(o<<12&4294967295|o>>>20),o=i+(n^s&(e^n))+r[6]+2821735955&4294967295,i=s+(o<<17&4294967295|o>>>15),o=n+(e^i&(s^e))+r[7]+4249261313&4294967295,n=i+(o<<22&4294967295|o>>>10),o=e+(s^n&(i^s))+r[8]+1770035416&4294967295,e=n+(o<<7&4294967295|o>>>25),o=s+(i^e&(n^i))+r[9]+2336552879&4294967295,s=e+(o<<12&4294967295|o>>>20),o=i+(n^s&(e^n))+r[10]+4294925233&4294967295,i=s+(o<<17&4294967295|o>>>15),o=n+(e^i&(s^e))+r[11]+2304563134&4294967295,n=i+(o<<22&4294967295|o>>>10),o=e+(s^n&(i^s))+r[12]+1804603682&4294967295,e=n+(o<<7&4294967295|o>>>25),o=s+(i^e&(n^i))+r[13]+4254626195&4294967295,s=e+(o<<12&4294967295|o>>>20),o=i+(n^s&(e^n))+r[14]+2792965006&4294967295,i=s+(o<<17&4294967295|o>>>15),o=n+(e^i&(s^e))+r[15]+1236535329&4294967295,n=i+(o<<22&4294967295|o>>>10),o=e+(i^s&(n^i))+r[1]+4129170786&4294967295,e=n+(o<<5&4294967295|o>>>27),o=s+(n^i&(e^n))+r[6]+3225465664&4294967295,s=e+(o<<9&4294967295|o>>>23),o=i+(e^n&(s^e))+r[11]+643717713&4294967295,i=s+(o<<14&4294967295|o>>>18),o=n+(s^e&(i^s))+r[0]+3921069994&4294967295,n=i+(o<<20&4294967295|o>>>12),o=e+(i^s&(n^i))+r[5]+3593408605&4294967295,e=n+(o<<5&4294967295|o>>>27),o=s+(n^i&(e^n))+r[10]+38016083&4294967295,s=e+(o<<9&4294967295|o>>>23),o=i+(e^n&(s^e))+r[15]+3634488961&4294967295,i=s+(o<<14&4294967295|o>>>18),o=n+(s^e&(i^s))+r[4]+3889429448&4294967295,n=i+(o<<20&4294967295|o>>>12),o=e+(i^s&(n^i))+r[9]+568446438&4294967295,e=n+(o<<5&4294967295|o>>>27),o=s+(n^i&(e^n))+r[14]+3275163606&4294967295,s=e+(o<<9&4294967295|o>>>23),o=i+(e^n&(s^e))+r[3]+4107603335&4294967295,i=s+(o<<14&4294967295|o>>>18),o=n+(s^e&(i^s))+r[8]+1163531501&4294967295,n=i+(o<<20&4294967295|o>>>12),o=e+(i^s&(n^i))+r[13]+2850285829&4294967295,e=n+(o<<5&4294967295|o>>>27),o=s+(n^i&(e^n))+r[2]+4243563512&4294967295,s=e+(o<<9&4294967295|o>>>23),o=i+(e^n&(s^e))+r[7]+1735328473&4294967295,i=s+(o<<14&4294967295|o>>>18),o=n+(s^e&(i^s))+r[12]+2368359562&4294967295,n=i+(o<<20&4294967295|o>>>12),o=e+(n^i^s)+r[5]+4294588738&4294967295,e=n+(o<<4&4294967295|o>>>28),o=s+(e^n^i)+r[8]+2272392833&4294967295,s=e+(o<<11&4294967295|o>>>21),o=i+(s^e^n)+r[11]+1839030562&4294967295,i=s+(o<<16&4294967295|o>>>16),o=n+(i^s^e)+r[14]+4259657740&4294967295,n=i+(o<<23&4294967295|o>>>9),o=e+(n^i^s)+r[1]+2763975236&4294967295,e=n+(o<<4&4294967295|o>>>28),o=s+(e^n^i)+r[4]+1272893353&4294967295,s=e+(o<<11&4294967295|o>>>21),o=i+(s^e^n)+r[7]+4139469664&4294967295,i=s+(o<<16&4294967295|o>>>16),o=n+(i^s^e)+r[10]+3200236656&4294967295,n=i+(o<<23&4294967295|o>>>9),o=e+(n^i^s)+r[13]+681279174&4294967295,e=n+(o<<4&4294967295|o>>>28),o=s+(e^n^i)+r[0]+3936430074&4294967295,s=e+(o<<11&4294967295|o>>>21),o=i+(s^e^n)+r[3]+3572445317&4294967295,i=s+(o<<16&4294967295|o>>>16),o=n+(i^s^e)+r[6]+76029189&4294967295,n=i+(o<<23&4294967295|o>>>9),o=e+(n^i^s)+r[9]+3654602809&4294967295,e=n+(o<<4&4294967295|o>>>28),o=s+(e^n^i)+r[12]+3873151461&4294967295,s=e+(o<<11&4294967295|o>>>21),o=i+(s^e^n)+r[15]+530742520&4294967295,i=s+(o<<16&4294967295|o>>>16),o=n+(i^s^e)+r[2]+3299628645&4294967295,n=i+(o<<23&4294967295|o>>>9),o=e+(i^(n|~s))+r[0]+4096336452&4294967295,e=n+(o<<6&4294967295|o>>>26),o=s+(n^(e|~i))+r[7]+1126891415&4294967295,s=e+(o<<10&4294967295|o>>>22),o=i+(e^(s|~n))+r[14]+2878612391&4294967295,i=s+(o<<15&4294967295|o>>>17),o=n+(s^(i|~e))+r[5]+4237533241&4294967295,n=i+(o<<21&4294967295|o>>>11),o=e+(i^(n|~s))+r[12]+1700485571&4294967295,e=n+(o<<6&4294967295|o>>>26),o=s+(n^(e|~i))+r[3]+2399980690&4294967295,s=e+(o<<10&4294967295|o>>>22),o=i+(e^(s|~n))+r[10]+4293915773&4294967295,i=s+(o<<15&4294967295|o>>>17),o=n+(s^(i|~e))+r[1]+2240044497&4294967295,n=i+(o<<21&4294967295|o>>>11),o=e+(i^(n|~s))+r[8]+1873313359&4294967295,e=n+(o<<6&4294967295|o>>>26),o=s+(n^(e|~i))+r[15]+4264355552&4294967295,s=e+(o<<10&4294967295|o>>>22),o=i+(e^(s|~n))+r[6]+2734768916&4294967295,i=s+(o<<15&4294967295|o>>>17),o=n+(s^(i|~e))+r[13]+1309151649&4294967295,n=i+(o<<21&4294967295|o>>>11),o=e+(i^(n|~s))+r[4]+4149444226&4294967295,e=n+(o<<6&4294967295|o>>>26),o=s+(n^(e|~i))+r[11]+3174756917&4294967295,s=e+(o<<10&4294967295|o>>>22),o=i+(e^(s|~n))+r[2]+718787259&4294967295,i=s+(o<<15&4294967295|o>>>17),o=n+(s^(i|~e))+r[9]+3951481745&4294967295,t.g[0]=t.g[0]+e&4294967295,t.g[1]=t.g[1]+(i+(o<<21&4294967295|o>>>11))&4294967295,t.g[2]=t.g[2]+i&4294967295,t.g[3]=t.g[3]+s&4294967295}yn.prototype.j=function(t,e){e===void 0&&(e=t.length);for(var n=e-this.blockSize,r=this.m,i=this.h,s=0;s<e;){if(i==0)for(;s<=n;)pm(this,t,s),s+=this.blockSize;if(typeof t=="string"){for(;s<e;)if(r[i++]=t.charCodeAt(s++),i==this.blockSize){pm(this,r),i=0;break}}else for(;s<e;)if(r[i++]=t[s++],i==this.blockSize){pm(this,r),i=0;break}}this.h=i,this.i+=e},yn.prototype.l=function(){var t=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);t[0]=128;for(var e=1;e<t.length-8;++e)t[e]=0;var n=8*this.i;for(e=t.length-8;e<t.length;++e)t[e]=n&255,n/=256;for(this.j(t),t=Array(16),e=n=0;4>e;++e)for(var r=0;32>r;r+=8)t[n++]=this.g[e]>>>r&255;return t};function me(t,e){this.h=e;for(var n=[],r=!0,i=t.length-1;0<=i;i--){var s=t[i]|0;r&&s==e||(n[i]=s,r=!1)}this.g=n}var HN={};function gm(t){return-128<=t&&128>t?JP(t,function(e){return new me([e|0],0>e?-1:0)}):new me([t|0],0>t?-1:0)}function Vn(t){if(isNaN(t)||!isFinite(t))return io;if(0>t)return rt(Vn(-t));for(var e=[],n=1,r=0;t>=n;r++)e[r]=t/n|0,n*=mm;return new me(e,0)}function Cx(t,e){if(t.length==0)throw Error("number format error: empty string");if(e=e||10,2>e||36<e)throw Error("radix out of range: "+e);if(t.charAt(0)=="-")return rt(Cx(t.substring(1),e));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var n=Vn(Math.pow(e,8)),r=io,i=0;i<t.length;i+=8){var s=Math.min(8,t.length-i),o=parseInt(t.substring(i,i+s),e);8>s?(s=Vn(Math.pow(e,s)),r=r.R(s).add(Vn(o))):(r=r.R(n),r=r.add(Vn(o)))}return r}var mm=4294967296,io=gm(0),vm=gm(1),bx=gm(16777216);F=me.prototype,F.ea=function(){if(on(this))return-rt(this).ea();for(var t=0,e=1,n=0;n<this.g.length;n++){var r=this.D(n);t+=(0<=r?r:mm+r)*e,e*=mm}return t},F.toString=function(t){if(t=t||10,2>t||36<t)throw Error("radix out of range: "+t);if(fr(this))return"0";if(on(this))return"-"+rt(this).toString(t);for(var e=Vn(Math.pow(t,6)),n=this,r="";;){var i=xh(n,e).g;n=wh(n,i.R(e));var s=((0<n.g.length?n.g[0]:n.h)>>>0).toString(t);if(n=i,fr(n))return s+r;for(;6>s.length;)s="0"+s;r=s+r}},F.D=function(t){return 0>t?0:t<this.g.length?this.g[t]:this.h};function fr(t){if(t.h!=0)return!1;for(var e=0;e<t.g.length;e++)if(t.g[e]!=0)return!1;return!0}function on(t){return t.h==-1}F.X=function(t){return t=wh(this,t),on(t)?-1:fr(t)?0:1};function rt(t){for(var e=t.g.length,n=[],r=0;r<e;r++)n[r]=~t.g[r];return new me(n,~t.h).add(vm)}F.abs=function(){return on(this)?rt(this):this},F.add=function(t){for(var e=Math.max(this.g.length,t.g.length),n=[],r=0,i=0;i<=e;i++){var s=r+(this.D(i)&65535)+(t.D(i)&65535),o=(s>>>16)+(this.D(i)>>>16)+(t.D(i)>>>16);r=o>>>16,s&=65535,o&=65535,n[i]=o<<16|s}return new me(n,n[n.length-1]&-2147483648?-1:0)};function wh(t,e){return t.add(rt(e))}F.R=function(t){if(fr(this)||fr(t))return io;if(on(this))return on(t)?rt(this).R(rt(t)):rt(rt(this).R(t));if(on(t))return rt(this.R(rt(t)));if(0>this.X(bx)&&0>t.X(bx))return Vn(this.ea()*t.ea());for(var e=this.g.length+t.g.length,n=[],r=0;r<2*e;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(var i=0;i<t.g.length;i++){var s=this.D(r)>>>16,o=this.D(r)&65535,a=t.D(i)>>>16,l=t.D(i)&65535;n[2*r+2*i]+=o*l,Eh(n,2*r+2*i),n[2*r+2*i+1]+=s*l,Eh(n,2*r+2*i+1),n[2*r+2*i+1]+=o*a,Eh(n,2*r+2*i+1),n[2*r+2*i+2]+=s*a,Eh(n,2*r+2*i+2)}for(r=0;r<e;r++)n[r]=n[2*r+1]<<16|n[2*r];for(r=e;r<2*e;r++)n[r]=0;return new me(n,0)};function Eh(t,e){for(;(t[e]&65535)!=t[e];)t[e+1]+=t[e]>>>16,t[e]&=65535,e++}function yl(t,e){this.g=t,this.h=e}function xh(t,e){if(fr(e))throw Error("division by zero");if(fr(t))return new yl(io,io);if(on(t))return e=xh(rt(t),e),new yl(rt(e.g),rt(e.h));if(on(e))return e=xh(t,rt(e)),new yl(rt(e.g),e.h);if(30<t.g.length){if(on(t)||on(e))throw Error("slowDivide_ only works with positive integers.");for(var n=vm,r=e;0>=r.X(t);)n=Rx(n),r=Rx(r);var i=so(n,1),s=so(r,1);for(r=so(r,2),n=so(n,2);!fr(r);){var o=s.add(r);0>=o.X(t)&&(i=i.add(n),s=o),r=so(r,1),n=so(n,1)}return e=wh(t,i.R(e)),new yl(i,e)}for(i=io;0<=t.X(e);){for(n=Math.max(1,Math.floor(t.ea()/e.ea())),r=Math.ceil(Math.log(n)/Math.LN2),r=48>=r?1:Math.pow(2,r-48),s=Vn(n),o=s.R(e);on(o)||0<o.X(t);)n-=r,s=Vn(n),o=s.R(e);fr(s)&&(s=vm),i=i.add(s),t=wh(t,o)}return new yl(i,t)}F.gb=function(t){return xh(this,t).h},F.and=function(t){for(var e=Math.max(this.g.length,t.g.length),n=[],r=0;r<e;r++)n[r]=this.D(r)&t.D(r);return new me(n,this.h&t.h)},F.or=function(t){for(var e=Math.max(this.g.length,t.g.length),n=[],r=0;r<e;r++)n[r]=this.D(r)|t.D(r);return new me(n,this.h|t.h)},F.xor=function(t){for(var e=Math.max(this.g.length,t.g.length),n=[],r=0;r<e;r++)n[r]=this.D(r)^t.D(r);return new me(n,this.h^t.h)};function Rx(t){for(var e=t.g.length+1,n=[],r=0;r<e;r++)n[r]=t.D(r)<<1|t.D(r-1)>>>31;return new me(n,t.h)}function so(t,e){var n=e>>5;e%=32;for(var r=t.g.length-n,i=[],s=0;s<r;s++)i[s]=0<e?t.D(s+n)>>>e|t.D(s+n+1)<<32-e:t.D(s+n);return new me(i,t.h)}_h.prototype.createWebChannel=_h.prototype.g,Qt.prototype.send=Qt.prototype.u,Qt.prototype.open=Qt.prototype.m,Qt.prototype.close=Qt.prototype.close,oh.NO_ERROR=0,oh.TIMEOUT=8,oh.HTTP_ERROR=6,F1.COMPLETE="complete",$1.EventType=al,al.OPEN="a",al.CLOSE="b",al.ERROR="c",al.MESSAGE="d",Ye.prototype.listen=Ye.prototype.O,Oe.prototype.listenOnce=Oe.prototype.P,Oe.prototype.getLastError=Oe.prototype.Sa,Oe.prototype.getLastErrorCode=Oe.prototype.Ia,Oe.prototype.getStatus=Oe.prototype.da,Oe.prototype.getResponseJson=Oe.prototype.Wa,Oe.prototype.getResponseText=Oe.prototype.ja,Oe.prototype.send=Oe.prototype.ha,Oe.prototype.setWithCredentials=Oe.prototype.Oa,yn.prototype.digest=yn.prototype.l,yn.prototype.reset=yn.prototype.reset,yn.prototype.update=yn.prototype.j,me.prototype.add=me.prototype.add,me.prototype.multiply=me.prototype.R,me.prototype.modulo=me.prototype.gb,me.prototype.compare=me.prototype.X,me.prototype.toNumber=me.prototype.ea,me.prototype.toString=me.prototype.toString,me.prototype.getBits=me.prototype.D,me.fromNumber=Vn,me.fromString=Cx;var GN=function(){return new _h},WN=function(){return sh()},ym=oh,QN=F1,qN=qi,kx={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},Sh=$1,KN=Oe,YN=yn,oo=me;const Px="@firebase/firestore";/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class gt{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}}gt.UNAUTHENTICATED=new gt(null),gt.GOOGLE_CREDENTIALS=new gt("google-credentials-uid"),gt.FIRST_PARTY=new gt("first-party-uid"),gt.MOCK_USER=new gt("mock-user");/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let ao="10.7.2";/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ji=new _g("@firebase/firestore");function _l(){return Ji.logLevel}function U(t,...e){if(Ji.logLevel<=ue.DEBUG){const n=e.map(_m);Ji.debug(`Firestore (${ao}): ${t}`,...n)}}function Fn(t,...e){if(Ji.logLevel<=ue.ERROR){const n=e.map(_m);Ji.error(`Firestore (${ao}): ${t}`,...n)}}function lo(t,...e){if(Ji.logLevel<=ue.WARN){const n=e.map(_m);Ji.warn(`Firestore (${ao}): ${t}`,...n)}}function _m(t){if(typeof t=="string")return t;try{/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/return function(n){return JSON.stringify(n)}(t)}catch{return t}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Z(t="Unexpected state"){const e=`FIRESTORE (${ao}) INTERNAL ASSERTION FAILED: `+t;throw Fn(e),new Error(e)}function Ee(t,e){t||Z()}function ie(t,e){return t}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const R={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 H extends On{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class pr{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Nx{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class XN{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(gt.UNAUTHENTICATED))}shutdown(){}}class JN{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 ZN{constructor(e){this.t=e,this.currentUser=gt.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){let r=this.i;const i=l=>this.i!==r?(r=this.i,n(l)):Promise.resolve();let s=new pr;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new pr,e.enqueueRetryable(()=>i(this.currentUser))};const o=()=>{const l=s;e.enqueueRetryable(async()=>{await l.promise,await i(this.currentUser)})},a=l=>{U("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.auth.addAuthTokenListener(this.o),o()};this.t.onInit(l=>a(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?a(l):(U("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new pr)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(U("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(Ee(typeof r.accessToken=="string"),new Nx(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const e=this.auth&&this.auth.getUid();return Ee(e===null||typeof e=="string"),new gt(e)}}class eO{constructor(e,n,r){this.l=e,this.h=n,this.P=r,this.type="FirstParty",this.user=gt.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class tO{constructor(e,n,r){this.l=e,this.h=n,this.P=r}getToken(){return Promise.resolve(new eO(this.l,this.h,this.P))}start(e,n){e.enqueueRetryable(()=>n(gt.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class nO{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 rO{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,n){const r=s=>{s.error!=null&&U("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const o=s.token!==this.R;return this.R=s.token,U("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>r(s))};const i=s=>{U("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.appCheck.addTokenListener(this.o)};this.A.onInit(s=>i(s)),setTimeout(()=>{if(!this.appCheck){const s=this.A.getImmediate({optional:!0});s?i(s):U("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(Ee(typeof n.token=="string"),this.R=n.token,new nO(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function iO(t){const e=typeof self!="undefined"&&(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}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ox{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=Math.floor(256/e.length)*e.length;let r="";for(;r.length<20;){const i=iO(40);for(let s=0;s<i.length;++s)r.length<20&&i[s]<n&&(r+=e.charAt(i[s]%e.length))}return r}}function fe(t,e){return t<e?-1:t>e?1:0}function uo(t,e,n){return t.length===e.length&&t.every((r,i)=>n(r,e[i]))}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ge{constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new H(R.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new H(R.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e<-62135596800)throw new H(R.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new H(R.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return Ge.fromMillis(Date.now())}static fromDate(e){return Ge.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*n));return new Ge(n,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?fe(this.nanoseconds,e.nanoseconds):fe(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{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ne{constructor(e){this.timestamp=e}static fromTimestamp(e){return new ne(e)}static min(){return new ne(new Ge(0,0))}static max(){return new ne(new Ge(253402300799,999999999))}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}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class wl{constructor(e,n,r){n===void 0?n=0:n>e.length&&Z(),r===void 0?r=e.length-n:r>e.length-n&&Z(),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return wl.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof wl?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 i=0;i<r;i++){const s=e.get(i),o=n.get(i);if(s<o)return-1;if(s>o)return 1}return e.length<n.length?-1:e.length>n.length?1:0}}class Ae extends wl{construct(e,n,r){return new Ae(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 H(R.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(i=>i.length>0))}return new Ae(n)}static emptyPath(){return new Ae([])}}const sO=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class it extends wl{construct(e,n,r){return new it(e,n,r)}static isValidIdentifier(e){return sO.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),it.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new it(["__name__"])}static fromServerFormat(e){const n=[];let r="",i=0;const s=()=>{if(r.length===0)throw new H(R.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;i<e.length;){const a=e[i];if(a==="\\"){if(i+1===e.length)throw new H(R.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const l=e[i+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new H(R.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=l,i+=2}else a==="`"?(o=!o,i++):a!=="."||o?(r+=a,i++):(s(),i++)}if(s(),o)throw new H(R.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new it(n)}static emptyPath(){return new it([])}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class K{constructor(e){this.path=e}static fromPath(e){return new K(Ae.fromString(e))}static fromName(e){return new K(Ae.fromString(e).popFirst(5))}static empty(){return new K(Ae.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&&Ae.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return Ae.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new K(new Ae(e.slice()))}}function oO(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=ne.fromTimestamp(r===1e9?new Ge(n+1,0):new Ge(n,r));return new ti(i,K.empty(),e)}function aO(t){return new ti(t.readTime,t.key,-1)}class ti{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new ti(ne.min(),K.empty(),-1)}static max(){return new ti(ne.max(),K.empty(),-1)}}function lO(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=K.comparator(t.documentKey,e.documentKey),n!==0?n:fe(t.largestBatchId,e.largestBatchId))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const uO="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class cO{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function El(t){if(t.code!==R.FAILED_PRECONDITION||t.message!==uO)throw t;U("LocalStore","Unexpectedly lost primary lease")}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class k{constructor(e){this.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&&Z(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new k((r,i)=>{this.nextCallback=s=>{this.wrapSuccess(e,s).next(r,i)},this.catchCallback=s=>{this.wrapFailure(n,s).next(r,i)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof k?n:k.resolve(n)}catch(n){return k.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):k.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):k.reject(n)}static resolve(e){return new k((n,r)=>{n(e)})}static reject(e){return new k((n,r)=>{r(e)})}static waitFor(e){return new k((n,r)=>{let i=0,s=0,o=!1;e.forEach(a=>{++i,a.next(()=>{++s,o&&s===i&&n()},l=>r(l))}),o=!0,s===i&&n()})}static or(e){let n=k.resolve(!1);for(const r of e)n=n.next(i=>i?k.resolve(i):r());return n}static forEach(e,n){const r=[];return e.forEach((i,s)=>{r.push(n.call(this,i,s))}),this.waitFor(r)}static mapArray(e,n){return new k((r,i)=>{const s=e.length,o=new Array(s);let a=0;for(let l=0;l<s;l++){const u=l;n(e[u]).next(c=>{o[u]=c,++a,a===s&&r(o)},c=>i(c))}})}static doWhile(e,n){return new k((r,i)=>{const s=()=>{e()===!0?n().next(()=>{s()},i):r()};s()})}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class wm{constructor(e,n){this.action=e,this.transaction=n,this.aborted=!1,this.V=new pr,this.transaction.oncomplete=()=>{this.V.resolve()},this.transaction.onabort=()=>{n.error?this.V.reject(new xl(e,n.error)):this.V.resolve()},this.transaction.onerror=r=>{const i=Em(r.target.error);this.V.reject(new xl(e,i))}}static open(e,n,r,i){try{return new wm(n,e.transaction(i,r))}catch(s){throw new xl(n,s)}}get m(){return this.V.promise}abort(e){e&&this.V.reject(e),this.aborted||(U("SimpleDb","Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}g(){const e=this.transaction;this.aborted||typeof e.commit!="function"||e.commit()}store(e){const n=this.transaction.objectStore(e);return new dO(n)}}class Zi{constructor(e,n,r){this.name=e,this.version=n,this.p=r,Zi.S(Ve())===12.2&&Fn("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}static delete(e){return U("SimpleDb","Removing database:",e),es(window.indexedDB.deleteDatabase(e)).toPromise()}static D(){if(!e1())return!1;if(Zi.C())return!0;const e=Ve(),n=Zi.S(e),r=0<n&&n<10,i=Zi.v(e),s=0<i&&i<4.5;return!(e.indexOf("MSIE ")>0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||r||s)}static C(){var e;return typeof process!="undefined"&&((e=process.__PRIVATE_env)===null||e===void 0?void 0:e.F)==="YES"}static M(e,n){return e.store(n)}static S(e){const n=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),r=n?n[1].split("_").slice(0,2).join("."):"-1";return Number(r)}static v(e){const n=e.match(/Android ([\d.]+)/i),r=n?n[1].split(".").slice(0,2).join("."):"-1";return Number(r)}async O(e){return this.db||(U("SimpleDb","Opening database:",this.name),this.db=await new Promise((n,r)=>{const i=indexedDB.open(this.name,this.version);i.onsuccess=s=>{const o=s.target.result;n(o)},i.onblocked=()=>{r(new xl(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=s=>{const o=s.target.error;o.name==="VersionError"?r(new H(R.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):o.name==="InvalidStateError"?r(new H(R.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+o)):r(new xl(e,o))},i.onupgradeneeded=s=>{U("SimpleDb",'Database "'+this.name+'" requires upgrade from version:',s.oldVersion);const o=s.target.result;this.p.N(o,i.transaction,s.oldVersion,this.version).next(()=>{U("SimpleDb","Database upgrade to version "+this.version+" complete")})}})),this.B&&(this.db.onversionchange=n=>this.B(n)),this.db}L(e){this.B=e,this.db&&(this.db.onversionchange=n=>e(n))}async runTransaction(e,n,r,i){const s=n==="readonly";let o=0;for(;;){++o;try{this.db=await this.O(e);const a=wm.open(this.db,e,s?"readonly":"readwrite",r),l=i(a).next(u=>(a.g(),u)).catch(u=>(a.abort(u),k.reject(u))).toPromise();return l.catch(()=>{}),await a.m,l}catch(a){const l=a,u=l.name!=="FirebaseError"&&o<3;if(U("SimpleDb","Transaction failed with error:",l.message,"Retrying:",u),this.close(),!u)return Promise.reject(l)}}}close(){this.db&&this.db.close(),this.db=void 0}}class hO{constructor(e){this.k=e,this.q=!1,this.K=null}get isDone(){return this.q}get $(){return this.K}set cursor(e){this.k=e}done(){this.q=!0}U(e){this.K=e}delete(){return es(this.k.delete())}}class xl extends H{constructor(e,n){super(R.UNAVAILABLE,`IndexedDB transaction '${e}' failed: ${n}`),this.name="IndexedDbTransactionError"}}function Sl(t){return t.name==="IndexedDbTransactionError"}class dO{constructor(e){this.store=e}put(e,n){let r;return n!==void 0?(U("SimpleDb","PUT",this.store.name,e,n),r=this.store.put(n,e)):(U("SimpleDb","PUT",this.store.name,"<auto-key>",e),r=this.store.put(e)),es(r)}add(e){return U("SimpleDb","ADD",this.store.name,e,e),es(this.store.add(e))}get(e){return es(this.store.get(e)).next(n=>(n===void 0&&(n=null),U("SimpleDb","GET",this.store.name,e,n),n))}delete(e){return U("SimpleDb","DELETE",this.store.name,e),es(this.store.delete(e))}count(){return U("SimpleDb","COUNT",this.store.name),es(this.store.count())}W(e,n){const r=this.options(e,n),i=r.index?this.store.index(r.index):this.store;if(typeof i.getAll=="function"){const s=i.getAll(r.range);return new k((o,a)=>{s.onerror=l=>{a(l.target.error)},s.onsuccess=l=>{o(l.target.result)}})}{const s=this.cursor(r),o=[];return this.G(s,(a,l)=>{o.push(l)}).next(()=>o)}}j(e,n){const r=this.store.getAll(e,n===null?void 0:n);return new k((i,s)=>{r.onerror=o=>{s(o.target.error)},r.onsuccess=o=>{i(o.target.result)}})}H(e,n){U("SimpleDb","DELETE ALL",this.store.name);const r=this.options(e,n);r.J=!1;const i=this.cursor(r);return this.G(i,(s,o,a)=>a.delete())}Y(e,n){let r;n?r=e:(r={},n=e);const i=this.cursor(r);return this.G(i,n)}Z(e){const n=this.cursor({});return new k((r,i)=>{n.onerror=s=>{const o=Em(s.target.error);i(o)},n.onsuccess=s=>{const o=s.target.result;o?e(o.primaryKey,o.value).next(a=>{a?o.continue():r()}):r()}})}G(e,n){const r=[];return new k((i,s)=>{e.onerror=o=>{s(o.target.error)},e.onsuccess=o=>{const a=o.target.result;if(!a)return void i();const l=new hO(a),u=n(a.primaryKey,a.value,l);if(u instanceof k){const c=u.catch(h=>(l.done(),k.reject(h)));r.push(c)}l.isDone?i():l.$===null?a.continue():a.continue(l.$)}}).next(()=>k.waitFor(r))}options(e,n){let r;return e!==void 0&&(typeof e=="string"?r=e:n=e),{index:r,range:n}}cursor(e){let n="next";if(e.reverse&&(n="prev"),e.index){const r=this.store.index(e.index);return e.J?r.openKeyCursor(e.range,n):r.openCursor(e.range,n)}return this.store.openCursor(e.range,n)}}function es(t){return new k((e,n)=>{t.onsuccess=r=>{const i=r.target.result;e(i)},t.onerror=r=>{const i=Em(r.target.error);n(i)}})}let Dx=!1;function Em(t){const e=Zi.S(Ve());if(e>=12.2&&e<13){const n="An internal error was encountered in the Indexed Database server";if(t.message.indexOf(n)>=0){const r=new H("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${n}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return Dx||(Dx=!0,setTimeout(()=>{throw r},0)),r}}return t}/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class xm{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.se(r),this.oe=r=>n.writeSequenceNumber(r))}se(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.oe&&this.oe(e),e}}xm._e=-1;function Ih(t){return t==null}function Ah(t){return t===0&&1/t==-1/0}function fO(t){return typeof t=="number"&&Number.isInteger(t)&&!Ah(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Mx(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function co(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Lx(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Pe{constructor(e,n){this.comparator=e,this.root=n||st.EMPTY}insert(e,n){return new Pe(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,st.BLACK,null,null))}remove(e){return new Pe(this.comparator,this.root.remove(e,this.comparator).copy(null,null,st.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 i=this.comparator(e,r.key);if(i===0)return n+r.left.size;i<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 Th(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Th(this.root,e,this.comparator,!1)}getReverseIterator(){return new Th(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Th(this.root,e,this.comparator,!0)}}class Th{constructor(e,n,r,i){this.isReverse=i,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=n?r(e.key,n):1,n&&i&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(s===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 st{constructor(e,n,r,i,s){this.key=e,this.value=n,this.color=r!=null?r:st.RED,this.left=i!=null?i:st.EMPTY,this.right=s!=null?s:st.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,i,s){return new st(e!=null?e:this.key,n!=null?n:this.value,r!=null?r:this.color,i!=null?i:this.left,s!=null?s: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 i=this;const s=r(e,i.key);return i=s<0?i.copy(null,null,null,i.left.insert(e,n,r),null):s===0?i.copy(null,n,null,null,null):i.copy(null,null,null,null,i.right.insert(e,n,r)),i.fixUp()}removeMin(){if(this.left.isEmpty())return st.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,i=this;if(n(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(e,i.key)===0){if(i.right.isEmpty())return st.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.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,st.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,st.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()||this.right.isRed())throw Z();const e=this.left.check();if(e!==this.right.check())throw Z();return e+(this.isRed()?0:1)}}st.EMPTY=null,st.RED=!0,st.BLACK=!1,st.EMPTY=new class{constructor(){this.size=0}get key(){throw Z()}get value(){throw Z()}get color(){throw Z()}get left(){throw Z()}get right(){throw Z()}copy(e,n,r,i,s){return this}insert(e,n,r){return new st(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}};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ot{constructor(e){this.comparator=e,this.data=new Pe(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 i=r.getNext();if(this.comparator(i.key,e[1])>=0)return;n(i.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 Vx(this.data.getIterator())}getIteratorFrom(e){return new Vx(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 ot)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(this.comparator(i,s)!==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 ot(this.comparator);return n.data=e,n}}class Vx{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class _n{constructor(e){this.fields=e,e.sort(it.comparator)}static empty(){return new _n([])}unionWith(e){let n=new ot(it.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new _n(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return uo(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Fx extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class mt{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(i){try{return atob(i)}catch(s){throw typeof DOMException!="undefined"&&s instanceof DOMException?new Fx("Invalid base64 string: "+s):s}}(e);return new mt(n)}static fromUint8Array(e){const n=function(i){let s="";for(let o=0;o<i.length;++o)s+=String.fromCharCode(i[o]);return s}(e);return new mt(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 i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return fe(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}mt.EMPTY_BYTE_STRING=new mt("");const pO=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function ni(t){if(Ee(!!t),typeof t=="string"){let e=0;const n=pO.exec(t);if(Ee(!!n),n[1]){let i=n[1];i=(i+"000000000").substr(0,9),e=Number(i)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:Fe(t.seconds),nanos:Fe(t.nanos)}}function Fe(t){return typeof t=="number"?t:typeof t=="string"?Number(t):0}function ts(t){return typeof t=="string"?mt.fromBase64String(t):mt.fromUint8Array(t)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Sm(t){var e,n;return((n=(((e=t==null?void 0:t.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||n===void 0?void 0:n.stringValue)==="server_timestamp"}function Im(t){const e=t.mapValue.fields.__previous_value__;return Sm(e)?Im(e):e}function Il(t){const e=ni(t.mapValue.fields.__local_write_time__.timestampValue);return new Ge(e.seconds,e.nanos)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class gO{constructor(e,n,r,i,s,o,a,l,u){this.databaseId=e,this.appId=n,this.persistenceKey=r,this.host=i,this.ssl=s,this.forceLongPolling=o,this.autoDetectLongPolling=a,this.longPollingOptions=l,this.useFetchStreams=u}}class Al{constructor(e,n){this.projectId=e,this.database=n||"(default)"}static empty(){return new Al("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(e){return e instanceof Al&&e.projectId===this.projectId&&e.database===this.database}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ch={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function ns(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?Sm(t)?4:mO(t)?9007199254740991:10:Z()}function Un(t,e){if(t===e)return!0;const n=ns(t);if(n!==ns(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Il(t).isEqual(Il(e));case 3:return function(i,s){if(typeof i.timestampValue=="string"&&typeof s.timestampValue=="string"&&i.timestampValue.length===s.timestampValue.length)return i.timestampValue===s.timestampValue;const o=ni(i.timestampValue),a=ni(s.timestampValue);return o.seconds===a.seconds&&o.nanos===a.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(i,s){return ts(i.bytesValue).isEqual(ts(s.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(i,s){return Fe(i.geoPointValue.latitude)===Fe(s.geoPointValue.latitude)&&Fe(i.geoPointValue.longitude)===Fe(s.geoPointValue.longitude)}(t,e);case 2:return function(i,s){if("integerValue"in i&&"integerValue"in s)return Fe(i.integerValue)===Fe(s.integerValue);if("doubleValue"in i&&"doubleValue"in s){const o=Fe(i.doubleValue),a=Fe(s.doubleValue);return o===a?Ah(o)===Ah(a):isNaN(o)&&isNaN(a)}return!1}(t,e);case 9:return uo(t.arrayValue.values||[],e.arrayValue.values||[],Un);case 10:return function(i,s){const o=i.mapValue.fields||{},a=s.mapValue.fields||{};if(Mx(o)!==Mx(a))return!1;for(const l in o)if(o.hasOwnProperty(l)&&(a[l]===void 0||!Un(o[l],a[l])))return!1;return!0}(t,e);default:return Z()}}function Tl(t,e){return(t.values||[]).find(n=>Un(n,e))!==void 0}function ho(t,e){if(t===e)return 0;const n=ns(t),r=ns(e);if(n!==r)return fe(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return fe(t.booleanValue,e.booleanValue);case 2:return function(s,o){const a=Fe(s.integerValue||s.doubleValue),l=Fe(o.integerValue||o.doubleValue);return a<l?-1:a>l?1:a===l?0:isNaN(a)?isNaN(l)?0:-1:1}(t,e);case 3:return Ux(t.timestampValue,e.timestampValue);case 4:return Ux(Il(t),Il(e));case 5:return fe(t.stringValue,e.stringValue);case 6:return function(s,o){const a=ts(s),l=ts(o);return a.compareTo(l)}(t.bytesValue,e.bytesValue);case 7:return function(s,o){const a=s.split("/"),l=o.split("/");for(let u=0;u<a.length&&u<l.length;u++){const c=fe(a[u],l[u]);if(c!==0)return c}return fe(a.length,l.length)}(t.referenceValue,e.referenceValue);case 8:return function(s,o){const a=fe(Fe(s.latitude),Fe(o.latitude));return a!==0?a:fe(Fe(s.longitude),Fe(o.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(s,o){const a=s.values||[],l=o.values||[];for(let u=0;u<a.length&&u<l.length;++u){const c=ho(a[u],l[u]);if(c)return c}return fe(a.length,l.length)}(t.arrayValue,e.arrayValue);case 10:return function(s,o){if(s===Ch.mapValue&&o===Ch.mapValue)return 0;if(s===Ch.mapValue)return 1;if(o===Ch.mapValue)return-1;const a=s.fields||{},l=Object.keys(a),u=o.fields||{},c=Object.keys(u);l.sort(),c.sort();for(let h=0;h<l.length&&h<c.length;++h){const d=fe(l[h],c[h]);if(d!==0)return d;const f=ho(a[l[h]],u[c[h]]);if(f!==0)return f}return fe(l.length,c.length)}(t.mapValue,e.mapValue);default:throw Z()}}function Ux(t,e){if(typeof t=="string"&&typeof e=="string"&&t.length===e.length)return fe(t,e);const n=ni(t),r=ni(e),i=fe(n.seconds,r.seconds);return i!==0?i:fe(n.nanos,r.nanos)}function fo(t){return Am(t)}function Am(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=ni(n);return`time(${r.seconds},${r.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?function(n){return ts(n).toBase64()}(t.bytesValue):"referenceValue"in t?function(n){return K.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="[",i=!0;for(const s of n.values||[])i?i=!1:r+=",",r+=Am(s);return r+"]"}(t.arrayValue):"mapValue"in t?function(n){const r=Object.keys(n.fields||{}).sort();let i="{",s=!0;for(const o of r)s?s=!1:i+=",",i+=`${o}:${Am(n.fields[o])}`;return i+"}"}(t.mapValue):Z()}function $x(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Tm(t){return!!t&&"integerValue"in t}function Cm(t){return!!t&&"arrayValue"in t}function jx(t){return!!t&&"nullValue"in t}function zx(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function bh(t){return!!t&&"mapValue"in t}function Cl(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return co(t.mapValue.fields,(n,r)=>e.mapValue.fields[n]=Cl(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Cl(t.arrayValue.values[n]);return e}return Object.assign({},t)}function mO(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class an{constructor(e){this.value=e}static empty(){return new an({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)],!bh(n))return null;return n=(n.mapValue.fields||{})[e.lastSegment()],n||null}}set(e,n){this.getFieldsMap(e.popLast())[e.lastSegment()]=Cl(n)}setAll(e){let n=it.emptyPath(),r={},i=[];e.forEach((o,a)=>{if(!n.isImmediateParentOf(a)){const l=this.getFieldsMap(n);this.applyChanges(l,r,i),r={},i=[],n=a.popLast()}o?r[a.lastSegment()]=Cl(o):i.push(a.lastSegment())});const s=this.getFieldsMap(n);this.applyChanges(s,r,i)}delete(e){const n=this.field(e.popLast());bh(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return Un(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 i=n.mapValue.fields[e.get(r)];bh(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},n.mapValue.fields[e.get(r)]=i),n=i}return n.mapValue.fields}applyChanges(e,n,r){co(n,(i,s)=>e[i]=s);for(const i of r)delete e[i]}clone(){return new an(Cl(this.value))}}function Bx(t){const e=[];return co(t.fields,(n,r)=>{const i=new it([n]);if(bh(r)){const s=Bx(r.mapValue).fields;if(s.length===0)e.push(i);else for(const o of s)e.push(i.child(o))}else e.push(i)}),new _n(e)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class vt{constructor(e,n,r,i,s,o,a){this.key=e,this.documentType=n,this.version=r,this.readTime=i,this.createTime=s,this.data=o,this.documentState=a}static newInvalidDocument(e){return new vt(e,0,ne.min(),ne.min(),ne.min(),an.empty(),0)}static newFoundDocument(e,n,r,i){return new vt(e,1,n,ne.min(),r,i,0)}static newNoDocument(e,n){return new vt(e,2,n,ne.min(),ne.min(),an.empty(),0)}static newUnknownDocument(e,n){return new vt(e,3,n,ne.min(),ne.min(),an.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(ne.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=an.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=an.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ne.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 vt&&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 vt(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}})`}}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Rh{constructor(e,n){this.position=e,this.inclusive=n}}function Hx(t,e,n){let r=0;for(let i=0;i<t.position.length;i++){const s=e[i],o=t.position[i];if(s.field.isKeyField()?r=K.comparator(K.fromName(o.referenceValue),n.key):r=ho(o,n.data.field(s.field)),s.dir==="desc"&&(r*=-1),r!==0)break}return r}function Gx(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(!Un(t.position[n],e.position[n]))return!1;return!0}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class bl{constructor(e,n="asc"){this.field=e,this.dir=n}}function vO(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Wx{}class Ue extends Wx{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 _O(e,n,r):n==="array-contains"?new xO(e,r):n==="in"?new SO(e,r):n==="not-in"?new IO(e,r):n==="array-contains-any"?new AO(e,r):new Ue(e,n,r)}static createKeyFieldInFilter(e,n,r){return n==="in"?new wO(e,r):new EO(e,r)}matches(e){const n=e.data.field(this.field);return this.op==="!="?n!==null&&this.matchesComparison(ho(n,this.value)):n!==null&&ns(this.value)===ns(n)&&this.matchesComparison(ho(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 Z()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class wn extends Wx{constructor(e,n){super(),this.filters=e,this.op=n,this.ue=null}static create(e,n){return new wn(e,n)}matches(e){return Qx(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.ue!==null||(this.ue=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.ue}getFilters(){return Object.assign([],this.filters)}}function Qx(t){return t.op==="and"}function qx(t){return yO(t)&&Qx(t)}function yO(t){for(const e of t.filters)if(e instanceof wn)return!1;return!0}function bm(t){if(t instanceof Ue)return t.field.canonicalString()+t.op.toString()+fo(t.value);if(qx(t))return t.filters.map(e=>bm(e)).join(",");{const e=t.filters.map(n=>bm(n)).join(",");return`${t.op}(${e})`}}function Kx(t,e){return t instanceof Ue?function(r,i){return i instanceof Ue&&r.op===i.op&&r.field.isEqual(i.field)&&Un(r.value,i.value)}(t,e):t instanceof wn?function(r,i){return i instanceof wn&&r.op===i.op&&r.filters.length===i.filters.length?r.filters.reduce((s,o,a)=>s&&Kx(o,i.filters[a]),!0):!1}(t,e):void Z()}function Yx(t){return t instanceof Ue?function(n){return`${n.field.canonicalString()} ${n.op} ${fo(n.value)}`}(t):t instanceof wn?function(n){return n.op.toString()+" {"+n.getFilters().map(Yx).join(" ,")+"}"}(t):"Filter"}class _O extends Ue{constructor(e,n,r){super(e,n,r),this.key=K.fromName(r.referenceValue)}matches(e){const n=K.comparator(e.key,this.key);return this.matchesComparison(n)}}class wO extends Ue{constructor(e,n){super(e,"in",n),this.keys=Xx("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class EO extends Ue{constructor(e,n){super(e,"not-in",n),this.keys=Xx("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function Xx(t,e){var n;return(((n=e.arrayValue)===null||n===void 0?void 0:n.values)||[]).map(r=>K.fromName(r.referenceValue))}class xO extends Ue{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return Cm(n)&&Tl(n.arrayValue,this.value)}}class SO extends Ue{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&Tl(this.value.arrayValue,n)}}class IO extends Ue{constructor(e,n){super(e,"not-in",n)}matches(e){if(Tl(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&!Tl(this.value.arrayValue,n)}}class AO extends Ue{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!Cm(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>Tl(this.value.arrayValue,r))}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class TO{constructor(e,n=null,r=[],i=[],s=null,o=null,a=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=s,this.startAt=o,this.endAt=a,this.ce=null}}function Jx(t,e=null,n=[],r=[],i=null,s=null,o=null){return new TO(t,e,n,r,i,s,o)}function Rm(t){const e=ie(t);if(e.ce===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>bm(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(s){return s.field.canonicalString()+s.dir}(r)).join(","),Ih(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>fo(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>fo(r)).join(",")),e.ce=n}return e.ce}function km(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(!vO(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(!Kx(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Gx(t.startAt,e.startAt)&&Gx(t.endAt,e.endAt)}function Pm(t){return K.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class po{constructor(e,n=null,r=[],i=[],s=null,o="F",a=null,l=null){this.path=e,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=i,this.limit=s,this.limitType=o,this.startAt=a,this.endAt=l,this.le=null,this.he=null,this.Pe=null,this.startAt,this.endAt}}function CO(t,e,n,r,i,s,o,a){return new po(t,e,n,r,i,s,o,a)}function Zx(t){return new po(t)}function eS(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 tS(t){return t.collectionGroup!==null}function Rl(t){const e=ie(t);if(e.le===null){e.le=[];const n=new Set;for(const s of e.explicitOrderBy)e.le.push(s),n.add(s.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new ot(it.comparator);return o.filters.forEach(l=>{l.getFlattenedFilters().forEach(u=>{u.isInequality()&&(a=a.add(u.field))})}),a})(e).forEach(s=>{n.has(s.canonicalString())||s.isKeyField()||e.le.push(new bl(s,r))}),n.has(it.keyField().canonicalString())||e.le.push(new bl(it.keyField(),r))}return e.le}function $n(t){const e=ie(t);return e.he||(e.he=bO(e,Rl(t))),e.he}function bO(t,e){if(t.limitType==="F")return Jx(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(i=>{const s=i.dir==="desc"?"asc":"desc";return new bl(i.field,s)});const n=t.endAt?new Rh(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new Rh(t.startAt.position,t.startAt.inclusive):null;return Jx(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function Nm(t,e){const n=t.filters.concat([e]);return new po(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Om(t,e,n){return new po(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function kh(t,e){return km($n(t),$n(e))&&t.limitType===e.limitType}function nS(t){return`${Rm($n(t))}|lt:${t.limitType}`}function go(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(i=>Yx(i)).join(", ")}]`),Ih(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(i=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(i)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(i=>fo(i)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(i=>fo(i)).join(",")),`Target(${r})`}($n(t))}; limitType=${t.limitType})`}function Ph(t,e){return e.isFoundDocument()&&function(r,i){const s=i.key.path;return r.collectionGroup!==null?i.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(s):K.isDocumentKey(r.path)?r.path.isEqual(s):r.path.isImmediateParentOf(s)}(t,e)&&function(r,i){for(const s of Rl(r))if(!s.field.isKeyField()&&i.data.field(s.field)===null)return!1;return!0}(t,e)&&function(r,i){for(const s of r.filters)if(!s.matches(i))return!1;return!0}(t,e)&&function(r,i){return!(r.startAt&&!function(o,a,l){const u=Hx(o,a,l);return o.inclusive?u<=0:u<0}(r.startAt,Rl(r),i)||r.endAt&&!function(o,a,l){const u=Hx(o,a,l);return o.inclusive?u>=0:u>0}(r.endAt,Rl(r),i))}(t,e)}function RO(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function rS(t){return(e,n)=>{let r=!1;for(const i of Rl(t)){const s=kO(i,e,n);if(s!==0)return s;r=r||i.field.isKeyField()}return 0}}function kO(t,e,n){const r=t.field.isKeyField()?K.comparator(e.key,n.key):function(s,o,a){const l=o.data.field(s),u=a.data.field(s);return l!==null&&u!==null?ho(l,u):Z()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Z()}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class mo{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[i,s]of r)if(this.equalsFn(i,e))return s}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),i=this.inner[r];if(i===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let s=0;s<i.length;s++)if(this.equalsFn(i[s][0],e))return void(i[s]=[e,n]);i.push([e,n]),this.innerSize++}delete(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r===void 0)return!1;for(let i=0;i<r.length;i++)if(this.equalsFn(r[i][0],e))return r.length===1?delete this.inner[n]:r.splice(i,1),this.innerSize--,!0;return!1}forEach(e){co(this.inner,(n,r)=>{for(const[i,s]of r)e(i,s)})}isEmpty(){return Lx(this.inner)}size(){return this.innerSize}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const PO=new Pe(K.comparator);function gr(){return PO}const iS=new Pe(K.comparator);function kl(...t){let e=iS;for(const n of t)e=e.insert(n.key,n);return e}function sS(t){let e=iS;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function rs(){return Pl()}function oS(){return Pl()}function Pl(){return new mo(t=>t.toString(),(t,e)=>t.isEqual(e))}const NO=new Pe(K.comparator),OO=new ot(K.comparator);function le(...t){let e=OO;for(const n of t)e=e.add(n);return e}const DO=new ot(fe);function MO(){return DO}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function aS(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:Ah(e)?"-0":e}}function lS(t){return{integerValue:""+t}}function LO(t,e){return fO(e)?lS(e):aS(t,e)}/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Nh{constructor(){this._=void 0}}function VO(t,e,n){return t instanceof Oh?function(i,s){const o={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return s&&Sm(s)&&(s=Im(s)),s&&(o.fields.__previous_value__=s),{mapValue:o}}(n,e):t instanceof Nl?cS(t,e):t instanceof Ol?hS(t,e):function(i,s){const o=uS(i,s),a=dS(o)+dS(i.Ie);return Tm(o)&&Tm(i.Ie)?lS(a):aS(i.serializer,a)}(t,e)}function FO(t,e,n){return t instanceof Nl?cS(t,e):t instanceof Ol?hS(t,e):n}function uS(t,e){return t instanceof Dh?function(r){return Tm(r)||function(s){return!!s&&"doubleValue"in s}(r)}(e)?e:{integerValue:0}:null}class Oh extends Nh{}class Nl extends Nh{constructor(e){super(),this.elements=e}}function cS(t,e){const n=fS(e);for(const r of t.elements)n.some(i=>Un(i,r))||n.push(r);return{arrayValue:{values:n}}}class Ol extends Nh{constructor(e){super(),this.elements=e}}function hS(t,e){let n=fS(e);for(const r of t.elements)n=n.filter(i=>!Un(i,r));return{arrayValue:{values:n}}}class Dh extends Nh{constructor(e,n){super(),this.serializer=e,this.Ie=n}}function dS(t){return Fe(t.integerValue||t.doubleValue)}function fS(t){return Cm(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}function UO(t,e){return t.field.isEqual(e.field)&&function(r,i){return r instanceof Nl&&i instanceof Nl||r instanceof Ol&&i instanceof Ol?uo(r.elements,i.elements,Un):r instanceof Dh&&i instanceof Dh?Un(r.Ie,i.Ie):r instanceof Oh&&i instanceof Oh}(t.transform,e.transform)}class $O{constructor(e,n){this.version=e,this.transformResults=n}}class mr{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new mr}static exists(e){return new mr(void 0,e)}static updateTime(e){return new mr(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 Mh(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class Lh{}function pS(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new _S(t.key,mr.none()):new Ml(t.key,t.data,mr.none());{const n=t.data,r=an.empty();let i=new ot(it.comparator);for(let s of e.fields)if(!i.has(s)){let o=n.field(s);o===null&&s.length>1&&(s=s.popLast(),o=n.field(s)),o===null?r.delete(s):r.set(s,o),i=i.add(s)}return new is(t.key,r,new _n(i.toArray()),mr.none())}}function jO(t,e,n){t instanceof Ml?function(i,s,o){const a=i.value.clone(),l=vS(i.fieldTransforms,s,o.transformResults);a.setAll(l),s.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(t,e,n):t instanceof is?function(i,s,o){if(!Mh(i.precondition,s))return void s.convertToUnknownDocument(o.version);const a=vS(i.fieldTransforms,s,o.transformResults),l=s.data;l.setAll(mS(i)),l.setAll(a),s.convertToFoundDocument(o.version,l).setHasCommittedMutations()}(t,e,n):function(i,s,o){s.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function Dl(t,e,n,r){return t instanceof Ml?function(s,o,a,l){if(!Mh(s.precondition,o))return a;const u=s.value.clone(),c=yS(s.fieldTransforms,l,o);return u.setAll(c),o.convertToFoundDocument(o.version,u).setHasLocalMutations(),null}(t,e,n,r):t instanceof is?function(s,o,a,l){if(!Mh(s.precondition,o))return a;const u=yS(s.fieldTransforms,l,o),c=o.data;return c.setAll(mS(s)),c.setAll(u),o.convertToFoundDocument(o.version,c).setHasLocalMutations(),a===null?null:a.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(h=>h.field))}(t,e,n,r):function(s,o,a){return Mh(s.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(t,e,n)}function zO(t,e){let n=null;for(const r of t.fieldTransforms){const i=e.data.field(r.field),s=uS(r.transform,i||null);s!=null&&(n===null&&(n=an.empty()),n.set(r.field,s))}return n||null}function gS(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,i){return r===void 0&&i===void 0||!(!r||!i)&&uo(r,i,(s,o)=>UO(s,o))}(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 Ml extends Lh{constructor(e,n,r,i=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class is extends Lh{constructor(e,n,r,i,s=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function mS(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 vS(t,e,n){const r=new Map;Ee(t.length===n.length);for(let i=0;i<n.length;i++){const s=t[i],o=s.transform,a=e.data.field(s.field);r.set(s.field,FO(o,a,n[i]))}return r}function yS(t,e,n){const r=new Map;for(const i of t){const s=i.transform,o=n.data.field(i.field);r.set(i.field,VO(s,o,e))}return r}class _S extends Lh{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class BO extends Lh{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class HO{constructor(e,n,r,i){this.batchId=e,this.localWriteTime=n,this.baseMutations=r,this.mutations=i}applyToRemoteDocument(e,n){const r=n.mutationResults;for(let i=0;i<this.mutations.length;i++){const s=this.mutations[i];s.key.isEqual(e.key)&&jO(s,e,r[i])}}applyToLocalView(e,n){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(n=Dl(r,e,n,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(n=Dl(r,e,n,this.localWriteTime));return n}applyToLocalDocumentSet(e,n){const r=oS();return this.mutations.forEach(i=>{const s=e.get(i.key),o=s.overlayedDocument;let a=this.applyToLocalView(o,s.mutatedFields);a=n.has(i.key)?null:a;const l=pS(o,a);l!==null&&r.set(i.key,l),o.isValidDocument()||o.convertToNoDocument(ne.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),le())}isEqual(e){return this.batchId===e.batchId&&uo(this.mutations,e.mutations,(n,r)=>gS(n,r))&&uo(this.baseMutations,e.baseMutations,(n,r)=>gS(n,r))}}class Dm{constructor(e,n,r,i){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=i}static from(e,n,r){Ee(e.mutations.length===r.length);let i=function(){return NO}();const s=e.mutations;for(let o=0;o<s.length;o++)i=i.insert(s[o].key,r[o].version);return new Dm(e,n,r,i)}}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class GO{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{
      largestBatchId: ${this.largestBatchId},
      mutation: ${this.mutation.toString()}
    }`}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class WO{constructor(e,n){this.count=e,this.unchangedNames=n}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var $e,he;function QO(t){switch(t){default:return Z();case R.CANCELLED:case R.UNKNOWN:case R.DEADLINE_EXCEEDED:case R.RESOURCE_EXHAUSTED:case R.INTERNAL:case R.UNAVAILABLE:case R.UNAUTHENTICATED:return!1;case R.INVALID_ARGUMENT:case R.NOT_FOUND:case R.ALREADY_EXISTS:case R.PERMISSION_DENIED:case R.FAILED_PRECONDITION:case R.ABORTED:case R.OUT_OF_RANGE:case R.UNIMPLEMENTED:case R.DATA_LOSS:return!0}}function wS(t){if(t===void 0)return Fn("GRPC error has no .code"),R.UNKNOWN;switch(t){case $e.OK:return R.OK;case $e.CANCELLED:return R.CANCELLED;case $e.UNKNOWN:return R.UNKNOWN;case $e.DEADLINE_EXCEEDED:return R.DEADLINE_EXCEEDED;case $e.RESOURCE_EXHAUSTED:return R.RESOURCE_EXHAUSTED;case $e.INTERNAL:return R.INTERNAL;case $e.UNAVAILABLE:return R.UNAVAILABLE;case $e.UNAUTHENTICATED:return R.UNAUTHENTICATED;case $e.INVALID_ARGUMENT:return R.INVALID_ARGUMENT;case $e.NOT_FOUND:return R.NOT_FOUND;case $e.ALREADY_EXISTS:return R.ALREADY_EXISTS;case $e.PERMISSION_DENIED:return R.PERMISSION_DENIED;case $e.FAILED_PRECONDITION:return R.FAILED_PRECONDITION;case $e.ABORTED:return R.ABORTED;case $e.OUT_OF_RANGE:return R.OUT_OF_RANGE;case $e.UNIMPLEMENTED:return R.UNIMPLEMENTED;case $e.DATA_LOSS:return R.DATA_LOSS;default:return Z()}}(he=$e||($e={}))[he.OK=0]="OK",he[he.CANCELLED=1]="CANCELLED",he[he.UNKNOWN=2]="UNKNOWN",he[he.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",he[he.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",he[he.NOT_FOUND=5]="NOT_FOUND",he[he.ALREADY_EXISTS=6]="ALREADY_EXISTS",he[he.PERMISSION_DENIED=7]="PERMISSION_DENIED",he[he.UNAUTHENTICATED=16]="UNAUTHENTICATED",he[he.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",he[he.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",he[he.ABORTED=10]="ABORTED",he[he.OUT_OF_RANGE=11]="OUT_OF_RANGE",he[he.UNIMPLEMENTED=12]="UNIMPLEMENTED",he[he.INTERNAL=13]="INTERNAL",he[he.UNAVAILABLE=14]="UNAVAILABLE",he[he.DATA_LOSS=15]="DATA_LOSS";/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function qO(){return new TextEncoder}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const KO=new oo([4294967295,4294967295],0);function ES(t){const e=qO().encode(t),n=new YN;return n.update(e),new Uint8Array(n.digest())}function xS(t){const e=new DataView(t.buffer),n=e.getUint32(0,!0),r=e.getUint32(4,!0),i=e.getUint32(8,!0),s=e.getUint32(12,!0);return[new oo([n,r],0),new oo([i,s],0)]}class Mm{constructor(e,n,r){if(this.bitmap=e,this.padding=n,this.hashCount=r,n<0||n>=8)throw new Ll(`Invalid padding: ${n}`);if(r<0)throw new Ll(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new Ll(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new Ll(`Invalid padding when bitmap length is 0: ${n}`);this.Te=8*e.length-n,this.Ee=oo.fromNumber(this.Te)}de(e,n,r){let i=e.add(n.multiply(oo.fromNumber(r)));return i.compare(KO)===1&&(i=new oo([i.getBits(0),i.getBits(1)],0)),i.modulo(this.Ee).toNumber()}Ae(e){return(this.bitmap[Math.floor(e/8)]&1<<e%8)!=0}mightContain(e){if(this.Te===0)return!1;const n=ES(e),[r,i]=xS(n);for(let s=0;s<this.hashCount;s++){const o=this.de(r,i,s);if(!this.Ae(o))return!1}return!0}static create(e,n,r){const i=e%8==0?0:8-e%8,s=new Uint8Array(Math.ceil(e/8)),o=new Mm(s,i,n);return r.forEach(a=>o.insert(a)),o}insert(e){if(this.Te===0)return;const n=ES(e),[r,i]=xS(n);for(let s=0;s<this.hashCount;s++){const o=this.de(r,i,s);this.Re(o)}}Re(e){const n=Math.floor(e/8),r=e%8;this.bitmap[n]|=1<<r}}class Ll extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Vh{constructor(e,n,r,i,s){this.snapshotVersion=e,this.targetChanges=n,this.targetMismatches=r,this.documentUpdates=i,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(e,n,r){const i=new Map;return i.set(e,Vl.createSynthesizedTargetChangeForCurrentChange(e,n,r)),new Vh(ne.min(),i,new Pe(fe),gr(),le())}}class Vl{constructor(e,n,r,i,s){this.resumeToken=e,this.current=n,this.addedDocuments=r,this.modifiedDocuments=i,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(e,n,r){return new Vl(r,n,le(),le(),le())}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Fh{constructor(e,n,r,i){this.Ve=e,this.removedTargetIds=n,this.key=r,this.me=i}}class SS{constructor(e,n){this.targetId=e,this.fe=n}}class IS{constructor(e,n,r=mt.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=n,this.resumeToken=r,this.cause=i}}class AS{constructor(){this.ge=0,this.pe=CS(),this.ye=mt.EMPTY_BYTE_STRING,this.we=!1,this.Se=!0}get current(){return this.we}get resumeToken(){return this.ye}get be(){return this.ge!==0}get De(){return this.Se}Ce(e){e.approximateByteSize()>0&&(this.Se=!0,this.ye=e)}ve(){let e=le(),n=le(),r=le();return this.pe.forEach((i,s)=>{switch(s){case 0:e=e.add(i);break;case 2:n=n.add(i);break;case 1:r=r.add(i);break;default:Z()}}),new Vl(this.ye,this.we,e,n,r)}Fe(){this.Se=!1,this.pe=CS()}Me(e,n){this.Se=!0,this.pe=this.pe.insert(e,n)}xe(e){this.Se=!0,this.pe=this.pe.remove(e)}Oe(){this.ge+=1}Ne(){this.ge-=1,Ee(this.ge>=0)}Be(){this.Se=!0,this.we=!0}}class YO{constructor(e){this.Le=e,this.ke=new Map,this.qe=gr(),this.Qe=TS(),this.Ke=new Pe(fe)}$e(e){for(const n of e.Ve)e.me&&e.me.isFoundDocument()?this.Ue(n,e.me):this.We(n,e.key,e.me);for(const n of e.removedTargetIds)this.We(n,e.key,e.me)}Ge(e){this.forEachTarget(e,n=>{const r=this.ze(n);switch(e.state){case 0:this.je(n)&&r.Ce(e.resumeToken);break;case 1:r.Ne(),r.be||r.Fe(),r.Ce(e.resumeToken);break;case 2:r.Ne(),r.be||this.removeTarget(n);break;case 3:this.je(n)&&(r.Be(),r.Ce(e.resumeToken));break;case 4:this.je(n)&&(this.He(n),r.Ce(e.resumeToken));break;default:Z()}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ke.forEach((r,i)=>{this.je(i)&&n(i)})}Je(e){const n=e.targetId,r=e.fe.count,i=this.Ye(n);if(i){const s=i.target;if(Pm(s))if(r===0){const o=new K(s.path);this.We(n,o,vt.newNoDocument(o,ne.min()))}else Ee(r===1);else{const o=this.Ze(n);if(o!==r){const a=this.Xe(e),l=a?this.et(a,e,o):1;if(l!==0){this.He(n);const u=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ke=this.Ke.insert(n,u)}}}}}Xe(e){const n=e.fe.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:i=0},hashCount:s=0}=n;let o,a;try{o=ts(r).toUint8Array()}catch(l){if(l instanceof Fx)return lo("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{a=new Mm(o,i,s)}catch(l){return lo(l instanceof Ll?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return a.Te===0?null:a}et(e,n,r){return n.fe.count===r-this.rt(e,n.targetId)?0:2}rt(e,n){const r=this.Le.getRemoteKeysForTarget(n);let i=0;return r.forEach(s=>{const o=this.Le.nt(),a=`projects/${o.projectId}/databases/${o.database}/documents/${s.path.canonicalString()}`;e.mightContain(a)||(this.We(n,s,null),i++)}),i}it(e){const n=new Map;this.ke.forEach((s,o)=>{const a=this.Ye(o);if(a){if(s.current&&Pm(a.target)){const l=new K(a.target.path);this.qe.get(l)!==null||this.st(o,l)||this.We(o,l,vt.newNoDocument(l,e))}s.De&&(n.set(o,s.ve()),s.Fe())}});let r=le();this.Qe.forEach((s,o)=>{let a=!0;o.forEachWhile(l=>{const u=this.Ye(l);return!u||u.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(r=r.add(s))}),this.qe.forEach((s,o)=>o.setReadTime(e));const i=new Vh(e,n,this.Ke,this.qe,r);return this.qe=gr(),this.Qe=TS(),this.Ke=new Pe(fe),i}Ue(e,n){if(!this.je(e))return;const r=this.st(e,n.key)?2:0;this.ze(e).Me(n.key,r),this.qe=this.qe.insert(n.key,n),this.Qe=this.Qe.insert(n.key,this.ot(n.key).add(e))}We(e,n,r){if(!this.je(e))return;const i=this.ze(e);this.st(e,n)?i.Me(n,1):i.xe(n),this.Qe=this.Qe.insert(n,this.ot(n).delete(e)),r&&(this.qe=this.qe.insert(n,r))}removeTarget(e){this.ke.delete(e)}Ze(e){const n=this.ze(e).ve();return this.Le.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}Oe(e){this.ze(e).Oe()}ze(e){let n=this.ke.get(e);return n||(n=new AS,this.ke.set(e,n)),n}ot(e){let n=this.Qe.get(e);return n||(n=new ot(fe),this.Qe=this.Qe.insert(e,n)),n}je(e){const n=this.Ye(e)!==null;return n||U("WatchChangeAggregator","Detected inactive target",e),n}Ye(e){const n=this.ke.get(e);return n&&n.be?null:this.Le._t(e)}He(e){this.ke.set(e,new AS),this.Le.getRemoteKeysForTarget(e).forEach(n=>{this.We(e,n,null)})}st(e,n){return this.Le.getRemoteKeysForTarget(e).has(n)}}function TS(){return new Pe(K.comparator)}function CS(){return new Pe(K.comparator)}const XO={asc:"ASCENDING",desc:"DESCENDING"},JO={"<":"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"},ZO={and:"AND",or:"OR"};class eD{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function Lm(t,e){return t.useProto3Json||Ih(e)?e:{value:e}}function Uh(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 bS(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function tD(t,e){return Uh(t,e.toTimestamp())}function jn(t){return Ee(!!t),ne.fromTimestamp(function(n){const r=ni(n);return new Ge(r.seconds,r.nanos)}(t))}function Vm(t,e){return Fm(t,e).canonicalString()}function Fm(t,e){const n=function(i){return new Ae(["projects",i.projectId,"databases",i.database])}(t).child("documents");return e===void 0?n:n.child(e)}function RS(t){const e=Ae.fromString(t);return Ee(MS(e)),e}function Um(t,e){return Vm(t.databaseId,e.path)}function $m(t,e){const n=RS(e);if(n.get(1)!==t.databaseId.projectId)throw new H(R.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 H(R.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new K(PS(n))}function kS(t,e){return Vm(t.databaseId,e)}function nD(t){const e=RS(t);return e.length===4?Ae.emptyPath():PS(e)}function jm(t){return new Ae(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function PS(t){return Ee(t.length>4&&t.get(4)==="documents"),t.popFirst(5)}function NS(t,e,n){return{name:Um(t,e),fields:n.value.mapValue.fields}}function rD(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(u){return u==="NO_CHANGE"?0:u==="ADD"?1:u==="REMOVE"?2:u==="CURRENT"?3:u==="RESET"?4:Z()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(u,c){return u.useProto3Json?(Ee(c===void 0||typeof c=="string"),mt.fromBase64String(c||"")):(Ee(c===void 0||c instanceof Uint8Array),mt.fromUint8Array(c||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(u){const c=u.code===void 0?R.UNKNOWN:wS(u.code);return new H(c,u.message||"")}(o);n=new IS(r,i,s,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=$m(t,r.document.name),s=jn(r.document.updateTime),o=r.document.createTime?jn(r.document.createTime):ne.min(),a=new an({mapValue:{fields:r.document.fields}}),l=vt.newFoundDocument(i,s,o,a),u=r.targetIds||[],c=r.removedTargetIds||[];n=new Fh(u,c,l.key,l)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=$m(t,r.document),s=r.readTime?jn(r.readTime):ne.min(),o=vt.newNoDocument(i,s),a=r.removedTargetIds||[];n=new Fh([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=$m(t,r.document),s=r.removedTargetIds||[];n=new Fh([],s,i,null)}else{if(!("filter"in e))return Z();{e.filter;const r=e.filter;r.targetId;const{count:i=0,unchangedNames:s}=r,o=new WO(i,s),a=r.targetId;n=new SS(a,o)}}return n}function iD(t,e){let n;if(e instanceof Ml)n={update:NS(t,e.key,e.value)};else if(e instanceof _S)n={delete:Um(t,e.key)};else if(e instanceof is)n={update:NS(t,e.key,e.data),updateMask:fD(e.fieldMask)};else{if(!(e instanceof BO))return Z();n={verify:Um(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(s,o){const a=o.transform;if(a instanceof Oh)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof Nl)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof Ol)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof Dh)return{fieldPath:o.field.canonicalString(),increment:a.Ie};throw Z()}(0,r))),e.precondition.isNone||(n.currentDocument=function(i,s){return s.updateTime!==void 0?{updateTime:tD(i,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:Z()}(t,e.precondition)),n}function sD(t,e){return t&&t.length>0?(Ee(e!==void 0),t.map(n=>function(i,s){let o=i.updateTime?jn(i.updateTime):jn(s);return o.isEqual(ne.min())&&(o=jn(s)),new $O(o,i.transformResults||[])}(n,e))):[]}function oD(t,e){return{documents:[kS(t,e.path)]}}function aD(t,e){const n={structuredQuery:{}},r=e.path;let i;e.collectionGroup!==null?(i=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=kS(t,i);const s=function(u){if(u.length!==0)return DS(wn.create(u,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const o=function(u){if(u.length!==0)return u.map(c=>function(d){return{field:vo(d.field),direction:cD(d.dir)}}(c))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const a=Lm(t,e.limit);return a!==null&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=function(u){return{before:u.inclusive,values:u.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(u){return{before:!u.inclusive,values:u.position}}(e.endAt)),{ut:n,parent:i}}function lD(t){let e=nD(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){Ee(r===1);const c=n.from[0];c.allDescendants?i=c.collectionId:e=e.child(c.collectionId)}let s=[];n.where&&(s=function(h){const d=OS(h);return d instanceof wn&&qx(d)?d.getFilters():[d]}(n.where));let o=[];n.orderBy&&(o=function(h){return h.map(d=>function(g){return new bl(yo(g.field),function(w){switch(w){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(g.direction))}(d))}(n.orderBy));let a=null;n.limit&&(a=function(h){let d;return d=typeof h=="object"?h.value:h,Ih(d)?null:d}(n.limit));let l=null;n.startAt&&(l=function(h){const d=!!h.before,f=h.values||[];return new Rh(f,d)}(n.startAt));let u=null;return n.endAt&&(u=function(h){const d=!h.before,f=h.values||[];return new Rh(f,d)}(n.endAt)),CO(e,i,o,s,a,"F",l,u)}function uD(t,e){const n=function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Z()}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function OS(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=yo(n.unaryFilter.field);return Ue.create(r,"==",{doubleValue:NaN});case"IS_NULL":const i=yo(n.unaryFilter.field);return Ue.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=yo(n.unaryFilter.field);return Ue.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=yo(n.unaryFilter.field);return Ue.create(o,"!=",{nullValue:"NULL_VALUE"});default:return Z()}}(t):t.fieldFilter!==void 0?function(n){return Ue.create(yo(n.fieldFilter.field),function(i){switch(i){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";default:return Z()}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return wn.create(n.compositeFilter.filters.map(r=>OS(r)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return Z()}}(n.compositeFilter.op))}(t):Z()}function cD(t){return XO[t]}function hD(t){return JO[t]}function dD(t){return ZO[t]}function vo(t){return{fieldPath:t.canonicalString()}}function yo(t){return it.fromServerFormat(t.fieldPath)}function DS(t){return t instanceof Ue?function(n){if(n.op==="=="){if(zx(n.value))return{unaryFilter:{field:vo(n.field),op:"IS_NAN"}};if(jx(n.value))return{unaryFilter:{field:vo(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(zx(n.value))return{unaryFilter:{field:vo(n.field),op:"IS_NOT_NAN"}};if(jx(n.value))return{unaryFilter:{field:vo(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:vo(n.field),op:hD(n.op),value:n.value}}}(t):t instanceof wn?function(n){const r=n.getFilters().map(i=>DS(i));return r.length===1?r[0]:{compositeFilter:{op:dD(n.op),filters:r}}}(t):Z()}function fD(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function MS(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ri{constructor(e,n,r,i,s=ne.min(),o=ne.min(),a=mt.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=l}withSequenceNumber(e){return new ri(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new ri(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new ri(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new ri(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class pD{constructor(e){this.ct=e}}function gD(t){const e=lD({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?Om(e,e.limit,"L"):e}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class mD{constructor(){this._n=new vD}addToCollectionParentIndex(e,n){return this._n.add(n),k.resolve()}getCollectionParents(e,n){return k.resolve(this._n.getEntries(n))}addFieldIndex(e,n){return k.resolve()}deleteFieldIndex(e,n){return k.resolve()}deleteAllFieldIndexes(e){return k.resolve()}createTargetIndexes(e,n){return k.resolve()}getDocumentsMatchingTarget(e,n){return k.resolve(null)}getIndexType(e,n){return k.resolve(0)}getFieldIndexes(e,n){return k.resolve([])}getNextCollectionGroupToUpdate(e){return k.resolve(null)}getMinOffset(e,n){return k.resolve(ti.min())}getMinOffsetFromCollectionGroup(e,n){return k.resolve(ti.min())}updateCollectionGroup(e,n,r){return k.resolve()}updateIndexEntries(e,n){return k.resolve()}}class vD{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n]||new ot(Ae.comparator),s=!i.has(r);return this.index[n]=i.add(r),s}has(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n];return i&&i.has(r)}getEntries(e){return(this.index[e]||new ot(Ae.comparator)).toArray()}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class _o{constructor(e){this.On=e}next(){return this.On+=2,this.On}static Nn(){return new _o(0)}static Bn(){return new _o(-1)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class yD{constructor(){this.changes=new mo(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,vt.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?k.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(){}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *//**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class _D{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class wD{constructor(e,n,r,i){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=i}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(i=>(r=i,this.remoteDocumentCache.getEntry(e,n))).next(i=>(r!==null&&Dl(r.mutation,i,_n.empty(),Ge.now()),i))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,le()).next(()=>r))}getLocalViewOfDocuments(e,n,r=le()){const i=rs();return this.populateOverlays(e,i,n).next(()=>this.computeViews(e,n,i,r).next(s=>{let o=kl();return s.forEach((a,l)=>{o=o.insert(a,l.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=rs();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,le()))}populateOverlays(e,n,r){const i=[];return r.forEach(s=>{n.has(s)||i.push(s)}),this.documentOverlayCache.getOverlays(e,i).next(s=>{s.forEach((o,a)=>{n.set(o,a)})})}computeViews(e,n,r,i){let s=gr();const o=Pl(),a=function(){return Pl()}();return n.forEach((l,u)=>{const c=r.get(u.key);i.has(u.key)&&(c===void 0||c.mutation instanceof is)?s=s.insert(u.key,u):c!==void 0?(o.set(u.key,c.mutation.getFieldMask()),Dl(c.mutation,u,c.mutation.getFieldMask(),Ge.now())):o.set(u.key,_n.empty())}),this.recalculateAndSaveOverlays(e,s).next(l=>(l.forEach((u,c)=>o.set(u,c)),n.forEach((u,c)=>{var h;return a.set(u,new _D(c,(h=o.get(u))!==null&&h!==void 0?h:null))}),a))}recalculateAndSaveOverlays(e,n){const r=Pl();let i=new Pe((o,a)=>o-a),s=le();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const a of o)a.keys().forEach(l=>{const u=n.get(l);if(u===null)return;let c=r.get(l)||_n.empty();c=a.applyToLocalView(u,c),r.set(l,c);const h=(i.get(a.batchId)||le()).add(l);i=i.insert(a.batchId,h)})}).next(()=>{const o=[],a=i.getReverseIterator();for(;a.hasNext();){const l=a.getNext(),u=l.key,c=l.value,h=oS();c.forEach(d=>{if(!s.has(d)){const f=pS(n.get(d),r.get(d));f!==null&&h.set(d,f),s=s.add(d)}}),o.push(this.documentOverlayCache.saveOverlays(e,u,h))}return k.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,i){return function(o){return K.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):tS(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,i):this.getDocumentsMatchingCollectionQuery(e,n,r,i)}getNextDocuments(e,n,r,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,i).next(s=>{const o=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,i-s.size):k.resolve(rs());let a=-1,l=s;return o.next(u=>k.forEach(u,(c,h)=>(a<h.largestBatchId&&(a=h.largestBatchId),s.get(c)?k.resolve():this.remoteDocumentCache.getEntry(e,c).next(d=>{l=l.insert(c,d)}))).next(()=>this.populateOverlays(e,u,s)).next(()=>this.computeViews(e,l,u,le())).next(c=>({batchId:a,changes:sS(c)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new K(n)).next(r=>{let i=kl();return r.isFoundDocument()&&(i=i.insert(r.key,r)),i})}getDocumentsMatchingCollectionGroupQuery(e,n,r,i){const s=n.collectionGroup;let o=kl();return this.indexManager.getCollectionParents(e,s).next(a=>k.forEach(a,l=>{const u=function(h,d){return new po(d,null,h.explicitOrderBy.slice(),h.filters.slice(),h.limit,h.limitType,h.startAt,h.endAt)}(n,l.child(s));return this.getDocumentsMatchingCollectionQuery(e,u,r,i).next(c=>{c.forEach((h,d)=>{o=o.insert(h,d)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,i){let s;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(s=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,s,i))).next(o=>{s.forEach((l,u)=>{const c=u.getKey();o.get(c)===null&&(o=o.insert(c,vt.newInvalidDocument(c)))});let a=kl();return o.forEach((l,u)=>{const c=s.get(l);c!==void 0&&Dl(c.mutation,u,_n.empty(),Ge.now()),Ph(n,u)&&(a=a.insert(l,u))}),a})}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ED{constructor(e){this.serializer=e,this.cr=new Map,this.lr=new Map}getBundleMetadata(e,n){return k.resolve(this.cr.get(n))}saveBundleMetadata(e,n){return this.cr.set(n.id,function(i){return{id:i.id,version:i.version,createTime:jn(i.createTime)}}(n)),k.resolve()}getNamedQuery(e,n){return k.resolve(this.lr.get(n))}saveNamedQuery(e,n){return this.lr.set(n.name,function(i){return{name:i.name,query:gD(i.bundledQuery),readTime:jn(i.readTime)}}(n)),k.resolve()}}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class xD{constructor(){this.overlays=new Pe(K.comparator),this.hr=new Map}getOverlay(e,n){return k.resolve(this.overlays.get(n))}getOverlays(e,n){const r=rs();return k.forEach(n,i=>this.getOverlay(e,i).next(s=>{s!==null&&r.set(i,s)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((i,s)=>{this.ht(e,n,s)}),k.resolve()}removeOverlaysForBatchId(e,n,r){const i=this.hr.get(r);return i!==void 0&&(i.forEach(s=>this.overlays=this.overlays.remove(s)),this.hr.delete(r)),k.resolve()}getOverlaysForCollection(e,n,r){const i=rs(),s=n.length+1,o=new K(n.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const l=a.getNext().value,u=l.getKey();if(!n.isPrefixOf(u.path))break;u.path.length===s&&l.largestBatchId>r&&i.set(l.getKey(),l)}return k.resolve(i)}getOverlaysForCollectionGroup(e,n,r,i){let s=new Pe((u,c)=>u-c);const o=this.overlays.getIterator();for(;o.hasNext();){const u=o.getNext().value;if(u.getKey().getCollectionGroup()===n&&u.largestBatchId>r){let c=s.get(u.largestBatchId);c===null&&(c=rs(),s=s.insert(u.largestBatchId,c)),c.set(u.getKey(),u)}}const a=rs(),l=s.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((u,c)=>a.set(u,c)),!(a.size()>=i)););return k.resolve(a)}ht(e,n,r){const i=this.overlays.get(r.key);if(i!==null){const o=this.hr.get(i.largestBatchId).delete(r.key);this.hr.set(i.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new GO(n,r));let s=this.hr.get(n);s===void 0&&(s=le(),this.hr.set(n,s)),this.hr.set(n,s.add(r.key))}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class zm{constructor(){this.Pr=new ot(Xe.Ir),this.Tr=new ot(Xe.Er)}isEmpty(){return this.Pr.isEmpty()}addReference(e,n){const r=new Xe(e,n);this.Pr=this.Pr.add(r),this.Tr=this.Tr.add(r)}dr(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Ar(new Xe(e,n))}Rr(e,n){e.forEach(r=>this.removeReference(r,n))}Vr(e){const n=new K(new Ae([])),r=new Xe(n,e),i=new Xe(n,e+1),s=[];return this.Tr.forEachInRange([r,i],o=>{this.Ar(o),s.push(o.key)}),s}mr(){this.Pr.forEach(e=>this.Ar(e))}Ar(e){this.Pr=this.Pr.delete(e),this.Tr=this.Tr.delete(e)}gr(e){const n=new K(new Ae([])),r=new Xe(n,e),i=new Xe(n,e+1);let s=le();return this.Tr.forEachInRange([r,i],o=>{s=s.add(o.key)}),s}containsKey(e){const n=new Xe(e,0),r=this.Pr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class Xe{constructor(e,n){this.key=e,this.pr=n}static Ir(e,n){return K.comparator(e.key,n.key)||fe(e.pr,n.pr)}static Er(e,n){return fe(e.pr,n.pr)||K.comparator(e.key,n.key)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class SD{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.yr=1,this.wr=new ot(Xe.Ir)}checkEmpty(e){return k.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,i){const s=this.yr;this.yr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new HO(s,n,r,i);this.mutationQueue.push(o);for(const a of i)this.wr=this.wr.add(new Xe(a.key,s)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return k.resolve(o)}lookupMutationBatch(e,n){return k.resolve(this.Sr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,i=this.br(r),s=i<0?0:i;return k.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return k.resolve(this.mutationQueue.length===0?-1:this.yr-1)}getAllMutationBatches(e){return k.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new Xe(n,0),i=new Xe(n,Number.POSITIVE_INFINITY),s=[];return this.wr.forEachInRange([r,i],o=>{const a=this.Sr(o.pr);s.push(a)}),k.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new ot(fe);return n.forEach(i=>{const s=new Xe(i,0),o=new Xe(i,Number.POSITIVE_INFINITY);this.wr.forEachInRange([s,o],a=>{r=r.add(a.pr)})}),k.resolve(this.Dr(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,i=r.length+1;let s=r;K.isDocumentKey(s)||(s=s.child(""));const o=new Xe(new K(s),0);let a=new ot(fe);return this.wr.forEachWhile(l=>{const u=l.key.path;return!!r.isPrefixOf(u)&&(u.length===i&&(a=a.add(l.pr)),!0)},o),k.resolve(this.Dr(a))}Dr(e){const n=[];return e.forEach(r=>{const i=this.Sr(r);i!==null&&n.push(i)}),n}removeMutationBatch(e,n){Ee(this.Cr(n.batchId,"removed")===0),this.mutationQueue.shift();let r=this.wr;return k.forEach(n.mutations,i=>{const s=new Xe(i.key,n.batchId);return r=r.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.wr=r})}Mn(e){}containsKey(e,n){const r=new Xe(n,0),i=this.wr.firstAfterOrEqual(r);return k.resolve(n.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,k.resolve()}Cr(e,n){return this.br(e)}br(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Sr(e){const n=this.br(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ID{constructor(e){this.vr=e,this.docs=function(){return new Pe(K.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,i=this.docs.get(r),s=i?i.size:0,o=this.vr(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-s,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 k.resolve(r?r.document.mutableCopy():vt.newInvalidDocument(n))}getEntries(e,n){let r=gr();return n.forEach(i=>{const s=this.docs.get(i);r=r.insert(i,s?s.document.mutableCopy():vt.newInvalidDocument(i))}),k.resolve(r)}getDocumentsMatchingQuery(e,n,r,i){let s=gr();const o=n.path,a=new K(o.child("")),l=this.docs.getIteratorFrom(a);for(;l.hasNext();){const{key:u,value:{document:c}}=l.getNext();if(!o.isPrefixOf(u.path))break;u.path.length>o.length+1||lO(aO(c),r)<=0||(i.has(c.key)||Ph(n,c))&&(s=s.insert(c.key,c.mutableCopy()))}return k.resolve(s)}getAllFromCollectionGroup(e,n,r,i){Z()}Fr(e,n){return k.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new AD(this)}getSize(e){return k.resolve(this.size)}}class AD extends yD{constructor(e){super(),this.ar=e}applyChanges(e){const n=[];return this.changes.forEach((r,i)=>{i.isValidDocument()?n.push(this.ar.addEntry(e,i)):this.ar.removeEntry(r)}),k.waitFor(n)}getFromCache(e,n){return this.ar.getEntry(e,n)}getAllFromCache(e,n){return this.ar.getEntries(e,n)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class TD{constructor(e){this.persistence=e,this.Mr=new mo(n=>Rm(n),km),this.lastRemoteSnapshotVersion=ne.min(),this.highestTargetId=0,this.Or=0,this.Nr=new zm,this.targetCount=0,this.Br=_o.Nn()}forEachTarget(e,n){return this.Mr.forEach((r,i)=>n(i)),k.resolve()}getLastRemoteSnapshotVersion(e){return k.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return k.resolve(this.Or)}allocateTargetId(e){return this.highestTargetId=this.Br.next(),k.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.Or&&(this.Or=n),k.resolve()}qn(e){this.Mr.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.Br=new _o(n),this.highestTargetId=n),e.sequenceNumber>this.Or&&(this.Or=e.sequenceNumber)}addTargetData(e,n){return this.qn(n),this.targetCount+=1,k.resolve()}updateTargetData(e,n){return this.qn(n),k.resolve()}removeTargetData(e,n){return this.Mr.delete(n.target),this.Nr.Vr(n.targetId),this.targetCount-=1,k.resolve()}removeTargets(e,n,r){let i=0;const s=[];return this.Mr.forEach((o,a)=>{a.sequenceNumber<=n&&r.get(a.targetId)===null&&(this.Mr.delete(o),s.push(this.removeMatchingKeysForTargetId(e,a.targetId)),i++)}),k.waitFor(s).next(()=>i)}getTargetCount(e){return k.resolve(this.targetCount)}getTargetData(e,n){const r=this.Mr.get(n)||null;return k.resolve(r)}addMatchingKeys(e,n,r){return this.Nr.dr(n,r),k.resolve()}removeMatchingKeys(e,n,r){this.Nr.Rr(n,r);const i=this.persistence.referenceDelegate,s=[];return i&&n.forEach(o=>{s.push(i.markPotentiallyOrphaned(e,o))}),k.waitFor(s)}removeMatchingKeysForTargetId(e,n){return this.Nr.Vr(n),k.resolve()}getMatchingKeysForTargetId(e,n){const r=this.Nr.gr(n);return k.resolve(r)}containsKey(e,n){return k.resolve(this.Nr.containsKey(n))}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class CD{constructor(e,n){this.Lr={},this.overlays={},this.kr=new xm(0),this.qr=!1,this.qr=!0,this.referenceDelegate=e(this),this.Qr=new TD(this),this.indexManager=new mD,this.remoteDocumentCache=function(i){return new ID(i)}(r=>this.referenceDelegate.Kr(r)),this.serializer=new pD(n),this.$r=new ED(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.qr=!1,Promise.resolve()}get started(){return this.qr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new xD,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this.Lr[e.toKey()];return r||(r=new SD(n,this.referenceDelegate),this.Lr[e.toKey()]=r),r}getTargetCache(){return this.Qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.$r}runTransaction(e,n,r){U("MemoryPersistence","Starting transaction:",e);const i=new bD(this.kr.next());return this.referenceDelegate.Ur(),r(i).next(s=>this.referenceDelegate.Wr(i).next(()=>s)).toPromise().then(s=>(i.raiseOnCommittedEvent(),s))}Gr(e,n){return k.or(Object.values(this.Lr).map(r=>()=>r.containsKey(e,n)))}}class bD extends cO{constructor(e){super(),this.currentSequenceNumber=e}}class Bm{constructor(e){this.persistence=e,this.zr=new zm,this.jr=null}static Hr(e){return new Bm(e)}get Jr(){if(this.jr)return this.jr;throw Z()}addReference(e,n,r){return this.zr.addReference(r,n),this.Jr.delete(r.toString()),k.resolve()}removeReference(e,n,r){return this.zr.removeReference(r,n),this.Jr.add(r.toString()),k.resolve()}markPotentiallyOrphaned(e,n){return this.Jr.add(n.toString()),k.resolve()}removeTarget(e,n){this.zr.Vr(n.targetId).forEach(i=>this.Jr.add(i.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(i=>{i.forEach(s=>this.Jr.add(s.toString()))}).next(()=>r.removeTargetData(e,n))}Ur(){this.jr=new Set}Wr(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return k.forEach(this.Jr,r=>{const i=K.fromPath(r);return this.Yr(e,i).next(s=>{s||n.removeEntry(i,ne.min())})}).next(()=>(this.jr=null,n.apply(e)))}updateLimboDocument(e,n){return this.Yr(e,n).next(r=>{r?this.Jr.delete(n.toString()):this.Jr.add(n.toString())})}Kr(e){return 0}Yr(e,n){return k.or([()=>k.resolve(this.zr.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Gr(e,n)])}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Hm{constructor(e,n,r,i){this.targetId=e,this.fromCache=n,this.qi=r,this.Qi=i}static Ki(e,n){let r=le(),i=le();for(const s of n.docChanges)switch(s.type){case 0:r=r.add(s.doc.key);break;case 1:i=i.add(s.doc.key)}return new Hm(e,n.fromCache,r,i)}}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class RD{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class kD{constructor(){this.$i=!1,this.Ui=!1,this.Wi=100,this.Gi=function(){return Pk()?8:Zi.v(Ve())>0?6:4}()}initialize(e,n){this.zi=e,this.indexManager=n,this.$i=!0}getDocumentsMatchingQuery(e,n,r,i){const s={result:null};return this.ji(e,n).next(o=>{s.result=o}).next(()=>{if(!s.result)return this.Hi(e,n,i,r).next(o=>{s.result=o})}).next(()=>{if(s.result)return;const o=new RD;return this.Ji(e,n,o).next(a=>{if(s.result=a,this.Ui)return this.Yi(e,n,o,a.size)})}).next(()=>s.result)}Yi(e,n,r,i){return r.documentReadCount<this.Wi?(_l()<=ue.DEBUG&&U("QueryEngine","SDK will not create cache indexes for query:",go(n),"since it only creates cache indexes for collection contains","more than or equal to",this.Wi,"documents"),k.resolve()):(_l()<=ue.DEBUG&&U("QueryEngine","Query:",go(n),"scans",r.documentReadCount,"local documents and returns",i,"documents as results."),r.documentReadCount>this.Gi*i?(_l()<=ue.DEBUG&&U("QueryEngine","The SDK decides to create cache indexes for query:",go(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,$n(n))):k.resolve())}ji(e,n){if(eS(n))return k.resolve(null);let r=$n(n);return this.indexManager.getIndexType(e,r).next(i=>i===0?null:(n.limit!==null&&i===1&&(n=Om(n,null,"F"),r=$n(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(s=>{const o=le(...s);return this.zi.getDocuments(e,o).next(a=>this.indexManager.getMinOffset(e,r).next(l=>{const u=this.Zi(n,a);return this.Xi(n,u,o,l.readTime)?this.ji(e,Om(n,null,"F")):this.es(e,u,n,l)}))})))}Hi(e,n,r,i){return eS(n)||i.isEqual(ne.min())?k.resolve(null):this.zi.getDocuments(e,r).next(s=>{const o=this.Zi(n,s);return this.Xi(n,o,r,i)?k.resolve(null):(_l()<=ue.DEBUG&&U("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),go(n)),this.es(e,o,n,oO(i,-1)).next(a=>a))})}Zi(e,n){let r=new ot(rS(e));return n.forEach((i,s)=>{Ph(e,s)&&(r=r.add(s))}),r}Xi(e,n,r,i){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const s=e.limitType==="F"?n.last():n.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}Ji(e,n,r){return _l()<=ue.DEBUG&&U("QueryEngine","Using full collection scan to execute query:",go(n)),this.zi.getDocumentsMatchingQuery(e,n,ti.min(),r)}es(e,n,r,i){return this.zi.getDocumentsMatchingQuery(e,r,i).next(s=>(n.forEach(o=>{s=s.insert(o.key,o)}),s))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class PD{constructor(e,n,r,i){this.persistence=e,this.ts=n,this.serializer=i,this.ns=new Pe(fe),this.rs=new mo(s=>Rm(s),km),this.ss=new Map,this.os=e.getRemoteDocumentCache(),this.Qr=e.getTargetCache(),this.$r=e.getBundleCache(),this._s(r)}_s(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new wD(this.os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.os.setIndexManager(this.indexManager),this.ts.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.ns))}}function ND(t,e,n,r){return new PD(t,e,n,r)}async function LS(t,e){const n=ie(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let i;return n.mutationQueue.getAllMutationBatches(r).next(s=>(i=s,n._s(e),n.mutationQueue.getAllMutationBatches(r))).next(s=>{const o=[],a=[];let l=le();for(const u of i){o.push(u.batchId);for(const c of u.mutations)l=l.add(c.key)}for(const u of s){a.push(u.batchId);for(const c of u.mutations)l=l.add(c.key)}return n.localDocuments.getDocuments(r,l).next(u=>({us:u,removedBatchIds:o,addedBatchIds:a}))})})}function OD(t,e){const n=ie(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const i=e.batch.keys(),s=n.os.newChangeBuffer({trackRemovals:!0});return function(a,l,u,c){const h=u.batch,d=h.keys();let f=k.resolve();return d.forEach(g=>{f=f.next(()=>c.getEntry(l,g)).next(m=>{const w=u.docVersions.get(g);Ee(w!==null),m.version.compareTo(w)<0&&(h.applyToRemoteDocument(m,u),m.isValidDocument()&&(m.setReadTime(u.commitVersion),c.addEntry(m)))})}),f.next(()=>a.mutationQueue.removeMutationBatch(l,h))}(n,r,e,s).next(()=>s.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,i,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(a){let l=le();for(let u=0;u<a.mutationResults.length;++u)a.mutationResults[u].transformResults.length>0&&(l=l.add(a.batch.mutations[u].key));return l}(e))).next(()=>n.localDocuments.getDocuments(r,i))})}function VS(t){const e=ie(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.Qr.getLastRemoteSnapshotVersion(n))}function DD(t,e){const n=ie(t),r=e.snapshotVersion;let i=n.ns;return n.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{const o=n.os.newChangeBuffer({trackRemovals:!0});i=n.ns;const a=[];e.targetChanges.forEach((c,h)=>{const d=i.get(h);if(!d)return;a.push(n.Qr.removeMatchingKeys(s,c.removedDocuments,h).next(()=>n.Qr.addMatchingKeys(s,c.addedDocuments,h)));let f=d.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(h)!==null?f=f.withResumeToken(mt.EMPTY_BYTE_STRING,ne.min()).withLastLimboFreeSnapshotVersion(ne.min()):c.resumeToken.approximateByteSize()>0&&(f=f.withResumeToken(c.resumeToken,r)),i=i.insert(h,f),function(m,w,v){return m.resumeToken.approximateByteSize()===0||w.snapshotVersion.toMicroseconds()-m.snapshotVersion.toMicroseconds()>=3e8?!0:v.addedDocuments.size+v.modifiedDocuments.size+v.removedDocuments.size>0}(d,f,c)&&a.push(n.Qr.updateTargetData(s,f))});let l=gr(),u=le();if(e.documentUpdates.forEach(c=>{e.resolvedLimboDocuments.has(c)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(s,c))}),a.push(MD(s,o,e.documentUpdates).next(c=>{l=c.cs,u=c.ls})),!r.isEqual(ne.min())){const c=n.Qr.getLastRemoteSnapshotVersion(s).next(h=>n.Qr.setTargetsMetadata(s,s.currentSequenceNumber,r));a.push(c)}return k.waitFor(a).next(()=>o.apply(s)).next(()=>n.localDocuments.getLocalViewOfDocuments(s,l,u)).next(()=>l)}).then(s=>(n.ns=i,s))}function MD(t,e,n){let r=le(),i=le();return n.forEach(s=>r=r.add(s)),e.getEntries(t,r).next(s=>{let o=gr();return n.forEach((a,l)=>{const u=s.get(a);l.isFoundDocument()!==u.isFoundDocument()&&(i=i.add(a)),l.isNoDocument()&&l.version.isEqual(ne.min())?(e.removeEntry(a,l.readTime),o=o.insert(a,l)):!u.isValidDocument()||l.version.compareTo(u.version)>0||l.version.compareTo(u.version)===0&&u.hasPendingWrites?(e.addEntry(l),o=o.insert(a,l)):U("LocalStore","Ignoring outdated watch update for ",a,". Current version:",u.version," Watch version:",l.version)}),{cs:o,ls:i}})}function LD(t,e){const n=ie(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function VD(t,e){const n=ie(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let i;return n.Qr.getTargetData(r,e).next(s=>s?(i=s,k.resolve(i)):n.Qr.allocateTargetId(r).next(o=>(i=new ri(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.Qr.addTargetData(r,i).next(()=>i))))}).then(r=>{const i=n.ns.get(r.targetId);return(i===null||r.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.ns=n.ns.insert(r.targetId,r),n.rs.set(e,r.targetId)),r})}async function Gm(t,e,n){const r=ie(t),i=r.ns.get(e),s=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",s,o=>r.persistence.referenceDelegate.removeTarget(o,i))}catch(o){if(!Sl(o))throw o;U("LocalStore",`Failed to update sequence numbers for target ${e}: ${o}`)}r.ns=r.ns.remove(e),r.rs.delete(i.target)}function FS(t,e,n){const r=ie(t);let i=ne.min(),s=le();return r.persistence.runTransaction("Execute query","readwrite",o=>function(l,u,c){const h=ie(l),d=h.rs.get(c);return d!==void 0?k.resolve(h.ns.get(d)):h.Qr.getTargetData(u,c)}(r,o,$n(e)).next(a=>{if(a)return i=a.lastLimboFreeSnapshotVersion,r.Qr.getMatchingKeysForTargetId(o,a.targetId).next(l=>{s=l})}).next(()=>r.ts.getDocumentsMatchingQuery(o,e,n?i:ne.min(),n?s:le())).next(a=>(FD(r,RO(e),a),{documents:a,hs:s})))}function FD(t,e,n){let r=t.ss.get(e)||ne.min();n.forEach((i,s)=>{s.readTime.compareTo(r)>0&&(r=s.readTime)}),t.ss.set(e,r)}class US{constructor(){this.activeTargetIds=MO()}As(e){this.activeTargetIds=this.activeTargetIds.add(e)}Rs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ds(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class UD{constructor(){this.no=new US,this.ro={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e){return this.no.As(e),this.ro[e]||"not-current"}updateQueryState(e,n,r){this.ro[e]=n}removeLocalQueryTarget(e){this.no.Rs(e)}isLocalQueryTarget(e){return this.no.activeTargetIds.has(e)}clearQueryState(e){delete this.ro[e]}getAllActiveQueryTargets(){return this.no.activeTargetIds}isActiveQueryTarget(e){return this.no.activeTargetIds.has(e)}start(){return this.no=new US,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class $D{io(e){}shutdown(){}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class $S{constructor(){this.so=()=>this.oo(),this._o=()=>this.ao(),this.uo=[],this.co()}io(e){this.uo.push(e)}shutdown(){window.removeEventListener("online",this.so),window.removeEventListener("offline",this._o)}co(){window.addEventListener("online",this.so),window.addEventListener("offline",this._o)}oo(){U("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.uo)e(0)}ao(){U("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.uo)e(1)}static D(){return typeof window!="undefined"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let $h=null;function Wm(){return $h===null?$h=function(){return 268435456+Math.round(2147483648*Math.random())}():$h++,"0x"+$h.toString(16)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const jD={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class zD{constructor(e){this.lo=e.lo,this.ho=e.ho}Po(e){this.Io=e}To(e){this.Eo=e}onMessage(e){this.Ao=e}close(){this.ho()}send(e){this.lo(e)}Ro(){this.Io()}Vo(e){this.Eo(e)}mo(e){this.Ao(e)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const yt="WebChannelConnection";class BD extends class{constructor(n){this.databaseInfo=n,this.databaseId=n.databaseId;const r=n.ssl?"https":"http",i=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.fo=r+"://"+n.host,this.po=`projects/${i}/databases/${s}`,this.yo=this.databaseId.database==="(default)"?`project_id=${i}`:`project_id=${i}&database_id=${s}`}get wo(){return!1}So(n,r,i,s,o){const a=Wm(),l=this.bo(n,r.toUriEncodedString());U("RestConnection",`Sending RPC '${n}' ${a}:`,l,i);const u={"google-cloud-resource-prefix":this.po,"x-goog-request-params":this.yo};return this.Do(u,s,o),this.Co(n,l,u,i).then(c=>(U("RestConnection",`Received RPC '${n}' ${a}: `,c),c),c=>{throw lo("RestConnection",`RPC '${n}' ${a} failed with error: `,c,"url: ",l,"request:",i),c})}vo(n,r,i,s,o,a){return this.So(n,r,i,s,o)}Do(n,r,i){n["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+ao}(),n["Content-Type"]="text/plain",this.databaseInfo.appId&&(n["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((s,o)=>n[o]=s),i&&i.headers.forEach((s,o)=>n[o]=s)}bo(n,r){const i=jD[n];return`${this.fo}/v1/${r}:${i}`}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Co(e,n,r,i){const s=Wm();return new Promise((o,a)=>{const l=new KN;l.setWithCredentials(!0),l.listenOnce(QN.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case ym.NO_ERROR:const c=l.getResponseJson();U(yt,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(c)),o(c);break;case ym.TIMEOUT:U(yt,`RPC '${e}' ${s} timed out`),a(new H(R.DEADLINE_EXCEEDED,"Request time out"));break;case ym.HTTP_ERROR:const h=l.getStatus();if(U(yt,`RPC '${e}' ${s} failed with status:`,h,"response text:",l.getResponseText()),h>0){let d=l.getResponseJson();Array.isArray(d)&&(d=d[0]);const f=d==null?void 0:d.error;if(f&&f.status&&f.message){const g=function(w){const v=w.toLowerCase().replace(/_/g,"-");return Object.values(R).indexOf(v)>=0?v:R.UNKNOWN}(f.status);a(new H(g,f.message))}else a(new H(R.UNKNOWN,"Server responded with status "+l.getStatus()))}else a(new H(R.UNAVAILABLE,"Connection failed."));break;default:Z()}}finally{U(yt,`RPC '${e}' ${s} completed.`)}});const u=JSON.stringify(i);U(yt,`RPC '${e}' ${s} sending request:`,i),l.send(n,"POST",u,r,15)})}Fo(e,n,r){const i=Wm(),s=[this.fo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=GN(),a=WN(),l={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&&(l.longPollingTimeout=Math.round(1e3*u)),this.useFetchStreams&&(l.useFetchStreams=!0),this.Do(l.initMessageHeaders,n,r),l.encodeInitMessageHeaders=!0;const c=s.join("");U(yt,`Creating RPC '${e}' stream ${i}: ${c}`,l);const h=o.createWebChannel(c,l);let d=!1,f=!1;const g=new zD({lo:w=>{f?U(yt,`Not sending because RPC '${e}' stream ${i} is closed:`,w):(d||(U(yt,`Opening RPC '${e}' stream ${i} transport.`),h.open(),d=!0),U(yt,`RPC '${e}' stream ${i} sending:`,w),h.send(w))},ho:()=>h.close()}),m=(w,v,y)=>{w.listen(v,_=>{try{y(_)}catch(E){setTimeout(()=>{throw E},0)}})};return m(h,Sh.EventType.OPEN,()=>{f||U(yt,`RPC '${e}' stream ${i} transport opened.`)}),m(h,Sh.EventType.CLOSE,()=>{f||(f=!0,U(yt,`RPC '${e}' stream ${i} transport closed`),g.Vo())}),m(h,Sh.EventType.ERROR,w=>{f||(f=!0,lo(yt,`RPC '${e}' stream ${i} transport errored:`,w),g.Vo(new H(R.UNAVAILABLE,"The operation could not be completed")))}),m(h,Sh.EventType.MESSAGE,w=>{var v;if(!f){const y=w.data[0];Ee(!!y);const _=y,E=_.error||((v=_[0])===null||v===void 0?void 0:v.error);if(E){U(yt,`RPC '${e}' stream ${i} received error:`,E);const I=E.status;let A=function(N){const O=$e[N];if(O!==void 0)return wS(O)}(I),T=E.message;A===void 0&&(A=R.INTERNAL,T="Unknown error status: "+I+" with message "+E.message),f=!0,g.Vo(new H(A,T)),h.close()}else U(yt,`RPC '${e}' stream ${i} received:`,y),g.mo(y)}}),m(a,qN.STAT_EVENT,w=>{w.stat===kx.PROXY?U(yt,`RPC '${e}' stream ${i} detected buffering proxy`):w.stat===kx.NOPROXY&&U(yt,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{g.Ro()},0),g}}function Qm(){return typeof document!="undefined"?document:null}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function jh(t){return new eD(t,!0)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class jS{constructor(e,n,r=1e3,i=1.5,s=6e4){this.oi=e,this.timerId=n,this.Mo=r,this.xo=i,this.Oo=s,this.No=0,this.Bo=null,this.Lo=Date.now(),this.reset()}reset(){this.No=0}ko(){this.No=this.Oo}qo(e){this.cancel();const n=Math.floor(this.No+this.Qo()),r=Math.max(0,Date.now()-this.Lo),i=Math.max(0,n-r);i>0&&U("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.No} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.Bo=this.oi.enqueueAfterDelay(this.timerId,i,()=>(this.Lo=Date.now(),e())),this.No*=this.xo,this.No<this.Mo&&(this.No=this.Mo),this.No>this.Oo&&(this.No=this.Oo)}Ko(){this.Bo!==null&&(this.Bo.skipDelay(),this.Bo=null)}cancel(){this.Bo!==null&&(this.Bo.cancel(),this.Bo=null)}Qo(){return(Math.random()-.5)*this.No}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class zS{constructor(e,n,r,i,s,o,a,l){this.oi=e,this.$o=r,this.Uo=i,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=l,this.state=0,this.Wo=0,this.Go=null,this.zo=null,this.stream=null,this.jo=new jS(e,n)}Ho(){return this.state===1||this.state===5||this.Jo()}Jo(){return this.state===2||this.state===3}start(){this.state!==4?this.auth():this.Yo()}async stop(){this.Ho()&&await this.close(0)}Zo(){this.state=0,this.jo.reset()}Xo(){this.Jo()&&this.Go===null&&(this.Go=this.oi.enqueueAfterDelay(this.$o,6e4,()=>this.e_()))}t_(e){this.n_(),this.stream.send(e)}async e_(){if(this.Jo())return this.close(0)}n_(){this.Go&&(this.Go.cancel(),this.Go=null)}r_(){this.zo&&(this.zo.cancel(),this.zo=null)}async close(e,n){this.n_(),this.r_(),this.jo.cancel(),this.Wo++,e!==4?this.jo.reset():n&&n.code===R.RESOURCE_EXHAUSTED?(Fn(n.toString()),Fn("Using maximum backoff delay to prevent overloading the backend."),this.jo.ko()):n&&n.code===R.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.i_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.To(n)}i_(){}auth(){this.state=1;const e=this.s_(this.Wo),n=this.Wo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,i])=>{this.Wo===n&&this.o_(r,i)},r=>{e(()=>{const i=new H(R.UNKNOWN,"Fetching auth token failed: "+r.message);return this.__(i)})})}o_(e,n){const r=this.s_(this.Wo);this.stream=this.a_(e,n),this.stream.Po(()=>{r(()=>(this.state=2,this.zo=this.oi.enqueueAfterDelay(this.Uo,1e4,()=>(this.Jo()&&(this.state=3),Promise.resolve())),this.listener.Po()))}),this.stream.To(i=>{r(()=>this.__(i))}),this.stream.onMessage(i=>{r(()=>this.onMessage(i))})}Yo(){this.state=5,this.jo.qo(async()=>{this.state=0,this.start()})}__(e){return U("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}s_(e){return n=>{this.oi.enqueueAndForget(()=>this.Wo===e?n():(U("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class HD extends zS{constructor(e,n,r,i,s,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}a_(e,n){return this.connection.Fo("Listen",e,n)}onMessage(e){this.jo.reset();const n=rD(this.serializer,e),r=function(s){if(!("targetChange"in s))return ne.min();const o=s.targetChange;return o.targetIds&&o.targetIds.length?ne.min():o.readTime?jn(o.readTime):ne.min()}(e);return this.listener.u_(n,r)}c_(e){const n={};n.database=jm(this.serializer),n.addTarget=function(s,o){let a;const l=o.target;if(a=Pm(l)?{documents:oD(s,l)}:{query:aD(s,l).ut},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=bS(s,o.resumeToken);const u=Lm(s,o.expectedCount);u!==null&&(a.expectedCount=u)}else if(o.snapshotVersion.compareTo(ne.min())>0){a.readTime=Uh(s,o.snapshotVersion.toTimestamp());const u=Lm(s,o.expectedCount);u!==null&&(a.expectedCount=u)}return a}(this.serializer,e);const r=uD(this.serializer,e);r&&(n.labels=r),this.t_(n)}l_(e){const n={};n.database=jm(this.serializer),n.removeTarget=e,this.t_(n)}}class GD extends zS{constructor(e,n,r,i,s,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s,this.h_=!1}get P_(){return this.h_}start(){this.h_=!1,this.lastStreamToken=void 0,super.start()}i_(){this.h_&&this.I_([])}a_(e,n){return this.connection.Fo("Write",e,n)}onMessage(e){if(Ee(!!e.streamToken),this.lastStreamToken=e.streamToken,this.h_){this.jo.reset();const n=sD(e.writeResults,e.commitTime),r=jn(e.commitTime);return this.listener.T_(r,n)}return Ee(!e.writeResults||e.writeResults.length===0),this.h_=!0,this.listener.E_()}d_(){const e={};e.database=jm(this.serializer),this.t_(e)}I_(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>iD(this.serializer,r))};this.t_(n)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class WD extends class{}{constructor(e,n,r,i){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=i,this.A_=!1}R_(){if(this.A_)throw new H(R.FAILED_PRECONDITION,"The client has already been terminated.")}So(e,n,r,i){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.So(e,Fm(n,r),i,s,o)).catch(s=>{throw s.name==="FirebaseError"?(s.code===R.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new H(R.UNKNOWN,s.toString())})}vo(e,n,r,i,s){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,a])=>this.connection.vo(e,Fm(n,r),i,o,a,s)).catch(o=>{throw o.name==="FirebaseError"?(o.code===R.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new H(R.UNKNOWN,o.toString())})}terminate(){this.A_=!0,this.connection.terminate()}}class QD{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.m_=0,this.f_=null,this.g_=!0}p_(){this.m_===0&&(this.y_("Unknown"),this.f_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.f_=null,this.w_("Backend didn't respond within 10 seconds."),this.y_("Offline"),Promise.resolve())))}S_(e){this.state==="Online"?this.y_("Unknown"):(this.m_++,this.m_>=1&&(this.b_(),this.w_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.y_("Offline")))}set(e){this.b_(),this.m_=0,e==="Online"&&(this.g_=!1),this.y_(e)}y_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}w_(e){const n=`Could not reach Cloud Firestore backend. ${e}
This 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.g_?(Fn(n),this.g_=!1):U("OnlineStateTracker",n)}b_(){this.f_!==null&&(this.f_.cancel(),this.f_=null)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class qD{constructor(e,n,r,i,s){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.D_=[],this.C_=new Map,this.v_=new Set,this.F_=[],this.M_=s,this.M_.io(o=>{r.enqueueAndForget(async()=>{ss(this)&&(U("RemoteStore","Restarting streams for network reachability change."),await async function(l){const u=ie(l);u.v_.add(4),await Fl(u),u.x_.set("Unknown"),u.v_.delete(4),await zh(u)}(this))})}),this.x_=new QD(r,i)}}async function zh(t){if(ss(t))for(const e of t.F_)await e(!0)}async function Fl(t){for(const e of t.F_)await e(!1)}function BS(t,e){const n=ie(t);n.C_.has(e.targetId)||(n.C_.set(e.targetId,e),Ym(n)?Km(n):wo(n).Jo()&&qm(n,e))}function HS(t,e){const n=ie(t),r=wo(n);n.C_.delete(e),r.Jo()&&GS(n,e),n.C_.size===0&&(r.Jo()?r.Xo():ss(n)&&n.x_.set("Unknown"))}function qm(t,e){if(t.O_.Oe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(ne.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}wo(t).c_(e)}function GS(t,e){t.O_.Oe(e),wo(t).l_(e)}function Km(t){t.O_=new YO({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),_t:e=>t.C_.get(e)||null,nt:()=>t.datastore.serializer.databaseId}),wo(t).start(),t.x_.p_()}function Ym(t){return ss(t)&&!wo(t).Ho()&&t.C_.size>0}function ss(t){return ie(t).v_.size===0}function WS(t){t.O_=void 0}async function KD(t){t.C_.forEach((e,n)=>{qm(t,e)})}async function YD(t,e){WS(t),Ym(t)?(t.x_.S_(e),Km(t)):t.x_.set("Unknown")}async function XD(t,e,n){if(t.x_.set("Online"),e instanceof IS&&e.state===2&&e.cause)try{await async function(i,s){const o=s.cause;for(const a of s.targetIds)i.C_.has(a)&&(await i.remoteSyncer.rejectListen(a,o),i.C_.delete(a),i.O_.removeTarget(a))}(t,e)}catch(r){U("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Bh(t,r)}else if(e instanceof Fh?t.O_.$e(e):e instanceof SS?t.O_.Je(e):t.O_.Ge(e),!n.isEqual(ne.min()))try{const r=await VS(t.localStore);n.compareTo(r)>=0&&await function(s,o){const a=s.O_.it(o);return a.targetChanges.forEach((l,u)=>{if(l.resumeToken.approximateByteSize()>0){const c=s.C_.get(u);c&&s.C_.set(u,c.withResumeToken(l.resumeToken,o))}}),a.targetMismatches.forEach((l,u)=>{const c=s.C_.get(l);if(!c)return;s.C_.set(l,c.withResumeToken(mt.EMPTY_BYTE_STRING,c.snapshotVersion)),GS(s,l);const h=new ri(c.target,l,u,c.sequenceNumber);qm(s,h)}),s.remoteSyncer.applyRemoteEvent(a)}(t,n)}catch(r){U("RemoteStore","Failed to raise snapshot:",r),await Bh(t,r)}}async function Bh(t,e,n){if(!Sl(e))throw e;t.v_.add(1),await Fl(t),t.x_.set("Offline"),n||(n=()=>VS(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{U("RemoteStore","Retrying IndexedDB access"),await n(),t.v_.delete(1),await zh(t)})}function QS(t,e){return e().catch(n=>Bh(t,n,e))}async function Hh(t){const e=ie(t),n=ii(e);let r=e.D_.length>0?e.D_[e.D_.length-1].batchId:-1;for(;JD(e);)try{const i=await LD(e.localStore,r);if(i===null){e.D_.length===0&&n.Xo();break}r=i.batchId,ZD(e,i)}catch(i){await Bh(e,i)}qS(e)&&KS(e)}function JD(t){return ss(t)&&t.D_.length<10}function ZD(t,e){t.D_.push(e);const n=ii(t);n.Jo()&&n.P_&&n.I_(e.mutations)}function qS(t){return ss(t)&&!ii(t).Ho()&&t.D_.length>0}function KS(t){ii(t).start()}async function eM(t){ii(t).d_()}async function tM(t){const e=ii(t);for(const n of t.D_)e.I_(n.mutations)}async function nM(t,e,n){const r=t.D_.shift(),i=Dm.from(r,e,n);await QS(t,()=>t.remoteSyncer.applySuccessfulWrite(i)),await Hh(t)}async function rM(t,e){e&&ii(t).P_&&await async function(r,i){if(function(o){return QO(o)&&o!==R.ABORTED}(i.code)){const s=r.D_.shift();ii(r).Zo(),await QS(r,()=>r.remoteSyncer.rejectFailedWrite(s.batchId,i)),await Hh(r)}}(t,e),qS(t)&&KS(t)}async function YS(t,e){const n=ie(t);n.asyncQueue.verifyOperationInProgress(),U("RemoteStore","RemoteStore received new credentials");const r=ss(n);n.v_.add(3),await Fl(n),r&&n.x_.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.v_.delete(3),await zh(n)}async function iM(t,e){const n=ie(t);e?(n.v_.delete(2),await zh(n)):e||(n.v_.add(2),await Fl(n),n.x_.set("Unknown"))}function wo(t){return t.N_||(t.N_=function(n,r,i){const s=ie(n);return s.R_(),new HD(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Po:KD.bind(null,t),To:YD.bind(null,t),u_:XD.bind(null,t)}),t.F_.push(async e=>{e?(t.N_.Zo(),Ym(t)?Km(t):t.x_.set("Unknown")):(await t.N_.stop(),WS(t))})),t.N_}function ii(t){return t.B_||(t.B_=function(n,r,i){const s=ie(n);return s.R_(),new GD(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Po:eM.bind(null,t),To:rM.bind(null,t),E_:tM.bind(null,t),T_:nM.bind(null,t)}),t.F_.push(async e=>{e?(t.B_.Zo(),await Hh(t)):(await t.B_.stop(),t.D_.length>0&&(U("RemoteStore",`Stopping write stream with ${t.D_.length} pending writes`),t.D_=[]))})),t.B_}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Xm{constructor(e,n,r,i,s){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=s,this.deferred=new pr,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,i,s){const o=Date.now()+r,a=new Xm(e,n,o,i,s);return a.start(r),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new H(R.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 Jm(t,e){if(Fn("AsyncQueue",`${e}: ${t}`),Sl(t))return new H(R.UNAVAILABLE,`${e}: ${t}`);throw t}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Eo{constructor(e){this.comparator=e?(n,r)=>e(n,r)||K.comparator(n.key,r.key):(n,r)=>K.comparator(n.key,r.key),this.keyedMap=kl(),this.sortedSet=new Pe(this.comparator)}static emptySet(e){return new Eo(e.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 Eo)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(!i.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
  `+e.join(`  
`)+`
)`}copy(e,n){const r=new Eo;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class XS{constructor(){this.L_=new Pe(K.comparator)}track(e){const n=e.doc.key,r=this.L_.get(n);r?e.type!==0&&r.type===3?this.L_=this.L_.insert(n,e):e.type===3&&r.type!==1?this.L_=this.L_.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.L_=this.L_.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.L_=this.L_.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.L_=this.L_.remove(n):e.type===1&&r.type===2?this.L_=this.L_.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.L_=this.L_.insert(n,{type:2,doc:e.doc}):Z():this.L_=this.L_.insert(n,e)}k_(){const e=[];return this.L_.inorderTraversal((n,r)=>{e.push(r)}),e}}class xo{constructor(e,n,r,i,s,o,a,l,u){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=s,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=l,this.hasCachedResults=u}static fromInitialDocuments(e,n,r,i,s){const o=[];return n.forEach(a=>{o.push({type:0,doc:a})}),new xo(e,n,Eo.emptySet(n),o,r,i,!0,!1,s)}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)&&kh(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 i=0;i<n.length;i++)if(n[i].type!==r[i].type||!n[i].doc.isEqual(r[i].doc))return!1;return!0}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class sM{constructor(){this.q_=void 0,this.Q_=[]}}class oM{constructor(){this.queries=new mo(e=>nS(e),kh),this.onlineState="Unknown",this.K_=new Set}}async function aM(t,e){const n=ie(t),r=e.query;let i=!1,s=n.queries.get(r);if(s||(i=!0,s=new sM),i)try{s.q_=await n.onListen(r)}catch(o){const a=Jm(o,`Initialization of query '${go(e.query)}' failed`);return void e.onError(a)}n.queries.set(r,s),s.Q_.push(e),e.U_(n.onlineState),s.q_&&e.W_(s.q_)&&Zm(n)}async function lM(t,e){const n=ie(t),r=e.query;let i=!1;const s=n.queries.get(r);if(s){const o=s.Q_.indexOf(e);o>=0&&(s.Q_.splice(o,1),i=s.Q_.length===0)}if(i)return n.queries.delete(r),n.onUnlisten(r)}function uM(t,e){const n=ie(t);let r=!1;for(const i of e){const s=i.query,o=n.queries.get(s);if(o){for(const a of o.Q_)a.W_(i)&&(r=!0);o.q_=i}}r&&Zm(n)}function cM(t,e,n){const r=ie(t),i=r.queries.get(e);if(i)for(const s of i.Q_)s.onError(n);r.queries.delete(e)}function Zm(t){t.K_.forEach(e=>{e.next()})}class hM{constructor(e,n,r){this.query=e,this.G_=n,this.z_=!1,this.j_=null,this.onlineState="Unknown",this.options=r||{}}W_(e){if(!this.options.includeMetadataChanges){const r=[];for(const i of e.docChanges)i.type!==3&&r.push(i);e=new xo(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.z_?this.H_(e)&&(this.G_.next(e),n=!0):this.J_(e,this.onlineState)&&(this.Y_(e),n=!0),this.j_=e,n}onError(e){this.G_.error(e)}U_(e){this.onlineState=e;let n=!1;return this.j_&&!this.z_&&this.J_(this.j_,e)&&(this.Y_(this.j_),n=!0),n}J_(e,n){if(!e.fromCache)return!0;const r=n!=="Offline";return(!this.options.Z_||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}H_(e){if(e.docChanges.length>0)return!0;const n=this.j_&&this.j_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}Y_(e){e=xo.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.z_=!0,this.G_.next(e)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class JS{constructor(e){this.key=e}}class ZS{constructor(e){this.key=e}}class dM{constructor(e,n){this.query=e,this.oa=n,this._a=null,this.hasCachedResults=!1,this.current=!1,this.aa=le(),this.mutatedKeys=le(),this.ua=rS(e),this.ca=new Eo(this.ua)}get la(){return this.oa}ha(e,n){const r=n?n.Pa:new XS,i=n?n.ca:this.ca;let s=n?n.mutatedKeys:this.mutatedKeys,o=i,a=!1;const l=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,u=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((c,h)=>{const d=i.get(c),f=Ph(this.query,h)?h:null,g=!!d&&this.mutatedKeys.has(d.key),m=!!f&&(f.hasLocalMutations||this.mutatedKeys.has(f.key)&&f.hasCommittedMutations);let w=!1;d&&f?d.data.isEqual(f.data)?g!==m&&(r.track({type:3,doc:f}),w=!0):this.Ia(d,f)||(r.track({type:2,doc:f}),w=!0,(l&&this.ua(f,l)>0||u&&this.ua(f,u)<0)&&(a=!0)):!d&&f?(r.track({type:0,doc:f}),w=!0):d&&!f&&(r.track({type:1,doc:d}),w=!0,(l||u)&&(a=!0)),w&&(f?(o=o.add(f),s=m?s.add(c):s.delete(c)):(o=o.delete(c),s=s.delete(c)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const c=this.query.limitType==="F"?o.last():o.first();o=o.delete(c.key),s=s.delete(c.key),r.track({type:1,doc:c})}return{ca:o,Pa:r,Xi:a,mutatedKeys:s}}Ia(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,i){const s=this.ca;this.ca=e.ca,this.mutatedKeys=e.mutatedKeys;const o=e.Pa.k_();o.sort((c,h)=>function(f,g){const m=w=>{switch(w){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Z()}};return m(f)-m(g)}(c.type,h.type)||this.ua(c.doc,h.doc)),this.Ta(r),i=i!=null&&i;const a=n&&!i?this.Ea():[],l=this.aa.size===0&&this.current&&!i?1:0,u=l!==this._a;return this._a=l,o.length!==0||u?{snapshot:new xo(this.query,e.ca,s,o,e.mutatedKeys,l===0,u,!1,!!r&&r.resumeToken.approximateByteSize()>0),da:a}:{da:a}}U_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({ca:this.ca,Pa:new XS,mutatedKeys:this.mutatedKeys,Xi:!1},!1)):{da:[]}}Aa(e){return!this.oa.has(e)&&!!this.ca.has(e)&&!this.ca.get(e).hasLocalMutations}Ta(e){e&&(e.addedDocuments.forEach(n=>this.oa=this.oa.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.oa=this.oa.delete(n)),this.current=e.current)}Ea(){if(!this.current)return[];const e=this.aa;this.aa=le(),this.ca.forEach(r=>{this.Aa(r.key)&&(this.aa=this.aa.add(r.key))});const n=[];return e.forEach(r=>{this.aa.has(r)||n.push(new ZS(r))}),this.aa.forEach(r=>{e.has(r)||n.push(new JS(r))}),n}Ra(e){this.oa=e.hs,this.aa=le();const n=this.ha(e.documents);return this.applyChanges(n,!0)}Va(){return xo.fromInitialDocuments(this.query,this.ca,this.mutatedKeys,this._a===0,this.hasCachedResults)}}class fM{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class pM{constructor(e){this.key=e,this.ma=!1}}class gM{constructor(e,n,r,i,s,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.fa={},this.ga=new mo(a=>nS(a),kh),this.pa=new Map,this.ya=new Set,this.wa=new Pe(K.comparator),this.Sa=new Map,this.ba=new zm,this.Da={},this.Ca=new Map,this.va=_o.Bn(),this.onlineState="Unknown",this.Fa=void 0}get isPrimaryClient(){return this.Fa===!0}}async function mM(t,e){const n=TM(t);let r,i;const s=n.ga.get(e);if(s)r=s.targetId,n.sharedClientState.addLocalQueryTarget(r),i=s.view.Va();else{const o=await VD(n.localStore,$n(e)),a=n.sharedClientState.addLocalQueryTarget(o.targetId);r=o.targetId,i=await vM(n,e,r,a==="current",o.resumeToken),n.isPrimaryClient&&BS(n.remoteStore,o)}return i}async function vM(t,e,n,r,i){t.Ma=(h,d,f)=>async function(m,w,v,y){let _=w.view.ha(v);_.Xi&&(_=await FS(m.localStore,w.query,!1).then(({documents:T})=>w.view.ha(T,_)));const E=y&&y.targetChanges.get(w.targetId),I=y&&y.targetMismatches.get(w.targetId)!=null,A=w.view.applyChanges(_,m.isPrimaryClient,E,I);return sI(m,w.targetId,A.da),A.snapshot}(t,h,d,f);const s=await FS(t.localStore,e,!0),o=new dM(e,s.hs),a=o.ha(s.documents),l=Vl.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",i),u=o.applyChanges(a,t.isPrimaryClient,l);sI(t,n,u.da);const c=new fM(e,n,o);return t.ga.set(e,c),t.pa.has(n)?t.pa.get(n).push(e):t.pa.set(n,[e]),u.snapshot}async function yM(t,e){const n=ie(t),r=n.ga.get(e),i=n.pa.get(r.targetId);if(i.length>1)return n.pa.set(r.targetId,i.filter(s=>!kh(s,e))),void n.ga.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await Gm(n.localStore,r.targetId,!1).then(()=>{n.sharedClientState.clearQueryState(r.targetId),HS(n.remoteStore,r.targetId),ev(n,r.targetId)}).catch(El)):(ev(n,r.targetId),await Gm(n.localStore,r.targetId,!0))}async function _M(t,e,n){const r=CM(t);try{const i=await function(o,a){const l=ie(o),u=Ge.now(),c=a.reduce((f,g)=>f.add(g.key),le());let h,d;return l.persistence.runTransaction("Locally write mutations","readwrite",f=>{let g=gr(),m=le();return l.os.getEntries(f,c).next(w=>{g=w,g.forEach((v,y)=>{y.isValidDocument()||(m=m.add(v))})}).next(()=>l.localDocuments.getOverlayedDocuments(f,g)).next(w=>{h=w;const v=[];for(const y of a){const _=zO(y,h.get(y.key).overlayedDocument);_!=null&&v.push(new is(y.key,_,Bx(_.value.mapValue),mr.exists(!0)))}return l.mutationQueue.addMutationBatch(f,u,v,a)}).next(w=>{d=w;const v=w.applyToLocalDocumentSet(h,m);return l.documentOverlayCache.saveOverlays(f,w.batchId,v)})}).then(()=>({batchId:d.batchId,changes:sS(h)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(i.batchId),function(o,a,l){let u=o.Da[o.currentUser.toKey()];u||(u=new Pe(fe)),u=u.insert(a,l),o.Da[o.currentUser.toKey()]=u}(r,i.batchId,n),await Ul(r,i.changes),await Hh(r.remoteStore)}catch(i){const s=Jm(i,"Failed to persist write");n.reject(s)}}async function eI(t,e){const n=ie(t);try{const r=await DD(n.localStore,e);e.targetChanges.forEach((i,s)=>{const o=n.Sa.get(s);o&&(Ee(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1),i.addedDocuments.size>0?o.ma=!0:i.modifiedDocuments.size>0?Ee(o.ma):i.removedDocuments.size>0&&(Ee(o.ma),o.ma=!1))}),await Ul(n,r,e)}catch(r){await El(r)}}function tI(t,e,n){const r=ie(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const i=[];r.ga.forEach((s,o)=>{const a=o.view.U_(e);a.snapshot&&i.push(a.snapshot)}),function(o,a){const l=ie(o);l.onlineState=a;let u=!1;l.queries.forEach((c,h)=>{for(const d of h.Q_)d.U_(a)&&(u=!0)}),u&&Zm(l)}(r.eventManager,e),i.length&&r.fa.u_(i),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function wM(t,e,n){const r=ie(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.Sa.get(e),s=i&&i.key;if(s){let o=new Pe(K.comparator);o=o.insert(s,vt.newNoDocument(s,ne.min()));const a=le().add(s),l=new Vh(ne.min(),new Map,new Pe(fe),o,a);await eI(r,l),r.wa=r.wa.remove(s),r.Sa.delete(e),tv(r)}else await Gm(r.localStore,e,!1).then(()=>ev(r,e,n)).catch(El)}async function EM(t,e){const n=ie(t),r=e.batch.batchId;try{const i=await OD(n.localStore,e);rI(n,r,null),nI(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await Ul(n,i)}catch(i){await El(i)}}async function xM(t,e,n){const r=ie(t);try{const i=await function(o,a){const l=ie(o);return l.persistence.runTransaction("Reject batch","readwrite-primary",u=>{let c;return l.mutationQueue.lookupMutationBatch(u,a).next(h=>(Ee(h!==null),c=h.keys(),l.mutationQueue.removeMutationBatch(u,h))).next(()=>l.mutationQueue.performConsistencyCheck(u)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(u,c,a)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(u,c)).next(()=>l.localDocuments.getDocuments(u,c))})}(r.localStore,e);rI(r,e,n),nI(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await Ul(r,i)}catch(i){await El(i)}}function nI(t,e){(t.Ca.get(e)||[]).forEach(n=>{n.resolve()}),t.Ca.delete(e)}function rI(t,e,n){const r=ie(t);let i=r.Da[r.currentUser.toKey()];if(i){const s=i.get(e);s&&(n?s.reject(n):s.resolve(),i=i.remove(e)),r.Da[r.currentUser.toKey()]=i}}function ev(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.pa.get(e))t.ga.delete(r),n&&t.fa.xa(r,n);t.pa.delete(e),t.isPrimaryClient&&t.ba.Vr(e).forEach(r=>{t.ba.containsKey(r)||iI(t,r)})}function iI(t,e){t.ya.delete(e.path.canonicalString());const n=t.wa.get(e);n!==null&&(HS(t.remoteStore,n),t.wa=t.wa.remove(e),t.Sa.delete(n),tv(t))}function sI(t,e,n){for(const r of n)r instanceof JS?(t.ba.addReference(r.key,e),SM(t,r)):r instanceof ZS?(U("SyncEngine","Document no longer in limbo: "+r.key),t.ba.removeReference(r.key,e),t.ba.containsKey(r.key)||iI(t,r.key)):Z()}function SM(t,e){const n=e.key,r=n.path.canonicalString();t.wa.get(n)||t.ya.has(r)||(U("SyncEngine","New document in limbo: "+n),t.ya.add(r),tv(t))}function tv(t){for(;t.ya.size>0&&t.wa.size<t.maxConcurrentLimboResolutions;){const e=t.ya.values().next().value;t.ya.delete(e);const n=new K(Ae.fromString(e)),r=t.va.next();t.Sa.set(r,new pM(n)),t.wa=t.wa.insert(n,r),BS(t.remoteStore,new ri($n(Zx(n.path)),r,"TargetPurposeLimboResolution",xm._e))}}async function Ul(t,e,n){const r=ie(t),i=[],s=[],o=[];r.ga.isEmpty()||(r.ga.forEach((a,l)=>{o.push(r.Ma(l,e,n).then(u=>{if((u||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(l.targetId,u!=null&&u.fromCache?"not-current":"current"),u){i.push(u);const c=Hm.Ki(l.targetId,u);s.push(c)}}))}),await Promise.all(o),r.fa.u_(i),await async function(l,u){const c=ie(l);try{await c.persistence.runTransaction("notifyLocalViewChanges","readwrite",h=>k.forEach(u,d=>k.forEach(d.qi,f=>c.persistence.referenceDelegate.addReference(h,d.targetId,f)).next(()=>k.forEach(d.Qi,f=>c.persistence.referenceDelegate.removeReference(h,d.targetId,f)))))}catch(h){if(!Sl(h))throw h;U("LocalStore","Failed to update sequence numbers: "+h)}for(const h of u){const d=h.targetId;if(!h.fromCache){const f=c.ns.get(d),g=f.snapshotVersion,m=f.withLastLimboFreeSnapshotVersion(g);c.ns=c.ns.insert(d,m)}}}(r.localStore,s))}async function IM(t,e){const n=ie(t);if(!n.currentUser.isEqual(e)){U("SyncEngine","User change. New user:",e.toKey());const r=await LS(n.localStore,e);n.currentUser=e,function(s,o){s.Ca.forEach(a=>{a.forEach(l=>{l.reject(new H(R.CANCELLED,o))})}),s.Ca.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await Ul(n,r.us)}}function AM(t,e){const n=ie(t),r=n.Sa.get(e);if(r&&r.ma)return le().add(r.key);{let i=le();const s=n.pa.get(e);if(!s)return i;for(const o of s){const a=n.ga.get(o);i=i.unionWith(a.view.la)}return i}}function TM(t){const e=ie(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=eI.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=AM.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=wM.bind(null,e),e.fa.u_=uM.bind(null,e.eventManager),e.fa.xa=cM.bind(null,e.eventManager),e}function CM(t){const e=ie(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=EM.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=xM.bind(null,e),e}class oI{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=jh(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,n){return null}createIndexBackfillerScheduler(e,n){return null}createLocalStore(e){return ND(this.persistence,new kD,e.initialUser,this.serializer)}createPersistence(e){return new CD(Bm.Hr,this.serializer)}createSharedClientState(e){return new UD}async terminate(){var e,n;(e=this.gcScheduler)===null||e===void 0||e.stop(),(n=this.indexBackfillerScheduler)===null||n===void 0||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class bM{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=>tI(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=IM.bind(null,this.syncEngine),await iM(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new oM}()}createDatastore(e){const n=jh(e.databaseInfo.databaseId),r=function(s){return new BD(s)}(e.databaseInfo);return function(s,o,a,l){return new WD(s,o,a,l)}(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,i,s,o,a){return new qD(r,i,s,o,a)}(this.localStore,this.datastore,e.asyncQueue,n=>tI(this.syncEngine,n,0),function(){return $S.D()?new $S:new $D}())}createSyncEngine(e,n){return function(i,s,o,a,l,u,c){const h=new gM(i,s,o,a,l,u);return c&&(h.Fa=!0),h}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e;await async function(r){const i=ie(r);U("RemoteStore","RemoteStore shutting down."),i.v_.add(5),await Fl(i),i.M_.shutdown(),i.x_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *//**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class RM{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Ba(this.observer.next,e)}error(e){this.observer.error?this.Ba(this.observer.error,e):Fn("Uncaught Error in snapshot listener:",e.toString())}La(){this.muted=!0}Ba(e,n){this.muted||setTimeout(()=>{this.muted||e(n)},0)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class kM{constructor(e,n,r,i){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=i,this.user=gt.UNAUTHENTICATED,this.clientId=Ox.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(r,async s=>{U("FirestoreClient","Received user=",s.uid),await this.authCredentialListener(s),this.user=s}),this.appCheckCredentials.start(r,s=>(U("FirestoreClient","Received new app check token=",s),this.appCheckCredentialListener(s,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}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new H(R.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const e=new pr;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=Jm(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function nv(t,e){t.asyncQueue.verifyOperationInProgress(),U("FirestoreClient","Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async i=>{r.isEqual(i)||(await LS(e.localStore,i),r=i)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function aI(t,e){t.asyncQueue.verifyOperationInProgress();const n=await NM(t);U("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>YS(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,i)=>YS(e.remoteStore,i)),t._onlineComponents=e}function PM(t){return t.name==="FirebaseError"?t.code===R.FAILED_PRECONDITION||t.code===R.UNIMPLEMENTED:!(typeof DOMException!="undefined"&&t instanceof DOMException)||t.code===22||t.code===20||t.code===11}async function NM(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){U("FirestoreClient","Using user provided OfflineComponentProvider");try{await nv(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!PM(n))throw n;lo("Error using user provided cache. Falling back to memory cache: "+n),await nv(t,new oI)}}else U("FirestoreClient","Using default OfflineComponentProvider"),await nv(t,new oI);return t._offlineComponents}async function lI(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(U("FirestoreClient","Using user provided OnlineComponentProvider"),await aI(t,t._uninitializedComponentsProvider._online)):(U("FirestoreClient","Using default OnlineComponentProvider"),await aI(t,new bM))),t._onlineComponents}function OM(t){return lI(t).then(e=>e.syncEngine)}async function DM(t){const e=await lI(t),n=e.eventManager;return n.onListen=mM.bind(null,e.syncEngine),n.onUnlisten=yM.bind(null,e.syncEngine),n}function MM(t,e,n={}){const r=new pr;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,a,l,u){const c=new RM({next:d=>{o.enqueueAndForget(()=>lM(s,h)),d.fromCache&&l.source==="server"?u.reject(new H(R.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.)')):u.resolve(d)},error:d=>u.reject(d)}),h=new hM(a,c,{includeMetadataChanges:!0,Z_:!0});return aM(s,h)}(await DM(t),t.asyncQueue,e,n,r)),r.promise}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function uI(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const cI=new Map;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function hI(t,e,n){if(!n)throw new H(R.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function LM(t,e,n,r){if(e===!0&&r===!0)throw new H(R.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function dI(t){if(!K.isDocumentKey(t))throw new H(R.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function fI(t){if(K.isDocumentKey(t))throw new H(R.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Gh(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":Z()}function $l(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new H(R.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Gh(t);throw new H(R.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class pI{constructor(e){var n,r;if(e.host===void 0){if(e.ssl!==void 0)throw new H(R.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=(n=e.ssl)===null||n===void 0||n;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new H(R.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}LM("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=uI((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(s){if(s.timeoutSeconds!==void 0){if(isNaN(s.timeoutSeconds))throw new H(R.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (must not be NaN)`);if(s.timeoutSeconds<5)throw new H(R.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (minimum allowed value is 5)`);if(s.timeoutSeconds>30)throw new H(R.INVALID_ARGUMENT,`invalid long polling timeout: ${s.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,i){return r.timeoutSeconds===i.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Wh{constructor(e,n,r,i){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new pI({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new H(R.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!==void 0}_setSettings(e){if(this._settingsFrozen)throw new H(R.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 pI(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new XN;switch(r.type){case"firstParty":return new tO(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new H(R.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=cI.get(n);r&&(U("ComponentProvider","Removing Datastore"),cI.delete(n),r.terminate())}(this),Promise.resolve()}}function VM(t,e,n,r={}){var i;const s=(t=$l(t,Wh))._getSettings(),o=`${e}:${n}`;if(s.host!=="firestore.googleapis.com"&&s.host!==o&&lo("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),t._setSettings(Object.assign(Object.assign({},s),{host:o,ssl:!1})),r.mockUserToken){let a,l;if(typeof r.mockUserToken=="string")a=r.mockUserToken,l=gt.MOCK_USER;else{a=ZE(r.mockUserToken,(i=t._app)===null||i===void 0?void 0:i.options.projectId);const u=r.mockUserToken.sub||r.mockUserToken.user_id;if(!u)throw new H(R.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");l=new gt(u)}t._authCredentials=new JN(new Nx(a,l))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class os{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new os(this.firestore,e,this._query)}}class qt{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 si(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new qt(this.firestore,e,this._key)}}class si extends os{constructor(e,n,r){super(e,n,Zx(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 qt(this.firestore,null,new K(e))}withConverter(e){return new si(this.firestore,e,this._path)}}function So(t,e,...n){if(t=dt(t),hI("collection","path",e),t instanceof Wh){const r=Ae.fromString(e,...n);return fI(r),new si(t,null,r)}{if(!(t instanceof qt||t instanceof si))throw new H(R.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Ae.fromString(e,...n));return fI(r),new si(t.firestore,null,r)}}function FM(t,e,...n){if(t=dt(t),arguments.length===1&&(e=Ox.newId()),hI("doc","path",e),t instanceof Wh){const r=Ae.fromString(e,...n);return dI(r),new qt(t,null,new K(r))}{if(!(t instanceof qt||t instanceof si))throw new H(R.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Ae.fromString(e,...n));return dI(r),new qt(t.firestore,t instanceof si?t.converter:null,new K(r))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class UM{constructor(){this.Xa=Promise.resolve(),this.eu=[],this.tu=!1,this.nu=[],this.ru=null,this.iu=!1,this.su=!1,this.ou=[],this.jo=new jS(this,"async_queue_retry"),this._u=()=>{const n=Qm();n&&U("AsyncQueue","Visibility state changed to "+n.visibilityState),this.jo.Ko()};const e=Qm();e&&typeof e.addEventListener=="function"&&e.addEventListener("visibilitychange",this._u)}get isShuttingDown(){return this.tu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.au(),this.uu(e)}enterRestrictedMode(e){if(!this.tu){this.tu=!0,this.su=e||!1;const n=Qm();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._u)}}enqueue(e){if(this.au(),this.tu)return new Promise(()=>{});const n=new pr;return this.uu(()=>this.tu&&this.su?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.eu.push(e),this.cu()))}async cu(){if(this.eu.length!==0){try{await this.eu[0](),this.eu.shift(),this.jo.reset()}catch(e){if(!Sl(e))throw e;U("AsyncQueue","Operation failed with retryable error: "+e)}this.eu.length>0&&this.jo.qo(()=>this.cu())}}uu(e){const n=this.Xa.then(()=>(this.iu=!0,e().catch(r=>{this.ru=r,this.iu=!1;const i=function(o){let a=o.message||"";return o.stack&&(a=o.stack.includes(o.message)?o.stack:o.message+`
`+o.stack),a}(r);throw Fn("INTERNAL UNHANDLED ERROR: ",i),r}).then(r=>(this.iu=!1,r))));return this.Xa=n,n}enqueueAfterDelay(e,n,r){this.au(),this.ou.indexOf(e)>-1&&(n=0);const i=Xm.createAndSchedule(this,e,n,r,s=>this.lu(s));return this.nu.push(i),i}au(){this.ru&&Z()}verifyOperationInProgress(){}async hu(){let e;do e=this.Xa,await e;while(e!==this.Xa)}Pu(e){for(const n of this.nu)if(n.timerId===e)return!0;return!1}Iu(e){return this.hu().then(()=>{this.nu.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.nu)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.hu()})}Tu(e){this.ou.push(e)}lu(e){const n=this.nu.indexOf(e);this.nu.splice(n,1)}}class rv extends Wh{constructor(e,n,r,i){super(e,n,r,i),this.type="firestore",this._queue=function(){return new UM}(),this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||mI(this),this._firestoreClient.terminate()}}function $M(t,e){const n=typeof t=="object"?t:Rg(),r=typeof t=="string"?t:e||"(default)",i=Yc(n,"firestore").getImmediate({identifier:r});if(!i._initialized){const s=YE("firestore");s&&VM(i,...s)}return i}function gI(t){return t._firestoreClient||mI(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function mI(t){var e,n,r;const i=t._freezeSettings(),s=function(a,l,u,c){return new gO(a,l,u,c.host,c.ssl,c.experimentalForceLongPolling,c.experimentalAutoDetectLongPolling,uI(c.experimentalLongPollingOptions),c.useFetchStreams)}(t._databaseId,((e=t._app)===null||e===void 0?void 0:e.options.appId)||"",t._persistenceKey,i);t._firestoreClient=new kM(t._authCredentials,t._appCheckCredentials,t._queue,s),!((n=i.localCache)===null||n===void 0)&&n._offlineComponentProvider&&(!((r=i.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(t._firestoreClient._uninitializedComponentsProvider={_offlineKind:i.localCache.kind,_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider})}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Io{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Io(mt.fromBase64String(e))}catch(n){throw new H(R.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new Io(mt.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)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class iv{constructor(...e){for(let n=0;n<e.length;++n)if(e[n].length===0)throw new H(R.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new it(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class vI{constructor(e){this._methodName=e}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class sv{constructor(e,n){if(!isFinite(e)||e<-90||e>90)throw new H(R.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new H(R.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}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return fe(this._lat,e._lat)||fe(this._long,e._long)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const jM=/^__.*__$/;class zM{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new is(e,this.data,this.fieldMask,n,this.fieldTransforms):new Ml(e,this.data,n,this.fieldTransforms)}}function yI(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Z()}}class ov{constructor(e,n,r,i,s,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=i,s===void 0&&this.Eu(),this.fieldTransforms=s||[],this.fieldMask=o||[]}get path(){return this.settings.path}get du(){return this.settings.du}Au(e){return new ov(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Ru(e){var n;const r=(n=this.path)===null||n===void 0?void 0:n.child(e),i=this.Au({path:r,Vu:!1});return i.mu(e),i}fu(e){var n;const r=(n=this.path)===null||n===void 0?void 0:n.child(e),i=this.Au({path:r,Vu:!1});return i.Eu(),i}gu(e){return this.Au({path:void 0,Vu:!0})}pu(e){return Qh(e,this.settings.methodName,this.settings.yu||!1,this.path,this.settings.wu)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}Eu(){if(this.path)for(let e=0;e<this.path.length;e++)this.mu(this.path.get(e))}mu(e){if(e.length===0)throw this.pu("Document fields must not be empty");if(yI(this.du)&&jM.test(e))throw this.pu('Document fields cannot begin and end with "__"')}}class BM{constructor(e,n,r){this.databaseId=e,this.ignoreUndefinedProperties=n,this.serializer=r||jh(e)}Su(e,n,r,i=!1){return new ov({du:e,methodName:n,wu:r,path:it.emptyPath(),Vu:!1,yu:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function _I(t){const e=t._freezeSettings(),n=jh(t._databaseId);return new BM(t._databaseId,!!e.ignoreUndefinedProperties,n)}function HM(t,e,n,r,i,s={}){const o=t.Su(s.merge||s.mergeFields?2:0,e,n,i);xI("Data must be an object, but it was:",o,r);const a=wI(r,o);let l,u;if(s.merge)l=new _n(o.fieldMask),u=o.fieldTransforms;else if(s.mergeFields){const c=[];for(const h of s.mergeFields){const d=WM(e,h,n);if(!o.contains(d))throw new H(R.INVALID_ARGUMENT,`Field '${d}' is specified in your field mask but missing from your input data.`);qM(c,d)||c.push(d)}l=new _n(c),u=o.fieldTransforms.filter(h=>l.covers(h.field))}else l=null,u=o.fieldTransforms;return new zM(new an(a),l,u)}function GM(t,e,n,r=!1){return av(n,t.Su(r?4:3,e))}function av(t,e){if(EI(t=dt(t)))return xI("Unsupported field value:",e,t),wI(t,e);if(t instanceof vI)return function(r,i){if(!yI(i.du))throw i.pu(`${r._methodName}() can only be used with update() and set()`);if(!i.path)throw i.pu(`${r._methodName}() is not currently supported inside arrays`);const s=r._toFieldTransform(i);s&&i.fieldTransforms.push(s)}(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.Vu&&e.du!==4)throw e.pu("Nested arrays are not supported");return function(r,i){const s=[];let o=0;for(const a of r){let l=av(a,i.gu(o));l==null&&(l={nullValue:"NULL_VALUE"}),s.push(l),o++}return{arrayValue:{values:s}}}(t,e)}return function(r,i){if((r=dt(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return LO(i.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const s=Ge.fromDate(r);return{timestampValue:Uh(i.serializer,s)}}if(r instanceof Ge){const s=new Ge(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Uh(i.serializer,s)}}if(r instanceof sv)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Io)return{bytesValue:bS(i.serializer,r._byteString)};if(r instanceof qt){const s=i.databaseId,o=r.firestore._databaseId;if(!o.isEqual(s))throw i.pu(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:Vm(r.firestore._databaseId||i.databaseId,r._key.path)}}throw i.pu(`Unsupported field value: ${Gh(r)}`)}(t,e)}function wI(t,e){const n={};return Lx(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):co(t,(r,i)=>{const s=av(i,e.Ru(r));s!=null&&(n[r]=s)}),{mapValue:{fields:n}}}function EI(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Ge||t instanceof sv||t instanceof Io||t instanceof qt||t instanceof vI)}function xI(t,e,n){if(!EI(n)||!function(i){return typeof i=="object"&&i!==null&&(Object.getPrototypeOf(i)===Object.prototype||Object.getPrototypeOf(i)===null)}(n)){const r=Gh(n);throw r==="an object"?e.pu(t+" a custom object"):e.pu(t+" "+r)}}function WM(t,e,n){if((e=dt(e))instanceof iv)return e._internalPath;if(typeof e=="string")return SI(t,e);throw Qh("Field path arguments must be of type string or ",t,!1,void 0,n)}const QM=new RegExp("[~\\*/\\[\\]]");function SI(t,e,n){if(e.search(QM)>=0)throw Qh(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new iv(...e.split("."))._internalPath}catch{throw Qh(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function Qh(t,e,n,r,i){const s=r&&!r.isEmpty(),o=i!==void 0;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let l="";return(s||o)&&(l+=" (found",s&&(l+=` in field ${r}`),o&&(l+=` in document ${i}`),l+=")"),new H(R.INVALID_ARGUMENT,a+t+l)}function qM(t,e){return t.some(n=>n.isEqual(e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class II{constructor(e,n,r,i,s){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=i,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new qt(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new KM(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const n=this._document.data.field(qh("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class KM extends II{data(){return super.data()}}function qh(t,e){return typeof e=="string"?SI(t,e):e instanceof iv?e._internalPath:e._delegate._internalPath}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function YM(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new H(R.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class lv{}class AI extends lv{}function jl(t,e,...n){let r=[];e instanceof lv&&r.push(e),r=r.concat(n),function(s){const o=s.filter(l=>l instanceof uv).length,a=s.filter(l=>l instanceof Kh).length;if(o>1||o>0&&a>0)throw new H(R.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 i of r)t=i._apply(t);return t}class Kh extends AI{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new Kh(e,n,r)}_apply(e){const n=this._parse(e);return bI(e._query,n),new os(e.firestore,e.converter,Nm(e._query,n))}_parse(e){const n=_I(e.firestore);return function(s,o,a,l,u,c,h){let d;if(u.isKeyField()){if(c==="array-contains"||c==="array-contains-any")throw new H(R.INVALID_ARGUMENT,`Invalid Query. You can't perform '${c}' queries on documentId().`);if(c==="in"||c==="not-in"){CI(h,c);const f=[];for(const g of h)f.push(TI(l,s,g));d={arrayValue:{values:f}}}else d=TI(l,s,h)}else c!=="in"&&c!=="not-in"&&c!=="array-contains-any"||CI(h,c),d=GM(a,o,h,c==="in"||c==="not-in");return Ue.create(u,c,d)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function XM(t,e,n){const r=e,i=qh("where",t);return Kh._create(i,r,n)}class uv extends lv{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new uv(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]:wn.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(i,s){let o=i;const a=s.getFlattenedFilters();for(const l of a)bI(o,l),o=Nm(o,l)}(e._query,n),new os(e.firestore,e.converter,Nm(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class cv extends AI{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new cv(e,n)}_apply(e){const n=function(i,s,o){if(i.startAt!==null)throw new H(R.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new H(R.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new bl(s,o)}(e._query,this._field,this._direction);return new os(e.firestore,e.converter,function(i,s){const o=i.explicitOrderBy.concat([s]);return new po(i.path,i.collectionGroup,o,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)}(e._query,n))}}function Yh(t,e="asc"){const n=e,r=qh("orderBy",t);return cv._create(r,n)}function TI(t,e,n){if(typeof(n=dt(n))=="string"){if(n==="")throw new H(R.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!tS(e)&&n.indexOf("/")!==-1)throw new H(R.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(Ae.fromString(n));if(!K.isDocumentKey(r))throw new H(R.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 $x(t,new K(r))}if(n instanceof qt)return $x(t,n._key);throw new H(R.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Gh(n)}.`)}function CI(t,e){if(!Array.isArray(t)||t.length===0)throw new H(R.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function bI(t,e){const n=function(i,s){for(const o of i)for(const a of o.getFlattenedFilters())if(s.indexOf(a.op)>=0)return a.op;return null}(t.filters,function(i){switch(i){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 H(R.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new H(R.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class JM{convertValue(e,n="none"){switch(ns(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Fe(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(ts(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 10:return this.convertObject(e.mapValue,n);default:throw Z()}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return co(e,(i,s)=>{r[i]=this.convertValue(s,n)}),r}convertGeoPoint(e){return new sv(Fe(e.latitude),Fe(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=Im(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(Il(e));default:return null}}convertTimestamp(e){const n=ni(e);return new Ge(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=Ae.fromString(e);Ee(MS(r));const i=new Al(r.get(1),r.get(3)),s=new K(r.popFirst(5));return i.isEqual(n)||Fn(`Document ${s} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),s}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function ZM(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Xh{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class eL extends II{constructor(e,n,r,i,s,o){super(e,n,r,i,o),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new Jh(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(qh("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}}class Jh extends eL{data(e={}){return super.data(e)}}class tL{constructor(e,n,r,i){this._firestore=e,this._userDataWriter=n,this._snapshot=i,this.metadata=new Xh(i.hasPendingWrites,i.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 Jh(this._firestore,this._userDataWriter,r.key,r,new Xh(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 H(R.INVALID_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(i,s){if(i._snapshot.oldDocs.isEmpty()){let o=0;return i._snapshot.docChanges.map(a=>{const l=new Jh(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Xh(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);return a.doc,{type:"added",doc:l,oldIndex:-1,newIndex:o++}})}{let o=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(a=>s||a.type!==3).map(a=>{const l=new Jh(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Xh(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);let u=-1,c=-1;return a.type!==0&&(u=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),c=o.indexOf(a.doc.key)),{type:nL(a.type),doc:l,oldIndex:u,newIndex:c}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}}function nL(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Z()}}class rL extends JM{constructor(e){super(),this.firestore=e}convertBytes(e){return new Io(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new qt(this.firestore,null,n)}}function Ao(t){t=$l(t,os);const e=$l(t.firestore,rv),n=gI(e),r=new rL(e);return YM(t._query),MM(n,t._query).then(i=>new tL(e,r,t,i))}function iL(t,e,n){t=$l(t,qt);const r=$l(t.firestore,rv),i=ZM(t.converter,e,n);return sL(r,[HM(_I(r),"setDoc",t._key,i,t.converter!==null,n).toMutation(t._key,mr.none())])}function sL(t,e){return function(r,i){const s=new pr;return r.asyncQueue.enqueueAndForget(async()=>_M(await OM(r),i,s)),s.promise}(gI(t),e)}(function(e,n=!0){(function(i){ao=i})(Qi),Wi(new Yr("firestore",(r,{instanceIdentifier:i,options:s})=>{const o=r.getProvider("app").getImmediate(),a=new rv(new ZN(r.getProvider("auth-internal")),new rO(r.getProvider("app-check-internal")),function(u,c){if(!Object.prototype.hasOwnProperty.apply(u.options,["projectId"]))throw new H(R.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Al(u.options.projectId,c)}(o,i),o);return s=Object.assign({useFetchStreams:n},s),a._setSettings(s),a},"PUBLIC").setMultipleInstances(!0)),Dn(Px,"4.4.1",e),Dn(Px,"4.4.1","esm2017")})();var oL="firebase",aL="10.7.2";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */Dn(oL,aL,"app");/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const RI="firebasestorage.googleapis.com",lL="storageBucket",uL=2*60*1e3,cL=10*60*1e3;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class zn extends On{constructor(e,n,r=0){super(hv(e),`Firebase Storage: ${n} (${hv(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,zn.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return hv(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
${this.customData.serverResponse}`:this.message=this._baseMessage}}var Bn;(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"})(Bn||(Bn={}));function hv(t){return"storage/"+t}function hL(){const t="An unknown error occurred, please check the error payload for server response.";return new zn(Bn.UNKNOWN,t)}function dL(){return new zn(Bn.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function fL(){return new zn(Bn.CANCELED,"User canceled the upload/download.")}function pL(t){return new zn(Bn.INVALID_URL,"Invalid URL '"+t+"'.")}function gL(t){return new zn(Bn.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function kI(t){return new zn(Bn.INVALID_ARGUMENT,t)}function PI(){return new zn(Bn.APP_DELETED,"The Firebase app was deleted.")}function mL(t){return new zn(Bn.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').")}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class En{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=En.makeFromUrl(e,n)}catch{return new En(e,"")}if(r.path==="")return r;throw gL(e)}static makeFromUrl(e,n){let r=null;const i="([A-Za-z0-9.\\-_]+)";function s(E){E.path.charAt(E.path.length-1)==="/"&&(E.path_=E.path_.slice(0,-1))}const o="(/(.*))?$",a=new RegExp("^gs://"+i+o,"i"),l={bucket:1,path:3};function u(E){E.path_=decodeURIComponent(E.path)}const c="v[A-Za-z0-9_]+",h=n.replace(/[.]/g,"\\."),d="(/([^?#]*).*)?$",f=new RegExp(`^https?://${h}/${c}/b/${i}/o${d}`,"i"),g={bucket:1,path:3},m=n===RI?"(?:storage.googleapis.com|storage.cloud.google.com)":n,w="([^?#]*)",v=new RegExp(`^https?://${m}/${i}/${w}`,"i"),_=[{regex:a,indices:l,postModify:s},{regex:f,indices:g,postModify:u},{regex:v,indices:{bucket:1,path:2},postModify:u}];for(let E=0;E<_.length;E++){const I=_[E],A=I.regex.exec(e);if(A){const T=A[I.indices.bucket];let C=A[I.indices.path];C||(C=""),r=new En(T,C),I.postModify(r);break}}if(r==null)throw pL(e);return r}}class vL{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function yL(t,e,n){let r=1,i=null,s=null,o=!1,a=0;function l(){return a===2}let u=!1;function c(...w){u||(u=!0,e.apply(null,w))}function h(w){i=setTimeout(()=>{i=null,t(f,l())},w)}function d(){s&&clearTimeout(s)}function f(w,...v){if(u){d();return}if(w){d(),c.call(null,w,...v);return}if(l()||o){d(),c.call(null,w,...v);return}r<64&&(r*=2);let _;a===1?(a=2,_=0):_=(r+Math.random())*1e3,h(_)}let g=!1;function m(w){g||(g=!0,d(),!u&&(i!==null?(w||(a=2),clearTimeout(i),h(0)):w||(a=1)))}return h(0),s=setTimeout(()=>{o=!0,m(!0)},n),m}function _L(t){t(!1)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function wL(t){return t!==void 0}function NI(t,e,n,r){if(r<e)throw kI(`Invalid value for '${t}'. Expected ${e} or greater.`);if(r>n)throw kI(`Invalid value for '${t}'. Expected ${n} or less.`)}function EL(t){const e=encodeURIComponent;let n="?";for(const r in t)if(t.hasOwnProperty(r)){const i=e(r)+"="+e(t[r]);n=n+i+"&"}return n=n.slice(0,-1),n}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Zh;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(Zh||(Zh={}));/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function xL(t,e){const n=t>=500&&t<600,i=[408,429].indexOf(t)!==-1,s=e.indexOf(t)!==-1;return n||i||s}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class SL{constructor(e,n,r,i,s,o,a,l,u,c,h,d=!0){this.url_=e,this.method_=n,this.headers_=r,this.body_=i,this.successCodes_=s,this.additionalRetryCodes_=o,this.callback_=a,this.errorCallback_=l,this.timeout_=u,this.progressCallback_=c,this.connectionFactory_=h,this.retry=d,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((f,g)=>{this.resolve_=f,this.reject_=g,this.start_()})}start_(){const e=(r,i)=>{if(i){r(!1,new ed(!1,null,!0));return}const s=this.connectionFactory_();this.pendingConnection_=s;const o=a=>{const l=a.loaded,u=a.lengthComputable?a.total:-1;this.progressCallback_!==null&&this.progressCallback_(l,u)};this.progressCallback_!==null&&s.addUploadProgressListener(o),s.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&s.removeUploadProgressListener(o),this.pendingConnection_=null;const a=s.getErrorCode()===Zh.NO_ERROR,l=s.getStatus();if(!a||xL(l,this.additionalRetryCodes_)&&this.retry){const c=s.getErrorCode()===Zh.ABORT;r(!1,new ed(!1,null,c));return}const u=this.successCodes_.indexOf(l)!==-1;r(!0,new ed(u,s))})},n=(r,i)=>{const s=this.resolve_,o=this.reject_,a=i.connection;if(i.wasSuccessCode)try{const l=this.callback_(a,a.getResponse());wL(l)?s(l):s()}catch(l){o(l)}else if(a!==null){const l=hL();l.serverResponse=a.getErrorText(),this.errorCallback_?o(this.errorCallback_(a,l)):o(l)}else if(i.canceled){const l=this.appDelete_?PI():fL();o(l)}else{const l=dL();o(l)}};this.canceled_?n(!1,new ed(!1,null,!0)):this.backoffId_=yL(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&_L(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class ed{constructor(e,n,r){this.wasSuccessCode=e,this.connection=n,this.canceled=!!r}}function IL(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function AL(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e!=null?e:"AppManager")}function TL(t,e){e&&(t["X-Firebase-GMPID"]=e)}function CL(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function bL(t,e,n,r,i,s,o=!0){const a=EL(t.urlParams),l=t.url+a,u=Object.assign({},t.headers);return TL(u,e),IL(u,n),AL(u,s),CL(u,r),new SL(l,t.method,u,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,i,o)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function RL(t){if(t.length===0)return null;const e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function kL(t){const e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class td{constructor(e,n){this._service=e,n instanceof En?this._location=n:this._location=En.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new td(e,n)}get root(){const e=new En(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return kL(this._location.path)}get storage(){return this._service}get parent(){const e=RL(this._location.path);if(e===null)return null;const n=new En(this._location.bucket,e);return new td(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw mL(e)}}function OI(t,e){const n=e==null?void 0:e[lL];return n==null?null:En.makeFromBucketSpec(n,t)}function PL(t,e,n,r={}){t.host=`${e}:${n}`,t._protocol="http";const{mockUserToken:i}=r;i&&(t._overrideAuthToken=typeof i=="string"?i:ZE(i,t.app.options.projectId))}class NL{constructor(e,n,r,i,s){this.app=e,this._authProvider=n,this._appCheckProvider=r,this._url=i,this._firebaseVersion=s,this._bucket=null,this._host=RI,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=uL,this._maxUploadRetryTime=cL,this._requests=new Set,i!=null?this._bucket=En.makeFromBucketSpec(i,this._host):this._bucket=OI(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=En.makeFromBucketSpec(this._url,e):this._bucket=OI(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){NI("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){NI("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(){const e=this._appCheckProvider.getImmediate({optional:!0});return 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 td(this,e)}_makeRequest(e,n,r,i,s=!0){if(this._deleted)return new vL(PI());{const o=bL(e,this._appId,r,i,n,this._firebaseVersion,s);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,n){const[r,i]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,r,i).getPromise()}}const DI="@firebase/storage",MI="0.12.0";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const LI="storage";function OL(t=Rg(),e){t=dt(t);const r=Yc(t,LI).getImmediate({identifier:e}),i=YE("storage");return i&&DL(r,...i),r}function DL(t,e,n,r={}){PL(t,e,n,r)}function ML(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),i=t.getProvider("app-check-internal");return new NL(n,r,i,e,Qi)}function LL(){Wi(new Yr(LI,ML,"PUBLIC").setMultipleInstances(!0)),Dn(DI,MI,""),Dn(DI,MI,"esm2017")}LL();function dv(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 i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}typeof SuppressedError=="function"&&SuppressedError;function VI(){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 VL=VI,FI=new Qa("auth","Firebase",VI());/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const nd=new _g("@firebase/auth");function FL(t,...e){nd.logLevel<=ue.WARN&&nd.warn(`Auth (${Qi}): ${t}`,...e)}function rd(t,...e){nd.logLevel<=ue.ERROR&&nd.error(`Auth (${Qi}): ${t}`,...e)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function xn(t,...e){throw fv(t,...e)}function Hn(t,...e){return fv(t,...e)}function UL(t,e,n){const r=Object.assign(Object.assign({},VL()),{[e]:n});return new Qa("auth","Firebase",r).create(e,{appName:t.name})}function fv(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 FI.create(t,...e)}function J(t,e,...n){if(!t)throw fv(e,...n)}function vr(t){const e="INTERNAL ASSERTION FAILED: "+t;throw rd(e),new Error(e)}function yr(t,e){t||vr(e)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function id(){var t;return typeof self!="undefined"&&((t=self.location)===null||t===void 0?void 0:t.href)||""}function $L(){return UI()==="http:"||UI()==="https:"}function UI(){var t;return typeof self!="undefined"&&((t=self.location)===null||t===void 0?void 0:t.protocol)||null}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function jL(){return typeof navigator!="undefined"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&($L()||bk()||"connection"in navigator)?navigator.onLine:!0}function zL(){if(typeof navigator=="undefined")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class zl{constructor(e,n){this.shortDelay=e,this.longDelay=n,yr(n>e,"Short delay should be less than long delay!"),this.isMobile=Tk()||Rk()}get(){return jL()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function pv(t,e){yr(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class $I{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!="undefined"&&"fetch"in self)return self.fetch;if(typeof globalThis!="undefined"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch!="undefined")return fetch;vr("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self!="undefined"&&"Headers"in self)return self.Headers;if(typeof globalThis!="undefined"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers!="undefined")return Headers;vr("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!="undefined"&&"Response"in self)return self.Response;if(typeof globalThis!="undefined"&&globalThis.Response)return globalThis.Response;if(typeof Response!="undefined")return Response;vr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const BL={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"};/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const HL=new zl(3e4,6e4);function as(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function oi(t,e,n,r,i={}){return jI(t,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const a=qa(Object.assign({key:t.config.apiKey},o)).slice(1),l=await t._getAdditionalHeaders();return l["Content-Type"]="application/json",t.languageCode&&(l["X-Firebase-Locale"]=t.languageCode),$I.fetch()(zI(t,t.config.apiHost,n,a),Object.assign({method:e,headers:l,referrerPolicy:"no-referrer"},s))})}async function jI(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},BL),e);try{const i=new WL(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw od(t,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const a=s.ok?o.errorMessage:o.error.message,[l,u]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw od(t,"credential-already-in-use",o);if(l==="EMAIL_EXISTS")throw od(t,"email-already-in-use",o);if(l==="USER_DISABLED")throw od(t,"user-disabled",o);const c=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw UL(t,c,u);xn(t,c)}}catch(i){if(i instanceof On)throw i;xn(t,"network-request-failed",{message:String(i)})}}async function sd(t,e,n,r,i={}){const s=await oi(t,e,n,r,i);return"mfaPendingCredential"in s&&xn(t,"multi-factor-auth-required",{_serverResponse:s}),s}function zI(t,e,n,r){const i=`${e}${n}?${r}`;return t.config.emulator?pv(t.config,i):`${t.config.apiScheme}://${i}`}function GL(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class WL{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(Hn(this.auth,"network-request-failed")),HL.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function od(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=Hn(t,e,r);return i.customData._tokenResponse=n,i}function BI(t){return t!==void 0&&t.enterprise!==void 0}class QL{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 GL(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}}async function qL(t,e){return oi(t,"GET","/v2/recaptchaConfig",as(t,e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function KL(t,e){return oi(t,"POST","/v1/accounts:delete",e)}async function YL(t,e){return oi(t,"POST","/v1/accounts:lookup",e)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Bl(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function XL(t,e=!1){const n=dt(t),r=await n.getIdToken(e),i=mv(r);J(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s==null?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:Bl(gv(i.auth_time)),issuedAtTime:Bl(gv(i.iat)),expirationTime:Bl(gv(i.exp)),signInProvider:o||null,signInSecondFactor:(s==null?void 0:s.sign_in_second_factor)||null}}function gv(t){return Number(t)*1e3}function mv(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return rd("JWT malformed, contained fewer than 3 sections"),null;try{const i=qE(n);return i?JSON.parse(i):(rd("Failed to decode base64 JWT payload"),null)}catch(i){return rd("Caught error parsing JWT payload as JSON",i==null?void 0:i.toString()),null}}function JL(t){const e=mv(t);return J(e,"internal-error"),J(typeof e.exp!="undefined","internal-error"),J(typeof e.iat!="undefined","internal-error"),Number(e.exp)-Number(e.iat)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function Hl(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof On&&ZL(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function ZL({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class e3{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){var n;if(e){const r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;const i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}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==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class HI{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Bl(this.lastLoginAt),this.creationTime=Bl(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function ad(t){var e;const n=t.auth,r=await t.getIdToken(),i=await Hl(t,YL(n,{idToken:r}));J(i==null?void 0:i.users.length,n,"internal-error");const s=i.users[0];t._notifyReloadListener(s);const o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?r3(s.providerUserInfo):[],a=n3(t.providerData,o),l=t.isAnonymous,u=!(t.email&&s.passwordHash)&&!(a!=null&&a.length),c=l?u:!1,h={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 HI(s.createdAt,s.lastLoginAt),isAnonymous:c};Object.assign(t,h)}async function t3(t){const e=dt(t);await ad(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function n3(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function r3(t){return t.map(e=>{var{providerId:n}=e,r=dv(e,["providerId"]);return{providerId:n,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function i3(t,e){const n=await jI(t,{},async()=>{const r=qa({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,o=zI(t,i,"/v1/token",`key=${s}`),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",$I.fetch()(o,{method:"POST",headers:a,body:r})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function s3(t,e){return oi(t,"POST","/v2/accounts:revokeToken",as(t,e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Gl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){J(e.idToken,"internal-error"),J(typeof e.idToken!="undefined","internal-error"),J(typeof e.refreshToken!="undefined","internal-error");const n="expiresIn"in e&&typeof e.expiresIn!="undefined"?Number(e.expiresIn):JL(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}async getToken(e,n=!1){return J(!this.accessToken||this.refreshToken,e,"user-token-expired"),!n&&this.accessToken&&!this.isExpired?this.accessToken:this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:i,expiresIn:s}=await i3(e,n);this.updateTokensAndExpiration(r,i,Number(s))}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:i,expirationTime:s}=n,o=new Gl;return r&&(J(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(J(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(J(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}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 Gl,this.toJSON())}_performRefresh(){return vr("not implemented")}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function ai(t,e){J(typeof t=="string"||typeof t=="undefined","internal-error",{appName:e})}class ls{constructor(e){var{uid:n,auth:r,stsTokenManager:i}=e,s=dv(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new e3(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new HI(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const n=await Hl(this,this.stsTokenManager.getToken(this.auth,e));return J(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return XL(this,e)}reload(){return t3(this)}_assign(e){this!==e&&(J(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=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new ls(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){J(!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 ad(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await Hl(this,KL(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var r,i,s,o,a,l,u,c;const h=(r=n.displayName)!==null&&r!==void 0?r:void 0,d=(i=n.email)!==null&&i!==void 0?i:void 0,f=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,g=(o=n.photoURL)!==null&&o!==void 0?o:void 0,m=(a=n.tenantId)!==null&&a!==void 0?a:void 0,w=(l=n._redirectEventId)!==null&&l!==void 0?l:void 0,v=(u=n.createdAt)!==null&&u!==void 0?u:void 0,y=(c=n.lastLoginAt)!==null&&c!==void 0?c:void 0,{uid:_,emailVerified:E,isAnonymous:I,providerData:A,stsTokenManager:T}=n;J(_&&T,e,"internal-error");const C=Gl.fromJSON(this.name,T);J(typeof _=="string",e,"internal-error"),ai(h,e.name),ai(d,e.name),J(typeof E=="boolean",e,"internal-error"),J(typeof I=="boolean",e,"internal-error"),ai(f,e.name),ai(g,e.name),ai(m,e.name),ai(w,e.name),ai(v,e.name),ai(y,e.name);const N=new ls({uid:_,auth:e,email:d,emailVerified:E,displayName:h,isAnonymous:I,photoURL:g,phoneNumber:f,tenantId:m,stsTokenManager:C,createdAt:v,lastLoginAt:y});return A&&Array.isArray(A)&&(N.providerData=A.map(O=>Object.assign({},O))),w&&(N._redirectEventId=w),N}static async _fromIdTokenResponse(e,n,r=!1){const i=new Gl;i.updateFromServerResponse(n);const s=new ls({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await ad(s),s}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const GI=new Map;function _r(t){yr(t instanceof Function,"Expected a class definition");let e=GI.get(t);return e?(yr(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,GI.set(t,e),e)}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class WI{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){}}WI.type="NONE";const QI=WI;/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function ld(t,e,n){return`firebase:${t}:${e}:${n}`}class To{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=ld(this.userKey,i.apiKey,s),this.fullPersistenceKey=ld("persistence",i.apiKey,s),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);return e?ls._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;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 To(_r(QI),e,r);const i=(await Promise.all(n.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let s=i[0]||_r(QI);const o=ld(r,e.config.apiKey,e.name);let a=null;for(const u of n)try{const c=await u._get(o);if(c){const h=ls._fromJSON(e,c);u!==s&&(a=h),s=u;break}}catch{}const l=i.filter(u=>u._shouldAllowMigration);return!s._shouldAllowMigration||!l.length?new To(s,e,r):(s=l[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async u=>{if(u!==s)try{await u._remove(o)}catch{}})),new To(s,e,r))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function qI(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(XI(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(KI(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(ZI(e))return"Blackberry";if(eA(e))return"Webos";if(vv(e))return"Safari";if((e.includes("chrome/")||YI(e))&&!e.includes("edge/"))return"Chrome";if(JI(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function KI(t=Ve()){return/firefox\//i.test(t)}function vv(t=Ve()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function YI(t=Ve()){return/crios\//i.test(t)}function XI(t=Ve()){return/iemobile/i.test(t)}function JI(t=Ve()){return/android/i.test(t)}function ZI(t=Ve()){return/blackberry/i.test(t)}function eA(t=Ve()){return/webos/i.test(t)}function ud(t=Ve()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function o3(t=Ve()){var e;return ud(t)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function a3(){return kk()&&document.documentMode===10}function tA(t=Ve()){return ud(t)||JI(t)||eA(t)||ZI(t)||/windows phone/i.test(t)||XI(t)}function l3(){try{return!!(window&&window!==window.top)}catch{return!1}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function nA(t,e=[]){let n;switch(t){case"Browser":n=qI(Ve());break;case"Worker":n=`${qI(Ve())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Qi}/${r}`}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class u3{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=s=>new Promise((o,a)=>{try{const l=e(s);o(l)}catch(l){a(l)}});r.onAbort=n,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>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 i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function c3(t,e={}){return oi(t,"GET","/v2/passwordPolicy",as(t,e))}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const h3=6;class d3{constructor(e){var n,r,i,s;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:h3,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(r=e.allowedNonAlphanumericCharacters)===null||r===void 0?void 0:r.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,r,i,s,o,a;const l={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,l),this.validatePasswordCharacterOptions(e,l),l.isValid&&(l.isValid=(n=l.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),l.isValid&&(l.isValid=(r=l.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),l.isValid&&(l.isValid=(i=l.containsLowercaseLetter)!==null&&i!==void 0?i:!0),l.isValid&&(l.isValid=(s=l.containsUppercaseLetter)!==null&&s!==void 0?s:!0),l.isValid&&(l.isValid=(o=l.containsNumericCharacter)!==null&&o!==void 0?o:!0),l.isValid&&(l.isValid=(a=l.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),l}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class f3{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new rA(this),this.idTokenSubscription=new rA(this),this.beforeStateQueue=new u3(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=FI,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=_r(n)),this._initializationPromise=this.queue(async()=>{var r,i;if(!this._deleted&&(this.persistenceManager=await To.create(this,e),!this._deleted)){if(!((r=this._popupRedirectResolver)===null||r===void 0)&&r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.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 initializeCurrentUser(e){var n;const r=await this.assertedPersistence.getCurrentUser();let i=r,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i==null?void 0:i._redirectEventId,l=await this.tryRedirectSignIn(e);(!o||o===a)&&(l!=null&&l.user)&&(i=l.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return J(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}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 ad(e)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=zL()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const n=e?dt(e):null;return n&&J(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&&J(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 await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue(async()=>{await this.assertedPersistence.setPersistence(_r(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 c3(this),n=new d3(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new Qa("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 s3(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.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&&_r(e)||this._popupRedirectResolver;J(n,this,"argument-error"),this.redirectPersistenceManager=await To.create(this,[_r(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)===null||r===void 0?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const r=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};const s=typeof n=="function"?n:n.next.bind(n);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(J(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){const l=e.addObserver(n,r,i);return()=>{o=!0,l()}}else{const l=e.addObserver(n);return()=>{o=!0,l()}}}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 J(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=nA(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);const r=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());r&&(n["X-Firebase-Client"]=r);const i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;const n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n!=null&&n.error&&FL(`Error while retrieving App Check token: ${n.error}`),n==null?void 0:n.token}}function Wl(t){return dt(t)}class rA{constructor(e){this.auth=e,this.observer=null,this.addObserver=Vk(n=>this.observer=n)}get next(){return J(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function p3(){var t,e;return(e=(t=document.getElementsByTagName("head"))===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:document}function iA(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{const s=Hn("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",p3().appendChild(r)})}function g3(t){return`__${t}${Math.floor(Math.random()*1e6)}`}const m3="https://www.google.com/recaptcha/enterprise.js?render=",v3="recaptcha-enterprise",y3="NO_RECAPTCHA";class _3{constructor(e){this.type=v3,this.auth=Wl(e)}async verify(e="verify",n=!1){async function r(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{qL(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const u=new QL(l);return s.tenantId==null?s._agentRecaptchaConfig=u:s._tenantRecaptchaConfigs[s.tenantId]=u,o(u.siteKey)}}).catch(l=>{a(l)})})}function i(s,o,a){const l=window.grecaptcha;BI(l)?l.enterprise.ready(()=>{l.enterprise.execute(s,{action:e}).then(u=>{o(u)}).catch(()=>{o(y3)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{r(this.auth).then(a=>{if(!n&&BI(window.grecaptcha))i(a,s,o);else{if(typeof window=="undefined"){o(new Error("RecaptchaVerifier is only supported in browser"));return}iA(m3+a).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}}async function sA(t,e,n,r=!1){const i=new _3(t);let s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function oA(t,e,n,r){var i;if(!((i=t._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await sA(t,e,n,n==="getOobCode");return r(t,s)}else return r(t,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const o=await sA(t,e,n,n==="getOobCode");return r(t,o)}else return Promise.reject(s)})}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function w3(t,e){const n=Yc(t,"auth");if(n.isInitialized()){const i=n.getImmediate(),s=n.getOptions();if(qc(s,e!=null?e:{}))return i;xn(i,"already-initialized")}return n.initialize({options:e})}function E3(t,e){const n=(e==null?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(_r);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function x3(t,e,n){const r=Wl(t);J(r._canInitEmulator,r,"emulator-config-failed"),J(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!!(n!=null&&n.disableWarnings),s=aA(e),{host:o,port:a}=S3(e),l=a===null?"":`:${a}`;r.config.emulator={url:`${s}//${o}${l}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||I3()}function aA(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function S3(t){const e=aA(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:lA(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:lA(o)}}}function lA(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function I3(){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 console!="undefined"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials."),typeof window!="undefined"&&typeof document!="undefined"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class yv{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return vr("not implemented")}_getIdTokenResponse(e){return vr("not implemented")}_linkToIdToken(e,n){return vr("not implemented")}_getReauthenticationResolver(e){return vr("not implemented")}}async function A3(t,e){return oi(t,"POST","/v1/accounts:signUp",e)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function T3(t,e){return sd(t,"POST","/v1/accounts:signInWithPassword",as(t,e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function C3(t,e){return sd(t,"POST","/v1/accounts:signInWithEmailLink",as(t,e))}async function b3(t,e){return sd(t,"POST","/v1/accounts:signInWithEmailLink",as(t,e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ql extends yv{constructor(e,n,r,i=null){super("password",r),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new Ql(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new Ql(e,n,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e;if(n!=null&&n.email&&(n!=null&&n.password)){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return oA(e,n,"signInWithPassword",T3);case"emailLink":return C3(e,{email:this._email,oobCode:this._password});default:xn(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":const r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return oA(e,r,"signUpPassword",A3);case"emailLink":return b3(e,{idToken:n,email:this._email,oobCode:this._password});default:xn(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function Co(t,e){return sd(t,"POST","/v1/accounts:signInWithIdp",as(t,e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const R3="http://localhost";class us extends yv{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new us(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):xn("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i}=n,s=dv(n,["providerId","signInMethod"]);if(!r||!i)return null;const o=new us(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return Co(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,Co(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,Co(e,n)}buildRequest(){const e={requestUri:R3,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=qa(n)}return e}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function k3(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function P3(t){const e=Ka(Ya(t)).link,n=e?Ka(Ya(e)).deep_link_id:null,r=Ka(Ya(t)).deep_link_id;return(r?Ka(Ya(r)).link:null)||r||n||e||t}class cd{constructor(e){var n,r,i,s,o,a;const l=Ka(Ya(e)),u=(n=l.apiKey)!==null&&n!==void 0?n:null,c=(r=l.oobCode)!==null&&r!==void 0?r:null,h=k3((i=l.mode)!==null&&i!==void 0?i:null);J(u&&c&&h,"argument-error"),this.apiKey=u,this.operation=h,this.code=c,this.continueUrl=(s=l.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=l.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=l.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){const n=P3(e);try{return new cd(n)}catch{return null}}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class bo{constructor(){this.providerId=bo.PROVIDER_ID}static credential(e,n){return Ql._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const r=cd.parseLink(n);return J(r,"argument-error"),Ql._fromEmailAndCode(e,r.code,r.tenantId)}}bo.PROVIDER_ID="password",bo.EMAIL_PASSWORD_SIGN_IN_METHOD="password",bo.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class uA{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}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ql extends uA{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class li extends ql{constructor(){super("facebook.com")}static credential(e){return us._fromParams({providerId:li.PROVIDER_ID,signInMethod:li.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return li.credentialFromTaggedObject(e)}static credentialFromError(e){return li.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return li.credential(e.oauthAccessToken)}catch{return null}}}li.FACEBOOK_SIGN_IN_METHOD="facebook.com",li.PROVIDER_ID="facebook.com";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ui extends ql{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return us._fromParams({providerId:ui.PROVIDER_ID,signInMethod:ui.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return ui.credentialFromTaggedObject(e)}static credentialFromError(e){return ui.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return ui.credential(n,r)}catch{return null}}}ui.GOOGLE_SIGN_IN_METHOD="google.com",ui.PROVIDER_ID="google.com";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ci extends ql{constructor(){super("github.com")}static credential(e){return us._fromParams({providerId:ci.PROVIDER_ID,signInMethod:ci.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ci.credentialFromTaggedObject(e)}static credentialFromError(e){return ci.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return ci.credential(e.oauthAccessToken)}catch{return null}}}ci.GITHUB_SIGN_IN_METHOD="github.com",ci.PROVIDER_ID="github.com";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class hi extends ql{constructor(){super("twitter.com")}static credential(e,n){return us._fromParams({providerId:hi.PROVIDER_ID,signInMethod:hi.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return hi.credentialFromTaggedObject(e)}static credentialFromError(e){return hi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return hi.credential(n,r)}catch{return null}}}hi.TWITTER_SIGN_IN_METHOD="twitter.com",hi.PROVIDER_ID="twitter.com";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ro{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){const s=await ls._fromIdTokenResponse(e,r,i),o=cA(r);return new Ro({user:s,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const i=cA(r);return new Ro({user:e,providerId:i,_tokenResponse:r,operationType:n})}}function cA(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class hd extends On{constructor(e,n,r,i){var s;super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,hd.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new hd(e,n,r,i)}}function hA(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?hd._fromErrorAndOperation(t,s,e,r):s})}async function N3(t,e,n=!1){const r=await Hl(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Ro._forOperation(t,"link",r)}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function O3(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await Hl(t,hA(r,i,e,t),n);J(s.idToken,r,"internal-error");const o=mv(s.idToken);J(o,r,"internal-error");const{sub:a}=o;return J(t.uid===a,r,"user-mismatch"),Ro._forOperation(t,i,s)}catch(s){throw(s==null?void 0:s.code)==="auth/user-not-found"&&xn(r,"user-mismatch"),s}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function dA(t,e,n=!1){const r="signIn",i=await hA(t,r,e),s=await Ro._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}async function D3(t,e){return dA(Wl(t),e)}function M3(t,e){const n=cd.parseLink(e);return(n==null?void 0:n.operation)==="EMAIL_SIGNIN"}async function L3(t,e,n){const r=dt(t),i=bo.credentialWithLink(e,n||id());return J(i._tenantId===(r.tenantId||null),r,"tenant-id-mismatch"),D3(r,i)}function V3(t,e,n,r){return dt(t).onIdTokenChanged(e,n,r)}function F3(t,e,n){return dt(t).beforeAuthStateChanged(e,n)}function U3(t,e,n,r){return dt(t).onAuthStateChanged(e,n,r)}function $3(t){return dt(t).signOut()}const dd="__sak";/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class fA{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(dd,"1"),this.storage.removeItem(dd),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()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function j3(){const t=Ve();return vv(t)||ud(t)}const z3=1e3,B3=10;class pA extends fA{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=j3()&&l3(),this.fallbackToPolling=tA(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,l)=>{this.notifyListeners(o,l)});return}const r=e.key;if(n?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const o=this.storage.getItem(r);if(e.newValue!==o)e.newValue!==null?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!n)return}const i=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);a3()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,B3):i()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(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)})},z3)}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]),Object.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]}}pA.type="LOCAL";const H3=pA;/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class gA extends fA{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}gA.type="SESSION";const mA=gA;/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function G3(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class fd{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;const r=new fd(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!(o!=null&&o.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const a=Array.from(o).map(async u=>u(n.origin,s)),l=await G3(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:l})}_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)}}fd.receivers=[];/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function _v(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class W3{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 i=typeof MessageChannel!="undefined"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,o;return new Promise((a,l)=>{const u=_v("",20);i.port1.start();const c=setTimeout(()=>{l(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(h){const d=h;if(d.data.eventId===u)switch(d.data.status){case"ack":clearTimeout(c),s=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(d.data.response);break;default:clearTimeout(c),clearTimeout(s),l(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:u,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Gn(){return window}function Q3(t){Gn().location.href=t}/**
 * @license
 * Copyright 2020 Google LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function vA(){return typeof Gn().WorkerGlobalScope!="undefined"&&typeof Gn().importScripts=="function"}async function q3(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function K3(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)===null||t===void 0?void 0:t.controller)||null}function Y3(){return vA()?self:null}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const yA="firebaseLocalStorageDb",X3=1,pd="firebaseLocalStorage",_A="fbase_key";class Kl{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 gd(t,e){return t.transaction([pd],e?"readwrite":"readonly").objectStore(pd)}function J3(){const t=indexedDB.deleteDatabase(yA);return new Kl(t).toPromise()}function wv(){const t=indexedDB.open(yA,X3);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(pd,{keyPath:_A})}catch(i){n(i)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(pd)?e(r):(r.close(),await J3(),e(await wv()))})})}async function wA(t,e,n){const r=gd(t,!0).put({[_A]:e,value:n});return new Kl(r).toPromise()}async function Z3(t,e){const n=gd(t,!1).get(e),r=await new Kl(n).toPromise();return r===void 0?null:r.value}function EA(t,e){const n=gd(t,!0).delete(e);return new Kl(n).toPromise()}const eV=800,tV=3;class xA{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++>tV)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return vA()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=fd._getInstance(Y3()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await q3(),!this.activeServiceWorker)return;this.sender=new W3(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&!((e=r[0])===null||e===void 0)&&e.fulfilled&&!((n=r[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||K3()!==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 wA(e,dd,"1"),await EA(e,dd),!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=>wA(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>Z3(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>EA(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const s=gd(i,!1).getAll();return new Kl(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),eV)}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]),Object.keys(this.listeners).length===0&&this.stopPolling()}}xA.type="LOCAL";const nV=xA;new zl(3e4,6e4);/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function rV(t,e){return e?_r(e):(J(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ev extends yv{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Co(e,this._buildIdpRequest())}_linkToIdToken(e,n){return Co(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return Co(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 iV(t){return dA(t.auth,new Ev(t),t.bypassAuthState)}function sV(t){const{auth:e,user:n}=t;return J(n,e,"internal-error"),O3(n,new Ev(t),t.bypassAuthState)}async function oV(t){const{auth:e,user:n}=t;return J(n,e,"internal-error"),N3(n,new Ev(t),t.bypassAuthState)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class SA{constructor(e,n,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,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:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}const l={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(l))}catch(u){this.reject(u)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return iV;case"linkViaPopup":case"linkViaRedirect":return oV;case"reauthViaPopup":case"reauthViaRedirect":return sV;default:xn(this.auth,"internal-error")}}resolve(e){yr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){yr(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()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const aV=new zl(2e3,1e4);class ko extends SA{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,ko.currentPopupAction&&ko.currentPopupAction.cancel(),ko.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return J(e,this.auth,"internal-error"),e}async onExecution(){yr(this.filter.length===1,"Popup operations only handle one event");const e=_v();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(Hn(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(Hn(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ko.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if(!((r=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||r===void 0)&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Hn(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,aV.get())};e()}}ko.currentPopupAction=null;/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const lV="pendingRedirect",md=new Map;class uV extends SA{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=md.get(this.auth._key());if(!e){try{const r=await cV(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}md.set(this.auth._key(),e)}return this.bypassAuthState||md.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 cV(t,e){const n=fV(e),r=dV(t);if(!await r._isAvailable())return!1;const i=await r._get(n)==="true";return await r._remove(n),i}function hV(t,e){md.set(t._key(),e)}function dV(t){return _r(t._redirectPersistence)}function fV(t){return ld(lV,t.config.apiKey,t.name)}async function pV(t,e,n=!1){const r=Wl(t),i=rV(r,e),o=await new uV(r,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const gV=10*60*1e3;class mV{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!vV(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!AA(e)){const i=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";n.onError(Hn(this.auth,i))}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>=gV&&this.cachedEventUids.clear(),this.cachedEventUids.has(IA(e))}saveEventToCache(e){this.cachedEventUids.add(IA(e)),this.lastProcessedEventTime=Date.now()}}function IA(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function AA({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function vV(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return AA(t);default:return!1}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function yV(t,e={}){return oi(t,"GET","/v1/projects",e)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const _V=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wV=/^https?/;async function EV(t){if(t.config.emulator)return;const{authorizedDomains:e}=await yV(t);for(const n of e)try{if(xV(n))return}catch{}xn(t,"unauthorized-domain")}function xV(t){const e=id(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!wV.test(n))return!1;if(_V.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}/**
 * @license
 * Copyright 2020 Google LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const SV=new zl(3e4,6e4);function TA(){const t=Gn().___jsl;if(t!=null&&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}}function IV(t){return new Promise((e,n)=>{var r,i,s;function o(){TA(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{TA(),n(Hn(t,"network-request-failed"))},timeout:SV.get()})}if(!((i=(r=Gn().gapi)===null||r===void 0?void 0:r.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=Gn().gapi)===null||s===void 0)&&s.load)o();else{const a=g3("iframefcb");return Gn()[a]=()=>{gapi.load?o():n(Hn(t,"network-request-failed"))},iA(`https://apis.google.com/js/api.js?onload=${a}`).catch(l=>n(l))}}).catch(e=>{throw vd=null,e})}let vd=null;function AV(t){return vd=vd||IV(t),vd}/**
 * @license
 * Copyright 2020 Google LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const TV=new zl(5e3,15e3),CV="__/auth/iframe",bV="emulator/auth/iframe",RV={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},kV=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function PV(t){const e=t.config;J(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?pv(e,bV):`https://${t.config.authDomain}/${CV}`,r={apiKey:e.apiKey,appName:t.name,v:Qi},i=kV.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${qa(r).slice(1)}`}async function NV(t){const e=await AV(t),n=Gn().gapi;return J(n,t,"internal-error"),e.open({where:document.body,url:PV(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:RV,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=Hn(t,"network-request-failed"),a=Gn().setTimeout(()=>{s(o)},TV.get());function l(){Gn().clearTimeout(a),i(r)}r.ping(l).then(l,()=>{s(o)})}))}/**
 * @license
 * Copyright 2020 Google LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const OV={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},DV=500,MV=600,LV="_blank",VV="http://localhost";class CA{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function FV(t,e,n,r=DV,i=MV){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const l=Object.assign(Object.assign({},OV),{width:r.toString(),height:i.toString(),top:s,left:o}),u=Ve().toLowerCase();n&&(a=YI(u)?LV:n),KI(u)&&(e=e||VV,l.scrollbars="yes");const c=Object.entries(l).reduce((d,[f,g])=>`${d}${f}=${g},`,"");if(o3(u)&&a!=="_self")return UV(e||"",a),new CA(null);const h=window.open(e||"",a,c);J(h,t,"popup-blocked");try{h.focus()}catch{}return new CA(h)}function UV(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)}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const $V="__/auth/handler",jV="emulator/auth/handler",zV=encodeURIComponent("fac");async function bA(t,e,n,r,i,s){J(t.config.authDomain,t,"auth-domain-config-required"),J(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Qi,eventId:i};if(e instanceof uA){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",Lk(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[c,h]of Object.entries(s||{}))o[c]=h}if(e instanceof ql){const c=e.getScopes().filter(h=>h!=="");c.length>0&&(o.scopes=c.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const c of Object.keys(a))a[c]===void 0&&delete a[c];const l=await t._getAppCheckToken(),u=l?`#${zV}=${encodeURIComponent(l)}`:"";return`${BV(t)}?${qa(a).slice(1)}${u}`}function BV({config:t}){return t.emulator?pv(t,jV):`https://${t.authDomain}/${$V}`}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const xv="webStorageSupport";class HV{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=mA,this._completeRedirectFn=pV,this._overrideRedirectResult=hV}async _openPopup(e,n,r,i){var s;yr((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");const o=await bA(e,n,r,id(),i);return FV(e,o,_v())}async _openRedirect(e,n,r,i){await this._originValidation(e);const s=await bA(e,n,r,id(),i);return Q3(s),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(yr(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await NV(e),r=new mV(e);return n.register("authEvent",i=>(J(i==null?void 0:i.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.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(xv,{type:xv},i=>{var s;const o=(s=i==null?void 0:i[0])===null||s===void 0?void 0:s[xv];o!==void 0&&n(!!o),xn(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=EV(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return tA()||vv()||ud()}}const GV=HV;var RA="@firebase/auth",kA="1.5.1";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class WV{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e((r==null?void 0: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(){J(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function QV(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}function qV(t){Wi(new Yr("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;J(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:o,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:nA(t)},u=new f3(r,i,s,l);return E3(u,n),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),Wi(new Yr("auth-internal",e=>{const n=Wl(e.getProvider("auth").getImmediate());return(r=>new WV(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Dn(RA,kA,QV(t)),Dn(RA,kA,"esm2017")}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const KV=5*60,YV=JE("authIdTokenMaxAge")||KV;let PA=null;const XV=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>YV)return;const i=n==null?void 0:n.token;PA!==i&&(PA=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function JV(t=Rg()){const e=Yc(t,"auth");if(e.isInitialized())return e.getImmediate();const n=w3(t,{popupRedirectResolver:GV,persistence:[nV,H3,mA]}),r=JE("authTokenSyncURL");if(r){const s=XV(r);F3(n,s,()=>s(n.currentUser)),V3(n,o=>s(o))}const i=KE("auth");return i&&x3(n,`http://${i}`),n}qV("Browser");const ZV={apiKey:"AIzaSyDoalRxE1BYoeHVS8CRhlw-DRwt9hdjalc",authDomain:"bostadsplanerare.firebaseapp.com",projectId:"bostadsplanerare",storageBucket:"bostadsplanerare.appspot.com",messagingSenderId:"278881924775",appId:"1:278881924775:web:0e267bbcccebc19952cd82"},e4="https://bostad-storage.pintar.se/",NA=l1(ZV),cs=$M(NA);OL(NA);const yd=JV();function Po(t){return t.startsWith("https://firebasestorage.googleapis.com")?t:t.startsWith("gs://")?t.replace("gs://","https://firebasestorage.googleapis.com/v0/b/bostadsplanerare.appspot.com/o/"):e4+t}const t4=async(t,e)=>{const n=jl(So(cs,`/${e}`),XM("sitename","==",t));return(await Ao(n)).docs.map(i=>({...i.data(),siteid:i.id}))};function _t(){const{company:t,sitename:e}=g2(),r=hr({queryKey:["site",e,"company",t],queryFn:()=>t4(e,t),enabled:!!(t&&e)});return r.data===void 0?[{},r.status]:[{...r.data[0],company:t},r.status]}const n4=async t=>{try{if(!t)return{viewBox:"",paths:[]};const e=await fetch(t);if(!e.ok)throw new Error("Failed to load SVG");const n=await e.text(),i=new DOMParser().parseFromString(n,"image/svg+xml"),s=i.querySelector("svg"),o=(s==null?void 0:s.getAttribute("viewBox"))||"",a=Array.from(i.querySelectorAll("path, polygon, circle")).map(l=>{const u=l.tagName.toLowerCase()==="polygon",c=l.tagName.toLowerCase()==="circle",h=(f,g,m)=>(parseFloat(m)||0)===0?"":`M ${+f-+m},${+g} A ${+m},${+m} 0 1,0 ${+f+ +m},${+g} A ${+m},${+m} 0 1,0 ${+f-+m},${+g} Z`;let d="";return u?d=`M ${l.getAttribute("points")||""} z`:c?d=h(l.getAttribute("cx")||"",l.getAttribute("cy")||"",l.getAttribute("r")||""):d=l.getAttribute("d")||"",{id:l.getAttribute("id")||"",ref_id:l.getAttribute("data-ref_id")||"",type:l.getAttribute("data-type")||"none",coordinates:d,tooltipplace:l.getAttribute("data-tooltipplace")||"top",title:l.getAttribute("data-title")||"",color:l.getAttribute("data-color")||"",text:l.getAttribute("data-text")||""}});return{viewBox:o,paths:a}}catch(e){return console.error("Error loading SVG:",e),{viewBox:"",paths:[]}}},OA=(t,e)=>{var i,s,o,a;const[n]=_t(),r=hr({queryKey:["svgUrl",t],queryFn:()=>n4(t)});return[(s=(i=r==null?void 0:r.data)==null?void 0:i.viewBox)!=null?s:"",(a=(o=r==null?void 0:r.data)==null?void 0:o.paths)!=null?a:[],r.status]},r4=async(t,e)=>{const n=jl(So(cs,`${t}/${e}/solar`),Yh("order"));return(await Ao(n)).docs.map(i=>({...i.data(),id:i.id}))};function _d(t){var s,o;const[e]=_t(),n=hr({queryKey:["company",e.company,"siteId",e.siteid,"solarScenes"],queryFn:()=>r4(e.company,e.siteid)}),r=t?(s=n==null?void 0:n.data)==null?void 0:s.filter(a=>a.viewid===t):n==null?void 0:n.data,i=r==null?void 0:r.findIndex(a=>a.default);return[(o=r==null?void 0:r.sort((a,l)=>a.order-l.order))!=null?o:[],i,n.status]}var wr={BASE_URL:"/",MODE:"widget",DEV:!1,PROD:!0,SSR:!1};let i4=0;function ye(t,e){const n=`atom${++i4}`,r={toString(){return(wr?"widget":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=s4,r.write=o4),e&&(r.write=e),r}function s4(t){return t(this)}function o4(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}const DA=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,Sv=t=>"init"in t,Iv=t=>!!t.write,wd=new WeakMap,Av=t=>{var e;return Tv(t)&&!((e=wd.get(t))!=null&&e[1])},a4=(t,e)=>{const n=wd.get(t);if(n)n[1]=!0,n[0].forEach(r=>r(e));else if((wr?"widget":void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},l4=t=>{if(wd.has(t))return;const e=[new Set,!1];wd.set(t,e);const n=()=>{e[1]=!0};t.then(n,n),t.onCancel=r=>{e[0].add(r)}},Tv=t=>typeof(t==null?void 0:t.then)=="function",MA=t=>"v"in t||"e"in t,Ed=t=>{if("e"in t)throw t.e;if((wr?"widget":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},LA=(t,e,n)=>{n.p.has(t)||(n.p.add(t),e.then(()=>{n.p.delete(t)},()=>{n.p.delete(t)}))},u4=(t,e,n,r)=>{var i;if((wr?"widget":void 0)!=="production"&&n===t)throw new Error("[Bug] atom cannot depend on itself");e.d.set(n,r.n),Av(e.v)&&LA(t,e.v,r),(i=r.m)==null||i.t.add(t)},c4=Symbol.for("JOTAI.EXPERIMENTAL.FLUSHSTOREHOOK"),VA=(...t)=>{const[e,n,r,i,s,o]=t,a=P=>{if((wr?"widget":void 0)!=="production"&&!P)throw new Error("Atom is undefined or null");let b=e(P);return b||(b={d:new Map,p:new Set,n:0},n(P,b),s==null||s(P,O)),b},l=new WeakMap,u=new Map,c=new Set,h=new Set,d=()=>{var P;const b=[],L=V=>{try{V()}catch($){b.push($)}};do{(P=O[c4])==null||P.call(O);const V=new Set,$=V.add.bind(V);u.forEach(z=>{var X;return(X=z.m)==null?void 0:X.l.forEach($)}),u.clear(),c.forEach($),c.clear(),h.forEach($),h.clear(),V.forEach(L),u.size&&y()}while(u.size||c.size||h.size);if(b.length)throw b[0]},f=(P,b,L)=>{const V="v"in b,$=b.v,z=Av(b.v)?b.v:null;if(Tv(L)){l4(L);for(const X of b.d.keys())LA(P,L,a(X));b.v=L}else b.v=L;delete b.e,(!V||!Object.is($,b.v))&&(++b.n,z&&a4(z,L))},g=P=>{var b;const L=a(P);if(MA(L)&&(L.m&&l.get(P)!==L.n||Array.from(L.d).every(([j,se])=>g(j).n===se)))return L;L.d.clear();let V=!0;const $=()=>{L.m&&(I(P,L),y(),d())},z=j=>{if(DA(P,j)){const pe=a(j);if(!MA(pe))if(Sv(j))f(j,pe,j.init);else throw new Error("no atom init");return Ed(pe)}const se=g(j);try{return Ed(se)}finally{u4(P,L,j,se),V||$()}};let X,D;const W={get signal(){return X||(X=new AbortController),X.signal},get setSelf(){return(wr?"widget":void 0)!=="production"&&!Iv(P)&&console.warn("setSelf function cannot be used with read-only atom"),!D&&Iv(P)&&(D=(...j)=>{if((wr?"widget":void 0)!=="production"&&V&&console.warn("setSelf function cannot be called in sync"),!V)return E(P,...j)}),D}};try{const j=r(P,z,W);return f(P,L,j),Tv(j)&&((b=j.onCancel)==null||b.call(j,()=>X==null?void 0:X.abort()),j.then($,$)),L}catch(j){return delete L.v,L.e=j,++L.n,L}finally{V=!1}},m=P=>Ed(g(P)),w=P=>{var b;const L=new Map;for(const V of((b=P.m)==null?void 0:b.t)||[]){const $=a(V);$.m&&L.set(V,$)}for(const V of P.p)L.set(V,a(V));return L},v=P=>{const b=[P];for(;b.length;){const L=b.pop();for(const[V,$]of w(L))l.has(V)||(l.set(V,$.n),b.push($))}},y=()=>{var P;const b=[],L=new WeakSet,V=new WeakSet,$=Array.from(u);for(;$.length;){const[z,X]=$[$.length-1];if(V.has(z)){$.pop();continue}if(L.has(z)){l.get(z)===X.n?b.push([z,X,X.n]):(l.delete(z),u.set(z,X)),V.add(z),$.pop();continue}L.add(z);for(const[D,W]of w(X))L.has(D)||$.push([D,W])}for(let z=b.length-1;z>=0;--z){const[X,D,W]=b[z];let j=!1;for(const se of D.d.keys())if(se!==X&&u.has(se)){j=!0;break}j&&(g(X),I(X,D),W!==D.n&&(u.set(X,D),(P=D.u)==null||P.call(D))),l.delete(X)}},_=(P,...b)=>{let L=!0;const V=z=>Ed(g(z)),$=(z,...X)=>{var D;const W=a(z);try{if(DA(P,z)){if(!Sv(z))throw new Error("atom not writable");const j=W.n,se=X[0];f(z,W,se),I(z,W),j!==W.n&&(u.set(z,W),(D=W.u)==null||D.call(W),v(W));return}else return _(z,...X)}finally{L||(y(),d())}};try{return i(P,V,$,...b)}finally{L=!1}},E=(P,...b)=>{try{return _(P,...b)}finally{y(),d()}},I=(P,b)=>{var L;if(b.m&&!Av(b.v)){for(const[V,$]of b.d)if(!b.m.d.has(V)){const z=a(V);A(V,z).t.add(P),b.m.d.add(V),$!==z.n&&(u.set(V,z),(L=z.u)==null||L.call(z),v(z))}for(const V of b.m.d||[])if(!b.d.has(V)){b.m.d.delete(V);const $=T(V,a(V));$==null||$.t.delete(P)}}},A=(P,b)=>{var L;if(!b.m){g(P);for(const V of b.d.keys())A(V,a(V)).t.add(P);if(b.m={l:new Set,d:new Set(b.d.keys()),t:new Set},(L=b.h)==null||L.call(b),Iv(P)){const V=b.m,$=()=>{let z=!0;const X=(...D)=>{try{return _(P,...D)}finally{z||(y(),d())}};try{const D=o(P,X);D&&(V.u=()=>{z=!0;try{D()}finally{z=!1}})}finally{z=!1}};h.add($)}}return b.m},T=(P,b)=>{var L;if(b.m&&!b.m.l.size&&!Array.from(b.m.t).some(V=>{var $;return($=a(V).m)==null?void 0:$.d.has(P)})){const V=b.m.u;V&&c.add(V),delete b.m,(L=b.h)==null||L.call(b);for(const $ of b.d.keys()){const z=T($,a($));z==null||z.t.delete(P)}return}return b.m},O={get:m,set:E,sub:(P,b)=>{const L=a(P),$=A(P,L).l;return $.add(b),d(),()=>{$.delete(b),T(P,L),d()}},unstable_derive:P=>VA(...P(...t))};return O},h4=t=>{const e=new Set;let n,r=0;const i=t.unstable_derive((...a)=>{const[l,u,,c]=a;return n=l,a[1]=function(d,f){u(d,f);const g=f.h;f.h=()=>{g==null||g(),f.m?e.add(d):e.delete(d)}},a[3]=function(d,f,g,...m){return r?g(d,...m):c(d,f,g,...m)},a}),s=i.set;return Object.assign(i,{dev4_get_internal_weak_map:()=>({get:a=>{const l=n(a);if(!(!l||l.n===0))return l}}),dev4_get_mounted_atoms:()=>e,dev4_restore_atoms:a=>{s({read:()=>null,write:(u,c)=>{++r;try{for(const[h,d]of a)Sv(h)&&c(h,d)}finally{--r}}})}})},Cv=()=>{const t=new WeakMap,e=VA(n=>t.get(n),(n,r)=>t.set(n,r).get(n),(n,...r)=>n.read(...r),(n,...r)=>n.write(...r),(n,...r)=>{var i;return(i=n.unstable_onInit)==null?void 0:i.call(n,...r)},(n,...r)=>{var i;return(i=n.onMount)==null?void 0:i.call(n,...r)});return(wr?"widget":void 0)!=="production"?h4(e):e};let Yl;const d4=()=>(Yl||(Yl=Cv(),(wr?"widget":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Yl),globalThis.__JOTAI_DEFAULT_STORE__!==Yl&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Yl);var FA={BASE_URL:"/",MODE:"widget",DEV:!1,PROD:!0,SSR:!1};const UA=S.createContext(void 0),$A=t=>{const e=S.useContext(UA);return(t==null?void 0:t.store)||e||d4()},f4=({children:t,store:e})=>{const n=S.useRef(void 0);return!e&&!n.current&&(n.current=Cv()),S.createElement(UA.Provider,{value:e||n.current},t)},bv=t=>typeof(t==null?void 0:t.then)=="function",jA=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},p4=Q0.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(jA(t),t)}),Rv=new WeakMap,zA=t=>{let e=Rv.get(t);return e||(e=new Promise((n,r)=>{let i=t;const s=l=>u=>{i===l&&n(u)},o=l=>u=>{i===l&&r(u)},a=l=>{"onCancel"in l&&typeof l.onCancel=="function"&&l.onCancel(u=>{if((FA?"widget":void 0)!=="production"&&u===l)throw new Error("[Bug] p is not updated even after cancelation");bv(u)?(Rv.set(u,e),i=u,u.then(s(u),o(u)),a(u)):n(u)})};t.then(s(t),o(t)),a(t)}),Rv.set(t,e)),e};function g4(t,e){const n=$A(e),[[r,i,s],o]=S.useReducer(u=>{const c=n.get(t);return Object.is(u[0],c)&&u[1]===n&&u[2]===t?u:[c,n,t]},void 0,()=>[n.get(t),n,t]);let a=r;(i!==n||s!==t)&&(o(),a=n.get(t));const l=e==null?void 0:e.delay;if(S.useEffect(()=>{const u=n.sub(t,()=>{if(typeof l=="number"){const c=n.get(t);bv(c)&&jA(zA(c)),setTimeout(o,l);return}o()});return o(),u},[n,t,l]),S.useDebugValue(a),bv(a)){const u=zA(a);return p4(u)}return a}function BA(t,e){const n=$A(e);return S.useCallback((...i)=>{if((FA?"widget":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...i)},[n,t])}function Y(t,e){return[g4(t,e),BA(t,e)]}const Kt=()=>window.matchMedia("(max-width: 640px)").matches,m4=()=>window.self!==window.top,kv=ye(!1),Pv=ye(!1),Nv=ye(!1),Ov=ye(!1),v4=ye(t=>t(kv)||t(Pv)||t(Nv)||t(Ov)),HA=ye(!1),y4=ye(!1),_4=ye(!1),GA=ye(!1),WA=ye(!1),QA=ye(!1);ye([]);const No=ye(0),qA=ye(null),Dv=ye(null),Mv=ye(null),Lv=ye(null),KA=ye(null),YA=ye(null),XA=ye(null),JA=ye(null),Vv=ye([]);ye([]);const Xl=ye(!1),ZA=ye([!0,!0,!0,!0,!0,!0]),w4=ye(t=>{const e=t(ZA),n=r=>r.rok==1?e[0]:r.rok==2?e[1]:r.rok==3?e[2]:r.rok==4?e[3]:r.rok==5?e[4]:r.rok==6?e[5]:!0;return t(Vv).filter(n)}),eT=ye(t=>{const e=t(Vv),n=[0,0,0,0,0,0];return e.forEach(r=>{r.rok==1&&n[0]++,r.rok==2&&n[1]++,r.rok==3&&n[2]++,r.rok==4&&n[3]++,r.rok==5&&n[4]++,r.rok==6&&n[5]++}),n}),E4=({currentSolar:t})=>{Y(WA);const[e]=_d(t==null?void 0:t.viewid);return!e||e.length==0,null},xd=(t,e,n)=>t==="top"?{x:e.top.x-n.width/2,y:e.top.y-n.height-2}:t==="right"?{x:e.right.x+1,y:e.right.y-n.height/2}:t==="bottom"?{x:e.bottom.x-n.width/2,y:e.bottom.y+1}:{x:e.left.x-n.width-1,y:e.left.y-n.height/2},Jl=({location:t,setArea:e,handleMouseLeave:n,onClick:r,openOnClick:i,anchorType:s,pathStyle:o,className:a,mobileScale:l,children:u})=>{const c=S.useRef(null),h=S.useRef(null),[d,f]=S.useState(null),[g,m]=S.useState(!1),w=!1,v=()=>{const C=h.current;if(!C)return;const N=C.ownerSVGElement;if(!N)return;const{x:O,y:P,width:b,height:L}=N.viewBox.baseVal,V=(Es,T0)=>({x:(Es-O)/b*100,y:(T0-P)/L*100}),$=C.getBBox(),z=$.x+$.width/2,X=$.y+$.height/2,D=Kt()&&l?l:1,W=Es=>D===1?Es:{x:z+(Es.x-z)*D,y:X+(Es.y-X)*D};let j=null,se=null,pe=null,Xt=null;if(s==="box")j={x:$.x,y:X},se={x:$.x+$.width,y:X},pe={x:z,y:$.y},Xt={x:z,y:$.y+$.height};else{const Es=L*.004,T0=b*.004,QU=C.getTotalLength(),pC=400;for(let C0=0;C0<=pC;C0++){const $t=C.getPointAtLength(QU*C0/pC);Math.abs($t.y-X)<=Es&&((!j||$t.x<j.x)&&(j={x:$t.x,y:$t.y}),(!se||$t.x>se.x)&&(se={x:$t.x,y:$t.y})),Math.abs($t.x-z)<=T0&&((!pe||$t.y<pe.y)&&(pe={x:$t.x,y:$t.y}),(!Xt||$t.y>Xt.y)&&(Xt={x:$t.x,y:$t.y}))}j!=null||(j={x:$.x,y:X}),se!=null||(se={x:$.x+$.width,y:X}),pe!=null||(pe={x:z,y:$.y}),Xt!=null||(Xt={x:z,y:$.y+$.height})}const Xn=W(j),Zo=W(se),Jn=W(pe),ws=W(Xt);return{left:V(Xn.x,Xn.y),right:V(Zo.x,Zo.y),top:V(Jn.x,Jn.y),bottom:V(ws.x,ws.y)}},y=()=>{const C=v();C&&(f({...C,reference_id:t.ref_id,coordinates:t.coordinates,tooltipplace:t.tooltipplace}),e({...C,reference_id:t.ref_id,coordinates:t.coordinates,title:t.title,text:t.text,tooltipplace:t.tooltipplace}),m(!0))};S.useEffect(()=>{if(!l)return;const C=()=>{var O;const N=(O=c.current)==null?void 0:O.getElementsByTagName("path");N&&Array.from(N).forEach(P=>{if(P){const b=P.getBBox(),L=b.x+b.width/2,V=b.y+b.height/2;Kt()?P.setAttribute("transform",`translate(${L} ${V}) scale(${l}) translate(${-L} ${-V})`):P.setAttribute("transform","scale(1)")}})};return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]),S.useEffect(()=>{if(!g)return;const C=N=>{const O=c.current;O&&N.target instanceof Node&&!O.contains(N.target)&&_()};return document.addEventListener("pointerdown",C,!0),()=>document.removeEventListener("pointerdown",C,!0)},[g]);const _=()=>{m(!1),e(null),n==null||n()},E=()=>{Kt()||_()},I=()=>{Kt()||y()},A=C=>{var N;i&&(g?_():(y(),(N=c.current)==null||N.focus())),r==null||r(C)},T=C=>{const N=c.current,O=C.relatedTarget;(!N||!O||!N.contains(O))&&_()};return p.jsxs("g",{ref:c,id:t.id,className:["hover:cursor-pointer",a].join(" "),onBlur:T,onClick:A,onMouseEnter:I,onMouseLeave:E,children:[p.jsx("path",{ref:h,d:t.coordinates,style:o}),u,d&&w&&p.jsxs(p.Fragment,{children:[p.jsx("circle",{cx:`${d.left.x}%`,cy:`${d.left.y}%`,r:"10",fill:"red"}),p.jsx("circle",{cx:`${d.right.x}%`,cy:`${d.right.y}%`,r:"10",fill:"red"}),p.jsx("circle",{cx:`${d.top.x}%`,cy:`${d.top.y}%`,r:"10",fill:"red"}),p.jsx("circle",{cx:`${d.bottom.x}%`,cy:`${d.bottom.y}%`,r:"10",fill:"red"})]})]})},x4=async(t,e)=>{const n=So(cs,`${t}/${e}/apartments`);return(await Ao(n)).docs.map(i=>({...i.data(),id:i.id}))},Fv=()=>{const[t]=_t(),[,e]=Y(Vv),[n]=Y(w4),r=hr({queryKey:["site",t.siteid,"company",t.company,"apartments"],queryFn:()=>x4(t.company,t.siteid)});return S.useEffect(()=>{r.data?e(r.data):r.isSuccess&&e([])},[r.data,r.isSuccess,e]),n},Sd="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='11'%20height='11'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3cstyle%3e%20.cls-1%20{%20stroke-width:%203px;%20stroke:%20white;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='cls-1'%20d='M22%2014.55V20a2%202%200%200%201-2%202H4a2%202%200%200%201-2-2V4a2%202%200%200%201%202-2h5.53'%20/%3e%3cline%20class='cls-1'%20x1='21.39'%20y1='2.48'%20x2='9.26'%20y2='14.09'%20/%3e%3cpath%20class='cls-1'%20d='M17%201.9h3.09A1.83%201.83%200%200%201%2022%203.62V6.9'%20/%3e%3c/svg%3e",S4=({currentSolar:t,onChange:e})=>{const[n,r]=Y(WA),[,i]=Y(Pv),[s]=_d();return!s||s.length===0?p.jsx(p.Fragment,{}):t?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`absolute left-0 top-0 z-10 h-full w-full cursor-default ${n?"visible":"invisible"}`,role:"button",tabIndex:0,onKeyDown:o=>o.key==="Enter"&&r(!1),onClick:()=>r(!1)}),p.jsxs("div",{id:"solar-tooltip",className:`absolute right-2 top-2 z-50 transform rounded-md bg-black/60 bg-white p-3 text-white shadow-lg transition-all duration-300 ease-out ${n?"visible scale-100 opacity-90":"invisible scale-75 opacity-0"}`,style:{backgroundColor:"rgba(0, 0, 0, 0.6)",color:"white",borderRadius:"0.375rem",padding:"0.5rem 0"},children:[p.jsx("ul",{className:"max-h-64 overflow-y-auto text-sm",children:s.map(o=>p.jsx("li",{children:p.jsxs("button",{className:`block w-full px-4 py-2 text-left hover:bg-white/10 ${t.id===o.id?"text-green-400":""}`,onClick:()=>{e==null||e(o)},children:[o.date," ",p.jsx("span",{className:"ml-5",children:o.time})]})},o.id))}),p.jsxs("button",{className:"flex w-full items-center gap-2 px-4 py-2 text-left text-sm hover:bg-white/10",onClick:()=>i(!0),children:[p.jsx("span",{children:"Visa Solstudie"}),p.jsx("img",{src:Sd,alt:"open modal",className:""})]})]})]}):p.jsx(p.Fragment,{})},I4=({viewid:t,picture:e,compass:n,svgurl:r})=>{const i=!!r,[s,o]=OA(r),[a,l]=_d(t),[u,c]=S.useState(a[l||0]),h=u||a[l||0],[,d]=Y(No),f=N=>{d(Number(N))},[,g]=Y(Mv),[m,w]=Y(Dv),[,v]=Y(Lv),[y]=Y(Xl),[,_]=Y(YA),[,E]=Y(XA),[,I]=Y(JA),A=Fv();if(!A)return p.jsx(p.Fragment,{});const T=o,C=s;return C?p.jsxs("div",{className:"relative inline-block",children:[p.jsx("img",{alt:"ViewImage",src:Po(e),className:n+" block h-auto max-w-full"}),p.jsx(E4,{currentSolar:h}),p.jsx(S4,{currentSolar:h,onChange:c}),p.jsx("svg",{className:"absolute left-0 top-0",viewBox:C,preserveAspectRatio:"none",children:T.map((N,O)=>{const P=`${N.type}-${O}`;if(N.type==="apartment"){let b=A.find(z=>z.apartmentid===N.ref_id);if(!b)return null;const L=z=>{I(z),g(b),w(b.apartmentid)},V=()=>{w(null)},$=["location-path",b.status,m==b.apartmentid?"showbold":"",y?"show":""].join(" ");return p.jsx(Jl,{location:N,anchorType:"box",className:$,setArea:L,handleMouseLeave:V,onClick:z=>{z.preventDefault(),Kt()?(w(null),setTimeout(()=>{g(b),v(b)},450)):v(b)}},P)}else if(N.type==="view"){const b=["view-path",y?"show":""].join(" ");return p.jsx(Jl,{location:N,className:b,setArea:_,onClick:L=>{L.preventDefault(),_(null),Kt()?setTimeout(()=>{f(N.ref_id)},350):f(N.ref_id)}},P)}else if(N.type==="viewinfo"){const b=["info-path"].join(" ");return p.jsx(Jl,{location:N,className:b,setArea:E,openOnClick:!0},P)}else if(N.type==="info"){const b=["infogroup","w-[100px]"].join(" "),L=i?T.find($=>$.id===N.ref_id):void 0;if(!L)return null;const V={fill:L.color,opacity:"0.7"};return p.jsx(Jl,{location:N,className:b,pathStyle:V,setArea:E,openOnClick:!0,mobileScale:1.5,children:p.jsx("path",{style:{fill:"#FFF"},className:"innerfigure",d:L.coordinates})},P)}return null})})]}):p.jsx(p.Fragment,{})},A4=async(t,e)=>{const n=jl(So(cs,`${t}/${e}/views`),Yh("order"));return(await Ao(n)).docs.map(i=>({...i.data(),viewid:i.id}))};function Id(){var n;const[t]=_t(),e=hr({queryKey:["company",t.company,"siteid",t.siteid,"views"],queryFn:()=>A4(t.company,t.siteid)});return[(n=e==null?void 0:e.data)!=null?n:[],e.status]}const Uv="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20data-name='Layer%201'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20395.92%20408.77'%3e%3cdefs%3e%3cstyle%3e%20.cls-1%20{%20stroke-width:%200px;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='cls-1'%20d='M314.94,97.05v142.24c44.72,0,80.98-31.84,80.98-71.12s-36.26-71.12-80.98-71.12Z'/%3e%3cpath%20class='cls-1'%20d='M0,204.39c0,112.88,91.51,204.39,204.39,204.39V0C91.51,0,0,91.51,0,204.39Z'/%3e%3c/svg%3e",T4=()=>{const[t,e]=S.useState(!1);return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`absolute left-0 top-0 h-full w-full cursor-default ${t?"visible":"invisible"}`,role:"button",tabIndex:0,onKeyDown:n=>n.key==="Enter"&&e(!1),onClick:()=>e(!1)}),p.jsx("div",{className:`absolute bottom-[90px] right-2 z-10 w-44 transform rounded-md bg-black p-3 text-xs text-white shadow-lg transition-all duration-300 ease-out sm:bottom-[110px] ${t?"visible scale-100 opacity-80":"invisible scale-90 opacity-0"}`,id:"viewSelector",children:p.jsxs("div",{className:"flex flex-col gap-2",children:[p.jsx("p",{children:"Powered by Pintar Studios AB"}),p.jsx("p",{children:p.jsx("a",{href:"https://www.pintarstudios.se",target:"_top",children:"www.pintarstudios.se"})})]})}),p.jsx("button",{"data-tooltip-id":"viewSelector","data-tooltip-place":"top",onClick:()=>e(!t),className:"absolute bottom-14 right-2 h-7 w-7 opacity-90 sm:h-10 sm:w-10 sm:origin-center sm:transform sm:transition sm:duration-100 sm:hover:scale-110",children:p.jsx("img",{className:"h-full w-full opacity-85",alt:"logo",src:Uv})})]})},C4=()=>{const t=BA(Ov),[e]=_t();return!(e!=null&&e.galleryButton)||e.galleryButton.type!=="iframe"?null:p.jsxs("button",{onClick:()=>t(!0),className:"bottom-14 left-2 flex w-auto items-center gap-2 whitespace-nowrap rounded-md bg-black bg-opacity-50 px-3 py-1 text-sm text-white opacity-90 sm:origin-center sm:transform sm:transition sm:duration-100 sm:hover:scale-105",children:["Galleri",p.jsx("img",{src:Sd,alt:"open modal",className:""})]})},b4=async(t,e)=>{const n=jl(So(cs,`${t}/${e}/scenes`),Yh("order"));return(await Ao(n)).docs.map(i=>({...i.data()}))};/*! *****************************************************************************
	Copyright (c) Microsoft Corporation.

	Permission to use, copy, modify, and/or distribute this software for any
	purpose with or without fee is hereby granted.

	THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
	REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
	AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
	INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
	LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
	OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
	PERFORMANCE OF THIS SOFTWARE.
	***************************************************************************** */function R4(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function k4(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s}function $v(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(k4(arguments[e]));return t}var Zl=function(t){return typeof t=="undefined"},jv=function(){function t(n,r){var i,s;if(this._canceled=!1,r)try{for(var o=R4(Object.keys(r)),a=o.next();!a.done;a=o.next()){var l=a.value;this[l]=r[l]}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}this.eventType=n}var e=t.prototype;return e.stop=function(){this._canceled=!0},e.isCanceled=function(){return this._canceled},t}(),wt=function(){function t(){this._eventHandler={}}var e=t.prototype;return e.trigger=function(n){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var s=n instanceof jv?n.eventType:n,o=$v(this._eventHandler[s]||[]);return o.length<=0?this:(n instanceof jv?(n.currentTarget=this,o.forEach(function(a){a(n)})):o.forEach(function(a){a.apply(void 0,$v(r))}),this)},e.once=function(n,r){var i=this;if(typeof n=="object"&&Zl(r)){var s=n;for(var o in s)this.once(o,s[o]);return this}else if(typeof n=="string"&&typeof r=="function"){var a=function(){for(var l=[],u=0;u<arguments.length;u++)l[u]=arguments[u];r.apply(void 0,$v(l)),i.off(n,a)};this.on(n,a)}return this},e.hasOn=function(n){return!!this._eventHandler[n]},e.on=function(n,r){if(typeof n=="object"&&Zl(r)){var i=n;for(var s in i)this.on(s,i[s]);return this}else if(typeof n=="string"&&typeof r=="function"){var o=this._eventHandler[n];Zl(o)&&(this._eventHandler[n]=[],o=this._eventHandler[n]),o.push(r)}return this},e.off=function(n,r){if(Zl(n))return this._eventHandler={},this;if(Zl(r)){if(typeof n=="string")return delete this._eventHandler[n],this;var i=n;for(var s in i)this.off(s,i[s]);return this}var o=this._eventHandler[n];if(o){for(var a=o.length,l=0;l<a;++l)if(o[l]===r){o.splice(l,1),a<=1&&delete this._eventHandler[n];break}}return this},t.VERSION="3.0.5",t}(),eu=jv,di=1e-6,Et=typeof Float32Array!="undefined"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function P4(){var t=new Et(9);return Et!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function tu(){var t=new Et(16);return Et!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function N4(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function tT(t,e,n){var r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],d=e[9],f=e[10],g=e[11],m=e[12],w=e[13],v=e[14],y=e[15],_=n[0],E=n[1],I=n[2],A=n[3];return t[0]=_*r+E*a+I*h+A*m,t[1]=_*i+E*l+I*d+A*w,t[2]=_*s+E*u+I*f+A*v,t[3]=_*o+E*c+I*g+A*y,_=n[4],E=n[5],I=n[6],A=n[7],t[4]=_*r+E*a+I*h+A*m,t[5]=_*i+E*l+I*d+A*w,t[6]=_*s+E*u+I*f+A*v,t[7]=_*o+E*c+I*g+A*y,_=n[8],E=n[9],I=n[10],A=n[11],t[8]=_*r+E*a+I*h+A*m,t[9]=_*i+E*l+I*d+A*w,t[10]=_*s+E*u+I*f+A*v,t[11]=_*o+E*c+I*g+A*y,_=n[12],E=n[13],I=n[14],A=n[15],t[12]=_*r+E*a+I*h+A*m,t[13]=_*i+E*l+I*d+A*w,t[14]=_*s+E*u+I*f+A*v,t[15]=_*o+E*c+I*g+A*y,t}function O4(t,e,n,r){var i=e[0],s=e[1],o=e[2],a=e[3],l=i+i,u=s+s,c=o+o,h=i*l,d=i*u,f=i*c,g=s*u,m=s*c,w=o*c,v=a*l,y=a*u,_=a*c,E=r[0],I=r[1],A=r[2];return t[0]=(1-(g+w))*E,t[1]=(d+_)*E,t[2]=(f-y)*E,t[3]=0,t[4]=(d-_)*I,t[5]=(1-(h+w))*I,t[6]=(m+v)*I,t[7]=0,t[8]=(f+y)*A,t[9]=(m-v)*A,t[10]=(1-(h+g))*A,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function D4(t,e,n,r,i){var s=1/Math.tan(e/2),o;return t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(o=1/(r-i),t[10]=(i+r)*o,t[14]=2*i*r*o):(t[10]=-1,t[14]=-2*r),t}var M4=D4;function L4(t,e,n,r){var i,s,o,a,l,u,c,h,d,f,g=e[0],m=e[1],w=e[2],v=r[0],y=r[1],_=r[2],E=n[0],I=n[1],A=n[2];return Math.abs(g-E)<di&&Math.abs(m-I)<di&&Math.abs(w-A)<di?N4(t):(c=g-E,h=m-I,d=w-A,f=1/Math.hypot(c,h,d),c*=f,h*=f,d*=f,i=y*d-_*h,s=_*c-v*d,o=v*h-y*c,f=Math.hypot(i,s,o),f?(f=1/f,i*=f,s*=f,o*=f):(i=0,s=0,o=0),a=h*o-d*s,l=d*i-c*o,u=c*s-h*i,f=Math.hypot(a,l,u),f?(f=1/f,a*=f,l*=f,u*=f):(a=0,l=0,u=0),t[0]=i,t[1]=a,t[2]=c,t[3]=0,t[4]=s,t[5]=l,t[6]=h,t[7]=0,t[8]=o,t[9]=u,t[10]=d,t[11]=0,t[12]=-(i*g+s*m+o*w),t[13]=-(a*g+l*m+u*w),t[14]=-(c*g+h*m+d*w),t[15]=1,t)}function Sn(){var t=new Et(3);return Et!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function zv(t){var e=t[0],n=t[1],r=t[2];return Math.hypot(e,n,r)}function We(t,e,n){var r=new Et(3);return r[0]=t,r[1]=e,r[2]=n,r}function V4(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function F4(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function U4(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function nT(t,e){var n=e[0],r=e[1],i=e[2],s=n*n+r*r+i*i;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}function rT(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Oo(t,e,n){var r=e[0],i=e[1],s=e[2],o=n[0],a=n[1],l=n[2];return t[0]=i*l-s*a,t[1]=s*o-r*l,t[2]=r*a-i*o,t}function iT(t,e,n){var r=e[0],i=e[1],s=e[2],o=n[3]*r+n[7]*i+n[11]*s+n[15];return o=o||1,t[0]=(n[0]*r+n[4]*i+n[8]*s+n[12])/o,t[1]=(n[1]*r+n[5]*i+n[9]*s+n[13])/o,t[2]=(n[2]*r+n[6]*i+n[10]*s+n[14])/o,t}function ln(t,e,n){var r=n[0],i=n[1],s=n[2],o=n[3],a=e[0],l=e[1],u=e[2],c=i*u-s*l,h=s*a-r*u,d=r*l-i*a,f=i*d-s*h,g=s*c-r*d,m=r*h-i*c,w=o*2;return c*=w,h*=w,d*=w,f*=2,g*=2,m*=2,t[0]=a+c+f,t[1]=l+h+g,t[2]=u+d+m,t}var $4=zv;(function(){var t=Sn();return function(e,n,r,i,s,o){var a,l;for(n||(n=3),r||(r=0),i?l=Math.min(i*n+r,e.length):l=e.length,a=r;a<l;a+=n)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],s(t,t,o),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2];return e}})();function j4(){var t=new Et(4);return Et!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function z4(t){var e=new Et(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function B4(t,e,n,r){var i=new Et(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i}function H4(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function G4(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function W4(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],o=n*n+r*r+i*i+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=n*o,t[1]=r*o,t[2]=i*o,t[3]=s*o,t}function Q4(t,e){var n=t[0],r=t[1],i=t[2],s=t[3],o=e[0],a=e[1],l=e[2],u=e[3];return Math.abs(n-o)<=di*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-a)<=di*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-l)<=di*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(s-u)<=di*Math.max(1,Math.abs(s),Math.abs(u))}(function(){var t=j4();return function(e,n,r,i,s,o){var a,l;for(n||(n=4),r||(r=0),i?l=Math.min(i*n+r,e.length):l=e.length,a=r;a<l;a+=n)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],t[3]=e[a+3],s(t,t,o),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=t[3];return e}})();function Er(){var t=new Et(4);return Et!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function sT(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function q4(t,e,n){n=n*.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function oT(t,e,n){var r=e[0],i=e[1],s=e[2],o=e[3],a=n[0],l=n[1],u=n[2],c=n[3];return t[0]=r*c+o*a+i*u-s*l,t[1]=i*c+o*l+s*a-r*u,t[2]=s*c+o*u+r*l-i*a,t[3]=o*c-r*a-i*l-s*u,t}function aT(t,e,n){n*=.5;var r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),l=Math.cos(n);return t[0]=r*l+o*a,t[1]=i*l+s*a,t[2]=s*l-i*a,t[3]=o*l-r*a,t}function lT(t,e,n){n*=.5;var r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),l=Math.cos(n);return t[0]=r*l-s*a,t[1]=i*l+o*a,t[2]=s*l+r*a,t[3]=o*l-i*a,t}function uT(t,e,n){n*=.5;var r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),l=Math.cos(n);return t[0]=r*l+i*a,t[1]=i*l-r*a,t[2]=s*l+o*a,t[3]=o*l-s*a,t}function Ad(t,e,n,r){var i=e[0],s=e[1],o=e[2],a=e[3],l=n[0],u=n[1],c=n[2],h=n[3],d,f,g,m,w;return f=i*l+s*u+o*c+a*h,f<0&&(f=-f,l=-l,u=-u,c=-c,h=-h),1-f>di?(d=Math.acos(f),g=Math.sin(d),m=Math.sin((1-r)*d)/g,w=Math.sin(r*d)/g):(m=1-r,w=r),t[0]=m*i+w*l,t[1]=m*s+w*u,t[2]=m*o+w*c,t[3]=m*a+w*h,t}function K4(t,e){var n=e[0]+e[4]+e[8],r;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);var s=(i+1)%3,o=(i+2)%3;r=Math.sqrt(e[i*3+i]-e[s*3+s]-e[o*3+o]+1),t[i]=.5*r,r=.5/r,t[3]=(e[s*3+o]-e[o*3+s])*r,t[s]=(e[s*3+i]+e[i*3+s])*r,t[o]=(e[o*3+i]+e[i*3+o])*r}return t}var nu=z4,Y4=B4,X4=H4,J4=G4,Do=W4,cT=Q4;(function(){var t=Sn(),e=We(1,0,0),n=We(0,1,0);return function(r,i,s){var o=rT(i,s);return o<-.999999?(Oo(t,e,i),$4(t)<1e-6&&Oo(t,n,i),nT(t,t),q4(r,t,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Oo(t,i,s),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+o,Do(r,r))}})(),function(){var t=Er(),e=Er();return function(n,r,i,s,o,a){return Ad(t,r,o,a),Ad(e,i,s,a),Ad(n,t,e,2*a*(1-a)),n}}(),function(){var t=P4();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],Do(e,K4(e,t))}}();function Z4(){var t=new Et(2);return Et!=Float32Array&&(t[0]=0,t[1]=0),t}function e5(t,e){var n=new Et(2);return n[0]=t,n[1]=e,n}(function(){var t=Z4();return function(e,n,r,i,s,o){var a,l;for(n||(n=2),r||(r=0),i?l=Math.min(i*n+r,e.length):l=e.length,a=r;a<l;a+=n)t[0]=e[a],t[1]=e[a+1],s(t,t,o),e[a]=t[0],e[a+1]=t[1];return e}})();var Bv=function(t,e){return Bv=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},Bv(t,e)};function Mo(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Bv(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Lo=function(){return Lo=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Lo.apply(this,arguments)};function t5(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)r[i]=s[o];return r}var Hv=typeof window!="undefined",n5=Hv?window.navigator.userAgent:"",r5=Hv?"getComputedStyle"in window:!1,i5=/MSIE|Trident|Windows Phone|Edge/.test(n5),s5=Hv?"addEventListener"in document:!1,Gv="width",ru="height";function Td(t,e){return t.getAttribute(e)||""}function Cd(t){return[].slice.call(t)}function o5(t,e){return e===void 0&&(e="data-"),!!t.getAttribute(e+"width")}function hT(t,e){return e===void 0&&(e="data-"),"loading"in t&&t.getAttribute("loading")==="lazy"||!!t.getAttribute(e+"lazy")}function a5(t,e){return e===void 0&&(e="data-"),!!t.getAttribute(e+"skip")}function dT(t,e,n){s5?t.addEventListener(e,n,!1):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n}function fT(t,e,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent?t.detachEvent("on"+e,n):t["on"+e]=null}function l5(t){return pT(t,"Width")}function u5(t){return pT(t,"Height")}function c5(t){return(r5?window.getComputedStyle(t):t.currentStyle)||{}}function pT(t,e){var n=t["client"+e]||t["offset"+e];return parseFloat(n||c5(t)[e.toLowerCase()])||0}function h5(t,e,n){var r=Cd(t.querySelectorAll(t5(["["+n+"skip] ["+n+"width]"],e.map(function(i){return["["+n+"skip] "+i,i+"["+n+"skip]","["+n+"width] "+i].join(", ")})).join(", ")));return Cd(t.querySelectorAll("["+n+"width], "+e.join(", "))).filter(function(i){return r.indexOf(i)===-1})}var Vo=[];function gT(t,e){!Vo.length&&dT(window,"resize",vT),t.__PREFIX__=e,Vo.push(t),mT(t)}function d5(t,e){var n=Vo.indexOf(t);if(!(n<0)){var r=Td(t,e+"fixed");delete t.__PREFIX__,t.style[r===ru?Gv:ru]="",Vo.splice(n,1),!Vo.length&&fT(window,"resize",vT)}}function mT(t,e){e===void 0&&(e="data-");var n=t.__PREFIX__||e,r=parseInt(Td(t,""+n+Gv),10)||0,i=parseInt(Td(t,""+n+ru),10)||0,s=Td(t,n+"fixed");if(s===ru){var o=u5(t)||i;t.style[Gv]=r/i*o+"px"}else{var o=l5(t)||r;t.style[ru]=i/r*o+"px"}}function vT(){Vo.forEach(function(t){mT(t)})}var Wv=function(t){Mo(e,t);function e(r,i){i===void 0&&(i={});var s=t.call(this)||this;s.isReady=!1,s.isPreReady=!1,s.hasDataSize=!1,s.hasLoading=!1,s.isSkip=!1,s.onCheck=function(a){if(s.clear(),a&&a.type==="error"&&s.onError(s.element),!(s.hasLoading&&s.checkElement())){var l=!s.hasDataSize&&!s.hasLoading;s.onReady(l)}},s.options=Lo({prefix:"data-"},i),s.element=r;var o=s.options.prefix;return s.hasDataSize=o5(r,o),s.isSkip=a5(r,o),s.hasLoading=hT(r,o),s}var n=e.prototype;return n.check=function(){return this.isSkip||!this.checkElement()?(this.onAlreadyReady(!0),!1):(this.hasDataSize&&gT(this.element,this.options.prefix),(this.hasDataSize||this.hasLoading)&&this.onAlreadyPreReady(),!0)},n.addEvents=function(){var r=this,i=this.element;this.constructor.EVENTS.forEach(function(s){dT(i,s,r.onCheck)})},n.clear=function(){var r=this,i=this.element;this.constructor.EVENTS.forEach(function(s){fT(i,s,r.onCheck)}),this.removeAutoSizer()},n.destroy=function(){this.clear(),this.off()},n.removeAutoSizer=function(){if(this.hasDataSize){var r=this.options.prefix;d5(this.element,r)}},n.onError=function(r){this.trigger("error",{element:this.element,target:r})},n.onPreReady=function(){this.isPreReady||(this.isPreReady=!0,this.trigger("preReady",{element:this.element,hasLoading:this.hasLoading,isSkip:this.isSkip}))},n.onReady=function(r){this.isReady||(r=!this.isPreReady&&r,r&&(this.isPreReady=!0),this.removeAutoSizer(),this.isReady=!0,this.trigger("ready",{element:this.element,withPreReady:r,hasLoading:this.hasLoading,isSkip:this.isSkip}))},n.onAlreadyError=function(r){var i=this;setTimeout(function(){i.onError(r)})},n.onAlreadyPreReady=function(){var r=this;setTimeout(function(){r.onPreReady()})},n.onAlreadyReady=function(r){var i=this;setTimeout(function(){i.onReady(r)})},e.EVENTS=[],e}(wt),f5=function(t){Mo(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}var n=e.prototype;return n.setHasLoading=function(r){this.hasLoading=r},n.check=function(){return this.isSkip?(this.onAlreadyReady(!0),!1):(this.hasDataSize?(gT(this.element,this.options.prefix),this.onAlreadyPreReady()):this.trigger("requestChildren"),!0)},n.checkElement=function(){return!0},n.destroy=function(){this.clear(),this.trigger("requestDestroy"),this.off()},n.onAlreadyPreReady=function(){t.prototype.onAlreadyPreReady.call(this),this.trigger("reqeustReadyChildren")},e.EVENTS=[],e}(Wv),p5=function(t){Mo(e,t);function e(r){r===void 0&&(r={});var i=t.call(this)||this;return i.readyCount=0,i.preReadyCount=0,i.totalCount=0,i.totalErrorCount=0,i.isPreReadyOver=!0,i.elementInfos=[],i.options=Lo({loaders:{},prefix:"data-"},r),i}var n=e.prototype;return n.check=function(r){var i=this,s=this.options.prefix;this.clear(),this.elementInfos=Cd(r).map(function(a,l){var u=i.getLoader(a,{prefix:s});return u.check(),u.on("error",function(c){i.onError(l,c.target)}).on("preReady",function(c){var h=i.elementInfos[l];h.hasLoading=c.hasLoading,h.isSkip=c.isSkip;var d=i.checkPreReady(l);i.onPreReadyElement(l),d&&i.onPreReady()}).on("ready",function(c){var h=c.withPreReady,d=c.hasLoading,f=c.isSkip,g=i.elementInfos[l];g.hasLoading=d,g.isSkip=f;var m=h&&i.checkPreReady(l),w=i.checkReady(l);h&&i.onPreReadyElement(l),i.onReadyElement(l),m&&i.onPreReady(),w&&i.onReady()}),{loader:u,element:a,hasLoading:!1,hasError:!1,isPreReady:!1,isReady:!1,isSkip:!1}});var o=this.elementInfos.length;return this.totalCount=o,o||setTimeout(function(){i.onPreReady(),i.onReady()}),this},n.getTotalCount=function(){return this.totalCount},n.isPreReady=function(){return this.elementInfos.every(function(r){return r.isPreReady})},n.isReady=function(){return this.elementInfos.every(function(r){return r.isReady})},n.hasError=function(){return this.totalErrorCount>0},n.clear=function(){this.isPreReadyOver=!1,this.totalCount=0,this.preReadyCount=0,this.readyCount=0,this.totalErrorCount=0,this.elementInfos.forEach(function(r){r.loader&&r.loader.destroy()}),this.elementInfos=[]},n.destroy=function(){this.clear(),this.off()},n.getLoader=function(r,i){var s=this,o=r.tagName.toLowerCase(),a=this.options.loaders,l=i.prefix,u=Object.keys(a);if(a[o])return new a[o](r,i);var c=new f5(r,i),h=Cd(r.querySelectorAll(u.join(", ")));c.setHasLoading(h.some(function(g){return hT(g,l)}));var d=!1,f=this.clone().on("error",function(g){c.onError(g.target)}).on("ready",function(){c.onReady(d)});return c.on("requestChildren",function(){var g=h5(r,u,s.options.prefix);f.check(g).on("preReady",function(m){d=m.isReady,d||c.onPreReady()})}).on("reqeustReadyChildren",function(){f.check(h)}).on("requestDestroy",function(){f.destroy()}),c},n.clone=function(){return new e(Lo({},this.options))},n.checkPreReady=function(r){return this.elementInfos[r].isPreReady=!0,++this.preReadyCount,!(this.preReadyCount<this.totalCount)},n.checkReady=function(r){return this.elementInfos[r].isReady=!0,++this.readyCount,!(this.readyCount<this.totalCount)},n.onError=function(r,i){var s=this.elementInfos[r];s.hasError=!0,this.trigger(new eu("error",{element:s.element,index:r,target:i,errorCount:this.getErrorCount(),totalErrorCount:++this.totalErrorCount}))},n.onPreReadyElement=function(r){var i=this.elementInfos[r];this.trigger(new eu("preReadyElement",{element:i.element,index:r,preReadyCount:this.preReadyCount,readyCount:this.readyCount,totalCount:this.totalCount,isPreReady:this.isPreReady(),isReady:this.isReady(),hasLoading:i.hasLoading,isSkip:i.isSkip}))},n.onPreReady=function(){this.isPreReadyOver=!0,this.trigger(new eu("preReady",{readyCount:this.readyCount,totalCount:this.totalCount,isReady:this.isReady(),hasLoading:this.hasLoading()}))},n.onReadyElement=function(r){var i=this.elementInfos[r];this.trigger(new eu("readyElement",{index:r,element:i.element,hasError:i.hasError,errorCount:this.getErrorCount(),totalErrorCount:this.totalErrorCount,preReadyCount:this.preReadyCount,readyCount:this.readyCount,totalCount:this.totalCount,isPreReady:this.isPreReady(),isReady:this.isReady(),hasLoading:i.hasLoading,isPreReadyOver:this.isPreReadyOver,isSkip:i.isSkip}))},n.onReady=function(){this.trigger(new eu("ready",{errorCount:this.getErrorCount(),totalErrorCount:this.totalErrorCount,totalCount:this.totalCount}))},n.getErrorCount=function(){return this.elementInfos.filter(function(r){return r.hasError}).length},n.hasLoading=function(){return this.elementInfos.some(function(r){return r.hasLoading})},e}(wt),g5=function(t){Mo(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}var n=e.prototype;return n.checkElement=function(){var r=this.element,i=r.getAttribute("src");if(r.complete){if(i)return r.naturalWidth||this.onAlreadyError(r),!1;this.onAlreadyPreReady()}return this.addEvents(),i5&&r.setAttribute("src",i),!0},e.EVENTS=["load","error"],e}(Wv),m5=function(t){Mo(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}var n=e.prototype;return n.checkElement=function(){var r=this.element;return r.readyState>=1?!1:r.error?(this.onAlreadyError(r),!1):(this.addEvents(),!0)},e.EVENTS=["loadedmetadata","error"],e}(Wv),v5=function(t){Mo(e,t);function e(n){return n===void 0&&(n={}),t.call(this,Lo({loaders:{img:g5,video:m5}},n))||this}return e}(p5);function Lt(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(h){o(h)}}function l(c){try{u(r.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})}class xr extends Error{constructor(e,n){super(e),Object.setPrototypeOf(this,xr.prototype),this.name="View360Error",this.code=n}}var Vt={CODES:{WRONG_TYPE:0,WRONG_OPTION:1,ELEMENT_NOT_FOUND:2,CANVAS_NOT_FOUND:3,WEBGL_NOT_SUPPORTED:4,FAILED_CREATE_CONTEXT_2D:5,PROVIDE_PROJECTION_FIRST:6,FAILED_LINKING_PROGRAM:7,INSUFFICIENT_ARGS:8},MESSAGES:{WRONG_TYPE:(t,e)=>`${typeof t} is not a ${e.map(n=>`"${n}"`).join(" or ")}.`,WRONG_OPTION:(t,e)=>`Bad option: given "${t}" for option "${e}".`,ELEMENT_NOT_FOUND:t=>`Element with selector "${t}" not found.`,CANVAS_NOT_FOUND:"The canvas element was not found inside the given root element.",WEBGL_NOT_SUPPORTED:"WebGL is not supported on this browser.",FAILED_CREATE_CONTEXT_2D:"Failed to create canvas 2D context",PROVIDE_PROJECTION_FIRST:'"projection" should be provided before initialization.',FAILED_LINKING_PROGRAM:(t,e)=>`Failed linking WebGL program - "${t}
Shader compile Log: ${e}`,INSUFFICIENT_ARGS:(t,e)=>`Insufficient arguments: given "${t}" for "${e}".`}};const te={MOUSE_DOWN:"mousedown",MOUSE_MOVE:"mousemove",MOUSE_UP:"mouseup",TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:"touchend",WHEEL:"wheel",RESIZE:"resize",CONTEXT_MENU:"contextmenu",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_UP:"pointerup",POINTER_CANCEL:"pointercancel",POINTER_ENTER:"pointerenter",POINTER_LEAVE:"pointerleave",KEY_DOWN:"keydown",KEY_UP:"keyup",LOAD:"load",ERROR:"error",CLICK:"click",DOUBLE_CLICK:"dblclick",CONTEXT_CREATE_ERROR:"webglcontextcreationerror",CONTEXT_LOST:"webglcontextlost",CONTEXT_RESTORED:"webglcontextrestored",DEVICE_ORIENTATION:"deviceorientation",DEVICE_MOTION:"devicemotion",ORIENTATION_CHANGE:"orientationchange",VIDEO_PLAY:"play",VIDEO_PAUSE:"pause",VIDEO_LOADED_DATA:"loadeddata",VIDEO_VOLUME_CHANGE:"volumechange",VIDEO_TIME_UPDATE:"timeupdate",VIDEO_DURATION_CHANGE:"durationchange",VIDEO_CAN_PLAYTHROUGH:"canplaythrough",TRANSITION_END:"transitionend",XR_END:"end"};var Qv;(function(t){t[t.LEFT=0]="LEFT",t[t.MIDDLE=1]="MIDDLE",t[t.RIGHT=2]="RIGHT"})(Qv||(Qv={}));const fi={GRAB:"grab",GRABBING:"grabbing",NONE:""},yT=["LEFT","UP","RIGHT","DOWN"];var qv;(function(t){t[t.LEFT=37]="LEFT",t[t.UP=38]="UP",t[t.RIGHT=39]="RIGHT",t[t.DOWN=40]="DOWN"})(qv||(qv={}));const y5={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"},_5=["fullscreenElement","webkitFullscreenElement","webkitCurrentFullScreenElement","mozFullScreenElement","msFullscreenElement"],Wn={CONTAINER:"view360-container",CANVAS:"view360-canvas",CTX_LOST:"view360-ctx-lost",IN_VR:"view360-vr-presenting",HOTSPOT_CONTAINER:"view360-hotspots",HOTSPOT:"view360-hotspot",HOTSPOT_VISIBLE:"view360-hotspot-visible",HOTSPOT_FLIP_X:"view360-hotspot-flip-x",HOTSPOT_FLIP_Y:"view360-hotspot-flip-y"},Je={READY:"ready",LOAD_START:"loadStart",LOAD:"load",PROJECTION_CHANGE:"projectionChange",RESIZE:"resize",BEFORE_RENDER:"beforeRender",RENDER:"render",INPUT_START:"inputStart",INPUT_END:"inputEnd",VIEW_CHANGE:"viewChange",STATIC_CLICK:"staticClick",VR_START:"vrStart",VR_END:"vrEnd"},w5={LINEAR:t=>t,SINE_WAVE:t=>Math.sin(t*Math.PI*2),EASE_OUT_CUBIC:t=>1-Math.pow(1-t,3),EASE_OUT_BOUNCE:t=>t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375};var Kv;const _T={CHANGE:"change",ANIMATION_END:"animationEnd"},E5={UPDATE:"update"},q={INPUT_START:"inputStart",CHANGE:"change",INPUT_END:"inputEnd",ENABLE:"enable",DISABLE:"disable",STATIC_CLICK:"staticClick"},at=Math.PI/180,hs=180/Math.PI,iu=w5.EASE_OUT_CUBIC,su=300,Yv={min:-1/0,max:1/0},wT={min:-90,max:90},x5={min:.6,max:10};var ou;(function(t){t[t.ZERO=0]="ZERO",t[t.CW_90=1]="CW_90",t[t.CCW_90=2]="CCW_90",t[t.CW_180=3]="CW_180"})(ou||(ou={}));const ET="immersive-vr",xT="local",ST=(Kv=Number.EPSILON)!==null&&Kv!==void 0?Kv:2220446049250313e-31,Xv=t=>typeof t=="string",S5=t=>!!t&&t.nodeType===Node.ELEMENT_NODE,IT=(t,e)=>{let n=null;if(Xv(t)){const i=(e||document).querySelector(t);if(!i)return null;n=i}else S5(t)&&(n=t);return n},I5=(t,e)=>{const n=IT(t,e);if(!n)throw Xv(t)?new xr(Vt.MESSAGES.ELEMENT_NOT_FOUND(t),Vt.CODES.ELEMENT_NOT_FOUND):new xr(Vt.MESSAGES.WRONG_TYPE(t,["HTMLElement","string"]),Vt.CODES.WRONG_TYPE);return n},A5=(t,e)=>{const n=t.querySelector(e);if(!n)throw new xr(Vt.MESSAGES.CANVAS_NOT_FOUND,Vt.CODES.CANVAS_NOT_FOUND);return n},T5=t=>!t||t<=0?[]:Array.apply(0,Array(t)).map((e,n)=>n),In=(t,e,n)=>Math.max(Math.min(t,n),e),AT=(t,e,n)=>t*(1-n)+e*n,bd=(t,e,n)=>{const r=Math.abs(n-e);if(t<e){const i=(e-t)%r;t=n-i}else if(t>n){const i=(t-n)%r;t=e+i}return t},au=t=>typeof t=="object"?t:{},Rd=(t,e)=>Math.atan(Math.tan(t*.5)/e)*2,Jv=(t,e,n="RLUDFB")=>n.split("").map(r=>e.indexOf(r)).map(r=>t[r]),C5=()=>{if(!document)return!1;for(const t of _5)if(document[t])return!0;return!1},b5=()=>window.isSecureContext&&!!DeviceMotionEvent&&"requestPermission"in DeviceMotionEvent,R5=(t,e)=>{const n=Math.tan(at*t*.5),r=Math.tan(at*e*.5);return n/r},TT=(t,e,n,r)=>{sT(t);const i=.01,s=In(n,-90+i,90-i);return lT(t,t,e*at),aT(t,t,s*at),uT(t,t,r*at),t},CT=t=>{const e=t[0],n=t[1],r=t[2],i=t[3],s=e*e,o=n*n,a=r*r,l=i*i,u=s+o+a+l,c=e*i-n*r;let h,d;if(c>.499995*u)h=Math.PI/2,d=2*Math.atan2(n,e);else if(c<-.499995*u)h=-Math.PI/2,d=-2*Math.atan2(n,e);else{const f=We(0,0,1),g=We(0,1,0);ln(f,f,t),ln(g,g,t);const m=Math.sqrt(f[0]*f[0]+f[2]*f[2]);h=Math.atan2(-f[1],m),d=Math.atan2(f[0],f[2])}return{pitch:In(h*hs,-90,90),yaw:bd(d*hs,0,360)}};class kd{get val(){return this._val}get start(){return this._start}get end(){return this._end}get progress(){return this._progress}get activated(){return this._activated}get duration(){return this._duration}set duration(e){this._duration=e}get loop(){return this._loop}set loop(e){this._loop=e}get range(){return this._range}get easing(){return this._easing}set easing(e){this._easing=e}constructor({duration:e=su,loop:n=!1,range:r={min:0,max:1},easing:i=iu}={}){this._duration=e,this._loop=n,this._range=r,this._easing=i,this._activated=!1,this.reset(0)}update(e){if(!this._activated)return this._val=this._end,0;const n=this._start,r=this._end,i=this._duration,s=this._val,o=this._loop,a=this._progress+e/i;this._progress=o?bd(a,0,1):In(a,0,1);const l=this._easing(this._progress);return this._val=AT(n,r,l),!o&&this._progress>=1&&(this._activated=!1),this._val-s}reset(e){const n=this._range,r=In(e,n.min,n.max);this._start=r,this._end=r,this._val=r,this._progress=0,this._activated=!1}add(e){const n=this._range;this._start=In(this._start+e,n.min,n.max),this._end=In(this._end+e,n.min,n.max),this._val=In(this._val+e,n.min,n.max)}setNewEndByDelta(e){const n=this._range;this._start=this._val,this._end=In(this._end+e,n.min,n.max),this._progress=0,this._activated=!0}setRange(e,n){this._start=In(this._start,e,n),this._end=In(this._end,e,n),this._range={min:e,max:n}}}class k5{get duration(){return this._motion.duration}set duration(e){this._motion.duration=e}get easing(){return this._motion.easing}set easing(e){this._motion.easing=e}constructor(e,n,r,{duration:i=su,easing:s=iu}={}){this._camera=e,this._motion=new kd({duration:i,easing:s,range:{min:0,max:1}}),this._from=n,this._to=r,this._finishPromise=new Promise(o=>{this._finish=o}),this._motion.setNewEndByDelta(1)}getFinishPromise(){return this._finishPromise}update(e){const n=this._camera,r=this._from,i=this._to,s=this._motion;s.update(e);const o=s.val,a=Er(),l=AT(r.zoom,i.zoom,o);Ad(a,r.rotation,i.rotation,o),n.rotate(a,l),o>=1&&this._finish()}}class P5 extends wt{get aspect(){return this._aspect}get changed(){return this._changed}get yawRange(){return this._initialYawRange}set yawRange(e){this._initialYawRange=e}get pitchRange(){return this._initialPitchRange}set pitchRange(e){this._initialPitchRange=e}get zoomRange(){return this._initialZoomRange}set zoomRange(e){this._initialZoomRange=e}constructor({initialYaw:e,initialPitch:n,initialZoom:r,yawRange:i,pitchRange:s,zoomRange:o,fov:a}){super(),this.yaw=e,this.pitch=n,this.zoom=r,this.rollOffset=0,this.initialYaw=e,this.initialPitch=n,this.initialZoom=r,this.position=Sn(),this.animation=null,this._up=We(0,1,0),this._aspect=1,this._initialYawRange=i,this._initialPitchRange=s,this._initialZoomRange=o,this._yawRange=i,this._pitchRange=s,this._zoomRange=o,this.quaternion=Er(),this._updateQuaternion(),this.viewMatrix=tu(),this.projectionMatrix=tu(),this.fov=a,this._maxRenderHeight=-1}destroy(){this.off()}resize(e,n){const r=this._aspect;this._aspect=e/n,this._aspect!==r&&this.updateMatrix()}lookAt({yaw:e=this.yaw,pitch:n=this.pitch,zoom:r=this.zoom}){const i=nu(this.quaternion),s=this.zoom;this.yaw=bd(e,0,360),this.pitch=In(n,-90,90),this.zoom=r,this._updateQuaternion();const o=Math.abs(r-s);(!cT(this.quaternion,i)||o>=ST*10)&&this.updateMatrix()}rotate(e,n=this.zoom){const r=Do(Er(),e),i=cT(this.quaternion,r);X4(this.quaternion,r);const s=this.zoom,{yaw:o,pitch:a}=CT(r);this.yaw=o,this.pitch=a,this.zoom=n;const l=Math.abs(n-s);(!i||l>=ST*10)&&this.updateMatrix()}animateTo({yaw:e=this.yaw,pitch:n=this.pitch,zoom:r=this.zoom,duration:i=0,easing:s=iu}={}){return Lt(this,void 0,void 0,function*(){if(this.yaw===e&&this.pitch===n&&this.zoom===r)return;const o={rotation:nu(this.quaternion),zoom:this.zoom},a={rotation:TT(Er(),e,n,this.rollOffset),zoom:r},l=new k5(this,o,a,{duration:i,easing:s}),u=l.getFinishPromise();return this.animation=l,u.then(()=>{this.animation=null,this.trigger(_T.ANIMATION_END,{animation:l})}),u})}restrictYawRange(e,n){this._yawRange={min:e,max:n}}restrictPitchRange(e,n){this._pitchRange={min:e,max:n}}restrictZoomRange(e,n){this._zoomRange={min:e,max:n}}restrictRenderHeight(e){this._maxRenderHeight=e}resetRange(){this._yawRange=this._initialYawRange,this._pitchRange=this._initialPitchRange,this._zoomRange=this._initialZoomRange,this._maxRenderHeight=-1}getYawRange(e){const n=this._yawRange,r=this._maxRenderHeight;if(!n)return Yv;const i=this.getHorizontalFov(e)*.5;let s=n.min,o=n.max;if(r>0){const a=Rd(i*at,this._aspect),l=r*.5,u=Math.tan(a),c=Math.sqrt((1+l*l)/(1+u*u)),h=Math.atan(Math.tan(i*at)*c)*hs;s=n.min+h,o=n.max-h}return s>o&&(s=0,o=0),{min:s,max:o}}getPitchRange(e){const n=this._pitchRange,r=this._maxRenderHeight;if(!n)return wT;let i=n.min,s=n.max;if(r>0){const o=this.getVerticalFov(e)*.5;i=n.min+o,s=n.max-o}return i>s&&(i=0,s=0),{min:Math.max(i,-90),max:Math.min(s,90)}}getZoomRange(){var e;const n=(e=this._zoomRange)!==null&&e!==void 0?e:x5,r=this.getHorizontalFov(n.max),i=this.getHorizontalFov(n.min),s=this.getHorizontalFov(this.zoom);return{min:Math.max(r,1),max:Math.min(i,180),current:s}}getHorizontalFov(e=this.zoom){return this._getZoomedHorizontalFov(e)*hs}getVerticalFov(e=this.zoom){const n=this._aspect,r=this._getZoomedHorizontalFov(e);return Rd(r,n)*hs}fovToZoom(e){const n=this.fov,r=Math.tan(at*n*.5),i=Math.tan(at*e*.5);return r/i}updateMatrix(){const e=this._up,n=this._aspect,r=this.viewMatrix,i=this.projectionMatrix,s=this.position,o=this.quaternion,a=Sn(),l=We(0,0,-1);ln(l,l,o),ln(a,e,o);const u=this._getZoomedHorizontalFov(),c=Rd(u,n);L4(r,s,l,a),M4(i,c,n,.1,100),this._changed=!0}onFrameRender(){this._changed=!1}_updateQuaternion(){TT(this.quaternion,this.yaw,this.pitch,this.rollOffset)}_getZoomedHorizontalFov(e=this.zoom){return 2*Math.atan(Math.tan(at*this.fov*.5)/e)}}class N5 extends wt{constructor(){super(),this._onMouseDown=e=>{const n=this._el;!n||e.button!==Qv.LEFT||(e.preventDefault(),n.focus?n.focus():window.focus(),this._prevPos[0]=e.clientX,this._prevPos[1]=e.clientY,window.addEventListener(te.MOUSE_MOVE,this._onMouseMove,!1),window.addEventListener(te.MOUSE_UP,this._onMouseUp,!1),this.trigger(q.INPUT_START,{srcEvent:e,isTouch:!1,isKeyboard:!1}))},this._onMouseMove=e=>{e.preventDefault();const n=e.clientX,r=e.clientY,i=this._prevPos,s=n-i[0],o=r-i[1];this.trigger(q.CHANGE,{delta:{x:s,y:o},isTouch:!1,isKeyboard:!1}),i[0]=n,i[1]=r},this._onMouseUp=()=>{this._prevPos[0]=0,this._prevPos[1]=0,window.removeEventListener(te.MOUSE_MOVE,this._onMouseMove,!1),window.removeEventListener(te.MOUSE_UP,this._onMouseUp,!1),this.trigger(q.INPUT_END,{isTouch:!1,isKeyboard:!1,scrolling:!1})},this._el=null,this._prevPos=[0,0]}enable(e){this._el||(e.addEventListener(te.MOUSE_DOWN,this._onMouseDown),this._el=e)}disable(){const e=this._el;e&&(e.removeEventListener(te.MOUSE_DOWN,this._onMouseDown),window.removeEventListener(te.MOUSE_MOVE,this._onMouseMove,!1),window.removeEventListener(te.MOUSE_UP,this._onMouseUp,!1),this._el=null)}}class O5 extends wt{get scrollable(){return this._scrollable}set scrollable(e){this._scrollable=e}constructor(){super(),this._onTouchStart=e=>{if(e.touches.length>1||this._scrolling)return;const n=e.touches[0];this._isFirstTouch=!0,this._prevPos[0]=n.clientX,this._prevPos[1]=n.clientY,this.trigger(q.INPUT_START,{srcEvent:e,isTouch:!0,isKeyboard:!1})},this._onTouchMove=e=>{if(e.touches.length>1||this._scrolling)return;const n=e.touches[0],r=this._scrollable,i=this._prevPos,s=n.clientX,o=n.clientY,a=s-i[0],l=o-i[1];if(this._isFirstTouch){if(r&&!C5()&&Math.abs(l)>Math.abs(a)){this._scrolling=!0;return}this._isFirstTouch=!1}e.cancelable!==!1&&e.preventDefault(),this.trigger(q.CHANGE,{delta:{x:a,y:l},isTouch:!0,isKeyboard:!1}),i[0]=s,i[1]=o},this._onTouchEnd=e=>{if(e.touches.length!==0)return;const n=e.touches[0],r=this._prevPos;n?(r[0]=n.clientX,r[1]=n.clientY):(r[0]=0,r[1]=0,this.trigger(q.INPUT_END,{isTouch:!0,isKeyboard:!1,scrolling:this._scrolling})),e.cancelable!==!1&&e.preventDefault(),this._scrolling=!1},this._el=null,this._prevPos=[0,0],this._isFirstTouch=!1,this._scrolling=!1,this._scrollable=!1}enable(e){this._el||(e.addEventListener(te.TOUCH_START,this._onTouchStart,{passive:!1}),e.addEventListener(te.TOUCH_MOVE,this._onTouchMove,{passive:!1}),e.addEventListener(te.TOUCH_END,this._onTouchEnd),this._el=e)}disable(){const e=this._el;e&&(e.removeEventListener(te.TOUCH_START,this._onTouchStart),e.removeEventListener(te.TOUCH_MOVE,this._onTouchMove),e.removeEventListener(te.TOUCH_END,this._onTouchEnd),this._el=null)}}class D5 extends wt{get active(){const e=this._pressed;return e.LEFT||e.UP||e.RIGHT||e.DOWN}constructor(){super(),this._onKeyDown=e=>{if(e.location!==KeyboardEvent.DOM_KEY_LOCATION_STANDARD)return;this._updateKeyPress(e,!0);const n=this._getPressedKeyCount();n<=0||(e.preventDefault(),n===1&&!e.repeat&&this.trigger(q.INPUT_START,{srcEvent:e,isTouch:!1,isKeyboard:!0}))},this._onKeyUp=e=>{e.location!==KeyboardEvent.DOM_KEY_LOCATION_STANDARD||(this._updateKeyPress(e,!1),this._getPressedKeyCount()>0)||this.trigger(q.INPUT_END,{isTouch:!1,isKeyboard:!0,scrolling:!1})},this._el=null,this._clearPressedKeys()}enable(e){this._el||(e.addEventListener(te.KEY_DOWN,this._onKeyDown),e.addEventListener(te.KEY_UP,this._onKeyUp),this._el=e,this._clearPressedKeys())}disable(){const e=this._el;e&&(e.removeEventListener(te.KEY_DOWN,this._onKeyDown),e.removeEventListener(te.KEY_UP,this._onKeyUp),this._el=null,this._clearPressedKeys())}update(){const e=this._getDeltaByPressedKeys();(e.x!==0||e.y!==0)&&this.trigger(q.CHANGE,{delta:e,isTouch:!1,isKeyboard:!0})}_clearPressedKeys(){this._pressed=yT.reduce((e,n)=>Object.assign(Object.assign({},e),{[n]:!1}),{})}_updateKeyPress(e,n){const r=this._pressed,i=e.keyCode!=null?qv[e.keyCode]:y5[e.key];i&&(r[i]=n)}_getPressedKeyCount(){return yT.filter(e=>this._pressed[e]).length}_getDeltaByPressedKeys(){const e=this._pressed;let n=0,r=0;return e.LEFT&&(n+=1),e.RIGHT&&(n-=1),e.UP&&(r+=1),e.DOWN&&(r-=1),{x:n,y:r}}}class M5 extends wt{get enabled(){return this._enabled}get enableBlocked(){return this._enableBlocked}get animating(){return this._keyboardInput.active||this._xMotion.activated||this._yMotion.activated}get yaw(){return this._xMotion}get pitch(){return this._yMotion}get scrollable(){return this._touchInput.scrollable}set scrollable(e){this._touchInput.scrollable=e}get pointerScale(){return this._pointerScale}set pointerScale(e){this._pointerScale=e}get keyboardScale(){return this._keyboardScale}set keyboardScale(e){this._keyboardScale=e}get duration(){return this._duration}set duration(e){this._duration=e,this._xMotion.duration=e,this._yMotion.duration=e}get easing(){return this._easing}set easing(e){this._easing=e,this._xMotion.easing=e,this._yMotion.easing=e}get disablePitch(){return this._disablePitch}set disablePitch(e){this._disablePitch=e}get disableYaw(){return this._disableYaw}set disableYaw(e){this._disableYaw=e}get disableKeyboard(){return this._disableKeyboard}set disableKeyboard(e){this._disableKeyboard=e}constructor(e,n,{duration:r=su,easing:i=iu,pointerScale:s=[1,1],keyboardScale:o=[1,1],disablePitch:a=!1,disableYaw:l=!1,disableKeyboard:u=!1}={}){super(),this._onInputStart=c=>{this._changedWhileDragging=!1,this.trigger(q.INPUT_START,Object.assign(Object.assign({},c),{inputType:"rotate"}))},this._onChange=c=>{const h=c.delta,d=1/this._zoomScale,f=this._screenScale,g=this._keyboardScale,m=this._pointerScale;let w;c.isKeyboard?w=[g[0]*d,g[1]*d]:w=[m[0]*f[0]*d,m[1]*f[1]*d];const v=h.x*w[0],y=h.y*w[1];this._xMotion.setNewEndByDelta(v),this._yMotion.setNewEndByDelta(y),this._changedWhileDragging=!0},this._onInputEnd=c=>{this.trigger(q.INPUT_END,Object.assign(Object.assign({},c),{inputType:"rotate"})),!this._changedWhileDragging&&!c.isKeyboard&&!c.scrolling&&this.trigger(q.STATIC_CLICK,{isTouch:c.isTouch}),this._changedWhileDragging=!1},this._controlEl=e,this._pointerScale=s,this._keyboardScale=o,this._duration=r,this._easing=i,this._disablePitch=a,this._disableYaw=l,this._disableKeyboard=u,this._enableBlocked=n,this._mouseInput=new N5,this._touchInput=new O5,this._keyboardInput=new D5,this._xMotion=new kd({duration:r,range:Yv,easing:i}),this._yMotion=new kd({duration:r,range:wT,easing:i}),this._screenScale=[1,1],this._zoomScale=1,this._enabled=!1,this._changedWhileDragging=!1,this._bindInputs()}destroy(){this.disable(),this._mouseInput.off(),this._touchInput.off(),this._keyboardInput.off(),this.off(),this._changedWhileDragging=!1}update(e){if(!this._enabled)return;const n=this._xMotion,r=this._yMotion,i=this._keyboardInput;this._disableKeyboard||i.update(),this._disablePitch||r.update(e),this._disableYaw||n.update(e)}updateRange(e,n){const r=e.getYawRange(n),i=e.getPitchRange(n);this._xMotion.setRange(r.min,r.max),this._yMotion.setRange(i.min,i.max)}setZoomScale(e){this._zoomScale=e}resize(e,n,r,i){const s=Rd(e*at,n)*hs;this._screenScale[0]=e/r,this._screenScale[1]=s/i}enable(){if(this._enabled)return;const e=this._controlEl;this._mouseInput.enable(e),this._touchInput.enable(e),this._keyboardInput.enable(e),this._enabled=!0,this._enableBlocked=!1,this.trigger(q.ENABLE,{control:this,updateCursor:!0})}disable(){this._enabled&&(this._mouseInput.disable(),this._touchInput.disable(),this._keyboardInput.disable(),this._enabled=!1,this.trigger(q.DISABLE,{updateCursor:!0}))}sync(e){this.updateRange(e,e.zoom),this._xMotion.reset(e.yaw),this._yMotion.reset(e.pitch)}_bindInputs(){const e=this._mouseInput,n=this._touchInput,r=this._keyboardInput;e.on(q.INPUT_START,this._onInputStart),e.on(q.CHANGE,this._onChange),e.on(q.INPUT_END,this._onInputEnd),n.on(q.INPUT_START,this._onInputStart),n.on(q.CHANGE,this._onChange),n.on(q.INPUT_END,this._onInputEnd),r.on(q.INPUT_START,this._onInputStart),r.on(q.CHANGE,this._onChange),r.on(q.INPUT_END,this._onInputEnd)}}class L5 extends wt{get scrollable(){return this._scrollable}set scrollable(e){this._scrollable=e}constructor(){super(),this._onWheel=e=>{const n=this._scrollable;if(e.deltaY===0||n)return;e.preventDefault(),e.stopPropagation(),this._inputTimer<0?this.trigger(q.INPUT_START,{srcEvent:e,isTouch:!1,isKeyboard:!1}):this._clearTimer();const r=this._baseScale*e.deltaY;this.trigger(q.CHANGE,{delta:r,isTouch:!1,isKeyboard:!1}),this._inputTimer=window.setTimeout(()=>{this.trigger(q.INPUT_END,{isTouch:!1,isKeyboard:!1,scrolling:!1}),this._inputTimer=-1},su)},this._el=null,this._baseScale=.04,this._scrollable=!1,this._inputTimer=-1}enable(e){this._el||(e.addEventListener(te.WHEEL,this._onWheel,{passive:!1,capture:!1}),this._el=e,this._clearTimer())}disable(){const e=this._el;e&&(e.removeEventListener(te.WHEEL,this._onWheel,!1),this._el=null,this._clearTimer())}_clearTimer(){window.clearTimeout(this._inputTimer),this._inputTimer=-1}}class V5 extends wt{constructor(){super(),this._onTouchMove=e=>{const n=e.touches;if(n.length!==2||!e.cancelable)return;e.preventDefault(),e.stopPropagation();const r=this._prevDistance,i=[n[0].pageX-n[1].pageX,n[0].pageY-n[1].pageY],s=Math.sqrt(i[0]*i[0]+i[1]*i[1])*this._baseScale,o=this._isFirstTouch?0:s-r;this._isFirstTouch&&this.trigger(q.INPUT_START,{srcEvent:e,isTouch:!0,isKeyboard:!1}),this._prevDistance=s,this._isFirstTouch=!1,this.trigger(q.CHANGE,{delta:o,isTouch:!0,isKeyboard:!1})},this._onTouchEnd=e=>{e.touches.length===0&&(this._isFirstTouch||this.trigger(q.INPUT_END,{isTouch:!0,isKeyboard:!1,scrolling:!1}),this._prevDistance=-1,this._isFirstTouch=!0)},this._el=null,this._baseScale=-.2,this._prevDistance=-1,this._isFirstTouch=!0}enable(e){this._el||(e.addEventListener(te.TOUCH_MOVE,this._onTouchMove,{passive:!1,capture:!1}),e.addEventListener(te.TOUCH_END,this._onTouchEnd),this._el=e,this._prevDistance=-1,this._isFirstTouch=!0)}disable(){const e=this._el;e&&(e.removeEventListener(te.TOUCH_MOVE,this._onTouchMove,!1),e.removeEventListener(te.TOUCH_END,this._onTouchEnd),this._el=null)}}class F5 extends wt{get enabled(){return this._enabled}get enableBlocked(){return this._enableBlocked}get animating(){return this._motion.activated}get zoom(){return this._motion.val}get scrollable(){return this._wheelInput.scrollable}set scrollable(e){this._wheelInput.scrollable=e}get range(){return this._motion.range}get scale(){return this._scale}set scale(e){this._scale=e}get duration(){return this._motion.duration}get easing(){return this._motion.easing}constructor(e,n,{scale:r=1,duration:i=su,easing:s=iu}={}){super(),this._onInputStart=o=>{this.trigger(q.INPUT_START,Object.assign(Object.assign({},o),{inputType:"zoom"}))},this._onChange=({delta:o})=>{const a=this._scale,l=o*a;this._motion.setNewEndByDelta(l)},this._onInputEnd=o=>{this.trigger(q.INPUT_END,Object.assign(Object.assign({},o),{inputType:"zoom"}))},this._scale=r,this._controlEl=e,this._enableBlocked=n,this._wheelInput=new L5,this._pinchInput=new V5,this._motion=new kd({duration:i,easing:s,range:Yv}),this._enabled=!1,this._bindInputs()}destroy(){this.disable(),this._wheelInput.off(),this._pinchInput.off(),this.off()}update(e){if(!this._enabled)return;this._motion.update(e)}enable(){if(this._enabled)return;const e=this._controlEl;this._wheelInput.enable(e),this._pinchInput.enable(e),this._enabled=!0,this._enableBlocked=!1,this.trigger(q.ENABLE,{control:this,updateCursor:!1})}disable(){this._enabled&&(this._wheelInput.disable(),this._pinchInput.disable(),this._enabled=!1,this.trigger(q.DISABLE,{updateCursor:!1}))}sync(e){const n=this._motion,r=e.getZoomRange();n.setRange(r.min,r.max),n.reset(r.current)}_bindInputs(){const e=this._wheelInput,n=this._pinchInput;e.on(q.INPUT_START,this._onInputStart),e.on(q.CHANGE,this._onChange),e.on(q.INPUT_END,this._onInputEnd),n.on(q.INPUT_START,this._onInputStart),n.on(q.CHANGE,this._onChange),n.on(q.INPUT_END,this._onInputEnd)}}const bt={PITCH_DELTA:1,YAW_DELTA_BY_ROLL:2,YAW_DELTA_BY_YAW:3};bt[bt.PITCH_DELTA]={targetAxis:[0,1,0],meshPoint:[0,0,1]},bt[bt.YAW_DELTA_BY_ROLL]={targetAxis:[0,1,0],meshPoint:[1,0,0]},bt[bt.YAW_DELTA_BY_YAW]={targetAxis:[1,0,0],meshPoint:[0,0,1]};class U5 extends wt{get enabled(){return this._enabled}get orientationUpdated(){return this._orientationUpdated}get ignoreRoll(){return this._ignoreRoll}set ignoreRoll(e){this._ignoreRoll=e}constructor(){super(),this._onDeviceOrientation=e=>{const n=this._orientation,{alpha:r,beta:i,gamma:s}=e;r==null||i==null||s==null||(n.alpha=r,n.beta=i,n.gamma=s,this._orientationUpdated=!0,this._needsCalibrate&&(this._needsCalibrate=!1,this._calibrateSensor()))},this._updateScreenOrientation=()=>{window.screen&&window.screen.orientation&&window.screen.orientation.angle!==void 0?this._screenOrientation=screen.orientation.angle:window.orientation!==void 0?this._screenOrientation=window.orientation>=0?window.orientation:360+window.orientation:this._screenOrientation=0},this.quaternion=Er(),this._orientation={alpha:0,beta:90,gamma:0},this._yawOrigin=0,this._yawOffset=0,this._orientationUpdated=!1,this._screenOrientation=0,this._needsCalibrate=!0,this._enabled=!1}enable(){this._enabled||(window.addEventListener(te.DEVICE_ORIENTATION,this._onDeviceOrientation),window.addEventListener(te.ORIENTATION_CHANGE,this._updateScreenOrientation),this._updateScreenOrientation(),this._orientationUpdated=!1,this._needsCalibrate=!0,this._enabled=!0)}disable(){this._enabled&&(window.removeEventListener(te.DEVICE_ORIENTATION,this._onDeviceOrientation),window.removeEventListener(te.ORIENTATION_CHANGE,this._updateScreenOrientation),this._enabled=!1)}update(){this._updateRotation(),this._orientationUpdated=!1}collectDelta(){if(!this._orientationUpdated)return{pitch:0,yaw:0};const e=nu(this.quaternion);return this._updateRotation(),this._orientationUpdated=!1,this._toEulerDelta(e,this.quaternion)}setInitialRotation(e){this._yawOrigin=e}_calibrateSensor(){const e=this._yawOrigin,n=this.quaternion;this._yawOffset=0,this._updateRotation();const{yaw:r}=CT(n);this._yawOffset=r-e,this._updateRotation(),this._needsCalibrate=!1}_updateRotation(){const e=this.quaternion,{alpha:n,beta:r,gamma:i}=this._orientation;sT(e),lT(e,e,(n-this._yawOffset)*at),aT(e,e,r*at),uT(e,e,-i*at);const s=Er(),o=-this._screenOrientation*.5*at,a=Y4(-Math.sqrt(.5),0,0,Math.sqrt(.5));J4(s,0,Math.sin(o),0,Math.cos(o)),oT(e,e,s),oT(e,e,a),Do(e,e)}_toEulerDelta(e,n){return{yaw:this._getDeltaYaw(e,n),pitch:this._getDeltaPitch(e,n)}}_getDeltaYaw(e,n){const r=this._getRotationDelta(e,n,bt.YAW_DELTA_BY_YAW);return this._getRotationDelta(e,n,bt.YAW_DELTA_BY_ROLL)*Math.sin(this._extractPitchFromQuat(n))+r}_getDeltaPitch(e,n){return this._getRotationDelta(e,n,bt.PITCH_DELTA)}_getRotationDelta(e,n,r){const i=We(bt[r].targetAxis[0],bt[r].targetAxis[1],bt[r].targetAxis[2]),s=bt[r].meshPoint,o=nu(e),a=nu(n);Do(o,o),Do(a,a);let l=We(0,0,1),u=We(0,0,1);ln(l,l,o),ln(u,u,a),ln(i,i,a);const h=rT(i,Oo(Sn(),l,u))>0?1:-1,d=We(s[0],s[1],s[2]);let f;r!==bt.YAW_DELTA_BY_YAW?f=We(0,h,0):f=We(h,0,0),ln(d,d,a),ln(f,f,a);const g=d,m=f,w=Sn();Oo(w,g,m),nT(w,w);const v=w[0],y=w[1],_=w[2];u=We(s[0],s[1],s[2]),ln(u,u,a),l=We(s[0],s[1],s[2]),ln(l,l,o);let E=Math.abs(l[0]*v+l[1]*y+l[2]*_);const I=Sn();F4(I,l,U4(Sn(),w,E));let A=(I[0]*u[0]+I[1]*u[1]+I[2]*u[2])/(zv(I)*zv(u));A>1&&(A=1);const T=Math.acos(A),C=Oo(Sn(),u,I);E=v*C[0]+y*C[1]+_*C[2];let N;return r!==bt.YAW_DELTA_BY_YAW?N=E>0?1:-1:N=E<0?1:-1,T*N*h*hs}_extractPitchFromQuat(e){const n=We(0,0,1);return ln(n,n,e),-1*Math.atan2(n[1],Math.sqrt(Math.pow(n[0],2)+Math.pow(n[2],2)))}}class Zv extends wt{get enabled(){return this._input.enabled}get enableBlocked(){return this._enableBlocked}get animating(){return this._input.enabled&&this._input.orientationUpdated}get ignoreRoll(){return this._ignoreRoll}set ignoreRoll(e){this._ignoreRoll=e}static isAvailable(){return Lt(this,void 0,void 0,function*(){if(!DeviceMotionEvent)return!1;let e;const n=()=>new Promise(i=>{e=s=>{i(s.rotationRate&&s.rotationRate.alpha!=null)},window.addEventListener(te.DEVICE_MOTION,e)}),r=()=>new Promise(i=>{setTimeout(()=>i(!1),1e3)});return Promise.race([n(),r()]).then(i=>(window.removeEventListener(te.DEVICE_MOTION,e),i))})}static requestSensorPermission(){return Lt(this,void 0,void 0,function*(){return b5()?DeviceMotionEvent.requestPermission().then(e=>e==="granted").catch(()=>!1):!0})}constructor(e,{ignoreRoll:n=!0}={}){super(),this._enableBlocked=e,this._ignoreRoll=n,this._input=new U5}destroy(){this.disable(),this._input.off(),this.off()}update(e,n,r,i){this._ignoreRoll?this._updateYawPitch(e,n,r,i):this._updateQuaternion(e,i)}enable(){this._input.enabled||(this._input.enable(),this._enableBlocked=!1,this.trigger(q.ENABLE,{control:this,updateCursor:!1}))}disable(){this._input.enabled&&(this._input.disable(),this.trigger(q.DISABLE,{updateCursor:!1}))}sync(){}_updateYawPitch(e,n,r,i){const s=this._input;if(!s.enabled)return;const{yaw:o,pitch:a}=s.collectDelta();n.add(o),r.add(a),e.lookAt({yaw:n.val,pitch:r.val,zoom:i})}_updateQuaternion(e,n){const r=this._input;r.enabled&&(r.update(),e.rotate(r.quaternion,n))}}class $5{get useGrabCursor(){return this._useGrabCursor}set useGrabCursor(e){e!==this._useGrabCursor&&(this._useGrabCursor=e,e&&this._enabled?this._setCursor(fi.GRAB):e||this._setCursor(fi.NONE))}get disableContextMenu(){return this._disableContextMenu}set disableContextMenu(e){e!==this._disableContextMenu&&(this._disableContextMenu=e,e&&this._enabled?this._blockContextMenu():e||this._restoreContextMenu())}get scrollable(){return this._rotateControl.scrollable}set scrollable(e){this._rotateControl.scrollable=e}get wheelScrollable(){return this._zoomControl.scrollable}set wheelScrollable(e){this._zoomControl.scrollable=e}get ignoreZoomScale(){return this._ignoreZoomScale}set ignoreZoomScale(e){this._ignoreZoomScale=e}get enabled(){return this._enabled}get rotate(){return this._rotateControl}get zoom(){return this._zoomControl}get gyro(){return this._gyroControl}get animating(){return this._rotateControl.animating||this._zoomControl.animating||this._gyroControl.animating}constructor(e,n,{useGrabCursor:r,scrollable:i,wheelScrollable:s,disableContextMenu:o,rotate:a,zoom:l,gyro:u}){this._preventContextMenu=c=>{c.preventDefault()},this._onInputStart=c=>{this._useGrabCursor&&!c.isKeyboard&&this._setCursor(fi.GRABBING)},this._onInputEnd=c=>{this._useGrabCursor&&!c.isKeyboard&&this._setCursor(fi.GRAB)},this._onEnable=({control:c,updateCursor:h})=>{h&&this._useGrabCursor&&this._setCursor(fi.GRAB),c.sync(this._camera)},this._onDisable=({updateCursor:c})=>{c&&this._setCursor(fi.NONE)},this._onCameraAnimationEnd=({animation:c})=>{c.getFinishPromise().then(()=>{this.sync()})},this._useGrabCursor=r,this._disableContextMenu=o,this._camera=n,this._controlEl=e,this._ignoreZoomScale=!1,this._enabled=!1,this._rotateControl=new M5(e,!a,au(a)),this._zoomControl=new F5(e,!l,au(l)),this._gyroControl=new Zv(!u,au(u)),this._rotateControl.scrollable=i,this._zoomControl.scrollable=s,this._bindEvents()}destroy(){this.disable(),this._rotateControl.destroy(),this._zoomControl.destroy(),this._setCursor(fi.NONE)}resize(e,n){const r=this._camera;this._rotateControl.resize(r.fov,r.aspect,e,n)}enable(){return Lt(this,void 0,void 0,function*(){this._enabled||(this._rotateControl.enableBlocked||this._rotateControl.enable(),this._zoomControl.enableBlocked||this._zoomControl.enable(),this._gyroControl.enableBlocked||(yield Zv.isAvailable())&&this._gyroControl.enable(),this.sync(),this._disableContextMenu&&this._blockContextMenu(),this._enabled=!0)})}disable(){this._enabled&&(this._rotateControl.disable(),this._zoomControl.disable(),this._gyroControl.disable(),this._restoreContextMenu(),this._enabled=!1)}update(e){const n=this._camera,r=this._rotateControl,i=this._zoomControl,s=this._gyroControl;i.update(e);const o=R5(n.fov,i.zoom),a=this._ignoreZoomScale?1:Math.max(o,1);r.setZoomScale(a),r.updateRange(n,o),r.update(e);const l=r.yaw,u=r.pitch;s.enabled?s.update(n,l,u,o):n.lookAt({yaw:l.val,pitch:u.val,zoom:o})}sync(){const e=this._camera;this._zoomControl.sync(e),this._rotateControl.sync(e)}_blockContextMenu(){this._controlEl.addEventListener(te.CONTEXT_MENU,this._preventContextMenu)}_restoreContextMenu(){this._controlEl.removeEventListener(te.CONTEXT_MENU,this._preventContextMenu)}_setCursor(e){if(!this._useGrabCursor&&e!==fi.NONE)return;const n=this._controlEl;n.style.cursor=e}_bindEvents(){const e=this._rotateControl,n=this._zoomControl;e.on(q.INPUT_START,this._onInputStart),e.on(q.INPUT_END,this._onInputEnd),e.on(q.ENABLE,this._onEnable),e.on(q.DISABLE,this._onDisable),n.on(q.ENABLE,this._onEnable),n.on(q.DISABLE,this._onDisable),this._camera.on(_T.ANIMATION_END,this._onCameraAnimationEnd)}}class bT{constructor({width:e,height:n,flipY:r}){this.width=e,this.height=n,this.flipY=r,this.wrapS=WebGLRenderingContext.CLAMP_TO_EDGE,this.wrapT=WebGLRenderingContext.CLAMP_TO_EDGE}destroy(){}isVideo(){return!1}isCube(){return!1}}class RT extends bT{constructor({source:e,width:n,height:r,flipY:i}){super({width:n,height:r,flipY:i}),this.source=e}}class j5 extends RT{destroy(){const e=this.source;e.pause(),e.removeAttribute("src"),e.load()}isVideo(){return!0}isPaused(){const e=this.source;return e.paused||e.ended||e.readyState<=2}hasAudio(){const e=this.source;return e.audioTracks?e.audioTracks.length>0:e.webkitAudioDecodedByteCount!=null?e.webkitAudioDecodedByteCount>0:e.mozHasAudio!=null?e.mozHasAudio:!0}}class z5 extends bT{constructor({sources:e,width:n,height:r,flipY:i}){super({width:n,height:r,flipY:i}),this.sources=e}isCube(){return!0}}class B5{constructor(){this._loadChecker=new v5}load(e,n){return Lt(this,void 0,void 0,function*(){if(n)return this.loadVideo(e,au(n));if(Array.isArray(e)&&e.length>1)return this.loadCubeImage(e);{const r=Array.isArray(e)?e[0]:e;return this.loadImage(r)}})}loadImage(e){return Lt(this,void 0,void 0,function*(){const n=this._toImageArray(e);return this._load(n,r=>{const i=n[0];r(new RT({source:i,width:i.naturalWidth,height:i.naturalHeight,flipY:!0}))})})}loadCubeImage(e){return Lt(this,void 0,void 0,function*(){const n=this._toImageArray(e);return this._load(n,r=>{r(new z5({sources:n,width:n[0].naturalWidth,height:n[0].naturalHeight,flipY:!1}))})})}loadVideo(e,n){return Lt(this,void 0,void 0,function*(){const r=Object.assign({autoplay:!0,muted:!0,loop:!1,volume:1},n),i=this._toVideoElement(e,r);return this._load([i],s=>{const{autoplay:o,muted:a}=r;i.currentTime=0,o&&a&&i.play().catch(()=>{}),s(new j5({source:i,width:i.videoWidth,height:i.videoHeight,flipY:!0}))})})}_load(e,n){const r=this._loadChecker;return new Promise((i,s)=>{r.once("ready",o=>{o.errorCount>0||n(i)}),r.once("error",s),r.check(e)})}_toImageArray(e){return(Array.isArray(e)?e:[e]).map(r=>{if(Xv(r)){const i=new Image;return i.crossOrigin="anonymous",i.src=r,i}else return r})}_toVideoElement(e,{muted:n,loop:r,volume:i}){if(e instanceof HTMLVideoElement)return e;const s=document.createElement("video");return s.crossOrigin="anonymous",s.playsInline=!0,s.setAttribute("webkit-playsinline",""),s.muted=n,s.volume=i,s.loop=r,Array.isArray(e)?e.forEach(a=>this._appendSourceElement(s,a)):this._appendSourceElement(s,e),s.querySelectorAll("source").length>0&&s.readyState<1&&s.load(),s}_appendSourceElement(e,n){if(n instanceof HTMLSourceElement)return n;const r=document.createElement("source");r.src=n,e.appendChild(r)}}class H5{constructor(e,n=window){this.maxDeltaTime=e,this._context=n,this._rafId=-1,this._rafTimer=-1,this._lastUpdateTime=-1}start(e){const n=this._context;if(!n||!e||this._rafId>=0||this._rafTimer>=0)return;const r=(i,s)=>{const o=Date.now(),a=Math.min(o-this._lastUpdateTime,this.maxDeltaTime*1e3);e(a,s),this._lastUpdateTime=o,this._rafId=n.requestAnimationFrame(r)};this._lastUpdateTime=Date.now(),this._rafId=n.requestAnimationFrame(r)}stop(){this._rafId>=0&&this._context.cancelAnimationFrame(this._rafId),this._rafTimer>=0&&clearTimeout(this._rafTimer),this._rafId=-1,this._rafTimer=-1}changeContext(e){this.stop(),this._context=e}}class G5{get useResizeObserver(){return this._useResizeObserver}get enabled(){return this._enabled}constructor(e,n){this._skipFirstResize=(()=>{let r=!0;return()=>{if(r){r=!1;return}this._onResize()}})(),this._useResizeObserver=e,this._enabled=!1,this._resizeObserver=null,this._onResize=n}enable(e){if(this._enabled&&this.disable(),this._useResizeObserver&&window.ResizeObserver){const n=e.getBoundingClientRect(),r=n.width!==0||n.height!==0,i=new ResizeObserver(r?this._skipFirstResize:this._onResize);i.observe(e),this._resizeObserver=i}else window.addEventListener(te.RESIZE,this._onResize);return this._enabled=!0,this}disable(){if(!this._enabled)return this;const e=this._resizeObserver;return e?(e.disconnect(),this._resizeObserver=null):window.removeEventListener(te.RESIZE,this._onResize),this._enabled=!1,this}}class W5{get enabled(){return this._enabled}get enableBlocked(){return this._enableBlocked}get playing(){return this._enabled&&!this._interrupted}get delay(){return this._delay}set delay(e){this._delay=e}get delayOnMouseLeave(){return this._delayOnMouseLeave}set delayOnMouseLeave(e){this._delayOnMouseLeave=e}get speed(){return this._speed}set speed(e){this._speed=e}get pauseOnHover(){return this._pauseOnHover}set pauseOnHover(e){this._pauseOnHover=e}get canInterrupt(){return this._canInterrupt}set canInterrupt(e){this._canInterrupt=e}get disableOnInterrupt(){return this._disableOnInterrupt}set disableOnInterrupt(e){this._disableOnInterrupt=e}constructor(e,n,r){this._onInputStart=()=>{this._canInterrupt&&(this._interrupted=!0,this._clearTimeout())},this._onInputEnd=()=>{this._setUninterruptedAfterDelay(this._delay)},this._onGyroEnable=()=>{this.disable()},this._onMouseEnter=()=>{this._pauseOnHover&&(this._interrupted=!0,this._hovering=!0)},this._onMouseLeave=()=>{this._pauseOnHover&&(this._hovering=!1,this._setUninterruptedAfterDelay(this._delayOnMouseLeave))},this._camera=e.camera,this._control=e.control,this._element=n,this._enabled=!1,this._interrupted=!1,this._interruptionTimer=-1,this._hovering=!1;const{delay:i=2e3,delayOnMouseLeave:s=0,speed:o=1,pauseOnHover:a=!1,canInterrupt:l=!0,disableOnInterrupt:u=!1}=au(r);this._enableBlocked=!r,this._delay=i,this._delayOnMouseLeave=s,this._speed=o,this._pauseOnHover=a,this._canInterrupt=l,this._disableOnInterrupt=u}destroy(){this.disable()}update(e){if(!this._enabled)return;if(this._interrupted){this._disableOnInterrupt&&this.disable();return}const n=this._camera,r=-this._speed*e/100;n.yaw=bd(n.yaw+r,0,360)}enable(){const e=this._control,n=this._element;this._enabled||e.gyro.enabled||(e.rotate.on(q.INPUT_START,this._onInputStart),e.rotate.on(q.INPUT_END,this._onInputEnd),e.zoom.on(q.INPUT_START,this._onInputStart),e.zoom.on(q.INPUT_END,this._onInputEnd),e.gyro.on(q.ENABLE,this._onGyroEnable),n.addEventListener(te.MOUSE_ENTER,this._onMouseEnter,!1),n.addEventListener(te.MOUSE_LEAVE,this._onMouseLeave,!1),this._enabled=!0,this._enableBlocked=!1)}enableAfterDelay(){this.enable(),this._interrupted=!0,this._setUninterruptedAfterDelay(this._delay)}disable(){if(!this._enabled)return;const e=this._control,n=this._element;e.rotate.off(q.INPUT_START,this._onInputStart),e.rotate.off(q.INPUT_END,this._onInputEnd),e.zoom.off(q.INPUT_START,this._onInputStart),e.zoom.off(q.INPUT_END,this._onInputEnd),e.gyro.off(q.ENABLE,this._onGyroEnable),n.removeEventListener(te.MOUSE_ENTER,this._onMouseEnter,!1),n.removeEventListener(te.MOUSE_LEAVE,this._onMouseLeave,!1),this._enabled=!1,this._interrupted=!1,this._hovering=!1,this._clearTimeout()}_setUninterruptedAfterDelay(e){this._hovering||(this._clearTimeout(),e>0?this._interruptionTimer=window.setTimeout(()=>{this._interrupted=!1,this._interruptionTimer=-1},e):(this._interrupted=!1,this._interruptionTimer=-1))}_clearTimeout(){this._interruptionTimer>=0&&(window.clearTimeout(this._interruptionTimer),this._interruptionTimer=-1)}}class Q5 extends wt{constructor(e,n={}){super(),this.destroy=()=>{this.exit(),this.off()},this._onSessionEnd=()=>{this.exit(),this.trigger(Je.VR_END)},this._xrSession=null,this._xrRefSpace=null,this._ctx=e,this._options=n}isAvailable(){return Lt(this,void 0,void 0,function*(){const e=window.navigator.xr;return e?e.isSessionSupported(ET).then(n=>n).catch(()=>!1):!1})}enter(){return Lt(this,void 0,void 0,function*(){const e=this._ctx,n=window.navigator.xr;if(!n)return;yield Zv.requestSensorPermission();const r=Object.assign({requiredFeatures:[xT]},this._options);yield e.makeXRCompatible();const i=yield n.requestSession(ET,r);e.bindXRLayer(i);const s=yield i.requestReferenceSpace(xT);this._setSession(i,s),this.trigger(Je.VR_START,{session:i})})}exit(){const e=this._xrSession;e&&e.end().catch(()=>{}),this._xrSession=null,this._xrRefSpace=null}canRender(e){const n=this._xrRefSpace;return n?!!e.getViewerPose(n):!1}getEyeParams(e){const n=e.session,r=e.getViewerPose(this._xrRefSpace);if(!r)return null;const i=n.renderState.baseLayer;return i?r.views.map(s=>{const o=i.getViewport(s),a=s.transform.inverse.matrix;return{viewport:o,vMatrix:a,pMatrix:s.projectionMatrix}}):null}_setSession(e,n){this._xrSession=e,this._xrRefSpace=n,e.addEventListener(te.XR_END,this._onSessionEnd)}}class e0{constructor(e,n){this.element=e,this.position=n}}class q5{constructor(e,n,{zoom:r=!1}){this._containerEl=IT(`.${Wn.HOTSPOT_CONTAINER}`,e),this._renderer=n,this._hotspots=[],this._zoom=r}refresh(){const e=this._containerEl;if(!e)return;const n=[].slice.apply(e.querySelectorAll(`.${Wn.HOTSPOT}`));this._hotspots=n.map(r=>this._parseHotspot(r))}render(e){const n=this._hotspots,r=this._renderer.width*.5,i=this._renderer.height*.5,s=e.zoom,o="translate(-50%, -50%)",a=this._zoom?`scale(${s})`:"";n.forEach(l=>{const u=l.position,c=Sn();if(V4(c,u),iT(c,c,e.viewMatrix),iT(c,c,e.projectionMatrix),c[2]>1||c[2]<0){l.element.classList.remove(Wn.HOTSPOT_VISIBLE);return}const h=e5(c[0]*r+r,-c[1]*i+i);l.element.classList.add(Wn.HOTSPOT_VISIBLE),l.element.style.transform=[o,`translate(${h[0]}px, ${h[1]}px)`,a].join(" ")})}_parseHotspot(e){const n=e.dataset.yaw,r=e.dataset.pitch,i=e.dataset.position;if(n||r){const s=n?parseFloat(n):0,o=r?parseFloat(r):0,a=this._yawPitchToVec3(s,o);return new e0(e,a)}else if(i){const s=i.split(" ").map(o=>parseFloat(o));if(s.length<3)throw new xr(Vt.MESSAGES.INSUFFICIENT_ARGS(i,'hotspot attribute "data-position"'),Vt.CODES.INSUFFICIENT_ARGS);return new e0(e,We(s[0],s[1],s[2]))}else{const s=We(0,0,-1);return new e0(e,s)}}_yawPitchToVec3(e,n){const r=e*at,i=n*at,s=Sn();return s[1]=Math.sin(i),s[2]=Math.cos(i),s[0]=s[2]*Math.sin(-r),s[2]=-s[2]*Math.cos(-r),s}}class K5{get count(){return this.geometry.indicies.count}constructor(e,n,r){this.obj=e,this.geometry=n,this.buffers=r}}class Y5{get canvas(){return this._canvas}get maxTextureSize(){return this._maxTextureSize}get isWebGL2(){return this._isWebGL2}get supportVAO(){return this._isWebGL2||!!this._extensions.vao}get lost(){return this._contextLost}get debug(){return this._debug}constructor(e,n){this._onContextLost=()=>{this._canvas.classList.add(Wn.CTX_LOST),this._contextLost=!0},this._onContextRestore=()=>{this._canvas.classList.remove(Wn.CTX_LOST),this._contextLost=!1},this._canvas=e,this._contextLost=!1,this._debug=n,this._extensions={vao:null,loseContext:null}}init(){const e=this._canvas,{gl:n,isWebGL2:r}=this._getContext(e);this._gl=n,this._maxTextureSize=n.getParameter(n.MAX_TEXTURE_SIZE),this._isWebGL2=r,this._isWebGL2||(this._extensions.vao=n.getExtension("OES_vertex_array_object")),this._extensions.loseContext=n.getExtension("WEBGL_lose_context"),e.addEventListener(te.CONTEXT_LOST,this._onContextLost),e.addEventListener(te.CONTEXT_RESTORED,this._onContextRestore)}destroy(){const e=this._gl,n=this._canvas;e&&(e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),n.removeEventListener(te.CONTEXT_LOST,this._onContextLost),n.removeEventListener(te.CONTEXT_RESTORED,this._onContextRestore)}forceLoseContext(){const e=this._extensions.loseContext;e&&e.loseContext()}forceRestoreContext(){const e=this._extensions.loseContext;e&&e.restoreContext()}clear(){const e=this._gl;e.clear(e.COLOR_BUFFER_BIT)}resize(){const e=this._gl;e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight)}viewport(e,n,r,i){this._gl.viewport(e,n,r,i)}createVAO(e,n){const r=this._createNativeVAO(),i=new K5(r,e,{indicies:this._createBuffer(),position:this._createBuffer(),uv:this._createBuffer()});return r&&(this._bindNativeVAO(r),this._supplyGeometryData(i,n),this._bindNativeVAO(null),this._unbindBuffers()),i}draw(e,n){const r=this._gl;e.obj?this._bindNativeVAO(e.obj):this._supplyGeometryData(e,n),r.drawElements(r.TRIANGLES,e.count,r.UNSIGNED_SHORT,0),e.obj?this._bindNativeVAO(null):this._unbindBuffers()}releaseVAO(e){e.obj&&this._deleteNativeVAO(e.obj),this._deleteBuffer(e.buffers.indicies),this._deleteBuffer(e.buffers.position),this._deleteBuffer(e.buffers.uv)}getUniformLocations(e,n){const r=this._gl,i=Object.keys(n).reduce((s,o)=>(s[o]=r.getUniformLocation(e,o),s),{});return Object.assign(Object.assign({},this._getCommonUniformLocations(e)),i)}updateCommonUniforms(e,n,r){const i=this._gl,s=r.uniformLocations,o=e.matrix,a=tu();tT(a,n.viewMatrix,o),i.uniformMatrix4fv(s.uMVMatrix,!1,a),i.uniformMatrix4fv(s.uPMatrix,!1,n.projectionMatrix)}updateVRUniforms(e,n,r,i){const s=this._gl,o=e.uniformLocations;s.uniformMatrix4fv(o.uMVMatrix,!1,n),s.uniformMatrix4fv(o.uPMatrix,!1,r),o.uEye&&s.uniform1f(o.uEye,i)}updateUniforms(e){const n=this._gl,r=e.uniforms,i=e.uniformLocations;for(const s in r){const o=r[s],a=i[s];o&&o.needsUpdate&&o.update(n,a,this._isWebGL2)}}releaseShaderResources(e){const n=this._gl,r=e.uniforms;for(const i in r){const s=r[i];s&&s.needsUpdate&&s.destroy(n)}n.deleteProgram(e.program)}useProgram(e){this._gl.useProgram(e.program)}createProgram(e,n){const r=this._gl,i=r.createProgram(),s=this._compileShader(r.VERTEX_SHADER,e),o=this._compileShader(r.FRAGMENT_SHADER,n);if(r.attachShader(i,s),r.attachShader(i,o),r.bindAttribLocation(i,0,"position"),r.bindAttribLocation(i,1,"uv"),r.linkProgram(i),this._debug&&!r.getProgramParameter(i,r.LINK_STATUS)){let a=null;throw r.getShaderParameter(s,r.COMPILE_STATUS)?r.getShaderParameter(o,r.COMPILE_STATUS)||(a=r.getShaderInfoLog(o)):a=r.getShaderInfoLog(s),new xr(Vt.MESSAGES.FAILED_LINKING_PROGRAM(r.getProgramInfoLog(i),a),Vt.CODES.FAILED_LINKING_PROGRAM)}return r.deleteShader(s),r.deleteShader(o),i}createWebGLTexture(e){const n=this._gl,r=n.createTexture();if(n.bindTexture(n.TEXTURE_2D,r),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e.wrapS),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e.wrapT),!e.isVideo()&&this._isWebGL2){const i=n;i.texStorage2D(i.TEXTURE_2D,1,i.RGBA8,e.width,e.height)}return r}createWebGLCubeTexture(e,n){const r=this._gl,i=r.createTexture();if(r.bindTexture(r.TEXTURE_CUBE_MAP,i),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_WRAP_S,e.wrapS),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_WRAP_T,e.wrapT),this._isWebGL2){const s=r;s.texStorage2D(s.TEXTURE_CUBE_MAP,1,s.RGBA8,n,n)}return i}makeXRCompatible(){return Lt(this,void 0,void 0,function*(){const e=this._gl,n=e.getContextAttributes();n&&n.xrCompatible!==!0&&(yield e.makeXRCompatible())})}bindXRLayer(e){const n=this._gl,r=new XRWebGLLayer(e,n);e.updateRenderState({baseLayer:r})}bindXRFrame(e){const n=this._gl,i=e.session.renderState.baseLayer;n.bindFramebuffer(n.FRAMEBUFFER,i.framebuffer)}useDefaultFrameBuffer(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)}_createBuffer(){return this._gl.createBuffer()}_deleteBuffer(e){return this._gl.deleteBuffer(e)}_createNativeVAO(){const e=this._gl;if(this._isWebGL2)return e.createVertexArray();{const n=this._extensions.vao;return(n==null?void 0:n.createVertexArrayOES())||null}}_bindNativeVAO(e){const n=this._gl;if(this._isWebGL2)n.bindVertexArray(e);else{const r=this._extensions.vao;r==null||r.bindVertexArrayOES(e)}}_deleteNativeVAO(e){const n=this._gl;if(this._isWebGL2)n.deleteVertexArray(e);else{const r=this._extensions.vao;r==null||r.deleteVertexArrayOES(e)}}_supplyGeometryData(e,n){const r=e.geometry;this._supplyIndiciesData(r.indicies,e.buffers.indicies),this._supplyAttributeData(r.vertices,n.program,"position",e.buffers.position),this._supplyAttributeData(r.uvs,n.program,"uv",e.buffers.uv)}_unbindBuffers(){const e=this._gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindBuffer(e.ARRAY_BUFFER,null)}_supplyIndiciesData(e,n){const r=this._gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,n),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.data,r.STATIC_DRAW)}_supplyAttributeData(e,n,r,i){const s=this._gl,o=s.getAttribLocation(n,r);o<0||(s.bindBuffer(s.ARRAY_BUFFER,i),s.bufferData(s.ARRAY_BUFFER,e.data,s.STATIC_DRAW),s.vertexAttribPointer(o,e.itemSize,s.FLOAT,!1,0,0),s.enableVertexAttribArray(o))}_compileShader(e,n){const r=this._gl,i=r.createShader(e);return r.shaderSource(i,n),r.compileShader(i),i}_getCommonUniformLocations(e){const n=this._gl;return{uMVMatrix:n.getUniformLocation(e,"uMVMatrix"),uPMatrix:n.getUniformLocation(e,"uPMatrix")}}_getContext(e){const n=["webgl2","webgl","experimental-webgl","webkit-3d","moz-webgl"];let r=null,i=!1;const s={preserveDrawingBuffer:!1,antialias:!1},o=a=>a.statusMessage;e.addEventListener(te.CONTEXT_CREATE_ERROR,o);for(const a of n){try{r=e.getContext(a,s),i=a==="webgl2"}catch{}if(r)break}if(e.removeEventListener(te.CONTEXT_CREATE_ERROR,o),!r)throw new xr(Vt.MESSAGES.WEBGL_NOT_SUPPORTED,Vt.CODES.WEBGL_NOT_SUPPORTED);return{gl:r,isWebGL2:i}}}class X5{get canvas(){return this._canvas}get width(){return this._elementSize.x}get height(){return this._elementSize.y}get pixelRatio(){return this._pixelRatio}get aspect(){return this._elementSize.x/this._elementSize.y}constructor(e,n){this._canvas=e,this._elementSize={x:0,y:0},this._pixelRatio=1,this.ctx=new Y5(e,n)}destroy(){const e=this._canvas;this.ctx.destroy(),e.width=1,e.height=1}resize(){const e=this._canvas,n=this._elementSize,r=window.devicePixelRatio;n.x=e.clientWidth,n.y=e.clientHeight,e.width=n.x*r,e.height=n.y*r,this._pixelRatio=r,this.ctx.resize()}render(e,n){const r=this.ctx;r.lost||(r.clear(),r.useProgram(e.program),r.updateCommonUniforms(e,n,e.program),e.update({camera:n}),r.updateUniforms(e.program),r.draw(e.vao,e.program))}renderVR(e,n,r){const i=this.ctx,s=n.getEyeParams(r);!s||!e||(i.bindXRFrame(r),i.useProgram(e.program),i.updateUniforms(e.program),s.forEach((o,a)=>{const l=o.viewport,u=tT(tu(),o.vMatrix,e.matrix);i.viewport(l.x,l.y,l.width,l.height),i.updateVRUniforms(e.program,u,o.pMatrix,a),i.draw(e.vao,e.program)}))}}let Fo=class extends wt{get rootEl(){return this._rootEl}get renderer(){return this._renderer}get camera(){return this._camera}get control(){return this._control}get vr(){return this._vr}get hotspot(){return this._hotspot}get plugins(){return this._plugins}get projection(){return this._projection}set projection(e){this._initialized&&e?this.load(e):this._projection=e}get mesh(){return this._mesh}get initialized(){return this._initialized}get autoplay(){return this._autoplay}get autoInit(){return this._autoInit}get autoResize(){return this._autoResize}get canvasSelector(){return this._canvasSelector}get useResizeObserver(){return this._useResizeObserver}get tabIndex(){return this._tabIndex}set tabIndex(e){const n=this._renderer.canvas;this._tabIndex=e,e!=null?n.tabIndex=e:n.removeAttribute("tabindex")}get maxDeltaTime(){return this._animator.maxDeltaTime}set maxDeltaTime(e){this._animator.maxDeltaTime=e}get debug(){return this._debug}set debug(e){this._debug=e}get initialYaw(){return this._camera.initialYaw}set initialYaw(e){this._camera.initialYaw=e}get initialPitch(){return this._camera.initialPitch}set initialPitch(e){this._camera.initialPitch=e}get initialZoom(){return this._camera.initialZoom}set initialZoom(e){this._camera.initialZoom=e}get yawRange(){return this._camera.yawRange}set yawRange(e){this._camera.yawRange=e,this._projection&&this._projection.updateCamera(this._camera)}get pitchRange(){return this._camera.pitchRange}set pitchRange(e){this._camera.pitchRange=e,this._projection&&this._projection.updateCamera(this._camera)}get zoomRange(){return this._camera.zoomRange}set zoomRange(e){this._camera.zoomRange=e,this._projection&&this._projection.updateCamera(this._camera)}get fov(){return this._camera.fov}set fov(e){const n=this._camera,r=this._control;n.fov=e,n.updateMatrix(),r.sync()}get rotate(){return this._control.rotate}get zoom(){return this._control.zoom}get gyro(){return this._control.gyro}get useGrabCursor(){return this._control.useGrabCursor}set useGrabCursor(e){this._control.useGrabCursor=e}get disableContextMenu(){return this._control.disableContextMenu}set disableContextMenu(e){this._control.disableContextMenu=e}get scrollable(){return this._control.scrollable}set scrollable(e){this._control.scrollable=e}get wheelScrollable(){return this._control.wheelScrollable}set wheelScrollable(e){this._control.wheelScrollable=e}constructor(e,{projection:n=null,initialYaw:r=0,initialPitch:i=0,initialZoom:s=1,yawRange:o=null,pitchRange:a=null,zoomRange:l=null,fov:u=90,useGrabCursor:c=!0,disableContextMenu:h=!1,rotate:d=!0,zoom:f=!0,gyro:g=!1,scrollable:m=!0,wheelScrollable:w=!1,autoplay:v=!1,hotspot:y={},autoInit:_=!0,autoResize:E=!0,canvasSelector:I="canvas",useResizeObserver:A=!0,on:T={},plugins:C=[],maxDeltaTime:N=1/30,tabIndex:O=0,debug:P=!1}={}){super(),this.renderFrame=L=>{const V=this._camera,$=this._renderer,z=this._control,X=this._hotspot,D=this._autoplay,W=this._mesh;W&&(this._emit(Je.BEFORE_RENDER),D.playing&&(D.update(L),z.sync()),V.animation?V.animation.update(L):z.update(L),$.render(W,V),X.render(V),V.changed&&this._emit(Je.VIEW_CHANGE,{yaw:V.yaw,pitch:V.pitch,zoom:V.zoom,quaternion:[V.quaternion[0],V.quaternion[1],V.quaternion[2],V.quaternion[3]]}),V.onFrameRender(),this._emit(Je.RENDER))},this._renderFrameOnDemand=L=>{const V=this._camera,$=this._control,z=this._autoplay,X=this._mesh,D=X==null?void 0:X.getTexture();!this._initialized||!D||!V.animation&&!$.animating&&!z.playing&&!D.isVideo()||this.renderFrame(L)},this._renderVRFrame=(L,V)=>{const $=this._vr,z=this._mesh,X=this._renderer;z&&(this._emit(Je.BEFORE_RENDER),X.renderVR(z,$,V),this._emit(Je.RENDER))},this._rootEl=I5(e),this._plugins=C,this._initialized=!1,this._autoInit=_,this._autoResize=E,this._canvasSelector=I,this._useResizeObserver=A,this._tabIndex=O,this._debug=P;const b=A5(this._rootEl,I);this._renderer=new X5(b,P),this._camera=new P5({initialYaw:r,initialPitch:i,initialZoom:s,fov:u,yawRange:o,pitchRange:a,zoomRange:l}),this._control=new $5(b,this._camera,{useGrabCursor:c,scrollable:m,wheelScrollable:w,disableContextMenu:h,rotate:d,zoom:f,gyro:g}),this._animator=new H5(N),this._autoplay=new W5(this,b,v),this._projection=n,this._mesh=null,this._autoResizer=new G5(A,()=>this.resize()),this._vr=new Q5(this._renderer.ctx),this._hotspot=new q5(this._rootEl,this._renderer,y),this._addEventHandlers(T),n&&_&&this.init()}destroy(){this._camera.destroy(),this._animator.stop(),this._renderer.destroy(),this._control.destroy(),this._autoResizer.disable(),this._mesh&&(this._mesh.destroy(this._renderer.ctx),this._mesh=null),this._plugins.forEach(e=>e.destroy(this)),this._initialized=!1}init(){return Lt(this,void 0,void 0,function*(){if(!this._projection)throw new xr(Vt.MESSAGES.PROVIDE_PROJECTION_FIRST,Vt.CODES.PROVIDE_PROJECTION_FIRST);const e=this._renderer,n=this._camera,r=this._control,i=this._animator,s=this._hotspot,o=this._projection,a=e.canvas;this._bindComponentEvents(),e.ctx.init(),this._resizeComponents(),n.updateMatrix(),this._autoResize&&this._autoResizer.enable(a),this._autoplay.enableBlocked||this._autoplay.enable(),this._plugins.forEach(u=>{u.init(this)});const l=yield this._loadTexture(o);this._applyProjection(o,l),s.refresh(),i.start(this._renderFrameOnDemand),yield r.enable(),this._tabIndex!=null&&!a.hasAttribute("tabIndex")&&(a.tabIndex=this._tabIndex),this._initialized=!0,this.renderFrame(0),this._emit(Je.READY)})}load(e){return Lt(this,void 0,void 0,function*(){if(!e)return!1;if(this._initialized){const n=yield this._loadTexture(e);this._applyProjection(e,n),this.renderFrame(0)}else this._projection=e,this.init();return!0})}resize(){if(!this._initialized)return;this._resizeComponents(),this.renderFrame(0);const{width:e,height:n}=this._renderer;this._emit(Je.RESIZE,{width:e,height:n})}addPlugins(...e){this._initialized&&e.forEach(n=>{n.init(this)}),this._plugins.push(...e)}removePlugins(...e){e.forEach(n=>{const r=this._plugins.indexOf(n);r<0||(n.destroy(this),this._plugins.splice(r,1))})}_emit(e,...n){const r=n?n[0]:{};this.trigger(e,Object.assign({type:e,target:this},r))}_applyProjection(e,n){const r=this._camera,i=this._control,s=this._renderer,o=this._mesh;o&&o.destroy(s.ctx);const a=e.createMesh(s.ctx,n);e.updateCamera(r),e.updateControl(i),this._mesh=a,this._emit(Je.PROJECTION_CHANGE,{projection:e})}_loadTexture(e){return Lt(this,void 0,void 0,function*(){const n=new B5,{src:r,video:i}=e;this._emit(Je.LOAD_START,{src:r,video:i});const s=yield n.load(r,i);return this._emit(Je.LOAD,{src:r,video:i}),s})}_resizeComponents(){const e=this._renderer,n=this._camera,r=this._control;e.resize(),n.resize(e.width,e.height),r.resize(e.width,e.height)}_addEventHandlers(e){Object.keys(e).forEach(n=>{this.on(n,e[n])})}_bindComponentEvents(){const e=this._rootEl,n=this._control,r=this._animator,i=this._renderer,s=this._vr;[q.STATIC_CLICK,q.INPUT_START,q.INPUT_END].forEach(a=>{n.rotate.on(a,l=>{this._emit(a,l)}),n.zoom.on(a,l=>{this._emit(a,l)})}),s.on(Je.VR_START,a=>{e.classList.add(Wn.IN_VR),r.changeContext(a.session),r.start(this._renderVRFrame),this._emit(Je.VR_START)}),s.on(Je.VR_END,()=>{e.classList.remove(Wn.IN_VR),i.ctx.useDefaultFrameBuffer(),r.changeContext(window),r.start(this._renderFrameOnDemand),this.resize(),this._emit(Je.VR_END)})}};Fo.VERSION="4.0.0-beta.7";class J5 extends wt{constructor(){super(),this.matrix=tu(),this.rotation=Er(),this.position=We(0,0,0),this.scale=We(1,1,1)}updateMatrix(){O4(this.matrix,this.rotation,this.position,this.scale)}update(e){this.trigger(E5.UPDATE,e)}}class t0{constructor({src:e,video:n=!1}){this.src=e,this.video=n}updateCamera(e){e.resetRange()}updateControl(e){e.ignoreZoomScale=!1}}class lu{constructor(){this.needsUpdate=!0}destroy(e){}}class Z5 extends lu{constructor(e,n,r){super(),this.texture=n,this._webglTexture=e.createWebGLCubeTexture(n,n.width),this._cubemapOrder=r}destroy(e){this.texture.destroy(),e.deleteTexture(this._webglTexture)}update(e,n,r){const i=this.texture;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.uniform1i(n,0),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,this._webglTexture),Jv(i.sources,this._cubemapOrder).forEach((o,a)=>{r?e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,0,0,e.RGBA,e.UNSIGNED_BYTE,o):e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,o)}),i.isVideo()||(this.needsUpdate=!1)}}class eF{get size(){return this._size}constructor(e,n){this.texture=e,this._renderingOrder=Jv(T5(6),n);const r=document.createElement("canvas");this._calcRenderingSize(),r.width=this._size,r.height=this._size,this._canvas=r,this._ctx=r.getContext("2d")}destroy(){const e=this._canvas;e.width=1,e.height=1,this._canvas=null}draw(e,n){const r=this._size,i=this.texture;let s=0;for(let o=0;o<this._row;o++)for(let a=0;a<this._column;a++){const l=r*a,u=r*o,c=this._renderingOrder[s];this._ctx.drawImage(i.source,l,u,r,r,0,0,r,r),n?e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,0,0,e.RGBA,e.UNSIGNED_BYTE,this._canvas):e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this._canvas),s++}}_calcRenderingSize(){const{width:e,height:n}=this.texture,r=e/n;r===1/6?(this._size=e,this._row=6,this._column=1):r===6?(this._size=n,this._row=1,this._column=6):r===2/3?(this._size=e*.5,this._row=3,this._column=2):(this._size=e/3,this._row=2,this._column=3)}}class tF extends lu{get texture(){return this._painter.texture}constructor(e,n,r){super(),this._painter=new eF(n,r),this._webglTexture=e.createWebGLCubeTexture(n,this._painter.size)}destroy(e){e.deleteTexture(this._webglTexture),this._painter.destroy()}update(e,n,r){const i=this.texture;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.uniform1i(n,0),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,this._webglTexture),this._painter.draw(e,r),i.isVideo()||(this.needsUpdate=!1)}}class n0 extends J5{constructor(e,n){super(),this.vao=e,this.program=n}destroy(e){e.releaseVAO(this.vao),e.releaseShaderResources(this.program)}getTexture(){return this.program.uniforms.uTexture.texture}}class r0{constructor(e,n,r,i){this.program=e.createProgram(n,r),this.uniforms=i,this.uniformLocations=e.getUniformLocations(this.program,i)}}class i0{constructor(e,n){this.data=e,this.itemSize=n,this.count=e.length/n}}class kT{constructor(e,n,r){this.vertices=new i0(new Float32Array(e),3),this.indicies=new i0(new Uint16Array(n),1),this.uvs=new i0(new Float32Array(r),2)}}class nF extends kT{constructor({order:e,rotateUV:n}){const r=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1],i=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23],s=1/3,o=[];for(let l=1;l>=0;l--)for(let u=0;u<3;u++){const c=[u*s,l*.5,(u+1)*s,l*.5,(u+1)*s,(l+1)*.5,u*s,(l+1)*.5];o.push(c)}n&&n.forEach((l,u)=>{if(l===ou.ZERO)return;const c=o[u];let h;l===ou.CW_90?h=[1,2,3,0]:l===ou.CCW_90?h=[3,0,1,2]:h=[2,3,0,1];const d=Array(c.length);for(let f=0;f<c.length/2;f++)d[f*2+0]=c[h[f]*2+0],d[f*2+1]=c[h[f]*2+1];o[u]=d});const a=Jv(o,e,"BFUDRL").reduce((l,u)=>l.concat(u),[]);super(r,i,a)}}var rF=`#define GLSLIFY 1
attribute vec3 position;attribute vec2 uv;uniform mat4 uMVMatrix;uniform mat4 uPMatrix;varying highp vec3 vPos;void main(){vPos=position;gl_Position=uPMatrix*uMVMatrix*vec4(position,1.0);}`,iF=`#define GLSLIFY 1
uniform samplerCube uTexture;varying highp vec3 vPos;void main(){gl_FragColor=textureCube(uTexture,vec3(vPos.x,vPos.y,-vPos.z));}`;class sF extends t0{constructor(e){super(e);const{cubemapOrder:n="RLUDFB",cubemapFlipX:r=!1}=e;this._cubemapOrder=n,this._cubemapFlipX=r}createMesh(e,n){const r=this._cubemapOrder,i=this._cubemapFlipX,s={uTexture:n.isCube()?new Z5(e,n,r):new tF(e,n,r)},o=new nF({order:r}),a=new r0(e,rF,iF,s),l=e.createVAO(o,a),u=new n0(l,a);return i&&(u.scale[0]=-1),u.updateMatrix(),u}}class PT extends lu{constructor(e,n){super(),this.texture=n,this._webglTexture=e.createWebGLTexture(n)}destroy(e){this.texture.destroy(),e.deleteTexture(this._webglTexture)}update(e,n,r){const i=this.texture,s=i.isVideo();e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.uniform1i(n,0),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this._webglTexture),!s&&r?e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,i.source):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i.source),s||(this.needsUpdate=!1)}}var oF=`#define GLSLIFY 1
attribute vec3 position;attribute vec2 uv;uniform mat4 uMVMatrix;uniform mat4 uPMatrix;varying highp vec2 vUV;void main(){vUV=uv;gl_Position=uPMatrix*uMVMatrix*vec4(position,1.0);}`,NT=`#define GLSLIFY 1
uniform sampler2D uTexture;varying highp vec2 vUV;void main(){gl_FragColor=texture2D(uTexture,vUV.st);}`;class OT extends kT{constructor(){const r=-.5*Math.PI,i=[],s=[],o=[];let a,l;for(a=0;a<=60;a++){const u=(a/60-.5)*Math.PI,c=Math.sin(u),h=Math.cos(u);for(l=0;l<=60;l++){const d=(l/60-.5)*2*Math.PI+r,f=Math.sin(d),m=Math.cos(d)*h,w=c,v=f*h,y=l/60,_=a/60;if(i.push(y,_),s.push(m,w,v),l!==60&&a!==60){const E=a*61+l,I=E+60+1;o.push(E,E+1,I,I,E+1,I+1)}}}super(s,o,i)}}class aF extends t0{constructor(e){super(e)}createMesh(e,n){const r={uTexture:new PT(e,n)},i=new OT,s=new r0(e,oF,NT,r),o=e.createVAO(i,s);return new n0(o,s)}}class lF extends lu{constructor(e){super(),this.val=e}update(e,n){e.uniform1f(n,this.val),this.needsUpdate=!1}}class uF extends lu{constructor(e){super(),this.val=e}update(e,n){e.uniform4fv(n,this.val.reduce((r,i)=>[...r,...i],[])),this.needsUpdate=!1}}var cF=`#define GLSLIFY 1
attribute vec3 position;attribute vec2 uv;uniform mat4 uMVMatrix;uniform mat4 uPMatrix;uniform vec4 uTexScaleOffset[2];uniform float uEye;varying highp vec2 vUV;void main(){vec4 scaleOffset=uTexScaleOffset[int(uEye)];vUV=uv.xy*scaleOffset.xy+scaleOffset.zw;gl_Position=uPMatrix*uMVMatrix*vec4(position,1.0);}`;class s0 extends t0{constructor(e){super(e),this._mode=e.mode}createMesh(e,n){let r,i;switch(this._mode){case s0.MODE.LEFT_RIGHT:r=[.5,1,0,0],i=[.5,1,.5,0];break;default:r=[1,.5,0,0],i=[1,.5,0,.5]}const s={uTexture:new PT(e,n),uEye:new lF(0),uTexScaleOffset:new uF([r,i])},o=new OT,a=new r0(e,cF,NT,s),l=e.createVAO(o,a);return new n0(l,a)}}s0.MODE={LEFT_RIGHT:"left_right",TOP_BOTTOM:"top_bottom"};const hF=(t,e)=>{[wt.prototype,Fo.prototype].forEach(n=>{Object.getOwnPropertyNames(n).filter(r=>r.charAt(0)!=="_"&&r!=="constructor").forEach(r=>{const i=Object.getOwnPropertyDescriptor(n,r);if(i.value)Object.defineProperty(t,r,{value:function(...s){return i.value.call(this[e],...s)}});else{const s={};i.get&&(s.get=function(){var o;return this[e]&&((o=i.get)===null||o===void 0?void 0:o.call(this[e]))}),i.set&&(s.set=function(...o){var a;return(a=i.set)===null||a===void 0?void 0:a.call(this[e],...o)}),Object.defineProperty(t,r,s)}})})};function Pd(t){const[e]=_t(),n=hr({queryKey:["company",e.company,"siteId",e.siteid,"galleryScenes"],queryFn:()=>b4(e.company,e.siteid)}),r=S.useMemo(()=>n!=null&&n.data?t=="cube"?n.data.map(i=>({...i,projection:new sF({src:[`https://firebasestorage.googleapis.com/v0/b/bostadsplanerare.appspot.com/o/${e.company}%2F360tiles%2F${e.sitename}%2F${i.name}%2Fpx.jpg?alt=media&token=23d6a4cf-dcbe-46be-af6e-c13760da85f8`,`https://firebasestorage.googleapis.com/v0/b/bostadsplanerare.appspot.com/o/${e.company}%2F360tiles%2F${e.sitename}%2F${i.name}%2Fnx.jpg?alt=media&token=23d6a4cf-dcbe-46be-af6e-c13760da85f8`,`https://firebasestorage.googleapis.com/v0/b/bostadsplanerare.appspot.com/o/${e.company}%2F360tiles%2F${e.sitename}%2F${i.name}%2Fpy.jpg?alt=media&token=23d6a4cf-dcbe-46be-af6e-c13760da85f8`,`https://firebasestorage.googleapis.com/v0/b/bostadsplanerare.appspot.com/o/${e.company}%2F360tiles%2F${e.sitename}%2F${i.name}%2Fny.jpg?alt=media&token=23d6a4cf-dcbe-46be-af6e-c13760da85f8`,`https://firebasestorage.googleapis.com/v0/b/bostadsplanerare.appspot.com/o/${e.company}%2F360tiles%2F${e.sitename}%2F${i.name}%2Fpz.jpg?alt=media&token=23d6a4cf-dcbe-46be-af6e-c13760da85f8`,`https://firebasestorage.googleapis.com/v0/b/bostadsplanerare.appspot.com/o/${e.company}%2F360tiles%2F${e.sitename}%2F${i.name}%2Fnz.jpg?alt=media&token=23d6a4cf-dcbe-46be-af6e-c13760da85f8`]})})):n.data.map(i=>({...i,projection:new aF({src:i.imageurl})})):[],[n==null?void 0:n.data]);return[r!=null?r:[],n.status]}const dF=()=>{const[t]=Pd("cube"),[,e]=Y(Nv),[n,r]=S.useState(!1);if(!t||t.length===0)return null;const i=()=>{Kt()?(r(!0),setTimeout(()=>{r(!1),e(!0)},450)):e(!0)};return p.jsxs("button",{onClick:i,className:`relative bottom-0 left-2 flex w-auto items-center gap-1.5 whitespace-nowrap rounded-md bg-black bg-opacity-50 px-2 py-0.5 text-white opacity-90 sm:origin-center sm:transform sm:gap-2 sm:px-3 sm:py-1 sm:text-sm sm:transition sm:duration-100 sm:hover:scale-105 ${n?"scale-95 bg-[#00965f]/80":""}`,children:["Galleri",p.jsx("img",{src:Sd,alt:"open modal"}),n&&p.jsx("span",{className:"absolute inset-0 animate-ping rounded-md bg-white/30"})]})},fF=async(t,e)=>{const n=jl(So(cs,`${t}/${e}/maps`),Yh("order"));return(await Ao(n)).docs.map(i=>({...i.data()}))};function uu(){var n;const[t]=_t(),e=hr({queryKey:["company",t.company,"siteId",t.siteid,"mapScenes"],queryFn:()=>fF(t.company,t.siteid)});return[(n=e==null?void 0:e.data)!=null?n:[],e.status]}const pF=()=>{const[,t]=Y(kv),[e]=uu(),[n,r]=S.useState(!1);if(!e||e.length===0)return null;const i=()=>{Kt()?(r(!0),setTimeout(()=>{r(!1),t(!0)},450)):t(!0)};return p.jsxs("button",{onClick:i,className:`relative bottom-0 left-2 flex w-auto items-center gap-1.5 whitespace-nowrap rounded-md bg-black bg-opacity-50 px-2 py-0.5 text-white opacity-90 sm:origin-center sm:transform sm:gap-2 sm:px-3 sm:py-1 sm:text-sm sm:transition sm:duration-100 sm:hover:scale-105 ${n?"scale-95 bg-[#00965f]/80":""}`,children:["Karta",p.jsx("img",{src:Sd,alt:"open modal"}),n&&p.jsx("span",{className:"absolute inset-0 animate-ping rounded-md bg-white/30"})]})},gF="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M20.4217%2018.2208C20.9404%2018.7088%2020.9404%2019.5005%2020.4217%2019.9885C19.903%2020.4766%2019.0614%2020.4765%2018.5427%2019.9885L12.0009%2013.7886L5.41264%2019.9865C4.89394%2020.4744%204.05236%2020.4744%203.5336%2019.9865C3.01484%2019.4985%203.0149%2018.7068%203.5336%2018.2188L10.1241%2012.023L3.53177%205.77822C3.01307%205.29026%203.01307%204.49854%203.53177%204.01052C4.05047%203.52251%204.89206%203.52256%205.41081%204.01052L12.0009%2010.2574L18.5892%204.05948C19.1079%203.57152%2019.9495%203.57152%2020.4682%204.05948C20.987%204.54745%2020.9869%205.33916%2020.4682%205.82718L13.8777%2012.023L20.4217%2018.2208Z'%20fill='%23092C3E'/%3e%3c/svg%3e",o0=({src:t,alt:e,onLoad:n})=>{const[r,i]=S.useState(!1),[s,o]=S.useState(!1),[a,l]=S.useState(!1),[u,c]=S.useState({x:0,y:0}),[h,d]=S.useState({x:0,y:0}),f=S.useRef(null),g=S.useRef(null),m=S.useRef({x:0,y:0});S.useEffect(()=>{i(!1)},[t]);const w=E=>{r&&(o(!0),l(!1),m.current={x:E.clientX,y:E.clientY},g.current&&(g.current.setPointerCapture(E.pointerId),f.current&&(f.current.style.cursor="grabbing")))},v=E=>{if(!r||!s)return;const I=E.clientX-m.current.x,A=E.clientY-m.current.y;(Math.abs(I)>2||Math.abs(A)>2)&&l(!0),d(T=>({x:T.x+I/2,y:T.y+A/2})),m.current={x:E.clientX,y:E.clientY}},y=E=>{r&&(o(!1),g.current&&g.current.releasePointerCapture(E.pointerId),f.current&&(f.current.style.cursor="grab"))},_=E=>{var b;if(a)return;const I=(b=g.current)==null?void 0:b.getBoundingClientRect();if(!I)return;const A=E.clientX-I.left,T=E.clientY-I.top,C=I.width/2,N=I.height/2,O=(C-A)/2,P=(N-T)/2;i(L=>!L),c(r?{x:0,y:0}:{x:O,y:P}),d(r?{x:0,y:0}:h)};return p.jsx("div",{ref:g,className:`relative flex h-full w-full items-start justify-center overflow-hidden ${r?"touch-none":""}`,onClick:_,onPointerDown:w,onPointerMove:v,onPointerUp:y,onPointerCancel:y,children:p.jsx("img",{ref:f,onLoad:n,src:t,alt:e,className:`h-auto max-h-screen w-auto max-w-full cursor-grab ${s?"":"transition-transform duration-300 ease-in-out"}`,style:{objectFit:"contain",transform:r?`scale(2) translate(${u.x+h.x}px, ${u.y+h.y}px)`:"scale(1) translate(0, 0)",cursor:r?"grab":"pointer"},draggable:!1})})},mF=()=>{const[t,e]=Y(Lv),[,n]=Y(Mv);if(!t)return null;const r=t.pictures||[],i=[t.floorplanpicture,...r];return p.jsx("div",{part:"view-border",className:"view-border absolute left-0 top-0 z-10 h-full w-full align-middle",children:p.jsxs("div",{className:"absolute bottom-1 left-1 right-1 top-1 bg-white",children:[p.jsx("button",{onClick:()=>{n(null),e(null)},className:"absolute right-0 top-0 z-50 m-3",children:p.jsx("img",{src:gF,alt:"close",className:""})}),p.jsxs("div",{className:"relative flex h-full w-full flex-col",children:[p.jsx("div",{className:"singleapartmentpicture relative flex flex-grow items-start justify-center",children:p.jsx(o0,{src:Po(i[0]),alt:"apartmentpicture"})}),p.jsx("div",{className:"flex h-0 items-center justify-center",children:p.jsxs("ul",{className:"flex justify-center gap-10 max-[400px]:gap-2 sm:gap-24",children:[t.interesturl&&p.jsx("li",{children:p.jsx("a",{href:t.interesturl,target:"_top",rel:"noopener noreferrer",children:p.jsx("button",{part:"apartment-button",className:"apartment-button interest-button h-8 w-44 -translate-y-12 hover:opacity-90 max-[400px]:w-36 max-[400px]:-translate-y-8 sm:h-11 sm:w-52 sm:-translate-y-16 sm:text-sm",children:"Intresseanmälan"})})}),t.sheeturl&&p.jsx(F2,{to:t.sheeturl,target:"_blank",children:p.jsx("li",{className:"",children:p.jsx("button",{part:"apartment-button",className:"apartment-button info-button h-8 w-44 -translate-y-12 hover:opacity-90 max-[400px]:w-36 max-[400px]:-translate-y-8 sm:h-11 sm:w-52 sm:-translate-y-16 sm:text-sm",children:"Bofaktablad"})})})]})})]})]})})},DT=({checked:t,action:e})=>{const n=S.useCallback(()=>{e()},[e]);return p.jsx("button",{type:"button",role:"switch","aria-checked":t,onClick:n,className:`ml-3 h-[20px] w-[38px] rounded-full transition ${t?"bg-[#00965f]":"bg-black/90"}`,children:p.jsx("span",{className:`block h-[14px] w-[14px] rounded-full bg-white shadow transition-transform duration-100 will-change-transform ${t?"translate-x-[21px]":"translate-x-[3px]"}`})})},vF=()=>{const[t]=Y(GA),[e,n]=Y(ZA),[r]=Y(eT),[,i]=Y(Xl);function s(o){const a=[...e];a[o]=!a[o],i(!0),n(a)}return p.jsx(p.Fragment,{children:p.jsx("div",{className:`z-5 absolute right-2 top-2 w-[115px] transform rounded-md bg-white p-3 shadow-lg transition-all duration-300 ease-out ${t?"visible scale-100 opacity-90":"invisible scale-75 opacity-0"}`,children:p.jsx("ul",{children:e.map((o,a)=>r[a]?p.jsxs("li",{className:"font-style-one mb-2 flex items-center font-bold",children:[a+1," rok",p.jsx(DT,{checked:e[a],action:()=>s(a)})]},`rok-${a}`):null)},"filter-list")})})},yF=()=>{const[t]=Y(YA),[e,n]=S.useState({width:0,height:0}),r=S.useRef(null),[i]=Id(),s=S.useCallback(()=>{var h;if((h=r.current)!=null&&h.parentElement){const d=r.current.parentElement,{offsetWidth:f,offsetHeight:g}=r.current;n({width:f/d.offsetWidth*100,height:g/d.offsetHeight*100})}},[]);if(S.useEffect(()=>{var f;if(!((f=r.current)!=null&&f.parentElement))return;const h=r.current.parentElement;s();const d=new ResizeObserver(s);return d.observe(h),()=>d.disconnect()},[t,s]),!t)return null;const o=t;let a=null;if(i&&o.reference_id&&(a=i[Number(o.reference_id)]),!a)return null;const l=h=>{if(h==="S"||h==="SSE"||h==="SSW")return"Nord";if(h==="E"||h==="ENE"||h==="ESE")return"Väst";if(h==="W"||h==="WNW"||h==="WSW")return"Öst";if(h==="N"||h==="NNE"||h==="NNW")return"Syd";if(h==="SE")return"NordVäst";if(h==="SW")return"NordOst";if(h==="NE"||h==="NNE")return"SydVäst";if(h==="NW"||h==="")return"SydOst"},u=o.tooltipplace,c=xd(u,o,e);return p.jsxs("div",{ref:r,className:`z-5 pointer-events-none absolute transform rounded-md shadow-lg transition-all duration-300 ease-out ${t?"visible scale-100":"invisible scale-75"}`,style:{top:`${c.y}%`,left:`${c.x}%`,maxWidth:"25%",width:"auto"},children:[u==="top"&&p.jsx("div",{className:"absolute left-1/2 top-full -translate-x-1/2 border-x-[7px] border-t-[7px] border-x-transparent border-t-white opacity-95"}),u==="bottom"&&p.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 border-x-[7px] border-b-[7px] border-x-transparent border-b-white opacity-95"}),u==="left"&&p.jsx("div",{className:"absolute left-full top-1/2 -translate-y-1/2 border-y-[7px] border-l-[7px] border-y-transparent border-l-white opacity-95"}),u==="right"&&p.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-y-[7px] border-r-[7px] border-y-transparent border-r-white opacity-95"}),p.jsx("div",{children:p.jsx("img",{className:"h-auto max-w-full rounded-t-md border-2",src:Po(a.daypicture),alt:"floorplanpicture",onLoad:s})}),p.jsxs("div",{className:"h-10 overflow-hidden text-ellipsis whitespace-nowrap rounded-b-md bg-white px-2 pb-2 pt-2 text-center text-[clamp(0.75rem,2vw,1rem)] opacity-95",children:["Kameravy mot ",l(a.compass)]})]})},_F=()=>{var f,g,m;const[t]=Y(JA),[e,n]=S.useState({width:0,height:0}),r=S.useRef(null),[i]=_t(),s=Fv(),o=S.useCallback(()=>{var w;if((w=r.current)!=null&&w.parentElement){const v=r.current.parentElement,{offsetWidth:y,offsetHeight:_}=r.current;n({width:y/v.offsetWidth*100,height:_/v.offsetHeight*100})}},[]);if(S.useEffect(()=>{var y;if(!((y=r.current)!=null&&y.parentElement))return;const w=r.current.parentElement;o();const v=new ResizeObserver(o);return v.observe(w),()=>v.disconnect()},[t,o]),!t)return null;const a=t,l=s.find(w=>w.apartmentid===a.reference_id);if(!l)return p.jsx(p.Fragment,{});const u=a.tooltipplace,c=xd(u,a,e),h=l.status==="available"?(f=i==null?void 0:i.statuslabels)==null?void 0:f.available:l.status==="sold"?(g=i==null?void 0:i.statuslabels)==null?void 0:g.sold:(m=i==null?void 0:i.statuslabels)==null?void 0:m.reserved,d=l.status==="available"?"status-available":l.status==="sold"?"status-sold":"status-pending";return p.jsx("div",{ref:r,className:`z-9 pointer-events-none absolute transform rounded-md bg-white pb-2 pr-2 pt-2 shadow-lg transition-all duration-300 ease-out ${t?"visible scale-100 opacity-95":"invisible scale-75 opacity-0"}`,style:{top:`${c.y}%`,left:`${c.x}%`},children:p.jsxs("div",{className:"w-64 flex-col pb-2",children:[p.jsxs("ul",{className:"flex items-end",children:[p.jsx("li",{className:"flex h-10 w-20 items-center",children:p.jsx("div",{className:`status-popup-shape ${d} flex items-center justify-center pl-1 pr-5 text-xs font-bold text-white`,children:h})}),p.jsx("li",{className:"flex-grow"}),p.jsxs("li",{children:[p.jsxs("div",{className:"text-lg font-bold",children:[l.rok," rok, ",l.size," m",p.jsx("sup",{children:"2"})]}),p.jsxs("div",{className:"-mt-1 text-xs",children:["Nr. ",l.apartmentid]})]})]}),p.jsx("div",{className:"mt-4 align-top",children:p.jsx("img",{src:Po(l.floorplanpicture),alt:"floorplanpicture",onLoad:o})}),p.jsxs("ul",{className:"flex items-end pl-4",children:[(i==null?void 0:i.type)=="ownership"||(i==null?void 0:i.type)=="condominium"?p.jsx("li",{className:"",children:p.jsxs("ul",{children:[p.jsx("li",{className:"mt-2 text-left font-bold",children:"Pris"}),p.jsx("li",{className:"text-xs",children:l.price>0?l.price.toLocaleString("sv-SE")+" kr":"-"})]})}):null,(i==null?void 0:i.type)=="rental"?p.jsx("li",{className:"",children:p.jsxs("ul",{children:[p.jsx("li",{className:"mt-2 text-left font-bold",children:"Hyra"}),p.jsx("li",{className:"text-xs",children:l.charge>0?l.charge.toLocaleString("sv-SE")+" kr/mån":"-"})]})}):null,p.jsx("li",{className:"flex-grow"}),(i==null?void 0:i.type)=="condominium"?p.jsx("li",{className:"",children:p.jsxs("ul",{children:[p.jsx("li",{className:"mt-2 text-left font-bold",children:"Avgift"}),p.jsx("li",{className:"text-xs",children:l.charge>0?l.charge.toLocaleString("sv-SE")+" kr/mån":"-"})]})}):null,(i==null?void 0:i.type)=="ownership"&&l.lotsize?p.jsx("li",{className:"",children:p.jsxs("ul",{children:[p.jsx("li",{className:"mt-2 text-left font-bold",children:"Tomtarea"}),p.jsxs("li",{className:"text-xs",children:[l.lotsize.toLocaleString("sv-SE")," m",p.jsx("sup",{children:"2"})]})]})}):null,(i==null?void 0:i.type)=="rental"&&l.moveindate?p.jsx("li",{className:"",children:p.jsxs("ul",{children:[p.jsx("li",{className:"mt-2 text-left font-bold",children:"Inflyttning"}),p.jsx("li",{className:"text-xs",children:l.moveindate.toDate().toLocaleString("sv-SE",{dateStyle:"short"})})]})}):null]})]})})},wF=()=>{const[t]=Y(XA),[e,n]=S.useState({width:0,height:0}),r=S.useRef(null),[i,s]=S.useState(!1),o=!1,a=Kt()?.75:1,l=S.useCallback(()=>{var d;if((d=r.current)!=null&&d.parentElement){const f=r.current.parentElement,{offsetWidth:g,offsetHeight:m}=r.current;n({width:g/f.offsetWidth*100*a,height:m/f.offsetHeight*100*a})}},[a]);if(S.useEffect(()=>{t?requestAnimationFrame(()=>s(!0)):s(!1)},[t]),S.useEffect(()=>{var g;if(!((g=r.current)!=null&&g.parentElement))return;const d=r.current.parentElement;l();const f=new ResizeObserver(l);return f.observe(d),()=>f.disconnect()},[t,l]),!t)return null;const u=t,c=u.tooltipplace,h=xd(c,u,e);return p.jsxs(p.Fragment,{children:[p.jsxs("div",{ref:r,className:`z-9 pointer-events-none absolute rounded-md bg-white pb-2 pr-2 pt-2 shadow-lg transition-all duration-300 ease-out ${i?"opacity-95":"opacity-0"}`,style:{top:`${h.y}%`,left:`${h.x}%`,transform:`scale(${a*(i?1:.75)})`,transformOrigin:"top left",willChange:"transform, opacity"},children:[c==="top"&&p.jsx("div",{className:"absolute left-1/2 top-full -translate-x-1/2 border-x-[7px] border-t-[7px] border-x-transparent border-t-white opacity-95"}),c==="bottom"&&p.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 border-x-[7px] border-b-[7px] border-x-transparent border-b-white opacity-95"}),c==="left"&&p.jsx("div",{className:"absolute left-full top-1/2 -translate-y-1/2 border-y-[7px] border-l-[7px] border-y-transparent border-l-white opacity-95"}),c==="right"&&p.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-y-[7px] border-r-[7px] border-y-transparent border-r-white opacity-95"}),p.jsxs("div",{className:"max-w-64",children:[p.jsx("div",{className:"pb-1 pl-4 pr-2 pt-1 text-left text-xs font-bold max-[400px]:text-[10px] sm:text-base",children:t.title}),t.text&&p.jsx("div",{className:"w-64 pb-2 pl-4 pr-2 text-left text-xs leading-tight max-[400px]:text-[10px] sm:text-xs",children:t.text})]})]}),o]})},Nd="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='293'%20height='293'%20viewBox='0%200%20293%20293'%3e%3c!--%20Vit%20fylld%20cirkel%20--%3e%3ccircle%20cx='146.5'%20cy='146.5'%20r='130'%20style='fill:%20%23fff;%20stroke:%20%23fff;%20stroke-width:%2016px;'%20/%3e%3c!--%20Streckad%20cirkel%20--%3e%3ccircle%20cx='146.5'%20cy='146.5'%20r='120'%20style='fill:%20none;%20stroke:%20%23000;%20stroke-width:%208px;%20stroke-dasharray:%208%2020;'%20/%3e%3c!--%20Svart%20cirkelram%20--%3e%3ccircle%20cx='146.5'%20cy='146.5'%20r='140'%20style='fill:%20none;%20stroke:%20%23000;%20stroke-width:%204px;'%20/%3e%3cimage%20id='N'%20x='108'%20y='60'%20width='74'%20height='122'%20xlink:href='data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAAE8AAACCCAYAAAAHQpXsAAALtUlEQVR4nO2dfWyVVx3Hv7e3tKO0g75RqLyUZry50hcpbYExKm0Z0CIUysawVAQKU+ky4zJAHUSNihj/mEZiDInJZC5shBBCDKIGjNGIREQXIkHFMUVBDaCthA24x5wnv+fucPrc557n7TzPhftJTnqfe5+X83z7O+f8zjs0MgLADgDvArhmEd4D8CnF6LwO4F/SPe4CWK/zhXI1PisG4FEAeQDGpjjnGwAOAPhPmnuNAVBm8X2hD/FUJkfjsxiARJpz8gH8QOFeqeJ9z0W8XKNTPFWWAFgdwXgNI4ri8Th9HUB5BOJii07xYhRUqAKw0+a8VPFOly34ShQs7x6VwCIxKjlbw42aPVEQbxDASQDXpe/LyLUpDSleaYmCeNxdeg3Azyx+ewrAsxHNm7VHyup5/Lv/AfguWaHMtwAUKdwH5A5pIwr/0RiJcxzAxRTnvKI5TkpEQbyRACbS5+dTnPMxAB/WGCclopBsISTLXwI4muKcrwqf/5zCLXnoXBWZj6fIuxoAvESf39FdFbMiiuLdBLDd4nveoLCK8siRDhzuwIiieDzpfR/Aryx+awawkgQOHd3ipbIWOa+6Si6KFZ8E8E8Adyx+e+hclVQcBHDI4rd2APXZZPs+VqUkLxC+COAfFr+tozwwVKJseZy3qHVZTo5joxD3qIsHEu9CBOIxDN3teW6ft1XxvIfeSbbi5wD2Ry1SUXVVrPgCuTB2PNCWF/dw7d8AfDrA+ztGZ78to9bi/1IwGaXQT2vyI/L/Wi2c5BIAQ77H2oYwHM1Uz1StHdjFWWsNI0uWLDJN1DhgNSYlSxp2Uh7WlBXKGeOoK5JRr1oWB8wj4cwQevOTFVGsnvFBkL302XQ9NoUYn4xitGR1PLz9sIuiyiZBtAT95Q2jjZkR/XC5aGF5ZqdQFhtmCGIlpM9/ojHNWVJwSBJMDHwM3wtZ4awppFYXOcmK4ajmlqCM4UWyLjvx+NyLhVF5oSj5eSsVuhN5PbdFU3wyhsU0CkB2UayOzwGojMKLRcXyljqYOlBHpXIWAI8B+F2avE4Or2dQz1+g9DgUzgxa55lZEfZ/r5DEc8PGcKMePpNtCol04UrYsQ/b8taIB9OmTcOUKVNUr+Ul7txAYpUh3BSta9++fWzNmjVOrO/YwyrcIlmM69evs7a2Nifi/ZWa7EMhzGT7OfFg2bJlKC4uxq1bt5zcg4/T6/M9ZoqEJd5ouY66YcMG428s5qi7Io8mt4TSxxGWeC+Lz66trUVzc7PxmTHHIybm0gQ/7YQl3nLRWpYuXYrKStfV1dFhzcsNQ7xnxEy+tLQUHR0dyM311Ez3EZodrpUwxOsSm9NramqSSdYDMwFM1/0iusWrE9vj8vLy0NnZicLC96upLvI8k61RmF4QJAOinzZhwgR25coVJtLS0uKmkcAMqRa7CQSdlldGSTbJokWLvBQUVmzx82ZRokm2lFOnTjEZj5anOjzXF3RZXq68Ss+MGTOwcKHvfTmP0tw0LegS7xHK75Js2mQ9dsdDgWHyotcbRI1VchIbHBwclmQ5zc3NXpIto44kLR1Euizvy+IBtzrRPRHxwfKKAWzzehMVdIj3mNzb1dvbm/ps7/D89UnKKgJFh3g7xIPGxkajVhEw/AEdD4J4K8SDVatWGe12AaOlsSBo8T4hLmVUUVGBtrY2xONapoitDLq+G7R4T9NSlgbcr2toaLC9wIcCw6Sa6tKBEaR4C3iHmHkwatQodHV1YcSIEUG+jwzv2y0I6uZBirdY9Ld4l+KSJUsCfJwlT5HrEghBiTcBQJt5wPM43ghQXh7KMqDPhfFQL3SJXn9hYSE7c+aMZY1CprGx0WsNQw6OuuOcEITlFVBJl2TWrFmGfxcSI6nPxHeCEK9YnrEzMDCQ+mw9fDbsCKjynJhsioqK2N27d5WSLGf27Nl+J1tGwzqq/X7RICzvvuoYbwTQ5BTbUUgOu6/4LV4DDRtL0tcX2mgIkTiNUPC1scBv8b4iHrS3txstxhHhcb/XnPdTvCK5CZxbXX5+fuorLPCxeiZTQNbn2zv7Kd6AeL+qqiqjMzsnJ1Ljrnmt54N+3czPN7tvJW3eme1glKcuJlO+7At+icdrFB8wD8aMGWOIp7kRQJVN1N7nGb/E6xEr4HV1dWhpiewsp4XiP9oLfojHi9M55gG3tsWLF7tuLQ6wwBBRXY/PFj/EmytmwiUlJVi9OvK70KjucmWLV/HGyONPeAPA9OnuW781WV48CvsM1cn1yBMnTijXY62or68Pom5rFX7r9eW9WF6cRmQmmTp1qjHKM0OYRoMiQxGPDyT8jPiFOaI9Q3hEYSVIW7yIt0D2l9av17pboFdyqLCTd3lRxot4u8SD5cuXY+LEianPVoAXFkKBYeZTQVJNg5C0isd3hJovfrFtm+9ja5zsk+aWArGjyiluxdstHtTX1xshQ+lwu9SSW/H4SIAkPT09hnOcoYxzO/XUjXi94jyKsrIyo0/W4yQUAynP08mzbjancyPe09SdZ8Db7DQMGQuauW4aC5yK1ygOnjEnoRQVuS7t7yNEywPt8OIIp+J1AphkHlRXV6O7u9tTjF2IFZS6W50uj+5EvHHixm28eb21tRXjxnmbaG3Or5VEZJKfJ/4YpPviqIrkRLzHxQnGvGNn3bp1jmJmhzRJOSb5ebomI7+kcE4SVfHyKckm4StRLFiwwFUMZULO60R4jaNW9WRV8UrlHvfNmze7jeAwuNXxIIgoKykn46CIBzEJpld8gZycHHbv3j1P7XYmiUQi+fnOnTuspqbGfE7CxUI1foSLqgMiVS3v8+JBf3+/b/2xNgsymHme7vQ8ibYGS4uKAlPlUeUbN/q/jJNNnieqq0PIfJqGkFYbFfFeFg+ampowc6anBthhcOFMC+SOtw26St0nVVaIVBHvGfGAN3gWFDgbYJ6uJDWFSyQSGBoydqKx8vOsfL6gGEvr03viBVod24j8+PHj2fnz530pHERu3LjBDhw4wDo7O1k8Hrda5jeMwoN3EI33It5vxBv29/ez27dv+yIaHy16+vRptn37dlZbW8tF012qqgTXjmyruAhqQUEBO3z4sGurM7l58yY7cuQIW7FiBSsrKxNfQMWy/DpHNbzqNp99RXzAnDlz2LVr11wJxq3s3LlzbM+ePcaYY+4n2kT+PVpDlLdW8x6lI7Q+cljW53i00mQxyebm5rIdO3Y4Fo3P5j527Fhi7dq1rLS0VLYc2UL4oOs3Aay1WAP+QwD2APg9gLs21hhEvuh4LPNHxRuUl5ezs2fPKlvZhQsX2N69e9n8+fNZLBZLpHmxP9JWhHMU4lVCqz0etLmf0+/TBUfLa/KWzdfEG7a3t6cVjVfXeJ7Y19fHKioq0kWIl+CHabKL4+ZvqoPOBvAlAH/RkHSV3ZaZtBVg8uKDBw9aCsZL0UuXLhnLVc6bN4/l5eXZRYAnt8sAvkmjM/1YuihG4vPq1E9pG8QgxLPaHnsY3Gl+XrywpKRkmGhDQ0Ps5MmTbMuWLWzSpEnpHjwI4Ce02k7QU7yfoK1cL4v+qQ/hbZUUkk+7eSYfuGvXrqRoV69eZfv372cdHR3pSkwe3gHwHVobVDdjaYWL4z6J965KU9UT4kV8tuLly5cNKxsYGGBVVVW8AEiXlx0nK5sQgmgycerU/jaAv3sU8Ifp9uL4sXhBZWUl6+7uNhzkNDf+N1nZfNpyNWrw7GgK/VN/4TJJX7cbmlEoX8D9O5ub8Xmsv6bkMTmqG7tZMJKykgMKO7/IYXeqm+5WvAHfGvoNANrnvPtMjJbK5O99xsL5tgpvAbAcCnbJ5iLuupymB03NICtTJZ/GKL+hUBUclnS7aUtn+UTuN31PXufzASaHRkTspB1frPLGQ3LBcVT4kVdj/kB9mMrdcA8gJdTd+qZcaaDfDJpojfUhasFYkd2c7T7yyIi+RvVwLt5e84Qean4KdPWbB4QiGpLxqvk6oc9hz1BG5NCQ+uwuds4oAoD/A34T/V6EcoYJAAAAAElFTkSuQmCC'/%3e%3c/svg%3e",MT={N:180,NNE:157.5,NE:135,ENE:112.5,E:90,ESE:67.5,SE:45,SSE:22.5,S:0,SSW:337.5,SW:315,WSW:292.5,W:270,WNW:247.5,NW:225,NNW:202.5},EF=({siteViews:t,overviewPicture:e})=>{const[n,r]=Y(QA),[i]=Y(No),s=S.useRef(null),[,o]=Y(HA),[,a]=Y(Xl),[l,u]=S.useState(!1);S.useEffect(()=>{if(!s.current)return;let h=null,d=null,f=null;const g=new IntersectionObserver(m=>{m[0].isIntersecting&&(o(!0),a(!0),u(!0),f=setTimeout(()=>u(!1),5e3),h=setTimeout(()=>{o(!1)},4850),d=setTimeout(()=>{a(!1)},5e3),g.disconnect())},{threshold:.1});return g.observe(s.current),()=>{g.disconnect(),h&&clearTimeout(h),d&&clearTimeout(d),f&&clearTimeout(f)}},[s]);const c=t.map(h=>h.compass);return e?p.jsx("div",{ref:s,children:p.jsx("button",{"data-tooltip-id":"viewSelector","data-tooltip-place":"top",onClick:()=>r(!n),className:`compass z-6 absolute left-1/2 top-1/2 flex h-[68px] w-[68px] -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full shadow-[2px_3px_8px_rgba(0,0,0,0.4)] transition-all hover:ring-4 hover:ring-black/10 sm:h-[82px] sm:w-[82px] ${n?"scale-95 shadow-none":""}`,children:p.jsx("div",{className:`${l?"animate-pulse-scale":""} flex items-center justify-center`,children:p.jsx("img",{src:Nd,alt:"compass",style:{transform:`rotate(${MT[c[i]]}deg) scale(1.03)`,transition:"transform 0.5s ease-out"},className:"pointer-events-none object-contain"})})})}):p.jsx("div",{className:"z-6 absolute left-1/2 h-[68px] w-[68px] -translate-x-1/2 -translate-y-1/2 transition-all sm:h-[82px] sm:w-[82px]",children:p.jsx("img",{src:Nd,alt:"compass",style:{transform:`rotate(${MT[c[i]]}deg) scale(1.03)`,transition:"transform 0.5s ease-out"},className:"pointer-events-none object-contain"})})},xF=({coordinates:t,slide:e,ref_id:n,active:r})=>{const[i,s]=Y(No);if(e<0)return p.jsx("div",{});const o=()=>{e!==i&&s(e)},a=e===i?"current":"";return p.jsx("a",{id:"camera-"+n,href:"",onClick:l=>{l.preventDefault(),o()},className:"relative block",children:p.jsx("path",{d:t,className:`camera-path scale-150 sm:scale-100 sm:hover:scale-110 ${a} ${r?"jello-horizontal":""}`})},"camera-"+n)},SF=({apartmentIdsStr:t,d:e})=>{const[n]=Y(Dv),[r]=Y(_4);if(!r)return p.jsx(p.Fragment,{});const s=["overviewapartment-path",t.split(",").map(o=>o.trim()).filter(o=>o.length>0).includes(n!=null?n:"")?"show":""];return p.jsx(p.Fragment,{children:p.jsx("path",{id:t,className:s.join(" "),d:e})})},IF=async t=>{try{if(!t)return{viewBox:"",paths:[]};const e=await fetch(t);if(!e.ok)throw new Error("Failed to load SVG");const n=await e.text(),i=new DOMParser().parseFromString(n,"image/svg+xml"),s=i.querySelector("svg"),o=(s==null?void 0:s.getAttribute("viewBox"))||"",a=Array.from(i.querySelectorAll("path, polygon, circle")).map(l=>{const u=l.tagName.toLowerCase()==="polygon",c=l.tagName.toLowerCase()==="circle",h=(f,g,m)=>(parseFloat(m)||0)===0?"":`M ${+f-+m},${+g} A ${+m},${+m} 0 1,0 ${+f+ +m},${+g} A ${+m},${+m} 0 1,0 ${+f-+m},${+g} Z`;let d="";return u?d=`M ${l.getAttribute("points")||""} z`:c?d=h(l.getAttribute("cx")||"",l.getAttribute("cy")||"",l.getAttribute("r")||""):d=l.getAttribute("d")||"",{id:l.getAttribute("id")||"",ref_id:l.getAttribute("data-ref_id")||"",type:l.getAttribute("data-type")||"view",coordinates:d}});return{viewBox:o,paths:a}}catch(e){return console.error("Error loading SVG:",e),{viewBox:"",paths:[]}}},AF=t=>{var n,r,i,s;const e=hr({queryKey:["svgUrl",t],queryFn:()=>IF(t)});return[(r=(n=e==null?void 0:e.data)==null?void 0:n.viewBox)!=null?r:"",(s=(i=e==null?void 0:e.data)==null?void 0:i.paths)!=null?s:[],e.status]},TF=({siteViews:t,overviewPicture:e,overviewPictureSVG:n})=>{const[r,i]=AF(n),[s,o]=Y(QA),a=t.map(h=>h.viewname),[l,u]=S.useState(1);S.useEffect(()=>{const h=new Image;h.src=e,h.onload=()=>{u(h.naturalHeight/h.naturalWidth)}},[e]);const c=()=>l===1?"top-[2%] h-[60%] w-[60%] left-[20%] sm:top-[29%] sm:left-[28%] sm:h-[44%] sm:w-[44%] min-[420px]:top-[7%] min-[420px]:left-[20%] min-[420px]:h-[60%] min-[420px]:w-[60%]":"top-[10%] h-[70%] w-[70%] left-[15%] sm:top-[43%] sm:left-[28%] sm:h-[44%] sm:w-[44%] min-[420px]:top-[15%]";return s?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`absolute left-0 top-0 h-full w-full cursor-default ${s?"visible":"invisible"}`,role:"button",tabIndex:0,onKeyDown:h=>h.key==="Enter"&&o(!1),onClick:()=>o(!1)}),p.jsx("div",{className:`absolute left-[15%] ${c()} cursor-default opacity-90 ${s?"visible scale-100 opacity-100":"invisible scale-90 opacity-0"}`,children:p.jsxs("div",{className:"relative inline-block",children:[p.jsx("img",{alt:"ViewImage",src:Po(e),className:"block h-auto max-w-full rounded-md"}),p.jsx("svg",{className:"absolute left-0 top-0",viewBox:`${r}`,preserveAspectRatio:"none",children:i.map(h=>{if(h.type=="view")return p.jsx(xF,{coordinates:h.coordinates,slide:a.indexOf(h.ref_id),ref_id:h.ref_id,active:s},h.ref_id);if(h.type=="apartment")return p.jsx(SF,{apartmentIdsStr:h.ref_id,d:h.coordinates,toolTipPlace:h.tooltipplace,toolTipId:"apartment-tooltip"},h.ref_id)})})]})})]}):null},CF=()=>{const[t,e]=Y(HA),[,n]=Y(Xl);return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`absolute left-0 top-0 h-full w-full cursor-default ${t?"visible":"invisible"}`,role:"button",tabIndex:0,onKeyDown:r=>r.key==="Enter"&&e(!1),onClick:()=>{e(!1),n(!1)}}),p.jsx("div",{className:`absolute left-1/2 top-[5%] z-10 w-64 -translate-x-1/2 transform rounded-md bg-black p-3 text-xs text-white shadow-lg transition-all duration-300 ease-out sm:top-[10%] sm:w-80 sm:text-base ${t?"visible scale-100 opacity-80":"invisible scale-90 opacity-0"}`,id:"viewSelector",children:p.jsx("div",{className:"flex flex-col items-center justify-center gap-2 text-center",children:"Klicka i bilden för att se mer information"})})]})},bF="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='470'%20height='304'%20viewBox='0%200%20470%20304'%3e%3cimage%20x='13'%20y='12'%20width='450'%20height='280'%20xlink:href='data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAEYCAYAAADPvfYMAAAGSUlEQVR4nO3dTarkVBjH4ff2FXWmLe5HBAfOXYDoxCW0S7BXoI0K7RL8BgeOFL9xHboB2270NgUVKK/3oypJpXLO/3ngpaY5OQd+BELlvGB/b1bVP1X1p3sGQJq3thH8vapesPsAJBkieLGdH8QQgBSXIzjMj2IIQO+ui6AYAtC92yI4zE9iCEBv9o2gGALQnUMjKIYAdGNsBIf5WQwBaNXUCIohAM2aK4LD/CKGALRi7giKIQDNOFYExRCA1Tt2BHdj+KLjAMCaLBVBMQRgdZaOoBgCsBqniuAwv4ohAKdy6giKIQAns5YI7sbwruMAwBLWFkExBGAxa42gGAJwdGuP4DC/iSEAc2slgmIIwOxai+BuDF9yHACYotUIiiEAk7Uewc08qqpXHAUADtVLBF+38wAcSgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIigCAKQRgQBiCWCAIhgw/OXCAIwhggCEEsEARBBEQQgjQgCEOttEQRABEUQgDAiCEAsEQRABEUQgDQiCEAsEQRABEUQgDQiCEAsEQRABEUQgDQiCEAsEQRABEUQgDQiCEAsEQRABEUQgDQiCEAsEQRABEUQgDQiCEAsEQRABEUQgDQiCEAsEQRABEUQgDQiCEAsEQRABEUQgDQiCEAsEQRABEUQgDQiCEAsEQRABEUQgDQiCEAsEQRABEUQgDQiCEAsEQRABEUQgJaczXCtmwh+WFV3Gt/5b6rq2xVcBwDL+WhqCHuJIACZXp0SMBEEoHUvj42YCALQg7MxIRNBALpxaMxEEICuHBI0EQSgN0/2jZoIAtCjf/cJmwgC0K3b4iaCAHTtpsCJIADduy5yIghAgourQieCAKR4fDl2IghAlN3giSAAcYboiSAAkTbhe2fzPSYRBCDRJn53Z/pALwC05sl5VX1XVX9X1Wu2D4AwD8+36xVDABJ9cr6zaDEEIM1/QlhiCECY/4WwxBCAIA+vCmGJIQAhHlwXwhJDAAJ8fFMISwwB6NytISwxBKBje4WwtjF8JIYAdGbvEG58L4YAdObGl2WuIoYA9OSDQ0NYYghARw5+IhyIIQA9GB3CEkMAOvDgmYlruL/9fa/xe/G4qt7fhh2AHH/MtdJ7VXXR+HxdVc87/ACMJYYAxBNDAOL1EsPn0jcSgPHEEIB4YghAPDEEIJ4YAhBPDAGIJ4YAxBNDAOKJIQDxxBCAeGIIQDwxBCBeDzH8SgwBmEIMAYgnhgDEE0MA4okhAPHEEIB4YghAPDEEIJ4YAhBPDAGIJ4YAxBNDAOL1EsNn0zcSgPHEEIB4YghAPDEEIJ4YAhBPDAGIJ4YAxBNDAOKJIQDxxBCAeGIIQDwxBCCeGAIQr4cYfimGAEwhhgDEE0MA4okhAPHEEIB4YghAPDEEIJ4YAhBPDAGIJ4YAxBNDAOKJIQDxeojhF2IIwBRiCEA8MQQgnhgCEE8MAYgnhgDEE0MA4okhAPHEEIB4YghAPDEEIJ4YAhCvhxh+LoYATCGGAMQTQwDiiSEA8cQQgHhiCEA8MQQgnhgCEE8MAYgnhgDEE0MA4okhAPHEEIB4PcTwMzEEYAoxBCCeGAIQTwwBiCeGAMQTQwDiiSEA8cQQgHhiCEA8MQQgnhgCEE8MAYjXQww/FUMAphBDAOKJIQDxxBCAeGIIQDwxBCCeGAIQTwwBiCeGACPccdO6cb+q3m18MWcruAYAGtfqk6G/YANgNq3FUAQBmF0rMRRBAI5m7TEUQQCObq0xFEEAFrO2GIogAItbSwxFEICTOXUMRRCAkztVDEUQgNVYOoYiCMDqLBVDEQRgtY4dQxEEYPWOFUMRBKAZc8dQBAFozlwx9E1BAJo1NYYiCEDzxsZQBAHoxqExFEEAurNvDEUQgG7dFkMRBKB718VQBAGIcTmGIghAnHsiCEC6N0QQ6EpVPQXgd37xi5CxhgAAAABJRU5ErkJggg=='/%3e%3c/svg%3e",RF="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='470'%20height='304'%20viewBox='0%200%20470%20304'%3e%3cimage%20x='13'%20y='12'%20width='450'%20height='280'%20xlink:href='data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAEYCAYAAADPvfYMAAAGWElEQVR4nO3dS8os5R3A4b8fenRmTnTkGrIHMxLnWYBEkoETp+oOPGtQsockXoaCE+MNlxNvR6VCR454Lt+lv+6q+j0PFDQ03VT1+8KPqi7eGoCd+dPMvGZQASh6fma+mZn7M/NXMwCAkiWCn83Mz4dNDAHIWCL4nwciKIYAZDwqgmIIwO4tEfz8MREUQwB267IRFEMAdueqERRDAHZjieAX14igGAKweTeNoBgCsFlLBL88QgTFEIDNOXYExRCAzbitCIohAKv3h1uOoBgCsFqniqAYArA6p46gGAKwGksEvzpDBMUQgLM7dwTFEICzubuSCIohACe3tgiKIQAns9YIiiEAt26J4NcrjqAYAnBrthJBMQTg6P64sQiKIQBHs9UIiiEAR/HyzHy74RCKIQA39qoYAlAnhgDkiSEAeWIIQJ4YApAnhgDkiSEAeWIIQJ4YApAnhgDkiSEAeWIIQJ4YApAnhgDkiSEAeWIIQJ4YApAnhgDkiSEAeWIIQJ4YApAnhgDkiSEAeWIIQJ4YApAnhgDkiSEAeWIIQJ4YApAnhgDkiSEAeWIIQJ4YApAnhgDkiSEAeWIIQJ4YApAnhgDkiSEAeWIIQJ4YApAnhgDkiSEAeWIIQJ4YApAnhgDkiSEAeWIIQJ4YApAnhgDkiSEAeUsM/yuGAJSJIQB5YghAnhgCkCeGAOTtJYav1wcSgOsTQwDyxBCAPDEEIE8MAcgTQwDyxBCAPDEEIE8MAcgTQwDyxBCAPDEEIE8MAcgTQwDyxBCAPDEEIE8MAcgTQwDyxBCAPDEEIE8MAcgTQwDyxBCAPDEEIE8MAcgTQwDyxBCAPDEEIE8MAcgTQwDyxBCAPDEEIE8MAcgTQwDyxBCAPDEEIE8MAcgTQwDyxBCAPDEEIE8MH/D0zLwwM3+rzwqAmE9n5pUNH/LFzLx3eP2Pm3zRUzPz55n55Dj7BQAn9dPM/P0mMVyK+qIxA2Cj/n9meO3LpBeHs0IASMbw4vj7AwAnd+0YCiEAe3GtGC4f+sEUAGAnrhzDi8MdNwCQjKFLowDs0aVjKIQA7NWlYiiEAOzZE2N4cVizDQD26rExXN783tADsHOPjKFLowBUPDSGQghAye9iKIQA1Pwmhk8bfgCClhi+PzPPWGINgKrl6Ut3LbEGQNU7M/Ou/wgBKPpfBMfNMgAE/RrBEUIAYn4TwbHEGgAhv4vgHEL4nVkAwM49NILj0igAAY+M4AghADv32AiOEAKwY0+M4FhiDYCdentm7l3m0JYzwh/NAgB25NIRnEMI7xt9AHbiShEc/xECsCNXjuAIIQA7ca0IjhACsAPXjuAcnsX00sy8aSYApDw3M2/MzJ2NH/SNIghA0xLBjw9rTW95e8v8BeCqRBCALBEEIOtZEQRABEUQgBgRBCBLBAEQQREEoEYEAcgSQQBEUAQBqBFBALJEEAARFEEAakQQgKwlgh+JIABFIghAlggCIIIiCECNCAKQJYIAiKAIAlAjggBkiSAAIiiCANSIIABZIghA1h0RBEAERRCAGBEEIEsEARBBEQSgRgQByBJBAERQBAGoEUEAskQQABEUQQBqRBCALBEEIB3BD0UQgCIRBCBLBAEQQREEoEYEAcgSQQBEUAQBqBFBALJEEAARFEEAakQQgCwRBCAdwQ9EEIAiEQQgSwQBEEERBKBGBAHIEkEARFAEAagRQQCyRBAAERRBAGpEEIAsEQQgHcF/iyAARSIIQJYIAiCCIghAjQgCkCWCAIigCAJQI4IAZIkgACIoggDUiCAAWSIIgAiKIAA1SwT/JYIAFIkgAFkiCIAIiiAANSIIQJYIAiCCIghAjQgCkCWCAIigCAJQI4IAZIkgAOkI/lMEASgSQQCyRBAAERRBAGpEEIAsEQRABEUQgBoRBCBLBFmVC8MBnMFTG//R356ZeyvYDwA2astLqDkTBOAothhDEQTgqLYUQxEE4FZsIYYiCMCtWnMMRRCAk1hjDEUQgJNaUwxFEICzWEMMRRCAszpnDEUQgFU4RwxFEIBVOWUMRRCAVTpFDEUQgFW7zRiKIACbcBsxFEEANuWYzzIUQQA26RgxFEEANu0mMRRBAHbhOjEUQQB25SoxFEEAdukyMRRBAHbtcTEUQQASHhZDEQQg5cEYiiAASUsM/2LouZSZ+QUgtWhuPcb5WwAAAABJRU5ErkJggg=='/%3e%3c/svg%3e",kF=({totalSlides:t})=>{const[e,n]=Y(No),r=t===1?"oneslidebutton":"";return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`-bottom-15 absolute left-[calc(50%-100px)] flex h-12 -translate-x-1/2 items-center justify-center ${r}`,children:p.jsx("button",{onClick:()=>n(i=>Math.max(i-1,0)),disabled:e===0,children:p.jsx("img",{src:bF,alt:"arrow left",className:`h-8 w-8 ${e===0?"opacity-50":"hover:h-9 hover:w-9"}`})})}),p.jsx("div",{className:`-bottom-15 absolute left-[calc(50%+100px)] flex h-12 -translate-x-1/2 items-center justify-center ${r}`,children:p.jsx("button",{onClick:()=>n(i=>Math.min(i+1,t-1)),disabled:e===t-1,children:p.jsx("img",{src:RF,alt:"arrow right",className:`h-8 w-8 ${e===t-1?"opacity-50":"hover:h-9 hover:w-9"}`})})})]})},PF=50,NF=()=>{const[t]=_t(),[e]=Id(),[n,r]=S.useState([0,0]),[i,s]=S.useState(!1),[o,a]=Y(No),[l,u]=Y(y4),c=S.useRef(null),h=S.useRef(null);if(S.useEffect(()=>{if(e.length>0){const w=new Image;w.onload=()=>{r([w.width,w.height]),s(!0)},w.src=e[0].daypicture}},[e]),!i)return p.jsx("section",{className:"sec-loading",children:p.jsx("div",{className:"one",children:p.jsx("img",{className:"bottom-10 h-32 w-32",alt:"logo",src:Uv})})});const d=e.length,f=w=>{c.current=w.touches[0].clientX,h.current=null},g=w=>{h.current=w.touches[0].clientX},m=()=>{if(!c.current||!h.current)return;const w=c.current-h.current;Math.abs(w)>PF&&(w>0&&o<d-1?a(o+1):w<0&&o>0&&a(o-1))};return p.jsxs("div",{className:"relative select-none pb-12",children:[p.jsx("div",{className:"overflow-hidden",style:{aspectRatio:`${n[0]} / ${n[1]}`},onTouchStart:f,onTouchMove:g,onTouchEnd:m,children:p.jsx("div",{className:"flex transition-transform duration-500 ease-in-out",style:{transform:`translateX(-${o*100}%)`},children:e.map((w,v)=>{let y=w.svgurl;return y&&(y=w.svgurl),p.jsxs("div",{className:"relative w-full flex-shrink-0 overflow-hidden",style:{flexBasis:"100%"},children:[p.jsx(I4,{viewid:w.viewid,picture:w.daypicture,compass:w.compass,svgurl:y}),p.jsx(yF,{}),p.jsx(_F,{}),p.jsx(wF,{})]},v)})})}),p.jsx("div",{className:`absolute left-0 top-0 h-full w-full cursor-default ${l?"visible":"invisible"}`,role:"button",tabIndex:0,onKeyDown:w=>w.key==="Enter"&&u(!1),onClick:()=>u(!1)}),p.jsx(vF,{}),p.jsx(TF,{siteViews:e,overviewPicture:t.overviewpicture,overviewPictureSVG:t.overviewpicturesvg}),p.jsxs("div",{className:"absolute bottom-14 left-1 flex space-x-[2px] md:left-2 md:space-x-[6px]",children:[p.jsx(C4,{}),p.jsx(pF,{}),p.jsx(dF,{})]}),p.jsx(T4,{}),p.jsx(CF,{}),p.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 -translate-y-1/2",children:p.jsx(EF,{siteViews:e,overviewPicture:t.overviewpicture})}),p.jsx(mF,{}),p.jsx(kF,{totalSlides:d})]})},OF=()=>{const[t]=Y(eT),[e,n]=Y(GA);return t.filter(r=>r>0).length<2?p.jsx(p.Fragment,{}):p.jsx("li",{className:"ml-6 h-6",children:p.jsx("button",{className:"font-style-one ml-auto font-bold","data-tooltip-id":"filterBox",onClick:()=>n(!e),children:"Filtrera"})})};function DF(){const[t,e]=Y(qA),[n]=_t(),[r,i]=Y(Xl),s=Ga(),a=aE([{path:"/:company/admin/*"}],s),u=a?a[0].params.company:"";if(S.useEffect(()=>{U3(yd,f=>{f&&f.uid?e({id:f.uid}):e({id:"anonymous"})})},[]),t&&t.id==="anonymous"&&M3(yd,window.location.href)){let f=window.localStorage.getItem("emailForSignIn");f||(f=window.prompt("Please provide your email for confirmation")),f&&L3(yd,f,window.location.href).then(()=>{window.localStorage.removeItem("emailForSignIn")}).catch(g=>{throw new Error(g.message)})}function c(f){i(f||!r)}const h=()=>{$3(yd).then(()=>{e({id:"anonymous"})}).catch(f=>{console.log(f)})};if(u)return p.jsx("header",{className:"mb-2 mt-2",children:p.jsx("nav",{children:p.jsxs("ul",{className:"flex flex-wrap justify-between",children:[p.jsx("li",{className:"ml-3 mr-5 text-base font-extrabold",children:"ADMIN PAGE"}),t&&t.id!=="anonymous"&&p.jsx("li",{className:"mr-2 flex items-center text-xs md:mr-5 md:text-sm",children:p.jsx("div",{className:"flex justify-end",children:p.jsx("button",{onClick:()=>h(),children:"Sign out"})})})]})})});const d=()=>{if(n.type==="condominium")return"Bostadsrätter";if(n.type==="ownership")return"Äganderätter";if(n.type==="rental")return"Hyresrätter"};return p.jsx("header",{className:"mt-2 sm:mb-1",children:p.jsx("nav",{children:p.jsxs("div",{className:"flex flex-col justify-between sm:flex-row",children:[p.jsxs("ul",{className:"flex list-none sm:mt-0",children:[p.jsx("li",{className:"font-style-one ml-3 mr-2 font-bold sm:mr-5",children:d()}),(n==null?void 0:n.statuslabels.available)&&p.jsxs("li",{className:"mr-1 flex items-center text-xs sm:mr-2",children:[p.jsx("svg",{width:"16",height:"16",children:p.jsx("circle",{cx:"8",cy:"8",r:"3",className:"svg-circle-available",fill:"#18974d"})}),p.jsxs("span",{className:"whitespace-nowrap",children:[" ",n==null?void 0:n.statuslabels.available]})]}),(n==null?void 0:n.statuslabels.reserved)&&p.jsxs("li",{className:"mr-1 flex items-center text-xs sm:mr-2",children:[p.jsx("svg",{width:"16",height:"16",children:p.jsx("circle",{cx:"8",cy:"8",r:"3",className:"svg-circle-reserved",fill:"orange"})}),n==null?void 0:n.statuslabels.reserved]}),(n==null?void 0:n.statuslabels.sold)&&p.jsxs("li",{className:"mr-1 flex items-center text-xs sm:mr-2",children:[p.jsx("svg",{width:"16",height:"16",children:p.jsx("circle",{cx:"8",cy:"8",r:"3",className:"svg-circle-sold",fill:"#ec3326"})}),n==null?void 0:n.statuslabels.sold]})]}),p.jsx("hr",{className:"ml-3 mr-3 h-px border-0 bg-black sm:ml-0 sm:mr-0"}),p.jsxs("ul",{className:"ml-3 mr-3 flex flex-grow list-none border-t p-0 sm:border-t-0",children:[p.jsx("li",{className:"ml-auto h-6 font-bold",children:p.jsx("button",{className:"font-style-one whitespace-nowrap",onClick:()=>c(),children:n.type==="rental"?"Visa lediga lägenheter":"Visa bostäder till salu"})}),p.jsx("li",{className:"flex items-center",children:p.jsx(DT,{checked:r,action:()=>c()})}),p.jsx(OF,{})]})]})})})}const MF=()=>{const[t]=_t();return t!=null&&t.disclaimer?p.jsx("div",{className:"p-2 text-left text-xs text-gray-500",children:p.jsx("p",{children:t==null?void 0:t.disclaimer})}):p.jsx(p.Fragment,{})},LF=()=>window.self!==window.top,VF=()=>{const[t,e]=Y(Ov),[n]=_t();return t?Kt()&&LF()?p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-90 p-0 md:p-4",children:p.jsxs("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:[p.jsx("iframe",{src:n.galleryButton.data,className:"absolute left-0 top-0 h-full w-full rounded-lg border-0",allowFullScreen:!0,title:"Rundvandring"}),p.jsx("button",{onClick:()=>e(!1),className:"text-s absolute left-1/2 top-4 -translate-x-1/2 rounded bg-black bg-opacity-50 px-4 py-2 text-white hover:bg-opacity-75",children:"✕"})]})}):p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-90 p-0 md:p-4",children:p.jsxs("div",{className:"relative h-full w-full md:h-[80vh] md:max-w-7xl md:overflow-hidden md:rounded-lg md:bg-black",children:[p.jsx("iframe",{src:n.galleryButton.data,className:"h-full w-full",allowFullScreen:!0,title:"Virtual Tour"}),p.jsx("button",{onClick:()=>e(!1),className:"absolute left-1/2 top-4 -translate-x-1/2 rounded bg-black bg-opacity-50 px-4 py-2 text-2xl text-white hover:bg-opacity-75",children:"✕"})]})}):null},a0=({isOpenAtom:t,pathSegment:e,children:n,className:r})=>{const[i,s]=Y(t);S.useEffect(()=>{i&&window.history.pushState({modal:e},"",`#${e}`);const u=()=>{i&&s(!1)};return window.addEventListener("popstate",u),()=>{window.removeEventListener("popstate",u)}},[i,e,s]);const o=()=>{var u;s(!1),((u=window.history.state)==null?void 0:u.modal)===e&&window.history.back()};if(S.useLayoutEffect(()=>{if(!i)return;const u=document.documentElement,c=document.body,h=u.style.overflow,d=c.style.overflow,f=u.style.paddingRight,g=window.innerWidth-u.clientWidth;return u.style.setProperty("overflow","hidden","important"),c.style.setProperty("overflow","hidden","important"),u.style.setProperty("overscroll-behavior","contain","important"),c.style.setProperty("overscroll-behavior","contain","important"),g>0&&u.style.setProperty("padding-right",`${g}px`,"important"),()=>{u.style.overflow=h,c.style.overflow=d,u.style.paddingRight=f,u.style.removeProperty("overscroll-behavior"),c.style.removeProperty("overscroll-behavior")}},[i]),!i)return null;const a=window.__PintarStudiosModalMount,l=a||document.body;return rE.createPortal(p.jsxs("div",{id:`pintarstudios-${e}-modal`,className:"fixed inset-0 z-[2147483647] flex items-center justify-center",children:[p.jsx("div",{tabIndex:0,role:"button",className:"absolute inset-0 cursor-default bg-black/90",onClick:o}),p.jsxs("div",{className:`${r||""}`,children:[n,p.jsx("button",{onClick:o,className:"absolute left-1/2 top-3 z-[9999] -translate-x-1/2 rounded bg-black/70 px-3 py-1 text-white hover:bg-black/90 md:top-4 md:px-4 md:py-2 md:text-2xl",children:"✕"})]})]}),l)};var l0=function(t,e){return l0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},l0(t,e)};function FF(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");l0(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var u0=function(){return u0=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},u0.apply(this,arguments)};function UF(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 i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}var $F=Object.getOwnPropertyNames(Fo.prototype).filter(function(t){var e=Object.getOwnPropertyDescriptor(Fo.prototype,t);return t.startsWith("_")||e!=null&&e.value?!1:!!e.set}),jF=function(t){FF(e,t);function e(r){var i=t.call(this,r)||this;return hF(i,"_vanillaView360"),i}var n=e.prototype;return Object.defineProperty(n,"view360",{get:function(){return this._vanillaView360},enumerable:!1,configurable:!0}),Object.defineProperty(n,"element",{get:function(){return this._containerEl},enumerable:!1,configurable:!0}),n.componentDidMount=function(){this._vanillaView360=new Fo(this._containerEl,this.props),this._bindEvents()},n.componentWillUnmount=function(){this._vanillaView360.destroy()},n.componentDidUpdate=function(r){var i=this,s=this._vanillaView360;$F.forEach(function(o){var a=r[o],l=i.props[o];l!==a&&(s[o]=l)})},n.render=function(){var r=this,i=this.props,s=i.tag,o=i.className,a=o===void 0?"":o,l=i.canvasClass,u=l===void 0?"":l,c=UF(i,["tag","className","canvasClass"]),h=s,d="".concat(Wn.CONTAINER," ").concat(a).trim(),f="".concat(Wn.CANVAS," ").concat(u).trim(),g={};for(var m in c)!m.startsWith("on")&&!(m in Fo.prototype)&&(g[m]=c[m]);return S.createElement(h,u0({},g,{className:d,ref:function(w){w&&(r._containerEl=w)}}),S.createElement("canvas",{className:f}),this.props.children)},n._bindEvents=function(){var r=this,i=this._vanillaView360;Object.keys(Je).forEach(function(s){var o=Je[s],a="on".concat(o.charAt(0).toUpperCase()+o.slice(1));i.on(o,function(l){l.target=r;var u=r.props[a];u&&u(l)})})},e.defaultProps={tag:"div"},e}(S.PureComponent);const zF=({yaw:t,northOffset:e=0})=>{const n=(t+e)%360;return p.jsx("div",{className:"compass pointer-events-none absolute left-4 top-4 z-10 h-[68px] w-[68px] sm:h-[82px] sm:w-[82px]",style:{transform:`rotate(${n}deg)`,transformOrigin:"center",opacity:.8},children:p.jsx("img",{src:Nd,alt:"Compass",className:"h-full w-full"})})},BF=({currentScene:t,setSelectedScene:e})=>{const[n]=Pd("cube");return p.jsx("div",{className:"absolute left-0 top-40 z-50 flex -translate-y-1/2 flex-col gap-2",children:n.map((r,i)=>{var o;const s=(t==null?void 0:t.sceneid)===r.sceneid;return p.jsx("button",{onClick:()=>e(r),className:`rounded-r-md px-4 py-2 text-sm text-white transition hover:scale-105 ${s?"scale-105 bg-[#00965f]/80 font-bold shadow-lg":"bg-black bg-opacity-50"}`,children:(o=r.name)!=null?o:`Scen ${i+1}`},`scene-button-${i}`)})})},HF=({src:t,alt:e,children:n})=>{const[r,i]=S.useState(!1),[s,o]=S.useState(!1),[a,l]=S.useState(!1),[u,c]=S.useState({x:0,y:0}),[h,d]=S.useState({x:0,y:0}),f=S.useRef(null),g=S.useRef(null),m=S.useRef({x:0,y:0});S.useEffect(()=>{i(!1)},[t]);const w=E=>{r&&(o(!0),l(!1),m.current={x:E.clientX,y:E.clientY},g.current&&(g.current.setPointerCapture(E.pointerId),f.current&&(f.current.style.cursor="grabbing")))},v=E=>{if(!r||!s)return;const I=E.clientX-m.current.x,A=E.clientY-m.current.y;(Math.abs(I)>0||Math.abs(A)>0)&&l(!0),d(T=>({x:T.x+I/2,y:T.y+A/2})),m.current={x:E.clientX,y:E.clientY}},y=E=>{r&&(o(!1),g.current&&g.current.releasePointerCapture(E.pointerId),f.current&&(f.current.style.cursor="grab"))},_=E=>{var b;if(a)return;const I=(b=g.current)==null?void 0:b.getBoundingClientRect();if(!I)return;const A=E.clientX-I.left,T=E.clientY-I.top,C=I.width/2,N=I.height/2,O=(C-A)/2,P=(N-T)/2;i(L=>!L),c(r?{x:0,y:0}:{x:O,y:P}),d(r?{x:0,y:0}:h)};return p.jsx("div",{ref:g,className:`relative flex h-full w-full select-none items-start justify-center overflow-hidden ${r?"touch-none":""}`,onClick:_,onPointerDown:w,onPointerMove:v,onPointerUp:y,onPointerCancel:y,style:{touchAction:r?"none":"auto"},children:p.jsxs("div",{className:`relative h-full w-full ${s?"":"transition-transform duration-300 ease-in-out"}`,style:{transform:r?`scale(2) translate(${u.x+h.x}px, ${u.y+h.y}px)`:"scale(1) translate(0, 0)",transformOrigin:"center center",cursor:r?s?"grabbing":"grab":"pointer"},children:[p.jsx("img",{ref:f,src:t,alt:e,draggable:!1,onDragStart:E=>E.preventDefault(),className:"pointer-events-none h-full w-full object-contain"}),n]})})},LT=t=>t*Math.PI/180,c0=(t,e,n)=>Math.min(n,Math.max(e,t)),GF=({currentScene:t,yaw:e,pitch:n,fov:r})=>{const a=25+15*Math.cos(LT(c0(Math.abs(n),0,89))),l=c0(r||75,10,160);let u=Math.tan(LT(l/2))*a;u=c0(u,1,70);const c=50+a,h=50-u,d=50+u,f=`50,50 ${h},${c} ${d},${c}`;return p.jsx("div",{className:"absolute right-3 top-3 z-50 h-36 w-36 rounded bg-white/80 p-2 sm:h-64 sm:w-64",children:p.jsx("div",{className:"relative flex h-full w-full items-center justify-center",children:p.jsx(HF,{src:t.floorplanpicture,alt:"PanoramaImage",children:p.jsxs("svg",{className:"absolute",style:{left:`calc(50% + ${t.posx}%)`,top:`calc(50% + ${t.posy}%)`,transform:`translate(-50%, -50%) rotate(${-e+t.yawoffset}deg)`,width:"60px",height:"60px"},viewBox:"0 0 100 100",children:[p.jsx("polygon",{points:f,fill:"rgba(0, 150, 95, 0.6)"}),p.jsx("circle",{cx:50,cy:50,r:"5",fill:"rgba(0, 150, 95, 0.6)"}),p.jsx("line",{x1:50,y1:50,x2:50,y2:c,stroke:"rgba(0,150,95,0.6)",strokeWidth:"1",strokeDasharray:"2 2"})]})})})})},WF=(t,e,n)=>{const[r,i,s,o]=n.split(" ").map(Number),a=(t-r)/s,l=(e-i)/o,u=-a*360-180,c=90-l*180;return{yaw:u,pitch:c}},QF=async t=>{try{if(!t)return{viewBox:"",paths:[]};const e=await fetch(t);if(!e.ok)throw new Error("Failed to load SVG");const n=await e.text(),i=new DOMParser().parseFromString(n,"image/svg+xml"),s=i.querySelector("svg"),o=(s==null?void 0:s.getAttribute("viewBox"))||"";if(!o)return{viewBox:"",paths:[]};const a=Array.from(i.querySelectorAll("circle")).map(l=>{const u=parseFloat(l.getAttribute("cx")||"0"),c=parseFloat(l.getAttribute("cy")||"0"),{yaw:h,pitch:d}=WF(u,c,o);return{id:l.getAttribute("id")||"",ref_id:l.getAttribute("data-ref_id")||"",type:l.getAttribute("data-type")||"view",yaw:h,pitch:d}});return{viewBox:o,paths:a}}catch(e){return console.error("Error loading SVG:",e),{viewBox:"",paths:[]}}},qF=t=>{var n,r;const e=hr({queryKey:["svgUrl",t],queryFn:()=>QF(t)});return[(r=(n=e==null?void 0:e.data)==null?void 0:n.paths)!=null?r:[],e.status]},KF=({currentScene:t,setSelectedScene:e})=>{const[n]=qF(t==null?void 0:t.svgurl),[r]=Pd("cube");return p.jsx("div",{className:"view360-hotspots",children:n==null?void 0:n.map((i,s)=>p.jsx("button",{className:"view360-hotspot flex h-8 w-8 items-center justify-center rounded-full bg-white font-bold text-black","data-yaw":i.yaw,"data-pitch":i.pitch,onClick:()=>e(r[i.ref_id]),children:s+10},`hotspotlinks-${s}`))})},YF=({viewerRef:t})=>{const e=i=>{var a;const s=(a=t.current)==null?void 0:a.camera;if(!s)return;const o=Math.max(.5,Math.min(3,s.zoom*i));console.log(i,s.zoom),s.animateTo({zoom:o,duration:200})},n=()=>e(1.15),r=()=>e(.85);return p.jsxs(p.Fragment,{children:[p.jsx("button",{className:"absolute bottom-2 right-2 z-50 text-white md:bottom-2",onClick:n,children:"+"}),p.jsx("button",{className:"absolute bottom-2 right-10 z-50 text-white md:bottom-2",onClick:r,children:"-"})]})},VT=({maxWidth:t,height:e,fullscreen:n})=>{const r=S.useRef(null),[i,s]=S.useState(null),[o]=Pd("cube"),[a,l]=S.useState(null),[u,c]=S.useState(0),[h,d]=S.useState(0),[,f]=S.useState(1),[g,m]=S.useState(75),[w,v]=S.useState(1),y=a||(o==null?void 0:o[0]),_=S.useCallback(T=>{T&&s(T)},[]);S.useLayoutEffect(()=>{if(!i)return;const T=new ResizeObserver(C=>{const{width:N,height:O}=C[0].contentRect;O>0&&v(N/O)});return T.observe(i),()=>T.disconnect()},[i]),S.useLayoutEffect(()=>{if(!(!i||!n))return Object.defineProperty(document,"fullscreenElement",{configurable:!0,get:()=>i}),()=>{try{delete document.fullscreenElement}catch{}}},[n,i]);const E=n?{}:{maxWidth:t?`clamp(0rem, ${t}, 90rem)`:"64rem"},I=n?{height:"100dvh",width:"100dvw"}:{height:e||"600px",width:"100%"};if(!n&&!Kt()){const T=r.current;T==null||T.control.zoom.disable()}const A=T=>{var N;c(T.yaw),d(T.pitch),f(T.zoom);const C=(N=r.current)==null?void 0:N.camera;C&&(m(C.getHorizontalFov(T.zoom)),v(C.aspect))};return y?p.jsx("div",{id:"pintar-planner-panorama-wrapper",className:"m-auto",style:E,children:p.jsx("div",{id:"pintar-planner-panorama-content-wrapper",className:"relative",style:I,ref:_,children:p.jsxs(jF,{ref:r,className:"h-full w-full",projection:y.projection,onViewChange:A,onProjectionChange:T=>T.target.hotspot.refresh(),onReady:()=>{var C;const T=(C=r.current)==null?void 0:C.camera;T&&(m(T.getHorizontalFov(T.zoom)),v(T.aspect))},zoom:{scale:1},children:[p.jsx(zF,{yaw:u,northOffset:210}),p.jsx(BF,{currentScene:y,setSelectedScene:l}),p.jsx(GF,{currentScene:y,yaw:u,pitch:h,fov:g,aspect:w}),p.jsx(KF,{currentScene:y,setSelectedScene:l}),!n&&!Kt()&&p.jsx(YF,{viewerRef:r})]})})}):null},XF=()=>{const[t]=Y(KA),[e,n]=S.useState({width:0,height:0}),r=S.useRef(null),[i]=uu(),s=S.useCallback(()=>{var d;if((d=r.current)!=null&&d.parentElement){const f=r.current.parentElement,{offsetWidth:g,offsetHeight:m}=r.current;n({width:g/f.offsetWidth*100,height:m/f.offsetHeight*100})}},[]);if(S.useEffect(()=>{var g;if(!((g=r.current)!=null&&g.parentElement))return;const d=r.current.parentElement;s();const f=new ResizeObserver(s);return f.observe(d),()=>f.disconnect()},[t,s]),!t)return null;const o=i[Number(t.reference_id)];if(!o)return null;const a=o.imageurl,l=o.name,u=t,c=u.tooltipplace,h=xd(c,u,e);return p.jsxs("div",{ref:r,className:`z-100 pointer-events-none absolute transform rounded-md bg-white shadow-lg transition-all duration-300 ease-out ${t?"visible scale-100 opacity-95":"invisible scale-75 opacity-0"}`,style:{top:`${h.y}%`,left:`${h.x}%`},children:[c==="top"&&p.jsx("div",{className:"absolute left-1/2 top-full -translate-x-1/2 border-x-[7px] border-t-[7px] border-x-transparent border-t-white opacity-90"}),c==="bottom"&&p.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 border-x-[7px] border-b-[7px] border-x-transparent border-b-white opacity-90"}),c==="left"&&p.jsx("div",{className:"absolute left-full top-1/2 -translate-y-1/2 border-y-[7px] border-l-[7px] border-y-transparent border-l-white opacity-90"}),c==="right"&&p.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-y-[7px] border-r-[7px] border-y-transparent border-r-white opacity-90"}),p.jsxs("div",{className:"min-h-56 w-64",children:[p.jsx("div",{className:"p-2",children:p.jsx("img",{src:Po(a),alt:"floorplanpicture",onLoad:s})}),p.jsx("div",{className:"mb-3 text-center text-base",children:l})]})]})},JF=({map:t,setCurrentMap:e})=>{const[,n]=Y(KA),[r]=uu(),[i,s]=OA(t.svgurl),o=S.useMemo(()=>{const f=r.map(g=>g.imageurl).filter(Boolean);return Array.from(new Set(f))},[r]),a=t==null?void 0:t.imageurl,l=S.useMemo(()=>o.filter(f=>f!==a),[o,a]),u=S.useRef(null),c=S.useMemo(()=>o.join("|"),[o]),h=S.useCallback(f=>{f.forEach(g=>{const m=new Image;m.decoding="async",m.src=g})},[]),d=S.useCallback(()=>{c&&u.current!==c&&(u.current=c,l.length&&h(l))},[c,l,h]);return p.jsxs(p.Fragment,{children:[p.jsx(o0,{src:t.imageurl,alt:"MapImage",onLoad:d}),p.jsx(XF,{}),s.length>0&&p.jsx("svg",{className:"absolute left-0 top-0",viewBox:`${i}`,preserveAspectRatio:"none",children:s.map(f=>f.type==="view"?p.jsx(Jl,{location:f,className:"view-path",setArea:n,onClick:g=>{g.preventDefault(),n(null),e(r[Number(f.ref_id)])}},f.id):null)})]})},ZF=({currentScene:t,setSelectedScene:e})=>{const[n]=uu();return p.jsx("div",{className:"absolute left-0 top-10 z-50 flex flex-col gap-2",children:n.map((r,i)=>{var o;const s=(t==null?void 0:t.mapid)===r.mapid;return p.jsx("button",{onClick:()=>e(r),className:`rounded-r-md px-2 py-1 text-xs text-white transition hover:scale-105 md:px-4 md:py-2 md:text-sm ${s?"ml-[3px] scale-105 bg-[#00965f]/80 font-bold shadow-lg":"bg-black bg-opacity-50"}`,children:(o=r.name)!=null?o:`Scen ${i+1}`},`scene-button-${i}`)})})},FT=({maxWidth:t})=>{const[e,n]=S.useState(null),[r]=uu();return S.useEffect(()=>{r&&r.length>0&&n(r[0])},[r]),e?p.jsx("div",{id:"pintar-planner-map-wrapper",className:"m-auto",style:{maxWidth:t?`clamp(0rem, ${t}, 90rem)`:"64rem"},children:p.jsxs("div",{className:"pintar-planner-content-wrapper relative",children:[p.jsx(JF,{map:e,setCurrentMap:n}),p.jsx(ZF,{currentScene:e,setSelectedScene:n})]})}):null},eU=({times:t,setSelectedSolar:e,solars:n,currentSolar:r})=>{const i=o=>{const a=parseFloat(o.target.value),l=Math.round(a);n[l].id!==r.id&&e(n[l])},s=o=>{const a=o.target;a.value=String(Math.round(parseFloat(a.value)))};return r?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"flex w-[81%] flex-col items-center px-2",children:p.jsx("div",{className:"relative flex w-full justify-between",children:t.map((o,a)=>p.jsx("div",{className:"flex flex-col items-center",children:p.jsx("span",{className:"text-l text-white",children:o})},a))})}),p.jsx("div",{className:"flex w-3/4 flex-col items-center px-2",children:p.jsxs("div",{className:"relative mt-1 flex w-full items-center justify-between",children:[t.map((o,a)=>p.jsx("div",{className:"flex flex-col items-center",children:p.jsx("div",{className:"h-3 w-[3px] rounded-sm bg-white opacity-80"})},a)),p.jsx("div",{className:"pointer-events-none absolute inset-x-1 top-1/2 flex h-2 items-center justify-between md:inset-x-2",children:Array.from({length:t.length-1}).map((o,a)=>p.jsx("div",{className:"flex flex-col items-center",children:p.jsx("svg",{width:"100%",height:"6",children:p.jsx("line",{x1:"0",y1:"3",x2:"100%",y2:"3",stroke:"white",strokeWidth:"2",strokeDasharray:"1,8",strokeLinecap:"round"})},a)},a))})]})}),p.jsx("div",{className:"w-3/4",children:p.jsx("input",{id:"default-range",min:"0",max:n.length-1,type:"range",step:"any",onChange:i,onMouseUp:s,onTouchEnd:s,className:"mt-2 h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 accent-[#00965f] dark:bg-gray-700"})}),p.jsxs("span",{className:"mt-2 text-sm text-white",children:[r.date," ",p.jsxs("span",{className:"ml-4",children:[" ",r.name]})]})]}):p.jsx("section",{className:"sec-loading",children:p.jsx("div",{className:"one",children:p.jsx("img",{className:"bottom-10 h-32 w-32",alt:"logo",src:Uv})})})},tU={N:180,NNE:157.5,NE:135,ENE:112.5,E:90,ESE:67.5,SE:45,SSE:22.5,S:0,SSW:337.5,SW:315,WSW:292.5,W:270,WNW:247.5,NW:225,NNW:202.5},nU=({compass:t})=>p.jsx("div",{className:"compass pointer-events-none absolute left-9 top-9 z-10 h-[0px] w-[0px] md:left-9 md:top-9 md:h-[82px] md:w-[82px]",style:{transform:`translate(-50%, -50%) rotate(${tU[t]}deg)}`,opacity:.9},children:p.jsx("img",{src:Nd,alt:"Compass",className:"h-full w-full"})}),rU=({currentView:t,setSelectedView:e})=>{const[n]=Id();return p.jsx("div",{className:"absolute left-0 top-12 z-50 flex flex-col gap-2 md:top-28",children:n.length>1&&n.map((r,i)=>{const s=(t==null?void 0:t.viewid)===r.viewid;return p.jsx("button",{onClick:()=>e(r),className:`rounded-r-md bg-black bg-opacity-50 px-2 py-1 text-left text-xs text-white transition md:px-4 md:py-2 md:text-sm ${s?"scale-110 bg-green-400 text-white shadow-md":"bg-gray-100 text-gray-700 hover:bg-blue-100"}`,children:r.viewname},`solar-button-${i}`)})})},UT=({maxWidth:t})=>{const[e,n]=S.useState(null),[r,i]=S.useState(null),[s]=Id(),o=e||s[0],[a,l]=_d(o==null?void 0:o.viewid),u=r||a[l||0],c=S.useRef({}),h=S.useMemo(()=>a.map(m=>m.imageurl).filter(Boolean),[a]),d=S.useMemo(()=>{const m=u==null?void 0:u.imageurl;return h.filter(w=>w!==m)},[h,u==null?void 0:u.imageurl]);S.useEffect(()=>{},[o==null?void 0:o.viewid]);const f=S.useCallback(m=>{m.forEach(w=>{const v=new Image;v.decoding="async",v.src=w})},[]),g=S.useCallback(()=>{const m=o==null?void 0:o.viewid;m&&(c.current[m]||(c.current[m]=!0,f(d)))},[o==null?void 0:o.viewid,d,f]);return u?p.jsx("div",{id:"pintar-planner-map-wrapper",className:"m-auto",style:{maxWidth:t?`clamp(0rem, ${t}, 90rem)`:"64rem"},children:p.jsxs("div",{className:"pintar-planner-content-wrapper relative",children:[p.jsx(nU,{compass:(o==null?void 0:o.compass)||"NE"}),p.jsx(o0,{src:u.imageurl,alt:"MapImage",onLoad:g}),p.jsx(rU,{currentView:o,setSelectedView:n}),p.jsx("div",{className:"static flex max-h-screen w-full max-w-7xl flex-col items-center bg-black/90 p-4 md:absolute md:bottom-2 md:left-1/2 md:z-50 md:-translate-x-1/2 md:bg-black/30",children:p.jsx(eU,{times:a.map(m=>m.time),solars:a,currentSolar:u,setSelectedSolar:i})})]})}):null};/**
   * table-core
   *
   * Copyright (c) TanStack
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE.md file in the root directory of this source tree.
   *
   * @license MIT
   */function pi(t,e){return typeof t=="function"?t(e):t}function Yt(t,e){return n=>{e.setState(r=>({...r,[t]:pi(n,r[t])}))}}function Od(t){return t instanceof Function}function iU(t){return Array.isArray(t)&&t.every(e=>typeof e=="number")}function sU(t,e){const n=[],r=i=>{i.forEach(s=>{n.push(s);const o=e(s);o!=null&&o.length&&r(o)})};return r(t),n}function re(t,e,n){let r=[],i;return()=>{let s;n.key&&n.debug&&(s=Date.now());const o=t();if(!(o.length!==r.length||o.some((u,c)=>r[c]!==u)))return i;r=o;let l;if(n.key&&n.debug&&(l=Date.now()),i=e(...o),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const u=Math.round((Date.now()-s)*100)/100,c=Math.round((Date.now()-l)*100)/100,h=c/16,d=(f,g)=>{for(f=String(f);f.length<g;)f=" "+f;return f};console.info(`%c⏱ ${d(c,5)} /${d(u,5)} ms`,`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*h,120))}deg 100% 31%);`,n==null?void 0:n.key)}return i}}function oU(t,e,n,r){var i,s;const a={...t._getDefaultColumnDef(),...e},l=a.accessorKey;let u=(i=(s=a.id)!=null?s:l?l.replace(".","_"):void 0)!=null?i:typeof a.header=="string"?a.header:void 0,c;if(a.accessorFn?c=a.accessorFn:l&&(l.includes(".")?c=d=>{let f=d;for(const m of l.split(".")){var g;f=(g=f)==null?void 0:g[m]}return f}:c=d=>d[a.accessorKey]),!u)throw new Error;let h={id:`${String(u)}`,accessorFn:c,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:re(()=>[!0],()=>{var d;return[h,...(d=h.columns)==null?void 0:d.flatMap(f=>f.getFlatColumns())]},{key:"column.getFlatColumns",debug:()=>{var d;return(d=t.options.debugAll)!=null?d:t.options.debugColumns}}),getLeafColumns:re(()=>[t._getOrderColumnsFn()],d=>{var f;if((f=h.columns)!=null&&f.length){let g=h.columns.flatMap(m=>m.getLeafColumns());return d(g)}return[h]},{key:"column.getLeafColumns",debug:()=>{var d;return(d=t.options.debugAll)!=null?d:t.options.debugColumns}})};for(const d of t._features)d.createColumn==null||d.createColumn(h,t);return h}function $T(t,e,n){var r;let s={id:(r=n.id)!=null?r:e.id,column:e,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const o=[],a=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(a),o.push(l)};return a(s),o},getContext:()=>({table:t,header:s,column:e})};return t._features.forEach(o=>{o.createHeader==null||o.createHeader(s,t)}),s}const aU={createTable:t=>{t.getHeaderGroups=re(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,i)=>{var s,o;const a=(s=r==null?void 0:r.map(h=>n.find(d=>d.id===h)).filter(Boolean))!=null?s:[],l=(o=i==null?void 0:i.map(h=>n.find(d=>d.id===h)).filter(Boolean))!=null?o:[],u=n.filter(h=>!(r!=null&&r.includes(h.id))&&!(i!=null&&i.includes(h.id)));return Dd(e,[...a,...u,...l],t)},{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getCenterHeaderGroups=re(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,i)=>(n=n.filter(s=>!(r!=null&&r.includes(s.id))&&!(i!=null&&i.includes(s.id))),Dd(e,n,t,"center")),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getLeftHeaderGroups=re(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left],(e,n,r)=>{var i;const s=(i=r==null?void 0:r.map(o=>n.find(a=>a.id===o)).filter(Boolean))!=null?i:[];return Dd(e,s,t,"left")},{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getRightHeaderGroups=re(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.right],(e,n,r)=>{var i;const s=(i=r==null?void 0:r.map(o=>n.find(a=>a.id===o)).filter(Boolean))!=null?i:[];return Dd(e,s,t,"right")},{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getFooterGroups=re(()=>[t.getHeaderGroups()],e=>[...e].reverse(),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getLeftFooterGroups=re(()=>[t.getLeftHeaderGroups()],e=>[...e].reverse(),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getCenterFooterGroups=re(()=>[t.getCenterHeaderGroups()],e=>[...e].reverse(),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getRightFooterGroups=re(()=>[t.getRightHeaderGroups()],e=>[...e].reverse(),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getFlatHeaders=re(()=>[t.getHeaderGroups()],e=>e.map(n=>n.headers).flat(),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getLeftFlatHeaders=re(()=>[t.getLeftHeaderGroups()],e=>e.map(n=>n.headers).flat(),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getCenterFlatHeaders=re(()=>[t.getCenterHeaderGroups()],e=>e.map(n=>n.headers).flat(),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getRightFlatHeaders=re(()=>[t.getRightHeaderGroups()],e=>e.map(n=>n.headers).flat(),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getCenterLeafHeaders=re(()=>[t.getCenterFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getLeftLeafHeaders=re(()=>[t.getLeftFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getRightLeafHeaders=re(()=>[t.getRightFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}}),t.getLeafHeaders=re(()=>[t.getLeftHeaderGroups(),t.getCenterHeaderGroups(),t.getRightHeaderGroups()],(e,n,r)=>{var i,s,o,a,l,u;return[...(i=(s=e[0])==null?void 0:s.headers)!=null?i:[],...(o=(a=n[0])==null?void 0:a.headers)!=null?o:[],...(l=(u=r[0])==null?void 0:u.headers)!=null?l:[]].map(c=>c.getLeafHeaders()).flat()},{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugHeaders}})}};function Dd(t,e,n,r){var i,s;let o=0;const a=function(d,f){f===void 0&&(f=1),o=Math.max(o,f),d.filter(g=>g.getIsVisible()).forEach(g=>{var m;(m=g.columns)!=null&&m.length&&a(g.columns,f+1)},0)};a(t);let l=[];const u=(d,f)=>{const g={depth:f,id:[r,`${f}`].filter(Boolean).join("_"),headers:[]},m=[];d.forEach(w=>{const v=[...m].reverse()[0],y=w.column.depth===g.depth;let _,E=!1;if(y&&w.column.parent?_=w.column.parent:(_=w.column,E=!0),v&&(v==null?void 0:v.column)===_)v.subHeaders.push(w);else{const I=$T(n,_,{id:[r,f,_.id,w==null?void 0:w.id].filter(Boolean).join("_"),isPlaceholder:E,placeholderId:E?`${m.filter(A=>A.column===_).length}`:void 0,depth:f,index:m.length});I.subHeaders.push(w),m.push(I)}g.headers.push(w),w.headerGroup=g}),l.push(g),f>0&&u(m,f-1)},c=e.map((d,f)=>$T(n,d,{depth:o,index:f}));u(c,o-1),l.reverse();const h=d=>d.filter(g=>g.column.getIsVisible()).map(g=>{let m=0,w=0,v=[0];g.subHeaders&&g.subHeaders.length?(v=[],h(g.subHeaders).forEach(_=>{let{colSpan:E,rowSpan:I}=_;m+=E,v.push(I)})):m=1;const y=Math.min(...v);return w=w+y,g.colSpan=m,g.rowSpan=w,{colSpan:m,rowSpan:w}});return h((i=(s=l[0])==null?void 0:s.headers)!=null?i:[]),l}const Md={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},h0=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),lU={getDefaultColumnDef:()=>Md,getInitialState:t=>({columnSizing:{},columnSizingInfo:h0(),...t}),getDefaultOptions:t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Yt("columnSizing",t),onColumnSizingInfoChange:Yt("columnSizingInfo",t)}),createColumn:(t,e)=>{t.getSize=()=>{var n,r,i;const s=e.getState().columnSizing[t.id];return Math.min(Math.max((n=t.columnDef.minSize)!=null?n:Md.minSize,(r=s!=null?s:t.columnDef.size)!=null?r:Md.size),(i=t.columnDef.maxSize)!=null?i:Md.maxSize)},t.getStart=n=>{const r=n?n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns(),i=r.findIndex(s=>s.id===t.id);if(i>0){const s=r[i-1];return s.getStart(n)+s.getSize()}return 0},t.resetSize=()=>{e.setColumnSizing(n=>{let{[t.id]:r,...i}=n;return i})},t.getCanResize=()=>{var n,r;return((n=t.columnDef.enableResizing)!=null?n:!0)&&((r=e.options.enableColumnResizing)!=null?r:!0)},t.getIsResizing=()=>e.getState().columnSizingInfo.isResizingColumn===t.id},createHeader:(t,e)=>{t.getSize=()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var s;n+=(s=i.column.getSize())!=null?s:0}};return r(t),n},t.getStart=()=>{if(t.index>0){const n=t.headerGroup.headers[t.index-1];return n.getStart()+n.getSize()}return 0},t.getResizeHandler=n=>{const r=e.getColumn(t.column.id),i=r==null?void 0:r.getCanResize();return s=>{if(!r||!i||(s.persist==null||s.persist(),d0(s)&&s.touches&&s.touches.length>1))return;const o=t.getSize(),a=t?t.getLeafHeaders().map(v=>[v.column.id,v.column.getSize()]):[[r.id,r.getSize()]],l=d0(s)?Math.round(s.touches[0].clientX):s.clientX,u={},c=(v,y)=>{typeof y=="number"&&(e.setColumnSizingInfo(_=>{var E,I;const A=e.options.columnResizeDirection==="rtl"?-1:1,T=(y-((E=_==null?void 0:_.startOffset)!=null?E:0))*A,C=Math.max(T/((I=_==null?void 0:_.startSize)!=null?I:0),-.999999);return _.columnSizingStart.forEach(N=>{let[O,P]=N;u[O]=Math.round(Math.max(P+P*C,0)*100)/100}),{..._,deltaOffset:T,deltaPercentage:C}}),(e.options.columnResizeMode==="onChange"||v==="end")&&e.setColumnSizing(_=>({..._,...u})))},h=v=>c("move",v),d=v=>{c("end",v),e.setColumnSizingInfo(y=>({...y,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},f=n||typeof document!="undefined"?document:null,g={moveHandler:v=>h(v.clientX),upHandler:v=>{f==null||f.removeEventListener("mousemove",g.moveHandler),f==null||f.removeEventListener("mouseup",g.upHandler),d(v.clientX)}},m={moveHandler:v=>(v.cancelable&&(v.preventDefault(),v.stopPropagation()),h(v.touches[0].clientX),!1),upHandler:v=>{var y;f==null||f.removeEventListener("touchmove",m.moveHandler),f==null||f.removeEventListener("touchend",m.upHandler),v.cancelable&&(v.preventDefault(),v.stopPropagation()),d((y=v.touches[0])==null?void 0:y.clientX)}},w=uU()?{passive:!1}:!1;d0(s)?(f==null||f.addEventListener("touchmove",m.moveHandler,w),f==null||f.addEventListener("touchend",m.upHandler,w)):(f==null||f.addEventListener("mousemove",g.moveHandler,w),f==null||f.addEventListener("mouseup",g.upHandler,w)),e.setColumnSizingInfo(v=>({...v,startOffset:l,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:t=>{t.setColumnSizing=e=>t.options.onColumnSizingChange==null?void 0:t.options.onColumnSizingChange(e),t.setColumnSizingInfo=e=>t.options.onColumnSizingInfoChange==null?void 0:t.options.onColumnSizingInfoChange(e),t.resetColumnSizing=e=>{var n;t.setColumnSizing(e?{}:(n=t.initialState.columnSizing)!=null?n:{})},t.resetHeaderSizeInfo=e=>{var n;t.setColumnSizingInfo(e?h0():(n=t.initialState.columnSizingInfo)!=null?n:h0())},t.getTotalSize=()=>{var e,n;return(e=(n=t.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0},t.getLeftTotalSize=()=>{var e,n;return(e=(n=t.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0},t.getCenterTotalSize=()=>{var e,n;return(e=(n=t.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0},t.getRightTotalSize=()=>{var e,n;return(e=(n=t.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0}}};let Ld=null;function uU(){if(typeof Ld=="boolean")return Ld;let t=!1;try{const e={get passive(){return t=!0,!1}},n=()=>{};window.addEventListener("test",n,e),window.removeEventListener("test",n)}catch{t=!1}return Ld=t,Ld}function d0(t){return t.type==="touchstart"}const cU={getInitialState:t=>({expanded:{},...t}),getDefaultOptions:t=>({onExpandedChange:Yt("expanded",t),paginateExpandedRows:!0}),createTable:t=>{let e=!1,n=!1;t._autoResetExpanded=()=>{var r,i;if(!e){t._queue(()=>{e=!0});return}if((r=(i=t.options.autoResetAll)!=null?i:t.options.autoResetExpanded)!=null?r:!t.options.manualExpanding){if(n)return;n=!0,t._queue(()=>{t.resetExpanded(),n=!1})}},t.setExpanded=r=>t.options.onExpandedChange==null?void 0:t.options.onExpandedChange(r),t.toggleAllRowsExpanded=r=>{(r!=null?r:!t.getIsAllRowsExpanded())?t.setExpanded(!0):t.setExpanded({})},t.resetExpanded=r=>{var i,s;t.setExpanded(r?{}:(i=(s=t.initialState)==null?void 0:s.expanded)!=null?i:{})},t.getCanSomeRowsExpand=()=>t.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),t.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),t.toggleAllRowsExpanded()},t.getIsSomeRowsExpanded=()=>{const r=t.getState().expanded;return r===!0||Object.values(r).some(Boolean)},t.getIsAllRowsExpanded=()=>{const r=t.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||t.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},t.getExpandedDepth=()=>{let r=0;return(t.getState().expanded===!0?Object.keys(t.getRowModel().rowsById):Object.keys(t.getState().expanded)).forEach(s=>{const o=s.split(".");r=Math.max(r,o.length)}),r},t.getPreExpandedRowModel=()=>t.getSortedRowModel(),t.getExpandedRowModel=()=>(!t._getExpandedRowModel&&t.options.getExpandedRowModel&&(t._getExpandedRowModel=t.options.getExpandedRowModel(t)),t.options.manualExpanding||!t._getExpandedRowModel?t.getPreExpandedRowModel():t._getExpandedRowModel())},createRow:(t,e)=>{t.toggleExpanded=n=>{e.setExpanded(r=>{var i;const s=r===!0?!0:!!(r!=null&&r[t.id]);let o={};if(r===!0?Object.keys(e.getRowModel().rowsById).forEach(a=>{o[a]=!0}):o=r,n=(i=n)!=null?i:!s,!s&&n)return{...o,[t.id]:!0};if(s&&!n){const{[t.id]:a,...l}=o;return l}return r})},t.getIsExpanded=()=>{var n;const r=e.getState().expanded;return!!((n=e.options.getIsRowExpanded==null?void 0:e.options.getIsRowExpanded(t))!=null?n:r===!0||r!=null&&r[t.id])},t.getCanExpand=()=>{var n,r,i;return(n=e.options.getRowCanExpand==null?void 0:e.options.getRowCanExpand(t))!=null?n:((r=e.options.enableExpanding)!=null?r:!0)&&!!((i=t.subRows)!=null&&i.length)},t.getIsAllParentsExpanded=()=>{let n=!0,r=t;for(;n&&r.parentId;)r=e.getRow(r.parentId,!0),n=r.getIsExpanded();return n},t.getToggleExpandedHandler=()=>{const n=t.getCanExpand();return()=>{n&&t.toggleExpanded()}}}},jT=(t,e,n)=>{var r;const i=n.toLowerCase();return!!(!((r=t.getValue(e))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(i))};jT.autoRemove=t=>An(t);const zT=(t,e,n)=>{var r;return!!(!((r=t.getValue(e))==null||(r=r.toString())==null)&&r.includes(n))};zT.autoRemove=t=>An(t);const BT=(t,e,n)=>{var r;return((r=t.getValue(e))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};BT.autoRemove=t=>An(t);const HT=(t,e,n)=>{var r;return(r=t.getValue(e))==null?void 0:r.includes(n)};HT.autoRemove=t=>An(t)||!(t!=null&&t.length);const GT=(t,e,n)=>!n.some(r=>{var i;return!((i=t.getValue(e))!=null&&i.includes(r))});GT.autoRemove=t=>An(t)||!(t!=null&&t.length);const WT=(t,e,n)=>n.some(r=>{var i;return(i=t.getValue(e))==null?void 0:i.includes(r)});WT.autoRemove=t=>An(t)||!(t!=null&&t.length);const QT=(t,e,n)=>t.getValue(e)===n;QT.autoRemove=t=>An(t);const qT=(t,e,n)=>t.getValue(e)==n;qT.autoRemove=t=>An(t);const f0=(t,e,n)=>{let[r,i]=n;const s=t.getValue(e);return s>=r&&s<=i};f0.resolveFilterValue=t=>{let[e,n]=t,r=typeof e!="number"?parseFloat(e):e,i=typeof n!="number"?parseFloat(n):n,s=e===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(i)?1/0:i;if(s>o){const a=s;s=o,o=a}return[s,o]},f0.autoRemove=t=>An(t)||An(t[0])&&An(t[1]);const Sr={includesString:jT,includesStringSensitive:zT,equalsString:BT,arrIncludes:HT,arrIncludesAll:GT,arrIncludesSome:WT,equals:QT,weakEquals:qT,inNumberRange:f0};function An(t){return t==null||t===""}const hU={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:t=>({columnFilters:[],globalFilter:void 0,...t}),getDefaultOptions:t=>({onColumnFiltersChange:Yt("columnFilters",t),onGlobalFilterChange:Yt("globalFilter",t),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:e=>{var n;const r=(n=t.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[e.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(t,e)=>{t.getAutoFilterFn=()=>{const n=e.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(t.id);return typeof r=="string"?Sr.includesString:typeof r=="number"?Sr.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?Sr.equals:Array.isArray(r)?Sr.arrIncludes:Sr.weakEquals},t.getFilterFn=()=>{var n,r;return Od(t.columnDef.filterFn)?t.columnDef.filterFn:t.columnDef.filterFn==="auto"?t.getAutoFilterFn():(n=(r=e.options.filterFns)==null?void 0:r[t.columnDef.filterFn])!=null?n:Sr[t.columnDef.filterFn]},t.getCanFilter=()=>{var n,r,i;return((n=t.columnDef.enableColumnFilter)!=null?n:!0)&&((r=e.options.enableColumnFilters)!=null?r:!0)&&((i=e.options.enableFilters)!=null?i:!0)&&!!t.accessorFn},t.getCanGlobalFilter=()=>{var n,r,i,s;return((n=t.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=e.options.enableGlobalFilter)!=null?r:!0)&&((i=e.options.enableFilters)!=null?i:!0)&&((s=e.options.getColumnCanGlobalFilter==null?void 0:e.options.getColumnCanGlobalFilter(t))!=null?s:!0)&&!!t.accessorFn},t.getIsFiltered=()=>t.getFilterIndex()>-1,t.getFilterValue=()=>{var n;return(n=e.getState().columnFilters)==null||(n=n.find(r=>r.id===t.id))==null?void 0:n.value},t.getFilterIndex=()=>{var n,r;return(n=(r=e.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===t.id))!=null?n:-1},t.setFilterValue=n=>{e.setColumnFilters(r=>{const i=t.getFilterFn(),s=r==null?void 0:r.find(c=>c.id===t.id),o=pi(n,s?s.value:void 0);if(KT(i,o,t)){var a;return(a=r==null?void 0:r.filter(c=>c.id!==t.id))!=null?a:[]}const l={id:t.id,value:o};if(s){var u;return(u=r==null?void 0:r.map(c=>c.id===t.id?l:c))!=null?u:[]}return r!=null&&r.length?[...r,l]:[l]})},t._getFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,t.id),t.getFacetedRowModel=()=>t._getFacetedRowModel?t._getFacetedRowModel():e.getPreFilteredRowModel(),t._getFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,t.id),t.getFacetedUniqueValues=()=>t._getFacetedUniqueValues?t._getFacetedUniqueValues():new Map,t._getFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,t.id),t.getFacetedMinMaxValues=()=>{if(t._getFacetedMinMaxValues)return t._getFacetedMinMaxValues()}},createRow:(t,e)=>{t.columnFilters={},t.columnFiltersMeta={}},createTable:t=>{t.getGlobalAutoFilterFn=()=>Sr.includesString,t.getGlobalFilterFn=()=>{var e,n;const{globalFilterFn:r}=t.options;return Od(r)?r:r==="auto"?t.getGlobalAutoFilterFn():(e=(n=t.options.filterFns)==null?void 0:n[r])!=null?e:Sr[r]},t.setColumnFilters=e=>{const n=t.getAllLeafColumns(),r=i=>{var s;return(s=pi(e,i))==null?void 0:s.filter(o=>{const a=n.find(l=>l.id===o.id);if(a){const l=a.getFilterFn();if(KT(l,o.value,a))return!1}return!0})};t.options.onColumnFiltersChange==null||t.options.onColumnFiltersChange(r)},t.setGlobalFilter=e=>{t.options.onGlobalFilterChange==null||t.options.onGlobalFilterChange(e)},t.resetGlobalFilter=e=>{t.setGlobalFilter(e?void 0:t.initialState.globalFilter)},t.resetColumnFilters=e=>{var n,r;t.setColumnFilters(e?[]:(n=(r=t.initialState)==null?void 0:r.columnFilters)!=null?n:[])},t.getPreFilteredRowModel=()=>t.getCoreRowModel(),t.getFilteredRowModel=()=>(!t._getFilteredRowModel&&t.options.getFilteredRowModel&&(t._getFilteredRowModel=t.options.getFilteredRowModel(t)),t.options.manualFiltering||!t._getFilteredRowModel?t.getPreFilteredRowModel():t._getFilteredRowModel()),t._getGlobalFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,"__global__"),t.getGlobalFacetedRowModel=()=>t.options.manualFiltering||!t._getGlobalFacetedRowModel?t.getPreFilteredRowModel():t._getGlobalFacetedRowModel(),t._getGlobalFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,"__global__"),t.getGlobalFacetedUniqueValues=()=>t._getGlobalFacetedUniqueValues?t._getGlobalFacetedUniqueValues():new Map,t._getGlobalFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,"__global__"),t.getGlobalFacetedMinMaxValues=()=>{if(t._getGlobalFacetedMinMaxValues)return t._getGlobalFacetedMinMaxValues()}}};function KT(t,e,n){return(t&&t.autoRemove?t.autoRemove(e,n):!1)||typeof e=="undefined"||typeof e=="string"&&!e}const p0={sum:(t,e,n)=>n.reduce((r,i)=>{const s=i.getValue(t);return r+(typeof s=="number"?s:0)},0),min:(t,e,n)=>{let r;return n.forEach(i=>{const s=i.getValue(t);s!=null&&(r>s||r===void 0&&s>=s)&&(r=s)}),r},max:(t,e,n)=>{let r;return n.forEach(i=>{const s=i.getValue(t);s!=null&&(r<s||r===void 0&&s>=s)&&(r=s)}),r},extent:(t,e,n)=>{let r,i;return n.forEach(s=>{const o=s.getValue(t);o!=null&&(r===void 0?o>=o&&(r=i=o):(r>o&&(r=o),i<o&&(i=o)))}),[r,i]},mean:(t,e)=>{let n=0,r=0;if(e.forEach(i=>{let s=i.getValue(t);s!=null&&(s=+s)>=s&&(++n,r+=s)}),n)return r/n},median:(t,e)=>{if(!e.length)return;const n=e.map(s=>s.getValue(t));if(!iU(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((s,o)=>s-o);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},unique:(t,e)=>Array.from(new Set(e.map(n=>n.getValue(t))).values()),uniqueCount:(t,e)=>new Set(e.map(n=>n.getValue(t))).size,count:(t,e)=>e.length},dU={getDefaultColumnDef:()=>({aggregatedCell:t=>{var e,n;return(e=(n=t.getValue())==null||n.toString==null?void 0:n.toString())!=null?e:null},aggregationFn:"auto"}),getInitialState:t=>({grouping:[],...t}),getDefaultOptions:t=>({onGroupingChange:Yt("grouping",t),groupedColumnMode:"reorder"}),createColumn:(t,e)=>{t.toggleGrouping=()=>{e.setGrouping(n=>n!=null&&n.includes(t.id)?n.filter(r=>r!==t.id):[...n!=null?n:[],t.id])},t.getCanGroup=()=>{var n,r,i,s;return(n=(r=(i=(s=t.columnDef.enableGrouping)!=null?s:!0)!=null?i:e.options.enableGrouping)!=null?r:!0)!=null?n:!!t.accessorFn},t.getIsGrouped=()=>{var n;return(n=e.getState().grouping)==null?void 0:n.includes(t.id)},t.getGroupedIndex=()=>{var n;return(n=e.getState().grouping)==null?void 0:n.indexOf(t.id)},t.getToggleGroupingHandler=()=>{const n=t.getCanGroup();return()=>{n&&t.toggleGrouping()}},t.getAutoAggregationFn=()=>{const n=e.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(t.id);if(typeof r=="number")return p0.sum;if(Object.prototype.toString.call(r)==="[object Date]")return p0.extent},t.getAggregationFn=()=>{var n,r;if(!t)throw new Error;return Od(t.columnDef.aggregationFn)?t.columnDef.aggregationFn:t.columnDef.aggregationFn==="auto"?t.getAutoAggregationFn():(n=(r=e.options.aggregationFns)==null?void 0:r[t.columnDef.aggregationFn])!=null?n:p0[t.columnDef.aggregationFn]}},createTable:t=>{t.setGrouping=e=>t.options.onGroupingChange==null?void 0:t.options.onGroupingChange(e),t.resetGrouping=e=>{var n,r;t.setGrouping(e?[]:(n=(r=t.initialState)==null?void 0:r.grouping)!=null?n:[])},t.getPreGroupedRowModel=()=>t.getFilteredRowModel(),t.getGroupedRowModel=()=>(!t._getGroupedRowModel&&t.options.getGroupedRowModel&&(t._getGroupedRowModel=t.options.getGroupedRowModel(t)),t.options.manualGrouping||!t._getGroupedRowModel?t.getPreGroupedRowModel():t._getGroupedRowModel())},createRow:(t,e)=>{t.getIsGrouped=()=>!!t.groupingColumnId,t.getGroupingValue=n=>{if(t._groupingValuesCache.hasOwnProperty(n))return t._groupingValuesCache[n];const r=e.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(t._groupingValuesCache[n]=r.columnDef.getGroupingValue(t.original),t._groupingValuesCache[n]):t.getValue(n)},t._groupingValuesCache={}},createCell:(t,e,n,r)=>{t.getIsGrouped=()=>e.getIsGrouped()&&e.id===n.groupingColumnId,t.getIsPlaceholder=()=>!t.getIsGrouped()&&e.getIsGrouped(),t.getIsAggregated=()=>{var i;return!t.getIsGrouped()&&!t.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}}};function fU(t,e,n){if(!(e!=null&&e.length)||!n)return t;const r=t.filter(s=>!e.includes(s.id));return n==="remove"?r:[...e.map(s=>t.find(o=>o.id===s)).filter(Boolean),...r]}const pU={getInitialState:t=>({columnOrder:[],...t}),getDefaultOptions:t=>({onColumnOrderChange:Yt("columnOrder",t)}),createTable:t=>{t.setColumnOrder=e=>t.options.onColumnOrderChange==null?void 0:t.options.onColumnOrderChange(e),t.resetColumnOrder=e=>{var n;t.setColumnOrder(e?[]:(n=t.initialState.columnOrder)!=null?n:[])},t._getOrderColumnsFn=re(()=>[t.getState().columnOrder,t.getState().grouping,t.options.groupedColumnMode],(e,n,r)=>i=>{let s=[];if(!(e!=null&&e.length))s=i;else{const o=[...e],a=[...i];for(;a.length&&o.length;){const l=o.shift(),u=a.findIndex(c=>c.id===l);u>-1&&s.push(a.splice(u,1)[0])}s=[...s,...a]}return fU(s,n,r)},{key:!1})}},g0=0,m0=10,v0=()=>({pageIndex:g0,pageSize:m0}),gU={getInitialState:t=>({...t,pagination:{...v0(),...t==null?void 0:t.pagination}}),getDefaultOptions:t=>({onPaginationChange:Yt("pagination",t)}),createTable:t=>{let e=!1,n=!1;t._autoResetPageIndex=()=>{var r,i;if(!e){t._queue(()=>{e=!0});return}if((r=(i=t.options.autoResetAll)!=null?i:t.options.autoResetPageIndex)!=null?r:!t.options.manualPagination){if(n)return;n=!0,t._queue(()=>{t.resetPageIndex(),n=!1})}},t.setPagination=r=>{const i=s=>pi(r,s);return t.options.onPaginationChange==null?void 0:t.options.onPaginationChange(i)},t.resetPagination=r=>{var i;t.setPagination(r?v0():(i=t.initialState.pagination)!=null?i:v0())},t.setPageIndex=r=>{t.setPagination(i=>{let s=pi(r,i.pageIndex);const o=typeof t.options.pageCount=="undefined"||t.options.pageCount===-1?Number.MAX_SAFE_INTEGER:t.options.pageCount-1;return s=Math.max(0,Math.min(s,o)),{...i,pageIndex:s}})},t.resetPageIndex=r=>{var i,s;t.setPageIndex(r?g0:(i=(s=t.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?i:g0)},t.resetPageSize=r=>{var i,s;t.setPageSize(r?m0:(i=(s=t.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?i:m0)},t.setPageSize=r=>{t.setPagination(i=>{const s=Math.max(1,pi(r,i.pageSize)),o=i.pageSize*i.pageIndex,a=Math.floor(o/s);return{...i,pageIndex:a,pageSize:s}})},t.setPageCount=r=>t.setPagination(i=>{var s;let o=pi(r,(s=t.options.pageCount)!=null?s:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...i,pageCount:o}}),t.getPageOptions=re(()=>[t.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((s,o)=>o)),i},{key:!1,debug:()=>{var r;return(r=t.options.debugAll)!=null?r:t.options.debugTable}}),t.getCanPreviousPage=()=>t.getState().pagination.pageIndex>0,t.getCanNextPage=()=>{const{pageIndex:r}=t.getState().pagination,i=t.getPageCount();return i===-1?!0:i===0?!1:r<i-1},t.previousPage=()=>t.setPageIndex(r=>r-1),t.nextPage=()=>t.setPageIndex(r=>r+1),t.getPrePaginationRowModel=()=>t.getExpandedRowModel(),t.getPaginationRowModel=()=>(!t._getPaginationRowModel&&t.options.getPaginationRowModel&&(t._getPaginationRowModel=t.options.getPaginationRowModel(t)),t.options.manualPagination||!t._getPaginationRowModel?t.getPrePaginationRowModel():t._getPaginationRowModel()),t.getPageCount=()=>{var r;return(r=t.options.pageCount)!=null?r:Math.ceil(t.getPrePaginationRowModel().rows.length/t.getState().pagination.pageSize)}}},y0=()=>({left:[],right:[]}),_0=()=>({top:[],bottom:[]}),mU={getInitialState:t=>({columnPinning:y0(),rowPinning:_0(),...t}),getDefaultOptions:t=>({onColumnPinningChange:Yt("columnPinning",t),onRowPinningChange:Yt("rowPinning",t)}),createColumn:(t,e)=>{t.pin=n=>{const r=t.getLeafColumns().map(i=>i.id).filter(Boolean);e.setColumnPinning(i=>{var s,o;if(n==="right"){var a,l;return{left:((a=i==null?void 0:i.left)!=null?a:[]).filter(h=>!(r!=null&&r.includes(h))),right:[...((l=i==null?void 0:i.right)!=null?l:[]).filter(h=>!(r!=null&&r.includes(h))),...r]}}if(n==="left"){var u,c;return{left:[...((u=i==null?void 0:i.left)!=null?u:[]).filter(h=>!(r!=null&&r.includes(h))),...r],right:((c=i==null?void 0:i.right)!=null?c:[]).filter(h=>!(r!=null&&r.includes(h)))}}return{left:((s=i==null?void 0:i.left)!=null?s:[]).filter(h=>!(r!=null&&r.includes(h))),right:((o=i==null?void 0:i.right)!=null?o:[]).filter(h=>!(r!=null&&r.includes(h)))}})},t.getCanPin=()=>t.getLeafColumns().some(r=>{var i,s,o;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((s=(o=e.options.enableColumnPinning)!=null?o:e.options.enablePinning)!=null?s:!0)}),t.getIsPinned=()=>{const n=t.getLeafColumns().map(a=>a.id),{left:r,right:i}=e.getState().columnPinning,s=n.some(a=>r==null?void 0:r.includes(a)),o=n.some(a=>i==null?void 0:i.includes(a));return s?"left":o?"right":!1},t.getPinnedIndex=()=>{var n,r;const i=t.getIsPinned();return i?(n=(r=e.getState().columnPinning)==null||(r=r[i])==null?void 0:r.indexOf(t.id))!=null?n:-1:0}},createRow:(t,e)=>{t.pin=(n,r,i)=>{const s=r?t.getLeafRows().map(l=>{let{id:u}=l;return u}):[],o=i?t.getParentRows().map(l=>{let{id:u}=l;return u}):[],a=new Set([...o,t.id,...s]);e.setRowPinning(l=>{var u,c;if(n==="bottom"){var h,d;return{top:((h=l==null?void 0:l.top)!=null?h:[]).filter(m=>!(a!=null&&a.has(m))),bottom:[...((d=l==null?void 0:l.bottom)!=null?d:[]).filter(m=>!(a!=null&&a.has(m))),...Array.from(a)]}}if(n==="top"){var f,g;return{top:[...((f=l==null?void 0:l.top)!=null?f:[]).filter(m=>!(a!=null&&a.has(m))),...Array.from(a)],bottom:((g=l==null?void 0:l.bottom)!=null?g:[]).filter(m=>!(a!=null&&a.has(m)))}}return{top:((u=l==null?void 0:l.top)!=null?u:[]).filter(m=>!(a!=null&&a.has(m))),bottom:((c=l==null?void 0:l.bottom)!=null?c:[]).filter(m=>!(a!=null&&a.has(m)))}})},t.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:i}=e.options;return typeof r=="function"?r(t):(n=r!=null?r:i)!=null?n:!0},t.getIsPinned=()=>{const n=[t.id],{top:r,bottom:i}=e.getState().rowPinning,s=n.some(a=>r==null?void 0:r.includes(a)),o=n.some(a=>i==null?void 0:i.includes(a));return s?"top":o?"bottom":!1},t.getPinnedIndex=()=>{var n,r;const i=t.getIsPinned();if(!i)return-1;const s=(n=e._getPinnedRows(i))==null?void 0:n.map(o=>{let{id:a}=o;return a});return(r=s==null?void 0:s.indexOf(t.id))!=null?r:-1},t.getCenterVisibleCells=re(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i)=>{const s=[...r!=null?r:[],...i!=null?i:[]];return n.filter(o=>!s.includes(o.column.id))},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugRows}}),t.getLeftVisibleCells=re(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left,,],(n,r)=>(r!=null?r:[]).map(s=>n.find(o=>o.column.id===s)).filter(Boolean).map(s=>({...s,position:"left"})),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugRows}}),t.getRightVisibleCells=re(()=>[t._getAllVisibleCells(),e.getState().columnPinning.right],(n,r)=>(r!=null?r:[]).map(s=>n.find(o=>o.column.id===s)).filter(Boolean).map(s=>({...s,position:"right"})),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugRows}})},createTable:t=>{t.setColumnPinning=e=>t.options.onColumnPinningChange==null?void 0:t.options.onColumnPinningChange(e),t.resetColumnPinning=e=>{var n,r;return t.setColumnPinning(e?y0():(n=(r=t.initialState)==null?void 0:r.columnPinning)!=null?n:y0())},t.getIsSomeColumnsPinned=e=>{var n;const r=t.getState().columnPinning;if(!e){var i,s;return!!((i=r.left)!=null&&i.length||(s=r.right)!=null&&s.length)}return!!((n=r[e])!=null&&n.length)},t.getLeftLeafColumns=re(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left],(e,n)=>(n!=null?n:[]).map(r=>e.find(i=>i.id===r)).filter(Boolean),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugColumns}}),t.getRightLeafColumns=re(()=>[t.getAllLeafColumns(),t.getState().columnPinning.right],(e,n)=>(n!=null?n:[]).map(r=>e.find(i=>i.id===r)).filter(Boolean),{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugColumns}}),t.getCenterLeafColumns=re(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r)=>{const i=[...n!=null?n:[],...r!=null?r:[]];return e.filter(s=>!i.includes(s.id))},{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugColumns}}),t.setRowPinning=e=>t.options.onRowPinningChange==null?void 0:t.options.onRowPinningChange(e),t.resetRowPinning=e=>{var n,r;return t.setRowPinning(e?_0():(n=(r=t.initialState)==null?void 0:r.rowPinning)!=null?n:_0())},t.getIsSomeRowsPinned=e=>{var n;const r=t.getState().rowPinning;if(!e){var i,s;return!!((i=r.top)!=null&&i.length||(s=r.bottom)!=null&&s.length)}return!!((n=r[e])!=null&&n.length)},t._getPinnedRows=e=>re(()=>[t.getRowModel().rows,t.getState().rowPinning[e]],(n,r)=>{var i;return((i=t.options.keepPinnedRows)==null||i?(r!=null?r:[]).map(o=>{const a=t.getRow(o,!0);return a.getIsAllParentsExpanded()?a:null}):(r!=null?r:[]).map(o=>n.find(a=>a.id===o))).filter(Boolean).map(o=>({...o,position:e}))},{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}})(),t.getTopRows=()=>t._getPinnedRows("top"),t.getBottomRows=()=>t._getPinnedRows("bottom"),t.getCenterRows=re(()=>[t.getRowModel().rows,t.getState().rowPinning.top,t.getState().rowPinning.bottom],(e,n,r)=>{const i=new Set([...n!=null?n:[],...r!=null?r:[]]);return e.filter(s=>!i.has(s.id))},{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugRows}})}},vU={getInitialState:t=>({rowSelection:{},...t}),getDefaultOptions:t=>({onRowSelectionChange:Yt("rowSelection",t),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:t=>{t.setRowSelection=e=>t.options.onRowSelectionChange==null?void 0:t.options.onRowSelectionChange(e),t.resetRowSelection=e=>{var n;return t.setRowSelection(e?{}:(n=t.initialState.rowSelection)!=null?n:{})},t.toggleAllRowsSelected=e=>{t.setRowSelection(n=>{e=typeof e!="undefined"?e:!t.getIsAllRowsSelected();const r={...n},i=t.getPreGroupedRowModel().flatRows;return e?i.forEach(s=>{s.getCanSelect()&&(r[s.id]=!0)}):i.forEach(s=>{delete r[s.id]}),r})},t.toggleAllPageRowsSelected=e=>t.setRowSelection(n=>{const r=typeof e!="undefined"?e:!t.getIsAllPageRowsSelected(),i={...n};return t.getRowModel().rows.forEach(s=>{w0(i,s.id,r,!0,t)}),i}),t.getPreSelectedRowModel=()=>t.getCoreRowModel(),t.getSelectedRowModel=re(()=>[t.getState().rowSelection,t.getCoreRowModel()],(e,n)=>Object.keys(e).length?E0(t,n):{rows:[],flatRows:[],rowsById:{}},{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugTable}}),t.getFilteredSelectedRowModel=re(()=>[t.getState().rowSelection,t.getFilteredRowModel()],(e,n)=>Object.keys(e).length?E0(t,n):{rows:[],flatRows:[],rowsById:{}},{key:"getFilteredSelectedRowModel",debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugTable}}),t.getGroupedSelectedRowModel=re(()=>[t.getState().rowSelection,t.getSortedRowModel()],(e,n)=>Object.keys(e).length?E0(t,n):{rows:[],flatRows:[],rowsById:{}},{key:"getGroupedSelectedRowModel",debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugTable}}),t.getIsAllRowsSelected=()=>{const e=t.getFilteredRowModel().flatRows,{rowSelection:n}=t.getState();let r=!!(e.length&&Object.keys(n).length);return r&&e.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},t.getIsAllPageRowsSelected=()=>{const e=t.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=t.getState();let r=!!e.length;return r&&e.some(i=>!n[i.id])&&(r=!1),r},t.getIsSomeRowsSelected=()=>{var e;const n=Object.keys((e=t.getState().rowSelection)!=null?e:{}).length;return n>0&&n<t.getFilteredRowModel().flatRows.length},t.getIsSomePageRowsSelected=()=>{const e=t.getPaginationRowModel().flatRows;return t.getIsAllPageRowsSelected()?!1:e.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},t.getToggleAllRowsSelectedHandler=()=>e=>{t.toggleAllRowsSelected(e.target.checked)},t.getToggleAllPageRowsSelectedHandler=()=>e=>{t.toggleAllPageRowsSelected(e.target.checked)}},createRow:(t,e)=>{t.toggleSelected=(n,r)=>{const i=t.getIsSelected();e.setRowSelection(s=>{var o;if(n=typeof n!="undefined"?n:!i,t.getCanSelect()&&i===n)return s;const a={...s};return w0(a,t.id,n,(o=r==null?void 0:r.selectChildren)!=null?o:!0,e),a})},t.getIsSelected=()=>{const{rowSelection:n}=e.getState();return x0(t,n)},t.getIsSomeSelected=()=>{const{rowSelection:n}=e.getState();return S0(t,n)==="some"},t.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=e.getState();return S0(t,n)==="all"},t.getCanSelect=()=>{var n;return typeof e.options.enableRowSelection=="function"?e.options.enableRowSelection(t):(n=e.options.enableRowSelection)!=null?n:!0},t.getCanSelectSubRows=()=>{var n;return typeof e.options.enableSubRowSelection=="function"?e.options.enableSubRowSelection(t):(n=e.options.enableSubRowSelection)!=null?n:!0},t.getCanMultiSelect=()=>{var n;return typeof e.options.enableMultiRowSelection=="function"?e.options.enableMultiRowSelection(t):(n=e.options.enableMultiRowSelection)!=null?n:!0},t.getToggleSelectedHandler=()=>{const n=t.getCanSelect();return r=>{var i;n&&t.toggleSelected((i=r.target)==null?void 0:i.checked)}}}},w0=(t,e,n,r,i)=>{var s;const o=i.getRow(e,!0);n?(o.getCanMultiSelect()||Object.keys(t).forEach(a=>delete t[a]),o.getCanSelect()&&(t[e]=!0)):delete t[e],r&&(s=o.subRows)!=null&&s.length&&o.getCanSelectSubRows()&&o.subRows.forEach(a=>w0(t,a.id,n,r,i))};function E0(t,e){const n=t.getState().rowSelection,r=[],i={},s=function(o,a){return o.map(l=>{var u;const c=x0(l,n);if(c&&(r.push(l),i[l.id]=l),(u=l.subRows)!=null&&u.length&&(l={...l,subRows:s(l.subRows)}),c)return l}).filter(Boolean)};return{rows:s(e.rows),flatRows:r,rowsById:i}}function x0(t,e){var n;return(n=e[t.id])!=null?n:!1}function S0(t,e,n){var r;if(!((r=t.subRows)!=null&&r.length))return!1;let i=!0,s=!1;return t.subRows.forEach(o=>{if(!(s&&!i)&&(o.getCanSelect()&&(x0(o,e)?s=!0:i=!1),o.subRows&&o.subRows.length)){const a=S0(o,e);a==="all"?s=!0:(a==="some"&&(s=!0),i=!1)}}),i?"all":s?"some":!1}const I0=/([0-9]+)/gm,yU=(t,e,n)=>YT(gi(t.getValue(n)).toLowerCase(),gi(e.getValue(n)).toLowerCase()),_U=(t,e,n)=>YT(gi(t.getValue(n)),gi(e.getValue(n))),wU=(t,e,n)=>A0(gi(t.getValue(n)).toLowerCase(),gi(e.getValue(n)).toLowerCase()),EU=(t,e,n)=>A0(gi(t.getValue(n)),gi(e.getValue(n))),xU=(t,e,n)=>{const r=t.getValue(n),i=e.getValue(n);return r>i?1:r<i?-1:0},SU=(t,e,n)=>A0(t.getValue(n),e.getValue(n));function A0(t,e){return t===e?0:t>e?1:-1}function gi(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}function YT(t,e){const n=t.split(I0).filter(Boolean),r=e.split(I0).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),s=r.shift(),o=parseInt(i,10),a=parseInt(s,10),l=[o,a].sort();if(isNaN(l[0])){if(i>s)return 1;if(s>i)return-1;continue}if(isNaN(l[1]))return isNaN(o)?-1:1;if(o>a)return 1;if(a>o)return-1}return n.length-r.length}const cu={alphanumeric:yU,alphanumericCaseSensitive:_U,text:wU,textCaseSensitive:EU,datetime:xU,basic:SU},XT=[aU,{getInitialState:t=>({columnVisibility:{},...t}),getDefaultOptions:t=>({onColumnVisibilityChange:Yt("columnVisibility",t)}),createColumn:(t,e)=>{t.toggleVisibility=n=>{t.getCanHide()&&e.setColumnVisibility(r=>({...r,[t.id]:n!=null?n:!t.getIsVisible()}))},t.getIsVisible=()=>{var n,r;return(n=(r=e.getState().columnVisibility)==null?void 0:r[t.id])!=null?n:!0},t.getCanHide=()=>{var n,r;return((n=t.columnDef.enableHiding)!=null?n:!0)&&((r=e.options.enableHiding)!=null?r:!0)},t.getToggleVisibilityHandler=()=>n=>{t.toggleVisibility==null||t.toggleVisibility(n.target.checked)}},createRow:(t,e)=>{t._getAllVisibleCells=re(()=>[t.getAllCells(),e.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),{key:"row._getAllVisibleCells",debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugRows}}),t.getVisibleCells=re(()=>[t.getLeftVisibleCells(),t.getCenterVisibleCells(),t.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugRows}})},createTable:t=>{const e=(n,r)=>re(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),{key:n,debug:()=>{var i;return(i=t.options.debugAll)!=null?i:t.options.debugColumns}});t.getVisibleFlatColumns=e("getVisibleFlatColumns",()=>t.getAllFlatColumns()),t.getVisibleLeafColumns=e("getVisibleLeafColumns",()=>t.getAllLeafColumns()),t.getLeftVisibleLeafColumns=e("getLeftVisibleLeafColumns",()=>t.getLeftLeafColumns()),t.getRightVisibleLeafColumns=e("getRightVisibleLeafColumns",()=>t.getRightLeafColumns()),t.getCenterVisibleLeafColumns=e("getCenterVisibleLeafColumns",()=>t.getCenterLeafColumns()),t.setColumnVisibility=n=>t.options.onColumnVisibilityChange==null?void 0:t.options.onColumnVisibilityChange(n),t.resetColumnVisibility=n=>{var r;t.setColumnVisibility(n?{}:(r=t.initialState.columnVisibility)!=null?r:{})},t.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!t.getIsAllColumnsVisible(),t.setColumnVisibility(t.getAllLeafColumns().reduce((i,s)=>({...i,[s.id]:n||!(s.getCanHide!=null&&s.getCanHide())}),{}))},t.getIsAllColumnsVisible=()=>!t.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),t.getIsSomeColumnsVisible=()=>t.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),t.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;t.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}},pU,mU,hU,{getInitialState:t=>({sorting:[],...t}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:t=>({onSortingChange:Yt("sorting",t),isMultiSortEvent:e=>e.shiftKey}),createColumn:(t,e)=>{t.getAutoSortingFn=()=>{const n=e.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const s=i==null?void 0:i.getValue(t.id);if(Object.prototype.toString.call(s)==="[object Date]")return cu.datetime;if(typeof s=="string"&&(r=!0,s.split(I0).length>1))return cu.alphanumeric}return r?cu.text:cu.basic},t.getAutoSortDir=()=>{const n=e.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(t.id))=="string"?"asc":"desc"},t.getSortingFn=()=>{var n,r;if(!t)throw new Error;return Od(t.columnDef.sortingFn)?t.columnDef.sortingFn:t.columnDef.sortingFn==="auto"?t.getAutoSortingFn():(n=(r=e.options.sortingFns)==null?void 0:r[t.columnDef.sortingFn])!=null?n:cu[t.columnDef.sortingFn]},t.toggleSorting=(n,r)=>{const i=t.getNextSortingOrder(),s=typeof n!="undefined"&&n!==null;e.setSorting(o=>{const a=o==null?void 0:o.find(f=>f.id===t.id),l=o==null?void 0:o.findIndex(f=>f.id===t.id);let u=[],c,h=s?n:i==="desc";if(o!=null&&o.length&&t.getCanMultiSort()&&r?a?c="toggle":c="add":o!=null&&o.length&&l!==o.length-1?c="replace":a?c="toggle":c="replace",c==="toggle"&&(s||i||(c="remove")),c==="add"){var d;u=[...o,{id:t.id,desc:h}],u.splice(0,u.length-((d=e.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else c==="toggle"?u=o.map(f=>f.id===t.id?{...f,desc:h}:f):c==="remove"?u=o.filter(f=>f.id!==t.id):u=[{id:t.id,desc:h}];return u})},t.getFirstSortDir=()=>{var n,r;return((n=(r=t.columnDef.sortDescFirst)!=null?r:e.options.sortDescFirst)!=null?n:t.getAutoSortDir()==="desc")?"desc":"asc"},t.getNextSortingOrder=n=>{var r,i;const s=t.getFirstSortDir(),o=t.getIsSorted();return o?o!==s&&((r=e.options.enableSortingRemoval)==null||r)&&(!(n&&(i=e.options.enableMultiRemove)!=null)||i)?!1:o==="desc"?"asc":"desc":s},t.getCanSort=()=>{var n,r;return((n=t.columnDef.enableSorting)!=null?n:!0)&&((r=e.options.enableSorting)!=null?r:!0)&&!!t.accessorFn},t.getCanMultiSort=()=>{var n,r;return(n=(r=t.columnDef.enableMultiSort)!=null?r:e.options.enableMultiSort)!=null?n:!!t.accessorFn},t.getIsSorted=()=>{var n;const r=(n=e.getState().sorting)==null?void 0:n.find(i=>i.id===t.id);return r?r.desc?"desc":"asc":!1},t.getSortIndex=()=>{var n,r;return(n=(r=e.getState().sorting)==null?void 0:r.findIndex(i=>i.id===t.id))!=null?n:-1},t.clearSorting=()=>{e.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==t.id):[])},t.getToggleSortingHandler=()=>{const n=t.getCanSort();return r=>{n&&(r.persist==null||r.persist(),t.toggleSorting==null||t.toggleSorting(void 0,t.getCanMultiSort()?e.options.isMultiSortEvent==null?void 0:e.options.isMultiSortEvent(r):!1))}}},createTable:t=>{t.setSorting=e=>t.options.onSortingChange==null?void 0:t.options.onSortingChange(e),t.resetSorting=e=>{var n,r;t.setSorting(e?[]:(n=(r=t.initialState)==null?void 0:r.sorting)!=null?n:[])},t.getPreSortedRowModel=()=>t.getGroupedRowModel(),t.getSortedRowModel=()=>(!t._getSortedRowModel&&t.options.getSortedRowModel&&(t._getSortedRowModel=t.options.getSortedRowModel(t)),t.options.manualSorting||!t._getSortedRowModel?t.getPreSortedRowModel():t._getSortedRowModel())}},dU,cU,gU,vU,lU];function IU(t){var e;(t.debugAll||t.debugTable)&&console.info("Creating Table Instance...");let n={_features:XT};const r=n._features.reduce((c,h)=>Object.assign(c,h.getDefaultOptions==null?void 0:h.getDefaultOptions(n)),{}),i=c=>n.options.mergeOptions?n.options.mergeOptions(r,c):{...r,...c};let o={...{},...(e=t.initialState)!=null?e:{}};n._features.forEach(c=>{var h;o=(h=c.getInitialState==null?void 0:c.getInitialState(o))!=null?h:o});const a=[];let l=!1;const u={_features:XT,options:{...r,...t},initialState:o,_queue:c=>{a.push(c),l||(l=!0,Promise.resolve().then(()=>{for(;a.length;)a.shift()();l=!1}).catch(h=>setTimeout(()=>{throw h})))},reset:()=>{n.setState(n.initialState)},setOptions:c=>{const h=pi(c,n.options);n.options=i(h)},getState:()=>n.options.state,setState:c=>{n.options.onStateChange==null||n.options.onStateChange(c)},_getRowId:(c,h,d)=>{var f;return(f=n.options.getRowId==null?void 0:n.options.getRowId(c,h,d))!=null?f:`${d?[d.id,h].join("."):h}`},getCoreRowModel:()=>(n._getCoreRowModel||(n._getCoreRowModel=n.options.getCoreRowModel(n)),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(c,h)=>{let d=(h?n.getPrePaginationRowModel():n.getRowModel()).rowsById[c];if(!d&&(d=n.getCoreRowModel().rowsById[c],!d))throw new Error;return d},_getDefaultColumnDef:re(()=>[n.options.defaultColumn],c=>{var h;return c=(h=c)!=null?h:{},{header:d=>{const f=d.header.column.columnDef;return f.accessorKey?f.accessorKey:f.accessorFn?f.id:null},cell:d=>{var f,g;return(f=(g=d.renderValue())==null||g.toString==null?void 0:g.toString())!=null?f:null},...n._features.reduce((d,f)=>Object.assign(d,f.getDefaultColumnDef==null?void 0:f.getDefaultColumnDef()),{}),...c}},{debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns},key:!1}),_getColumnDefs:()=>n.options.columns,getAllColumns:re(()=>[n._getColumnDefs()],c=>{const h=function(d,f,g){return g===void 0&&(g=0),d.map(m=>{const w=oU(n,m,g,f),v=m;return w.columns=v.columns?h(v.columns,w,g+1):[],w})};return h(c)},{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),getAllFlatColumns:re(()=>[n.getAllColumns()],c=>c.flatMap(h=>h.getFlatColumns()),{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),_getAllFlatColumnsById:re(()=>[n.getAllFlatColumns()],c=>c.reduce((h,d)=>(h[d.id]=d,h),{}),{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),getAllLeafColumns:re(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(c,h)=>{let d=c.flatMap(f=>f.getLeafColumns());return h(d)},{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),getColumn:c=>n._getAllFlatColumnsById()[c]};Object.assign(n,u);for(let c=0;c<n._features.length;c++){const h=n._features[c];h==null||h.createTable==null||h.createTable(n)}return n}function AU(t,e,n,r){const i=()=>{var o;return(o=s.getValue())!=null?o:t.options.renderFallbackValue},s={id:`${e.id}_${n.id}`,row:e,column:n,getValue:()=>e.getValue(r),renderValue:i,getContext:re(()=>[t,n,e,s],(o,a,l,u)=>({table:o,column:a,row:l,cell:u,getValue:u.getValue,renderValue:u.renderValue}),{key:!1,debug:()=>t.options.debugAll})};return t._features.forEach(o=>{o.createCell==null||o.createCell(s,n,e,t)},{}),s}const TU=(t,e,n,r,i,s,o)=>{let a={id:e,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(a._valuesCache.hasOwnProperty(l))return a._valuesCache[l];const u=t.getColumn(l);if(u!=null&&u.accessorFn)return a._valuesCache[l]=u.accessorFn(a.original,r),a._valuesCache[l]},getUniqueValues:l=>{if(a._uniqueValuesCache.hasOwnProperty(l))return a._uniqueValuesCache[l];const u=t.getColumn(l);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(a._uniqueValuesCache[l]=u.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[l]):(a._uniqueValuesCache[l]=[a.getValue(l)],a._uniqueValuesCache[l])},renderValue:l=>{var u;return(u=a.getValue(l))!=null?u:t.options.renderFallbackValue},subRows:s!=null?s:[],getLeafRows:()=>sU(a.subRows,l=>l.subRows),getParentRow:()=>a.parentId?t.getRow(a.parentId,!0):void 0,getParentRows:()=>{let l=[],u=a;for(;;){const c=u.getParentRow();if(!c)break;l.push(c),u=c}return l.reverse()},getAllCells:re(()=>[t.getAllLeafColumns()],l=>l.map(u=>AU(t,a,u,u.id)),{key:!1,debug:()=>{var l;return(l=t.options.debugAll)!=null?l:t.options.debugRows}}),_getAllCellsByColumnId:re(()=>[a.getAllCells()],l=>l.reduce((u,c)=>(u[c.column.id]=c,u),{}),{key:"row.getAllCellsByColumnId",debug:()=>{var l;return(l=t.options.debugAll)!=null?l:t.options.debugRows}})};for(let l=0;l<t._features.length;l++){const u=t._features[l];u==null||u.createRow==null||u.createRow(a,t)}return a};function CU(){return{accessor:(t,e)=>typeof t=="function"?{...e,accessorFn:t}:{...e,accessorKey:t},display:t=>t,group:t=>t}}function bU(){return t=>re(()=>[t.options.data],e=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,s,o){s===void 0&&(s=0);const a=[];for(let u=0;u<i.length;u++){const c=TU(t,t._getRowId(i[u],u,o),i[u],u,s,void 0,o==null?void 0:o.id);if(n.flatRows.push(c),n.rowsById[c.id]=c,a.push(c),t.options.getSubRows){var l;c.originalSubRows=t.options.getSubRows(i[u],u),(l=c.originalSubRows)!=null&&l.length&&(c.subRows=r(c.originalSubRows,s+1,c))}}return a};return n.rows=r(e),n},{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugTable},onChange:()=>{t._autoResetPageIndex()}})}function RU(){return t=>re(()=>[t.getState().sorting,t.getPreSortedRowModel()],(e,n)=>{if(!n.rows.length||!(e!=null&&e.length))return n;const r=t.getState().sorting,i=[],s=r.filter(l=>{var u;return(u=t.getColumn(l.id))==null?void 0:u.getCanSort()}),o={};s.forEach(l=>{const u=t.getColumn(l.id);u&&(o[l.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const a=l=>{const u=l.map(c=>({...c}));return u.sort((c,h)=>{for(let f=0;f<s.length;f+=1){var d;const g=s[f],m=o[g.id],w=(d=g==null?void 0:g.desc)!=null?d:!1;let v=0;if(m.sortUndefined){const y=c.getValue(g.id),_=h.getValue(g.id),E=y===void 0,I=_===void 0;(E||I)&&(v=E&&I?0:E?m.sortUndefined:-m.sortUndefined)}if(v===0&&(v=m.sortingFn(c,h,g.id)),v!==0)return w&&(v*=-1),m.invertSorting&&(v*=-1),v}return c.index-h.index}),u.forEach(c=>{var h;i.push(c),(h=c.subRows)!=null&&h.length&&(c.subRows=a(c.subRows))}),u};return{rows:a(n.rows),flatRows:i,rowsById:n.rowsById}},{key:!1,debug:()=>{var e;return(e=t.options.debugAll)!=null?e:t.options.debugTable},onChange:()=>{t._autoResetPageIndex()}})}/**
   * react-table
   *
   * Copyright (c) TanStack
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE.md file in the root directory of this source tree.
   *
   * @license MIT
   */function kU(t,e){return t?PU(t)?S.createElement(t,e):t:null}function PU(t){return NU(t)||typeof t=="function"||OU(t)}function NU(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function OU(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function DU(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=S.useState(()=>({current:IU(e)})),[r,i]=S.useState(()=>n.current.initialState);return n.current.setOptions(s=>({...s,...t,state:{...r,...t.state},onStateChange:o=>{i(o),t.onStateChange==null||t.onStateChange(o)}})),n.current}const MU=({status:t,onChange:e,alwaysEdit:n})=>{const[r]=_t(),[i]=Y(qA),[s,o]=S.useState(n||!1),[a,l]=S.useState(0),u=S.useRef(null),c=mE(),h=(i==null?void 0:i.id)!=="anonymous";S.useEffect(()=>{if(!(a===0||n))return u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>l(0),1200),()=>{u.current&&window.clearTimeout(u.current)}},[a,n]);const d=m=>{switch(m){case"available":case"sold":case"reserved":return m;default:throw new Error("Invalid status")}},f=()=>{e&&(o(!0),l(0))},g=()=>{l(a+1),h&&a+1>=2&&f(),!h&&a+1>=5&&c(`/${r.company}/admin`)};if(s&&e)return p.jsxs("select",{name:"status",id:"status",className:"h-8 w-[65px] appearance-none rounded-md border border-gray-300 bg-right bg-no-repeat pl-1 pr-0 text-xs md:w-36",onChange:m=>{const w=d(m.target.value);e(w),o(n||!1)},defaultValue:d(t),onBlur:()=>o(n||!1),children:[r.statuslabels.available&&p.jsx("option",{value:"available",children:r.statuslabels.available}),r.statuslabels.sold&&p.jsx("option",{value:"sold",children:r.statuslabels.sold}),r.statuslabels.reserved&&p.jsx("option",{value:"reserved",children:r.statuslabels.reserved})]});switch(t){case"available":return p.jsxs("button",{type:"button",onClick:g,title:h?"Dubbelklicka för att ändra status":"",className:`-ml-1 flex ${h?"cursor-pointer":"cursor-default"} items-center bg-transparent p-0`,children:[p.jsx("svg",{width:"16",height:"16","aria-hidden":"true",children:p.jsx("circle",{cx:"8",cy:"9",r:"3",fill:"#18974d",className:"svg-circle-available"})}),p.jsx("span",{className:"whitespace-nowrap",children:r==null?void 0:r.statuslabels.available})]});case"sold":return p.jsxs("button",{type:"button",onClick:g,title:h?"Dubbelklicka för att ändra status":"",className:`-ml-1 flex ${h?"cursor-pointer":"cursor-default"} items-center bg-transparent p-0`,children:[p.jsx("svg",{width:"16",height:"16","aria-hidden":"true",children:p.jsx("circle",{cx:"8",cy:"9",r:"3",fill:"#ec3326",className:"svg-circle-sold"})}),p.jsx("span",{className:"whitespace-nowrap",children:r.statuslabels.sold})]});case"reserved":return p.jsxs("button",{type:"button",onClick:g,title:h?"Dubbelklicka för att ändra status":"",className:`-ml-1 flex ${h?"cursor-pointer":"cursor-default"} items-center bg-transparent p-0`,children:[p.jsx("svg",{width:"16",height:"16","aria-hidden":"true",children:p.jsx("circle",{cx:"8",cy:"9",r:"3",fill:"orange",className:"svg-circle-reserved"})}),p.jsx("span",{className:"whitespace-nowrap",children:r==null?void 0:r.statuslabels.reserved})]});default:return p.jsx("button",{type:"button",onClick:g,title:h?"Dubbelklicka för att ändra status":"",className:`-ml-1 flex ${h?"cursor-pointer":"cursor-default"} items-center bg-transparent p-0`,children:p.jsx("span",{children:t})})}},LU=async({company:t,site:e,id:n,data:r})=>{const i=FM(cs,`${t}/${e}/apartments/${n}`);return await iL(i,r,{merge:!0}),{id:n,data:r}},VU=()=>{const[t]=_t(),e=mg();return vk({mutationFn:n=>{if(!t.company||!t.siteid||!n.id)throw new Error("Missing company or site id.");return LU({company:t.company,site:t.siteid,id:n.id,data:n.data})},onSuccess:()=>{t!=null&&t.siteid&&(t!=null&&t.company)&&e.invalidateQueries({queryKey:["site",t.siteid,"company",t.company,"apartments"]})}})};class JT{constructor(e,n,r,i,s,o){Zn(this,"id");Zn(this,"apartmentid");Zn(this,"cells");Zn(this,"apartmentOnTop");Zn(this,"mainview");Zn(this,"firebaseId");this.id=e,this.apartmentid=n,this.cells=r,this.apartmentOnTop=i,this.mainview=s,this.firebaseId=o}getVisibleCells(){return this.cells}getCellValue(e){if(this.apartmentOnTop){const n=e.column.id.toString();return this.apartmentOnTop[n]}return e.getValue()}}const ZT=({row:t,isTopRow:e})=>{const[n,r]=Y(Dv),[i,s]=Y(Mv),[,o]=Y(No),[a,l]=Y(Lv),u=VU();if(!t||!e&&(i==null?void 0:i.apartmentid)===t.getValue("apartmentid"))return null;let c;if(e){if(!i)return null;c=new JT("toprow",i.apartmentid,t.getVisibleCells(),i,t.getValue("mainview"),i.id)}else c=new JT(t.id,t.getValue("apartmentid"),t.getVisibleCells(),void 0,t.getValue("mainview"),t.original.id);const h=["tr-hooverable",c.apartmentid===n||e?"highlight-row":""],d=e?{}:{onFocus:()=>{s(null),r(c.apartmentid)},onMouseOver:()=>{s(null),r(c.apartmentid)},onMouseOut:()=>{Kt()||(s(null),r(null))},onBlur:()=>{s(null),r(null)},onClick:()=>{s(null),r(c.apartmentid),a&&l(t.original),c.mainview!==void 0&&o(c.mainview)}},f=m=>m==="apartmentid"||m==="floor"?"":m==="mainview"?"alwayshide":"",g=m=>{c.firebaseId&&u.mutate({id:c.firebaseId,data:{status:m}})};return p.jsx("tr",{className:h.join(" "),...d,children:c.getVisibleCells().map(m=>{var _;const w=m.column.id.toString(),v=c.getCellValue(m);let y=p.jsx(p.Fragment,{});return w==="status"?y=p.jsx(MU,{status:v,onChange:E=>{g(E)}}):w==="price"?y=p.jsx("span",{className:"whitespace-nowrap",children:typeof v=="number"&&v>0?v.toLocaleString("sv-SE")+" kr":"-"}):w==="charge"?y=p.jsx("span",{className:"whitespace-nowrap",children:typeof v=="number"&&v>0?v.toLocaleString("sv-SE")+" kr/mån":"-"}):w==="size"?y=p.jsxs("span",{className:"whitespace-nowrap",children:[v.toLocaleString("sv-SE")+" m",p.jsx("sup",{children:"2"})]}):w==="lotsize"?y=p.jsxs("span",{className:"whitespace-nowrap",children:[v.toLocaleString("sv-SE")+" m",p.jsx("sup",{children:"2"})]}):w==="moveindate"?y=p.jsxs("span",{className:"whitespace-nowrap",children:[" ",(_=v==null?void 0:v.toDate())==null?void 0:_.toLocaleString("sv-SE",{dateStyle:"short"})]}):y=p.jsx("span",{className:"whitespace-nowrap",children:v}),S.createElement("td",{className:`pr-3 ${f(w)} ${["status"].find(E=>E==w)?"text-left":"text-right"}`,key:m.id},y)})},c.id)},eC=({maxTableHeight:t})=>{const[e]=_t(),n=Fv(),[r,i]=S.useState([{id:e!=null&&e.sort?e.sort:"rok",desc:!1}]),s=CU(),o=h=>{var d,f,g,m,w,v,y,_,E;switch(h){case"status":return((d=e==null?void 0:e.tabletitles)==null?void 0:d.status)||"Status";case"apartmentid":return((f=e==null?void 0:e.tabletitles)==null?void 0:f.apartmentid)||"Nr.";case"size":return((g=e==null?void 0:e.tabletitles)==null?void 0:g.size)||"Boarea";case"lotsize":return((m=e==null?void 0:e.tabletitles)==null?void 0:m.lotsize)||"Tomtarea";case"rok":return((w=e==null?void 0:e.tabletitles)==null?void 0:w.rok)||"Rum";case"floor":return((v=e==null?void 0:e.tabletitles)==null?void 0:v.floor)||"Våning";case"price":return((y=e==null?void 0:e.tabletitles)==null?void 0:y.price)||"Pris";case"charge":return((_=e==null?void 0:e.tabletitles)==null?void 0:_.charge)||"Avgift";case"moveindate":return((E=e==null?void 0:e.tabletitles)==null?void 0:E.moveindate)||"Inflyttning";default:return""}},a=[];a.push(s.accessor("status",{header:h=>o(h.column.id)})),a.push(s.accessor("rok",{header:h=>o(h.column.id)})),((e==null?void 0:e.type)=="condominium"||(e==null?void 0:e.type)=="ownership")&&a.push(s.accessor("price",{header:h=>o(h.column.id)})),((e==null?void 0:e.type)=="condominium"||(e==null?void 0:e.type)=="rental")&&a.push(s.accessor("charge",{header:h=>o(h.column.id)})),a.push(s.accessor("size",{header:h=>o(h.column.id)})),n.length>0&&n[0].lotsize&&a.push(s.accessor("lotsize",{header:h=>o(h.column.id)})),a.push(s.accessor("floor",{header:h=>o(h.column.id)})),n.length>0&&n[0].moveindate&&a.push(s.accessor("moveindate",{header:h=>o(h.column.id)})),a.push(s.accessor("apartmentid",{header:h=>o(h.column.id)})),a.push(s.accessor("mainview",{header:h=>o(h.column.id)}));const l=DU({data:n,columns:a,state:{sorting:r},onSortingChange:i,getCoreRowModel:bU(),getSortedRowModel:RU()}),u=h=>h==="apartmentid"||h==="floor"?"":h==="mainview"?"alwayshide":"",c=t?{maxHeight:t,overflow:"auto"}:m4()?{maxHeight:"14rem",overflow:"auto"}:{};return p.jsx("div",{className:"flex w-full select-none justify-center",children:p.jsx("div",{className:"tableapartments w-full overflow-x-auto border-2 border-gray-100 p-2 pl-2 shadow-md",id:"table-container",style:c,children:p.jsxs("table",{className:"reacttable w-full",children:[p.jsx("thead",{className:"font-style-one text-sm",children:l.getHeaderGroups().map(h=>p.jsx("tr",{children:h.headers.map(d=>{var f;return p.jsx("th",{className:`text-left pr-3 whitespace-nowrap ${u(d.id)}`,children:d.isPlaceholder?null:p.jsxs("div",{className:d.column.getCanSort()?`cursor-pointer select-none ${["status"].find(g=>g==d.id)?"text-left":"text-right"}`:"",onClick:d.column.getToggleSortingHandler(),children:[(f={asc:p.jsx("svg",{viewBox:"0 0 512 512",className:"inline-block h-4 w-4 rotate-90",children:p.jsx("polygon",{points:"352,128.4 319.7,96 160,256 160,256 160,256 319.7,416 352,383.6 224.7,256 "})}),desc:p.jsx("svg",{viewBox:"0 0 512 512",className:"inline-block h-4 w-4 -rotate-90",children:p.jsx("polygon",{points:"352,128.4 319.7,96 160,256 160,256 160,256 319.7,416 352,383.6 224.7,256 "})})}[d.column.getIsSorted()])!=null?f:null,kU(d.column.columnDef.header,d.getContext())]})},d.id)})},h.id))}),p.jsxs("tbody",{className:"text-xs",children:[p.jsx(ZT,{row:l.getRowModel().rows[0],isTopRow:!0}),l.getRowModel().rows.map(h=>p.jsx(ZT,{row:h},h.id))]})]})})})},FU=({maxTableHeight:t,maxWidth:e})=>{const[n]=_t(),[r]=Y(v4);return n!=null&&n.siteid?n.disabled?p.jsx(p.Fragment,{}):p.jsxs("div",{id:"pintar-planner-wrapper",part:"pintar-planner-wrapper",className:"m-auto",style:{maxWidth:e?`clamp(0rem, ${e}, 90rem)`:"64rem"},children:[p.jsx(DF,{}),p.jsxs("div",{className:`pintar-planner-content-wrapper relative ${r?"hidden":""}`,children:[p.jsx(NF,{}),p.jsx(eC,{maxTableHeight:t}),p.jsx(MF,{})]}),p.jsxs("div",{id:"modals",children:[p.jsx(a0,{isOpenAtom:kv,pathSegment:"map",className:"relative max-w-5xl",children:p.jsx(FT,{})}),p.jsx(a0,{isOpenAtom:Nv,pathSegment:"panorama",children:p.jsx(VT,{fullscreen:!0})}),p.jsx(a0,{isOpenAtom:Pv,pathSegment:"solar",className:"relative max-w-5xl",children:p.jsx(UT,{})}),p.jsx(VF,{})]})]}):p.jsx(p.Fragment,{})},UU="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap",$U="https://fonts.googleapis.com/css?family=Jost",jU=new ek({defaultOptions:{queries:{staleTime:1/0,gcTime:1/0}}});function zU({company:t,sitename:e,view:n,maxWidth:r,maxTableHeight:i,height:s,shadowRootRef:o,assetBase:a}){S.useEffect(()=>{BU(),HU(["Poppins","Jost"]).catch(()=>{})},[]),S.useEffect(()=>{if(!t||!o||!a)return;const c=new URL(`styles/${t}5.css?v=104`,a).toString(),h=document.createElement("link");return h.rel="stylesheet",h.href=c,o.appendChild(h),()=>{o.contains(h)&&o.removeChild(h)}},[t,o,a]);const l=S.useMemo(()=>{const c=g=>(g!=null?g:"").trim().replace(/^\/+|\/+$/g,""),h=c(t),d=c(e),f=c(n);return`/${[h,d,f].filter(Boolean).join("/")}`},[t,e,n]),u=S.useMemo(()=>Cv(),[]);return p.jsx(f4,{store:u,children:p.jsx(R2,{initialEntries:[l],children:p.jsx(sk,{client:jU,children:p.jsxs(P2,{children:[p.jsx(Xs,{path:"/:company/:sitename",element:p.jsx(FU,{maxTableHeight:i,maxWidth:r})}),p.jsx(Xs,{path:"/:company/:sitename/map",element:p.jsx(FT,{maxWidth:r})}),p.jsx(Xs,{path:"/:company/:sitename/solar",element:p.jsx(UT,{maxWidth:r})}),p.jsx(Xs,{path:"/:company/:sitename/table",element:p.jsx(eC,{maxTableHeight:i})}),p.jsx(Xs,{path:"/:company/:sitename/panorama",element:p.jsx(VT,{height:s,maxWidth:r})})]})})},l)})}function BU(){Vd("mtw-gf-pre-googleapis",{rel:"preconnect",href:"https://fonts.googleapis.com"}),Vd("mtw-gf-pre-gstatic",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),Vd("mtw-gf-poppins",{rel:"stylesheet",href:UU}),Vd("mtw-gf-jost",{rel:"stylesheet",href:$U})}function Vd(t,e){const n=document.head||document.getElementsByTagName("head")[0];if(!n)return;let r=document.getElementById(t);r||(r=document.createElement("link"),r.id=t,n.appendChild(r));for(const[i,s]of Object.entries(e))r[i]=s,r.setAttribute(i,s)}async function HU(t){if(!("fonts"in document))return;const e=t.map(n=>document.fonts.load(`1em "${n}"`));await Promise.allSettled(e)}const tC=`*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}[type=text],input:where(:not([type])),[type=email],[type=url],[type=password],[type=number],[type=date],[type=datetime-local],[type=month],[type=search],[type=tel],[type=time],[type=week],[multiple],textarea,select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-width:1px;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem;--tw-shadow: 0 0 #0000}[type=text]:focus,input:where(:not([type])):focus,[type=email]:focus,[type=url]:focus,[type=password]:focus,[type=number]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=month]:focus,[type=search]:focus,[type=tel]:focus,[type=time]:focus,[type=week]:focus,[multiple]:focus,textarea:focus,select:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset: var(--tw-empty, );--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: #2563eb;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#2563eb}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}select{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}[multiple],[size]:where(select:not([size="1"])){background-image:initial;background-position:initial;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;display:inline-block;vertical-align:middle;background-origin:border-box;-webkit-user-select:none;-moz-user-select:none;user-select:none;flex-shrink:0;height:1rem;width:1rem;color:#2563eb;background-color:#fff;border-color:#6b7280;border-width:1px;--tw-shadow: 0 0 #0000}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset: var(--tw-empty, );--tw-ring-offset-width: 2px;--tw-ring-offset-color: #fff;--tw-ring-color: #2563eb;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}[type=checkbox]:checked,[type=radio]:checked{border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:center;background-repeat:no-repeat}[type=checkbox]:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")}@media (forced-colors: active){[type=checkbox]:checked{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}}[type=radio]:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e")}@media (forced-colors: active){[type=radio]:checked{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}}[type=checkbox]:checked:hover,[type=checkbox]:checked:focus,[type=radio]:checked:hover,[type=radio]:checked:focus{border-color:transparent;background-color:currentColor}[type=checkbox]:indeterminate{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e");border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:center;background-repeat:no-repeat}@media (forced-colors: active){[type=checkbox]:indeterminate{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}}[type=checkbox]:indeterminate:hover,[type=checkbox]:indeterminate:focus{border-color:transparent;background-color:currentColor}[type=file]{background:unset;border-color:inherit;border-width:0;border-radius:0;padding:0;font-size:unset;line-height:inherit}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}body,:host{font-family:Poppins,Helvetica,Arial,Lucida,sans-serif;font-weight:500;letter-spacing:.5px;line-height:1.7em;font-size:14px;overscroll-behavior-y:contain}td{font-family:Helvetica,Arial,Lucida,sans-serif}:root{--border-width: 7px}:host([pintarstudios-webtools-widget]){width:100%;height:auto;display:block;color:#000}@media (max-width: 768px){:host([pintarstudios-webtools-widget]){display:block!important;width:100vw!important;width:100dvw!important;max-width:100dvw!important;margin-left:calc(50% - 50dvw)!important;margin-right:calc(50% - 50dvw)!important;box-sizing:border-box!important;background:#fff!important}}#modal:has(div){visibility:visible}.sec-loading{align-items:center;justify-content:center;height:716px;display:flex;padding:15px}.sec-loading .one{position:relative;animation:move .5s linear infinite alternate-reverse}.alwayshide{display:none}g.view-path{fill-opacity:0;stroke:#fff;stroke-width:5px;pointer-events:all;visibility:hidden}g.view-path.show{visibility:visible}g.view-path:hover{visibility:visible}path.camera-path{fill:#fff;stroke:#000;stroke-width:3px;pointer-events:all;transform-origin:center;transform-box:fill-box}path.camera-path.current{fill:#019660;stroke-width:3px!important}path.camera-path:hover{stroke-width:5px}path.camera-path.jello-horizontal{animation:puff-in-center .7s cubic-bezier(.215,.61,.355,1) both;animation-composition:add}path.overviewapartment-path{stroke:#36a14d;stroke-width:6px;visibility:hidden;pointer-events:all;opacity:0;transition:none}path.overviewapartment-path.show{visibility:visible;opacity:1;fill:#36a14d;fill-opacity:.3}g.location-path{fill:gray;fill-opacity:.3;stroke:#fff;stroke-width:3px;visibility:hidden;pointer-events:all}g.location-path.available{fill:#36a14d}g.location-path.reserved{fill:orange}g.location-path.sold{fill:#ec3326}g.location-path.show{visibility:visible}g.location-path.showbold{fill-opacity:.6;visibility:visible}g.location-path.show.showbold{fill-opacity:.75;visibility:visible}g.location-path:hover{fill-opacity:.6;visibility:visible}@keyframes click-opacity{0%{fill-opacity:.8}to{fill-opacity:.6}}g.location-path:active{animation:click-opacity .45s ease}.infogroup:hover .thecircle{fill-opacity:1;visibility:visible;stroke:#fff;stroke-width:5px;opacity:.9;transition:stroke-width .6s linear}.infogroup:hover .innerfigure{fill-opacity:1;visibility:visible;stroke:#fff;stroke-width:2px;transition:stroke-width .6s linear}.info-path{fill-opacity:0;pointer-events:all}.info-path:hover{stroke:#fff;stroke-width:5px;pointer-events:all}.status-popup-shape{height:30px;background-color:#ccc;border-radius:0 15px 15px 0}.status-popup-shape.status-available{background-color:#00965f;fill-opacity:.8}.status-popup-shape.status-sold{background-color:#ec3326;fill-opacity:.8}.status-popup-shape.status-pending{background-color:orange;fill-opacity:.8}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.\\!container{width:100%!important}.container{width:100%}@media (min-width: 640px){.\\!container{max-width:640px!important}.container{max-width:640px}}@media (min-width: 768px){.\\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width: 1024px){.\\!container{max-width:1024px!important}.container{max-width:1024px}}@media (min-width: 1280px){.\\!container{max-width:1280px!important}.container{max-width:1280px}}@media (min-width: 1536px){.\\!container{max-width:1536px!important}.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-1{left:.25rem;right:.25rem}.bottom-0{bottom:0}.bottom-1{bottom:.25rem}.bottom-10{bottom:2.5rem}.bottom-12{bottom:3rem}.bottom-14{bottom:3.5rem}.bottom-2{bottom:.5rem}.bottom-\\[90px\\]{bottom:90px}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\\/2{left:50%}.left-2{left:.5rem}.left-4{left:1rem}.left-9{left:2.25rem}.left-\\[15\\%\\]{left:15%}.left-\\[20\\%\\]{left:20%}.left-\\[calc\\(50\\%\\+100px\\)\\]{left:calc(50% + 100px)}.left-\\[calc\\(50\\%-100px\\)\\]{left:calc(50% - 100px)}.left-full{left:100%}.right-0{right:0}.right-1{right:.25rem}.right-10{right:2.5rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-full{right:100%}.top-0{top:0}.top-1{top:.25rem}.top-1\\/2{top:50%}.top-10{top:2.5rem}.top-12{top:3rem}.top-2{top:.5rem}.top-3{top:.75rem}.top-4{top:1rem}.top-40{top:10rem}.top-9{top:2.25rem}.top-\\[10\\%\\]{top:10%}.top-\\[110px\\]{top:110px}.top-\\[2\\%\\]{top:2%}.top-\\[5\\%\\]{top:5%}.top-full{top:100%}.isolate{isolation:isolate}.z-10{z-index:10}.z-50{z-index:50}.z-\\[2147483647\\]{z-index:2147483647}.z-\\[9999\\]{z-index:9999}.m-0{margin:0}.m-3{margin:.75rem}.m-5{margin:1.25rem}.m-auto{margin:auto}.mx-auto{margin-left:auto;margin-right:auto}.-ml-1{margin-left:-.25rem}.-mt-1{margin-top:-.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-5{margin-left:1.25rem}.ml-6{margin-left:1.5rem}.ml-\\[3px\\]{margin-left:3px}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-4{margin-right:1rem}.mr-5{margin-right:1.25rem}.mt-1{margin-top:.25rem}.mt-10{margin-top:2.5rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-0{height:0px}.h-10{height:2.5rem}.h-12{height:3rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-32{height:8rem}.h-36{height:9rem}.h-4{height:1rem}.h-52{height:13rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\\[0px\\]{height:0px}.h-\\[1100px\\]{height:1100px}.h-\\[14px\\]{height:14px}.h-\\[20px\\]{height:20px}.h-\\[60\\%\\]{height:60%}.h-\\[68px\\]{height:68px}.h-\\[70\\%\\]{height:70%}.h-\\[calc\\(100vh-110px\\)\\]{height:calc(100vh - 110px)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-64{max-height:16rem}.max-h-screen{max-height:100vh}.min-h-56{min-height:14rem}.min-h-\\[calc\\(100vh-68px\\)\\]{min-height:calc(100vh - 68px)}.min-h-screen{min-height:100vh}.w-20{width:5rem}.w-3\\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-52{width:13rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-\\[0px\\]{width:0px}.w-\\[100px\\]{width:100px}.w-\\[115px\\]{width:115px}.w-\\[14px\\]{width:14px}.w-\\[38px\\]{width:38px}.w-\\[3px\\]{width:3px}.w-\\[60\\%\\]{width:60%}.w-\\[65px\\]{width:65px}.w-\\[68px\\]{width:68px}.w-\\[70\\%\\]{width:70%}.w-\\[81\\%\\]{width:81%}.w-auto{width:auto}.w-full{width:100%}.min-w-\\[600px\\]{min-width:600px}.max-w-3xl{max-width:48rem}.max-w-5xl{max-width:64rem}.max-w-64{max-width:16rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-full{max-width:100%}.max-w-md{max-width:28rem}.flex-shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-12{--tw-translate-y: -3rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\\[21px\\]{--tw-translate-x: 21px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\\[3px\\]{--tw-translate-x: 3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-105{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-150{--tw-scale-x: 1.5;--tw-scale-y: 1.5;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-75{--tw-scale-x: .75;--tw-scale-y: .75;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.scroll-mt-32{scroll-margin-top:8rem}.scroll-mt-56{scroll-margin-top:14rem}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-evenly{justify-content:space-evenly}.gap-1{gap:.25rem}.gap-1\\.5{gap:.375rem}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-6{gap:1.5rem}.space-x-\\[2px\\]>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(2px * var(--tw-space-x-reverse));margin-left:calc(2px * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-slate-800>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 41 59 / var(--tw-divide-opacity))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.rounded-xl{border-radius:.75rem}.rounded-b-md{border-bottom-right-radius:.375rem;border-bottom-left-radius:.375rem}.rounded-r-md{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}.rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-x-\\[7px\\]{border-left-width:7px;border-right-width:7px}.border-y-\\[7px\\]{border-top-width:7px;border-bottom-width:7px}.border-b{border-bottom-width:1px}.border-b-\\[7px\\]{border-bottom-width:7px}.border-l-\\[7px\\]{border-left-width:7px}.border-r{border-right-width:1px}.border-r-\\[7px\\]{border-right-width:7px}.border-t{border-top-width:1px}.border-t-\\[7px\\]{border-top-width:7px}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity))}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-x-transparent{border-left-color:transparent;border-right-color:transparent}.border-y-transparent{border-top-color:transparent;border-bottom-color:transparent}.border-b-white{--tw-border-opacity: 1;border-bottom-color:rgb(255 255 255 / var(--tw-border-opacity))}.border-l-white{--tw-border-opacity: 1;border-left-color:rgb(255 255 255 / var(--tw-border-opacity))}.border-r-white{--tw-border-opacity: 1;border-right-color:rgb(255 255 255 / var(--tw-border-opacity))}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity))}.bg-\\[\\#00965f\\]{--tw-bg-opacity: 1;background-color:rgb(0 150 95 / var(--tw-bg-opacity))}.bg-\\[\\#00965f\\]\\/80{background-color:#00965fcc}.bg-\\[\\#0f1116\\]{--tw-bg-opacity: 1;background-color:rgb(15 17 22 / var(--tw-bg-opacity))}.bg-\\[\\#151823\\]{--tw-bg-opacity: 1;background-color:rgb(21 24 35 / var(--tw-bg-opacity))}.bg-\\[\\#1b2030\\]{--tw-bg-opacity: 1;background-color:rgb(27 32 48 / var(--tw-bg-opacity))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-black\\/60{background-color:#0009}.bg-black\\/70{background-color:#000000b3}.bg-black\\/90{background-color:#000000e6}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-white\\/10{background-color:#ffffff1a}.bg-white\\/30{background-color:#ffffff4d}.bg-white\\/5{background-color:#ffffff0d}.bg-white\\/80{background-color:#fffc}.bg-opacity-50{--tw-bg-opacity: .5}.bg-opacity-90{--tw-bg-opacity: .9}.bg-right{background-position:right}.bg-no-repeat{background-repeat:no-repeat}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-0{padding-top:0;padding-bottom:0}.py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-1{padding-bottom:.25rem}.pb-12{padding-bottom:3rem}.pb-2{padding-bottom:.5rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pr-0{padding-right:0}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-5{padding-right:1.25rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.align-middle{vertical-align:middle}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\\[clamp\\(0\\.75rem\\,2vw\\,1rem\\)\\]{font-size:clamp(.75rem,2vw,1rem)}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-tight{line-height:1.25}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.accent-\\[\\#00965f\\]{accent-color:#00965f}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-80{opacity:.8}.opacity-85{opacity:.85}.opacity-90{opacity:.9}.opacity-95{opacity:.95}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[2px_3px_8px_rgba\\(0\\,0\\,0\\,0\\.4\\)\\]{--tw-shadow: 2px 3px 8px rgba(0,0,0,.4);--tw-shadow-colored: 2px 3px 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[inset_0_0_0_1px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow: inset 0 0 0 1px rgba(0,0,0,.25);--tw-shadow-colored: inset 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.will-change-transform{will-change:transform}#root{width:100%;max-width:100%;min-width:320px}@keyframes puff-in-center{0%{transform:scale(5);filter:blur(4px);fill-opacity:0;stroke-opacity:0}to{transform:scale(1);filter:blur(0px);fill-opacity:1;stroke-opacity:1}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes move{to{transform:translateY(15px)}}@media (min-width: 640px){.tooltipmedia{visibility:visible}}@media (max-width: 640px){.tooltipmedia{visibility:hidden}th{font-size:12px}.hidewhenmobile{display:none}iframe.wuksD5{width:100%;height:auto}}@media (max-width: 400px){.hidewhenminimobile{display:none}}@keyframes pulse-scale{0%,to{transform:scale(1)}50%{transform:scale(1.1)}}.animate-pulse-scale{animation:pulse-scale 1s ease-in-out infinite}.hover\\:h-9:hover{height:2.25rem}.hover\\:w-9:hover{width:2.25rem}.hover\\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:cursor-pointer:hover{cursor:pointer}.hover\\:bg-black\\/90:hover{background-color:#000000e6}.hover\\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity))}.hover\\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}.hover\\:bg-slate-800\\/50:hover{background-color:#1e293b80}.hover\\:bg-slate-800\\/60:hover{background-color:#1e293b99}.hover\\:bg-white\\/10:hover{background-color:#ffffff1a}.hover\\:bg-white\\/15:hover{background-color:#ffffff26}.hover\\:bg-opacity-75:hover{--tw-bg-opacity: .75}.hover\\:opacity-90:hover{opacity:.9}.hover\\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\\:ring-4:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\\:ring-black\\/10:hover{--tw-ring-color: rgb(0 0 0 / .1)}.focus\\:bg-slate-800\\/60:focus{background-color:#1e293b99}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-blue-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(96 165 250 / var(--tw-ring-opacity))}@media (max-width: 400px){.max-\\[400px\\]\\:w-36{width:9rem}.max-\\[400px\\]\\:-translate-y-8{--tw-translate-y: -2rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.max-\\[400px\\]\\:gap-2{gap:.5rem}.max-\\[400px\\]\\:text-\\[10px\\]{font-size:10px}}@media (min-width: 420px){.min-\\[420px\\]\\:left-\\[20\\%\\]{left:20%}.min-\\[420px\\]\\:top-\\[15\\%\\]{top:15%}.min-\\[420px\\]\\:top-\\[7\\%\\]{top:7%}.min-\\[420px\\]\\:h-\\[60\\%\\]{height:60%}.min-\\[420px\\]\\:w-\\[60\\%\\]{width:60%}}@media (min-width: 640px){.sm\\:bottom-\\[110px\\]{bottom:110px}.sm\\:left-\\[28\\%\\]{left:28%}.sm\\:top-\\[10\\%\\]{top:10%}.sm\\:top-\\[29\\%\\]{top:29%}.sm\\:top-\\[43\\%\\]{top:43%}.sm\\:mb-1{margin-bottom:.25rem}.sm\\:ml-0{margin-left:0}.sm\\:mr-0{margin-right:0}.sm\\:mr-2{margin-right:.5rem}.sm\\:mr-5{margin-right:1.25rem}.sm\\:mt-0{margin-top:0}.sm\\:h-10{height:2.5rem}.sm\\:h-11{height:2.75rem}.sm\\:h-64{height:16rem}.sm\\:h-\\[44\\%\\]{height:44%}.sm\\:h-\\[82px\\]{height:82px}.sm\\:w-10{width:2.5rem}.sm\\:w-52{width:13rem}.sm\\:w-64{width:16rem}.sm\\:w-80{width:20rem}.sm\\:w-\\[44\\%\\]{width:44%}.sm\\:w-\\[82px\\]{width:82px}.sm\\:origin-center{transform-origin:center}.sm\\:-translate-y-16{--tw-translate-y: -4rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\\:scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\\:transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\\:flex-row{flex-direction:row}.sm\\:gap-2{gap:.5rem}.sm\\:gap-24{gap:6rem}.sm\\:border-t-0{border-top-width:0px}.sm\\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\\:py-1{padding-top:.25rem;padding-bottom:.25rem}.sm\\:text-base{font-size:1rem;line-height:1.5rem}.sm\\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:text-xs{font-size:.75rem;line-height:1rem}.sm\\:transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.sm\\:duration-100{transition-duration:.1s}.sm\\:hover\\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\\:hover\\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}}@media (min-width: 768px){.md\\:absolute{position:absolute}.md\\:inset-x-2{left:.5rem;right:.5rem}.md\\:bottom-2{bottom:.5rem}.md\\:left-1\\/2{left:50%}.md\\:left-2{left:.5rem}.md\\:left-9{left:2.25rem}.md\\:top-2{top:.5rem}.md\\:top-28{top:7rem}.md\\:top-4{top:1rem}.md\\:top-9{top:2.25rem}.md\\:z-50{z-index:50}.md\\:mr-5{margin-right:1.25rem}.md\\:block{display:block}.md\\:hidden{display:none}.md\\:h-\\[80vh\\]{height:80vh}.md\\:h-\\[82px\\]{height:82px}.md\\:w-36{width:9rem}.md\\:w-\\[220px\\]{width:220px}.md\\:w-\\[82px\\]{width:82px}.md\\:min-w-\\[600px\\]{min-width:600px}.md\\:max-w-7xl{max-width:80rem}.md\\:-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:flex-row{flex-direction:row}.md\\:space-x-\\[6px\\]>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(6px * var(--tw-space-x-reverse));margin-left:calc(6px * calc(1 - var(--tw-space-x-reverse)))}.md\\:overflow-hidden{overflow:hidden}.md\\:rounded-lg{border-radius:.5rem}.md\\:rounded-xl{border-radius:.75rem}.md\\:border{border-width:1px}.md\\:border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity))}.md\\:bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.md\\:bg-black\\/30{background-color:#0000004d}.md\\:p-4{padding:1rem}.md\\:px-4{padding-left:1rem;padding-right:1rem}.md\\:py-2{padding-top:.5rem;padding-bottom:.5rem}.md\\:text-2xl{font-size:1.5rem;line-height:2rem}.md\\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 1024px){.lg\\:block{display:block}.lg\\:\\[grid-template-columns\\:280px_1fr\\]{grid-template-columns:280px 1fr}}@media (prefers-color-scheme: dark){.dark\\:bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}}`,nC=`.view360-container{position:relative;touch-action:pan-y;overflow:hidden}.view360-canvas{position:absolute;left:0;top:0;width:100%;height:100%;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.view360-canvas.ctx-lost{text-indent:.001px}.view360-container.is-1by1,.view360-container.is-square{padding-top:100%}.view360-container.is-5by4{padding-top:80%}.view360-container.is-4by3{padding-top:75%}.view360-container.is-3by2{padding-top:66.6666%}.view360-container.is-5by3{padding-top:60%}.view360-container.is-16by9{padding-top:56.25%}.view360-container.is-2by1{padding-top:50%}.view360-container.is-3by1{padding-top:33.3333%}.view360-container.is-4by5{padding-top:125%}.view360-container.is-3by4{padding-top:133.3333%}.view360-container.is-2by3{padding-top:150%}.view360-container.is-3by5{padding-top:166.6666%}.view360-container.is-9by16{padding-top:177.7777%}.view360-container.is-1by2{padding-top:200%}.view360-container.is-1by3{padding-top:300%}.view360-container:-webkit-full-screen{padding-top:0}.view360-container:fullscreen{padding-top:0}.view360-controls{position:absolute;top:0;left:0;width:100%;height:100%;padding:0;margin:0;border:0;pointer-events:none;-webkit-user-select:none;user-select:none;-webkit-user-drag:none;z-index:1}.view360-main.view360-vr-presenting .view360-controls{display:none}.view360-controls-float-left,.view360-controls-float-right{position:absolute;display:flex;flex-direction:column}.view360-controls-float-left{left:0;top:0}.view360-controls-float-right{right:0;top:0}.view360-controls-main{position:absolute;bottom:0;left:0;width:100%;opacity:1;transition:none}.view360-controls-main.view360-controls-hidden{opacity:0;transition:opacity .5s}.view360-controls-main.view360-controls-hidden *{pointer-events:none}.view360-controls-main.view360-controls-fixed{opacity:1}.view360-controls-background{width:100%;height:calc(100% + 32px);position:absolute;left:0;bottom:0;background-image:linear-gradient(0deg,#323232,#32323200)}.view360-controls-background.view360-controls-hidden{display:none}.view360-controls-mid{display:flex;flex-direction:row;position:relative}.view360-controls-left{display:flex;flex:1;justify-content:flex-start;align-items:center;flex-direction:row}.view360-controls-right,.view360-controls-bottom{display:flex;align-items:center;flex-direction:row}.view360-controls-button{display:inline-block;background-color:transparent;cursor:pointer;border:0;position:relative;background-size:24px 24px;background-origin:content-box;background-repeat:no-repeat;box-sizing:border-box;pointer-events:all;border-radius:20px;transition:opacity .25s;width:40px;height:40px;margin:6px;padding:8px;opacity:.8}.view360-controls-button:hover{opacity:1}.view360-controls-button.view360-controls-vr{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='48' width='48' viewBox='0 0 100 100'%3E%3Cg%3E%3Cpath d='M5,30 L95,30 L95,80 L55,80 L50,70 L45,80 L5,80 L5,30' fill='transparent' stroke='%23fff' stroke-width='8' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M5,30 L15,10 L85,10 L95,30' fill='transparent' stroke='%23fff' stroke-width='8' stroke-linejoin='round' stroke-linecap='round'/%3E%3Ccircle cx='30' cy='55' r='10' stroke='%23fff' stroke-width='8' fill='transparent' /%3E%3Ccircle cx='70' cy='55' r='10' stroke='%23fff' stroke-width='8' fill='transparent' /%3E%3C/g%3E%3C/svg%3E")}.view360-controls-button.view360-controls-play{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' stroke-width='2' stroke='%23fff' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M7 4v16l13 -8z'%3E%3C/path%3E%3C/svg%3E")}.view360-controls-button.view360-controls-pause{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' stroke-width='2' stroke='%23fff' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Crect x='6' y='5' width='4' height='14' rx='1'%3E%3C/rect%3E%3Crect x='14' y='5' width='4' height='14' rx='1'%3E%3C/rect%3E%3C/svg%3E")}.view360-controls-button.view360-controls-unmuted{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' stroke-width='2' stroke='%23fff' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M15 8a5 5 0 0 1 0 8'%3E%3C/path%3E%3Cpath d='M17.7 5a9 9 0 0 1 0 14'%3E%3C/path%3E%3Cpath d='M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a0.8 .8 0 0 1 1.5 .5v14a0.8 .8 0 0 1 -1.5 .5l-3.5 -4.5'%3E%3C/path%3E%3C/svg%3E")}.view360-controls-button.view360-controls-muted{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' stroke-width='2' stroke='%23fff' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a0.8 .8 0 0 1 1.5 .5v14a0.8 .8 0 0 1 -1.5 .5l-3.5 -4.5'%3E%3C/path%3E%3Cpath d='M16 10l4 4m0 -4l-4 4'%3E%3C/path%3E%3C/svg%3E")}.view360-controls-button.view360-controls-fullscreen{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' stroke-width='2' stroke='%23fff' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M4 8v-2a2 2 0 0 1 2 -2h2'%3E%3C/path%3E%3Cpath d='M4 16v2a2 2 0 0 0 2 2h2'%3E%3C/path%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v2'%3E%3C/path%3E%3Cpath d='M16 20h2a2 2 0 0 0 2 -2v-2'%3E%3C/path%3E%3C/svg%3E")}.view360-controls-button.view360-controls-fullscreen-exit{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' stroke-width='2' stroke='%23fff' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M15 19v-2a2 2 0 0 1 2 -2h2'%3E%3C/path%3E%3Cpath d='M15 5v2a2 2 0 0 0 2 2h2'%3E%3C/path%3E%3Cpath d='M5 15h2a2 2 0 0 1 2 2v2'%3E%3C/path%3E%3Cpath d='M5 9h2a2 2 0 0 0 2 -2v-2'%3E%3C/path%3E%3C/svg%3E")}.view360-controls-button.view360-controls-gyro-enabled{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='48' width='48'%3E%3Cpath fill='%23fff' d='M22.5 7.6v2.95q-1 .15-1.975.475-.975.325-1.875.825L16.5 9.7q1.35-.9 2.875-1.4 1.525-.5 3.125-.7Zm15.35 15.35q-.2 1.6-.7 3.125-.5 1.525-1.4 2.875L33.6 26.8q.5-.9.825-1.875.325-.975.475-1.975Zm3.8 20.45L1.3 3.05 3.45.9 43.8 41.25ZM7 41.4q-1.25 0-2.125-.875T4 38.4v-8.6h3v8.6h8.6v3ZM41 13V4.4h-8.6v-3H41q1.25 0 2.125.875T44 4.4V13ZM4 13V4.4q0-.55.2-1.1t.6-1l2.1 2.1V13Zm28.4 28.4v-3h8.5l2.1 2.1q-.4.45-.925.675-.525.225-1.075.225Zm-21.2-37-3-3h7.4v3ZM44 37.2l-3-3v-4.4h3ZM10.15 22.95h2.95q.5 3.7 3.1 6.3 2.6 2.6 6.3 3.1v2.95q-4.9-.55-8.35-4-3.45-3.45-4-8.35Zm4-11.35 2.1 2.05q-1.3 1.3-2.1 2.9-.8 1.6-1.05 3.4h-2.95q.25-2.4 1.275-4.525Q12.45 13.3 14.15 11.6ZM31.8 29.2l2.05 2.1q-1.7 1.7-3.825 2.725Q27.9 35.05 25.5 35.3v-2.95q1.8-.25 3.4-1.05 1.6-.8 2.9-2.1ZM25.5 7.6q4.9.55 8.35 4 3.45 3.45 4 8.35H34.9q-.5-3.7-3.1-6.3-2.6-2.6-6.3-3.1Z'/%3E%3C/svg%3E")}.view360-controls-button.view360-controls-gyro-disabled{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='48' width='48'%3E%3Cpath fill='%23fff' d='M7 44q-1.2 0-2.1-.9Q4 42.2 4 41v-8.6h3V41h8.6v3ZM4 15.6V7q0-1.2.9-2.1Q5.8 4 7 4h8.6v3H7v8.6Zm18.5 22.25q-4.9-.55-8.35-4-3.45-3.45-4-8.35h2.95q.5 3.7 3.125 6.3 2.625 2.6 6.275 3.1ZM10.15 22.5q.55-4.9 4-8.35 3.45-3.45 8.35-4v2.95q-3.7.5-6.3 3.1-2.6 2.6-3.1 6.3Zm13.85 5q-1.45 0-2.475-1.025Q20.5 25.45 20.5 24q0-1.45 1.025-2.475Q22.55 20.5 24 20.5q1.45 0 2.475 1.025Q27.5 22.55 27.5 24q0 1.45-1.025 2.475Q25.45 27.5 24 27.5Zm1.5 10.35V34.9q3.7-.5 6.3-3.125 2.6-2.625 3.1-6.275h2.95q-.55 4.9-4 8.35-3.45 3.45-8.35 4Zm9.4-15.35q-.5-3.7-3.1-6.3-2.6-2.6-6.3-3.1v-2.95q4.9.55 8.35 4 3.45 3.45 4 8.35ZM32.4 44v-3H41v-8.6h3V41q0 1.2-.9 2.1-.9.9-2.1.9ZM41 15.6V7h-8.6V4H41q1.2 0 2.1.9.9.9.9 2.1v8.6Z'/%3E%3C/svg%3E")}.view360-controls-time{display:inline-block;vertical-align:top;white-space:nowrap;color:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;font-weight:400;font-size:14px;z-index:1}.view360-controls-time:first-child{padding:0 16px}.view360-controls-progress{flex:1;width:100%;padding:0 16px;box-sizing:border-box}.view360-controls-progress:not(:first-child){padding-left:0}.view360-controls-bottom .view360-controls-progress{padding-bottom:20px}.view360-controls-volume{display:inline-flex;flex-direction:row;align-items:center;transition:width .25s,background-color .25s;overflow:hidden}.view360-controls-volume:not(:disabled).view360-controls-fixed,.view360-controls-volume:not(:disabled):hover{width:112px}.view360-controls-volume .view360-range{flex:1;height:100%;padding:0}.view360-controls-volume .view360-range .view360-range-track{width:calc(100% - 12px);transform:translate(-4px)}.view360-controls-volume .view360-controls-button{margin:0;padding:0;width:24px;height:24px;flex-shrink:0}.view360-controls-volume:disabled{opacity:.5;pointer-events:none}.view360-controls-volume:disabled *{pointer-events:none}.view360-controls-pie{width:36px;height:36px;margin:6px;padding:0;border-radius:18px;opacity:.8;pointer-events:all;cursor:pointer;color:#fff;position:relative;transition:opacity .25s}.view360-controls-pie>svg{position:absolute;top:0;left:0;width:100%;height:100%}.view360-controls-pie:hover{opacity:1}.view360-range{position:relative;cursor:pointer;pointer-events:all;display:flex;justify-content:center;align-items:center;touch-action:pan-y}.view360-range:hover .view360-range-thumb{opacity:1}.view360-range-track{width:100%;height:4px;border-radius:4px;position:relative;background-color:#e6e6e666}.view360-range-filler,.view360-range-load{position:absolute;left:0;top:0;width:0;height:100%;border-radius:4px}.view360-range-filler{background-color:#fff}.view360-range-load{background-color:#757575}.view360-range-thumb{width:13px;height:13px;position:absolute;top:-5px;left:-6.5px;border-radius:50%;background-color:#fff;box-sizing:border-box;transition:opacity .25s;opacity:0}.view360-range-thumb.view360-controls-fixed{opacity:1}.view360-controls-unavailable{display:none!important}@media screen and (max-width:768px){.view360-controls-button{background-size:18px 18px;width:30px;height:30px;margin:4.5px;padding:6px;border-radius:15px}.view360-controls-volume .view360-controls-button{width:18px;height:18px}.view360-controls-volume:not(:disabled).view360-controls-fixed,.view360-controls-volume:not(:disabled):hover{width:84px}.view360-controls-pie{width:27px;height:27px;margin:4.5px;padding:0;border-radius:13.5px}}.view360-spinner{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;background-color:#00000026}.view360-spinner-ring{top:0;left:0;padding:0;margin:0;width:64px;height:64px;box-sizing:content-box;background-color:transparent;border-style:solid;border-radius:50%;border-width:10px;border-color:#fff;border-bottom-color:transparent;animation:view360-spin-animation 1.2s linear infinite}@keyframes view360-spin-animation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.view360-container.view360-vr-presenting{width:100vw;height:100vh;position:fixed;left:0;top:0;z-index:9999}.view360-hotspots{width:100%;height:100%;position:absolute;top:0;left:0;pointer-events:none}.view360-hotspot{pointer-events:none;visibility:hidden;position:absolute;top:0;left:0}.view360-hotspot-visible{visibility:visible;pointer-events:all}`,rC=["company","sitename","view","max-width","height","max-table-height"],GU=(()=>{const t=document.currentScript;return t!=null&&t.src?new URL("/",t.src).toString():"/"})();class WU extends HTMLElement{constructor(){super(...arguments);Zn(this,"root");Zn(this,"shadow");Zn(this,"props",{})}static get observedAttributes(){return rC}connectedCallback(){var i;this.setAttribute("pintarstudios-webtools-widget","1"),this.shadow=this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=tC+nC,this.shadow.appendChild(n);const r=document.createElement("div");if(r.setAttribute("part","wrapper"),this.shadow.appendChild(r),!window.__PintarStudiosModalMount){const s=document.createElement("div");s.id="pintarstudios-panorama-host",document.body.appendChild(s);const o=s.attachShadow({mode:"open"}),a=document.createElement("style");a.textContent=tC+nC,o.appendChild(a);const l=document.createElement("div");o.appendChild(l),window.__PintarStudiosModalMount=o}for(const s of rC){const o=(i=this.getAttribute(s))!=null?i:void 0;this.props[s]=o}this.root=iE(r),this.render(),this.dispatchEvent(new CustomEvent("mytool:ready",{bubbles:!0}))}attributeChangedCallback(n,r,i){this.props[n]=i!=null?i:void 0,this.render()}disconnectedCallback(){var n;(n=this.root)==null||n.unmount(),this.root=void 0}render(){var n;this.root&&this.root.render(p.jsx(zU,{company:this.props.company,sitename:this.props.sitename,view:this.props.view,maxWidth:this.props["max-width"],maxTableHeight:this.props["max-table-height"],height:this.props.height,shadowRootRef:(n=this.shadow)!=null?n:null,assetBase:GU}))}}customElements.define("pintar-studios-webtools",WU),window.MyToolWidget={version:"1.0.3"}})();
